@gajae-code/coding-agent 0.3.0 → 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 +18 -0
- package/dist/types/async/job-manager.d.ts +7 -0
- package/dist/types/cli/args.d.ts +1 -1
- package/dist/types/commands/deep-interview.d.ts +3 -0
- package/dist/types/config/keybindings.d.ts +5 -0
- package/dist/types/config/settings-schema.d.ts +4 -4
- 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 +1 -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/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-migrations.d.ts +9 -0
- package/dist/types/gjc-runtime/state-schema.d.ts +317 -0
- package/dist/types/gjc-runtime/state-writer.d.ts +10 -0
- package/dist/types/gjc-runtime/workflow-command-ref.d.ts +43 -0
- package/dist/types/harness-control-plane/control-endpoint.d.ts +3 -2
- package/dist/types/hooks/skill-state.d.ts +21 -0
- 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/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 +1 -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 +1 -0
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +11 -1
- package/dist/types/skill-state/workflow-state-contract.d.ts +1 -2
- package/dist/types/skill-state/workflow-state-version.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 +143 -11
- 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 +15 -0
- package/package.json +7 -7
- package/scripts/build-binary.ts +7 -0
- package/src/async/job-manager.ts +36 -0
- package/src/cli/args.ts +9 -2
- package/src/commands/deep-interview.ts +1 -0
- package/src/commands/harness.ts +289 -19
- package/src/commands/launch.ts +2 -2
- package/src/commands/state.ts +2 -1
- package/src/commands/team.ts +22 -4
- package/src/config/keybindings.ts +6 -0
- package/src/config/settings-schema.ts +6 -3
- 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 +6 -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/ultragoal/SKILL.md +28 -2
- 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/gjc-runtime/cli-write-receipt.ts +31 -0
- package/src/gjc-runtime/deep-interview-runtime.ts +69 -32
- package/src/gjc-runtime/ralplan-runtime.ts +213 -36
- package/src/gjc-runtime/state-migrations.ts +54 -7
- package/src/gjc-runtime/state-runtime.ts +461 -64
- package/src/gjc-runtime/state-schema.ts +192 -0
- package/src/gjc-runtime/state-writer.ts +32 -1
- package/src/gjc-runtime/team-runtime.ts +177 -105
- package/src/gjc-runtime/ultragoal-runtime.ts +114 -26
- package/src/gjc-runtime/workflow-command-ref.ts +239 -0
- package/src/gjc-runtime/workflow-manifest.generated.json +108 -4
- package/src/gjc-runtime/workflow-manifest.ts +3 -1
- package/src/harness-control-plane/control-endpoint.ts +19 -8
- package/src/harness-control-plane/owner.ts +57 -10
- package/src/harness-control-plane/state-machine.ts +2 -1
- package/src/hooks/skill-state.ts +176 -26
- 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/custom-editor.ts +101 -0
- package/src/modes/components/hook-selector.ts +61 -18
- 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/extension-ui-controller.ts +39 -3
- package/src/modes/controllers/input-controller.ts +97 -9
- package/src/modes/controllers/selector-controller.ts +29 -0
- package/src/modes/index.ts +1 -0
- package/src/modes/interactive-mode.ts +27 -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 +1 -0
- package/src/prompts/tools/subagent.md +12 -7
- package/src/prompts/tools/task-summary.md +3 -9
- package/src/prompts/tools/task.md +5 -1
- package/src/sdk.ts +4 -0
- package/src/session/agent-session.ts +214 -38
- package/src/skill-state/deep-interview-mutation-guard.ts +23 -4
- package/src/skill-state/workflow-state-contract.ts +7 -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 +29 -5
- package/src/task/id.ts +33 -0
- package/src/task/index.ts +257 -67
- package/src/task/output-manager.ts +5 -4
- package/src/task/receipt.ts +297 -0
- package/src/task/render.ts +48 -131
- package/src/task/spawn-gate.ts +132 -0
- package/src/task/types.ts +48 -7
- package/src/tools/ask.ts +73 -33
- 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 +237 -84
|
@@ -24,7 +24,8 @@ export declare class ControlServer {
|
|
|
24
24
|
}
|
|
25
25
|
export declare class EndpointUnreachableError extends Error {
|
|
26
26
|
readonly socketPath: string;
|
|
27
|
-
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
constructor(socketPath: string, reason?: string);
|
|
28
29
|
}
|
|
29
|
-
/** Call the owner's control endpoint. Rejects with {@link EndpointUnreachableError} when no owner listens. */
|
|
30
|
+
/** Call the owner's control endpoint. Rejects with {@link EndpointUnreachableError} when no owner listens or responds. */
|
|
30
31
|
export declare function callEndpoint(socketPath: string, req: EndpointRequest, timeoutMs?: number): Promise<unknown>;
|
|
@@ -59,6 +59,27 @@ import { initialPhaseForSkill } from "../skill-state/initial-phase";
|
|
|
59
59
|
export { initialPhaseForSkill };
|
|
60
60
|
export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, stateDir?: string): Promise<SkillActiveState | null>;
|
|
61
61
|
export declare function recordSkillActivation(input: RecordSkillActivationInput): Promise<SkillActiveState | null>;
|
|
62
|
+
export interface EnsureWorkflowSkillActivationInput {
|
|
63
|
+
cwd: string;
|
|
64
|
+
skill: string;
|
|
65
|
+
sessionId?: string;
|
|
66
|
+
threadId?: string;
|
|
67
|
+
turnId?: string;
|
|
68
|
+
nowIso?: string;
|
|
69
|
+
stateDir?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Idempotently seed `.gjc/state` for a workflow skill that was invoked directly
|
|
73
|
+
* (e.g. via `/skill:<name>`) rather than through keyword detection. This ensures
|
|
74
|
+
* the mutation guard and Stop hook engage the moment a workflow skill becomes
|
|
75
|
+
* active, instead of relying on the skill prompt to run its own state-init steps.
|
|
76
|
+
*
|
|
77
|
+
* The seed is non-destructive: if an active entry for this skill already exists
|
|
78
|
+
* (for example after a `gjc state handoff` promotion that carries
|
|
79
|
+
* `handoff_from`/`handoff_at` lineage), nothing is written so lineage is
|
|
80
|
+
* preserved. Non-workflow skills are ignored.
|
|
81
|
+
*/
|
|
82
|
+
export declare function ensureWorkflowSkillActivationState(input: EnsureWorkflowSkillActivationInput): Promise<SkillActiveState | null>;
|
|
62
83
|
export declare function buildActiveUltragoalPromptContext(input: UserPromptSubmitStateInput): Promise<string | null>;
|
|
63
84
|
export declare function buildSkillStopOutput(input: StopHookInput): Promise<Record<string, unknown> | null>;
|
|
64
85
|
export declare function buildSkillActivationAdditionalContext(state: SkillActiveState, effectiveSkillConfig?: EffectiveSkillConfigInput): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
1
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Handler for agent:// URLs.
|
|
4
4
|
*
|
|
@@ -8,5 +8,5 @@ import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
|
8
8
|
export declare class AgentProtocolHandler implements ProtocolHandler {
|
|
9
9
|
readonly scheme = "agent";
|
|
10
10
|
readonly immutable = true;
|
|
11
|
-
resolve(url: InternalUrl): Promise<InternalResource>;
|
|
11
|
+
resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
|
|
1
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, ResolveContext } from "./types";
|
|
2
2
|
export declare class ArtifactProtocolHandler implements ProtocolHandler {
|
|
3
3
|
readonly scheme = "artifact";
|
|
4
4
|
readonly immutable = true;
|
|
5
|
-
resolve(url: InternalUrl): Promise<InternalResource>;
|
|
5
|
+
resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource>;
|
|
6
6
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ResolveContext } from "./types";
|
|
1
2
|
/**
|
|
2
|
-
* Snapshot of artifacts dirs for
|
|
3
|
+
* Snapshot of artifacts dirs explicitly authorized for the calling session.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Normal reads are scoped to the caller's artifacts directory. Parent/child
|
|
6
|
+
* agent tree sharing is allowed only when the caller supplies explicit
|
|
7
|
+
* authorized directories at the ResolveContext boundary. This intentionally
|
|
8
|
+
* does not enumerate AgentRegistry.global(); live but unrelated sessions are
|
|
9
|
+
* not an authorization source.
|
|
9
10
|
*/
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function authorizedArtifactsDirsFromContext(context?: ResolveContext): string[];
|
|
@@ -56,6 +56,10 @@ export interface ResolveContext {
|
|
|
56
56
|
cwd?: string;
|
|
57
57
|
/** Settings of the calling session (used by `issue://`/`pr://` for cache TTLs). */
|
|
58
58
|
settings?: unknown;
|
|
59
|
+
/** Artifacts directory of the calling session. */
|
|
60
|
+
getArtifactsDir?: () => string | null;
|
|
61
|
+
/** Additional artifacts directories explicitly authorized for this caller (for parent/child agent trees). */
|
|
62
|
+
getAuthorizedArtifactsDirs?: () => readonly string[];
|
|
59
63
|
/** Caller's abort signal. */
|
|
60
64
|
signal?: AbortSignal;
|
|
61
65
|
}
|
|
@@ -93,8 +93,8 @@ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetai
|
|
|
93
93
|
readonly loadMode = "discoverable";
|
|
94
94
|
readonly summary = "Query LSP (language server) for diagnostics, hover info, and references";
|
|
95
95
|
readonly description: string;
|
|
96
|
-
readonly parameters: import("zod
|
|
97
|
-
action: import("zod
|
|
96
|
+
readonly parameters: import("zod").ZodObject<{
|
|
97
|
+
action: import("zod").ZodEnum<{
|
|
98
98
|
capabilities: "capabilities";
|
|
99
99
|
code_actions: "code_actions";
|
|
100
100
|
definition: "definition";
|
|
@@ -110,14 +110,14 @@ export declare class LspTool implements AgentTool<typeof lspSchema, LspToolDetai
|
|
|
110
110
|
symbols: "symbols";
|
|
111
111
|
type_definition: "type_definition";
|
|
112
112
|
}>;
|
|
113
|
-
file: import("zod
|
|
114
|
-
line: import("zod
|
|
115
|
-
symbol: import("zod
|
|
116
|
-
query: import("zod
|
|
117
|
-
new_name: import("zod
|
|
118
|
-
apply: import("zod
|
|
119
|
-
timeout: import("zod
|
|
120
|
-
payload: import("zod
|
|
113
|
+
file: import("zod").ZodOptional<import("zod").ZodString>;
|
|
114
|
+
line: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
115
|
+
symbol: import("zod").ZodOptional<import("zod").ZodString>;
|
|
116
|
+
query: import("zod").ZodOptional<import("zod").ZodString>;
|
|
117
|
+
new_name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
118
|
+
apply: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
119
|
+
timeout: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
120
|
+
payload: import("zod").ZodOptional<import("zod").ZodString>;
|
|
121
121
|
}, import("zod/v4/core").$strip>;
|
|
122
122
|
readonly renderCall: typeof renderCall;
|
|
123
123
|
readonly renderResult: typeof renderResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface BridgeAuthConfig {
|
|
2
|
+
token: string;
|
|
3
|
+
}
|
|
4
|
+
export interface BridgeBindConfig {
|
|
5
|
+
hostname: string;
|
|
6
|
+
port: number;
|
|
7
|
+
tlsConfigured: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function extractBearerToken(authorization: string | null | undefined): string | undefined;
|
|
10
|
+
export declare function isBridgeTokenAuthorized(authorization: string | null | undefined, config: BridgeAuthConfig): boolean;
|
|
11
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
12
|
+
export declare function assertSafeBridgeBind(config: BridgeBindConfig): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "../../session/client-bridge";
|
|
2
|
+
import type { UiRequestBroker } from "../shared/agent-wire/ui-request-broker";
|
|
3
|
+
export interface BridgePermissionRequestPayload {
|
|
4
|
+
kind: "permission";
|
|
5
|
+
toolCall: ClientBridgePermissionToolCall;
|
|
6
|
+
options: ClientBridgePermissionOption[];
|
|
7
|
+
}
|
|
8
|
+
export type BridgePermissionBroker = UiRequestBroker<BridgePermissionRequestPayload, ClientBridgePermissionOutcome>;
|
|
9
|
+
export declare function createBridgeClientBridge(broker: BridgePermissionBroker): ClientBridge;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ExtensionUIContext } from "../../extensibility/extensions";
|
|
2
|
+
import type { AgentSession } from "../../session/agent-session";
|
|
3
|
+
import type { ClientBridgePermissionOutcome } from "../../session/client-bridge";
|
|
4
|
+
import type { RpcCommand, RpcResponse } from "../rpc/rpc-types";
|
|
5
|
+
import { RpcHostToolBridge } from "../shared/agent-wire/host-tool-bridge";
|
|
6
|
+
import { RpcHostUriBridge } from "../shared/agent-wire/host-uri-bridge";
|
|
7
|
+
import { type BridgeCommandScope } from "../shared/agent-wire/scopes";
|
|
8
|
+
import { UiRequestBroker } from "../shared/agent-wire/ui-request-broker";
|
|
9
|
+
import type { BridgeUiResult } from "../shared/agent-wire/ui-result";
|
|
10
|
+
import { type BridgePermissionRequestPayload } from "./bridge-client-bridge";
|
|
11
|
+
import { type BridgeUiRequestPayload } from "./bridge-ui-context";
|
|
12
|
+
import { BridgeEventStream } from "./event-stream";
|
|
13
|
+
interface BridgeEndpointMatrix {
|
|
14
|
+
events: boolean;
|
|
15
|
+
commands: boolean;
|
|
16
|
+
control: boolean;
|
|
17
|
+
uiResponses: boolean;
|
|
18
|
+
hostToolResults: boolean;
|
|
19
|
+
hostUriResults: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface BridgeFetchHandlerOptions {
|
|
22
|
+
sessionId: string;
|
|
23
|
+
token: string;
|
|
24
|
+
eventStream?: BridgeEventStream;
|
|
25
|
+
commandDispatcher?: (command: RpcCommand) => Promise<RpcResponse>;
|
|
26
|
+
commandScopes?: readonly BridgeCommandScope[];
|
|
27
|
+
idempotencyCache?: BridgeIdempotencyCache;
|
|
28
|
+
permissionBroker?: UiRequestBroker<BridgePermissionRequestPayload, ClientBridgePermissionOutcome>;
|
|
29
|
+
uiBroker?: UiRequestBroker<BridgeUiRequestPayload, BridgeUiResult<unknown>>;
|
|
30
|
+
hostToolBridge?: RpcHostToolBridge;
|
|
31
|
+
hostUriBridge?: RpcHostUriBridge;
|
|
32
|
+
endpointMatrix?: Partial<BridgeEndpointMatrix>;
|
|
33
|
+
}
|
|
34
|
+
interface BridgeIdempotencyRecord {
|
|
35
|
+
route: string;
|
|
36
|
+
ownerToken?: string;
|
|
37
|
+
body: string | Promise<string>;
|
|
38
|
+
response: unknown | Promise<unknown>;
|
|
39
|
+
pending?: boolean;
|
|
40
|
+
}
|
|
41
|
+
type BridgeIdempotencyCache = Map<string, BridgeIdempotencyRecord>;
|
|
42
|
+
export declare function createBridgeFetchHandler(options: BridgeFetchHandlerOptions): (request: Request) => Promise<Response>;
|
|
43
|
+
export declare function runBridgeMode(session: AgentSession, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void): Promise<never>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetContent, ExtensionWidgetOptions, TerminalInputHandler } from "../../extensibility/extensions";
|
|
2
|
+
import type { UiRequestBroker } from "../shared/agent-wire/ui-request-broker";
|
|
3
|
+
import type { BridgeUiResult } from "../shared/agent-wire/ui-result";
|
|
4
|
+
import { type Theme } from "../theme/theme";
|
|
5
|
+
export type BridgeUiRequestPayload = {
|
|
6
|
+
kind: "select";
|
|
7
|
+
title: string;
|
|
8
|
+
options: string[];
|
|
9
|
+
timeout?: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "confirm";
|
|
12
|
+
title: string;
|
|
13
|
+
message: string;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "input";
|
|
17
|
+
title: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
timeout?: number;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "editor";
|
|
22
|
+
title: string;
|
|
23
|
+
prefill?: string;
|
|
24
|
+
promptStyle?: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "notify";
|
|
27
|
+
message: string;
|
|
28
|
+
type?: "info" | "warning" | "error";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "status";
|
|
31
|
+
key: string;
|
|
32
|
+
text: string | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "widget";
|
|
35
|
+
key: string;
|
|
36
|
+
lines: string[] | undefined;
|
|
37
|
+
placement?: "aboveEditor" | "belowEditor";
|
|
38
|
+
} | {
|
|
39
|
+
kind: "title";
|
|
40
|
+
title: string;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "set_editor_text";
|
|
43
|
+
text: string;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "unsupported";
|
|
46
|
+
capability: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
};
|
|
49
|
+
export type BridgeUiBroker = UiRequestBroker<BridgeUiRequestPayload, BridgeUiResult<unknown>>;
|
|
50
|
+
export type BridgeUiEmitter = (payload: BridgeUiRequestPayload) => void;
|
|
51
|
+
export declare class BridgeExtensionUIContext implements ExtensionUIContext {
|
|
52
|
+
#private;
|
|
53
|
+
constructor(options: {
|
|
54
|
+
broker: BridgeUiBroker;
|
|
55
|
+
emit: BridgeUiEmitter;
|
|
56
|
+
});
|
|
57
|
+
select(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions): Promise<string | undefined>;
|
|
58
|
+
confirm(title: string, message: string, dialogOptions?: ExtensionUIDialogOptions): Promise<boolean>;
|
|
59
|
+
input(title: string, placeholder?: string, dialogOptions?: ExtensionUIDialogOptions): Promise<string | undefined>;
|
|
60
|
+
notify(message: string, type?: "info" | "warning" | "error"): void;
|
|
61
|
+
onTerminalInput(_handler: TerminalInputHandler): () => void;
|
|
62
|
+
setStatus(key: string, text: string | undefined): void;
|
|
63
|
+
setWorkingMessage(message?: string): void;
|
|
64
|
+
setWidget(key: string, content: ExtensionWidgetContent, options?: ExtensionWidgetOptions): void;
|
|
65
|
+
setFooter(_factory?: unknown): void;
|
|
66
|
+
setHeader(_factory?: unknown): void;
|
|
67
|
+
setTitle(title: string): void;
|
|
68
|
+
custom<T>(): Promise<T>;
|
|
69
|
+
setEditorText(text: string): void;
|
|
70
|
+
pasteToEditor(text: string): void;
|
|
71
|
+
getEditorText(): string;
|
|
72
|
+
editor(title: string, prefill?: string, dialogOptions?: ExtensionUIDialogOptions, editorOptions?: {
|
|
73
|
+
promptStyle?: boolean;
|
|
74
|
+
}): Promise<string | undefined>;
|
|
75
|
+
setEditorComponent(_factory?: unknown): void;
|
|
76
|
+
get theme(): Theme;
|
|
77
|
+
getAllThemes(): Promise<{
|
|
78
|
+
name: string;
|
|
79
|
+
path: string | undefined;
|
|
80
|
+
}[]>;
|
|
81
|
+
getTheme(_name: string): Promise<Theme | undefined>;
|
|
82
|
+
setTheme(_theme: string | Theme): Promise<{
|
|
83
|
+
success: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
}>;
|
|
86
|
+
getToolsExpanded(): boolean;
|
|
87
|
+
setToolsExpanded(_expanded: boolean): void;
|
|
88
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BridgeFrameEnvelope } from "../shared/agent-wire/protocol";
|
|
2
|
+
export declare class BridgeEventStream {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(replayLimit?: number);
|
|
5
|
+
get frameCount(): number;
|
|
6
|
+
publish(frame: BridgeFrameEnvelope): void;
|
|
7
|
+
response(lastSeq?: number): Response;
|
|
8
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Editor, type KeyId } from "@gajae-code/tui";
|
|
2
2
|
import type { AppKeybinding } from "../../config/keybindings";
|
|
3
3
|
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.clipboard.pasteImage" | "app.clipboard.copyPrompt">;
|
|
4
|
+
type PastePendingClearReason = "timeout" | "queue-limit";
|
|
4
5
|
/**
|
|
5
6
|
* Custom editor that handles configurable app-level shortcuts for coding-agent.
|
|
6
7
|
*/
|
|
@@ -25,6 +26,10 @@ export declare class CustomEditor extends Editor {
|
|
|
25
26
|
onCopyPrompt?: () => void;
|
|
26
27
|
/** Called when the configured image-paste shortcut is pressed. */
|
|
27
28
|
onPasteImage?: () => Promise<boolean>;
|
|
29
|
+
/** Called before bracketed paste content is inserted. Return true to consume it. */
|
|
30
|
+
onPasteText?: (text: string) => boolean | Promise<boolean>;
|
|
31
|
+
/** Called when async paste handling drops queued input instead of replaying it. */
|
|
32
|
+
onPastePendingInputCleared?: (reason: PastePendingClearReason, droppedInputCount: number) => void;
|
|
28
33
|
/** Called when the configured dequeue shortcut is pressed. */
|
|
29
34
|
onDequeue?: () => void;
|
|
30
35
|
/** Called when Caps Lock is pressed. */
|
|
@@ -42,6 +47,7 @@ export declare class CustomEditor extends Editor {
|
|
|
42
47
|
* Clear all custom key handlers.
|
|
43
48
|
*/
|
|
44
49
|
clearCustomKeyHandlers(): void;
|
|
50
|
+
dispose(): void;
|
|
45
51
|
handleInput(data: string): void;
|
|
46
52
|
}
|
|
47
53
|
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure model helpers for the jobs overlay.
|
|
3
|
+
*
|
|
4
|
+
* Kept free of UI/Component dependencies so the grouping/ordering and
|
|
5
|
+
* detail-formatting logic is unit-testable. The selector controller wires these
|
|
6
|
+
* SelectItem lists into nested SelectLists (list -> detail -> confirm).
|
|
7
|
+
*/
|
|
8
|
+
import type { SelectItem } from "@gajae-code/tui";
|
|
9
|
+
import type { JobsSnapshot } from "../jobs-observer";
|
|
10
|
+
export type JobRefKind = "monitor" | "cron";
|
|
11
|
+
export interface JobRef {
|
|
12
|
+
kind: JobRefKind;
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
/** Compact relative time, e.g. "in 5m", "2m ago", "now". */
|
|
16
|
+
export declare function formatRelative(targetMs: number | undefined, nowMs?: number): string;
|
|
17
|
+
/** Parse a list item value back into a job reference. */
|
|
18
|
+
export declare function parseJobRef(value: string): JobRef | null;
|
|
19
|
+
/**
|
|
20
|
+
* Build the grouped jobs list: monitors first (newest-first), then crons
|
|
21
|
+
* (newest-first). The snapshot arrays are already sorted newest-first.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildJobsListItems(snapshot: JobsSnapshot): SelectItem[];
|
|
24
|
+
/**
|
|
25
|
+
* Build the detail-level items for a job: read-only info rows (value "noop"),
|
|
26
|
+
* then the destructive action, then a back row. `output` is the bounded monitor
|
|
27
|
+
* output tail (ignored for cron jobs).
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildJobDetailItems(snapshot: JobsSnapshot, ref: JobRef, output?: string): SelectItem[];
|
|
30
|
+
/** Yes/No confirm items for a destructive action. */
|
|
31
|
+
export declare function buildConfirmItems(actionLabel: string): SelectItem[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Container, type SelectItem, SelectList } from "@gajae-code/tui";
|
|
2
|
+
import type { JobsSnapshot } from "../jobs-observer";
|
|
3
|
+
/**
|
|
4
|
+
* Generic single-level selector used by the jobs overlay. The selector
|
|
5
|
+
* controller mounts a fresh instance per navigation level (list -> detail ->
|
|
6
|
+
* confirm); focus is placed on the inner SelectList, matching the existing
|
|
7
|
+
* selector components (e.g. ThemeSelectorComponent).
|
|
8
|
+
*/
|
|
9
|
+
export declare class JobsSelectorComponent extends Container {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(items: SelectItem[], onSelect: (item: SelectItem) => void, onCancel: () => void, maxVisible?: number);
|
|
12
|
+
getSelectList(): SelectList;
|
|
13
|
+
}
|
|
14
|
+
export interface JobsOverlayController {
|
|
15
|
+
acknowledgeFailures(): void;
|
|
16
|
+
getSnapshot(): JobsSnapshot;
|
|
17
|
+
getMonitorOutput(id: string): string;
|
|
18
|
+
cancelMonitor(id: string): boolean;
|
|
19
|
+
deleteCron(id: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface JobsOverlayCallbacks {
|
|
22
|
+
close(): void;
|
|
23
|
+
requestRender(): void;
|
|
24
|
+
}
|
|
25
|
+
export declare class JobsOverlayComponent extends Container {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(controller: JobsOverlayController, callbacks: JobsOverlayCallbacks);
|
|
28
|
+
getFocus(): SelectList;
|
|
29
|
+
handleInput(data: string): void;
|
|
30
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle } from "../../../config/settings-schema";
|
|
2
2
|
import type { AgentSession } from "../../../session/agent-session";
|
|
3
|
+
import type { JobsSnapshot } from "../../jobs-observer";
|
|
3
4
|
import type { StatusLineSegmentOptions, StatusLineSettings } from "../status-line";
|
|
4
5
|
export type { StatusLinePreset, StatusLineSegmentId, StatusLineSegmentOptions, StatusLineSeparatorStyle, StatusLineSettings, };
|
|
5
6
|
export type RGB = readonly [number, number, number];
|
|
@@ -28,6 +29,7 @@ export interface SegmentContext {
|
|
|
28
29
|
contextWindow: number;
|
|
29
30
|
autoCompactEnabled: boolean;
|
|
30
31
|
subagentCount: number;
|
|
32
|
+
jobs: JobsSnapshot;
|
|
31
33
|
sessionStartTime: number;
|
|
32
34
|
git: {
|
|
33
35
|
branch: string | null;
|
|
@@ -2,6 +2,7 @@ import { type Component } from "@gajae-code/tui";
|
|
|
2
2
|
import type { StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle } from "../../config/settings-schema";
|
|
3
3
|
import type { AgentSession } from "../../session/agent-session";
|
|
4
4
|
import { type SkillActiveEntry } from "../../skill-state/active-state";
|
|
5
|
+
import { type JobsSnapshot } from "../jobs-observer";
|
|
5
6
|
export interface StatusLineSegmentOptions {
|
|
6
7
|
model?: {
|
|
7
8
|
showThinkingLevel?: boolean;
|
|
@@ -39,6 +40,7 @@ export declare class StatusLineComponent implements Component {
|
|
|
39
40
|
updateSettings(settings: StatusLineSettings): void;
|
|
40
41
|
setAutoCompactEnabled(enabled: boolean): void;
|
|
41
42
|
setSubagentCount(count: number): void;
|
|
43
|
+
setJobs(jobs: JobsSnapshot): void;
|
|
42
44
|
setSessionStartTime(time: number): void;
|
|
43
45
|
setPlanModeStatus(status: {
|
|
44
46
|
enabled: boolean;
|
|
@@ -17,6 +17,7 @@ export declare class InputController {
|
|
|
17
17
|
currentText?: string;
|
|
18
18
|
}): number;
|
|
19
19
|
handleBackgroundCommand(): void;
|
|
20
|
+
handleTextPaste(text: string): boolean | Promise<boolean>;
|
|
20
21
|
handleImagePaste(): Promise<boolean>;
|
|
21
22
|
createAutocompleteProvider(commands: SlashCommand[], basePath: string): AutocompleteProvider;
|
|
22
23
|
/** Copy the current editor line to the system clipboard. */
|
|
@@ -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";
|
|
@@ -191,6 +191,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
191
191
|
handleSTTToggle(): Promise<void>;
|
|
192
192
|
showDebugSelector(): void;
|
|
193
193
|
showSessionObserver(): void;
|
|
194
|
+
showJobsOverlay(): void;
|
|
194
195
|
resetObserverRegistry(): void;
|
|
195
196
|
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
196
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;
|