@downcity/agent 1.1.217 → 1.1.224

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/bin/agent/local/Agent.d.ts +1 -34
  2. package/bin/agent/local/Agent.d.ts.map +1 -1
  3. package/bin/agent/local/Agent.js +1 -44
  4. package/bin/agent/local/Agent.js.map +1 -1
  5. package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -1
  6. package/bin/agent/local/services/AgentAssemblyService.js +35 -2
  7. package/bin/agent/local/services/AgentAssemblyService.js.map +1 -1
  8. package/bin/agent/local/services/AgentSessions.d.ts +6 -0
  9. package/bin/agent/local/services/AgentSessions.d.ts.map +1 -1
  10. package/bin/agent/local/services/AgentSessions.js +43 -4
  11. package/bin/agent/local/services/AgentSessions.js.map +1 -1
  12. package/bin/agent/remote/RemoteAgent.d.ts +1 -35
  13. package/bin/agent/remote/RemoteAgent.d.ts.map +1 -1
  14. package/bin/agent/remote/RemoteAgent.js +1 -37
  15. package/bin/agent/remote/RemoteAgent.js.map +1 -1
  16. package/bin/agent/remote/RemoteSession.d.ts +26 -41
  17. package/bin/agent/remote/RemoteSession.d.ts.map +1 -1
  18. package/bin/agent/remote/RemoteSession.js +75 -107
  19. package/bin/agent/remote/RemoteSession.js.map +1 -1
  20. package/bin/agent/remote/RemoteTransport.d.ts +15 -27
  21. package/bin/agent/remote/RemoteTransport.d.ts.map +1 -1
  22. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts +10 -21
  23. package/bin/agent/remote/transports/HttpRemoteAgentTransport.d.ts.map +1 -1
  24. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js +24 -46
  25. package/bin/agent/remote/transports/HttpRemoteAgentTransport.js.map +1 -1
  26. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts +10 -20
  27. package/bin/agent/remote/transports/RpcRemoteAgentTransport.d.ts.map +1 -1
  28. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js +10 -16
  29. package/bin/agent/remote/transports/RpcRemoteAgentTransport.js.map +1 -1
  30. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js +2 -2
  31. package/bin/executor/store/history/jsonl/JsonlSessionHistoryStore.js.map +1 -1
  32. package/bin/executor/types/SessionHistoryPaths.d.ts +1 -1
  33. package/bin/executor/types/SessionRecords.d.ts +2 -0
  34. package/bin/executor/types/SessionRecords.d.ts.map +1 -1
  35. package/bin/executor/types/SessionRecords.js.map +1 -1
  36. package/bin/index.d.ts +6 -3
  37. package/bin/index.d.ts.map +1 -1
  38. package/bin/index.js +1 -0
  39. package/bin/index.js.map +1 -1
  40. package/bin/rpc/Client.d.ts +12 -34
  41. package/bin/rpc/Client.d.ts.map +1 -1
  42. package/bin/rpc/Client.js +31 -70
  43. package/bin/rpc/Client.js.map +1 -1
  44. package/bin/session/Session.d.ts +22 -4
  45. package/bin/session/Session.d.ts.map +1 -1
  46. package/bin/session/Session.js +95 -21
  47. package/bin/session/Session.js.map +1 -1
  48. package/bin/session/browse/Browse.d.ts.map +1 -1
  49. package/bin/session/browse/Browse.js +49 -18
  50. package/bin/session/browse/Browse.js.map +1 -1
  51. package/bin/session/recorder/JsonlSessionMessageStore.d.ts +51 -0
  52. package/bin/session/recorder/JsonlSessionMessageStore.d.ts.map +1 -0
  53. package/bin/session/recorder/JsonlSessionMessageStore.js +231 -0
  54. package/bin/session/recorder/JsonlSessionMessageStore.js.map +1 -0
  55. package/bin/session/recorder/SessionMessageCodec.d.ts +20 -0
  56. package/bin/session/recorder/SessionMessageCodec.d.ts.map +1 -0
  57. package/bin/session/recorder/SessionMessageCodec.js +257 -0
  58. package/bin/session/recorder/SessionMessageCodec.js.map +1 -0
  59. package/bin/session/recorder/SessionRecorder.d.ts +186 -0
  60. package/bin/session/recorder/SessionRecorder.d.ts.map +1 -0
  61. package/bin/session/recorder/SessionRecorder.js +655 -0
  62. package/bin/session/recorder/SessionRecorder.js.map +1 -0
  63. package/bin/session/recorder/SessionRecorderCompaction.d.ts +18 -0
  64. package/bin/session/recorder/SessionRecorderCompaction.d.ts.map +1 -0
  65. package/bin/session/recorder/SessionRecorderCompaction.js +142 -0
  66. package/bin/session/recorder/SessionRecorderCompaction.js.map +1 -0
  67. package/bin/session/recorder/SessionRecorderHistoryStore.d.ts +66 -0
  68. package/bin/session/recorder/SessionRecorderHistoryStore.d.ts.map +1 -0
  69. package/bin/session/recorder/SessionRecorderHistoryStore.js +195 -0
  70. package/bin/session/recorder/SessionRecorderHistoryStore.js.map +1 -0
  71. package/bin/session/runtime/SessionEventHub.d.ts +12 -5
  72. package/bin/session/runtime/SessionEventHub.d.ts.map +1 -1
  73. package/bin/session/runtime/SessionEventHub.js +11 -6
  74. package/bin/session/runtime/SessionEventHub.js.map +1 -1
  75. package/bin/session/runtime/SessionPromptRuntime.d.ts +9 -15
  76. package/bin/session/runtime/SessionPromptRuntime.d.ts.map +1 -1
  77. package/bin/session/runtime/SessionPromptRuntime.js +48 -30
  78. package/bin/session/runtime/SessionPromptRuntime.js.map +1 -1
  79. package/bin/session/services/SessionStateService.d.ts +9 -5
  80. package/bin/session/services/SessionStateService.d.ts.map +1 -1
  81. package/bin/session/services/SessionStateService.js +138 -74
  82. package/bin/session/services/SessionStateService.js.map +1 -1
  83. package/bin/session/services/SessionTurnService.d.ts +6 -7
  84. package/bin/session/services/SessionTurnService.d.ts.map +1 -1
  85. package/bin/session/services/SessionTurnService.js +84 -60
  86. package/bin/session/services/SessionTurnService.js.map +1 -1
  87. package/bin/session/services/SessionViewService.d.ts +8 -3
  88. package/bin/session/services/SessionViewService.d.ts.map +1 -1
  89. package/bin/session/services/SessionViewService.js +10 -5
  90. package/bin/session/services/SessionViewService.js.map +1 -1
  91. package/bin/session/storage/Paths.d.ts +1 -1
  92. package/bin/session/storage/Paths.d.ts.map +1 -1
  93. package/bin/session/storage/Paths.js +2 -2
  94. package/bin/session/storage/Paths.js.map +1 -1
  95. package/bin/session/storage/Persistence.d.ts +6 -0
  96. package/bin/session/storage/Persistence.d.ts.map +1 -1
  97. package/bin/session/storage/Persistence.js +7 -0
  98. package/bin/session/storage/Persistence.js.map +1 -1
  99. package/bin/session/storage/RuntimeSessionPort.d.ts +3 -3
  100. package/bin/session/storage/RuntimeSessionPort.d.ts.map +1 -1
  101. package/bin/session/storage/RuntimeSessionPort.js +2 -2
  102. package/bin/session/storage/RuntimeSessionPort.js.map +1 -1
  103. package/bin/types/agent/SessionActor.d.ts +15 -5
  104. package/bin/types/agent/SessionActor.d.ts.map +1 -1
  105. package/bin/types/rpc/RpcProtocol.d.ts +48 -61
  106. package/bin/types/rpc/RpcProtocol.d.ts.map +1 -1
  107. package/bin/types/runtime/agent/AgentContext.d.ts +5 -4
  108. package/bin/types/runtime/agent/AgentContext.d.ts.map +1 -1
  109. package/bin/types/runtime/agent/AgentContext.js.map +1 -1
  110. package/bin/types/session/SessionApproval.d.ts +97 -0
  111. package/bin/types/session/SessionApproval.d.ts.map +1 -0
  112. package/bin/types/session/SessionApproval.js +7 -0
  113. package/bin/types/session/SessionApproval.js.map +1 -0
  114. package/bin/types/session/SessionMessage.d.ts +223 -0
  115. package/bin/types/session/SessionMessage.d.ts.map +1 -0
  116. package/bin/types/session/SessionMessage.js +8 -0
  117. package/bin/types/session/SessionMessage.js.map +1 -0
  118. package/bin/types/session/SessionMutation.d.ts +116 -0
  119. package/bin/types/session/SessionMutation.d.ts.map +1 -0
  120. package/bin/types/session/SessionMutation.js +19 -0
  121. package/bin/types/session/SessionMutation.js.map +1 -0
  122. package/bin/types/session/SessionOptions.d.ts +9 -0
  123. package/bin/types/session/SessionOptions.d.ts.map +1 -1
  124. package/package.json +3 -3
  125. package/scripts/agent-env.test.mjs +4 -4
  126. package/scripts/remote-session-reconnect.test.mjs +7 -3
  127. package/scripts/session-action-message.test.mjs +98 -27
  128. package/scripts/session-history-inflight.test.mjs +2 -2
  129. package/scripts/session-list-title.test.mjs +6 -19
  130. package/scripts/session-prompt-runtime.test.mjs +7 -19
  131. package/scripts/session-recorder.test.mjs +199 -0
  132. package/scripts/session-title-event.test.mjs +10 -18
  133. package/src/agent/local/Agent.ts +1 -55
  134. package/src/agent/local/services/AgentAssemblyService.ts +39 -3
  135. package/src/agent/local/services/AgentSessions.ts +48 -3
  136. package/src/agent/remote/RemoteAgent.ts +1 -54
  137. package/src/agent/remote/RemoteSession.ts +106 -136
  138. package/src/agent/remote/RemoteTransport.ts +30 -30
  139. package/src/agent/remote/transports/HttpRemoteAgentTransport.ts +52 -77
  140. package/src/agent/remote/transports/RpcRemoteAgentTransport.ts +30 -34
  141. package/src/executor/store/history/jsonl/JsonlSessionHistoryStore.ts +2 -2
  142. package/src/executor/types/SessionHistoryPaths.ts +1 -1
  143. package/src/executor/types/SessionRecords.ts +2 -0
  144. package/src/index.ts +36 -10
  145. package/src/rpc/Client.ts +58 -95
  146. package/src/session/Session.ts +128 -37
  147. package/src/session/browse/Browse.ts +51 -22
  148. package/src/session/recorder/JsonlSessionMessageStore.ts +246 -0
  149. package/src/session/recorder/SessionMessageCodec.ts +284 -0
  150. package/src/session/recorder/SessionRecorder.ts +871 -0
  151. package/src/session/recorder/SessionRecorderCompaction.ts +188 -0
  152. package/src/session/recorder/SessionRecorderHistoryStore.ts +276 -0
  153. package/src/session/runtime/SessionEventHub.ts +25 -12
  154. package/src/session/runtime/SessionPromptRuntime.ts +60 -43
  155. package/src/session/services/SessionStateService.ts +159 -86
  156. package/src/session/services/SessionTurnService.ts +91 -73
  157. package/src/session/services/SessionViewService.ts +25 -13
  158. package/src/session/storage/Paths.ts +2 -2
  159. package/src/session/storage/Persistence.ts +13 -0
  160. package/src/session/storage/RuntimeSessionPort.ts +8 -9
  161. package/src/types/agent/SessionActor.ts +31 -8
  162. package/src/types/rpc/RpcProtocol.ts +44 -67
  163. package/src/types/runtime/agent/AgentContext.ts +9 -7
  164. package/src/types/session/SessionApproval.ts +108 -0
  165. package/src/types/session/SessionMessage.ts +253 -0
  166. package/src/types/session/SessionMutation.ts +141 -0
  167. package/src/types/session/SessionOptions.ts +25 -0
  168. package/tsconfig.tsbuildinfo +1 -1
  169. package/bin/session/SessionEventMapper.d.ts +0 -32
  170. package/bin/session/SessionEventMapper.d.ts.map +0 -1
  171. package/bin/session/SessionEventMapper.js +0 -131
  172. package/bin/session/SessionEventMapper.js.map +0 -1
  173. package/bin/types/sdk/AgentSessionEvent.d.ts +0 -302
  174. package/bin/types/sdk/AgentSessionEvent.d.ts.map +0 -1
  175. package/bin/types/sdk/AgentSessionEvent.js +0 -9
  176. package/bin/types/sdk/AgentSessionEvent.js.map +0 -1
  177. package/bin/types/sdk/InternalUiChunkEvent.d.ts +0 -100
  178. package/bin/types/sdk/InternalUiChunkEvent.d.ts.map +0 -1
  179. package/bin/types/sdk/InternalUiChunkEvent.js +0 -9
  180. package/bin/types/sdk/InternalUiChunkEvent.js.map +0 -1
  181. package/scripts/session-history-archive.test.mjs +0 -188
  182. package/src/session/SessionEventMapper.ts +0 -148
  183. package/src/types/sdk/AgentSessionEvent.ts +0 -370
  184. package/src/types/sdk/InternalUiChunkEvent.ts +0 -108
@@ -15,12 +15,6 @@ import type { AgentModel } from "@/model/CityModelAdapter.js";
15
15
  import type { AgentOptions } from "@/types/agent/AgentOptions.js";
16
16
  import type { AgentSessions as AgentSessionsApi } from "@/types/agent/SessionActor.js";
17
17
  import type {
18
- ShellApprovalMode,
19
- ShellApprovalDecisionResult,
20
- ShellApprovalModeUpdateResult,
21
- ShellApprovalModeOption,
22
- ShellSessionApprovalModeView,
23
- ShellApprovalView,
24
18
  Shell,
25
19
  } from "@downcity/shell";
26
20
  import { Logger } from "@/utils/logger/Logger.js";
@@ -122,55 +116,6 @@ export class Agent {
122
116
  await this.backgroundService.dispose();
123
117
  }
124
118
 
125
- /**
126
- * 列出当前 shell pending approvals。
127
- */
128
- approvals(): ShellApprovalView[] {
129
- return this.shell?.approvals() || [];
130
- }
131
-
132
- /**
133
- * 列出当前 shell 显式设置过的 approval 模式。
134
- */
135
- approval_modes(): ShellApprovalModeOption[] {
136
- return this.shell?.approval_modes() || [];
137
- }
138
-
139
- /**
140
- * 读取当前 shell 指定 session 的 approval 模式。
141
- */
142
- approval_mode(input: { session_id: string }): ShellSessionApprovalModeView {
143
- if (!this.shell) throw new Error("Agent shell is not configured");
144
- return this.shell.approval_mode(input);
145
- }
146
-
147
- /**
148
- * 设置当前 shell 指定 session 的 approval 模式。
149
- */
150
- set_approval_mode(input: {
151
- session_id: string;
152
- mode: ShellApprovalMode;
153
- }): ShellApprovalModeUpdateResult {
154
- if (!this.shell) throw new Error("Agent shell is not configured");
155
- return this.shell.set_approval_mode(input);
156
- }
157
-
158
- /**
159
- * 批准当前 shell pending approval。
160
- */
161
- async approve(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
162
- if (!this.shell) throw new Error("Agent shell is not configured");
163
- return await this.shell.approve(input);
164
- }
165
-
166
- /**
167
- * 拒绝当前 shell pending approval。
168
- */
169
- async deny(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
170
- if (!this.shell) throw new Error("Agent shell is not configured");
171
- return await this.shell.deny(input);
172
- }
173
-
174
119
  /**
175
120
  * 更新当前 SDK Agent 的静态基础指令。
176
121
  */
@@ -260,6 +205,7 @@ export class Agent {
260
205
  tools: this.tools || assembly.tools,
261
206
  logger: this.logger || assembly.logger,
262
207
  get_agent_context: () => this.agentContext ?? assembly.agent_context,
208
+ get_shell: () => this.shell,
263
209
  get_instruction: () => this.instruction,
264
210
  ensure_agent_ready: async () => {
265
211
  await this.backgroundService.ready();
@@ -32,7 +32,7 @@ import {
32
32
  } from "@executor/tools/plugin/PluginToolDefinition.js";
33
33
  import type { AgentManagedSession } from "@/types/session/SessionOptions.js";
34
34
  import type { SessionPort } from "@/types/runtime/agent/AgentContext.js";
35
- import type { AgentSessionEvent } from "@/types/sdk/AgentSessionEvent.js";
35
+ import type { SessionApprovalRuntimeEvent } from "@/types/session/SessionApproval.js";
36
36
 
37
37
  type AgentAssemblyServiceOptions = {
38
38
  /**
@@ -215,10 +215,12 @@ export class AgentAssemblyService {
215
215
  env,
216
216
  agent_id: id,
217
217
  logger,
218
- emit_event: (event) => {
218
+ emit_event: async (event) => {
219
219
  const session_id = String(event.session_id || "").trim();
220
220
  if (!session_id) return;
221
- agent_context!.session.get(session_id).publishEvent(event as unknown as AgentSessionEvent);
221
+ const approval_event = normalize_approval_runtime_event(event);
222
+ if (!approval_event) return;
223
+ await agent_context!.session.get(session_id).publishEvent(approval_event);
222
224
  },
223
225
  });
224
226
  Object.assign(tools, shell.tools);
@@ -269,3 +271,37 @@ export class AgentAssemblyService {
269
271
  return false;
270
272
  }
271
273
  }
274
+
275
+ function normalize_approval_runtime_event(
276
+ event: Record<string, unknown>,
277
+ ): SessionApprovalRuntimeEvent | null {
278
+ if (event.type === "tool-approval-request") {
279
+ return {
280
+ type: "tool-approval-request",
281
+ turn_id: String(event.turnId || ""),
282
+ tool_call_id: String(event.toolCallId || ""),
283
+ tool_name: String(event.toolName || "unknown"),
284
+ approval_id: String(event.approvalId || ""),
285
+ command: String(event.cmd || ""),
286
+ cwd: String(event.cwd || ""),
287
+ reason: String(event.reason || ""),
288
+ operation:
289
+ event.operation === "start" || event.operation === "write"
290
+ ? event.operation
291
+ : "exec",
292
+ };
293
+ }
294
+ if (event.type === "tool-approval-result") {
295
+ const decision = event.decision === "approved" || event.decision === "denied"
296
+ ? event.decision
297
+ : "expired";
298
+ return {
299
+ type: "tool-approval-result",
300
+ turn_id: String(event.turnId || ""),
301
+ tool_call_id: String(event.toolCallId || ""),
302
+ approval_id: String(event.approvalId || ""),
303
+ decision,
304
+ };
305
+ }
306
+ return null;
307
+ }
@@ -39,6 +39,8 @@ import {
39
39
  import type { AgentContext } from "@/types/runtime/agent/AgentContext.js";
40
40
  import type { SessionPort } from "@/types/runtime/agent/AgentContext.js";
41
41
  import { createInstructionSystemBlocks } from "@/agent/local/AgentInstructions.js";
42
+ import type { Shell } from "@downcity/shell";
43
+ import type { SessionApproval } from "@/types/session/SessionApproval.js";
42
44
 
43
45
  function decodeMaybe(input: string): string {
44
46
  try {
@@ -77,6 +79,9 @@ type AgentSessionsOptions = {
77
79
  */
78
80
  get_agent_context: () => AgentContext;
79
81
 
82
+ /** 延迟读取当前 Agent 挂载的 Shell Runtime。 */
83
+ get_shell: () => Shell | undefined;
84
+
80
85
  /**
81
86
  * 当前静态 instruction 文本集合。
82
87
  */
@@ -113,6 +118,7 @@ export class AgentSessions implements AgentSessionsApi<AgentSession> {
113
118
  private readonly tools: Record<string, Tool>;
114
119
  private readonly logger: Logger;
115
120
  private readonly get_agent_context: AgentSessionsOptions["get_agent_context"];
121
+ private readonly get_shell: AgentSessionsOptions["get_shell"];
116
122
  private readonly get_instruction: AgentSessionsOptions["get_instruction"];
117
123
  private readonly ensure_agent_ready: AgentSessionsOptions["ensure_agent_ready"];
118
124
  private readonly default_model?: AgentModel;
@@ -128,6 +134,7 @@ export class AgentSessions implements AgentSessionsApi<AgentSession> {
128
134
  this.tools = options.tools;
129
135
  this.logger = options.logger;
130
136
  this.get_agent_context = options.get_agent_context;
137
+ this.get_shell = options.get_shell;
131
138
  this.get_instruction = options.get_instruction;
132
139
  this.ensure_agent_ready = options.ensure_agent_ready;
133
140
  this.default_model = options.default_model;
@@ -348,19 +355,57 @@ export class AgentSessions implements AgentSessionsApi<AgentSession> {
348
355
  await this.apply_session_defaults(session);
349
356
  },
350
357
  ...(this.resolve_model ? { resolve_model: this.resolve_model } : {}),
358
+ list_approvals: async (session_id) => this.list_session_approvals(session_id),
359
+ get_approval_mode: async (session_id) => {
360
+ const shell = this.require_shell();
361
+ return shell.approval_mode({ session_id });
362
+ },
363
+ set_approval_mode: async (session_id, { mode }) => {
364
+ const shell = this.require_shell();
365
+ return shell.set_approval_mode({ session_id, mode });
366
+ },
367
+ resolve_approval: async (session_id, { approval_id, decision }) => {
368
+ const approval = this.list_session_approvals(session_id)
369
+ .find((item) => item.approval_id === approval_id);
370
+ if (!approval) return { success: false, approval_id, decision };
371
+ return decision === "approved"
372
+ ? await this.require_shell().approve({ approval_id })
373
+ : await this.require_shell().deny({ approval_id });
374
+ },
351
375
  });
352
376
  this.sessions_by_id.set(resolved_session_id, created);
353
377
  return created;
354
378
  }
355
379
 
380
+ private require_shell(): Shell {
381
+ const shell = this.get_shell();
382
+ if (!shell) throw new Error("Session shell is not configured");
383
+ return shell;
384
+ }
385
+
386
+ private list_session_approvals(session_id: string): SessionApproval[] {
387
+ return (this.get_shell()?.approvals() || [])
388
+ .filter((approval) => approval.session_id === session_id)
389
+ .map((approval) => ({
390
+ approval_id: approval.approval_id,
391
+ session_id,
392
+ ...(approval.turn_id ? { turn_id: approval.turn_id } : {}),
393
+ ...(approval.tool_call_id ? { tool_call_id: approval.tool_call_id } : {}),
394
+ tool_name: approval.tool_name,
395
+ command: approval.cmd,
396
+ cwd: approval.cwd,
397
+ reason: approval.reason,
398
+ operation: approval.operation,
399
+ created_at: approval.created_at,
400
+ }));
401
+ }
402
+
356
403
  private async apply_session_defaults(
357
404
  session: AgentManagedSession,
358
405
  ): Promise<void> {
359
406
  if (this.configured_session_ids.has(session.id)) return;
360
407
  const persisted_model_id = String(session.config.modelId || "").trim();
361
- if (persisted_model_id && this.resolve_model) {
362
- await session.set({ modelId: persisted_model_id });
363
- } else if (this.default_model) {
408
+ if (!persisted_model_id && this.default_model) {
364
409
  await session.set({
365
410
  model: this.default_model,
366
411
  ...(this.default_model_id ? { modelId: this.default_model_id } : {}),
@@ -23,14 +23,6 @@ import type {
23
23
  RemoteAgentPluginActionInput,
24
24
  RemoteAgentPluginActionResult,
25
25
  } from "@/types/agent/RemoteAgentPluginAction.js";
26
- import type {
27
- ShellApprovalMode,
28
- ShellApprovalDecisionResult,
29
- ShellApprovalModeUpdateResult,
30
- ShellApprovalModeOption,
31
- ShellSessionApprovalModeView,
32
- ShellApprovalView,
33
- } from "@downcity/shell";
34
26
  import type { RemoteAgentTransport } from "@/agent/remote/RemoteTransport.js";
35
27
  import { RemoteSession } from "@/agent/remote/RemoteSession.js";
36
28
  import { create_remote_agent_transport } from "@/agent/remote/TransportFactory.js";
@@ -57,7 +49,7 @@ export class RemoteAgent {
57
49
  *
58
50
  * 关键点(中文)
59
51
  * - 这是 RemoteAgent 顶层能力,不绑定某个 session。
60
- * - Shell approval 请使用 `approvals()` / `approve()` / `deny()`。
52
+ * - Shell approval 通过具体 RemoteSession 处理。
61
53
  */
62
54
  async runPluginAction(
63
55
  input: RemoteAgentPluginActionInput,
@@ -77,51 +69,6 @@ export class RemoteAgent {
77
69
  });
78
70
  }
79
71
 
80
- /**
81
- * 列出远程 Agent 的 shell pending approvals。
82
- */
83
- async approvals(): Promise<ShellApprovalView[]> {
84
- return await this.transport.approvals();
85
- }
86
-
87
- /**
88
- * 列出远程 Agent 显式设置过的 shell approval 模式。
89
- */
90
- async approval_modes(): Promise<ShellApprovalModeOption[]> {
91
- return await this.transport.approval_modes();
92
- }
93
-
94
- /**
95
- * 读取远程 Agent 指定 session 的 shell approval 模式。
96
- */
97
- async approval_mode(input: { session_id: string }): Promise<ShellSessionApprovalModeView> {
98
- return await this.transport.approval_mode(input);
99
- }
100
-
101
- /**
102
- * 设置远程 Agent 指定 session 的 shell approval 模式。
103
- */
104
- async set_approval_mode(input: {
105
- session_id: string;
106
- mode: ShellApprovalMode;
107
- }): Promise<ShellApprovalModeUpdateResult> {
108
- return await this.transport.set_approval_mode(input);
109
- }
110
-
111
- /**
112
- * 批准远程 Agent 的 shell approval。
113
- */
114
- async approve(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
115
- return await this.transport.approve(input);
116
- }
117
-
118
- /**
119
- * 拒绝远程 Agent 的 shell approval。
120
- */
121
- async deny(input: { approval_id: string }): Promise<ShellApprovalDecisionResult> {
122
- return await this.transport.deny(input);
123
- }
124
-
125
72
  /**
126
73
  * 关闭远程 transport。
127
74
  *