agent-afk 5.355.0 → 5.356.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/agent/background-registry.d.ts +1 -0
- package/dist/agent/background-registry.types.d.ts +1 -0
- package/dist/agent/daemon/builtin-task.d.ts +1 -0
- package/dist/agent/daemon/github-webhook-receiver.d.ts +36 -0
- package/dist/agent/daemon/shell-task.d.ts +1 -0
- package/dist/agent/daemon/tool-health-task.d.ts +1 -0
- package/dist/agent/daemon/triggers.d.ts +1 -0
- package/dist/agent/daemon/worktree-prune-task.d.ts +1 -0
- package/dist/agent/facets/schema.d.ts +1 -1
- package/dist/agent/provider.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/overage-tracker.d.ts +29 -0
- package/dist/agent/providers/anthropic-direct/provider-query-setup.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query/client-setup.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/query/turn-request.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-options.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-runtime.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-turn-driver.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/request-types.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/context-pressure.arguments.d.ts +2 -0
- package/dist/agent/providers/openai-compatible/query/context-pressure.d.ts +3 -2
- package/dist/agent/providers/openai-compatible/query/turn-iteration.d.ts +1 -1
- package/dist/agent/session/accounting-accumulator.d.ts +6 -0
- package/dist/agent/session/closure-emitter.d.ts +4 -0
- package/dist/agent/session/turn-stream-runner.fatal-done.d.ts +4 -0
- package/dist/agent/session/wire-executors.d.ts +2 -0
- package/dist/agent/subagent/continuation-dispose.d.ts +9 -0
- package/dist/agent/subagent/continuation-registry.d.ts +12 -0
- package/dist/agent/tools/subagent/background-branch.d.ts +1 -0
- package/dist/agent/tools/subagent/continuation-dispatch.d.ts +8 -0
- package/dist/agent/tools/subagent/continuation-run.d.ts +1 -0
- package/dist/agent/tools/subagent/continuation-worktree.d.ts +21 -0
- package/dist/agent/tools/subagent/foreground-handoff.d.ts +1 -1
- package/dist/agent/tools/subagent/foreground-promotion.d.ts +5 -0
- package/dist/agent/tools/subagent-executor.execute-once.helpers.d.ts +1 -0
- package/dist/agent/trace/cost.d.ts +17 -0
- package/dist/agent/trace/events.d.ts +8 -0
- package/dist/agent/trace/events.session-phase.d.ts +2 -0
- package/dist/agent/trace/receipt.types.d.ts +3 -0
- package/dist/agent/trace/types.d.ts +2 -0
- package/dist/agent/trace/types.session-phase.d.ts +1 -1
- package/dist/agent/types/message-types.d.ts +2 -0
- package/dist/cli/commands/events.d.ts +2 -0
- package/dist/cli/commands/interactive/bootstrap-infra.d.ts +2 -0
- package/dist/cli/session-autosave.d.ts +1 -0
- package/dist/cli/session-store.d.ts +1 -1
- package/dist/cli/tty-trace.d.ts +8 -0
- package/dist/cli.mjs +525 -514
- package/dist/config/env.d.ts +30 -0
- package/dist/config/env.daemon.d.ts +23 -0
- package/dist/config/env.tty-trace.d.ts +8 -0
- package/dist/index.mjs +395 -395
- package/dist/insights/aggregators/session-prescreen.d.ts +1 -0
- package/dist/telegram/session-lifecycle.d.ts +1 -1
- package/dist/telegram/session-provider.d.ts +5 -0
- package/dist/telegram.mjs +425 -425
- package/dist/web-ui-assets/assets/{angular-html-BuB3Xwa-.js → angular-html-D3r_OvVu.js} +1 -1
- package/dist/web-ui-assets/assets/{angular-ts-DrWtBiBz.js → angular-ts-CYYKmYCY.js} +1 -1
- package/dist/web-ui-assets/assets/{apl-BfbHb7D4.js → apl-Qebclc6H.js} +1 -1
- package/dist/web-ui-assets/assets/{astro-Be6fp2Al.js → astro-EC7rA9tr.js} +1 -1
- package/dist/web-ui-assets/assets/{blade-DzrBc1Ik.js → blade-3LEHciyw.js} +1 -1
- package/dist/web-ui-assets/assets/{c-BmOCcIKK.js → c-BMHvDp3M.js} +1 -1
- package/dist/web-ui-assets/assets/{chapel-DqoMRDYP.js → chapel-DIdY1czS.js} +1 -1
- package/dist/web-ui-assets/assets/{cobol-BWcFjXux.js → cobol-B4veGjea.js} +1 -1
- package/dist/web-ui-assets/assets/{coffee-fgm8QvPo.js → coffee-CTW65drd.js} +1 -1
- package/dist/web-ui-assets/assets/{cpp-Bm53UCRY.js → cpp-UFv8IcpT.js} +1 -1
- package/dist/web-ui-assets/assets/{crystal-BOM_4uHZ.js → crystal-CAl2astP.js} +1 -1
- package/dist/web-ui-assets/assets/{css-NyBy1rdj.js → css-W4FP-8b5.js} +1 -1
- package/dist/web-ui-assets/assets/{dist-BwLOGCJM.js → dist-CL6azZY0.js} +2 -2
- package/dist/web-ui-assets/assets/{edge-DVJOwB-r.js → edge-BHV7W1lD.js} +1 -1
- package/dist/web-ui-assets/assets/{elixir-22WcAtSb.js → elixir-BSeMK1dJ.js} +1 -1
- package/dist/web-ui-assets/assets/{elm-Ddhj6iO2.js → elm-DBbEnhG_.js} +1 -1
- package/dist/web-ui-assets/assets/{erb-BBnnDLnf.js → erb-prErkLIh.js} +1 -1
- package/dist/web-ui-assets/assets/{git-rebase-C1maaghc.js → git-rebase-C2YnmdYZ.js} +1 -1
- package/dist/web-ui-assets/assets/{glimmer-js-CnZUZaVl.js → glimmer-js-UE5yPqqs.js} +1 -1
- package/dist/web-ui-assets/assets/{glimmer-ts-D8dEoCFG.js → glimmer-ts-CHUC7ee4.js} +1 -1
- package/dist/web-ui-assets/assets/{glsl-Bk477m8m.js → glsl-BP7hWcQl.js} +1 -1
- package/dist/web-ui-assets/assets/{graphql-DT_lK-LX.js → graphql-B2mDXSlF.js} +1 -1
- package/dist/web-ui-assets/assets/{hack-MX1qmO45.js → hack-CYmItAIT.js} +1 -1
- package/dist/web-ui-assets/assets/{haml-Dl9ZsNh1.js → haml-BE55kcBt.js} +1 -1
- package/dist/web-ui-assets/assets/{handlebars-Dfku37Fg.js → handlebars-HqWAfmn0.js} +1 -1
- package/dist/web-ui-assets/assets/{html-rBV1hv39.js → html-DQqmUNra.js} +1 -1
- package/dist/web-ui-assets/assets/{html-derivative-BugeKd9d.js → html-derivative-DHtOwb02.js} +1 -1
- package/dist/web-ui-assets/assets/{http-C1FdJQoT.js → http-qsOPQWSh.js} +1 -1
- package/dist/web-ui-assets/assets/{hurl-B8Tqv--n.js → hurl-CLG0zR7e.js} +1 -1
- package/dist/web-ui-assets/assets/{index-jxN_375F.css → index-7_rxjzbt.css} +1 -1
- package/dist/web-ui-assets/assets/index-CrFMdDLW.js +94 -0
- package/dist/web-ui-assets/assets/{java-i9tQYiUJ.js → java-CIoYCZPE.js} +1 -1
- package/dist/web-ui-assets/assets/{javascript-DHkYQPBV.js → javascript-BiSgC3HH.js} +1 -1
- package/dist/web-ui-assets/assets/{jinja-BsYyycs0.js → jinja-uoMhNXH1.js} +1 -1
- package/dist/web-ui-assets/assets/{jison-B4utk3Rp.js → jison-62dtSwty.js} +1 -1
- package/dist/web-ui-assets/assets/{json-CkQJ6hZ6.js → json-Cxps7Vp_.js} +1 -1
- package/dist/web-ui-assets/assets/{jsx-BxpqLhaw.js → jsx-i4FhzmZ3.js} +1 -1
- package/dist/web-ui-assets/assets/{julia-Bz0RIEKk.js → julia-4eQbL51O.js} +1 -1
- package/dist/web-ui-assets/assets/{just-CKJs0D30.js → just-DuzaqAD6.js} +1 -1
- package/dist/web-ui-assets/assets/{latex-Dkxnor6C.js → latex-DR1YiBEA.js} +1 -1
- package/dist/web-ui-assets/assets/{liquid-CYklfeLg.js → liquid-BCJgC6HS.js} +1 -1
- package/dist/web-ui-assets/assets/{lua-BMXYDhjN.js → lua-BC4drQZp.js} +1 -1
- package/dist/web-ui-assets/assets/{marko-DDcpjyDA.js → marko-DtJIqB68.js} +1 -1
- package/dist/web-ui-assets/assets/{mdc-DCfW6SUk.js → mdc-CYBfAC3q.js} +1 -1
- package/dist/web-ui-assets/assets/{nginx-HhjkSdae.js → nginx-CMR593MB.js} +1 -1
- package/dist/web-ui-assets/assets/{nim-DzYITBYm.js → nim-BbUeXd8c.js} +1 -1
- package/dist/web-ui-assets/assets/{org-OV0shxVF.js → org-oHqhaY5K.js} +1 -1
- package/dist/web-ui-assets/assets/{perl-CNHoCLMx.js → perl-DE4Fx5iS.js} +1 -1
- package/dist/web-ui-assets/assets/{php-D3UW9YmA.js → php-rh-d5On6.js} +1 -1
- package/dist/web-ui-assets/assets/{pug-gZURAtyY.js → pug-8Ni7Ix1b.js} +1 -1
- package/dist/web-ui-assets/assets/{qml-CxczNQrj.js → qml-CrGNXQfX.js} +1 -1
- package/dist/web-ui-assets/assets/{r-CYSQmhYh.js → r-BiZL36Lf.js} +1 -1
- package/dist/web-ui-assets/assets/{razor-C8RkL8GY.js → razor-DnQFAjmg.js} +1 -1
- package/dist/web-ui-assets/assets/{regexp-BROA9FZ9.js → regexp-ZehcoqOu.js} +1 -1
- package/dist/web-ui-assets/assets/{rst-6_5wei2F.js → rst-BHnIys2E.js} +1 -1
- package/dist/web-ui-assets/assets/{ruby-CGSkRBuk.js → ruby-CQjEBqXf.js} +1 -1
- package/dist/web-ui-assets/assets/{sas-BHzPKY9p.js → sas-DDw_qWwd.js} +1 -1
- package/dist/web-ui-assets/assets/{scss-BhdrfutF.js → scss-Buc-D2q0.js} +1 -1
- package/dist/web-ui-assets/assets/{shellscript-2oBOuRcG.js → shellscript-DSdjoUZi.js} +1 -1
- package/dist/web-ui-assets/assets/{shellsession-_NizP2ZG.js → shellsession-Dlf5ZOd7.js} +1 -1
- package/dist/web-ui-assets/assets/{soy-Cq1Cl1Y_.js → soy-BtqthtDI.js} +1 -1
- package/dist/web-ui-assets/assets/{sql-DCk2ZvIR.js → sql-Wbs3a-2M.js} +1 -1
- package/dist/web-ui-assets/assets/{stata-CY0XEIjf.js → stata-CZQadxtE.js} +1 -1
- package/dist/web-ui-assets/assets/{surrealql-DPCIj4-R.js → surrealql-BHX1_keB.js} +1 -1
- package/dist/web-ui-assets/assets/{svelte-mNYrrLYc.js → svelte-5Gzb7jP2.js} +1 -1
- package/dist/web-ui-assets/assets/{templ-CjaWoGHC.js → templ-6-2sxD2t.js} +1 -1
- package/dist/web-ui-assets/assets/{tex-D3ao8VCf.js → tex-s7OSL_QU.js} +1 -1
- package/dist/web-ui-assets/assets/{ts-tags-lFkQdLml.js → ts-tags-ILSDF7eF.js} +1 -1
- package/dist/web-ui-assets/assets/{tsx-CsdWmMpE.js → tsx-Ba3RCOh1.js} +1 -1
- package/dist/web-ui-assets/assets/{twig-CSGU10iK.js → twig-B5Q27p1D.js} +1 -1
- package/dist/web-ui-assets/assets/{typescript-CEegO1My.js → typescript-BGZwH6By.js} +1 -1
- package/dist/web-ui-assets/assets/{typst-DzDXDNft.js → typst-BNUBq5yx.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-DWAhaqej.js → vue-BWxalE-A.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-html-DF5GPB7J.js → vue-html-Czl3_Xc-.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-vine-DXYE3l-Q.js → vue-vine-DbFJFkgw.js} +1 -1
- package/dist/web-ui-assets/assets/{xml-D6s8ylbB.js → xml-_-I97g00.js} +1 -1
- package/dist/web-ui-assets/assets/{xsl-C1cpADN5.js → xsl-BS-NWXy1.js} +1 -1
- package/dist/web-ui-assets/assets/{yaml-BxT2kUBY.js → yaml-Dru6aRB_.js} +1 -1
- package/dist/web-ui-assets/index.html +2 -2
- package/package.json +6 -3
- package/dist/web-ui-assets/assets/index-Fk5hxG58.js +0 -94
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from 'node:http';
|
|
2
|
+
export interface WebhookReceiverOptions {
|
|
3
|
+
secret: string;
|
|
4
|
+
commandTemplate: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
host?: string;
|
|
7
|
+
allowExternal?: boolean;
|
|
8
|
+
queueDir?: string;
|
|
9
|
+
stateDir?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_WEBHOOK_PORT = 9876;
|
|
12
|
+
export declare const DEFAULT_WEBHOOK_HOST = "127.0.0.1";
|
|
13
|
+
export declare function verifySignature(secret: string, rawBody: Buffer, signatureHeader: string | undefined): boolean;
|
|
14
|
+
export declare function sanitiseRepo(raw: string | undefined): string;
|
|
15
|
+
export declare function sanitiseDeliveryId(raw: string): string;
|
|
16
|
+
export declare function summarisePayload(rawBody: Buffer, eventName: string): string;
|
|
17
|
+
export declare class WebhookReceiver {
|
|
18
|
+
private readonly secret;
|
|
19
|
+
private readonly commandTemplate;
|
|
20
|
+
private readonly port;
|
|
21
|
+
private readonly host;
|
|
22
|
+
private readonly queueDir;
|
|
23
|
+
private readonly dedupPath;
|
|
24
|
+
private readonly seen;
|
|
25
|
+
private server;
|
|
26
|
+
private persistLock;
|
|
27
|
+
constructor(opts: WebhookReceiverOptions);
|
|
28
|
+
listen(): Promise<void>;
|
|
29
|
+
address(): {
|
|
30
|
+
host: string;
|
|
31
|
+
port: number;
|
|
32
|
+
} | null;
|
|
33
|
+
close(): Promise<void>;
|
|
34
|
+
private markSeen;
|
|
35
|
+
handleRequest(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
36
|
+
}
|
package/dist/agent/provider.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
2
|
+
export interface OverageEvidence {
|
|
3
|
+
status?: string;
|
|
4
|
+
overageStatus?: string;
|
|
5
|
+
overageInUse?: string;
|
|
6
|
+
representativeClaim?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface OverageClassification {
|
|
9
|
+
measured: boolean;
|
|
10
|
+
overage: boolean;
|
|
11
|
+
evidence: OverageEvidence;
|
|
12
|
+
}
|
|
13
|
+
export declare function classifyOverage(headers: Headers): OverageClassification;
|
|
14
|
+
export interface ResponseOverageState {
|
|
15
|
+
measured: boolean;
|
|
16
|
+
overage: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class OverageTracker {
|
|
19
|
+
private readonly writer?;
|
|
20
|
+
private latest;
|
|
21
|
+
private lastEvidenceKey;
|
|
22
|
+
constructor(writer?: TraceSink | undefined);
|
|
23
|
+
observe(headers: Headers): void;
|
|
24
|
+
takeForResponse(): ResponseOverageState | undefined;
|
|
25
|
+
}
|
|
26
|
+
export declare function overageUsageFields(state: ResponseOverageState | undefined, costUsd: number | undefined): {
|
|
27
|
+
overageCostUsd?: number;
|
|
28
|
+
overageRequests?: number;
|
|
29
|
+
};
|
|
@@ -14,6 +14,7 @@ export interface QuerySetupResult {
|
|
|
14
14
|
cwd: string;
|
|
15
15
|
systemPrefix: Awaited<ReturnType<typeof setUpQueryClient>>['systemPrefix'];
|
|
16
16
|
throttleQueue: ReturnType<typeof setUpQueryClient>['throttleQueue'];
|
|
17
|
+
overageTracker: ReturnType<typeof setUpQueryClient>['overageTracker'];
|
|
17
18
|
tokenRefresher: ReturnType<typeof setUpQueryClient>['tokenRefresher'];
|
|
18
19
|
credentialFromStore: boolean;
|
|
19
20
|
queryDispatcher: ReturnType<typeof wireQueryDispatcher>['queryDispatcher'];
|
|
@@ -4,6 +4,7 @@ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
|
4
4
|
import { buildClientOptions } from '../auth.js';
|
|
5
5
|
import type { AuthMode } from '../types.js';
|
|
6
6
|
import { ThrottleQueue } from '../throttle-queue.js';
|
|
7
|
+
import { OverageTracker } from '../overage-tracker.js';
|
|
7
8
|
import type { AnthropicClientFactory } from '../provider-options.js';
|
|
8
9
|
export interface ClientSetupArgs {
|
|
9
10
|
config: AgentConfig;
|
|
@@ -16,6 +17,7 @@ export interface ClientSetupArgs {
|
|
|
16
17
|
export interface ClientSetup {
|
|
17
18
|
client: Anthropic;
|
|
18
19
|
throttleQueue: ThrottleQueue | undefined;
|
|
20
|
+
overageTracker: OverageTracker | undefined;
|
|
19
21
|
systemPrefix: ContentBlockParam[] | null;
|
|
20
22
|
tokenRefresher?: (() => Promise<Anthropic | null>) | undefined;
|
|
21
23
|
}
|
|
@@ -24,6 +24,7 @@ export interface TurnRequestInput {
|
|
|
24
24
|
traceWriter?: RunTurnInput['traceWriter'];
|
|
25
25
|
subagentId?: string;
|
|
26
26
|
throttleQueue?: RunTurnInput['throttleQueue'];
|
|
27
|
+
overageTracker?: RunTurnInput['overageTracker'];
|
|
27
28
|
onUsageProgress?: RunTurnInput['onUsageProgress'];
|
|
28
29
|
beforeNextRound?: RunTurnInput['beforeNextRound'];
|
|
29
30
|
beforeTurnEnd?: RunTurnInput['beforeTurnEnd'];
|
|
@@ -53,6 +53,7 @@ export interface AnthropicDirectQueryOptions {
|
|
|
53
53
|
autoCompactThreshold?: number;
|
|
54
54
|
hookRegistry?: HookRegistry;
|
|
55
55
|
throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
|
|
56
|
+
overageTracker?: import('./overage-tracker.js').OverageTracker;
|
|
56
57
|
fastModeController?: import('../../fast-mode.js').FastModeController;
|
|
57
58
|
beforeNextRound?: () => string | undefined;
|
|
58
59
|
enableFileCheckpointing?: boolean;
|
|
@@ -35,6 +35,7 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
|
|
|
35
35
|
private readonly mcpManager?;
|
|
36
36
|
private readonly hookRegistry?;
|
|
37
37
|
private readonly throttleQueue?;
|
|
38
|
+
private readonly overageTracker?;
|
|
38
39
|
private readonly fastModeController?;
|
|
39
40
|
private beforeNextRound?;
|
|
40
41
|
private beforeTurnEnd?;
|
|
@@ -26,6 +26,7 @@ export interface TurnDriverContext {
|
|
|
26
26
|
readonly mcpManager: import('../../mcp/index.js').McpManager | undefined;
|
|
27
27
|
readonly hookRegistry: HookRegistry | undefined;
|
|
28
28
|
readonly throttleQueue: import('./throttle-queue.js').ThrottleQueue | undefined;
|
|
29
|
+
readonly overageTracker: import('./overage-tracker.js').OverageTracker | undefined;
|
|
29
30
|
readonly fastModeController: import('../../fast-mode.js').FastModeController | undefined;
|
|
30
31
|
readonly beforeNextRound: (() => string | undefined) | undefined;
|
|
31
32
|
readonly beforeTurnEnd: ((continuation: number, assistantText?: string) => Promise<{
|
|
@@ -27,6 +27,7 @@ export interface RunTurnInput {
|
|
|
27
27
|
subagentId?: string;
|
|
28
28
|
onUsageProgress?: (usage: ProviderUsage) => void;
|
|
29
29
|
throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
|
|
30
|
+
overageTracker?: import('./overage-tracker.js').OverageTracker;
|
|
30
31
|
beforeNextRound?: () => string | undefined;
|
|
31
32
|
beforeTurnEnd?: (continuation: number, assistantText?: string) => Promise<{
|
|
32
33
|
continueWith?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TurnDriverContext } from './turn-driver.js';
|
|
2
|
+
import type { OpenAIMessage } from '../messages.js';
|
|
2
3
|
export declare const WIND_DOWN_MAX_OUTPUT_TOKENS = 4096;
|
|
3
|
-
export declare function windDownForContextPressure(ctx: TurnDriverContext, appendedAt: number): boolean;
|
|
4
|
-
export declare function canSynthesizeUnderPressure(ctx: TurnDriverContext, appendedAt: number): boolean;
|
|
4
|
+
export declare function windDownForContextPressure(ctx: TurnDriverContext, appendedAt: number, turns?: OpenAIMessage[]): boolean;
|
|
5
|
+
export declare function canSynthesizeUnderPressure(ctx: TurnDriverContext, appendedAt: number, turns?: OpenAIMessage[]): boolean;
|
|
@@ -41,4 +41,4 @@ export interface FinishTurnContext {
|
|
|
41
41
|
}
|
|
42
42
|
export declare function finishTurn(ctx: FinishTurnContext, accumulatedUsage: ProviderUsage, turnStartTime: number): Generator<ProviderEvent>;
|
|
43
43
|
export declare function pushUserTurn(ctx: IterationContext, content: import('../../../provider.js').ProviderUserTurn['content'], linkCheckpoint?: boolean): void;
|
|
44
|
-
export declare function runIteration(ctx: IterationContext, controller: AbortController, vision: boolean, windDown: typeof TOOL_USE_LOOP_CAPPED | typeof SOFT_DEADLINE_WIND_DOWN | typeof CONTEXT_PRESSURE_WIND_DOWN | null): AsyncGenerator<ProviderEvent, IterationResult | null>;
|
|
44
|
+
export declare function runIteration(ctx: IterationContext, controller: AbortController, vision: boolean, windDown: typeof TOOL_USE_LOOP_CAPPED | typeof SOFT_DEADLINE_WIND_DOWN | typeof CONTEXT_PRESSURE_WIND_DOWN | null, synthesisTurns?: OpenAIMessage[]): AsyncGenerator<ProviderEvent, IterationResult | null>;
|
|
@@ -9,6 +9,10 @@ interface TokenCounters {
|
|
|
9
9
|
}
|
|
10
10
|
export interface AccountingSnapshot {
|
|
11
11
|
sessionRunningCostUsd: number;
|
|
12
|
+
sessionOverage?: {
|
|
13
|
+
costUsd: number;
|
|
14
|
+
requests: number;
|
|
15
|
+
};
|
|
12
16
|
sessionRunningTokens: Readonly<TokenCounters>;
|
|
13
17
|
subagentCompletedCount: number;
|
|
14
18
|
subagentRunningTokens: Readonly<TokenCounters>;
|
|
@@ -20,6 +24,7 @@ export interface AccountingSnapshot {
|
|
|
20
24
|
}
|
|
21
25
|
export declare class AccountingAccumulator {
|
|
22
26
|
private sessionRunningCostUsd;
|
|
27
|
+
private sessionOverage;
|
|
23
28
|
private sessionRunningTokens;
|
|
24
29
|
private lastStopReason;
|
|
25
30
|
private maxTurnsHit;
|
|
@@ -35,6 +40,7 @@ export declare class AccountingAccumulator {
|
|
|
35
40
|
private readonly subagentBilling;
|
|
36
41
|
reset(): void;
|
|
37
42
|
recordTurnMetadata(m: ResponseMetadata): void;
|
|
43
|
+
private recordOverage;
|
|
38
44
|
markHookBlocked(): void;
|
|
39
45
|
markMaxTurnsHit(): void;
|
|
40
46
|
markProviderError(): void;
|
|
@@ -23,6 +23,10 @@ export interface ClosureTotals {
|
|
|
23
23
|
}
|
|
24
24
|
export interface EmitClosureInput extends ClosureSignals, ClosureTotals {
|
|
25
25
|
runningTokens: ClosureTokenCounters;
|
|
26
|
+
overage?: {
|
|
27
|
+
costUsd: number;
|
|
28
|
+
requests: number;
|
|
29
|
+
};
|
|
26
30
|
subagentId?: string;
|
|
27
31
|
}
|
|
28
32
|
export declare function emitClosureEvent(writer: TraceSink | undefined, input: EmitClosureInput): Promise<void>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OutputEvent } from '../types.js';
|
|
2
|
+
export type FatalStopReason = 'error' | 'interrupted' | 'budget_ceiling' | 'stalled';
|
|
3
|
+
export declare function fatalStopReason(signal: AbortSignal): FatalStopReason;
|
|
4
|
+
export declare function buildFatalDone(signal: AbortSignal, elapsedMs: number): OutputEvent;
|
|
@@ -2,6 +2,7 @@ import { SubagentManager } from '../subagent.js';
|
|
|
2
2
|
import { SubagentExecutor } from '../tools/subagent-executor.js';
|
|
3
3
|
import { SkillExecutor } from '../tools/skill-executor.js';
|
|
4
4
|
import { ComposeExecutor } from '../tools/compose-executor.js';
|
|
5
|
+
import { ContinuationRegistry } from '../subagent/continuation-registry.js';
|
|
5
6
|
import type { SubagentExecutorContext } from '../tools/subagent-executor.js';
|
|
6
7
|
import type { BackgroundAgentRegistry } from '../background-registry.js';
|
|
7
8
|
import type { TraceSink } from '../trace/writer.js';
|
|
@@ -42,5 +43,6 @@ export interface WiredExecutors {
|
|
|
42
43
|
subagentExecutor: SubagentExecutor;
|
|
43
44
|
skillExecutor: SkillExecutor;
|
|
44
45
|
composeExecutor: ComposeExecutor;
|
|
46
|
+
continuationRegistry: ContinuationRegistry;
|
|
45
47
|
}
|
|
46
48
|
export declare function wireExecutors(opts: WireExecutorsOptions): WiredExecutors;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DisposableContinuationRegistry {
|
|
2
|
+
dispose(): void;
|
|
3
|
+
}
|
|
4
|
+
export declare function drainThenDispose<T>(drain: () => Promise<T>, registry: DisposableContinuationRegistry): Promise<T>;
|
|
5
|
+
export declare function withContinuationDispose<S extends {
|
|
6
|
+
drainSubagents?: (reason: string) => Promise<unknown>;
|
|
7
|
+
}>(shutdown: S, registry: DisposableContinuationRegistry): S & {
|
|
8
|
+
drainSubagents: (reason: string) => Promise<unknown>;
|
|
9
|
+
};
|
|
@@ -34,6 +34,9 @@ export interface ChainRecord {
|
|
|
34
34
|
lastEndReason: string | undefined;
|
|
35
35
|
settling: Promise<void> | undefined;
|
|
36
36
|
admitting: boolean;
|
|
37
|
+
isolatedWorktreePath?: string;
|
|
38
|
+
worktreeIsolated?: true;
|
|
39
|
+
worktreeReleaseRequested?: true;
|
|
37
40
|
}
|
|
38
41
|
export type AdmissionResult = {
|
|
39
42
|
ok: true;
|
|
@@ -55,14 +58,19 @@ export interface TerminalUpdate {
|
|
|
55
58
|
export declare const CONTINUATION_DEFAULTS: ContinuationLimits;
|
|
56
59
|
export declare function resolveContinuationLimits(): ContinuationLimits;
|
|
57
60
|
export declare const MAX_CHAINS = 256;
|
|
61
|
+
export type ChainEvictCallback = (chain: ChainRecord) => void;
|
|
58
62
|
export declare class ContinuationRegistry {
|
|
59
63
|
private readonly limits;
|
|
60
64
|
private readonly maxChains;
|
|
61
65
|
private readonly chains;
|
|
62
66
|
readonly rootActor: string;
|
|
67
|
+
onEvict?: ChainEvictCallback;
|
|
68
|
+
private readonly linkTeardowns;
|
|
63
69
|
constructor(limits?: ContinuationLimits, maxChains?: number);
|
|
64
70
|
get size(): number;
|
|
65
71
|
private evictForInsert;
|
|
72
|
+
dispose(): void;
|
|
73
|
+
private releaseDisposedWorktree;
|
|
66
74
|
createChain(args: {
|
|
67
75
|
owner: string;
|
|
68
76
|
rootSessionId: string | undefined;
|
|
@@ -79,7 +87,11 @@ export declare class ContinuationRegistry {
|
|
|
79
87
|
reason: string;
|
|
80
88
|
};
|
|
81
89
|
chargeInitialRounds(chainId: string, roundsUsed: number): void;
|
|
90
|
+
trackLinkTeardown(chainId: string, done: Promise<void>): void;
|
|
91
|
+
pendingLinkTeardown(chainId: string): Promise<void> | undefined;
|
|
82
92
|
setSettling(chainId: string, settling: Promise<void>): void;
|
|
93
|
+
setIsolatedWorktreePath(chainId: string, worktreePath: string): void;
|
|
94
|
+
clearIsolatedWorktreePath(chainId: string): void;
|
|
83
95
|
recordTerminal(chainId: string, update: TerminalUpdate): void;
|
|
84
96
|
}
|
|
85
97
|
export declare function formatContinuationLine(chain: ChainRecord): string;
|
|
@@ -49,6 +49,7 @@ export interface ChainTerminalArgs {
|
|
|
49
49
|
traceWriter?: TraceSink | undefined;
|
|
50
50
|
}
|
|
51
51
|
export declare function recordChainTerminal(args: ChainTerminalArgs): Promise<WorkspaceCheckpoint | undefined>;
|
|
52
|
+
export declare function isContinuableChain(chain: ChainRecord): boolean;
|
|
52
53
|
export declare function markChainPromoted(handle: object): void;
|
|
53
54
|
export declare function annotateChainResult<R extends ToolResult>(result: R, chain: ChainRecord | undefined, always?: boolean, handle?: object): R & ContinuationResultFields;
|
|
54
55
|
export declare function endReasonOf(result: ToolResult): string;
|
|
@@ -62,6 +63,9 @@ export declare function instrumentHandleForChain(handle: ChainHandle, terminal:
|
|
|
62
63
|
flushJournal?: () => Promise<void>;
|
|
63
64
|
rollbackIfNotStarted?: () => void;
|
|
64
65
|
alwaysLine?: boolean;
|
|
66
|
+
childManager?: {
|
|
67
|
+
teardownAll(): Promise<void>;
|
|
68
|
+
} | undefined;
|
|
65
69
|
}): void;
|
|
66
70
|
export type SettleDegradedReason = 'flush_timeout' | 'checkpoint_unavailable' | 'error';
|
|
67
71
|
export declare const JOURNAL_FLUSH_TIMEOUT_MS = 5000;
|
|
@@ -84,5 +88,9 @@ export declare function wireDispatchChain(args: {
|
|
|
84
88
|
currentCwd: string | undefined;
|
|
85
89
|
writeCapable: boolean;
|
|
86
90
|
plan?: ContinuationPlan | undefined;
|
|
91
|
+
isolated?: boolean;
|
|
92
|
+
childManager?: {
|
|
93
|
+
teardownAll(): Promise<void>;
|
|
94
|
+
} | undefined;
|
|
87
95
|
}): ChainRecord | undefined;
|
|
88
96
|
export {};
|
|
@@ -22,6 +22,7 @@ export declare function refuseContinuation(reason: string): {
|
|
|
22
22
|
error: ToolResult;
|
|
23
23
|
};
|
|
24
24
|
export declare function continuationNote(chain: ChainRecord, index: number, allowance: number): string;
|
|
25
|
+
export declare function worktreeNotKeptReason(id: string): string;
|
|
25
26
|
export declare const SETTLING_WAIT_MS = 15000;
|
|
26
27
|
export declare function admitContinuationCall(parsed: AgentInput, ctx: AdmitCtx): Promise<{
|
|
27
28
|
plan: ContinuationPlan;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChainRecord, ContinuationRegistry } from '../../subagent/continuation-registry.js';
|
|
2
|
+
export declare function repoRootFromWorktreePath(worktreePath: string): string | undefined;
|
|
3
|
+
export declare function buildIsolationTeardownHook(isolationTeardown: {
|
|
4
|
+
repoRoot: string;
|
|
5
|
+
worktreePath: string;
|
|
6
|
+
} | undefined, chain: ChainRecord | undefined, registry: ContinuationRegistry | undefined, isContinuable: (c: ChainRecord) => boolean): ((td: {
|
|
7
|
+
repoRoot: string;
|
|
8
|
+
worktreePath: string;
|
|
9
|
+
}) => Promise<boolean>) | undefined;
|
|
10
|
+
export declare function keepWorktreeForChain(args: {
|
|
11
|
+
repoRoot: string;
|
|
12
|
+
worktreePath: string;
|
|
13
|
+
chainId: string;
|
|
14
|
+
registry: ContinuationRegistry;
|
|
15
|
+
}): Promise<boolean>;
|
|
16
|
+
export declare function releaseChainWorktree(args: {
|
|
17
|
+
repoRoot: string;
|
|
18
|
+
worktreePath: string;
|
|
19
|
+
chainId: string;
|
|
20
|
+
registry: ContinuationRegistry;
|
|
21
|
+
}): Promise<void>;
|
|
@@ -20,7 +20,7 @@ export declare function prepareForegroundRun(args: RunForegroundArgs): {
|
|
|
20
20
|
};
|
|
21
21
|
export declare function emitForegroundRejection(args: Pick<RunForegroundArgs, 'identity' | 'handle' | 'idPrefix' | 'parentSessionId' | 'depth'>, err: unknown, startedAt: number): void;
|
|
22
22
|
export declare function foregroundCompletionResult(args: Pick<RunForegroundArgs, 'handle' | 'identity' | 'parentSessionId' | 'depth' | 'model' | 'parentModel' | 'idPrefix'>, result: Awaited<RunPromise>, startedAt: number): ToolResult;
|
|
23
|
-
export declare function adoptForegroundRun(args: Pick<RunForegroundArgs, 'handle' | 'backgroundPrompt' | 'model' | 'parentSessionId' | 'budgetRelease'>, registry: NonNullable<RunForegroundArgs['registry']>, runPromise: RunPromise, isoTd: RunForegroundArgs['isolationTeardown']): import("../../background-registry.types.js").BackgroundJob;
|
|
23
|
+
export declare function adoptForegroundRun(args: Pick<RunForegroundArgs, 'handle' | 'backgroundPrompt' | 'model' | 'parentSessionId' | 'budgetRelease' | 'projectKey'>, registry: NonNullable<RunForegroundArgs['registry']>, runPromise: RunPromise, isoTd: RunForegroundArgs['isolationTeardown']): import("../../background-registry.types.js").BackgroundJob;
|
|
24
24
|
export declare function prependNeedsInputHeader(result: ToolResult & ContinuationResultFields & {
|
|
25
25
|
_needsInput?: SubagentResult['needsInput'];
|
|
26
26
|
}): void;
|
|
@@ -44,10 +44,15 @@ export interface RunForegroundArgs {
|
|
|
44
44
|
repoRoot: string;
|
|
45
45
|
worktreePath: string;
|
|
46
46
|
};
|
|
47
|
+
onIsolationTeardown?: (td: {
|
|
48
|
+
repoRoot: string;
|
|
49
|
+
worktreePath: string;
|
|
50
|
+
}) => Promise<boolean>;
|
|
47
51
|
budgetRelease?: () => void;
|
|
48
52
|
promotionTookBudget?: {
|
|
49
53
|
value: boolean;
|
|
50
54
|
};
|
|
51
55
|
onPromoted?: () => void;
|
|
56
|
+
projectKey?: string;
|
|
52
57
|
}
|
|
53
58
|
export declare function runForegroundWithPromotion(args: RunForegroundArgs): Promise<ToolResult>;
|
|
@@ -108,6 +108,7 @@ export interface RunBackgroundDispatchArgs {
|
|
|
108
108
|
worktreePath: string;
|
|
109
109
|
} | undefined;
|
|
110
110
|
traceWriter: TraceSink | undefined;
|
|
111
|
+
currentCwd: string | undefined;
|
|
111
112
|
}
|
|
112
113
|
export declare function runBackgroundDispatch(args: RunBackgroundDispatchArgs): Promise<ToolResult>;
|
|
113
114
|
export declare function checkNestedScope(nestedScope: readonly string[], requestedType: string | undefined): ToolResult | undefined;
|
|
@@ -13,6 +13,9 @@ export interface SessionCostBreakdown {
|
|
|
13
13
|
totalTokens?: CostTokens;
|
|
14
14
|
closureCount: number;
|
|
15
15
|
source: SessionCostSource;
|
|
16
|
+
overageCostUsd?: number;
|
|
17
|
+
overageRequests?: number;
|
|
18
|
+
overageIncomplete?: true;
|
|
16
19
|
}
|
|
17
20
|
export interface CostEventLike {
|
|
18
21
|
kind: unknown;
|
|
@@ -22,6 +25,9 @@ export declare class SessionCostAccumulator {
|
|
|
22
25
|
private closureSum;
|
|
23
26
|
private closureCount;
|
|
24
27
|
private lastClosureCost;
|
|
28
|
+
private lastClosureTurns;
|
|
29
|
+
private lastRootClosure;
|
|
30
|
+
private rootClosureCount;
|
|
25
31
|
private lastClosureSubagentId;
|
|
26
32
|
private rootCycleSum;
|
|
27
33
|
private rootCycleTurnCount;
|
|
@@ -32,9 +38,20 @@ export declare class SessionCostAccumulator {
|
|
|
32
38
|
private sealSubagent;
|
|
33
39
|
private sealTurns;
|
|
34
40
|
private sealIncomplete;
|
|
41
|
+
private overage;
|
|
35
42
|
add(event: CostEventLike): void;
|
|
43
|
+
private addOverage;
|
|
36
44
|
result(): SessionCostBreakdown;
|
|
45
|
+
private baseResult;
|
|
37
46
|
private rootSplit;
|
|
47
|
+
private provenanceKnown;
|
|
48
|
+
private lastRootClosureMatchesSeal;
|
|
38
49
|
private tokenTotals;
|
|
39
50
|
}
|
|
51
|
+
export declare function totalCostFields(sc: SessionCostBreakdown): {
|
|
52
|
+
totalCostUsd?: number;
|
|
53
|
+
overageCostUsd?: number;
|
|
54
|
+
overageRequests?: number;
|
|
55
|
+
overageIncomplete?: true;
|
|
56
|
+
};
|
|
40
57
|
export declare function computeSessionCost(events: Iterable<CostEventLike>): SessionCostBreakdown;
|
|
@@ -240,6 +240,8 @@ export declare const ClosurePayloadSchema: z.ZodObject<{
|
|
|
240
240
|
}>;
|
|
241
241
|
finalTurnCount: z.ZodNumber;
|
|
242
242
|
finalCostUsd: z.ZodNumber;
|
|
243
|
+
overageCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
overageRequests: z.ZodOptional<z.ZodNumber>;
|
|
243
245
|
finalTokens: z.ZodObject<{
|
|
244
246
|
input: z.ZodOptional<z.ZodNumber>;
|
|
245
247
|
output: z.ZodOptional<z.ZodNumber>;
|
|
@@ -607,6 +609,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
607
609
|
}>;
|
|
608
610
|
finalTurnCount: z.ZodNumber;
|
|
609
611
|
finalCostUsd: z.ZodNumber;
|
|
612
|
+
overageCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
613
|
+
overageRequests: z.ZodOptional<z.ZodNumber>;
|
|
610
614
|
finalTokens: z.ZodObject<{
|
|
611
615
|
input: z.ZodOptional<z.ZodNumber>;
|
|
612
616
|
output: z.ZodOptional<z.ZodNumber>;
|
|
@@ -765,6 +769,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
765
769
|
round_cap_notice_dropped: "round_cap_notice_dropped";
|
|
766
770
|
continuation_settle_degraded: "continuation_settle_degraded";
|
|
767
771
|
prompt_fragment_sizes: "prompt_fragment_sizes";
|
|
772
|
+
ratelimit_unified_state: "ratelimit_unified_state";
|
|
768
773
|
}>;
|
|
769
774
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
770
775
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1088,6 +1093,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1088
1093
|
}>;
|
|
1089
1094
|
finalTurnCount: z.ZodNumber;
|
|
1090
1095
|
finalCostUsd: z.ZodNumber;
|
|
1096
|
+
overageCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
1097
|
+
overageRequests: z.ZodOptional<z.ZodNumber>;
|
|
1091
1098
|
finalTokens: z.ZodObject<{
|
|
1092
1099
|
input: z.ZodOptional<z.ZodNumber>;
|
|
1093
1100
|
output: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1256,6 +1263,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1256
1263
|
round_cap_notice_dropped: "round_cap_notice_dropped";
|
|
1257
1264
|
continuation_settle_degraded: "continuation_settle_degraded";
|
|
1258
1265
|
prompt_fragment_sizes: "prompt_fragment_sizes";
|
|
1266
|
+
ratelimit_unified_state: "ratelimit_unified_state";
|
|
1259
1267
|
}>;
|
|
1260
1268
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1261
1269
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -56,6 +56,7 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
|
|
|
56
56
|
round_cap_notice_dropped: "round_cap_notice_dropped";
|
|
57
57
|
continuation_settle_degraded: "continuation_settle_degraded";
|
|
58
58
|
prompt_fragment_sizes: "prompt_fragment_sizes";
|
|
59
|
+
ratelimit_unified_state: "ratelimit_unified_state";
|
|
59
60
|
}>;
|
|
60
61
|
export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
61
62
|
phase: z.ZodEnum<{
|
|
@@ -115,6 +116,7 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
|
115
116
|
round_cap_notice_dropped: "round_cap_notice_dropped";
|
|
116
117
|
continuation_settle_degraded: "continuation_settle_degraded";
|
|
117
118
|
prompt_fragment_sizes: "prompt_fragment_sizes";
|
|
119
|
+
ratelimit_unified_state: "ratelimit_unified_state";
|
|
118
120
|
}>;
|
|
119
121
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
120
122
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -66,6 +66,9 @@ export interface RunReceipt {
|
|
|
66
66
|
totalCostUsd?: number;
|
|
67
67
|
totalTokens?: CostTokens;
|
|
68
68
|
costSource?: SessionCostSource;
|
|
69
|
+
overageCostUsd?: number;
|
|
70
|
+
overageRequests?: number;
|
|
71
|
+
overageIncomplete?: true;
|
|
69
72
|
};
|
|
70
73
|
failures: ReceiptToolFailure[];
|
|
71
74
|
humanReviewRequired: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'context_pressure_wind_down' | 'catalog_model_upgrade' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'credential_swap' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'thinking_block_dropped' | 'background_process_started' | 'background_process_settled' | 'compose_recovery_decision' | 'compose_leaf_tools_stripped' | 'hook_block_repeat_tripped' | 'endpoint_semaphore_wait' | 'billing_settled' | 'subagent_model_fallback' | 'model_fallback' | 'round_cap_notice_dropped' | 'continuation_settle_degraded' | 'prompt_fragment_sizes';
|
|
1
|
+
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'context_pressure_wind_down' | 'catalog_model_upgrade' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'credential_swap' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'thinking_block_dropped' | 'background_process_started' | 'background_process_settled' | 'compose_recovery_decision' | 'compose_leaf_tools_stripped' | 'hook_block_repeat_tripped' | 'endpoint_semaphore_wait' | 'billing_settled' | 'subagent_model_fallback' | 'model_fallback' | 'round_cap_notice_dropped' | 'continuation_settle_degraded' | 'prompt_fragment_sizes' | 'ratelimit_unified_state';
|
|
2
2
|
export interface SessionPhasePayload {
|
|
3
3
|
phase: SessionPhaseName;
|
|
4
4
|
durationMs?: number;
|
|
@@ -9,6 +9,8 @@ export interface ResponseMetadata extends Record<string, unknown> {
|
|
|
9
9
|
durationMs?: number;
|
|
10
10
|
durationApiMs?: number;
|
|
11
11
|
totalCostUsd?: number;
|
|
12
|
+
overageCostUsd?: number;
|
|
13
|
+
overageRequests?: number;
|
|
12
14
|
numTurns?: number;
|
|
13
15
|
isError?: boolean;
|
|
14
16
|
usage?: Record<string, unknown>;
|
|
@@ -5,6 +5,7 @@ import type { SkillExecutor } from '../../../agent/tools/skill-executor.js';
|
|
|
5
5
|
import type { ComposeExecutor } from '../../../agent/tools/compose-executor.js';
|
|
6
6
|
import type { SubagentManager } from '../../../agent/subagent.js';
|
|
7
7
|
import { BackgroundAgentRegistry } from '../../../agent/background-registry.js';
|
|
8
|
+
import type { ContinuationRegistry } from '../../../agent/subagent/continuation-registry.js';
|
|
8
9
|
import { BackgroundSummarizer } from '../../../agent/background-summarizer.js';
|
|
9
10
|
import { DetachableToolRegistry } from '../../../agent/tools/detach-registry.js';
|
|
10
11
|
import { ProcessJobRegistry } from '../../../agent/shell-jobs/process-jobs.js';
|
|
@@ -22,6 +23,7 @@ export interface BootstrapInfra {
|
|
|
22
23
|
subagentExecutor: SubagentExecutor;
|
|
23
24
|
skillExecutor: SkillExecutor;
|
|
24
25
|
composeExecutor: ComposeExecutor;
|
|
26
|
+
continuationRegistry: ContinuationRegistry;
|
|
25
27
|
}
|
|
26
28
|
export declare function createBootstrapInfra(a: {
|
|
27
29
|
sessionRef: SessionRef;
|
|
@@ -12,6 +12,7 @@ export interface SessionAutosaverOptions {
|
|
|
12
12
|
export interface SessionAutosaver {
|
|
13
13
|
readonly stats: SessionStats;
|
|
14
14
|
saveTurn(userInput: string, assistantText: string, metadata: ResponseMetadata | undefined, toolEvents?: ToolEvent[]): void;
|
|
15
|
+
close(exitReason?: import('./session-store.js').StoredSession['exitReason']): void;
|
|
15
16
|
}
|
|
16
17
|
export declare function createSessionAutosaver(opts: SessionAutosaverOptions): SessionAutosaver;
|
|
17
18
|
export interface CollectedTurn {
|