@noetic-tools/core 5.20.0 → 5.22.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builders/tool-builder.d.ts +20 -0
- package/dist/builders/tool-builder.js +23 -1
- package/dist/builders/workflow-hydrator.d.ts +19 -0
- package/dist/builders/workflow-hydrator.js +19 -0
- package/dist/builders/workflow-step.js +7 -1
- package/dist/connections/cron-schedule.js +12 -3
- package/dist/connections/durability.d.ts +1 -2
- package/dist/connections/durability.js +1 -4
- package/dist/connections/gates.js +6 -2
- package/dist/connections/harness-wiring.d.ts +5 -0
- package/dist/connections/harness-wiring.js +76 -10
- package/dist/connections/in-memory-connection.d.ts +4 -0
- package/dist/connections/in-memory-connection.js +10 -0
- package/dist/connections/model-tools.js +5 -1
- package/dist/connections/registry.d.ts +6 -2
- package/dist/connections/registry.js +10 -0
- package/dist/connections/sources.js +261 -20
- package/dist/connections/triggers.d.ts +62 -2
- package/dist/connections/triggers.js +375 -35
- package/dist/harness/agent-harness.d.ts +263 -4
- package/dist/harness/agent-harness.js +1156 -95
- package/dist/harness/connection-gate.d.ts +3 -0
- package/dist/harness/connection-gate.js +4 -0
- package/dist/harness/deps/runtime.d.ts +3 -0
- package/dist/harness/deps/runtime.js +2 -0
- package/dist/harness/flow-version.d.ts +13 -0
- package/dist/harness/flow-version.js +66 -0
- package/dist/harness/harness-options.d.ts +82 -0
- package/dist/harness/model-call.d.ts +0 -1
- package/dist/harness/model-call.js +8 -48
- package/dist/harness/model-rounds.d.ts +30 -0
- package/dist/harness/model-rounds.js +146 -1
- package/dist/harness/model-tool-round.d.ts +3 -0
- package/dist/harness/model-tool-round.js +201 -19
- package/dist/harness/park-watchers.d.ts +93 -0
- package/dist/harness/park-watchers.js +217 -0
- package/dist/harness/read-decision.d.ts +23 -0
- package/dist/harness/read-decision.js +100 -0
- package/dist/harness/spend.js +4 -0
- package/dist/harness/steer-inbox.js +3 -1
- package/dist/harness/thread-record.d.ts +77 -1
- package/dist/harness/thread-record.js +272 -13
- package/dist/index.d.ts +17 -7
- package/dist/index.js +10 -2
- package/dist/interpreter/acp-resume.d.ts +77 -0
- package/dist/interpreter/acp-resume.js +164 -0
- package/dist/interpreter/acp-tools.d.ts +11 -0
- package/dist/interpreter/acp-tools.js +94 -7
- package/dist/interpreter/connection-steps.d.ts +24 -1
- package/dist/interpreter/connection-steps.js +77 -2
- package/dist/interpreter/execute-acp-agent.js +111 -15
- package/dist/interpreter/execute-action.js +7 -0
- package/dist/interpreter/execute-call.js +30 -4
- package/dist/interpreter/execute-control.js +21 -0
- package/dist/interpreter/execute-invoke-tool.js +149 -5
- package/dist/interpreter/execute-wait.js +67 -9
- package/dist/interpreter/execute.js +4 -0
- package/dist/interpreter/turn-ending.d.ts +15 -0
- package/dist/interpreter/turn-ending.js +46 -0
- package/dist/portable/builders.d.ts +1 -1
- package/dist/portable/builders.js +1 -1
- package/dist/runtime/durable/parking.d.ts +61 -0
- package/dist/runtime/durable/parking.js +137 -0
- package/dist/runtime/durable/session-store.d.ts +38 -0
- package/dist/runtime/durable/session-store.js +79 -1
- package/dist/runtime/durable/step-ledger.d.ts +121 -2
- package/dist/runtime/durable/step-ledger.js +352 -15
- package/dist/runtime/durable/turn-lease.d.ts +128 -0
- package/dist/runtime/durable/turn-lease.js +307 -0
- package/dist/runtime/held-calls.d.ts +192 -0
- package/dist/runtime/held-calls.js +496 -0
- package/dist/runtime/in-memory-storage.d.ts +10 -1
- package/dist/runtime/in-memory-storage.js +20 -2
- package/dist/runtime/message-queue.d.ts +2 -0
- package/dist/runtime/message-queue.js +8 -0
- package/dist/runtime/session-runner.d.ts +18 -2
- package/dist/runtime/session-runner.js +88 -3
- package/dist/runtime/tool-approval.d.ts +46 -6
- package/dist/runtime/tool-approval.js +160 -38
- package/dist/runtime/tool-call.d.ts +34 -2
- package/dist/runtime/tool-call.js +182 -13
- package/dist/runtime/tool-context.d.ts +15 -1
- package/dist/runtime/tool-context.js +38 -2
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ArtifactStore, ConnectionStatus } from '@noetic-tools/types';
|
|
1
|
+
import type { ApproveRequest, ArtifactStore, ConnectionStatus, ConnectionTrigger, ExecuteArgument, HeldCall, HeldResolution, StuckTurn, TrailMark } from '@noetic-tools/types';
|
|
2
2
|
import { ItemSchemaRegistry } from '@noetic-tools/types';
|
|
3
3
|
import { AcpSessionStore } from '../runtime/acp-session-store.js';
|
|
4
4
|
import type { LayerStateStore, RecallCache } from './deps/context.js';
|
|
5
5
|
import type { DetachedSpawnOverrides } from './deps/interpreter.js';
|
|
6
6
|
import type { CheckpointStore, EventBroadcaster, RestoreCheckpointOptions, StepLedgerRetention, StepLedgerStore } from './deps/runtime.js';
|
|
7
7
|
import { ChannelStore, Drains } from './deps/runtime.js';
|
|
8
|
-
import type { AcpLiveSession, AcpSessionInfo, AgentConfig, AgentHarnessContract, CallModelRequest, CancelOptions, Channel, ChannelHandle, Context, ContextCacheStore, ContextData, ContextLayer, CustomItem, CustomItemOf, CustomItemStreamEvent, CustomStreamingItem, CwdState, DecideRequest, DecideResponse, DecisionRecord, DeclaredItems, DetachedHandle, DrainReport,
|
|
9
|
-
import type { AgentHarnessOpts } from './harness-options.js';
|
|
8
|
+
import type { AcpLiveSession, AcpSessionInfo, AgentConfig, AgentHarnessContract, CallModelRequest, CancelOptions, Channel, ChannelHandle, Context, ContextCacheStore, ContextData, ContextLayer, CustomItem, CustomItemOf, CustomItemStreamEvent, CustomStreamingItem, CwdState, DecideRequest, DecideResponse, DecisionRecord, DeclaredItems, DetachedHandle, DrainReport, ExecuteOptions, ExecutionScope, ExecutionStatus, ExternalChannel, FsAdapter, HarnessResponse, HarnessStatus, Item, LLMResponse, OnSteerParams, PendingSpend, RecallLayerOutput, RecallOptions, ReconcileSpendOptions, SessionScope, SessionUsage, ShellAdapter, Span, SpendSettlement, SteeringDecision, SteerVerdict, Step, StepLike, StepsInput, StepsOutput, StorageAdapter, StreamEvent, StreamingItem, SubprocessAdapter, TraceExporter, ValidStepChain, WriteOffSpendOptions } from './deps/types.js';
|
|
9
|
+
import type { AgentHarnessOpts, WakeTimeListener } from './harness-options.js';
|
|
10
10
|
import { Spend } from './spend.js';
|
|
11
11
|
/**
|
|
12
12
|
* Default agent harness for executing agent steps with built-in channel, context, and trace support.
|
|
@@ -66,6 +66,20 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
66
66
|
private readonly liveRoots;
|
|
67
67
|
/** Stored sessions for `execute()` threads. Present exactly when durability is on. */
|
|
68
68
|
private readonly sessionStore?;
|
|
69
|
+
/** Set when sessions are durable and storage can compare-and-set. */
|
|
70
|
+
private readonly leaseOptions?;
|
|
71
|
+
/** The flow version this harness runs, when the host names one. */
|
|
72
|
+
private readonly version?;
|
|
73
|
+
/** Set when turns park (`environment.storage.park`): the grace before one does. */
|
|
74
|
+
private readonly parkGraceMs?;
|
|
75
|
+
/** Set when this harness wakes the turns it parked (`park.autoWake`). */
|
|
76
|
+
private readonly parkWatchers?;
|
|
77
|
+
/** Who hears when the next wake time changes (`onWakeTimeChange`). */
|
|
78
|
+
private readonly wakeTimeListeners;
|
|
79
|
+
/** The wake time listeners last heard; `null` until they have heard one. */
|
|
80
|
+
private announcedWakeTime;
|
|
81
|
+
/** The announcement in flight, so two never run out of order. */
|
|
82
|
+
private announcing;
|
|
69
83
|
/** Checkpoint capture in flight per execution id — see `saveCheckpoint`. */
|
|
70
84
|
private readonly pendingCheckpoints;
|
|
71
85
|
private readonly defaultDeliveryMode;
|
|
@@ -148,6 +162,35 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
148
162
|
* @public
|
|
149
163
|
*/
|
|
150
164
|
start(): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Hear when `getNextWakeTime()` changes: a turn parks, resumes or ends, a
|
|
167
|
+
* trigger is added or removed, or a scheduled source's event is read. `listener`
|
|
168
|
+
* gets the new time, or `undefined` when there is nothing to wake for. The first
|
|
169
|
+
* call comes when the harness starts. A host with no process of its own between
|
|
170
|
+
* events sets its alarm from it.
|
|
171
|
+
*
|
|
172
|
+
* The harness waits for the listener before a parking turn answers, and a
|
|
173
|
+
* listener that throws there fails that turn's response: a turn nothing will
|
|
174
|
+
* wake must not look safely parked. Anywhere else a throw is logged.
|
|
175
|
+
*
|
|
176
|
+
* It does not replace the harness's own timer (`park.autoWake`).
|
|
177
|
+
*
|
|
178
|
+
* @returns a function that stops the listener hearing.
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
onWakeTimeChange(listener: WakeTimeListener): () => void;
|
|
182
|
+
/** Tell the listeners the next wake time, when it is not the one they last heard. */
|
|
183
|
+
private announceWakeTime;
|
|
184
|
+
/** `announceWakeTime`, where a listener's failure has no turn to land on. */
|
|
185
|
+
private announceWakeTimeQuietly;
|
|
186
|
+
/**
|
|
187
|
+
* Resolves once the harness has nothing in hand: every scheduled event that is
|
|
188
|
+
* due has been read by its trigger, and every turn has finished or parked. A
|
|
189
|
+
* serverless host awaits it after `start()` and `wake()`, before it lets its
|
|
190
|
+
* process go.
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
193
|
+
waitForIdle(): Promise<void>;
|
|
151
194
|
/**
|
|
152
195
|
* Each connection's state, identity and pool usage; one entry for `name`, or all.
|
|
153
196
|
* @public
|
|
@@ -169,7 +212,53 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
169
212
|
* for passing an absolute, validated path.
|
|
170
213
|
*/
|
|
171
214
|
setRootCwd(nextCwd: string): void;
|
|
172
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Hand the thread a message, a person's decision, or both.
|
|
217
|
+
*
|
|
218
|
+
* A {@link DecisionItem} answers a tool call the thread's turn holds, or settles
|
|
219
|
+
* its stuck turn. It is not written to the conversation, and input that holds
|
|
220
|
+
* nothing else starts no turn: the turn the decision is for goes on.
|
|
221
|
+
*
|
|
222
|
+
* Several decisions in one list are read first, so a malformed one changes
|
|
223
|
+
* nothing, and then taken in order: one the thread's state refuses throws, and
|
|
224
|
+
* those before it stay taken. `options` reach the turn a decision resumes.
|
|
225
|
+
*
|
|
226
|
+
* @throws NoeticError `hold_refused` when an answer to a held call cannot be
|
|
227
|
+
* taken: the thread holds no such call, `argsHash` names other arguments, the
|
|
228
|
+
* answer is the wrong kind for the hold, the call was already answered
|
|
229
|
+
* differently, its `output` is not a JSON value, or a `function_call_output`
|
|
230
|
+
* item names a held call.
|
|
231
|
+
* @throws NoeticError `decision_refused` when a decision does not fit what the
|
|
232
|
+
* thread is waiting on: no turn is stuck, it carries both an `action` and an
|
|
233
|
+
* `output`, or its action is the wrong kind for a decision with, or without,
|
|
234
|
+
* a `callId`.
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
execute(input: ExecuteArgument, options?: ExecuteOptions): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Act on the decisions in `input` and resolve what is left of it: the message to
|
|
240
|
+
* deliver, or undefined when the input was decisions only.
|
|
241
|
+
*
|
|
242
|
+
* Every decision is read before any is acted on, so a list with a malformed one
|
|
243
|
+
* changes nothing. They are then acted on in order: one the thread's state
|
|
244
|
+
* refuses throws, and those before it stay taken.
|
|
245
|
+
*/
|
|
246
|
+
private takeDecisions;
|
|
247
|
+
/**
|
|
248
|
+
* A held call's result comes in a decision. A `function_call_output` for one
|
|
249
|
+
* would go into the conversation and leave the call waiting, so it is refused.
|
|
250
|
+
*/
|
|
251
|
+
private refuseResultsForHeldCalls;
|
|
252
|
+
/** Act on one decision: an answer to a held call, or the settling of a stuck turn. */
|
|
253
|
+
private takeDecision;
|
|
254
|
+
private deliverInput;
|
|
255
|
+
/**
|
|
256
|
+
* Hand a message to its thread. One at a time per thread: what to do with a
|
|
257
|
+
* message is decided by looking at the thread and then acting, and two
|
|
258
|
+
* deliveries doing that at once would each miss the other.
|
|
259
|
+
*/
|
|
260
|
+
private deliver;
|
|
261
|
+
private deliverOne;
|
|
173
262
|
/** The turn's response. `items` holds final items: standard ones and the graph's declared custom items. */
|
|
174
263
|
getAgentResponse(scope?: SessionScope): Promise<HarnessResponse<Item | CustomItemOf<DeclaredItems<TItem>>>>;
|
|
175
264
|
/**
|
|
@@ -193,15 +282,185 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
193
282
|
getUsage(scope?: SessionScope): SessionUsage;
|
|
194
283
|
seedSessionHistory(threadId: string, items: ReadonlyArray<Item>): void;
|
|
195
284
|
private getOrCreateSession;
|
|
285
|
+
/**
|
|
286
|
+
* Resume turns that are parked or were cut off (spec 23 § Parked turns).
|
|
287
|
+
*
|
|
288
|
+
* With no `threadId`, every stored thread is looked at: a parked turn is resumed
|
|
289
|
+
* once its wake time has come, and a cut-off turn at once. With a `threadId`, that
|
|
290
|
+
* thread's turn is resumed whether or not it is due — the call a host makes when
|
|
291
|
+
* it knows the event a parked turn waits for has arrived. A turn another harness
|
|
292
|
+
* holds, or one already running here, is left alone.
|
|
293
|
+
*
|
|
294
|
+
* A resumed turn replays what it finished and goes on. `options` are the
|
|
295
|
+
* `execute()` options it runs with; a stored turn keeps none of its own.
|
|
296
|
+
*
|
|
297
|
+
* Resolves the ids of the threads it resumed. Durable sessions only.
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
wake(scope?: {
|
|
301
|
+
threadId?: string;
|
|
302
|
+
options?: ExecuteOptions;
|
|
303
|
+
}): Promise<string[]>;
|
|
304
|
+
/**
|
|
305
|
+
* The earliest time the harness has something to do, in epoch ms: a parked turn
|
|
306
|
+
* that needs waking, or the next event of a scheduled source a trigger listens
|
|
307
|
+
* to (`cron()`). Undefined when there is neither. A host with no process of its
|
|
308
|
+
* own between events (a serverless worker) schedules its next `start()` and
|
|
309
|
+
* `wake()` from this.
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
312
|
+
getNextWakeTime(): Promise<number | undefined>;
|
|
313
|
+
/**
|
|
314
|
+
* When a routine `wake()` would have something to do for the thread's turn: a
|
|
315
|
+
* parked turn at its deadline, a turn cut off by a crash at once. Never before
|
|
316
|
+
* another harness's lease on it runs out, since a wake before then does nothing.
|
|
317
|
+
* Undefined for a turn that waits on something other than time, and one that is
|
|
318
|
+
* stuck or stopped. A turn this harness is running is due one lease period from
|
|
319
|
+
* now: the time to come back if the process running it is gone.
|
|
320
|
+
*/
|
|
321
|
+
private turnDueAt;
|
|
322
|
+
/**
|
|
323
|
+
* The tool calls a thread's turn holds for a person (spec 08 § Held tool calls):
|
|
324
|
+
* calls waiting for approval, and calls whose tool left its result open. Each
|
|
325
|
+
* carries what a decision needs to answer it.
|
|
326
|
+
* @public
|
|
327
|
+
*/
|
|
328
|
+
pending(scope?: SessionScope | ExecutionScope): Promise<HeldCall[]>;
|
|
329
|
+
/**
|
|
330
|
+
* Answer a held tool call: a decision for one that waits for approval, an output
|
|
331
|
+
* for one that waits for its result. The turn then goes on — at once when it is
|
|
332
|
+
* running here, and by being woken when it is parked.
|
|
333
|
+
*
|
|
334
|
+
* `scope` names the thread, or with `{ executionId }` an execution a host runs
|
|
335
|
+
* itself through `harness.run()`.
|
|
336
|
+
*
|
|
337
|
+
* The first answer wins. The same answer again is a no-op, so a host may retry.
|
|
338
|
+
* Pass the `argsHash` the call was shown with to make sure the answer is for it.
|
|
339
|
+
*
|
|
340
|
+
* @throws NoeticError `hold_refused` when the thread holds no such call,
|
|
341
|
+
* `argsHash` names different arguments, the answer is the wrong kind for the
|
|
342
|
+
* hold, or the call was already answered differently.
|
|
343
|
+
* @internal Hosts answer through `execute()` with a `DecisionItem`, which
|
|
344
|
+
* carries an `executionId` for a call held by a run the host started itself.
|
|
345
|
+
* This is what that calls.
|
|
346
|
+
*/
|
|
347
|
+
resolveHeld(scope: SessionScope | ExecutionScope | undefined, answer: HeldResolution & {
|
|
348
|
+
readonly callId: string;
|
|
349
|
+
readonly argsHash?: string;
|
|
350
|
+
}, options?: ExecuteOptions): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* The turns that stopped rather than redo a step that had a lasting effect under
|
|
353
|
+
* another flow version (spec 23 § Versions). Each waits for a `DecisionItem`
|
|
354
|
+
* with `continue`, `restart` or `abandon`, passed to `execute()` on its thread.
|
|
355
|
+
* @public
|
|
356
|
+
*/
|
|
357
|
+
listStuckRuns(): Promise<StuckTurn[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Settle a stuck turn (spec 23 § Versions). Resolves false when the thread has none.
|
|
360
|
+
*
|
|
361
|
+
* - `continue`: accept the difference. The turn resumes on this harness's
|
|
362
|
+
* version, and the step that no longer matches runs again.
|
|
363
|
+
* - `restart`: forget what the turn recorded and run it from the top on this
|
|
364
|
+
* harness's version. Every step runs again, effects included.
|
|
365
|
+
* - `abandon`: drop the turn. Its trail is kept.
|
|
366
|
+
*/
|
|
367
|
+
private settleStuckTurn;
|
|
368
|
+
/**
|
|
369
|
+
* What a run did, step by step: who ran each step, under which flow version, and
|
|
370
|
+
* the receipt of a step with a lasting effect (spec 23 § The trail). Marks outlive
|
|
371
|
+
* the ledger entries they came from, so the trail of a finished run stays readable.
|
|
372
|
+
*
|
|
373
|
+
* `scope` names an execution, or a thread, whose recent turns are then listed in
|
|
374
|
+
* order.
|
|
375
|
+
* @public
|
|
376
|
+
*/
|
|
377
|
+
getAuditTrail(scope: SessionScope | ExecutionScope): Promise<TrailMark[]>;
|
|
378
|
+
/**
|
|
379
|
+
* Add a trigger while the harness runs (spec 35 § Triggers). A trigger written
|
|
380
|
+
* with expressions only is kept in storage, so it is there again after a restart;
|
|
381
|
+
* one with a function in it lasts for this process.
|
|
382
|
+
*
|
|
383
|
+
* @throws NoeticConfigError `CONNECTION_INVALID` for an id already in use, a
|
|
384
|
+
* missing event or an expression that does not parse; `CONNECTION_UNKNOWN` for
|
|
385
|
+
* an unknown connection.
|
|
386
|
+
* @public
|
|
387
|
+
*/
|
|
388
|
+
addTrigger(trigger: ConnectionTrigger): Promise<void>;
|
|
389
|
+
/**
|
|
390
|
+
* Stop and forget a trigger. Resolves false when there is none with that id.
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
removeTrigger(id: string): Promise<boolean>;
|
|
394
|
+
/**
|
|
395
|
+
* Every trigger the harness has: its own, and those added while it ran.
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
listTriggers(): ConnectionTrigger[];
|
|
399
|
+
/** The watchers that wake this harness's parked turns, when auto-wake is on. */
|
|
400
|
+
private createParkWatchers;
|
|
401
|
+
/**
|
|
402
|
+
* Messages that reached the runner while the thread's turn is parked or stuck
|
|
403
|
+
* (one that landed as the turn was closing out, say). Starting a turn with them
|
|
404
|
+
* would throw the waiting one away, so they are kept in storage for after it. A
|
|
405
|
+
* steer wakes a parked turn, as one delivered a moment later would. An
|
|
406
|
+
* `interrupt` is not set aside: replacing the turn is what it asks for.
|
|
407
|
+
* Resolves true when the messages were set aside.
|
|
408
|
+
*/
|
|
409
|
+
private setAside;
|
|
410
|
+
/** Resume a parked turn when one of its held calls already has an answer. */
|
|
411
|
+
private wakeIfAnswered;
|
|
412
|
+
/**
|
|
413
|
+
* A message delivered again after its turn finished (spec 23a § Sessions): a queue
|
|
414
|
+
* that delivers at least once, or a webhook the sender retried. It is answered
|
|
415
|
+
* with the answer that turn gave, and nothing runs. Resolves true when it was.
|
|
416
|
+
*/
|
|
417
|
+
private answerAgain;
|
|
418
|
+
/**
|
|
419
|
+
* A message delivered again while this harness already has it in hand: its turn is
|
|
420
|
+
* running, it is queued to run, or its turn finished a moment ago and the runner
|
|
421
|
+
* has not gone idle yet (spec 23a § Sessions). Queuing it would run the same
|
|
422
|
+
* message as a second turn once the first ends. It is dropped; the caller reads
|
|
423
|
+
* the answer of the turn that has it. Resolves true when it was.
|
|
424
|
+
*/
|
|
425
|
+
private inHand;
|
|
426
|
+
/**
|
|
427
|
+
* A message for a thread whose turn is parked (spec 23 § Parked turns). It must not
|
|
428
|
+
* start a turn of its own: the thread has one in flight, and starting another would
|
|
429
|
+
* abandon it. Resolves true when the message was taken care of here.
|
|
430
|
+
*
|
|
431
|
+
* - `next-turn` waits in storage for the parked turn to end.
|
|
432
|
+
* - A steer wakes the turn, which offers it to the context layers as it would mid-round.
|
|
433
|
+
* - `interrupt` is not handled here: it replaces the turn, as it does a running one.
|
|
434
|
+
*/
|
|
435
|
+
private deliverToParked;
|
|
436
|
+
/** The execution whose held calls `scope` names. */
|
|
437
|
+
private heldExecutionId;
|
|
438
|
+
/** The execution of the thread's turn in flight: running here, or stored. */
|
|
439
|
+
private turnExecutionId;
|
|
440
|
+
/** The harness clock. */
|
|
441
|
+
private now;
|
|
442
|
+
/** Hand the turn's lease back and return the thread record to best-effort writes. */
|
|
443
|
+
private releaseLease;
|
|
196
444
|
/** The stored record for `threadId`, when durability is on. */
|
|
197
445
|
private threadRecord;
|
|
198
446
|
private requireSession;
|
|
199
447
|
callModel(request: CallModelRequest): Promise<LLMResponse>;
|
|
200
448
|
decide(request: DecideRequest): Promise<DecideResponse>;
|
|
449
|
+
/**
|
|
450
|
+
* The approval seam (spec 08 § Held tool calls): the `approveToolCall` approver
|
|
451
|
+
* decides, and with none, or when it answers `hold`, the action is held until
|
|
452
|
+
* a decision answers it. Resolves the settled decision.
|
|
453
|
+
* @public
|
|
454
|
+
*/
|
|
455
|
+
approve(request: ApproveRequest): Promise<SteeringDecision>;
|
|
201
456
|
notifyDecision(layers: ContextLayer[], record: DecisionRecord, ctx: Context): Promise<void>;
|
|
202
457
|
/**
|
|
203
458
|
* Runs a step — or an array of steps in sequence, each output the next one's
|
|
204
459
|
* input. Every link of an array is type-checked (`ValidStepChain`).
|
|
460
|
+
*
|
|
461
|
+
* @internal How one step runs another (`execCtx.harness.run` inside a step or a
|
|
462
|
+
* tool), and how a test runs a step on a context it built. A host's way in is
|
|
463
|
+
* `execute()`.
|
|
205
464
|
*/
|
|
206
465
|
run<I, O>(step: Step<ContextData, I, O>, input: I, ctx: Context): Promise<O>;
|
|
207
466
|
run<const T extends StepLike | ReadonlyArray<StepLike>>(steps: T & ValidStepChain<T>, input: StepsInput<T>, ctx: Context): Promise<StepsOutput<T>>;
|