@lensagent/core 0.1.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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/config/lens.example.jsonc +92 -0
  4. package/config/pair.example.json +3 -0
  5. package/dist/adapters/executor.d.ts +35 -0
  6. package/dist/adapters/executor.js +296 -0
  7. package/dist/adapters/lsp.d.ts +18 -0
  8. package/dist/adapters/lsp.js +218 -0
  9. package/dist/adapters/mcp.d.ts +32 -0
  10. package/dist/adapters/mcp.js +283 -0
  11. package/dist/adapters/revert.d.ts +12 -0
  12. package/dist/adapters/revert.js +155 -0
  13. package/dist/config/runtime.d.ts +55 -0
  14. package/dist/config/runtime.js +371 -0
  15. package/dist/config/schema.d.ts +292 -0
  16. package/dist/config/schema.js +177 -0
  17. package/dist/contracts/adapter.d.ts +28 -0
  18. package/dist/contracts/adapter.js +8 -0
  19. package/dist/contracts/capability.d.ts +41 -0
  20. package/dist/contracts/capability.js +1 -0
  21. package/dist/contracts/domain.d.ts +61 -0
  22. package/dist/contracts/domain.js +1 -0
  23. package/dist/contracts/index.d.ts +5 -0
  24. package/dist/contracts/index.js +5 -0
  25. package/dist/contracts/model.d.ts +77 -0
  26. package/dist/contracts/model.js +1 -0
  27. package/dist/contracts/ports.d.ts +14 -0
  28. package/dist/contracts/ports.js +14 -0
  29. package/dist/core/access.d.ts +24 -0
  30. package/dist/core/access.js +205 -0
  31. package/dist/core/codec.d.ts +33 -0
  32. package/dist/core/codec.js +105 -0
  33. package/dist/core/domain.d.ts +13 -0
  34. package/dist/core/domain.js +24 -0
  35. package/dist/core/host.d.ts +19 -0
  36. package/dist/core/host.js +249 -0
  37. package/dist/core/identity.d.ts +19 -0
  38. package/dist/core/identity.js +54 -0
  39. package/dist/entry/bun.d.ts +1 -0
  40. package/dist/entry/bun.js +2 -0
  41. package/dist/entry/node.d.ts +2 -0
  42. package/dist/entry/node.js +3 -0
  43. package/dist/entry/rebuild.d.ts +1 -0
  44. package/dist/entry/rebuild.js +47 -0
  45. package/dist/entry/run.d.ts +1 -0
  46. package/dist/entry/run.js +43 -0
  47. package/dist/execution/lsp-process.d.ts +14 -0
  48. package/dist/execution/lsp-process.js +234 -0
  49. package/dist/http/server.d.ts +34 -0
  50. package/dist/http/server.js +1332 -0
  51. package/dist/launch.d.ts +3 -0
  52. package/dist/launch.js +4 -0
  53. package/dist/runtime/agent.d.ts +35 -0
  54. package/dist/runtime/agent.js +853 -0
  55. package/dist/runtime/artifacts.d.ts +15 -0
  56. package/dist/runtime/artifacts.js +72 -0
  57. package/dist/runtime/cache.d.ts +20 -0
  58. package/dist/runtime/cache.js +44 -0
  59. package/dist/runtime/calls.d.ts +21 -0
  60. package/dist/runtime/calls.js +130 -0
  61. package/dist/runtime/capabilities.d.ts +58 -0
  62. package/dist/runtime/capabilities.js +196 -0
  63. package/dist/runtime/cleanup.d.ts +7 -0
  64. package/dist/runtime/cleanup.js +33 -0
  65. package/dist/runtime/context.d.ts +34 -0
  66. package/dist/runtime/context.js +169 -0
  67. package/dist/runtime/diagnostics.d.ts +8 -0
  68. package/dist/runtime/diagnostics.js +71 -0
  69. package/dist/runtime/events.d.ts +22 -0
  70. package/dist/runtime/events.js +131 -0
  71. package/dist/runtime/kernel-capabilities.d.ts +32 -0
  72. package/dist/runtime/kernel-capabilities.js +200 -0
  73. package/dist/runtime/manifests.d.ts +14 -0
  74. package/dist/runtime/manifests.js +117 -0
  75. package/dist/runtime/model.d.ts +20 -0
  76. package/dist/runtime/model.js +241 -0
  77. package/dist/runtime/observability.d.ts +22 -0
  78. package/dist/runtime/observability.js +104 -0
  79. package/dist/runtime/policy.d.ts +8 -0
  80. package/dist/runtime/policy.js +31 -0
  81. package/dist/runtime/profile.d.ts +8 -0
  82. package/dist/runtime/profile.js +52 -0
  83. package/dist/runtime/projects.d.ts +40 -0
  84. package/dist/runtime/projects.js +115 -0
  85. package/dist/runtime/results.d.ts +7 -0
  86. package/dist/runtime/results.js +55 -0
  87. package/dist/runtime/review.d.ts +9 -0
  88. package/dist/runtime/review.js +54 -0
  89. package/dist/runtime/scheduler.d.ts +15 -0
  90. package/dist/runtime/scheduler.js +85 -0
  91. package/dist/runtime/skills.d.ts +2 -0
  92. package/dist/runtime/skills.js +83 -0
  93. package/dist/runtime/tokenizer.d.ts +8 -0
  94. package/dist/runtime/tokenizer.js +30 -0
  95. package/dist/store/database.d.ts +3 -0
  96. package/dist/store/database.js +49 -0
  97. package/dist/store/event-log.d.ts +19 -0
  98. package/dist/store/event-log.js +61 -0
  99. package/dist/store/schema.d.ts +1 -0
  100. package/dist/store/schema.js +347 -0
  101. package/dist/store/store.d.ts +344 -0
  102. package/dist/store/store.js +2554 -0
  103. package/package.json +73 -0
  104. package/proto/executor.proto +314 -0
@@ -0,0 +1,344 @@
1
+ import { type EntityRef, type Json, type Page } from '../core/domain.js';
2
+ import type { EventBus } from '../runtime/events.js';
3
+ import type { Sqlite } from './database.js';
4
+ import type { EventLog } from './event-log.js';
5
+ export type Document = Readonly<Record<string, Json>>;
6
+ interface PageOptions {
7
+ readonly cursor?: string;
8
+ readonly limit: number;
9
+ }
10
+ interface AgentCreate {
11
+ readonly taskId: string;
12
+ readonly sessionId: string;
13
+ readonly workspaceId: string;
14
+ readonly parentAgentId?: string;
15
+ readonly name: string;
16
+ readonly model: string;
17
+ readonly modelReasoningEffort: string;
18
+ readonly policyPreset: string;
19
+ readonly capabilities: Readonly<Record<string, string>>;
20
+ readonly loadedCapabilities: readonly string[];
21
+ }
22
+ export interface IngressCommand {
23
+ readonly clientId: string;
24
+ readonly key: string;
25
+ readonly operation: string;
26
+ readonly digest: string;
27
+ }
28
+ export declare class Store {
29
+ #private;
30
+ constructor(database: Sqlite, events: EventBus, eventLog?: EventLog);
31
+ close(): Promise<void>;
32
+ instance(): Document;
33
+ stateRevision(): number;
34
+ ingressReplay(input: IngressCommand): Document | null;
35
+ recover(): readonly EntityRef[];
36
+ /**
37
+ * 02A `ProjectPageQuery.archive`: `active` hides archived Projects, `archived` shows only those,
38
+ * `all` shows both. The Route previously read a differently spelled parameter, so the documented
39
+ * one silently had no effect and archived Projects were unreachable through the API.
40
+ */
41
+ listProjects(options: PageOptions, archive?: 'active' | 'archived' | 'all'): Page<Document>;
42
+ defaultProject(): Document | null;
43
+ getProject(projectId: string): Document;
44
+ createProject(name: string, paths: readonly string[]): Document;
45
+ updateProject(projectId: string, expectedRevision: number, name: string): Document;
46
+ archiveProject(projectId: string, expectedRevision: number, archived: boolean): Document;
47
+ listWorkspaces(projectId: string): readonly Document[];
48
+ /**
49
+ * The ordered folder set a Call may reach: every Workspace in the Project, with the Call's own
50
+ * Workspace first.
51
+ *
52
+ * The bound Workspace leads because the first path is the primary one that relative paths resolve
53
+ * against, so an Agent's own folder stays the default target while the rest of the Project becomes
54
+ * readable. Paths are deduplicated: the same folder may appear in more than one Workspace, and a
55
+ * repeated root would make the Executor walk it twice.
56
+ */
57
+ projectWorkspacePaths(projectId: string, workspaceId: string): readonly string[];
58
+ getWorkspace(projectId: string, workspaceId: string): Document;
59
+ createWorkspace(projectId: string, name: string, paths: readonly string[], makeDefault: boolean): Document;
60
+ updateWorkspace(projectId: string, workspaceId: string, expectedRevision: number, name: string, paths: readonly string[], makeDefault: boolean): Document;
61
+ deleteWorkspace(projectId: string, workspaceId: string, expectedRevision: number): void;
62
+ listTasks(projectId: string, options: PageOptions, archived?: boolean): Page<Document>;
63
+ listAllTasks(projectId: string, options: PageOptions, archived?: boolean): Page<Document>;
64
+ getTask(projectId: string, taskId: string): Document;
65
+ /**
66
+ * A Project's Task/Session totals. `Page` carries no total, so without this a client had to walk
67
+ * every page to show a count.
68
+ */
69
+ projectDetail(projectId: string): Document;
70
+ /**
71
+ * 02A `TaskDetail`. The Route returned a bare `TaskSummary`, so a client reading `task.title`
72
+ * dereferenced `undefined` and the view crashed. Counts are derived, not stored.
73
+ */
74
+ taskDetail(projectId: string, taskId: string): Document;
75
+ createTask(projectId: string, title: string): Document;
76
+ updateTask(projectId: string, taskId: string, expectedRevision: number, title: string): Document;
77
+ archiveTask(projectId: string, taskId: string, expectedRevision: number, archived: boolean): Document;
78
+ deleteTask(projectId: string, taskId: string, expectedRevision: number): Document;
79
+ listSessions(projectId: string, taskId: string, options: PageOptions, archived?: boolean): Page<Document>;
80
+ getSession(projectId: string, sessionId: string): Document;
81
+ /**
82
+ * 02A `SessionDetail`. The Route returned a bare `SessionSummary`, so `root_agent` was absent and
83
+ * a client reading the active Agent's Workspace dereferenced `undefined`.
84
+ */
85
+ sessionDetail(projectId: string, sessionId: string): Document;
86
+ /** 02A `AgentDetail`. */
87
+ agentDetail(projectId: string, agentId: string): Document;
88
+ createSession(projectId: string, taskId: string, title: string, ingress?: IngressCommand): Document;
89
+ createSessionWithAgent(projectId: string, input: {
90
+ readonly taskId: string;
91
+ readonly title: string;
92
+ readonly workspaceId: string;
93
+ readonly agentName: string;
94
+ readonly model: string;
95
+ readonly modelReasoningEffort: string;
96
+ readonly policyPreset: string;
97
+ readonly capabilities: Readonly<Record<string, string>>;
98
+ readonly loadedCapabilities: readonly string[];
99
+ readonly initialPrompt?: string;
100
+ readonly initialMessage?: string;
101
+ readonly ingress: IngressCommand;
102
+ }): Document;
103
+ updateSession(projectId: string, sessionId: string, expectedRevision: number, title: string): Document;
104
+ archiveSession(projectId: string, sessionId: string, expectedRevision: number, archived: boolean): Document;
105
+ /**
106
+ * 02A `SessionSnapshot`, bounded to the Session's live objects per 07 §163. It answered five fields
107
+ * of the thirteen and named the revision `revision` instead of `state_revision`, so the Trace tab
108
+ * read `snapshot.steps` and the Runs tab read `snapshot.agent_sessions` off `undefined` -- both threw
109
+ * during render, and with one boundary around the whole workbench that blanked the window.
110
+ *
111
+ * `messages` and `context_items` are still absent. 07 §163 bounds this to non-terminal run objects
112
+ * and names neither, and a Session's transcript is unbounded and already paged by its own Routes;
113
+ * sending it on every panel poll would be the opposite of a bounded read. Returning `[]` instead
114
+ * would be worse than omitting them -- it would assert there are none.
115
+ */
116
+ sessionSnapshot(projectId: string, sessionId: string): Document;
117
+ sessionTimeline(projectId: string, sessionId: string, options: PageOptions): Page<Document>;
118
+ listAgents(projectId: string, field: 'task_id' | 'session_id', ownerId: string): readonly Document[];
119
+ getAgent(projectId: string, agentId: string): Document;
120
+ createAgent(projectId: string, input: AgentCreate): Document;
121
+ createSubagent(projectId: string, parentAgentId: string, input: {
122
+ readonly name: string;
123
+ readonly model: string;
124
+ readonly modelReasoningEffort: string;
125
+ readonly policyPreset: string;
126
+ readonly capabilities: Readonly<Record<string, string>>;
127
+ readonly loadedCapabilities: readonly string[];
128
+ readonly forkContext: 'full' | 'compact' | 'none';
129
+ readonly compactSummary?: string;
130
+ readonly initialPrompt?: string;
131
+ readonly initialMessage?: string;
132
+ readonly ingress?: IngressCommand;
133
+ }): Document;
134
+ updateAgent(projectId: string, agentId: string, expectedRevision: number, input: {
135
+ readonly name: string;
136
+ readonly model: string;
137
+ readonly modelReasoningEffort: string;
138
+ readonly policyPreset: string;
139
+ }): Document;
140
+ setAgentState(projectId: string, agentId: string, state: string): Document;
141
+ getMessage(projectId: string, messageId: string): Document;
142
+ enqueueMessage(projectId: string, agentId: string, content: string, sourceAgentId?: string, ingress?: IngressCommand): {
143
+ readonly message: Document;
144
+ readonly pending: Document;
145
+ readonly run: Document;
146
+ };
147
+ enqueueSubagentMessage(projectId: string, parentAgentId: string, targetAgentId: string, content: string, ingress: IngressCommand): Document;
148
+ broadcastSubagentMessage(projectId: string, parentAgentId: string, content: string, ingress: IngressCommand): Document;
149
+ waitForSubagent(projectId: string, sourceAgentId: string, targetAgentId: string, timeoutMs: number, signal: AbortSignal): Promise<Document>;
150
+ listPending(projectId: string, agentId: string, options: PageOptions): Page<Document>;
151
+ getPending(projectId: string, pendingId: string): Document;
152
+ updatePending(projectId: string, pendingId: string, expectedRevision: number, content: string): Document;
153
+ deletePending(projectId: string, pendingId: string, expectedRevision: number): void;
154
+ reorderPending(projectId: string, agentId: string, ids: readonly string[]): readonly Document[];
155
+ listCapabilities(projectId: string, agentId: string): readonly Document[];
156
+ getCapabilityAssignment(projectId: string, agentId: string, capabilityId: string): Document;
157
+ replaceCapabilities(projectId: string, agentId: string, capabilities: Readonly<Record<string, string>>, loadedCapabilities: readonly string[]): readonly Document[];
158
+ setCapabilityLoaded(projectId: string, agentId: string, capabilityId: string, loaded: boolean): readonly Document[];
159
+ loadCapabilities(projectId: string, agentId: string, capabilities: Readonly<Record<string, string>>): readonly Document[];
160
+ listRuns(projectId: string, agentId: string, options: PageOptions): Page<Document>;
161
+ /** 02A `RunDetail`. */
162
+ runDetail(projectId: string, runId: string): Document;
163
+ getRun(projectId: string, runId: string): Document;
164
+ getRunGoal(projectId: string, runId: string): Document;
165
+ retryAgent(projectId: string, agentId: string): Document;
166
+ claimRun(projectId: string, agentId: string): {
167
+ readonly run: Document;
168
+ readonly step: Document;
169
+ readonly pending: readonly Document[];
170
+ } | null;
171
+ consumePending(projectId: string, pendingId: string): void;
172
+ restorePending(projectId: string, pending: Document): Document;
173
+ getStep(projectId: string, stepId: string): Document;
174
+ listSteps(projectId: string, runId: string, options: PageOptions): Page<Document>;
175
+ createAttempt(projectId: string, input: {
176
+ readonly agentId: string;
177
+ readonly stepId: string | null;
178
+ readonly kind: 'agent' | 'compaction';
179
+ readonly model: string;
180
+ readonly profileId: string;
181
+ readonly profileVersion: number;
182
+ readonly profileDigest: string;
183
+ readonly configDigest: string;
184
+ readonly contextRevision: number;
185
+ readonly request: Json;
186
+ readonly preparation: Json;
187
+ readonly capabilities: readonly {
188
+ readonly id: string;
189
+ readonly schema: Json;
190
+ }[];
191
+ }): Document;
192
+ getAttempt(projectId: string, attemptId: string): Document;
193
+ listAttempts(projectId: string, field: 'agent_id' | 'step_id', ownerId: string, options: PageOptions): Page<Document>;
194
+ transitionAttempt(projectId: string, attemptId: string, from: string, to: string, outcome?: string | null, usage?: Json | null, errorCode?: string | null): Document;
195
+ recordToolOrdinal(projectId: string, attemptId: string, ordinal: number, providerToolId: string | null, complete: boolean): void;
196
+ createPartition(projectId: string, stepId: string, mode: 'parallel' | 'serial'): Document;
197
+ listPartitions(projectId: string, stepId: string, options: PageOptions): Page<Document>;
198
+ createCall(projectId: string, input: {
199
+ readonly workspaceId: string;
200
+ readonly agentId?: string;
201
+ readonly stepId?: string;
202
+ readonly attemptId?: string;
203
+ readonly partitionId?: string;
204
+ readonly parentCallId?: string;
205
+ readonly source: 'user' | 'llm' | 'program';
206
+ readonly capabilityId: string;
207
+ readonly providerCallId?: string;
208
+ readonly callOrdinal?: number;
209
+ readonly arguments: Json;
210
+ readonly effect: string;
211
+ readonly policy?: string;
212
+ readonly state: 'WAITING' | 'QUEUED';
213
+ readonly waitReason?: string;
214
+ readonly autoReviewPassed?: boolean;
215
+ readonly ingress?: IngressCommand;
216
+ }): Document;
217
+ /**
218
+ * The stored Call row plus its Result, as the Runtime reads it: flat, physical column names,
219
+ * `state` and `outcome` separate. Every scheduling and dispatch path in `src/runtime` switches on
220
+ * this shape, so it is deliberately not the documented wire shape -- see `callDetail` and
221
+ * `callSummary` for those.
222
+ */
223
+ getCall(projectId: string, callId: string): Document;
224
+ /** 02A `CallSummary` for one Call. */
225
+ callSummary(projectId: string, callId: string): Document;
226
+ /**
227
+ * 02A `CallDetail`. `concurrency` is absent rather than invented: resource claims live only in the
228
+ * in-process scheduler (`runtime/scheduler.ts`) and are never persisted, so the Store cannot say
229
+ * whether a Call was judged concurrency-safe. Reporting `{ safe: true, claims: [] }` would be a
230
+ * claim no code made.
231
+ */
232
+ callDetail(projectId: string, callId: string): Document;
233
+ listCalls(projectId: string, options: PageOptions, filters?: {
234
+ readonly stepId?: string;
235
+ readonly state?: string;
236
+ }): Page<Document>;
237
+ activeCallIds(projectId: string, agentId: string): readonly string[];
238
+ queuedDirectCallIds(projectId: string): readonly string[];
239
+ hasActiveRuntimeObjects(projectId: string): boolean;
240
+ decideCall(projectId: string, callId: string, decision: 'approve' | 'reject' | 'cancel', expectedRevision?: number): {
241
+ readonly call: Document;
242
+ readonly result: Document | null;
243
+ };
244
+ answerCall(projectId: string, callId: string, expectedRevision: number, answer: Json): {
245
+ readonly call: Document;
246
+ readonly result: Document | null;
247
+ };
248
+ reviewCall(projectId: string, callId: string, approved: boolean): Document;
249
+ startCall(projectId: string, callId: string): Document;
250
+ waitCall(projectId: string, callId: string, prompt: Json): Document;
251
+ completeCall(projectId: string, callId: string, outcome: string, content: Json, errorCode?: string | null, errorMessage?: string | null, artifacts?: readonly string[], truncated?: boolean): {
252
+ readonly call: Document;
253
+ readonly result: Document;
254
+ };
255
+ /**
256
+ * The stored Result plus its full Artifact rows, as `includeResult` reads it when it copies a
257
+ * Result into a Context. Not the wire shape -- see `resultDocument`.
258
+ */
259
+ getResult(projectId: string, resultId: string): Document;
260
+ /**
261
+ * 02A `ResultDocument`. One `content_json` column becomes `text` or `structured` according to its
262
+ * JSON type, which is the same split `normalizeOutput` makes when it decides what to store: a
263
+ * Capability producing prose stores a string, one producing records stores an object or array, and
264
+ * either is `null` here when the payload was too large to inline and became an Artifact instead.
265
+ * That is why a client reading a large Result has to fall back to `artifact_ids` and ART-01.
266
+ *
267
+ * `error_code` stays off the wire here because the documented shape does not carry it; a failed
268
+ * Call reports its code on `CallSummary.error_code`.
269
+ */
270
+ resultDocument(projectId: string, resultId: string): Document;
271
+ includeResult(projectId: string, resultId: string, agentId: string, expectedContextRevision: number): Document;
272
+ createArtifact(projectId: string, input: {
273
+ readonly name: string;
274
+ readonly mediaType: string;
275
+ readonly relativePath: string;
276
+ readonly sha256: string;
277
+ readonly sizeBytes: number;
278
+ }): Document;
279
+ getArtifact(projectId: string, artifactId: string): Document;
280
+ listArtifacts(projectId: string, options: PageOptions): Page<Document>;
281
+ /**
282
+ * 02A `ContextPageQuery.direction`. `backward` walks from the newest item towards the oldest,
283
+ * which is what a transcript needs: the first page is the latest turn, and paging loads history.
284
+ * `forward` walks in ordinal order for an audit view. The parameter was ignored and every caller
285
+ * got ordinal order, so the chat rendered its newest turn first and, past one page, would have
286
+ * paged away from the conversation instead of into its history.
287
+ */
288
+ listContext(projectId: string, agentId: string, options: PageOptions, direction?: 'forward' | 'backward'): Page<Document>;
289
+ contextSource(projectId: string, agentId: string): {
290
+ readonly agent: Document;
291
+ readonly items: readonly Document[];
292
+ readonly overrides: readonly Document[];
293
+ readonly capabilities: readonly Document[];
294
+ };
295
+ getPlan(projectId: string, agentId: string): Document | null;
296
+ updatePlan(projectId: string, agentId: string, items: Json): Document;
297
+ getContextItem(projectId: string, contextItemId: string): Document;
298
+ updateContextItem(projectId: string, contextItemId: string, expectedRevision: number, content: string): Document;
299
+ setContextVisibility(projectId: string, agentId: string, turnGroupIds: readonly string[], visible: boolean, expectedContextRevision: number): readonly Document[];
300
+ reorderContext(projectId: string, agentId: string, turnGroupIds: readonly string[], expectedContextRevision: number): readonly Document[];
301
+ listOverrides(projectId: string, agentId: string, options: PageOptions): Page<Document>;
302
+ getOverride(projectId: string, overrideId: string): Document;
303
+ createOverride(projectId: string, agentId: string, targetKind: string, targetId: string, instructions: string): Document;
304
+ updateOverride(projectId: string, overrideId: string, expectedRevision: number, instructions: string): Document;
305
+ deleteOverride(projectId: string, overrideId: string, expectedRevision: number): void;
306
+ listTurnGroups(projectId: string, agentId: string, options: PageOptions): Page<Document>;
307
+ listProjectionDecisions(projectId: string, agentId: string, options: PageOptions): Page<Document>;
308
+ resetProjection(projectId: string, agentId: string, expectedContextRevision: number, stages?: readonly string[]): Document;
309
+ appendProjectionDecision(projectId: string, agentId: string, attemptId: string | null, stage: string, sourceTokens: number, projectedTokens: number, details: Json): Document;
310
+ compactContext(projectId: string, agentId: string, summary: string, preserveFromOrdinal: number): Document;
311
+ forkContext(projectId: string, sourceAgentId: string, targetAgentId: string, throughOrdinal: number): readonly Document[];
312
+ createContextFork(projectId: string, sourceAgentId: string, input: {
313
+ readonly throughTurnGroupId: string;
314
+ readonly expectedContextRevision: number;
315
+ readonly name: string;
316
+ readonly model: string;
317
+ readonly modelReasoningEffort: string;
318
+ }): Document;
319
+ appendAssistantMessage(projectId: string, agentId: string, stepId: string, content: string): Document;
320
+ appendToolCalls(projectId: string, agentId: string, stepId: string, calls: readonly {
321
+ readonly id: string;
322
+ readonly name: string;
323
+ readonly arguments: Json;
324
+ }[]): Document;
325
+ /**
326
+ * `errorMessage` is what the failure actually said. `error_code` alone made a Provider rejection, a TLS
327
+ * fault and a malformed Tool block all read as one `RUNTIME_FAILED` with nothing to act on.
328
+ */
329
+ finishStep(projectId: string, stepId: string, outcome: string, errorCode?: string | null, errorMessage?: string | null): {
330
+ readonly step: Document;
331
+ readonly run: Document;
332
+ readonly agent: Document;
333
+ };
334
+ continueRun(projectId: string, stepId: string): Document;
335
+ yieldResults(projectId: string, agentId: string, callIds: readonly string[]): readonly Document[];
336
+ cancelAgent(projectId: string, agentId: string): readonly Document[];
337
+ runTimeline(projectId: string, runId: string, options: PageOptions): Page<Document>;
338
+ stepOutput(projectId: string, stepId: string): Document;
339
+ storageStats(): Document;
340
+ exportState(): Json;
341
+ purgeArchived(projectId: string, before: string): Document;
342
+ snapshot(projectId: string, maxEntities: number): Document;
343
+ }
344
+ export {};