@noetic-tools/types 1.4.0 → 2.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.
@@ -113,6 +113,21 @@ export interface StorageAdapter {
113
113
  set<T>(key: string, value: T): Promise<void>;
114
114
  delete(key: string): Promise<void>;
115
115
  list(prefix: string): Promise<string[]>;
116
+ /**
117
+ * Batch read. Anything that lists a prefix and then reads each key is an N+1 —
118
+ * one round trip per key on a network- or database-backed adapter, which is
119
+ * exactly what a resume path cannot afford. Implement this and the round trips
120
+ * collapse to one.
121
+ *
122
+ * Optional so existing adapters keep working: callers MUST NOT depend on it
123
+ * directly — go through `storageGetMany`, which falls back to a parallel
124
+ * `get` sweep when a backend has not implemented it.
125
+ *
126
+ * Keys with no stored value are ABSENT from the returned map. The map is never
127
+ * sparse-with-nulls, so `map.size < keys.length` is the normal way to see that
128
+ * something was missing.
129
+ */
130
+ getMany?<T>(keys: string[]): Promise<Map<string, T>>;
116
131
  }
117
132
  /** @public Scope-namespaced storage interface provided to memory layer init hooks. */
118
133
  export interface ScopedStorage {
@@ -120,6 +135,13 @@ export interface ScopedStorage {
120
135
  set<T>(key: string, value: T): Promise<void>;
121
136
  delete(key: string): Promise<void>;
122
137
  list(prefix?: string): Promise<string[]>;
138
+ /**
139
+ * Batch read, always available — the scoped wrapper supplies the fallback so a
140
+ * layer never has to check. Returned keys are scope-relative (the namespace
141
+ * prefix is stripped, as with `list`), and missing keys are absent rather than
142
+ * null.
143
+ */
144
+ getMany<T>(keys: string[]): Promise<Map<string, T>>;
123
145
  }
124
146
  /** @public Parameters passed to a memory layer's `init` hook. */
125
147
  export interface InitParams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noetic-tools/types",
3
- "version": "1.4.0",
3
+ "version": "2.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",