@noetic-tools/types 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -177,6 +177,11 @@ export interface ContextHarness {
177
177
  disposeLayers(layers: MemoryLayer[], ctx: Context): Promise<void>;
178
178
  checkpoint(ctx: Context): Promise<void>;
179
179
  restore(executionId: string, opts?: RestoreContextOptions): Promise<Context | null>;
180
+ /**
181
+ * Cancel an execution: abort `ctx` and every live descendant context, then
182
+ * run memory-layer teardown (`onComplete` with `outcome: 'aborted'`, then
183
+ * `dispose`) bottom-up. A no-op on an already-cancelled context.
184
+ */
180
185
  cancel(ctx: Context, reason?: string): Promise<void>;
181
186
  /** Trace exporter spans are flushed to. Defaults to a no-op exporter. */
182
187
  readonly traceExporter: TraceExporter;
@@ -242,6 +247,18 @@ export interface Context<TMemory = ContextMemory, TState = unknown> {
242
247
  readonly completionValue: unknown;
243
248
  readonly aborted: boolean;
244
249
  readonly abortReason?: string;
250
+ /**
251
+ * Cancel this context and everything running beneath it. The first call wins
252
+ * (later calls are no-ops, so `abortReason` is stable), and it cascades
253
+ * *down* the execution tree: every live fork path and spawn child is aborted
254
+ * too. It never travels up — aborting a child leaves the parent running.
255
+ *
256
+ * Aborting rejects operations blocked on the context (channel `recv` waiters,
257
+ * parked back-pressure senders) with `cancelled`, cuts short the in-flight
258
+ * model call or sub-harness turn, and makes the next step boundary throw
259
+ * `cancelled`. Memory-layer teardown is NOT run — use
260
+ * `harness.cancel(ctx, reason)` for that.
261
+ */
245
262
  abort(reason?: string): void;
246
263
  }
247
264
  export {};
@@ -251,6 +251,16 @@ export interface AgentHarnessContract<TParams extends Record<string, unknown> =
251
251
  * decorated context is silently replaced by a bare one on resume.
252
252
  */
253
253
  restore(executionId: string, opts?: RestoreContextOptions): Promise<Context | null>;
254
+ /**
255
+ * Cancel an execution. Aborts `ctx` and — cascading down the execution tree —
256
+ * every live fork path and spawn child, then runs memory-layer teardown
257
+ * (`onComplete` with `outcome: 'aborted'`, then `dispose`) bottom-up.
258
+ *
259
+ * Blocked channel operations reject with `cancelled`, the in-flight model
260
+ * call and sub-harness turn are cut short, and the next step boundary throws
261
+ * `cancelled`. Idempotent: cancelling an already-cancelled context is a
262
+ * no-op. Use `ctx.abort()` when you want the signal without layer teardown.
263
+ */
254
264
  cancel(ctx: Context, reason?: string): Promise<void>;
255
265
  /** Trace exporter spans are flushed to. Defaults to a no-op exporter. */
256
266
  readonly traceExporter: TraceExporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noetic-tools/types",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "description": "Foundational type contracts and primitives shared across the Noetic framework (items, LLM config, adapters, steering, errors).",
6
6
  "license": "Apache-2.0",