@gajae-code/coding-agent 0.12.21 → 0.13.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/CHANGELOG.md +67 -2
- package/dist/types/cli/args.d.ts +5 -2
- package/dist/types/cli/root-flags.d.ts +246 -0
- package/dist/types/cli.d.ts +11 -19
- package/dist/types/commands/daemon.d.ts +0 -30
- package/dist/types/commands/launch.d.ts +11 -19
- package/dist/types/commands/quick-lane.d.ts +32 -0
- package/dist/types/commands/sdk.d.ts +21 -15
- package/dist/types/config/file-lock-gc.d.ts +2 -0
- package/dist/types/config/model-equivalence.d.ts +20 -0
- package/dist/types/config/model-profile-activation.d.ts +62 -17
- package/dist/types/config/model-profiles.d.ts +10 -0
- package/dist/types/config/model-registry.d.ts +68 -1
- package/dist/types/config/model-resolver.d.ts +15 -4
- package/dist/types/config/models-config-schema.d.ts +7 -2
- package/dist/types/config/provider-selection-policy.d.ts +62 -0
- package/dist/types/config/settings-schema.d.ts +36 -78
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/edit/renderer.d.ts +5 -2
- package/dist/types/edit/streaming.d.ts +13 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +2 -0
- package/dist/types/extensibility/extensions/compact-handler.d.ts +2 -1
- package/dist/types/extensibility/extensions/types.d.ts +3 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +19 -5
- package/dist/types/internal-urls/local-protocol.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +0 -2
- package/dist/types/modes/components/provider-order-context.d.ts +45 -0
- package/dist/types/modes/components/provider-order-editor.d.ts +24 -0
- package/dist/types/modes/components/settings-defs.d.ts +5 -1
- package/dist/types/modes/components/settings-selector.d.ts +2 -0
- package/dist/types/quick-lane/classify.d.ts +40 -0
- package/dist/types/runtime/stt-settings-setup.d.ts +18 -0
- package/dist/types/sdk/broker/broker.d.ts +56 -2
- package/dist/types/sdk/broker/operation-receipt-ledger.d.ts +25 -0
- package/dist/types/sdk/broker/session-index.d.ts +83 -2
- package/dist/types/sdk/broker/state-version.d.ts +1 -1
- package/dist/types/sdk/bus/notification-service.d.ts +6 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +8 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +4 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +26 -0
- package/dist/types/sdk/cli/rows.d.ts +98 -0
- package/dist/types/sdk/cli/session-cli.d.ts +35 -3
- package/dist/types/sdk/elevation/allowlist.d.ts +20 -0
- package/dist/types/sdk/elevation/audit.d.ts +93 -0
- package/dist/types/sdk/elevation/capability.d.ts +3 -0
- package/dist/types/sdk/elevation/digest.d.ts +72 -0
- package/dist/types/sdk/elevation/dispatch-receipt.d.ts +85 -0
- package/dist/types/sdk/elevation/grant-ledger.d.ts +163 -0
- package/dist/types/sdk/elevation/owner.d.ts +48 -0
- package/dist/types/sdk/guides/cache.d.ts +98 -0
- package/dist/types/sdk/guides/catalog.d.ts +156 -0
- package/dist/types/sdk/guides/cli.d.ts +39 -0
- package/dist/types/sdk/guides/manifest.d.ts +66 -0
- package/dist/types/sdk/guides/verify.d.ts +66 -0
- package/dist/types/sdk/host/control/dispatch.d.ts +8 -0
- package/dist/types/sdk/host/control/index.d.ts +1 -1
- package/dist/types/sdk/host/control/operations.d.ts +3 -2
- package/dist/types/sdk/host/query/cursor.d.ts +10 -0
- package/dist/types/sdk/host/query/handlers.d.ts +21 -0
- package/dist/types/sdk/host/session-runtime.d.ts +9 -0
- package/dist/types/sdk/mcp/server.d.ts +2 -2
- package/dist/types/sdk/prompt-status.d.ts +11 -0
- package/dist/types/sdk/session.d.ts +4 -0
- package/dist/types/sdk/transport/index.d.ts +1 -0
- package/dist/types/sdk/transport/relay.d.ts +1 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +20 -1
- package/dist/types/session/agent-session.d.ts +32 -18
- package/dist/types/session/blob-store.d.ts +13 -7
- package/dist/types/session/fallback-chain-controller.d.ts +15 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +25 -1
- package/dist/types/session/internal/session-memory-sidecar.d.ts +5 -5
- package/dist/types/session/session-manager.d.ts +139 -10
- package/dist/types/session/session-storage.d.ts +48 -0
- package/dist/types/setup/provider-onboarding.d.ts +7 -1
- package/dist/types/slash-commands/builtin-registry.d.ts +14 -0
- package/dist/types/stt/setup.d.ts +2 -0
- package/dist/types/task/executor.d.ts +10 -2
- package/dist/types/tools/browser/runtime-diagnostics.d.ts +65 -0
- package/dist/types/tools/browser/tab-protocol.d.ts +4 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +2 -0
- package/dist/types/tools/browser/tab-worker.d.ts +2 -0
- package/dist/types/tools/browser.d.ts +2 -0
- package/dist/types/tools/image-gen.d.ts +14 -18
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/resource-gc.d.ts +2 -0
- package/dist/types/utils/pasted-image-path.d.ts +6 -0
- package/package.json +9 -9
- package/scripts/generate-sdk-operation-inventory.ts +8 -0
- package/scripts/run-test-manifest.ts +61 -21
- package/scripts/verify-gjc-sdk-canonicalization.ts +9 -4
- package/src/cli/args.ts +62 -9
- package/src/cli/completion-cli.ts +1 -0
- package/src/cli/fast-help.ts +1 -0
- package/src/cli/root-flags.ts +100 -0
- package/src/cli/setup-cli.ts +6 -2
- package/src/cli.ts +42 -65
- package/src/commands/acp.ts +1 -1
- package/src/commands/daemon.ts +2 -31
- package/src/commands/gc.ts +1 -1
- package/src/commands/launch.ts +8 -129
- package/src/commands/quick-lane.ts +51 -0
- package/src/commands/sdk.ts +200 -26
- package/src/commands/setup.ts +4 -2
- package/src/config/file-lock-gc.ts +4 -1
- package/src/config/model-equivalence.ts +76 -7
- package/src/config/model-profile-activation.ts +1115 -265
- package/src/config/model-profiles.ts +134 -2
- package/src/config/model-registry.ts +352 -50
- package/src/config/model-resolver.ts +289 -38
- package/src/config/models-config-schema.ts +11 -4
- package/src/config/provider-selection-policy.ts +146 -0
- package/src/config/settings-schema.ts +50 -77
- package/src/config/settings.ts +40 -0
- package/src/coordinator-mcp/server.ts +32 -2
- package/src/edit/renderer.ts +175 -223
- package/src/edit/streaming.ts +108 -1
- package/src/export/html/index.ts +57 -7
- package/src/extensibility/custom-tools/types.ts +2 -0
- package/src/extensibility/extensions/compact-handler.ts +3 -2
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +3 -0
- package/src/gjc-runtime/gc-runtime.ts +379 -20
- package/src/gjc-runtime/launch-worktree.ts +5 -1
- package/src/gjc-runtime/team-runtime.ts +59 -2
- package/src/gjc-runtime/tmux-owner-isolation.ts +19 -0
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +16 -1
- package/src/internal-urls/docs-index.generated.ts +17 -13
- package/src/internal-urls/local-protocol.ts +1 -0
- package/src/main.ts +40 -3
- package/src/memories/index.ts +4 -2
- package/src/modes/acp/acp-agent.ts +235 -91
- package/src/modes/components/model-selector.ts +206 -42
- package/src/modes/components/provider-order-context.ts +197 -0
- package/src/modes/components/provider-order-editor.ts +441 -0
- package/src/modes/components/settings-defs.ts +21 -1
- package/src/modes/components/settings-selector.ts +45 -2
- package/src/modes/components/tool-execution.ts +47 -15
- package/src/modes/controllers/command-controller.ts +6 -3
- package/src/modes/controllers/extension-ui-controller.ts +2 -0
- package/src/modes/controllers/input-controller.ts +73 -2
- package/src/modes/controllers/selector-controller.ts +260 -153
- package/src/modes/prompt-suggestion-controller.ts +1 -1
- package/src/modes/runtime-init.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +18 -0
- package/src/prompts/tools/browser.md +1 -0
- package/src/quick-lane/classify.ts +257 -0
- package/src/rlm/index.ts +1 -1
- package/src/runtime/stt-settings-setup.ts +57 -0
- package/src/sdk/acp/adapter.ts +2 -1
- package/src/sdk/broker/broker.ts +780 -12
- package/src/sdk/broker/lifecycle.ts +70 -29
- package/src/sdk/broker/operation-receipt-ledger.ts +144 -0
- package/src/sdk/broker/session-index.ts +463 -48
- package/src/sdk/broker/state-version.ts +13 -9
- package/src/sdk/broker/transport.ts +14 -1
- package/src/sdk/bus/index.ts +34 -13
- package/src/sdk/bus/kind-aware-reconciliation.ts +21 -2
- package/src/sdk/bus/notification-service.ts +47 -1
- package/src/sdk/bus/prompt-reconciliation.ts +22 -3
- package/src/sdk/bus/telegram-daemon-contract.ts +4 -1
- package/src/sdk/bus/telegram-daemon.ts +54 -3
- package/src/sdk/cli/rows.ts +247 -0
- package/src/sdk/cli/session-cli.ts +930 -79
- package/src/sdk/elevation/allowlist.ts +54 -0
- package/src/sdk/elevation/audit.ts +208 -0
- package/src/sdk/elevation/capability.ts +41 -0
- package/src/sdk/elevation/digest.ts +129 -0
- package/src/sdk/elevation/dispatch-receipt.ts +184 -0
- package/src/sdk/elevation/grant-ledger.ts +1142 -0
- package/src/sdk/elevation/owner.ts +109 -0
- package/src/sdk/guides/cache.ts +363 -0
- package/src/sdk/guides/catalog.ts +554 -0
- package/src/sdk/guides/cli.ts +235 -0
- package/src/sdk/guides/manifest.ts +152 -0
- package/src/sdk/guides/verify.ts +178 -0
- package/src/sdk/host/control/dispatch.ts +49 -1
- package/src/sdk/host/control/index.ts +1 -0
- package/src/sdk/host/control/operations.ts +8 -1
- package/src/sdk/host/query/cursor.ts +47 -3
- package/src/sdk/host/query/handlers.ts +155 -2
- package/src/sdk/host/sdk-surface-parity.test.ts +1 -0
- package/src/sdk/host/session-runtime.test.ts +391 -1
- package/src/sdk/host/session-runtime.ts +308 -73
- package/src/sdk/host/surface-policy.ts +3 -0
- package/src/sdk/host/websocket-transport.ts +7 -1
- package/src/sdk/mcp/server.ts +88 -15
- package/src/sdk/prompt-status.ts +8 -0
- package/src/sdk/protocol/operation-inventory.generated.json +62 -0
- package/src/sdk/protocol/operation-registry.ts +3 -2
- package/src/sdk/session.ts +87 -39
- package/src/sdk/transport/index.ts +1 -0
- package/src/sdk/transport/relay.ts +3 -0
- package/src/sdk/transport/serve-cli.ts +111 -24
- package/src/secrets/obfuscator.ts +92 -12
- package/src/session/agent-session.ts +322 -93
- package/src/session/blob-store.ts +60 -8
- package/src/session/fallback-chain-controller.ts +35 -0
- package/src/session/internal/managed-session-scope.ts +25 -3
- package/src/session/internal/managed-session-storage.ts +574 -73
- package/src/session/internal/session-memory-sidecar.ts +19 -29
- package/src/session/session-manager.ts +2166 -743
- package/src/session/session-storage.ts +715 -48
- package/src/setup/provider-onboarding.ts +19 -3
- package/src/setup/provider-presets.json +3 -1
- package/src/slash-commands/builtin-registry.ts +85 -3
- package/src/stt/downloader.ts +2 -3
- package/src/stt/setup.ts +29 -4
- package/src/task/executor.ts +22 -18
- package/src/task/index.ts +24 -1
- package/src/tools/archive-reader.ts +11 -2
- package/src/tools/browser/runtime-diagnostics.ts +249 -0
- package/src/tools/browser/tab-protocol.ts +4 -0
- package/src/tools/browser/tab-supervisor.ts +5 -0
- package/src/tools/browser/tab-worker.ts +36 -1
- package/src/tools/browser.ts +7 -0
- package/src/tools/image-gen.ts +110 -166
- package/src/tools/index.ts +2 -0
- package/src/tools/read.ts +1 -1
- package/src/tools/resource-gc.ts +6 -1
- package/src/tools/tool-catalog.generated.ts +5 -1
- package/src/utils/pasted-image-path.ts +93 -0
- package/src/web/search/index.ts +3 -3
|
@@ -5,14 +5,15 @@ export type ControlInput = Record<string, unknown>;
|
|
|
5
5
|
* AgentSession and its controllers without exposing those concrete types here.
|
|
6
6
|
*/
|
|
7
7
|
export interface ControlSurface {
|
|
8
|
+
authorizeElevationClaim?(sdkId: string, input: ControlInput, capability: string): boolean;
|
|
8
9
|
prompt(text: string, images?: ControlValue, clientRef?: string): Promise<ControlValue> | ControlValue;
|
|
9
10
|
steer(text: string): Promise<ControlValue> | ControlValue;
|
|
10
11
|
followUp(text: string): Promise<ControlValue> | ControlValue;
|
|
11
12
|
abort(): Promise<ControlValue> | ControlValue;
|
|
12
13
|
abortAndPrompt(text: string): Promise<ControlValue> | ControlValue;
|
|
13
14
|
answerAsk(id: string, answer: ControlValue): Promise<ControlValue> | ControlValue;
|
|
14
|
-
answerGate(id: string, response: ControlValue, expectedSessionId?: string, idempotencyKey?: string): Promise<ControlValue> | ControlValue;
|
|
15
|
-
approvePlan(id: string, choice: ControlValue, expectedSessionId?: string): Promise<ControlValue> | ControlValue;
|
|
15
|
+
answerGate(id: string, response: ControlValue, expectedSessionId?: string, idempotencyKey?: string, elevationRequestId?: string): Promise<ControlValue> | ControlValue;
|
|
16
|
+
approvePlan(id: string, choice: ControlValue, expectedSessionId?: string, elevationRequestId?: string): Promise<ControlValue> | ControlValue;
|
|
16
17
|
invokeSkill(name: string, args: ControlValue, clientRef?: string): Promise<ControlValue> | ControlValue;
|
|
17
18
|
setPlanMode(on: boolean): Promise<ControlValue> | ControlValue;
|
|
18
19
|
operateGoal(op: string, objective?: string): Promise<ControlValue> | ControlValue;
|
|
@@ -7,8 +7,14 @@ export interface CursorEnvelope {
|
|
|
7
7
|
protocolMajor: 3;
|
|
8
8
|
sessionId: string;
|
|
9
9
|
resource: string;
|
|
10
|
+
/** Unique per-grant identity so identical envelopes never alias into one pin. */
|
|
11
|
+
nonce?: string;
|
|
10
12
|
revision: string;
|
|
11
13
|
highWatermark?: unknown;
|
|
14
|
+
/** TTL metadata minted by `CursorRegistry.grant`: wall-clock ms when granted. */
|
|
15
|
+
issuedAt?: number;
|
|
16
|
+
/** TTL metadata minted by `CursorRegistry.grant`: wall-clock ms when the cursor expires. */
|
|
17
|
+
expiresAt?: number;
|
|
12
18
|
position: unknown;
|
|
13
19
|
direction: string;
|
|
14
20
|
pageShape: unknown;
|
|
@@ -54,6 +60,10 @@ export declare class CursorRegistry {
|
|
|
54
60
|
private readonly now;
|
|
55
61
|
constructor(sessionToken: string | Uint8Array, revisions: RevisionStore, now?: () => number);
|
|
56
62
|
grant(connectionId: string, envelope: CursorEnvelope, resourceKind: string, resourceId: string): Promise<string>;
|
|
63
|
+
exchange(cursor: string, connectionId: string, expected: CursorQueryContext, resourceKind: string, resourceId: string): Promise<{
|
|
64
|
+
cursor: string;
|
|
65
|
+
envelope: CursorEnvelope;
|
|
66
|
+
}>;
|
|
57
67
|
consume(cursor: string, connectionId: string, expected: CursorQueryContext): CursorEnvelope;
|
|
58
68
|
release(cursor: string): void;
|
|
59
69
|
close(): void;
|
|
@@ -46,6 +46,15 @@ export interface SessionSurface {
|
|
|
46
46
|
}): unknown | Promise<unknown>;
|
|
47
47
|
/** Q27 effective model-profile catalog from the live session registry. */
|
|
48
48
|
getModelProfiles?(): unknown[] | Promise<unknown[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Q30 atomic checkpoint capture: the live transcript entries and the
|
|
51
|
+
* event-ring watermark read in ONE synchronous call, so the snapshot
|
|
52
|
+
* revision and the subscribe position can never straddle an append.
|
|
53
|
+
*/
|
|
54
|
+
getCheckpointSnapshot?(): {
|
|
55
|
+
entries: unknown[];
|
|
56
|
+
watermark: SdkCheckpointRecord;
|
|
57
|
+
};
|
|
49
58
|
/** Query rows backed by the session's installed binding map. */
|
|
50
59
|
installedQueries?: ReadonlySet<string>;
|
|
51
60
|
}
|
|
@@ -75,6 +84,18 @@ export interface QueryResponse {
|
|
|
75
84
|
details?: unknown;
|
|
76
85
|
};
|
|
77
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Host-published durable transcript checkpoint (C9). `revision` is the
|
|
89
|
+
* transcript high-watermark (entry count/offset) at checkpoint time and bounds
|
|
90
|
+
* replay to exactly `[checkpointRevision, live)`; `generation`/`seq` anchor the
|
|
91
|
+
* event-ring subscribe position carried by replay cursors.
|
|
92
|
+
*/
|
|
93
|
+
export interface SdkCheckpointRecord {
|
|
94
|
+
revision: number;
|
|
95
|
+
generation: number;
|
|
96
|
+
seq: number;
|
|
97
|
+
}
|
|
98
|
+
export declare function isCheckpointRecord(value: unknown): value is SdkCheckpointRecord;
|
|
78
99
|
export declare class QueryHandlers {
|
|
79
100
|
#private;
|
|
80
101
|
private readonly surface;
|
|
@@ -57,6 +57,10 @@ export declare class SessionSdkSessionRuntime {
|
|
|
57
57
|
}
|
|
58
58
|
/** Narrow extension-facing factory for the SDK-only session path. */
|
|
59
59
|
export interface CreateSdkSessionRuntimeOptions {
|
|
60
|
+
/** Authoritative broker state root for this session's endpoint lifecycle. */
|
|
61
|
+
agentDir: string;
|
|
62
|
+
/** Lifecycle-owned sessions require broker publication before they become usable. */
|
|
63
|
+
brokerRegistrationRequired?: boolean;
|
|
60
64
|
createTransport(input: {
|
|
61
65
|
sessionId: string;
|
|
62
66
|
stateRoot: string;
|
|
@@ -119,6 +123,11 @@ export interface SdkSurfaceFactoryOptions {
|
|
|
119
123
|
clientRef?: string;
|
|
120
124
|
}) => unknown;
|
|
121
125
|
hostTools?: boolean | (() => boolean);
|
|
126
|
+
/** Q30 event-ring watermark source (the live session event stream); synchronous. */
|
|
127
|
+
getEventWatermark?: () => {
|
|
128
|
+
generation: number;
|
|
129
|
+
seq: number;
|
|
130
|
+
};
|
|
122
131
|
}
|
|
123
132
|
/** Shared policy, capability, and query-surface factory for every SDK transport. */
|
|
124
133
|
export interface SdkSurfaceFactory {
|
|
@@ -21,7 +21,7 @@ export interface SdkMcpServerOptions {
|
|
|
21
21
|
connect?: (url: string, token: string) => Promise<SdkClient>;
|
|
22
22
|
}
|
|
23
23
|
export declare const SDK_MCP_TOOL_NAMES: readonly ["gjc_session_control", "gjc_session_query", "gjc_session_global", "gjc_session_list"];
|
|
24
|
-
/** Creates the model-facing MCP adapter
|
|
24
|
+
/** Creates the model-facing MCP adapter; session targeting is broker-bound (C10). */
|
|
25
25
|
export declare function createSdkMcpServer(options?: SdkMcpServerOptions): {
|
|
26
26
|
callTool: (name: string, args?: Arguments) => Promise<unknown>;
|
|
27
27
|
handleJsonRpc: (request: JsonRpcRequest) => Promise<JsonRpcResponse>;
|
|
@@ -31,7 +31,7 @@ export declare function createSdkMcpServer(options?: SdkMcpServerOptions): {
|
|
|
31
31
|
/**
|
|
32
32
|
* Runs the SDK MCP server over stdio (newline-delimited JSON-RPC), the shipped
|
|
33
33
|
* `gjc mcp-serve sdk` entrypoint. Pure SDK client: session control/query flows
|
|
34
|
-
* through
|
|
34
|
+
* through the broker and v3 WebSockets only.
|
|
35
35
|
*/
|
|
36
36
|
export declare function runSdkMcpStdio(options?: SdkMcpServerOptions): Promise<void>;
|
|
37
37
|
export {};
|
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
* - Q26 tracks prompts accepted through the SDK control surface (which always
|
|
25
25
|
* carries a requesting connection); submissions without a delivery owner are
|
|
26
26
|
* outside the reconciliation contract and hold no reservation.
|
|
27
|
+
* - A terminal outcome settles once: the first terminal transition wins. A late
|
|
28
|
+
* `agent_failed` (arriving on a different delivery path than the one that
|
|
29
|
+
* claimed the terminal) may still attach its bounded, sanitized reason to an
|
|
30
|
+
* already-terminal record that has none, surfaced as `error` on `terminal_ok`.
|
|
31
|
+
* It never changes status, `terminalAt`, retention order, or the clientRef
|
|
32
|
+
* index, and the first recorded reason always wins over a later frame.
|
|
27
33
|
*/
|
|
28
34
|
export declare const PROMPT_CLIENT_REF_MAX_LENGTH = 128;
|
|
29
35
|
export interface TurnPromptImageInput {
|
|
@@ -82,6 +88,11 @@ export interface TurnPromptReconciliationTerminalOk extends TurnPromptReconcilia
|
|
|
82
88
|
/** Epoch milliseconds of the terminal transition. */
|
|
83
89
|
terminalAt: number;
|
|
84
90
|
outcome?: SdkPromptTerminalOutcome;
|
|
91
|
+
/** Present when a late `agent_failed` supplied the only failure reason. */
|
|
92
|
+
error?: {
|
|
93
|
+
code: string;
|
|
94
|
+
message: string;
|
|
95
|
+
};
|
|
85
96
|
}
|
|
86
97
|
export interface TurnPromptReconciliationFailed extends TurnPromptReconciliationIdentity {
|
|
87
98
|
status: "failed";
|
|
@@ -57,6 +57,8 @@ export interface CreateAgentSessionOptions {
|
|
|
57
57
|
/** Raw model pattern string (e.g. from --model CLI flag) to resolve after extensions load.
|
|
58
58
|
* Used when model lookup is deferred because extension-provided models aren't registered yet. */
|
|
59
59
|
modelPattern?: string;
|
|
60
|
+
/** Active profile inherited by a nested SDK/subagent session. */
|
|
61
|
+
activeModelProfile?: string;
|
|
60
62
|
/** Thinking selector. Default: from settings, else unset */
|
|
61
63
|
thinkingLevel?: ThinkingLevel;
|
|
62
64
|
/** Runtime substitution metadata for the initial model_change session event. */
|
|
@@ -71,6 +73,8 @@ export interface CreateAgentSessionOptions {
|
|
|
71
73
|
/** Optional provider-facing session identifier for prompt caches and sticky auth selection.
|
|
72
74
|
* Keeps persisted session files isolated while reusing provider-side caches. */
|
|
73
75
|
providerSessionId?: string;
|
|
76
|
+
/** Optional credential-selection session identity, distinct from provider transport/cache identity. */
|
|
77
|
+
credentialSessionId?: string;
|
|
74
78
|
/** Runtime credential selector for multi-account auth pools. */
|
|
75
79
|
credentialSelector?: {
|
|
76
80
|
provider?: string;
|
|
@@ -38,6 +38,7 @@ export type RelayOptions = {
|
|
|
38
38
|
onTransportError: (error: TransportError) => void;
|
|
39
39
|
webSocketFactory?: (url: string) => RelayWebSocket;
|
|
40
40
|
signal?: AbortSignal;
|
|
41
|
+
validateDownstreamFrame?: (frame: string) => boolean;
|
|
41
42
|
};
|
|
42
43
|
/** Starts a dedicated raw-WebSocket relay for exactly one downstream stream. */
|
|
43
44
|
export declare function startRelayPair(options: RelayOptions): Promise<RelayPair>;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
+
import { SdkClient } from "../client";
|
|
1
2
|
/** Resolves the pending ceiling with flag > env > default precedence; exported for tests. */
|
|
2
3
|
export declare function resolveServePendingCeiling(flagValue: string | undefined, envValue: string | undefined): number;
|
|
3
|
-
|
|
4
|
+
type BrokerSessionRow = {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
live: boolean;
|
|
7
|
+
ambiguous: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Exhausts broker `session.list` cursor pagination (default page limit 100) to
|
|
11
|
+
* one full snapshot; exported for tests.
|
|
12
|
+
*/
|
|
13
|
+
export declare function listBrokerSessions(broker: SdkClient): Promise<BrokerSessionRow[]>;
|
|
14
|
+
/** Selects the session to serve through broker `session.list` truth (C10); exported for tests. */
|
|
15
|
+
export declare function selectBrokerSession(sessions: BrokerSessionRow[], explicitSessionId: string | undefined): string;
|
|
16
|
+
/**
|
|
17
|
+
* Attaches a stdio or Unix-socket relay to one live SDK session endpoint.
|
|
18
|
+
* Session targeting is broker-bound (C10): `session.list` resolves the session
|
|
19
|
+
* and `session.get_endpoint` mints the exact credential — never a direct
|
|
20
|
+
* endpoint-file read. A missing or unreachable broker fails closed.
|
|
21
|
+
*/
|
|
4
22
|
export declare function runSdkServe(argv: string[]): Promise<void>;
|
|
23
|
+
export {};
|
|
@@ -105,6 +105,7 @@ import type { CheckpointState } from "../tools/checkpoint";
|
|
|
105
105
|
import { type TodoItem, type TodoPhase } from "../tools/todo-write";
|
|
106
106
|
import { type WorkspaceTree } from "../workspace-tree";
|
|
107
107
|
import { type DefaultModelSelectionResult } from "./default-model-selection";
|
|
108
|
+
import { type ConfiguredFallbackChain, type FallbackChainRuntimeState } from "./fallback-chain-controller";
|
|
108
109
|
export { DefaultModelSelectionRecoveryError } from "./default-model-selection";
|
|
109
110
|
import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "./client-bridge";
|
|
110
111
|
import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
|
|
@@ -339,6 +340,8 @@ export interface AgentSessionConfig {
|
|
|
339
340
|
* so that credential sticky selection is consistent with the session's streaming calls.
|
|
340
341
|
*/
|
|
341
342
|
providerSessionId?: string;
|
|
343
|
+
/** Optional auth-selection identity, distinct from logical/canonical and provider-cache identity. */
|
|
344
|
+
credentialSessionId?: string;
|
|
342
345
|
/** Optional provider-facing cache identity, distinct from logical session identity. */
|
|
343
346
|
providerCacheSessionId?: string;
|
|
344
347
|
}
|
|
@@ -559,6 +562,11 @@ export declare class StreamingEditFileCache {
|
|
|
559
562
|
has(path: string): boolean;
|
|
560
563
|
get totalBytes(): number;
|
|
561
564
|
}
|
|
565
|
+
export interface DefaultFallbackRuntimeState {
|
|
566
|
+
chain: ConfiguredFallbackChain;
|
|
567
|
+
controller: FallbackChainRuntimeState;
|
|
568
|
+
exhaustedLastTurn: boolean;
|
|
569
|
+
}
|
|
562
570
|
export declare class AgentSession {
|
|
563
571
|
#private;
|
|
564
572
|
readonly agent: Agent;
|
|
@@ -851,6 +859,8 @@ export declare class AgentSession {
|
|
|
851
859
|
get sessionFile(): string | undefined;
|
|
852
860
|
/** Current session ID */
|
|
853
861
|
get sessionId(): string;
|
|
862
|
+
/** Credential selection identity; defaults to the provider-facing session identity. */
|
|
863
|
+
get credentialSessionId(): string;
|
|
854
864
|
/** Current session display name, if set */
|
|
855
865
|
get sessionName(): string | undefined;
|
|
856
866
|
/** Scoped models for cycling (from --models flag) */
|
|
@@ -1061,18 +1071,13 @@ export declare class AgentSession {
|
|
|
1061
1071
|
selector?: string;
|
|
1062
1072
|
thinkingLevel?: ThinkingLevel;
|
|
1063
1073
|
cause?: ModelChangeCause;
|
|
1074
|
+
onMutationStarted?: () => void;
|
|
1064
1075
|
}): Promise<void>;
|
|
1065
1076
|
setActiveModelProfile(name: string | undefined): void;
|
|
1066
1077
|
getActiveModelProfile(): string | undefined;
|
|
1067
|
-
/**
|
|
1068
|
-
* Record which runtime override keys a profile activation installed together
|
|
1069
|
-
* with their pre-profile effective baseline (durable/project value or a
|
|
1070
|
-
* configured `modelBindings` value). First activation for a key wins, so a
|
|
1071
|
-
* profile switch never captures the previous profile's roles as the
|
|
1072
|
-
* baseline. The session-scoped reset restores exactly these keys.
|
|
1073
|
-
*/
|
|
1078
|
+
/** Record runtime override keys installed by a profile activation. */
|
|
1074
1079
|
noteProfileInstalledOverrides(modelRoles: readonly string[], agentModelOverrides: readonly string[], preProfileModel: Model | undefined): void;
|
|
1075
|
-
/** Drop the recorded profile-installed override keys
|
|
1080
|
+
/** Drop the recorded profile-installed override keys after materialization. */
|
|
1076
1081
|
clearProfileInstalledOverrides(): void;
|
|
1077
1082
|
/** Current profile-installed override keys, for deriving the activation base. */
|
|
1078
1083
|
getProfileInstalledOverrideKeys(): {
|
|
@@ -1120,6 +1125,13 @@ export declare class AgentSession {
|
|
|
1120
1125
|
withSdkControlMutation<T>(body: () => Promise<T>): Promise<T>;
|
|
1121
1126
|
/** Return the persisted configured fallback selectors for a model role. */
|
|
1122
1127
|
getConfiguredModelChain(role: string): readonly string[] | undefined;
|
|
1128
|
+
/** Return the persisted configured chain with its durable ownership metadata. */
|
|
1129
|
+
getConfiguredModelChainState(role: string): {
|
|
1130
|
+
entries: readonly string[];
|
|
1131
|
+
origin: string;
|
|
1132
|
+
identity?: string;
|
|
1133
|
+
explicitHead: boolean;
|
|
1134
|
+
} | undefined;
|
|
1123
1135
|
/** Persist the configured fallback selectors for a model role. */
|
|
1124
1136
|
setConfiguredModelChain(role: string, entries: readonly string[], origin: string, identity?: string, explicitHead?: boolean): void;
|
|
1125
1137
|
/**
|
|
@@ -1136,6 +1148,8 @@ export declare class AgentSession {
|
|
|
1136
1148
|
selector: string;
|
|
1137
1149
|
reason: string;
|
|
1138
1150
|
}>): void;
|
|
1151
|
+
getDefaultFallbackRuntimeState(): DefaultFallbackRuntimeState;
|
|
1152
|
+
restoreDefaultFallbackRuntimeState(state: DefaultFallbackRuntimeState): void;
|
|
1139
1153
|
/**
|
|
1140
1154
|
* The model selector ("provider/id") that resume restores as the session
|
|
1141
1155
|
* default — the latest session-log `model_change` with role="default".
|
|
@@ -1152,13 +1166,12 @@ export declare class AgentSession {
|
|
|
1152
1166
|
*/
|
|
1153
1167
|
resolveConfiguredDefaultModel(): Model | undefined;
|
|
1154
1168
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
* profile main model the failed activation already recorded as the default.
|
|
1169
|
+
* Record or clear the session resume default ("provider/id") without touching
|
|
1170
|
+
* the live runtime model. An undefined selector appends an explicit clear
|
|
1171
|
+
* marker so rollback preserves the absence of a prior default during replay.
|
|
1172
|
+
* Never writes global settings.
|
|
1160
1173
|
*/
|
|
1161
|
-
recordResumeDefaultModel(selector: string): void;
|
|
1174
|
+
recordResumeDefaultModel(selector: string | undefined): void;
|
|
1162
1175
|
/**
|
|
1163
1176
|
* Set model temporarily (for this session only).
|
|
1164
1177
|
* Validates API key, saves to session log but NOT to settings.
|
|
@@ -1166,10 +1179,9 @@ export declare class AgentSession {
|
|
|
1166
1179
|
* The change is recorded in the session log as `role: "temporary"` by
|
|
1167
1180
|
* default, which means it is NOT restored as the session default on resume —
|
|
1168
1181
|
* transient retry/fallback/context-promotion/plan switches must not clobber
|
|
1169
|
-
* the user's explicit pick (issue #849).
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
* global settings (new sessions keep the global default).
|
|
1182
|
+
* the user's explicit pick (issue #849). Callers that intentionally own the
|
|
1183
|
+
* session resume default may opt into `persistAsSessionDefault: true` without
|
|
1184
|
+
* changing global settings.
|
|
1173
1185
|
* @throws Error if no API key available for the model
|
|
1174
1186
|
*/
|
|
1175
1187
|
setModelTemporary(model: Model, thinkingLevel?: ThinkingLevel, options?: {
|
|
@@ -1179,6 +1191,8 @@ export declare class AgentSession {
|
|
|
1179
1191
|
providerSessionScope?: TemporaryProviderSessionScope;
|
|
1180
1192
|
signal?: AbortSignal;
|
|
1181
1193
|
}): Promise<TemporaryProviderSessionScope | void>;
|
|
1194
|
+
/** Restore the exact live-model state captured before a failed selector transaction. */
|
|
1195
|
+
restoreModelSelectionForRollback(model: Model | undefined, thinkingLevel: ThinkingLevel | undefined): Promise<void>;
|
|
1182
1196
|
/** Set a durable per-session model from a control surface without exposing credential errors. */
|
|
1183
1197
|
setModelTemporaryForControl(model: Model, expectedSessionId?: string, thinkingLevel?: ThinkingLevel): Promise<boolean>;
|
|
1184
1198
|
setDefaultModelSelection(model: Model, thinkingLevel: ThinkingLevel | undefined, options?: {
|
|
@@ -27,18 +27,15 @@ export declare class ResidentCacheTrustError extends Error {
|
|
|
27
27
|
readonly path: string;
|
|
28
28
|
constructor(reason: string, path: string, options?: ErrorOptions);
|
|
29
29
|
}
|
|
30
|
+
export declare function disposeVerifiedResidentCacheInstanceDir(instanceDir: string): void;
|
|
30
31
|
/**
|
|
31
32
|
* Best-effort cleanup of abandoned resident-cache instances. The root is
|
|
32
33
|
* re-verified before scanning, work is bounded, and all failures fail closed.
|
|
33
34
|
*/
|
|
34
35
|
export declare function sweepResidentCacheRoot(root: string, options?: ResidentCacheGcSweepOptions): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Create a private resident-cache instance directory beneath a trusted profile
|
|
37
|
-
* root. The cache-owned root and nonce instance are both verified owner-only
|
|
38
|
-
* directories; callers must use {@link EphemeralBlobStore.adoptVerifiedDir}
|
|
39
|
-
* rather than the destructive EphemeralBlobStore constructor.
|
|
40
|
-
*/
|
|
41
36
|
export declare function openVerifiedResidentCacheInstanceDir(root: string): string;
|
|
37
|
+
/** Open the deterministic per-session managed-sidecar instance in its separate cache root. */
|
|
38
|
+
export declare function openVerifiedSidecarCacheInstanceDir(root: string, sessionHash: string): string;
|
|
42
39
|
/**
|
|
43
40
|
* Content-addressed blob store for externalizing large binary data (images) from session JSONL files.
|
|
44
41
|
*
|
|
@@ -216,6 +213,8 @@ export interface CanonicalBlobEntry {
|
|
|
216
213
|
readonly path: string;
|
|
217
214
|
readonly bytes: number;
|
|
218
215
|
readonly mtimeMs: number;
|
|
216
|
+
readonly dev: number;
|
|
217
|
+
readonly ino: number;
|
|
219
218
|
}
|
|
220
219
|
/** Longest possible `blob:sha256:<hash>` reference, used to bound chunked scans. */
|
|
221
220
|
export declare const BLOB_REFERENCE_MAX_LENGTH: number;
|
|
@@ -232,10 +231,17 @@ export declare function listCanonicalBlobs(dir: string): Promise<CanonicalBlobEn
|
|
|
232
231
|
* at scan time must still describe the file at unlink time (same inode, size and
|
|
233
232
|
* mtime, still a single-link regular file), otherwise the blob is left in place.
|
|
234
233
|
*
|
|
234
|
+
* `beforeUnlink` runs after this function has verified the blob and immediately
|
|
235
|
+
* before it calls unlink. Callers use it to bind external liveness evidence to
|
|
236
|
+
* the verified blob identity, so a live reference that appears while the blob is
|
|
237
|
+
* being revalidated prevents the destructive syscall.
|
|
238
|
+
*
|
|
235
239
|
* `failed` distinguishes an actual IO failure (which a caller should surface as
|
|
236
240
|
* a failed reclaim) from a revalidation refusal (which is an ordinary KEEP).
|
|
237
241
|
*/
|
|
238
|
-
export declare function removeCanonicalBlob(entry: CanonicalBlobEntry
|
|
242
|
+
export declare function removeCanonicalBlob(entry: CanonicalBlobEntry, options?: {
|
|
243
|
+
beforeUnlink?: () => Promise<boolean>;
|
|
244
|
+
}): Promise<{
|
|
239
245
|
removed: true;
|
|
240
246
|
} | {
|
|
241
247
|
removed: false;
|
|
@@ -13,6 +13,19 @@ export interface FallbackFailure {
|
|
|
13
13
|
reason: string;
|
|
14
14
|
}
|
|
15
15
|
export type FallbackFailureResult = "retry" | "advance" | "exhausted";
|
|
16
|
+
export interface FallbackChainRuntimeState {
|
|
17
|
+
activeIndex: number;
|
|
18
|
+
attemptsUsed: number;
|
|
19
|
+
totalAttemptsUsed: number;
|
|
20
|
+
attemptStarted: boolean;
|
|
21
|
+
restoredEntryIndices: number[];
|
|
22
|
+
tried: FallbackFailure[];
|
|
23
|
+
skips: Array<{
|
|
24
|
+
selector: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
}>;
|
|
27
|
+
exhaustedForTurn: boolean;
|
|
28
|
+
}
|
|
16
29
|
/**
|
|
17
30
|
* In-memory policy state for one fallback-chain scope. A controller is deliberately
|
|
18
31
|
* not serializable: configured chain intent is durable, current position is not.
|
|
@@ -30,6 +43,8 @@ export declare class FallbackChainController {
|
|
|
30
43
|
}>;
|
|
31
44
|
exhaustedForTurn: boolean;
|
|
32
45
|
constructor(chain: ConfiguredFallbackChain, maxAttempts: number);
|
|
46
|
+
snapshotRuntimeState(): FallbackChainRuntimeState;
|
|
47
|
+
restoreRuntimeState(state: FallbackChainRuntimeState): void;
|
|
33
48
|
get totalAttemptsUsed(): number;
|
|
34
49
|
currentSelector(): string | undefined;
|
|
35
50
|
onResolutionSkip(reason: string): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NativeDirectoryTreeSnapshot, NativeExactUnlinkResult, NativeOwnerOnlySecurityResult, RecoveryFsRoot } from "@gajae-code/natives";
|
|
2
|
-
import type { SessionStorageStat } from "../session-storage";
|
|
2
|
+
import type { SessionStorageRangeSnapshot, SessionStorageStat } from "../session-storage";
|
|
3
3
|
import { type NativePublishOutcome } from "./native-publish-outcome";
|
|
4
4
|
export declare const MANAGED_ARTIFACT_MAX_DEPTH = 32;
|
|
5
5
|
export declare const MANAGED_ARTIFACT_MAX_FILES = 50000;
|
|
@@ -21,6 +21,10 @@ export declare class ManagedReplaceError extends Error {
|
|
|
21
21
|
readonly replacementCause: unknown;
|
|
22
22
|
constructor(result: NativeExactUnlinkResult, cleanupReceiptPath: string, replacementCause?: unknown);
|
|
23
23
|
}
|
|
24
|
+
export declare class ManagedCommittedMutationError extends Error {
|
|
25
|
+
readonly operation: "replace" | "append";
|
|
26
|
+
constructor(operation: "replace" | "append", cause: unknown);
|
|
27
|
+
}
|
|
24
28
|
/** Cleanup is safe only when the native move reports that it did not commit. */
|
|
25
29
|
export declare function mayCleanManagedTreeStaging(error: unknown): boolean;
|
|
26
30
|
/**
|
|
@@ -83,6 +87,17 @@ export interface ManagedBoundedAppendExpectation {
|
|
|
83
87
|
readonly ctimeNs: string;
|
|
84
88
|
readonly sha256: string;
|
|
85
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Best-effort removal of scrubbed write-protocol remnants from one managed
|
|
92
|
+
* directory. Only zero-length, single-link, non-symlink regular files whose
|
|
93
|
+
* names carry a terminal remnant prefix and whose timestamps are older than
|
|
94
|
+
* the age gate are removed: a zero-length single-link entry is exactly what
|
|
95
|
+
* the scrub proof leaves behind, and non-zero entries (displaced predecessors
|
|
96
|
+
* or detached receipts retained as evidence) are never touched. Failures are
|
|
97
|
+
* swallowed — a concurrent same-owner writer may legitimately own or already
|
|
98
|
+
* have reconciled any candidate.
|
|
99
|
+
*/
|
|
100
|
+
export declare function reapScrubbedProtocolRemnantsSync(directory: string, minAgeMs?: number): number;
|
|
86
101
|
export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
|
|
87
102
|
export interface ManagedLockRetirementTestEvent {
|
|
88
103
|
readonly path: string;
|
|
@@ -149,10 +164,19 @@ export declare class ManagedSessionDescendantStore {
|
|
|
149
164
|
appendSync(relativePath: string, bytes: Uint8Array): ManagedAppendReceipt;
|
|
150
165
|
/** Capture descriptor identity without copying file bytes when retained authority is available. */
|
|
151
166
|
descriptorExpected(relativePath: string): SessionStorageStat | null;
|
|
167
|
+
/**
|
|
168
|
+
* Read one bounded range through a no-follow descriptor while binding the
|
|
169
|
+
* opened file to retained authority (when available) and the managed root
|
|
170
|
+
* before and after the read. This avoids whole-transcript capture for cold
|
|
171
|
+
* managed-session indexing without weakening pathname authority.
|
|
172
|
+
*/
|
|
173
|
+
readRangeExpectedSync(relativePath: string, start: number, length: number, expectedDescriptor?: Pick<SessionStorageStat, "dev" | "ino" | "nlink" | "size" | "mtimeNs" | "ctimeNs">): SessionStorageRangeSnapshot;
|
|
152
174
|
/** Read an exact managed file without exposing its pathname as authority. */
|
|
153
175
|
readExpected(relativePath: string): ManagedFileSnapshot | null;
|
|
154
176
|
/** Remove an exact captured file without reopening its pathname as authority. */
|
|
155
177
|
removeExpected(relativePath: string, expected: ManagedFileSnapshot): void;
|
|
178
|
+
/** Remove one exact file without allocating its contents. */
|
|
179
|
+
removeIfExistsDescriptor(relativePath: string): boolean;
|
|
156
180
|
/** Read and remove one managed descendant through retained authority. */
|
|
157
181
|
consume(relativePath: string): Promise<Uint8Array | null>;
|
|
158
182
|
/** Remove one managed descendant through retained authority when it exists. */
|
|
@@ -186,7 +186,7 @@ export declare class ReducerBudget {
|
|
|
186
186
|
/**
|
|
187
187
|
* Single source of truth for every sidecar artifact and temp: `*.spill.idx`,
|
|
188
188
|
* `*.spill.tail`, `*.spill.commit`, `*.spill.buckets`, `*.spill.dict-*`,
|
|
189
|
-
* `*.spill.capture-*`, `*.spill.fork-*`, `*.spill.overlay-*`,
|
|
189
|
+
* `*.spill.capture-*`, `*.spill.fork-*`, `*.spill.overlay-*`, `*.spill.build-lock`,
|
|
190
190
|
* `*.spill.parent-*` (persistent parent→children buckets),
|
|
191
191
|
* `*.spill.metadata-*` (persistent metadata-delta section), and any
|
|
192
192
|
* `*.spill.*.tmp`. Used at every fork/delete/sweep/Memory-parity callsite so
|
|
@@ -731,10 +731,10 @@ export interface DictionaryIdDetector {
|
|
|
731
731
|
add(id: string): "added" | "duplicate" | "full";
|
|
732
732
|
}
|
|
733
733
|
/**
|
|
734
|
-
* Bounded duplicate-id oracle.
|
|
735
|
-
*
|
|
736
|
-
* A hash collision can only produce a spurious duplicate (fail
|
|
737
|
-
* miss a true duplicate.
|
|
734
|
+
* Bounded duplicate-id oracle. The fixed-capacity 48-bit hash table is allocated
|
|
735
|
+
* on the first record, so no attacker-controlled id string is retained by the
|
|
736
|
+
* detector. A hash collision can only produce a spurious duplicate (fail
|
|
737
|
+
* closed), never miss a true duplicate.
|
|
738
738
|
*/
|
|
739
739
|
export declare class BoundedDictionaryIdSet implements DictionaryIdDetector {
|
|
740
740
|
#private;
|