arcane-os 0.57.0 → 0.59.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 +37 -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 +152 -17
- package/docs/architecture.md +5 -2
- package/docs/platform-targets.md +30 -13
- package/docs/reference/README.md +22 -3
- package/docs/reference/availability-and-normalization.md +14 -7
- package/docs/reference/cli.md +22 -10
- package/docs/reference/core-client.md +87 -0
- package/docs/reference/core-native-packaging.md +129 -9
- 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 +205 -23
- package/docs/reference/local-ai.md +145 -11
- package/docs/reference/protocols.md +28 -19
- package/docs/reference/pwa.md +74 -4
- package/docs/reference/sdk-api.md +589 -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/host.mjs +14 -5
- 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/hosts/windows/ArcaneLauncher.cs +4 -1
- 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 +9 -4
- 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 +42 -13
|
@@ -47,16 +47,25 @@ 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/
|
|
60
|
+
| `arcane-os/core/packaged-web` | Core-owned packaged web listener with a persisted loopback origin and ready/failure events. |
|
|
61
|
+
| `arcane-os/core/preferences` | Existing preference RPC methods with an application-selected file, ordered writes and owned drain. |
|
|
62
|
+
| `arcane-os/core/diarization` | Lazy native speaker-diarization service, explicit stream methods and lifecycle/result events. |
|
|
63
|
+
| `arcane-os/diarization` | Retained Nemotron model helper and independent caller-fed audio streams. |
|
|
64
|
+
| `arcane-os/diarization/build` | First-party helper compilation against explicitly installed NeMo-Speech.cpp libraries. |
|
|
65
|
+
| `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). |
|
|
66
|
+
| `arcane-os/local-ai` | Official runtime installation and native artifact bundling for selected llama.cpp/Ollama/ONNX requirements and NeMo libraries. |
|
|
67
|
+
| `arcane-os/local-ai/onnx` | Retained native ONNX worker sessions with explicit graph loading and complete tensor inference. |
|
|
68
|
+
| `arcane-os/ai/core-onnx` | Optional browser access to system ONNX through an existing Core connection. |
|
|
60
69
|
| `arcane-os/integrated-provider` | Fixed integrated shared-development provider. |
|
|
61
70
|
| `arcane-os/packager` | Low-level browser app packager. |
|
|
62
71
|
| `arcane-os/release-bundle` | Deterministic external release bundles. |
|
|
@@ -283,6 +292,7 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
|
283
292
|
| `runApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
|
|
284
293
|
| `runDoctor()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
|
|
285
294
|
| `runProcess()` | function | `arcane-os` | Events, processes, and testing | Node |
|
|
295
|
+
| `createGitTextSnapshot()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node with Git |
|
|
286
296
|
| `runRegisteredTests()` | function | `arcane-os` | Events, processes, and testing | Node |
|
|
287
297
|
| `runRepositoryAction()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
|
|
288
298
|
| `runTarget()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
|
|
@@ -375,6 +385,27 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
|
375
385
|
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
376
386
|
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
377
387
|
| `startCoreHost()` | function | `arcane-os/core/host` | Native Core host composition | Node with readable input and writable output streams |
|
|
388
|
+
| `readCoreLaunchContext()` | function | `arcane-os/core/host` | Native Core host composition | Node; reads explicitly selected launch JSON |
|
|
389
|
+
| `createWindowsNativeProvider()` | function | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
390
|
+
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
391
|
+
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/windows-provider` | Windows native provider | Node assembly; Windows x64/WebView2 execution |
|
|
392
|
+
| `createMacOSNativeProvider()` | function | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
393
|
+
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
394
|
+
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/macos-provider` | macOS native provider | Node assembly; matching Darwin architecture and selected host asset |
|
|
395
|
+
| `createPackagedWebService()` | function | `arcane-os/core/packaged-web` | Native packaged web serving | Node Core lifetime; actual listener readiness before navigation |
|
|
396
|
+
| `createPreferencesService()` | function | `arcane-os/core/preferences` | Core preference persistence | Node Core runtime with an application-selected file |
|
|
397
|
+
| `createPreferencesService default export` | function | `arcane-os/core/preferences` | Core preference persistence | Same Core service factory |
|
|
398
|
+
| `createDiarization()` | function | `arcane-os/diarization` | Native speaker diarization | Node with a built helper, selected NeMo libraries and caller-selected model |
|
|
399
|
+
| `buildDiarizationHelper()` | function | `arcane-os/diarization/build` | Native speaker diarization | Node with installed CMake/C++17 toolchain and selected runtime |
|
|
400
|
+
| `createDiarizationService()` | function | `arcane-os/core/diarization` | Native speaker diarization | Node Core runtime with explicitly selected helper, runtime and model |
|
|
401
|
+
| `createDiarizationService default export` | function | `arcane-os/core/diarization` | Native speaker diarization | Same Core service factory |
|
|
402
|
+
| `createCoreLocalAIProvider()` | function | `arcane-os/ai/core-local` | Core local AI | Browser/native WebView with an available Core connection |
|
|
403
|
+
| `createLocalAIService()` | function | `arcane-os/core/local-ai` | Core local AI | Node with selected llama.cpp/Ollama/ONNX runtimes |
|
|
404
|
+
| `createONNXRuntime()` | function | `arcane-os/local-ai/onnx` | Core local AI | Node with prepared Microsoft ONNX runtime |
|
|
405
|
+
| `createCoreONNXRuntime()` | function | `arcane-os/ai/core-onnx` | Core local AI | Browser with an available Core ONNX service |
|
|
406
|
+
| `createLocalAIService default export` | function | `arcane-os/core/local-ai` | Core local AI | Same native service factory |
|
|
407
|
+
| `ensureLocalAIRuntimes()` | function | `arcane-os/local-ai` | Core local AI | Node; selected upstream platform assets |
|
|
408
|
+
| `bundleLocalAIRuntimes()` | function | `arcane-os/local-ai` | Core local AI | Node; complete native runtime assembly |
|
|
378
409
|
| `MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
379
410
|
| `MAIL_OUTBOX_PROTOCOL` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
380
411
|
| `MAIL_OUTBOX_STATES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
@@ -2723,10 +2754,12 @@ async function useloadArcaneIntegratedProvider(...arguments_) {
|
|
|
2723
2754
|
|
|
2724
2755
|
### Overview
|
|
2725
2756
|
|
|
2726
|
-
Loads the package-owned
|
|
2727
|
-
`
|
|
2728
|
-
|
|
2729
|
-
|
|
2757
|
+
Loads the package-owned provider when `arcaneRoot` is omitted and `target` is
|
|
2758
|
+
`portable` or `windows-x64`. Portable produces a non-executable payload; Windows
|
|
2759
|
+
assembles the matching precompiled SDK host. An explicit root retains the fixed
|
|
2760
|
+
Arcane OS checkout provider route, including its errors; there is no silent
|
|
2761
|
+
fallback. Other native targets still require that root. Normal Node module
|
|
2762
|
+
resolution owns imports.
|
|
2730
2763
|
|
|
2731
2764
|
### Signature and result
|
|
2732
2765
|
|
|
@@ -4113,7 +4146,7 @@ Import it from `arcane-os`. Source mode accepts
|
|
|
4113
4146
|
`{workspaceRoot=process.cwd(), appId, mode='source', host='127.0.0.1', port=0, httpPort=0, http=false,
|
|
4114
4147
|
certPath, keyPath, tls, signal, onEvent}` and serves one validated
|
|
4115
4148
|
workspace application plus its complete SDK or integrated runtime. Packaged mode uses
|
|
4116
|
-
`{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, certPath, keyPath, tls,
|
|
4149
|
+
`{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, http=false, certPath, keyPath, tls,
|
|
4117
4150
|
signal, onEvent}` and serves the complete selected release files.
|
|
4118
4151
|
External source mode accepts both the installed-package route layout and the
|
|
4119
4152
|
existing physical runtime layout. Installed-package mode serves the configured
|
|
@@ -4128,8 +4161,8 @@ The SDK request hook returns `308` for HTTP with a `Location` pointing to the
|
|
|
4128
4161
|
actual HTTPS port while preserving the original request path and query. Both listeners
|
|
4129
4162
|
use the selected host.
|
|
4130
4163
|
|
|
4131
|
-
Source servers default to HTTPS, including
|
|
4132
|
-
|
|
4164
|
+
Source servers and packaged browser previews default to HTTPS, including
|
|
4165
|
+
localhost. The existing `https` option is accepted; `https:false` and
|
|
4133
4166
|
`tls:false` alone do not disable HTTPS. HTTPS startup reads `.arcane/dev/server-cert.pem` and
|
|
4134
4167
|
`.arcane/dev/server-key.pem` relative to `workspaceRoot` unless explicit
|
|
4135
4168
|
`certPath` and `keyPath` are supplied together; relative paths resolve from the
|
|
@@ -4141,10 +4174,15 @@ handshake; browser trust and address matching are evaluated when a client
|
|
|
4141
4174
|
connects. The CLI's `--public` selects the wildcard bind;
|
|
4142
4175
|
the API's `host` option alone changes only the bind address.
|
|
4143
4176
|
|
|
4144
|
-
Explicit `http:true` selects one HTTP content listener in source mode and skips
|
|
4177
|
+
Explicit `http:true` selects one HTTP content listener in source or packaged mode and skips
|
|
4145
4178
|
certificate loading. `port` selects that listener's port, including `0` for an
|
|
4146
|
-
available port.
|
|
4147
|
-
|
|
4179
|
+
available port. Source mode keeps the same application, runtime and generated PWA routes.
|
|
4180
|
+
Packaged mode serves the complete selected `releaseRoot`; pass the artifact's
|
|
4181
|
+
web-root directory, not its enclosing native package directory. Its declared
|
|
4182
|
+
application start path, query and fragment are preserved. A caller requiring a
|
|
4183
|
+
stable origin must reuse its selected host and port; a bind conflict rejects
|
|
4184
|
+
startup rather than silently choosing another port.
|
|
4185
|
+
`http` must be boolean; `http:true` rejects `https:true`,
|
|
4148
4186
|
explicit certificate/key paths, a `tls` value other than `undefined`, `null` or
|
|
4149
4187
|
`false`, and a nonzero `httpPort`. Browser secure-context and installation
|
|
4150
4188
|
requirements remain browser-owned; see [explicit HTTP development](cli.md#explicit-http-development).
|
|
@@ -4154,10 +4192,10 @@ The promise settles after all selected listeners are ready and resolves to
|
|
|
4154
4192
|
networkUrls, httpPort, httpOrigin, httpUrl, close, closed, lifecycle}`. `server` is the raw Node
|
|
4155
4193
|
server for application content: `Http2SecureServer` for PEM-backed HTTPS,
|
|
4156
4194
|
`https.Server` for explicit raw `tls` options, or `http.Server` for explicit
|
|
4157
|
-
HTTP
|
|
4195
|
+
HTTP mode. HTTP/2 uses Node's compatibility request/response APIs;
|
|
4158
4196
|
callers accessing the raw server must account for its native type.
|
|
4159
4197
|
`protocol` describes the URL scheme: `'https:'` for either negotiated HTTPS
|
|
4160
|
-
protocol or `'http:'` with explicit HTTP
|
|
4198
|
+
protocol or `'http:'` with explicit HTTP mode.
|
|
4161
4199
|
`url` and `cleanUrl` are the same application URL. Wildcard listeners use
|
|
4162
4200
|
`localhost` in that local URL; `host` retains the actual bound address.
|
|
4163
4201
|
`httpPort` is the actual HTTP listener port, `httpOrigin` is its HTTP origin,
|
|
@@ -5092,24 +5130,85 @@ import {registeredTestCount} from 'arcane-os';
|
|
|
5092
5130
|
console.log(registeredTestCount());
|
|
5093
5131
|
```
|
|
5094
5132
|
|
|
5133
|
+
## createGitTextSnapshot()
|
|
5134
|
+
|
|
5135
|
+
### Overview
|
|
5136
|
+
|
|
5137
|
+
Reads complete application-selected UTF-8 text from one fetched revision using
|
|
5138
|
+
a dedicated bare Git cache. It does not create or alter a working checkout.
|
|
5139
|
+
|
|
5140
|
+
### Signature, lifecycle, and result
|
|
5141
|
+
|
|
5142
|
+
```text
|
|
5143
|
+
createGitTextSnapshot({cacheDirectory,remote,ref,selectPath,onEvent,run=runProcess}={})
|
|
5144
|
+
```
|
|
5145
|
+
|
|
5146
|
+
Import from `arcane-os`. The application owns the cache location, remote, ref,
|
|
5147
|
+
path predicate and service factory. The returned `refresh({signal}={})` returns
|
|
5148
|
+
`{revision,files:[{path,content}]}` in Git tree order. Concurrent calls share work;
|
|
5149
|
+
unchanged fetched revisions reuse completed text retrieval. Caller cancellation
|
|
5150
|
+
ends only that wait. `close()`, `drain()` and `dispose()` stop acceptance and
|
|
5151
|
+
await accepted refresh/process cleanup. Errors remain observable instead of
|
|
5152
|
+
returning stale or partial success. See [Git text snapshots](git-text-snapshot.md)
|
|
5153
|
+
for complete inputs, text semantics, errors, events and Core service composition.
|
|
5154
|
+
|
|
5155
|
+
### Example
|
|
5156
|
+
|
|
5157
|
+
```js
|
|
5158
|
+
import {createGitTextSnapshot} from 'arcane-os';
|
|
5159
|
+
|
|
5160
|
+
const dispatches = createGitTextSnapshot({
|
|
5161
|
+
cacheDirectory: applicationCacheDirectory,
|
|
5162
|
+
remote: applicationRepository,
|
|
5163
|
+
ref: applicationRef,
|
|
5164
|
+
selectPath: function selectDispatch(filename) {
|
|
5165
|
+
return filename.startsWith('dispatches/') && filename.endsWith('.md');
|
|
5166
|
+
}
|
|
5167
|
+
});
|
|
5168
|
+
const snapshot = await dispatches.refresh({signal});
|
|
5169
|
+
await dispatches.close();
|
|
5170
|
+
```
|
|
5171
|
+
|
|
5095
5172
|
## runProcess()
|
|
5096
5173
|
|
|
5097
5174
|
### Overview
|
|
5098
5175
|
|
|
5099
|
-
Runs one shell-free child command with complete stdout and stderr, ordered stream
|
|
5176
|
+
Runs one shell-free child command with complete stdout and stderr, ordered stream
|
|
5177
|
+
events, heartbeats, and explicitly selected process cancellation behavior.
|
|
5100
5178
|
|
|
5101
5179
|
### Signature, parameters, and result
|
|
5102
5180
|
|
|
5103
5181
|
```text
|
|
5104
|
-
async runProcess(command, args=[], { cwd, env, signal, onEvent, heartbeatMs=5000, terminationGraceMs=DEFAULT_TERMINATION_GRACE_MS, allowNonzero=false, input }={})
|
|
5182
|
+
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
5183
|
```
|
|
5106
5184
|
|
|
5107
5185
|
Import it from `arcane-os`. `command` is executed directly with `shell:false`;
|
|
5108
5186
|
`args` must be a fixed array of strings, so shell expansion, pipelines, and
|
|
5109
5187
|
redirection never occur. `cwd` selects the child directory. `env` is shallowly
|
|
5110
|
-
merged over `process.env`.
|
|
5111
|
-
|
|
5112
|
-
|
|
5188
|
+
merged over `process.env`. In the default `cancellationMode:'terminate-tree'`,
|
|
5189
|
+
supplied `input` is written once and stdin is closed; otherwise stdin closes
|
|
5190
|
+
immediately. With `cancellationMode:'close-input'`, optional input is written
|
|
5191
|
+
once and stdin remains open until cancellation or a callback/input failure
|
|
5192
|
+
requests shutdown. On Microsoft NT, `npm` and `npx` are normalized to their Node
|
|
5193
|
+
CLI entrypoints.
|
|
5194
|
+
|
|
5195
|
+
An `AsyncIterable` input instead feeds stdin with awaited writes and closes it
|
|
5196
|
+
when the producer finishes. Its `return()` must cooperate with cancellation of
|
|
5197
|
+
an outstanding `next()`; the process owner drains both input and output work.
|
|
5198
|
+
`onOutput({stream,chunk})` receives complete ordered chunks and is awaited with
|
|
5199
|
+
backpressure for each stream. UTF-8 decoding retains split characters. The
|
|
5200
|
+
default capture and nonempty-line events remain unchanged; line events are not
|
|
5201
|
+
a substitute for lossless chunk delivery.
|
|
5202
|
+
|
|
5203
|
+
`captureOutput` and `emitOutputEvents` accept booleans or per-stream selections,
|
|
5204
|
+
for example `{stdout:false}` while stderr retains its default. A stream with
|
|
5205
|
+
capture disabled returns `null` and requires an `onOutput` consumer.
|
|
5206
|
+
`outputEncoding` defaults to `'utf8'`; explicitly selecting `null`, globally or
|
|
5207
|
+
per stream such as `{stdout:null}`, delivers native `Buffer` chunks unchanged.
|
|
5208
|
+
A raw stream requires capture and line events explicitly disabled for that
|
|
5209
|
+
stream plus an `onOutput` owner. It is never decoded or sent as text implicitly.
|
|
5210
|
+
Complete failed chunks, original callback failures, process diagnostics and
|
|
5211
|
+
exit results remain available through the normal error record after drain.
|
|
5113
5212
|
|
|
5114
5213
|
`onEvent` is awaited in order for `process.starting`, nonempty
|
|
5115
5214
|
`process.stdout`/`process.stderr` lines, coalesced `process.heartbeat`, and the
|
|
@@ -5129,12 +5228,21 @@ text stream preserves its complete content. A missing executable rejects with
|
|
|
5129
5228
|
and spawn/runtime failures use the normalized SDK error boundary, with the
|
|
5130
5229
|
nonzero result retained in error details.
|
|
5131
5230
|
|
|
5132
|
-
Aborting `signal` emits cancellation-requested state
|
|
5133
|
-
process tree
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5231
|
+
Aborting `signal` emits cancellation-requested state. The default mode terminates
|
|
5232
|
+
the owned process tree and escalates after the grace interval. `close-input`
|
|
5233
|
+
instead closes only the child's stdin, with no forced termination or deadline;
|
|
5234
|
+
the selected child must own EOF shutdown. This lets a native host finish
|
|
5235
|
+
accepted service work before exiting. Both paths continue observing output and
|
|
5236
|
+
drain event delivery before rejection with `ARCANE_CANCELLED` and exit code 130.
|
|
5237
|
+
An abort after the child's close event does not cancel already completed work.
|
|
5238
|
+
|
|
5239
|
+
An `onEvent` failure requests shutdown through the same selected mode. The
|
|
5240
|
+
close-input failure retains the child's complete result in `details` and
|
|
5241
|
+
additional failures in `errors`, with the original primary error as `cause`
|
|
5242
|
+
when wrapping is needed. A cancellation rejection can therefore contain a
|
|
5243
|
+
successful child exit code `0`; that is the child's drained result, distinct
|
|
5244
|
+
from the cancelled caller operation. Cancellation cannot reverse external
|
|
5245
|
+
effects already performed by the command.
|
|
5138
5246
|
|
|
5139
5247
|
### Availability and normalization
|
|
5140
5248
|
|
|
@@ -7110,17 +7218,24 @@ await transport.closed;
|
|
|
7110
7218
|
|
|
7111
7219
|
Creates the SDK-owned native builder for one portable Core payload. The caller
|
|
7112
7220
|
selects application service modules already present in the app release. The
|
|
7113
|
-
provider does not load Arcane OS source, choose a model,
|
|
7114
|
-
|
|
7221
|
+
provider does not load Arcane OS source, choose a model, compile an executable
|
|
7222
|
+
or substitute for an unavailable platform host. An explicit `native.localAI`
|
|
7223
|
+
selection prepares and bundles its selected official runtime distributions;
|
|
7224
|
+
without that selection, no local-AI runtime is downloaded.
|
|
7115
7225
|
|
|
7116
7226
|
### Signature and result
|
|
7117
7227
|
|
|
7118
7228
|
```text
|
|
7119
|
-
createPortableNativeProvider({services=
|
|
7229
|
+
createPortableNativeProvider({services,packagedWeb=false,webKitDocumentLifecycle=false}={})
|
|
7120
7230
|
```
|
|
7121
7231
|
|
|
7122
7232
|
Import it from `arcane-os/native/portable-provider`. Each service selection is
|
|
7123
|
-
`{module, options}`.
|
|
7233
|
+
`{module, options}`. Omitted `services` uses `appDescriptor.native.services`;
|
|
7234
|
+
an explicit array, including `[]`, overrides the descriptor selection.
|
|
7235
|
+
The Mac composition selects `packagedWeb:true` for the SDK-owned serving service
|
|
7236
|
+
and `webKitDocumentLifecycle:true` for the canonical client projection. Defaults
|
|
7237
|
+
retain the existing portable and Windows behavior.
|
|
7238
|
+
The returned `arcane-native-builder/1` provider exposes
|
|
7124
7239
|
`describe()`, `doctor()`, `prepare()`, `build()`, `verify()` and `run()`.
|
|
7125
7240
|
`describe()` and successful payload results report `executable:false`; `run()`
|
|
7126
7241
|
reports `ARCANE_NATIVE_RUN_UNSUPPORTED`.
|
|
@@ -7156,8 +7271,10 @@ console.log(await provider.describe());
|
|
|
7156
7271
|
|
|
7157
7272
|
### Overview
|
|
7158
7273
|
|
|
7159
|
-
Package-owned
|
|
7160
|
-
|
|
7274
|
+
Package-owned provider with no preconfigured application services. Each native
|
|
7275
|
+
provider subpath exports its own singleton and exposes that same object as its
|
|
7276
|
+
default binding. The ordinary singleton uses the app descriptor's service
|
|
7277
|
+
selection.
|
|
7161
7278
|
|
|
7162
7279
|
### Value and import
|
|
7163
7280
|
|
|
@@ -7165,13 +7282,16 @@ is the named binding for the same object exposed as this subpath's default.
|
|
|
7165
7282
|
const arcaneNativeBuilderProvider
|
|
7166
7283
|
```
|
|
7167
7284
|
|
|
7168
|
-
Import it from `arcane-os/native/portable-provider
|
|
7285
|
+
Import it from `arcane-os/native/portable-provider` for a non-executable payload,
|
|
7286
|
+
or `arcane-os/native/windows-provider` for the Windows x64 executable contract.
|
|
7169
7287
|
|
|
7170
7288
|
### Availability and normalization
|
|
7171
7289
|
|
|
7172
|
-
**Node
|
|
7173
|
-
|
|
7174
|
-
|
|
7290
|
+
**Node for assembly.** The portable singleton retains the contract described by
|
|
7291
|
+
`createPortableNativeProvider()`. The Windows singleton retains
|
|
7292
|
+
`createWindowsNativeProvider()` and needs Windows x64/WebView2 for execution.
|
|
7293
|
+
The two providers are distinct objects; named/default identity holds within
|
|
7294
|
+
each selected subpath.
|
|
7175
7295
|
|
|
7176
7296
|
### Example
|
|
7177
7297
|
|
|
@@ -7195,12 +7315,14 @@ Default package binding for the same object exposed as
|
|
|
7195
7315
|
default as arcaneNativeBuilderProvider
|
|
7196
7316
|
```
|
|
7197
7317
|
|
|
7198
|
-
Import it from `arcane-os/native/portable-provider
|
|
7318
|
+
Import it from `arcane-os/native/portable-provider` or
|
|
7319
|
+
`arcane-os/native/windows-provider`, selecting that subpath's provider.
|
|
7199
7320
|
|
|
7200
7321
|
### Availability and normalization
|
|
7201
7322
|
|
|
7202
|
-
**Node
|
|
7203
|
-
default and named bindings have exact object identity and the same
|
|
7323
|
+
**Node for assembly; execution depends on the selected provider.** Within each
|
|
7324
|
+
subpath the default and named bindings have exact object identity and the same
|
|
7325
|
+
lifecycle; portable remains a non-executable payload.
|
|
7204
7326
|
|
|
7205
7327
|
### Example
|
|
7206
7328
|
|
|
@@ -7212,6 +7334,434 @@ import portableProvider, {
|
|
|
7212
7334
|
console.log(portableProvider === arcaneNativeBuilderProvider); // true
|
|
7213
7335
|
```
|
|
7214
7336
|
|
|
7337
|
+
## createWindowsNativeProvider()
|
|
7338
|
+
|
|
7339
|
+
### Overview
|
|
7340
|
+
|
|
7341
|
+
Creates the SDK-owned Windows x64 provider. It assembles the selected app's
|
|
7342
|
+
complete portable payload with the precompiled WebView2 launcher and Node SEA
|
|
7343
|
+
Core from the numeric release matching the installed SDK version.
|
|
7344
|
+
|
|
7345
|
+
### Signature and result
|
|
7346
|
+
|
|
7347
|
+
```text
|
|
7348
|
+
createWindowsNativeProvider({services,hostDirectory}={})
|
|
7349
|
+
```
|
|
7350
|
+
|
|
7351
|
+
Import it from `arcane-os/native/windows-provider`. `services` has the same
|
|
7352
|
+
descriptor/explicit-array semantics as the portable provider. An optional
|
|
7353
|
+
`hostDirectory` selects an already-built complete host tree; otherwise `build()`
|
|
7354
|
+
downloads and extracts the matching `arcane-native-windows-x64.tar.gz` beneath
|
|
7355
|
+
the selected output root. There is no compiler or OS checkout requirement for
|
|
7356
|
+
application builds. The build machine needs its normal Node/npm toolchain and
|
|
7357
|
+
`tar`; execution needs Windows x64, .NET Framework 4.6.2 or later and WebView2.
|
|
7358
|
+
|
|
7359
|
+
The returned `arcane-native-builder/1` provider exposes `describe`, `doctor`,
|
|
7360
|
+
`prepare`, `build`, `verify` and `run`. Build returns `{app,target,manifest}`
|
|
7361
|
+
with the actual directory at `target.rootDir`. Verification reads the artifact;
|
|
7362
|
+
it does not launch the window. Run launches `Arcane.exe` and observes complete
|
|
7363
|
+
diagnostics and exit. Cancellation closes input and waits for host-owned drain,
|
|
7364
|
+
including accepted service work, without a forced termination deadline. Missing
|
|
7365
|
+
prerequisites, download/extraction failures and host failures remain observable
|
|
7366
|
+
through the operation's error/event boundary.
|
|
7367
|
+
|
|
7368
|
+
### Example
|
|
7369
|
+
|
|
7370
|
+
```javascript
|
|
7371
|
+
import {createWindowsNativeProvider} from 'arcane-os/native/windows-provider';
|
|
7372
|
+
|
|
7373
|
+
const nativeBuilder = createWindowsNativeProvider({
|
|
7374
|
+
services: [{module: 'native/moon-ledger.mjs', options: {ledgerName: 'Cheese debts'}}]
|
|
7375
|
+
});
|
|
7376
|
+
```
|
|
7377
|
+
|
|
7378
|
+
Pass `nativeBuilder` to the existing native build-plan contract. For the ordinary
|
|
7379
|
+
CLI route and the complete artifact/launch contract, see
|
|
7380
|
+
[Windows executable packaging](core-native-packaging.md#windows-executable).
|
|
7381
|
+
|
|
7382
|
+
## createMacOSNativeProvider()
|
|
7383
|
+
|
|
7384
|
+
```text
|
|
7385
|
+
createMacOSNativeProvider({services,hostDirectory}={})
|
|
7386
|
+
```
|
|
7387
|
+
|
|
7388
|
+
Import from `arcane-os/native/macos-provider`. The named
|
|
7389
|
+
`arcaneNativeBuilderProvider` and default export are the same provider with
|
|
7390
|
+
descriptor-owned services and the exact SDK release's selected host asset.
|
|
7391
|
+
The six-method `arcane-native-builder/1` contract supports `macos-arm64` and
|
|
7392
|
+
`macos-x64`, platform `macos`, format `app`. A selected `hostDirectory` allows
|
|
7393
|
+
same-project collaboration on host output; otherwise assembly downloads the
|
|
7394
|
+
matching numeric SDK release's `arcane-native-macos-<architecture>.tar.gz`.
|
|
7395
|
+
Neither an available source implementation nor `doctor()` proves that the
|
|
7396
|
+
asset is published or its Mac runtime has been executed.
|
|
7397
|
+
|
|
7398
|
+
Build preserves the complete portable payload inside the bundle's Resources
|
|
7399
|
+
directory (`target.rootDir`) and returns its `.app` location as `bundleRoot`.
|
|
7400
|
+
The bundle supplies the SDK launcher and selected Node runtime. `verify()`
|
|
7401
|
+
reads assembled files; `run()` directly launches the bundled executable only on
|
|
7402
|
+
the matching Darwin architecture, observes diagnostics and waits for graceful
|
|
7403
|
+
Core/listener drain on cancellation. See the complete
|
|
7404
|
+
[macOS composition and prerequisite contract](core-native-packaging.md#macos-application-composition).
|
|
7405
|
+
|
|
7406
|
+
## createPackagedWebService()
|
|
7407
|
+
|
|
7408
|
+
```text
|
|
7409
|
+
createPackagedWebService({artifactRoot}, context={})
|
|
7410
|
+
```
|
|
7411
|
+
|
|
7412
|
+
Import from `arcane-os/core/packaged-web`. Returns the Core service
|
|
7413
|
+
`{name:'packaged-web', start, drain}`. Start reads the native manifest, serves
|
|
7414
|
+
its complete web root with the existing explicit HTTP packaged server on
|
|
7415
|
+
`127.0.0.1`, and emits `core.web.ready` with `{origin,url,port}` only after the
|
|
7416
|
+
actual listener is ready and its first selected port is saved. The complete
|
|
7417
|
+
manifest start URL is resolved against that origin.
|
|
7418
|
+
|
|
7419
|
+
State uses `context.stateRoot` or the native launcher's separate
|
|
7420
|
+
`--arcane-host-state-root` argument. The saved `packaged-web-origin.json` keeps
|
|
7421
|
+
the same port on subsequent launches; unreadable state or port conflicts remain
|
|
7422
|
+
errors, with no silent new origin. Startup rejection belongs to the Core
|
|
7423
|
+
`core.service.state` event; an unexpected post-start close/failure emits
|
|
7424
|
+
`core.web.failed` with the complete serialized error. Drain owns listener close
|
|
7425
|
+
and lifecycle completion. No application launch payload is rewritten, no model
|
|
7426
|
+
is loaded, and the ordinary server's HTTPS default is unchanged.
|
|
7427
|
+
|
|
7428
|
+
## createPreferencesService()
|
|
7429
|
+
|
|
7430
|
+
### Overview
|
|
7431
|
+
|
|
7432
|
+
Supplies the five existing `Arcane.preferences` methods using an application-selected
|
|
7433
|
+
JSON file. Construction performs no filesystem work. Preference names, defaults,
|
|
7434
|
+
schemas and writable location remain application-owned.
|
|
7435
|
+
|
|
7436
|
+
### Signature and result
|
|
7437
|
+
|
|
7438
|
+
```text
|
|
7439
|
+
createPreferencesService({file}={})
|
|
7440
|
+
```
|
|
7441
|
+
|
|
7442
|
+
Import from `arcane-os/core/preferences`. The returned Core service exposes
|
|
7443
|
+
`preferences.list/get/set/setMany/delete`, `drain()` and `dispose()`. Writes use
|
|
7444
|
+
`lifetime:'service'`, preserve complete JSON values and existing document metadata,
|
|
7445
|
+
and acknowledge after the new content is flushed and the selected file replaced.
|
|
7446
|
+
Operations selecting the same resolved filename share an ordered in-process queue.
|
|
7447
|
+
Unreadable or malformed files report their errors without being replaced; a missing
|
|
7448
|
+
file starts with empty entries. Unrepresentable JSON values fail before replacement.
|
|
7449
|
+
|
|
7450
|
+
```javascript
|
|
7451
|
+
import {createPreferencesService} from 'arcane-os/core/preferences';
|
|
7452
|
+
|
|
7453
|
+
const preferences = createPreferencesService({file: selectedPreferenceFile});
|
|
7454
|
+
```
|
|
7455
|
+
|
|
7456
|
+
Register the service with the existing Core owner. Its drain/dispose stops new
|
|
7457
|
+
acceptance, waits for accepted work and exposes failures; subsequent calls reject
|
|
7458
|
+
with `CORE_CLOSING`. See [method results, storage and service composition](core-preferences.md).
|
|
7459
|
+
|
|
7460
|
+
## createPreferencesService default export
|
|
7461
|
+
|
|
7462
|
+
The default export from `arcane-os/core/preferences` is the same
|
|
7463
|
+
`createPreferencesService` factory, with identical arguments, method results
|
|
7464
|
+
and lifecycle:
|
|
7465
|
+
|
|
7466
|
+
```javascript
|
|
7467
|
+
import createPreferencesService from 'arcane-os/core/preferences';
|
|
7468
|
+
```
|
|
7469
|
+
|
|
7470
|
+
## createDiarization()
|
|
7471
|
+
|
|
7472
|
+
### Overview
|
|
7473
|
+
|
|
7474
|
+
Retains one caller-selected Nemotron model in its first-party native helper and
|
|
7475
|
+
accepts independent mono-audio streams. Results contain generic timed speaker
|
|
7476
|
+
labels; they do not identify people or perform speech recognition.
|
|
7477
|
+
|
|
7478
|
+
### Signature and result
|
|
7479
|
+
|
|
7480
|
+
```text
|
|
7481
|
+
createDiarization({executable,modelPath,runtime,onEvent}={})
|
|
7482
|
+
```
|
|
7483
|
+
|
|
7484
|
+
Import from `arcane-os/diarization`. Supply absolute helper/model paths and the
|
|
7485
|
+
selected runtime's library locations. The returned owner starts the helper and
|
|
7486
|
+
exposes `ready`, `completion`, `current()`, replaying `subscribe()`,
|
|
7487
|
+
`openStream()`, `diarize()` and `close()`. Readiness resolves only after model
|
|
7488
|
+
loading. Each stream owns `push`, `finish`, `cancel`, `completion` and `current`;
|
|
7489
|
+
pushes preserve mono float32 input, use backpressure and return the latest timed
|
|
7490
|
+
segment snapshot. Caller callbacks may receive every probability frame.
|
|
7491
|
+
|
|
7492
|
+
```javascript
|
|
7493
|
+
import {createDiarization} from 'arcane-os/diarization';
|
|
7494
|
+
|
|
7495
|
+
const speakers = createDiarization({executable, modelPath, runtime});
|
|
7496
|
+
const result = await speakers.diarize({audio: monoSamples, sampleRate: 16000});
|
|
7497
|
+
await speakers.close();
|
|
7498
|
+
```
|
|
7499
|
+
|
|
7500
|
+
Load, callback, process and cleanup failures remain observable. Cancellation
|
|
7501
|
+
suppresses later results for its stream and closes it after accepted native
|
|
7502
|
+
commands; the C ABI supplies no immediate interrupt. Close drains owned work
|
|
7503
|
+
and observes helper exit. See [complete audio, callback and cancellation contracts](diarization.md).
|
|
7504
|
+
|
|
7505
|
+
## buildDiarizationHelper()
|
|
7506
|
+
|
|
7507
|
+
```text
|
|
7508
|
+
async buildDiarizationHelper({runtime,outputRoot,signal,onEvent}={})
|
|
7509
|
+
```
|
|
7510
|
+
|
|
7511
|
+
Import from `arcane-os/diarization/build`. Builds the first-party helper for the
|
|
7512
|
+
current host using installed CMake/C++17 tools and the selected runtime's
|
|
7513
|
+
`cmakeDirectory`. Returns `{platform,architecture,root,executable,diagnostics}`
|
|
7514
|
+
after configure, compile and install, retaining complete command diagnostics.
|
|
7515
|
+
Missing inputs or actual tool failures reject through the shared process owner;
|
|
7516
|
+
no compiler, model or runtime is downloaded by this function.
|
|
7517
|
+
|
|
7518
|
+
```javascript
|
|
7519
|
+
import {buildDiarizationHelper} from 'arcane-os/diarization/build';
|
|
7520
|
+
|
|
7521
|
+
const helper = await buildDiarizationHelper({runtime, outputRoot: helperDirectory});
|
|
7522
|
+
```
|
|
7523
|
+
|
|
7524
|
+
See [runtime preparation, helper placement and platform support](diarization.md#runtime-and-helper).
|
|
7525
|
+
|
|
7526
|
+
## createDiarizationService()
|
|
7527
|
+
|
|
7528
|
+
```text
|
|
7529
|
+
createDiarizationService(options={},launch={})
|
|
7530
|
+
```
|
|
7531
|
+
|
|
7532
|
+
Import from `arcane-os/core/diarization`. This synchronous `native.services`
|
|
7533
|
+
factory accepts `{executable,modelPath,runtime,onEvent}` and the native launch
|
|
7534
|
+
context. Relative executable/model paths use `workspaceRoot`, then `appRoot`,
|
|
7535
|
+
then the current directory. It supplies `diarization.status`, `diarization.load`,
|
|
7536
|
+
`diarization.open`, `diarization.push`, `diarization.finish`, `diarization.cancel`
|
|
7537
|
+
and `diarization.recording`, state/update/probability events and drain/dispose hooks.
|
|
7538
|
+
The first actual operation loads the model, independently of Core startup.
|
|
7539
|
+
|
|
7540
|
+
```javascript
|
|
7541
|
+
import {createDiarizationService} from 'arcane-os/core/diarization';
|
|
7542
|
+
|
|
7543
|
+
const service = createDiarizationService({executable, modelPath, runtime}, launch);
|
|
7544
|
+
```
|
|
7545
|
+
|
|
7546
|
+
Session audio has service lifetime and explicit cancellation; a recording's
|
|
7547
|
+
request cancellation closes only that recording. Complete float32 samples use
|
|
7548
|
+
the documented Core transport framing. See [inputs, results, events and lifetime](diarization.md#core-service).
|
|
7549
|
+
|
|
7550
|
+
## createDiarizationService default export
|
|
7551
|
+
|
|
7552
|
+
The default binding from `arcane-os/core/diarization` is exactly the named
|
|
7553
|
+
`createDiarizationService` factory, with the same selection and service lifecycle:
|
|
7554
|
+
|
|
7555
|
+
```javascript
|
|
7556
|
+
import createDiarizationService from 'arcane-os/core/diarization';
|
|
7557
|
+
```
|
|
7558
|
+
|
|
7559
|
+
## readCoreLaunchContext()
|
|
7560
|
+
|
|
7561
|
+
### Overview
|
|
7562
|
+
|
|
7563
|
+
Reads only the complete JSON object explicitly selected by
|
|
7564
|
+
`--arcane-launch-config <path>`; it does not search for application configuration.
|
|
7565
|
+
|
|
7566
|
+
### Signature and result
|
|
7567
|
+
|
|
7568
|
+
```text
|
|
7569
|
+
async readCoreLaunchContext({argv=process.argv.slice(2)}={})
|
|
7570
|
+
```
|
|
7571
|
+
|
|
7572
|
+
Import it from `arcane-os/core/host`. The promise resolves to `{}` when the flag
|
|
7573
|
+
is absent, or the complete parsed object when present. A missing flag value,
|
|
7574
|
+
unreadable file, malformed JSON or non-object value rejects. Relative paths use
|
|
7575
|
+
the process working directory. The reader does not rewrite content or mutate
|
|
7576
|
+
the environment.
|
|
7577
|
+
|
|
7578
|
+
```javascript
|
|
7579
|
+
import {readCoreLaunchContext} from 'arcane-os/core/host';
|
|
7580
|
+
|
|
7581
|
+
const launchContext = await readCoreLaunchContext();
|
|
7582
|
+
```
|
|
7583
|
+
|
|
7584
|
+
The generated entry supplies artifact-derived `appRoot`, then applies the whole
|
|
7585
|
+
explicit context and passes the same object as every service factory's second
|
|
7586
|
+
argument. Authored service options remain the first argument. Workspace/state
|
|
7587
|
+
locations and additional fields belong to the launcher/application. See
|
|
7588
|
+
[launch-time locations](core-native-packaging.md#launch-time-locations).
|
|
7589
|
+
|
|
7590
|
+
## createCoreLocalAIProvider()
|
|
7591
|
+
|
|
7592
|
+
### Overview
|
|
7593
|
+
|
|
7594
|
+
Creates a browser-safe llama.cpp LLM provider through an existing Core client.
|
|
7595
|
+
Construction selects no model and installs no runtime or transport.
|
|
7596
|
+
|
|
7597
|
+
### Signature and result
|
|
7598
|
+
|
|
7599
|
+
```text
|
|
7600
|
+
createCoreLocalAIProvider({client=getInstalledCoreClient(),id='llama.cpp'}={})
|
|
7601
|
+
```
|
|
7602
|
+
|
|
7603
|
+
Import it from `arcane-os/ai/core-local`. The provider implements
|
|
7604
|
+
`arcane-ai-provider/2` and exposes `catalog`, `status`, `inspect`, `load`,
|
|
7605
|
+
`request`, `unload` and `dispose`. Register it with the shared AI provider runtime,
|
|
7606
|
+
select the exact provider/model with `localOnly:true`, and load that selection.
|
|
7607
|
+
Requests wait for the requested model's actual readiness, preserve complete
|
|
7608
|
+
payloads and parsed streaming chunks, and cancel on observed readiness loss.
|
|
7609
|
+
Missing Core reports unavailability; it does not choose a browser or cloud route.
|
|
7610
|
+
Dispose/unregister at the caller's owning lifecycle boundary.
|
|
7611
|
+
|
|
7612
|
+
```javascript
|
|
7613
|
+
import {createCoreLocalAIProvider} from 'arcane-os/ai/core-local';
|
|
7614
|
+
import {getAIProviderRuntime} from 'arcane-os/ai-provider-runtime';
|
|
7615
|
+
|
|
7616
|
+
const provider = createCoreLocalAIProvider();
|
|
7617
|
+
const unregister = getAIProviderRuntime().register(provider);
|
|
7618
|
+
```
|
|
7619
|
+
|
|
7620
|
+
See [the browser provider guide](local-ai.md#browser-llamacpp-provider) for model
|
|
7621
|
+
selection, streaming, cancellation and primary-model reload behavior.
|
|
7622
|
+
|
|
7623
|
+
## createLocalAIService()
|
|
7624
|
+
|
|
7625
|
+
### Overview
|
|
7626
|
+
|
|
7627
|
+
Composes application-selected llama.cpp, Ollama and ONNX engines as a native Core
|
|
7628
|
+
service. Runtime installation, process availability and model readiness remain
|
|
7629
|
+
separate states; prompts, models and application policy remain caller-owned.
|
|
7630
|
+
|
|
7631
|
+
### Signature and result
|
|
7632
|
+
|
|
7633
|
+
```text
|
|
7634
|
+
createLocalAIService(configuration,{appRoot,runtimes=[],signal,onEvent}={})
|
|
7635
|
+
```
|
|
7636
|
+
|
|
7637
|
+
Import it from `arcane-os/core/local-ai`. `configuration` is the authored local-AI
|
|
7638
|
+
record; `appRoot` resolves its relative model paths and `runtimes` supplies
|
|
7639
|
+
resolved installed runtime records. It returns a Core service definition with
|
|
7640
|
+
`current()` and independent selected-engine startup. Compose it through the
|
|
7641
|
+
existing Core lifecycle. Shutdown cancels owned work and joins owned processes;
|
|
7642
|
+
an already running external service remains under its external owner.
|
|
7643
|
+
|
|
7644
|
+
The service provides `localai.status`, explicit `localai.services.recover`,
|
|
7645
|
+
`llama.status/models/load/unload/chat`, `onnx.status/load/run/unload`, and the documented native Ollama methods.
|
|
7646
|
+
`localai.state` reports runtime/model changes. `llama.chunk` and `ollama.chunk`
|
|
7647
|
+
carry original parsed chunks with `streamId`; terminal responses remain complete.
|
|
7648
|
+
There is no background health polling or implicit model choice.
|
|
7649
|
+
|
|
7650
|
+
```javascript
|
|
7651
|
+
import {createLocalAIService} from 'arcane-os/core/local-ai';
|
|
7652
|
+
|
|
7653
|
+
const service = createLocalAIService(application.native.localAI, {appRoot, runtimes});
|
|
7654
|
+
```
|
|
7655
|
+
|
|
7656
|
+
See [Core service configuration, results and failures](local-ai.md#core-service)
|
|
7657
|
+
and [native bundling](local-ai.md#native-bundling).
|
|
7658
|
+
|
|
7659
|
+
## createONNXRuntime()
|
|
7660
|
+
|
|
7661
|
+
`createONNXRuntime({modulePath,signal?,onEvent?})` from `arcane-os/local-ai/onnx`
|
|
7662
|
+
owns retained native ONNX sessions in workers. It exposes `load({id,model,
|
|
7663
|
+
sessionOptions?,signal?})`, `run({id,feeds,fetches?,runOptions?,signal?})`,
|
|
7664
|
+
`unload({id,signal?})`, `current()`, replaying `subscribe(listener)` and `close()`.
|
|
7665
|
+
The direct model path is absolute. Complete typed tensor records use
|
|
7666
|
+
`{type,dims,data}`; callers own the actual graph's inputs and preprocessing.
|
|
7667
|
+
|
|
7668
|
+
Models load only on explicit requests. A live session ID requires unloading
|
|
7669
|
+
before replacement. Independent sessions run concurrently; same-session work
|
|
7670
|
+
waits at that session's loading/execution boundary. Queued cancellation removes
|
|
7671
|
+
that request; active cancellation retires the affected worker and suppresses
|
|
7672
|
+
its response. Native code can delay termination; cleanup waits for actual exit.
|
|
7673
|
+
See [complete signatures, readiness, cancellation and usage](local-ai.md#native-onnx-sessions).
|
|
7674
|
+
|
|
7675
|
+
## createCoreONNXRuntime()
|
|
7676
|
+
|
|
7677
|
+
`createCoreONNXRuntime({client=getInstalledCoreClient()}={})` from
|
|
7678
|
+
`arcane-os/ai/core-onnx` accesses an available Core ONNX service. Its `load`,
|
|
7679
|
+
`run`, and `unload` mirror the native session selection and accept `signal` and
|
|
7680
|
+
`timeoutMs` (default `0`). Relative model paths resolve at Core's `appRoot`.
|
|
7681
|
+
The accessor owns complete tensor transport encoding/decoding, `inspect()`,
|
|
7682
|
+
`current()`, replaying `subscribe(listener)` and `close()`. Closing cancels this
|
|
7683
|
+
accessor's requests and subscriptions; unloading shared models is explicit.
|
|
7684
|
+
Construction installs no runtime and opens no transport. Existing browser
|
|
7685
|
+
ONNX/Wllama remain independent. See [Core and browser usage](local-ai.md#onnx-through-core-and-the-browser).
|
|
7686
|
+
|
|
7687
|
+
## createLocalAIService default export
|
|
7688
|
+
|
|
7689
|
+
The default binding from `arcane-os/core/local-ai` is exactly the named
|
|
7690
|
+
`createLocalAIService` factory above, with the same arguments, return value and
|
|
7691
|
+
lifecycle:
|
|
7692
|
+
|
|
7693
|
+
```javascript
|
|
7694
|
+
import createLocalAIService from 'arcane-os/core/local-ai';
|
|
7695
|
+
```
|
|
7696
|
+
|
|
7697
|
+
## ensureLocalAIRuntimes()
|
|
7698
|
+
|
|
7699
|
+
### Overview
|
|
7700
|
+
|
|
7701
|
+
Reuses matching managed runtimes or installs complete selected official
|
|
7702
|
+
llama.cpp/Ollama/ONNX distributions or NeMo libraries in an explicitly supplied directory.
|
|
7703
|
+
|
|
7704
|
+
### Signature and result
|
|
7705
|
+
|
|
7706
|
+
```text
|
|
7707
|
+
async ensureLocalAIRuntimes({runtimes=[],directory,platform=process.platform,architecture=process.arch,signal,onEvent}={})
|
|
7708
|
+
```
|
|
7709
|
+
|
|
7710
|
+
Import it from `arcane-os/local-ai`. Runtime requirements accept IDs or
|
|
7711
|
+
`{id,version?,url?}` records. The result is an array of absolute
|
|
7712
|
+
`{id,version,platform,architecture,root}` records, with `executable` for servers,
|
|
7713
|
+
`modulePath` for ONNX, or NeMo library directories. Matching concurrent
|
|
7714
|
+
installs share their work. Downloads retain runtime libraries and surface
|
|
7715
|
+
network/archive failures; cancellation and operation events remain observable.
|
|
7716
|
+
Installation changes no global PATH or system service and loads no model.
|
|
7717
|
+
Supported assets belong to the selected upstream distribution; see
|
|
7718
|
+
[platform and archive requirements](local-ai.md#native-bundling).
|
|
7719
|
+
|
|
7720
|
+
```javascript
|
|
7721
|
+
import {ensureLocalAIRuntimes} from 'arcane-os/local-ai';
|
|
7722
|
+
|
|
7723
|
+
// Call explicitly when the app needs its selected official runtime installed.
|
|
7724
|
+
async function prepareMoonCheeseRuntime(){
|
|
7725
|
+
return ensureLocalAIRuntimes({
|
|
7726
|
+
runtimes: ['llama.cpp'], directory: '.arcane/local-ai/runtimes'
|
|
7727
|
+
});
|
|
7728
|
+
}
|
|
7729
|
+
```
|
|
7730
|
+
|
|
7731
|
+
## bundleLocalAIRuntimes()
|
|
7732
|
+
|
|
7733
|
+
### Overview
|
|
7734
|
+
|
|
7735
|
+
Prepares selected runtimes through the same installer and copies their complete
|
|
7736
|
+
trees into one fresh native staging destination.
|
|
7737
|
+
|
|
7738
|
+
### Signature and result
|
|
7739
|
+
|
|
7740
|
+
```text
|
|
7741
|
+
async bundleLocalAIRuntimes({runtimes=[],directory,outputRoot,platform=process.platform,architecture=process.arch,signal,onEvent}={})
|
|
7742
|
+
```
|
|
7743
|
+
|
|
7744
|
+
Import it from `arcane-os/local-ai`. `directory` owns the reusable installation;
|
|
7745
|
+
`outputRoot` owns the fresh artifact. The promise resolves to `{runtimes,files}`:
|
|
7746
|
+
runtime paths are artifact-relative under `runtime/local-ai/<id>`, and `files`
|
|
7747
|
+
contains the complete emitted inventory. Existing runtime destinations are
|
|
7748
|
+
preserved and reported as a conflict. Copying settles all started work and
|
|
7749
|
+
reports failures/cancellation without executing app services or models.
|
|
7750
|
+
|
|
7751
|
+
```javascript
|
|
7752
|
+
import {bundleLocalAIRuntimes} from 'arcane-os/local-ai';
|
|
7753
|
+
|
|
7754
|
+
// Call explicitly with a fresh output directory for this native assembly.
|
|
7755
|
+
async function bundleMoonCheeseRuntime(outputRoot){
|
|
7756
|
+
return bundleLocalAIRuntimes({
|
|
7757
|
+
runtimes: ['llama.cpp'], directory: '.arcane/local-ai/runtimes', outputRoot
|
|
7758
|
+
});
|
|
7759
|
+
}
|
|
7760
|
+
```
|
|
7761
|
+
|
|
7762
|
+
The ordinary provider invokes this owner only for an explicit native local-AI
|
|
7763
|
+
selection. See [selected local-AI runtimes](core-native-packaging.md#selected-local-ai-runtimes).
|
|
7764
|
+
|
|
7215
7765
|
## startCoreHost()
|
|
7216
7766
|
|
|
7217
7767
|
### Overview
|