@noetic-tools/core 3.1.0 → 4.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.
Files changed (101) hide show
  1. package/dist/adapters/in-memory-subprocess/manifest-persistence.d.ts +1 -1
  2. package/dist/adapters/in-memory-subprocess/types.d.ts +1 -1
  3. package/dist/adapters/openrouter.d.ts +2 -2
  4. package/dist/adapters/openrouter.js +2 -2
  5. package/dist/builders/context-builder.d.ts +11 -0
  6. package/dist/builders/context-builder.js +15 -0
  7. package/dist/builders/context-option.d.ts +23 -0
  8. package/dist/builders/context-option.js +22 -0
  9. package/dist/builders/control-flow-builders.d.ts +19 -19
  10. package/dist/builders/every.d.ts +4 -4
  11. package/dist/builders/layer-provides-builders.d.ts +1 -1
  12. package/dist/builders/layer-provides-builders.js +1 -1
  13. package/dist/builders/loop-builder.d.ts +3 -3
  14. package/dist/builders/provide-builder.d.ts +14 -7
  15. package/dist/builders/provide-builder.js +15 -4
  16. package/dist/builders/spawn-builder.d.ts +8 -6
  17. package/dist/builders/spawn-builder.js +7 -2
  18. package/dist/builders/step-builders.d.ts +19 -20
  19. package/dist/builders/tool-builder.d.ts +9 -5
  20. package/dist/builders/tool-builder.js +3 -2
  21. package/dist/builders/workflow-hydrator.d.ts +17 -4
  22. package/dist/builders/workflow-hydrator.js +87 -8
  23. package/dist/builders/workflow-step.d.ts +61 -0
  24. package/dist/builders/workflow-step.js +126 -0
  25. package/dist/conditions/conditions.d.ts +17 -17
  26. package/dist/conditions/conditions.js +1 -1
  27. package/dist/deprecated.d.ts +30 -0
  28. package/dist/deprecated.js +28 -0
  29. package/dist/harness/agent-harness.d.ts +84 -27
  30. package/dist/harness/agent-harness.js +101 -20
  31. package/dist/harness/deps/context.d.ts +2 -0
  32. package/dist/harness/deps/context.js +1 -0
  33. package/dist/harness/deps/runtime.d.ts +4 -4
  34. package/dist/harness/deps/runtime.js +3 -3
  35. package/dist/harness/deps/types.d.ts +1 -1
  36. package/dist/harness/model-schema.d.ts +2 -2
  37. package/dist/index.d.ts +23 -19
  38. package/dist/index.js +15 -9
  39. package/dist/interpreter/action-deps.d.ts +3 -3
  40. package/dist/interpreter/action-deps.js +2 -2
  41. package/dist/interpreter/action-types.d.ts +1 -1
  42. package/dist/interpreter/collect-tools.d.ts +1 -1
  43. package/dist/interpreter/execute-action.d.ts +10 -10
  44. package/dist/interpreter/execute-action.js +33 -14
  45. package/dist/interpreter/execute-control.d.ts +4 -4
  46. package/dist/interpreter/execute-control.js +25 -16
  47. package/dist/interpreter/execute-sub-harness.d.ts +1 -1
  48. package/dist/interpreter/execute-sub-harness.js +22 -1
  49. package/dist/interpreter/execute.d.ts +3 -3
  50. package/dist/interpreter/execute.js +78 -31
  51. package/dist/interpreter/step-dispatcher.d.ts +3 -3
  52. package/dist/interpreter/sub-harness-events.d.ts +2 -2
  53. package/dist/interpreter/typeguards.d.ts +4 -4
  54. package/dist/patterns/dynamic-workflow.d.ts +7 -4
  55. package/dist/patterns/dynamic-workflow.js +2 -0
  56. package/dist/patterns/interview.d.ts +2 -2
  57. package/dist/patterns/plans.d.ts +5 -5
  58. package/dist/patterns/ralph-wiggum.d.ts +2 -2
  59. package/dist/patterns/react.d.ts +7 -5
  60. package/dist/patterns/react.js +6 -4
  61. package/dist/portable/builders.js +2 -0
  62. package/dist/portable/context-layers.d.ts +8 -0
  63. package/dist/portable/context-layers.js +8 -0
  64. package/dist/portable.d.ts +2 -2
  65. package/dist/portable.js +2 -2
  66. package/dist/runtime/context-deps.d.ts +2 -2
  67. package/dist/runtime/context-deps.js +1 -1
  68. package/dist/runtime/context-impl.d.ts +48 -9
  69. package/dist/runtime/context-impl.js +95 -10
  70. package/dist/runtime/context-type-deps.d.ts +1 -1
  71. package/dist/runtime/durable/checkpoint-store.d.ts +1 -1
  72. package/dist/runtime/durable/harness-checkpoints.d.ts +17 -4
  73. package/dist/runtime/durable/harness-checkpoints.js +21 -3
  74. package/dist/runtime/durable/index.d.ts +2 -0
  75. package/dist/runtime/durable/index.js +1 -0
  76. package/dist/runtime/durable/step-ledger.d.ts +107 -5
  77. package/dist/runtime/durable/step-ledger.js +179 -10
  78. package/dist/runtime/in-memory-storage.d.ts +1 -1
  79. package/dist/runtime/session-runner.d.ts +1 -1
  80. package/dist/runtime/step-registry.d.ts +3 -3
  81. package/dist/runtime/{tool-memory.d.ts → tool-context.d.ts} +1 -2
  82. package/dist/runtime/{tool-memory.js → tool-context.js} +5 -2
  83. package/dist/runtime/tool-ui.d.ts +1 -1
  84. package/dist/runtime/tool-ui.js +1 -1
  85. package/dist/schemas/workflow.d.ts +5 -279
  86. package/dist/schemas/workflow.js +4 -376
  87. package/dist/types/mutable-context.d.ts +2 -2
  88. package/dist/types/step-registrar.d.ts +1 -1
  89. package/dist/unstable.d.ts +5 -5
  90. package/dist/unstable.js +3 -3
  91. package/dist/until/predicates.d.ts +1 -1
  92. package/package.json +4 -4
  93. package/schema/noetic-workflow.schema.json +28 -0
  94. package/dist/builders/memory-builder.d.ts +0 -11
  95. package/dist/builders/memory-builder.js +0 -15
  96. package/dist/harness/deps/memory.d.ts +0 -2
  97. package/dist/harness/deps/memory.js +0 -1
  98. package/dist/patterns/flow.d.ts +0 -2
  99. package/dist/patterns/flow.js +0 -1
  100. package/dist/portable/memory-layers.d.ts +0 -8
  101. 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
- import type { CheckpointStore, EventBroadcaster, RestoreCheckpointOptions, StepLedgerStore } from './deps/runtime.js';
5
- import type { AgentConfig, AgentHarnessContract, AgentHooks, CallModelRequest, Channel, ChannelHandle, Context, ContextMemory, CwdState, DeliveryMode, DetachedHandle, ExecuteInput, ExecuteOptions, ExternalChannel, FsAdapter, HarnessResponse, HarnessStatus, Item, ItemSchemaExtensions, LLMResponse, LlmProviderConfig, MemoryLayer, ProjectionPolicy, RecallLayerOutput, SessionScope, ShellAdapter, Span, SteeringDecision, Step, StorageAdapter, StreamEvent, StreamingItem, SubHarnessSession, SubprocessAdapter, Tool, TraceExporter, ZodType } from './deps/types.js';
4
+ import type { CheckpointStore, EventBroadcaster, RestoreCheckpointOptions, StepLedgerRetention, StepLedgerStore } from './deps/runtime.js';
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<ContextMemory, string, string>;
10
- /** Default memory layers applied to every context created via `createContext()` / `execute()`. */
11
- memory?: MemoryLayer[];
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
  /**
@@ -33,6 +35,14 @@ interface AgentHarnessOpts<TParams extends Record<string, unknown> = Record<stri
33
35
  * to enable durable execution.
34
36
  */
35
37
  checkpointStore?: CheckpointStore;
38
+ /**
39
+ * Bounds on the step-completion ledger that backs step-level resume. Only meaningful
40
+ * alongside a `checkpointStore`. Defaults to `DEFAULT_STEP_LEDGER_RETENTION` — 128 KiB
41
+ * per entry, 1000 entries per execution — so an unbounded run cannot grow an unbounded
42
+ * ledger. Exceeding either cap costs resumability for the affected steps (they re-run),
43
+ * never correctness.
44
+ */
45
+ stepLedgerRetention?: StepLedgerRetention;
36
46
  llm?: LlmProviderConfig;
37
47
  /** Harness-wide item schema extensions. */
38
48
  itemSchemas?: ItemSchemaExtensions;
@@ -85,8 +95,8 @@ export interface ResolvedLlmClient {
85
95
  */
86
96
  export declare function resolveLlmClient(config: LlmProviderConfig | undefined, env: LlmEnv): ResolvedLlmClient | undefined;
87
97
  /**
88
- * Default agent harness for executing agent steps with built-in channel, memory, and trace support.
89
- * Provides channel store, memory layer lifecycle, and trace export with no external dependencies.
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.
90
100
  *
91
101
  * Messages submitted via `execute()` are enqueued on a per-thread session and
92
102
  * processed by a `SessionRunner`. Consumers observe responses via the session-
@@ -111,13 +121,19 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
111
121
  * @internal
112
122
  */
113
123
  readonly stepLedgerStore?: StepLedgerStore;
124
+ /**
125
+ * Resolved retention bounds for that ledger. Validated at construction so a bad cap
126
+ * is a loud config error rather than a run that silently records nothing.
127
+ * @internal
128
+ */
129
+ readonly stepLedgerRetention: Required<StepLedgerRetention>;
114
130
  private readonly initialStep?;
115
131
  /** Harness-wide tool pool merged into every context's `unifiedTools`. */
116
132
  private readonly harnessTools;
117
- /** @internal Memory layers configured for this harness. Exposed non-private
133
+ /** @internal Context layers configured for this harness. Exposed non-private
118
134
  * so free functions in `runtime/durable/` (checkpoint/restore) can read it
119
135
  * without friend-class gymnastics. Do not access from outside core. */
120
- readonly _memory?: MemoryLayer[];
136
+ readonly _contextLayers?: ContextLayer[];
121
137
  private readonly client?;
122
138
  private readonly channelStore;
123
139
  private readonly callModelOverride?;
@@ -175,7 +191,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
175
191
  private getOrCreateSession;
176
192
  private requireSession;
177
193
  callModel(request: CallModelRequest): Promise<LLMResponse>;
178
- run<I, O>(s: Step<ContextMemory, I, O>, input: I, ctx: Context): Promise<O>;
194
+ run<I, O>(s: Step<ContextData, I, O>, input: I, ctx: Context): Promise<O>;
179
195
  /** Run all layer `init` hooks before the first step executes. Per spec 11,
180
196
  * init MUST complete before any recall fires so layer state is populated. */
181
197
  private initAndRun;
@@ -187,14 +203,16 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
187
203
  * clobber accumulated in-memory state.
188
204
  */
189
205
  private ensureLayersInit;
190
- detachedSpawn<I, O>(s: Step<ContextMemory, I, O>, input: I, parentCtx: Context, overrides?: DetachedSpawnOverrides): DetachedHandle<O>;
206
+ detachedSpawn<I, O>(s: Step<ContextData, I, O>, input: I, parentCtx: Context, overrides?: DetachedSpawnOverrides): DetachedHandle<O>;
191
207
  createContext(opts?: {
192
208
  parent?: Context;
193
209
  items?: Item[];
194
210
  state?: unknown;
195
211
  threadId?: string;
196
212
  resourceId?: string;
197
- memory?: MemoryLayer[];
213
+ context?: ContextLayer[];
214
+ /** @deprecated Renamed to `context`. */
215
+ memory?: ContextLayer[];
198
216
  /**
199
217
  * Initial cwd for the new context. When set, takes precedence over both
200
218
  * the parent snapshot and the harness root cwd — used by worktree
@@ -212,15 +230,15 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
212
230
  /** Resolves layer-provided tools and merges with step tools into ctx.unifiedTools. */
213
231
  private setUnifiedTools;
214
232
  private toExecCtx;
215
- initLayers(layers: MemoryLayer[], ctx: Context, storage: StorageAdapter): Promise<void>;
216
- recallLayers(layers: MemoryLayer[], input: string, ctx: Context): Promise<RecallLayerOutput[]>;
233
+ initLayers(layers: ContextLayer[], ctx: Context, storage: StorageAdapter): Promise<void>;
234
+ recallLayers(layers: ContextLayer[], input: string, ctx: Context): Promise<RecallLayerOutput[]>;
217
235
  /** Allocate per-layer recall budgets from the harness projection policy. */
218
236
  private layerBudgets;
219
- recallLayersAtomic(layers: MemoryLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
220
- recallLayersEventual(layers: MemoryLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
237
+ recallLayersAtomic(layers: ContextLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
238
+ recallLayersEventual(layers: ContextLayer[], input: string, ctx: Context, budgets: Map<string, number>): Promise<RecallLayerOutput[]>;
221
239
  /**
222
240
  * Compute the items array that would be sent to the model on the next turn —
223
- * the same arrangement `executeLLM` builds: harness-level memory layers'
241
+ * the same arrangement `executeLLM` builds: harness-level context layers'
224
242
  * recall outputs concatenated with the session's accumulated history.
225
243
  *
226
244
  * Read-mostly: `recallLayers` writes layer-state snapshots to
@@ -228,8 +246,8 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
228
246
  * remain consistent with what the next real turn produces.
229
247
  */
230
248
  previewRequestItems(scope?: SessionScope): Promise<ReadonlyArray<Item>>;
231
- storeLayers(layers: MemoryLayer[], response: LLMResponse, ctx: Context): Promise<void>;
232
- disposeLayers(layers: MemoryLayer[], ctx: Context): Promise<void>;
249
+ storeLayers(layers: ContextLayer[], response: LLMResponse, ctx: Context): Promise<void>;
250
+ disposeLayers(layers: ContextLayer[], ctx: Context): Promise<void>;
233
251
  /**
234
252
  * Snapshot the execution state at a checkpoint boundary.
235
253
  *
@@ -258,7 +276,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
258
276
  * checkpoint via `CheckpointStore.clear()` and start a fresh execution.
259
277
  *
260
278
  * `opts` is the `createContext`-shaped wiring the host attached to the
261
- * original context (broadcaster, parent, state, memory overrides). A
279
+ * original context (broadcaster, parent, state, context overrides). A
262
280
  * snapshot recovers data, not live objects — pass the same wiring here or
263
281
  * the resumed run gets an undecorated context and whatever depended on that
264
282
  * wiring (event streaming, mid-turn injection) stops working without
@@ -270,14 +288,53 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
270
288
  * whose `id` is already the original `executionId`.
271
289
  */
272
290
  restore(executionId: string, opts?: RestoreCheckpointOptions): Promise<Context | null>;
273
- cancel(_ctx: Context, _reason?: string): Promise<void>;
291
+ /**
292
+ * Discard everything `restore(executionId)` would have used — the snapshot *and* the
293
+ * step-completion ledger — so the next run of that execution starts clean.
294
+ *
295
+ * Hosts must call this rather than resume when the workflow itself changed. A resumed
296
+ * run replays at the coarsest completed granularity: a parent step that finished
297
+ * replays wholesale, so an edit to one of its children is never noticed and the stale
298
+ * output wins. Divergence detection only catches a changed step *at* a recorded path.
299
+ *
300
+ * Also the right call after a terminal outcome (the execution finished, or the user
301
+ * abandoned it) — `CheckpointStore.clear` alone leaves the ledger's per-step keys
302
+ * behind, and nothing else enumerates them.
303
+ */
304
+ clearCheckpoint(executionId: string): Promise<void>;
305
+ /**
306
+ * Cancel an execution: abort `ctx` and every live descendant context, then
307
+ * run the context-layer teardown for each (spec 09, Cancellation).
308
+ *
309
+ * The abort itself fans out top-down and synchronously — `ctx.abort()`
310
+ * cascades into every live fork path and spawn child, so no corner of the
311
+ * tree keeps working while cleanup is in progress. Cleanup then runs
312
+ * bottom-up: a child's `onComplete` / `dispose` fires before its parent's.
313
+ *
314
+ * Aborting a context rejects everything blocked on it (channel `recv`
315
+ * waiters, parked senders) with `{ kind: 'cancelled' }`, stops its in-flight
316
+ * model call and sub-harness turn, and makes the next step boundary throw
317
+ * `cancelled`.
318
+ *
319
+ * Cancellation is cooperative: a layer hook already in flight is allowed to
320
+ * settle, and step code that ignores `ctx.aborted` between `await`s runs to
321
+ * its next boundary. Calling `cancel()` on an already-cancelled context is a
322
+ * no-op.
323
+ */
324
+ cancel(ctx: Context, reason?: string): Promise<void>;
325
+ /**
326
+ * Run the layer lifecycle's abort path for one cancelled context:
327
+ * `onComplete` with `outcome: 'aborted'`, then `dispose`. Both always run
328
+ * under cancellation (spec 09, Cancellation item 5).
329
+ */
330
+ private teardownCancelledContext;
274
331
  createSpan(name: string, parent: Span | null): Span;
275
332
  getLayerState<T>(executionId: string, layerId: string): T | undefined;
276
333
  setLayerState<T>(executionId: string, layerId: string, state: T): void;
277
- beforeToolCall(layers: MemoryLayer[], toolName: string, toolArgs: unknown, ctx: Context): Promise<SteeringDecision>;
278
- afterModelCall(layers: MemoryLayer[], response: LLMResponse, ctx: Context): Promise<SteeringDecision>;
279
- projectHistory(layers: MemoryLayer[], items: ReadonlyArray<Item>, ctx: Context): Promise<ReadonlyArray<Item>>;
280
- runAppendPipeline(layers: MemoryLayer[], items: Item[], ctx: Context): Promise<{
334
+ beforeToolCall(layers: ContextLayer[], toolName: string, toolArgs: unknown, ctx: Context): Promise<SteeringDecision>;
335
+ afterModelCall(layers: ContextLayer[], response: LLMResponse, ctx: Context): Promise<SteeringDecision>;
336
+ projectHistory(layers: ContextLayer[], items: ReadonlyArray<Item>, ctx: Context): Promise<ReadonlyArray<Item>>;
337
+ runAppendPipeline(layers: ContextLayer[], items: Item[], ctx: Context): Promise<{
281
338
  items: Item[];
282
339
  rerenderRequests: {
283
340
  layerId: string;
@@ -291,7 +348,7 @@ export declare class AgentHarness<TParams extends Record<string, unknown> = Reco
291
348
  slot: number;
292
349
  timing: 'immediate' | 'batched';
293
350
  scope: 'self' | 'slot-after' | 'all';
294
- }[], layers: MemoryLayer[], ctx: Context, budgets: Map<string, number>, query?: string): Promise<{
351
+ }[], layers: ContextLayer[], ctx: Context, budgets: Map<string, number>, query?: string): Promise<{
295
352
  layerId: string;
296
353
  items: Item[];
297
354
  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, contextToExecCtx, createLayerStateStore, createRecallCache, DEFAULT_PROJECTION, disposeLayers, executeRerender, initLayers, projectHistoryLayers, recallLayers, recallLayersAtomic, recallLayersEventual, resolveLayerTools, runAppendPipeline, storeLayers, } from './deps/memory.js';
7
- import { buildItemStream, ChannelStore, ContextImpl, captureCheckpoint, createInMemoryStorage, createStepLedgerStore, filterReasoningStream, filterTextStream, restoreFromCheckpoint, SessionRunner, StepLedger, snapshotCwdState, } from './deps/runtime.js';
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, memory, and trace support.
108
- * Provides channel store, memory layer lifecycle, and trace export with no external dependencies.
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-
@@ -130,13 +131,19 @@ export class AgentHarness {
130
131
  * @internal
131
132
  */
132
133
  stepLedgerStore;
134
+ /**
135
+ * Resolved retention bounds for that ledger. Validated at construction so a bad cap
136
+ * is a loud config error rather than a run that silently records nothing.
137
+ * @internal
138
+ */
139
+ stepLedgerRetention;
133
140
  initialStep;
134
141
  /** Harness-wide tool pool merged into every context's `unifiedTools`. */
135
142
  harnessTools;
136
- /** @internal Memory layers configured for this harness. Exposed non-private
143
+ /** @internal Context layers configured for this harness. Exposed non-private
137
144
  * so free functions in `runtime/durable/` (checkpoint/restore) can read it
138
145
  * without friend-class gymnastics. Do not access from outside core. */
139
- _memory;
146
+ _contextLayers;
140
147
  client;
141
148
  channelStore;
142
149
  callModelOverride;
@@ -192,9 +199,10 @@ export class AgentHarness {
192
199
  storage: this.config.storage ?? createInMemoryStorage(),
193
200
  })
194
201
  : undefined;
202
+ this.stepLedgerRetention = resolveStepLedgerRetention(opts.stepLedgerRetention);
195
203
  this.initialStep = opts.initialStep;
196
204
  this.harnessTools = opts.tools ?? [];
197
- this._memory = opts.memory;
205
+ this._contextLayers = resolveContextOption(opts);
198
206
  this.callModelOverride = opts._testCallModel;
199
207
  this.client = opts._testCallModel ? undefined : createClient(opts.llm);
200
208
  this.channelStore = new ChannelStore();
@@ -202,7 +210,7 @@ export class AgentHarness {
202
210
  this.layerStateStore =
203
211
  opts.layerStateStore ??
204
212
  createLayerStateStore((layerId, hook, error) => {
205
- console.warn(`[noetic] memory layer '${layerId}' ${hook} error:`, error);
213
+ console.warn(`[noetic] context layer '${layerId}' ${hook} error:`, error);
206
214
  });
207
215
  this.recallCache = createRecallCache();
208
216
  this.defaultDeliveryMode = opts.defaultDeliveryMode ?? 'next-turn';
@@ -315,7 +323,7 @@ export class AgentHarness {
315
323
  threadId,
316
324
  agentName: this.config.name,
317
325
  // The first queued message in a batch establishes `resourceId` /
318
- // `state` / `memory` for the turn. If multiple messages are drained
326
+ // `state` / `context` for the turn. If multiple messages are drained
319
327
  // together (queue flush), later messages' values for these fields
320
328
  // are ignored. `deliveryMode` is resolved per-message at enqueue
321
329
  // time and doesn't apply here.
@@ -330,7 +338,7 @@ export class AgentHarness {
330
338
  threadId,
331
339
  resourceId: perTurnOptions.resourceId,
332
340
  state: perTurnOptions.state,
333
- memory: perTurnOptions.memory,
341
+ context: resolveContextOption(perTurnOptions),
334
342
  _broadcaster: session.runner.broadcaster,
335
343
  });
336
344
  const ext = frameworkCast(ctx);
@@ -412,8 +420,8 @@ export class AgentHarness {
412
420
  ...this.harnessTools,
413
421
  ]);
414
422
  }
415
- // Hydrate/recall/persist memory on the bare `run()` path too (issue #48):
416
- // configuring `memory` + `storage` must "just work" without going through
423
+ // Hydrate/recall/persist context on the bare `run()` path too (issue #48):
424
+ // configuring `context` + `storage` must "just work" without going through
417
425
  // `execute()`/`seedSessionHistory`. Idempotent — see `ensureLayersInit`.
418
426
  await this.ensureLayersInit(ctx);
419
427
  return execute(s, input, ctx);
@@ -451,11 +459,14 @@ export class AgentHarness {
451
459
  return dispatchStepThroughAdapter(this, s, input, parentCtx, overrides);
452
460
  }
453
461
  createContext(opts) {
454
- const { memory: memoryLayers, cwdInit, ...rest } = opts ?? {};
455
- const effectiveMemory = memoryLayers ?? this._memory;
462
+ const resolved = opts ?? {};
463
+ // `ContextImpl` takes the layers as `layers`, so both option spellings are
464
+ // dropped from `rest` rather than spread through under the wrong name.
465
+ const { context: _context, memory: _memory, cwdInit, ...rest } = resolved;
466
+ const effectiveLayers = resolveContextOption(resolved) ?? this._contextLayers;
456
467
  const itemSchemas = buildItemSchemaRegistry({
457
468
  base: this.itemSchemas,
458
- layers: effectiveMemory,
469
+ layers: effectiveLayers,
459
470
  });
460
471
  /* The execution id is chosen here rather than inside ContextImpl so the ledger
461
472
  * can be keyed to it — the ledger's storage keys and `ctx.id` must agree for a
@@ -466,7 +477,7 @@ export class AgentHarness {
466
477
  id: executionId,
467
478
  harness: this,
468
479
  channelStore: this.channelStore,
469
- layers: effectiveMemory,
480
+ layers: effectiveLayers,
470
481
  itemSchemas,
471
482
  cwdState: resolveContextCwdState(this.rootCwdState, opts?.parent, cwdInit),
472
483
  // Without this `ctx.checkpoint()` is inert, and the boundaries below never
@@ -476,6 +487,7 @@ export class AgentHarness {
476
487
  ? new StepLedger({
477
488
  executionId,
478
489
  store: this.stepLedgerStore,
490
+ retention: this.stepLedgerRetention,
479
491
  })
480
492
  : undefined,
481
493
  });
@@ -578,7 +590,7 @@ export class AgentHarness {
578
590
  }
579
591
  /**
580
592
  * Compute the items array that would be sent to the model on the next turn —
581
- * the same arrangement `executeLLM` builds: harness-level memory layers'
593
+ * the same arrangement `executeLLM` builds: harness-level context layers'
582
594
  * recall outputs concatenated with the session's accumulated history.
583
595
  *
584
596
  * Read-mostly: `recallLayers` writes layer-state snapshots to
@@ -598,7 +610,7 @@ export class AgentHarness {
598
610
  const ctx = this.createContext({
599
611
  items: historyItems,
600
612
  threadId,
601
- memory: this._memory,
613
+ context: this._contextLayers,
602
614
  });
603
615
  const layers = ctx.layers ?? [];
604
616
  if (layers.length === 0) {
@@ -671,7 +683,7 @@ export class AgentHarness {
671
683
  * checkpoint via `CheckpointStore.clear()` and start a fresh execution.
672
684
  *
673
685
  * `opts` is the `createContext`-shaped wiring the host attached to the
674
- * original context (broadcaster, parent, state, memory overrides). A
686
+ * original context (broadcaster, parent, state, context overrides). A
675
687
  * snapshot recovers data, not live objects — pass the same wiring here or
676
688
  * the resumed run gets an undecorated context and whatever depended on that
677
689
  * wiring (event streaming, mid-turn injection) stops working without
@@ -685,8 +697,77 @@ export class AgentHarness {
685
697
  async restore(executionId, opts) {
686
698
  return restoreFromCheckpoint(this, executionId, opts);
687
699
  }
700
+ /**
701
+ * Discard everything `restore(executionId)` would have used — the snapshot *and* the
702
+ * step-completion ledger — so the next run of that execution starts clean.
703
+ *
704
+ * Hosts must call this rather than resume when the workflow itself changed. A resumed
705
+ * run replays at the coarsest completed granularity: a parent step that finished
706
+ * replays wholesale, so an edit to one of its children is never noticed and the stale
707
+ * output wins. Divergence detection only catches a changed step *at* a recorded path.
708
+ *
709
+ * Also the right call after a terminal outcome (the execution finished, or the user
710
+ * abandoned it) — `CheckpointStore.clear` alone leaves the ledger's per-step keys
711
+ * behind, and nothing else enumerates them.
712
+ */
713
+ async clearCheckpoint(executionId) {
714
+ return clearCheckpoint(this, executionId);
715
+ }
688
716
  //#endregion
689
- async cancel(_ctx, _reason) { }
717
+ /**
718
+ * Cancel an execution: abort `ctx` and every live descendant context, then
719
+ * run the context-layer teardown for each (spec 09, Cancellation).
720
+ *
721
+ * The abort itself fans out top-down and synchronously — `ctx.abort()`
722
+ * cascades into every live fork path and spawn child, so no corner of the
723
+ * tree keeps working while cleanup is in progress. Cleanup then runs
724
+ * bottom-up: a child's `onComplete` / `dispose` fires before its parent's.
725
+ *
726
+ * Aborting a context rejects everything blocked on it (channel `recv`
727
+ * waiters, parked senders) with `{ kind: 'cancelled' }`, stops its in-flight
728
+ * model call and sub-harness turn, and makes the next step boundary throw
729
+ * `cancelled`.
730
+ *
731
+ * Cancellation is cooperative: a layer hook already in flight is allowed to
732
+ * settle, and step code that ignores `ctx.aborted` between `await`s runs to
733
+ * its next boundary. Calling `cancel()` on an already-cancelled context is a
734
+ * no-op.
735
+ */
736
+ async cancel(ctx, reason) {
737
+ if (ctx.aborted) {
738
+ return;
739
+ }
740
+ // Snapshot the tree first: `abort()` cascades and clears each context's
741
+ // child registry, so collecting afterwards would find nothing.
742
+ const tree = collectContextTree(ctx);
743
+ ctx.abort(reason);
744
+ for (const node of tree.reverse()) {
745
+ await this.teardownCancelledContext(node);
746
+ }
747
+ }
748
+ /**
749
+ * Run the layer lifecycle's abort path for one cancelled context:
750
+ * `onComplete` with `outcome: 'aborted'`, then `dispose`. Both always run
751
+ * under cancellation (spec 09, Cancellation item 5).
752
+ */
753
+ async teardownCancelledContext(ctx) {
754
+ const layers = ctx.layers ?? [];
755
+ if (layers.length === 0) {
756
+ return;
757
+ }
758
+ await completeLayers({
759
+ layers: [
760
+ ...layers,
761
+ ],
762
+ ctx: this.toExecCtx(ctx),
763
+ log: ctx.itemLog,
764
+ outcome: 'aborted',
765
+ store: this.layerStateStore,
766
+ });
767
+ await this.disposeLayers([
768
+ ...layers,
769
+ ], ctx);
770
+ }
690
771
  createSpan(name, parent) {
691
772
  return new SpanImpl(name, parent);
692
773
  }
@@ -0,0 +1,2 @@
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';
@@ -0,0 +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/context';
@@ -1,11 +1,11 @@
1
1
  export { ChannelStore } from '../../runtime/channel-store.js';
2
- export { ContextImpl } from '../../runtime/context-impl.js';
2
+ export { ContextImpl, collectContextTree } from '../../runtime/context-impl.js';
3
3
  export { snapshotCwdState } from '../../runtime/cwd-helpers.js';
4
4
  export type { CheckpointStore } from '../../runtime/durable/index.js';
5
5
  export type { RestoreCheckpointOptions } from '../../runtime/durable/harness-checkpoints.js';
6
- export { captureCheckpoint, restoreFromCheckpoint, } from '../../runtime/durable/harness-checkpoints.js';
7
- export type { StepLedgerEntry, StepLedgerStore } from '../../runtime/durable/step-ledger.js';
8
- export { createStepLedgerStore, StepLedger } from '../../runtime/durable/step-ledger.js';
6
+ export { captureCheckpoint, clearCheckpoint, restoreFromCheckpoint, } from '../../runtime/durable/harness-checkpoints.js';
7
+ export type { StepLedgerEntry, StepLedgerRetention, StepLedgerStore, } from '../../runtime/durable/step-ledger.js';
8
+ export { createStepLedgerStore, resolveStepLedgerRetention, StepLedger, } from '../../runtime/durable/step-ledger.js';
9
9
  export type { EventBroadcaster } from '../../runtime/event-broadcaster.js';
10
10
  export { createInMemoryStorage } from '../../runtime/in-memory-storage.js';
11
11
  export type { QueuedMessage } from '../../runtime/message-queue.js';
@@ -1,8 +1,8 @@
1
1
  export { ChannelStore } from '../../runtime/channel-store.js';
2
- export { ContextImpl } from '../../runtime/context-impl.js';
2
+ export { ContextImpl, collectContextTree } from '../../runtime/context-impl.js';
3
3
  export { snapshotCwdState } from '../../runtime/cwd-helpers.js';
4
- export { captureCheckpoint, restoreFromCheckpoint, } from '../../runtime/durable/harness-checkpoints.js';
5
- export { createStepLedgerStore, StepLedger } from '../../runtime/durable/step-ledger.js';
4
+ export { captureCheckpoint, clearCheckpoint, restoreFromCheckpoint, } from '../../runtime/durable/harness-checkpoints.js';
5
+ export { createStepLedgerStore, resolveStepLedgerRetention, StepLedger, } from '../../runtime/durable/step-ledger.js';
6
6
  export { createInMemoryStorage } from '../../runtime/in-memory-storage.js';
7
7
  export { SessionRunner } from '../../runtime/session-runner.js';
8
8
  export { buildItemStream, filterReasoningStream, filterTextStream, } from '../../runtime/session-streams.js';
@@ -1,4 +1,4 @@
1
- export type { ContextMemory, ExecutionContext, MemoryLayer, ProjectionPolicy, StorageAdapter, } from '@noetic-tools/memory';
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 { MemoryLayer } from '@noetic-tools/memory';
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<MemoryLayer>;
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, ObservationalMemoryConfig, ObservationalState, PlanEnterSessionCallback, PlanExecutionEntry, PlanExitCallback, PlanMemoryConfig, PlanState, TemporalFact, TemporalMemoryConfig, TemporalSearchResult, WorkingMemoryConfig, WorkingMemoryState, } from '@noetic-tools/memory';
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, observationalMemory, PlanPhase, planMemory, staticContent, steering, storageGetMany, stripUnresolvedToolCalls, temporalMemory, toolMemoryLayer, workingMemory, } from '@noetic-tools/memory';
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';
@@ -100,22 +98,22 @@ export { react } from './patterns/react.js';
100
98
  /** @public */
101
99
  export { AgentHarness } from './harness/agent-harness.js';
102
100
  /** @public */
103
- export type { AfterFirstTurnContext, CheckpointStore, CreateCheckpointStoreOptions, CreateNudgeMessageOpts, DetachedSignal, RunnableLoopHarness, RunnableLoopOpts, SessionSeedHarness, StallNudgeOpts, } from './runtime/durable/index.js';
101
+ export type { AfterFirstTurnContext, CheckpointStore, CreateCheckpointStoreOptions, CreateNudgeMessageOpts, DetachedSignal, RunnableLoopHarness, RunnableLoopOpts, SessionSeedHarness, StallNudgeOpts, StepLedgerRetention, StepLedgerStats, } from './runtime/durable/index.js';
104
102
  /** @public */
105
- export { CheckpointKeys, createCheckpointStore, createDetachedSignal, createNudgeMessage, createStallNudgeHook, DEFAULT_NUDGE_MESSAGE_TEXT, runnableLoop, seedFromItems, } from './runtime/durable/index.js';
103
+ export { CheckpointKeys, createCheckpointStore, createDetachedSignal, createNudgeMessage, createStallNudgeHook, DEFAULT_NUDGE_MESSAGE_TEXT, DEFAULT_STEP_LEDGER_RETENTION, runnableLoop, seedFromItems, } from './runtime/durable/index.js';
106
104
  /** @public */
107
105
  export { getRegistry, lookupStep, registerStep } from './runtime/step-registry.js';
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, ToolMemoryDeclaration, } from '@noetic-tools/types';
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, ContextMemory, DisposeParams, InferMemory, InferMemoryShape, InitParams, InitResult, LayerDataDecl, LayerFunctionDecl, LayerProvides, LayerTimeouts, MemoryConfig, MemoryHooks, MemoryLayer, ProjectionPolicy, RecallParams, RecallResult, ReturnParams, ReturnResult, ScopedStorage, SpawnParams, SpawnResult, StorageAdapter, StoreParams, StoreResult, } from '@noetic-tools/memory';
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/memory';
142
+ export { Slot } from '@noetic-tools/context';
145
143
  /** @public */
146
- export type { ExecutionContext, ExecutionOutcome, MemoryCallModelRequest, MemoryScope, } from '@noetic-tools/types';
144
+ export type { ContextScope, ExecutionContext, ExecutionOutcome, LayerCallModelRequest, } from '@noetic-tools/types';
147
145
  /** @public */
148
- export type { MemoryTraceSpan, Span, TraceExporter } from '@noetic-tools/types';
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 { ToolExecutionContext, ToolMemory } from '@noetic-tools/types';
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';