@clawos-dev/clawd 0.2.43-beta.64.8ecc6a7 → 0.2.43

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 (2) hide show
  1. package/dist/cli.cjs +66 -2
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -4375,6 +4375,9 @@ var init_methods = __esm({
4375
4375
  // AskUserQuestion 表单回写:UI 答完所有 question 后调用,daemon 把答案合并进 updated_input
4376
4376
  // 写一条 control_response 到 CC stdin(详见 events.ts session:question JSDoc)
4377
4377
  "session:answerQuestion",
4378
+ // AskUserQuestion 用户跳过:daemon 向 CC 回 allow + answers={} 让 tool 走空答案路径,
4379
+ // 同时广播 cleared 帧(无 answers)让所有客户端 UI 卡片转 Ended
4380
+ "session:cancelQuestion",
4378
4381
  "history:projects",
4379
4382
  "history:list",
4380
4383
  "history:read",
@@ -8655,7 +8658,7 @@ var init_persona_schemas = __esm({
8655
8658
  });
8656
8659
 
8657
8660
  // ../protocol/src/schemas.ts
8658
- var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionSubscribeArgs, SessionPinArgs, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, GitWorktreePrefixArgs, GitWorktreePrefixResponseSchema, GitWorktreeCreateArgs, GitWorktreeCreateResponseSchema, GitWorktreeRemoveArgs, GitWorktreeRemoveResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelExitedEventSchema, InfoRunningSessionSchema, InfoResponseSchema;
8661
+ var SessionStatusSchema, UsageSchema, ContextUsageSchema, sessionMetaShape, SessionMetaSchema, ModelInfoSchema, ModeInfoSchema, ConfigFieldSchemaSchema, CapabilitiesGetArgs, CapabilitiesResponseSchema, AllowRuleSchema, SessionFileSchema, ParsedEventBase, HistoryUserMetaSchema, SubagentToolStatsSchema, StructuredPatchHunkSchema, ToolResultExtraSchema, MemoryEntrySchema, AskQuestionOptionSchema, AskQuestionItemSchema, ParsedEventSchema, SessionCreateArgs, SessionIdArgs, SessionUpdateArgs, SessionSendArgs, SessionRewindArgs, SessionRewindResponseSchema, SessionRewindDiffArgs, RewindDiffHunkSchema, RewindDiffFileSchema, SessionRewindDiffResponseSchema, SessionRewindableMessageIdsArgs, SessionRewindableMessageIdsResponseSchema, SessionResumeArgs, SessionForkArgs, SessionForkResponseSchema, SessionObserveArgs, SessionEventsArgs, PermissionRespondArgs, HistoryListArgs, HistoryReadArgs, HistorySubagentsArgs, HistorySubagentReadArgs, WorkspaceListArgs, WorkspaceReadArgs, SkillsListArgs, SkillEntrySchema, AgentEntrySchema, AgentsListArgs, AgentsListResponseSchema, SessionSubscribeArgs, SessionPinArgs, SessionReorderPinsArgs, GitRootArgs, GitRootResponseSchema, GitBranchArgs, GitBranchResponseSchema, GitBranchesArgs, GitBranchesResponseSchema, GitWorktreePrefixArgs, GitWorktreePrefixResponseSchema, GitWorktreeCreateArgs, GitWorktreeCreateResponseSchema, GitWorktreeRemoveArgs, GitWorktreeRemoveResponseSchema, HistoryRecentDirsArgs, RecentDirEntrySchema, HistoryRecentDirsResponseSchema, SessionQuestionFrameSchema, SessionQuestionClearedFrameSchema, AnswerQuestionArgs, AnswerQuestionResponseSchema, CancelQuestionArgs, CancelQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelExitedEventSchema, InfoRunningSessionSchema, InfoResponseSchema;
8659
8662
  var init_schemas = __esm({
8660
8663
  "../protocol/src/schemas.ts"() {
8661
8664
  "use strict";
@@ -9177,6 +9180,11 @@ var init_schemas = __esm({
9177
9180
  answers: external_exports.record(external_exports.string(), external_exports.string())
9178
9181
  });
9179
9182
  AnswerQuestionResponseSchema = external_exports.object({ ok: external_exports.literal(true) });
9183
+ CancelQuestionArgs = external_exports.object({
9184
+ sessionId: external_exports.string().min(1),
9185
+ toolUseId: external_exports.string().min(1)
9186
+ });
9187
+ CancelQuestionResponseSchema = external_exports.object({ ok: external_exports.literal(true) });
9180
9188
  AuthRequestFrameSchema = external_exports.object({
9181
9189
  type: external_exports.literal("auth"),
9182
9190
  token: external_exports.string().min(1),
@@ -16188,6 +16196,31 @@ function reduceSession(state, input, deps) {
16188
16196
  ]
16189
16197
  };
16190
16198
  }
16199
+ case "cancel-question": {
16200
+ const pending = state.pendingQuestions?.[input.toolUseId];
16201
+ if (!pending) {
16202
+ return { state, effects: [] };
16203
+ }
16204
+ const next = cloneState(state);
16205
+ const nextPending = { ...next.pendingQuestions };
16206
+ delete nextPending[input.toolUseId];
16207
+ next.pendingQuestions = nextPending;
16208
+ const sessionId = next.file.sessionId;
16209
+ return {
16210
+ state: next,
16211
+ effects: [
16212
+ // cleared(no answers) broadcast:UI dispatch session:question:clear → 卡片转 Ended。
16213
+ {
16214
+ kind: "emit-frame",
16215
+ frame: {
16216
+ type: "session:question:cleared",
16217
+ sessionId,
16218
+ toolUseId: input.toolUseId
16219
+ }
16220
+ }
16221
+ ]
16222
+ };
16223
+ }
16191
16224
  case "idle-kill-fired": {
16192
16225
  if (state.status !== "running-idle") {
16193
16226
  return { state, effects: [] };
@@ -17491,6 +17524,31 @@ var SessionManager = class {
17491
17524
  });
17492
17525
  return { response: { ok: true }, broadcast };
17493
17526
  }
17527
+ // AskUserQuestion 用户跳过:与官方 CC CLI Esc 行为对齐——**不向 CC 发 tool 结果**,而是发
17528
+ // control_request.subtype='interrupt'(与 session:interrupt 同一条路径)中断整个 turn,
17529
+ // tool call 在 CC 端不返回任何 result。Reducer 同步清 pendingQuestions[toolUseId] + 发
17530
+ // cleared 帧(answers 缺省)让 UI 转 Ended 只读态。
17531
+ //
17532
+ // - session 不存在 / 无 runner / procAlive=false → noop 幂等返回(与 answerQuestion 同语义)
17533
+ // - sendControlRequest 失败(CC 退出 / 超时)→ 不抛:cleared 帧已发,UI 状态已收敛
17534
+ async cancelQuestion(args) {
17535
+ const runner = this.runners.get(args.sessionId);
17536
+ if (!runner) {
17537
+ return { response: { ok: true }, broadcast: [] };
17538
+ }
17539
+ const hit = Boolean(runner.getState().pendingQuestions?.[args.toolUseId]);
17540
+ if (!hit) {
17541
+ return { response: { ok: true }, broadcast: [] };
17542
+ }
17543
+ const { broadcast } = this.withCollector(() => {
17544
+ runner.input({ kind: "cancel-question", toolUseId: args.toolUseId });
17545
+ });
17546
+ if (runner.getState().procAlive) {
17547
+ void runner.sendControlRequest("interrupt").catch(() => {
17548
+ });
17549
+ }
17550
+ return { response: { ok: true }, broadcast };
17551
+ }
17494
17552
  // 权限决定:dispatcher 收到 permission:respond 时调用
17495
17553
  // 先查 state.pendingPermissions:不存在 → 抛 PERMISSION_REQUEST_STALE
17496
17554
  respondPermission(args) {
@@ -19890,6 +19948,11 @@ function buildSessionHandlers(deps) {
19890
19948
  const { response, broadcast } = manager.answerQuestion(args);
19891
19949
  return { response: { type: "session:answerQuestion", ...response }, broadcast };
19892
19950
  };
19951
+ const cancelQuestion = async (frame) => {
19952
+ const args = CancelQuestionArgs.parse(frame);
19953
+ const { response, broadcast } = await manager.cancelQuestion(args);
19954
+ return { response: { type: "session:cancelQuestion", ...response }, broadcast };
19955
+ };
19893
19956
  return {
19894
19957
  "session:create": create,
19895
19958
  "session:list": list,
@@ -19911,7 +19974,8 @@ function buildSessionHandlers(deps) {
19911
19974
  "session:unsubscribe": unsubscribe,
19912
19975
  "session:pin": pin,
19913
19976
  "session:reorderPins": reorderPins,
19914
- "session:answerQuestion": answerQuestion
19977
+ "session:answerQuestion": answerQuestion,
19978
+ "session:cancelQuestion": cancelQuestion
19915
19979
  };
19916
19980
  }
19917
19981
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.43-beta.64.8ecc6a7",
3
+ "version": "0.2.43",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",