@gajae-code/coding-agent 0.9.6 → 0.10.1
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 +58 -0
- package/dist/types/cli/classify-install-target.d.ts +0 -10
- package/dist/types/cli/daemon-cli.d.ts +2 -0
- package/dist/types/cli/initial-message.d.ts +1 -1
- package/dist/types/cli/malloc-env-guard.d.ts +65 -0
- package/dist/types/cli/malloc-env-guard.test.d.ts +1 -0
- package/dist/types/cli/notify-cli.d.ts +3 -1
- package/dist/types/cli/session-picker.d.ts +4 -3
- package/dist/types/cli/update-cli.d.ts +22 -3
- package/dist/types/cli.d.ts +5 -0
- package/dist/types/commands/daemon.d.ts +6 -2
- package/dist/types/commands/launch.d.ts +1 -0
- package/dist/types/commands/notify.d.ts +6 -0
- package/dist/types/commit/analysis/conventional.d.ts +1 -1
- package/dist/types/commit/analysis/summary.d.ts +1 -1
- package/dist/types/commit/changelog/generate.d.ts +1 -1
- package/dist/types/commit/changelog/index.d.ts +2 -2
- package/dist/types/commit/map-reduce/map-phase.d.ts +1 -1
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +1 -1
- package/dist/types/config/keybindings.d.ts +5 -0
- package/dist/types/config/model-profile-activation.d.ts +1 -0
- package/dist/types/config/settings-schema.d.ts +47 -7
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/coordinator/contract.d.ts +1 -1
- package/dist/types/coordinator-mcp/model-preset.d.ts +45 -0
- package/dist/types/coordinator-mcp/policy.d.ts +3 -0
- package/dist/types/coordinator-mcp/server.d.ts +79 -6
- package/dist/types/coordinator-mcp/session-reaper.d.ts +53 -0
- package/dist/types/daemon/control-types.d.ts +10 -0
- package/dist/types/daemon/operator-contract.d.ts +47 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.d.ts +4 -0
- package/dist/types/discovery/helpers.d.ts +1 -1
- package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
- package/dist/types/extensibility/extensions/types.d.ts +3 -1
- package/dist/types/gjc-runtime/launch-tmux.d.ts +26 -7
- package/dist/types/gjc-runtime/session-state-sidecar.d.ts +34 -3
- package/dist/types/gjc-runtime/tmux-common.d.ts +6 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation-cli.d.ts +5 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +309 -0
- package/dist/types/gjc-runtime/tmux-sessions.d.ts +49 -17
- package/dist/types/internal-urls/local-protocol.d.ts +13 -9
- package/dist/types/main.d.ts +66 -2
- package/dist/types/modes/acp/acp-agent.d.ts +19 -2
- package/dist/types/modes/acp/acp-mode.d.ts +12 -0
- package/dist/types/modes/components/assistant-message.d.ts +1 -1
- package/dist/types/modes/components/custom-editor.d.ts +2 -0
- package/dist/types/modes/components/gajae-pet-widget.d.ts +59 -0
- package/dist/types/modes/components/hook-selector.d.ts +5 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +32 -0
- package/dist/types/modes/components/pet-selector.d.ts +11 -0
- package/dist/types/modes/components/session-selector.d.ts +22 -9
- package/dist/types/modes/components/settings-selector.d.ts +2 -0
- package/dist/types/modes/components/status-line/types.d.ts +1 -1
- package/dist/types/modes/components/status-line.d.ts +0 -10
- package/dist/types/modes/components/tool-execution.d.ts +1 -0
- package/dist/types/modes/components/user-message.d.ts +2 -1
- package/dist/types/modes/controllers/event-controller.d.ts +4 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +24 -2
- package/dist/types/modes/irc-observation-ledger.d.ts +22 -0
- package/dist/types/modes/print-mode.d.ts +3 -4
- package/dist/types/modes/rpc/rpc-client.d.ts +7 -1
- package/dist/types/modes/rpc/rpc-mode.d.ts +2 -1
- package/dist/types/modes/rpc/rpc-types.d.ts +17 -1
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +8 -0
- package/dist/types/modes/shared/agent-wire/unattended-run-controller.d.ts +5 -0
- package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +45 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +42 -2
- package/dist/types/modes/theme/defaults/index.d.ts +568 -568
- package/dist/types/modes/types.d.ts +28 -2
- package/dist/types/modes/utils/abort-message.d.ts +1 -1
- package/dist/types/modes/utils/context-usage.d.ts +4 -19
- package/dist/types/modes/utils/irc-message.d.ts +38 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +13 -4
- package/dist/types/notifications/config.d.ts +34 -0
- package/dist/types/notifications/daemon-paths.d.ts +7 -0
- package/dist/types/notifications/index.d.ts +27 -0
- package/dist/types/notifications/lifecycle-control-runtime.d.ts +12 -4
- package/dist/types/notifications/notification-service.d.ts +144 -0
- package/dist/types/notifications/rate-limit-pool.d.ts +27 -9
- package/dist/types/notifications/telegram-daemon-control.d.ts +6 -0
- package/dist/types/notifications/telegram-daemon.d.ts +130 -3
- package/dist/types/notifications/telegram-reference.d.ts +19 -2
- package/dist/types/notifications/topic-registry.d.ts +24 -4
- package/dist/types/registry/agent-registry.d.ts +2 -0
- package/dist/types/rlm/index.d.ts +1 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/secrets/obfuscator.d.ts +1 -1
- package/dist/types/session/agent-session.d.ts +40 -3
- package/dist/types/session/cache-economics.d.ts +79 -0
- package/dist/types/session/context-estimation.d.ts +31 -0
- package/dist/types/session/provider-safety-stop.d.ts +5 -0
- package/dist/types/session/session-manager.d.ts +124 -4
- package/dist/types/session/session-storage.d.ts +155 -13
- package/dist/types/setup/credential-auto-import.d.ts +2 -2
- package/dist/types/task/executor.d.ts +3 -0
- package/dist/types/task/receipt.d.ts +3 -1
- package/dist/types/task/types.d.ts +8 -0
- package/dist/types/tools/ask-answer-registry.d.ts +5 -0
- package/dist/types/tools/ask.d.ts +25 -1
- package/dist/types/tools/bash.d.ts +1 -1
- package/dist/types/tools/browser/tab-supervisor.d.ts +6 -0
- package/dist/types/tools/index.d.ts +58 -6
- package/dist/types/tools/telegram-send.d.ts +7 -0
- package/dist/types/utils/external-editor.d.ts +2 -0
- package/package.json +9 -9
- package/scripts/g004-tmux-smoke.ts +196 -36
- package/src/cli/daemon-cli.ts +19 -29
- package/src/cli/malloc-env-guard.test.ts +104 -0
- package/src/cli/malloc-env-guard.ts +149 -0
- package/src/cli/notify-cli.ts +78 -14
- package/src/cli/session-picker.ts +23 -40
- package/src/cli/update-cli.ts +56 -37
- package/src/cli.ts +51 -10
- package/src/commands/daemon.ts +19 -5
- package/src/commands/harness.ts +515 -47
- package/src/commands/launch.ts +11 -3
- package/src/commands/notify.ts +5 -1
- package/src/commands/session.ts +6 -1
- package/src/config/keybindings.ts +5 -0
- package/src/config/model-profile-activation.ts +1 -1
- package/src/config/model-profiles.ts +14 -14
- package/src/config/settings-schema.ts +41 -1
- package/src/config/settings.ts +96 -45
- package/src/coordinator/contract.ts +1 -0
- package/src/coordinator-mcp/model-preset.ts +100 -0
- package/src/coordinator-mcp/policy.ts +30 -0
- package/src/coordinator-mcp/server.ts +2881 -425
- package/src/coordinator-mcp/session-reaper.ts +129 -0
- package/src/daemon/control-types.ts +11 -0
- package/src/daemon/operator-contract.ts +121 -0
- package/src/deep-interview/render-middleware.ts +67 -2
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/models/catalog.ts +57 -17
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/payload/sanitize.ts +15 -2
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/register.ts +5 -1
- package/src/extensibility/extensions/runner.ts +1 -1
- package/src/extensibility/extensions/types.ts +3 -1
- package/src/gjc-runtime/launch-tmux.ts +702 -135
- package/src/gjc-runtime/session-state-sidecar.ts +756 -135
- package/src/gjc-runtime/team-runtime.ts +6 -0
- package/src/gjc-runtime/tmux-common.ts +26 -7
- package/src/gjc-runtime/tmux-gc.ts +52 -9
- package/src/gjc-runtime/tmux-owner-isolation-cli.ts +185 -0
- package/src/gjc-runtime/tmux-owner-isolation.ts +2060 -0
- package/src/gjc-runtime/tmux-sessions.ts +871 -68
- package/src/internal-urls/docs-index.generated.ts +12 -11
- package/src/internal-urls/local-protocol.ts +29 -10
- package/src/main.ts +301 -80
- package/src/modes/acp/acp-agent.ts +730 -100
- package/src/modes/acp/acp-mode.ts +29 -2
- package/src/modes/components/assistant-message.ts +32 -3
- package/src/modes/components/bash-execution.ts +43 -13
- package/src/modes/components/custom-editor.ts +5 -0
- package/src/modes/components/footer.ts +3 -3
- package/src/modes/components/gajae-pet-widget.ts +360 -0
- package/src/modes/components/hook-selector.ts +12 -0
- package/src/modes/components/irc-sidebar.ts +206 -0
- package/src/modes/components/pet-selector.ts +55 -0
- package/src/modes/components/session-selector.ts +222 -221
- package/src/modes/components/settings-selector.ts +10 -0
- package/src/modes/components/status-line/segments.ts +13 -6
- package/src/modes/components/status-line/types.ts +1 -1
- package/src/modes/components/status-line.ts +4 -171
- package/src/modes/components/tool-execution.ts +47 -6
- package/src/modes/components/user-message.ts +26 -9
- package/src/modes/controllers/command-controller.ts +28 -2
- package/src/modes/controllers/event-controller.ts +159 -36
- package/src/modes/controllers/extension-ui-controller.ts +37 -18
- package/src/modes/controllers/input-controller.ts +8 -2
- package/src/modes/controllers/selector-controller.ts +62 -15
- package/src/modes/interactive-mode.ts +199 -7
- package/src/modes/irc-observation-ledger.ts +127 -0
- package/src/modes/print-mode.ts +228 -92
- package/src/modes/rpc/rpc-client.ts +58 -1
- package/src/modes/rpc/rpc-mode.ts +286 -85
- package/src/modes/rpc/rpc-types.ts +15 -1
- package/src/modes/shared/agent-wire/command-dispatch.ts +33 -1
- package/src/modes/shared/agent-wire/command-validation.ts +10 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +45 -2
- package/src/modes/shared/agent-wire/scopes.ts +1 -0
- package/src/modes/shared/agent-wire/unattended-session.ts +288 -1
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +130 -20
- package/src/modes/types.ts +34 -2
- package/src/modes/utils/context-usage.ts +56 -92
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/irc-message.ts +138 -0
- package/src/modes/utils/ui-helpers.ts +216 -50
- package/src/notifications/config.ts +44 -0
- package/src/notifications/daemon-paths.ts +8 -0
- package/src/notifications/index.ts +535 -75
- package/src/notifications/lifecycle-control-runtime.ts +930 -77
- package/src/notifications/notification-service.ts +710 -0
- package/src/notifications/rate-limit-pool.ts +46 -12
- package/src/notifications/telegram-daemon-cli.ts +2 -0
- package/src/notifications/telegram-daemon-control.ts +27 -2
- package/src/notifications/telegram-daemon.ts +635 -94
- package/src/notifications/telegram-reference.ts +73 -13
- package/src/notifications/topic-registry.ts +86 -9
- package/src/prompts/system/irc-peer-roster.md +1 -0
- package/src/prompts/system/subagent-system-prompt.md +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/irc.md +1 -1
- package/src/registry/agent-registry.ts +3 -0
- package/src/sdk.ts +52 -1
- package/src/secrets/obfuscator.ts +4 -2
- package/src/session/agent-session.ts +670 -217
- package/src/session/cache-economics.ts +275 -0
- package/src/session/context-estimation.ts +91 -0
- package/src/session/provider-safety-stop.ts +9 -0
- package/src/session/session-dump-format.ts +6 -0
- package/src/session/session-manager.ts +809 -39
- package/src/session/session-storage.ts +582 -38
- package/src/slash-commands/builtin-registry.ts +153 -9
- package/src/slash-commands/helpers/context-report.ts +26 -4
- package/src/task/executor.ts +12 -3
- package/src/task/index.ts +8 -0
- package/src/task/receipt.ts +7 -2
- package/src/task/types.ts +26 -0
- package/src/tools/ask-answer-registry.ts +25 -0
- package/src/tools/ask.ts +355 -33
- package/src/tools/browser/tab-supervisor.ts +63 -6
- package/src/tools/browser.ts +8 -3
- package/src/tools/index.ts +81 -6
- package/src/tools/sqlite-reader.ts +8 -4
- package/src/tui/output-block.ts +18 -6
- package/src/utils/external-editor.ts +6 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provenance and lifecycle primitives for tmux-resident GJC owners.
|
|
3
|
+
* This module intentionally accepts and stores only opaque identifiers and
|
|
4
|
+
* process/cgroup metadata; it never reads panes, prompts, environment, or logs.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TMUX_OWNER_ISOLATION_SCHEMA_VERSION = 1;
|
|
7
|
+
export declare const TMUX_OWNER_ISOLATION_MAX_LINE_BYTES: number;
|
|
8
|
+
export declare const TMUX_OWNER_ISOLATION_MAX_DIAGNOSTIC_CHARS = 512;
|
|
9
|
+
export declare function tmuxOwnerIsolationBootstrapArgv(): string[];
|
|
10
|
+
export type CgroupClassification = "not_applicable" | "safe" | "unsafe_service" | "unverifiable";
|
|
11
|
+
export type ServerState = "absent" | "safe" | "unsafe" | "unverifiable";
|
|
12
|
+
export type PlanErrorCode = "scope_unavailable" | "server_unsafe" | "server_unverifiable" | "server_race" | "scope_bootstrap_failed";
|
|
13
|
+
export type ExpectedTerminalResult = "owner_term_then_session_cleanup";
|
|
14
|
+
export type TerminalSignal = "SIGTERM" | "SIGHUP" | "SIGINT" | "SIGKILL" | "EXIT" | "MANUAL" | "UNKNOWN";
|
|
15
|
+
export type VerdictClassification = "expected_operator_shutdown" | "unexpected_owner_loss" | "non_operator_cleanup";
|
|
16
|
+
export type TerminalObserver = "sidecar" | "raw_monitor";
|
|
17
|
+
export interface CgroupInfo {
|
|
18
|
+
classification: CgroupClassification;
|
|
19
|
+
scope?: string;
|
|
20
|
+
diagnostic?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Classify only public cgroup path metadata; malformed Linux data fails closed. */
|
|
23
|
+
export declare function classifyCgroup(input: {
|
|
24
|
+
platform: NodeJS.Platform;
|
|
25
|
+
cgroupText?: string | null;
|
|
26
|
+
}): CgroupInfo;
|
|
27
|
+
export declare function ownerProcessStartTime(platform: NodeJS.Platform, stat: string | null): string | null;
|
|
28
|
+
export interface TmuxServerProof {
|
|
29
|
+
state: ServerState;
|
|
30
|
+
pid?: number;
|
|
31
|
+
startTime?: string;
|
|
32
|
+
cgroup?: CgroupInfo;
|
|
33
|
+
sessionNames?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface PlanRequest {
|
|
36
|
+
schema_version: 1;
|
|
37
|
+
op: "plan";
|
|
38
|
+
platform: NodeJS.Platform;
|
|
39
|
+
session_id: string;
|
|
40
|
+
owner_generation: string;
|
|
41
|
+
cwd: string;
|
|
42
|
+
state_dir: string;
|
|
43
|
+
socket_key: string;
|
|
44
|
+
tmux_argv: string[];
|
|
45
|
+
baseline: OwnerGenerationBaseline;
|
|
46
|
+
}
|
|
47
|
+
export interface PublishGenerationRequest {
|
|
48
|
+
schema_version: 1;
|
|
49
|
+
op: "publish_generation";
|
|
50
|
+
session_id: string;
|
|
51
|
+
owner_generation: string;
|
|
52
|
+
state_dir: string;
|
|
53
|
+
baseline: OwnerGenerationBaseline;
|
|
54
|
+
}
|
|
55
|
+
export interface PublishGenerationResult {
|
|
56
|
+
schema_version: 1;
|
|
57
|
+
ok: true;
|
|
58
|
+
code: "generation_published";
|
|
59
|
+
generation: string;
|
|
60
|
+
}
|
|
61
|
+
export interface AttemptCapability {
|
|
62
|
+
token: string;
|
|
63
|
+
session_name: string;
|
|
64
|
+
socket_key: string;
|
|
65
|
+
server_absent_before: boolean;
|
|
66
|
+
baseline: OwnerGenerationBaseline;
|
|
67
|
+
expires_at: string;
|
|
68
|
+
}
|
|
69
|
+
export interface DirectExecution {
|
|
70
|
+
mode: "direct";
|
|
71
|
+
argv: string[];
|
|
72
|
+
attempt_session: string;
|
|
73
|
+
server_key: string;
|
|
74
|
+
server_absent_before: boolean;
|
|
75
|
+
server_pid?: number;
|
|
76
|
+
server_start_time?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface ScopedExecution {
|
|
79
|
+
mode: "scoped";
|
|
80
|
+
argv: string[];
|
|
81
|
+
stdin_line: string;
|
|
82
|
+
expected_scope: string;
|
|
83
|
+
attempt: AttemptCapability;
|
|
84
|
+
attempt_session: string;
|
|
85
|
+
server_key: string;
|
|
86
|
+
server_absent_before: true;
|
|
87
|
+
}
|
|
88
|
+
export type PlanExecution = DirectExecution | ScopedExecution;
|
|
89
|
+
export interface PlanSuccess {
|
|
90
|
+
schema_version: 1;
|
|
91
|
+
ok: true;
|
|
92
|
+
code: "not_required" | "unsafe_scope_required";
|
|
93
|
+
execution: PlanExecution;
|
|
94
|
+
classification: CgroupInfo;
|
|
95
|
+
server_state: ServerState;
|
|
96
|
+
}
|
|
97
|
+
export interface TmuxOwnerIsolationExecutionSuccess {
|
|
98
|
+
ok: true;
|
|
99
|
+
code: "executed";
|
|
100
|
+
execution: PlanExecution;
|
|
101
|
+
server: TmuxServerProof;
|
|
102
|
+
server_key: string;
|
|
103
|
+
server_pid: number;
|
|
104
|
+
server_start_time: string;
|
|
105
|
+
server_session: string;
|
|
106
|
+
native_session_id?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface PlanFailure {
|
|
109
|
+
schema_version: 1;
|
|
110
|
+
ok: false;
|
|
111
|
+
code: PlanErrorCode;
|
|
112
|
+
diagnostic: string;
|
|
113
|
+
}
|
|
114
|
+
export type PlanResponse = PlanSuccess | PlanFailure;
|
|
115
|
+
export interface OwnerIsolationProbe {
|
|
116
|
+
readCallerCgroup(): Promise<string | null>;
|
|
117
|
+
probeServer(socketKey: string, tmuxArgv?: string[]): Promise<TmuxServerProof>;
|
|
118
|
+
}
|
|
119
|
+
/** Synchronous probe boundary for managed launch paths. */
|
|
120
|
+
export interface OwnerIsolationProbeSync {
|
|
121
|
+
readCallerCgroup(): string | null;
|
|
122
|
+
probeServer(socketKey: string): TmuxServerProof;
|
|
123
|
+
recordAttempt(input: {
|
|
124
|
+
stateDir: string;
|
|
125
|
+
sessionId: string;
|
|
126
|
+
generation: string;
|
|
127
|
+
attempt: AttemptCapability;
|
|
128
|
+
}): void;
|
|
129
|
+
}
|
|
130
|
+
export interface TmuxOwnerIsolationExecutionFailure {
|
|
131
|
+
ok: false;
|
|
132
|
+
code: PlanErrorCode;
|
|
133
|
+
diagnostic: string;
|
|
134
|
+
}
|
|
135
|
+
export type TmuxOwnerIsolationExecutionResult = TmuxOwnerIsolationExecutionSuccess | TmuxOwnerIsolationExecutionFailure;
|
|
136
|
+
/** Synchronous spawn boundary; callers pass argv and scoped stdin unchanged. */
|
|
137
|
+
export interface TmuxOwnerIsolationExecutionDependencies {
|
|
138
|
+
socketKey: string;
|
|
139
|
+
spawn(argv: string[], stdinLine?: string): {
|
|
140
|
+
exitCode: number | null;
|
|
141
|
+
stdout?: string;
|
|
142
|
+
};
|
|
143
|
+
probeServer(socketKey: string): TmuxServerProof;
|
|
144
|
+
/** Reads the published owner generation immediately around direct execution. */
|
|
145
|
+
isCurrentGeneration?(): boolean;
|
|
146
|
+
cleanupSpawned?(input: {
|
|
147
|
+
execution: DirectExecution;
|
|
148
|
+
nativeSessionId: string;
|
|
149
|
+
server: TmuxServerProof;
|
|
150
|
+
}): void;
|
|
151
|
+
}
|
|
152
|
+
export declare function isExactScopedBootstrapSuccessReceipt(stdout: string): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Synchronous equivalent of the target-server truth table for managed callers.
|
|
155
|
+
* Attempt persistence is injected so a caller can use its existing atomic state writer.
|
|
156
|
+
*/
|
|
157
|
+
export declare function planTmuxOwnerIsolationSync(request: PlanRequest, probe: OwnerIsolationProbeSync): PlanResponse;
|
|
158
|
+
/**
|
|
159
|
+
* Runs one planned argv exactly and re-proves the target server before callers
|
|
160
|
+
* perform profile, attach, or cleanup operations.
|
|
161
|
+
*/
|
|
162
|
+
export declare function executeTmuxOwnerIsolationPlanSync(plan: PlanResponse, deps: TmuxOwnerIsolationExecutionDependencies): TmuxOwnerIsolationExecutionResult;
|
|
163
|
+
/** Implements the target-server truth table before any tmux operation. */
|
|
164
|
+
export declare function planTmuxOwnerIsolation(request: PlanRequest, probe: OwnerIsolationProbe): Promise<PlanResponse>;
|
|
165
|
+
export interface BootstrapRequest {
|
|
166
|
+
schema_version: 1;
|
|
167
|
+
op: "bootstrap";
|
|
168
|
+
session_id: string;
|
|
169
|
+
owner_generation: string;
|
|
170
|
+
state_dir: string;
|
|
171
|
+
socket_key: string;
|
|
172
|
+
expected_scope: string;
|
|
173
|
+
tmux_argv: string[];
|
|
174
|
+
attempt: AttemptCapability;
|
|
175
|
+
}
|
|
176
|
+
export interface BootstrapResult {
|
|
177
|
+
schema_version: 1;
|
|
178
|
+
ok: boolean;
|
|
179
|
+
code: "bootstrapped" | "scope_bootstrap_failed";
|
|
180
|
+
native_session_id?: string;
|
|
181
|
+
server_pid?: number;
|
|
182
|
+
server_start_time?: string;
|
|
183
|
+
session_name?: string;
|
|
184
|
+
diagnostic?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface BootstrapDependencies {
|
|
187
|
+
readSelfCgroup(): Promise<string | null>;
|
|
188
|
+
spawn(argv: string[]): {
|
|
189
|
+
exitCode: number | null;
|
|
190
|
+
stdout?: string;
|
|
191
|
+
};
|
|
192
|
+
probeServer(socketKey: string, tmuxControlArgv?: string[]): Promise<TmuxServerProof>;
|
|
193
|
+
}
|
|
194
|
+
/** Self-proves the scope and synchronously invokes the exact supplied argv. */
|
|
195
|
+
export declare function bootstrapTmuxOwnerIsolation(request: BootstrapRequest, deps: BootstrapDependencies): Promise<BootstrapResult>;
|
|
196
|
+
export interface OwnerIntent {
|
|
197
|
+
schema_version: 1;
|
|
198
|
+
intent_id: string;
|
|
199
|
+
generation: string;
|
|
200
|
+
session_id: string;
|
|
201
|
+
server_key: string;
|
|
202
|
+
expected_terminal: {
|
|
203
|
+
signal: "SIGTERM";
|
|
204
|
+
result: ExpectedTerminalResult;
|
|
205
|
+
};
|
|
206
|
+
dispatch_id: string;
|
|
207
|
+
created_at: string;
|
|
208
|
+
expires_at: string;
|
|
209
|
+
state: "pending";
|
|
210
|
+
}
|
|
211
|
+
export interface OwnerVerdict {
|
|
212
|
+
schema_version: 1;
|
|
213
|
+
generation: string;
|
|
214
|
+
session_id: string;
|
|
215
|
+
server_key: string;
|
|
216
|
+
observed_at: string;
|
|
217
|
+
signal: TerminalSignal;
|
|
218
|
+
exit_code: number | null;
|
|
219
|
+
result: string;
|
|
220
|
+
observer: TerminalObserver;
|
|
221
|
+
classification: VerdictClassification;
|
|
222
|
+
reason: string;
|
|
223
|
+
intent_id?: string;
|
|
224
|
+
dedupe_key: string;
|
|
225
|
+
}
|
|
226
|
+
export interface OwnerIncident {
|
|
227
|
+
schema_version: 1;
|
|
228
|
+
generation: string;
|
|
229
|
+
session_id: string;
|
|
230
|
+
dedupe_key: string;
|
|
231
|
+
created_at: string;
|
|
232
|
+
classification: "unexpected_owner_loss";
|
|
233
|
+
}
|
|
234
|
+
export interface ObserveTerminalRequest {
|
|
235
|
+
schema_version: 1;
|
|
236
|
+
op: "observe_terminal";
|
|
237
|
+
session_id: string;
|
|
238
|
+
owner_generation: string;
|
|
239
|
+
state_dir: string;
|
|
240
|
+
socket_key: string;
|
|
241
|
+
observer: TerminalObserver;
|
|
242
|
+
observed_at: string;
|
|
243
|
+
signal: TerminalSignal;
|
|
244
|
+
exit_code: number | null;
|
|
245
|
+
exit_kind: string;
|
|
246
|
+
reason: string;
|
|
247
|
+
operator_dispatch_id?: string;
|
|
248
|
+
}
|
|
249
|
+
export interface LifecyclePaths {
|
|
250
|
+
root: string;
|
|
251
|
+
generation: string;
|
|
252
|
+
generationFile: string;
|
|
253
|
+
generationMarkerFile: string;
|
|
254
|
+
intentFile: string;
|
|
255
|
+
verdictFile: string;
|
|
256
|
+
verdictAliasFile: string;
|
|
257
|
+
incidentFile: string;
|
|
258
|
+
lockDatabaseFile: string;
|
|
259
|
+
journalFile: string;
|
|
260
|
+
}
|
|
261
|
+
export declare function lifecyclePaths(stateDir: string, sessionId: string, generation: string): LifecyclePaths;
|
|
262
|
+
export declare function replaceOwnerGeneration(stateDir: string, sessionId: string, generation?: string, expectedBaseline?: OwnerGenerationBaseline): Promise<string>;
|
|
263
|
+
export type OwnerGenerationBaseline = {
|
|
264
|
+
state: "absent";
|
|
265
|
+
} | {
|
|
266
|
+
state: "current";
|
|
267
|
+
schema_version: 1;
|
|
268
|
+
generation: string;
|
|
269
|
+
session_id: string;
|
|
270
|
+
published_at: string;
|
|
271
|
+
};
|
|
272
|
+
export declare function captureOwnerGenerationBaseline(stateDir: string, sessionId: string): Promise<OwnerGenerationBaseline>;
|
|
273
|
+
/** Captures the full immutable generation record for a planned owner launch. */
|
|
274
|
+
export declare function captureOwnerGenerationBaselineSync(stateDir: string, sessionId: string): OwnerGenerationBaseline;
|
|
275
|
+
export declare function isOwnerGenerationBaselineCurrentSync(stateDir: string, sessionId: string, baseline: OwnerGenerationBaseline): boolean;
|
|
276
|
+
/** Synchronous publication for managed launch paths, serialized by a SQLite write transaction. */
|
|
277
|
+
export declare function replaceOwnerGenerationSync(stateDir: string, sessionId: string, generation: string, expectedBaseline: OwnerGenerationBaseline): string;
|
|
278
|
+
/** Publishes a raw-owner generation through the canonical SQLite-serialized CAS path. */
|
|
279
|
+
export declare function publishOwnerGenerationSync(request: PublishGenerationRequest): PublishGenerationResult;
|
|
280
|
+
export declare function createOwnerIntent(stateDir: string, input: Omit<OwnerIntent, "schema_version" | "intent_id" | "state">): Promise<OwnerIntent>;
|
|
281
|
+
/** Publish exactly one terminal verdict. Existing valid verdicts always win. */
|
|
282
|
+
export declare function observeOwnerTerminal(request: ObserveTerminalRequest): Promise<OwnerVerdict>;
|
|
283
|
+
/** Strictly validate the persisted authorization, optionally against its terminal observation. */
|
|
284
|
+
export declare function isValidOwnerIntent(intent: unknown, request?: ObserveTerminalRequest): intent is OwnerIntent;
|
|
285
|
+
/** Accept only real UTC timestamps in the canonical evidence serialization. */
|
|
286
|
+
export declare function isCanonicalUtcTimestamp(value: unknown): value is string;
|
|
287
|
+
/** Strictly validate a complete persisted verdict, optionally against its observation. */
|
|
288
|
+
export declare function isValidOwnerVerdict(verdict: unknown, request?: ObserveTerminalRequest): verdict is OwnerVerdict;
|
|
289
|
+
export interface ExactOwnerCloseRequest {
|
|
290
|
+
stateDir: string;
|
|
291
|
+
sessionId: string;
|
|
292
|
+
generation: string;
|
|
293
|
+
serverKey: string;
|
|
294
|
+
pid: number;
|
|
295
|
+
startTime: string;
|
|
296
|
+
dispatchId: string;
|
|
297
|
+
createdAt: string;
|
|
298
|
+
expiresAt: string;
|
|
299
|
+
}
|
|
300
|
+
export interface ExactOwnerCloseDependencies {
|
|
301
|
+
readStartTime(pid: number): Promise<string | null>;
|
|
302
|
+
sendSigterm(pid: number): Promise<void>;
|
|
303
|
+
waitForVerdict(): Promise<OwnerVerdict | null>;
|
|
304
|
+
cleanupSession(): Promise<void>;
|
|
305
|
+
}
|
|
306
|
+
/** Authorizes only an exact, start-time-validated SIGTERM before compatibility cleanup. */
|
|
307
|
+
export declare function closeExactTmuxOwner(request: ExactOwnerCloseRequest, deps: ExactOwnerCloseDependencies): Promise<OwnerVerdict>;
|
|
308
|
+
export declare function parseOwnerIsolationRequest(line: string): PlanRequest | BootstrapRequest | PublishGenerationRequest | ObserveTerminalRequest | null;
|
|
309
|
+
export declare function serializeOwnerIsolationResponse(response: PlanResponse | BootstrapResult | PublishGenerationResult | OwnerVerdict): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type OwnerIsolationProbeSync, type PlanResponse, type TmuxOwnerIsolationExecutionDependencies, type TmuxOwnerIsolationExecutionResult } from "./tmux-owner-isolation";
|
|
1
2
|
export interface GjcTmuxSessionStatus {
|
|
2
3
|
name: string;
|
|
3
4
|
attached: boolean;
|
|
@@ -11,6 +12,8 @@ export interface GjcTmuxSessionStatus {
|
|
|
11
12
|
sessionId?: string;
|
|
12
13
|
sessionStateFile?: string;
|
|
13
14
|
version?: string;
|
|
15
|
+
ownerGeneration?: string;
|
|
16
|
+
nativeSessionId?: string;
|
|
14
17
|
panePids: number[];
|
|
15
18
|
profile?: string;
|
|
16
19
|
}
|
|
@@ -22,6 +25,8 @@ export interface GjcTmuxSessionTagsForGc {
|
|
|
22
25
|
sessionId?: string;
|
|
23
26
|
sessionStateFile?: string;
|
|
24
27
|
version?: string;
|
|
28
|
+
ownerGeneration?: string;
|
|
29
|
+
nativeSessionId?: string;
|
|
25
30
|
createdAt?: string;
|
|
26
31
|
attached?: boolean;
|
|
27
32
|
panePids?: number[];
|
|
@@ -30,6 +35,44 @@ export interface GjcTmuxSessionsForGc {
|
|
|
30
35
|
tagged: GjcTmuxSessionStatus[];
|
|
31
36
|
untagged: GjcTmuxSessionStatus[];
|
|
32
37
|
}
|
|
38
|
+
export interface ProvenTmuxSessionIdentity {
|
|
39
|
+
nativeSessionId: string;
|
|
40
|
+
serverPid: number;
|
|
41
|
+
serverStartTime: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ExpectedGjcTmuxSessionIdentity {
|
|
44
|
+
nativeSessionId: string;
|
|
45
|
+
ownerGeneration: string;
|
|
46
|
+
sessionId: string;
|
|
47
|
+
sessionStateFile: string;
|
|
48
|
+
project: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ExactOwnerIdentity {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
stateDir: string;
|
|
54
|
+
socketKey: string;
|
|
55
|
+
generation: string;
|
|
56
|
+
pid: number;
|
|
57
|
+
startTime: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ForceCloseOwnerDependencies {
|
|
60
|
+
resolveOwner(sessionName: string, env: NodeJS.ProcessEnv): Promise<ExactOwnerIdentity>;
|
|
61
|
+
signalTerm(pid: number): void;
|
|
62
|
+
readProcessStartTime(pid: number): Promise<string | null>;
|
|
63
|
+
cleanupSession(sessionTarget: string, env: NodeJS.ProcessEnv): void;
|
|
64
|
+
now(): Date;
|
|
65
|
+
sleep(ms: number): Promise<void>;
|
|
66
|
+
listPanePids(sessionName: string, env: NodeJS.ProcessEnv): number[];
|
|
67
|
+
}
|
|
68
|
+
export type CreateOwnerIsolationTestDependencies = {
|
|
69
|
+
probe?: Partial<OwnerIsolationProbeSync>;
|
|
70
|
+
execute?: (plan: PlanResponse, deps: TmuxOwnerIsolationExecutionDependencies) => TmuxOwnerIsolationExecutionResult;
|
|
71
|
+
};
|
|
72
|
+
/** @internal Test-only seam; production create always uses live fail-closed probes. */
|
|
73
|
+
export declare function __setCreateOwnerIsolationForTests(dependencies: CreateOwnerIsolationTestDependencies | null): void;
|
|
74
|
+
/** @internal Test-only seam; production mutations always use live fail-closed proofs. */
|
|
75
|
+
export declare function __setMutationServerProofForTests(dependency: ((tmuxCommand: string, env: NodeJS.ProcessEnv) => unknown) | null): void;
|
|
33
76
|
export declare function listGjcTmuxSessions(env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus[];
|
|
34
77
|
/** @internal */
|
|
35
78
|
export declare function listTmuxSessionsForGc(env?: NodeJS.ProcessEnv): GjcTmuxSessionsForGc;
|
|
@@ -38,25 +81,14 @@ export declare function findGjcTmuxSessionByName(sessionName: string, env?: Node
|
|
|
38
81
|
export declare function findGjcTmuxSessionByScope(project: string, branch: string | null | undefined, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus | undefined;
|
|
39
82
|
export declare function statusGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
40
83
|
export declare function createGjcTmuxSession(env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
84
|
+
/** Proves a managed reusable name still resolves to one immutable session on one server. */
|
|
85
|
+
export declare function proveGjcTmuxSessionMutationTarget(sessionName: string, env?: NodeJS.ProcessEnv): ProvenTmuxSessionIdentity;
|
|
41
86
|
/** @internal */
|
|
42
87
|
export declare function readTmuxSessionTagsForGc(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionTagsForGc;
|
|
43
|
-
export declare function removeGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
88
|
+
export declare function removeGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedIdentity?: ExpectedGjcTmuxSessionIdentity): GjcTmuxSessionStatus;
|
|
44
89
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* This is the lifecycle-control counterpart to {@link removeGjcTmuxSession}: it
|
|
48
|
-
* intentionally does NOT refuse live/attached panes (hard-kill is the contract),
|
|
49
|
-
* but it keeps every safety check so it can only ever kill a genuinely
|
|
50
|
-
* GJC-managed session:
|
|
51
|
-
* - re-reads the exact tmux profile immediately before kill (never a non-GJC
|
|
52
|
-
* session, even one that collides by name);
|
|
53
|
-
* - when `expectedSessionId` is given, requires the `@gjc-session-id` tag match;
|
|
54
|
-
* - when `expectedStateFile` is given, requires the `@gjc-session-state-file`
|
|
55
|
-
* tag match.
|
|
56
|
-
*
|
|
57
|
-
* Returns the prior status (for audit). Throws a tagged error otherwise:
|
|
58
|
-
* `gjc_tmux_session_not_found`, `gjc_tmux_session_not_managed`,
|
|
59
|
-
* `gjc_tmux_session_id_mismatch`, or `gjc_tmux_session_state_file_mismatch`.
|
|
90
|
+
* Requests an exact tagged owner shutdown. Session cleanup is compatibility-only
|
|
91
|
+
* and follows a validated SIGTERM verdict; it never authorizes the close.
|
|
60
92
|
*/
|
|
61
|
-
export declare function forceCloseGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedSessionId?: string, expectedStateFile?: string): GjcTmuxSessionStatus
|
|
93
|
+
export declare function forceCloseGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedSessionId?: string, expectedStateFile?: string, deps?: Partial<ForceCloseOwnerDependencies>): Promise<GjcTmuxSessionStatus>;
|
|
62
94
|
export declare function attachGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): never;
|
|
@@ -17,22 +17,26 @@ export declare class LocalProtocolHandler implements ProtocolHandler {
|
|
|
17
17
|
readonly scheme = "local";
|
|
18
18
|
readonly immutable = false;
|
|
19
19
|
/**
|
|
20
|
-
* Install
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Install an explicit local-protocol mapping owned by the caller.
|
|
21
|
+
*
|
|
22
|
+
* The most recently installed live mapping wins. The returned disposer removes
|
|
23
|
+
* only this registration and is safe to call more than once.
|
|
24
|
+
*/
|
|
25
|
+
static installOverride(value: LocalProtocolOptions): () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Install a process-global test override that wins over owned and registry
|
|
28
|
+
* mappings. Prefer {@link installOverride} for lifecycle-bound production use.
|
|
23
29
|
*/
|
|
24
30
|
static setOverride(value: LocalProtocolOptions | undefined): void;
|
|
25
|
-
/** Reset
|
|
31
|
+
/** Reset all process-global local-protocol overrides. Test-only. */
|
|
26
32
|
static resetOverrideForTests(): void;
|
|
27
33
|
/**
|
|
28
34
|
* Returns the active local-protocol options.
|
|
29
35
|
*
|
|
30
36
|
* Resolution order:
|
|
31
|
-
* 1.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* 2. The main session in `AgentRegistry.global()`. Its `SessionManager`
|
|
35
|
-
* supplies both `getArtifactsDir` and `getSessionId`.
|
|
37
|
+
* 1. Direct test override installed via {@link setOverride}.
|
|
38
|
+
* 2. The most recently installed live owned override.
|
|
39
|
+
* 3. A live main session in `AgentRegistry.global()`.
|
|
36
40
|
*/
|
|
37
41
|
static resolveOptions(): LocalProtocolOptions | undefined;
|
|
38
42
|
resolve(url: InternalUrl): Promise<InternalResource>;
|
package/dist/types/main.d.ts
CHANGED
|
@@ -4,15 +4,39 @@
|
|
|
4
4
|
* This file handles CLI argument parsing and translates them into
|
|
5
5
|
* createAgentSession() options. The SDK does the heavy lifting.
|
|
6
6
|
*/
|
|
7
|
+
import type { ImageContent } from "@gajae-code/ai";
|
|
7
8
|
import type { Args } from "./cli/args";
|
|
8
9
|
import { ModelRegistry } from "./config/model-registry";
|
|
9
10
|
import { Settings } from "./config/settings";
|
|
11
|
+
import type { ExtensionUIContext } from "./extensibility/extensions/types";
|
|
12
|
+
import type { SessionSelectionResult } from "./modes/components/session-selector";
|
|
10
13
|
import type { InteractiveMode } from "./modes/interactive-mode";
|
|
14
|
+
import type { PrintModeOptions } from "./modes/print-mode";
|
|
15
|
+
import { initTheme } from "./modes/theme/theme";
|
|
11
16
|
import type { SubmittedUserInput } from "./modes/types";
|
|
17
|
+
import type { MCPManager } from "./runtime-mcp";
|
|
12
18
|
import { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession, discoverAuthStorage } from "./sdk";
|
|
13
19
|
import type { AgentSession } from "./session/agent-session";
|
|
14
20
|
import type { AuthStorage } from "./session/auth-storage";
|
|
15
|
-
import { SessionManager } from "./session/session-manager";
|
|
21
|
+
import { type ResumeSessionIdentity, type SessionInfo, SessionManager, type StrictSessionOpenResult } from "./session/session-manager";
|
|
22
|
+
import { runStartupCredentialAutoImportIfNeeded } from "./setup/credential-auto-import";
|
|
23
|
+
import type { LspStartupServerInfo } from "./tools";
|
|
24
|
+
import type { EventBus } from "./utils/event-bus";
|
|
25
|
+
export type StartupUpdateRoute = "interactive" | "print" | "text" | "json" | "rpc" | "rpc-ui" | "acp" | "bridge";
|
|
26
|
+
export declare function classifyStartupUpdateRoute(parsed: Pick<Args, "print" | "mode">, autoPrint: boolean): StartupUpdateRoute;
|
|
27
|
+
/** Coordinates the non-blocking update check around the interactive UI lifecycle. */
|
|
28
|
+
export declare class StartupUpdateOrchestrator {
|
|
29
|
+
#private;
|
|
30
|
+
constructor(route: StartupUpdateRoute, enabled: () => boolean, check: () => Promise<string | undefined>);
|
|
31
|
+
startBeforeInteractiveInitialization(): void;
|
|
32
|
+
attachAfterInteractiveInitialization(notify: (version: string) => void): void;
|
|
33
|
+
}
|
|
34
|
+
export interface StartupUpdateInteractiveMode {
|
|
35
|
+
init: () => Promise<void>;
|
|
36
|
+
showNewVersionNotification: (version: string) => void;
|
|
37
|
+
}
|
|
38
|
+
export declare function initializeInteractiveModeWithStartupUpdate(mode: StartupUpdateInteractiveMode, startupUpdate: StartupUpdateOrchestrator): Promise<void>;
|
|
39
|
+
declare function readPipedInput(): Promise<string | undefined>;
|
|
16
40
|
export interface InteractiveModeNotify {
|
|
17
41
|
kind: "warn" | "error" | "info";
|
|
18
42
|
message: string;
|
|
@@ -52,6 +76,25 @@ export declare function applyStartupModelProfilesOrExit(args: Parameters<typeof
|
|
|
52
76
|
* tool registry and shadow the client-supplied servers (issue #1234).
|
|
53
77
|
*/
|
|
54
78
|
export declare function createAcpSessionFactory(args: AcpSessionFactoryOptions): AcpSessionFactory;
|
|
79
|
+
interface InteractiveModeFactoryOptions {
|
|
80
|
+
session: AgentSession;
|
|
81
|
+
version: string;
|
|
82
|
+
changelogMarkdown: string | undefined;
|
|
83
|
+
setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void;
|
|
84
|
+
lspServers: LspStartupServerInfo[] | undefined;
|
|
85
|
+
mcpManager: MCPManager | undefined;
|
|
86
|
+
eventBus?: EventBus;
|
|
87
|
+
}
|
|
88
|
+
type CreateInteractiveMode = (options: InteractiveModeFactoryOptions) => InteractiveMode;
|
|
89
|
+
type ResumePickerTerminalCheck = () => boolean;
|
|
90
|
+
type ListForResumePickerReadOnly = (cwd: string, sessionDir?: string) => Promise<SessionInfo[]>;
|
|
91
|
+
type SelectResumeSession = (sessions: SessionInfo[]) => Promise<SessionSelectionResult>;
|
|
92
|
+
type OpenExistingSessionStrict = (identity: ResumeSessionIdentity, sessionDir?: string) => Promise<StrictSessionOpenResult>;
|
|
93
|
+
export declare const BARE_RESUME_CONFLICT_ERROR = "--resume without a session cannot be combined with --continue, --fork, or --no-session.";
|
|
94
|
+
export declare const BARE_RESUME_INTERACTIVE_ERROR = "--resume requires an interactive terminal; use --resume <id>.";
|
|
95
|
+
export declare const BARE_RESUME_OPEN_ERROR = "Could not open the selected session. Use --resume <id>.";
|
|
96
|
+
export declare function runInteractiveMode(session: AgentSession, version: string, changelogMarkdown: string | undefined, notifs: (InteractiveModeNotify | null)[], startupUpdate: StartupUpdateOrchestrator, initialMessages: string[], setExtensionUIContext: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers: LspStartupServerInfo[] | undefined, mcpManager: MCPManager | undefined, eventBus?: EventBus, initialMessage?: string, initialImages?: ImageContent[], createInteractiveMode?: CreateInteractiveMode, resumeAction?: "continue-tail" | "open-idle"): Promise<void>;
|
|
97
|
+
declare function getChangelogForDisplay(parsed: Args): Promise<string | undefined>;
|
|
55
98
|
export declare function createSessionManager(parsed: Args, cwd: string, activeSettings?: Settings): Promise<SessionManager | undefined>;
|
|
56
99
|
/**
|
|
57
100
|
* Research-mode (RLM) preset hook. Lets `gjc rlm` augment the session options
|
|
@@ -62,13 +105,34 @@ export interface RlmPreset {
|
|
|
62
105
|
applyOptions: (options: CreateAgentSessionOptions, settings: Settings) => void;
|
|
63
106
|
onSessionCreated?: (session: AgentSession) => void | Promise<void>;
|
|
64
107
|
}
|
|
65
|
-
|
|
108
|
+
type RunRpcMode = (session: AgentSession, setToolUIContext?: CreateAgentSessionResult["setToolUIContext"], options?: {
|
|
109
|
+
listen?: string;
|
|
110
|
+
}) => Promise<void>;
|
|
111
|
+
type RunBridgeMode = (session: AgentSession, setToolUIContext?: CreateAgentSessionResult["setToolUIContext"]) => Promise<void>;
|
|
112
|
+
type RunPrintMode = (session: AgentSession, options: PrintModeOptions) => Promise<void>;
|
|
113
|
+
export interface RunRootCommandDependencies {
|
|
66
114
|
createAgentSession?: typeof createAgentSession;
|
|
67
115
|
discoverAuthStorage?: typeof discoverAuthStorage;
|
|
68
116
|
runAcpMode?: (createSession: AcpSessionFactory) => Promise<void>;
|
|
69
117
|
settings?: Settings;
|
|
70
118
|
rlmPreset?: RlmPreset;
|
|
71
119
|
suppressProcessExit?: boolean;
|
|
120
|
+
startupUpdate?: {
|
|
121
|
+
check: () => Promise<string | undefined>;
|
|
122
|
+
};
|
|
123
|
+
initTheme?: typeof initTheme;
|
|
124
|
+
readPipedInput?: typeof readPipedInput;
|
|
125
|
+
runStartupCredentialAutoImportIfNeeded?: typeof runStartupCredentialAutoImportIfNeeded;
|
|
126
|
+
getChangelogForDisplay?: typeof getChangelogForDisplay;
|
|
127
|
+
runRpcMode?: RunRpcMode;
|
|
128
|
+
runBridgeMode?: RunBridgeMode;
|
|
129
|
+
createInteractiveMode?: CreateInteractiveMode;
|
|
130
|
+
runPrintMode?: RunPrintMode;
|
|
131
|
+
isResumePickerTerminal?: ResumePickerTerminalCheck;
|
|
132
|
+
listForResumePickerReadOnly?: ListForResumePickerReadOnly;
|
|
133
|
+
selectResumeSession?: SelectResumeSession;
|
|
134
|
+
openExistingSessionStrict?: OpenExistingSessionStrict;
|
|
135
|
+
initializeSettings?: typeof Settings.init;
|
|
72
136
|
}
|
|
73
137
|
export declare function runRootCommand(parsed: Args, rawArgs: string[], deps?: RunRootCommandDependencies): Promise<void>;
|
|
74
138
|
export declare function main(args: string[]): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Agent, type AgentSideConnection, type AuthenticateRequest, type AuthenticateResponse, type ClientCapabilities, type CloseSessionRequest, type CloseSessionResponse, type ForkSessionRequest, type ForkSessionResponse, type InitializeRequest, type InitializeResponse, type ListSessionsRequest, type ListSessionsResponse, type LoadSessionRequest, type LoadSessionResponse, type NewSessionRequest, type NewSessionResponse, type PromptRequest, type PromptResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type
|
|
1
|
+
import { type Agent, type AgentSideConnection, type AuthenticateRequest, type AuthenticateResponse, type ClientCapabilities, type CloseSessionRequest, type CloseSessionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type ForkSessionRequest, type ForkSessionResponse, type InitializeRequest, type InitializeResponse, type ListSessionsRequest, type ListSessionsResponse, type LoadSessionRequest, type LoadSessionResponse, type NewSessionRequest, type NewSessionResponse, type PromptRequest, type PromptResponse, type ResumeSessionRequest, type ResumeSessionResponse, type SetSessionConfigOptionRequest, type SetSessionConfigOptionResponse, type SetSessionModeRequest, type SetSessionModeResponse } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { ExtensionUIContext } from "../../extensibility/extensions";
|
|
3
3
|
import type { AgentSession } from "../../session/agent-session";
|
|
4
4
|
/**
|
|
@@ -40,9 +40,20 @@ export declare class AcpAgent implements Agent {
|
|
|
40
40
|
resumeSession(params: ResumeSessionRequest): Promise<ResumeSessionResponse>;
|
|
41
41
|
unstable_forkSession(params: ForkSessionRequest): Promise<ForkSessionResponse>;
|
|
42
42
|
closeSession(params: CloseSessionRequest): Promise<CloseSessionResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* Hard delete an ACP session. `DeleteSessionRequest` carries only `sessionId`;
|
|
45
|
+
* the server owns authorization through the immutable canonical cwd scope and
|
|
46
|
+
* the complete strict scoped inventory snapshot.
|
|
47
|
+
*
|
|
48
|
+
* - No scope / unknown / already-deleted id → lookup-free `{}`.
|
|
49
|
+
* - Duplicate/conflict id → visible error; neither transcript nor artifacts change.
|
|
50
|
+
* - Active session → reserve `deleting`, drain/cancel prompt, flush, strict
|
|
51
|
+
* dispose/close, recheck identity/state, then verified artifact-first deletion.
|
|
52
|
+
* - Concurrent delete callers join the terminal promise.
|
|
53
|
+
*/
|
|
54
|
+
deleteSession(params: DeleteSessionRequest): Promise<DeleteSessionResponse>;
|
|
43
55
|
setSessionMode(params: SetSessionModeRequest): Promise<SetSessionModeResponse>;
|
|
44
56
|
setSessionConfigOption(params: SetSessionConfigOptionRequest): Promise<SetSessionConfigOptionResponse>;
|
|
45
|
-
unstable_setSessionModel(params: SetSessionModelRequest): Promise<SetSessionModelResponse>;
|
|
46
57
|
prompt(params: PromptRequest): Promise<PromptResponse>;
|
|
47
58
|
cancel(params: {
|
|
48
59
|
sessionId: string;
|
|
@@ -57,5 +68,11 @@ export declare class AcpAgent implements Agent {
|
|
|
57
68
|
}): Promise<void>;
|
|
58
69
|
get signal(): AbortSignal;
|
|
59
70
|
get closed(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Connection-local shutdown promise. Resolves once all terminal work (dispose,
|
|
73
|
+
* active deletes, abort cleanup) has settled. `acp-mode.ts` awaits this after
|
|
74
|
+
* transport closure so `process.exit` never kills in-flight deletion/disposal.
|
|
75
|
+
*/
|
|
76
|
+
get shutdownPromise(): Promise<void>;
|
|
60
77
|
}
|
|
61
78
|
export {};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { AgentSideConnection, type Stream } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { AgentSession } from "../../session/agent-session";
|
|
3
|
+
import { AcpAgent } from "./acp-agent";
|
|
3
4
|
export type AcpSessionFactory = (cwd: string) => Promise<AgentSession>;
|
|
5
|
+
export interface AcpConnectionHandle {
|
|
6
|
+
connection: AgentSideConnection;
|
|
7
|
+
agent: AcpAgent;
|
|
8
|
+
}
|
|
4
9
|
export declare function createAcpConnection(transport: Stream, createSession: AcpSessionFactory, initialSession?: AgentSession): AgentSideConnection;
|
|
10
|
+
/**
|
|
11
|
+
* Create an ACP connection and return both the {@link AgentSideConnection} and the
|
|
12
|
+
* underlying {@link AcpAgent}. Callers that need to await agent shutdown (terminal
|
|
13
|
+
* delete/dispose work) after transport closure should use this instead of
|
|
14
|
+
* {@link createAcpConnection}.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAcpConnectionWithAgent(transport: Stream, createSession: AcpSessionFactory, initialSession?: AgentSession): AcpConnectionHandle;
|
|
5
17
|
export declare function runAcpMode(createSession: AcpSessionFactory, initialSession?: AgentSession): Promise<never>;
|
|
@@ -10,7 +10,7 @@ export declare class AssistantMessageComponent extends Container {
|
|
|
10
10
|
#private;
|
|
11
11
|
private hideThinkingBlock;
|
|
12
12
|
private readonly onImageUpdate?;
|
|
13
|
-
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, onImageUpdate?: (() => void) | undefined);
|
|
13
|
+
constructor(message?: AssistantMessage, hideThinkingBlock?: boolean, onImageUpdate?: (() => void) | undefined, viewportAnchorId?: string);
|
|
14
14
|
invalidate(): void;
|
|
15
15
|
setHideThinkingBlock(hide: boolean): void;
|
|
16
16
|
setToolResultImages(toolCallId: string, images: ImageContent[]): void;
|
|
@@ -49,6 +49,8 @@ export declare class CustomEditor extends Editor {
|
|
|
49
49
|
/** Called before regular composer input should return the transcript viewport to the live bottom. */
|
|
50
50
|
onViewportFollowLive?: () => void;
|
|
51
51
|
setActionKeys(action: ConfigurableEditorAction, keys: KeyId[]): void;
|
|
52
|
+
/** Returns whether a built-in editor action consumes this configured key before custom handlers. */
|
|
53
|
+
hasActionKey(key: KeyId): boolean;
|
|
52
54
|
/**
|
|
53
55
|
* Register a custom key handler. Extensions use this for shortcuts.
|
|
54
56
|
*/
|