@lucascouts/claude-agent-acp-plus 0.37.1 → 0.38.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.
- package/dist/acp-agent.d.ts +89 -25
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +391 -173
- package/dist/context-usage.d.ts +65 -0
- package/dist/context-usage.d.ts.map +1 -0
- package/dist/context-usage.js +82 -0
- package/dist/elicitation.d.ts +4 -2
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/retracted-tool-calls.d.ts +41 -0
- package/dist/retracted-tool-calls.d.ts.map +1 -0
- package/dist/retracted-tool-calls.js +75 -0
- package/dist/session-rewind.d.ts +59 -0
- package/dist/session-rewind.d.ts.map +1 -0
- package/dist/session-rewind.js +94 -0
- package/dist/side-question.d.ts +56 -0
- package/dist/side-question.d.ts.map +1 -0
- package/dist/side-question.js +91 -0
- package/dist/task-feed.d.ts +2 -1
- package/dist/task-feed.d.ts.map +1 -1
- package/dist/task-feed.js +9 -2
- package/dist/tool-progress-target.d.ts +30 -0
- package/dist/tool-progress-target.d.ts.map +1 -0
- package/dist/tool-progress-target.js +33 -0
- package/dist/turn-cut.d.ts +23 -0
- package/dist/turn-cut.d.ts.map +1 -0
- package/dist/turn-cut.js +67 -0
- package/package.json +3 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Query } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
export declare const CONTEXT_USAGE_METHOD = "_claude/context/usage";
|
|
3
|
+
export declare const CONTEXT_USAGE_CAPABILITY_KEY = "_claude/context";
|
|
4
|
+
export declare const CONTEXT_USAGE_CAPABILITY_VERSION = 1;
|
|
5
|
+
/** `full` makes per-category token-count calls; `summary` estimates locally. */
|
|
6
|
+
export type ContextDetail = "full" | "summary";
|
|
7
|
+
export type ContextUsageRequest = {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
};
|
|
10
|
+
export type ContextCategory = {
|
|
11
|
+
id?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
tokens: number;
|
|
14
|
+
color: string;
|
|
15
|
+
};
|
|
16
|
+
export type ContextUsageReport = {
|
|
17
|
+
status: "ok";
|
|
18
|
+
detail: ContextDetail;
|
|
19
|
+
model: string;
|
|
20
|
+
totalTokens: number;
|
|
21
|
+
maxTokens: number;
|
|
22
|
+
percentage: number;
|
|
23
|
+
autoCompact: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
threshold?: number;
|
|
26
|
+
};
|
|
27
|
+
categories: ContextCategory[];
|
|
28
|
+
tools: {
|
|
29
|
+
name: string;
|
|
30
|
+
callTokens: number;
|
|
31
|
+
resultTokens: number;
|
|
32
|
+
}[];
|
|
33
|
+
mcpTools: {
|
|
34
|
+
name: string;
|
|
35
|
+
serverName: string;
|
|
36
|
+
tokens: number;
|
|
37
|
+
}[];
|
|
38
|
+
memoryFiles: {
|
|
39
|
+
path: string;
|
|
40
|
+
type: string;
|
|
41
|
+
tokens: number;
|
|
42
|
+
}[];
|
|
43
|
+
skills: {
|
|
44
|
+
name: string;
|
|
45
|
+
source: string;
|
|
46
|
+
tokens: number;
|
|
47
|
+
}[];
|
|
48
|
+
agents: {
|
|
49
|
+
agentType: string;
|
|
50
|
+
source: string;
|
|
51
|
+
tokens: number;
|
|
52
|
+
}[];
|
|
53
|
+
} | {
|
|
54
|
+
status: "unavailable";
|
|
55
|
+
message: string;
|
|
56
|
+
};
|
|
57
|
+
type RawContextUsage = Awaited<ReturnType<Query["getContextUsage"]>>;
|
|
58
|
+
/** Validate raw JSON-RPC params for `_claude/context/usage`. */
|
|
59
|
+
export declare function parseContextUsageRequest(params: unknown): ContextUsageRequest;
|
|
60
|
+
/** The client's report, from the SDK's answer. */
|
|
61
|
+
export declare function shapeContextUsage(raw: RawContextUsage, detail: ContextDetail): ContextUsageReport;
|
|
62
|
+
/** Ask the query and shape the answer. Never throws. */
|
|
63
|
+
export declare function fetchContextReport(query: Pick<Query, "getContextUsage">, detail: ContextDetail): Promise<ContextUsageReport>;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=context-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-usage.d.ts","sourceRoot":"","sources":["../src/context-usage.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAE5D,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAC9D,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpE,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjE,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9D,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3D,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjE,GACD;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAErE,gEAAgE;AAChE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAY7E;AAMD,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,GAAG,kBAAkB,CA0CjG;AAED,wDAAwD;AACxD,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,EACrC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAS7B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `_claude/context/usage` — what fills the session's context window, for the
|
|
3
|
+
* context ring's breakdown card and its "View Report" (Zeo proposal §6.34,
|
|
4
|
+
* asks 57 and 58).
|
|
5
|
+
*
|
|
6
|
+
* The SDK's `Query.getContextUsage({ detail })` holds the data: categories
|
|
7
|
+
* with a stable `id` and a `kind`, MCP tools by server, memory files, skills,
|
|
8
|
+
* agents, and `messageBreakdown.toolCallsByType` — the tokens each tool's calls
|
|
9
|
+
* and results take, which is what the operator asked to see. This module keeps
|
|
10
|
+
* those and drops the CLI's visual grid (`gridRows`) and raw API counters, which
|
|
11
|
+
* the client does not draw.
|
|
12
|
+
*
|
|
13
|
+
* Only `used` rows become categories: free space and the compaction buffer are
|
|
14
|
+
* the bar's remainder, and `deferred` rows are tool schemas outside the window.
|
|
15
|
+
* A `kind` this module does not know is dropped, as the SDK asks ("treat an
|
|
16
|
+
* unknown value as absent").
|
|
17
|
+
*/
|
|
18
|
+
import { RequestError } from "@agentclientprotocol/sdk";
|
|
19
|
+
export const CONTEXT_USAGE_METHOD = "_claude/context/usage";
|
|
20
|
+
export const CONTEXT_USAGE_CAPABILITY_KEY = "_claude/context";
|
|
21
|
+
export const CONTEXT_USAGE_CAPABILITY_VERSION = 1;
|
|
22
|
+
/** Validate raw JSON-RPC params for `_claude/context/usage`. */
|
|
23
|
+
export function parseContextUsageRequest(params) {
|
|
24
|
+
const sessionId = params && typeof params === "object"
|
|
25
|
+
? params.sessionId
|
|
26
|
+
: undefined;
|
|
27
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
28
|
+
throw RequestError.invalidParams(undefined, `${CONTEXT_USAGE_METHOD} params require a non-empty sessionId`);
|
|
29
|
+
}
|
|
30
|
+
return { sessionId };
|
|
31
|
+
}
|
|
32
|
+
function byTokens(rows) {
|
|
33
|
+
return [...rows].sort((a, b) => b.tokens - a.tokens);
|
|
34
|
+
}
|
|
35
|
+
/** The client's report, from the SDK's answer. */
|
|
36
|
+
export function shapeContextUsage(raw, detail) {
|
|
37
|
+
const categories = byTokens(raw.categories
|
|
38
|
+
.filter((row) => row.kind === "used")
|
|
39
|
+
.map((row) => ({
|
|
40
|
+
...(row.id ? { id: row.id } : {}),
|
|
41
|
+
name: row.name,
|
|
42
|
+
tokens: row.tokens,
|
|
43
|
+
color: row.color,
|
|
44
|
+
})));
|
|
45
|
+
const tools = [...(raw.messageBreakdown?.toolCallsByType ?? [])]
|
|
46
|
+
.map(({ name, callTokens, resultTokens }) => ({ name, callTokens, resultTokens }))
|
|
47
|
+
.sort((a, b) => b.callTokens + b.resultTokens - (a.callTokens + a.resultTokens));
|
|
48
|
+
return {
|
|
49
|
+
status: "ok",
|
|
50
|
+
detail,
|
|
51
|
+
model: raw.model,
|
|
52
|
+
totalTokens: raw.totalTokens,
|
|
53
|
+
maxTokens: raw.maxTokens,
|
|
54
|
+
percentage: raw.percentage,
|
|
55
|
+
autoCompact: {
|
|
56
|
+
enabled: raw.isAutoCompactEnabled,
|
|
57
|
+
...(raw.autoCompactThreshold !== undefined ? { threshold: raw.autoCompactThreshold } : {}),
|
|
58
|
+
},
|
|
59
|
+
categories,
|
|
60
|
+
tools,
|
|
61
|
+
mcpTools: byTokens((raw.mcpTools ?? []).map(({ name, serverName, tokens }) => ({ name, serverName, tokens }))),
|
|
62
|
+
memoryFiles: (raw.memoryFiles ?? []).map(({ path, type, tokens }) => ({ path, type, tokens })),
|
|
63
|
+
skills: byTokens((raw.skills?.skillFrontmatter ?? []).map(({ name, source, tokens }) => ({
|
|
64
|
+
name,
|
|
65
|
+
source,
|
|
66
|
+
tokens,
|
|
67
|
+
}))),
|
|
68
|
+
agents: byTokens((raw.agents ?? []).map(({ agentType, source, tokens }) => ({ agentType, source, tokens }))),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Ask the query and shape the answer. Never throws. */
|
|
72
|
+
export async function fetchContextReport(query, detail) {
|
|
73
|
+
try {
|
|
74
|
+
return shapeContextUsage(await query.getContextUsage({ detail }), detail);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
status: "unavailable",
|
|
79
|
+
message: error instanceof Error ? error.message : String(error),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
package/dist/elicitation.d.ts
CHANGED
|
@@ -104,8 +104,10 @@ export declare const REFUSAL_FALLBACK_DIALOG_KIND = "refusal_fallback_prompt";
|
|
|
104
104
|
* transports payloads opaquely, so this shape is recovered from the CLI's own
|
|
105
105
|
* schema (v2.1.177): `originalModel`/`fallbackModel` are required strings;
|
|
106
106
|
* `apiRefusalCategory` (nullable), `guidanceText`, and
|
|
107
|
-
* `retractedMessageUuids` are optional. We ignore `retractedMessageUuids` —
|
|
108
|
-
* ACP has no way to retract already-streamed chunks.
|
|
107
|
+
* `retractedMessageUuids` are optional. We ignore `retractedMessageUuids` here —
|
|
108
|
+
* ACP has no way to retract already-streamed chunks. The tool calls of those
|
|
109
|
+
* messages are failed from the `model_refusal_fallback` notice instead (see
|
|
110
|
+
* `RetractedToolCalls`, upstream #1616).
|
|
109
111
|
*/
|
|
110
112
|
export type RefusalFallbackPrompt = {
|
|
111
113
|
originalModel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EACV,wBAAwB,EAKzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,MAAM,GAChB,wBAAwB,GAAG,IAAI,CAyBjC;AAgBD;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,yBAAyB,GAClC,iBAAiB,CAUnB;AAED;;;;GAIG;AACH,MAAM,MAAM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E,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,qBAAqB,GAAG,IAAI,CAW9B;AAYD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,GAChB,wBAAwB,CA+B1B;AAED;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAG7F"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SDKMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
/** The text of a tool call that Claude Code stopped when it took back the
|
|
3
|
+
* response that made it — upstream #1616's wording, kept so plus and
|
|
4
|
+
* upstream read the same. */
|
|
5
|
+
export declare const RETRACTED_TOOL_CALL_TEXT = "Claude Code replaced the response that made this tool call, and stopped the call. If it had started, some of its effects may have happened.";
|
|
6
|
+
/** A tool call of a message that Claude Code took back, with the Agent call
|
|
7
|
+
* of the subagent that made it (null for the main conversation). */
|
|
8
|
+
export type RetractedToolCall = {
|
|
9
|
+
toolCallId: string;
|
|
10
|
+
parentToolUseId: string | null;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The tool uses of the assistant messages that Claude Code sent, by message
|
|
14
|
+
* `uuid`, to find the tool calls of a message that Claude Code takes back.
|
|
15
|
+
* Ported from upstream claude-agent-acp #1616.
|
|
16
|
+
*
|
|
17
|
+
* Claude Code takes back the response of a model that refuses, and retries on
|
|
18
|
+
* the fallback model. It stops the tool calls of that response that have no
|
|
19
|
+
* result yet, and sends no result for them, so without this they spin in the
|
|
20
|
+
* client forever. It names the messages it took back, by the `uuid` they were
|
|
21
|
+
* sent with (read from the code of CLI 2.1.323 upstream; a refusal fallback
|
|
22
|
+
* cannot be produced on demand, so it was not observed live):
|
|
23
|
+
* - in `retracted_message_uuids` of the `model_refusal_fallback` notice;
|
|
24
|
+
* - in `supersedes` of the first assistant message of the retry.
|
|
25
|
+
*
|
|
26
|
+
* Both name the same messages, so a tool call is given once. Since Claude
|
|
27
|
+
* Code 2.1.323 `supersedes` also names a response whose tool call could not
|
|
28
|
+
* be parsed; such a response holds no tool use, so it gives nothing.
|
|
29
|
+
*/
|
|
30
|
+
export declare class RetractedToolCalls {
|
|
31
|
+
private readonly toolUses;
|
|
32
|
+
/** Records the tool uses of a complete assistant message. */
|
|
33
|
+
sent(message: SDKMessage): void;
|
|
34
|
+
/**
|
|
35
|
+
* The tool calls of the messages that `message` takes back, each given
|
|
36
|
+
* once. A tool call that `message` makes itself is not among them: the
|
|
37
|
+
* message that replaces another can hold the same tool use.
|
|
38
|
+
*/
|
|
39
|
+
retractedBy(message: SDKMessage): RetractedToolCall[];
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=retracted-tool-calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retracted-tool-calls.d.ts","sourceRoot":"","sources":["../src/retracted-tool-calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAOjE;;8BAE8B;AAC9B,eAAO,MAAM,wBAAwB,gJAC0G,CAAC;AAEhJ;qEACqE;AACrE,MAAM,MAAM,iBAAiB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEvF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IAEnE,6DAA6D;IAC7D,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAe/B;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,iBAAiB,EAAE;CAWtD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** The most assistant messages whose tool uses are kept; the oldest are
|
|
2
|
+
* dropped. Upstream #1616's bound: a retraction names the response just sent,
|
|
3
|
+
* so a long session needs only the recent ones. */
|
|
4
|
+
const MAX_MESSAGES = 1000;
|
|
5
|
+
/** The text of a tool call that Claude Code stopped when it took back the
|
|
6
|
+
* response that made it — upstream #1616's wording, kept so plus and
|
|
7
|
+
* upstream read the same. */
|
|
8
|
+
export const RETRACTED_TOOL_CALL_TEXT = "Claude Code replaced the response that made this tool call, and stopped the call. If it had started, some of its effects may have happened.";
|
|
9
|
+
/**
|
|
10
|
+
* The tool uses of the assistant messages that Claude Code sent, by message
|
|
11
|
+
* `uuid`, to find the tool calls of a message that Claude Code takes back.
|
|
12
|
+
* Ported from upstream claude-agent-acp #1616.
|
|
13
|
+
*
|
|
14
|
+
* Claude Code takes back the response of a model that refuses, and retries on
|
|
15
|
+
* the fallback model. It stops the tool calls of that response that have no
|
|
16
|
+
* result yet, and sends no result for them, so without this they spin in the
|
|
17
|
+
* client forever. It names the messages it took back, by the `uuid` they were
|
|
18
|
+
* sent with (read from the code of CLI 2.1.323 upstream; a refusal fallback
|
|
19
|
+
* cannot be produced on demand, so it was not observed live):
|
|
20
|
+
* - in `retracted_message_uuids` of the `model_refusal_fallback` notice;
|
|
21
|
+
* - in `supersedes` of the first assistant message of the retry.
|
|
22
|
+
*
|
|
23
|
+
* Both name the same messages, so a tool call is given once. Since Claude
|
|
24
|
+
* Code 2.1.323 `supersedes` also names a response whose tool call could not
|
|
25
|
+
* be parsed; such a response holds no tool use, so it gives nothing.
|
|
26
|
+
*/
|
|
27
|
+
export class RetractedToolCalls {
|
|
28
|
+
toolUses = new Map();
|
|
29
|
+
/** Records the tool uses of a complete assistant message. */
|
|
30
|
+
sent(message) {
|
|
31
|
+
if (message.type !== "assistant" || typeof message.uuid !== "string")
|
|
32
|
+
return;
|
|
33
|
+
const ids = toolUseIds(message);
|
|
34
|
+
if (ids.length === 0)
|
|
35
|
+
return;
|
|
36
|
+
const parentToolUseId = message.parent_tool_use_id ?? null;
|
|
37
|
+
this.toolUses.delete(message.uuid);
|
|
38
|
+
this.toolUses.set(message.uuid, ids.map((toolCallId) => ({ toolCallId, parentToolUseId })));
|
|
39
|
+
if (this.toolUses.size > MAX_MESSAGES) {
|
|
40
|
+
this.toolUses.delete(this.toolUses.keys().next().value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The tool calls of the messages that `message` takes back, each given
|
|
45
|
+
* once. A tool call that `message` makes itself is not among them: the
|
|
46
|
+
* message that replaces another can hold the same tool use.
|
|
47
|
+
*/
|
|
48
|
+
retractedBy(message) {
|
|
49
|
+
const own = new Set(toolUseIds(message));
|
|
50
|
+
const retracted = [];
|
|
51
|
+
for (const uuid of retractedMessageUuids(message)) {
|
|
52
|
+
for (const call of this.toolUses.get(uuid) ?? []) {
|
|
53
|
+
if (!own.has(call.toolCallId))
|
|
54
|
+
retracted.push(call);
|
|
55
|
+
}
|
|
56
|
+
this.toolUses.delete(uuid);
|
|
57
|
+
}
|
|
58
|
+
return retracted;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** The `uuid`s of the messages that `message` says Claude Code took back. */
|
|
62
|
+
function retractedMessageUuids(message) {
|
|
63
|
+
if (message.type === "assistant")
|
|
64
|
+
return message.supersedes ?? [];
|
|
65
|
+
if (message.type === "system" && message.subtype === "model_refusal_fallback") {
|
|
66
|
+
return message.retracted_message_uuids ?? [];
|
|
67
|
+
}
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
/** The ids of the tool uses of an assistant message. */
|
|
71
|
+
function toolUseIds(message) {
|
|
72
|
+
if (message.type !== "assistant" || !Array.isArray(message.message.content))
|
|
73
|
+
return [];
|
|
74
|
+
return message.message.content.flatMap((block) => (block.type === "tool_use" ? [block.id] : []));
|
|
75
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { RewindFilesResult } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { type CutAt, type TranscriptRow } from "./turn-cut.js";
|
|
3
|
+
export declare const REWIND_METHOD = "_claude/rewind";
|
|
4
|
+
export declare const REWIND_CAPABILITY_KEY = "_claude/rewind";
|
|
5
|
+
export declare const REWIND_CAPABILITY_VERSION = 1;
|
|
6
|
+
export type RewindRequest = {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
at: CutAt;
|
|
9
|
+
restoreFiles: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type RewindResult = {
|
|
12
|
+
status: "rewound";
|
|
13
|
+
sessionId: string;
|
|
14
|
+
droppedTurns: number;
|
|
15
|
+
filesRestored: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
status: "nothing_to_rewind";
|
|
18
|
+
} | {
|
|
19
|
+
status: "not_found";
|
|
20
|
+
} | {
|
|
21
|
+
status: "busy";
|
|
22
|
+
} | {
|
|
23
|
+
status: "failed";
|
|
24
|
+
stage: "files";
|
|
25
|
+
message: string;
|
|
26
|
+
} | {
|
|
27
|
+
status: "failed";
|
|
28
|
+
stage: "conversation";
|
|
29
|
+
message: string;
|
|
30
|
+
filesRestored: boolean;
|
|
31
|
+
};
|
|
32
|
+
/** What `rewindSession` needs from the adapter and the SDK. */
|
|
33
|
+
export type RewindDepsV2 = {
|
|
34
|
+
readTranscript: () => Promise<TranscriptRow[]>;
|
|
35
|
+
messageIdToUuid: ReadonlyMap<string, string>;
|
|
36
|
+
/** The live query's `rewindFiles`, at a user-message uuid. */
|
|
37
|
+
rewindFiles: (userMessageUuid: string) => Promise<RewindFilesResult>;
|
|
38
|
+
/** Copy the transcript up to and including `upToUuid`; resolves the new id. */
|
|
39
|
+
forkTranscript: (upToUuid: string) => Promise<string>;
|
|
40
|
+
};
|
|
41
|
+
/** Validate raw JSON-RPC params for `_claude/rewind`. */
|
|
42
|
+
export declare function parseRewindRequest(params: unknown): RewindRequest;
|
|
43
|
+
/** Rewind one session; the caller has already checked it is idle. */
|
|
44
|
+
export declare function rewindSession(deps: RewindDepsV2, request: Pick<RewindRequest, "at" | "restoreFiles">): Promise<RewindResult>;
|
|
45
|
+
/** The `_meta` key a `session/fork` request names its cut point under. */
|
|
46
|
+
export declare const FORK_AT_META_KEY = "_claude/forkAt";
|
|
47
|
+
/** How `unstable_forkSession` starts the forked query. */
|
|
48
|
+
export type ForkPlan = {
|
|
49
|
+
resume: string;
|
|
50
|
+
forkSession: boolean;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Fork from a turn (§6.33). Without a cut point, or with one at the last turn,
|
|
54
|
+
* the fork is the full copy it has always been: resume the parent with
|
|
55
|
+
* `forkSession`. With an earlier cut, the kept part is copied into a new
|
|
56
|
+
* transcript first and the fork resumes that copy as it is.
|
|
57
|
+
*/
|
|
58
|
+
export declare function planFork(deps: Pick<RewindDepsV2, "readTranscript" | "messageIdToUuid" | "forkTranscript">, parentSessionId: string, at: CutAt | undefined): Promise<ForkPlan>;
|
|
59
|
+
//# sourceMappingURL=session-rewind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-rewind.d.ts","sourceRoot":"","sources":["../src/session-rewind.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,KAAK,EAA8B,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE3F,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAC9C,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,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AO,CAAA;CAAE,CAAC;AAEhE;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC,EACjF,eAAe,EAAE,MAAM,EACvB,EAAE,EAAE,KAAK,GAAG,SAAS,GACpB,OAAO,CAAC,QAAQ,CAAC,CAYnB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `_claude/rewind` — take a session back to the end of an earlier turn, the
|
|
3
|
+
* conversation and optionally the files (Zeo proposal §6.33, ask 61; zed
|
|
4
|
+
* discussion #50192).
|
|
5
|
+
*
|
|
6
|
+
* The conversation is not truncated in place. A truncating resume
|
|
7
|
+
* (`resumeSessionAt`) leaves the discarded entries in the same transcript, and
|
|
8
|
+
* whether a later load follows the old tail until a new message is appended is
|
|
9
|
+
* not something this adapter can prove offline. Instead the kept part is
|
|
10
|
+
* copied into a NEW transcript with the SDK's documented `forkSession(id,
|
|
11
|
+
* { upToMessageId })`, and the new session id goes back to the client, which
|
|
12
|
+
* replaces the thread's session with it. The original transcript is left as
|
|
13
|
+
* it was, so nothing is lost if the client fails to switch.
|
|
14
|
+
*
|
|
15
|
+
* Order matters: files first, through the live query's `rewindFiles` at the
|
|
16
|
+
* first dropped prompt (its checkpoint is the files' state at the end of the
|
|
17
|
+
* kept turn). If that fails nothing else is touched. A fork failure after a
|
|
18
|
+
* file restore is reported with `filesRestored: true`, so the client can say
|
|
19
|
+
* so. A forked transcript starts without file checkpoints (SDK docs), so a
|
|
20
|
+
* later file rewind reaches only edits made after this one.
|
|
21
|
+
*/
|
|
22
|
+
import { RequestError } from "@agentclientprotocol/sdk";
|
|
23
|
+
import { parseCutAt, resolveTurnCut } from "./turn-cut.js";
|
|
24
|
+
export const REWIND_METHOD = "_claude/rewind";
|
|
25
|
+
export const REWIND_CAPABILITY_KEY = "_claude/rewind";
|
|
26
|
+
export const REWIND_CAPABILITY_VERSION = 1;
|
|
27
|
+
function reason(error) {
|
|
28
|
+
return error instanceof Error ? error.message : String(error);
|
|
29
|
+
}
|
|
30
|
+
/** Validate raw JSON-RPC params for `_claude/rewind`. */
|
|
31
|
+
export function parseRewindRequest(params) {
|
|
32
|
+
const record = params && typeof params === "object" ? params : undefined;
|
|
33
|
+
const sessionId = record?.sessionId;
|
|
34
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
35
|
+
throw RequestError.invalidParams(undefined, `${REWIND_METHOD} params require a non-empty sessionId`);
|
|
36
|
+
}
|
|
37
|
+
const restoreFiles = record?.restoreFiles ?? false;
|
|
38
|
+
if (typeof restoreFiles !== "boolean") {
|
|
39
|
+
throw RequestError.invalidParams(undefined, `${REWIND_METHOD} restoreFiles must be a boolean`);
|
|
40
|
+
}
|
|
41
|
+
return { sessionId, at: parseCutAt(record?.at, REWIND_METHOD), restoreFiles };
|
|
42
|
+
}
|
|
43
|
+
/** Rewind one session; the caller has already checked it is idle. */
|
|
44
|
+
export async function rewindSession(deps, request) {
|
|
45
|
+
const cut = resolveTurnCut(await deps.readTranscript(), request.at, deps.messageIdToUuid);
|
|
46
|
+
if (cut.kind === "nothing_to_cut")
|
|
47
|
+
return { status: "nothing_to_rewind" };
|
|
48
|
+
if (cut.kind === "not_found")
|
|
49
|
+
return { status: "not_found" };
|
|
50
|
+
let filesRestored = false;
|
|
51
|
+
if (request.restoreFiles) {
|
|
52
|
+
try {
|
|
53
|
+
const result = await deps.rewindFiles(cut.nextPromptUuid);
|
|
54
|
+
if (!result.canRewind) {
|
|
55
|
+
return {
|
|
56
|
+
status: "failed",
|
|
57
|
+
stage: "files",
|
|
58
|
+
message: result.error ?? "the files could not be restored",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
filesRestored = true;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return { status: "failed", stage: "files", message: reason(error) };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const sessionId = await deps.forkTranscript(cut.cutUuid);
|
|
69
|
+
return { status: "rewound", sessionId, droppedTurns: cut.droppedTurns, filesRestored };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return { status: "failed", stage: "conversation", message: reason(error), filesRestored };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** The `_meta` key a `session/fork` request names its cut point under. */
|
|
76
|
+
export const FORK_AT_META_KEY = "_claude/forkAt";
|
|
77
|
+
/**
|
|
78
|
+
* Fork from a turn (§6.33). Without a cut point, or with one at the last turn,
|
|
79
|
+
* the fork is the full copy it has always been: resume the parent with
|
|
80
|
+
* `forkSession`. With an earlier cut, the kept part is copied into a new
|
|
81
|
+
* transcript first and the fork resumes that copy as it is.
|
|
82
|
+
*/
|
|
83
|
+
export async function planFork(deps, parentSessionId, at) {
|
|
84
|
+
const fullCopy = { resume: parentSessionId, forkSession: true };
|
|
85
|
+
if (at === undefined)
|
|
86
|
+
return fullCopy;
|
|
87
|
+
const cut = resolveTurnCut(await deps.readTranscript(), at, deps.messageIdToUuid);
|
|
88
|
+
if (cut.kind === "nothing_to_cut")
|
|
89
|
+
return fullCopy;
|
|
90
|
+
if (cut.kind === "not_found") {
|
|
91
|
+
throw RequestError.invalidParams(undefined, "the fork's cut point was not found in the session");
|
|
92
|
+
}
|
|
93
|
+
return { resume: await deps.forkTranscript(cut.cutUuid), forkSession: false };
|
|
94
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const BTW_METHOD = "_claude/btw";
|
|
2
|
+
/** Advertised under `agentCapabilities._meta`; bump on a breaking wire change. */
|
|
3
|
+
export declare const BTW_CAPABILITY_KEY = "_claude/btw";
|
|
4
|
+
export declare const BTW_CAPABILITY_VERSION = 1;
|
|
5
|
+
/** Generous for a typed or dictated question; refuses a pasted file. */
|
|
6
|
+
export declare const BTW_MAX_QUESTION_CHARS = 8000;
|
|
7
|
+
export type BtwInvocation = {
|
|
8
|
+
kind: "ask";
|
|
9
|
+
question: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "usage";
|
|
12
|
+
};
|
|
13
|
+
/** `/btw <question>` → the question; bare `/btw` → usage; anything else → null.
|
|
14
|
+
* The command token must be the whole first word, at the very start. */
|
|
15
|
+
export declare function parseBtwInvocation(text: string): BtwInvocation | null;
|
|
16
|
+
export type SideQuestionRequest = {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
question: string;
|
|
19
|
+
};
|
|
20
|
+
export type SideQuestionResult = {
|
|
21
|
+
status: "answered";
|
|
22
|
+
answer: string;
|
|
23
|
+
synthetic: boolean;
|
|
24
|
+
fallbackModel?: string;
|
|
25
|
+
} | {
|
|
26
|
+
status: "no_answer";
|
|
27
|
+
} | {
|
|
28
|
+
status: "unsupported";
|
|
29
|
+
} | {
|
|
30
|
+
status: "failed";
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
/** Validate raw JSON-RPC params for `_claude/btw`. */
|
|
34
|
+
export declare function parseSideQuestionRequest(params: unknown): SideQuestionRequest;
|
|
35
|
+
/** The runtime shape of the SDK's answer (`sdk.mjs`, 0.3.325). */
|
|
36
|
+
type SdkSideAnswer = {
|
|
37
|
+
response: string;
|
|
38
|
+
synthetic?: boolean;
|
|
39
|
+
refusalFallback?: {
|
|
40
|
+
originalModel?: string;
|
|
41
|
+
fallbackModel?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/** The part of the SDK `Query` this module reads, method optional. */
|
|
45
|
+
export type SideQuestionQuery = {
|
|
46
|
+
askSideQuestion?: (question: string, options?: {
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}) => Promise<SdkSideAnswer | null>;
|
|
49
|
+
};
|
|
50
|
+
/** Ask one side question. Never throws: every outcome is a result. */
|
|
51
|
+
export declare function askSideQuestion(query: SideQuestionQuery, question: string, signal?: AbortSignal): Promise<SideQuestionResult>;
|
|
52
|
+
export declare const BTW_USAGE_TEXT = "Usage: `/btw <question>` \u2014 ask something on the side. The answer is not added to the conversation.";
|
|
53
|
+
/** Markdown for the `/btw` command typed into a composer. */
|
|
54
|
+
export declare function formatSideAnswer(result: SideQuestionResult): string;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=side-question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-question.d.ts","sourceRoot":"","sources":["../src/side-question.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,UAAU,gBAAgB,CAAC;AACxC,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAChD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAIlF;yEACyE;AACzE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAKrE;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAClF;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,sDAAsD;AACtD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAyB7E;AAED,kEAAkE;AAClE,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtE,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,CAAC,EAAE,CAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAC/B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CACpC,CAAC;AAEF,sEAAsE;AACtE,wBAAsB,eAAe,CACnC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAmB7B;AAED,eAAO,MAAM,cAAc,4GAC2E,CAAC;AAEvG,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAgBnE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/btw` — a side question answered without entering the conversation (Zeo
|
|
3
|
+
* proposal §6.8, ask 29).
|
|
4
|
+
*
|
|
5
|
+
* The CLI answers a side question through the `side_question` control request,
|
|
6
|
+
* which the SDK exposes as `Query.askSideQuestion(question, { signal })`. It is
|
|
7
|
+
* on the runtime object but absent from the SDK's published types (0.3.325), so
|
|
8
|
+
* it is feature-detected here and a missing method answers `unsupported`
|
|
9
|
+
* instead of throwing. The answer never enters the session's transcript: the
|
|
10
|
+
* model's history is unchanged, and a reloaded session does not replay it.
|
|
11
|
+
*
|
|
12
|
+
* Two ways in, one implementation: the `_claude/btw` ext method, which Zeo
|
|
13
|
+
* sends at once while a turn runs and renders as a dismissable card, and the
|
|
14
|
+
* `/btw <question>` command typed into any client's composer, answered as an
|
|
15
|
+
* agent message chunk.
|
|
16
|
+
*/
|
|
17
|
+
import { RequestError } from "@agentclientprotocol/sdk";
|
|
18
|
+
export const BTW_METHOD = "_claude/btw";
|
|
19
|
+
/** Advertised under `agentCapabilities._meta`; bump on a breaking wire change. */
|
|
20
|
+
export const BTW_CAPABILITY_KEY = "_claude/btw";
|
|
21
|
+
export const BTW_CAPABILITY_VERSION = 1;
|
|
22
|
+
/** Generous for a typed or dictated question; refuses a pasted file. */
|
|
23
|
+
export const BTW_MAX_QUESTION_CHARS = 8000;
|
|
24
|
+
const BTW_COMMAND = /^\/btw(?=\s|$)/;
|
|
25
|
+
/** `/btw <question>` → the question; bare `/btw` → usage; anything else → null.
|
|
26
|
+
* The command token must be the whole first word, at the very start. */
|
|
27
|
+
export function parseBtwInvocation(text) {
|
|
28
|
+
const match = text.match(BTW_COMMAND);
|
|
29
|
+
if (!match)
|
|
30
|
+
return null;
|
|
31
|
+
const question = text.slice(match[0].length).trim();
|
|
32
|
+
return question ? { kind: "ask", question } : { kind: "usage" };
|
|
33
|
+
}
|
|
34
|
+
/** Validate raw JSON-RPC params for `_claude/btw`. */
|
|
35
|
+
export function parseSideQuestionRequest(params) {
|
|
36
|
+
const record = params && typeof params === "object" ? params : undefined;
|
|
37
|
+
const sessionId = record?.sessionId;
|
|
38
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) {
|
|
39
|
+
throw RequestError.invalidParams(undefined, `${BTW_METHOD} params require a non-empty sessionId`);
|
|
40
|
+
}
|
|
41
|
+
const raw = record?.question;
|
|
42
|
+
const question = typeof raw === "string" ? raw.trim() : "";
|
|
43
|
+
if (!question) {
|
|
44
|
+
throw RequestError.invalidParams(undefined, `${BTW_METHOD} params require a non-empty question`);
|
|
45
|
+
}
|
|
46
|
+
if (question.length > BTW_MAX_QUESTION_CHARS) {
|
|
47
|
+
throw RequestError.invalidParams(undefined, `${BTW_METHOD} question must be at most ${BTW_MAX_QUESTION_CHARS} characters`);
|
|
48
|
+
}
|
|
49
|
+
return { sessionId, question };
|
|
50
|
+
}
|
|
51
|
+
/** Ask one side question. Never throws: every outcome is a result. */
|
|
52
|
+
export async function askSideQuestion(query, question, signal) {
|
|
53
|
+
if (typeof query.askSideQuestion !== "function") {
|
|
54
|
+
return { status: "unsupported" };
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const answer = await query.askSideQuestion(question, { signal });
|
|
58
|
+
if (answer === null || typeof answer?.response !== "string") {
|
|
59
|
+
return { status: "no_answer" };
|
|
60
|
+
}
|
|
61
|
+
const fallbackModel = answer.refusalFallback?.fallbackModel;
|
|
62
|
+
return {
|
|
63
|
+
status: "answered",
|
|
64
|
+
answer: answer.response,
|
|
65
|
+
synthetic: answer.synthetic ?? false,
|
|
66
|
+
...(fallbackModel ? { fallbackModel } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return { status: "failed", message: error instanceof Error ? error.message : String(error) };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export const BTW_USAGE_TEXT = "Usage: `/btw <question>` — ask something on the side. The answer is not added to the conversation.";
|
|
74
|
+
/** Markdown for the `/btw` command typed into a composer. */
|
|
75
|
+
export function formatSideAnswer(result) {
|
|
76
|
+
switch (result.status) {
|
|
77
|
+
case "answered":
|
|
78
|
+
return `**By the way** (not added to the conversation)\n\n${result.answer}`;
|
|
79
|
+
case "no_answer":
|
|
80
|
+
return "The side question got no answer.";
|
|
81
|
+
case "unsupported":
|
|
82
|
+
return "This Claude Code version cannot answer side questions (`/btw`).";
|
|
83
|
+
case "failed":
|
|
84
|
+
return `The side question failed: ${result.message}`;
|
|
85
|
+
default: {
|
|
86
|
+
// Exhaustive: a new status fails to compile here.
|
|
87
|
+
const unknownStatus = result;
|
|
88
|
+
return `The side question ended unexpectedly (${String(unknownStatus)}).`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
package/dist/task-feed.d.ts
CHANGED
|
@@ -108,7 +108,8 @@ export declare class TaskFeed {
|
|
|
108
108
|
private readonly tasks;
|
|
109
109
|
/** Ended tasks whose final snapshot was sent successfully: never shown again. */
|
|
110
110
|
private readonly published;
|
|
111
|
-
/** Ambient task ids: never shown, and their later
|
|
111
|
+
/** Ambient task ids that no tool call started: never shown, and their later
|
|
112
|
+
* messages are not news. */
|
|
112
113
|
private readonly ambient;
|
|
113
114
|
/** task id → its current life; bumped on every start. */
|
|
114
115
|
private readonly lives;
|
package/dist/task-feed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-feed.d.ts","sourceRoot":"","sources":["../src/task-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C;2DAC2D;AAC3D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,aAAa,CAAC;AAExF,MAAM,MAAM,SAAS,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,0EAA0E;AAC1E,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,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