@noetic-tools/core 3.2.0 → 5.0.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/adapters/in-memory-subprocess/manifest-persistence.d.ts +1 -1
- package/dist/adapters/in-memory-subprocess/types.d.ts +1 -1
- package/dist/adapters/openrouter.d.ts +2 -2
- package/dist/adapters/openrouter.js +2 -2
- package/dist/builders/context-builder.d.ts +11 -0
- package/dist/builders/context-builder.js +15 -0
- package/dist/builders/context-option.d.ts +23 -0
- package/dist/builders/context-option.js +22 -0
- package/dist/builders/control-flow-builders.d.ts +19 -19
- package/dist/builders/every.d.ts +4 -4
- package/dist/builders/layer-provides-builders.d.ts +1 -1
- package/dist/builders/layer-provides-builders.js +1 -1
- package/dist/builders/loop-builder.d.ts +3 -3
- package/dist/builders/provide-builder.d.ts +14 -7
- package/dist/builders/provide-builder.js +15 -4
- package/dist/builders/spawn-builder.d.ts +8 -6
- package/dist/builders/spawn-builder.js +7 -2
- package/dist/builders/step-builders.d.ts +19 -20
- package/dist/builders/tool-builder.d.ts +9 -5
- package/dist/builders/tool-builder.js +3 -2
- package/dist/builders/workflow-hydrator.d.ts +17 -4
- package/dist/builders/workflow-hydrator.js +87 -8
- package/dist/builders/workflow-step.d.ts +61 -0
- package/dist/builders/workflow-step.js +126 -0
- package/dist/conditions/conditions.d.ts +17 -17
- package/dist/conditions/conditions.js +1 -1
- package/dist/deprecated.d.ts +30 -0
- package/dist/deprecated.js +28 -0
- package/dist/harness/agent-harness.d.ts +42 -26
- package/dist/harness/agent-harness.js +68 -21
- package/dist/harness/deps/{memory.d.ts → context.d.ts} +2 -2
- package/dist/harness/deps/{memory.js → context.js} +1 -1
- package/dist/harness/deps/types.d.ts +1 -1
- package/dist/harness/model-schema.d.ts +2 -2
- package/dist/index.d.ts +21 -17
- package/dist/index.js +14 -8
- package/dist/interpreter/action-deps.d.ts +3 -3
- package/dist/interpreter/action-deps.js +2 -2
- package/dist/interpreter/action-types.d.ts +1 -1
- package/dist/interpreter/collect-tools.d.ts +1 -1
- package/dist/interpreter/execute-action.d.ts +10 -10
- package/dist/interpreter/execute-action.js +13 -13
- package/dist/interpreter/execute-control.d.ts +4 -4
- package/dist/interpreter/execute-control.js +1 -1
- package/dist/interpreter/execute-sub-harness.d.ts +1 -1
- package/dist/interpreter/execute.d.ts +3 -3
- package/dist/interpreter/execute.js +78 -31
- package/dist/interpreter/step-dispatcher.d.ts +3 -3
- package/dist/interpreter/sub-harness-events.d.ts +2 -2
- package/dist/interpreter/typeguards.d.ts +4 -4
- package/dist/patterns/dynamic-workflow.d.ts +7 -4
- package/dist/patterns/dynamic-workflow.js +2 -0
- package/dist/patterns/interview.d.ts +2 -2
- package/dist/patterns/plans.d.ts +5 -5
- package/dist/patterns/ralph-wiggum.d.ts +2 -2
- package/dist/patterns/react.d.ts +7 -5
- package/dist/patterns/react.js +6 -4
- package/dist/portable/builders.js +2 -0
- package/dist/portable/context-layers.d.ts +8 -0
- package/dist/portable/context-layers.js +8 -0
- package/dist/portable.d.ts +2 -2
- package/dist/portable.js +2 -2
- package/dist/runtime/channel-store.d.ts +33 -0
- package/dist/runtime/channel-store.js +297 -11
- package/dist/runtime/context-deps.d.ts +2 -2
- package/dist/runtime/context-deps.js +1 -1
- package/dist/runtime/context-impl.d.ts +10 -8
- package/dist/runtime/context-impl.js +11 -7
- package/dist/runtime/context-type-deps.d.ts +1 -1
- package/dist/runtime/durable/checkpoint-store.d.ts +1 -1
- package/dist/runtime/durable/harness-checkpoints.d.ts +2 -3
- package/dist/runtime/durable/harness-checkpoints.js +2 -3
- package/dist/runtime/durable/step-ledger.d.ts +1 -1
- package/dist/runtime/durable/step-ledger.js +1 -1
- package/dist/runtime/in-memory-storage.d.ts +1 -1
- package/dist/runtime/session-runner.d.ts +1 -1
- package/dist/runtime/step-registry.d.ts +3 -3
- package/dist/runtime/{tool-memory.d.ts → tool-context.d.ts} +1 -2
- package/dist/runtime/{tool-memory.js → tool-context.js} +5 -2
- package/dist/runtime/tool-ui.d.ts +1 -1
- package/dist/runtime/tool-ui.js +1 -1
- package/dist/schemas/workflow.d.ts +5 -279
- package/dist/schemas/workflow.js +4 -376
- package/dist/types/mutable-context.d.ts +2 -2
- package/dist/types/step-registrar.d.ts +1 -1
- package/dist/unstable.d.ts +5 -5
- package/dist/unstable.js +3 -3
- package/dist/until/predicates.d.ts +1 -1
- package/package.json +4 -4
- package/schema/noetic-workflow.schema.json +28 -0
- package/dist/builders/memory-builder.d.ts +0 -11
- package/dist/builders/memory-builder.js +0 -15
- package/dist/patterns/flow.d.ts +0 -2
- package/dist/patterns/flow.js +0 -1
- package/dist/portable/memory-layers.d.ts +0 -8
- package/dist/portable/memory-layers.js +0 -8
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ItemSchemaRegistry } from '@noetic-tools/types';
|
|
2
|
+
import type { LayerStateStore, RecallCache } from './deps/context.js';
|
|
2
3
|
import type { DetachedSpawnOverrides } from './deps/interpreter.js';
|
|
3
|
-
import type { LayerStateStore, RecallCache } from './deps/memory.js';
|
|
4
4
|
import type { CheckpointStore, EventBroadcaster, RestoreCheckpointOptions, StepLedgerRetention, StepLedgerStore } from './deps/runtime.js';
|
|
5
|
-
import type { AgentConfig, AgentHarnessContract, AgentHooks, CallModelRequest, Channel, ChannelHandle, Context,
|
|
5
|
+
import type { AgentConfig, AgentHarnessContract, AgentHooks, CallModelRequest, Channel, ChannelHandle, Context, ContextData, ContextLayer, CwdState, DeliveryMode, DetachedHandle, ExecuteInput, ExecuteOptions, ExternalChannel, FsAdapter, HarnessResponse, HarnessStatus, Item, ItemSchemaExtensions, LLMResponse, LlmProviderConfig, ProjectionPolicy, RecallLayerOutput, SessionScope, ShellAdapter, Span, SteeringDecision, Step, StorageAdapter, StreamEvent, StreamingItem, SubHarnessSession, SubprocessAdapter, Tool, TraceExporter, ZodType } from './deps/types.js';
|
|
6
6
|
export { createStreamIdleWatchdog } from './model-call.js';
|
|
7
7
|
interface AgentHarnessOpts<TParams extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
8
|
name: string;
|
|
9
|
-
initialStep?: Step<
|
|
10
|
-
/** Default
|
|
11
|
-
|
|
9
|
+
initialStep?: Step<ContextData, string, string>;
|
|
10
|
+
/** Default context layers applied to every context created via `createContext()` / `execute()`. */
|
|
11
|
+
context?: ContextLayer[];
|
|
12
|
+
/** @deprecated Renamed to `context`. */
|
|
13
|
+
memory?: ContextLayer[];
|
|
12
14
|
storage?: StorageAdapter;
|
|
13
15
|
hooks?: AgentHooks;
|
|
14
16
|
/**
|
|
@@ -93,8 +95,8 @@ export interface ResolvedLlmClient {
|
|
|
93
95
|
*/
|
|
94
96
|
export declare function resolveLlmClient(config: LlmProviderConfig | undefined, env: LlmEnv): ResolvedLlmClient | undefined;
|
|
95
97
|
/**
|
|
96
|
-
* Default agent harness for executing agent steps with built-in channel,
|
|
97
|
-
* Provides channel store,
|
|
98
|
+
* Default agent harness for executing agent steps with built-in channel, context, and trace support.
|
|
99
|
+
* Provides channel store, context layer lifecycle, and trace export with no external dependencies.
|
|
98
100
|
*
|
|
99
101
|
* Messages submitted via `execute()` are enqueued on a per-thread session and
|
|
100
102
|
* processed by a `SessionRunner`. Consumers observe responses via the session-
|
|
@@ -128,12 +130,14 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
128
130
|
private readonly initialStep?;
|
|
129
131
|
/** Harness-wide tool pool merged into every context's `unifiedTools`. */
|
|
130
132
|
private readonly harnessTools;
|
|
131
|
-
/** @internal
|
|
133
|
+
/** @internal Context layers configured for this harness. Exposed non-private
|
|
132
134
|
* so free functions in `runtime/durable/` (checkpoint/restore) can read it
|
|
133
135
|
* without friend-class gymnastics. Do not access from outside core. */
|
|
134
|
-
readonly
|
|
136
|
+
readonly _contextLayers?: ContextLayer[];
|
|
135
137
|
private readonly client?;
|
|
136
138
|
private readonly channelStore;
|
|
139
|
+
/** Re-entrant `run()` depth per root context id — see `executeClosingChannels`. */
|
|
140
|
+
private readonly rootRunDepth;
|
|
137
141
|
private readonly callModelOverride?;
|
|
138
142
|
private readonly defaultDeliveryMode;
|
|
139
143
|
private readonly streamIdleTimeoutMs;
|
|
@@ -189,10 +193,19 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
189
193
|
private getOrCreateSession;
|
|
190
194
|
private requireSession;
|
|
191
195
|
callModel(request: CallModelRequest): Promise<LLMResponse>;
|
|
192
|
-
run<I, O>(s: Step<
|
|
196
|
+
run<I, O>(s: Step<ContextData, I, O>, input: I, ctx: Context): Promise<O>;
|
|
193
197
|
/** Run all layer `init` hooks before the first step executes. Per spec 11,
|
|
194
198
|
* init MUST complete before any recall fires so layer state is populated. */
|
|
195
199
|
private initAndRun;
|
|
200
|
+
/**
|
|
201
|
+
* Run `execute`, closing the execution's external channels when the
|
|
202
|
+
* OUTERMOST run on a root context finishes (spec 06 Lifecycle: handles flip
|
|
203
|
+
* `closed`, channel streams end). Patterns re-enter `run()` with the same
|
|
204
|
+
* root context (`ctx.harness.run(step, input, ctx)`), so a depth count —
|
|
205
|
+
* not the return itself — marks root completion. Child-context runs never
|
|
206
|
+
* close anything.
|
|
207
|
+
*/
|
|
208
|
+
private executeClosingChannels;
|
|
196
209
|
/**
|
|
197
210
|
* Idempotently run layer `init` hooks for `ctx` (keyed by `ctx.id`). Init
|
|
198
211
|
* MUST complete before any recall/store fires so init-bearing layers are not
|
|
@@ -201,14 +214,16 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
201
214
|
* clobber accumulated in-memory state.
|
|
202
215
|
*/
|
|
203
216
|
private ensureLayersInit;
|
|
204
|
-
detachedSpawn<I, O>(s: Step<
|
|
217
|
+
detachedSpawn<I, O>(s: Step<ContextData, I, O>, input: I, parentCtx: Context, overrides?: DetachedSpawnOverrides): DetachedHandle<O>;
|
|
205
218
|
createContext(opts?: {
|
|
206
219
|
parent?: Context;
|
|
207
220
|
items?: Item[];
|
|
208
221
|
state?: unknown;
|
|
209
222
|
threadId?: string;
|
|
210
223
|
resourceId?: string;
|
|
211
|
-
|
|
224
|
+
context?: ContextLayer[];
|
|
225
|
+
/** @deprecated Renamed to `context`. */
|
|
226
|
+
memory?: ContextLayer[];
|
|
212
227
|
/**
|
|
213
228
|
* Initial cwd for the new context. When set, takes precedence over both
|
|
214
229
|
* the parent snapshot and the harness root cwd — used by worktree
|
|
@@ -223,18 +238,19 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
223
238
|
}): Promise<T>;
|
|
224
239
|
tryRecv<T>(channel: Channel<T>, _ctx: Context): T | null;
|
|
225
240
|
getChannelHandle<T>(channel: ExternalChannel<T>, executionId: string): ChannelHandle<T>;
|
|
241
|
+
getChannelStream<T>(channel: ExternalChannel<T>, executionId: string): AsyncIterable<T>;
|
|
226
242
|
/** Resolves layer-provided tools and merges with step tools into ctx.unifiedTools. */
|
|
227
243
|
private setUnifiedTools;
|
|
228
244
|
private toExecCtx;
|
|
229
|
-
initLayers(layers:
|
|
230
|
-
recallLayers(layers:
|
|
245
|
+
initLayers(layers: ContextLayer[], ctx: Context, storage: StorageAdapter): Promise<void>;
|
|
246
|
+
recallLayers(layers: ContextLayer[], input: string, ctx: Context): Promise<RecallLayerOutput[]>;
|
|
231
247
|
/** Allocate per-layer recall budgets from the harness projection policy. */
|
|
232
248
|
private layerBudgets;
|
|
233
|
-
recallLayersAtomic(layers:
|
|
234
|
-
recallLayersEventual(layers:
|
|
249
|
+
recallLayersAtomic(layers: ContextLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
|
|
250
|
+
recallLayersEventual(layers: ContextLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
|
|
235
251
|
/**
|
|
236
252
|
* Compute the items array that would be sent to the model on the next turn —
|
|
237
|
-
* the same arrangement `executeLLM` builds: harness-level
|
|
253
|
+
* the same arrangement `executeLLM` builds: harness-level context layers'
|
|
238
254
|
* recall outputs concatenated with the session's accumulated history.
|
|
239
255
|
*
|
|
240
256
|
* Read-mostly: `recallLayers` writes layer-state snapshots to
|
|
@@ -242,8 +258,8 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
242
258
|
* remain consistent with what the next real turn produces.
|
|
243
259
|
*/
|
|
244
260
|
previewRequestItems(scope?: SessionScope): Promise<ReadonlyArray<Item>>;
|
|
245
|
-
storeLayers(layers:
|
|
246
|
-
disposeLayers(layers:
|
|
261
|
+
storeLayers(layers: ContextLayer[], response: LLMResponse, ctx: Context): Promise<void>;
|
|
262
|
+
disposeLayers(layers: ContextLayer[], ctx: Context): Promise<void>;
|
|
247
263
|
/**
|
|
248
264
|
* Snapshot the execution state at a checkpoint boundary.
|
|
249
265
|
*
|
|
@@ -272,7 +288,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
272
288
|
* checkpoint via `CheckpointStore.clear()` and start a fresh execution.
|
|
273
289
|
*
|
|
274
290
|
* `opts` is the `createContext`-shaped wiring the host attached to the
|
|
275
|
-
* original context (broadcaster, parent, state,
|
|
291
|
+
* original context (broadcaster, parent, state, context overrides). A
|
|
276
292
|
* snapshot recovers data, not live objects — pass the same wiring here or
|
|
277
293
|
* the resumed run gets an undecorated context and whatever depended on that
|
|
278
294
|
* wiring (event streaming, mid-turn injection) stops working without
|
|
@@ -300,7 +316,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
300
316
|
clearCheckpoint(executionId: string): Promise<void>;
|
|
301
317
|
/**
|
|
302
318
|
* Cancel an execution: abort `ctx` and every live descendant context, then
|
|
303
|
-
* run the
|
|
319
|
+
* run the context-layer teardown for each (spec 09, Cancellation).
|
|
304
320
|
*
|
|
305
321
|
* The abort itself fans out top-down and synchronously — `ctx.abort()`
|
|
306
322
|
* cascades into every live fork path and spawn child, so no corner of the
|
|
@@ -327,10 +343,10 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
327
343
|
createSpan(name: string, parent: Span | null): Span;
|
|
328
344
|
getLayerState<T>(executionId: string, layerId: string): T | undefined;
|
|
329
345
|
setLayerState<T>(executionId: string, layerId: string, state: T): void;
|
|
330
|
-
beforeToolCall(layers:
|
|
331
|
-
afterModelCall(layers:
|
|
332
|
-
projectHistory(layers:
|
|
333
|
-
runAppendPipeline(layers:
|
|
346
|
+
beforeToolCall(layers: ContextLayer[], toolName: string, toolArgs: unknown, ctx: Context): Promise<SteeringDecision>;
|
|
347
|
+
afterModelCall(layers: ContextLayer[], response: LLMResponse, ctx: Context): Promise<SteeringDecision>;
|
|
348
|
+
projectHistory(layers: ContextLayer[], items: ReadonlyArray<Item>, ctx: Context): Promise<ReadonlyArray<Item>>;
|
|
349
|
+
runAppendPipeline(layers: ContextLayer[], items: Item[], ctx: Context): Promise<{
|
|
334
350
|
items: Item[];
|
|
335
351
|
rerenderRequests: {
|
|
336
352
|
layerId: string;
|
|
@@ -344,7 +360,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
|
|
|
344
360
|
slot: number;
|
|
345
361
|
timing: 'immediate' | 'batched';
|
|
346
362
|
scope: 'self' | 'slot-after' | 'all';
|
|
347
|
-
}[], layers:
|
|
363
|
+
}[], layers: ContextLayer[], ctx: Context, budgets: Map<string, number>, query?: string): Promise<{
|
|
348
364
|
layerId: string;
|
|
349
365
|
items: Item[];
|
|
350
366
|
tokenCount: number;
|
|
@@ -2,12 +2,13 @@ import { frameworkCast, ItemSchemaRegistry, NoeticConfigError } from '@noetic-to
|
|
|
2
2
|
import { SpanImpl } from '../observability/span-impl.js';
|
|
3
3
|
import { NoopExporter } from '../observability/trace-exporter.js';
|
|
4
4
|
import { createInMemoryFsAdapter, createInMemoryShellAdapter, createInMemorySubprocessAdapter, OpenRouter, } from './deps/adapters.js';
|
|
5
|
+
import { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from './deps/context.js';
|
|
5
6
|
import { collectAllTools, deduplicateTools, dispatchStepThroughAdapter, execute, } from './deps/interpreter.js';
|
|
6
|
-
import { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from './deps/memory.js';
|
|
7
7
|
import { buildItemStream, ChannelStore, ContextImpl, captureCheckpoint, clearCheckpoint, collectContextTree, createInMemoryStorage, createStepLedgerStore, filterReasoningStream, filterTextStream, resolveStepLedgerRetention, restoreFromCheckpoint, SessionRunner, StepLedger, snapshotCwdState, } from './deps/runtime.js';
|
|
8
8
|
import { SteeringAction } from './deps/types.js';
|
|
9
9
|
import { AgentHarnessModelCaller } from './model-call.js';
|
|
10
10
|
export { createStreamIdleWatchdog } from './model-call.js';
|
|
11
|
+
import { resolveContextOption } from '../builders/context-option.js';
|
|
11
12
|
import { buildItemSchemaRegistry } from './model-schema.js';
|
|
12
13
|
//#endregion
|
|
13
14
|
const DEFAULT_THREAD_ID = '__default__';
|
|
@@ -104,8 +105,8 @@ function createClient(config) {
|
|
|
104
105
|
}
|
|
105
106
|
//#region AgentHarness
|
|
106
107
|
/**
|
|
107
|
-
* Default agent harness for executing agent steps with built-in channel,
|
|
108
|
-
* Provides channel store,
|
|
108
|
+
* Default agent harness for executing agent steps with built-in channel, context, and trace support.
|
|
109
|
+
* Provides channel store, context layer lifecycle, and trace export with no external dependencies.
|
|
109
110
|
*
|
|
110
111
|
* Messages submitted via `execute()` are enqueued on a per-thread session and
|
|
111
112
|
* processed by a `SessionRunner`. Consumers observe responses via the session-
|
|
@@ -139,12 +140,14 @@ export class AgentHarness {
|
|
|
139
140
|
initialStep;
|
|
140
141
|
/** Harness-wide tool pool merged into every context's `unifiedTools`. */
|
|
141
142
|
harnessTools;
|
|
142
|
-
/** @internal
|
|
143
|
+
/** @internal Context layers configured for this harness. Exposed non-private
|
|
143
144
|
* so free functions in `runtime/durable/` (checkpoint/restore) can read it
|
|
144
145
|
* without friend-class gymnastics. Do not access from outside core. */
|
|
145
|
-
|
|
146
|
+
_contextLayers;
|
|
146
147
|
client;
|
|
147
148
|
channelStore;
|
|
149
|
+
/** Re-entrant `run()` depth per root context id — see `executeClosingChannels`. */
|
|
150
|
+
rootRunDepth = new Map();
|
|
148
151
|
callModelOverride;
|
|
149
152
|
defaultDeliveryMode;
|
|
150
153
|
streamIdleTimeoutMs;
|
|
@@ -201,7 +204,7 @@ export class AgentHarness {
|
|
|
201
204
|
this.stepLedgerRetention = resolveStepLedgerRetention(opts.stepLedgerRetention);
|
|
202
205
|
this.initialStep = opts.initialStep;
|
|
203
206
|
this.harnessTools = opts.tools ?? [];
|
|
204
|
-
this.
|
|
207
|
+
this._contextLayers = resolveContextOption(opts);
|
|
205
208
|
this.callModelOverride = opts._testCallModel;
|
|
206
209
|
this.client = opts._testCallModel ? undefined : createClient(opts.llm);
|
|
207
210
|
this.channelStore = new ChannelStore();
|
|
@@ -209,7 +212,7 @@ export class AgentHarness {
|
|
|
209
212
|
this.layerStateStore =
|
|
210
213
|
opts.layerStateStore ??
|
|
211
214
|
createLayerStateStore((layerId, hook, error) => {
|
|
212
|
-
console.warn(`[noetic]
|
|
215
|
+
console.warn(`[noetic] context layer '${layerId}' ${hook} error:`, error);
|
|
213
216
|
});
|
|
214
217
|
this.recallCache = createRecallCache();
|
|
215
218
|
this.defaultDeliveryMode = opts.defaultDeliveryMode ?? 'next-turn';
|
|
@@ -322,7 +325,7 @@ export class AgentHarness {
|
|
|
322
325
|
threadId,
|
|
323
326
|
agentName: this.config.name,
|
|
324
327
|
// The first queued message in a batch establishes `resourceId` /
|
|
325
|
-
// `state` / `
|
|
328
|
+
// `state` / `context` for the turn. If multiple messages are drained
|
|
326
329
|
// together (queue flush), later messages' values for these fields
|
|
327
330
|
// are ignored. `deliveryMode` is resolved per-message at enqueue
|
|
328
331
|
// time and doesn't apply here.
|
|
@@ -337,7 +340,7 @@ export class AgentHarness {
|
|
|
337
340
|
threadId,
|
|
338
341
|
resourceId: perTurnOptions.resourceId,
|
|
339
342
|
state: perTurnOptions.state,
|
|
340
|
-
|
|
343
|
+
context: resolveContextOption(perTurnOptions),
|
|
341
344
|
_broadcaster: session.runner.broadcaster,
|
|
342
345
|
});
|
|
343
346
|
const ext = frameworkCast(ctx);
|
|
@@ -419,17 +422,50 @@ export class AgentHarness {
|
|
|
419
422
|
...this.harnessTools,
|
|
420
423
|
]);
|
|
421
424
|
}
|
|
422
|
-
// Hydrate/recall/persist
|
|
423
|
-
// configuring `
|
|
425
|
+
// Hydrate/recall/persist context on the bare `run()` path too (issue #48):
|
|
426
|
+
// configuring `context` + `storage` must "just work" without going through
|
|
424
427
|
// `execute()`/`seedSessionHistory`. Idempotent — see `ensureLayersInit`.
|
|
425
428
|
await this.ensureLayersInit(ctx);
|
|
426
|
-
return
|
|
429
|
+
return this.executeClosingChannels(s, input, ctx);
|
|
427
430
|
}
|
|
428
431
|
/** Run all layer `init` hooks before the first step executes. Per spec 11,
|
|
429
432
|
* init MUST complete before any recall fires so layer state is populated. */
|
|
430
433
|
async initAndRun(s, input, ctx) {
|
|
431
434
|
await this.ensureLayersInit(ctx);
|
|
432
|
-
return
|
|
435
|
+
return this.executeClosingChannels(s, input, ctx);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Run `execute`, closing the execution's external channels when the
|
|
439
|
+
* OUTERMOST run on a root context finishes (spec 06 Lifecycle: handles flip
|
|
440
|
+
* `closed`, channel streams end). Patterns re-enter `run()` with the same
|
|
441
|
+
* root context (`ctx.harness.run(step, input, ctx)`), so a depth count —
|
|
442
|
+
* not the return itself — marks root completion. Child-context runs never
|
|
443
|
+
* close anything.
|
|
444
|
+
*/
|
|
445
|
+
async executeClosingChannels(s, input, ctx) {
|
|
446
|
+
if (ctx.parent !== null) {
|
|
447
|
+
return execute(s, input, ctx);
|
|
448
|
+
}
|
|
449
|
+
const depth = this.rootRunDepth.get(ctx.id) ?? 0;
|
|
450
|
+
if (depth === 0) {
|
|
451
|
+
// A restored or sequentially re-run root context reuses its id — clear
|
|
452
|
+
// any closure from a previous completion so its channels work again.
|
|
453
|
+
this.channelStore.openExecution(ctx.id);
|
|
454
|
+
}
|
|
455
|
+
this.rootRunDepth.set(ctx.id, depth + 1);
|
|
456
|
+
try {
|
|
457
|
+
return await execute(s, input, ctx);
|
|
458
|
+
}
|
|
459
|
+
finally {
|
|
460
|
+
const remaining = (this.rootRunDepth.get(ctx.id) ?? 1) - 1;
|
|
461
|
+
if (remaining > 0) {
|
|
462
|
+
this.rootRunDepth.set(ctx.id, remaining);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
this.rootRunDepth.delete(ctx.id);
|
|
466
|
+
this.channelStore.closeExecution(ctx.id);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
433
469
|
}
|
|
434
470
|
/**
|
|
435
471
|
* Idempotently run layer `init` hooks for `ctx` (keyed by `ctx.id`). Init
|
|
@@ -458,11 +494,14 @@ export class AgentHarness {
|
|
|
458
494
|
return dispatchStepThroughAdapter(this, s, input, parentCtx, overrides);
|
|
459
495
|
}
|
|
460
496
|
createContext(opts) {
|
|
461
|
-
const
|
|
462
|
-
|
|
497
|
+
const resolved = opts ?? {};
|
|
498
|
+
// `ContextImpl` takes the layers as `layers`, so both option spellings are
|
|
499
|
+
// dropped from `rest` rather than spread through under the wrong name.
|
|
500
|
+
const { context: _context, memory: _memory, cwdInit, ...rest } = resolved;
|
|
501
|
+
const effectiveLayers = resolveContextOption(resolved) ?? this._contextLayers;
|
|
463
502
|
const itemSchemas = buildItemSchemaRegistry({
|
|
464
503
|
base: this.itemSchemas,
|
|
465
|
-
layers:
|
|
504
|
+
layers: effectiveLayers,
|
|
466
505
|
});
|
|
467
506
|
/* The execution id is chosen here rather than inside ContextImpl so the ledger
|
|
468
507
|
* can be keyed to it — the ledger's storage keys and `ctx.id` must agree for a
|
|
@@ -473,7 +512,7 @@ export class AgentHarness {
|
|
|
473
512
|
id: executionId,
|
|
474
513
|
harness: this,
|
|
475
514
|
channelStore: this.channelStore,
|
|
476
|
-
layers:
|
|
515
|
+
layers: effectiveLayers,
|
|
477
516
|
itemSchemas,
|
|
478
517
|
cwdState: resolveContextCwdState(this.rootCwdState, opts?.parent, cwdInit),
|
|
479
518
|
// Without this `ctx.checkpoint()` is inert, and the boundaries below never
|
|
@@ -508,6 +547,9 @@ export class AgentHarness {
|
|
|
508
547
|
getChannelHandle(channel, executionId) {
|
|
509
548
|
return this.channelStore.getHandle(channel, executionId);
|
|
510
549
|
}
|
|
550
|
+
getChannelStream(channel, executionId) {
|
|
551
|
+
return this.channelStore.subscribe(channel, executionId);
|
|
552
|
+
}
|
|
511
553
|
/** Resolves layer-provided tools and merges with step tools into ctx.unifiedTools. */
|
|
512
554
|
setUnifiedTools(ctx, stepTools) {
|
|
513
555
|
const layers = ctx.layers;
|
|
@@ -586,7 +628,7 @@ export class AgentHarness {
|
|
|
586
628
|
}
|
|
587
629
|
/**
|
|
588
630
|
* Compute the items array that would be sent to the model on the next turn —
|
|
589
|
-
* the same arrangement `executeLLM` builds: harness-level
|
|
631
|
+
* the same arrangement `executeLLM` builds: harness-level context layers'
|
|
590
632
|
* recall outputs concatenated with the session's accumulated history.
|
|
591
633
|
*
|
|
592
634
|
* Read-mostly: `recallLayers` writes layer-state snapshots to
|
|
@@ -606,7 +648,7 @@ export class AgentHarness {
|
|
|
606
648
|
const ctx = this.createContext({
|
|
607
649
|
items: historyItems,
|
|
608
650
|
threadId,
|
|
609
|
-
|
|
651
|
+
context: this._contextLayers,
|
|
610
652
|
});
|
|
611
653
|
const layers = ctx.layers ?? [];
|
|
612
654
|
if (layers.length === 0) {
|
|
@@ -679,7 +721,7 @@ export class AgentHarness {
|
|
|
679
721
|
* checkpoint via `CheckpointStore.clear()` and start a fresh execution.
|
|
680
722
|
*
|
|
681
723
|
* `opts` is the `createContext`-shaped wiring the host attached to the
|
|
682
|
-
* original context (broadcaster, parent, state,
|
|
724
|
+
* original context (broadcaster, parent, state, context overrides). A
|
|
683
725
|
* snapshot recovers data, not live objects — pass the same wiring here or
|
|
684
726
|
* the resumed run gets an undecorated context and whatever depended on that
|
|
685
727
|
* wiring (event streaming, mid-turn injection) stops working without
|
|
@@ -712,7 +754,7 @@ export class AgentHarness {
|
|
|
712
754
|
//#endregion
|
|
713
755
|
/**
|
|
714
756
|
* Cancel an execution: abort `ctx` and every live descendant context, then
|
|
715
|
-
* run the
|
|
757
|
+
* run the context-layer teardown for each (spec 09, Cancellation).
|
|
716
758
|
*
|
|
717
759
|
* The abort itself fans out top-down and synchronously — `ctx.abort()`
|
|
718
760
|
* cascades into every live fork path and spawn child, so no corner of the
|
|
@@ -740,6 +782,11 @@ export class AgentHarness {
|
|
|
740
782
|
for (const node of tree.reverse()) {
|
|
741
783
|
await this.teardownCancelledContext(node);
|
|
742
784
|
}
|
|
785
|
+
// Cancellation completes the root execution (spec 06 Lifecycle): close
|
|
786
|
+
// its external channels so handles flip `closed` and streams end.
|
|
787
|
+
if (ctx.parent === null) {
|
|
788
|
+
this.channelStore.closeExecution(ctx.id);
|
|
789
|
+
}
|
|
743
790
|
}
|
|
744
791
|
/**
|
|
745
792
|
* Run the layer lifecycle's abort path for one cancelled context:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { LayerStateStore, RecallCache } from '@noetic-tools/
|
|
2
|
-
export { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from '@noetic-tools/
|
|
1
|
+
export type { LayerStateStore, RecallCache } from '@noetic-tools/context';
|
|
2
|
+
export { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from '@noetic-tools/context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from '@noetic-tools/
|
|
1
|
+
export { afterModelCallLayers, allocateBudgets, assembleView, beforeToolCallLayers, completeLayers, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from '@noetic-tools/context';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ContextData, ContextLayer, ExecutionContext, ProjectionPolicy, StorageAdapter, } from '@noetic-tools/context';
|
|
2
2
|
export type { AgentConfig, AgentHarnessContract, AgentHooks, CallModelRequest, Channel, ChannelHandle, Context, CwdState, DeliveryMode, DetachedHandle, ExecuteInput, ExecuteOptions, ExternalChannel, FsAdapter, HarnessResponse, HarnessStatus, Item, ItemSchemaExtensions, LLMResponse, LlmProviderConfig, RecallLayerOutput, SessionScope, ShellAdapter, Span, SteeringDecision, Step, StreamEvent, StreamingItem, SubHarnessSession, SubprocessAdapter, Tool, TraceExporter, } from '@noetic-tools/types';
|
|
3
3
|
export { SteeringAction } from '@noetic-tools/types';
|
|
4
4
|
export type { ZodType } from 'zod';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContextLayer } from '@noetic-tools/context';
|
|
2
2
|
import type { Item, ItemSchemaRegistry, Tool } from '@noetic-tools/types';
|
|
3
3
|
export declare function buildItemSchemaRegistry({ base, layers, tools, }: {
|
|
4
4
|
base: ItemSchemaRegistry;
|
|
5
|
-
layers?: ReadonlyArray<
|
|
5
|
+
layers?: ReadonlyArray<ContextLayer>;
|
|
6
6
|
tools?: ReadonlyArray<Tool>;
|
|
7
7
|
}): ItemSchemaRegistry;
|
|
8
8
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export { createOpenRouterEmbed } from './adapters/openrouter.js';
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export { channel } from './builders/channel-builder.js';
|
|
11
11
|
/** @public */
|
|
12
|
+
export { context } from './builders/context-builder.js';
|
|
13
|
+
/** @public */
|
|
12
14
|
export { branch, fork } from './builders/control-flow-builders.js';
|
|
13
15
|
/** @public */
|
|
14
16
|
export type { EveryOptions } from './builders/every.js';
|
|
@@ -21,20 +23,20 @@ export type { LoopConfig } from './builders/loop-builder.js';
|
|
|
21
23
|
/** @public */
|
|
22
24
|
export { loop } from './builders/loop-builder.js';
|
|
23
25
|
/** @public */
|
|
24
|
-
export { memory } from './builders/memory-builder.js';
|
|
25
|
-
/** @public */
|
|
26
26
|
export { provide } from './builders/provide-builder.js';
|
|
27
27
|
/** @public */
|
|
28
28
|
export { spawn } from './builders/spawn-builder.js';
|
|
29
29
|
/** @public */
|
|
30
|
-
export { step } from './builders/step-builders.js';
|
|
31
|
-
/** @public */
|
|
32
30
|
export { tool, toolWithGenerator } from './builders/tool-builder.js';
|
|
33
31
|
/** @public */
|
|
34
32
|
export type { HydrationContext } from './builders/workflow-hydrator.js';
|
|
35
33
|
/** @public */
|
|
36
34
|
export { hydrateNode, hydrateWorkflow } from './builders/workflow-hydrator.js';
|
|
37
35
|
/** @public */
|
|
36
|
+
export type { StepWorkflowOpts } from './builders/workflow-step.js';
|
|
37
|
+
/** @public */
|
|
38
|
+
export { step } from './builders/workflow-step.js';
|
|
39
|
+
/** @public */
|
|
38
40
|
export type { Condition, OtherwiseClause, WhenClause } from './conditions/conditions.js';
|
|
39
41
|
/** @public */
|
|
40
42
|
export { aiCondition, allCondition, anyCondition, embeddingMatch, otherwise, semanticRoute, semanticSwitch, when, } from './conditions/conditions.js';
|
|
@@ -55,7 +57,7 @@ export { execute } from './interpreter/execute.js';
|
|
|
55
57
|
/** @public */
|
|
56
58
|
/** @public */
|
|
57
59
|
/** @public */
|
|
58
|
-
export type { DurableTaskState, FactExtractor, FactSearcher, HistoryWindowConfig,
|
|
60
|
+
export type { DurableTaskState, FactExtractor, FactSearcher, HistoryWindowConfig, ObservationalContextConfig, ObservationalState, PlanContextConfig, PlanEnterSessionCallback, PlanExecutionEntry, PlanExitCallback, PlanState, TemporalContextConfig, TemporalFact, TemporalSearchResult, WorkingMemoryContextConfig, WorkingMemoryContextState, } from '@noetic-tools/context';
|
|
59
61
|
/** @public */
|
|
60
62
|
/** @public */
|
|
61
63
|
/** @public */
|
|
@@ -68,7 +70,7 @@ export type { DurableTaskState, FactExtractor, FactSearcher, HistoryWindowConfig
|
|
|
68
70
|
/** @public */
|
|
69
71
|
/** @public */
|
|
70
72
|
/** @public */
|
|
71
|
-
export { durableTaskState, fileReference, findFunctionCall, historyWindow,
|
|
73
|
+
export { durableTaskState, fileReference, findFunctionCall, historyWindow, observationalContext, PlanPhase, planContext, staticContent, steering, storageGetMany, stripUnresolvedToolCalls, temporalContext, toolContextLayer, workingMemoryContext, } from '@noetic-tools/context';
|
|
72
74
|
/** @public */
|
|
73
75
|
export { createMessage, estimateTokens } from '@noetic-tools/types';
|
|
74
76
|
/** @public */
|
|
@@ -82,10 +84,6 @@ export type { DynamicWorkflowOpts, ParseAndRunWorkflowOpts } from './patterns/dy
|
|
|
82
84
|
/** @public */
|
|
83
85
|
export { dynamicWorkflow, parseAndRunWorkflow } from './patterns/dynamic-workflow.js';
|
|
84
86
|
/** @public */
|
|
85
|
-
export type { FlowNode, ForkFlowNode, LlmFlowNode, SequenceFlowNode, SpawnFlowNode, SubagentFlowNode, } from './patterns/flow.js';
|
|
86
|
-
/** @public */
|
|
87
|
-
export { FlowSchema, flowDepth, validateFlow, walkFlow } from './patterns/flow.js';
|
|
88
|
-
/** @public */
|
|
89
87
|
export type { InterviewOpts, InterviewQuestionAnswer, InterviewResult } from './patterns/interview.js';
|
|
90
88
|
/** @public */
|
|
91
89
|
export { interview } from './patterns/interview.js';
|
|
@@ -108,14 +106,14 @@ export { getRegistry, lookupStep, registerStep } from './runtime/step-registry.j
|
|
|
108
106
|
/** @public */
|
|
109
107
|
export { defaultItemSchemaRegistry, ItemSchema, ItemSchemaRegistry } from '@noetic-tools/types';
|
|
110
108
|
/** @public */
|
|
111
|
-
export type { BranchRoute, BranchWorkflowNode, EveryWorkflowNode, ForkWorkflowNode, LlmWorkflowNode, LoopWorkflowNode, MergeStrategy, ProvideWorkflowNode, SequenceWorkflowNode, SpawnWorkflowNode, SubHarnessWorkflowNode, ToolWorkflowNode, UntilPredicate, WorkflowDocument, WorkflowNode, } from './schemas/workflow.js';
|
|
109
|
+
export type { BranchRoute, BranchWorkflowNode, EveryWorkflowNode, ForkWorkflowNode, LlmWorkflowNode, LoopWorkflowNode, MergeStrategy, ProvideWorkflowNode, SequenceWorkflowNode, SpawnWorkflowNode, SubflowWorkflowNode, SubHarnessWorkflowNode, ToolWorkflowNode, UntilPredicate, WorkflowDocument, WorkflowNode, } from './schemas/workflow.js';
|
|
112
110
|
/** @public */
|
|
113
111
|
export { MergeStrategySchema, UntilPredicateSchema, validateWorkflow, WorkflowDocumentSchema, WorkflowNodeSchema, walkWorkflow, workflowDepth, } from './schemas/workflow.js';
|
|
114
112
|
/** @public */
|
|
115
113
|
export type { Channel, ChannelHandle, ExternalChannel } from '@noetic-tools/types';
|
|
116
114
|
/** @public */
|
|
117
115
|
/** @public */
|
|
118
|
-
export type { LLMResponse, LlmProviderConfig, ModelParams, RetryPolicy, ServerToolSpec, StepMeta, TokenUsage, Tool,
|
|
116
|
+
export type { LLMResponse, LlmProviderConfig, ModelParams, RetryPolicy, ServerToolSpec, StepMeta, TokenUsage, Tool, ToolContextDeclaration, } from '@noetic-tools/types';
|
|
119
117
|
/** @public */
|
|
120
118
|
export { isServerToolSpec } from '@noetic-tools/types';
|
|
121
119
|
/** @public */
|
|
@@ -139,13 +137,13 @@ export type { NoeticError } from '@noetic-tools/types';
|
|
|
139
137
|
/** @public */
|
|
140
138
|
export type { ContentPart, DeveloperMessageExtensionItem, ExecuteInput, ExtendedItem, ExtensionItem, FileSearchItem, FunctionCallItem, FunctionCallOutputItem, ImageGenerationItem, InferExtendedItem, InputContentPart, InputFilePart, InputImagePart, InputMessageItem, InputTextPart, Item, ItemBase, ItemSchemaExtensions, MessageItem, OutputItem, OutputTextPart, ReasoningItem, ReasoningTextPart, RefusalPart, ServerToolItem, SummaryTextPart, WebSearchItem, } from '@noetic-tools/types';
|
|
141
139
|
/** @public */
|
|
142
|
-
export type { BudgetConfig, CompleteParams,
|
|
140
|
+
export type { BudgetConfig, CompleteParams, ContextConfig, ContextData, ContextLayer, ContextLayerHooks, DisposeParams, InferContext, InferContextShape, InitParams, InitResult, LayerDataDecl, LayerFunctionDecl, LayerProvides, LayerTimeouts, ProjectionPolicy, RecallParams, RecallResult, ReturnParams, ReturnResult, ScopedStorage, SpawnParams, SpawnResult, StorageAdapter, StoreParams, StoreResult, } from '@noetic-tools/context';
|
|
143
141
|
/** @public */
|
|
144
|
-
export { Slot } from '@noetic-tools/
|
|
142
|
+
export { Slot } from '@noetic-tools/context';
|
|
145
143
|
/** @public */
|
|
146
|
-
export type { ExecutionContext, ExecutionOutcome,
|
|
144
|
+
export type { ContextScope, ExecutionContext, ExecutionOutcome, LayerCallModelRequest, } from '@noetic-tools/types';
|
|
147
145
|
/** @public */
|
|
148
|
-
export type {
|
|
146
|
+
export type { LayerTraceSpan, Span, TraceExporter } from '@noetic-tools/types';
|
|
149
147
|
/** @public */
|
|
150
148
|
export type { FrameworkStreamEvent, HarnessResponse, SdkStreamEvent, StreamEvent, StreamingItem, } from '@noetic-tools/types';
|
|
151
149
|
/** @public */
|
|
@@ -170,10 +168,16 @@ export { TIMEOUT_ERROR_PREFIX } from '@noetic-tools/types';
|
|
|
170
168
|
/** @public Reusable error-serialiser used by custom SubprocessAdapter implementations. */
|
|
171
169
|
export { serializeError } from './adapters/in-memory-subprocess/metadata.js';
|
|
172
170
|
/** @public */
|
|
173
|
-
export type {
|
|
171
|
+
export type { ToolContext, ToolExecutionContext } from '@noetic-tools/types';
|
|
174
172
|
/** @public */
|
|
175
173
|
export { all, any } from './until/combinators.js';
|
|
176
174
|
/** @public */
|
|
177
175
|
export type { ConvergeConfig, VerifyFn } from './until/predicates.js';
|
|
178
176
|
/** @public */
|
|
179
177
|
export { until } from './until/predicates.js';
|
|
178
|
+
/**
|
|
179
|
+
* Pre-rename names for the context layer system — `MemoryLayer`, `memory()`,
|
|
180
|
+
* `workingMemory`, and friends. Each carries its own `@deprecated` pointer to
|
|
181
|
+
* its replacement in `./deprecated`. Removed in the next major.
|
|
182
|
+
*/
|
|
183
|
+
export * from './deprecated.js';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export { createOpenRouterEmbed } from './adapters/openrouter.js';
|
|
|
12
12
|
/** @public */
|
|
13
13
|
export { channel } from './builders/channel-builder.js';
|
|
14
14
|
/** @public */
|
|
15
|
+
export { context } from './builders/context-builder.js';
|
|
16
|
+
/** @public */
|
|
15
17
|
export { branch, fork } from './builders/control-flow-builders.js';
|
|
16
18
|
/** @public */
|
|
17
19
|
export { every } from './builders/every.js';
|
|
@@ -20,18 +22,16 @@ export { layerData, layerFn } from './builders/layer-provides-builders.js';
|
|
|
20
22
|
/** @public */
|
|
21
23
|
export { loop } from './builders/loop-builder.js';
|
|
22
24
|
/** @public */
|
|
23
|
-
export { memory } from './builders/memory-builder.js';
|
|
24
|
-
/** @public */
|
|
25
25
|
export { provide } from './builders/provide-builder.js';
|
|
26
26
|
/** @public */
|
|
27
27
|
export { spawn } from './builders/spawn-builder.js';
|
|
28
28
|
/** @public */
|
|
29
|
-
export { step } from './builders/step-builders.js';
|
|
30
|
-
/** @public */
|
|
31
29
|
export { tool, toolWithGenerator } from './builders/tool-builder.js';
|
|
32
30
|
/** @public */
|
|
33
31
|
export { hydrateNode, hydrateWorkflow } from './builders/workflow-hydrator.js';
|
|
34
32
|
/** @public */
|
|
33
|
+
export { step } from './builders/workflow-step.js';
|
|
34
|
+
/** @public */
|
|
35
35
|
export { aiCondition, allCondition, anyCondition, embeddingMatch, otherwise, semanticRoute, semanticSwitch, when, } from './conditions/conditions.js';
|
|
36
36
|
/** @public */
|
|
37
37
|
export { cosineSimilarity } from './conditions/cosine-similarity.js';
|
|
@@ -58,7 +58,7 @@ export { execute } from './interpreter/execute.js';
|
|
|
58
58
|
/** @public */
|
|
59
59
|
/** @public */
|
|
60
60
|
/** @public */
|
|
61
|
-
export { durableTaskState, fileReference, findFunctionCall, historyWindow,
|
|
61
|
+
export { durableTaskState, fileReference, findFunctionCall, historyWindow, observationalContext, PlanPhase, planContext, staticContent, steering, storageGetMany, stripUnresolvedToolCalls, temporalContext, toolContextLayer, workingMemoryContext, } from '@noetic-tools/context';
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region Message Utilities
|
|
64
64
|
/** @public */
|
|
@@ -74,8 +74,6 @@ export { createInMemoryStorage } from './runtime/in-memory-storage.js';
|
|
|
74
74
|
/** @public */
|
|
75
75
|
export { dynamicWorkflow, parseAndRunWorkflow } from './patterns/dynamic-workflow.js';
|
|
76
76
|
/** @public */
|
|
77
|
-
export { FlowSchema, flowDepth, validateFlow, walkFlow } from './patterns/flow.js';
|
|
78
|
-
/** @public */
|
|
79
77
|
export { interview } from './patterns/interview.js';
|
|
80
78
|
/** @public */
|
|
81
79
|
export { adaptivePlan, compilePlan, PlanNodeSchema } from './patterns/plans.js';
|
|
@@ -106,7 +104,7 @@ export { DetachedStatus } from '@noetic-tools/types';
|
|
|
106
104
|
/** @public */
|
|
107
105
|
export { CheckpointSchemaVersion, CheckpointSnapshotSchema, CwdSnapshotSchema, FrontierFrameSchema, ItemLogSnapshotSchema, PendingAskUserSnapshotSchema, } from './types/checkpoint.js';
|
|
108
106
|
/** @public */
|
|
109
|
-
export { Slot } from '@noetic-tools/
|
|
107
|
+
export { Slot } from '@noetic-tools/context';
|
|
110
108
|
/** @public */
|
|
111
109
|
export { LedgerEntryKind, SteeringAction } from '@noetic-tools/types';
|
|
112
110
|
/** @public */
|
|
@@ -122,3 +120,11 @@ export { all, any } from './until/combinators.js';
|
|
|
122
120
|
/** @public */
|
|
123
121
|
export { until } from './until/predicates.js';
|
|
124
122
|
//#endregion
|
|
123
|
+
//#region Deprecated aliases
|
|
124
|
+
/**
|
|
125
|
+
* Pre-rename names for the context layer system — `MemoryLayer`, `memory()`,
|
|
126
|
+
* `workingMemory`, and friends. Each carries its own `@deprecated` pointer to
|
|
127
|
+
* its replacement in `./deprecated`. Removed in the next major.
|
|
128
|
+
*/
|
|
129
|
+
export * from './deprecated.js';
|
|
130
|
+
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { LayerStateStore } from '@noetic-tools/
|
|
2
|
-
export { allocateBudgets, assembleView, commitLayerUsage, computeLayerUsage, contextToExecCtx, DEFAULT_PROJECTION, resolveLayerTools, returnLayers, spawnLayers, } from '@noetic-tools/
|
|
1
|
+
export type { LayerStateStore } from '@noetic-tools/context';
|
|
2
|
+
export { allocateBudgets, assembleView, commitLayerUsage, computeLayerUsage, contextToExecCtx, DEFAULT_PROJECTION, resolveLayerTools, returnLayers, spawnLayers, } from '@noetic-tools/context';
|
|
3
3
|
export type { ItemSchemaRegistry } from '@noetic-tools/types';
|
|
4
4
|
export { defaultItemSchemaRegistry } from '@noetic-tools/types';
|
|
5
5
|
export { emitFrameworkEvent, getBroadcaster, shouldEmit } from '../runtime/broadcaster-utils.js';
|
|
6
6
|
export { ContextImpl } from '../runtime/context-impl.js';
|
|
7
7
|
export { snapshotCwdState } from '../runtime/cwd-helpers.js';
|
|
8
|
-
export { buildToolExecutionContext } from '../runtime/tool-
|
|
8
|
+
export { buildToolExecutionContext } from '../runtime/tool-context.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { allocateBudgets, assembleView, commitLayerUsage, computeLayerUsage, contextToExecCtx, DEFAULT_PROJECTION, resolveLayerTools, returnLayers, spawnLayers, } from '@noetic-tools/
|
|
1
|
+
export { allocateBudgets, assembleView, commitLayerUsage, computeLayerUsage, contextToExecCtx, DEFAULT_PROJECTION, resolveLayerTools, returnLayers, spawnLayers, } from '@noetic-tools/context';
|
|
2
2
|
export { defaultItemSchemaRegistry } from '@noetic-tools/types';
|
|
3
3
|
export { emitFrameworkEvent, getBroadcaster, shouldEmit } from '../runtime/broadcaster-utils.js';
|
|
4
4
|
export { ContextImpl } from '../runtime/context-impl.js';
|
|
5
5
|
export { snapshotCwdState } from '../runtime/cwd-helpers.js';
|
|
6
|
-
export { buildToolExecutionContext } from '../runtime/tool-
|
|
6
|
+
export { buildToolExecutionContext } from '../runtime/tool-context.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { ContextConfig, ContextData, ContextLayer, ExecutionContext, } from '@noetic-tools/context';
|
|
2
2
|
export type { AgentHarnessContract, Context, ContextRerenderRequest, ExecuteStepFn, FunctionCallItem, Item, ProjectionPolicy, RecallLayerOutput, RetryPolicy, ServerToolSpec, StepLLM, StepMeta, StepProvide, StepRun, StepSpawn, StepTool, Tool, } from '@noetic-tools/types';
|
|
3
3
|
export { isServerToolSpec, SteeringAction } from '@noetic-tools/types';
|