@independo/inderun-web 0.2.0-dev.7 → 0.2.0-dev.9
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/README.md +71 -1
- package/dist/core/browser-host.d.ts.map +1 -0
- package/dist/{engine.d.ts → core/engine.d.ts} +6 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/{engine.js → core/engine.js} +11 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/host.d.ts.map +1 -0
- package/dist/{provider.d.ts → core/provider.d.ts} +9 -0
- package/dist/core/provider.d.ts.map +1 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/route-planner.d.ts.map +1 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/onnx.d.ts +3 -3
- package/dist/onnx.d.ts.map +1 -1
- package/dist/onnx.js +3 -3
- package/dist/openai.d.ts +1 -1
- package/dist/openai.d.ts.map +1 -1
- package/dist/openai.js +1 -1
- package/dist/{onnx-provider.d.ts → providers/onnx/provider.d.ts} +4 -4
- package/dist/providers/onnx/provider.d.ts.map +1 -0
- package/dist/{onnx-provider.js → providers/onnx/provider.js} +3 -3
- package/dist/{onnx-runtime.d.ts → providers/onnx/runtime.d.ts} +1 -1
- package/dist/providers/onnx/runtime.d.ts.map +1 -0
- package/dist/{onnx-transformers-runtime.d.ts → providers/onnx/transformers-runtime.d.ts} +2 -2
- package/dist/providers/onnx/transformers-runtime.d.ts.map +1 -0
- package/dist/{onnx-transformers-runtime.js → providers/onnx/transformers-runtime.js} +1 -1
- package/dist/{openai-provider.d.ts → providers/openai/provider.d.ts} +21 -3
- package/dist/providers/openai/provider.d.ts.map +1 -0
- package/dist/{openai-provider.js → providers/openai/provider.js} +42 -2
- package/dist/providers/system-model/chrome-runtime.d.ts +48 -0
- package/dist/providers/system-model/chrome-runtime.d.ts.map +1 -0
- package/dist/providers/system-model/chrome-runtime.js +137 -0
- package/dist/providers/system-model/provider.d.ts +67 -0
- package/dist/providers/system-model/provider.d.ts.map +1 -0
- package/dist/providers/system-model/provider.js +190 -0
- package/dist/providers/system-model/runtime.d.ts +110 -0
- package/dist/providers/system-model/runtime.d.ts.map +1 -0
- package/dist/providers/system-model/runtime.js +73 -0
- package/dist/system-model.d.ts +13 -0
- package/dist/system-model.d.ts.map +1 -0
- package/dist/system-model.js +12 -0
- package/dist/web-sdk.d.ts +14 -6
- package/dist/web-sdk.d.ts.map +1 -1
- package/dist/web-sdk.js +14 -9
- package/package.json +7 -3
- package/dist/browser-host.d.ts.map +0 -1
- package/dist/engine.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/host.d.ts.map +0 -1
- package/dist/onnx-provider.d.ts.map +0 -1
- package/dist/onnx-runtime.d.ts.map +0 -1
- package/dist/onnx-transformers-runtime.d.ts.map +0 -1
- package/dist/openai-provider.d.ts.map +0 -1
- package/dist/provider.d.ts.map +0 -1
- package/dist/registry.d.ts.map +0 -1
- package/dist/route-planner.d.ts.map +0 -1
- package/dist/router.d.ts.map +0 -1
- package/dist/telemetry.d.ts.map +0 -1
- /package/dist/{browser-host.d.ts → core/browser-host.d.ts} +0 -0
- /package/dist/{browser-host.js → core/browser-host.js} +0 -0
- /package/dist/{errors.d.ts → core/errors.d.ts} +0 -0
- /package/dist/{errors.js → core/errors.js} +0 -0
- /package/dist/{host.d.ts → core/host.d.ts} +0 -0
- /package/dist/{host.js → core/host.js} +0 -0
- /package/dist/{provider.js → core/provider.js} +0 -0
- /package/dist/{registry.d.ts → core/registry.d.ts} +0 -0
- /package/dist/{registry.js → core/registry.js} +0 -0
- /package/dist/{route-planner.d.ts → core/route-planner.d.ts} +0 -0
- /package/dist/{route-planner.js → core/route-planner.js} +0 -0
- /package/dist/{router.d.ts → core/router.d.ts} +0 -0
- /package/dist/{router.js → core/router.js} +0 -0
- /package/dist/{telemetry.d.ts → core/telemetry.d.ts} +0 -0
- /package/dist/{telemetry.js → core/telemetry.js} +0 -0
- /package/dist/{onnx-runtime.js → providers/onnx/runtime.js} +0 -0
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
TypeScript/Web SDK for IndeRun.
|
|
10
10
|
|
|
11
|
-
This package provides the Web SDK entrypoint, the engine core, routing, telemetry, error normalization, the OpenAI-compatible cloud provider,
|
|
11
|
+
This package provides the Web SDK entrypoint, the engine core, routing, telemetry, error normalization, the OpenAI-compatible cloud provider, the Web ONNX Runtime provider for developer-supplied local models, and the Web system-model provider for browser-managed on-device models.
|
|
12
12
|
|
|
13
13
|
## Basic Usage
|
|
14
14
|
|
|
@@ -164,6 +164,76 @@ const runtime: OnnxTextGenerationRuntime = {
|
|
|
164
164
|
|
|
165
165
|
`createFixtureOnnxRuntime()` provides a deterministic in-memory runtime for tests and offline demos.
|
|
166
166
|
|
|
167
|
+
## On-Device Models: Web System-Model Provider
|
|
168
|
+
|
|
169
|
+
`local.system-model.web` runs a browser-managed on-device model — currently
|
|
170
|
+
[Chrome's Prompt API](https://developer.chrome.com/docs/ai/prompt-api) (`LanguageModel`, Gemini
|
|
171
|
+
Nano). Unlike the ONNX provider above, this provider takes no `modelPackage`: the browser owns
|
|
172
|
+
model availability, download, and execution. Registering it also makes
|
|
173
|
+
`constraints.privacy = "local_required"` routable. Pass `systemModel` to the factory:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import { createIndeRunWeb } from "@independo/inderun-web";
|
|
177
|
+
|
|
178
|
+
const inderun = createIndeRunWeb({
|
|
179
|
+
systemModel: {}
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Options: `id` (defaults to `local.system-model.web`), `runtime` (defaults to
|
|
184
|
+
`createChromePromptApiRuntime()`), and `timeoutMs` (a request's `constraints.timeoutMs` wins).
|
|
185
|
+
|
|
186
|
+
### Browser support
|
|
187
|
+
|
|
188
|
+
Desktop Chrome 138+ only (Windows 10/11, macOS 13+, Linux, ChromeOS), and requires roughly 22 GB
|
|
189
|
+
free storage plus either a >4 GB VRAM GPU or a 16 GB RAM / 4+ core CPU. These figures come from
|
|
190
|
+
Chrome and may change — see the [Prompt API docs](https://developer.chrome.com/docs/ai/prompt-api)
|
|
191
|
+
for the current requirements. Edge exposes an analogous API, but this package has not yet verified
|
|
192
|
+
whether it shares the exact `LanguageModel` global shape. Everywhere else, the provider reports
|
|
193
|
+
itself unavailable (`api_missing`) rather than throwing.
|
|
194
|
+
|
|
195
|
+
### Errors
|
|
196
|
+
|
|
197
|
+
| Condition | `errorClass` |
|
|
198
|
+
| ------------------------------------------------------------- | --------------------- |
|
|
199
|
+
| Capability gate fails pre-attempt (any non-available state) | `CapabilityMismatch` |
|
|
200
|
+
| Hardware/browser-feature failure surfaced during generation | `CapabilityMismatch` |
|
|
201
|
+
| Storage/network constraints, transient failure | `Unavailable` |
|
|
202
|
+
| Generation aborted or exceeded its timeout budget | `Timeout` |
|
|
203
|
+
| Malformed/empty model output, unexpected runtime failure | `Internal` |
|
|
204
|
+
|
|
205
|
+
A purely local runtime never produces `AuthError`, `RateLimited`, or `Offline`. See
|
|
206
|
+
[`docs/architecture/web-system-model-provider-family.md`](https://github.com/independo-gmbh/inderun/blob/main/docs/architecture/web-system-model-provider-family.md)
|
|
207
|
+
in the monorepo for the full capability-state vocabulary.
|
|
208
|
+
|
|
209
|
+
### Custom runtimes
|
|
210
|
+
|
|
211
|
+
Swap the execution backend without touching provider semantics by implementing
|
|
212
|
+
`SystemModelRuntime`:
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import {
|
|
216
|
+
SystemModelWebProvider,
|
|
217
|
+
SystemModelRuntimeError,
|
|
218
|
+
createFixtureSystemModelRuntime,
|
|
219
|
+
type SystemModelRuntime
|
|
220
|
+
} from "@independo/inderun-web/system-model";
|
|
221
|
+
|
|
222
|
+
const runtime: SystemModelRuntime = {
|
|
223
|
+
async availability() {
|
|
224
|
+
return { kind: "available" };
|
|
225
|
+
},
|
|
226
|
+
async generate({ messages, generation }, signal) {
|
|
227
|
+
// Throw SystemModelRuntimeError("capability" | "unavailable" | "timeout" | "internal", …)
|
|
228
|
+
// to steer IndeRun error normalization.
|
|
229
|
+
return { text: "…" };
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`createFixtureSystemModelRuntime()` provides a deterministic in-memory runtime for tests and
|
|
235
|
+
offline demos.
|
|
236
|
+
|
|
167
237
|
## Commands
|
|
168
238
|
|
|
169
239
|
```sh
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-host.d.ts","sourceRoot":"","sources":["../../src/core/browser-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IACpE;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;CAOnC;AAED;;GAEG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD;;OAEG;IACH,GAAG,IAAI,MAAM;IAIb;;OAEG;IACH,YAAY,IAAI,MAAM;CAOvB;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,iBAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAEvC;;;;OAIG;gBACS,OAAO,GAAE,sBAA2B;IAShD;;;;OAIG;IACG,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CA0CxD;AAED;;GAEG;AACH,MAAM,WAAW,gCAAiC,SAAQ,OAAO,CAAC,YAAY,CAAC;IAC7E;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gCAAqC,GAC7C,YAAY,CA2Bd"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TaskRequest, type TaskResult } from "@independo/inderun-contracts";
|
|
2
2
|
import type { HostServices } from "./host.js";
|
|
3
|
+
import type { ProviderCapabilitySnapshot } from "./provider.js";
|
|
3
4
|
import { ProviderRegistry } from "./registry.js";
|
|
4
5
|
import { type TelemetryService } from "./telemetry.js";
|
|
5
6
|
/**
|
|
@@ -38,5 +39,10 @@ export declare class IndeRun {
|
|
|
38
39
|
* @throws {IndeRunException} Standardized error indicating validation, connection, or provider failures.
|
|
39
40
|
*/
|
|
40
41
|
run(request: TaskRequest): Promise<TaskResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Reports each registered provider's static descriptor and current dynamic capability check,
|
|
44
|
+
* without executing a task. Useful for UI that shows live provider availability before a run.
|
|
45
|
+
*/
|
|
46
|
+
checkCapabilities(): Promise<ProviderCapabilitySnapshot[]>;
|
|
41
47
|
}
|
|
42
48
|
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/core/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAuB,KAAK,gBAAgB,EAAwB,MAAM,gBAAgB,CAAC;AAElG;;;;GAIG;AACH,qBAAa,OAAO;IAWhB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,YAAY;IAXtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAmB;IAE3C;;;;;OAKG;gBAEO,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,EAAE,YAAY,EAClC,gBAAgB,CAAC,EAAE,gBAAgB;IAOrC;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAShB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;;;;;;OAOG;IACG,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAuIpD;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,0BAA0B,EAAE,CAAC;CASjE"}
|
|
@@ -190,4 +190,15 @@ export class IndeRun {
|
|
|
190
190
|
throw exception;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Reports each registered provider's static descriptor and current dynamic capability check,
|
|
195
|
+
* without executing a task. Useful for UI that shows live provider availability before a run.
|
|
196
|
+
*/
|
|
197
|
+
async checkCapabilities() {
|
|
198
|
+
return Promise.all(this.registry.list().map(async (provider) => ({
|
|
199
|
+
providerId: provider.describe().id,
|
|
200
|
+
descriptor: provider.describe(),
|
|
201
|
+
capabilities: await provider.capabilities(this.hostServices)
|
|
202
|
+
})));
|
|
203
|
+
}
|
|
193
204
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,UAAU,EAAE,iBAAiB,CAAC;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CA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AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAC,GAC7D,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAC,GAC7D,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAC,GAC7D,gBAAgB,CAElB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,CAAC,GAC7D,gBAAgB,CAElB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,GAChE,gBAAgB,CAuDlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/core/host.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAC"}
|
|
@@ -83,6 +83,15 @@ export interface ProviderDynamicCapabilities {
|
|
|
83
83
|
*/
|
|
84
84
|
reason?: string;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Snapshot of a registered provider's static descriptor and current dynamic
|
|
88
|
+
* capability check, without executing a task.
|
|
89
|
+
*/
|
|
90
|
+
export interface ProviderCapabilitySnapshot {
|
|
91
|
+
providerId: string;
|
|
92
|
+
descriptor: ProviderDescriptor;
|
|
93
|
+
capabilities: ProviderDynamicCapabilities;
|
|
94
|
+
}
|
|
86
95
|
/**
|
|
87
96
|
* Execution context passed to provider run commands.
|
|
88
97
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/core/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC;;OAEG;IACH,SAAS,EAAE,YAAY,GAAG,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;IACzE;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;IAEnD;;OAEG;IACH,QAAQ,EAAE;QACR,mEAAmE;QACnE,GAAG,EAAE,OAAO,CAAC;QACb,mDAAmD;QACnD,SAAS,EAAE,OAAO,CAAC;QACnB,6DAA6D;QAC7D,QAAQ,EAAE,OAAO,CAAC;QAClB,6DAA6D;QAC7D,KAAK,EAAE,OAAO,CAAC;QACf,wEAAwE;QACxE,eAAe,EAAE,OAAO,CAAC;QACzB,kFAAkF;QAClF,gBAAgB,EAAE,OAAO,CAAC;QAC1B,6EAA6E;QAC7E,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IAEF;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAEjC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG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B,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC;IAC1B;;OAEG;IACH,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC;;OAEG;IACH,SAAS,EAAE,sBAAsB,CAAC;IAClC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,qBAAqB,CAAC;CAClD;AAED;;;;GAIG;AACH,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,OAAO;gBADP,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE,YAAqC;IAGxD;;;;;;;;;OASG;IACG,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAc5F,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,2BAA2B;IA2BnC,OAAO,CAAC,kBAAkB;IA0F1B,OAAO,CAAC,2BAA2B;IAiCnC,OAAO,CAAC,gBAAgB;CAYzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/core/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErF,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D;;;OAGG;IACH,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;CAGnC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { type ConnectivityService, type DeviceConstraintsService, type SecureStorageService, type ClockService, type HttpClientService, type HttpRequest, type HttpResponse, type HostServices, type ThermalState } from "./host.js";
|
|
2
|
-
export { type ProviderDescriptor, type ProviderDynamicCapabilities, type RunContext, type ProviderAdapter } from "./provider.js";
|
|
3
|
-
export { ProviderRegistry } from "./registry.js";
|
|
4
|
-
export { type RouteSelection, Router } from "./router.js";
|
|
5
|
-
export { type RoutePlanner, type PlannerOutcome, type WasmUnavailableReason, type SharedPlannerInput, type SharedPlannerRoutePlan, WasmRoutePlanner } from "./route-planner.js";
|
|
6
|
-
export { type IndeRunExceptionParams, IndeRunException, createCapabilityMismatch, createOffline, createAuthError, createRateLimited, createTimeout, createUnavailable, createInternal, toIndeRunException } from "./errors.js";
|
|
7
|
-
export { IndeRun } from "./engine.js";
|
|
8
|
-
export { type TelemetryEventType, type TelemetryEvent, type TelemetryService, NoOpTelemetryService } from "./telemetry.js";
|
|
9
|
-
export { BrowserConnectivityService, FetchHttpClient, SystemClockService, createBrowserHostServices, type CreateBrowserHostServicesOptions, type FetchHttpClientOptions } from "./browser-host.js";
|
|
1
|
+
export { type ConnectivityService, type DeviceConstraintsService, type SecureStorageService, type ClockService, type HttpClientService, type HttpRequest, type HttpResponse, type HostServices, type ThermalState } from "./core/host.js";
|
|
2
|
+
export { type ProviderDescriptor, type ProviderDynamicCapabilities, type ProviderCapabilitySnapshot, type RunContext, type ProviderAdapter } from "./core/provider.js";
|
|
3
|
+
export { ProviderRegistry } from "./core/registry.js";
|
|
4
|
+
export { type RouteSelection, Router } from "./core/router.js";
|
|
5
|
+
export { type RoutePlanner, type PlannerOutcome, type WasmUnavailableReason, type SharedPlannerInput, type SharedPlannerRoutePlan, WasmRoutePlanner } from "./core/route-planner.js";
|
|
6
|
+
export { type IndeRunExceptionParams, IndeRunException, createCapabilityMismatch, createOffline, createAuthError, createRateLimited, createTimeout, createUnavailable, createInternal, toIndeRunException } from "./core/errors.js";
|
|
7
|
+
export { IndeRun } from "./core/engine.js";
|
|
8
|
+
export { type TelemetryEventType, type TelemetryEvent, type TelemetryService, NoOpTelemetryService } from "./core/telemetry.js";
|
|
9
|
+
export { BrowserConnectivityService, FetchHttpClient, SystemClockService, createBrowserHostServices, type CreateBrowserHostServicesOptions, type FetchHttpClientOptions } from "./core/browser-host.js";
|
|
10
10
|
export { createIndeRunWeb, type CreateIndeRunWebOptions } from "./web-sdk.js";
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {} from "./host.js";
|
|
2
|
-
export {} from "./provider.js";
|
|
3
|
-
export { ProviderRegistry } from "./registry.js";
|
|
4
|
-
export { Router } from "./router.js";
|
|
5
|
-
export { WasmRoutePlanner } from "./route-planner.js";
|
|
6
|
-
export { IndeRunException, createCapabilityMismatch, createOffline, createAuthError, createRateLimited, createTimeout, createUnavailable, createInternal, toIndeRunException } from "./errors.js";
|
|
7
|
-
export { IndeRun } from "./engine.js";
|
|
8
|
-
export { NoOpTelemetryService } from "./telemetry.js";
|
|
9
|
-
export { BrowserConnectivityService, FetchHttpClient, SystemClockService, createBrowserHostServices } from "./browser-host.js";
|
|
1
|
+
export {} from "./core/host.js";
|
|
2
|
+
export {} from "./core/provider.js";
|
|
3
|
+
export { ProviderRegistry } from "./core/registry.js";
|
|
4
|
+
export { Router } from "./core/router.js";
|
|
5
|
+
export { WasmRoutePlanner } from "./core/route-planner.js";
|
|
6
|
+
export { IndeRunException, createCapabilityMismatch, createOffline, createAuthError, createRateLimited, createTimeout, createUnavailable, createInternal, toIndeRunException } from "./core/errors.js";
|
|
7
|
+
export { IndeRun } from "./core/engine.js";
|
|
8
|
+
export { NoOpTelemetryService } from "./core/telemetry.js";
|
|
9
|
+
export { BrowserConnectivityService, FetchHttpClient, SystemClockService, createBrowserHostServices } from "./core/browser-host.js";
|
|
10
10
|
export { createIndeRunWeb } from "./web-sdk.js";
|
|
11
11
|
// The OpenAI Responses adapter is provider-specific and intentionally excluded
|
|
12
12
|
// from this unified index. Import it from "@independo/inderun-web/openai".
|
package/dist/onnx.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `OnnxTextGenerationRuntime`; most browser apps should pass `onnx` to
|
|
8
8
|
* `createIndeRunWeb` from the main entry point instead.
|
|
9
9
|
*/
|
|
10
|
-
export { OnnxRuntimeWebProvider, DEFAULT_ONNX_WEB_PROVIDER_ID, SUPPORTED_WEB_MODEL_SOURCE_TYPES, type OnnxProviderOptions } from "./onnx
|
|
11
|
-
export { OnnxRuntimeError, createFixtureOnnxRuntime, type FixtureOnnxRuntimeOptions, type OnnxGenerationInput, type OnnxGenerationMessage, type OnnxGenerationOutput, type OnnxRuntimeAvailability, type OnnxRuntimeErrorKind, type OnnxTextGenerationRuntime } from "./onnx
|
|
12
|
-
export { createTransformersJsRuntime, type TransformersJsRuntimeOptions, type TransformersModule, type TransformersTextGenerator } from "./onnx
|
|
10
|
+
export { OnnxRuntimeWebProvider, DEFAULT_ONNX_WEB_PROVIDER_ID, SUPPORTED_WEB_MODEL_SOURCE_TYPES, type OnnxProviderOptions } from "./providers/onnx/provider.js";
|
|
11
|
+
export { OnnxRuntimeError, createFixtureOnnxRuntime, type FixtureOnnxRuntimeOptions, type OnnxGenerationInput, type OnnxGenerationMessage, type OnnxGenerationOutput, type OnnxRuntimeAvailability, type OnnxRuntimeErrorKind, type OnnxTextGenerationRuntime } from "./providers/onnx/runtime.js";
|
|
12
|
+
export { createTransformersJsRuntime, type TransformersJsRuntimeOptions, type TransformersModule, type TransformersTextGenerator } from "./providers/onnx/transformers-runtime.js";
|
|
13
13
|
//# sourceMappingURL=onnx.d.ts.map
|
package/dist/onnx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onnx.d.ts","sourceRoot":"","sources":["../src/onnx.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,gCAAgC,EAChC,KAAK,mBAAmB,EACzB,MAAM,
|
|
1
|
+
{"version":3,"file":"onnx.d.ts","sourceRoot":"","sources":["../src/onnx.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,gCAAgC,EAChC,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC/B,MAAM,0CAA0C,CAAC"}
|
package/dist/onnx.js
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `OnnxTextGenerationRuntime`; most browser apps should pass `onnx` to
|
|
8
8
|
* `createIndeRunWeb` from the main entry point instead.
|
|
9
9
|
*/
|
|
10
|
-
export { OnnxRuntimeWebProvider, DEFAULT_ONNX_WEB_PROVIDER_ID, SUPPORTED_WEB_MODEL_SOURCE_TYPES } from "./onnx
|
|
11
|
-
export { OnnxRuntimeError, createFixtureOnnxRuntime } from "./onnx
|
|
12
|
-
export { createTransformersJsRuntime } from "./onnx
|
|
10
|
+
export { OnnxRuntimeWebProvider, DEFAULT_ONNX_WEB_PROVIDER_ID, SUPPORTED_WEB_MODEL_SOURCE_TYPES } from "./providers/onnx/provider.js";
|
|
11
|
+
export { OnnxRuntimeError, createFixtureOnnxRuntime } from "./providers/onnx/runtime.js";
|
|
12
|
+
export { createTransformersJsRuntime } from "./providers/onnx/transformers-runtime.js";
|
package/dist/openai.d.ts
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* when registering the adapter manually; most browser apps should use
|
|
7
7
|
* `createIndeRunWeb` from the main entry point instead.
|
|
8
8
|
*/
|
|
9
|
-
export { OpenAIResponsesProvider, type OpenAIProviderOptions, DEFAULT_OPENAI_RESPONSES_ENDPOINT } from "./openai
|
|
9
|
+
export { OpenAIResponsesProvider, type OpenAIProviderOptions, DEFAULT_OPENAI_RESPONSES_ENDPOINT } from "./providers/openai/provider.js";
|
|
10
10
|
//# sourceMappingURL=openai.d.ts.map
|
package/dist/openai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,iCAAiC,EAClC,MAAM,
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,iCAAiC,EAClC,MAAM,gCAAgC,CAAC"}
|
package/dist/openai.js
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* when registering the adapter manually; most browser apps should use
|
|
7
7
|
* `createIndeRunWeb` from the main entry point instead.
|
|
8
8
|
*/
|
|
9
|
-
export { OpenAIResponsesProvider, DEFAULT_OPENAI_RESPONSES_ENDPOINT } from "./openai
|
|
9
|
+
export { OpenAIResponsesProvider, DEFAULT_OPENAI_RESPONSES_ENDPOINT } from "./providers/openai/provider.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ModelPackage, type ModelSourceType, type TaskRequest, type TaskResult } from "@independo/inderun-contracts";
|
|
2
|
-
import type { HostServices } from "
|
|
3
|
-
import { type OnnxTextGenerationRuntime } from "./
|
|
4
|
-
import type { ProviderAdapter, ProviderDescriptor, ProviderDynamicCapabilities, RunContext } from "
|
|
2
|
+
import type { HostServices } from "../../core/host.js";
|
|
3
|
+
import { type OnnxTextGenerationRuntime } from "./runtime.js";
|
|
4
|
+
import type { ProviderAdapter, ProviderDescriptor, ProviderDynamicCapabilities, RunContext } from "../../core/provider.js";
|
|
5
5
|
/** Default provider id of the Web member of the ONNX Runtime provider family. */
|
|
6
6
|
export declare const DEFAULT_ONNX_WEB_PROVIDER_ID = "local.onnx.genai.web";
|
|
7
7
|
/**
|
|
@@ -75,4 +75,4 @@ export declare class OnnxRuntimeWebProvider implements ProviderAdapter {
|
|
|
75
75
|
run(request: TaskRequest, context: RunContext): Promise<TaskResult>;
|
|
76
76
|
private mapRuntimeError;
|
|
77
77
|
}
|
|
78
|
-
//# sourceMappingURL=
|
|
78
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/providers/onnx/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,8BAA8B,CAAC;AAStC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,2BAA2B,EAC3B,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAKnE;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,EAAE,SAAS,eAAe,EAKtE,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAShD,OAAO,CAAC,QAAQ,CAAC,OAAO;IARpC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IAEpD;;;OAGG;gBAC0B,OAAO,EAAE,mBAAmB;IAMzD;;OAEG;IACH,QAAQ,IAAI,kBAAkB;IAsB9B;;;;;;;OAOG;IACG,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAoC7E;;;;;;OAMG;IACG,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAoEzE,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getModelPackageValidationIssues } from "@independo/inderun-contracts";
|
|
2
|
-
import { createCapabilityMismatch, createInternal, createTimeout, createUnavailable, toIndeRunException } from "
|
|
3
|
-
import { OnnxRuntimeError } from "./
|
|
4
|
-
import { createTransformersJsRuntime } from "./
|
|
2
|
+
import { createCapabilityMismatch, createInternal, createTimeout, createUnavailable, toIndeRunException } from "../../core/errors.js";
|
|
3
|
+
import { OnnxRuntimeError } from "./runtime.js";
|
|
4
|
+
import { createTransformersJsRuntime } from "./transformers-runtime.js";
|
|
5
5
|
/** Default provider id of the Web member of the ONNX Runtime provider family. */
|
|
6
6
|
export const DEFAULT_ONNX_WEB_PROVIDER_ID = "local.onnx.genai.web";
|
|
7
7
|
/** Task kind this provider implements in Milestone 2 (Mode 1 only). */
|
|
@@ -107,4 +107,4 @@ export interface FixtureOnnxRuntimeOptions {
|
|
|
107
107
|
* @param options - Scripted availability, response, failure, and delay behavior.
|
|
108
108
|
*/
|
|
109
109
|
export declare function createFixtureOnnxRuntime(options?: FixtureOnnxRuntimeOptions): OnnxTextGenerationRuntime;
|
|
110
|
-
//# sourceMappingURL=
|
|
110
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/providers/onnx/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,sFAAsF;IACtF,SAAS,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,YAAY,EAAE,YAAY,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,iEAAiE;IACjE,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC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
2
|
-
import { type OnnxTextGenerationRuntime } from "./
|
|
2
|
+
import { type OnnxTextGenerationRuntime } from "./runtime.js";
|
|
3
3
|
/**
|
|
4
4
|
* Structural view of the `@huggingface/transformers` entry points this runtime uses.
|
|
5
5
|
*
|
|
@@ -69,4 +69,4 @@ export interface TransformersJsRuntimeOptions {
|
|
|
69
69
|
* @param options - Loader, backend, and model-resolution overrides.
|
|
70
70
|
*/
|
|
71
71
|
export declare function createTransformersJsRuntime(options?: TransformersJsRuntimeOptions): OnnxTextGenerationRuntime;
|
|
72
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=transformers-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers-runtime.d.ts","sourceRoot":"","sources":["../../../src/providers/onnx/transformers-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACxC,yFAAyF;IACzF,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,CACtC,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAC1B,YAAY,EAAE,YAAY,CAAC;QAC3B,MAAM,EAAE,kBAAkB,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC1C;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,4BAAiC,GACzC,yBAAyB,CAyI3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaskRequest, TaskResult } from "@independo/inderun-contracts";
|
|
2
|
-
import type { HostServices } from "
|
|
3
|
-
import type { ProviderAdapter, ProviderDescriptor, ProviderDynamicCapabilities, RunContext } from "
|
|
2
|
+
import type { HostServices } from "../../core/host.js";
|
|
3
|
+
import type { ProviderAdapter, ProviderDescriptor, ProviderDynamicCapabilities, RunContext } from "../../core/provider.js";
|
|
4
4
|
export declare const DEFAULT_OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for the OpenAI Responses provider.
|
|
@@ -31,6 +31,17 @@ export interface OpenAIProviderOptions {
|
|
|
31
31
|
* Optional HTTP timeout for the host transport attempt.
|
|
32
32
|
*/
|
|
33
33
|
timeoutMs?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Timeout for the endpoint reachability probe issued from `capabilities()`.
|
|
36
|
+
* Defaults to 3000ms. The OpenAI API has no dedicated health endpoint, so this
|
|
37
|
+
* is a cheap unauthenticated `GET` against the configured endpoint.
|
|
38
|
+
*/
|
|
39
|
+
healthCheckTimeoutMs?: number;
|
|
40
|
+
/**
|
|
41
|
+
* How long a reachability probe result is cached before `capabilities()` re-probes.
|
|
42
|
+
* Defaults to 5000ms. Avoids re-probing on every routing decision and UI capability check.
|
|
43
|
+
*/
|
|
44
|
+
healthCheckCacheMs?: number;
|
|
34
45
|
}
|
|
35
46
|
/**
|
|
36
47
|
* Cloud provider adapter that executes Mode-1 text-to-text requests through the OpenAI Responses API.
|
|
@@ -44,6 +55,7 @@ export declare class OpenAIResponsesProvider implements ProviderAdapter {
|
|
|
44
55
|
private readonly id;
|
|
45
56
|
private readonly endpointUrl;
|
|
46
57
|
private readonly auth;
|
|
58
|
+
private cachedHealth?;
|
|
47
59
|
/**
|
|
48
60
|
* Creates an OpenAI Responses provider.
|
|
49
61
|
* @param options - Provider configuration, including required OpenAI model id.
|
|
@@ -55,9 +67,15 @@ export declare class OpenAIResponsesProvider implements ProviderAdapter {
|
|
|
55
67
|
describe(): ProviderDescriptor;
|
|
56
68
|
/**
|
|
57
69
|
* Reports dynamic provider availability for the current host.
|
|
70
|
+
*
|
|
71
|
+
* After the static host-service checks pass, this probes endpoint reachability with a
|
|
72
|
+
* cheap unauthenticated `GET` against the configured endpoint (the OpenAI API has no
|
|
73
|
+
* dedicated health endpoint). The result is cached for `healthCheckCacheMs` so routing
|
|
74
|
+
* decisions and repeated UI capability checks don't re-probe on every call.
|
|
58
75
|
* @param host - Host services available to the engine.
|
|
59
76
|
*/
|
|
60
77
|
capabilities(host: HostServices): Promise<ProviderDynamicCapabilities>;
|
|
78
|
+
private checkEndpointReachable;
|
|
61
79
|
/**
|
|
62
80
|
* Executes a normalized text-to-text task using the OpenAI Responses API.
|
|
63
81
|
* @param request - Canonical IndeRun task request.
|
|
@@ -77,4 +95,4 @@ export declare class OpenAIResponsesProvider implements ProviderAdapter {
|
|
|
77
95
|
*/
|
|
78
96
|
private mapHttpError;
|
|
79
97
|
}
|
|
80
|
-
//# sourceMappingURL=
|
|
98
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/providers/openai/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAQ5E,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,2BAA2B,EAC3B,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,iCAAiC,wCAAwC,CAAC;AAKvF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAwBD;;;;;;GAMG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAUjD,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA4B;IACjD,OAAO,CAAC,YAAY,CAAC,CAA6D;IAElF;;;OAGG;gBAC0B,OAAO,EAAE,qBAAqB;IAM3D;;OAEG;IACH,QAAQ,IAAI,kBAAkB;IAsB9B;;;;;;;;OAQG;IACG,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC;YAkB9D,sBAAsB;IAuCpC;;;;;;OAMG;IACG,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAkHzE,OAAO,CAAC,iBAAiB;IAuBzB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;CAmErB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createAuthError, createInternal, createRateLimited, createTimeout, createUnavailable } from "
|
|
1
|
+
import { createAuthError, createInternal, createRateLimited, createTimeout, createUnavailable } from "../../core/errors.js";
|
|
2
2
|
export const DEFAULT_OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
|
|
3
|
+
const DEFAULT_HEALTH_CHECK_TIMEOUT_MS = 3000;
|
|
4
|
+
const DEFAULT_HEALTH_CHECK_CACHE_MS = 5000;
|
|
3
5
|
/**
|
|
4
6
|
* Cloud provider adapter that executes Mode-1 text-to-text requests through the OpenAI Responses API.
|
|
5
7
|
*
|
|
@@ -12,6 +14,7 @@ export class OpenAIResponsesProvider {
|
|
|
12
14
|
id;
|
|
13
15
|
endpointUrl;
|
|
14
16
|
auth;
|
|
17
|
+
cachedHealth;
|
|
15
18
|
/**
|
|
16
19
|
* Creates an OpenAI Responses provider.
|
|
17
20
|
* @param options - Provider configuration, including required OpenAI model id.
|
|
@@ -48,6 +51,11 @@ export class OpenAIResponsesProvider {
|
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
53
|
* Reports dynamic provider availability for the current host.
|
|
54
|
+
*
|
|
55
|
+
* After the static host-service checks pass, this probes endpoint reachability with a
|
|
56
|
+
* cheap unauthenticated `GET` against the configured endpoint (the OpenAI API has no
|
|
57
|
+
* dedicated health endpoint). The result is cached for `healthCheckCacheMs` so routing
|
|
58
|
+
* decisions and repeated UI capability checks don't re-probe on every call.
|
|
51
59
|
* @param host - Host services available to the engine.
|
|
52
60
|
*/
|
|
53
61
|
async capabilities(host) {
|
|
@@ -63,7 +71,39 @@ export class OpenAIResponsesProvider {
|
|
|
63
71
|
reason: "OpenAI Responses provider requires a SecureStorageService when auth is enabled."
|
|
64
72
|
};
|
|
65
73
|
}
|
|
66
|
-
return
|
|
74
|
+
return this.checkEndpointReachable(host.httpClient, host.clock);
|
|
75
|
+
}
|
|
76
|
+
async checkEndpointReachable(httpClient, clock) {
|
|
77
|
+
const now = clock ? clock.now() : Date.now();
|
|
78
|
+
const cacheMs = this.options.healthCheckCacheMs ?? DEFAULT_HEALTH_CHECK_CACHE_MS;
|
|
79
|
+
if (this.cachedHealth && now - this.cachedHealth.checkedAt < cacheMs) {
|
|
80
|
+
return this.cachedHealth.result;
|
|
81
|
+
}
|
|
82
|
+
let result;
|
|
83
|
+
try {
|
|
84
|
+
const response = await httpClient.send({
|
|
85
|
+
method: "GET",
|
|
86
|
+
url: this.endpointUrl,
|
|
87
|
+
timeoutMs: this.options.healthCheckTimeoutMs ?? DEFAULT_HEALTH_CHECK_TIMEOUT_MS
|
|
88
|
+
});
|
|
89
|
+
result =
|
|
90
|
+
response.status >= 500
|
|
91
|
+
? {
|
|
92
|
+
available: false,
|
|
93
|
+
reason: `OpenAI Responses endpoint returned HTTP ${response.status}.`
|
|
94
|
+
}
|
|
95
|
+
: { available: true };
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
result = {
|
|
99
|
+
available: false,
|
|
100
|
+
reason: isAbortError(err)
|
|
101
|
+
? "OpenAI Responses endpoint health check timed out."
|
|
102
|
+
: "OpenAI Responses endpoint is unreachable."
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
this.cachedHealth = { result, checkedAt: now };
|
|
106
|
+
return result;
|
|
67
107
|
}
|
|
68
108
|
/**
|
|
69
109
|
* Executes a normalized text-to-text task using the OpenAI Responses API.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type SystemModelRuntime } from "./runtime.js";
|
|
2
|
+
/**
|
|
3
|
+
* Structural view of the Chrome/Edge Prompt API's `LanguageModel` global this runtime uses.
|
|
4
|
+
*
|
|
5
|
+
* Typed structurally (not imported from `@types/dom`) since the Prompt API is not yet part of
|
|
6
|
+
* stable browser type definitions. See https://developer.chrome.com/docs/ai/prompt-api.
|
|
7
|
+
*/
|
|
8
|
+
export interface PromptApiLanguageModel {
|
|
9
|
+
availability: (options?: Record<string, unknown>) => Promise<string>;
|
|
10
|
+
create: (options?: Record<string, unknown>) => Promise<PromptApiSession>;
|
|
11
|
+
}
|
|
12
|
+
/** Structural view of a Prompt API session. */
|
|
13
|
+
export interface PromptApiSession {
|
|
14
|
+
prompt: (input: string, options?: {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}) => Promise<string>;
|
|
17
|
+
destroy: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generation controls forwarded to `LanguageModel.availability()` and `LanguageModel.create()`.
|
|
21
|
+
*
|
|
22
|
+
* Chrome's docs require passing the same options to both calls, since availability can depend on
|
|
23
|
+
* the requested configuration.
|
|
24
|
+
*/
|
|
25
|
+
export interface ChromePromptApiGenerationOptions {
|
|
26
|
+
temperature?: number;
|
|
27
|
+
topK?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for the Chrome Prompt API-backed system-model runtime.
|
|
31
|
+
*/
|
|
32
|
+
export interface ChromePromptApiRuntimeOptions {
|
|
33
|
+
/** Generation controls passed to both `availability()` and `create()`. */
|
|
34
|
+
generation?: ChromePromptApiGenerationOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates the default Web system-model runtime, backed by Chrome's built-in Prompt API
|
|
38
|
+
* (`LanguageModel`).
|
|
39
|
+
*
|
|
40
|
+
* The browser owns model availability, download, and execution; this runtime never bundles or
|
|
41
|
+
* fetches a model itself. When `LanguageModel` is not defined (unsupported browser, disabled
|
|
42
|
+
* flag, or origin trial not enrolled) the runtime reports itself unavailable instead of throwing,
|
|
43
|
+
* so routing degrades to an explainable `capability_unavailable` rejection.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Generation control overrides forwarded to the Prompt API.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createChromePromptApiRuntime(options?: ChromePromptApiRuntimeOptions): SystemModelRuntime;
|
|
48
|
+
//# sourceMappingURL=chrome-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-runtime.d.ts","sourceRoot":"","sources":["../../../src/providers/system-model/chrome-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,cAAc,CAAC;AAEtB;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC1E;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/E,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gCAAgC;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,0EAA0E;IAC1E,UAAU,CAAC,EAAE,gCAAgC,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,6BAAkC,GAC1C,kBAAkB,CA+EpB"}
|