arcane-os 0.51.0 → 0.51.2
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/CHANGELOG.md +20 -0
- package/README.md +81 -44
- package/browser-runtime/ai/twin-cloud.mjs +4 -0
- package/docs/architecture.md +33 -17
- package/docs/platform-targets.md +15 -2
- package/docs/reference/README.md +31 -26
- package/docs/reference/ai/browser-speech.md +106 -31
- package/docs/reference/ai/browser-wasm.md +27 -24
- package/docs/reference/ai/twin-cloud.md +30 -11
- package/docs/reference/asset-versioning.md +34 -37
- package/docs/reference/availability-and-normalization.md +31 -20
- package/docs/reference/cli.md +30 -17
- package/docs/reference/inventory/package-api.json +34 -6
- package/docs/reference/inventory/runtime-components.json +25 -11
- package/docs/reference/inventory/runtime-entities.json +6 -3
- package/docs/reference/inventory/runtime-modules.json +63 -8
- package/docs/reference/protocols.md +62 -56
- package/docs/reference/pwa.md +20 -13
- package/docs/reference/runtime-components.md +9 -2
- package/docs/reference/runtime-entities.md +14 -2
- package/docs/reference/runtime-modules.md +59 -2
- package/docs/reference/sdk-api.md +231 -65
- package/docs/roadmap.md +32 -26
- package/package.json +1 -1
- package/runtime/arcane/modules/AI.js +20 -6
- package/src/dev-server.mjs +3 -30
|
@@ -4,7 +4,9 @@ The npm package exposes a Node.js ESM control plane, the portable
|
|
|
4
4
|
`arcane-os/event-manager`, `arcane-os/logging`, `arcane-os/mail`,
|
|
5
5
|
`arcane-os/preference-store`, `arcane-os/speech-playback`,
|
|
6
6
|
`arcane-os/speech-text`, `arcane-os/ai/tool-text-stream`, `arcane-os/ai/twin-cloud`, and `arcane-os/browser-device` entrypoints, and the browser-only
|
|
7
|
-
`arcane-os/pwa
|
|
7
|
+
`arcane-os/pwa` and `arcane-os/ai/browser-wasm` entrypoints. The
|
|
8
|
+
`arcane-os/ai/browser-speech` entrypoint includes local and native browser
|
|
9
|
+
providers plus a cloud TTS adapter usable in Node with Fetch and Blob.
|
|
8
10
|
The `arcane-os/modules/<filename>` and `arcane-os/entities/<filename>` paths
|
|
9
11
|
resolve directly to the existing runtime files, with their actual extension.
|
|
10
12
|
They are public Node package exports and managed browser keys, without a wrapper.
|
|
@@ -17,14 +19,20 @@ browser names such as `arcane/AIProviderRuntime`, `arcane/AIRuntimeState`, and
|
|
|
17
19
|
direct-installed root maps use the package namespace instead. Applications call `globalThis.Arcane` for capability-gated host
|
|
18
20
|
behavior.
|
|
19
21
|
|
|
20
|
-
This page
|
|
22
|
+
This page documents the focused package APIs. The same binding can appear at
|
|
23
|
+
the root and a focused subpath; those entrypoints are listed together. Direct
|
|
24
|
+
runtime-module aliases and filename patterns expose the complete namespaces in
|
|
25
|
+
the [runtime module](runtime-modules.md) and [entity](runtime-entities.md)
|
|
26
|
+
catalogs. The root workspace `discoverApps` and low-level packager
|
|
27
|
+
`discoverApps` are separate functions with separate records.
|
|
21
28
|
|
|
22
29
|
## Import map
|
|
23
30
|
|
|
24
31
|
This table is the Node `package.json#exports` map: it defines package
|
|
25
32
|
entrypoints for SDK/tooling code. It is distinct from the generated browser
|
|
26
|
-
import map that resolves application-facing `arcane/*`
|
|
27
|
-
|
|
33
|
+
import map that resolves application-facing `arcane-os/*` names for root/direct
|
|
34
|
+
layouts and `arcane/*` compatibility names for physical/nested layouts.
|
|
35
|
+
See [browser runtime delivery](protocols.md#browser-runtime-delivery)
|
|
28
36
|
for the shared browser destinations used by installed-package and physical
|
|
29
37
|
runtime layouts.
|
|
30
38
|
|
|
@@ -66,8 +74,8 @@ runtime layouts.
|
|
|
66
74
|
| `arcane-os/pwa` | Nonblocking PWA registration, worker updates, native installation state and a dismissible installation component. |
|
|
67
75
|
| `arcane-os/ai/browser-wasm` | Caller-selected browser-local Wllama inference, complete DBOPFS model storage, streaming, cancellation, and structural tool-call results. |
|
|
68
76
|
| `arcane-os/ai/tool-text-stream` | Shared selected tool-argument text observer for provider integration. |
|
|
69
|
-
| `arcane-os/ai/twin-cloud` |
|
|
70
|
-
| `arcane-os/ai/browser-speech` | Caller-selected
|
|
77
|
+
| `arcane-os/ai/twin-cloud` | Stateless chat, System One state/questions and image generation with explicit key/model, complete results and operation-specific retry/cancellation. |
|
|
78
|
+
| `arcane-os/ai/browser-speech` | Caller-selected Whisper/Kokoro, native browser recognition/synthesis, cloud TTS, upstream assets, role lifecycle and cancellation. |
|
|
71
79
|
| `arcane-os/mail` | Portable Mail runtime, durable outbox, complete transport responses, and provider-neutral acceptance contracts. |
|
|
72
80
|
|
|
73
81
|
These lowercase runtime-module entrypoints expose their existing exports; they
|
|
@@ -86,7 +94,10 @@ Eight JSON schemas and `package.json` are data-only export subpaths. In Node ESM
|
|
|
86
94
|
|
|
87
95
|
### Managed AI narration
|
|
88
96
|
|
|
89
|
-
|
|
97
|
+
Root applications import `AI` through `arcane-os/ai` in the managed browser map.
|
|
98
|
+
`ai.prepareTTSPlayback(payload,signal)` silently prepares real Blob audio or a
|
|
99
|
+
native speech descriptor for playback. Native browser voices expose no audio
|
|
100
|
+
file; use this path or shared streaming/SpeechPlayback for native output.
|
|
90
101
|
`ai.prepareTTS({parts,storage,identity,signal,onState})` prepares complete
|
|
91
102
|
punctuation segments without playing them and optionally saves/reuses their
|
|
92
103
|
audio through application-owned DBOPFS. Its immediate handle exposes ordered
|
|
@@ -111,19 +122,18 @@ Protocol mechanics are intentionally kept in the [deep protocol guide](protocols
|
|
|
111
122
|
|
|
112
123
|
## Canonical member inventory
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
graph-node count. The remaining data-only subpaths are eight JSON Schemas and
|
|
120
|
-
package metadata. Runtime projection modules in the managed
|
|
121
|
-
browser map are cataloged separately in [Runtime modules](runtime-modules.md).
|
|
125
|
+
`memberCount` in [`inventory/package-api.json`](inventory/package-api.json)
|
|
126
|
+
counts the authored focused API records below. Shared bindings retain their
|
|
127
|
+
entrypoints together. Runtime aliases and filename patterns are documented in
|
|
128
|
+
[Runtime modules](runtime-modules.md) and [Runtime entities](runtime-entities.md).
|
|
129
|
+
The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
122
130
|
|
|
123
131
|
| Member | Kind | Import | Group | Availability |
|
|
124
132
|
| --- | --- | --- | --- | --- |
|
|
125
133
|
| `fetchRequest()` | function | `arcane-os/ai/twin-cloud` | TWiN Cloud requests | Node and Browser; remote HTTPS provider |
|
|
126
134
|
| `fetchSystemOneRequest()` | function | `arcane-os/ai/twin-cloud` | TWiN Cloud state-and-questions requests | Node and Browser; remote HTTPS provider |
|
|
135
|
+
| `generateImages()` | function | `arcane-os/ai/twin-cloud` | TWiN Cloud image generation | Node and Browser with Fetch and Blob; remote HTTPS provider |
|
|
136
|
+
| `createBrowserSpeechSynthesisProvider()` | function | `arcane-os/ai/browser-speech` | Native browser speech | Browser with speechSynthesis and SpeechSynthesisUtterance |
|
|
127
137
|
| `fetchHTTPResponse()` | function | `arcane-os/ai/twin-cloud` | Shared AI transport integration | Node and Browser |
|
|
128
138
|
| `fetchJSONResponse()` | function | `arcane-os/ai/twin-cloud` | Shared AI transport integration | Node and Browser |
|
|
129
139
|
| `structuredOutputFormat()` | function | `arcane-os/ai/twin-cloud` | Shared AI transport integration | Node and Browser |
|
|
@@ -855,12 +865,14 @@ selected input, or required control paths fail before output writes. Source
|
|
|
855
865
|
layout, app identity, OPFS scope, and internal package paths remain unchanged.
|
|
856
866
|
See [app-selected package output](protocols.md#app-selected-package-output).
|
|
857
867
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
868
|
+
Root app files retain their paths at the output root; explicitly nested apps
|
|
869
|
+
retain their `apps/<id>/` paths. Shared files retain their configured route
|
|
870
|
+
destinations. When the selected content supplies no root `index.html`, the SDK
|
|
871
|
+
generates one that opens the selected app page. The result
|
|
861
872
|
contains `outputRoot`, `manifest`, and the complete `files` inventory.
|
|
862
873
|
`manifest.app.entry` stays app-relative, while `manifest.app.start`
|
|
863
|
-
is the package launch URL, such as `./
|
|
874
|
+
is the package launch URL, such as `./index.html` for a root app or
|
|
875
|
+
`./apps/hello-world/index.html` for a nested app. Release
|
|
864
876
|
schema `1`, kind `arcane-app-release`, and packager identity
|
|
865
877
|
`arcane-app-packager-v1` remain unchanged. A dry run returns the planned output
|
|
866
878
|
and file inventory without writing source or output.
|
|
@@ -1260,7 +1272,7 @@ Import it from `arcane-os`.
|
|
|
1260
1272
|
| `documentRoot` | Required filesystem directory containing the selected documents. Returned root paths are absolute. |
|
|
1261
1273
|
| `runtimeRoot` | Existing materialized runtime directory containing `modules/`, `entities/`, `sdk/`, and its other selected content. Defaults to `arcane/` under `documentRoot`. Pass an absolute path when selecting another directory; relative root arguments resolve from the current working directory. |
|
|
1262
1274
|
| `documents` | Required nonempty array of document-root-relative file paths, such as `['shell/home.html', 'settings.html']`. Use forward slashes and normalized paths without a leading `./` or parent traversal. Duplicate paths are processed once, in first-selected order. |
|
|
1263
|
-
| `version` |
|
|
1275
|
+
| `version` | Retained argument with default `SDK_VERSION`; generated local URLs stay clean and retired `arcaneVersion` fields are removed regardless of this value. Other authored query values and fragments remain unchanged. |
|
|
1264
1276
|
| `deploymentUrl` | Optional absolute directory URL ending in `/` that corresponds to `documentRoot`, such as `https://example.com/control/`. Required when a selected document has an absolute or root-relative base URL, or a relative base that traverses above `documentRoot`. |
|
|
1265
1277
|
| `signal` | Optional `AbortSignal`, observed during inventory, document preparation, and before each write. |
|
|
1266
1278
|
| `onEvent` | Optional named callback receiving the ordered events below. An asynchronous callback is awaited before the operation continues. |
|
|
@@ -1292,7 +1304,8 @@ The first `<base>` with an `href` determines each document's effective base.
|
|
|
1292
1304
|
A target-only base, such as `<base target="_blank">`, does not change URL
|
|
1293
1305
|
resolution. With no base, `shell/home.html` resolves the default runtime through
|
|
1294
1306
|
`../arcane/`. With `<base href="../">`, the same page resolves it through
|
|
1295
|
-
`./arcane/`. Generated URLs
|
|
1307
|
+
`./arcane/`. Generated local URLs stay clean regardless of the retained
|
|
1308
|
+
`version` argument.
|
|
1296
1309
|
|
|
1297
1310
|
The host serves the runtime at the same relative location as `runtimeRoot`
|
|
1298
1311
|
has to `documentRoot`. `deploymentUrl` supplies that directory's public URL
|
|
@@ -1783,14 +1796,16 @@ const schema=preferenceSchema([]);
|
|
|
1783
1796
|
|
|
1784
1797
|
Default binding for the canonical SpeechPlayback runtime class. The static
|
|
1785
1798
|
specifier `arcane-os/speech-playback` works in Node package consumers and maps
|
|
1786
|
-
to the same runtime module in managed browsers.
|
|
1787
|
-
|
|
1799
|
+
to the same runtime module in managed browsers. Physical/nested maps also
|
|
1800
|
+
retain the `arcane/SpeechPlayback` compatibility name.
|
|
1788
1801
|
|
|
1789
|
-
When the supplied `speech` client has `fetchTTS` and reports a positive
|
|
1802
|
+
When the supplied `speech` client has `prepareTTSPlayback` or `fetchTTS` and reports a positive
|
|
1790
1803
|
`providerRuntime.status('tts', {execution:true}).execution.maxConcurrentRequests`,
|
|
1791
1804
|
`prepare()` submits every complete part immediately. The provider owns its
|
|
1792
|
-
bounded FIFO queue (browser Kokoro defaults to four), while Blob
|
|
1793
|
-
playback remain in exact input order.
|
|
1805
|
+
bounded FIFO queue (browser Kokoro defaults to four), while Blob audio or native
|
|
1806
|
+
playback descriptors remain in exact input order. Preparation prefers
|
|
1807
|
+
`prepareTTSPlayback` when available. Native playback owns pause, resume, stop
|
|
1808
|
+
and release without creating an audio-file URL. A native or custom client without that
|
|
1794
1809
|
advertised capacity stays serialized with one lookahead. Replay keeps completed
|
|
1795
1810
|
URLs and pending requests while retrying failed missing provider segments.
|
|
1796
1811
|
The optional constructor `onState(detail)` callback runs synchronously after
|
|
@@ -3732,6 +3747,12 @@ negotiate HTTP/2 or HTTP/1.1 on the same HTTPS port. Explicit raw `tls` options
|
|
|
3732
3747
|
retain native HTTPS transport with the same module response and static-file
|
|
3733
3748
|
operations.
|
|
3734
3749
|
|
|
3750
|
+
Static files retain the module's complete built-in MIME map, including PDF,
|
|
3751
|
+
Markdown, audio and video. Generated representations use the same published
|
|
3752
|
+
`node-http-server/mime-types` map. Existing text charsets and the
|
|
3753
|
+
`application/octet-stream` fallback for unknown extensions remain unchanged;
|
|
3754
|
+
supported document and media types need no application override.
|
|
3755
|
+
|
|
3735
3756
|
### Signature, modes, and result
|
|
3736
3757
|
|
|
3737
3758
|
```text
|
|
@@ -4177,7 +4198,7 @@ const toolchain = createToolchain({
|
|
|
4177
4198
|
|
|
4178
4199
|
// Only this explicit call refreshes the managed map and selected HTML documents.
|
|
4179
4200
|
const result = await toolchain.importMap();
|
|
4180
|
-
console.log(result.importMap.
|
|
4201
|
+
console.log(Object.keys(result.importMap.imports).length);
|
|
4181
4202
|
console.log(result.importMap.documentPaths, result.importMap.documentCount);
|
|
4182
4203
|
```
|
|
4183
4204
|
|
|
@@ -4257,12 +4278,14 @@ async function usedevelopApplication(...arguments_) {
|
|
|
4257
4278
|
Dispatches one named headless SDK operation with normalized acceptance, events, cancellation, and failure.
|
|
4258
4279
|
|
|
4259
4280
|
The exact command `'import-map'` dispatches one app-scoped refresh
|
|
4260
|
-
across
|
|
4261
|
-
include/exclude rules
|
|
4281
|
+
across directly navigable `.html`/`.htm` documents selected by the descriptor's
|
|
4282
|
+
existing include/exclude rules, excluding component fragments, and returns
|
|
4283
|
+
`{workspaceRoot, workspaceMode, appId,
|
|
4262
4284
|
importMap}`. The `importMap` value reports the generated imports and complete
|
|
4263
4285
|
ordered `documentPaths`. This route mutates the map artifact and selected managed HTML
|
|
4264
|
-
documents
|
|
4265
|
-
|
|
4286
|
+
documents through sequential writes and has no supported dry-run or
|
|
4287
|
+
all-file transaction. An error or cancellation can leave completed writes in
|
|
4288
|
+
place; rerun the operation after resolving the cause.
|
|
4266
4289
|
|
|
4267
4290
|
The exact command `'upgrade'` dispatches `upgradeApplication(options)`. It is
|
|
4268
4291
|
external-workspace-only and runs that application's ordinary `npm upgrade`
|
|
@@ -4297,7 +4320,7 @@ const result = await executeOperation('import-map', {
|
|
|
4297
4320
|
workspaceRoot:process.cwd(),
|
|
4298
4321
|
appId:'hello-world'
|
|
4299
4322
|
});
|
|
4300
|
-
console.log(result.importMap.committed, result.importMap.
|
|
4323
|
+
console.log(result.importMap.committed, Object.keys(result.importMap.imports).length);
|
|
4301
4324
|
console.log(result.importMap.documentPaths, result.importMap.documentCount);
|
|
4302
4325
|
```
|
|
4303
4326
|
|
|
@@ -4309,8 +4332,9 @@ Runs the high-level package operation for one selected application. It reads
|
|
|
4309
4332
|
the installed SDK/runtime selection and packages the saved source and managed
|
|
4310
4333
|
import maps through `packageApp()`. Map generation remains the explicit
|
|
4311
4334
|
`arcane import-map` operation and the ordinary `arcane dev` startup refresh.
|
|
4312
|
-
|
|
4313
|
-
and root launcher
|
|
4335
|
+
Root app files retain their paths at the output root, while explicitly nested
|
|
4336
|
+
apps retain `apps/<id>/` paths alongside the shared routes and any root launcher
|
|
4337
|
+
described by `packageApp()`.
|
|
4314
4338
|
|
|
4315
4339
|
The same low-level operation resolves the app's optional `outputDirectory`;
|
|
4316
4340
|
there is no separate high-level destination override. `release.outputRoot`
|
|
@@ -6117,11 +6141,14 @@ console.log(stack.sessionId, stack.events.length);
|
|
|
6117
6141
|
|
|
6118
6142
|
Mutable metadata for the browser-only runtime behind
|
|
6119
6143
|
`arcane-os/ai/browser-wasm`. It records protocol
|
|
6120
|
-
`arcane-ai-browser-wasm/2`, `@wllama/wllama` `3.6.0`, the
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
Its execution policy
|
|
6124
|
-
`cpuFallback:false`.
|
|
6144
|
+
`arcane-ai-browser-wasm/2`, `@wllama/wllama` `3.6.0`, the packaged JavaScript
|
|
6145
|
+
and WebAssembly asset locations, MIT license identifiers for Wllama and
|
|
6146
|
+
llama.cpp, and the disabled compatibility-runtime/remote-model-helper policy.
|
|
6147
|
+
Its execution policy declares `webgpuRequired:false`,
|
|
6148
|
+
`defaultGpuLayers:99999`, `cpuGpuLayers:0`, and `cpuFallback:false`. The default
|
|
6149
|
+
requests full GPU offload; `gpuLayers:0` explicitly selects CPU. A failed GPU
|
|
6150
|
+
load never silently switches to CPU. The metadata contains no model weights
|
|
6151
|
+
or default model catalog and does not establish that a model has loaded.
|
|
6125
6152
|
|
|
6126
6153
|
### Value and import
|
|
6127
6154
|
|
|
@@ -6231,7 +6258,7 @@ applies the supplied `loadPolicy`.
|
|
|
6231
6258
|
`Promise<PersistentAIChatSession>`, and binds its AI API to this exact
|
|
6232
6259
|
controller. Applications continue to use this public controller method rather
|
|
6233
6260
|
than importing that private specifier. `options` must be a plain object and cannot contain
|
|
6234
|
-
`chat`. The resulting session preserves coherent complete live context while
|
|
6261
|
+
`ai` or `chat`. The resulting session preserves coherent complete live context while
|
|
6235
6262
|
letting each user/assistant/tool turn choose matching durable ChatEntity/DBOPFS
|
|
6236
6263
|
persistence. A `persist:false` turn participates in one request and response,
|
|
6237
6264
|
then retains neither side in subsequent model context, the transcript, durable
|
|
@@ -6643,7 +6670,7 @@ Direct `load()` selects a catalog model and returns `{model,status}`; the
|
|
|
6643
6670
|
public AI API module's `ai.load()` returns the flat controller status. Load settings include
|
|
6644
6671
|
offline mode, `AbortSignal`, progress, threads, and context/batch/micro-batch
|
|
6645
6672
|
tokens. `loadDefaults:{gpuLayers:0}` or `load({gpuLayers:0})` explicitly selects
|
|
6646
|
-
CPU. Omission
|
|
6673
|
+
CPU. Omission requests full GPU offload (`gpuLayers:99999`); GPU failures never
|
|
6647
6674
|
silently switch to CPU.
|
|
6648
6675
|
|
|
6649
6676
|
Chat supports OpenAI-like message/generation fields, tools, tool choice,
|
|
@@ -6664,18 +6691,20 @@ turn.
|
|
|
6664
6691
|
|
|
6665
6692
|
### Availability and normalization
|
|
6666
6693
|
|
|
6667
|
-
**Browser context with WebAssembly and OPFS/DBOPFS.** The default GPU route
|
|
6694
|
+
**Browser secure context with WebAssembly and OPFS/DBOPFS.** The default GPU route
|
|
6668
6695
|
also requires WebGPU; explicit `gpuLayers:0` CPU loading skips GPU requirements
|
|
6669
6696
|
and adapter work. A load succeeds after Wllama confirms the complete model is
|
|
6670
|
-
loaded. There is no automatic CPU fallback.
|
|
6697
|
+
loaded and its context was created. There is no automatic CPU fallback.
|
|
6671
6698
|
Cross-origin isolation and coarse hardware fields remain observations rather
|
|
6672
6699
|
than hard gates. Ordinary status reports complete catalog compatibility and
|
|
6673
|
-
lifecycle state.
|
|
6700
|
+
lifecycle state. `capabilities()` reports `executionDevice:'cpu'|'webgpu'` and
|
|
6701
|
+
`webgpuRequired` for the active load plan. GPU adapter selection is instrumented as
|
|
6674
6702
|
`arcane.ai.browser-wasm.webgpu.adapter.selected`.
|
|
6675
6703
|
Cancellation normalizes to `ARCANE_AI_REQUEST_ABORTED`; load or availability failures
|
|
6676
6704
|
surface stable `ARCANE_AI_*` codes such as `ARCANE_AI_WEBGPU_REQUIRED`,
|
|
6677
6705
|
`ARCANE_AI_MODEL_FULL_OFFLOAD_UNPROVEN`, and
|
|
6678
|
-
`ARCANE_AI_MODEL_GPU_MEMORY_INSUFFICIENT
|
|
6706
|
+
`ARCANE_AI_MODEL_GPU_MEMORY_INSUFFICIENT` on the GPU route, or
|
|
6707
|
+
`ARCANE_AI_MODEL_CPU_MEMORY_INSUFFICIENT` on the CPU route. Concurrent runtime inference can fail
|
|
6679
6708
|
`ARCANE_AI_RUNTIME_BUSY`; inspection and status can report
|
|
6680
6709
|
`ARCANE_AI_PROVIDER_UNAVAILABLE` or fallback `ARCANE_AI_RUNTIME_FAILED` without
|
|
6681
6710
|
misrepresenting those observations as a successful load.
|
|
@@ -6777,8 +6806,8 @@ async function openCachedModel() {
|
|
|
6777
6806
|
### Overview
|
|
6778
6807
|
|
|
6779
6808
|
Projects one compatible v1 browser-WASM provider into the provider-neutral
|
|
6780
|
-
LLM role consumed by
|
|
6781
|
-
runtime checks
|
|
6809
|
+
LLM role consumed by `arcane-os/ai-provider-runtime`. The
|
|
6810
|
+
runtime checks protocol `arcane-ai-adapter/1`, required identity/methods, and local-only
|
|
6782
6811
|
capability; it does not establish ownership for an arbitrary compatible
|
|
6783
6812
|
object. The adapter does not
|
|
6784
6813
|
change the wrapped provider, download a model, create a fallback, or execute a
|
|
@@ -6819,7 +6848,7 @@ or CPU fallback behavior.
|
|
|
6819
6848
|
|
|
6820
6849
|
```javascript
|
|
6821
6850
|
import {adaptV1LlmProvider} from 'arcane-os/ai/browser-wasm';
|
|
6822
|
-
import {getAIProviderRuntime} from 'arcane/
|
|
6851
|
+
import {getAIProviderRuntime} from 'arcane-os/ai-provider-runtime';
|
|
6823
6852
|
|
|
6824
6853
|
const runtime = getAIProviderRuntime();
|
|
6825
6854
|
const releaseProvider = runtime.register(adaptV1LlmProvider(provider));
|
|
@@ -7243,6 +7272,72 @@ async function selectNativeRecognition(ai, signal) {
|
|
|
7243
7272
|
}
|
|
7244
7273
|
```
|
|
7245
7274
|
|
|
7275
|
+
## createBrowserSpeechSynthesisProvider()
|
|
7276
|
+
|
|
7277
|
+
### Overview
|
|
7278
|
+
|
|
7279
|
+
Creates a provider/2 TTS adapter for native `speechSynthesis`. Construction,
|
|
7280
|
+
voice discovery and preparation are silent. Applications choose when to play
|
|
7281
|
+
and retain ownership of voice preferences. Browser voices may use remote
|
|
7282
|
+
services, so the provider declares `localOnly:false`.
|
|
7283
|
+
|
|
7284
|
+
### Signature and result
|
|
7285
|
+
|
|
7286
|
+
```text
|
|
7287
|
+
createBrowserSpeechSynthesisProvider({id,model,language}={})
|
|
7288
|
+
```
|
|
7289
|
+
|
|
7290
|
+
Supply `id` and `model:{id,name?,defaultVoice?}`; optional `language` is a
|
|
7291
|
+
browser language tag. The provider exposes ordinary `catalog`, `inspect`,
|
|
7292
|
+
`status`, `load`, `request`, `unload` and `dispose` methods, plus:
|
|
7293
|
+
|
|
7294
|
+
- `catalog()` returns the selected model with `speech:{playback:'native'}`
|
|
7295
|
+
and actual `voices` records `{id,name,lang,default,localService}`. Voice `id`
|
|
7296
|
+
is the browser's exact `voiceURI`.
|
|
7297
|
+
- `subscribeCatalog(callback)` immediately delivers the current catalog and
|
|
7298
|
+
observes `voiceschanged`; its returned function removes that subscription.
|
|
7299
|
+
- `setDefaultVoice(voiceURI|null)` synchronously changes the default for future
|
|
7300
|
+
preparations and returns the selected value. An empty string selects `null`.
|
|
7301
|
+
Repeating a value is silent; changing it publishes the catalog. Explicit
|
|
7302
|
+
choices and prepared, queued or active speech keep their captured voice.
|
|
7303
|
+
- `prepare({input,model?,voice?,language?,speed?},{signal?})` returns a
|
|
7304
|
+
`{kind:'native-speech',input,voice,language,speed,play}` descriptor. Preparation
|
|
7305
|
+
preserves complete text and starts no speech. `play({signal,onState})`
|
|
7306
|
+
returns an owned handle with `finished`, `released`, `pause()`, `resume()`
|
|
7307
|
+
and `stop()`, plus observable state and errors.
|
|
7308
|
+
|
|
7309
|
+
`AI.prepareTTSPlayback(payload,signal)` returns this native descriptor or real
|
|
7310
|
+
Blob audio from a speech request. Streaming TTS and `SpeechPlayback` consume
|
|
7311
|
+
those prepared results. Audio-file methods `fetchTTS` and durable `prepareTTS`
|
|
7312
|
+
require real audio and report `ARCANE_AI_TTS_AUDIO_EXPORT_UNAVAILABLE` for native output.
|
|
7313
|
+
Unload and disposal cancel owned playback and wait for native release.
|
|
7314
|
+
|
|
7315
|
+
### Availability, errors and example
|
|
7316
|
+
|
|
7317
|
+
The actual browser must provide synthesis, utterance and voice-event APIs.
|
|
7318
|
+
No SDK model, Worker, Core or DBOPFS is required. Missing native synthesis
|
|
7319
|
+
reports `ARCANE_AI_SPEECH_SYNTHESIS_UNAVAILABLE`; an unavailable selected voice
|
|
7320
|
+
reports `ARCANE_AI_SPEECH_VOICE_UNAVAILABLE`. Activation and playback remain
|
|
7321
|
+
subject to browser behavior. A resolved playback operation describes its
|
|
7322
|
+
observed native lifecycle, not proof that a person heard it.
|
|
7323
|
+
|
|
7324
|
+
```javascript
|
|
7325
|
+
import {createBrowserSpeechSynthesisProvider} from 'arcane-os/ai/browser-speech';
|
|
7326
|
+
|
|
7327
|
+
// Call from the application's speech-selection action. This stays silent.
|
|
7328
|
+
async function selectNativeVoice(ai) {
|
|
7329
|
+
const provider = createBrowserSpeechSynthesisProvider({
|
|
7330
|
+
id: 'browser-voice',
|
|
7331
|
+
model: {id: 'browser-voice'}
|
|
7332
|
+
});
|
|
7333
|
+
await ai.configureSpeechProvider('tts', provider, {modelId: 'browser-voice'});
|
|
7334
|
+
return provider;
|
|
7335
|
+
}
|
|
7336
|
+
```
|
|
7337
|
+
|
|
7338
|
+
See [native speech and voice selection](ai/browser-speech.md) for live catalogs,
|
|
7339
|
+
explicit playback, cancellation and language handling.
|
|
7340
|
+
|
|
7246
7341
|
## createTwinCloudTTSProvider()
|
|
7247
7342
|
|
|
7248
7343
|
### Overview
|
|
@@ -7285,21 +7380,22 @@ instead of clamping. Returned media is fetched without the inference key.
|
|
|
7285
7380
|
Cancelling a credential wait leaves the application's shared refresh alone
|
|
7286
7381
|
and prevents a late result from starting this cancelled operation.
|
|
7287
7382
|
|
|
7288
|
-
The
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
retry is allowed per submission or
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
network
|
|
7301
|
-
|
|
7302
|
-
|
|
7383
|
+
The whole-job queue holds each slot through credential readiness, submission,
|
|
7384
|
+
remote completion and the complete audio response. Excess jobs wait in FIFO
|
|
7385
|
+
order; cancellation removes waiting work before submission. A separate queue
|
|
7386
|
+
owns initial POST attempts and eligible retries. Follow-up status/result GETs
|
|
7387
|
+
and audio downloads retain independent configurable capacity and cadence,
|
|
7388
|
+
defaulting to four requests and 250 ms between starts. Slots remain held
|
|
7389
|
+
through complete response-body consumption.
|
|
7390
|
+
|
|
7391
|
+
Readable HTTP 429 responses set a provider-wide cooldown observed by submissions
|
|
7392
|
+
and follow-ups. One readable rate-limit retry is allowed per submission or
|
|
7393
|
+
status read, respecting its applicable minimum delay and longer `Retry-After`.
|
|
7394
|
+
An accepted job's failed status Fetch may retry once after a network failure.
|
|
7395
|
+
Ambiguous POST network, JSON or error-body failures are surfaced without
|
|
7396
|
+
replaying a potentially accepted paid job. A failed job leaves sibling jobs
|
|
7397
|
+
intact. See the [cloud speech queue contract](ai/browser-speech.md#twin-cloud-text-to-speech)
|
|
7398
|
+
for full scheduling, retry and cancellation behavior.
|
|
7303
7399
|
|
|
7304
7400
|
Each provider/2 `tts/synthesize` request returns one complete audio Blob.
|
|
7305
7401
|
Request cancellation, unload, and disposal stop local polling/downloads and
|
|
@@ -7348,7 +7444,7 @@ Accepts the same options and returns the same provider as
|
|
|
7348
7444
|
### Availability and normalization
|
|
7349
7445
|
|
|
7350
7446
|
The alias shares the canonical factory's Browser and Node requirements,
|
|
7351
|
-
|
|
7447
|
+
whole-job and submission queues, queued follow-ups, cancellation and result contract.
|
|
7352
7448
|
Existing caller imports, stored provider IDs, and credentials remain valid;
|
|
7353
7449
|
renaming a caller's import requires no saved-data migration.
|
|
7354
7450
|
|
|
@@ -7371,6 +7467,12 @@ Creates a local-only Kokoro text-to-speech provider for the provider-neutral AI
|
|
|
7371
7467
|
runtime. It owns one independent, bounded Worker/session pool and never selects
|
|
7372
7468
|
a cloud, native, or LLM fallback.
|
|
7373
7469
|
|
|
7470
|
+
An ordinary `model.voices` array supplies optional display metadata for the
|
|
7471
|
+
application's voice selector. `catalog()` retains each complete record without
|
|
7472
|
+
loading or fetching a model. This metadata neither restricts synthesis voice
|
|
7473
|
+
values nor proves playback availability. Artifact-graph voice paths remain a
|
|
7474
|
+
separate asset-routing contract.
|
|
7475
|
+
|
|
7374
7476
|
### Signature and result
|
|
7375
7477
|
|
|
7376
7478
|
```text
|
|
@@ -7906,11 +8008,15 @@ it reads no browser preference or default-model selection. Optional
|
|
|
7906
8008
|
A supplied JSON Schema sends `response_format:{type:'json_schema',
|
|
7907
8009
|
json_schema:{name:'structured_response',strict:true,schema:...}}`. Omission
|
|
7908
8010
|
leaves structured output off. Optional `tools`, `toolChoice`,
|
|
7909
|
-
`parallelToolCalls`, and `
|
|
8011
|
+
`parallelToolCalls`, `reasoningEffort`, and `temperature` map to their existing TWiN wire
|
|
7910
8012
|
fields. Tool fields are sent when `tools` is nonempty; a nonempty
|
|
7911
8013
|
`reasoningEffort` is forwarded without selecting a default. No default output
|
|
7912
8014
|
cap, tool execution, or provider-response envelope validation is added.
|
|
7913
8015
|
|
|
8016
|
+
`temperature` is forwarded unchanged when supplied, including `0`. Omission or
|
|
8017
|
+
`undefined` leaves it out of the request, preserving the provider's default.
|
|
8018
|
+
The SDK adds no clamp or saved preference, and retries retain the same value.
|
|
8019
|
+
|
|
7914
8020
|
The return value is the entire parsed provider JSON, not only one choice or
|
|
7915
8021
|
message. Optional callbacks are `onRequest(request,id,metadata)` before
|
|
7916
8022
|
dispatch and `onResponse(response,id,false)` before successful return;
|
|
@@ -8007,6 +8113,66 @@ application. The JEV identifier is an explicit caller choice, not a default.
|
|
|
8007
8113
|
See [TWiN Cloud](ai/twin-cloud.md#evaluate-caller-owned-state-with-system-one)
|
|
8008
8114
|
for the complete transport and callback contract.
|
|
8009
8115
|
|
|
8116
|
+
## generateImages()
|
|
8117
|
+
|
|
8118
|
+
### Overview
|
|
8119
|
+
|
|
8120
|
+
Generates images through TWiN Cloud with a caller-selected model and complete
|
|
8121
|
+
prompt. Returns every image as a Blob in provider order. The application owns
|
|
8122
|
+
display, filenames, storage, credentials and model choice.
|
|
8123
|
+
|
|
8124
|
+
### Signature and result
|
|
8125
|
+
|
|
8126
|
+
```text
|
|
8127
|
+
async generateImages({model,prompt,parameters={},twinKey,getApiKey,signal=null,id=Date.now(),onRequest,onResponse,onProgress}={})
|
|
8128
|
+
```
|
|
8129
|
+
|
|
8130
|
+
Supported models are `fal-ai/flux/schnell` through async invocation and
|
|
8131
|
+
`stable-diffusion-3.5-large` through image generation. `prompt` is a string;
|
|
8132
|
+
`parameters` carries the selected provider's additional fields. Supply the
|
|
8133
|
+
prompt through its named argument, and the model through `model`. An explicit
|
|
8134
|
+
`twinKey` takes precedence over `getApiKey()`; the latter may return a promise.
|
|
8135
|
+
|
|
8136
|
+
The result is `{images:[{blob,mediaType,width?,height?},...]}`. Media metadata is
|
|
8137
|
+
retained when the provider supplies it. `onRequest(request,id,metadata)` and
|
|
8138
|
+
`onResponse(result,id,false)` receive complete diagnostic records;
|
|
8139
|
+
`onProgress({stage,model,id,requestId?})` reports credentials, requesting,
|
|
8140
|
+
queued, generating, downloading and complete stages as applicable. Keep these
|
|
8141
|
+
diagnostics outside durable conversation history.
|
|
8142
|
+
|
|
8143
|
+
The operation submits once. Async jobs are polled using their returned request
|
|
8144
|
+
ID; a readable `Retry-After` controls the wait. Ambiguous submission failures
|
|
8145
|
+
are surfaced without automatic resubmission. Cancellation covers credentials,
|
|
8146
|
+
observers, requests, response bodies and media downloads; it cannot promise
|
|
8147
|
+
that an accepted remote job was cancelled. Media downloads omit the inference
|
|
8148
|
+
credential. The SDK writes no image or conversation records.
|
|
8149
|
+
|
|
8150
|
+
### Availability, errors and example
|
|
8151
|
+
|
|
8152
|
+
Node or browser with Fetch, Blob and AbortController; browser requests also
|
|
8153
|
+
depend on endpoint CORS. Missing credentials report `AI_PROVIDER_NOT_CONFIGURED`,
|
|
8154
|
+
unsupported models `ARCANE_AI_IMAGE_MODEL_UNSUPPORTED`, malformed returned
|
|
8155
|
+
media `ARCANE_AI_INVALID_PROVIDER_RESULT`, and cancellation
|
|
8156
|
+
`ARCANE_AI_REQUEST_ABORTED`. HTTP/provider failures preserve their returned
|
|
8157
|
+
detail. Call only from the application's explicit generation action:
|
|
8158
|
+
|
|
8159
|
+
```javascript
|
|
8160
|
+
import {generateImages} from 'arcane-os/ai/twin-cloud';
|
|
8161
|
+
|
|
8162
|
+
async function drawLunarGarden(twinKey, signal) {
|
|
8163
|
+
return generateImages({
|
|
8164
|
+
twinKey,
|
|
8165
|
+
model: 'fal-ai/flux/schnell',
|
|
8166
|
+
prompt: 'A moon gardener watering a single enormous radish.',
|
|
8167
|
+
signal
|
|
8168
|
+
});
|
|
8169
|
+
}
|
|
8170
|
+
```
|
|
8171
|
+
|
|
8172
|
+
See [image generation](ai/twin-cloud.md#generate-images-with-an-application-selected-model)
|
|
8173
|
+
and [MarkdownMedia](runtime-modules.md#markdownmediajs) for application-owned
|
|
8174
|
+
image storage and document references.
|
|
8175
|
+
|
|
8010
8176
|
## fetchHTTPResponse()
|
|
8011
8177
|
|
|
8012
8178
|
### Overview
|
package/docs/roadmap.md
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
# Development roadmap
|
|
2
2
|
|
|
3
|
-
The SDK
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
The SDK already provides root application scaffolding, direct npm browser
|
|
4
|
+
routes, managed import maps, live source serving, browser/PWA packaging and
|
|
5
|
+
explicit native provider pairing. This roadmap distinguishes those implemented
|
|
6
|
+
contracts from remaining development work. Future items do not select an
|
|
7
|
+
implementation, dependency, publication or deployment.
|
|
7
8
|
|
|
8
|
-
##
|
|
9
|
+
## Current delivery baseline
|
|
9
10
|
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
- SDK publication uses the existing selected-package workflow. `dev` and
|
|
12
|
+
`latest` are npm channels; `main` remains the canonical source branch. See
|
|
13
|
+
[publishing](publishing.md) for the selected-artifact procedure.
|
|
14
|
+
- License terms and commercial licensing information are already documented in
|
|
15
|
+
[LICENSE](../LICENSE), [COMMERCIAL-LICENSE.md](../COMMERCIAL-LICENSE.md) and
|
|
16
|
+
[NOTICE](../NOTICE).
|
|
17
|
+
- Standalone apps use their repository root and installed npm resources.
|
|
18
|
+
Explicit multi-app and integrated workspaces retain their selected layout.
|
|
19
|
+
- The browser path includes PWA installation, offline resource selection,
|
|
20
|
+
conditional refresh and the shared update prompt. Development and packaged
|
|
21
|
+
preview serving share the published `node-http-server` MIME map.
|
|
22
|
+
- The reusable application release workflow remains unavailable until its
|
|
23
|
+
checked-in implementation matches the documented package-and-upload contract.
|
|
24
|
+
This is separate from SDK npm publication.
|
|
18
25
|
|
|
19
|
-
##
|
|
26
|
+
## Native provider continuity
|
|
20
27
|
|
|
21
28
|
- Keep the implemented process-local `arcane-native-build-plan/1` and
|
|
22
29
|
`arcane-native-builder/1` lifecycle as the single provider seam for the CLI,
|
|
@@ -31,16 +38,11 @@ one unbounded build.
|
|
|
31
38
|
- Preserve the implemented portable, Windows x64, Linux x64, Linux ARM64, and
|
|
32
39
|
Android ARM64 providers as one selected app plus its exact declared dependency
|
|
33
40
|
closure. Add new providers without weakening that release-reader boundary.
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- Preserve
|
|
38
|
-
|
|
39
|
-
manifest file as a reusable receipt.
|
|
40
|
-
- Add a manifest-declared origin policy for native enforcement and an optional
|
|
41
|
-
policy-faithful development mode. The current capability-gated loopback host
|
|
42
|
-
deliberately uses a broad development-only policy so the shared runtime can
|
|
43
|
-
exercise remote providers, media, WebSockets, and embeds.
|
|
41
|
+
- Keep native build and launch within the paired provider's process lifecycle.
|
|
42
|
+
Persistent sessions or restartable host integration require a separately
|
|
43
|
+
selected capability and its owning host implementation.
|
|
44
|
+
- Preserve complete selected app releases through planning, build and run.
|
|
45
|
+
Explicit verification remains separate from the ordinary build/run lifecycle.
|
|
44
46
|
|
|
45
47
|
## Platform adapters
|
|
46
48
|
|
|
@@ -62,6 +64,9 @@ one unbounded build.
|
|
|
62
64
|
reproducible. The APK contains no native ABI and is architecture-neutral. Add
|
|
63
65
|
AAB, release signing, store publishing, and update continuity only as explicit
|
|
64
66
|
later promotion work.
|
|
67
|
+
- macOS: the current registry provides browser delivery and no native package
|
|
68
|
+
adapter. A native adapter remains additional platform work; shared portable
|
|
69
|
+
SDK behavior must keep its declared macOS support.
|
|
65
70
|
|
|
66
71
|
## Developer experience
|
|
67
72
|
|
|
@@ -70,8 +75,9 @@ one unbounded build.
|
|
|
70
75
|
development check, never app discovery or an arbitrary package-script loop.
|
|
71
76
|
- Add the Arcane Developer control panel as a client of the same operation API;
|
|
72
77
|
it stores local repository paths per user and never becomes a second builder.
|
|
73
|
-
- Add
|
|
74
|
-
|
|
78
|
+
- Add an Arcane-owned source-development native wrapper around the same live
|
|
79
|
+
browser surface when that capability is selected. The current native `run`
|
|
80
|
+
command packages and builds its selected app; it is a different lifecycle.
|
|
75
81
|
- Preserve the implemented integrated app-scoped native path: `--workspace` and
|
|
76
82
|
`--arcane-root` identify the same checkout, one app and one target are
|
|
77
83
|
selected, and `--output-root` remains outside the checkout. Future GUI clients
|
package/package.json
CHANGED