@gajae-code/coding-agent 0.18.10 → 0.18.12
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 +295 -0
- package/dist/types/async/job-manager.d.ts +7 -3
- package/dist/types/async/result-formatting.d.ts +2 -0
- package/dist/types/autoresearch/git.d.ts +1 -1
- package/dist/types/capability/fs.d.ts +2 -2
- package/dist/types/cli/accounts-cli.d.ts +2 -2
- package/dist/types/cli/doctor/install-repairs.d.ts +4 -1
- package/dist/types/cli/install-activation.d.ts +10 -4
- package/dist/types/cli/public-command-errors.d.ts +1 -0
- package/dist/types/cli/update-cli.d.ts +14 -1
- package/dist/types/cli-ordinary.d.ts +2 -2
- package/dist/types/commands/accounts.d.ts +2 -1
- package/dist/types/commands/migrate.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +5 -0
- package/dist/types/commit/changelog/index.d.ts +1 -0
- package/dist/types/config/autorouting-tier-map.d.ts +30 -0
- package/dist/types/config/config-hot-reload-trust.d.ts +12 -0
- package/dist/types/config/config-hot-reload.d.ts +39 -0
- package/dist/types/config/file-lock.d.ts +8 -1
- package/dist/types/config/model-discovery-manager.d.ts +2 -0
- package/dist/types/config/model-profile-activation.d.ts +62 -6
- package/dist/types/config/model-registry.d.ts +56 -5
- package/dist/types/config/model-resolver.d.ts +2 -0
- package/dist/types/config/models-config-schema.d.ts +10 -0
- package/dist/types/config/settings-schema.d.ts +46 -3
- package/dist/types/config/settings.d.ts +33 -1
- package/dist/types/dap/config.d.ts +8 -4
- package/dist/types/debug/system-info.d.ts +6 -1
- package/dist/types/discovery/mcp-compat.d.ts +3 -1
- package/dist/types/edit/modes/patch.d.ts +5 -0
- package/dist/types/edit/modes/replace.d.ts +3 -0
- package/dist/types/exec/bash-executor.d.ts +12 -0
- package/dist/types/gjc-runtime/managed-owner-admission.d.ts +3 -0
- package/dist/types/gjc-runtime/session-state-lock.d.ts +2 -0
- package/dist/types/gjc-runtime/state-runtime.d.ts +0 -2
- package/dist/types/migrate/adapters/codex.d.ts +2 -1
- package/dist/types/migrate/adapters/index.d.ts +10 -1
- package/dist/types/migrate/executor.d.ts +3 -1
- package/dist/types/migrate/types.d.ts +15 -3
- package/dist/types/modes/components/settings-selector.d.ts +6 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +2 -0
- package/dist/types/modes/theme/theme.d.ts +1 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +4 -0
- package/dist/types/runtime-mcp/manager.d.ts +7 -0
- package/dist/types/runtime-mcp/plugin-mcp-name-filter.d.ts +22 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +4 -0
- package/dist/types/sdk/broker/broker-exit.d.ts +2 -2
- package/dist/types/sdk/broker/broker.d.ts +7 -1
- package/dist/types/sdk/broker/daemon-entry.d.ts +11 -1
- package/dist/types/sdk/broker/doctor-restart.d.ts +1 -1
- package/dist/types/sdk/broker/ensure.d.ts +136 -7
- package/dist/types/sdk/broker/hop.d.ts +36 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +18 -10
- package/dist/types/sdk/broker/lock-host-identity.d.ts +5 -0
- package/dist/types/sdk/broker/session-index.d.ts +4 -1
- package/dist/types/sdk/bus/chat-command-policy.d.ts +2 -1
- package/dist/types/sdk/bus/index.d.ts +23 -0
- package/dist/types/sdk/bus/reconciliation-store.d.ts +10 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/cli/session-cli.d.ts +0 -1
- package/dist/types/sdk/host/session-runtime.d.ts +32 -0
- package/dist/types/sdk/prompt-deadline-flush.d.ts +42 -4
- package/dist/types/sdk/prompt-deadline-manager.d.ts +2 -0
- package/dist/types/sdk/protocol/adapter-validation.d.ts +10 -4
- package/dist/types/sdk/reconciliation-extensions.d.ts +1 -1
- package/dist/types/sdk/session-list.d.ts +1 -1
- package/dist/types/session/agent-session.d.ts +58 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +2 -2
- package/dist/types/session/internal/managed-session-storage.d.ts +1 -1
- package/dist/types/session/internal/native-publish-outcome.d.ts +1 -1
- package/dist/types/session/messages.d.ts +5 -1
- package/dist/types/session/session-manager.d.ts +13 -3
- package/dist/types/session/startup-auth-config.d.ts +24 -2
- package/dist/types/session/streaming-output.d.ts +11 -0
- package/dist/types/session/terminal-abort.d.ts +3 -1
- package/dist/types/session-import/service.d.ts +1 -1
- package/dist/types/skill-state/workflow-mutation-guard.d.ts +7 -3
- package/dist/types/slash-commands/helpers/provider-auth-status.d.ts +8 -0
- package/dist/types/task/executor.d.ts +19 -2
- package/dist/types/tools/ast-edit-write-path.d.ts +10 -0
- package/dist/types/tools/atomic-file-write.d.ts +9 -7
- package/dist/types/tools/bash-allowed-prefixes.d.ts +11 -0
- package/dist/types/tools/descriptors.d.ts +2 -0
- package/dist/types/tools/fetch.d.ts +1 -1
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/python.d.ts +1 -1
- package/dist/types/tools/report-issue.d.ts +41 -0
- package/dist/types/tools/subagent.d.ts +23 -0
- package/dist/types/web/scrapers/types.d.ts +8 -1
- package/dist/types/web/search/providers/insane.d.ts +7 -1
- package/dist/types/web/search/providers/searxng.d.ts +5 -0
- package/package.json +8 -8
- package/scripts/build-binary.ts +2 -1
- package/scripts/capture-subagent-compact-panel-showcase.ts +105 -0
- package/scripts/generate-docs-index.ts +8 -1
- package/scripts/generate-sdk-operation-inventory.ts +22 -4
- package/src/async/job-manager.ts +356 -56
- package/src/async/result-formatting.ts +40 -0
- package/src/autoresearch/git.ts +9 -2
- package/src/autoresearch/prompts/prompt-setup.md +1 -1
- package/src/capability/fs.ts +27 -19
- package/src/capability/index.ts +2 -2
- package/src/cli/accounts-cli.ts +176 -8
- package/src/cli/auth-broker-cli.ts +21 -11
- package/src/cli/doctor/install-repairs.ts +35 -5
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/install-activation.ts +47 -4
- package/src/cli/migrate-cli.ts +7 -5
- package/src/cli/public-command-errors.ts +4 -0
- package/src/cli/root-flags.ts +2 -2
- package/src/cli/stats-cli.ts +9 -5
- package/src/cli/update-cli.ts +224 -7
- package/src/cli-ordinary.ts +7 -2
- package/src/commands/accounts.ts +10 -5
- package/src/commands/migrate.ts +3 -3
- package/src/commands/sdk.ts +199 -42
- package/src/commands/ultragoal.ts +16 -8
- package/src/commit/changelog/index.ts +39 -1
- package/src/commit/message.ts +10 -3
- package/src/config/autorouting-tier-map.ts +30 -0
- package/src/config/config-hot-reload-trust.ts +148 -0
- package/src/config/config-hot-reload.ts +734 -0
- package/src/config/file-lock.ts +216 -56
- package/src/config/model-bindings-applier.ts +85 -47
- package/src/config/model-discovery-manager.ts +10 -0
- package/src/config/model-profile-activation.ts +716 -113
- package/src/config/model-registry.ts +1334 -158
- package/src/config/model-resolver.ts +3 -1
- package/src/config/models-config-schema.ts +6 -0
- package/src/config/settings-schema.ts +60 -3
- package/src/config/settings.ts +458 -24
- package/src/coordinator-mcp/policy.ts +26 -1
- package/src/crash/sanitize.ts +4 -0
- package/src/customization/import.ts +3 -1
- package/src/dap/config.ts +31 -11
- package/src/dap/defaults.json +1 -1
- package/src/debug/crash-diagnostics.ts +2 -1
- package/src/debug/report-bundle.ts +19 -0
- package/src/debug/system-info.ts +8 -3
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/shared/base-url.ts +21 -7
- package/src/discovery/agents-md.ts +1 -1
- package/src/discovery/helpers.ts +1 -2
- package/src/discovery/mcp-compat.ts +120 -17
- package/src/edit/apply-patch/index.ts +12 -1
- package/src/edit/index.ts +13 -17
- package/src/edit/modes/patch.ts +187 -8
- package/src/edit/modes/replace.ts +136 -0
- package/src/eval/js/context-manager.ts +29 -3
- package/src/eval/js/worker-entry.ts +51 -18
- package/src/eval/py/executor.ts +14 -4
- package/src/eval/py/runner.py +144 -5
- package/src/exec/bash-executor.ts +81 -4
- package/src/exec/bash-shell-guardian.ts +4 -1
- package/src/exec/bash-shell-supervisor.ts +8 -4
- package/src/exec/isolated-shell.ts +5 -1
- package/src/export/html/index.ts +46 -6
- package/src/extensibility/custom-tools/wrapper.ts +3 -1
- package/src/extensibility/extensions/loader.ts +8 -1
- package/src/extensibility/plugins/marketplace/fetcher.ts +2 -2
- package/src/gjc-runtime/gc-runtime.ts +33 -6
- package/src/gjc-runtime/launch-tmux.ts +7 -2
- package/src/gjc-runtime/launch-worktree.test.ts +148 -0
- package/src/gjc-runtime/launch-worktree.ts +101 -14
- package/src/gjc-runtime/managed-owner-admission.ts +46 -2
- package/src/gjc-runtime/session-resolution.ts +38 -6
- package/src/gjc-runtime/session-state-lock.ts +59 -14
- package/src/gjc-runtime/state-runtime.ts +23 -19
- package/src/hooks/native-skill-hook.ts +14 -11
- package/src/internal-urls/docs-index.generated.ts +14 -13
- package/src/internal-urls/local-protocol.ts +142 -8
- package/src/lsp/index.ts +29 -0
- package/src/lsp/workspace-path.ts +23 -0
- package/src/migrate/action-planner.ts +57 -0
- package/src/migrate/adapters/claude-code.ts +23 -4
- package/src/migrate/adapters/codex.ts +22 -4
- package/src/migrate/adapters/index.ts +22 -4
- package/src/migrate/adapters/opencode.ts +6 -1
- package/src/migrate/executor.ts +84 -7
- package/src/migrate/report.ts +19 -2
- package/src/migrate/types.ts +14 -4
- package/src/modes/DESIGN.md +51 -0
- package/src/modes/acp/permission-mode.ts +18 -1
- package/src/modes/components/assistant-message.ts +55 -1
- package/src/modes/components/settings-selector.ts +103 -37
- package/src/modes/controllers/command-controller.ts +38 -2
- package/src/modes/controllers/plan-mode-controller.ts +17 -7
- package/src/modes/controllers/selector-controller.ts +62 -6
- package/src/modes/interactive-mode.ts +68 -0
- package/src/modes/theme/theme.ts +15 -0
- package/src/prompts/tools/debug.md +1 -1
- package/src/prompts/tools/read.md +1 -1
- package/src/prompts/tools/report-issue.md +13 -0
- package/src/prompts/tools/task.md +1 -1
- package/src/runtime-credential-selector.ts +2 -2
- package/src/runtime-mcp/content-limits.ts +7 -0
- package/src/runtime-mcp/manager-pool.test.ts +5 -4
- package/src/runtime-mcp/manager.ts +32 -0
- package/src/runtime-mcp/oauth-flow.ts +32 -6
- package/src/runtime-mcp/plugin-mcp-name-filter.ts +62 -0
- package/src/runtime-mcp/render.ts +16 -1
- package/src/runtime-mcp/tool-bridge.ts +126 -17
- package/src/sdk/broker/broker-exit.ts +8 -5
- package/src/sdk/broker/broker.ts +342 -82
- package/src/sdk/broker/daemon-entry.ts +338 -116
- package/src/sdk/broker/doctor-restart.ts +2 -1
- package/src/sdk/broker/ensure.ts +1143 -265
- package/src/sdk/broker/hop.ts +274 -0
- package/src/sdk/broker/lifecycle-ledger.ts +35 -11
- package/src/sdk/broker/lock-host-identity.ts +29 -0
- package/src/sdk/broker/session-index.ts +62 -12
- package/src/sdk/bus/chat-command-policy.ts +16 -3
- package/src/sdk/bus/index.ts +52 -21
- package/src/sdk/bus/reconciliation-store.ts +201 -8
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/cli/session-cli.ts +21 -6
- package/src/sdk/host/session-runtime.test.ts +118 -23
- package/src/sdk/host/session-runtime.ts +352 -47
- package/src/sdk/lifecycle/service.ts +1 -0
- package/src/sdk/prompt-deadline-flush.ts +78 -5
- package/src/sdk/prompt-deadline-manager.ts +68 -14
- package/src/sdk/protocol/adapter-validation.ts +53 -11
- package/src/sdk/protocol/operation-inventory.generated.json +101 -2
- package/src/sdk/reconciliation-extensions.ts +1 -0
- package/src/sdk/session-list.ts +1 -0
- package/src/sdk/session.ts +114 -61
- package/src/session/agent-session.ts +1043 -81
- package/src/session/internal/managed-session-scope.ts +126 -39
- package/src/session/internal/managed-session-storage.ts +14 -11
- package/src/session/internal/native-publish-outcome.ts +5 -1
- package/src/session/messages.ts +47 -6
- package/src/session/session-manager.ts +236 -14
- package/src/session/startup-auth-config.ts +116 -8
- package/src/session/streaming-output.ts +262 -4
- package/src/session/terminal-abort.ts +14 -2
- package/src/session-import/service.ts +1 -0
- package/src/skill-state/workflow-mutation-guard.ts +491 -32
- package/src/slash-commands/builtin-registry.ts +15 -3
- package/src/slash-commands/helpers/credential-switch.ts +10 -5
- package/src/slash-commands/helpers/provider-auth-status.ts +456 -0
- package/src/task/executor.ts +103 -12
- package/src/task/index.ts +389 -175
- package/src/tools/ast-edit-write-path.ts +64 -0
- package/src/tools/ast-edit.ts +18 -1
- package/src/tools/atomic-file-write.ts +46 -15
- package/src/tools/auto-generated-guard.ts +3 -0
- package/src/tools/bash-allowed-prefixes.ts +153 -5
- package/src/tools/bash-interactive.ts +14 -2
- package/src/tools/bash.ts +14 -0
- package/src/tools/debug.ts +7 -6
- package/src/tools/descriptors.test.ts +44 -0
- package/src/tools/descriptors.ts +34 -2
- package/src/tools/fetch.ts +3 -2
- package/src/tools/index.ts +2 -0
- package/src/tools/output-meta.ts +23 -2
- package/src/tools/python.ts +1 -1
- package/src/tools/read.ts +17 -35
- package/src/tools/report-issue.ts +184 -0
- package/src/tools/subagent-render.ts +114 -12
- package/src/tools/subagent.ts +108 -1
- package/src/tools/todo-write.ts +41 -3
- package/src/tools/tool-catalog.generated.ts +31 -3
- package/src/tools/write.ts +35 -3
- package/src/utils/commit-message-generator.ts +9 -2
- package/src/utils/file-mentions.ts +29 -1
- package/src/utils/title-generator.ts +7 -2
- package/src/web/scrapers/index.ts +3 -1
- package/src/web/scrapers/types.ts +8 -0
- package/src/web/scrapers/youtube.ts +3 -2
- package/src/web/search/providers/insane.ts +91 -28
- package/src/web/search/providers/searxng.ts +62 -10
|
@@ -1,9 +1,101 @@
|
|
|
1
1
|
import { type ChildProcess } from "node:child_process";
|
|
2
2
|
import type { FileHandle } from "node:fs/promises";
|
|
3
3
|
import { type FileLockOptions } from "../../config/file-lock";
|
|
4
|
+
import { type BrokerStartupExitRecord } from "./broker-exit";
|
|
4
5
|
import { type BrokerDiscovery } from "./discovery";
|
|
6
|
+
import { type ProcessIncarnationObservation } from "./process-incarnation";
|
|
5
7
|
import { type SdkInternalSpawnCommand } from "./runtime";
|
|
6
8
|
import { type BrokerStartupFailureMarker } from "./startup-failure";
|
|
9
|
+
/** Result of launching a broker through a hop/trampoline or as an exact fixture child. */
|
|
10
|
+
export interface BrokerSpawnResult {
|
|
11
|
+
/** The launcher process, or the exact broker process for fixture leases. */
|
|
12
|
+
process: ChildProcess;
|
|
13
|
+
/** The real broker's pid (from the launcher reply or exact child). */
|
|
14
|
+
realBrokerPid: number | undefined;
|
|
15
|
+
/** Kernel identity returned by the POSIX trampoline when available. */
|
|
16
|
+
realBrokerIncarnation?: string;
|
|
17
|
+
handoff?: BrokerLaunchHandoff;
|
|
18
|
+
}
|
|
19
|
+
export interface BrokerLaunchHandoff {
|
|
20
|
+
release(): Promise<void>;
|
|
21
|
+
terminate(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Typed error returned when a Windows broker hop fails.
|
|
25
|
+
* The hop is mandatory on Windows for broker detachment; failure is unrecoverable.
|
|
26
|
+
*/
|
|
27
|
+
export declare class BrokerHopError extends Error {
|
|
28
|
+
readonly code = "broker_hop_failed";
|
|
29
|
+
readonly hopExitCode: number | null;
|
|
30
|
+
readonly hopStdout: string;
|
|
31
|
+
readonly hopStderr: string;
|
|
32
|
+
readonly reason: string;
|
|
33
|
+
constructor(fields: {
|
|
34
|
+
exitCode: number | null;
|
|
35
|
+
stdout: string;
|
|
36
|
+
stderr: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export declare function resolveBrokerLaunchMode(platform: NodeJS.Platform, initiator: "discovery" | "fixture-lease"): "windows-hop" | "posix-trampoline" | "darwin-trampoline" | "direct";
|
|
41
|
+
/** What the parent sends the Windows hop. The broker environment is never serialized here. */
|
|
42
|
+
export interface BrokerHopMessage {
|
|
43
|
+
command: {
|
|
44
|
+
file: string;
|
|
45
|
+
args: string[];
|
|
46
|
+
};
|
|
47
|
+
cwd?: string;
|
|
48
|
+
/** Path (never an inherited fd number) the hop opens for the broker's stderr. */
|
|
49
|
+
stderrLogPath?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface BrokerLaunchResult {
|
|
52
|
+
process: ChildProcess;
|
|
53
|
+
realBrokerPid: number | undefined;
|
|
54
|
+
realBrokerIncarnation?: string;
|
|
55
|
+
error: Error | undefined;
|
|
56
|
+
handoff?: BrokerLaunchHandoff;
|
|
57
|
+
}
|
|
58
|
+
/** Test hook: proves a stuck launcher is terminated at its deadline. */
|
|
59
|
+
export declare function awaitBrokerLauncherForTest(child: ChildProcess, timeoutMs: number, onTimeout?: () => void): Promise<{
|
|
60
|
+
kind: "closed";
|
|
61
|
+
} | {
|
|
62
|
+
kind: "timeout";
|
|
63
|
+
terminated: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Windows only: launch the broker through the internal hop and await its reply.
|
|
67
|
+
*
|
|
68
|
+
* `taskkill /T /F` walks ParentProcessId, so a broker spawned directly by the client
|
|
69
|
+
* dies with it even when detached. The hop spawns the broker and exits after
|
|
70
|
+
* the parent acknowledges the complete reply, leaving the broker without a
|
|
71
|
+
* live parent in the client's tree. The broker inherits the environment set on
|
|
72
|
+
* the hop, never passed on the command line; stderr is passed as a path because
|
|
73
|
+
* a parent fd number does not exist inside the hop.
|
|
74
|
+
*/
|
|
75
|
+
export declare function launchBrokerViaHop(message: BrokerHopMessage, options: {
|
|
76
|
+
env: NodeJS.ProcessEnv;
|
|
77
|
+
cwd?: string;
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
}): Promise<BrokerLaunchResult>;
|
|
80
|
+
/** Parses the hop's single-line pid/incarnation reply into broker identity or a typed error. */
|
|
81
|
+
export declare function parseBrokerHopReply(code: number | null, stdout: string, spawnError?: Error, stderr?: string): {
|
|
82
|
+
realBrokerPid: number | undefined;
|
|
83
|
+
realBrokerIncarnation?: string;
|
|
84
|
+
error: Error | undefined;
|
|
85
|
+
};
|
|
86
|
+
/** POSIX only: the trampoline holds its exact broker child until the publication decision. */
|
|
87
|
+
export declare function launchBrokerViaPosixTrampoline(agentDir: string, options: {
|
|
88
|
+
env: NodeJS.ProcessEnv;
|
|
89
|
+
cwd?: string;
|
|
90
|
+
stderrFd?: number;
|
|
91
|
+
timeoutMs?: number;
|
|
92
|
+
retainChildUntilPublication?: boolean;
|
|
93
|
+
}): Promise<BrokerLaunchResult>;
|
|
94
|
+
export declare function parseBrokerTrampolineReply(code: number | null, stdout: string, spawnError?: Error): {
|
|
95
|
+
realBrokerPid: number | undefined;
|
|
96
|
+
realBrokerIncarnation?: string;
|
|
97
|
+
error: Error | undefined;
|
|
98
|
+
};
|
|
7
99
|
export declare function isBrokerGenerationCompatible(discovery: BrokerDiscovery | null): boolean;
|
|
8
100
|
/**
|
|
9
101
|
* A live incumbent stops being reusable once the runtime image it launches
|
|
@@ -29,7 +121,9 @@ export interface EnsureBrokerSettings {
|
|
|
29
121
|
*/
|
|
30
122
|
env?: NodeJS.ProcessEnv;
|
|
31
123
|
}
|
|
32
|
-
export interface
|
|
124
|
+
export interface BrokerStartupLockOptions {
|
|
125
|
+
/** Stop waiting for the startup lock at this absolute wall-clock deadline. */
|
|
126
|
+
deadlineAt?: number;
|
|
33
127
|
onAcquired?: () => void;
|
|
34
128
|
onContended?: () => void;
|
|
35
129
|
}
|
|
@@ -48,7 +142,7 @@ export declare function emitBrokerStartupTestSignal(signal: string): Promise<voi
|
|
|
48
142
|
*/
|
|
49
143
|
export declare const BROKER_DISCOVERY_BUDGET: {
|
|
50
144
|
readonly staleRetirementMs: 5000;
|
|
51
|
-
readonly startupLockWaitMs:
|
|
145
|
+
readonly startupLockWaitMs: number;
|
|
52
146
|
readonly publicationMs: 15000;
|
|
53
147
|
/** What the startup fence grants its holder: retirement plus one publication attempt. */
|
|
54
148
|
readonly fenceOperationMs: number;
|
|
@@ -94,7 +188,7 @@ declare function acquireSpawnLock(agentDir: string, options?: SpawnLockOptions):
|
|
|
94
188
|
* The parent-held spawn lock prevents ordinary stampedes; this second fence keeps
|
|
95
189
|
* startup single-flight if that detached child's launcher dies and its lock is reclaimed.
|
|
96
190
|
*/
|
|
97
|
-
export declare function withBrokerStartupLock<T>(agentDir: string, operation: (deadline: number) => Promise<T>,
|
|
191
|
+
export declare function withBrokerStartupLock<T>(agentDir: string, operation: (deadline: number) => Promise<T>, options?: BrokerStartupLockOptions): Promise<T>;
|
|
98
192
|
/**
|
|
99
193
|
* Tail of the detached broker's stderr folded into a discovery failure.
|
|
100
194
|
*
|
|
@@ -138,13 +232,27 @@ export interface StartedFixtureBroker {
|
|
|
138
232
|
interface BrokerOwner {
|
|
139
233
|
stop(): Promise<void>;
|
|
140
234
|
canReuse(discovery: BrokerDiscovery | null): boolean;
|
|
141
|
-
markReady(discovery: BrokerDiscovery): boolean
|
|
142
|
-
setTarget(pid: number, incarnation: string): void;
|
|
235
|
+
markReady(discovery: BrokerDiscovery): Promise<boolean>;
|
|
143
236
|
}
|
|
144
237
|
interface ReapTiming {
|
|
145
238
|
gracefulMs: number;
|
|
146
239
|
killVerifyMs: number;
|
|
147
240
|
}
|
|
241
|
+
type DetachedBrokerSignal = (pid: number, brokerIncarnation: string, signal: NodeJS.Signals) => boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Reap a broker launched by a short-lived hop or trampoline. The launcher has
|
|
244
|
+
* already exited, so its ChildProcess carries no signal to await: the real broker
|
|
245
|
+
* is targeted by the reported pid, and every poll is fenced by incarnation.
|
|
246
|
+
* Signals use a pinned OS process handle; unsupported platforms fail closed.
|
|
247
|
+
*/
|
|
248
|
+
interface PinnedBrokerProcess {
|
|
249
|
+
readonly incarnation: string;
|
|
250
|
+
signalRoot(signal: number): boolean;
|
|
251
|
+
}
|
|
252
|
+
/** Reap a failed launch through its pending trampoline lease or retained broker handle. */
|
|
253
|
+
export declare function reapFailedBrokerLaunch(launch: Pick<BrokerLaunchResult, "process" | "realBrokerPid" | "realBrokerIncarnation" | "handoff">): Promise<void>;
|
|
254
|
+
/** Reap the direct broker child held by the startup trampoline before publication. */
|
|
255
|
+
export declare function reapBrokerTrampolineChild(child: ChildProcess, brokerPid: number | undefined, brokerIncarnation?: string): Promise<void>;
|
|
148
256
|
type BrokerOwnerIdentity = Pick<BrokerDiscovery, "ownerId" | "pid" | "incarnation">;
|
|
149
257
|
/** Start client teardown, but never await it past the retirement operation's absolute deadline. */
|
|
150
258
|
export declare function closeBrokerClientBeforeDeadline(client: {
|
|
@@ -173,6 +281,10 @@ export declare function startFixtureBrokerWithLeaseForTest(settings: EnsureBroke
|
|
|
173
281
|
* Test-only launch surface for topology fixtures. It accepts an already-resolved
|
|
174
282
|
* command and retains the exact spawned child; no production selection path
|
|
175
283
|
* reaches this function.
|
|
284
|
+
*
|
|
285
|
+
* Note: This function does NOT use the Windows broker hop. Fixtures are test-only
|
|
286
|
+
* and do not require Windows process-tree detachment; the fixture needs to retain
|
|
287
|
+
* exact ownership of the actual broker process to control its stdio[3] control pipe.
|
|
176
288
|
*/
|
|
177
289
|
export declare function startFixtureBrokerCommandWithLeaseForTest(command: FixtureBrokerCommand): StartedFixtureBrokerCommand;
|
|
178
290
|
/** Test hook: returns a stop handle for the detached broker this process spawned. */
|
|
@@ -183,11 +295,28 @@ export declare function brokerOwnerForTest(agentDir: string): BrokerOwner | unde
|
|
|
183
295
|
/** Test hook: verifies the complete broker owner identity used during stale retirement. */
|
|
184
296
|
export declare function brokerOwnerIdentityMatchesForTest(left: BrokerOwnerIdentity | null, right: BrokerOwnerIdentity): boolean;
|
|
185
297
|
/** Test hook: drives the detached-broker reap on a controllable child surface. */
|
|
186
|
-
export declare function reapSpawnedBrokerForTest(child: ChildProcess, timing?: ReapTiming): Promise<void>;
|
|
298
|
+
export declare function reapSpawnedBrokerForTest(child: ChildProcess, realBrokerPid?: number, brokerIncarnation?: string, timing?: ReapTiming): Promise<void>;
|
|
299
|
+
/** Test hook: verifies detached PID reaping fences every signal and poll by incarnation. */
|
|
300
|
+
export declare function reapDetachedBrokerPidForTest(pid: number, brokerIncarnation: string | undefined, timing?: ReapTiming, observe?: (pid: number) => ProcessIncarnationObservation, signalProcess?: DetachedBrokerSignal): Promise<void>;
|
|
301
|
+
/** Test hook: verifies a pinned process handle matches before sending a signal. */
|
|
302
|
+
export declare function signalPinnedBrokerProcessForTest(reference: PinnedBrokerProcess | null, expectedIncarnation: string, signal: NodeJS.Signals): boolean;
|
|
303
|
+
/** Test hook: verifies platforms without identity-bound signaling fail closed. */
|
|
304
|
+
export declare function signalDetachedBrokerProcessForTest(pid: number, brokerIncarnation: string, signal: NodeJS.Signals, platform: NodeJS.Platform): boolean;
|
|
187
305
|
/** Test hook: resolves the complete broker environment without spawning. */
|
|
188
306
|
export declare function brokerSpawnEnvironmentForTest(command: SdkInternalSpawnCommand, override?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
189
307
|
/** Test hook: installs an exact controllable owner to exercise replacement fencing. */
|
|
190
|
-
export declare function registerBrokerOwnerForTest(agentDir: string, child: ChildProcess, timing?: ReapTiming): BrokerOwner;
|
|
308
|
+
export declare function registerBrokerOwnerForTest(agentDir: string, child: ChildProcess, realBrokerPid?: number, brokerIncarnation?: string, timing?: ReapTiming): BrokerOwner;
|
|
191
309
|
/** Test hook: exercises the same trusted-marker reason reconstruction used by ensureBroker. */
|
|
192
310
|
export declare function brokerStartupFailureReasonForTest(marker: BrokerStartupFailureMarker | undefined): string;
|
|
311
|
+
/** Test hook: verifies typed hop errors survive ensureBroker's spawn-failure mapping. */
|
|
312
|
+
export declare function brokerSpawnFailureErrorForTest(spawnError: Error): Error;
|
|
313
|
+
/** Test hook: preserves and reaps a verified broker reply captured at the hop deadline. */
|
|
314
|
+
export declare function brokerHopTimeoutResultForTest(hop: ChildProcess, stdout: string, stderr: string, timeoutMs: number, launcherTerminated: boolean): Promise<BrokerLaunchResult>;
|
|
315
|
+
/** Test hook: preserves and reaps a verified POSIX trampoline reply at its deadline. */
|
|
316
|
+
export declare function brokerTrampolineTimeoutResultForTest(trampoline: ChildProcess, stdout: string, timeoutMs: number, trampolineTerminated: boolean): Promise<BrokerLaunchResult>;
|
|
317
|
+
/** Test hook: verifies broker exit evidence takes precedence over the launcher's status. */
|
|
318
|
+
export declare function brokerStartupExitStatusForTest(childExitCode: number | null, childSignal: NodeJS.Signals | null, startupExitRecord: Pick<BrokerStartupExitRecord, "exitCode" | "signal"> | undefined, startupFailureMarker: Pick<BrokerStartupFailureMarker, "exitCode" | "signal"> | undefined): {
|
|
319
|
+
exitCode: number | null;
|
|
320
|
+
signal: string | null;
|
|
321
|
+
};
|
|
193
322
|
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as childProcess from "node:child_process";
|
|
2
|
+
import type * as stream from "node:stream";
|
|
3
|
+
import type { Process } from "@gajae-code/natives";
|
|
4
|
+
export declare const BROKER_HANDOFF_ACKNOWLEDGEMENT = "GJC_BROKER_HANDOFF_ACK\n";
|
|
5
|
+
export declare const BROKER_HANDOFF_COMMIT = "GJC_BROKER_HANDOFF_COMMIT\n";
|
|
6
|
+
export declare const BROKER_HANDOFF_ABORT = "GJC_BROKER_HANDOFF_ABORT\n";
|
|
7
|
+
/**
|
|
8
|
+
* Windows broker hop: spawns the real broker with detached:true and reports its pid.
|
|
9
|
+
*
|
|
10
|
+
* The hop is needed because a broker spawned with detached:true IS still killed when the
|
|
11
|
+
* parent process tree is terminated (e.g., by taskkill /T /F on Windows). Using an
|
|
12
|
+
* intermediate hop process that exits after spawning the real broker allows the broker
|
|
13
|
+
* to survive, because the hop's parent (the initiating client) can be killed without
|
|
14
|
+
* affecting the broker (the hop's pid is no longer valid).
|
|
15
|
+
*
|
|
16
|
+
* Invoked by gjc internals only. Usage:
|
|
17
|
+
* gjc internal broker-hop <json-encoded-args>
|
|
18
|
+
*
|
|
19
|
+
* Exits with code 0 after writing the broker pid/incarnation to stdout and
|
|
20
|
+
* receiving the parent's acknowledgement. If stdin closes first, it terminates
|
|
21
|
+
* the pinned broker and exits with code 1.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runBrokerHopFromArgv(argv: string[]): Promise<void>;
|
|
24
|
+
type BrokerHopWriteCallback = (error?: Error | null) => void;
|
|
25
|
+
type BrokerHopWriter = (chunk: string, callback: BrokerHopWriteCallback) => void;
|
|
26
|
+
type BrokerHopAcknowledger = () => Promise<boolean>;
|
|
27
|
+
export declare function writeBrokerHopReplyForTest(child: childProcess.ChildProcess, reference: Process, pid: number, write: BrokerHopWriter, waitForAcknowledgement?: BrokerHopAcknowledger): Promise<{
|
|
28
|
+
kind: "written";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "failed";
|
|
31
|
+
reason: string;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function waitForBrokerHandoffAcknowledgement(input: stream.Readable): Promise<boolean>;
|
|
34
|
+
/** Wait for a validated identity ACK followed by the parent's publication decision. */
|
|
35
|
+
export declare function waitForBrokerHandoffDecision(input: stream.Readable, timeoutMs?: number): Promise<"commit" | "abort">;
|
|
36
|
+
export {};
|
|
@@ -144,19 +144,27 @@ export declare class LifecycleLedger {
|
|
|
144
144
|
findByOperationKey(operationKey: string, fingerprint?: string): LifecycleLedgerEntry | undefined;
|
|
145
145
|
findAnyByOperationKey(operationKey: string): LifecycleLedgerEntry | undefined;
|
|
146
146
|
/**
|
|
147
|
-
* Live
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
147
|
+
* Live legacy rows predate the operation/key index. Their opaque identities
|
|
148
|
+
* cannot establish that a different target is safe, so callers must reject
|
|
149
|
+
* rather than create a second admission. A fresh session.create may ignore
|
|
150
|
+
* final legacy rows: exact legacy identities are still resolved before this
|
|
151
|
+
* check, and uncertain rows retain their session-scoped fences.
|
|
152
|
+
*
|
|
153
|
+
* A session-targeted request passes `sessionTarget` to ignore terminal legacy
|
|
154
|
+
* rows that record only other sessions, unless the row is the caller's key
|
|
155
|
+
* reused across targets (`keyReuseIdentities`). Terminal rows recording the
|
|
156
|
+
* target or no session, uncertain rows, and live rows keep the fence because
|
|
157
|
+
* they cannot prove the requested target is unrelated.
|
|
156
158
|
*/
|
|
157
159
|
hasLegacyIdentity(excludedIdentities?: ReadonlySet<string>, options?: {
|
|
158
|
-
|
|
160
|
+
ignoreFinalRows?: boolean;
|
|
161
|
+
sessionTarget?: {
|
|
162
|
+
sessionId: string;
|
|
163
|
+
keyReuseIdentities: ReadonlySet<string>;
|
|
164
|
+
};
|
|
159
165
|
}): boolean;
|
|
166
|
+
/** Sessions recorded by terminal legacy rows, for deriving key-reuse identities. */
|
|
167
|
+
terminalLegacySessionIds(): Set<string>;
|
|
160
168
|
migrateIdentity(from: string, to: string, metadata: {
|
|
161
169
|
operationKey: string;
|
|
162
170
|
fingerprint: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FileLockOptions } from "../../config/file-lock";
|
|
1
2
|
import { SDK_STATE_VERSION, SESSION_INDEX_EVENT_VERSION } from "./state-version";
|
|
2
3
|
export type SessionIndexEventType = "host_registered" | "host_heartbeat" | "host_unregistered" | "lifecycle_started" | "lifecycle_terminal" | "session_closed" | "session_deleted" | "record_reconciled";
|
|
3
4
|
export type SessionActivityState = "active" | "idle";
|
|
@@ -182,10 +183,12 @@ export declare const SESSION_HEARTBEAT_INTERVAL_MS = 60000;
|
|
|
182
183
|
export declare const DEAD_HOST_HEARTBEAT_SILENCE_MS: number;
|
|
183
184
|
export declare const DEFAULT_SESSION_RETENTION_MAX_AGE_MS: number;
|
|
184
185
|
export declare const DEFAULT_SESSION_RETENTION_MAX_ROWS = 25000;
|
|
186
|
+
/** Bound ordinary bootstrap waits; authorized doctor successors may use the full prepared window. */
|
|
187
|
+
export declare function sessionIndexStartupLockOptions(deadline: number, signal?: AbortSignal, policy?: "ordinary" | "authorized-successor"): FileLockOptions;
|
|
185
188
|
export declare class SessionIndex {
|
|
186
189
|
#private;
|
|
187
190
|
constructor(agentDir: string, policy?: RetentionPolicy, observationDeps?: SessionIndexObservationDeps);
|
|
188
|
-
open(): Promise<this>;
|
|
191
|
+
open(options?: FileLockOptions): Promise<this>;
|
|
189
192
|
replay(): Promise<void>;
|
|
190
193
|
/**
|
|
191
194
|
* Polling-path refresh (#4689): when both index files carry the exact change
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type AdapterValidationError } from "../protocol/adapter-validation";
|
|
1
2
|
import { type Adapter, type OperationKind } from "../protocol/operation-registry";
|
|
2
3
|
export type ChatTransport = Extract<Adapter, "telegram" | "discord" | "slack">;
|
|
3
4
|
export type ChatOperationDisposition = "allowed" | "unsupported_on_chat";
|
|
4
5
|
export interface ChatCommandError {
|
|
5
|
-
code: "unsupported_on_chat" | "secret_input_forbidden";
|
|
6
|
+
code: "unsupported_on_chat" | "secret_input_forbidden" | "ultrafast_tier_forbidden" | AdapterValidationError["code"];
|
|
6
7
|
message: string;
|
|
7
8
|
}
|
|
8
9
|
export type ChatCommandDecision = {
|
|
@@ -612,6 +612,29 @@ export declare function shouldAwaitNotificationStartup(event: {
|
|
|
612
612
|
};
|
|
613
613
|
}): boolean;
|
|
614
614
|
export declare function boundedCorrelatedAgentEndFrame(frame: Record<string, unknown>): Record<string, unknown>;
|
|
615
|
+
/** Connection-scoped identity of a queued prompt submission an abort may address. */
|
|
616
|
+
export interface TerminalAbortSubmissionScope {
|
|
617
|
+
connectionId?: string;
|
|
618
|
+
terminal: boolean;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Whether a terminal abort addresses this prompt submission.
|
|
622
|
+
*
|
|
623
|
+
* An ordinary abort is scoped to the requesting connection's own prompt: `connectionId`
|
|
624
|
+
* identifies the connection that submitted it, and a submission that already reached a
|
|
625
|
+
* terminal state is never addressed. Broker-authorized operator authority
|
|
626
|
+
* (`TerminalAbortInput.operator`, granted only through the broker control route) is the
|
|
627
|
+
* documented exception — "operator authority changes only connection ownership, never
|
|
628
|
+
* those settlement proofs" — so it addresses the session's submission even when another
|
|
629
|
+
* connection submitted it. Without that override every operator abort issued over a
|
|
630
|
+
* second connection (the SDK client case, where each request is its own connection)
|
|
631
|
+
* reported no_active_turn while the turn was still running.
|
|
632
|
+
*/
|
|
633
|
+
export declare function terminalAbortAddressesSubmission(input: {
|
|
634
|
+
connectionId: string | undefined;
|
|
635
|
+
operatorAuthorized: boolean;
|
|
636
|
+
submission: TerminalAbortSubmissionScope;
|
|
637
|
+
}): boolean;
|
|
615
638
|
export declare function createNotificationsExtension(api: ExtensionAPI, options?: {
|
|
616
639
|
settings?: Settings;
|
|
617
640
|
ensureTelegramDaemon?: (input: {
|
|
@@ -182,9 +182,19 @@ export interface ReconciliationStore {
|
|
|
182
182
|
snapshotTerminalScopes(): DurableTerminalScopeRecord[];
|
|
183
183
|
delete(): Promise<void>;
|
|
184
184
|
}
|
|
185
|
+
export interface ReconciliationStoreInstrumentationEvent {
|
|
186
|
+
at: number;
|
|
187
|
+
phase: "enqueued" | "started" | "completed" | "failed";
|
|
188
|
+
operation?: string;
|
|
189
|
+
substep?: string;
|
|
190
|
+
error?: string;
|
|
191
|
+
/** Detailed information about lock acquisition, promise identity, db state, etc. */
|
|
192
|
+
detail?: string;
|
|
193
|
+
}
|
|
185
194
|
export declare function createReconciliationStore(options: {
|
|
186
195
|
sessionFile: string | null | undefined;
|
|
187
196
|
sessionId: string;
|
|
188
197
|
fs?: ReconciliationStoreFs;
|
|
189
198
|
now?: () => number;
|
|
199
|
+
onInstrumentationForTests?: (event: ReconciliationStoreInstrumentationEvent) => void;
|
|
190
200
|
}): ReconciliationStore;
|
|
@@ -296,8 +296,10 @@ export declare const SDK_LIFECYCLE_ROUTER_PROTOCOL_VERSION = 1;
|
|
|
296
296
|
* Generation 202 joins queued-removal terminal publication before ordinary
|
|
297
297
|
* abort acknowledgement, replacing owners that still acknowledge cancellation
|
|
298
298
|
* before its terminal record is durable.
|
|
299
|
+
* Generation 203 replaces owners that still treat a project `.gjc` file as an
|
|
300
|
+
* explicit deadline-autosave opt-in for a primary checkout.
|
|
299
301
|
*/
|
|
300
|
-
export declare const DAEMON_GENERATION =
|
|
302
|
+
export declare const DAEMON_GENERATION = 204;
|
|
301
303
|
/**
|
|
302
304
|
* Serving-compatibility boundary for daemon lifecycle requests. Epoch 7
|
|
303
305
|
* requires durable publication receipts and acknowledged attachment dispatch,
|
|
@@ -45,7 +45,6 @@ export interface RetainedTranscriptTailReader {
|
|
|
45
45
|
export declare const SDK_JSON_INPUT_FILE_MAX_BYTES: number;
|
|
46
46
|
/** Translate only SDK-owned codes and explicitly allowlisted reconciliation fields. */
|
|
47
47
|
export declare function sdkPublicFailure(code: string, details?: unknown, proof?: PublicEffectProof): PublicCommandFailure;
|
|
48
|
-
/** Lifecycle terminality/retryability is not, by itself, proof of an effect outcome. */
|
|
49
48
|
export declare function lifecyclePublicFailure(outcome: Extract<SessionLifecycleResult, {
|
|
50
49
|
ok: false;
|
|
51
50
|
}>): PublicCommandFailure;
|
|
@@ -157,6 +157,8 @@ export interface SdkOnlyTerminalAbortSeams {
|
|
|
157
157
|
getReconciliationStore?: () => SdkOnlyReconciliationStore | undefined;
|
|
158
158
|
getTerminalTurnEpoch: () => number | undefined;
|
|
159
159
|
getActivePromptHandle: () => string | undefined;
|
|
160
|
+
onDeadlineRecoveryCheckpointForTests?: (checkpoint: SdkOnlyDeadlineRecoveryCheckpoint) => void;
|
|
161
|
+
onPersistenceInstrumentationForTests?: (event: PersistenceInstrumentationEvent) => void;
|
|
160
162
|
/** Re-read the active prompt's owning SDK connection for the owner-mismatch
|
|
161
163
|
* recheck; falls back to the runtime-tracked owner when absent (review
|
|
162
164
|
* thread P1). */
|
|
@@ -196,6 +198,23 @@ export interface SdkOnlyTerminalAbortSeams {
|
|
|
196
198
|
/** Test override for the maximum durable terminal reservation rows. */
|
|
197
199
|
maxDurableTerminalReservationsForTests?: number;
|
|
198
200
|
}
|
|
201
|
+
export interface SdkOnlyDeadlineRecoveryCheckpoint {
|
|
202
|
+
at: number;
|
|
203
|
+
stage: "terminalization-start" | "terminalization-result" | "publication-start" | "publication-result" | "note-transition-start" | "note-transition-awaiting-finalization" | "note-transition-finalization-ready" | "note-transition-before-persist" | "note-transition-persisted" | "note-transition-persist-failed" | "deadline-recovery-retired";
|
|
204
|
+
correlation: InvocationCorrelation;
|
|
205
|
+
result?: "settled" | "uncertain" | "published" | "not-published" | "rejected";
|
|
206
|
+
reason?: string;
|
|
207
|
+
recordStatus?: string;
|
|
208
|
+
recordRevision?: number;
|
|
209
|
+
recordTerminalAt?: number;
|
|
210
|
+
pendingFinalization?: boolean;
|
|
211
|
+
eventCaptured?: boolean;
|
|
212
|
+
eventPrepared?: boolean;
|
|
213
|
+
terminalCommitted?: boolean;
|
|
214
|
+
leaseCurrent?: boolean;
|
|
215
|
+
pendingToolCount?: number;
|
|
216
|
+
errorCode?: string;
|
|
217
|
+
}
|
|
199
218
|
/**
|
|
200
219
|
* The transport-neutral SDK session runtime.
|
|
201
220
|
*
|
|
@@ -354,10 +373,23 @@ export interface InvocationReconciliation {
|
|
|
354
373
|
}): Promise<void>;
|
|
355
374
|
markUncertain(kind: InvocationKind, correlation: InvocationCorrelation, isCurrent?: () => boolean, deadlineMaxAt?: number): Promise<void>;
|
|
356
375
|
}
|
|
376
|
+
export interface PersistenceInstrumentationEvent {
|
|
377
|
+
at: number;
|
|
378
|
+
phase: "enqueued" | "started" | "completed" | "failed";
|
|
379
|
+
operation?: string;
|
|
380
|
+
substep?: string;
|
|
381
|
+
error?: string;
|
|
382
|
+
/** Detailed information about lock acquisition, promise identity, db state, etc. */
|
|
383
|
+
detail?: string;
|
|
384
|
+
/** Time spent waiting (ms) before the operation started. */
|
|
385
|
+
waitMs?: number;
|
|
386
|
+
}
|
|
357
387
|
export declare function createInvocationReconciliation(options?: {
|
|
358
388
|
stateRoot?: string;
|
|
359
389
|
sessionId?: string;
|
|
360
390
|
store?: SdkOnlyReconciliationStore;
|
|
391
|
+
onDeadlineRecoveryCheckpointForTests?: (checkpoint: SdkOnlyDeadlineRecoveryCheckpoint) => void;
|
|
392
|
+
onPersistenceInstrumentationForTests?: (event: PersistenceInstrumentationEvent) => void;
|
|
361
393
|
}): InvocationReconciliation;
|
|
362
394
|
export interface SdkSurfaceFactoryOptions {
|
|
363
395
|
ctx: ExtensionContext;
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
* WHERE it runs. `sdk.flushWorktreeOnDeadline` still defaults to on, but the
|
|
45
45
|
* implicit default applies only in a LINKED worktree (`gitDir !== commonDir`) —
|
|
46
46
|
* what agent/paseo sessions run in, and the #5583 field report. In the user's
|
|
47
|
-
* primary checkout an autosave needs an explicit opt-in
|
|
47
|
+
* primary checkout an autosave needs an explicit opt-in from the user/global
|
|
48
|
+
* config or a runtime override. A project `.gjc` file is not that opt-in.
|
|
48
49
|
*/
|
|
49
50
|
export interface PromptDeadlineFlushResult {
|
|
50
51
|
/** Branch the WIP commit landed on, or `undefined` on a detached HEAD. */
|
|
@@ -58,9 +59,10 @@ export interface PromptDeadlineFlushOptions {
|
|
|
58
59
|
/** Active session's agent directory, used to keep volatile broker state out of the WIP commit. */
|
|
59
60
|
readonly agentDir?: string;
|
|
60
61
|
/**
|
|
61
|
-
* Whether the caller resolved `sdk.flushWorktreeOnDeadline` to `true` from
|
|
62
|
-
*
|
|
63
|
-
*
|
|
62
|
+
* Whether the caller resolved `sdk.flushWorktreeOnDeadline` to `true` from the
|
|
63
|
+
* user/global config or a runtime override, rather than from the schema
|
|
64
|
+
* default or a project `.gjc` file. Only that opt-in may autosave outside a
|
|
65
|
+
* linked worktree.
|
|
64
66
|
*/
|
|
65
67
|
readonly explicitOptIn?: boolean;
|
|
66
68
|
/**
|
|
@@ -71,6 +73,41 @@ export interface PromptDeadlineFlushOptions {
|
|
|
71
73
|
readonly isCurrent?: () => boolean;
|
|
72
74
|
readonly signal?: AbortSignal;
|
|
73
75
|
}
|
|
76
|
+
declare const DEADLINE_FLUSH_SETTING = "sdk.flushWorktreeOnDeadline";
|
|
77
|
+
/**
|
|
78
|
+
* The settings view both deadline hosts already hold. `get` is the merged value
|
|
79
|
+
* (global, then project, then runtime override, otherwise the schema default).
|
|
80
|
+
* `getGlobal` and `getOverride` are the layers a project file cannot write.
|
|
81
|
+
*/
|
|
82
|
+
export interface DeadlineFlushSettings {
|
|
83
|
+
get(path: typeof DEADLINE_FLUSH_SETTING): unknown;
|
|
84
|
+
getAgentDir?(): string | undefined;
|
|
85
|
+
getGlobal?(path: typeof DEADLINE_FLUSH_SETTING): unknown;
|
|
86
|
+
getOverride?(path: typeof DEADLINE_FLUSH_SETTING): unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* True only when the user wrote `sdk.flushWorktreeOnDeadline: true` in a runtime
|
|
90
|
+
* override or the global config. The schema default and a project `.gjc` file
|
|
91
|
+
* do not count: `Settings.has()` sees the merged view, so a repo-shipped `true`
|
|
92
|
+
* would otherwise open the primary-checkout gate.
|
|
93
|
+
*/
|
|
94
|
+
export declare function explicitDeadlineFlushOptIn(settings: DeadlineFlushSettings | undefined): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether this deadline must not autosave.
|
|
97
|
+
*
|
|
98
|
+
* A runtime override wins, then the user/global value. A project file cannot
|
|
99
|
+
* cancel either one. A project `false` still opts out when the user has not
|
|
100
|
+
* written the key.
|
|
101
|
+
*/
|
|
102
|
+
export declare function deadlineFlushSuppressed(settings: DeadlineFlushSettings | undefined): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Deadline-host entry for the worktree autosave. Both the session runtime and
|
|
105
|
+
* the notification bus call this so the opt-in decision cannot drift.
|
|
106
|
+
*/
|
|
107
|
+
export declare function autosaveWorktreeOnPromptDeadline(cwd: string, settings: DeadlineFlushSettings | undefined, options?: {
|
|
108
|
+
readonly isCurrent?: () => boolean;
|
|
109
|
+
readonly signal?: AbortSignal;
|
|
110
|
+
}): Promise<PromptDeadlineFlushResult | undefined>;
|
|
74
111
|
/**
|
|
75
112
|
* Commit any uncommitted work in the worktree owning `cwd`.
|
|
76
113
|
*
|
|
@@ -83,3 +120,4 @@ export interface PromptDeadlineFlushOptions {
|
|
|
83
120
|
* bound, so a caller that passes nothing still cannot hang here.
|
|
84
121
|
*/
|
|
85
122
|
export declare function flushWorktreeOnPromptDeadline(cwd: string, options?: AbortSignal | PromptDeadlineFlushOptions): Promise<PromptDeadlineFlushResult | undefined>;
|
|
123
|
+
export {};
|
|
@@ -70,6 +70,8 @@ export declare class PromptDeadlineManager {
|
|
|
70
70
|
*/
|
|
71
71
|
deadlineFlushTimeoutMs?: number;
|
|
72
72
|
});
|
|
73
|
+
/** Notify about termination check results to adjust retry strategy. */
|
|
74
|
+
notifyTerminationResult(correlation: InvocationCorrelation, _result: PromptDeadlineTerminalization, reason: string): void;
|
|
73
75
|
onAccepted(correlation: InvocationCorrelation): void;
|
|
74
76
|
/** A new exact agent_start retires an uncertainty-only fence, never captured terminal intent. */
|
|
75
77
|
onRunStarted(correlation: InvocationCorrelation): void;
|
|
@@ -3,14 +3,20 @@ type SecretInputError = {
|
|
|
3
3
|
code: "secret_field_forbidden";
|
|
4
4
|
message: string;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type UltrafastRestrictionError = {
|
|
7
|
+
code: "ultrafast_tier_forbidden";
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
/** Rejects secret-bearing and ultrafast-tier config patches from model-facing adapter inputs. */
|
|
11
|
+
export declare function validateAdapterSecretFields(operation: string, input: Input): SecretInputError | UltrafastRestrictionError | undefined;
|
|
8
12
|
export type AdapterValidationError = {
|
|
9
13
|
code: "invalid_reload_component" | "invalid_input";
|
|
10
14
|
message: string;
|
|
11
15
|
};
|
|
12
16
|
/** Rejects instruction-bearing controls before correlation or provider work. */
|
|
13
17
|
export declare function validateRequiredPromptText(operation: string, input: Input): AdapterValidationError | undefined;
|
|
14
|
-
/** Validates controls
|
|
15
|
-
export declare function validateAdapterControl(operation: string, input: Input
|
|
18
|
+
/** Validates controls before forwarding them; adapters reject ultrafast unless explicitly trusted. */
|
|
19
|
+
export declare function validateAdapterControl(operation: string, input: Input, options?: {
|
|
20
|
+
allowUltrafastTier?: boolean;
|
|
21
|
+
}): AdapterValidationError | undefined;
|
|
16
22
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createKindAwareReconciliation, type KindAwareReconciliation, type ReconciliationKind, type SteerReconciliationResult, } from "./bus/kind-aware-reconciliation";
|
|
2
|
-
export { createReconciliationStore, type DurableExecutionReconciliationRecord, type DurableReconciliationRecord, type DurableSteerReconciliationRecord, type ReconciliationStore, resolveReconciliationSessionFile, } from "./bus/reconciliation-store";
|
|
2
|
+
export { createReconciliationStore, type DurableExecutionReconciliationRecord, type DurableReconciliationRecord, type DurableSteerReconciliationRecord, type ReconciliationStore, type ReconciliationStoreInstrumentationEvent, resolveReconciliationSessionFile, } from "./bus/reconciliation-store";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type SessionListPageRecord = Record<string, unknown>;
|
|
2
2
|
export type SessionListSavedSessionOmissionReason = "scope_unavailable" | "candidate_scan_failed" | "candidate_not_found" | "candidate_ambiguous" | "candidate_invalid" | "identity_incomplete";
|
|
3
|
-
export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "managed_gc_journal_capacity_exceeded", "atomic_unavailable", "invalid_request", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
|
|
3
|
+
export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "managed_gc_journal_capacity_exceeded", "atomic_unavailable", "invalid_request", "permission_denied", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
|
|
4
4
|
export type SessionListSavedSessionOmissionDetailCode = (typeof SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES)[number];
|
|
5
5
|
/** Path-free diagnostic for a requested managed transcript that could not be selected safely. */
|
|
6
6
|
export interface SessionListSavedSessionOmission {
|