@agentclientprotocol/claude-agent-acp 0.102.0 → 0.102.1-preview.2
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/README.md +5 -1
- package/dist/acp-agent.d.ts +119 -439
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +380 -2412
- package/dist/acp-subagents.d.ts +1 -2
- package/dist/acp-subagents.d.ts.map +1 -1
- package/dist/auth-methods.d.ts +21 -0
- package/dist/auth-methods.d.ts.map +1 -0
- package/dist/auth-methods.js +68 -0
- package/dist/auth-status-reporter.d.ts +112 -0
- package/dist/auth-status-reporter.d.ts.map +1 -0
- package/dist/auth-status-reporter.js +253 -0
- package/dist/background-work.d.ts +12 -265
- package/dist/background-work.d.ts.map +1 -1
- package/dist/background-work.js +8 -558
- package/dist/client-system-prompt.d.ts +7 -0
- package/dist/client-system-prompt.d.ts.map +1 -1
- package/dist/client-system-prompt.js +24 -0
- package/dist/context-compaction.d.ts +20 -0
- package/dist/context-compaction.d.ts.map +1 -1
- package/dist/context-compaction.js +26 -0
- package/dist/context-window.d.ts +70 -0
- package/dist/context-window.d.ts.map +1 -0
- package/dist/context-window.js +132 -0
- package/dist/diff.d.ts +1 -1
- package/dist/diff.js +1 -1
- package/dist/elicitation.d.ts +66 -1
- package/dist/elicitation.d.ts.map +1 -1
- package/dist/elicitation.js +109 -0
- package/dist/file-change-audit.d.ts +4 -3
- package/dist/file-change-audit.d.ts.map +1 -1
- package/dist/file-change-audit.js +3 -2
- package/dist/mcp-oauth.d.ts +44 -0
- package/dist/mcp-oauth.d.ts.map +1 -0
- package/dist/mcp-oauth.js +142 -0
- package/dist/mcp-servers.d.ts +10 -0
- package/dist/mcp-servers.d.ts.map +1 -0
- package/dist/mcp-servers.js +29 -0
- package/dist/native-subagents.d.ts +18 -8
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +7 -35
- package/dist/permissions/presentation.d.ts +29 -0
- package/dist/permissions/presentation.d.ts.map +1 -1
- package/dist/permissions/presentation.js +38 -11
- package/dist/plans.d.ts +36 -6
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +49 -11
- package/dist/prompt-suggestions.d.ts +29 -0
- package/dist/prompt-suggestions.d.ts.map +1 -1
- package/dist/prompt-suggestions.js +45 -0
- package/dist/providers.d.ts +139 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +286 -0
- package/dist/remote-control.d.ts +62 -0
- package/dist/remote-control.d.ts.map +1 -0
- package/dist/remote-control.js +78 -0
- package/dist/result-end.d.ts +39 -0
- package/dist/result-end.d.ts.map +1 -0
- package/dist/result-end.js +50 -0
- package/dist/serve.d.ts +7 -2
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +10 -5
- package/dist/session-config-ids.d.ts +1 -0
- package/dist/session-config-ids.d.ts.map +1 -1
- package/dist/session-config-ids.js +1 -0
- package/dist/session-config-options.d.ts +64 -0
- package/dist/session-config-options.d.ts.map +1 -0
- package/dist/session-config-options.js +162 -0
- package/dist/session-effort.d.ts +67 -0
- package/dist/session-effort.d.ts.map +1 -1
- package/dist/session-effort.js +98 -0
- package/dist/session-env.d.ts +22 -0
- package/dist/session-env.d.ts.map +1 -0
- package/dist/session-env.js +66 -0
- package/dist/session-fast-mode.d.ts +83 -0
- package/dist/session-fast-mode.d.ts.map +1 -0
- package/dist/session-fast-mode.js +142 -0
- package/dist/session-index/connection.d.ts +2 -5
- package/dist/session-index/connection.d.ts.map +1 -1
- package/dist/session-index/connection.js +3 -5
- package/dist/session-mode.d.ts +1 -0
- package/dist/session-mode.d.ts.map +1 -1
- package/dist/session-mode.js +1 -1
- package/dist/session-model.d.ts +41 -0
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +110 -45
- package/dist/session-notices.d.ts +44 -0
- package/dist/session-notices.d.ts.map +1 -1
- package/dist/session-notices.js +68 -0
- package/dist/session-titles.d.ts +34 -12
- package/dist/session-titles.d.ts.map +1 -1
- package/dist/session-titles.js +7 -6
- package/dist/session-usage.d.ts +125 -0
- package/dist/session-usage.d.ts.map +1 -0
- package/dist/session-usage.js +196 -0
- package/dist/streamed-text.d.ts +33 -0
- package/dist/streamed-text.d.ts.map +1 -0
- package/dist/streamed-text.js +71 -0
- package/dist/subagent-configuration.d.ts +32 -0
- package/dist/subagent-configuration.d.ts.map +1 -0
- package/dist/subagent-configuration.js +70 -0
- package/dist/subagent-replay.d.ts +18 -0
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +25 -15
- package/dist/tool-calls/client-capabilities.d.ts +8 -8
- package/dist/tool-calls/client-capabilities.js +4 -4
- package/dist/tool-calls/renderer.d.ts +4 -5
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +4 -5
- package/dist/turn-events.d.ts +6 -46
- package/dist/turn-events.d.ts.map +1 -1
- package/dist/v2/agent.d.ts +7 -11
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +751 -331
- package/dist/v2/air.d.ts +33 -0
- package/dist/v2/air.d.ts.map +1 -0
- package/dist/v2/air.js +29 -0
- package/dist/v2/auth.d.ts +97 -0
- package/dist/v2/auth.d.ts.map +1 -0
- package/dist/v2/auth.js +216 -0
- package/dist/v2/background.d.ts +27 -16
- package/dist/v2/background.d.ts.map +1 -1
- package/dist/v2/background.js +4 -32
- package/dist/v2/child-config.d.ts +55 -0
- package/dist/v2/child-config.d.ts.map +1 -0
- package/dist/v2/child-config.js +92 -0
- package/dist/v2/clear-context.d.ts +94 -0
- package/dist/v2/clear-context.d.ts.map +1 -0
- package/dist/v2/clear-context.js +176 -0
- package/dist/v2/commands.d.ts +46 -0
- package/dist/v2/commands.d.ts.map +1 -0
- package/dist/v2/commands.js +54 -0
- package/dist/v2/config.d.ts +187 -0
- package/dist/v2/config.d.ts.map +1 -0
- package/dist/v2/config.js +494 -0
- package/dist/v2/elicitation.d.ts +93 -0
- package/dist/v2/elicitation.d.ts.map +1 -0
- package/dist/v2/elicitation.js +160 -0
- package/dist/v2/file-changes.d.ts +61 -0
- package/dist/v2/file-changes.d.ts.map +1 -0
- package/dist/v2/file-changes.js +108 -0
- package/dist/v2/file-preview.d.ts +18 -0
- package/dist/v2/file-preview.d.ts.map +1 -0
- package/dist/v2/file-preview.js +29 -0
- package/dist/v2/initialize.d.ts +10 -24
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +4 -111
- package/dist/v2/outcome.d.ts +81 -0
- package/dist/v2/outcome.d.ts.map +1 -0
- package/dist/v2/outcome.js +165 -0
- package/dist/v2/permissions.d.ts +92 -0
- package/dist/v2/permissions.d.ts.map +1 -0
- package/dist/v2/permissions.js +162 -0
- package/dist/v2/prompt.d.ts +2 -42
- package/dist/v2/prompt.d.ts.map +1 -1
- package/dist/v2/prompt.js +2 -119
- package/dist/v2/remote-control.d.ts +41 -0
- package/dist/v2/remote-control.d.ts.map +1 -0
- package/dist/v2/remote-control.js +63 -0
- package/dist/v2/reports.d.ts +198 -0
- package/dist/v2/reports.d.ts.map +1 -0
- package/dist/v2/reports.js +487 -0
- package/dist/v2/restarts.d.ts +128 -0
- package/dist/v2/restarts.d.ts.map +1 -0
- package/dist/v2/restarts.js +348 -0
- package/dist/v2/session-requests.d.ts +20 -0
- package/dist/v2/session-requests.d.ts.map +1 -0
- package/dist/v2/session-requests.js +108 -0
- package/dist/v2/session-update.d.ts +2 -13
- package/dist/v2/session-update.d.ts.map +1 -1
- package/dist/v2/session-update.js +2 -22
- package/dist/v2/session.d.ts +340 -41
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +1223 -141
- package/dist/v2/setup.d.ts +49 -0
- package/dist/v2/setup.d.ts.map +1 -0
- package/dist/v2/setup.js +62 -0
- package/dist/v2/stopped-work.d.ts +123 -0
- package/dist/v2/stopped-work.d.ts.map +1 -0
- package/dist/v2/stopped-work.js +210 -0
- package/dist/v2/stream.d.ts +228 -0
- package/dist/v2/stream.d.ts.map +1 -0
- package/dist/v2/stream.js +506 -0
- package/dist/v2/subagent-replay.d.ts +115 -0
- package/dist/v2/subagent-replay.d.ts.map +1 -0
- package/dist/v2/subagent-replay.js +479 -0
- package/dist/v2/subscription-guard.d.ts +60 -0
- package/dist/v2/subscription-guard.d.ts.map +1 -0
- package/dist/v2/subscription-guard.js +84 -0
- package/dist/v2/tasks.d.ts +492 -0
- package/dist/v2/tasks.d.ts.map +1 -0
- package/dist/v2/tasks.js +1728 -0
- package/dist/v2/terminal.d.ts.map +1 -1
- package/dist/v2/terminal.js +6 -1
- package/dist/v2/tool-call.d.ts +3 -2
- package/dist/v2/tool-call.d.ts.map +1 -1
- package/dist/v2/update-translator.d.ts +36 -0
- package/dist/v2/update-translator.d.ts.map +1 -0
- package/dist/v2/update-translator.js +80 -0
- package/dist/workflow-progress.d.ts +23 -0
- package/dist/workflow-progress.d.ts.map +1 -1
- package/dist/workflow-progress.js +31 -8
- package/package.json +1 -1
- package/dist/v2/permission.d.ts +0 -28
- package/dist/v2/permission.d.ts.map +0 -1
- package/dist/v2/permission.js +0 -41
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The adapter's `/remote-control` on the v2 core, and the messages that
|
|
3
|
+
* a person types in another client of the session over Remote Control.
|
|
4
|
+
*
|
|
5
|
+
* The command, its listing, and its reply are the v1 core's
|
|
6
|
+
* (`remote-control.ts`). The command
|
|
7
|
+
* runs as a local command of its own turn, as v2 asks of one ("Local handling
|
|
8
|
+
* still uses the foreground lifecycle"): its prompt is inserted as a
|
|
9
|
+
* live-only `user_message`, the turn reports `running`, the reply goes out,
|
|
10
|
+
* and the turn ends `idle` with `end_turn`. It waits until no turn is open
|
|
11
|
+
* and no prompt waits in Claude Code's queue, and the prompts after it wait
|
|
12
|
+
* for it: v2 asks to hold a prompt rather than reject it while Claude works.
|
|
13
|
+
*/
|
|
14
|
+
import { randomUUID } from "node:crypto";
|
|
15
|
+
import { adapterRemoteControlCommand, isRemoteHumanMessage, parseRemoteControlCommand, runRemoteControlCommand, } from "../remote-control.js";
|
|
16
|
+
export class SessionRemoteControl {
|
|
17
|
+
host;
|
|
18
|
+
/** The uuids of the prompts that this session sent, until Claude Code echoes them. */
|
|
19
|
+
sent = new Set();
|
|
20
|
+
constructor(host) {
|
|
21
|
+
this.host = host;
|
|
22
|
+
}
|
|
23
|
+
/** Whether `prompt` may be the adapter's command, which {@link run} then decides. */
|
|
24
|
+
mayRun(prompt) {
|
|
25
|
+
return parseRemoteControlCommand(prompt) !== null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs `prompt` as the adapter's command, as its turn, once the session is
|
|
29
|
+
* idle. Resolves `false` without running it when Claude Code serves the
|
|
30
|
+
* command itself or the query has no Remote Control: the prompt then goes
|
|
31
|
+
* to Claude Code. `stillPending` tells whether a cancel or close answered
|
|
32
|
+
* the prompt meanwhile.
|
|
33
|
+
*/
|
|
34
|
+
async run(prompt, uuid, stillPending) {
|
|
35
|
+
const query = this.host.query();
|
|
36
|
+
if (!query)
|
|
37
|
+
return false;
|
|
38
|
+
const command = await adapterRemoteControlCommand(prompt, query, this.host.terminalCommands());
|
|
39
|
+
if (!command)
|
|
40
|
+
return false;
|
|
41
|
+
if (!(await this.host.idle()) || !stillPending())
|
|
42
|
+
return true;
|
|
43
|
+
this.host.begin(uuid);
|
|
44
|
+
// The turn is open across the network call, so the session reads as busy.
|
|
45
|
+
const text = await runRemoteControlCommand(command.query, command.command, (message) => this.host.logger.error(message));
|
|
46
|
+
this.host.end(text, randomUUID());
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
/** The session sent the prompt `uuid` to Claude Code. */
|
|
50
|
+
pushed(uuid) {
|
|
51
|
+
this.sent.add(uuid);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The content of a prompt echo to show as a user message: one that a
|
|
55
|
+
* person typed in another client of the session. `undefined` for the
|
|
56
|
+
* echo of a prompt that this session sent, and for any other echo.
|
|
57
|
+
*/
|
|
58
|
+
remoteMessage(message) {
|
|
59
|
+
if (message.uuid && this.sent.delete(message.uuid))
|
|
60
|
+
return undefined;
|
|
61
|
+
return isRemoteHumanMessage(message) ? message.message.content : undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reports of a v2 session that are not Claude's output: the
|
|
3
|
+
* context window and cost (`usage_update`), Claude Code's warnings and MCP startup failures (`notice`), compactions
|
|
4
|
+
* (`compaction_update`), the title (`session_info_update`), the predicted
|
|
5
|
+
* follow-up prompt of an AIR client (`session_info_update._meta.promptSuggestions`),
|
|
6
|
+
* and the adapter's own idle compaction.
|
|
7
|
+
*
|
|
8
|
+
* They are built as the v1 core builds them, from the shared modules
|
|
9
|
+
* (`session-usage.ts`, `session-notices.ts`, `context-compaction.ts`,
|
|
10
|
+
* `session-titles.ts`, `prompt-suggestions.ts`, `idle-compaction.ts`), and go out through the
|
|
11
|
+
* session's v1-to-v2 translation. The session tells it where its turns start
|
|
12
|
+
* and end.
|
|
13
|
+
*/
|
|
14
|
+
import type { ContentBlock, PromptRequest } from "@agentclientprotocol/sdk/unstable";
|
|
15
|
+
import type { ModelInfo, Options, Query, SDKAssistantMessage, SDKMessage, SDKPartialAssistantMessage, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
16
|
+
import type { Logger } from "../acp-agent.js";
|
|
17
|
+
import type { AcpSessionNotification } from "../acp-subagents.js";
|
|
18
|
+
import { type TitledSession } from "../session-titles.js";
|
|
19
|
+
import type { SettingsManager } from "../settings.js";
|
|
20
|
+
import type { SessionOutput } from "./stream.js";
|
|
21
|
+
/** What the reports need of their session. */
|
|
22
|
+
export interface ReportsHost {
|
|
23
|
+
readonly sessionId: string;
|
|
24
|
+
readonly logger: Logger;
|
|
25
|
+
/** The client is JetBrains AIR, the only one that gets the predicted follow-up prompt. */
|
|
26
|
+
readonly airClient: boolean;
|
|
27
|
+
/** Sends v1-shaped updates of the session, in the order of the calls. */
|
|
28
|
+
emit(notifications: AcpSessionNotification[]): void;
|
|
29
|
+
/** For the idle compaction: whether the session is busy, and its `/compact`. */
|
|
30
|
+
isBusy(): boolean;
|
|
31
|
+
compact(): Promise<void>;
|
|
32
|
+
/** The session as titles read it, the same object each time; undefined until it starts and once it ends. */
|
|
33
|
+
titledSession(): TitledSession | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** What the session's query was started with (see {@link SessionReports.configure}). */
|
|
36
|
+
export interface ReportsSetup {
|
|
37
|
+
/** The session's live Claude Code settings, disposed with the reports. */
|
|
38
|
+
settings: Pick<SettingsManager, "getSettings" | "dispose">;
|
|
39
|
+
/** The query's environment. */
|
|
40
|
+
env: Record<string, string | undefined>;
|
|
41
|
+
/** The names of the client's MCP servers. */
|
|
42
|
+
mcpServers: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Whether the session asks the user to sign in to an MCP server that needs
|
|
45
|
+
* it (see `SessionElicitations.authenticateMcpServers`): the client renders
|
|
46
|
+
* URL elicitations and the query can authenticate. Its startup then sends
|
|
47
|
+
* no "needs authentication" notice.
|
|
48
|
+
*/
|
|
49
|
+
mcpOAuth: boolean;
|
|
50
|
+
/** The query, for its context window (`getContextUsage`). */
|
|
51
|
+
query: Pick<Query, "getContextUsage">;
|
|
52
|
+
/**
|
|
53
|
+
* The session's model, and its allowlisted entry: the only one whose
|
|
54
|
+
* identity strings are a trustworthy window signal (see
|
|
55
|
+
* `withCurrentModelInfo`).
|
|
56
|
+
*/
|
|
57
|
+
model: {
|
|
58
|
+
id: string;
|
|
59
|
+
info: ModelInfo | undefined;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export declare class SessionReports {
|
|
63
|
+
private readonly host;
|
|
64
|
+
private readonly titles;
|
|
65
|
+
private readonly compaction;
|
|
66
|
+
private idleCompaction;
|
|
67
|
+
private settings;
|
|
68
|
+
private clientMcpServers;
|
|
69
|
+
private mcpOAuth;
|
|
70
|
+
private readonly reportedMcpServers;
|
|
71
|
+
/** The tool uses whose `informational` progress went out as a notice. */
|
|
72
|
+
private readonly noticedToolUses;
|
|
73
|
+
private lastUsage;
|
|
74
|
+
private lastTotal;
|
|
75
|
+
private lastModel;
|
|
76
|
+
/** A `rate_limit_event` that came before the turn had usage to report it with. */
|
|
77
|
+
private pendingRateLimit;
|
|
78
|
+
/** The normalized texts of the turn's notices (see {@link repeats}). */
|
|
79
|
+
private noticeTexts;
|
|
80
|
+
/** The context window of the session's model (see `context-window.ts`). */
|
|
81
|
+
private contextWindow;
|
|
82
|
+
/** Whether {@link contextWindow} came from Claude Code, not from a guess. */
|
|
83
|
+
private contextWindowAuthoritative;
|
|
84
|
+
/** The model that {@link contextWindow} is of. */
|
|
85
|
+
private modelId;
|
|
86
|
+
/** Scopes the cross-session window cache to the query's backend. */
|
|
87
|
+
private providerCacheKey;
|
|
88
|
+
private query;
|
|
89
|
+
private disposed;
|
|
90
|
+
/** The context used after the last main-thread request. */
|
|
91
|
+
private contextUsed;
|
|
92
|
+
/** The follow-up prompt the client holds, for an AIR client only. */
|
|
93
|
+
private suggestions;
|
|
94
|
+
constructor(host: ReportsHost);
|
|
95
|
+
/** Called once, before the query's first message. */
|
|
96
|
+
configure(setup: ReportsSetup): void;
|
|
97
|
+
/**
|
|
98
|
+
* The session's query restarted with the same MCP servers (see
|
|
99
|
+
* `restarts.ts`): a server already reported is not reported again, and the
|
|
100
|
+
* prediction the client holds is still cleared at the next prompt.
|
|
101
|
+
*/
|
|
102
|
+
restartedFrom(previous: SessionReports): void;
|
|
103
|
+
/** The session's MCP servers changed, as a resume of the active session asks. */
|
|
104
|
+
mcpServersChanged(names: readonly string[]): void;
|
|
105
|
+
turnStarted(): void;
|
|
106
|
+
/**
|
|
107
|
+
* The turn ends: a compaction that Claude Code left open ends `cancelled`.
|
|
108
|
+
* Called before the turn's idle.
|
|
109
|
+
*/
|
|
110
|
+
turnEnded(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the text of a result that streamed no model text was shown
|
|
113
|
+
* already: as a compaction, or as one of the turn's notices (a hook-blocked
|
|
114
|
+
* turn's result repeats the block reason).
|
|
115
|
+
*/
|
|
116
|
+
repeats(resultText: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Claude Code's session state went `idle`: the idle compaction may arm, and
|
|
119
|
+
* the title may have landed (see {@link SessionTitles.onTurnEnd}).
|
|
120
|
+
*/
|
|
121
|
+
idle(): void;
|
|
122
|
+
/**
|
|
123
|
+
* A client prompt came: it drops the armed idle compaction, and its text is
|
|
124
|
+
* for the title. The adapter's `/compact` is no client prompt.
|
|
125
|
+
*/
|
|
126
|
+
promptSent(prompt: PromptRequest["prompt"]): void;
|
|
127
|
+
/** The client prompt went to Claude Code, which may title the session from it. */
|
|
128
|
+
promptQueued(prompt: PromptRequest["prompt"]): void;
|
|
129
|
+
/** A live agent text chunk of the root session, for the title. */
|
|
130
|
+
agentText(content: ContentBlock): void;
|
|
131
|
+
/** Sends the session's current title and `updatedAt`, as `session/resume` asks. */
|
|
132
|
+
publishTitle(): Promise<void>;
|
|
133
|
+
/** Drops the armed idle compaction: a prompt or a cancel came. */
|
|
134
|
+
disarmIdleCompaction(reason: string): void;
|
|
135
|
+
/**
|
|
136
|
+
* The session's model is `id` now: the idle compaction's request describes
|
|
137
|
+
* the old one, and the context window is seeded for the new one, as on v1
|
|
138
|
+
* (`applyConfigOptionValue`). Nothing changes for the same model.
|
|
139
|
+
*/
|
|
140
|
+
modelChanged(id: string, info: ModelInfo | undefined): void;
|
|
141
|
+
/**
|
|
142
|
+
* A `conversation_reset`: Claude Code mounted a fresh transcript. A
|
|
143
|
+
* compaction still open ends `cancelled`, the title is evaluated again at
|
|
144
|
+
* the next idle, and the idle compaction's request and TTL describe the
|
|
145
|
+
* dropped conversation.
|
|
146
|
+
*/
|
|
147
|
+
conversationReset(): void;
|
|
148
|
+
/** Sends the usage of an empty context, as a fresh context for an approved plan starts. */
|
|
149
|
+
emptyContext(): void;
|
|
150
|
+
/** The share of the context window in use, in percent, once a request reported it. */
|
|
151
|
+
contextUsedPercent(): number | undefined;
|
|
152
|
+
dispose(): void;
|
|
153
|
+
/** The PostCompact hook's summary of the root conversation's compaction. */
|
|
154
|
+
compactSummary(summary: unknown): void;
|
|
155
|
+
/** A root stream event: its usage, and the streamed summary of a compaction. */
|
|
156
|
+
streamEvent(message: SDKPartialAssistantMessage): void;
|
|
157
|
+
/**
|
|
158
|
+
* A root assistant message: the turn's latest usage and model. A synthetic
|
|
159
|
+
* message (a CLI banner with an all-zero usage) is not a model response.
|
|
160
|
+
*/
|
|
161
|
+
assistant(message: SDKAssistantMessage): void;
|
|
162
|
+
/**
|
|
163
|
+
* A result: its cost, and the model's context window. The idle's quota is
|
|
164
|
+
* `outcome.ts`'s. The CLI predicts the next prompt right after it.
|
|
165
|
+
*/
|
|
166
|
+
result(message: SDKResultMessage): void;
|
|
167
|
+
/**
|
|
168
|
+
* The messages that only report: Claude Code's notices, compaction states,
|
|
169
|
+
* rate limits and predicted prompts. Returns whether `message` was one.
|
|
170
|
+
*/
|
|
171
|
+
handle(message: SDKMessage): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* The window of model `id` without IPC: one learned from a result of this
|
|
174
|
+
* or another session on the same backend, else a guess from the model's
|
|
175
|
+
* names. A guess is then read from Claude Code in the background
|
|
176
|
+
* (`readContextWindow`), until a result reports the window.
|
|
177
|
+
*/
|
|
178
|
+
private seedContextWindow;
|
|
179
|
+
/** A notice for each client MCP server that did not start, once per server. */
|
|
180
|
+
private mcpStartupFailures;
|
|
181
|
+
/** Sends the `_meta` of {@link PromptSuggestions}, when it has one. */
|
|
182
|
+
private sendSuggestion;
|
|
183
|
+
/**
|
|
184
|
+
* Sends a `usage_update` with the model the usage belongs to and any
|
|
185
|
+
* pending rate limit in `_meta`, as ACP's usage_update has no field for them.
|
|
186
|
+
*/
|
|
187
|
+
private sendUsage;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The hooks that feed the reports: the PostCompact summary of the root
|
|
191
|
+
* conversation's compaction (a subagent's own is not the session's), and
|
|
192
|
+
* the TaskCreated and TaskCompleted changes of the session's Task* plan.
|
|
193
|
+
*/
|
|
194
|
+
export declare function reportHooks(session: {
|
|
195
|
+
readonly reports: SessionReports;
|
|
196
|
+
readonly output: SessionOutput;
|
|
197
|
+
}): NonNullable<Options["hooks"]>;
|
|
198
|
+
//# sourceMappingURL=reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../../src/v2/reports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EACV,SAAS,EAET,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA4BlE,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,yEAAyE;IACzE,IAAI,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC;IACpD,gFAAgF;IAChF,MAAM,IAAI,OAAO,CAAC;IAClB,OAAO,IAAI,OAA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