indusagi-coding-agent 0.2.5 → 0.2.9
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 +9 -0
- package/README.md +9 -5
- package/dist/entry.js +14267 -24282
- package/dist/guardrails.js +924 -7867
- package/dist/index.js +13706 -23775
- package/package.json +3 -2
- package/src/_decls/entry.ts +18 -0
- package/src/_decls/guardrails.ts +35 -0
- package/src/_decls/index.ts +26 -0
- package/src/addons/contract.ts +236 -0
- package/src/addons/dispatch/event-dispatcher.ts +164 -0
- package/src/addons/dispatch/index.ts +25 -0
- package/src/addons/dispatch/tool-interceptor.ts +208 -0
- package/src/addons/host.ts +225 -0
- package/src/addons/index.ts +112 -0
- package/src/addons/manifest.ts +158 -0
- package/src/addons/sandbox.ts +170 -0
- package/src/addons/surface.ts +78 -0
- package/src/boot/auth-vault.ts +195 -0
- package/src/boot/boot.ts +138 -0
- package/src/boot/contract.ts +238 -0
- package/src/boot/heap.ts +59 -0
- package/src/boot/index.ts +28 -0
- package/src/boot/invocation.ts +93 -0
- package/src/boot/runners/addon-wiring.ts +153 -0
- package/src/boot/runners/checkpoint.ts +169 -0
- package/src/boot/runners/delegate-runner.ts +294 -0
- package/src/boot/runners/index.ts +13 -0
- package/src/boot/runners/link-runner.ts +45 -0
- package/src/boot/runners/memdir.ts +168 -0
- package/src/boot/runners/oneshot-runner.ts +58 -0
- package/src/boot/runners/read-state.ts +90 -0
- package/src/boot/runners/registry.ts +42 -0
- package/src/boot/runners/repl-runner.ts +143 -0
- package/src/boot/runners/server-mode.ts +121 -0
- package/src/boot/runners/session.ts +641 -0
- package/src/boot/server-token.ts +148 -0
- package/src/boot/stages.ts +167 -0
- package/src/boot/upgrade/apply.ts +94 -0
- package/src/boot/upgrade/index.ts +13 -0
- package/src/boot/upgrade/upgrades.ts +289 -0
- package/src/briefing/compose.ts +150 -0
- package/src/briefing/context-docs.ts +19 -0
- package/src/briefing/contract.ts +717 -0
- package/src/briefing/index.ts +31 -0
- package/src/briefing/macros.ts +97 -0
- package/src/briefing/skills.ts +47 -0
- package/src/capability-deck/bridge-ledger/index.ts +27 -0
- package/src/capability-deck/bridge-ledger/key.ts +67 -0
- package/src/capability-deck/bridge-ledger/ledger.ts +131 -0
- package/src/capability-deck/bridge-ledger/network.ts +117 -0
- package/src/capability-deck/builtin-bridge.ts +312 -0
- package/src/capability-deck/cards/bg-process-card.ts +335 -0
- package/src/capability-deck/cards/index.ts +115 -0
- package/src/capability-deck/cards/memory-card.ts +146 -0
- package/src/capability-deck/cards/plan-file.ts +97 -0
- package/src/capability-deck/cards/plan-tools.ts +185 -0
- package/src/capability-deck/cards/saas-card.ts +183 -0
- package/src/capability-deck/cards/task-card.ts +207 -0
- package/src/capability-deck/cards/todo-card.ts +168 -0
- package/src/capability-deck/cards/workflow-card.ts +247 -0
- package/src/capability-deck/contract.ts +388 -0
- package/src/capability-deck/index.ts +48 -0
- package/src/capability-deck/manifest.ts +109 -0
- package/src/capability-deck/provision.ts +169 -0
- package/src/channels/contract.ts +191 -0
- package/src/channels/framer.ts +50 -0
- package/src/channels/index.ts +101 -0
- package/src/channels/link/dialog.ts +129 -0
- package/src/channels/link/driver.ts +190 -0
- package/src/channels/link/index.ts +34 -0
- package/src/channels/link/server.ts +134 -0
- package/src/channels/oneshot.ts +90 -0
- package/src/channels/ops.ts +65 -0
- package/src/channels/session-ops.ts +81 -0
- package/src/conductor/bash-guard.ts +599 -0
- package/src/conductor/catalog/catalog.ts +116 -0
- package/src/conductor/catalog/index.ts +8 -0
- package/src/conductor/catalog/matcher.ts +134 -0
- package/src/conductor/conductor.ts +234 -0
- package/src/conductor/contract.ts +842 -0
- package/src/conductor/diagnostics.ts +227 -0
- package/src/conductor/index.ts +33 -0
- package/src/conductor/permissions.ts +588 -0
- package/src/conductor/quota-error.ts +49 -0
- package/src/conductor/signal-hub/hub.ts +46 -0
- package/src/conductor/signal-hub/index.ts +2 -0
- package/src/conductor/signal-hub/translate.test.ts +81 -0
- package/src/conductor/signal-hub/translate.ts +74 -0
- package/src/conductor/skill-parse/index.ts +2 -0
- package/src/conductor/skill-parse/parse.ts +108 -0
- package/src/conductor/transcript-store/index.ts +22 -0
- package/src/conductor/transcript-store/serialize.ts +116 -0
- package/src/conductor/transcript-store/store.ts +205 -0
- package/src/console/auth-status.ts +56 -0
- package/src/console/components/AgentsView.ts +165 -0
- package/src/console/components/BackgroundAgents.ts +155 -0
- package/src/console/components/Banner.ts +334 -0
- package/src/console/components/Composer.ts +94 -0
- package/src/console/components/StatusBar.ts +49 -0
- package/src/console/components/TerminalConsole.ts +1090 -0
- package/src/console/components/WorkingIndicator.ts +98 -0
- package/src/console/components/banner-sweep.ts +24 -0
- package/src/console/components/welcome.ts +74 -0
- package/src/console/contract.ts +630 -0
- package/src/console/index.ts +34 -0
- package/src/console/input/complete.ts +127 -0
- package/src/console/input/dir-reader.ts +34 -0
- package/src/console/input/index.ts +23 -0
- package/src/console/input/keymap.ts +159 -0
- package/src/console/input/paste.ts +104 -0
- package/src/console/mount.ts +56 -0
- package/src/console/overlays/approval-queue.ts +57 -0
- package/src/console/overlays/approval.ts +130 -0
- package/src/console/overlays/auth.ts +342 -0
- package/src/console/overlays/boards.ts +308 -0
- package/src/console/overlays/host.ts +36 -0
- package/src/console/overlays/index.ts +26 -0
- package/src/console/overlays/pickers.ts +258 -0
- package/src/console/overlays/sessions.ts +190 -0
- package/src/console/reducer.ts +182 -0
- package/src/console/slash/builtins.ts +81 -0
- package/src/console/slash/commands/dynamic.ts +83 -0
- package/src/console/slash/commands/integrations.ts +695 -0
- package/src/console/slash/commands/shared.ts +75 -0
- package/src/console/slash/commands/transcript.ts +263 -0
- package/src/console/slash/commands/workbench.ts +246 -0
- package/src/console/slash/index.ts +15 -0
- package/src/console/slash/registry.ts +70 -0
- package/src/console/slash/resolve.ts +63 -0
- package/src/console/startup.ts +209 -0
- package/src/console/theme/adapter.ts +45 -0
- package/src/console/theme/index.ts +7 -0
- package/src/console/theme/palette.ts +68 -0
- package/src/console/theme/resolve.ts +39 -0
- package/src/console/theme/tokens.ts +71 -0
- package/src/entry.ts +55 -0
- package/src/guardrails.ts +37 -0
- package/src/index.ts +18 -0
- package/src/insight/channel.ts +88 -0
- package/src/insight/contract.ts +185 -0
- package/src/insight/index.ts +110 -0
- package/src/insight/recorder.ts +213 -0
- package/src/insight/redaction.ts +157 -0
- package/src/insight/replay.ts +158 -0
- package/src/insight/sampling.ts +70 -0
- package/src/insight/serialize.ts +50 -0
- package/src/insight/sinks/console.ts +64 -0
- package/src/insight/sinks/file.ts +40 -0
- package/src/insight/sinks/index.ts +24 -0
- package/src/insight/sinks/stream.ts +54 -0
- package/src/integrations/sarvam/attach.ts +239 -0
- package/src/integrations/sarvam/config.ts +156 -0
- package/src/integrations/sarvam/index.ts +25 -0
- package/src/integrations/sarvam/sarvam.test.ts +60 -0
- package/src/integrations/sarvam/types.ts +27 -0
- package/src/integrations/zoho/attach.ts +342 -0
- package/src/integrations/zoho/config.ts +125 -0
- package/src/integrations/zoho/index.ts +27 -0
- package/src/integrations/zoho/types.ts +21 -0
- package/src/integrations/zoho/zoho.test.ts +50 -0
- package/src/kit/clipboard-image.ts +107 -0
- package/src/kit/external-editor.ts +48 -0
- package/src/kit/image.ts +59 -0
- package/src/kit/index.ts +51 -0
- package/src/kit/shell.ts +19 -0
- package/src/kit/tool-fetch.ts +85 -0
- package/src/launch/catalog.ts +148 -0
- package/src/launch/contract.ts +187 -0
- package/src/launch/credentials.ts +625 -0
- package/src/launch/index.ts +98 -0
- package/src/launch/invocation/attachments.ts +179 -0
- package/src/launch/invocation/flags.ts +196 -0
- package/src/launch/invocation/index.ts +25 -0
- package/src/launch/invocation/read.ts +260 -0
- package/src/launch/invocation/usage.ts +67 -0
- package/src/launch/login.ts +324 -0
- package/src/launch/oauth.test.ts +18 -0
- package/src/launch/oauth.ts +203 -0
- package/src/launch/packages.ts +194 -0
- package/src/launch/pickers.ts +189 -0
- package/src/runtime-bridge/bridges/_drive.ts +96 -0
- package/src/runtime-bridge/bridges/builtins.ts +68 -0
- package/src/runtime-bridge/bridges/claude-cli.ts +123 -0
- package/src/runtime-bridge/bridges/codex-cli.ts +142 -0
- package/src/runtime-bridge/bridges/index.ts +33 -0
- package/src/runtime-bridge/bridges/indusagi-cli.ts +155 -0
- package/src/runtime-bridge/broker.ts +227 -0
- package/src/runtime-bridge/contract.ts +122 -0
- package/src/runtime-bridge/index.ts +79 -0
- package/src/runtime-bridge/sink.ts +180 -0
- package/src/sessions/contract.ts +81 -0
- package/src/sessions/index.ts +13 -0
- package/src/sessions/library.ts +229 -0
- package/src/settings/contract.ts +114 -0
- package/src/settings/index.ts +32 -0
- package/src/settings/manager.ts +117 -0
- package/src/transcript-export/index.ts +45 -0
- package/src/transcript-export/publish.ts +260 -0
- package/src/transcript-export/sgr.ts +315 -0
- package/src/transcript-export/template.ts +272 -0
- package/src/transcript-export/theme-bridge.ts +150 -0
- package/src/window-budget/budget/estimate.ts +135 -0
- package/src/window-budget/budget/gate.ts +33 -0
- package/src/window-budget/budget/index.ts +16 -0
- package/src/window-budget/budget/slice.ts +56 -0
- package/src/window-budget/condenser.ts +58 -0
- package/src/window-budget/contract.ts +184 -0
- package/src/window-budget/index.ts +19 -0
- package/src/window-budget/microcompact.ts +95 -0
- package/src/window-budget/rehydrate.ts +136 -0
- package/src/window-budget/summarize/condense.ts +103 -0
- package/src/window-budget/summarize/index.ts +14 -0
- package/src/window-budget/summarize/prompt.ts +149 -0
- package/src/workflow-engine/agent-runner.ts +181 -0
- package/src/workflow-engine/display.ts +224 -0
- package/src/workflow-engine/engine.ts +294 -0
- package/src/workflow-engine/index.ts +23 -0
- package/src/workflow-engine/parse.ts +172 -0
- package/src/workflow-engine/structured-output.ts +35 -0
- package/src/workspace/brand.ts +29 -0
- package/src/workspace/index.ts +18 -0
- package/src/workspace/locator.ts +103 -0
- package/src/workspace/runtime-detect.ts +64 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuntimeBroker — the single decision point that routes every turn to either an
|
|
3
|
+
* external runtime or the framework network stream.
|
|
4
|
+
*/
|
|
5
|
+
import { streamSimple } from "indusagi/ai";
|
|
6
|
+
import type {
|
|
7
|
+
Api,
|
|
8
|
+
AssistantMessageEventStream,
|
|
9
|
+
ChildTransport,
|
|
10
|
+
Context,
|
|
11
|
+
ExchangeOptions,
|
|
12
|
+
ExternalRuntimeSpec,
|
|
13
|
+
Model,
|
|
14
|
+
NormalizedEvent,
|
|
15
|
+
RuntimeBridge,
|
|
16
|
+
RuntimeBroker,
|
|
17
|
+
} from "./contract.js";
|
|
18
|
+
|
|
19
|
+
export const RUNTIME_LINK_ENTRY = "external-runtime-link" as const;
|
|
20
|
+
export type RuntimeLinkEntryTag = typeof RUNTIME_LINK_ENTRY;
|
|
21
|
+
|
|
22
|
+
export interface RuntimeLink {
|
|
23
|
+
readonly source: string;
|
|
24
|
+
readonly bridge: string;
|
|
25
|
+
readonly resumeToken: string;
|
|
26
|
+
readonly at: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function runtimeSourceKey(source: string, modelId: string, bridge: string): string {
|
|
30
|
+
return `${source}|${modelId}|${bridge}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface RuntimeLinkStore {
|
|
34
|
+
save(link: RuntimeLink): Promise<void> | void;
|
|
35
|
+
find(sourceKey: string): Promise<string | undefined> | string | undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TransportContext {
|
|
39
|
+
readonly spec: ExternalRuntimeSpec;
|
|
40
|
+
readonly model: Model<Api>;
|
|
41
|
+
readonly opts: ExchangeOptions;
|
|
42
|
+
readonly resume?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ChildTransportFactory = (ctx: TransportContext) => ChildTransport;
|
|
46
|
+
|
|
47
|
+
export type FrameworkStream = (
|
|
48
|
+
model: Model<Api>,
|
|
49
|
+
context: Context,
|
|
50
|
+
opts: ExchangeOptions,
|
|
51
|
+
) => AssistantMessageEventStream;
|
|
52
|
+
|
|
53
|
+
export interface RuntimeBrokerDeps {
|
|
54
|
+
readonly transportFactory?: ChildTransportFactory;
|
|
55
|
+
readonly linkStore?: RuntimeLinkStore;
|
|
56
|
+
readonly frameworkStream?: FrameworkStream;
|
|
57
|
+
readonly bridges?: readonly RuntimeBridge[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RuntimeBrokerRuntime extends RuntimeBroker {
|
|
61
|
+
exchange(
|
|
62
|
+
model: Model<Api>,
|
|
63
|
+
context: Context,
|
|
64
|
+
opts?: ExchangeOptions,
|
|
65
|
+
): AssistantMessageEventStream;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type ResumeEvent = Extract<NormalizedEvent, { kind: "resume" }>;
|
|
69
|
+
|
|
70
|
+
function resumeTokenOf(payload: unknown): string | undefined {
|
|
71
|
+
if (typeof payload !== "object" || payload === null) return undefined;
|
|
72
|
+
const rec = payload as Record<string, unknown>;
|
|
73
|
+
if (rec["method"] === "session/resume") {
|
|
74
|
+
const params = rec["params"];
|
|
75
|
+
if (typeof params === "object" && params !== null) {
|
|
76
|
+
const t = (params as Record<string, unknown>)["resumeToken"];
|
|
77
|
+
if (typeof t === "string") return t;
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
if (rec["type"] === "system" && rec["subtype"] === "init") {
|
|
82
|
+
const id = rec["session_id"];
|
|
83
|
+
if (typeof id === "string") return id;
|
|
84
|
+
}
|
|
85
|
+
if (rec["type"] === "thread.started") {
|
|
86
|
+
const id = rec["thread_id"];
|
|
87
|
+
if (typeof id === "string") return id;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface ResumeTap {
|
|
93
|
+
onMessage: (m: { payload: unknown }) => void;
|
|
94
|
+
onClose: (disposer: () => void) => void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function makeResumeTap(
|
|
98
|
+
store: RuntimeLinkStore | undefined,
|
|
99
|
+
source: string,
|
|
100
|
+
modelId: string,
|
|
101
|
+
bridge: string,
|
|
102
|
+
): ResumeTap | undefined {
|
|
103
|
+
if (!store) return undefined;
|
|
104
|
+
let saved = false;
|
|
105
|
+
let disposer: (() => void) | undefined;
|
|
106
|
+
const persist = (resumeToken: string): void => {
|
|
107
|
+
if (saved) return;
|
|
108
|
+
saved = true;
|
|
109
|
+
const link: RuntimeLink = {
|
|
110
|
+
source,
|
|
111
|
+
bridge,
|
|
112
|
+
resumeToken,
|
|
113
|
+
at: new Date().toISOString(),
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
const r = store.save(link);
|
|
117
|
+
if (r && typeof (r as Promise<void>).catch === "function") {
|
|
118
|
+
(r as Promise<void>).catch(() => undefined);
|
|
119
|
+
}
|
|
120
|
+
} catch {
|
|
121
|
+
/* ignore persistence failures */
|
|
122
|
+
}
|
|
123
|
+
disposer?.();
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
onMessage: (m): void => {
|
|
127
|
+
const token = resumeTokenOf(m.payload);
|
|
128
|
+
if (token !== undefined) persist(token);
|
|
129
|
+
},
|
|
130
|
+
onClose: (d): void => {
|
|
131
|
+
disposer = d;
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class Broker implements RuntimeBrokerRuntime {
|
|
137
|
+
readonly #bridges: Map<string, RuntimeBridge> = new Map();
|
|
138
|
+
readonly #transportFactory: ChildTransportFactory | undefined;
|
|
139
|
+
readonly #linkStore: RuntimeLinkStore | undefined;
|
|
140
|
+
readonly #framework: FrameworkStream;
|
|
141
|
+
readonly #knownSpecs: Readonly<Record<string, ExternalRuntimeSpec>> = {
|
|
142
|
+
"claude-cli": {
|
|
143
|
+
adapter: "claude-cli",
|
|
144
|
+
authMode: "external-cli",
|
|
145
|
+
binaryPath: "claude",
|
|
146
|
+
args: ["--output-format", "stream-json", "--verbose"],
|
|
147
|
+
},
|
|
148
|
+
"codex-cli": {
|
|
149
|
+
adapter: "codex-cli",
|
|
150
|
+
authMode: "external-cli",
|
|
151
|
+
binaryPath: "codex",
|
|
152
|
+
args: ["--json"],
|
|
153
|
+
},
|
|
154
|
+
"indusagi-cli": {
|
|
155
|
+
adapter: "indusagi-cli",
|
|
156
|
+
authMode: "external-cli",
|
|
157
|
+
binaryPath: "indusagi",
|
|
158
|
+
args: ["--rpc"],
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
constructor(deps: RuntimeBrokerDeps = {}) {
|
|
163
|
+
this.#transportFactory = deps.transportFactory;
|
|
164
|
+
this.#linkStore = deps.linkStore;
|
|
165
|
+
this.#framework = deps.frameworkStream ?? ((model, context, opts) => streamSimple(model, context, opts));
|
|
166
|
+
for (const bridge of deps.bridges ?? []) this.register(bridge);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
register(bridge: RuntimeBridge): void {
|
|
170
|
+
this.#bridges.set(bridge.adapter, bridge);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
resolveSpec(model: Model<Api>): ExternalRuntimeSpec | undefined {
|
|
174
|
+
const baseUrl = model.baseUrl;
|
|
175
|
+
if (!baseUrl.startsWith("bridge:")) return undefined;
|
|
176
|
+
const adapter = baseUrl.slice("bridge:".length);
|
|
177
|
+
if (!this.#bridges.has(adapter)) return undefined;
|
|
178
|
+
return this.#knownSpecs[adapter];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
requiresCredential(spec: ExternalRuntimeSpec): boolean {
|
|
182
|
+
const bridge = this.#bridges.get(spec.adapter);
|
|
183
|
+
return bridge ? bridge.requiresCredential(spec) : spec.authMode === "api-key";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
route(model: Model<Api>, _context: Context, _opts: ExchangeOptions): { target: "external"; bridge: RuntimeBridge; spec: ExternalRuntimeSpec } | { target: "framework" } {
|
|
187
|
+
const spec = this.resolveSpec(model);
|
|
188
|
+
if (!spec) return { target: "framework" };
|
|
189
|
+
const bridge = this.#bridges.get(spec.adapter);
|
|
190
|
+
if (!bridge) return { target: "framework" };
|
|
191
|
+
return { target: "external", bridge, spec };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
exchange(model: Model<Api>, context: Context, opts: ExchangeOptions = {}): AssistantMessageEventStream {
|
|
195
|
+
const baseUrl = model.baseUrl;
|
|
196
|
+
const adapter = baseUrl.startsWith("bridge:") ? baseUrl.slice("bridge:".length) : undefined;
|
|
197
|
+
const spec = adapter ? this.resolveSpec(model) : undefined;
|
|
198
|
+
const bridge = spec ? this.#bridges.get(spec.adapter) : undefined;
|
|
199
|
+
if (!spec || !bridge) {
|
|
200
|
+
return this.#framework(model, context, opts);
|
|
201
|
+
}
|
|
202
|
+
if (!this.#transportFactory) {
|
|
203
|
+
return this.#framework(model, context, opts);
|
|
204
|
+
}
|
|
205
|
+
const source = String(model.provider);
|
|
206
|
+
const sourceKey = runtimeSourceKey(source, model.id, spec.adapter);
|
|
207
|
+
const persisted = this.#linkStore?.find(sourceKey);
|
|
208
|
+
const resume = typeof persisted === "string" ? persisted : opts.resume;
|
|
209
|
+
const exchangeOpts: ExchangeOptions = resume !== undefined ? { ...opts, resume } : opts;
|
|
210
|
+
const transport = this.#transportFactory({
|
|
211
|
+
spec,
|
|
212
|
+
model,
|
|
213
|
+
opts: exchangeOpts,
|
|
214
|
+
...(resume !== undefined ? { resume } : {}),
|
|
215
|
+
});
|
|
216
|
+
const tap = makeResumeTap(this.#linkStore, source, model.id, spec.adapter);
|
|
217
|
+
if (tap) {
|
|
218
|
+
const dispose = transport.onMessage(tap.onMessage);
|
|
219
|
+
tap.onClose(dispose);
|
|
220
|
+
}
|
|
221
|
+
return bridge.runExchange(model, context, exchangeOpts, transport);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export function createRuntimeBroker(deps: RuntimeBrokerDeps = {}): RuntimeBrokerRuntime {
|
|
226
|
+
return new Broker(deps);
|
|
227
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-bridge contract — the FROZEN type surface of provider *routing*.
|
|
3
|
+
*/
|
|
4
|
+
import type {
|
|
5
|
+
Api,
|
|
6
|
+
AssistantMessage,
|
|
7
|
+
AssistantMessageEventStream,
|
|
8
|
+
Context,
|
|
9
|
+
KnownProvider,
|
|
10
|
+
Model,
|
|
11
|
+
SimpleStreamOptions,
|
|
12
|
+
StopReason,
|
|
13
|
+
ToolCall,
|
|
14
|
+
} from "indusagi/ai";
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
Api,
|
|
18
|
+
AssistantMessage,
|
|
19
|
+
AssistantMessageEventStream,
|
|
20
|
+
Context,
|
|
21
|
+
KnownProvider,
|
|
22
|
+
Model,
|
|
23
|
+
SimpleStreamOptions,
|
|
24
|
+
StopReason,
|
|
25
|
+
ToolCall,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type RuntimeAdapterId = "claude-cli" | "codex-cli" | "indusagi-cli" | (string & {});
|
|
29
|
+
|
|
30
|
+
export type RuntimeAuthMode = "external-cli" | "api-key";
|
|
31
|
+
|
|
32
|
+
export interface ExternalRuntimeSpec {
|
|
33
|
+
readonly adapter: RuntimeAdapterId;
|
|
34
|
+
readonly authMode: RuntimeAuthMode;
|
|
35
|
+
readonly binaryPath?: string;
|
|
36
|
+
readonly args?: readonly string[];
|
|
37
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
38
|
+
readonly delegate?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const RUNTIME_ENDPOINT_SCHEME = "bridge:" as const;
|
|
42
|
+
export type RuntimeEndpointScheme = typeof RUNTIME_ENDPOINT_SCHEME;
|
|
43
|
+
|
|
44
|
+
export function runtimeEndpoint(adapter: RuntimeAdapterId): string {
|
|
45
|
+
return `${RUNTIME_ENDPOINT_SCHEME}${adapter}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type NormalizedEvent =
|
|
49
|
+
| { readonly kind: "text"; readonly delta: string }
|
|
50
|
+
| { readonly kind: "thinking"; readonly delta: string }
|
|
51
|
+
| { readonly kind: "tool_call"; readonly call: ToolCall }
|
|
52
|
+
| { readonly kind: "resume"; readonly resumeToken: string }
|
|
53
|
+
| { readonly kind: "finish"; readonly reason: FinishReason }
|
|
54
|
+
| { readonly kind: "failed"; readonly error: BridgeFailure };
|
|
55
|
+
|
|
56
|
+
export type NormalizedEventKind = NormalizedEvent["kind"];
|
|
57
|
+
|
|
58
|
+
export type NormalizedEventOf<K extends NormalizedEventKind> = Extract<
|
|
59
|
+
NormalizedEvent,
|
|
60
|
+
{ kind: K }
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
export type FinishReason = Extract<StopReason, "stop" | "length" | "toolUse">;
|
|
64
|
+
|
|
65
|
+
export interface BridgeFailure {
|
|
66
|
+
readonly message: string;
|
|
67
|
+
readonly aborted?: boolean;
|
|
68
|
+
readonly cause?: unknown;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface BridgeEventSink {
|
|
72
|
+
start(): void;
|
|
73
|
+
text(delta: string): void;
|
|
74
|
+
thinking(delta: string): void;
|
|
75
|
+
toolCall(call: ToolCall): void;
|
|
76
|
+
emit(event: NormalizedEvent): void;
|
|
77
|
+
finishSuccess(reason?: FinishReason): void;
|
|
78
|
+
finishError(error: BridgeFailure): void;
|
|
79
|
+
readonly stream: AssistantMessageEventStream;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ChildMessage {
|
|
83
|
+
readonly payload: unknown;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ChildRequest {
|
|
87
|
+
readonly body: unknown;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ChildTransport {
|
|
91
|
+
send(request: ChildRequest): Promise<void>;
|
|
92
|
+
onMessage(listener: (message: ChildMessage) => void): () => void;
|
|
93
|
+
close(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ExchangeOptions extends SimpleStreamOptions {
|
|
97
|
+
readonly sessionId?: string;
|
|
98
|
+
readonly cwd?: string;
|
|
99
|
+
readonly resume?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface RuntimeBridge {
|
|
103
|
+
readonly adapter: RuntimeAdapterId;
|
|
104
|
+
runExchange(
|
|
105
|
+
model: Model<Api>,
|
|
106
|
+
context: Context,
|
|
107
|
+
opts: ExchangeOptions,
|
|
108
|
+
transport: ChildTransport,
|
|
109
|
+
): AssistantMessageEventStream;
|
|
110
|
+
requiresCredential(spec: ExternalRuntimeSpec): boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export type RuntimeRoute =
|
|
114
|
+
| { readonly target: "external"; readonly bridge: RuntimeBridge; readonly spec: ExternalRuntimeSpec }
|
|
115
|
+
| { readonly target: "framework" };
|
|
116
|
+
|
|
117
|
+
export interface RuntimeBroker {
|
|
118
|
+
register(bridge: RuntimeBridge): void;
|
|
119
|
+
route(model: Model<Api>, context: Context, opts: ExchangeOptions): RuntimeRoute;
|
|
120
|
+
resolveSpec(model: Model<Api>): ExternalRuntimeSpec | undefined;
|
|
121
|
+
requiresCredential(spec: ExternalRuntimeSpec): boolean;
|
|
122
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Type declarations recovered from dist/types (no runtime body)
|
|
3
|
+
/**
|
|
4
|
+
* Runtime-bridge subsystem — public barrel.
|
|
5
|
+
*
|
|
6
|
+
* Re-exports the FROZEN provider-routing contract: the external-runtime
|
|
7
|
+
* annotation ({@link ExternalRuntimeSpec} + the `bridge:<adapter>` endpoint
|
|
8
|
+
* convention), the provider-neutral {@link NormalizedEvent} union, the single
|
|
9
|
+
* {@link BridgeEventSink} push-stream helper, the injectable
|
|
10
|
+
* {@link ChildTransport} boundary, and the routing surface itself
|
|
11
|
+
* ({@link RuntimeBridge}, {@link RuntimeBroker}, {@link RuntimeRoute}).
|
|
12
|
+
*
|
|
13
|
+
* Behavior modules (the concrete bridges under `bridges/`, the sink
|
|
14
|
+
* implementation, the broker) are added to this barrel as they land; consumers
|
|
15
|
+
* import the routing surface from `src/runtime-bridge` rather than reaching into
|
|
16
|
+
* individual modules.
|
|
17
|
+
*/
|
|
18
|
+
export type {
|
|
19
|
+
RuntimeAdapterId,
|
|
20
|
+
RuntimeAuthMode,
|
|
21
|
+
ExternalRuntimeSpec,
|
|
22
|
+
RuntimeEndpointScheme,
|
|
23
|
+
NormalizedEvent,
|
|
24
|
+
NormalizedEventKind,
|
|
25
|
+
NormalizedEventOf,
|
|
26
|
+
FinishReason,
|
|
27
|
+
BridgeFailure,
|
|
28
|
+
BridgeEventSink,
|
|
29
|
+
ChildMessage,
|
|
30
|
+
ChildRequest,
|
|
31
|
+
ChildTransport,
|
|
32
|
+
ExchangeOptions,
|
|
33
|
+
RuntimeBridge,
|
|
34
|
+
RuntimeBroker,
|
|
35
|
+
RuntimeRoute,
|
|
36
|
+
Api,
|
|
37
|
+
AssistantMessage,
|
|
38
|
+
AssistantMessageEventStream,
|
|
39
|
+
Context,
|
|
40
|
+
KnownProvider,
|
|
41
|
+
Model,
|
|
42
|
+
SimpleStreamOptions,
|
|
43
|
+
StopReason,
|
|
44
|
+
ToolCall,
|
|
45
|
+
} from "./contract.js";
|
|
46
|
+
export { RUNTIME_ENDPOINT_SCHEME, runtimeEndpoint } from "./contract.js";
|
|
47
|
+
export type { BridgeMessageSeed } from "./sink.js";
|
|
48
|
+
export { createBridgeSink } from "./sink.js";
|
|
49
|
+
export {
|
|
50
|
+
claudeCliBridge,
|
|
51
|
+
codexCliBridge,
|
|
52
|
+
indusagiCliBridge,
|
|
53
|
+
makeIndusagiCliBridge,
|
|
54
|
+
BUILTIN_RUNTIME_SPECS,
|
|
55
|
+
BUILTIN_ADAPTERS,
|
|
56
|
+
builtinRuntimeSpec,
|
|
57
|
+
annotateCard,
|
|
58
|
+
withRuntimeEndpoint,
|
|
59
|
+
specFromModel,
|
|
60
|
+
type RuntimeAnnotatedModel,
|
|
61
|
+
driveExchange,
|
|
62
|
+
seedFromModel,
|
|
63
|
+
type ChildParser,
|
|
64
|
+
type ParseStep,
|
|
65
|
+
} from "./bridges/index.js";
|
|
66
|
+
export {
|
|
67
|
+
createRuntimeBroker,
|
|
68
|
+
runtimeSourceKey,
|
|
69
|
+
RUNTIME_LINK_ENTRY,
|
|
70
|
+
type RuntimeBrokerRuntime,
|
|
71
|
+
type RuntimeBrokerDeps,
|
|
72
|
+
type ChildTransportFactory,
|
|
73
|
+
type TransportContext,
|
|
74
|
+
type FrameworkStream,
|
|
75
|
+
type RuntimeLink,
|
|
76
|
+
type RuntimeLinkStore,
|
|
77
|
+
type RuntimeLinkEntryTag,
|
|
78
|
+
type ResumeEvent,
|
|
79
|
+
} from "./broker.js";
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single {@link BridgeEventSink} implementation.
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
createAssistantMessageEventStream,
|
|
6
|
+
type AssistantMessage,
|
|
7
|
+
type Usage,
|
|
8
|
+
} from "indusagi/ai";
|
|
9
|
+
import type {
|
|
10
|
+
BridgeEventSink,
|
|
11
|
+
BridgeFailure,
|
|
12
|
+
FinishReason,
|
|
13
|
+
NormalizedEvent,
|
|
14
|
+
ToolCall,
|
|
15
|
+
} from "./contract.js";
|
|
16
|
+
|
|
17
|
+
export interface BridgeMessageSeed {
|
|
18
|
+
readonly api: AssistantMessage["api"];
|
|
19
|
+
readonly provider: AssistantMessage["provider"];
|
|
20
|
+
readonly model: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function zeroUsage(): Usage {
|
|
24
|
+
return {
|
|
25
|
+
input: 0,
|
|
26
|
+
output: 0,
|
|
27
|
+
cacheRead: 0,
|
|
28
|
+
cacheWrite: 0,
|
|
29
|
+
totalTokens: 0,
|
|
30
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class BridgeSink implements BridgeEventSink {
|
|
35
|
+
readonly stream: ReturnType<typeof createAssistantMessageEventStream>;
|
|
36
|
+
partial: AssistantMessage;
|
|
37
|
+
open: { kind: "text" | "thinking"; index: number } | undefined;
|
|
38
|
+
started = false;
|
|
39
|
+
settled = false;
|
|
40
|
+
|
|
41
|
+
constructor(seed: BridgeMessageSeed) {
|
|
42
|
+
this.stream = createAssistantMessageEventStream();
|
|
43
|
+
this.partial = {
|
|
44
|
+
role: "assistant",
|
|
45
|
+
content: [],
|
|
46
|
+
api: seed.api,
|
|
47
|
+
provider: seed.provider,
|
|
48
|
+
model: seed.model,
|
|
49
|
+
usage: zeroUsage(),
|
|
50
|
+
stopReason: "stop",
|
|
51
|
+
timestamp: Date.now(),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
start(): void {
|
|
56
|
+
if (this.started || this.settled) return;
|
|
57
|
+
this.started = true;
|
|
58
|
+
this.stream.pushStart(this.partial);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
text(delta: string): void {
|
|
62
|
+
if (this.settled) return;
|
|
63
|
+
this.start();
|
|
64
|
+
const index = this.ensureOpen("text");
|
|
65
|
+
const block = this.partial.content[index];
|
|
66
|
+
if (block && block.type === "text") {
|
|
67
|
+
block.text += delta;
|
|
68
|
+
}
|
|
69
|
+
this.stream.pushTextDelta(index, delta, this.partial);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
thinking(delta: string): void {
|
|
73
|
+
if (this.settled) return;
|
|
74
|
+
this.start();
|
|
75
|
+
const index = this.ensureOpen("thinking");
|
|
76
|
+
const block = this.partial.content[index];
|
|
77
|
+
if (block && block.type === "thinking") {
|
|
78
|
+
block.thinking += delta;
|
|
79
|
+
}
|
|
80
|
+
this.stream.pushThinkingDelta(index, delta, this.partial);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
toolCall(call: ToolCall): void {
|
|
84
|
+
if (this.settled) return;
|
|
85
|
+
this.start();
|
|
86
|
+
this.closeOpen();
|
|
87
|
+
const index = this.partial.content.length;
|
|
88
|
+
const block = {
|
|
89
|
+
type: "toolCall" as const,
|
|
90
|
+
id: call.id,
|
|
91
|
+
name: call.name,
|
|
92
|
+
arguments: call.arguments,
|
|
93
|
+
...(call.thoughtSignature !== undefined
|
|
94
|
+
? { thoughtSignature: call.thoughtSignature }
|
|
95
|
+
: {}),
|
|
96
|
+
};
|
|
97
|
+
this.partial.content.push(block);
|
|
98
|
+
this.stream.pushToolCallStart(index, this.partial);
|
|
99
|
+
this.stream.pushToolCallDelta(index, JSON.stringify(block.arguments), this.partial);
|
|
100
|
+
this.stream.pushToolCallEnd(index, block, this.partial);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
emit(event: NormalizedEvent): void {
|
|
104
|
+
switch (event.kind) {
|
|
105
|
+
case "text":
|
|
106
|
+
this.text(event.delta);
|
|
107
|
+
return;
|
|
108
|
+
case "thinking":
|
|
109
|
+
this.thinking(event.delta);
|
|
110
|
+
return;
|
|
111
|
+
case "tool_call":
|
|
112
|
+
this.toolCall(event.call);
|
|
113
|
+
return;
|
|
114
|
+
case "resume":
|
|
115
|
+
return;
|
|
116
|
+
case "finish":
|
|
117
|
+
this.finishSuccess(event.reason);
|
|
118
|
+
return;
|
|
119
|
+
case "failed":
|
|
120
|
+
this.finishError(event.error);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
finishSuccess(reason: FinishReason = "stop"): void {
|
|
126
|
+
if (this.settled) return;
|
|
127
|
+
this.start();
|
|
128
|
+
this.closeOpen();
|
|
129
|
+
this.settled = true;
|
|
130
|
+
this.partial.stopReason = reason;
|
|
131
|
+
this.stream.pushDone(reason, this.partial);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
finishError(error: BridgeFailure): void {
|
|
135
|
+
if (this.settled) return;
|
|
136
|
+
this.start();
|
|
137
|
+
this.closeOpen();
|
|
138
|
+
this.settled = true;
|
|
139
|
+
const reason = error.aborted ? "aborted" : "error";
|
|
140
|
+
this.partial.stopReason = reason;
|
|
141
|
+
this.partial.errorMessage = error.message;
|
|
142
|
+
this.stream.pushError(reason, this.partial);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private ensureOpen(kind: "text" | "thinking"): number {
|
|
146
|
+
if (this.open) {
|
|
147
|
+
if (this.open.kind === kind) return this.open.index;
|
|
148
|
+
this.closeOpen();
|
|
149
|
+
}
|
|
150
|
+
const index = this.partial.content.length;
|
|
151
|
+
if (kind === "text") {
|
|
152
|
+
this.partial.content.push({ type: "text", text: "" });
|
|
153
|
+
this.stream.pushTextStart(index, this.partial);
|
|
154
|
+
} else {
|
|
155
|
+
this.partial.content.push({ type: "thinking", thinking: "" });
|
|
156
|
+
this.stream.pushThinkingStart(index, this.partial);
|
|
157
|
+
}
|
|
158
|
+
this.open = { kind, index };
|
|
159
|
+
return index;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private closeOpen(): void {
|
|
163
|
+
const open = this.open;
|
|
164
|
+
if (!open) return;
|
|
165
|
+
this.open = undefined;
|
|
166
|
+
const block = this.partial.content[open.index];
|
|
167
|
+
if (open.kind === "text" && block && block.type === "text") {
|
|
168
|
+
this.stream.pushTextEnd(open.index, block.text, this.partial);
|
|
169
|
+
} else if (open.kind === "thinking" && block && block.type === "thinking") {
|
|
170
|
+
this.stream.pushThinkingEnd(open.index, block.thinking, this.partial);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Construct a {@link BridgeEventSink} seeded with the bound model's identity.
|
|
177
|
+
*/
|
|
178
|
+
export function createBridgeSink(seed: BridgeMessageSeed): BridgeEventSink {
|
|
179
|
+
return new BridgeSink(seed);
|
|
180
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Type declarations recovered from dist/types (no runtime body)
|
|
3
|
+
/**
|
|
4
|
+
* Session Library contract — the value types the library surface speaks in.
|
|
5
|
+
*
|
|
6
|
+
* The library sits on top of the conductor's persistent transcript store: it
|
|
7
|
+
* enumerates the session files a workspace has accumulated, opens one back into
|
|
8
|
+
* a live {@link TranscriptStore}, and projects the resulting node tree into the
|
|
9
|
+
* flat shapes a navigator and a forking picker consume.
|
|
10
|
+
*
|
|
11
|
+
* These records are the *catalog/navigation* projections — the minimum a chooser
|
|
12
|
+
* UI needs. They deliberately hold no framework message objects: text is already
|
|
13
|
+
* reduced to a short preview, and identity is carried by stable string ids so a
|
|
14
|
+
* caller can list, rename, delete, walk, and fork without rehydrating payloads.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* One persisted session as the library catalogs it — what a chooser shows in a
|
|
18
|
+
* list before anything is opened.
|
|
19
|
+
*
|
|
20
|
+
* `id` is the bare session identifier (the filename stem the conductor's
|
|
21
|
+
* filesystem backend writes to); `path` is its absolute on-disk location. The
|
|
22
|
+
* remaining fields are best-effort enrichments filled when the library is asked
|
|
23
|
+
* to peek inside a file: a derived `name`, file `lastModified`/`size`, the
|
|
24
|
+
* `messageCount` of conversational nodes, and a short `preview` of the opening
|
|
25
|
+
* user turn. Any of them may be absent when only a shallow listing was taken.
|
|
26
|
+
*/
|
|
27
|
+
export interface SavedSession {
|
|
28
|
+
/** Bare session identifier — the filename stem, no extension or directory. */
|
|
29
|
+
readonly id: string;
|
|
30
|
+
/** Absolute on-disk path the session persists to. */
|
|
31
|
+
readonly path: string;
|
|
32
|
+
/** Human-facing label for the session, when one could be derived. */
|
|
33
|
+
readonly name?: string;
|
|
34
|
+
/** Last-modified wall-clock time of the file, in epoch milliseconds. */
|
|
35
|
+
readonly lastModified?: number;
|
|
36
|
+
/** Byte size of the session file on disk. */
|
|
37
|
+
readonly size?: number;
|
|
38
|
+
/** Count of conversational (user/assistant/tool) nodes in the transcript. */
|
|
39
|
+
readonly messageCount?: number;
|
|
40
|
+
/** Short single-line excerpt of the opening turn, for at-a-glance recognition. */
|
|
41
|
+
readonly preview?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One row in the flattened view of a loaded transcript tree.
|
|
45
|
+
*
|
|
46
|
+
* The conductor stores a branchable tree of nodes; a navigator wants a single
|
|
47
|
+
* ordered list it can render and select against. Each {@link BranchNode} names
|
|
48
|
+
* its `id`, its `parent` link (so a caller can still reconstruct the tree),
|
|
49
|
+
* a render-ready `label`, the indentation `depth` from the root, and two flags:
|
|
50
|
+
* `isLeaf` for a tip of the tree and `isCurrent` for the node the active head
|
|
51
|
+
* points at.
|
|
52
|
+
*/
|
|
53
|
+
export interface BranchNode {
|
|
54
|
+
/** Stable id of the underlying transcript node. */
|
|
55
|
+
readonly id: string;
|
|
56
|
+
/** Parent node id, or `null` for a transcript root. */
|
|
57
|
+
readonly parent: string | null;
|
|
58
|
+
/** Render-ready, depth-indented one-line label. */
|
|
59
|
+
readonly label: string;
|
|
60
|
+
/** Distance from the root (a root is depth 0). */
|
|
61
|
+
readonly depth: number;
|
|
62
|
+
/** True when this node has no children — a tip of the tree. */
|
|
63
|
+
readonly isLeaf: boolean;
|
|
64
|
+
/** True when the active head currently points at this node. */
|
|
65
|
+
readonly isCurrent: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A past user turn offered as a fork point.
|
|
69
|
+
*
|
|
70
|
+
* To re-ask or re-edit an earlier prompt, a caller picks one of these and the
|
|
71
|
+
* conductor branches the transcript at `entryId`. `text` is the full prompt
|
|
72
|
+
* text; `preview` is the trimmed single-line form a picker renders.
|
|
73
|
+
*/
|
|
74
|
+
export interface PriorTurn {
|
|
75
|
+
/** Id of the transcript node this user turn lives on (the fork target). */
|
|
76
|
+
readonly entryId: string;
|
|
77
|
+
/** Full text of the user prompt. */
|
|
78
|
+
readonly text: string;
|
|
79
|
+
/** Trimmed single-line excerpt of {@link text}, for display. */
|
|
80
|
+
readonly preview: string;
|
|
81
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Type declarations recovered from dist/types (no runtime body)
|
|
3
|
+
/**
|
|
4
|
+
* Sessions subsystem — public barrel.
|
|
5
|
+
*
|
|
6
|
+
* Exposes the {@link SessionLibrary} (the catalog-and-navigation layer over the
|
|
7
|
+
* conductor's persisted transcripts) and its value contract — the
|
|
8
|
+
* {@link SavedSession} catalog row, the {@link BranchNode} navigator row, and
|
|
9
|
+
* the {@link PriorTurn} fork candidate. Consumers import the session-library
|
|
10
|
+
* surface from `src/sessions` rather than reaching into the individual modules.
|
|
11
|
+
*/
|
|
12
|
+
export type { SavedSession, BranchNode, PriorTurn } from "./contract.js";
|
|
13
|
+
export { SessionLibrary, type SessionLibraryOptions } from "./library.js";
|