@gajae-code/coding-agent 0.2.5 → 0.3.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 +28 -0
- package/dist/types/async/job-manager.d.ts +91 -2
- package/dist/types/cli/args.d.ts +1 -1
- package/dist/types/commands/deep-interview.d.ts +3 -0
- package/dist/types/commands/harness.d.ts +37 -0
- package/dist/types/config/keybindings.d.ts +5 -0
- package/dist/types/config/settings-schema.d.ts +10 -4
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/debug/crash-diagnostics.d.ts +45 -0
- package/dist/types/debug/runtime-gauges.d.ts +6 -0
- package/dist/types/deep-interview/render-middleware.d.ts +6 -0
- package/dist/types/eval/py/executor.d.ts +2 -0
- package/dist/types/eval/py/kernel.d.ts +2 -0
- package/dist/types/exec/bash-executor.d.ts +10 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +1 -0
- package/dist/types/extensibility/extensions/types.d.ts +6 -0
- package/dist/types/extensibility/shared-events.d.ts +1 -0
- package/dist/types/gjc-runtime/cli-write-receipt.d.ts +24 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +1 -0
- package/dist/types/gjc-runtime/state-graph.d.ts +4 -0
- package/dist/types/gjc-runtime/state-migrations.d.ts +33 -0
- package/dist/types/gjc-runtime/state-renderer.d.ts +65 -0
- package/dist/types/gjc-runtime/state-runtime.d.ts +2 -0
- package/dist/types/gjc-runtime/state-schema.d.ts +317 -0
- package/dist/types/gjc-runtime/state-validation.d.ts +6 -0
- package/dist/types/gjc-runtime/state-writer.d.ts +147 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +81 -7
- package/dist/types/gjc-runtime/workflow-command-ref.d.ts +43 -0
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +54 -0
- package/dist/types/harness-control-plane/classifier.d.ts +13 -0
- package/dist/types/harness-control-plane/control-endpoint.d.ts +31 -0
- package/dist/types/harness-control-plane/finalize.d.ts +47 -0
- package/dist/types/harness-control-plane/frame-mapper.d.ts +29 -0
- package/dist/types/harness-control-plane/operate.d.ts +35 -0
- package/dist/types/harness-control-plane/owner.d.ts +46 -0
- package/dist/types/harness-control-plane/preserve.d.ts +19 -0
- package/dist/types/harness-control-plane/receipts.d.ts +88 -0
- package/dist/types/harness-control-plane/rpc-adapter.d.ts +66 -0
- package/dist/types/harness-control-plane/seams.d.ts +21 -0
- package/dist/types/harness-control-plane/session-lease.d.ts +65 -0
- package/dist/types/harness-control-plane/state-machine.d.ts +19 -0
- package/dist/types/harness-control-plane/storage.d.ts +53 -0
- package/dist/types/harness-control-plane/types.d.ts +162 -0
- package/dist/types/hooks/skill-keywords.d.ts +2 -1
- package/dist/types/hooks/skill-state.d.ts +23 -29
- package/dist/types/internal-urls/agent-protocol.d.ts +2 -2
- package/dist/types/internal-urls/artifact-protocol.d.ts +2 -2
- package/dist/types/internal-urls/registry-helpers.d.ts +8 -7
- package/dist/types/internal-urls/types.d.ts +4 -0
- package/dist/types/lsp/index.d.ts +10 -10
- package/dist/types/modes/bridge/auth.d.ts +12 -0
- package/dist/types/modes/bridge/bridge-client-bridge.d.ts +9 -0
- package/dist/types/modes/bridge/bridge-mode.d.ts +44 -0
- package/dist/types/modes/bridge/bridge-ui-context.d.ts +88 -0
- package/dist/types/modes/bridge/event-stream.d.ts +8 -0
- package/dist/types/modes/components/custom-editor.d.ts +6 -0
- package/dist/types/modes/components/hook-selector.d.ts +1 -0
- package/dist/types/modes/components/jobs-overlay-model.d.ts +31 -0
- package/dist/types/modes/components/jobs-overlay.d.ts +30 -0
- package/dist/types/modes/components/status-line/types.d.ts +2 -0
- package/dist/types/modes/components/status-line.d.ts +2 -0
- package/dist/types/modes/controllers/input-controller.d.ts +1 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +8 -0
- package/dist/types/modes/index.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +2 -0
- package/dist/types/modes/jobs-observer.d.ts +57 -0
- package/dist/types/modes/rpc/host-tools.d.ts +1 -16
- package/dist/types/modes/rpc/host-uris.d.ts +1 -38
- package/dist/types/modes/shared/agent-wire/command-dispatch.d.ts +20 -0
- package/dist/types/modes/shared/agent-wire/command-validation.d.ts +2 -0
- package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +24 -0
- package/dist/types/modes/shared/agent-wire/handshake.d.ts +46 -0
- package/dist/types/modes/shared/agent-wire/host-tool-bridge.d.ts +16 -0
- package/dist/types/modes/shared/agent-wire/host-uri-bridge.d.ts +17 -0
- package/dist/types/modes/shared/agent-wire/protocol.d.ts +44 -0
- package/dist/types/modes/shared/agent-wire/responses.d.ts +4 -0
- package/dist/types/modes/shared/agent-wire/scopes.d.ts +18 -0
- package/dist/types/modes/shared/agent-wire/ui-request-broker.d.ts +42 -0
- package/dist/types/modes/shared/agent-wire/ui-result.d.ts +27 -0
- package/dist/types/modes/types.d.ts +2 -0
- package/dist/types/sdk.d.ts +4 -0
- package/dist/types/session/agent-session.d.ts +19 -1
- package/dist/types/skill-state/active-state.d.ts +2 -0
- package/dist/types/skill-state/deep-interview-mutation-guard.d.ts +1 -1
- package/dist/types/skill-state/workflow-state-contract.d.ts +25 -2
- package/dist/types/skill-state/workflow-state-version.d.ts +3 -0
- package/dist/types/task/executor.d.ts +3 -0
- package/dist/types/task/id.d.ts +7 -0
- package/dist/types/task/index.d.ts +5 -0
- package/dist/types/task/receipt.d.ts +85 -0
- package/dist/types/task/spawn-gate.d.ts +38 -0
- package/dist/types/task/types.d.ts +198 -14
- package/dist/types/tools/cron.d.ts +6 -0
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/subagent.d.ts +26 -1
- package/package.json +7 -7
- package/scripts/build-binary.ts +7 -0
- package/src/async/job-manager.ts +334 -6
- package/src/cli/args.ts +9 -2
- package/src/cli/auth-broker-cli.ts +1 -0
- package/src/cli/config-cli.ts +10 -2
- package/src/cli.ts +2 -0
- package/src/commands/deep-interview.ts +1 -0
- package/src/commands/harness.ts +862 -0
- package/src/commands/launch.ts +2 -2
- package/src/commands/state.ts +2 -1
- package/src/commands/team.ts +54 -39
- package/src/config/keybindings.ts +6 -0
- package/src/config/settings-schema.ts +13 -3
- package/src/config/settings.ts +5 -0
- package/src/dap/client.ts +17 -3
- package/src/debug/crash-diagnostics.ts +223 -0
- package/src/debug/runtime-gauges.ts +20 -0
- package/src/deep-interview/render-middleware.ts +372 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -1
- package/src/defaults/gjc/skills/ralplan/SKILL.md +31 -2
- package/src/defaults/gjc/skills/team/SKILL.md +47 -21
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +106 -13
- package/src/eval/py/executor.ts +21 -1
- package/src/eval/py/kernel.ts +15 -0
- package/src/exec/bash-executor.ts +41 -0
- package/src/extensibility/custom-tools/types.ts +1 -0
- package/src/extensibility/extensions/types.ts +6 -0
- package/src/extensibility/shared-events.ts +1 -0
- package/src/gjc-runtime/cli-write-receipt.ts +31 -0
- package/src/gjc-runtime/deep-interview-runtime.ts +98 -42
- package/src/gjc-runtime/goal-mode-request.ts +11 -3
- package/src/gjc-runtime/ralplan-runtime.ts +235 -43
- package/src/gjc-runtime/state-graph.ts +86 -0
- package/src/gjc-runtime/state-migrations.ts +179 -0
- package/src/gjc-runtime/state-renderer.ts +345 -0
- package/src/gjc-runtime/state-runtime.ts +1155 -46
- package/src/gjc-runtime/state-schema.ts +192 -0
- package/src/gjc-runtime/state-validation.ts +49 -0
- package/src/gjc-runtime/state-writer.ts +749 -0
- package/src/gjc-runtime/team-runtime.ts +1255 -189
- package/src/gjc-runtime/ultragoal-runtime.ts +460 -43
- package/src/gjc-runtime/workflow-command-ref.ts +239 -0
- package/src/gjc-runtime/workflow-manifest.generated.json +1601 -0
- package/src/gjc-runtime/workflow-manifest.ts +427 -0
- package/src/harness-control-plane/classifier.ts +128 -0
- package/src/harness-control-plane/control-endpoint.ts +148 -0
- package/src/harness-control-plane/finalize.ts +222 -0
- package/src/harness-control-plane/frame-mapper.ts +286 -0
- package/src/harness-control-plane/operate.ts +225 -0
- package/src/harness-control-plane/owner.ts +600 -0
- package/src/harness-control-plane/preserve.ts +102 -0
- package/src/harness-control-plane/receipts.ts +216 -0
- package/src/harness-control-plane/rpc-adapter.ts +276 -0
- package/src/harness-control-plane/seams.ts +39 -0
- package/src/harness-control-plane/session-lease.ts +388 -0
- package/src/harness-control-plane/state-machine.ts +98 -0
- package/src/harness-control-plane/storage.ts +257 -0
- package/src/harness-control-plane/types.ts +214 -0
- package/src/hooks/skill-keywords.ts +4 -2
- package/src/hooks/skill-state.ts +197 -64
- package/src/internal-urls/agent-protocol.ts +68 -21
- package/src/internal-urls/artifact-protocol.ts +12 -17
- package/src/internal-urls/docs-index.generated.ts +3 -2
- package/src/internal-urls/registry-helpers.ts +19 -16
- package/src/internal-urls/types.ts +4 -0
- package/src/lsp/client.ts +18 -2
- package/src/main.ts +21 -5
- package/src/modes/bridge/auth.ts +41 -0
- package/src/modes/bridge/bridge-client-bridge.ts +47 -0
- package/src/modes/bridge/bridge-mode.ts +520 -0
- package/src/modes/bridge/bridge-ui-context.ts +200 -0
- package/src/modes/bridge/event-stream.ts +70 -0
- package/src/modes/components/assistant-message.ts +5 -1
- package/src/modes/components/custom-editor.ts +101 -0
- package/src/modes/components/hook-selector.ts +133 -20
- package/src/modes/components/jobs-overlay-model.ts +109 -0
- package/src/modes/components/jobs-overlay.ts +172 -0
- package/src/modes/components/status-line/presets.ts +7 -5
- package/src/modes/components/status-line/segments.ts +25 -0
- package/src/modes/components/status-line/types.ts +2 -0
- package/src/modes/components/status-line.ts +9 -1
- package/src/modes/controllers/event-controller.ts +71 -6
- package/src/modes/controllers/extension-ui-controller.ts +43 -1
- package/src/modes/controllers/input-controller.ts +105 -9
- package/src/modes/controllers/selector-controller.ts +31 -1
- package/src/modes/index.ts +1 -0
- package/src/modes/interactive-mode.ts +28 -0
- package/src/modes/jobs-observer.ts +204 -0
- package/src/modes/rpc/host-tools.ts +1 -186
- package/src/modes/rpc/host-uris.ts +1 -235
- package/src/modes/rpc/rpc-client.ts +25 -10
- package/src/modes/rpc/rpc-mode.ts +12 -381
- package/src/modes/shared/agent-wire/command-dispatch.ts +341 -0
- package/src/modes/shared/agent-wire/command-validation.ts +131 -0
- package/src/modes/shared/agent-wire/event-envelope.ts +108 -0
- package/src/modes/shared/agent-wire/handshake.ts +117 -0
- package/src/modes/shared/agent-wire/host-tool-bridge.ts +194 -0
- package/src/modes/shared/agent-wire/host-uri-bridge.ts +236 -0
- package/src/modes/shared/agent-wire/protocol.ts +96 -0
- package/src/modes/shared/agent-wire/responses.ts +17 -0
- package/src/modes/shared/agent-wire/scopes.ts +89 -0
- package/src/modes/shared/agent-wire/ui-request-broker.ts +150 -0
- package/src/modes/shared/agent-wire/ui-result.ts +48 -0
- package/src/modes/types.ts +2 -0
- package/src/prompts/agents/executor.md +13 -0
- package/src/prompts/tools/subagent.md +39 -4
- package/src/prompts/tools/task-summary.md +3 -9
- package/src/prompts/tools/task.md +5 -1
- package/src/sdk.ts +8 -0
- package/src/session/agent-session.ts +445 -71
- package/src/session/session-manager.ts +13 -1
- package/src/skill-state/active-state.ts +58 -65
- package/src/skill-state/deep-interview-mutation-guard.ts +114 -17
- package/src/skill-state/initial-phase.ts +2 -0
- package/src/skill-state/workflow-state-contract.ts +33 -4
- package/src/skill-state/workflow-state-version.ts +3 -0
- package/src/slash-commands/builtin-registry.ts +8 -0
- package/src/task/executor.ts +79 -13
- package/src/task/id.ts +33 -0
- package/src/task/index.ts +376 -74
- package/src/task/output-manager.ts +5 -4
- package/src/task/receipt.ts +297 -0
- package/src/task/render.ts +54 -134
- package/src/task/spawn-gate.ts +132 -0
- package/src/task/types.ts +104 -10
- package/src/tools/ask.ts +88 -27
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/bash.ts +1 -1
- package/src/tools/cron.ts +48 -0
- package/src/tools/find.ts +4 -1
- package/src/tools/index.ts +2 -0
- package/src/tools/path-utils.ts +3 -2
- package/src/tools/read.ts +1 -0
- package/src/tools/search.ts +1 -0
- package/src/tools/skill.ts +6 -1
- package/src/tools/subagent.ts +423 -79
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Component } from "@gajae-code/tui";
|
|
2
2
|
import type { InteractiveModeContext } from "../../modes/types";
|
|
3
|
+
import type { JobsObserver } from "../jobs-observer";
|
|
3
4
|
import type { SessionObserverRegistry } from "../session-observer-registry";
|
|
4
5
|
export declare class SelectorController {
|
|
5
6
|
#private;
|
|
@@ -44,4 +45,11 @@ export declare class SelectorController {
|
|
|
44
45
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
45
46
|
showDebugSelector(): void;
|
|
46
47
|
showSessionObserver(registry: SessionObserverRegistry): void;
|
|
48
|
+
/**
|
|
49
|
+
* Jobs overlay: navigate ongoing monitor + cron jobs (Monitors then Crons,
|
|
50
|
+
* newest-first), drill into per-type detail, and cancel/delete with a y/N
|
|
51
|
+
* confirm. Built from nested SelectLists (list -> detail -> confirm) so focus
|
|
52
|
+
* stays on the active SelectList.
|
|
53
|
+
*/
|
|
54
|
+
showJobsOverlay(observer: JobsObserver): void;
|
|
47
55
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Run modes for the coding agent.
|
|
3
3
|
*/
|
|
4
4
|
export { runAcpMode } from "./acp";
|
|
5
|
+
export { runBridgeMode } from "./bridge/bridge-mode";
|
|
5
6
|
export { InteractiveMode, type InteractiveModeOptions } from "./interactive-mode";
|
|
6
7
|
export { type PrintModeOptions, runPrintMode } from "./print-mode";
|
|
7
8
|
export { defineRpcClientTool, type ModelInfo, RpcClient, type RpcClientCustomTool, type RpcClientOptions, type RpcClientToolContext, type RpcClientToolResult, type RpcEventListener, } from "./rpc/rpc-client";
|
|
@@ -86,6 +86,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
86
86
|
retryLoader: Loader | undefined;
|
|
87
87
|
autoCompactionEscapeHandler?: () => void;
|
|
88
88
|
retryEscapeHandler?: () => void;
|
|
89
|
+
retryCountdownTimer?: ReturnType<typeof setInterval>;
|
|
89
90
|
unsubscribe?: () => void;
|
|
90
91
|
onInputCallback?: (input: SubmittedUserInput) => void;
|
|
91
92
|
optimisticUserMessageSignature: string | undefined;
|
|
@@ -190,6 +191,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
190
191
|
handleSTTToggle(): Promise<void>;
|
|
191
192
|
showDebugSelector(): void;
|
|
192
193
|
showSessionObserver(): void;
|
|
194
|
+
showJobsOverlay(): void;
|
|
193
195
|
resetObserverRegistry(): void;
|
|
194
196
|
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
195
197
|
handlePythonCommand(code: string, excludeFromContext?: boolean): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JobsObserver
|
|
3
|
+
*
|
|
4
|
+
* Single, event-driven aggregator over the two background-work sources surfaced
|
|
5
|
+
* by the status-line jobs widget and the jobs overlay:
|
|
6
|
+
* - monitor jobs (bash jobs started by the `monitor` tool, tracked in `AsyncJobManager`)
|
|
7
|
+
* - cron jobs (tracked in the cron module's owner-scoped schedule store)
|
|
8
|
+
*
|
|
9
|
+
* It subscribes to change hooks on both sources (no polling), debounces bursts
|
|
10
|
+
* to a microtask, and exposes a precomputed snapshot so the status-line render
|
|
11
|
+
* loop never scans the underlying stores. A failure latch keeps the widget red
|
|
12
|
+
* until `acknowledgeFailures()` is called (when the overlay opens), so a failed
|
|
13
|
+
* job that evicts before the user looks is not silently lost.
|
|
14
|
+
*/
|
|
15
|
+
import type { AsyncJob, AsyncJobManager } from "../async";
|
|
16
|
+
export type JobsWorstState = "none" | "running" | "failed";
|
|
17
|
+
export interface MonitorJobView {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
status: AsyncJob["status"];
|
|
21
|
+
startTime: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CronJobView {
|
|
24
|
+
id: string;
|
|
25
|
+
humanSchedule: string;
|
|
26
|
+
cronExpression: string;
|
|
27
|
+
prompt: string;
|
|
28
|
+
recurring: boolean;
|
|
29
|
+
nextFireAt?: number;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
}
|
|
32
|
+
export interface JobsSnapshot {
|
|
33
|
+
monitors: MonitorJobView[];
|
|
34
|
+
crons: CronJobView[];
|
|
35
|
+
activeMonitorCount: number;
|
|
36
|
+
activeCronCount: number;
|
|
37
|
+
worstState: JobsWorstState;
|
|
38
|
+
failedUnacknowledged: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const EMPTY_JOBS_SNAPSHOT: JobsSnapshot;
|
|
41
|
+
export declare class JobsObserver {
|
|
42
|
+
#private;
|
|
43
|
+
constructor(manager: AsyncJobManager, ownerId: string | undefined);
|
|
44
|
+
/** Subscribe to debounced change events. Returns an unsubscribe function. */
|
|
45
|
+
onChange(cb: () => void): () => void;
|
|
46
|
+
/** Return the precomputed snapshot (recomputed on each upstream change). */
|
|
47
|
+
getSnapshot(): JobsSnapshot;
|
|
48
|
+
/** Clear the failure latch (called when the user opens the jobs overlay). */
|
|
49
|
+
acknowledgeFailures(): void;
|
|
50
|
+
/** Cancel a running monitor job. Returns true when the job was cancelled. */
|
|
51
|
+
cancelMonitor(id: string): boolean;
|
|
52
|
+
/** Delete a visible scheduled cron job. Returns true when removed. */
|
|
53
|
+
deleteCron(id: string): boolean;
|
|
54
|
+
/** Bounded tail of a monitor job's captured output (for the detail view). */
|
|
55
|
+
getMonitorOutput(id: string): string;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { RpcHostToolCallRequest, RpcHostToolCancelRequest, RpcHostToolDefinition, RpcHostToolResult, RpcHostToolUpdate } from "./rpc-types";
|
|
3
|
-
type RpcHostToolOutput = (frame: RpcHostToolCallRequest | RpcHostToolCancelRequest) => void;
|
|
4
|
-
export declare function isRpcHostToolResult(value: unknown): value is RpcHostToolResult;
|
|
5
|
-
export declare function isRpcHostToolUpdate(value: unknown): value is RpcHostToolUpdate;
|
|
6
|
-
export declare class RpcHostToolBridge {
|
|
7
|
-
#private;
|
|
8
|
-
constructor(output: RpcHostToolOutput);
|
|
9
|
-
getToolNames(): string[];
|
|
10
|
-
setTools(tools: RpcHostToolDefinition[]): AgentTool[];
|
|
11
|
-
handleResult(frame: RpcHostToolResult): boolean;
|
|
12
|
-
handleUpdate(frame: RpcHostToolUpdate): boolean;
|
|
13
|
-
requestExecution(definition: RpcHostToolDefinition, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<unknown>): Promise<AgentToolResult<unknown>>;
|
|
14
|
-
rejectAllPending(message: string): void;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
1
|
+
export * from "../shared/agent-wire/host-tool-bridge";
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { InternalResource, InternalUrl, ResolveContext, WriteContext } from "../../internal-urls/types";
|
|
3
|
-
import type { RpcHostUriCancelRequest, RpcHostUriRequest, RpcHostUriResult, RpcHostUriSchemeDefinition } from "./rpc-types";
|
|
4
|
-
type RpcHostUriOutput = (frame: RpcHostUriRequest | RpcHostUriCancelRequest) => void;
|
|
5
|
-
/** Type guard for inbound `host_uri_result` frames coming from the host. */
|
|
6
|
-
export declare function isRpcHostUriResult(value: unknown): value is RpcHostUriResult;
|
|
7
|
-
/**
|
|
8
|
-
* Bidirectional bridge that lets the RPC host own a set of URI schemes.
|
|
9
|
-
*
|
|
10
|
-
* The host registers schemes via `set_host_uri_schemes`; the bridge installs
|
|
11
|
-
* a `RpcHostUriProtocolHandler` per scheme into the process-global
|
|
12
|
-
* {@link InternalUrlRouter}. Reads land on the read tool through the existing
|
|
13
|
-
* router; writes are intercepted by the write tool and dispatched through
|
|
14
|
-
* `requestWrite`.
|
|
15
|
-
*/
|
|
16
|
-
export declare class RpcHostUriBridge {
|
|
17
|
-
#private;
|
|
18
|
-
constructor(output: RpcHostUriOutput, router?: InternalUrlRouter);
|
|
19
|
-
getSchemes(): string[];
|
|
20
|
-
/**
|
|
21
|
-
* Replace the registered set of host URI schemes. Previously registered
|
|
22
|
-
* schemes that no longer appear in the new set are unregistered from the
|
|
23
|
-
* router; surviving and new schemes get fresh handler instances.
|
|
24
|
-
*/
|
|
25
|
-
setSchemes(schemes: RpcHostUriSchemeDefinition[]): string[];
|
|
26
|
-
/**
|
|
27
|
-
* Unregister every host scheme from the router and reject any in-flight
|
|
28
|
-
* requests. Called on RPC shutdown to keep the global router clean for
|
|
29
|
-
* subsequent sessions in the same process (used by tests).
|
|
30
|
-
*/
|
|
31
|
-
clear(message?: string): void;
|
|
32
|
-
/** Resolve a pending request by id; called by `rpc-mode` on inbound results. */
|
|
33
|
-
handleResult(frame: RpcHostUriResult): boolean;
|
|
34
|
-
rejectAllPending(message: string): void;
|
|
35
|
-
requestRead(scheme: string, url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
|
|
36
|
-
requestWrite(_scheme: string, url: InternalUrl, content: string, context?: WriteContext): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
1
|
+
export * from "../shared/agent-wire/host-uri-bridge";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentTool } from "@gajae-code/agent-core";
|
|
2
|
+
import type { ExtensionUIContext } from "../../../extensibility/extensions";
|
|
3
|
+
import type { AgentSession } from "../../../session/agent-session";
|
|
4
|
+
import type { RpcCommand, RpcExtensionUIRequest, RpcHostToolDefinition, RpcHostUriSchemeDefinition, RpcResponse } from "../../rpc/rpc-types";
|
|
5
|
+
export type RpcCommandDispatchOutput = (obj: RpcResponse | RpcExtensionUIRequest | object) => void;
|
|
6
|
+
export interface RpcHostToolRegistry {
|
|
7
|
+
setTools(tools: RpcHostToolDefinition[]): AgentTool[];
|
|
8
|
+
}
|
|
9
|
+
export interface RpcHostUriRegistry {
|
|
10
|
+
setSchemes(schemes: RpcHostUriSchemeDefinition[]): string[];
|
|
11
|
+
}
|
|
12
|
+
export interface RpcCommandDispatchContext {
|
|
13
|
+
session: AgentSession;
|
|
14
|
+
output: RpcCommandDispatchOutput;
|
|
15
|
+
hostToolRegistry: RpcHostToolRegistry;
|
|
16
|
+
hostUriRegistry: RpcHostUriRegistry;
|
|
17
|
+
createUiContext: () => Pick<ExtensionUIContext, "notify">;
|
|
18
|
+
}
|
|
19
|
+
export declare function normalizeHostToolDefinitions(tools: RpcHostToolDefinition[]): RpcHostToolDefinition[];
|
|
20
|
+
export declare function dispatchRpcCommand(command: RpcCommand, context: RpcCommandDispatchContext): Promise<RpcResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentSessionEvent } from "../../../session/agent-session";
|
|
2
|
+
import { type AgentSessionEventType, type BridgeEventFrame, type BridgeFrameEnvelope, type BridgeFrameType } from "./protocol";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the stable wire event-type for an `AgentSessionEvent`.
|
|
5
|
+
*
|
|
6
|
+
* Exhaustive over the union; adding a variant without a case is a type error.
|
|
7
|
+
*/
|
|
8
|
+
export declare function agentSessionEventType(event: AgentSessionEvent): AgentSessionEventType;
|
|
9
|
+
/**
|
|
10
|
+
* Per-session monotonic frame builder. One instance per active session; `seq`
|
|
11
|
+
* starts at 1 and increments per frame so clients can order and resume.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BridgeFrameSequencer {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(sessionId: string);
|
|
16
|
+
/** The session id stamped onto every frame this sequencer produces. */
|
|
17
|
+
get sessionId(): string;
|
|
18
|
+
/** The seq assigned to the most recently produced frame (0 before any). */
|
|
19
|
+
get lastSeq(): number;
|
|
20
|
+
/** Build the next envelope of the given type with a fresh seq + frame id. */
|
|
21
|
+
next<TType extends BridgeFrameType, TPayload>(type: TType, payload: TPayload, correlationId?: string): BridgeFrameEnvelope<TType, TPayload>;
|
|
22
|
+
}
|
|
23
|
+
/** Serialize a single `AgentSessionEvent` into an `event` wire frame. */
|
|
24
|
+
export declare function toBridgeEventFrame(event: AgentSessionEvent, sequencer: BridgeFrameSequencer): BridgeEventFrame;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BRIDGE_PROTOCOL_VERSION, type BridgeFrameType } from "./protocol";
|
|
2
|
+
import type { BridgeCommandScope } from "./scopes";
|
|
3
|
+
export type BridgeCapability = "events" | "prompt" | "permission" | "elicitation" | "ui.declarative" | "ui.editor" | "ui.terminal_input" | "host_tools" | "host_uri" | "client_bridge.read_text_file" | "client_bridge.write_text_file" | "client_bridge.create_terminal";
|
|
4
|
+
export interface BridgeProtocolRange {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
}
|
|
8
|
+
export interface BridgeHandshakeRequest {
|
|
9
|
+
protocol_version_range: BridgeProtocolRange;
|
|
10
|
+
capabilities: BridgeCapability[];
|
|
11
|
+
requested_scopes: BridgeCommandScope[];
|
|
12
|
+
last_seq?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface BridgeEndpointDescriptor {
|
|
15
|
+
events: string;
|
|
16
|
+
commands: string;
|
|
17
|
+
uiResponses: string;
|
|
18
|
+
claimControl: string;
|
|
19
|
+
disconnectControl: string;
|
|
20
|
+
hostToolResults: string;
|
|
21
|
+
hostUriResults: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BridgeHandshakeAccepted {
|
|
24
|
+
status: "accepted";
|
|
25
|
+
protocol_version: typeof BRIDGE_PROTOCOL_VERSION;
|
|
26
|
+
session_id: string;
|
|
27
|
+
accepted_capabilities: BridgeCapability[];
|
|
28
|
+
accepted_scopes: BridgeCommandScope[];
|
|
29
|
+
unsupported: BridgeCapability[];
|
|
30
|
+
endpoints: BridgeEndpointDescriptor;
|
|
31
|
+
frame_types: BridgeFrameType[];
|
|
32
|
+
}
|
|
33
|
+
export interface BridgeHandshakeRejected {
|
|
34
|
+
status: "rejected";
|
|
35
|
+
reason: "incompatible_version" | "unauthorized" | "invalid_request";
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export type BridgeHandshakeResponse = BridgeHandshakeAccepted | BridgeHandshakeRejected;
|
|
39
|
+
export declare function isBridgeHandshakeRequest(value: unknown): value is BridgeHandshakeRequest;
|
|
40
|
+
export declare function negotiateBridgeHandshake(request: BridgeHandshakeRequest, server: {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
capabilities: readonly BridgeCapability[];
|
|
43
|
+
scopes: readonly BridgeCommandScope[];
|
|
44
|
+
endpoints: BridgeEndpointDescriptor;
|
|
45
|
+
frameTypes: readonly BridgeFrameType[];
|
|
46
|
+
}): BridgeHandshakeResponse;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@gajae-code/agent-core";
|
|
2
|
+
import type { RpcHostToolCallRequest, RpcHostToolCancelRequest, RpcHostToolDefinition, RpcHostToolResult, RpcHostToolUpdate } from "../../rpc/rpc-types";
|
|
3
|
+
type RpcHostToolOutput = (frame: RpcHostToolCallRequest | RpcHostToolCancelRequest) => void;
|
|
4
|
+
export declare function isRpcHostToolResult(value: unknown): value is RpcHostToolResult;
|
|
5
|
+
export declare function isRpcHostToolUpdate(value: unknown): value is RpcHostToolUpdate;
|
|
6
|
+
export declare class RpcHostToolBridge {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(output: RpcHostToolOutput);
|
|
9
|
+
getToolNames(): string[];
|
|
10
|
+
setTools(tools: RpcHostToolDefinition[]): AgentTool[];
|
|
11
|
+
handleResult(frame: RpcHostToolResult): boolean;
|
|
12
|
+
handleUpdate(frame: RpcHostToolUpdate): boolean;
|
|
13
|
+
requestExecution(definition: RpcHostToolDefinition, toolCallId: string, args: Record<string, unknown>, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<unknown>): Promise<AgentToolResult<unknown>>;
|
|
14
|
+
rejectAllPending(message: string): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { InternalUrlRouter } from "../../../internal-urls";
|
|
2
|
+
import type { InternalResource, InternalUrl, ResolveContext, WriteContext } from "../../../internal-urls/types";
|
|
3
|
+
import type { RpcHostUriCancelRequest, RpcHostUriRequest, RpcHostUriResult, RpcHostUriSchemeDefinition } from "../../rpc/rpc-types";
|
|
4
|
+
type RpcHostUriOutput = (frame: RpcHostUriRequest | RpcHostUriCancelRequest) => void;
|
|
5
|
+
export declare function isRpcHostUriResult(value: unknown): value is RpcHostUriResult;
|
|
6
|
+
export declare class RpcHostUriBridge {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(output: RpcHostUriOutput, router?: InternalUrlRouter);
|
|
9
|
+
getSchemes(): string[];
|
|
10
|
+
setSchemes(schemes: RpcHostUriSchemeDefinition[]): string[];
|
|
11
|
+
clear(message?: string): void;
|
|
12
|
+
handleResult(frame: RpcHostUriResult): boolean;
|
|
13
|
+
rejectAllPending(message: string): void;
|
|
14
|
+
requestRead(scheme: string, url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
|
|
15
|
+
requestWrite(_scheme: string, url: InternalUrl, content: string, context?: WriteContext): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared agent-wire protocol primitives for GJC bridge surfaces.
|
|
3
|
+
*
|
|
4
|
+
* This module is the transport-agnostic, versioned frame contract that the
|
|
5
|
+
* RPC mode and the (in-progress) `--mode bridge` wiring site both build on.
|
|
6
|
+
* It carries the SEMANTIC agent surface — events, responses, and UI/permission
|
|
7
|
+
* requests — never pixels. See `.gjc/specs/deep-interview-gjc-backend-bridge.md`
|
|
8
|
+
* and `.gjc/plans/ralplan/gjc-backend-bridge/pending-approval.md`.
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentSessionEvent } from "../../../session/agent-session";
|
|
11
|
+
/** Wire protocol version. Bump on breaking envelope/semantic changes. */
|
|
12
|
+
export declare const BRIDGE_PROTOCOL_VERSION: 1;
|
|
13
|
+
/** The discriminant of every `AgentSessionEvent` the agent can emit. */
|
|
14
|
+
export type AgentSessionEventType = AgentSessionEvent["type"];
|
|
15
|
+
/** Every agent-session event type, derived from the exhaustive registry. */
|
|
16
|
+
export declare const AGENT_SESSION_EVENT_TYPES: readonly AgentSessionEventType[];
|
|
17
|
+
/** Top-level frame categories carried over any bridge transport. */
|
|
18
|
+
export type BridgeFrameType = "ready" | "event" | "response" | "ui_request" | "permission_request" | "host_tool_call" | "host_uri_request" | "reset" | "error";
|
|
19
|
+
/**
|
|
20
|
+
* Universal frame envelope. Every frame on every transport carries these
|
|
21
|
+
* fields so clients can order (`seq`), resume (`seq` cursor), and correlate
|
|
22
|
+
* request/response pairs (`correlation_id`). `session_id` is present from v1
|
|
23
|
+
* even though v1 runs one session per process, so in-process multiplexing is
|
|
24
|
+
* an additive, non-breaking change later.
|
|
25
|
+
*/
|
|
26
|
+
export interface BridgeFrameEnvelope<TType extends BridgeFrameType = BridgeFrameType, TPayload = unknown> {
|
|
27
|
+
protocol_version: typeof BRIDGE_PROTOCOL_VERSION;
|
|
28
|
+
session_id: string;
|
|
29
|
+
/** Monotonic per-session sequence number, starting at 1. */
|
|
30
|
+
seq: number;
|
|
31
|
+
/** Unique id for this frame. */
|
|
32
|
+
frame_id: string;
|
|
33
|
+
/** Ties a request frame to its response frame, when applicable. */
|
|
34
|
+
correlation_id?: string;
|
|
35
|
+
type: TType;
|
|
36
|
+
payload: TPayload;
|
|
37
|
+
}
|
|
38
|
+
/** Payload carried by an `event` frame. */
|
|
39
|
+
export interface BridgeEventPayload {
|
|
40
|
+
event_type: AgentSessionEventType;
|
|
41
|
+
event: AgentSessionEvent;
|
|
42
|
+
}
|
|
43
|
+
/** An `AgentSessionEvent` serialized into a versioned wire frame. */
|
|
44
|
+
export type BridgeEventFrame = BridgeFrameEnvelope<"event", BridgeEventPayload>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Shared RPC-compatible response helpers for agent-wire consumers. */
|
|
2
|
+
import type { RpcCommand, RpcResponse } from "../../rpc/rpc-types";
|
|
3
|
+
export declare function rpcSuccess<T extends RpcCommand["type"]>(id: string | undefined, command: T, data?: object | null): RpcResponse;
|
|
4
|
+
export declare function rpcError(id: string | undefined, command: string, message: string): RpcResponse;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coarse bridge authorization scopes for RPC commands.
|
|
3
|
+
*
|
|
4
|
+
* The v1 bridge exposes a network-reachable control surface, so every
|
|
5
|
+
* `RpcCommand` must be assigned to one coarse scope before any REST handler can
|
|
6
|
+
* dispatch it. The registry is intentionally typed as `Record<RpcCommandType,
|
|
7
|
+
* BridgeCommandScope>` so adding a new RPC command without a scope is a compile
|
|
8
|
+
* failure.
|
|
9
|
+
*/
|
|
10
|
+
import type { RpcCommand } from "../../rpc/rpc-types";
|
|
11
|
+
export type RpcCommandType = RpcCommand["type"];
|
|
12
|
+
export type BridgeCommandScope = "prompt" | "control" | "bash" | "export" | "session" | "model" | "message:read" | "host_tools" | "host_uri" | "admin";
|
|
13
|
+
export declare const BRIDGE_COMMAND_SCOPES: readonly BridgeCommandScope[];
|
|
14
|
+
export declare const RPC_COMMAND_TYPES: readonly RpcCommandType[];
|
|
15
|
+
export declare function isRpcCommandType(value: unknown): value is RpcCommandType;
|
|
16
|
+
export declare const MANDATORY_FLOOR_COMMAND_SCOPES: readonly BridgeCommandScope[];
|
|
17
|
+
export declare function scopeForRpcCommand(type: RpcCommandType): BridgeCommandScope;
|
|
18
|
+
export declare function isRpcCommandAllowed(type: RpcCommandType, scopes: ReadonlySet<BridgeCommandScope>): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type UiRequestCancelReason = "timeout" | "abort" | "disconnect";
|
|
2
|
+
export interface UiRequestCancelled {
|
|
3
|
+
status: "cancelled";
|
|
4
|
+
reason: UiRequestCancelReason;
|
|
5
|
+
}
|
|
6
|
+
export type UiRequestResolution<TResponse> = TResponse | UiRequestCancelled;
|
|
7
|
+
export type UiBrokerResponseResult = {
|
|
8
|
+
status: "accepted";
|
|
9
|
+
} | {
|
|
10
|
+
status: "rejected";
|
|
11
|
+
code: "not_controller" | "already_resolved" | "unknown_request";
|
|
12
|
+
};
|
|
13
|
+
export interface UiRequestBrokerOptions<TRequest> {
|
|
14
|
+
emitRequest: (correlationId: string, request: TRequest) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface UiRequestOptions {
|
|
17
|
+
correlationId?: string;
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Broker for one active session. v1 supports one controller token at a time;
|
|
23
|
+
* other clients may observe frames but cannot answer correlated requests.
|
|
24
|
+
*/
|
|
25
|
+
export declare class UiRequestBroker<TRequest, TResponse> {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(options: UiRequestBrokerOptions<TRequest>);
|
|
28
|
+
get ownerToken(): string | undefined;
|
|
29
|
+
get pendingCount(): number;
|
|
30
|
+
claimController(ownerToken?: string): {
|
|
31
|
+
status: "claimed";
|
|
32
|
+
ownerToken: string;
|
|
33
|
+
} | {
|
|
34
|
+
status: "busy";
|
|
35
|
+
};
|
|
36
|
+
releaseController(ownerToken: string): boolean;
|
|
37
|
+
request(request: TRequest, options?: UiRequestOptions): Promise<UiRequestResolution<TResponse>>;
|
|
38
|
+
respond(correlationId: string, ownerToken: string, response: TResponse): UiBrokerResponseResult;
|
|
39
|
+
cancelAll(reason: UiRequestCancelReason): void;
|
|
40
|
+
cancel(correlationId: string, reason: UiRequestCancelReason): boolean;
|
|
41
|
+
disconnectController(ownerToken: string): boolean;
|
|
42
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed UI/manipulation result semantics for bridge-capability handling.
|
|
3
|
+
*
|
|
4
|
+
* `unsupported` is distinct from both a real value and user cancellation. This
|
|
5
|
+
* prevents local-only or undeclared `ExtensionUIContext` surfaces from becoming
|
|
6
|
+
* silent no-ops that look like user intent.
|
|
7
|
+
*/
|
|
8
|
+
export interface BridgeUiValue<TValue> {
|
|
9
|
+
status: "value";
|
|
10
|
+
value: TValue;
|
|
11
|
+
}
|
|
12
|
+
export interface BridgeUiCancelled {
|
|
13
|
+
status: "cancelled";
|
|
14
|
+
reason?: "user" | "timeout" | "abort" | "disconnect";
|
|
15
|
+
}
|
|
16
|
+
export interface BridgeUiUnsupported {
|
|
17
|
+
status: "unsupported";
|
|
18
|
+
capability: string;
|
|
19
|
+
reason: string;
|
|
20
|
+
}
|
|
21
|
+
export type BridgeUiResult<TValue> = BridgeUiValue<TValue> | BridgeUiCancelled | BridgeUiUnsupported;
|
|
22
|
+
export declare function uiValue<TValue>(value: TValue): BridgeUiValue<TValue>;
|
|
23
|
+
export declare function uiCancelled(reason?: BridgeUiCancelled["reason"]): BridgeUiCancelled;
|
|
24
|
+
export declare function uiUnsupported(capability: string, reason: string): BridgeUiUnsupported;
|
|
25
|
+
export declare function isUiUnsupported<TValue>(result: BridgeUiResult<TValue>): result is BridgeUiUnsupported;
|
|
26
|
+
export declare function isUiCancelled<TValue>(result: BridgeUiResult<TValue>): result is BridgeUiCancelled;
|
|
27
|
+
export declare function isUiValue<TValue>(result: BridgeUiResult<TValue>): result is BridgeUiValue<TValue>;
|
|
@@ -93,6 +93,7 @@ export interface InteractiveModeContext {
|
|
|
93
93
|
retryLoader: Loader | undefined;
|
|
94
94
|
autoCompactionEscapeHandler?: () => void;
|
|
95
95
|
retryEscapeHandler?: () => void;
|
|
96
|
+
retryCountdownTimer?: ReturnType<typeof setInterval>;
|
|
96
97
|
unsubscribe?: () => void;
|
|
97
98
|
onInputCallback?: (input: SubmittedUserInput) => void;
|
|
98
99
|
optimisticUserMessageSignature: string | undefined;
|
|
@@ -227,6 +228,7 @@ export interface InteractiveModeContext {
|
|
|
227
228
|
showHookConfirm(title: string, message: string): Promise<boolean>;
|
|
228
229
|
showDebugSelector(): void;
|
|
229
230
|
showSessionObserver(): void;
|
|
231
|
+
showJobsOverlay(): void;
|
|
230
232
|
resetObserverRegistry(): void;
|
|
231
233
|
handleCtrlC(): void;
|
|
232
234
|
handleCtrlD(): void;
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -93,6 +93,8 @@ export interface CreateAgentSessionOptions {
|
|
|
93
93
|
requireYieldTool?: boolean;
|
|
94
94
|
/** Task recursion depth (for subagent sessions). Default: 0 */
|
|
95
95
|
taskDepth?: number;
|
|
96
|
+
/** Current role-agent type/name for nested task sessions. */
|
|
97
|
+
currentAgentType?: string;
|
|
96
98
|
/** Parent Hindsight state to alias for subagent memory tools. */
|
|
97
99
|
parentHindsightSessionState?: HindsightSessionState;
|
|
98
100
|
/** Pre-allocated agent identity for IRC routing. Default: "0-Main" for top-level, parentTaskPrefix-derived for sub. */
|
|
@@ -127,6 +129,8 @@ export interface CreateAgentSessionOptions {
|
|
|
127
129
|
forkContextSeed?: ForkContextSeed;
|
|
128
130
|
/** Optional provider state override. Fork-context children should omit this by default. */
|
|
129
131
|
providerSessionState?: Map<string, ProviderSessionState>;
|
|
132
|
+
/** Cooperative pause checkpoint passed through to Agent. */
|
|
133
|
+
shouldPause?: () => boolean;
|
|
130
134
|
}
|
|
131
135
|
/** Result from createAgentSession */
|
|
132
136
|
export interface CreateAgentSessionResult {
|
|
@@ -90,6 +90,7 @@ export type AgentSessionEvent = AgentEvent | {
|
|
|
90
90
|
maxAttempts: number;
|
|
91
91
|
delayMs: number;
|
|
92
92
|
errorMessage: string;
|
|
93
|
+
unbounded?: boolean;
|
|
93
94
|
} | {
|
|
94
95
|
type: "auto_retry_end";
|
|
95
96
|
success: boolean;
|
|
@@ -132,7 +133,7 @@ export type AgentSessionEvent = AgentEvent | {
|
|
|
132
133
|
};
|
|
133
134
|
/** Listener function for agent session events */
|
|
134
135
|
export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
|
|
135
|
-
export type AsyncJobSnapshotItem = Pick<AsyncJob, "id" | "type" | "status" | "label" | "startTime">;
|
|
136
|
+
export type AsyncJobSnapshotItem = Pick<AsyncJob, "id" | "type" | "status" | "label" | "startTime" | "metadata">;
|
|
136
137
|
export interface AsyncJobSnapshot {
|
|
137
138
|
running: AsyncJobSnapshotItem[];
|
|
138
139
|
recent: AsyncJobSnapshotItem[];
|
|
@@ -357,6 +358,7 @@ export declare class AgentSession {
|
|
|
357
358
|
* Does NOT push to the agent's steering/followUp queue — that happens
|
|
358
359
|
* separately inside `sendCustomMessage`. */
|
|
359
360
|
enqueueCustomMessageDisplay(text: string, mode: "steer" | "followUp"): string;
|
|
361
|
+
getAgentId(): string | undefined;
|
|
360
362
|
getAsyncJobSnapshot(options?: {
|
|
361
363
|
recentLimit?: number;
|
|
362
364
|
}): AsyncJobSnapshot | null;
|
|
@@ -576,6 +578,10 @@ export declare class AgentSession {
|
|
|
576
578
|
};
|
|
577
579
|
/** Number of pending messages (includes steering, follow-up, and next-turn messages) */
|
|
578
580
|
get queuedMessageCount(): number;
|
|
581
|
+
/** Whether the agent has queued steering messages that a `user_interrupt`
|
|
582
|
+
* abort would resume into (steer-on-interrupt). Drives the Esc-on-steer UX:
|
|
583
|
+
* the first Esc consumes the steer and auto-continues, a second Esc aborts. */
|
|
584
|
+
get hasQueuedSteering(): boolean;
|
|
579
585
|
/** Get pending messages (read-only). Returns the public text-only view;
|
|
580
586
|
* internal `{text, tag?}` records are mapped to `.text` so callers
|
|
581
587
|
* (`updatePendingMessagesDisplay`, `restoreQueuedMessagesToEditor`) see
|
|
@@ -604,6 +610,12 @@ export declare class AgentSession {
|
|
|
604
610
|
abort(options?: {
|
|
605
611
|
goalReason?: "interrupted" | "internal";
|
|
606
612
|
timeoutMs?: number;
|
|
613
|
+
cause?: "user_interrupt" | "new_session" | "session_switch" | "compaction" | "handoff" | "tool_abort" | "internal";
|
|
614
|
+
/** Suppress the "Operation aborted" line on the resulting aborted message
|
|
615
|
+
* by stamping `SILENT_ABORT_MARKER`. Used when Esc consumes a queued steer
|
|
616
|
+
* and resumes via steer-on-interrupt, so the interrupt reads as a quiet
|
|
617
|
+
* hand-off rather than a failure. */
|
|
618
|
+
silent?: boolean;
|
|
607
619
|
}): Promise<void>;
|
|
608
620
|
/**
|
|
609
621
|
* Start a new session, optionally with initial messages and parent tracking.
|
|
@@ -752,6 +764,12 @@ export declare class AgentSession {
|
|
|
752
764
|
* Cancel in-progress retry.
|
|
753
765
|
*/
|
|
754
766
|
abortRetry(): void;
|
|
767
|
+
/**
|
|
768
|
+
* Skip the current retry backoff and re-attempt immediately. Distinct from
|
|
769
|
+
* abortRetry(), which cancels the retry and returns to idle. No-op when no
|
|
770
|
+
* retry backoff is active.
|
|
771
|
+
*/
|
|
772
|
+
retryNow(): void;
|
|
755
773
|
/** Whether auto-retry is currently in progress */
|
|
756
774
|
get isRetrying(): boolean;
|
|
757
775
|
/** Whether auto-retry is enabled */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentTool } from "@gajae-code/agent-core";
|
|
2
2
|
export declare const DEEP_INTERVIEW_MUTATION_BLOCK_MESSAGE = "Deep-interview phase boundary: continue gathering context/questions/risks and emit a handoff/spec before code edits. Mutation tools and patch execution are blocked while deep-interview is active; finalize specs through `gjc deep-interview --write --stage final` or hand off to an execution phase.";
|
|
3
|
-
export declare const WORKFLOW_STATE_MUTATION_BLOCK_MESSAGE = "
|
|
3
|
+
export declare const WORKFLOW_STATE_MUTATION_BLOCK_MESSAGE = ".gjc workflow state and artifacts are runtime-owned. Agent mutation tools cannot edit `.gjc/**`; use the sanctioned `gjc` CLI instead.";
|
|
4
4
|
type ToolWithEditMode = AgentTool & {
|
|
5
5
|
mode?: unknown;
|
|
6
6
|
customWireName?: unknown;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type CanonicalGjcWorkflowSkill } from "./active-state";
|
|
2
|
+
export { WORKFLOW_STATE_RECEIPT_FRESH_MS, WORKFLOW_STATE_RECEIPT_VERSION, WORKFLOW_STATE_VERSION, } from "./workflow-state-version";
|
|
2
3
|
export type { CanonicalGjcWorkflowSkill };
|
|
3
|
-
export declare const WORKFLOW_STATE_RECEIPT_VERSION = 1;
|
|
4
|
-
export declare const WORKFLOW_STATE_RECEIPT_FRESH_MS: number;
|
|
5
4
|
export type WorkflowStateMutationOwner = "gjc-state-cli" | "gjc-runtime" | "gjc-hook";
|
|
6
5
|
export type WorkflowStateReceiptStatus = "fresh" | "stale";
|
|
6
|
+
export interface WorkflowStateContentChecksum {
|
|
7
|
+
algorithm: "sha256";
|
|
8
|
+
value: string;
|
|
9
|
+
covered_path: string;
|
|
10
|
+
computed_at: string;
|
|
11
|
+
}
|
|
7
12
|
export interface WorkflowStateReceipt {
|
|
8
13
|
version: 1;
|
|
9
14
|
skill: CanonicalGjcWorkflowSkill;
|
|
@@ -15,6 +20,24 @@ export interface WorkflowStateReceipt {
|
|
|
15
20
|
fresh_until: string;
|
|
16
21
|
status: WorkflowStateReceiptStatus;
|
|
17
22
|
mutation_id: string;
|
|
23
|
+
verb?: string;
|
|
24
|
+
from_phase?: string;
|
|
25
|
+
to_phase?: string;
|
|
26
|
+
forced?: boolean;
|
|
27
|
+
paths?: string[];
|
|
28
|
+
content_sha256?: WorkflowStateContentChecksum;
|
|
29
|
+
}
|
|
30
|
+
export interface AuditEntry {
|
|
31
|
+
ts: string;
|
|
32
|
+
skill?: string;
|
|
33
|
+
category: string;
|
|
34
|
+
verb: string;
|
|
35
|
+
owner: WorkflowStateMutationOwner;
|
|
36
|
+
mutation_id: string;
|
|
37
|
+
from_phase?: string;
|
|
38
|
+
to_phase?: string;
|
|
39
|
+
forced: boolean;
|
|
40
|
+
paths: string[];
|
|
18
41
|
}
|
|
19
42
|
export declare function workflowModeStateFileName(skill: CanonicalGjcWorkflowSkill): string;
|
|
20
43
|
export declare function workflowStateStoragePath(cwd: string, skill: CanonicalGjcWorkflowSkill, sessionId?: string): string;
|
|
@@ -29,6 +29,9 @@ export interface ExecutorOptions {
|
|
|
29
29
|
index: number;
|
|
30
30
|
id: string;
|
|
31
31
|
modelOverride?: string | string[];
|
|
32
|
+
runMode?: "initial" | "resume" | "message";
|
|
33
|
+
resumeMessage?: string;
|
|
34
|
+
subagentId?: string;
|
|
32
35
|
/**
|
|
33
36
|
* Active model selector of the parent session, used as an auth-aware fallback
|
|
34
37
|
* if the resolved subagent model has no working credentials. See #985.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const TASK_ID_PATTERN: RegExp;
|
|
2
|
+
export declare const TASK_ID_DESCRIPTION = "filesystem-safe identifier matching ^[A-Za-z0-9][A-Za-z0-9_-]{0,47}$";
|
|
3
|
+
export declare function isValidTaskId(id: string): boolean;
|
|
4
|
+
export declare function getTaskIdValidationError(id: unknown): string | undefined;
|
|
5
|
+
export declare function validateTaskId(id: string): string;
|
|
6
|
+
export declare function isValidAllocatedTaskId(id: string): boolean;
|
|
7
|
+
export declare function validateAllocatedTaskId(id: string): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@gajae-code/agent-core";
|
|
2
|
+
import type { Model } from "@gajae-code/ai";
|
|
2
3
|
import type { ToolSession } from "..";
|
|
3
4
|
import type { Theme } from "../modes/theme/theme";
|
|
4
5
|
import { type TaskToolDetails, type TaskToolSchemaInstance } from "./types";
|
|
@@ -7,9 +8,13 @@ import { renderResult, renderCall as renderTaskCall } from "./render";
|
|
|
7
8
|
export { loadBundledAgents as BUNDLED_AGENTS } from "./agents";
|
|
8
9
|
export { discoverCommands, expandCommand, getCommand } from "./commands";
|
|
9
10
|
export { discoverAgents, getAgent } from "./discovery";
|
|
11
|
+
export { isValidAllocatedTaskId, isValidTaskId, TASK_ID_DESCRIPTION, TASK_ID_PATTERN, validateAllocatedTaskId, validateTaskId, } from "./id";
|
|
10
12
|
export { AgentOutputManager } from "./output-manager";
|
|
13
|
+
export type { TaskResultReceipt } from "./receipt";
|
|
14
|
+
export { assertNoRawTaskFields, buildTaskReceipt, buildTaskRoi, buildTaskRoiSummary, findRawTaskLeakKeys, sanitizeTaskToolDetails, } from "./receipt";
|
|
11
15
|
export type { AgentDefinition, AgentProgress, SingleResult, SubagentLifecyclePayload, SubagentProgressPayload, TaskParams, TaskToolDetails, } from "./types";
|
|
12
16
|
export { TASK_SUBAGENT_EVENT_CHANNEL, TASK_SUBAGENT_LIFECYCLE_CHANNEL, TASK_SUBAGENT_PROGRESS_CHANNEL, taskSchema, } from "./types";
|
|
17
|
+
export declare function resolveForkContextMaxTokens(configured: number, model: Model | undefined): number;
|
|
13
18
|
/**
|
|
14
19
|
* Task tool - Delegate tasks to specialized agents.
|
|
15
20
|
*
|