arcane-os 0.1.0 → 0.1.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/NOTICE +10 -0
- package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +80 -4
- package/browser-runtime/ai/ARCANE_AI_BROWSER_WASM_COMPONENTS.json +69 -0
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +1151 -0
- package/browser-runtime/ai/browser-wasm.mjs +44 -0
- package/browser-runtime/ai/browser-wllama-runtime.mjs +390 -0
- package/browser-runtime/ai/internal/sha256.mjs +166 -0
- package/browser-runtime/ai/model-controller.mjs +581 -0
- package/browser-runtime/ai/wllama/LICENCE +21 -0
- package/browser-runtime/ai/wllama/index.mjs +3494 -0
- package/browser-runtime/ai/wllama/llama.cpp-LICENSE +21 -0
- package/browser-runtime/ai/wllama/wllama.wasm +0 -0
- package/docs/publishing.md +23 -18
- package/docs/reference/README.md +9 -5
- package/docs/reference/ai/browser-wasm.md +335 -0
- package/docs/reference/availability-and-normalization.md +17 -0
- package/docs/reference/behavioral-testing.md +8 -0
- package/docs/reference/cli.md +86 -3
- package/docs/reference/event-manager.md +15 -6
- package/docs/reference/inventory/package-api.json +84 -4
- package/docs/reference/protocols.md +113 -14
- package/docs/reference/sdk-api.md +244 -11
- package/package.json +8 -5
- package/runtime/ARCANE_RUNTIME_RELEASE.json +1 -1
- package/schemas/arcane-lock.schema.json +17 -6
- package/src/dev-server.mjs +2 -1
- package/src/doctor.mjs +1 -1
- package/src/import-map.mjs +25 -1
- package/src/sdk-browser-runtime.mjs +134 -17
- package/src/templates/workspace-template.mjs +6 -0
- package/src/workspace.mjs +7 -1
|
@@ -16,7 +16,10 @@ The API is capability-first:
|
|
|
16
16
|
|
|
17
17
|
All 20 JavaScript exports are available from both `arcane-os` and
|
|
18
18
|
`arcane-os/event-manager`. The bindings are identical, so choose the focused
|
|
19
|
-
subpath when event instrumentation is the only SDK capability you need.
|
|
19
|
+
subpath when event instrumentation is the only SDK capability you need. Node
|
|
20
|
+
can resolve either package entrypoint. The generated browser map intentionally
|
|
21
|
+
exposes only the focused `arcane-os/event-manager` entry, not the Node package
|
|
22
|
+
root.
|
|
20
23
|
|
|
21
24
|
## Quick start
|
|
22
25
|
|
|
@@ -53,15 +56,21 @@ bounded, export intentionally, then call `clearHistory()`.
|
|
|
53
56
|
|
|
54
57
|
| Capability | Node | Browser renderer | Native/Core host | Remote or cloud | Normalization |
|
|
55
58
|
| --- | --- | --- | --- | --- | --- |
|
|
56
|
-
| Pub/sub, semantic instrumentation, parse/export, seek, playback | Yes | Yes, through a bundler or import map | Only when the SDK module runs in that JavaScript host | No automatic transport | Same synchronous API; optional immutable JSON-like snapshots |
|
|
59
|
+
| Pub/sub, semantic instrumentation, parse/export, seek, playback | Yes | Yes, through a bundler or the managed Arcane import map | Only when the SDK module runs in that JavaScript host | No automatic transport | Same synchronous API; optional immutable JSON-like snapshots |
|
|
57
60
|
| DOM selectors and target descriptions | With DOM-like values or a test shim | Yes | No native UI observation | No | Stable diagnostic descriptors |
|
|
58
61
|
| DOM interaction and mutation capture | No native DOM | Yes | No | No | DOM activity becomes semantic event-stack records |
|
|
59
62
|
| Event-stack schema | Yes | Yes | Data contract only | Can be transported explicitly by the developer | `arcane-event-stack/1` |
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
In an external or physical-v1 integrated workspace, the managed browser map
|
|
65
|
+
resolves `arcane-os/event-manager` to
|
|
66
|
+
`./arcane/sdk/event-manager.mjs` and its private bare dependency
|
|
67
|
+
`event-pubsub` to
|
|
68
|
+
`./arcane/sdk/dependencies/event-pubsub/index.js`. The canonical
|
|
69
|
+
integrated-legacy workspace retains its older physical routes instead. The
|
|
70
|
+
hash-pinned Arcane browser runtime does not inject this SDK-authored module into
|
|
71
|
+
Shell, Provisioner, Core, or built-in apps. There is no transparent fallback to
|
|
72
|
+
the Node package root, `arcane/1`, HTTP, WebSocket, Ollama, or a cloud event
|
|
73
|
+
service.
|
|
65
74
|
|
|
66
75
|
## Export summary
|
|
67
76
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"sdkVersion": "0.1.
|
|
3
|
+
"sdkVersion": "0.1.2",
|
|
4
4
|
"environment": {
|
|
5
|
-
"runtime": "Node.js",
|
|
6
|
-
"minimumVersion": "22.23.2",
|
|
5
|
+
"runtime": "Node.js for Node entrypoints; browser for browser-only entrypoints",
|
|
6
|
+
"minimumVersion": "22.23.2 for Node entrypoints",
|
|
7
7
|
"moduleSystem": "ESM"
|
|
8
8
|
},
|
|
9
|
-
"memberCount":
|
|
9
|
+
"memberCount": 163,
|
|
10
10
|
"members": [
|
|
11
11
|
{
|
|
12
12
|
"id": "root:APP_BUNDLE_DESCRIPTOR_NAME",
|
|
@@ -2627,6 +2627,86 @@
|
|
|
2627
2627
|
"availability": "Node; on-demand CLI or maintainer check only",
|
|
2628
2628
|
"protocol": "Approved credential-free HTTPS registry origin",
|
|
2629
2629
|
"normalization": "Returns a normalized URL object only for an exact allowed root origin"
|
|
2630
|
+
},
|
|
2631
|
+
{
|
|
2632
|
+
"id": "browser-wasm:BROWSER_WASM_RUNTIME_AUTHORITY",
|
|
2633
|
+
"name": "BROWSER_WASM_RUNTIME_AUTHORITY",
|
|
2634
|
+
"displayName": "BROWSER_WASM_RUNTIME_AUTHORITY",
|
|
2635
|
+
"kind": "constant",
|
|
2636
|
+
"signature": "const BROWSER_WASM_RUNTIME_AUTHORITY",
|
|
2637
|
+
"entrypoints": [
|
|
2638
|
+
"arcane-os/ai/browser-wasm"
|
|
2639
|
+
],
|
|
2640
|
+
"primaryImport": "arcane-os/ai/browser-wasm",
|
|
2641
|
+
"group": "Browser-WASM local AI",
|
|
2642
|
+
"summary": "Deep-frozen authority for the packaged Wllama and llama.cpp runtime, authenticated JS and WASM assets, licensing, and disabled compatibility-network policy.",
|
|
2643
|
+
"availability": "Browser metadata; import and inspection require neither DBOPFS nor a loaded model",
|
|
2644
|
+
"protocol": "arcane-ai-browser-wasm/1 over the provider-neutral arcane-ai-adapter/1 boundary",
|
|
2645
|
+
"normalization": "Exact immutable runtime and component identity; it contains no model weights or model catalog"
|
|
2646
|
+
},
|
|
2647
|
+
{
|
|
2648
|
+
"id": "browser-wasm:createArcaneAI",
|
|
2649
|
+
"name": "createArcaneAI",
|
|
2650
|
+
"displayName": "createArcaneAI()",
|
|
2651
|
+
"kind": "function",
|
|
2652
|
+
"signature": "createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand' }={})",
|
|
2653
|
+
"entrypoints": [
|
|
2654
|
+
"arcane-os/ai/browser-wasm"
|
|
2655
|
+
],
|
|
2656
|
+
"primaryImport": "arcane-os/ai/browser-wasm",
|
|
2657
|
+
"group": "Browser-WASM local AI",
|
|
2658
|
+
"summary": "Creates the provider-neutral browser AI facade and LLM lifecycle controller around one compatible provider or controller.",
|
|
2659
|
+
"availability": "Browser; the selected provider observes its own WebAssembly, storage, and model readiness",
|
|
2660
|
+
"protocol": "arcane-ai-adapter/1",
|
|
2661
|
+
"normalization": "Normalizes lazy or manual load, lifecycle status, cancellation, streaming completion, and structural tool-call visibility without executing tools"
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
"id": "browser-wasm:createBrowserModelSource",
|
|
2665
|
+
"name": "createBrowserModelSource",
|
|
2666
|
+
"displayName": "createBrowserModelSource()",
|
|
2667
|
+
"kind": "function",
|
|
2668
|
+
"signature": "createBrowserModelSource(descriptor, { fetchImpl=null }={})",
|
|
2669
|
+
"entrypoints": [
|
|
2670
|
+
"arcane-os/ai/browser-wasm"
|
|
2671
|
+
],
|
|
2672
|
+
"primaryImport": "arcane-os/ai/browser-wasm",
|
|
2673
|
+
"group": "Browser-WASM local AI",
|
|
2674
|
+
"summary": "Validates a caller-supplied immutable HTTPS model authority and creates its cancellable no-credentials download source.",
|
|
2675
|
+
"availability": "Browser with Fetch and a readable response body; each direct open call performs its configured HTTPS fetch",
|
|
2676
|
+
"protocol": "Caller-supplied exact model URL, expected byte length, SHA-256, license identifier, and source revision",
|
|
2677
|
+
"normalization": "Canonical frozen descriptor and download handle; byte integrity is verified by the model store before admission"
|
|
2678
|
+
},
|
|
2679
|
+
{
|
|
2680
|
+
"id": "browser-wasm:createBrowserWasmLlmProvider",
|
|
2681
|
+
"name": "createBrowserWasmLlmProvider",
|
|
2682
|
+
"displayName": "createBrowserWasmLlmProvider()",
|
|
2683
|
+
"kind": "function",
|
|
2684
|
+
"signature": "createBrowserWasmLlmProvider({ source, store, loadDefaults={}, logger=console }={})",
|
|
2685
|
+
"entrypoints": [
|
|
2686
|
+
"arcane-os/ai/browser-wasm"
|
|
2687
|
+
],
|
|
2688
|
+
"primaryImport": "arcane-os/ai/browser-wasm",
|
|
2689
|
+
"group": "Browser-WASM local AI",
|
|
2690
|
+
"summary": "Creates the packaged Wllama browser provider with verified model admission, serialized inference, streaming, abort, unload, and probe operations.",
|
|
2691
|
+
"availability": "Browser; WebAssembly required, WebGPU optional, and model loading requires verified DBOPFS bytes",
|
|
2692
|
+
"protocol": "arcane-ai-adapter/1 with OpenAI-like chat completion and streaming envelopes",
|
|
2693
|
+
"normalization": "Frozen lifecycle/status/capability records and structured tool-call data; the SDK never invokes application tools"
|
|
2694
|
+
},
|
|
2695
|
+
{
|
|
2696
|
+
"id": "browser-wasm:createDbopfsModelStore",
|
|
2697
|
+
"name": "createDbopfsModelStore",
|
|
2698
|
+
"displayName": "createDbopfsModelStore()",
|
|
2699
|
+
"kind": "function",
|
|
2700
|
+
"signature": "createDbopfsModelStore({ dbopfs, tableName='arcane_ai_browser_models' }={})",
|
|
2701
|
+
"entrypoints": [
|
|
2702
|
+
"arcane-os/ai/browser-wasm"
|
|
2703
|
+
],
|
|
2704
|
+
"primaryImport": "arcane-os/ai/browser-wasm",
|
|
2705
|
+
"group": "Browser-WASM local AI",
|
|
2706
|
+
"summary": "Adapts an existing DBOPFS instance into an authenticated model cache that commits metadata last and rehashes cached bytes before reuse.",
|
|
2707
|
+
"availability": "Browser with a ready DBOPFS instance and OPFS support",
|
|
2708
|
+
"protocol": "arcane.ai.browser-wasm.model.v2 completion manifests over existing DBOPFS method semantics",
|
|
2709
|
+
"normalization": "Returns verified or installed cache receipts, fail-closed offline misses, progress snapshots, and explicit removal without changing DBOPFS public names"
|
|
2630
2710
|
}
|
|
2631
2711
|
]
|
|
2632
2712
|
}
|
|
@@ -47,6 +47,14 @@ These protocols normalize orchestration and evidence. They do not normalize a
|
|
|
47
47
|
Windows EXE, Linux DEB, Android APK, and portable directory into the same
|
|
48
48
|
artifact kind.
|
|
49
49
|
|
|
50
|
+
Managed browser imports have three supported control-plane entrypoints. The CLI
|
|
51
|
+
uses `arcane import-map`; Node callers use
|
|
52
|
+
`executeOperation('import-map', options)` or
|
|
53
|
+
`createToolchain(defaults).importMap(options)`. These are three routes to the
|
|
54
|
+
same app-scoped operation, not three import-map formats. There is no exported
|
|
55
|
+
`importMapApplication()` function, `generateImportMap()` function, or
|
|
56
|
+
`arcane-os/import-map` package subpath.
|
|
57
|
+
|
|
50
58
|
## Central events and time-travel data
|
|
51
59
|
|
|
52
60
|
`arcane-os/event-manager` is host-neutral JavaScript. Its live event path is
|
|
@@ -83,18 +91,106 @@ surface, DOM privacy defaults, playback modes, and recovery behavior.
|
|
|
83
91
|
|
|
84
92
|
## Browser runtime delivery
|
|
85
93
|
|
|
86
|
-
External and integrated workspaces keep the same application URLs
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
External and modern integrated workspaces keep the same application URLs and a
|
|
95
|
+
browser-standard import map. Each selected app owns
|
|
96
|
+
`apps/<id>/modules/arcane.importmap.json`; the exact canonical JSON is also
|
|
97
|
+
embedded in its HTML entry as a managed `<script type="importmap"
|
|
98
|
+
data-arcane-import-map>`. The map follows `<base>` and precedes module scripts,
|
|
99
|
+
classic scripts, and module preloads, so application code can use stable named
|
|
100
|
+
imports such as:
|
|
90
101
|
|
|
91
102
|
```javascript
|
|
92
|
-
import ollama from '
|
|
103
|
+
import ollama from 'arcane/Ollama';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The authenticated physical-v1 tree lives entirely beneath `arcane/`. It
|
|
107
|
+
contains 155 pinned Arcane runtime files plus 18 SDK browser-runtime files:
|
|
108
|
+
173 files in all. Runtime `strong-type` 1.1 stays under
|
|
109
|
+
`arcane/dependencies/strong-type/`; the focused SDK event surface lives under
|
|
110
|
+
`arcane/sdk/`, with `event-pubsub` 6.1 and its sibling `strong-type` 2.0 under
|
|
111
|
+
`arcane/sdk/dependencies/`. This URL-key separation prevents the runtime and SDK
|
|
112
|
+
dependency versions from aliasing one another. Development serves the selected
|
|
113
|
+
app plus that authenticated tree. Packaging copies the same map, app entry, and
|
|
114
|
+
physical bytes into `dist/<id>`; targets never resolve through the consumer
|
|
115
|
+
workspace's root `node_modules/`.
|
|
116
|
+
|
|
117
|
+
In SDK `0.1.1`, the generated map has exactly 86 entries: 73 named
|
|
118
|
+
`arcane/*` modules, nine `arcane/entities/*` modules, and these four focused or
|
|
119
|
+
compatibility mappings:
|
|
120
|
+
|
|
121
|
+
| Browser specifier | Physical target |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `arcane-os/event-manager` | `./arcane/sdk/event-manager.mjs` |
|
|
124
|
+
| `arcane-os/ai/browser-wasm` | `./arcane/sdk/ai/browser-wasm.mjs` |
|
|
125
|
+
| `event-pubsub` | `./arcane/sdk/dependencies/event-pubsub/index.js` |
|
|
126
|
+
| `./node_modules/strong-type/index.js` | `./arcane/dependencies/strong-type/index.js` |
|
|
127
|
+
|
|
128
|
+
There is no `arcane-os` package-root mapping, bare `strong-type` mapping, or
|
|
129
|
+
catch-all `arcane/` prefix. Host-internal `CaseEvidenceIndexer.js` is explicitly
|
|
130
|
+
excluded; classic scripts, workers, stylesheets, and other non-ESM assets use
|
|
131
|
+
their documented URL or host loading contract rather than invented package
|
|
132
|
+
bindings.
|
|
133
|
+
|
|
134
|
+
The imported module can be pure browser logic, standard-Web-API logic, or a
|
|
135
|
+
client of `globalThis.Arcane`. Import-map resolution is not a new Arcane wire
|
|
136
|
+
protocol, Core capability, network authority, or provider fallback. Import
|
|
137
|
+
transport and host RPC remain separate layers.
|
|
138
|
+
|
|
139
|
+
The canonical integrated-legacy Arcane OS root is the documented exception. It
|
|
140
|
+
retains its physical `/arcane` and `/node_modules/strong-type` routes, returns
|
|
141
|
+
an `integrated-legacy` skip receipt, and does not create the managed map pair.
|
|
142
|
+
|
|
143
|
+
<details>
|
|
144
|
+
<summary>Refresh lifecycle and two-file commit behavior</summary>
|
|
145
|
+
|
|
146
|
+
Scaffolding (`new` and `init`) creates the map. `dev` refreshes once before
|
|
147
|
+
binding. Non-dry-run `package`, browser `build`, and paired native packaging
|
|
148
|
+
refresh before collecting source. `test`, `check`, `verify`, `bundle`, and
|
|
149
|
+
browser `run` do not refresh. Dry-run packaging/build validates an existing map
|
|
150
|
+
without rewriting it, and `import-map` itself has no supported dry-run.
|
|
151
|
+
|
|
152
|
+
Generation stages the artifact and HTML entry beside their destinations,
|
|
153
|
+
checks directory and file identity under the workspace-operation lock, and
|
|
154
|
+
uses backups to restore the prior pair after a handled pre-commit failure.
|
|
155
|
+
Success reports `committed: true` and SHA-256/byte-length records for both
|
|
156
|
+
files. Cleanup failures after commit remain warnings on the valid receipt;
|
|
157
|
+
packaging rejects them rather than publishing ambiguous state. This is a
|
|
158
|
+
bounded handled-error transaction, not a claim of one filesystem-atomic rename
|
|
159
|
+
for both files and not a durable crash journal.
|
|
160
|
+
|
|
161
|
+
No app watches, polls, downloads, or self-updates this map. An active operation's
|
|
162
|
+
heartbeat is event telemetry only and never regenerates browser state.
|
|
163
|
+
|
|
164
|
+
</details>
|
|
165
|
+
|
|
166
|
+
<details>
|
|
167
|
+
<summary>SDK browser-runtime admission and exact receipt fields</summary>
|
|
168
|
+
|
|
169
|
+
`arcane.lock.json.sdkBrowserRuntime` persists the trusted manifest path,
|
|
170
|
+
`manifestSha256`, `contentSha256`, `builder`, `sdkVersion`, and `source` record.
|
|
171
|
+
For SDK `0.1.1` those identities are:
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
manifest: node_modules/arcane-os/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json
|
|
175
|
+
manifestSha256: 33396b3d35322b784929270e7ca0a2a8b31d899c6e77bcb227edc95b37d0ae7d
|
|
176
|
+
contentSha256: 5e03f45a732db51cb5a2b2193cc79ecda34501d07a9b2e82e794e5fa37d55d00
|
|
177
|
+
builder: arcane-sdk-browser-runtime-v1
|
|
178
|
+
sdkVersion: 0.1.1
|
|
179
|
+
source.protocol: arcane-sdk-browser-runtime/1
|
|
180
|
+
source.browserEntry: arcane-os/event-manager
|
|
93
181
|
```
|
|
94
182
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
183
|
+
The `source` record also binds the `arcane-os-sdk` authority/repository and the
|
|
184
|
+
exact `event-pubsub` 6.1.0 and `strong-type` 2.0.0 package identities. Before a
|
|
185
|
+
workspace tree is admitted, the same-process verifier returns
|
|
186
|
+
`schemaVersion`, `kind`, `canonicalLocation`, `rootIdentity`, `manifestPath`,
|
|
187
|
+
`manifestSha256`, `manifestIdentity`, `builder`, `sdkVersion`, `source`,
|
|
188
|
+
`files`, `fileCount`, `totalBytes`, `contentSha256`, `identities`,
|
|
189
|
+
`sourceIdentities`, and `directories`. Those object-identity-bound verifier
|
|
190
|
+
receipts are authority inside the issuing process; reconstructing the same JSON
|
|
191
|
+
does not recreate authority.
|
|
192
|
+
|
|
193
|
+
</details>
|
|
98
194
|
|
|
99
195
|
## Arcane application protocol
|
|
100
196
|
|
|
@@ -190,7 +286,7 @@ Arcane normalizes the outer promise/error and stream lifecycle. `chatText`,
|
|
|
190
286
|
|
|
191
287
|
## Explicit cloud provider path
|
|
192
288
|
|
|
193
|
-
|
|
289
|
+
`arcane/AI` can use an explicitly selected and configured cloud
|
|
194
290
|
profile over HTTPS. That path is not Core transport fallback. The module adapts
|
|
195
291
|
the selected provider into its high-level application behavior, while provider
|
|
196
292
|
diagnostics and optional fields can remain provider-specific. Native policy and
|
|
@@ -231,11 +327,14 @@ The common contract ends where platform truth must remain different:
|
|
|
231
327
|
|
|
232
328
|
## Receipt and generation boundaries
|
|
233
329
|
|
|
234
|
-
SDK runtime, app releases,
|
|
235
|
-
identity-bound receipts.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
receipt
|
|
330
|
+
SDK runtime, app releases, import-map artifact/entry pairs, bundles, native
|
|
331
|
+
plans, providers, and artifacts use identity-bound receipts. The import-map
|
|
332
|
+
receipt binds each committed relative path, byte length, and SHA-256 in
|
|
333
|
+
addition to its exact imports, entry count, exclusions, and cleanup state. A
|
|
334
|
+
runtime or release receipt binds the exact location, filesystem identity,
|
|
335
|
+
bytes/inventory hashes, policy, toolchain, platform/architecture, signer/trust
|
|
336
|
+
result where applicable, and generation. Mutation invalidates the receipt
|
|
337
|
+
before bytes or authority change.
|
|
239
338
|
|
|
240
339
|
Process-local receipts do not authorize reuse across Shell, Core, providers, or
|
|
241
340
|
other processes. Cross-process reuse requires an authenticated shared host or
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
# Arcane OS SDK JavaScript API
|
|
2
2
|
|
|
3
|
-
The npm package exposes a Node.js ESM control plane
|
|
3
|
+
The npm package exposes a Node.js ESM control plane, the Node-and-browser
|
|
4
|
+
`arcane-os/event-manager` entrypoint, and the browser-only
|
|
5
|
+
`arcane-os/ai/browser-wasm` entrypoint. Application code otherwise uses named
|
|
6
|
+
modules from the managed browser map, such as `arcane/ThemeBootstrap`, and
|
|
7
|
+
calls `globalThis.Arcane` for capability-gated host behavior.
|
|
4
8
|
|
|
5
9
|
This page is the canonical inventory for every JavaScript name reachable through `package.json#exports`. The same binding can appear at the root and a focused subpath; those entrypoints are listed together. The root workspace `discoverApps` and the low-level packager `discoverApps` are intentionally separate records because they are different functions.
|
|
6
10
|
|
|
7
11
|
## Import map
|
|
8
12
|
|
|
13
|
+
This table is the Node `package.json#exports` map: it defines package
|
|
14
|
+
entrypoints for SDK/tooling code. It is distinct from the generated browser
|
|
15
|
+
import map that resolves application-facing `arcane/*` modules and the focused
|
|
16
|
+
EventManager entry. See [browser runtime delivery](protocols.md#browser-runtime-delivery)
|
|
17
|
+
for that 86-entry physical-runtime contract.
|
|
18
|
+
|
|
9
19
|
| Specifier | Purpose |
|
|
10
20
|
| --- | --- |
|
|
11
21
|
| `arcane-os` | Complete high-level SDK surface. |
|
|
@@ -19,6 +29,7 @@ This page is the canonical inventory for every JavaScript name reachable through
|
|
|
19
29
|
| `arcane-os/packager` | Low-level browser app packager. |
|
|
20
30
|
| `arcane-os/release-bundle` | Deterministic external release bundles. |
|
|
21
31
|
| `arcane-os/event-manager` | Central synchronous events, bounded time-travel history, playback, and optional DOM instrumentation. |
|
|
32
|
+
| `arcane-os/ai/browser-wasm` | Caller-authenticated browser-local Wllama inference, verified DBOPFS model caching, streaming, cancellation, and structural tool-call results. |
|
|
22
33
|
|
|
23
34
|
JSON schemas, the runtime manifest, and `package.json` are data-only export subpaths. In Node ESM, import JSON with `with {type: 'json'}`, or resolve and read it explicitly.
|
|
24
35
|
|
|
@@ -68,14 +79,19 @@ Protocol mechanics are intentionally kept in the [deep protocol guide](protocols
|
|
|
68
79
|
| `authenticateSharedPayloadSnapshot()` | function | `arcane-os` | Packaging and release bundles | Node |
|
|
69
80
|
| `buildApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
70
81
|
| `buildTarget()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
|
|
82
|
+
| `BROWSER_WASM_RUNTIME_AUTHORITY` | constant | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser metadata; no model or DBOPFS required to inspect |
|
|
71
83
|
| `bumpVersion()` | function | `arcane-os/packager` | Packaging and release bundles | Node |
|
|
72
84
|
| `bundleApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
73
85
|
| `checkApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
74
86
|
| `CLI_EVENT_PROTOCOL` | constant | `arcane-os` | Identity and protocol constants | Node |
|
|
75
87
|
| `CLI_NAME` | constant | `arcane-os` | Identity and protocol constants | Node |
|
|
76
88
|
| `createApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
89
|
+
| `createArcaneAI()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser; compatible LLM provider or controller required |
|
|
77
90
|
| `createAppReleaseBundle()` | function | `arcane-os` | Packaging and release bundles | Node |
|
|
91
|
+
| `createBrowserModelSource()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser Fetch with a readable response body |
|
|
92
|
+
| `createBrowserWasmLlmProvider()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser; WebAssembly and verified DBOPFS model bytes |
|
|
78
93
|
| `createCanonicalUstarHeader()` | function | `arcane-os` | Packaging and release bundles | Node |
|
|
94
|
+
| `createDbopfsModelStore()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser with a ready DBOPFS instance and OPFS |
|
|
79
95
|
| `createNativeBuildPlan()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
|
|
80
96
|
| `createNativeTargetAdapter()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
|
|
81
97
|
| `createReporter()` | function | `arcane-os` | Events, processes, and testing | Node |
|
|
@@ -2634,6 +2650,13 @@ Frozen registry of stable SDK error-code strings.
|
|
|
2634
2650
|
registry, timeout, HTTP, or response failure; caller cancellation remains the
|
|
2635
2651
|
separate `ERROR_CODES.cancelled` value.
|
|
2636
2652
|
|
|
2653
|
+
The import-map operation also reports the stable operation-specific strings
|
|
2654
|
+
`ARCANE_IMPORT_MAP_INVALID`, `ARCANE_IMPORT_MAP_UNRESOLVED`, and
|
|
2655
|
+
`ARCANE_IMPORT_MAP_COLLISION`; package assembly can additionally report
|
|
2656
|
+
`ARCANE_IMPORT_MAP_CLEANUP_FAILED`. They are normalized `ArcaneError.code`
|
|
2657
|
+
values, but are not properties added to this frozen general registry in SDK
|
|
2658
|
+
`0.1.1`.
|
|
2659
|
+
|
|
2637
2660
|
### Value and import
|
|
2638
2661
|
|
|
2639
2662
|
```text
|
|
@@ -3417,9 +3440,12 @@ async function usecreateApplication(...arguments_) {
|
|
|
3417
3440
|
|
|
3418
3441
|
Returns a frozen convenience object that applies shared defaults to every headless application operation.
|
|
3419
3442
|
|
|
3420
|
-
The object includes `
|
|
3421
|
-
|
|
3422
|
-
|
|
3443
|
+
The object includes `importMap(options)`, which merges defaults with explicit
|
|
3444
|
+
call options and performs one selected app's authenticated map refresh. The
|
|
3445
|
+
equivalent generic route is `execute('import-map', options)`. It also includes
|
|
3446
|
+
`updateCheck(options)`, which invokes `checkSdkUpdate()` once. Constructing the
|
|
3447
|
+
toolchain does not check, poll, schedule, download, install, regenerate, or
|
|
3448
|
+
mutate anything.
|
|
3423
3449
|
|
|
3424
3450
|
### Signature and result
|
|
3425
3451
|
|
|
@@ -3440,14 +3466,15 @@ import {createToolchain} from 'arcane-os';
|
|
|
3440
3466
|
|
|
3441
3467
|
const toolchain = createToolchain({
|
|
3442
3468
|
workspaceRoot: process.cwd(),
|
|
3469
|
+
appId:'hello-world',
|
|
3443
3470
|
onEvent(event) {
|
|
3444
3471
|
console.info(event.type);
|
|
3445
3472
|
}
|
|
3446
3473
|
});
|
|
3447
3474
|
|
|
3448
|
-
// Only this explicit call
|
|
3449
|
-
const
|
|
3450
|
-
console.log(
|
|
3475
|
+
// Only this explicit call refreshes the managed map and HTML entry.
|
|
3476
|
+
const result = await toolchain.importMap();
|
|
3477
|
+
console.log(result.importMap.entryCount); // 86 in SDK 0.1.1
|
|
3451
3478
|
```
|
|
3452
3479
|
|
|
3453
3480
|
## describeTargets()
|
|
@@ -3512,9 +3539,18 @@ async function usedevelopApplication(...arguments_) {
|
|
|
3512
3539
|
|
|
3513
3540
|
Dispatches one named headless SDK operation with normalized acceptance, events, cancellation, and failure.
|
|
3514
3541
|
|
|
3542
|
+
The exact command `'import-map'` dispatches one app-scoped authenticated refresh
|
|
3543
|
+
and returns `{workspaceRoot, workspaceMode, appId, importMap}`. A normal
|
|
3544
|
+
`importMap` value binds the generated imports and the committed map/HTML file
|
|
3545
|
+
hashes; the canonical integrated-legacy layout returns its documented skip
|
|
3546
|
+
record instead. This route mutates the two managed application files and has no
|
|
3547
|
+
supported dry-run.
|
|
3548
|
+
|
|
3515
3549
|
The exact command `'update-check'` dispatches one `checkSdkUpdate(options)`
|
|
3516
|
-
call. Dispatch never installs a recurring task
|
|
3517
|
-
to check for updates implicitly.
|
|
3550
|
+
call. Dispatch never installs a recurring task, polls application state, or
|
|
3551
|
+
causes another command to check for updates implicitly. There is no exported
|
|
3552
|
+
`importMapApplication()` or `generateImportMap()` binding and no
|
|
3553
|
+
`arcane-os/import-map` package subpath.
|
|
3518
3554
|
|
|
3519
3555
|
### Signature and result
|
|
3520
3556
|
|
|
@@ -3533,8 +3569,11 @@ Import it from `arcane-os` or `arcane-os/toolchain`. The signature above states
|
|
|
3533
3569
|
```javascript
|
|
3534
3570
|
import {executeOperation} from 'arcane-os';
|
|
3535
3571
|
|
|
3536
|
-
const result = await executeOperation('
|
|
3537
|
-
|
|
3572
|
+
const result = await executeOperation('import-map', {
|
|
3573
|
+
workspaceRoot:process.cwd(),
|
|
3574
|
+
appId:'hello-world'
|
|
3575
|
+
});
|
|
3576
|
+
console.log(result.importMap.committed, result.importMap.entryCount);
|
|
3538
3577
|
```
|
|
3539
3578
|
|
|
3540
3579
|
## packageApplication()
|
|
@@ -4896,6 +4935,200 @@ const stack = parseEventStack(serialized);
|
|
|
4896
4935
|
console.log(stack.sessionId, stack.events.length);
|
|
4897
4936
|
```
|
|
4898
4937
|
|
|
4938
|
+
## BROWSER_WASM_RUNTIME_AUTHORITY
|
|
4939
|
+
|
|
4940
|
+
### Overview
|
|
4941
|
+
|
|
4942
|
+
Deep-frozen authority for the browser-only runtime behind
|
|
4943
|
+
`arcane-os/ai/browser-wasm`. It records protocol
|
|
4944
|
+
`arcane-ai-browser-wasm/1`, `@wllama/wllama` `3.6.0`, the embedded llama.cpp
|
|
4945
|
+
revision, the exact packaged JavaScript and WebAssembly assets, retained MIT
|
|
4946
|
+
licenses, and the disabled compatibility-runtime/remote-model-helper policy.
|
|
4947
|
+
It contains no model weights or model catalog.
|
|
4948
|
+
|
|
4949
|
+
### Value and import
|
|
4950
|
+
|
|
4951
|
+
```text
|
|
4952
|
+
const BROWSER_WASM_RUNTIME_AUTHORITY
|
|
4953
|
+
```
|
|
4954
|
+
|
|
4955
|
+
The value is available from `arcane-os/ai/browser-wasm` only. Importing and
|
|
4956
|
+
inspecting it does not initialize Wllama, request storage, or download a model.
|
|
4957
|
+
|
|
4958
|
+
### Availability and normalization
|
|
4959
|
+
|
|
4960
|
+
**Browser metadata.** This is an immutable component receipt, not a provider,
|
|
4961
|
+
model, browser-permission grant, or proof that WebAssembly/OPFS is available.
|
|
4962
|
+
|
|
4963
|
+
### Example
|
|
4964
|
+
|
|
4965
|
+
```javascript
|
|
4966
|
+
import {BROWSER_WASM_RUNTIME_AUTHORITY} from 'arcane-os/ai/browser-wasm';
|
|
4967
|
+
|
|
4968
|
+
console.log(BROWSER_WASM_RUNTIME_AUTHORITY.protocol);
|
|
4969
|
+
console.log(BROWSER_WASM_RUNTIME_AUTHORITY.package.version);
|
|
4970
|
+
```
|
|
4971
|
+
|
|
4972
|
+
Complete lifecycle, model authority, cache, cancellation, and tool behavior:
|
|
4973
|
+
[Browser-WASM local AI](ai/browser-wasm.md).
|
|
4974
|
+
|
|
4975
|
+
## createArcaneAI()
|
|
4976
|
+
|
|
4977
|
+
### Overview
|
|
4978
|
+
|
|
4979
|
+
Creates the application-facing LLM facade around a compatible provider or
|
|
4980
|
+
controller. The default `on-demand` policy loads before first use; `manual`
|
|
4981
|
+
requires an explicit successful `load()` before requests. When both `llm` and
|
|
4982
|
+
`provider` are supplied, `llm` takes precedence.
|
|
4983
|
+
|
|
4984
|
+
### Signature and result
|
|
4985
|
+
|
|
4986
|
+
```text
|
|
4987
|
+
createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand' }={})
|
|
4988
|
+
```
|
|
4989
|
+
|
|
4990
|
+
At least one `llm` or `provider` is required. The frozen facade contains
|
|
4991
|
+
`llm`, `runtime`, `status`, `load`, `unload`, `probe`, `fetchRequest`,
|
|
4992
|
+
`streamRequest`, and `dispose`. `status()` returns `{llm: status}`; lifecycle
|
|
4993
|
+
methods return the flat LLM status. `fetchRequest()` returns the completion.
|
|
4994
|
+
`streamRequest()` consumes streaming and returns text or a tool-name-to-JSON-
|
|
4995
|
+
argument-string record. Use `ai.llm.stream()` for the async iterator.
|
|
4996
|
+
|
|
4997
|
+
### Availability and normalization
|
|
4998
|
+
|
|
4999
|
+
**Browser.** It normalizes lifecycle, state/progress events, lazy/manual use,
|
|
5000
|
+
cancellation, completions, and structural tool-call visibility. It neither
|
|
5001
|
+
selects a provider fallback nor executes an application tool.
|
|
5002
|
+
|
|
5003
|
+
### Example
|
|
5004
|
+
|
|
5005
|
+
```javascript
|
|
5006
|
+
const ai = createArcaneAI({provider, loadPolicy:'manual'});
|
|
5007
|
+
const stop = ai.llm.on('progress', event => renderProgress(event.detail));
|
|
5008
|
+
await ai.load({offline:true});
|
|
5009
|
+
stop();
|
|
5010
|
+
```
|
|
5011
|
+
|
|
5012
|
+
## createBrowserModelSource()
|
|
5013
|
+
|
|
5014
|
+
### Overview
|
|
5015
|
+
|
|
5016
|
+
Validates a caller-owned model descriptor and creates the cancellable HTTPS
|
|
5017
|
+
source accepted by the browser-WASM store/provider. Required fields are `id`,
|
|
5018
|
+
`name`, `immutableUrl`, `bytes`, `sha256`, `licenseSpdx`, and
|
|
5019
|
+
`sourceRevision`. `bytes` is the expected positive safe-integer byte length,
|
|
5020
|
+
not inline data.
|
|
5021
|
+
|
|
5022
|
+
### Signature and result
|
|
5023
|
+
|
|
5024
|
+
```text
|
|
5025
|
+
createBrowserModelSource(descriptor, { fetchImpl=null }={})
|
|
5026
|
+
```
|
|
5027
|
+
|
|
5028
|
+
The URL must be absolute HTTPS with no credentials or fragment and no
|
|
5029
|
+
revision-floating `main`, `master`, or `latest` path. The SHA-256 value is
|
|
5030
|
+
exactly 64 hexadecimal characters. The frozen source exposes its canonical
|
|
5031
|
+
descriptor and `open({signal})`, which returns `{body, requestedUrl, finalUrl,
|
|
5032
|
+
cancel}`. Every direct `open()` performs the configured fetch. The SDK records
|
|
5033
|
+
but does not independently prove the supplied license identifier or revision.
|
|
5034
|
+
|
|
5035
|
+
### Availability and normalization
|
|
5036
|
+
|
|
5037
|
+
**Browser Fetch with CORS and a readable response body.** Downloads omit
|
|
5038
|
+
credentials/referrer, disable HTTP caching, follow redirects, require a final
|
|
5039
|
+
HTTPS URL, compare `Content-Length` when present, and honor `AbortSignal`.
|
|
5040
|
+
Actual length and digest admission belongs to the DBOPFS store.
|
|
5041
|
+
|
|
5042
|
+
### Example
|
|
5043
|
+
|
|
5044
|
+
```javascript
|
|
5045
|
+
const source = createBrowserModelSource({
|
|
5046
|
+
id:'reviewed-model',
|
|
5047
|
+
name:'model-q4.gguf',
|
|
5048
|
+
immutableUrl:'https://models.example/revisions/4f7c/model-q4.gguf',
|
|
5049
|
+
bytes:123456789,
|
|
5050
|
+
sha256:'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
|
|
5051
|
+
licenseSpdx:'Apache-2.0',
|
|
5052
|
+
sourceRevision:'4f7c'
|
|
5053
|
+
});
|
|
5054
|
+
```
|
|
5055
|
+
|
|
5056
|
+
## createBrowserWasmLlmProvider()
|
|
5057
|
+
|
|
5058
|
+
### Overview
|
|
5059
|
+
|
|
5060
|
+
Creates the packaged Wllama provider from genuine source and store objects
|
|
5061
|
+
created by this module. It serializes requests and exposes provider states
|
|
5062
|
+
`unloaded`, `loading`, `ready`, `unloading`, and `error`.
|
|
5063
|
+
|
|
5064
|
+
### Signature and result
|
|
5065
|
+
|
|
5066
|
+
```text
|
|
5067
|
+
createBrowserWasmLlmProvider({ source, store, loadDefaults={}, logger=console }={})
|
|
5068
|
+
```
|
|
5069
|
+
|
|
5070
|
+
The frozen provider exposes `protocol`, `id`, `model`, `capabilities`,
|
|
5071
|
+
`status`, `load`, `unload`, `chat`, `stream`, `streamChat`, `use`, `probe`, and
|
|
5072
|
+
`dispose`. Load settings include offline mode, `AbortSignal`, progress,
|
|
5073
|
+
threads, context/batch/micro-batch tokens, and GPU layers. Chat supports
|
|
5074
|
+
OpenAI-like message/generation fields, tools, tool choice, parallel tool-call
|
|
5075
|
+
preference, and JSON/JSON-Schema structured output. `stream()` returns a frozen
|
|
5076
|
+
async iterator with `result` and `cancel(reason)`.
|
|
5077
|
+
|
|
5078
|
+
### Availability and normalization
|
|
5079
|
+
|
|
5080
|
+
**Browser with WebAssembly and a verified DBOPFS model.** WebGPU and
|
|
5081
|
+
cross-origin isolation are capability observations, not promised gates.
|
|
5082
|
+
Returned tools are validated structural data; the SDK never calls a handler.
|
|
5083
|
+
Cancellation normalizes to `ARCANE_AI_REQUEST_ABORTED`.
|
|
5084
|
+
|
|
5085
|
+
### Example
|
|
5086
|
+
|
|
5087
|
+
```javascript
|
|
5088
|
+
const provider = createBrowserWasmLlmProvider({
|
|
5089
|
+
source,
|
|
5090
|
+
store,
|
|
5091
|
+
loadDefaults:{threads:1, contextTokens:4096, gpuLayers:0}
|
|
5092
|
+
});
|
|
5093
|
+
console.log(provider.status().state); // unloaded
|
|
5094
|
+
```
|
|
5095
|
+
|
|
5096
|
+
## createDbopfsModelStore()
|
|
5097
|
+
|
|
5098
|
+
### Overview
|
|
5099
|
+
|
|
5100
|
+
Adapts an existing DBOPFS instance into an authenticated model cache without
|
|
5101
|
+
renaming its public methods. The adapter commits model bytes before the
|
|
5102
|
+
`arcane.ai.browser-wasm.model.v2` completion manifest and then reopens and
|
|
5103
|
+
rehashes the stored file.
|
|
5104
|
+
|
|
5105
|
+
### Signature and result
|
|
5106
|
+
|
|
5107
|
+
```text
|
|
5108
|
+
createDbopfsModelStore({ dbopfs, tableName='arcane_ai_browser_models' }={})
|
|
5109
|
+
```
|
|
5110
|
+
|
|
5111
|
+
The frozen result contains `kind`, `tableName`, the original `adapter`, and
|
|
5112
|
+
`ready`, `openVerified`, `install`, `ensure`, and `remove`. `ensure()` returns
|
|
5113
|
+
`{file, manifest, cache:'verified'|'installed'}`. Every cache reuse rehashes the
|
|
5114
|
+
actual bytes. `offline:true` never downloads and rejects a miss with
|
|
5115
|
+
`ARCANE_AI_MODEL_OFFLINE_MISS`. Invalid cache records are removed fail closed.
|
|
5116
|
+
|
|
5117
|
+
### Availability and normalization
|
|
5118
|
+
|
|
5119
|
+
**Browser with a ready DBOPFS instance and OPFS.** The cache is local integrity
|
|
5120
|
+
evidence, not a transferable capability or license proof. Unload/dispose keep
|
|
5121
|
+
the cache; `store.remove(source)` explicitly deletes it.
|
|
5122
|
+
|
|
5123
|
+
### Example
|
|
5124
|
+
|
|
5125
|
+
```javascript
|
|
5126
|
+
const store = createDbopfsModelStore({dbopfs});
|
|
5127
|
+
await store.ready();
|
|
5128
|
+
const cached = await store.openVerified(source);
|
|
5129
|
+
console.log(cached ? 'verified cache' : 'cache miss');
|
|
5130
|
+
```
|
|
5131
|
+
|
|
4899
5132
|
## Data export subpaths
|
|
4900
5133
|
|
|
4901
5134
|
The package also exposes the exact runtime manifest, eight JSON Schemas (including `arcane-os/schemas/event-stack.json`), and its package manifest. These are data contracts, not callable JavaScript members. See [schema and manifest contracts](../architecture.md) and the files under `schemas/`.
|