@corenel/tools-web 0.1.0 → 0.3.0
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/dist/budgetGate.d.ts +21 -0
- package/dist/budgetGate.d.ts.map +1 -0
- package/dist/budgetGate.js +41 -0
- package/dist/budgetGate.js.map +1 -0
- package/dist/contextDocs.d.ts +54 -0
- package/dist/contextDocs.d.ts.map +1 -0
- package/dist/contextDocs.js +145 -0
- package/dist/contextDocs.js.map +1 -0
- package/dist/core/protocol.d.ts +58 -2
- package/dist/core/protocol.d.ts.map +1 -1
- package/dist/idb.d.ts +9 -0
- package/dist/idb.d.ts.map +1 -1
- package/dist/idb.js +15 -0
- package/dist/idb.js.map +1 -1
- package/dist/memory/local.d.ts.map +1 -1
- package/dist/memory/local.js.map +1 -1
- package/dist/prompts/history.d.ts.map +1 -1
- package/dist/prompts/history.js +11 -6
- package/dist/prompts/history.js.map +1 -1
- package/dist/runWatchdog.d.ts +20 -0
- package/dist/runWatchdog.d.ts.map +1 -0
- package/dist/runWatchdog.js +66 -0
- package/dist/runWatchdog.js.map +1 -0
- package/dist/runtime.d.ts +444 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +858 -0
- package/dist/runtime.js.map +1 -0
- package/dist/runtime.testHost.d.ts +9 -0
- package/dist/runtime.testHost.d.ts.map +1 -0
- package/dist/runtime.testHost.js +53 -0
- package/dist/runtime.testHost.js.map +1 -0
- package/dist/storageQuota.d.ts +25 -0
- package/dist/storageQuota.d.ts.map +1 -0
- package/dist/storageQuota.js +89 -0
- package/dist/storageQuota.js.map +1 -0
- package/dist/storageRegistry.d.ts +53 -0
- package/dist/storageRegistry.d.ts.map +1 -0
- package/dist/storageRegistry.js +40 -0
- package/dist/storageRegistry.js.map +1 -0
- package/dist/workerClient.d.ts +61 -3
- package/dist/workerClient.d.ts.map +1 -1
- package/dist/workerClient.js +72 -5
- package/dist/workerClient.js.map +1 -1
- package/dist/workerHandler.d.ts +15 -0
- package/dist/workerHandler.d.ts.map +1 -1
- package/dist/workerHandler.js +105 -62
- package/dist/workerHandler.js.map +1 -1
- package/package.json +19 -29
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const WATCHDOG_SOFT_MS = 45000;
|
|
2
|
+
export const WATCHDOG_TOOL_HARD_MS = 10 * 60 * 1000;
|
|
3
|
+
export function createRunWatchdog(onTimeout, opts) {
|
|
4
|
+
const softMs = opts?.softMs ?? WATCHDOG_SOFT_MS;
|
|
5
|
+
const hardMs = opts?.hardMs ?? WATCHDOG_TOOL_HARD_MS;
|
|
6
|
+
const toolsInFlight = new Set();
|
|
7
|
+
let soft;
|
|
8
|
+
let hard;
|
|
9
|
+
let paused = false;
|
|
10
|
+
let done = false;
|
|
11
|
+
const fire = (reason) => {
|
|
12
|
+
if (done)
|
|
13
|
+
return;
|
|
14
|
+
done = true;
|
|
15
|
+
if (soft)
|
|
16
|
+
clearTimeout(soft);
|
|
17
|
+
if (hard)
|
|
18
|
+
clearTimeout(hard);
|
|
19
|
+
onTimeout(reason);
|
|
20
|
+
};
|
|
21
|
+
const bump = () => {
|
|
22
|
+
if (soft)
|
|
23
|
+
clearTimeout(soft);
|
|
24
|
+
if (done || paused)
|
|
25
|
+
return;
|
|
26
|
+
if (toolsInFlight.size > 0) {
|
|
27
|
+
// Soft timer stays down mid-tool; the hard cap (armed on tool-call) guards.
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
soft = setTimeout(() => fire('silent'), softMs);
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
onEvent(e) {
|
|
34
|
+
if (e.type === 'tool-call' && e.id != null) {
|
|
35
|
+
if (toolsInFlight.size === 0)
|
|
36
|
+
hard = setTimeout(() => fire('tool-hard-cap'), hardMs);
|
|
37
|
+
toolsInFlight.add(e.id);
|
|
38
|
+
}
|
|
39
|
+
else if (e.type === 'tool-result' && e.id != null) {
|
|
40
|
+
toolsInFlight.delete(e.id);
|
|
41
|
+
if (toolsInFlight.size === 0 && hard) {
|
|
42
|
+
clearTimeout(hard);
|
|
43
|
+
hard = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
bump();
|
|
47
|
+
},
|
|
48
|
+
pause() {
|
|
49
|
+
paused = true;
|
|
50
|
+
if (soft)
|
|
51
|
+
clearTimeout(soft);
|
|
52
|
+
},
|
|
53
|
+
bump() {
|
|
54
|
+
paused = false;
|
|
55
|
+
bump();
|
|
56
|
+
},
|
|
57
|
+
clear() {
|
|
58
|
+
done = true;
|
|
59
|
+
if (soft)
|
|
60
|
+
clearTimeout(soft);
|
|
61
|
+
if (hard)
|
|
62
|
+
clearTimeout(hard);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=runWatchdog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWatchdog.js","sourceRoot":"","sources":["../runWatchdog.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpD,MAAM,UAAU,iBAAiB,CAC/B,SAAuD,EACvD,IAA2C;IAE3C,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,gBAAgB,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,qBAAqB,CAAC;IACrD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,IAAI,IAA+C,CAAC;IACpD,IAAI,IAA+C,CAAC;IACpD,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,MAAM,IAAI,GAAG,CAAC,MAAkC,EAAE,EAAE;QAClD,IAAI,IAAI;YAAE,OAAO;QACjB,IAAI,GAAG,IAAI,CAAC;QACZ,IAAI,IAAI;YAAE,YAAY,CAAC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CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI;YACF,MAAM,GAAG,KAAK,CAAC;YACf,IAAI,EAAE,CAAC;QACT,CAAC;QACD,KAAK;YACH,IAAI,GAAG,IAAI,CAAC;YACZ,IAAI,IAAI;gBAAE,YAAY,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,IAAI;gBAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
|
|
2
|
+
import { createWorkerAgent, type WorkerAgent } from './workerClient';
|
|
3
|
+
import type { ConversationTurn } from '@corenel/harness/conversation';
|
|
4
|
+
import type { AskQuestion, AskAnswers, SessionSurface, AgentSession, FileService, Usage } from '@corenel/protocol';
|
|
5
|
+
import { allTools } from '@corenel/harness/tools/builtins';
|
|
6
|
+
import type { AgentConstraints, AgentBreachAction, Breach } from '@corenel/harness/core/budget';
|
|
7
|
+
import type { CompressionMode } from '@corenel/harness/compression';
|
|
8
|
+
import type { GuardVerdict } from '@corenel/harness/guards';
|
|
9
|
+
import { type SystemParts } from '@corenel/harness/systemParts';
|
|
10
|
+
/** The worker deps bundle minus getFileService (the runtime supplies that). */
|
|
11
|
+
export type RuntimeWorkerDeps = Omit<Parameters<typeof createWorkerAgent>[0], 'getFileService'>;
|
|
12
|
+
/** What the engine needs of the host workspace. Generic W lets a host expose
|
|
13
|
+
* its richer workspace type through runtime.workspace() without the engine
|
|
14
|
+
* depending on it. */
|
|
15
|
+
export interface RuntimeWorkspace {
|
|
16
|
+
get(): FileService | null;
|
|
17
|
+
whenReady(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/** The session persistence port — structurally satisfied by the host's
|
|
20
|
+
* JsonlSessionStore instance. */
|
|
21
|
+
export interface SessionStorePort {
|
|
22
|
+
list(surface: SessionSurface): Promise<AgentSession[]>;
|
|
23
|
+
get(id: string): Promise<AgentSession | null>;
|
|
24
|
+
create(title: string, surface: SessionSurface): Promise<AgentSession>;
|
|
25
|
+
save(s: AgentSession): Promise<void>;
|
|
26
|
+
delete(id: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface ModelInfo {
|
|
29
|
+
provider: string;
|
|
30
|
+
label: string;
|
|
31
|
+
inPrice: number;
|
|
32
|
+
outPrice: number;
|
|
33
|
+
contextWindow?: number;
|
|
34
|
+
}
|
|
35
|
+
/** Injectable capability registries. Defaults preserve today's globals.
|
|
36
|
+
* (MCP server management stays a host UI concern — its Clerk-authed service
|
|
37
|
+
* functions live host-side; Phase 3's AgentChat receives them via its own
|
|
38
|
+
* props. Deliberate narrowing of the spec's Capabilities sketch.) */
|
|
39
|
+
export interface RuntimeCapabilities {
|
|
40
|
+
/** The tool set this runtime advertises in its system prompt AND (when it
|
|
41
|
+
* differs from the builtin registry) restricts the worker run to. */
|
|
42
|
+
tools?: () => ReturnType<typeof allTools>;
|
|
43
|
+
/** Tool names withheld from this runtime — a DENYLIST, applied in the worker
|
|
44
|
+
* after every source (builtin + MCP + sidecar) is combined.
|
|
45
|
+
*
|
|
46
|
+
* Prefer this over `tools` for "everything except X". An allowlist is built
|
|
47
|
+
* from the builtin registry on the main thread, so it silently drops the
|
|
48
|
+
* tools that only exist in the worker (mcp__*, sidecar remotes) — which is
|
|
49
|
+
* exactly how crew agents lost their MCP and sidecar tools. */
|
|
50
|
+
toolDeny?: () => string[];
|
|
51
|
+
/** Crew agents this runtime may delegate to (`call_agent`), resolved per run.
|
|
52
|
+
* The identities are composed HERE because a global-scope agent lives in the
|
|
53
|
+
* config workspace, which the worker's file proxy cannot reach. */
|
|
54
|
+
delegates?: () => Promise<{
|
|
55
|
+
name: string;
|
|
56
|
+
system: string;
|
|
57
|
+
}[]>;
|
|
58
|
+
/** Installed skills, for surfaces that list them (Phase 3 consumers; no engine default yet). */
|
|
59
|
+
skills?: () => Promise<import('@corenel/harness/skills').InstalledSkill[]>;
|
|
60
|
+
}
|
|
61
|
+
/** The AgentEvent union as the worker client emits it — derived from RunOpts. */
|
|
62
|
+
type RunOptsOf = NonNullable<Parameters<WorkerAgent['run']>[1]>;
|
|
63
|
+
export type RuntimeAgentEvent = Parameters<NonNullable<RunOptsOf['onEvent']>>[0];
|
|
64
|
+
type HealRecordOf = Extract<RuntimeAgentEvent, {
|
|
65
|
+
type: 'heal';
|
|
66
|
+
}>['record'];
|
|
67
|
+
/** The recorded-event union: real AgentEvents plus a replay-only `user` marker
|
|
68
|
+
* the runtime injects at each follow-up turn so multi-turn sessions replay the
|
|
69
|
+
* user's prompts as bubbles (the loop itself never emits `user`). Named
|
|
70
|
+
* distinctly from RuntimeAgentEvent because the brief's RuntimeHost.recorder
|
|
71
|
+
* sketch under-typed this field as RuntimeAgentEvent alone, which doesn't
|
|
72
|
+
* admit the synthetic `user` event the class actually pushes — mechanical fix,
|
|
73
|
+
* mirroring the pre-extraction module's AgentRecordedEvent. */
|
|
74
|
+
export type RuntimeRecordedEvent = RuntimeAgentEvent | {
|
|
75
|
+
type: 'user';
|
|
76
|
+
content: string;
|
|
77
|
+
images?: string[];
|
|
78
|
+
};
|
|
79
|
+
/** Breach policy bundle signatures — copied verbatim from src/prompd/agentBreach.ts. */
|
|
80
|
+
export interface BreachCtx {
|
|
81
|
+
currentModel: string;
|
|
82
|
+
ask: (msg: string) => Promise<boolean>;
|
|
83
|
+
warn: (msg: string) => void;
|
|
84
|
+
cheaperModel: (current: string) => string | null;
|
|
85
|
+
}
|
|
86
|
+
export type BreachDecide = (action: AgentBreachAction, breach: Breach, ctx: BreachCtx) => Promise<{
|
|
87
|
+
continue: boolean;
|
|
88
|
+
model?: string;
|
|
89
|
+
}>;
|
|
90
|
+
export type CheaperModelFactory = (recentUsage: () => {
|
|
91
|
+
promptTokens: number;
|
|
92
|
+
completionTokens: number;
|
|
93
|
+
cachedTokens?: number;
|
|
94
|
+
}) => (current: string) => string | null;
|
|
95
|
+
export type BreachDescribe = (b: Breach) => string;
|
|
96
|
+
export interface RuntimeHost {
|
|
97
|
+
workerDeps: RuntimeWorkerDeps;
|
|
98
|
+
workspace: () => RuntimeWorkspace;
|
|
99
|
+
/** Install the module-global active-files resolver the host's session/recall
|
|
100
|
+
* stores read (stateFs seam). The runtime calls this from ws() AND from every
|
|
101
|
+
* session-store entry point (the craft direct-load regression, commit 4559050). */
|
|
102
|
+
installFilesResolver: (fn: () => Promise<FileService | null>) => void;
|
|
103
|
+
sessions: SessionStorePort;
|
|
104
|
+
modelInfo: (id: string) => ModelInfo;
|
|
105
|
+
price: (usage: Usage, model: string) => number;
|
|
106
|
+
guard: (feature: string) => Promise<GuardVerdict>;
|
|
107
|
+
recordUsage: (u: {
|
|
108
|
+
surface: SessionSurface;
|
|
109
|
+
provider: string;
|
|
110
|
+
model: string;
|
|
111
|
+
modelLabel: string;
|
|
112
|
+
inEst: number | null;
|
|
113
|
+
inTok: number;
|
|
114
|
+
outTok: number;
|
|
115
|
+
cost: number;
|
|
116
|
+
}) => void;
|
|
117
|
+
constraints: (surface: string) => AgentConstraints;
|
|
118
|
+
compression: () => CompressionMode;
|
|
119
|
+
/** Composer mode id that new sessions start in (folder-driven id: 'auto',
|
|
120
|
+
* 'plan', or a custom mode). Omit -> 'auto'. Read once per session at mint time. */
|
|
121
|
+
defaultMode?: () => string;
|
|
122
|
+
/** Session replay recording sink (host recordings store). */
|
|
123
|
+
recorder?: {
|
|
124
|
+
newId(): string;
|
|
125
|
+
save(rec: {
|
|
126
|
+
kind: 'agent';
|
|
127
|
+
id: string;
|
|
128
|
+
title: string;
|
|
129
|
+
at: number;
|
|
130
|
+
ok: boolean;
|
|
131
|
+
prompt: string;
|
|
132
|
+
promptImages?: string[];
|
|
133
|
+
events: {
|
|
134
|
+
at: number;
|
|
135
|
+
ev: RuntimeRecordedEvent;
|
|
136
|
+
}[];
|
|
137
|
+
}): void;
|
|
138
|
+
};
|
|
139
|
+
suggestFollowups?: (a: {
|
|
140
|
+
messages: ChatCompletionMessageParam[];
|
|
141
|
+
model: string;
|
|
142
|
+
signal: AbortSignal;
|
|
143
|
+
}) => Promise<string[]>;
|
|
144
|
+
/** Live "Recovering…" note for a heal event's record (host healStore). */
|
|
145
|
+
healNote?: (record: HealRecordOf) => string | null;
|
|
146
|
+
/** Breach policy bundle — signatures copied verbatim from src/prompd/agentBreach.ts
|
|
147
|
+
* (decideBreach / cheaperModelFactory / describeBreach). */
|
|
148
|
+
breach?: {
|
|
149
|
+
decide: BreachDecide;
|
|
150
|
+
cheaperModel: CheaperModelFactory;
|
|
151
|
+
describe: BreachDescribe;
|
|
152
|
+
};
|
|
153
|
+
/** Extra system-context blocks (project instructions, memory, editor buffer …),
|
|
154
|
+
* resolved per send against the active FileService. Nulls are skipped. */
|
|
155
|
+
contextProviders?: Array<(files: FileService | null) => Promise<string | null>>;
|
|
156
|
+
/** Per-filetype system prompt path (systemForFile) — editor host only. */
|
|
157
|
+
systemPath?: (files: FileService | null) => string | undefined;
|
|
158
|
+
/** Extra template params for the composed system prompt (e.g. the editor host
|
|
159
|
+
* passes `{ fileName }` so per-filetype system templates can use `{{ fileName }}`). */
|
|
160
|
+
systemParams?: () => Record<string, unknown> | undefined;
|
|
161
|
+
capabilities?: RuntimeCapabilities;
|
|
162
|
+
/** Merged memory index (both scopes) — passed through to composeAgentSystem so
|
|
163
|
+
* every session sees what it can recall. */
|
|
164
|
+
memoryIndex?: () => Promise<string>;
|
|
165
|
+
}
|
|
166
|
+
type PolicyName = string;
|
|
167
|
+
/** Per-send options `send`/`retry` accept — all optional beyond the two the
|
|
168
|
+
* pre-extraction class always took, so /agent and /craft (which pass none of
|
|
169
|
+
* these) are unaffected. */
|
|
170
|
+
export interface SendOpts {
|
|
171
|
+
persona: string;
|
|
172
|
+
policyName: PolicyName;
|
|
173
|
+
/** Per-run constraints override. Callers pass `mergeOverride(savedDefault,
|
|
174
|
+
* emitted)`'s output (mergeOverride stays a UI-side concern, exported from
|
|
175
|
+
* this module) — the engine spreads it over the host's saved default:
|
|
176
|
+
* `{ ...host.constraints(surface), ...(opts.constraints ?? {}) }`. */
|
|
177
|
+
constraints?: AgentConstraints;
|
|
178
|
+
/** Workspace-relative path of the editor buffer the agent edits — forwarded
|
|
179
|
+
* verbatim to the worker so propose_edit can validate a proposal before
|
|
180
|
+
* surfacing the diff. */
|
|
181
|
+
editorFile?: string;
|
|
182
|
+
/** Await the user's verdict on a propose_edit. The engine adapts this to
|
|
183
|
+
* RunOpts' single-arg `onEditReview(callId)` form, closing over its own
|
|
184
|
+
* AbortController and pausing/bumping the run watchdog around the await
|
|
185
|
+
* (mirrors AgentPanel.tsx's awaitEditDecision wiring). */
|
|
186
|
+
onEditReview?: (callId: string, signal: AbortSignal) => ReturnType<NonNullable<RunOptsOf['onEditReview']>>;
|
|
187
|
+
/** Node-tagged events from the run's sub-agents (the DAG canvas stream) —
|
|
188
|
+
* forwarded verbatim. */
|
|
189
|
+
onNodeEvent?: RunOptsOf['onNodeEvent'];
|
|
190
|
+
/** Which composed parts of the system prompt to include for this run.
|
|
191
|
+
* Defaults to the persisted `getSystemParts()` when omitted. */
|
|
192
|
+
partsOverride?: SystemParts;
|
|
193
|
+
/** Every raw agent event, in emission order, for a host side-channel (the
|
|
194
|
+
* editor panel drives its todo list from tool-call events here — todos stay
|
|
195
|
+
* host-side, this is just the feed). */
|
|
196
|
+
onRunEvent?: (e: RuntimeAgentEvent) => void;
|
|
197
|
+
/** Where budget-breach notices (soft `warn` + `budget-stop`) land. Default
|
|
198
|
+
* `'transcript'` appends BOTH a transcript `note()` turn and a `policyNotes`
|
|
199
|
+
* entry — the /agent and /craft behavior from before this opt existed, kept
|
|
200
|
+
* byte-identical since neither surface renders policyNotes. `'notes'` skips
|
|
201
|
+
* the `note()` call and appends to policyNotes only — for a surface (the
|
|
202
|
+
* editor drawer) that renders the policyNotes banner itself, so a
|
|
203
|
+
* transcript turn would double the message. */
|
|
204
|
+
budgetNotices?: 'notes' | 'transcript';
|
|
205
|
+
}
|
|
206
|
+
export interface LiveTool {
|
|
207
|
+
id: string;
|
|
208
|
+
name: string;
|
|
209
|
+
args?: Record<string, unknown>;
|
|
210
|
+
result?: string;
|
|
211
|
+
isError?: boolean;
|
|
212
|
+
done?: boolean;
|
|
213
|
+
ms?: number;
|
|
214
|
+
}
|
|
215
|
+
export interface LiveState {
|
|
216
|
+
text: string;
|
|
217
|
+
tools: LiveTool[];
|
|
218
|
+
}
|
|
219
|
+
/** Who is asking. The card's copy is the only difference, but it is not a
|
|
220
|
+
* cosmetic one: "the agent wants to use delete_file" in front of someone who
|
|
221
|
+
* just typed `>pd rm notes.md` themselves misattributes the request, and an
|
|
222
|
+
* approval prompt that misstates who is asking is worse than terse. Defaults to
|
|
223
|
+
* 'agent' — every existing caller is the run loop. */
|
|
224
|
+
export type PermRequester = 'agent' | 'you';
|
|
225
|
+
export interface PendingPerm {
|
|
226
|
+
tool: string;
|
|
227
|
+
summary: string;
|
|
228
|
+
requester?: PermRequester;
|
|
229
|
+
resolve: (b: boolean) => void;
|
|
230
|
+
}
|
|
231
|
+
export interface PendingAsk {
|
|
232
|
+
questions: AskQuestion[];
|
|
233
|
+
resolve: (a: AskAnswers | null) => void;
|
|
234
|
+
}
|
|
235
|
+
export type SessionStatus = 'idle' | 'running' | 'waiting';
|
|
236
|
+
/** A runtime-agnostic composer mode id — the host UI owns the concrete union. */
|
|
237
|
+
export type RuntimeAgentMode = string;
|
|
238
|
+
/** The slice of a session the view renders. */
|
|
239
|
+
export interface SessionState {
|
|
240
|
+
turns: ConversationTurn[];
|
|
241
|
+
live: LiveState | null;
|
|
242
|
+
running: boolean;
|
|
243
|
+
error: string;
|
|
244
|
+
mode: RuntimeAgentMode;
|
|
245
|
+
input: string;
|
|
246
|
+
attachments: string[];
|
|
247
|
+
pendingPerm: PendingPerm | null;
|
|
248
|
+
pendingAsk: PendingAsk | null;
|
|
249
|
+
loaded: boolean;
|
|
250
|
+
/** Click-to-fill follow-up prompts for the latest assistant turn (empty while a
|
|
251
|
+
* run is in flight; populated best-effort after it completes). */
|
|
252
|
+
suggestions: string[];
|
|
253
|
+
/** Live self-heal status while a run recovers from a blip ("Recovering — retrying…"),
|
|
254
|
+
* or null. Cleared once output resumes or the turn ends. */
|
|
255
|
+
recovery: string | null;
|
|
256
|
+
/** Bumped once per `'offload'` event — the editor panel's context drawer uses
|
|
257
|
+
* this to know when to re-read the session's offloaded blobs. */
|
|
258
|
+
offloadTick: number;
|
|
259
|
+
/** Policy-notice banner entries (breach warn/stop + guard `policy-violation`
|
|
260
|
+
* events). Reset at the start of every run. The editor panel renders these
|
|
261
|
+
* (and passes `budgetNotices: 'notes'` so budget warn/stop skip the
|
|
262
|
+
* transcript turn); the standalone /agent page keeps rendering the same
|
|
263
|
+
* budget notices via `note()` (a transcript turn) instead, per
|
|
264
|
+
* SendOpts.budgetNotices. */
|
|
265
|
+
policyNotes: {
|
|
266
|
+
kind: string;
|
|
267
|
+
message: string;
|
|
268
|
+
action: string;
|
|
269
|
+
}[];
|
|
270
|
+
/** A console command typed into the chat that is still running, or null.
|
|
271
|
+
*
|
|
272
|
+
* A model turn announces itself - streaming text, a spinner, an elapsed
|
|
273
|
+
* counter - and a command announced nothing at all. That is survivable for
|
|
274
|
+
* `pd ls`, which is over before you lift your finger, and wrong for everything
|
|
275
|
+
* that takes time: a command awaiting approval, one that spawns a process, one
|
|
276
|
+
* blocked on a daemon that is not answering. All three look exactly like a
|
|
277
|
+
* keystroke that did nothing, which is the worst thing an interface can look
|
|
278
|
+
* like, because the honest response to it is to press the key again. */
|
|
279
|
+
pendingCommand: {
|
|
280
|
+
command: string;
|
|
281
|
+
startedAt: number;
|
|
282
|
+
} | null;
|
|
283
|
+
/** The model a `degrade` breach switched the run onto, or null. Reset at the
|
|
284
|
+
* start of every run. */
|
|
285
|
+
degradedModel: string | null;
|
|
286
|
+
/** Raw per-session event stream (this session's turns, one entry per event with
|
|
287
|
+
* wall-clock `at`), for the live scrubber. Accumulated in send(); reset on clear. */
|
|
288
|
+
recEvents: {
|
|
289
|
+
at: number;
|
|
290
|
+
ev: RuntimeRecordedEvent;
|
|
291
|
+
}[];
|
|
292
|
+
}
|
|
293
|
+
/** Merge a form's freshly-emitted envelope into a per-run override, against the
|
|
294
|
+
* currently saved default. The form only emits the keys it still wants set — a
|
|
295
|
+
* cleared field (e.g. "No limit") is simply ABSENT from `emitted`, not `undefined`.
|
|
296
|
+
* A plain `{...savedDefault, ...emitted}` merge at read time would then silently
|
|
297
|
+
* fall back to the saved default for that field, so "No limit" could never
|
|
298
|
+
* actually clear a saved cap. Fix: for every key present in `savedDefault` but
|
|
299
|
+
* absent from `emitted`, materialize an explicit `undefined` in the returned
|
|
300
|
+
* override so the read-time spread masks it (`{...{maxUsd:2}, ...{maxUsd:undefined}}`
|
|
301
|
+
* -> `maxUsd: undefined`, which all `!= null` consumers treat as no limit). Keys the
|
|
302
|
+
* form already sends as `undefined` (its own internal clears) pass through unchanged. */
|
|
303
|
+
export declare function mergeOverride(savedDefault: AgentConstraints, emitted: AgentConstraints): AgentConstraints;
|
|
304
|
+
export declare class AgentRuntime {
|
|
305
|
+
private readonly host;
|
|
306
|
+
private readonly surface;
|
|
307
|
+
private readonly systemExtra;
|
|
308
|
+
/** Resolves the model id for each run — the host factory always passes one
|
|
309
|
+
* (Corenel's agent model, or Craft's own surface getter). */
|
|
310
|
+
private readonly getModel;
|
|
311
|
+
/** Optional sampling temperature for each run. The HOST resolves this,
|
|
312
|
+
* because whether a temperature may be sent at all depends on the model
|
|
313
|
+
* family (reasoning models reject a non-default value) and model metadata
|
|
314
|
+
* lives host-side. Undefined leaves the provider default in place. */
|
|
315
|
+
private readonly getTemperature?;
|
|
316
|
+
/** `surface` namespaces this runtime's sessions in the store (so /agent and /craft
|
|
317
|
+
* never list each other's chats). `systemExtra` is prepended to every run's system
|
|
318
|
+
* context — Craft uses it to carry the document-creation directive. */
|
|
319
|
+
constructor(host: RuntimeHost, surface: SessionSurface | undefined, systemExtra: string | undefined,
|
|
320
|
+
/** Resolves the model id for each run — the host factory always passes one
|
|
321
|
+
* (Corenel's agent model, or Craft's own surface getter). */
|
|
322
|
+
getModel: () => string,
|
|
323
|
+
/** Optional sampling temperature for each run. The HOST resolves this,
|
|
324
|
+
* because whether a temperature may be sent at all depends on the model
|
|
325
|
+
* family (reasoning models reject a non-default value) and model metadata
|
|
326
|
+
* lives host-side. Undefined leaves the provider default in place. */
|
|
327
|
+
getTemperature?: (() => number | undefined) | undefined);
|
|
328
|
+
private map;
|
|
329
|
+
private subs;
|
|
330
|
+
private globalSubs;
|
|
331
|
+
private _ws;
|
|
332
|
+
private worker;
|
|
333
|
+
private ws;
|
|
334
|
+
private getWorker;
|
|
335
|
+
/** The active file workspace (the page shows its label as a context chip). */
|
|
336
|
+
fileService(): FileService | null;
|
|
337
|
+
workspace(): RuntimeWorkspace;
|
|
338
|
+
private ensure;
|
|
339
|
+
private notify;
|
|
340
|
+
private notifyGlobal;
|
|
341
|
+
/** Mutate a session and notify its view; `global` also pokes the running-badge subscribers. */
|
|
342
|
+
private patch;
|
|
343
|
+
subscribe(id: string, cb: () => void): () => void;
|
|
344
|
+
subscribeGlobal(cb: () => void): () => void;
|
|
345
|
+
getState(id: string): SessionState;
|
|
346
|
+
status(id: string): SessionStatus;
|
|
347
|
+
/** The session store reads through the module-global active-files resolver
|
|
348
|
+
* (stateFs), which only THIS runtime's ws() installs. Every session-store
|
|
349
|
+
* entry point must assert it first — a page that never touches
|
|
350
|
+
* workspace()/fileService() before its mount effect (CraftPage direct load)
|
|
351
|
+
* otherwise hits the default null resolver and the store throws
|
|
352
|
+
* "No file workspace is connected". */
|
|
353
|
+
/** Lazily load a session's turns from the store the first time it's focused. */
|
|
354
|
+
load(id: string): Promise<void>;
|
|
355
|
+
/** Reuse the most-recent empty session if there is one, else create a fresh one.
|
|
356
|
+
* Returns the id to focus on page open — keeps a single throwaway "New chat"
|
|
357
|
+
* around instead of breeding empties. Concurrent calls are deduped (React
|
|
358
|
+
* StrictMode double-invokes the mount effect) so the page never opens two. */
|
|
359
|
+
private initInFlight;
|
|
360
|
+
openInitial(): Promise<string>;
|
|
361
|
+
newSession(): Promise<string>;
|
|
362
|
+
deleteSession(id: string): Promise<void>;
|
|
363
|
+
setInput(id: string, v: string): void;
|
|
364
|
+
setMode(id: string, m: RuntimeAgentMode): void;
|
|
365
|
+
/** Clear the conversation (keep the session) — empties the visible transcript and
|
|
366
|
+
* starts a fresh recording stream for what follows. */
|
|
367
|
+
clear(id: string): void;
|
|
368
|
+
/** Append a local assistant-style notice turn (e.g. a /model confirmation) — not
|
|
369
|
+
* sent to the model, just shown in the transcript. */
|
|
370
|
+
note(id: string, text: string): void;
|
|
371
|
+
setAttachments(id: string, fn: (a: string[]) => string[]): void;
|
|
372
|
+
toggleInclude(id: string, turnId: string): void;
|
|
373
|
+
/**
|
|
374
|
+
* Ask the user to approve something the HOST is about to do, through the same
|
|
375
|
+
* card a tool call raises.
|
|
376
|
+
*
|
|
377
|
+
* A console command typed into the chat is judged by the same policy as the
|
|
378
|
+
* agent's own tools (see terminal/commandSubject), and when that policy says
|
|
379
|
+
* `ask` it has to actually ask - through this, not a second prompt of its own.
|
|
380
|
+
* Two different approval dialogs for the same act is how people learn to click
|
|
381
|
+
* the one that appears more often without reading it.
|
|
382
|
+
*
|
|
383
|
+
* Resolves false if the session is gone, so a caller can never read a dropped
|
|
384
|
+
* prompt as consent.
|
|
385
|
+
*/
|
|
386
|
+
requestPermission(id: string, tool: string, summary: string): Promise<boolean>;
|
|
387
|
+
/**
|
|
388
|
+
* Record a console command run from the chat as a synthetic tool call+result.
|
|
389
|
+
*
|
|
390
|
+
* The SHAPE is the point. Written as the message pair a real tool call
|
|
391
|
+
* produces, it gets four things with no new machinery: the agent sees it in a
|
|
392
|
+
* form it already understands, it persists to the session log (a
|
|
393
|
+
* transcript-only rendering would not), it replays in recordings, and the
|
|
394
|
+
* user can promote it into context with the include toggle every turn
|
|
395
|
+
* already has.
|
|
396
|
+
*
|
|
397
|
+
* IT IS RECORDED OUT OF CONTEXT. Persistence and context-inclusion are
|
|
398
|
+
* separate switches here - persist() writes every turn, while only `included`
|
|
399
|
+
* turns are sent to the model - and a command should default to written-down
|
|
400
|
+
* but not re-sent. A transcript message is the most expensive kind of
|
|
401
|
+
* context: it is paid again on every subsequent turn for the rest of the
|
|
402
|
+
* session, so a handful of exploratory `pd ls` calls quietly become a
|
|
403
|
+
* permanent tax. Defaulting IN would put the work of noticing on the user at
|
|
404
|
+
* exactly the moment they are thinking about something else, and the ones
|
|
405
|
+
* they forget are the ones that compound. Defaulting OUT makes forgetting
|
|
406
|
+
* free and makes Keep the deliberate act.
|
|
407
|
+
*/
|
|
408
|
+
/** Mark a console command as running. Paired with recordCommand, which clears
|
|
409
|
+
* it - so the indicator cannot outlive the command even if it fails, since the
|
|
410
|
+
* failure is itself recorded. */
|
|
411
|
+
beginCommand(id: string, command: string, startedAt: number): void;
|
|
412
|
+
/** Give up on a command that will never settle (the surface unmounted, the
|
|
413
|
+
* session was closed). Clears the indicator WITHOUT recording a result,
|
|
414
|
+
* because there is no honest result to record. */
|
|
415
|
+
abandonCommand(id: string): void;
|
|
416
|
+
recordCommand(id: string, command: string, output: string, ok: boolean): void;
|
|
417
|
+
resolvePerm(id: string, allow: boolean, always?: boolean): void;
|
|
418
|
+
resolveAsk(id: string, answers: AskAnswers | null): void;
|
|
419
|
+
stop(id: string): void;
|
|
420
|
+
private persist;
|
|
421
|
+
private composeSystem;
|
|
422
|
+
/** Send a message and run the agent for `id`. Concurrent with other sessions:
|
|
423
|
+
* each run is its own AbortController + watchdog and streams into its own slice. */
|
|
424
|
+
send(id: string, text: string, images: string[], opts: SendOpts): Promise<void>;
|
|
425
|
+
/** A host-driven turn: appends the user message, then awaits a host-supplied
|
|
426
|
+
* `produce` (e.g. the /strategy command's own completion) instead of running
|
|
427
|
+
* the worker agent. Same running/live/error/abort shape as `send`, minus
|
|
428
|
+
* tool calls — used by surfaces that render a live "thinking" placeholder for
|
|
429
|
+
* work the engine itself doesn't perform. */
|
|
430
|
+
hostTurn(id: string, userText: string, produce: (signal: AbortSignal) => Promise<string>): Promise<void>;
|
|
431
|
+
/** Replace the offload stub for `blobId` inside turn `turnId` (session `id`)
|
|
432
|
+
* with the full content — the context drawer's per-item Restore, transplanted
|
|
433
|
+
* from the harness/conversation.ts singleton (same marker-matching and
|
|
434
|
+
* identity-swap semantics; see that module for the rationale). Returns false
|
|
435
|
+
* (state untouched, no persist) when the turn or the matching stub is absent. */
|
|
436
|
+
restoreToolResult(id: string, turnId: string, blobId: string, content: string): boolean;
|
|
437
|
+
/** Re-run a prior user turn: drop it and everything after, then resend it. */
|
|
438
|
+
retry(id: string, turnId: string, opts: SendOpts): Promise<void>;
|
|
439
|
+
/** Drop all in-memory state and abort every run — called on a scope change so
|
|
440
|
+
* one identity's sessions and runs never carry into another's. */
|
|
441
|
+
reset(): void;
|
|
442
|
+
}
|
|
443
|
+
export {};
|
|
444
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA6B,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/G,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,E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