@noetic-tools/types 2.3.0 → 3.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.
@@ -14,11 +14,13 @@ export interface Channel<T> {
14
14
  readonly capacity?: number;
15
15
  }
16
16
  /**
17
- * A channel that is writable from outside the execution tree (e.g. user input).
17
+ * A channel reachable from outside the execution tree: writable via
18
+ * `getChannelHandle` (e.g. user input) and readable via `getChannelStream`
19
+ * (e.g. approval requests posted to a chat platform).
18
20
  * @public
19
21
  */
20
22
  export interface ExternalChannel<T> extends Channel<T> {
21
- /** Marker indicating the channel accepts writes from external callers. */
23
+ /** Marker indicating the channel accepts external readers and writers. */
22
24
  readonly external: true;
23
25
  }
24
26
  /** @public Handle for sending messages to a channel and checking its closed state. */
@@ -177,6 +177,8 @@ export interface ContextHarness {
177
177
  }): Promise<T>;
178
178
  tryRecv<T>(channel: Channel<T>, ctx: Context): T | null;
179
179
  getChannelHandle<T>(channel: ExternalChannel<T>, executionId: string): ChannelHandle<T>;
180
+ /** Read-side counterpart to `getChannelHandle` — see `AgentHarnessContract.getChannelStream`. */
181
+ getChannelStream<T>(channel: ExternalChannel<T>, executionId: string): AsyncIterable<T>;
180
182
  initLayers(layers: ContextLayer[], ctx: Context, storage: StorageAdapter): Promise<void>;
181
183
  disposeLayers(layers: ContextLayer[], ctx: Context): Promise<void>;
182
184
  checkpoint(ctx: Context): Promise<void>;
@@ -234,6 +234,17 @@ export interface AgentHarnessContract<TParams extends Record<string, unknown> =
234
234
  }): Promise<T>;
235
235
  tryRecv<T>(channel: Channel<T>, ctx: Context): T | null;
236
236
  getChannelHandle<T>(channel: ExternalChannel<T>, executionId: string): ChannelHandle<T>;
237
+ /**
238
+ * Read-side counterpart to `getChannelHandle`: subscribe to values the agent
239
+ * sends on an external channel. Delivery is CHANNEL-scoped (state is keyed
240
+ * by channel name per harness) — `executionId` bounds only the
241
+ * subscription's lifetime: the iterable ends when that root execution
242
+ * completes (success, failure, or cancellation), draining buffered values
243
+ * first. An id no execution runs under never closes, giving a
244
+ * harness-lifetime stream ended via `iterator.return()`. The returned
245
+ * iterable owns a single iterator; subscribe again for a second consumer.
246
+ */
247
+ getChannelStream<T>(channel: ExternalChannel<T>, executionId: string): AsyncIterable<T>;
237
248
  initLayers(layers: ContextLayer[], ctx: Context, storage: StorageAdapter): Promise<void>;
238
249
  recallLayers(layers: ContextLayer[], input: string, ctx: Context): Promise<RecallLayerOutput[]>;
239
250
  /** Recall only atomic layers (or all layers when the harness forces atomic recall). Blocks until complete. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noetic-tools/types",
3
- "version": "2.3.0",
3
+ "version": "3.0.0",
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",