arcane-os 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +6 -2
- package/browser-runtime/ai/core-onnx.mjs +96 -0
- package/browser-runtime/ai/onnx-tensors.mjs +85 -0
- package/browser-runtime/core/client.mjs +151 -16
- package/docs/architecture.md +5 -2
- package/docs/platform-targets.md +30 -13
- package/docs/reference/README.md +18 -3
- package/docs/reference/availability-and-normalization.md +9 -6
- package/docs/reference/cli.md +22 -10
- package/docs/reference/core-client.md +80 -0
- package/docs/reference/core-native-packaging.md +110 -2
- package/docs/reference/core-preferences.md +49 -0
- package/docs/reference/diarization.md +206 -0
- package/docs/reference/git-text-snapshot.md +104 -0
- package/docs/reference/inventory/package-api.json +203 -21
- package/docs/reference/local-ai.md +145 -11
- package/docs/reference/protocols.md +28 -19
- package/docs/reference/pwa.md +5 -2
- package/docs/reference/sdk-api.md +448 -39
- package/package.json +11 -3
- package/schemas/arcane-app.schema.json +3 -3
- package/schemas/arcane-package.schema.json +2 -2
- package/schemas/native-build-plan.schema.json +27 -1
- package/schemas/target-adapter.schema.json +2 -0
- package/src/app-descriptor.mjs +1 -1
- package/src/cli/main.mjs +14 -4
- package/src/constants.mjs +2 -0
- package/src/core/hosts/macos/ArcaneHost.h +86 -0
- package/src/core/hosts/macos/ArcaneHost.m +455 -0
- package/src/core/hosts/macos/ArcaneLauncher.m +432 -0
- package/src/core/services/local-ai.mjs +82 -4
- package/src/core/services/packaged-web.mjs +89 -0
- package/src/core/services/preferences.mjs +201 -0
- package/src/core-classic-source.mjs +2 -2
- package/src/dev-server.mjs +2 -5
- package/src/diarization/build.mjs +35 -0
- package/src/diarization/index.mjs +432 -0
- package/src/diarization/native/CMakeLists.txt +9 -0
- package/src/diarization/native/main.cpp +269 -0
- package/src/diarization/service.mjs +129 -0
- package/src/git-text-snapshot.mjs +265 -0
- package/src/import-map.mjs +1 -0
- package/src/index.mjs +1 -0
- package/src/local-ai/config.mjs +1 -1
- package/src/local-ai/install.mjs +134 -19
- package/src/local-ai/onnx-worker.mjs +85 -0
- package/src/local-ai/onnx.mjs +368 -0
- package/src/native/macos-provider.mjs +291 -0
- package/src/native/portable-layout.mjs +10 -2
- package/src/native/portable-provider.mjs +10 -5
- package/src/native-plan.mjs +9 -1
- package/src/native-provider-loader.mjs +3 -1
- package/src/process.mjs +123 -17
- package/src/scaffold.mjs +1 -1
- package/src/targets/index.mjs +11 -1
- package/src/templates/workspace-template.mjs +6 -5
- package/src/toolchain.mjs +1 -1
|
@@ -47,16 +47,21 @@ runtime layouts.
|
|
|
47
47
|
| `arcane-os/testing` | Isolated test registration and execution. |
|
|
48
48
|
| `arcane-os/targets` | Target adapters and dispatch. |
|
|
49
49
|
| `arcane-os/native` | Native plan and builder protocol. |
|
|
50
|
-
| `arcane-os/native-provider` | SDK portable
|
|
50
|
+
| `arcane-os/native-provider` | SDK portable/Windows/macOS defaults and registered explicit checkout provider loader. |
|
|
51
51
|
| `arcane-os/native/portable-provider` | Node-only portable payload provider and explicit app-service composition; not an executable host. |
|
|
52
|
+
| `arcane-os/native/windows-provider` | Selected Windows x64 executable assembly and host-owned run/drain lifecycle. |
|
|
53
|
+
| `arcane-os/native/macos-provider` | Architecture-selected Mac application bundle composition and host-owned run/drain lifecycle. |
|
|
52
54
|
| `arcane-os/core/client` | Browser-safe Core RPC client, application facade, readiness and request cancellation. |
|
|
53
55
|
| `arcane-os/core/contracts` | Shared Core protocol, frame, method and diagnostic error contracts. |
|
|
54
56
|
| `arcane-os/core/classic-source` | Node generator for the canonical classic-script Core client projection. |
|
|
55
57
|
| `arcane-os/core/runtime` | App-neutral native Core dispatcher and service lifecycle. |
|
|
56
58
|
| `arcane-os/core/stdio` | Framed Node stdio transport with graceful runtime drain. |
|
|
57
59
|
| `arcane-os/core/host` | Node-only reusable Core host lifecycle with explicitly supplied services. |
|
|
58
|
-
| `arcane-os/core/
|
|
59
|
-
| `arcane-os/local-ai` |
|
|
60
|
+
| `arcane-os/core/packaged-web` | Core-owned packaged web listener with a persisted loopback origin and ready/failure events. |
|
|
61
|
+
| `arcane-os/core/local-ai` | Native llama.cpp, Ollama and ONNX Core service, model readiness, complete responses and owned lifecycle. See [local AI through Core](local-ai.md). |
|
|
62
|
+
| `arcane-os/local-ai` | Official runtime installation and native artifact bundling for selected llama.cpp/Ollama/ONNX requirements and NeMo libraries. |
|
|
63
|
+
| `arcane-os/local-ai/onnx` | Retained native ONNX worker sessions with explicit graph loading and complete tensor inference. |
|
|
64
|
+
| `arcane-os/ai/core-onnx` | Optional browser access to system ONNX through an existing Core connection. |
|
|
60
65
|
| `arcane-os/integrated-provider` | Fixed integrated shared-development provider. |
|
|
61
66
|
| `arcane-os/packager` | Low-level browser app packager. |
|
|
62
67
|
| `arcane-os/release-bundle` | Deterministic external release bundles. |
|
|
@@ -283,6 +288,7 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
|
283
288
|
| `runApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
284
289
|
| `runDoctor()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
|
|
285
290
|
| `runProcess()` | function | `arcane-os` | Events, processes, and testing | Node |
|
|
291
|
+
| `createGitTextSnapshot()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node with Git |
|
|
286
292
|
| `runRegisteredTests()` | function | `arcane-os` | Events, processes, and testing | Node |
|
|
287
293
|
| `runRepositoryAction()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
|
|
288
294
|
| `runTarget()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
|
|
@@ -375,6 +381,21 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
|
375
381
|
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
376
382
|
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
377
383
|
| `startCoreHost()` | function | `arcane-os/core/host` | Native Core host composition | Node with readable input and writable output streams |
|
|
384
|
+
| `readCoreLaunchContext()` | function | `arcane-os/core/host` | Native Core host composition | Node; reads explicitly selected launch JSON |
|
|
385
|
+
| `createWindowsNativeProvider()` | function | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
386
|
+
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
387
|
+
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
388
|
+
| `createMacOSNativeProvider()` | function | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
389
|
+
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
390
|
+
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
391
|
+
| `createPackagedWebService()` | function | `arcane-os/core/packaged-web` | Native packaged web serving | Node Core lifetime; actual listener readiness before navigation |
|
|
392
|
+
| `createCoreLocalAIProvider()` | function | `arcane-os/ai/core-local` | Core local AI | Browser/native WebView with an available Core connection |
|
|
393
|
+
| `createLocalAIService()` | function | `arcane-os/core/local-ai` | Core local AI | Node with selected llama.cpp/Ollama/ONNX runtimes |
|
|
394
|
+
| `createONNXRuntime()` | function | `arcane-os/local-ai/onnx` | Core local AI | Node with prepared Microsoft ONNX runtime |
|
|
395
|
+
| `createCoreONNXRuntime()` | function | `arcane-os/ai/core-onnx` | Core local AI | Browser with an available Core ONNX service |
|
|
396
|
+
| `createLocalAIService default export` | function | `arcane-os/core/local-ai` | Core local AI | Same native service factory |
|
|
397
|
+
| `ensureLocalAIRuntimes()` | function | `arcane-os/local-ai` | Core local AI | Node; selected upstream platform assets |
|
|
398
|
+
| `bundleLocalAIRuntimes()` | function | `arcane-os/local-ai` | Core local AI | Node; complete native runtime assembly |
|
|
378
399
|
| `MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
379
400
|
| `MAIL_OUTBOX_PROTOCOL` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
380
401
|
| `MAIL_OUTBOX_STATES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
@@ -2723,10 +2744,12 @@ async function useloadArcaneIntegratedProvider(...arguments_) {
|
|
|
2723
2744
|
|
|
2724
2745
|
### Overview
|
|
2725
2746
|
|
|
2726
|
-
Loads the package-owned
|
|
2727
|
-
`
|
|
2728
|
-
|
|
2729
|
-
|
|
2747
|
+
Loads the package-owned provider when `arcaneRoot` is omitted and `target` is
|
|
2748
|
+
`portable` or `windows-x64`. Portable produces a non-executable payload; Windows
|
|
2749
|
+
assembles the matching precompiled SDK host. An explicit root retains the fixed
|
|
2750
|
+
Arcane OS checkout provider route, including its errors; there is no silent
|
|
2751
|
+
fallback. Other native targets still require that root. Normal Node module
|
|
2752
|
+
resolution owns imports.
|
|
2730
2753
|
|
|
2731
2754
|
### Signature and result
|
|
2732
2755
|
|
|
@@ -4113,7 +4136,7 @@ Import it from `arcane-os`. Source mode accepts
|
|
|
4113
4136
|
`{workspaceRoot=process.cwd(), appId, mode='source', host='127.0.0.1', port=0, httpPort=0, http=false,
|
|
4114
4137
|
certPath, keyPath, tls, signal, onEvent}` and serves one validated
|
|
4115
4138
|
workspace application plus its complete SDK or integrated runtime. Packaged mode uses
|
|
4116
|
-
`{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, certPath, keyPath, tls,
|
|
4139
|
+
`{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, http=false, certPath, keyPath, tls,
|
|
4117
4140
|
signal, onEvent}` and serves the complete selected release files.
|
|
4118
4141
|
External source mode accepts both the installed-package route layout and the
|
|
4119
4142
|
existing physical runtime layout. Installed-package mode serves the configured
|
|
@@ -4128,8 +4151,8 @@ The SDK request hook returns `308` for HTTP with a `Location` pointing to the
|
|
|
4128
4151
|
actual HTTPS port while preserving the original request path and query. Both listeners
|
|
4129
4152
|
use the selected host.
|
|
4130
4153
|
|
|
4131
|
-
Source servers default to HTTPS, including
|
|
4132
|
-
|
|
4154
|
+
Source servers and packaged browser previews default to HTTPS, including
|
|
4155
|
+
localhost. The existing `https` option is accepted; `https:false` and
|
|
4133
4156
|
`tls:false` alone do not disable HTTPS. HTTPS startup reads `.arcane/dev/server-cert.pem` and
|
|
4134
4157
|
`.arcane/dev/server-key.pem` relative to `workspaceRoot` unless explicit
|
|
4135
4158
|
`certPath` and `keyPath` are supplied together; relative paths resolve from the
|
|
@@ -4141,10 +4164,15 @@ handshake; browser trust and address matching are evaluated when a client
|
|
|
4141
4164
|
connects. The CLI's `--public` selects the wildcard bind;
|
|
4142
4165
|
the API's `host` option alone changes only the bind address.
|
|
4143
4166
|
|
|
4144
|
-
Explicit `http:true` selects one HTTP content listener in source mode and skips
|
|
4167
|
+
Explicit `http:true` selects one HTTP content listener in source or packaged mode and skips
|
|
4145
4168
|
certificate loading. `port` selects that listener's port, including `0` for an
|
|
4146
|
-
available port.
|
|
4147
|
-
|
|
4169
|
+
available port. Source mode keeps the same application, runtime and generated PWA routes.
|
|
4170
|
+
Packaged mode serves the complete selected `releaseRoot`; pass the artifact's
|
|
4171
|
+
web-root directory, not its enclosing native package directory. Its declared
|
|
4172
|
+
application start path, query and fragment are preserved. A caller requiring a
|
|
4173
|
+
stable origin must reuse its selected host and port; a bind conflict rejects
|
|
4174
|
+
startup rather than silently choosing another port.
|
|
4175
|
+
`http` must be boolean; `http:true` rejects `https:true`,
|
|
4148
4176
|
explicit certificate/key paths, a `tls` value other than `undefined`, `null` or
|
|
4149
4177
|
`false`, and a nonzero `httpPort`. Browser secure-context and installation
|
|
4150
4178
|
requirements remain browser-owned; see [explicit HTTP development](cli.md#explicit-http-development).
|
|
@@ -4154,10 +4182,10 @@ The promise settles after all selected listeners are ready and resolves to
|
|
|
4154
4182
|
networkUrls, httpPort, httpOrigin, httpUrl, close, closed, lifecycle}`. `server` is the raw Node
|
|
4155
4183
|
server for application content: `Http2SecureServer` for PEM-backed HTTPS,
|
|
4156
4184
|
`https.Server` for explicit raw `tls` options, or `http.Server` for explicit
|
|
4157
|
-
HTTP
|
|
4185
|
+
HTTP mode. HTTP/2 uses Node's compatibility request/response APIs;
|
|
4158
4186
|
callers accessing the raw server must account for its native type.
|
|
4159
4187
|
`protocol` describes the URL scheme: `'https:'` for either negotiated HTTPS
|
|
4160
|
-
protocol or `'http:'` with explicit HTTP
|
|
4188
|
+
protocol or `'http:'` with explicit HTTP mode.
|
|
4161
4189
|
`url` and `cleanUrl` are the same application URL. Wildcard listeners use
|
|
4162
4190
|
`localhost` in that local URL; `host` retains the actual bound address.
|
|
4163
4191
|
`httpPort` is the actual HTTP listener port, `httpOrigin` is its HTTP origin,
|
|
@@ -5092,24 +5120,85 @@ import {registeredTestCount} from 'arcane-os';
|
|
|
5092
5120
|
console.log(registeredTestCount());
|
|
5093
5121
|
```
|
|
5094
5122
|
|
|
5123
|
+
## createGitTextSnapshot()
|
|
5124
|
+
|
|
5125
|
+
### Overview
|
|
5126
|
+
|
|
5127
|
+
Reads complete application-selected UTF-8 text from one fetched revision using
|
|
5128
|
+
a dedicated bare Git cache. It does not create or alter a working checkout.
|
|
5129
|
+
|
|
5130
|
+
### Signature, lifecycle, and result
|
|
5131
|
+
|
|
5132
|
+
```text
|
|
5133
|
+
createGitTextSnapshot({cacheDirectory,remote,ref,selectPath,onEvent,run=runProcess}={})
|
|
5134
|
+
```
|
|
5135
|
+
|
|
5136
|
+
Import from `arcane-os`. The application owns the cache location, remote, ref,
|
|
5137
|
+
path predicate and service factory. The returned `refresh({signal}={})` returns
|
|
5138
|
+
`{revision,files:[{path,content}]}` in Git tree order. Concurrent calls share work;
|
|
5139
|
+
unchanged fetched revisions reuse completed text retrieval. Caller cancellation
|
|
5140
|
+
ends only that wait. `close()`, `drain()` and `dispose()` stop acceptance and
|
|
5141
|
+
await accepted refresh/process cleanup. Errors remain observable instead of
|
|
5142
|
+
returning stale or partial success. See [Git text snapshots](git-text-snapshot.md)
|
|
5143
|
+
for complete inputs, text semantics, errors, events and Core service composition.
|
|
5144
|
+
|
|
5145
|
+
### Example
|
|
5146
|
+
|
|
5147
|
+
```js
|
|
5148
|
+
import {createGitTextSnapshot} from 'arcane-os';
|
|
5149
|
+
|
|
5150
|
+
const dispatches = createGitTextSnapshot({
|
|
5151
|
+
cacheDirectory: applicationCacheDirectory,
|
|
5152
|
+
remote: applicationRepository,
|
|
5153
|
+
ref: applicationRef,
|
|
5154
|
+
selectPath: function selectDispatch(filename) {
|
|
5155
|
+
return filename.startsWith('dispatches/') && filename.endsWith('.md');
|
|
5156
|
+
}
|
|
5157
|
+
});
|
|
5158
|
+
const snapshot = await dispatches.refresh({signal});
|
|
5159
|
+
await dispatches.close();
|
|
5160
|
+
```
|
|
5161
|
+
|
|
5095
5162
|
## runProcess()
|
|
5096
5163
|
|
|
5097
5164
|
### Overview
|
|
5098
5165
|
|
|
5099
|
-
Runs one shell-free child command with complete stdout and stderr, ordered stream
|
|
5166
|
+
Runs one shell-free child command with complete stdout and stderr, ordered stream
|
|
5167
|
+
events, heartbeats, and explicitly selected process cancellation behavior.
|
|
5100
5168
|
|
|
5101
5169
|
### Signature, parameters, and result
|
|
5102
5170
|
|
|
5103
5171
|
```text
|
|
5104
|
-
async runProcess(command, args=[], { cwd, env, signal, onEvent, heartbeatMs=5000, terminationGraceMs=DEFAULT_TERMINATION_GRACE_MS, allowNonzero=false, input }={})
|
|
5172
|
+
async runProcess(command, args=[], { cwd, env, signal, onEvent, onOutput, captureOutput=true, emitOutputEvents=true, outputEncoding='utf8', heartbeatMs=5000, terminationGraceMs=DEFAULT_TERMINATION_GRACE_MS, allowNonzero=false, input, cancellationMode='terminate-tree' }={})
|
|
5105
5173
|
```
|
|
5106
5174
|
|
|
5107
5175
|
Import it from `arcane-os`. `command` is executed directly with `shell:false`;
|
|
5108
5176
|
`args` must be a fixed array of strings, so shell expansion, pipelines, and
|
|
5109
5177
|
redirection never occur. `cwd` selects the child directory. `env` is shallowly
|
|
5110
|
-
merged over `process.env`.
|
|
5111
|
-
|
|
5112
|
-
|
|
5178
|
+
merged over `process.env`. In the default `cancellationMode:'terminate-tree'`,
|
|
5179
|
+
supplied `input` is written once and stdin is closed; otherwise stdin closes
|
|
5180
|
+
immediately. With `cancellationMode:'close-input'`, optional input is written
|
|
5181
|
+
once and stdin remains open until cancellation or a callback/input failure
|
|
5182
|
+
requests shutdown. On Microsoft NT, `npm` and `npx` are normalized to their Node
|
|
5183
|
+
CLI entrypoints.
|
|
5184
|
+
|
|
5185
|
+
An `AsyncIterable` input instead feeds stdin with awaited writes and closes it
|
|
5186
|
+
when the producer finishes. Its `return()` must cooperate with cancellation of
|
|
5187
|
+
an outstanding `next()`; the process owner drains both input and output work.
|
|
5188
|
+
`onOutput({stream,chunk})` receives complete ordered chunks and is awaited with
|
|
5189
|
+
backpressure for each stream. UTF-8 decoding retains split characters. The
|
|
5190
|
+
default capture and nonempty-line events remain unchanged; line events are not
|
|
5191
|
+
a substitute for lossless chunk delivery.
|
|
5192
|
+
|
|
5193
|
+
`captureOutput` and `emitOutputEvents` accept booleans or per-stream selections,
|
|
5194
|
+
for example `{stdout:false}` while stderr retains its default. A stream with
|
|
5195
|
+
capture disabled returns `null` and requires an `onOutput` consumer.
|
|
5196
|
+
`outputEncoding` defaults to `'utf8'`; explicitly selecting `null`, globally or
|
|
5197
|
+
per stream such as `{stdout:null}`, delivers native `Buffer` chunks unchanged.
|
|
5198
|
+
A raw stream requires capture and line events explicitly disabled for that
|
|
5199
|
+
stream plus an `onOutput` owner. It is never decoded or sent as text implicitly.
|
|
5200
|
+
Complete failed chunks, original callback failures, process diagnostics and
|
|
5201
|
+
exit results remain available through the normal error record after drain.
|
|
5113
5202
|
|
|
5114
5203
|
`onEvent` is awaited in order for `process.starting`, nonempty
|
|
5115
5204
|
`process.stdout`/`process.stderr` lines, coalesced `process.heartbeat`, and the
|
|
@@ -5129,12 +5218,21 @@ text stream preserves its complete content. A missing executable rejects with
|
|
|
5129
5218
|
and spawn/runtime failures use the normalized SDK error boundary, with the
|
|
5130
5219
|
nonzero result retained in error details.
|
|
5131
5220
|
|
|
5132
|
-
Aborting `signal` emits cancellation-requested state
|
|
5133
|
-
process tree
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5221
|
+
Aborting `signal` emits cancellation-requested state. The default mode terminates
|
|
5222
|
+
the owned process tree and escalates after the grace interval. `close-input`
|
|
5223
|
+
instead closes only the child's stdin, with no forced termination or deadline;
|
|
5224
|
+
the selected child must own EOF shutdown. This lets a native host finish
|
|
5225
|
+
accepted service work before exiting. Both paths continue observing output and
|
|
5226
|
+
drain event delivery before rejection with `ARCANE_CANCELLED` and exit code 130.
|
|
5227
|
+
An abort after the child's close event does not cancel already completed work.
|
|
5228
|
+
|
|
5229
|
+
An `onEvent` failure requests shutdown through the same selected mode. The
|
|
5230
|
+
close-input failure retains the child's complete result in `details` and
|
|
5231
|
+
additional failures in `errors`, with the original primary error as `cause`
|
|
5232
|
+
when wrapping is needed. A cancellation rejection can therefore contain a
|
|
5233
|
+
successful child exit code `0`; that is the child's drained result, distinct
|
|
5234
|
+
from the cancelled caller operation. Cancellation cannot reverse external
|
|
5235
|
+
effects already performed by the command.
|
|
5138
5236
|
|
|
5139
5237
|
### Availability and normalization
|
|
5140
5238
|
|
|
@@ -7110,17 +7208,24 @@ await transport.closed;
|
|
|
7110
7208
|
|
|
7111
7209
|
Creates the SDK-owned native builder for one portable Core payload. The caller
|
|
7112
7210
|
selects application service modules already present in the app release. The
|
|
7113
|
-
provider does not load Arcane OS source, choose a model,
|
|
7114
|
-
|
|
7211
|
+
provider does not load Arcane OS source, choose a model, compile an executable
|
|
7212
|
+
or substitute for an unavailable platform host. An explicit `native.localAI`
|
|
7213
|
+
selection prepares and bundles its selected official runtime distributions;
|
|
7214
|
+
without that selection, no local-AI runtime is downloaded.
|
|
7115
7215
|
|
|
7116
7216
|
### Signature and result
|
|
7117
7217
|
|
|
7118
7218
|
```text
|
|
7119
|
-
createPortableNativeProvider({services=
|
|
7219
|
+
createPortableNativeProvider({services,packagedWeb=false,webKitDocumentLifecycle=false}={})
|
|
7120
7220
|
```
|
|
7121
7221
|
|
|
7122
7222
|
Import it from `arcane-os/native/portable-provider`. Each service selection is
|
|
7123
|
-
`{module, options}`.
|
|
7223
|
+
`{module, options}`. Omitted `services` uses `appDescriptor.native.services`;
|
|
7224
|
+
an explicit array, including `[]`, overrides the descriptor selection.
|
|
7225
|
+
The Mac composition selects `packagedWeb:true` for the SDK-owned serving service
|
|
7226
|
+
and `webKitDocumentLifecycle:true` for the canonical client projection. Defaults
|
|
7227
|
+
retain the existing portable and Windows behavior.
|
|
7228
|
+
The returned `arcane-native-builder/1` provider exposes
|
|
7124
7229
|
`describe()`, `doctor()`, `prepare()`, `build()`, `verify()` and `run()`.
|
|
7125
7230
|
`describe()` and successful payload results report `executable:false`; `run()`
|
|
7126
7231
|
reports `ARCANE_NATIVE_RUN_UNSUPPORTED`.
|
|
@@ -7156,8 +7261,10 @@ console.log(await provider.describe());
|
|
|
7156
7261
|
|
|
7157
7262
|
### Overview
|
|
7158
7263
|
|
|
7159
|
-
Package-owned
|
|
7160
|
-
|
|
7264
|
+
Package-owned provider with no preconfigured application services. Each native
|
|
7265
|
+
provider subpath exports its own singleton and exposes that same object as its
|
|
7266
|
+
default binding. The ordinary singleton uses the app descriptor's service
|
|
7267
|
+
selection.
|
|
7161
7268
|
|
|
7162
7269
|
### Value and import
|
|
7163
7270
|
|
|
@@ -7165,13 +7272,16 @@ is the named binding for the same object exposed as this subpath's default.
|
|
|
7165
7272
|
const arcaneNativeBuilderProvider
|
|
7166
7273
|
```
|
|
7167
7274
|
|
|
7168
|
-
Import it from `arcane-os/native/portable-provider
|
|
7275
|
+
Import it from `arcane-os/native/portable-provider` for a non-executable payload,
|
|
7276
|
+
or `arcane-os/native/windows-provider` for the Windows x64 executable contract.
|
|
7169
7277
|
|
|
7170
7278
|
### Availability and normalization
|
|
7171
7279
|
|
|
7172
|
-
**Node
|
|
7173
|
-
|
|
7174
|
-
|
|
7280
|
+
**Node for assembly.** The portable singleton retains the contract described by
|
|
7281
|
+
`createPortableNativeProvider()`. The Windows singleton retains
|
|
7282
|
+
`createWindowsNativeProvider()` and needs Windows x64/WebView2 for execution.
|
|
7283
|
+
The two providers are distinct objects; named/default identity holds within
|
|
7284
|
+
each selected subpath.
|
|
7175
7285
|
|
|
7176
7286
|
### Example
|
|
7177
7287
|
|
|
@@ -7195,12 +7305,14 @@ Default package binding for the same object exposed as
|
|
|
7195
7305
|
default as arcaneNativeBuilderProvider
|
|
7196
7306
|
```
|
|
7197
7307
|
|
|
7198
|
-
Import it from `arcane-os/native/portable-provider
|
|
7308
|
+
Import it from `arcane-os/native/portable-provider` or
|
|
7309
|
+
`arcane-os/native/windows-provider`, selecting that subpath's provider.
|
|
7199
7310
|
|
|
7200
7311
|
### Availability and normalization
|
|
7201
7312
|
|
|
7202
|
-
**Node
|
|
7203
|
-
default and named bindings have exact object identity and the same
|
|
7313
|
+
**Node for assembly; execution depends on the selected provider.** Within each
|
|
7314
|
+
subpath the default and named bindings have exact object identity and the same
|
|
7315
|
+
lifecycle; portable remains a non-executable payload.
|
|
7204
7316
|
|
|
7205
7317
|
### Example
|
|
7206
7318
|
|
|
@@ -7212,6 +7324,303 @@ import portableProvider, {
|
|
|
7212
7324
|
console.log(portableProvider === arcaneNativeBuilderProvider); // true
|
|
7213
7325
|
```
|
|
7214
7326
|
|
|
7327
|
+
## createWindowsNativeProvider()
|
|
7328
|
+
|
|
7329
|
+
### Overview
|
|
7330
|
+
|
|
7331
|
+
Creates the SDK-owned Windows x64 provider. It assembles the selected app's
|
|
7332
|
+
complete portable payload with the precompiled WebView2 launcher and Node SEA
|
|
7333
|
+
Core from the numeric release matching the installed SDK version.
|
|
7334
|
+
|
|
7335
|
+
### Signature and result
|
|
7336
|
+
|
|
7337
|
+
```text
|
|
7338
|
+
createWindowsNativeProvider({services,hostDirectory}={})
|
|
7339
|
+
```
|
|
7340
|
+
|
|
7341
|
+
Import it from `arcane-os/native/windows-provider`. `services` has the same
|
|
7342
|
+
descriptor/explicit-array semantics as the portable provider. An optional
|
|
7343
|
+
`hostDirectory` selects an already-built complete host tree; otherwise `build()`
|
|
7344
|
+
downloads and extracts the matching `arcane-native-windows-x64.tar.gz` beneath
|
|
7345
|
+
the selected output root. There is no compiler or OS checkout requirement for
|
|
7346
|
+
application builds. The build machine needs its normal Node/npm toolchain and
|
|
7347
|
+
`tar`; execution needs Windows x64, .NET Framework 4.6.2 or later and WebView2.
|
|
7348
|
+
|
|
7349
|
+
The returned `arcane-native-builder/1` provider exposes `describe`, `doctor`,
|
|
7350
|
+
`prepare`, `build`, `verify` and `run`. Build returns `{app,target,manifest}`
|
|
7351
|
+
with the actual directory at `target.rootDir`. Verification reads the artifact;
|
|
7352
|
+
it does not launch the window. Run launches `Arcane.exe` and observes complete
|
|
7353
|
+
diagnostics and exit. Cancellation closes input and waits for host-owned drain,
|
|
7354
|
+
including accepted service work, without a forced termination deadline. Missing
|
|
7355
|
+
prerequisites, download/extraction failures and host failures remain observable
|
|
7356
|
+
through the operation's error/event boundary.
|
|
7357
|
+
|
|
7358
|
+
### Example
|
|
7359
|
+
|
|
7360
|
+
```javascript
|
|
7361
|
+
import {createWindowsNativeProvider} from 'arcane-os/native/windows-provider';
|
|
7362
|
+
|
|
7363
|
+
const nativeBuilder = createWindowsNativeProvider({
|
|
7364
|
+
services: [{module: 'native/moon-ledger.mjs', options: {ledgerName: 'Cheese debts'}}]
|
|
7365
|
+
});
|
|
7366
|
+
```
|
|
7367
|
+
|
|
7368
|
+
Pass `nativeBuilder` to the existing native build-plan contract. For the ordinary
|
|
7369
|
+
CLI route and the complete artifact/launch contract, see
|
|
7370
|
+
[Windows executable packaging](core-native-packaging.md#windows-executable).
|
|
7371
|
+
|
|
7372
|
+
## createMacOSNativeProvider()
|
|
7373
|
+
|
|
7374
|
+
```text
|
|
7375
|
+
createMacOSNativeProvider({services,hostDirectory}={})
|
|
7376
|
+
```
|
|
7377
|
+
|
|
7378
|
+
Import from `arcane-os/native/macos-provider`. The named
|
|
7379
|
+
`arcaneNativeBuilderProvider` and default export are the same provider with
|
|
7380
|
+
descriptor-owned services and the exact SDK release's selected host asset.
|
|
7381
|
+
The six-method `arcane-native-builder/1` contract supports `macos-arm64` and
|
|
7382
|
+
`macos-x64`, platform `macos`, format `app`. A selected `hostDirectory` allows
|
|
7383
|
+
same-project collaboration on host output; otherwise assembly downloads the
|
|
7384
|
+
matching numeric SDK release's `arcane-native-macos-<architecture>.tar.gz`.
|
|
7385
|
+
Neither an available source implementation nor `doctor()` proves that the
|
|
7386
|
+
asset is published or its Mac runtime has been executed.
|
|
7387
|
+
|
|
7388
|
+
Build preserves the complete portable payload inside the bundle's Resources
|
|
7389
|
+
directory (`target.rootDir`) and returns its `.app` location as `bundleRoot`.
|
|
7390
|
+
The bundle supplies the SDK launcher and selected Node runtime. `verify()`
|
|
7391
|
+
reads assembled files; `run()` directly launches the bundled executable only on
|
|
7392
|
+
the matching Darwin architecture, observes diagnostics and waits for graceful
|
|
7393
|
+
Core/listener drain on cancellation. See the complete
|
|
7394
|
+
[macOS composition and prerequisite contract](core-native-packaging.md#macos-application-composition).
|
|
7395
|
+
|
|
7396
|
+
## createPackagedWebService()
|
|
7397
|
+
|
|
7398
|
+
```text
|
|
7399
|
+
createPackagedWebService({artifactRoot}, context={})
|
|
7400
|
+
```
|
|
7401
|
+
|
|
7402
|
+
Import from `arcane-os/core/packaged-web`. Returns the Core service
|
|
7403
|
+
`{name:'packaged-web', start, drain}`. Start reads the native manifest, serves
|
|
7404
|
+
its complete web root with the existing explicit HTTP packaged server on
|
|
7405
|
+
`127.0.0.1`, and emits `core.web.ready` with `{origin,url,port}` only after the
|
|
7406
|
+
actual listener is ready and its first selected port is saved. The complete
|
|
7407
|
+
manifest start URL is resolved against that origin.
|
|
7408
|
+
|
|
7409
|
+
State uses `context.stateRoot` or the native launcher's separate
|
|
7410
|
+
`--arcane-host-state-root` argument. The saved `packaged-web-origin.json` keeps
|
|
7411
|
+
the same port on subsequent launches; unreadable state or port conflicts remain
|
|
7412
|
+
errors, with no silent new origin. Startup rejection belongs to the Core
|
|
7413
|
+
`core.service.state` event; an unexpected post-start close/failure emits
|
|
7414
|
+
`core.web.failed` with the complete serialized error. Drain owns listener close
|
|
7415
|
+
and lifecycle completion. No application launch payload is rewritten, no model
|
|
7416
|
+
is loaded, and the ordinary server's HTTPS default is unchanged.
|
|
7417
|
+
|
|
7418
|
+
## readCoreLaunchContext()
|
|
7419
|
+
|
|
7420
|
+
### Overview
|
|
7421
|
+
|
|
7422
|
+
Reads only the complete JSON object explicitly selected by
|
|
7423
|
+
`--arcane-launch-config <path>`; it does not search for application configuration.
|
|
7424
|
+
|
|
7425
|
+
### Signature and result
|
|
7426
|
+
|
|
7427
|
+
```text
|
|
7428
|
+
async readCoreLaunchContext({argv=process.argv.slice(2)}={})
|
|
7429
|
+
```
|
|
7430
|
+
|
|
7431
|
+
Import it from `arcane-os/core/host`. The promise resolves to `{}` when the flag
|
|
7432
|
+
is absent, or the complete parsed object when present. A missing flag value,
|
|
7433
|
+
unreadable file, malformed JSON or non-object value rejects. Relative paths use
|
|
7434
|
+
the process working directory. The reader does not rewrite content or mutate
|
|
7435
|
+
the environment.
|
|
7436
|
+
|
|
7437
|
+
```javascript
|
|
7438
|
+
import {readCoreLaunchContext} from 'arcane-os/core/host';
|
|
7439
|
+
|
|
7440
|
+
const launchContext = await readCoreLaunchContext();
|
|
7441
|
+
```
|
|
7442
|
+
|
|
7443
|
+
The generated entry supplies artifact-derived `appRoot`, then applies the whole
|
|
7444
|
+
explicit context and passes the same object as every service factory's second
|
|
7445
|
+
argument. Authored service options remain the first argument. Workspace/state
|
|
7446
|
+
locations and additional fields belong to the launcher/application. See
|
|
7447
|
+
[launch-time locations](core-native-packaging.md#launch-time-locations).
|
|
7448
|
+
|
|
7449
|
+
## createCoreLocalAIProvider()
|
|
7450
|
+
|
|
7451
|
+
### Overview
|
|
7452
|
+
|
|
7453
|
+
Creates a browser-safe llama.cpp LLM provider through an existing Core client.
|
|
7454
|
+
Construction selects no model and installs no runtime or transport.
|
|
7455
|
+
|
|
7456
|
+
### Signature and result
|
|
7457
|
+
|
|
7458
|
+
```text
|
|
7459
|
+
createCoreLocalAIProvider({client=getInstalledCoreClient(),id='llama.cpp'}={})
|
|
7460
|
+
```
|
|
7461
|
+
|
|
7462
|
+
Import it from `arcane-os/ai/core-local`. The provider implements
|
|
7463
|
+
`arcane-ai-provider/2` and exposes `catalog`, `status`, `inspect`, `load`,
|
|
7464
|
+
`request`, `unload` and `dispose`. Register it with the shared AI provider runtime,
|
|
7465
|
+
select the exact provider/model with `localOnly:true`, and load that selection.
|
|
7466
|
+
Requests wait for the requested model's actual readiness, preserve complete
|
|
7467
|
+
payloads and parsed streaming chunks, and cancel on observed readiness loss.
|
|
7468
|
+
Missing Core reports unavailability; it does not choose a browser or cloud route.
|
|
7469
|
+
Dispose/unregister at the caller's owning lifecycle boundary.
|
|
7470
|
+
|
|
7471
|
+
```javascript
|
|
7472
|
+
import {createCoreLocalAIProvider} from 'arcane-os/ai/core-local';
|
|
7473
|
+
import {getAIProviderRuntime} from 'arcane-os/ai-provider-runtime';
|
|
7474
|
+
|
|
7475
|
+
const provider = createCoreLocalAIProvider();
|
|
7476
|
+
const unregister = getAIProviderRuntime().register(provider);
|
|
7477
|
+
```
|
|
7478
|
+
|
|
7479
|
+
See [the browser provider guide](local-ai.md#browser-llamacpp-provider) for model
|
|
7480
|
+
selection, streaming, cancellation and primary-model reload behavior.
|
|
7481
|
+
|
|
7482
|
+
## createLocalAIService()
|
|
7483
|
+
|
|
7484
|
+
### Overview
|
|
7485
|
+
|
|
7486
|
+
Composes application-selected llama.cpp, Ollama and ONNX engines as a native Core
|
|
7487
|
+
service. Runtime installation, process availability and model readiness remain
|
|
7488
|
+
separate states; prompts, models and application policy remain caller-owned.
|
|
7489
|
+
|
|
7490
|
+
### Signature and result
|
|
7491
|
+
|
|
7492
|
+
```text
|
|
7493
|
+
createLocalAIService(configuration,{appRoot,runtimes=[],signal,onEvent}={})
|
|
7494
|
+
```
|
|
7495
|
+
|
|
7496
|
+
Import it from `arcane-os/core/local-ai`. `configuration` is the authored local-AI
|
|
7497
|
+
record; `appRoot` resolves its relative model paths and `runtimes` supplies
|
|
7498
|
+
resolved installed runtime records. It returns a Core service definition with
|
|
7499
|
+
`current()` and independent selected-engine startup. Compose it through the
|
|
7500
|
+
existing Core lifecycle. Shutdown cancels owned work and joins owned processes;
|
|
7501
|
+
an already running external service remains under its external owner.
|
|
7502
|
+
|
|
7503
|
+
The service provides `localai.status`, explicit `localai.services.recover`,
|
|
7504
|
+
`llama.status/models/load/unload/chat`, `onnx.status/load/run/unload`, and the documented native Ollama methods.
|
|
7505
|
+
`localai.state` reports runtime/model changes. `llama.chunk` and `ollama.chunk`
|
|
7506
|
+
carry original parsed chunks with `streamId`; terminal responses remain complete.
|
|
7507
|
+
There is no background health polling or implicit model choice.
|
|
7508
|
+
|
|
7509
|
+
```javascript
|
|
7510
|
+
import {createLocalAIService} from 'arcane-os/core/local-ai';
|
|
7511
|
+
|
|
7512
|
+
const service = createLocalAIService(application.native.localAI, {appRoot, runtimes});
|
|
7513
|
+
```
|
|
7514
|
+
|
|
7515
|
+
See [Core service configuration, results and failures](local-ai.md#core-service)
|
|
7516
|
+
and [native bundling](local-ai.md#native-bundling).
|
|
7517
|
+
|
|
7518
|
+
## createONNXRuntime()
|
|
7519
|
+
|
|
7520
|
+
`createONNXRuntime({modulePath,signal?,onEvent?})` from `arcane-os/local-ai/onnx`
|
|
7521
|
+
owns retained native ONNX sessions in workers. It exposes `load({id,model,
|
|
7522
|
+
sessionOptions?,signal?})`, `run({id,feeds,fetches?,runOptions?,signal?})`,
|
|
7523
|
+
`unload({id,signal?})`, `current()`, replaying `subscribe(listener)` and `close()`.
|
|
7524
|
+
The direct model path is absolute. Complete typed tensor records use
|
|
7525
|
+
`{type,dims,data}`; callers own the actual graph's inputs and preprocessing.
|
|
7526
|
+
|
|
7527
|
+
Models load only on explicit requests. A live session ID requires unloading
|
|
7528
|
+
before replacement. Independent sessions run concurrently; same-session work
|
|
7529
|
+
waits at that session's loading/execution boundary. Queued cancellation removes
|
|
7530
|
+
that request; active cancellation retires the affected worker and suppresses
|
|
7531
|
+
its response. Native code can delay termination; cleanup waits for actual exit.
|
|
7532
|
+
See [complete signatures, readiness, cancellation and usage](local-ai.md#native-onnx-sessions).
|
|
7533
|
+
|
|
7534
|
+
## createCoreONNXRuntime()
|
|
7535
|
+
|
|
7536
|
+
`createCoreONNXRuntime({client=getInstalledCoreClient()}={})` from
|
|
7537
|
+
`arcane-os/ai/core-onnx` accesses an available Core ONNX service. Its `load`,
|
|
7538
|
+
`run`, and `unload` mirror the native session selection and accept `signal` and
|
|
7539
|
+
`timeoutMs` (default `0`). Relative model paths resolve at Core's `appRoot`.
|
|
7540
|
+
The accessor owns complete tensor transport encoding/decoding, `inspect()`,
|
|
7541
|
+
`current()`, replaying `subscribe(listener)` and `close()`. Closing cancels this
|
|
7542
|
+
accessor's requests and subscriptions; unloading shared models is explicit.
|
|
7543
|
+
Construction installs no runtime and opens no transport. Existing browser
|
|
7544
|
+
ONNX/Wllama remain independent. See [Core and browser usage](local-ai.md#onnx-through-core-and-the-browser).
|
|
7545
|
+
|
|
7546
|
+
## createLocalAIService default export
|
|
7547
|
+
|
|
7548
|
+
The default binding from `arcane-os/core/local-ai` is exactly the named
|
|
7549
|
+
`createLocalAIService` factory above, with the same arguments, return value and
|
|
7550
|
+
lifecycle:
|
|
7551
|
+
|
|
7552
|
+
```javascript
|
|
7553
|
+
import createLocalAIService from 'arcane-os/core/local-ai';
|
|
7554
|
+
```
|
|
7555
|
+
|
|
7556
|
+
## ensureLocalAIRuntimes()
|
|
7557
|
+
|
|
7558
|
+
### Overview
|
|
7559
|
+
|
|
7560
|
+
Reuses matching managed runtimes or installs complete selected official
|
|
7561
|
+
llama.cpp/Ollama/ONNX distributions or NeMo libraries in an explicitly supplied directory.
|
|
7562
|
+
|
|
7563
|
+
### Signature and result
|
|
7564
|
+
|
|
7565
|
+
```text
|
|
7566
|
+
async ensureLocalAIRuntimes({runtimes=[],directory,platform=process.platform,architecture=process.arch,signal,onEvent}={})
|
|
7567
|
+
```
|
|
7568
|
+
|
|
7569
|
+
Import it from `arcane-os/local-ai`. Runtime requirements accept IDs or
|
|
7570
|
+
`{id,version?,url?}` records. The result is an array of absolute
|
|
7571
|
+
`{id,version,platform,architecture,root}` records, with `executable` for servers,
|
|
7572
|
+
`modulePath` for ONNX, or NeMo library directories. Matching concurrent
|
|
7573
|
+
installs share their work. Downloads retain runtime libraries and surface
|
|
7574
|
+
network/archive failures; cancellation and operation events remain observable.
|
|
7575
|
+
Installation changes no global PATH or system service and loads no model.
|
|
7576
|
+
Supported assets belong to the selected upstream distribution; see
|
|
7577
|
+
[platform and archive requirements](local-ai.md#native-bundling).
|
|
7578
|
+
|
|
7579
|
+
```javascript
|
|
7580
|
+
import {ensureLocalAIRuntimes} from 'arcane-os/local-ai';
|
|
7581
|
+
|
|
7582
|
+
// Call explicitly when the app needs its selected official runtime installed.
|
|
7583
|
+
async function prepareMoonCheeseRuntime(){
|
|
7584
|
+
return ensureLocalAIRuntimes({
|
|
7585
|
+
runtimes: ['llama.cpp'], directory: '.arcane/local-ai/runtimes'
|
|
7586
|
+
});
|
|
7587
|
+
}
|
|
7588
|
+
```
|
|
7589
|
+
|
|
7590
|
+
## bundleLocalAIRuntimes()
|
|
7591
|
+
|
|
7592
|
+
### Overview
|
|
7593
|
+
|
|
7594
|
+
Prepares selected runtimes through the same installer and copies their complete
|
|
7595
|
+
trees into one fresh native staging destination.
|
|
7596
|
+
|
|
7597
|
+
### Signature and result
|
|
7598
|
+
|
|
7599
|
+
```text
|
|
7600
|
+
async bundleLocalAIRuntimes({runtimes=[],directory,outputRoot,platform=process.platform,architecture=process.arch,signal,onEvent}={})
|
|
7601
|
+
```
|
|
7602
|
+
|
|
7603
|
+
Import it from `arcane-os/local-ai`. `directory` owns the reusable installation;
|
|
7604
|
+
`outputRoot` owns the fresh artifact. The promise resolves to `{runtimes,files}`:
|
|
7605
|
+
runtime paths are artifact-relative under `runtime/local-ai/<id>`, and `files`
|
|
7606
|
+
contains the complete emitted inventory. Existing runtime destinations are
|
|
7607
|
+
preserved and reported as a conflict. Copying settles all started work and
|
|
7608
|
+
reports failures/cancellation without executing app services or models.
|
|
7609
|
+
|
|
7610
|
+
```javascript
|
|
7611
|
+
import {bundleLocalAIRuntimes} from 'arcane-os/local-ai';
|
|
7612
|
+
|
|
7613
|
+
// Call explicitly with a fresh output directory for this native assembly.
|
|
7614
|
+
async function bundleMoonCheeseRuntime(outputRoot){
|
|
7615
|
+
return bundleLocalAIRuntimes({
|
|
7616
|
+
runtimes: ['llama.cpp'], directory: '.arcane/local-ai/runtimes', outputRoot
|
|
7617
|
+
});
|
|
7618
|
+
}
|
|
7619
|
+
```
|
|
7620
|
+
|
|
7621
|
+
The ordinary provider invokes this owner only for an explicit native local-AI
|
|
7622
|
+
selection. See [selected local-AI runtimes](core-native-packaging.md#selected-local-ai-runtimes).
|
|
7623
|
+
|
|
7215
7624
|
## startCoreHost()
|
|
7216
7625
|
|
|
7217
7626
|
### Overview
|