lark-remote 0.4.4 → 0.5.0

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 (170) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/binder.d.ts +11 -10
  3. package/dist/binder.js +17 -16
  4. package/dist/bridge/approval-coordinator.d.ts +1 -1
  5. package/dist/bridge/approval-coordinator.js +3 -3
  6. package/dist/bridge/inbound-media.d.ts +1 -27
  7. package/dist/bridge/inbound-media.js +23 -21
  8. package/dist/bridge/index.d.ts +57 -57
  9. package/dist/bridge/index.js +136 -129
  10. package/dist/bridge/queue-manager.d.ts +45 -38
  11. package/dist/bridge/queue-manager.js +136 -136
  12. package/dist/card/approval-render.d.ts +1 -1
  13. package/dist/card/approval-render.js +6 -6
  14. package/dist/card/bash-card-session.d.ts +3 -3
  15. package/dist/card/bash-card-session.js +3 -3
  16. package/dist/card/bash-renderer.js +5 -5
  17. package/dist/card/card-session.d.ts +4 -4
  18. package/dist/card/card-session.js +6 -6
  19. package/dist/card/card-shared.d.ts +1 -1
  20. package/dist/card/card-shared.js +2 -2
  21. package/dist/card/run-card-session.js +2 -2
  22. package/dist/card/run-renderer.d.ts +1 -1
  23. package/dist/card/run-renderer.js +22 -22
  24. package/dist/card/run-state.d.ts +2 -2
  25. package/dist/card/run-state.js +3 -3
  26. package/dist/card/tool-render.d.ts +1 -1
  27. package/dist/card/tool-render.js +6 -6
  28. package/dist/cli.js +5 -6
  29. package/dist/clone.d.ts +6 -9
  30. package/dist/clone.js +12 -8
  31. package/dist/common/clamp.d.ts +2 -0
  32. package/dist/common/clamp.js +5 -0
  33. package/dist/common/fs.d.ts +4 -3
  34. package/dist/common/fs.js +5 -4
  35. package/dist/common/truncate.d.ts +1 -1
  36. package/dist/common/truncate.js +2 -2
  37. package/dist/common/ttl-cache.d.ts +2 -2
  38. package/dist/common/ttl-cache.js +2 -2
  39. package/dist/config/codex-config.d.ts +9 -9
  40. package/dist/config/codex-config.js +18 -18
  41. package/dist/config/dir.d.ts +4 -5
  42. package/dist/config/dir.js +12 -10
  43. package/dist/config/index.d.ts +3 -3
  44. package/dist/config/index.js +6 -6
  45. package/dist/config/opencode-config.js +3 -3
  46. package/dist/config/wizard.js +2 -2
  47. package/dist/connector/index.d.ts +5 -7
  48. package/dist/connector/index.js +29 -16
  49. package/dist/inbound/event.d.ts +1 -1
  50. package/dist/inbound/event.js +1 -1
  51. package/dist/inbound/placeholder.d.ts +2 -2
  52. package/dist/inbound/placeholder.js +2 -2
  53. package/dist/inbound/receipt.d.ts +1 -3
  54. package/dist/inbound/receipt.js +2 -2
  55. package/dist/inbound/turn-assembler.d.ts +1 -3
  56. package/dist/inbound/turn-assembler.js +2 -2
  57. package/dist/index.js +38 -30
  58. package/dist/instance-lock.js +8 -7
  59. package/dist/logger/index.d.ts +1 -1
  60. package/dist/logger/index.js +4 -4
  61. package/dist/persistence/atomic-write.d.ts +1 -1
  62. package/dist/persistence/atomic-write.js +9 -5
  63. package/dist/platform/agent-stopper.d.ts +2 -2
  64. package/dist/platform/identity.d.ts +7 -1
  65. package/dist/platform/identity.js +2 -2
  66. package/dist/platform/path.d.ts +6 -0
  67. package/dist/platform/path.js +14 -8
  68. package/dist/platform/select.d.ts +1 -1
  69. package/dist/platform/select.js +1 -1
  70. package/dist/platform/shell.d.ts +2 -3
  71. package/dist/platform/spawn.d.ts +2 -2
  72. package/dist/platform/spawn.js +2 -2
  73. package/dist/platform/terminator-posix.js +6 -6
  74. package/dist/platform/terminator-win32.js +3 -3
  75. package/dist/platform/terminator.d.ts +3 -3
  76. package/dist/platform/terminator.js +2 -2
  77. package/dist/platform/types.d.ts +1 -1
  78. package/dist/restart.d.ts +1 -1
  79. package/dist/restart.js +5 -3
  80. package/dist/router/card-helpers.d.ts +1 -3
  81. package/dist/router/card-helpers.js +2 -2
  82. package/dist/router/config/codex.d.ts +1 -1
  83. package/dist/router/config/codex.js +3 -3
  84. package/dist/router/config/common/model-patch.d.ts +1 -2
  85. package/dist/router/config/common/model-patch.js +1 -2
  86. package/dist/router/config/opencode.js +2 -2
  87. package/dist/router/config/pi.js +1 -1
  88. package/dist/router/index.d.ts +30 -30
  89. package/dist/router/index.js +103 -84
  90. package/dist/router/order-exec-dispatch.d.ts +3 -10
  91. package/dist/router/order-exec-dispatch.js +5 -5
  92. package/dist/router/{utils.d.ts → usage-format.d.ts} +2 -4
  93. package/dist/router/{utils.js → usage-format.js} +3 -8
  94. package/dist/runner/bash/runner.d.ts +2 -2
  95. package/dist/runner/bash/runner.js +6 -6
  96. package/dist/runner/claude/runner.d.ts +1 -1
  97. package/dist/runner/claude/runner.js +2 -3
  98. package/dist/runner/claude/session.d.ts +4 -6
  99. package/dist/runner/claude/session.js +21 -23
  100. package/dist/runner/codex/app-server/runner.js +3 -3
  101. package/dist/runner/codex/app-server/translator.d.ts +2 -2
  102. package/dist/runner/codex/app-server/translator.js +5 -5
  103. package/dist/runner/common/acp/{protocol-helpers.d.ts → acp-approval.d.ts} +4 -10
  104. package/dist/runner/common/acp/{protocol-helpers.js → acp-approval.js} +7 -6
  105. package/dist/runner/common/acp/base-acp-runner.d.ts +1 -1
  106. package/dist/runner/common/acp/base-acp-runner.js +2 -2
  107. package/dist/runner/common/acp/base-translator.d.ts +3 -3
  108. package/dist/runner/common/acp/base-translator.js +4 -4
  109. package/dist/runner/common/acp/protocol-types.js +1 -1
  110. package/dist/runner/common/connection-based-runner.d.ts +5 -5
  111. package/dist/runner/common/connection-based-runner.js +5 -5
  112. package/dist/runner/common/jsonl-stream.d.ts +2 -2
  113. package/dist/runner/common/jsonl-stream.js +12 -12
  114. package/dist/runner/common/jsonrpc/client.d.ts +1 -1
  115. package/dist/runner/common/jsonrpc/client.js +1 -1
  116. package/dist/runner/common/jsonrpc/connection-manager.d.ts +13 -13
  117. package/dist/runner/common/jsonrpc/connection-manager.js +37 -37
  118. package/dist/runner/common/jsonrpc/transport.d.ts +1 -1
  119. package/dist/runner/common/jsonrpc/transport.js +2 -2
  120. package/dist/runner/common/{usage.d.ts → result-usage.d.ts} +1 -1
  121. package/dist/runner/common/{usage.js → result-usage.js} +2 -2
  122. package/dist/runner/common/spawning-runner.d.ts +23 -10
  123. package/dist/runner/common/spawning-runner.js +48 -22
  124. package/dist/runner/common/{runner-utils.d.ts → synthetic-events.d.ts} +4 -4
  125. package/dist/runner/common/{runner-utils.js → synthetic-events.js} +5 -5
  126. package/dist/runner/dsh/client.d.ts +1 -1
  127. package/dist/runner/dsh/client.js +1 -1
  128. package/dist/runner/dsh/runner.js +3 -3
  129. package/dist/runner/kimi/acp/runner.d.ts +4 -4
  130. package/dist/runner/kimi/acp/runner.js +10 -10
  131. package/dist/runner/kimi/acp/translator.d.ts +2 -2
  132. package/dist/runner/kimi/acp/translator.js +5 -5
  133. package/dist/runner/opencode/acp/runner.d.ts +4 -4
  134. package/dist/runner/opencode/acp/runner.js +4 -4
  135. package/dist/runner/opencode/acp/translator.js +2 -2
  136. package/dist/runner/pi/rpc/runner.d.ts +1 -1
  137. package/dist/runner/pi/rpc/runner.js +2 -2
  138. package/dist/runner/pi/rpc/translator.d.ts +1 -2
  139. package/dist/runner/pi/rpc/translator.js +4 -6
  140. package/dist/runner/registry.d.ts +3 -3
  141. package/dist/runner/registry.js +3 -3
  142. package/dist/runner/types.d.ts +1 -1
  143. package/dist/session/claude/session-index.d.ts +13 -1
  144. package/dist/session/claude/session-index.js +21 -6
  145. package/dist/session/claude/session-reader.d.ts +1 -1
  146. package/dist/session/claude/session-reader.js +1 -1
  147. package/dist/session/claude/sessions.js +10 -10
  148. package/dist/session/codex/rollout-reader.d.ts +4 -4
  149. package/dist/session/codex/rollout-reader.js +14 -14
  150. package/dist/session/common/two-pass.js +2 -2
  151. package/dist/session/common/usage-accumulator.d.ts +2 -2
  152. package/dist/session/common/usage-accumulator.js +2 -2
  153. package/dist/session/dsh/sessions.d.ts +1 -1
  154. package/dist/session/dsh/sessions.js +3 -3
  155. package/dist/session/kimi/sessions.d.ts +2 -6
  156. package/dist/session/kimi/sessions.js +13 -19
  157. package/dist/session/opencode/sessions.d.ts +3 -3
  158. package/dist/session/opencode/sessions.js +15 -13
  159. package/dist/session/pi/sessions.js +13 -12
  160. package/dist/session/registry.d.ts +1 -1
  161. package/dist/session/registry.js +1 -1
  162. package/dist/session/session-store.d.ts +3 -4
  163. package/dist/session/session-store.js +3 -5
  164. package/dist/update/index.d.ts +1 -1
  165. package/dist/update/index.js +1 -1
  166. package/dist/update/version-check.d.ts +5 -3
  167. package/dist/update/version-check.js +10 -8
  168. package/dist/workspace/index.d.ts +4 -4
  169. package/dist/workspace/index.js +5 -5
  170. package/package.json +1 -1
@@ -28,20 +28,20 @@ interface BridgeChannel extends RunCardChannel {
28
28
  addReaction(messageId: string, emoji: string): Promise<void>;
29
29
  removeReactionByEmoji(messageId: string, emoji: string): Promise<void>;
30
30
  }
31
- /** Caller context for a bridge operation. */
32
- interface BridgeContext {
31
+ /** Caller context shared by bridge operations and router command handling. */
32
+ export interface CommandContext {
33
33
  userId: string;
34
34
  chatId: string;
35
35
  messageId: string;
36
36
  /**
37
37
  * 本轮(装配窗口)全部入站 messageId,`messageId` 是其中最后一条。
38
38
  * 只有走入站装配器的路径会填;卡片动作等单消息路径留空,收尾退化为只处理
39
- * `messageId`。缺它会导致合并轮次里先到的消息挂着 Typing 不撤(§B8)。
39
+ * `messageId`。缺它会导致合并轮次里先到的消息挂着 Typing 不撤。
40
40
  */
41
41
  turnMessageIds?: string[];
42
42
  }
43
- /** A sendable result payload (mirror of the router's CommandResult shape). */
44
- interface BridgeResult {
43
+ /** A sendable result payload returned by a command handler. */
44
+ export interface CommandResult {
45
45
  text?: string;
46
46
  markdown?: string;
47
47
  card?: object;
@@ -74,7 +74,7 @@ interface BridgeDeps {
74
74
  /** Override the idle watchdog timeout (default 15 min). Tests use a small value. */
75
75
  idleTimeoutMs?: number;
76
76
  /**
77
- * Multi-agent registry. `getRunner(workspace)` looks up
77
+ * Multi-agent registry. `getRunner(cwd)` looks up
78
78
  * `config.defaultAgent` here.
79
79
  */
80
80
  agentRegistry: AgentRegistry;
@@ -91,10 +91,10 @@ interface BridgeDeps {
91
91
  *
92
92
  * The router delegates non-command messages here via `forwardToClaude` and
93
93
  * sends command results via `sendResult`. Serial processing is enforced per
94
- * workspace by `enqueue`: each workspace has its own Promise chain, so at
95
- * most one agent process runs per workspace at a time, while different
94
+ * cwd by `enqueue`: each cwd has its own Promise chain, so at
95
+ * most one agent process runs per cwd at a time, while different
96
96
  * workspaces run in parallel (see `activeRuns`, §9.6). This is a load-bearing
97
- * invariant — concurrent spawns within one workspace would corrupt session
97
+ * invariant — concurrent spawns within one cwd would corrupt session
98
98
  * state. Most card actions go through `enqueueImmediate` (fire-and-forget,
99
99
  * outside the serial chain); only run-forwarding is serialized.
100
100
  *
@@ -127,8 +127,8 @@ export declare class Bridge {
127
127
  */
128
128
  private runners;
129
129
  /**
130
- * Runner 槽位在「活跃运行期间配置变更」时被标 stale(CC-06/P1):clearRunners() 对
131
- * 活跃 workspace 只标 stale、不立即 evict(避免误杀长驻连接),当前 run 结束后由
130
+ * Runner 槽位在「活跃运行期间配置变更」时被标 stale:clearRunners() 对
131
+ * 活跃 cwd 只标 stale、不立即 evict(避免误杀长驻连接),当前 run 结束后由
132
132
  * finalizeRun 安全 evict+dispose,下一轮 getRunner 创建新配置的 runner。
133
133
  * key 为 `${cwd}\u0000${agentKind}`。
134
134
  */
@@ -136,7 +136,7 @@ export declare class Bridge {
136
136
  /** Queue manager for per-workspace serial processing queue. */
137
137
  /** 普通消息队列管理器(public:测试注入 queue-card 状态用)。 */
138
138
  queueManager: QueueManager;
139
- /** Active runs per workspace (cwd). Multiple workspaces can run in parallel. */
139
+ /** Active runs per cwd (cwd). Multiple workspaces can run in parallel. */
140
140
  private activeRuns;
141
141
  /** Approval coordinators keyed by runId. */
142
142
  private approvalCoordinators;
@@ -144,17 +144,17 @@ export declare class Bridge {
144
144
  * 最近一次已完成的、runner 有 runCompact 的 run(按 cwd)。run 结束后
145
145
  * activeRuns 已清空,Compact 需要它来校验 runId 并提供 sessionId。
146
146
  */
147
- private lastCompactableCodexRun;
147
+ private lastCompactableRun;
148
148
  /**
149
149
  * Active `!` bash runs, keyed by runId (NOT cwd). Bash runs bypass the serial
150
150
  * queue and may run in parallel with claude runs / other bash runs in the same
151
- * workspace, so they live outside `activeRuns`. Tracked so `/stop` can reach
151
+ * cwd, so they live outside `activeRuns`. Tracked so `/stop` can reach
152
152
  * the per-run BashRunner instance via interruptCurrentRun.
153
153
  */
154
154
  private activeBashRuns;
155
155
  constructor(deps: BridgeDeps);
156
156
  /**
157
- * Get or create a runner for the given workspace, keyed by current defaultAgent.
157
+ * Get or create a runner for the given cwd, keyed by current defaultAgent.
158
158
  *
159
159
  * Fix 4 (2026-07-18): Cache key includes agentKind, so switching defaultAgent
160
160
  * creates a NEW runner under a different key without evicting the old one.
@@ -174,17 +174,17 @@ export declare class Bridge {
174
174
  syncActiveApprovalModes(): void;
175
175
  /** Per-agent approval-mode settings snapshot from the current config. */
176
176
  private approvalModeSettingsFor;
177
- /** Get the current runner for a workspace. Used by router for agent-specific commands (P3.2). */
178
- getCurrentRunner(workspace: string): AgentRunner;
177
+ /** Get the current runner for a cwd. Used by router for agent-specific commands (.2). */
178
+ getCurrentRunner(cwd: string): AgentRunner;
179
179
  /**
180
180
  * Whether the runner for the given agent kind has runCompact capability.
181
- * Used by router for compact button gating (design doc §6.2-2: duck-typing
181
+ * Used by router for compact button gating (duck-typing
182
182
  * instead of hardcoding agentKind === 'codex').
183
183
  */
184
- hasRunCompact(workspace: string, kind?: AgentKind): boolean;
184
+ hasRunCompact(cwd: string, kind?: AgentKind): boolean;
185
185
  /** 入队时刻快照:当前 defaultAgent + 该 agent 的 sessionId(无 session 则 undefined)。
186
- * 唯一捕获点:排队消息在 T0 把 agent+session 钉进 AgentBinding,随任务闭包带到 T1
187
- * 执行时刻,避免 /new、/config 在排队期间改写 live 状态导致语义漂移(方案 D4)。 */
186
+ * 唯一捕获点:排队消息在入队时刻把 agent+session 钉进 AgentBinding,随任务闭包带到执行时刻
187
+ * 执行时刻,避免 /new、/config 在排队期间改写 live 状态导致语义漂移。 */
188
188
  currentBinding(userId: string): AgentBinding;
189
189
  /**
190
190
  * Clear all cached runner instances. Call after config changes that affect runner config.
@@ -192,7 +192,7 @@ export declare class Bridge {
192
192
  clearRunners(): void;
193
193
  /**
194
194
  * Evict a (cwd, agentKind) runner cache slot. Unregisters the runner from the
195
- * process-level exit dispatcher first (P1-1: without removal the singleton
195
+ * process-level exit dispatcher first (without removal the singleton
196
196
  * Set<Runner> retains every historical runner instance, so memory still grows
197
197
  * with run count), then deletes the slot. Every runner-discarding path
198
198
  * (clearRunners / finalizeRun / interruptCurrentRun) must go through this.
@@ -221,36 +221,36 @@ export declare class Bridge {
221
221
  * Enqueue a task into the workspace-level serial bridge queue.
222
222
  * Delegates to QueueManager for actual implementation.
223
223
  */
224
- enqueue(workspace: string, task: () => Promise<void>, opts?: EnqueueOptions): void;
224
+ enqueue(cwd: string, task: () => Promise<void>, opts?: EnqueueOptions): void;
225
225
  /**
226
226
  * Execute a task immediately without going through the queue.
227
227
  * Used for / commands that should respond immediately.
228
228
  */
229
- enqueueImmediate(workspace: string, task: () => Promise<void>): void;
230
- /** Get queue info for a workspace. */
231
- getQueueInfo(workspace: string): {
229
+ enqueueImmediate(cwd: string, task: () => Promise<void>): void;
230
+ /** Get queue info for a cwd. */
231
+ getQueueInfo(cwd: string): {
232
232
  position: number;
233
233
  tasksAhead: number;
234
234
  isRunning: boolean;
235
235
  };
236
236
  /** Remove a task from the queue by messageId. Returns true if found and removed. */
237
- removeFromQueue(workspace: string, messageId: string): boolean;
237
+ removeFromQueue(cwd: string, messageId: string): boolean;
238
238
  /**
239
239
  * One-shot: replace the execution closure of an existing queued task in
240
240
  * place, preserving its queue position. Used by queue.immediate after the
241
241
  * user edits a queued message (see router handleQueueImmediate).
242
242
  */
243
- setTaskReplacement(workspace: string, messageId: string, task: () => Promise<void>): void;
243
+ setTaskReplacement(cwd: string, messageId: string, task: () => Promise<void>): void;
244
244
  /** Update queue card to "cancelled" status when user clicks 撤销. */
245
- updateQueueCardToCancelled(workspace: string, messageId: string): Promise<void>;
245
+ updateQueueCardToCancelled(cwd: string, messageId: string): Promise<void>;
246
246
  /** Mark a queued task's card as executing immediately (grey out buttons).
247
247
  * Called by handleQueueImmediate so the user sees feedback right away
248
248
  * instead of waiting for the queue callback. Idempotent: the queue
249
249
  * callback's own updateQueueCardToExecuting call becomes a no-op because
250
250
  * updateQueueCardToExecuting deletes the card-message mapping in finally. */
251
- markQueueCardExecuting(workspace: string, messageId: string): Promise<void>;
251
+ markQueueCardExecuting(cwd: string, messageId: string): Promise<void>;
252
252
  /** Get task metadata from queue. */
253
- getQueuedTask(workspace: string, messageId: string): QueuedTask | undefined;
253
+ getQueuedTask(cwd: string, messageId: string): QueuedTask | undefined;
254
254
  /**
255
255
  * Whether a task with the given messageId has begun executing and has not
256
256
  * settled yet. Lets handleQueueImmediate's final feedback distinguish a
@@ -259,8 +259,8 @@ export declare class Bridge {
259
259
  * "未安排执行").
260
260
  */
261
261
  hasTaskBegan(messageId: string): boolean;
262
- /** Get all queued tasks for a workspace. Returns a copy to prevent aliasing bugs. */
263
- getQueuedTasks(workspace: string): QueuedTask[];
262
+ /** Get all queued tasks for a cwd. Returns a copy to prevent aliasing bugs. */
263
+ getQueuedTasks(cwd: string): QueuedTask[];
264
264
  /**
265
265
  * Update the messagePreview for a queued task and build the updated queue
266
266
  * card. Returns the card object to send back as the cardAction callback
@@ -268,11 +268,11 @@ export declare class Bridge {
268
268
  * queued. Returning the card via the callback response avoids the
269
269
  * PATCH-vs-callback-response race that left the card stuck in edit state.
270
270
  */
271
- updateMessagePreview(workspace: string, messageId: string, newMessage: string): Promise<object | null>;
272
- /** Whether a claude run is currently in progress in the given workspace. */
273
- isBusyFor(workspace: string): boolean;
274
- getActiveRunFor(workspace: string): ActiveRunSnapshot | undefined;
275
- /** Whether any claude run is currently in progress (any workspace). */
271
+ updateMessagePreview(cwd: string, messageId: string, newMessage: string): Promise<object | null>;
272
+ /** Whether a claude run is currently in progress in the given cwd. */
273
+ isBusyFor(cwd: string): boolean;
274
+ getActiveRunFor(cwd: string): ActiveRunSnapshot | undefined;
275
+ /** Whether any claude run is currently in progress (any cwd). */
276
276
  get isBusy(): boolean;
277
277
  /** Get all active runs across all workspaces. */
278
278
  getAllActiveRuns(): Map<string, {
@@ -303,12 +303,12 @@ export declare class Bridge {
303
303
  userId: string;
304
304
  chatId: string;
305
305
  runId?: string;
306
- /** Restrict the match to a single workspace (queue.immediate). When
307
- * omitted, all workspaces are candidates (used by /stop, /t, and card stop button which don't know which workspace to target). */
308
- workspace?: string;
306
+ /** Restrict the match to a single cwd (queue.immediate). When
307
+ * omitted, all workspaces are candidates (used by /stop, /t, and card stop button which don't know which cwd to target). */
308
+ cwd?: string;
309
309
  }): Promise<boolean>;
310
310
  /** Send a result message to the user (§7). Returns true on success, false on failure. */
311
- sendResult(result: BridgeResult, ctx: BridgeContext): Promise<boolean>;
311
+ sendResult(result: CommandResult, ctx: CommandContext): Promise<boolean>;
312
312
  /**
313
313
  * Update an existing card in place (原地更新) instead of sending a new one.
314
314
  *
@@ -322,9 +322,9 @@ export declare class Bridge {
322
322
  *
323
323
  * Returns true if the in-place update succeeded, false if it fell back.
324
324
  */
325
- updateCardInPlace(card: object, ctx: BridgeContext): Promise<boolean>;
325
+ updateCardInPlace(card: object, ctx: CommandContext): Promise<boolean>;
326
326
  /** Send a file to the user via Feishu. */
327
- sendFile(filePath: string, ctx: BridgeContext): Promise<void>;
327
+ sendFile(filePath: string, ctx: CommandContext): Promise<void>;
328
328
  /**
329
329
  * 入站媒体落盘(connector 下载完成后调用):只落盘并回报结果,
330
330
  * 时间语义与回执由 `InboundTurnAssembler` 统一负责。
@@ -332,7 +332,7 @@ export declare class Bridge {
332
332
  saveInboundMedia(payload: InboundMediaPayload): Promise<MediaOutcome>;
333
333
  /**
334
334
  * Resolve the working directory for a user.
335
- * First checks sessionStore (set by /cd), then falls back to first workspace.
335
+ * First checks sessionStore (set by /cd), then falls back to first cwd.
336
336
  * Returns undefined if no cwd is available.
337
337
  */
338
338
  private resolveCwd;
@@ -344,7 +344,7 @@ export declare class Bridge {
344
344
  * work queue. Session is synced from `system.init`; every renderable event
345
345
  * updates the same run card, and terminal events finalize that card.
346
346
  */
347
- forwardToClaude(message: string, ctx: BridgeContext, opts?: {
347
+ forwardToClaude(message: string, ctx: CommandContext, opts?: {
348
348
  cwdOverride?: string;
349
349
  binding?: AgentBinding;
350
350
  }): Promise<void>;
@@ -354,7 +354,7 @@ export declare class Bridge {
354
354
  */
355
355
  private createRunSession;
356
356
  /**
357
- * §9.12 空闲看门狗:单 interval + 截止时间判定(P2-1),普通 run 与 compact
357
+ * §9.12 空闲看门狗:单 interval + 截止时间判定,普通 run 与 compact
358
358
  * 共用同一套兜底。事件到达只 `touch()` 刷新时间戳(无 timer 操作);静默超过
359
359
  * `idleTimeoutMs` 才 finish('idle_timeout') + runner.stop(),让该工作区的串行
360
360
  * 队列继续推进(否则一个挂死的 run 永久堵住后续消息)。
@@ -443,7 +443,7 @@ export declare class Bridge {
443
443
  nonce: string;
444
444
  }): Promise<void>;
445
445
  /**
446
- * Claude AskUserQuestion 自定义答案(Other,review P3-4):自由文本直接
446
+ * Claude AskUserQuestion 自定义答案(Other):自由文本直接
447
447
  * 作为该单选问题的答案提交。路由到 ApprovalCoordinator.answerCustom。
448
448
  */
449
449
  handleApprovalAnswerCustom(opts: {
@@ -466,14 +466,14 @@ export declare class Bridge {
466
466
  nonce: string;
467
467
  }): Promise<void>;
468
468
  /**
469
- * Handle codex.compact card action — trigger a compaction request for any
469
+ * Handle compact card action — trigger a compaction request for any
470
470
  * runCompact-capable runner(codex/kimi/opencode/pi/claude,按
471
- * lastCompactableCodexRun 记录的 agentKind 路由)。Validates the run exists
471
+ * lastCompactableRun 记录的 agentKind 路由)。Validates the run exists
472
472
  * and is in a terminal state, then calls the runner's runCompact().
473
473
  */
474
- handleCodexCompact(value: {
474
+ handleCompactAction(value: {
475
475
  runId?: string;
476
- }, ctx: BridgeContext): Promise<void>;
476
+ }, ctx: CommandContext): Promise<void>;
477
477
  /**
478
478
  * §5.3: kimi 压缩在途检测——reader 鸭子实现 `readCompactionState` 时,若
479
479
  * wire 状态机判定当前有未终结的压缩(最后一次 begin 无 terminal 记录),
@@ -485,18 +485,18 @@ export declare class Bridge {
485
485
  * Stream a compaction to a card: start a RunCardSession with
486
486
  * operationKind='compaction' (no recursive Compact button), consume
487
487
  * runner.runCompact() events, read authoritative jsonl usage, and finish
488
- * the card. Shared by handleCodexCompact (run card button) and
488
+ * the card. Shared by handleCompactAction (run card button) and
489
489
  * handleResumeCompact (resume cards) so both flows stay in sync.
490
490
  *
491
491
  * Precondition: callers have already validated that `runner` implements
492
492
  * runCompact and that the session exists in `cwd`.
493
493
  */
494
- private streamCodexCompact;
494
+ private streamCompact;
495
495
  /**
496
496
  * Handle resume.compact card action — compact a session directly from a
497
497
  * resume card (auto-resume / `/resume <id>`), without a runId.
498
498
  *
499
- * Unlike handleCodexCompact (which validates against the last finished run's
499
+ * Unlike handleCompactAction (which validates against the last finished run's
500
500
  * runId), the resume card carries the sessionId + agent it was rendered for.
501
501
  * Validation: the session must exist in the current cwd (same rule as
502
502
  * cmdResume / resume.use) and the runner must implement runCompact.
@@ -504,14 +504,14 @@ export declare class Bridge {
504
504
  handleResumeCompact(value: {
505
505
  sessionId?: string;
506
506
  agent?: string;
507
- }, ctx: BridgeContext): Promise<void>;
507
+ }, ctx: CommandContext): Promise<void>;
508
508
  /**
509
509
  * Execute a bash command and stream output to a card.
510
510
  * `!` commands bypass the serial queue entirely (see body comment + §9.6):
511
511
  * bash runs in parallel with same-workspace agent runs, tracked in
512
512
  * `activeBashRuns` separately from `activeRuns`.
513
513
  */
514
- executeBash(command: string, ctx: BridgeContext): Promise<void>;
514
+ executeBash(command: string, ctx: CommandContext): Promise<void>;
515
515
  /**
516
516
  * Internal execution of bash command (called directly from executeBash,
517
517
  * bypassing the serial queue — see executeBash).