Skip to main content

github_copilot_sdk/generated/
rpc.rs

1//! Auto-generated typed JSON-RPC namespace — do not edit manually.
2//!
3//! Generated from `api.schema.json` by `scripts/codegen/rust.ts`. The
4//! [`ClientRpc`] and [`SessionRpc`] view structs let callers reach every
5//! protocol method through a typed namespace tree, so wire method names
6//! and request/response shapes live in exactly one place — this file.
7
8#![allow(missing_docs)]
9#![allow(clippy::too_many_arguments)]
10
11use super::api_types::{rpc_methods, *};
12use crate::session::Session;
13use crate::{Client, Error};
14
15/// Typed view over the [`Client`]'s server-level RPC namespace.
16#[derive(Clone, Copy)]
17pub struct ClientRpc<'a> {
18    pub(crate) client: &'a Client,
19}
20
21impl<'a> ClientRpc<'a> {
22    /// `account.*` sub-namespace.
23    pub fn account(&self) -> ClientRpcAccount<'a> {
24        ClientRpcAccount {
25            client: self.client,
26        }
27    }
28
29    /// `mcp.*` sub-namespace.
30    pub fn mcp(&self) -> ClientRpcMcp<'a> {
31        ClientRpcMcp {
32            client: self.client,
33        }
34    }
35
36    /// `models.*` sub-namespace.
37    pub fn models(&self) -> ClientRpcModels<'a> {
38        ClientRpcModels {
39            client: self.client,
40        }
41    }
42
43    /// `sessionFs.*` sub-namespace.
44    pub fn session_fs(&self) -> ClientRpcSessionFs<'a> {
45        ClientRpcSessionFs {
46            client: self.client,
47        }
48    }
49
50    /// `sessions.*` sub-namespace.
51    pub fn sessions(&self) -> ClientRpcSessions<'a> {
52        ClientRpcSessions {
53            client: self.client,
54        }
55    }
56
57    /// `skills.*` sub-namespace.
58    pub fn skills(&self) -> ClientRpcSkills<'a> {
59        ClientRpcSkills {
60            client: self.client,
61        }
62    }
63
64    /// `tools.*` sub-namespace.
65    pub fn tools(&self) -> ClientRpcTools<'a> {
66        ClientRpcTools {
67            client: self.client,
68        }
69    }
70
71    /// Wire method: `ping`.
72    pub async fn ping(&self, params: PingRequest) -> Result<PingResult, Error> {
73        let wire_params = serde_json::to_value(params)?;
74        let _value = self
75            .client
76            .call(rpc_methods::PING, Some(wire_params))
77            .await?;
78        Ok(serde_json::from_value(_value)?)
79    }
80
81    /// Wire method: `connect`.
82    pub async fn connect(&self, params: ConnectRequest) -> Result<ConnectResult, Error> {
83        let wire_params = serde_json::to_value(params)?;
84        let _value = self
85            .client
86            .call(rpc_methods::CONNECT, Some(wire_params))
87            .await?;
88        Ok(serde_json::from_value(_value)?)
89    }
90}
91
92/// `account.*` RPCs.
93#[derive(Clone, Copy)]
94pub struct ClientRpcAccount<'a> {
95    pub(crate) client: &'a Client,
96}
97
98impl<'a> ClientRpcAccount<'a> {
99    /// Wire method: `account.getQuota`.
100    pub async fn get_quota(&self) -> Result<AccountGetQuotaResult, Error> {
101        let wire_params = serde_json::json!({});
102        let _value = self
103            .client
104            .call(rpc_methods::ACCOUNT_GETQUOTA, Some(wire_params))
105            .await?;
106        Ok(serde_json::from_value(_value)?)
107    }
108}
109
110/// `mcp.*` RPCs.
111#[derive(Clone, Copy)]
112pub struct ClientRpcMcp<'a> {
113    pub(crate) client: &'a Client,
114}
115
116impl<'a> ClientRpcMcp<'a> {
117    /// `mcp.config.*` sub-namespace.
118    pub fn config(&self) -> ClientRpcMcpConfig<'a> {
119        ClientRpcMcpConfig {
120            client: self.client,
121        }
122    }
123
124    /// Wire method: `mcp.discover`.
125    pub async fn discover(&self, params: McpDiscoverRequest) -> Result<McpDiscoverResult, Error> {
126        let wire_params = serde_json::to_value(params)?;
127        let _value = self
128            .client
129            .call(rpc_methods::MCP_DISCOVER, Some(wire_params))
130            .await?;
131        Ok(serde_json::from_value(_value)?)
132    }
133}
134
135/// `mcp.config.*` RPCs.
136#[derive(Clone, Copy)]
137pub struct ClientRpcMcpConfig<'a> {
138    pub(crate) client: &'a Client,
139}
140
141impl<'a> ClientRpcMcpConfig<'a> {
142    /// Wire method: `mcp.config.list`.
143    pub async fn list(&self) -> Result<McpConfigList, Error> {
144        let wire_params = serde_json::json!({});
145        let _value = self
146            .client
147            .call(rpc_methods::MCP_CONFIG_LIST, Some(wire_params))
148            .await?;
149        Ok(serde_json::from_value(_value)?)
150    }
151
152    /// Wire method: `mcp.config.add`.
153    pub async fn add(&self, params: McpConfigAddRequest) -> Result<(), Error> {
154        let wire_params = serde_json::to_value(params)?;
155        let _value = self
156            .client
157            .call(rpc_methods::MCP_CONFIG_ADD, Some(wire_params))
158            .await?;
159        Ok(())
160    }
161
162    /// Wire method: `mcp.config.update`.
163    pub async fn update(&self, params: McpConfigUpdateRequest) -> Result<(), Error> {
164        let wire_params = serde_json::to_value(params)?;
165        let _value = self
166            .client
167            .call(rpc_methods::MCP_CONFIG_UPDATE, Some(wire_params))
168            .await?;
169        Ok(())
170    }
171
172    /// Wire method: `mcp.config.remove`.
173    pub async fn remove(&self, params: McpConfigRemoveRequest) -> Result<(), Error> {
174        let wire_params = serde_json::to_value(params)?;
175        let _value = self
176            .client
177            .call(rpc_methods::MCP_CONFIG_REMOVE, Some(wire_params))
178            .await?;
179        Ok(())
180    }
181
182    /// Wire method: `mcp.config.enable`.
183    pub async fn enable(&self, params: McpConfigEnableRequest) -> Result<(), Error> {
184        let wire_params = serde_json::to_value(params)?;
185        let _value = self
186            .client
187            .call(rpc_methods::MCP_CONFIG_ENABLE, Some(wire_params))
188            .await?;
189        Ok(())
190    }
191
192    /// Wire method: `mcp.config.disable`.
193    pub async fn disable(&self, params: McpConfigDisableRequest) -> Result<(), Error> {
194        let wire_params = serde_json::to_value(params)?;
195        let _value = self
196            .client
197            .call(rpc_methods::MCP_CONFIG_DISABLE, Some(wire_params))
198            .await?;
199        Ok(())
200    }
201}
202
203/// `models.*` RPCs.
204#[derive(Clone, Copy)]
205pub struct ClientRpcModels<'a> {
206    pub(crate) client: &'a Client,
207}
208
209impl<'a> ClientRpcModels<'a> {
210    /// Wire method: `models.list`.
211    pub async fn list(&self) -> Result<ModelList, Error> {
212        let wire_params = serde_json::json!({});
213        let _value = self
214            .client
215            .call(rpc_methods::MODELS_LIST, Some(wire_params))
216            .await?;
217        Ok(serde_json::from_value(_value)?)
218    }
219}
220
221/// `sessionFs.*` RPCs.
222#[derive(Clone, Copy)]
223pub struct ClientRpcSessionFs<'a> {
224    pub(crate) client: &'a Client,
225}
226
227impl<'a> ClientRpcSessionFs<'a> {
228    /// Wire method: `sessionFs.setProvider`.
229    pub async fn set_provider(
230        &self,
231        params: SessionFsSetProviderRequest,
232    ) -> Result<SessionFsSetProviderResult, Error> {
233        let wire_params = serde_json::to_value(params)?;
234        let _value = self
235            .client
236            .call(rpc_methods::SESSIONFS_SETPROVIDER, Some(wire_params))
237            .await?;
238        Ok(serde_json::from_value(_value)?)
239    }
240}
241
242/// `sessions.*` RPCs.
243#[derive(Clone, Copy)]
244pub struct ClientRpcSessions<'a> {
245    pub(crate) client: &'a Client,
246}
247
248impl<'a> ClientRpcSessions<'a> {
249    /// Wire method: `sessions.fork`.
250    ///
251    /// <div class="warning">
252    ///
253    /// **Experimental.** This API is part of an experimental wire-protocol surface
254    /// and may change or be removed in future SDK or CLI releases. Pin both the
255    /// SDK and CLI versions if your code depends on it.
256    ///
257    /// </div>
258    pub async fn fork(&self, params: SessionsForkRequest) -> Result<SessionsForkResult, Error> {
259        let wire_params = serde_json::to_value(params)?;
260        let _value = self
261            .client
262            .call(rpc_methods::SESSIONS_FORK, Some(wire_params))
263            .await?;
264        Ok(serde_json::from_value(_value)?)
265    }
266}
267
268/// `skills.*` RPCs.
269#[derive(Clone, Copy)]
270pub struct ClientRpcSkills<'a> {
271    pub(crate) client: &'a Client,
272}
273
274impl<'a> ClientRpcSkills<'a> {
275    /// `skills.config.*` sub-namespace.
276    pub fn config(&self) -> ClientRpcSkillsConfig<'a> {
277        ClientRpcSkillsConfig {
278            client: self.client,
279        }
280    }
281
282    /// Wire method: `skills.discover`.
283    pub async fn discover(&self, params: SkillsDiscoverRequest) -> Result<ServerSkillList, Error> {
284        let wire_params = serde_json::to_value(params)?;
285        let _value = self
286            .client
287            .call(rpc_methods::SKILLS_DISCOVER, Some(wire_params))
288            .await?;
289        Ok(serde_json::from_value(_value)?)
290    }
291}
292
293/// `skills.config.*` RPCs.
294#[derive(Clone, Copy)]
295pub struct ClientRpcSkillsConfig<'a> {
296    pub(crate) client: &'a Client,
297}
298
299impl<'a> ClientRpcSkillsConfig<'a> {
300    /// Wire method: `skills.config.setDisabledSkills`.
301    pub async fn set_disabled_skills(
302        &self,
303        params: SkillsConfigSetDisabledSkillsRequest,
304    ) -> Result<(), Error> {
305        let wire_params = serde_json::to_value(params)?;
306        let _value = self
307            .client
308            .call(
309                rpc_methods::SKILLS_CONFIG_SETDISABLEDSKILLS,
310                Some(wire_params),
311            )
312            .await?;
313        Ok(())
314    }
315}
316
317/// `tools.*` RPCs.
318#[derive(Clone, Copy)]
319pub struct ClientRpcTools<'a> {
320    pub(crate) client: &'a Client,
321}
322
323impl<'a> ClientRpcTools<'a> {
324    /// Wire method: `tools.list`.
325    pub async fn list(&self, params: ToolsListRequest) -> Result<ToolList, Error> {
326        let wire_params = serde_json::to_value(params)?;
327        let _value = self
328            .client
329            .call(rpc_methods::TOOLS_LIST, Some(wire_params))
330            .await?;
331        Ok(serde_json::from_value(_value)?)
332    }
333}
334
335/// Typed view over a [`Session`]'s RPC namespace.
336#[derive(Clone, Copy)]
337pub struct SessionRpc<'a> {
338    pub(crate) session: &'a Session,
339}
340
341impl<'a> SessionRpc<'a> {
342    /// `session.agent.*` sub-namespace.
343    pub fn agent(&self) -> SessionRpcAgent<'a> {
344        SessionRpcAgent {
345            session: self.session,
346        }
347    }
348
349    /// `session.auth.*` sub-namespace.
350    pub fn auth(&self) -> SessionRpcAuth<'a> {
351        SessionRpcAuth {
352            session: self.session,
353        }
354    }
355
356    /// `session.commands.*` sub-namespace.
357    pub fn commands(&self) -> SessionRpcCommands<'a> {
358        SessionRpcCommands {
359            session: self.session,
360        }
361    }
362
363    /// `session.extensions.*` sub-namespace.
364    pub fn extensions(&self) -> SessionRpcExtensions<'a> {
365        SessionRpcExtensions {
366            session: self.session,
367        }
368    }
369
370    /// `session.fleet.*` sub-namespace.
371    pub fn fleet(&self) -> SessionRpcFleet<'a> {
372        SessionRpcFleet {
373            session: self.session,
374        }
375    }
376
377    /// `session.history.*` sub-namespace.
378    pub fn history(&self) -> SessionRpcHistory<'a> {
379        SessionRpcHistory {
380            session: self.session,
381        }
382    }
383
384    /// `session.instructions.*` sub-namespace.
385    pub fn instructions(&self) -> SessionRpcInstructions<'a> {
386        SessionRpcInstructions {
387            session: self.session,
388        }
389    }
390
391    /// `session.mcp.*` sub-namespace.
392    pub fn mcp(&self) -> SessionRpcMcp<'a> {
393        SessionRpcMcp {
394            session: self.session,
395        }
396    }
397
398    /// `session.mode.*` sub-namespace.
399    pub fn mode(&self) -> SessionRpcMode<'a> {
400        SessionRpcMode {
401            session: self.session,
402        }
403    }
404
405    /// `session.model.*` sub-namespace.
406    pub fn model(&self) -> SessionRpcModel<'a> {
407        SessionRpcModel {
408            session: self.session,
409        }
410    }
411
412    /// `session.name.*` sub-namespace.
413    pub fn name(&self) -> SessionRpcName<'a> {
414        SessionRpcName {
415            session: self.session,
416        }
417    }
418
419    /// `session.permissions.*` sub-namespace.
420    pub fn permissions(&self) -> SessionRpcPermissions<'a> {
421        SessionRpcPermissions {
422            session: self.session,
423        }
424    }
425
426    /// `session.plan.*` sub-namespace.
427    pub fn plan(&self) -> SessionRpcPlan<'a> {
428        SessionRpcPlan {
429            session: self.session,
430        }
431    }
432
433    /// `session.plugins.*` sub-namespace.
434    pub fn plugins(&self) -> SessionRpcPlugins<'a> {
435        SessionRpcPlugins {
436            session: self.session,
437        }
438    }
439
440    /// `session.remote.*` sub-namespace.
441    pub fn remote(&self) -> SessionRpcRemote<'a> {
442        SessionRpcRemote {
443            session: self.session,
444        }
445    }
446
447    /// `session.shell.*` sub-namespace.
448    pub fn shell(&self) -> SessionRpcShell<'a> {
449        SessionRpcShell {
450            session: self.session,
451        }
452    }
453
454    /// `session.skills.*` sub-namespace.
455    pub fn skills(&self) -> SessionRpcSkills<'a> {
456        SessionRpcSkills {
457            session: self.session,
458        }
459    }
460
461    /// `session.tasks.*` sub-namespace.
462    pub fn tasks(&self) -> SessionRpcTasks<'a> {
463        SessionRpcTasks {
464            session: self.session,
465        }
466    }
467
468    /// `session.tools.*` sub-namespace.
469    pub fn tools(&self) -> SessionRpcTools<'a> {
470        SessionRpcTools {
471            session: self.session,
472        }
473    }
474
475    /// `session.ui.*` sub-namespace.
476    pub fn ui(&self) -> SessionRpcUi<'a> {
477        SessionRpcUi {
478            session: self.session,
479        }
480    }
481
482    /// `session.usage.*` sub-namespace.
483    pub fn usage(&self) -> SessionRpcUsage<'a> {
484        SessionRpcUsage {
485            session: self.session,
486        }
487    }
488
489    /// `session.workspaces.*` sub-namespace.
490    pub fn workspaces(&self) -> SessionRpcWorkspaces<'a> {
491        SessionRpcWorkspaces {
492            session: self.session,
493        }
494    }
495
496    /// Wire method: `session.suspend`.
497    pub async fn suspend(&self) -> Result<(), Error> {
498        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
499        let _value = self
500            .session
501            .client()
502            .call(rpc_methods::SESSION_SUSPEND, Some(wire_params))
503            .await?;
504        Ok(())
505    }
506
507    /// Wire method: `session.log`.
508    pub async fn log(&self, params: LogRequest) -> Result<LogResult, Error> {
509        let mut wire_params = serde_json::to_value(params)?;
510        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
511        let _value = self
512            .session
513            .client()
514            .call(rpc_methods::SESSION_LOG, Some(wire_params))
515            .await?;
516        Ok(serde_json::from_value(_value)?)
517    }
518}
519
520/// `session.agent.*` RPCs.
521#[derive(Clone, Copy)]
522pub struct SessionRpcAgent<'a> {
523    pub(crate) session: &'a Session,
524}
525
526impl<'a> SessionRpcAgent<'a> {
527    /// Wire method: `session.agent.list`.
528    ///
529    /// <div class="warning">
530    ///
531    /// **Experimental.** This API is part of an experimental wire-protocol surface
532    /// and may change or be removed in future SDK or CLI releases. Pin both the
533    /// SDK and CLI versions if your code depends on it.
534    ///
535    /// </div>
536    pub async fn list(&self) -> Result<AgentList, Error> {
537        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
538        let _value = self
539            .session
540            .client()
541            .call(rpc_methods::SESSION_AGENT_LIST, Some(wire_params))
542            .await?;
543        Ok(serde_json::from_value(_value)?)
544    }
545
546    /// Wire method: `session.agent.getCurrent`.
547    ///
548    /// <div class="warning">
549    ///
550    /// **Experimental.** This API is part of an experimental wire-protocol surface
551    /// and may change or be removed in future SDK or CLI releases. Pin both the
552    /// SDK and CLI versions if your code depends on it.
553    ///
554    /// </div>
555    pub async fn get_current(&self) -> Result<AgentGetCurrentResult, Error> {
556        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
557        let _value = self
558            .session
559            .client()
560            .call(rpc_methods::SESSION_AGENT_GETCURRENT, Some(wire_params))
561            .await?;
562        Ok(serde_json::from_value(_value)?)
563    }
564
565    /// Wire method: `session.agent.select`.
566    ///
567    /// <div class="warning">
568    ///
569    /// **Experimental.** This API is part of an experimental wire-protocol surface
570    /// and may change or be removed in future SDK or CLI releases. Pin both the
571    /// SDK and CLI versions if your code depends on it.
572    ///
573    /// </div>
574    pub async fn select(&self, params: AgentSelectRequest) -> Result<AgentSelectResult, Error> {
575        let mut wire_params = serde_json::to_value(params)?;
576        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
577        let _value = self
578            .session
579            .client()
580            .call(rpc_methods::SESSION_AGENT_SELECT, Some(wire_params))
581            .await?;
582        Ok(serde_json::from_value(_value)?)
583    }
584
585    /// Wire method: `session.agent.deselect`.
586    ///
587    /// <div class="warning">
588    ///
589    /// **Experimental.** This API is part of an experimental wire-protocol surface
590    /// and may change or be removed in future SDK or CLI releases. Pin both the
591    /// SDK and CLI versions if your code depends on it.
592    ///
593    /// </div>
594    pub async fn deselect(&self) -> Result<(), Error> {
595        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
596        let _value = self
597            .session
598            .client()
599            .call(rpc_methods::SESSION_AGENT_DESELECT, Some(wire_params))
600            .await?;
601        Ok(())
602    }
603
604    /// Wire method: `session.agent.reload`.
605    ///
606    /// <div class="warning">
607    ///
608    /// **Experimental.** This API is part of an experimental wire-protocol surface
609    /// and may change or be removed in future SDK or CLI releases. Pin both the
610    /// SDK and CLI versions if your code depends on it.
611    ///
612    /// </div>
613    pub async fn reload(&self) -> Result<AgentReloadResult, Error> {
614        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
615        let _value = self
616            .session
617            .client()
618            .call(rpc_methods::SESSION_AGENT_RELOAD, Some(wire_params))
619            .await?;
620        Ok(serde_json::from_value(_value)?)
621    }
622}
623
624/// `session.auth.*` RPCs.
625#[derive(Clone, Copy)]
626pub struct SessionRpcAuth<'a> {
627    pub(crate) session: &'a Session,
628}
629
630impl<'a> SessionRpcAuth<'a> {
631    /// Wire method: `session.auth.getStatus`.
632    pub async fn get_status(&self) -> Result<SessionAuthStatus, Error> {
633        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
634        let _value = self
635            .session
636            .client()
637            .call(rpc_methods::SESSION_AUTH_GETSTATUS, Some(wire_params))
638            .await?;
639        Ok(serde_json::from_value(_value)?)
640    }
641}
642
643/// `session.commands.*` RPCs.
644#[derive(Clone, Copy)]
645pub struct SessionRpcCommands<'a> {
646    pub(crate) session: &'a Session,
647}
648
649impl<'a> SessionRpcCommands<'a> {
650    /// Wire method: `session.commands.handlePendingCommand`.
651    pub async fn handle_pending_command(
652        &self,
653        params: CommandsHandlePendingCommandRequest,
654    ) -> Result<CommandsHandlePendingCommandResult, Error> {
655        let mut wire_params = serde_json::to_value(params)?;
656        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
657        let _value = self
658            .session
659            .client()
660            .call(
661                rpc_methods::SESSION_COMMANDS_HANDLEPENDINGCOMMAND,
662                Some(wire_params),
663            )
664            .await?;
665        Ok(serde_json::from_value(_value)?)
666    }
667
668    /// Wire method: `session.commands.respondToQueuedCommand`.
669    pub async fn respond_to_queued_command(
670        &self,
671        params: CommandsRespondToQueuedCommandRequest,
672    ) -> Result<CommandsRespondToQueuedCommandResult, Error> {
673        let mut wire_params = serde_json::to_value(params)?;
674        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
675        let _value = self
676            .session
677            .client()
678            .call(
679                rpc_methods::SESSION_COMMANDS_RESPONDTOQUEUEDCOMMAND,
680                Some(wire_params),
681            )
682            .await?;
683        Ok(serde_json::from_value(_value)?)
684    }
685}
686
687/// `session.extensions.*` RPCs.
688#[derive(Clone, Copy)]
689pub struct SessionRpcExtensions<'a> {
690    pub(crate) session: &'a Session,
691}
692
693impl<'a> SessionRpcExtensions<'a> {
694    /// Wire method: `session.extensions.list`.
695    ///
696    /// <div class="warning">
697    ///
698    /// **Experimental.** This API is part of an experimental wire-protocol surface
699    /// and may change or be removed in future SDK or CLI releases. Pin both the
700    /// SDK and CLI versions if your code depends on it.
701    ///
702    /// </div>
703    pub async fn list(&self) -> Result<ExtensionList, Error> {
704        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
705        let _value = self
706            .session
707            .client()
708            .call(rpc_methods::SESSION_EXTENSIONS_LIST, Some(wire_params))
709            .await?;
710        Ok(serde_json::from_value(_value)?)
711    }
712
713    /// Wire method: `session.extensions.enable`.
714    ///
715    /// <div class="warning">
716    ///
717    /// **Experimental.** This API is part of an experimental wire-protocol surface
718    /// and may change or be removed in future SDK or CLI releases. Pin both the
719    /// SDK and CLI versions if your code depends on it.
720    ///
721    /// </div>
722    pub async fn enable(&self, params: ExtensionsEnableRequest) -> Result<(), Error> {
723        let mut wire_params = serde_json::to_value(params)?;
724        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
725        let _value = self
726            .session
727            .client()
728            .call(rpc_methods::SESSION_EXTENSIONS_ENABLE, Some(wire_params))
729            .await?;
730        Ok(())
731    }
732
733    /// Wire method: `session.extensions.disable`.
734    ///
735    /// <div class="warning">
736    ///
737    /// **Experimental.** This API is part of an experimental wire-protocol surface
738    /// and may change or be removed in future SDK or CLI releases. Pin both the
739    /// SDK and CLI versions if your code depends on it.
740    ///
741    /// </div>
742    pub async fn disable(&self, params: ExtensionsDisableRequest) -> Result<(), Error> {
743        let mut wire_params = serde_json::to_value(params)?;
744        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
745        let _value = self
746            .session
747            .client()
748            .call(rpc_methods::SESSION_EXTENSIONS_DISABLE, Some(wire_params))
749            .await?;
750        Ok(())
751    }
752
753    /// Wire method: `session.extensions.reload`.
754    ///
755    /// <div class="warning">
756    ///
757    /// **Experimental.** This API is part of an experimental wire-protocol surface
758    /// and may change or be removed in future SDK or CLI releases. Pin both the
759    /// SDK and CLI versions if your code depends on it.
760    ///
761    /// </div>
762    pub async fn reload(&self) -> Result<(), Error> {
763        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
764        let _value = self
765            .session
766            .client()
767            .call(rpc_methods::SESSION_EXTENSIONS_RELOAD, Some(wire_params))
768            .await?;
769        Ok(())
770    }
771}
772
773/// `session.fleet.*` RPCs.
774#[derive(Clone, Copy)]
775pub struct SessionRpcFleet<'a> {
776    pub(crate) session: &'a Session,
777}
778
779impl<'a> SessionRpcFleet<'a> {
780    /// Wire method: `session.fleet.start`.
781    ///
782    /// <div class="warning">
783    ///
784    /// **Experimental.** This API is part of an experimental wire-protocol surface
785    /// and may change or be removed in future SDK or CLI releases. Pin both the
786    /// SDK and CLI versions if your code depends on it.
787    ///
788    /// </div>
789    pub async fn start(&self, params: FleetStartRequest) -> Result<FleetStartResult, Error> {
790        let mut wire_params = serde_json::to_value(params)?;
791        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
792        let _value = self
793            .session
794            .client()
795            .call(rpc_methods::SESSION_FLEET_START, Some(wire_params))
796            .await?;
797        Ok(serde_json::from_value(_value)?)
798    }
799}
800
801/// `session.history.*` RPCs.
802#[derive(Clone, Copy)]
803pub struct SessionRpcHistory<'a> {
804    pub(crate) session: &'a Session,
805}
806
807impl<'a> SessionRpcHistory<'a> {
808    /// Wire method: `session.history.compact`.
809    ///
810    /// <div class="warning">
811    ///
812    /// **Experimental.** This API is part of an experimental wire-protocol surface
813    /// and may change or be removed in future SDK or CLI releases. Pin both the
814    /// SDK and CLI versions if your code depends on it.
815    ///
816    /// </div>
817    pub async fn compact(&self) -> Result<HistoryCompactResult, Error> {
818        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
819        let _value = self
820            .session
821            .client()
822            .call(rpc_methods::SESSION_HISTORY_COMPACT, Some(wire_params))
823            .await?;
824        Ok(serde_json::from_value(_value)?)
825    }
826
827    /// Wire method: `session.history.truncate`.
828    ///
829    /// <div class="warning">
830    ///
831    /// **Experimental.** This API is part of an experimental wire-protocol surface
832    /// and may change or be removed in future SDK or CLI releases. Pin both the
833    /// SDK and CLI versions if your code depends on it.
834    ///
835    /// </div>
836    pub async fn truncate(
837        &self,
838        params: HistoryTruncateRequest,
839    ) -> Result<HistoryTruncateResult, Error> {
840        let mut wire_params = serde_json::to_value(params)?;
841        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
842        let _value = self
843            .session
844            .client()
845            .call(rpc_methods::SESSION_HISTORY_TRUNCATE, Some(wire_params))
846            .await?;
847        Ok(serde_json::from_value(_value)?)
848    }
849}
850
851/// `session.instructions.*` RPCs.
852#[derive(Clone, Copy)]
853pub struct SessionRpcInstructions<'a> {
854    pub(crate) session: &'a Session,
855}
856
857impl<'a> SessionRpcInstructions<'a> {
858    /// Wire method: `session.instructions.getSources`.
859    pub async fn get_sources(&self) -> Result<InstructionsGetSourcesResult, Error> {
860        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
861        let _value = self
862            .session
863            .client()
864            .call(
865                rpc_methods::SESSION_INSTRUCTIONS_GETSOURCES,
866                Some(wire_params),
867            )
868            .await?;
869        Ok(serde_json::from_value(_value)?)
870    }
871}
872
873/// `session.mcp.*` RPCs.
874#[derive(Clone, Copy)]
875pub struct SessionRpcMcp<'a> {
876    pub(crate) session: &'a Session,
877}
878
879impl<'a> SessionRpcMcp<'a> {
880    /// `session.mcp.oauth.*` sub-namespace.
881    pub fn oauth(&self) -> SessionRpcMcpOauth<'a> {
882        SessionRpcMcpOauth {
883            session: self.session,
884        }
885    }
886
887    /// Wire method: `session.mcp.list`.
888    ///
889    /// <div class="warning">
890    ///
891    /// **Experimental.** This API is part of an experimental wire-protocol surface
892    /// and may change or be removed in future SDK or CLI releases. Pin both the
893    /// SDK and CLI versions if your code depends on it.
894    ///
895    /// </div>
896    pub async fn list(&self) -> Result<McpServerList, Error> {
897        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
898        let _value = self
899            .session
900            .client()
901            .call(rpc_methods::SESSION_MCP_LIST, Some(wire_params))
902            .await?;
903        Ok(serde_json::from_value(_value)?)
904    }
905
906    /// Wire method: `session.mcp.enable`.
907    ///
908    /// <div class="warning">
909    ///
910    /// **Experimental.** This API is part of an experimental wire-protocol surface
911    /// and may change or be removed in future SDK or CLI releases. Pin both the
912    /// SDK and CLI versions if your code depends on it.
913    ///
914    /// </div>
915    pub async fn enable(&self, params: McpEnableRequest) -> Result<(), Error> {
916        let mut wire_params = serde_json::to_value(params)?;
917        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
918        let _value = self
919            .session
920            .client()
921            .call(rpc_methods::SESSION_MCP_ENABLE, Some(wire_params))
922            .await?;
923        Ok(())
924    }
925
926    /// Wire method: `session.mcp.disable`.
927    ///
928    /// <div class="warning">
929    ///
930    /// **Experimental.** This API is part of an experimental wire-protocol surface
931    /// and may change or be removed in future SDK or CLI releases. Pin both the
932    /// SDK and CLI versions if your code depends on it.
933    ///
934    /// </div>
935    pub async fn disable(&self, params: McpDisableRequest) -> Result<(), Error> {
936        let mut wire_params = serde_json::to_value(params)?;
937        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
938        let _value = self
939            .session
940            .client()
941            .call(rpc_methods::SESSION_MCP_DISABLE, Some(wire_params))
942            .await?;
943        Ok(())
944    }
945
946    /// Wire method: `session.mcp.reload`.
947    ///
948    /// <div class="warning">
949    ///
950    /// **Experimental.** This API is part of an experimental wire-protocol surface
951    /// and may change or be removed in future SDK or CLI releases. Pin both the
952    /// SDK and CLI versions if your code depends on it.
953    ///
954    /// </div>
955    pub async fn reload(&self) -> Result<(), Error> {
956        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
957        let _value = self
958            .session
959            .client()
960            .call(rpc_methods::SESSION_MCP_RELOAD, Some(wire_params))
961            .await?;
962        Ok(())
963    }
964}
965
966/// `session.mcp.oauth.*` RPCs.
967#[derive(Clone, Copy)]
968pub struct SessionRpcMcpOauth<'a> {
969    pub(crate) session: &'a Session,
970}
971
972impl<'a> SessionRpcMcpOauth<'a> {
973    /// Wire method: `session.mcp.oauth.login`.
974    ///
975    /// <div class="warning">
976    ///
977    /// **Experimental.** This API is part of an experimental wire-protocol surface
978    /// and may change or be removed in future SDK or CLI releases. Pin both the
979    /// SDK and CLI versions if your code depends on it.
980    ///
981    /// </div>
982    pub async fn login(&self, params: McpOauthLoginRequest) -> Result<McpOauthLoginResult, Error> {
983        let mut wire_params = serde_json::to_value(params)?;
984        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
985        let _value = self
986            .session
987            .client()
988            .call(rpc_methods::SESSION_MCP_OAUTH_LOGIN, Some(wire_params))
989            .await?;
990        Ok(serde_json::from_value(_value)?)
991    }
992}
993
994/// `session.mode.*` RPCs.
995#[derive(Clone, Copy)]
996pub struct SessionRpcMode<'a> {
997    pub(crate) session: &'a Session,
998}
999
1000impl<'a> SessionRpcMode<'a> {
1001    /// Wire method: `session.mode.get`.
1002    pub async fn get(&self) -> Result<SessionMode, Error> {
1003        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1004        let _value = self
1005            .session
1006            .client()
1007            .call(rpc_methods::SESSION_MODE_GET, Some(wire_params))
1008            .await?;
1009        Ok(serde_json::from_value(_value)?)
1010    }
1011
1012    /// Wire method: `session.mode.set`.
1013    pub async fn set(&self, params: ModeSetRequest) -> Result<(), Error> {
1014        let mut wire_params = serde_json::to_value(params)?;
1015        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1016        let _value = self
1017            .session
1018            .client()
1019            .call(rpc_methods::SESSION_MODE_SET, Some(wire_params))
1020            .await?;
1021        Ok(())
1022    }
1023}
1024
1025/// `session.model.*` RPCs.
1026#[derive(Clone, Copy)]
1027pub struct SessionRpcModel<'a> {
1028    pub(crate) session: &'a Session,
1029}
1030
1031impl<'a> SessionRpcModel<'a> {
1032    /// Wire method: `session.model.getCurrent`.
1033    pub async fn get_current(&self) -> Result<CurrentModel, Error> {
1034        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1035        let _value = self
1036            .session
1037            .client()
1038            .call(rpc_methods::SESSION_MODEL_GETCURRENT, Some(wire_params))
1039            .await?;
1040        Ok(serde_json::from_value(_value)?)
1041    }
1042
1043    /// Wire method: `session.model.switchTo`.
1044    pub async fn switch_to(
1045        &self,
1046        params: ModelSwitchToRequest,
1047    ) -> Result<ModelSwitchToResult, Error> {
1048        let mut wire_params = serde_json::to_value(params)?;
1049        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1050        let _value = self
1051            .session
1052            .client()
1053            .call(rpc_methods::SESSION_MODEL_SWITCHTO, Some(wire_params))
1054            .await?;
1055        Ok(serde_json::from_value(_value)?)
1056    }
1057}
1058
1059/// `session.name.*` RPCs.
1060#[derive(Clone, Copy)]
1061pub struct SessionRpcName<'a> {
1062    pub(crate) session: &'a Session,
1063}
1064
1065impl<'a> SessionRpcName<'a> {
1066    /// Wire method: `session.name.get`.
1067    pub async fn get(&self) -> Result<NameGetResult, Error> {
1068        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1069        let _value = self
1070            .session
1071            .client()
1072            .call(rpc_methods::SESSION_NAME_GET, Some(wire_params))
1073            .await?;
1074        Ok(serde_json::from_value(_value)?)
1075    }
1076
1077    /// Wire method: `session.name.set`.
1078    pub async fn set(&self, params: NameSetRequest) -> Result<(), Error> {
1079        let mut wire_params = serde_json::to_value(params)?;
1080        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1081        let _value = self
1082            .session
1083            .client()
1084            .call(rpc_methods::SESSION_NAME_SET, Some(wire_params))
1085            .await?;
1086        Ok(())
1087    }
1088}
1089
1090/// `session.permissions.*` RPCs.
1091#[derive(Clone, Copy)]
1092pub struct SessionRpcPermissions<'a> {
1093    pub(crate) session: &'a Session,
1094}
1095
1096impl<'a> SessionRpcPermissions<'a> {
1097    /// Wire method: `session.permissions.handlePendingPermissionRequest`.
1098    pub async fn handle_pending_permission_request(
1099        &self,
1100        params: PermissionDecisionRequest,
1101    ) -> Result<PermissionRequestResult, Error> {
1102        let mut wire_params = serde_json::to_value(params)?;
1103        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1104        let _value = self
1105            .session
1106            .client()
1107            .call(
1108                rpc_methods::SESSION_PERMISSIONS_HANDLEPENDINGPERMISSIONREQUEST,
1109                Some(wire_params),
1110            )
1111            .await?;
1112        Ok(serde_json::from_value(_value)?)
1113    }
1114
1115    /// Wire method: `session.permissions.setApproveAll`.
1116    pub async fn set_approve_all(
1117        &self,
1118        params: PermissionsSetApproveAllRequest,
1119    ) -> Result<PermissionsSetApproveAllResult, Error> {
1120        let mut wire_params = serde_json::to_value(params)?;
1121        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1122        let _value = self
1123            .session
1124            .client()
1125            .call(
1126                rpc_methods::SESSION_PERMISSIONS_SETAPPROVEALL,
1127                Some(wire_params),
1128            )
1129            .await?;
1130        Ok(serde_json::from_value(_value)?)
1131    }
1132
1133    /// Wire method: `session.permissions.resetSessionApprovals`.
1134    pub async fn reset_session_approvals(
1135        &self,
1136    ) -> Result<PermissionsResetSessionApprovalsResult, Error> {
1137        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1138        let _value = self
1139            .session
1140            .client()
1141            .call(
1142                rpc_methods::SESSION_PERMISSIONS_RESETSESSIONAPPROVALS,
1143                Some(wire_params),
1144            )
1145            .await?;
1146        Ok(serde_json::from_value(_value)?)
1147    }
1148}
1149
1150/// `session.plan.*` RPCs.
1151#[derive(Clone, Copy)]
1152pub struct SessionRpcPlan<'a> {
1153    pub(crate) session: &'a Session,
1154}
1155
1156impl<'a> SessionRpcPlan<'a> {
1157    /// Wire method: `session.plan.read`.
1158    pub async fn read(&self) -> Result<PlanReadResult, Error> {
1159        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1160        let _value = self
1161            .session
1162            .client()
1163            .call(rpc_methods::SESSION_PLAN_READ, Some(wire_params))
1164            .await?;
1165        Ok(serde_json::from_value(_value)?)
1166    }
1167
1168    /// Wire method: `session.plan.update`.
1169    pub async fn update(&self, params: PlanUpdateRequest) -> Result<(), Error> {
1170        let mut wire_params = serde_json::to_value(params)?;
1171        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1172        let _value = self
1173            .session
1174            .client()
1175            .call(rpc_methods::SESSION_PLAN_UPDATE, Some(wire_params))
1176            .await?;
1177        Ok(())
1178    }
1179
1180    /// Wire method: `session.plan.delete`.
1181    pub async fn delete(&self) -> Result<(), Error> {
1182        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1183        let _value = self
1184            .session
1185            .client()
1186            .call(rpc_methods::SESSION_PLAN_DELETE, Some(wire_params))
1187            .await?;
1188        Ok(())
1189    }
1190}
1191
1192/// `session.plugins.*` RPCs.
1193#[derive(Clone, Copy)]
1194pub struct SessionRpcPlugins<'a> {
1195    pub(crate) session: &'a Session,
1196}
1197
1198impl<'a> SessionRpcPlugins<'a> {
1199    /// Wire method: `session.plugins.list`.
1200    ///
1201    /// <div class="warning">
1202    ///
1203    /// **Experimental.** This API is part of an experimental wire-protocol surface
1204    /// and may change or be removed in future SDK or CLI releases. Pin both the
1205    /// SDK and CLI versions if your code depends on it.
1206    ///
1207    /// </div>
1208    pub async fn list(&self) -> Result<PluginList, Error> {
1209        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1210        let _value = self
1211            .session
1212            .client()
1213            .call(rpc_methods::SESSION_PLUGINS_LIST, Some(wire_params))
1214            .await?;
1215        Ok(serde_json::from_value(_value)?)
1216    }
1217}
1218
1219/// `session.remote.*` RPCs.
1220#[derive(Clone, Copy)]
1221pub struct SessionRpcRemote<'a> {
1222    pub(crate) session: &'a Session,
1223}
1224
1225impl<'a> SessionRpcRemote<'a> {
1226    /// Wire method: `session.remote.enable`.
1227    ///
1228    /// <div class="warning">
1229    ///
1230    /// **Experimental.** This API is part of an experimental wire-protocol surface
1231    /// and may change or be removed in future SDK or CLI releases. Pin both the
1232    /// SDK and CLI versions if your code depends on it.
1233    ///
1234    /// </div>
1235    pub async fn enable(&self) -> Result<RemoteEnableResult, Error> {
1236        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1237        let _value = self
1238            .session
1239            .client()
1240            .call(rpc_methods::SESSION_REMOTE_ENABLE, Some(wire_params))
1241            .await?;
1242        Ok(serde_json::from_value(_value)?)
1243    }
1244
1245    /// Wire method: `session.remote.disable`.
1246    ///
1247    /// <div class="warning">
1248    ///
1249    /// **Experimental.** This API is part of an experimental wire-protocol surface
1250    /// and may change or be removed in future SDK or CLI releases. Pin both the
1251    /// SDK and CLI versions if your code depends on it.
1252    ///
1253    /// </div>
1254    pub async fn disable(&self) -> Result<(), Error> {
1255        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1256        let _value = self
1257            .session
1258            .client()
1259            .call(rpc_methods::SESSION_REMOTE_DISABLE, Some(wire_params))
1260            .await?;
1261        Ok(())
1262    }
1263}
1264
1265/// `session.shell.*` RPCs.
1266#[derive(Clone, Copy)]
1267pub struct SessionRpcShell<'a> {
1268    pub(crate) session: &'a Session,
1269}
1270
1271impl<'a> SessionRpcShell<'a> {
1272    /// Wire method: `session.shell.exec`.
1273    pub async fn exec(&self, params: ShellExecRequest) -> Result<ShellExecResult, Error> {
1274        let mut wire_params = serde_json::to_value(params)?;
1275        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1276        let _value = self
1277            .session
1278            .client()
1279            .call(rpc_methods::SESSION_SHELL_EXEC, Some(wire_params))
1280            .await?;
1281        Ok(serde_json::from_value(_value)?)
1282    }
1283
1284    /// Wire method: `session.shell.kill`.
1285    pub async fn kill(&self, params: ShellKillRequest) -> Result<ShellKillResult, Error> {
1286        let mut wire_params = serde_json::to_value(params)?;
1287        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1288        let _value = self
1289            .session
1290            .client()
1291            .call(rpc_methods::SESSION_SHELL_KILL, Some(wire_params))
1292            .await?;
1293        Ok(serde_json::from_value(_value)?)
1294    }
1295}
1296
1297/// `session.skills.*` RPCs.
1298#[derive(Clone, Copy)]
1299pub struct SessionRpcSkills<'a> {
1300    pub(crate) session: &'a Session,
1301}
1302
1303impl<'a> SessionRpcSkills<'a> {
1304    /// Wire method: `session.skills.list`.
1305    ///
1306    /// <div class="warning">
1307    ///
1308    /// **Experimental.** This API is part of an experimental wire-protocol surface
1309    /// and may change or be removed in future SDK or CLI releases. Pin both the
1310    /// SDK and CLI versions if your code depends on it.
1311    ///
1312    /// </div>
1313    pub async fn list(&self) -> Result<SkillList, Error> {
1314        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1315        let _value = self
1316            .session
1317            .client()
1318            .call(rpc_methods::SESSION_SKILLS_LIST, Some(wire_params))
1319            .await?;
1320        Ok(serde_json::from_value(_value)?)
1321    }
1322
1323    /// Wire method: `session.skills.enable`.
1324    ///
1325    /// <div class="warning">
1326    ///
1327    /// **Experimental.** This API is part of an experimental wire-protocol surface
1328    /// and may change or be removed in future SDK or CLI releases. Pin both the
1329    /// SDK and CLI versions if your code depends on it.
1330    ///
1331    /// </div>
1332    pub async fn enable(&self, params: SkillsEnableRequest) -> Result<(), Error> {
1333        let mut wire_params = serde_json::to_value(params)?;
1334        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1335        let _value = self
1336            .session
1337            .client()
1338            .call(rpc_methods::SESSION_SKILLS_ENABLE, Some(wire_params))
1339            .await?;
1340        Ok(())
1341    }
1342
1343    /// Wire method: `session.skills.disable`.
1344    ///
1345    /// <div class="warning">
1346    ///
1347    /// **Experimental.** This API is part of an experimental wire-protocol surface
1348    /// and may change or be removed in future SDK or CLI releases. Pin both the
1349    /// SDK and CLI versions if your code depends on it.
1350    ///
1351    /// </div>
1352    pub async fn disable(&self, params: SkillsDisableRequest) -> Result<(), Error> {
1353        let mut wire_params = serde_json::to_value(params)?;
1354        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1355        let _value = self
1356            .session
1357            .client()
1358            .call(rpc_methods::SESSION_SKILLS_DISABLE, Some(wire_params))
1359            .await?;
1360        Ok(())
1361    }
1362
1363    /// Wire method: `session.skills.reload`.
1364    ///
1365    /// <div class="warning">
1366    ///
1367    /// **Experimental.** This API is part of an experimental wire-protocol surface
1368    /// and may change or be removed in future SDK or CLI releases. Pin both the
1369    /// SDK and CLI versions if your code depends on it.
1370    ///
1371    /// </div>
1372    pub async fn reload(&self) -> Result<(), Error> {
1373        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1374        let _value = self
1375            .session
1376            .client()
1377            .call(rpc_methods::SESSION_SKILLS_RELOAD, Some(wire_params))
1378            .await?;
1379        Ok(())
1380    }
1381}
1382
1383/// `session.tasks.*` RPCs.
1384#[derive(Clone, Copy)]
1385pub struct SessionRpcTasks<'a> {
1386    pub(crate) session: &'a Session,
1387}
1388
1389impl<'a> SessionRpcTasks<'a> {
1390    /// Wire method: `session.tasks.startAgent`.
1391    ///
1392    /// <div class="warning">
1393    ///
1394    /// **Experimental.** This API is part of an experimental wire-protocol surface
1395    /// and may change or be removed in future SDK or CLI releases. Pin both the
1396    /// SDK and CLI versions if your code depends on it.
1397    ///
1398    /// </div>
1399    pub async fn start_agent(
1400        &self,
1401        params: TasksStartAgentRequest,
1402    ) -> Result<TasksStartAgentResult, Error> {
1403        let mut wire_params = serde_json::to_value(params)?;
1404        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1405        let _value = self
1406            .session
1407            .client()
1408            .call(rpc_methods::SESSION_TASKS_STARTAGENT, Some(wire_params))
1409            .await?;
1410        Ok(serde_json::from_value(_value)?)
1411    }
1412
1413    /// Wire method: `session.tasks.list`.
1414    ///
1415    /// <div class="warning">
1416    ///
1417    /// **Experimental.** This API is part of an experimental wire-protocol surface
1418    /// and may change or be removed in future SDK or CLI releases. Pin both the
1419    /// SDK and CLI versions if your code depends on it.
1420    ///
1421    /// </div>
1422    pub async fn list(&self) -> Result<TaskList, Error> {
1423        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1424        let _value = self
1425            .session
1426            .client()
1427            .call(rpc_methods::SESSION_TASKS_LIST, Some(wire_params))
1428            .await?;
1429        Ok(serde_json::from_value(_value)?)
1430    }
1431
1432    /// Wire method: `session.tasks.promoteToBackground`.
1433    ///
1434    /// <div class="warning">
1435    ///
1436    /// **Experimental.** This API is part of an experimental wire-protocol surface
1437    /// and may change or be removed in future SDK or CLI releases. Pin both the
1438    /// SDK and CLI versions if your code depends on it.
1439    ///
1440    /// </div>
1441    pub async fn promote_to_background(
1442        &self,
1443        params: TasksPromoteToBackgroundRequest,
1444    ) -> Result<TasksPromoteToBackgroundResult, Error> {
1445        let mut wire_params = serde_json::to_value(params)?;
1446        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1447        let _value = self
1448            .session
1449            .client()
1450            .call(
1451                rpc_methods::SESSION_TASKS_PROMOTETOBACKGROUND,
1452                Some(wire_params),
1453            )
1454            .await?;
1455        Ok(serde_json::from_value(_value)?)
1456    }
1457
1458    /// Wire method: `session.tasks.cancel`.
1459    ///
1460    /// <div class="warning">
1461    ///
1462    /// **Experimental.** This API is part of an experimental wire-protocol surface
1463    /// and may change or be removed in future SDK or CLI releases. Pin both the
1464    /// SDK and CLI versions if your code depends on it.
1465    ///
1466    /// </div>
1467    pub async fn cancel(&self, params: TasksCancelRequest) -> Result<TasksCancelResult, Error> {
1468        let mut wire_params = serde_json::to_value(params)?;
1469        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1470        let _value = self
1471            .session
1472            .client()
1473            .call(rpc_methods::SESSION_TASKS_CANCEL, Some(wire_params))
1474            .await?;
1475        Ok(serde_json::from_value(_value)?)
1476    }
1477
1478    /// Wire method: `session.tasks.remove`.
1479    ///
1480    /// <div class="warning">
1481    ///
1482    /// **Experimental.** This API is part of an experimental wire-protocol surface
1483    /// and may change or be removed in future SDK or CLI releases. Pin both the
1484    /// SDK and CLI versions if your code depends on it.
1485    ///
1486    /// </div>
1487    pub async fn remove(&self, params: TasksRemoveRequest) -> Result<TasksRemoveResult, Error> {
1488        let mut wire_params = serde_json::to_value(params)?;
1489        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1490        let _value = self
1491            .session
1492            .client()
1493            .call(rpc_methods::SESSION_TASKS_REMOVE, Some(wire_params))
1494            .await?;
1495        Ok(serde_json::from_value(_value)?)
1496    }
1497
1498    /// Wire method: `session.tasks.sendMessage`.
1499    ///
1500    /// <div class="warning">
1501    ///
1502    /// **Experimental.** This API is part of an experimental wire-protocol surface
1503    /// and may change or be removed in future SDK or CLI releases. Pin both the
1504    /// SDK and CLI versions if your code depends on it.
1505    ///
1506    /// </div>
1507    pub async fn send_message(
1508        &self,
1509        params: TasksSendMessageRequest,
1510    ) -> Result<TasksSendMessageResult, Error> {
1511        let mut wire_params = serde_json::to_value(params)?;
1512        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1513        let _value = self
1514            .session
1515            .client()
1516            .call(rpc_methods::SESSION_TASKS_SENDMESSAGE, Some(wire_params))
1517            .await?;
1518        Ok(serde_json::from_value(_value)?)
1519    }
1520}
1521
1522/// `session.tools.*` RPCs.
1523#[derive(Clone, Copy)]
1524pub struct SessionRpcTools<'a> {
1525    pub(crate) session: &'a Session,
1526}
1527
1528impl<'a> SessionRpcTools<'a> {
1529    /// Wire method: `session.tools.handlePendingToolCall`.
1530    pub async fn handle_pending_tool_call(
1531        &self,
1532        params: HandlePendingToolCallRequest,
1533    ) -> Result<HandlePendingToolCallResult, Error> {
1534        let mut wire_params = serde_json::to_value(params)?;
1535        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1536        let _value = self
1537            .session
1538            .client()
1539            .call(
1540                rpc_methods::SESSION_TOOLS_HANDLEPENDINGTOOLCALL,
1541                Some(wire_params),
1542            )
1543            .await?;
1544        Ok(serde_json::from_value(_value)?)
1545    }
1546}
1547
1548/// `session.ui.*` RPCs.
1549#[derive(Clone, Copy)]
1550pub struct SessionRpcUi<'a> {
1551    pub(crate) session: &'a Session,
1552}
1553
1554impl<'a> SessionRpcUi<'a> {
1555    /// Wire method: `session.ui.elicitation`.
1556    pub async fn elicitation(
1557        &self,
1558        params: UIElicitationRequest,
1559    ) -> Result<UIElicitationResponse, Error> {
1560        let mut wire_params = serde_json::to_value(params)?;
1561        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1562        let _value = self
1563            .session
1564            .client()
1565            .call(rpc_methods::SESSION_UI_ELICITATION, Some(wire_params))
1566            .await?;
1567        Ok(serde_json::from_value(_value)?)
1568    }
1569
1570    /// Wire method: `session.ui.handlePendingElicitation`.
1571    pub async fn handle_pending_elicitation(
1572        &self,
1573        params: UIHandlePendingElicitationRequest,
1574    ) -> Result<UIElicitationResult, Error> {
1575        let mut wire_params = serde_json::to_value(params)?;
1576        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1577        let _value = self
1578            .session
1579            .client()
1580            .call(
1581                rpc_methods::SESSION_UI_HANDLEPENDINGELICITATION,
1582                Some(wire_params),
1583            )
1584            .await?;
1585        Ok(serde_json::from_value(_value)?)
1586    }
1587}
1588
1589/// `session.usage.*` RPCs.
1590#[derive(Clone, Copy)]
1591pub struct SessionRpcUsage<'a> {
1592    pub(crate) session: &'a Session,
1593}
1594
1595impl<'a> SessionRpcUsage<'a> {
1596    /// Wire method: `session.usage.getMetrics`.
1597    ///
1598    /// <div class="warning">
1599    ///
1600    /// **Experimental.** This API is part of an experimental wire-protocol surface
1601    /// and may change or be removed in future SDK or CLI releases. Pin both the
1602    /// SDK and CLI versions if your code depends on it.
1603    ///
1604    /// </div>
1605    pub async fn get_metrics(&self) -> Result<UsageGetMetricsResult, Error> {
1606        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1607        let _value = self
1608            .session
1609            .client()
1610            .call(rpc_methods::SESSION_USAGE_GETMETRICS, Some(wire_params))
1611            .await?;
1612        Ok(serde_json::from_value(_value)?)
1613    }
1614}
1615
1616/// `session.workspaces.*` RPCs.
1617#[derive(Clone, Copy)]
1618pub struct SessionRpcWorkspaces<'a> {
1619    pub(crate) session: &'a Session,
1620}
1621
1622impl<'a> SessionRpcWorkspaces<'a> {
1623    /// Wire method: `session.workspaces.getWorkspace`.
1624    pub async fn get_workspace(&self) -> Result<WorkspacesGetWorkspaceResult, Error> {
1625        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1626        let _value = self
1627            .session
1628            .client()
1629            .call(
1630                rpc_methods::SESSION_WORKSPACES_GETWORKSPACE,
1631                Some(wire_params),
1632            )
1633            .await?;
1634        Ok(serde_json::from_value(_value)?)
1635    }
1636
1637    /// Wire method: `session.workspaces.listFiles`.
1638    pub async fn list_files(&self) -> Result<WorkspacesListFilesResult, Error> {
1639        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1640        let _value = self
1641            .session
1642            .client()
1643            .call(rpc_methods::SESSION_WORKSPACES_LISTFILES, Some(wire_params))
1644            .await?;
1645        Ok(serde_json::from_value(_value)?)
1646    }
1647
1648    /// Wire method: `session.workspaces.readFile`.
1649    pub async fn read_file(
1650        &self,
1651        params: WorkspacesReadFileRequest,
1652    ) -> Result<WorkspacesReadFileResult, Error> {
1653        let mut wire_params = serde_json::to_value(params)?;
1654        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1655        let _value = self
1656            .session
1657            .client()
1658            .call(rpc_methods::SESSION_WORKSPACES_READFILE, Some(wire_params))
1659            .await?;
1660        Ok(serde_json::from_value(_value)?)
1661    }
1662
1663    /// Wire method: `session.workspaces.createFile`.
1664    pub async fn create_file(&self, params: WorkspacesCreateFileRequest) -> Result<(), Error> {
1665        let mut wire_params = serde_json::to_value(params)?;
1666        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1667        let _value = self
1668            .session
1669            .client()
1670            .call(
1671                rpc_methods::SESSION_WORKSPACES_CREATEFILE,
1672                Some(wire_params),
1673            )
1674            .await?;
1675        Ok(())
1676    }
1677}