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.shell.*` sub-namespace.
441    pub fn shell(&self) -> SessionRpcShell<'a> {
442        SessionRpcShell {
443            session: self.session,
444        }
445    }
446
447    /// `session.skills.*` sub-namespace.
448    pub fn skills(&self) -> SessionRpcSkills<'a> {
449        SessionRpcSkills {
450            session: self.session,
451        }
452    }
453
454    /// `session.tasks.*` sub-namespace.
455    pub fn tasks(&self) -> SessionRpcTasks<'a> {
456        SessionRpcTasks {
457            session: self.session,
458        }
459    }
460
461    /// `session.tools.*` sub-namespace.
462    pub fn tools(&self) -> SessionRpcTools<'a> {
463        SessionRpcTools {
464            session: self.session,
465        }
466    }
467
468    /// `session.ui.*` sub-namespace.
469    pub fn ui(&self) -> SessionRpcUi<'a> {
470        SessionRpcUi {
471            session: self.session,
472        }
473    }
474
475    /// `session.usage.*` sub-namespace.
476    pub fn usage(&self) -> SessionRpcUsage<'a> {
477        SessionRpcUsage {
478            session: self.session,
479        }
480    }
481
482    /// `session.workspaces.*` sub-namespace.
483    pub fn workspaces(&self) -> SessionRpcWorkspaces<'a> {
484        SessionRpcWorkspaces {
485            session: self.session,
486        }
487    }
488
489    /// Wire method: `session.suspend`.
490    pub async fn suspend(&self) -> Result<(), Error> {
491        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
492        let _value = self
493            .session
494            .client()
495            .call(rpc_methods::SESSION_SUSPEND, Some(wire_params))
496            .await?;
497        Ok(())
498    }
499
500    /// Wire method: `session.log`.
501    pub async fn log(&self, params: LogRequest) -> Result<LogResult, Error> {
502        let mut wire_params = serde_json::to_value(params)?;
503        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
504        let _value = self
505            .session
506            .client()
507            .call(rpc_methods::SESSION_LOG, Some(wire_params))
508            .await?;
509        Ok(serde_json::from_value(_value)?)
510    }
511}
512
513/// `session.agent.*` RPCs.
514#[derive(Clone, Copy)]
515pub struct SessionRpcAgent<'a> {
516    pub(crate) session: &'a Session,
517}
518
519impl<'a> SessionRpcAgent<'a> {
520    /// Wire method: `session.agent.list`.
521    ///
522    /// <div class="warning">
523    ///
524    /// **Experimental.** This API is part of an experimental wire-protocol surface
525    /// and may change or be removed in future SDK or CLI releases. Pin both the
526    /// SDK and CLI versions if your code depends on it.
527    ///
528    /// </div>
529    pub async fn list(&self) -> Result<AgentList, Error> {
530        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
531        let _value = self
532            .session
533            .client()
534            .call(rpc_methods::SESSION_AGENT_LIST, Some(wire_params))
535            .await?;
536        Ok(serde_json::from_value(_value)?)
537    }
538
539    /// Wire method: `session.agent.getCurrent`.
540    ///
541    /// <div class="warning">
542    ///
543    /// **Experimental.** This API is part of an experimental wire-protocol surface
544    /// and may change or be removed in future SDK or CLI releases. Pin both the
545    /// SDK and CLI versions if your code depends on it.
546    ///
547    /// </div>
548    pub async fn get_current(&self) -> Result<AgentGetCurrentResult, Error> {
549        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
550        let _value = self
551            .session
552            .client()
553            .call(rpc_methods::SESSION_AGENT_GETCURRENT, Some(wire_params))
554            .await?;
555        Ok(serde_json::from_value(_value)?)
556    }
557
558    /// Wire method: `session.agent.select`.
559    ///
560    /// <div class="warning">
561    ///
562    /// **Experimental.** This API is part of an experimental wire-protocol surface
563    /// and may change or be removed in future SDK or CLI releases. Pin both the
564    /// SDK and CLI versions if your code depends on it.
565    ///
566    /// </div>
567    pub async fn select(&self, params: AgentSelectRequest) -> Result<AgentSelectResult, Error> {
568        let mut wire_params = serde_json::to_value(params)?;
569        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
570        let _value = self
571            .session
572            .client()
573            .call(rpc_methods::SESSION_AGENT_SELECT, Some(wire_params))
574            .await?;
575        Ok(serde_json::from_value(_value)?)
576    }
577
578    /// Wire method: `session.agent.deselect`.
579    ///
580    /// <div class="warning">
581    ///
582    /// **Experimental.** This API is part of an experimental wire-protocol surface
583    /// and may change or be removed in future SDK or CLI releases. Pin both the
584    /// SDK and CLI versions if your code depends on it.
585    ///
586    /// </div>
587    pub async fn deselect(&self) -> Result<(), Error> {
588        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
589        let _value = self
590            .session
591            .client()
592            .call(rpc_methods::SESSION_AGENT_DESELECT, Some(wire_params))
593            .await?;
594        Ok(())
595    }
596
597    /// Wire method: `session.agent.reload`.
598    ///
599    /// <div class="warning">
600    ///
601    /// **Experimental.** This API is part of an experimental wire-protocol surface
602    /// and may change or be removed in future SDK or CLI releases. Pin both the
603    /// SDK and CLI versions if your code depends on it.
604    ///
605    /// </div>
606    pub async fn reload(&self) -> Result<AgentReloadResult, Error> {
607        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
608        let _value = self
609            .session
610            .client()
611            .call(rpc_methods::SESSION_AGENT_RELOAD, Some(wire_params))
612            .await?;
613        Ok(serde_json::from_value(_value)?)
614    }
615}
616
617/// `session.auth.*` RPCs.
618#[derive(Clone, Copy)]
619pub struct SessionRpcAuth<'a> {
620    pub(crate) session: &'a Session,
621}
622
623impl<'a> SessionRpcAuth<'a> {
624    /// Wire method: `session.auth.getStatus`.
625    pub async fn get_status(&self) -> Result<SessionAuthStatus, Error> {
626        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
627        let _value = self
628            .session
629            .client()
630            .call(rpc_methods::SESSION_AUTH_GETSTATUS, Some(wire_params))
631            .await?;
632        Ok(serde_json::from_value(_value)?)
633    }
634}
635
636/// `session.commands.*` RPCs.
637#[derive(Clone, Copy)]
638pub struct SessionRpcCommands<'a> {
639    pub(crate) session: &'a Session,
640}
641
642impl<'a> SessionRpcCommands<'a> {
643    /// Wire method: `session.commands.handlePendingCommand`.
644    pub async fn handle_pending_command(
645        &self,
646        params: CommandsHandlePendingCommandRequest,
647    ) -> Result<CommandsHandlePendingCommandResult, Error> {
648        let mut wire_params = serde_json::to_value(params)?;
649        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
650        let _value = self
651            .session
652            .client()
653            .call(
654                rpc_methods::SESSION_COMMANDS_HANDLEPENDINGCOMMAND,
655                Some(wire_params),
656            )
657            .await?;
658        Ok(serde_json::from_value(_value)?)
659    }
660}
661
662/// `session.extensions.*` RPCs.
663#[derive(Clone, Copy)]
664pub struct SessionRpcExtensions<'a> {
665    pub(crate) session: &'a Session,
666}
667
668impl<'a> SessionRpcExtensions<'a> {
669    /// Wire method: `session.extensions.list`.
670    ///
671    /// <div class="warning">
672    ///
673    /// **Experimental.** This API is part of an experimental wire-protocol surface
674    /// and may change or be removed in future SDK or CLI releases. Pin both the
675    /// SDK and CLI versions if your code depends on it.
676    ///
677    /// </div>
678    pub async fn list(&self) -> Result<ExtensionList, Error> {
679        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
680        let _value = self
681            .session
682            .client()
683            .call(rpc_methods::SESSION_EXTENSIONS_LIST, Some(wire_params))
684            .await?;
685        Ok(serde_json::from_value(_value)?)
686    }
687
688    /// Wire method: `session.extensions.enable`.
689    ///
690    /// <div class="warning">
691    ///
692    /// **Experimental.** This API is part of an experimental wire-protocol surface
693    /// and may change or be removed in future SDK or CLI releases. Pin both the
694    /// SDK and CLI versions if your code depends on it.
695    ///
696    /// </div>
697    pub async fn enable(&self, params: ExtensionsEnableRequest) -> Result<(), Error> {
698        let mut wire_params = serde_json::to_value(params)?;
699        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
700        let _value = self
701            .session
702            .client()
703            .call(rpc_methods::SESSION_EXTENSIONS_ENABLE, Some(wire_params))
704            .await?;
705        Ok(())
706    }
707
708    /// Wire method: `session.extensions.disable`.
709    ///
710    /// <div class="warning">
711    ///
712    /// **Experimental.** This API is part of an experimental wire-protocol surface
713    /// and may change or be removed in future SDK or CLI releases. Pin both the
714    /// SDK and CLI versions if your code depends on it.
715    ///
716    /// </div>
717    pub async fn disable(&self, params: ExtensionsDisableRequest) -> Result<(), Error> {
718        let mut wire_params = serde_json::to_value(params)?;
719        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
720        let _value = self
721            .session
722            .client()
723            .call(rpc_methods::SESSION_EXTENSIONS_DISABLE, Some(wire_params))
724            .await?;
725        Ok(())
726    }
727
728    /// Wire method: `session.extensions.reload`.
729    ///
730    /// <div class="warning">
731    ///
732    /// **Experimental.** This API is part of an experimental wire-protocol surface
733    /// and may change or be removed in future SDK or CLI releases. Pin both the
734    /// SDK and CLI versions if your code depends on it.
735    ///
736    /// </div>
737    pub async fn reload(&self) -> Result<(), Error> {
738        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
739        let _value = self
740            .session
741            .client()
742            .call(rpc_methods::SESSION_EXTENSIONS_RELOAD, Some(wire_params))
743            .await?;
744        Ok(())
745    }
746}
747
748/// `session.fleet.*` RPCs.
749#[derive(Clone, Copy)]
750pub struct SessionRpcFleet<'a> {
751    pub(crate) session: &'a Session,
752}
753
754impl<'a> SessionRpcFleet<'a> {
755    /// Wire method: `session.fleet.start`.
756    ///
757    /// <div class="warning">
758    ///
759    /// **Experimental.** This API is part of an experimental wire-protocol surface
760    /// and may change or be removed in future SDK or CLI releases. Pin both the
761    /// SDK and CLI versions if your code depends on it.
762    ///
763    /// </div>
764    pub async fn start(&self, params: FleetStartRequest) -> Result<FleetStartResult, Error> {
765        let mut wire_params = serde_json::to_value(params)?;
766        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
767        let _value = self
768            .session
769            .client()
770            .call(rpc_methods::SESSION_FLEET_START, Some(wire_params))
771            .await?;
772        Ok(serde_json::from_value(_value)?)
773    }
774}
775
776/// `session.history.*` RPCs.
777#[derive(Clone, Copy)]
778pub struct SessionRpcHistory<'a> {
779    pub(crate) session: &'a Session,
780}
781
782impl<'a> SessionRpcHistory<'a> {
783    /// Wire method: `session.history.compact`.
784    ///
785    /// <div class="warning">
786    ///
787    /// **Experimental.** This API is part of an experimental wire-protocol surface
788    /// and may change or be removed in future SDK or CLI releases. Pin both the
789    /// SDK and CLI versions if your code depends on it.
790    ///
791    /// </div>
792    pub async fn compact(&self) -> Result<HistoryCompactResult, Error> {
793        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
794        let _value = self
795            .session
796            .client()
797            .call(rpc_methods::SESSION_HISTORY_COMPACT, Some(wire_params))
798            .await?;
799        Ok(serde_json::from_value(_value)?)
800    }
801
802    /// Wire method: `session.history.truncate`.
803    ///
804    /// <div class="warning">
805    ///
806    /// **Experimental.** This API is part of an experimental wire-protocol surface
807    /// and may change or be removed in future SDK or CLI releases. Pin both the
808    /// SDK and CLI versions if your code depends on it.
809    ///
810    /// </div>
811    pub async fn truncate(
812        &self,
813        params: HistoryTruncateRequest,
814    ) -> Result<HistoryTruncateResult, Error> {
815        let mut wire_params = serde_json::to_value(params)?;
816        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
817        let _value = self
818            .session
819            .client()
820            .call(rpc_methods::SESSION_HISTORY_TRUNCATE, Some(wire_params))
821            .await?;
822        Ok(serde_json::from_value(_value)?)
823    }
824}
825
826/// `session.instructions.*` RPCs.
827#[derive(Clone, Copy)]
828pub struct SessionRpcInstructions<'a> {
829    pub(crate) session: &'a Session,
830}
831
832impl<'a> SessionRpcInstructions<'a> {
833    /// Wire method: `session.instructions.getSources`.
834    pub async fn get_sources(&self) -> Result<InstructionsGetSourcesResult, Error> {
835        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
836        let _value = self
837            .session
838            .client()
839            .call(
840                rpc_methods::SESSION_INSTRUCTIONS_GETSOURCES,
841                Some(wire_params),
842            )
843            .await?;
844        Ok(serde_json::from_value(_value)?)
845    }
846}
847
848/// `session.mcp.*` RPCs.
849#[derive(Clone, Copy)]
850pub struct SessionRpcMcp<'a> {
851    pub(crate) session: &'a Session,
852}
853
854impl<'a> SessionRpcMcp<'a> {
855    /// `session.mcp.oauth.*` sub-namespace.
856    pub fn oauth(&self) -> SessionRpcMcpOauth<'a> {
857        SessionRpcMcpOauth {
858            session: self.session,
859        }
860    }
861
862    /// Wire method: `session.mcp.list`.
863    ///
864    /// <div class="warning">
865    ///
866    /// **Experimental.** This API is part of an experimental wire-protocol surface
867    /// and may change or be removed in future SDK or CLI releases. Pin both the
868    /// SDK and CLI versions if your code depends on it.
869    ///
870    /// </div>
871    pub async fn list(&self) -> Result<McpServerList, Error> {
872        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
873        let _value = self
874            .session
875            .client()
876            .call(rpc_methods::SESSION_MCP_LIST, Some(wire_params))
877            .await?;
878        Ok(serde_json::from_value(_value)?)
879    }
880
881    /// Wire method: `session.mcp.enable`.
882    ///
883    /// <div class="warning">
884    ///
885    /// **Experimental.** This API is part of an experimental wire-protocol surface
886    /// and may change or be removed in future SDK or CLI releases. Pin both the
887    /// SDK and CLI versions if your code depends on it.
888    ///
889    /// </div>
890    pub async fn enable(&self, params: McpEnableRequest) -> Result<(), Error> {
891        let mut wire_params = serde_json::to_value(params)?;
892        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
893        let _value = self
894            .session
895            .client()
896            .call(rpc_methods::SESSION_MCP_ENABLE, Some(wire_params))
897            .await?;
898        Ok(())
899    }
900
901    /// Wire method: `session.mcp.disable`.
902    ///
903    /// <div class="warning">
904    ///
905    /// **Experimental.** This API is part of an experimental wire-protocol surface
906    /// and may change or be removed in future SDK or CLI releases. Pin both the
907    /// SDK and CLI versions if your code depends on it.
908    ///
909    /// </div>
910    pub async fn disable(&self, params: McpDisableRequest) -> Result<(), Error> {
911        let mut wire_params = serde_json::to_value(params)?;
912        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
913        let _value = self
914            .session
915            .client()
916            .call(rpc_methods::SESSION_MCP_DISABLE, Some(wire_params))
917            .await?;
918        Ok(())
919    }
920
921    /// Wire method: `session.mcp.reload`.
922    ///
923    /// <div class="warning">
924    ///
925    /// **Experimental.** This API is part of an experimental wire-protocol surface
926    /// and may change or be removed in future SDK or CLI releases. Pin both the
927    /// SDK and CLI versions if your code depends on it.
928    ///
929    /// </div>
930    pub async fn reload(&self) -> Result<(), Error> {
931        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
932        let _value = self
933            .session
934            .client()
935            .call(rpc_methods::SESSION_MCP_RELOAD, Some(wire_params))
936            .await?;
937        Ok(())
938    }
939}
940
941/// `session.mcp.oauth.*` RPCs.
942#[derive(Clone, Copy)]
943pub struct SessionRpcMcpOauth<'a> {
944    pub(crate) session: &'a Session,
945}
946
947impl<'a> SessionRpcMcpOauth<'a> {
948    /// Wire method: `session.mcp.oauth.login`.
949    ///
950    /// <div class="warning">
951    ///
952    /// **Experimental.** This API is part of an experimental wire-protocol surface
953    /// and may change or be removed in future SDK or CLI releases. Pin both the
954    /// SDK and CLI versions if your code depends on it.
955    ///
956    /// </div>
957    pub async fn login(&self, params: McpOauthLoginRequest) -> Result<McpOauthLoginResult, Error> {
958        let mut wire_params = serde_json::to_value(params)?;
959        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
960        let _value = self
961            .session
962            .client()
963            .call(rpc_methods::SESSION_MCP_OAUTH_LOGIN, Some(wire_params))
964            .await?;
965        Ok(serde_json::from_value(_value)?)
966    }
967}
968
969/// `session.mode.*` RPCs.
970#[derive(Clone, Copy)]
971pub struct SessionRpcMode<'a> {
972    pub(crate) session: &'a Session,
973}
974
975impl<'a> SessionRpcMode<'a> {
976    /// Wire method: `session.mode.get`.
977    pub async fn get(&self) -> Result<SessionMode, Error> {
978        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
979        let _value = self
980            .session
981            .client()
982            .call(rpc_methods::SESSION_MODE_GET, Some(wire_params))
983            .await?;
984        Ok(serde_json::from_value(_value)?)
985    }
986
987    /// Wire method: `session.mode.set`.
988    pub async fn set(&self, params: ModeSetRequest) -> Result<(), Error> {
989        let mut wire_params = serde_json::to_value(params)?;
990        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
991        let _value = self
992            .session
993            .client()
994            .call(rpc_methods::SESSION_MODE_SET, Some(wire_params))
995            .await?;
996        Ok(())
997    }
998}
999
1000/// `session.model.*` RPCs.
1001#[derive(Clone, Copy)]
1002pub struct SessionRpcModel<'a> {
1003    pub(crate) session: &'a Session,
1004}
1005
1006impl<'a> SessionRpcModel<'a> {
1007    /// Wire method: `session.model.getCurrent`.
1008    pub async fn get_current(&self) -> Result<CurrentModel, Error> {
1009        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1010        let _value = self
1011            .session
1012            .client()
1013            .call(rpc_methods::SESSION_MODEL_GETCURRENT, Some(wire_params))
1014            .await?;
1015        Ok(serde_json::from_value(_value)?)
1016    }
1017
1018    /// Wire method: `session.model.switchTo`.
1019    pub async fn switch_to(
1020        &self,
1021        params: ModelSwitchToRequest,
1022    ) -> Result<ModelSwitchToResult, Error> {
1023        let mut wire_params = serde_json::to_value(params)?;
1024        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1025        let _value = self
1026            .session
1027            .client()
1028            .call(rpc_methods::SESSION_MODEL_SWITCHTO, Some(wire_params))
1029            .await?;
1030        Ok(serde_json::from_value(_value)?)
1031    }
1032}
1033
1034/// `session.name.*` RPCs.
1035#[derive(Clone, Copy)]
1036pub struct SessionRpcName<'a> {
1037    pub(crate) session: &'a Session,
1038}
1039
1040impl<'a> SessionRpcName<'a> {
1041    /// Wire method: `session.name.get`.
1042    pub async fn get(&self) -> Result<NameGetResult, Error> {
1043        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1044        let _value = self
1045            .session
1046            .client()
1047            .call(rpc_methods::SESSION_NAME_GET, Some(wire_params))
1048            .await?;
1049        Ok(serde_json::from_value(_value)?)
1050    }
1051
1052    /// Wire method: `session.name.set`.
1053    pub async fn set(&self, params: NameSetRequest) -> Result<(), Error> {
1054        let mut wire_params = serde_json::to_value(params)?;
1055        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1056        let _value = self
1057            .session
1058            .client()
1059            .call(rpc_methods::SESSION_NAME_SET, Some(wire_params))
1060            .await?;
1061        Ok(())
1062    }
1063}
1064
1065/// `session.permissions.*` RPCs.
1066#[derive(Clone, Copy)]
1067pub struct SessionRpcPermissions<'a> {
1068    pub(crate) session: &'a Session,
1069}
1070
1071impl<'a> SessionRpcPermissions<'a> {
1072    /// Wire method: `session.permissions.handlePendingPermissionRequest`.
1073    pub async fn handle_pending_permission_request(
1074        &self,
1075        params: PermissionDecisionRequest,
1076    ) -> Result<PermissionRequestResult, Error> {
1077        let mut wire_params = serde_json::to_value(params)?;
1078        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1079        let _value = self
1080            .session
1081            .client()
1082            .call(
1083                rpc_methods::SESSION_PERMISSIONS_HANDLEPENDINGPERMISSIONREQUEST,
1084                Some(wire_params),
1085            )
1086            .await?;
1087        Ok(serde_json::from_value(_value)?)
1088    }
1089
1090    /// Wire method: `session.permissions.setApproveAll`.
1091    pub async fn set_approve_all(
1092        &self,
1093        params: PermissionsSetApproveAllRequest,
1094    ) -> Result<PermissionsSetApproveAllResult, Error> {
1095        let mut wire_params = serde_json::to_value(params)?;
1096        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1097        let _value = self
1098            .session
1099            .client()
1100            .call(
1101                rpc_methods::SESSION_PERMISSIONS_SETAPPROVEALL,
1102                Some(wire_params),
1103            )
1104            .await?;
1105        Ok(serde_json::from_value(_value)?)
1106    }
1107
1108    /// Wire method: `session.permissions.resetSessionApprovals`.
1109    pub async fn reset_session_approvals(
1110        &self,
1111    ) -> Result<PermissionsResetSessionApprovalsResult, Error> {
1112        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1113        let _value = self
1114            .session
1115            .client()
1116            .call(
1117                rpc_methods::SESSION_PERMISSIONS_RESETSESSIONAPPROVALS,
1118                Some(wire_params),
1119            )
1120            .await?;
1121        Ok(serde_json::from_value(_value)?)
1122    }
1123}
1124
1125/// `session.plan.*` RPCs.
1126#[derive(Clone, Copy)]
1127pub struct SessionRpcPlan<'a> {
1128    pub(crate) session: &'a Session,
1129}
1130
1131impl<'a> SessionRpcPlan<'a> {
1132    /// Wire method: `session.plan.read`.
1133    pub async fn read(&self) -> Result<PlanReadResult, Error> {
1134        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1135        let _value = self
1136            .session
1137            .client()
1138            .call(rpc_methods::SESSION_PLAN_READ, Some(wire_params))
1139            .await?;
1140        Ok(serde_json::from_value(_value)?)
1141    }
1142
1143    /// Wire method: `session.plan.update`.
1144    pub async fn update(&self, params: PlanUpdateRequest) -> Result<(), Error> {
1145        let mut wire_params = serde_json::to_value(params)?;
1146        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1147        let _value = self
1148            .session
1149            .client()
1150            .call(rpc_methods::SESSION_PLAN_UPDATE, Some(wire_params))
1151            .await?;
1152        Ok(())
1153    }
1154
1155    /// Wire method: `session.plan.delete`.
1156    pub async fn delete(&self) -> Result<(), Error> {
1157        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1158        let _value = self
1159            .session
1160            .client()
1161            .call(rpc_methods::SESSION_PLAN_DELETE, Some(wire_params))
1162            .await?;
1163        Ok(())
1164    }
1165}
1166
1167/// `session.plugins.*` RPCs.
1168#[derive(Clone, Copy)]
1169pub struct SessionRpcPlugins<'a> {
1170    pub(crate) session: &'a Session,
1171}
1172
1173impl<'a> SessionRpcPlugins<'a> {
1174    /// Wire method: `session.plugins.list`.
1175    ///
1176    /// <div class="warning">
1177    ///
1178    /// **Experimental.** This API is part of an experimental wire-protocol surface
1179    /// and may change or be removed in future SDK or CLI releases. Pin both the
1180    /// SDK and CLI versions if your code depends on it.
1181    ///
1182    /// </div>
1183    pub async fn list(&self) -> Result<PluginList, Error> {
1184        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1185        let _value = self
1186            .session
1187            .client()
1188            .call(rpc_methods::SESSION_PLUGINS_LIST, Some(wire_params))
1189            .await?;
1190        Ok(serde_json::from_value(_value)?)
1191    }
1192}
1193
1194/// `session.shell.*` RPCs.
1195#[derive(Clone, Copy)]
1196pub struct SessionRpcShell<'a> {
1197    pub(crate) session: &'a Session,
1198}
1199
1200impl<'a> SessionRpcShell<'a> {
1201    /// Wire method: `session.shell.exec`.
1202    pub async fn exec(&self, params: ShellExecRequest) -> Result<ShellExecResult, Error> {
1203        let mut wire_params = serde_json::to_value(params)?;
1204        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1205        let _value = self
1206            .session
1207            .client()
1208            .call(rpc_methods::SESSION_SHELL_EXEC, Some(wire_params))
1209            .await?;
1210        Ok(serde_json::from_value(_value)?)
1211    }
1212
1213    /// Wire method: `session.shell.kill`.
1214    pub async fn kill(&self, params: ShellKillRequest) -> Result<ShellKillResult, Error> {
1215        let mut wire_params = serde_json::to_value(params)?;
1216        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1217        let _value = self
1218            .session
1219            .client()
1220            .call(rpc_methods::SESSION_SHELL_KILL, Some(wire_params))
1221            .await?;
1222        Ok(serde_json::from_value(_value)?)
1223    }
1224}
1225
1226/// `session.skills.*` RPCs.
1227#[derive(Clone, Copy)]
1228pub struct SessionRpcSkills<'a> {
1229    pub(crate) session: &'a Session,
1230}
1231
1232impl<'a> SessionRpcSkills<'a> {
1233    /// Wire method: `session.skills.list`.
1234    ///
1235    /// <div class="warning">
1236    ///
1237    /// **Experimental.** This API is part of an experimental wire-protocol surface
1238    /// and may change or be removed in future SDK or CLI releases. Pin both the
1239    /// SDK and CLI versions if your code depends on it.
1240    ///
1241    /// </div>
1242    pub async fn list(&self) -> Result<SkillList, Error> {
1243        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1244        let _value = self
1245            .session
1246            .client()
1247            .call(rpc_methods::SESSION_SKILLS_LIST, Some(wire_params))
1248            .await?;
1249        Ok(serde_json::from_value(_value)?)
1250    }
1251
1252    /// Wire method: `session.skills.enable`.
1253    ///
1254    /// <div class="warning">
1255    ///
1256    /// **Experimental.** This API is part of an experimental wire-protocol surface
1257    /// and may change or be removed in future SDK or CLI releases. Pin both the
1258    /// SDK and CLI versions if your code depends on it.
1259    ///
1260    /// </div>
1261    pub async fn enable(&self, params: SkillsEnableRequest) -> Result<(), Error> {
1262        let mut wire_params = serde_json::to_value(params)?;
1263        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1264        let _value = self
1265            .session
1266            .client()
1267            .call(rpc_methods::SESSION_SKILLS_ENABLE, Some(wire_params))
1268            .await?;
1269        Ok(())
1270    }
1271
1272    /// Wire method: `session.skills.disable`.
1273    ///
1274    /// <div class="warning">
1275    ///
1276    /// **Experimental.** This API is part of an experimental wire-protocol surface
1277    /// and may change or be removed in future SDK or CLI releases. Pin both the
1278    /// SDK and CLI versions if your code depends on it.
1279    ///
1280    /// </div>
1281    pub async fn disable(&self, params: SkillsDisableRequest) -> Result<(), Error> {
1282        let mut wire_params = serde_json::to_value(params)?;
1283        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1284        let _value = self
1285            .session
1286            .client()
1287            .call(rpc_methods::SESSION_SKILLS_DISABLE, Some(wire_params))
1288            .await?;
1289        Ok(())
1290    }
1291
1292    /// Wire method: `session.skills.reload`.
1293    ///
1294    /// <div class="warning">
1295    ///
1296    /// **Experimental.** This API is part of an experimental wire-protocol surface
1297    /// and may change or be removed in future SDK or CLI releases. Pin both the
1298    /// SDK and CLI versions if your code depends on it.
1299    ///
1300    /// </div>
1301    pub async fn reload(&self) -> Result<(), Error> {
1302        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1303        let _value = self
1304            .session
1305            .client()
1306            .call(rpc_methods::SESSION_SKILLS_RELOAD, Some(wire_params))
1307            .await?;
1308        Ok(())
1309    }
1310}
1311
1312/// `session.tasks.*` RPCs.
1313#[derive(Clone, Copy)]
1314pub struct SessionRpcTasks<'a> {
1315    pub(crate) session: &'a Session,
1316}
1317
1318impl<'a> SessionRpcTasks<'a> {
1319    /// Wire method: `session.tasks.startAgent`.
1320    ///
1321    /// <div class="warning">
1322    ///
1323    /// **Experimental.** This API is part of an experimental wire-protocol surface
1324    /// and may change or be removed in future SDK or CLI releases. Pin both the
1325    /// SDK and CLI versions if your code depends on it.
1326    ///
1327    /// </div>
1328    pub async fn start_agent(
1329        &self,
1330        params: TasksStartAgentRequest,
1331    ) -> Result<TasksStartAgentResult, Error> {
1332        let mut wire_params = serde_json::to_value(params)?;
1333        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1334        let _value = self
1335            .session
1336            .client()
1337            .call(rpc_methods::SESSION_TASKS_STARTAGENT, Some(wire_params))
1338            .await?;
1339        Ok(serde_json::from_value(_value)?)
1340    }
1341
1342    /// Wire method: `session.tasks.list`.
1343    ///
1344    /// <div class="warning">
1345    ///
1346    /// **Experimental.** This API is part of an experimental wire-protocol surface
1347    /// and may change or be removed in future SDK or CLI releases. Pin both the
1348    /// SDK and CLI versions if your code depends on it.
1349    ///
1350    /// </div>
1351    pub async fn list(&self) -> Result<TaskList, Error> {
1352        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1353        let _value = self
1354            .session
1355            .client()
1356            .call(rpc_methods::SESSION_TASKS_LIST, Some(wire_params))
1357            .await?;
1358        Ok(serde_json::from_value(_value)?)
1359    }
1360
1361    /// Wire method: `session.tasks.promoteToBackground`.
1362    ///
1363    /// <div class="warning">
1364    ///
1365    /// **Experimental.** This API is part of an experimental wire-protocol surface
1366    /// and may change or be removed in future SDK or CLI releases. Pin both the
1367    /// SDK and CLI versions if your code depends on it.
1368    ///
1369    /// </div>
1370    pub async fn promote_to_background(
1371        &self,
1372        params: TasksPromoteToBackgroundRequest,
1373    ) -> Result<TasksPromoteToBackgroundResult, Error> {
1374        let mut wire_params = serde_json::to_value(params)?;
1375        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1376        let _value = self
1377            .session
1378            .client()
1379            .call(
1380                rpc_methods::SESSION_TASKS_PROMOTETOBACKGROUND,
1381                Some(wire_params),
1382            )
1383            .await?;
1384        Ok(serde_json::from_value(_value)?)
1385    }
1386
1387    /// Wire method: `session.tasks.cancel`.
1388    ///
1389    /// <div class="warning">
1390    ///
1391    /// **Experimental.** This API is part of an experimental wire-protocol surface
1392    /// and may change or be removed in future SDK or CLI releases. Pin both the
1393    /// SDK and CLI versions if your code depends on it.
1394    ///
1395    /// </div>
1396    pub async fn cancel(&self, params: TasksCancelRequest) -> Result<TasksCancelResult, Error> {
1397        let mut wire_params = serde_json::to_value(params)?;
1398        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1399        let _value = self
1400            .session
1401            .client()
1402            .call(rpc_methods::SESSION_TASKS_CANCEL, Some(wire_params))
1403            .await?;
1404        Ok(serde_json::from_value(_value)?)
1405    }
1406
1407    /// Wire method: `session.tasks.remove`.
1408    ///
1409    /// <div class="warning">
1410    ///
1411    /// **Experimental.** This API is part of an experimental wire-protocol surface
1412    /// and may change or be removed in future SDK or CLI releases. Pin both the
1413    /// SDK and CLI versions if your code depends on it.
1414    ///
1415    /// </div>
1416    pub async fn remove(&self, params: TasksRemoveRequest) -> Result<TasksRemoveResult, Error> {
1417        let mut wire_params = serde_json::to_value(params)?;
1418        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1419        let _value = self
1420            .session
1421            .client()
1422            .call(rpc_methods::SESSION_TASKS_REMOVE, Some(wire_params))
1423            .await?;
1424        Ok(serde_json::from_value(_value)?)
1425    }
1426}
1427
1428/// `session.tools.*` RPCs.
1429#[derive(Clone, Copy)]
1430pub struct SessionRpcTools<'a> {
1431    pub(crate) session: &'a Session,
1432}
1433
1434impl<'a> SessionRpcTools<'a> {
1435    /// Wire method: `session.tools.handlePendingToolCall`.
1436    pub async fn handle_pending_tool_call(
1437        &self,
1438        params: HandlePendingToolCallRequest,
1439    ) -> Result<HandlePendingToolCallResult, Error> {
1440        let mut wire_params = serde_json::to_value(params)?;
1441        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1442        let _value = self
1443            .session
1444            .client()
1445            .call(
1446                rpc_methods::SESSION_TOOLS_HANDLEPENDINGTOOLCALL,
1447                Some(wire_params),
1448            )
1449            .await?;
1450        Ok(serde_json::from_value(_value)?)
1451    }
1452}
1453
1454/// `session.ui.*` RPCs.
1455#[derive(Clone, Copy)]
1456pub struct SessionRpcUi<'a> {
1457    pub(crate) session: &'a Session,
1458}
1459
1460impl<'a> SessionRpcUi<'a> {
1461    /// Wire method: `session.ui.elicitation`.
1462    pub async fn elicitation(
1463        &self,
1464        params: UIElicitationRequest,
1465    ) -> Result<UIElicitationResponse, Error> {
1466        let mut wire_params = serde_json::to_value(params)?;
1467        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1468        let _value = self
1469            .session
1470            .client()
1471            .call(rpc_methods::SESSION_UI_ELICITATION, Some(wire_params))
1472            .await?;
1473        Ok(serde_json::from_value(_value)?)
1474    }
1475
1476    /// Wire method: `session.ui.handlePendingElicitation`.
1477    pub async fn handle_pending_elicitation(
1478        &self,
1479        params: UIHandlePendingElicitationRequest,
1480    ) -> Result<UIElicitationResult, Error> {
1481        let mut wire_params = serde_json::to_value(params)?;
1482        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1483        let _value = self
1484            .session
1485            .client()
1486            .call(
1487                rpc_methods::SESSION_UI_HANDLEPENDINGELICITATION,
1488                Some(wire_params),
1489            )
1490            .await?;
1491        Ok(serde_json::from_value(_value)?)
1492    }
1493}
1494
1495/// `session.usage.*` RPCs.
1496#[derive(Clone, Copy)]
1497pub struct SessionRpcUsage<'a> {
1498    pub(crate) session: &'a Session,
1499}
1500
1501impl<'a> SessionRpcUsage<'a> {
1502    /// Wire method: `session.usage.getMetrics`.
1503    ///
1504    /// <div class="warning">
1505    ///
1506    /// **Experimental.** This API is part of an experimental wire-protocol surface
1507    /// and may change or be removed in future SDK or CLI releases. Pin both the
1508    /// SDK and CLI versions if your code depends on it.
1509    ///
1510    /// </div>
1511    pub async fn get_metrics(&self) -> Result<UsageGetMetricsResult, Error> {
1512        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1513        let _value = self
1514            .session
1515            .client()
1516            .call(rpc_methods::SESSION_USAGE_GETMETRICS, Some(wire_params))
1517            .await?;
1518        Ok(serde_json::from_value(_value)?)
1519    }
1520}
1521
1522/// `session.workspaces.*` RPCs.
1523#[derive(Clone, Copy)]
1524pub struct SessionRpcWorkspaces<'a> {
1525    pub(crate) session: &'a Session,
1526}
1527
1528impl<'a> SessionRpcWorkspaces<'a> {
1529    /// Wire method: `session.workspaces.getWorkspace`.
1530    pub async fn get_workspace(&self) -> Result<WorkspacesGetWorkspaceResult, Error> {
1531        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1532        let _value = self
1533            .session
1534            .client()
1535            .call(
1536                rpc_methods::SESSION_WORKSPACES_GETWORKSPACE,
1537                Some(wire_params),
1538            )
1539            .await?;
1540        Ok(serde_json::from_value(_value)?)
1541    }
1542
1543    /// Wire method: `session.workspaces.listFiles`.
1544    pub async fn list_files(&self) -> Result<WorkspacesListFilesResult, Error> {
1545        let wire_params = serde_json::json!({ "sessionId": self.session.id() });
1546        let _value = self
1547            .session
1548            .client()
1549            .call(rpc_methods::SESSION_WORKSPACES_LISTFILES, Some(wire_params))
1550            .await?;
1551        Ok(serde_json::from_value(_value)?)
1552    }
1553
1554    /// Wire method: `session.workspaces.readFile`.
1555    pub async fn read_file(
1556        &self,
1557        params: WorkspacesReadFileRequest,
1558    ) -> Result<WorkspacesReadFileResult, Error> {
1559        let mut wire_params = serde_json::to_value(params)?;
1560        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1561        let _value = self
1562            .session
1563            .client()
1564            .call(rpc_methods::SESSION_WORKSPACES_READFILE, Some(wire_params))
1565            .await?;
1566        Ok(serde_json::from_value(_value)?)
1567    }
1568
1569    /// Wire method: `session.workspaces.createFile`.
1570    pub async fn create_file(&self, params: WorkspacesCreateFileRequest) -> Result<(), Error> {
1571        let mut wire_params = serde_json::to_value(params)?;
1572        wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string());
1573        let _value = self
1574            .session
1575            .client()
1576            .call(
1577                rpc_methods::SESSION_WORKSPACES_CREATEFILE,
1578                Some(wire_params),
1579            )
1580            .await?;
1581        Ok(())
1582    }
1583}