@clawos-dev/clawd 0.2.41-beta.61.b447af7 → 0.2.42-beta.62.2e07b2e
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.
- package/dist/cli.cjs +71 -16
- 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",
|
|
@@ -8592,7 +8595,7 @@ var init_zod = __esm({
|
|
|
8592
8595
|
});
|
|
8593
8596
|
|
|
8594
8597
|
// ../protocol/src/persona-schemas.ts
|
|
8595
|
-
var PersonaTokenEntrySchema, PersonaFileSchema,
|
|
8598
|
+
var PersonaTokenEntrySchema, PersonaFileSchema, PersonaCreateArgsSchema, PersonaIdArgsSchema, PersonaUpdateArgsSchema, PersonaIssueTokenArgsSchema, PersonaRevokeTokenArgsSchema, PersonaAppendOwnerMessageArgsSchema;
|
|
8596
8599
|
var init_persona_schemas = __esm({
|
|
8597
8600
|
"../protocol/src/persona-schemas.ts"() {
|
|
8598
8601
|
"use strict";
|
|
@@ -8614,9 +8617,6 @@ var init_persona_schemas = __esm({
|
|
|
8614
8617
|
createdAt: external_exports.number(),
|
|
8615
8618
|
updatedAt: external_exports.number()
|
|
8616
8619
|
}).strict();
|
|
8617
|
-
PersonaInfoResponseSchema = PersonaFileSchema.extend({
|
|
8618
|
-
personality: external_exports.string().optional()
|
|
8619
|
-
});
|
|
8620
8620
|
PersonaCreateArgsSchema = external_exports.object({
|
|
8621
8621
|
label: external_exports.string().min(1),
|
|
8622
8622
|
personality: external_exports.string(),
|
|
@@ -8655,7 +8655,7 @@ var init_persona_schemas = __esm({
|
|
|
8655
8655
|
});
|
|
8656
8656
|
|
|
8657
8657
|
// ../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;
|
|
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, CancelQuestionArgs, CancelQuestionResponseSchema, AuthRequestFrameSchema, AuthOkFrameSchema, TunnelExitedEventSchema, InfoRunningSessionSchema, InfoResponseSchema;
|
|
8659
8659
|
var init_schemas = __esm({
|
|
8660
8660
|
"../protocol/src/schemas.ts"() {
|
|
8661
8661
|
"use strict";
|
|
@@ -9177,6 +9177,11 @@ var init_schemas = __esm({
|
|
|
9177
9177
|
answers: external_exports.record(external_exports.string(), external_exports.string())
|
|
9178
9178
|
});
|
|
9179
9179
|
AnswerQuestionResponseSchema = external_exports.object({ ok: external_exports.literal(true) });
|
|
9180
|
+
CancelQuestionArgs = external_exports.object({
|
|
9181
|
+
sessionId: external_exports.string().min(1),
|
|
9182
|
+
toolUseId: external_exports.string().min(1)
|
|
9183
|
+
});
|
|
9184
|
+
CancelQuestionResponseSchema = external_exports.object({ ok: external_exports.literal(true) });
|
|
9180
9185
|
AuthRequestFrameSchema = external_exports.object({
|
|
9181
9186
|
type: external_exports.literal("auth"),
|
|
9182
9187
|
token: external_exports.string().min(1),
|
|
@@ -16188,6 +16193,31 @@ function reduceSession(state, input, deps) {
|
|
|
16188
16193
|
]
|
|
16189
16194
|
};
|
|
16190
16195
|
}
|
|
16196
|
+
case "cancel-question": {
|
|
16197
|
+
const pending = state.pendingQuestions?.[input.toolUseId];
|
|
16198
|
+
if (!pending) {
|
|
16199
|
+
return { state, effects: [] };
|
|
16200
|
+
}
|
|
16201
|
+
const next = cloneState(state);
|
|
16202
|
+
const nextPending = { ...next.pendingQuestions };
|
|
16203
|
+
delete nextPending[input.toolUseId];
|
|
16204
|
+
next.pendingQuestions = nextPending;
|
|
16205
|
+
const sessionId = next.file.sessionId;
|
|
16206
|
+
return {
|
|
16207
|
+
state: next,
|
|
16208
|
+
effects: [
|
|
16209
|
+
// cleared(no answers) broadcast:UI dispatch session:question:clear → 卡片转 Ended。
|
|
16210
|
+
{
|
|
16211
|
+
kind: "emit-frame",
|
|
16212
|
+
frame: {
|
|
16213
|
+
type: "session:question:cleared",
|
|
16214
|
+
sessionId,
|
|
16215
|
+
toolUseId: input.toolUseId
|
|
16216
|
+
}
|
|
16217
|
+
}
|
|
16218
|
+
]
|
|
16219
|
+
};
|
|
16220
|
+
}
|
|
16191
16221
|
case "idle-kill-fired": {
|
|
16192
16222
|
if (state.status !== "running-idle") {
|
|
16193
16223
|
return { state, effects: [] };
|
|
@@ -17461,6 +17491,31 @@ var SessionManager = class {
|
|
|
17461
17491
|
});
|
|
17462
17492
|
return { response: { ok: true }, broadcast };
|
|
17463
17493
|
}
|
|
17494
|
+
// AskUserQuestion 用户跳过:与官方 CC CLI Esc 行为对齐——**不向 CC 发 tool 结果**,而是发
|
|
17495
|
+
// control_request.subtype='interrupt'(与 session:interrupt 同一条路径)中断整个 turn,
|
|
17496
|
+
// tool call 在 CC 端不返回任何 result。Reducer 同步清 pendingQuestions[toolUseId] + 发
|
|
17497
|
+
// cleared 帧(answers 缺省)让 UI 转 Ended 只读态。
|
|
17498
|
+
//
|
|
17499
|
+
// - session 不存在 / 无 runner / procAlive=false → noop 幂等返回(与 answerQuestion 同语义)
|
|
17500
|
+
// - sendControlRequest 失败(CC 退出 / 超时)→ 不抛:cleared 帧已发,UI 状态已收敛
|
|
17501
|
+
async cancelQuestion(args) {
|
|
17502
|
+
const runner = this.runners.get(args.sessionId);
|
|
17503
|
+
if (!runner) {
|
|
17504
|
+
return { response: { ok: true }, broadcast: [] };
|
|
17505
|
+
}
|
|
17506
|
+
const hit = Boolean(runner.getState().pendingQuestions?.[args.toolUseId]);
|
|
17507
|
+
if (!hit) {
|
|
17508
|
+
return { response: { ok: true }, broadcast: [] };
|
|
17509
|
+
}
|
|
17510
|
+
const { broadcast } = this.withCollector(() => {
|
|
17511
|
+
runner.input({ kind: "cancel-question", toolUseId: args.toolUseId });
|
|
17512
|
+
});
|
|
17513
|
+
if (runner.getState().procAlive) {
|
|
17514
|
+
void runner.sendControlRequest("interrupt").catch(() => {
|
|
17515
|
+
});
|
|
17516
|
+
}
|
|
17517
|
+
return { response: { ok: true }, broadcast };
|
|
17518
|
+
}
|
|
17464
17519
|
// 权限决定:dispatcher 收到 permission:respond 时调用
|
|
17465
17520
|
// 先查 state.pendingPermissions:不存在 → 抛 PERMISSION_REQUEST_STALE
|
|
17466
17521
|
respondPermission(args) {
|
|
@@ -17658,16 +17713,13 @@ var PersonaManager = class {
|
|
|
17658
17713
|
updated.iconKey = iconKeyPatch;
|
|
17659
17714
|
}
|
|
17660
17715
|
if (personality !== void 0) {
|
|
17661
|
-
this.deps.store.
|
|
17716
|
+
this.deps.store.write(updated, personality);
|
|
17717
|
+
} else {
|
|
17718
|
+
this.deps.store.writeMeta(updated);
|
|
17662
17719
|
}
|
|
17663
|
-
this.deps.store.writeMeta(updated);
|
|
17664
17720
|
this.deps.registry.set(updated);
|
|
17665
17721
|
return updated;
|
|
17666
17722
|
}
|
|
17667
|
-
/** 读取 CLAUDE.md 内容;persona 目录或文件不存在时返回 null。透传给 handler 拼响应。 */
|
|
17668
|
-
readPersonality(personaId) {
|
|
17669
|
-
return this.deps.store.readPersonality(personaId);
|
|
17670
|
-
}
|
|
17671
17723
|
/**
|
|
17672
17724
|
* 删除 persona。
|
|
17673
17725
|
* PersonaStore.remove(personaId) 已级联删除整个 <personaRoot>/<personaId>/ 目录,
|
|
@@ -19860,6 +19912,11 @@ function buildSessionHandlers(deps) {
|
|
|
19860
19912
|
const { response, broadcast } = manager.answerQuestion(args);
|
|
19861
19913
|
return { response: { type: "session:answerQuestion", ...response }, broadcast };
|
|
19862
19914
|
};
|
|
19915
|
+
const cancelQuestion = async (frame) => {
|
|
19916
|
+
const args = CancelQuestionArgs.parse(frame);
|
|
19917
|
+
const { response, broadcast } = await manager.cancelQuestion(args);
|
|
19918
|
+
return { response: { type: "session:cancelQuestion", ...response }, broadcast };
|
|
19919
|
+
};
|
|
19863
19920
|
return {
|
|
19864
19921
|
"session:create": create,
|
|
19865
19922
|
"session:list": list,
|
|
@@ -19881,7 +19938,8 @@ function buildSessionHandlers(deps) {
|
|
|
19881
19938
|
"session:unsubscribe": unsubscribe,
|
|
19882
19939
|
"session:pin": pin,
|
|
19883
19940
|
"session:reorderPins": reorderPins,
|
|
19884
|
-
"session:answerQuestion": answerQuestion
|
|
19941
|
+
"session:answerQuestion": answerQuestion,
|
|
19942
|
+
"session:cancelQuestion": cancelQuestion
|
|
19885
19943
|
};
|
|
19886
19944
|
}
|
|
19887
19945
|
|
|
@@ -20376,10 +20434,7 @@ function buildPersonaHandlers(deps) {
|
|
|
20376
20434
|
if (!persona) {
|
|
20377
20435
|
return { response: { type: "persona:info", persona: null } };
|
|
20378
20436
|
}
|
|
20379
|
-
|
|
20380
|
-
return {
|
|
20381
|
-
response: { type: "persona:info", ...persona, personality }
|
|
20382
|
-
};
|
|
20437
|
+
return { response: { type: "persona:info", ...persona } };
|
|
20383
20438
|
};
|
|
20384
20439
|
const update = async (frame) => {
|
|
20385
20440
|
const { type: _type, requestId: _requestId, ...rest } = frame;
|
package/package.json
CHANGED