pi-observational-memory 3.1.1 → 3.1.4
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/package.json +1 -1
- package/src/agents/worker-stream.ts +8 -16
package/package.json
CHANGED
|
@@ -11,13 +11,12 @@ export type WorkerStreamSimple = (
|
|
|
11
11
|
* Duck-typed subset of Pi's extension ModelRegistry.
|
|
12
12
|
*
|
|
13
13
|
* `streamSimple` is the host-composed path (Pi #8964). Until that lands on the
|
|
14
|
-
* facade, `getRegisteredProviderConfig`
|
|
15
|
-
* `streamSimple` handler
|
|
16
|
-
*
|
|
14
|
+
* facade, `getRegisteredProviderConfig` exposes each `registerProvider`
|
|
15
|
+
* `streamSimple` handler by provider id. Use only the model's exact provider
|
|
16
|
+
* and require matching API metadata as a consistency check.
|
|
17
17
|
*/
|
|
18
18
|
export type StreamableModelRegistry = {
|
|
19
19
|
streamSimple?: WorkerStreamSimple;
|
|
20
|
-
getRegisteredProviderIds?: () => readonly string[];
|
|
21
20
|
getRegisteredProviderConfig?: (providerId: string) => {
|
|
22
21
|
api?: string;
|
|
23
22
|
streamSimple?: WorkerStreamSimple;
|
|
@@ -41,21 +40,14 @@ export function resolveWorkerStreamSimple(
|
|
|
41
40
|
|
|
42
41
|
const registryStream = modelRegistry?.streamSimple;
|
|
43
42
|
if (typeof registryStream === "function") {
|
|
44
|
-
return (nextModel, context, options) => registryStream(nextModel, context, options);
|
|
43
|
+
return (nextModel, context, options) => registryStream.call(modelRegistry, nextModel, context, options);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
try {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
for (const providerId of modelRegistry.getRegisteredProviderIds()) {
|
|
53
|
-
const config = modelRegistry.getRegisteredProviderConfig(providerId);
|
|
54
|
-
const composed = config?.streamSimple;
|
|
55
|
-
if (config?.api === model.api && typeof composed === "function") {
|
|
56
|
-
return composed;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
47
|
+
const config = modelRegistry?.getRegisteredProviderConfig?.(model.provider);
|
|
48
|
+
const composed = config?.streamSimple;
|
|
49
|
+
if (config?.api === model.api && typeof composed === "function") {
|
|
50
|
+
return composed;
|
|
59
51
|
}
|
|
60
52
|
} catch {
|
|
61
53
|
// Incomplete host/test doubles still use the built-in compat dispatcher.
|