arcane-os 0.56.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +6 -2
  3. package/browser-runtime/ai/core-local.mjs +306 -0
  4. package/browser-runtime/ai/core-onnx.mjs +96 -0
  5. package/browser-runtime/ai/onnx-tensors.mjs +85 -0
  6. package/browser-runtime/core/client.mjs +151 -16
  7. package/docs/architecture.md +5 -2
  8. package/docs/platform-targets.md +30 -13
  9. package/docs/reference/README.md +38 -3
  10. package/docs/reference/availability-and-normalization.md +9 -6
  11. package/docs/reference/cli.md +29 -9
  12. package/docs/reference/core-client.md +80 -0
  13. package/docs/reference/core-native-packaging.md +304 -12
  14. package/docs/reference/core-preferences.md +49 -0
  15. package/docs/reference/diarization.md +206 -0
  16. package/docs/reference/git-text-snapshot.md +104 -0
  17. package/docs/reference/inventory/package-api.json +330 -22
  18. package/docs/reference/local-ai.md +331 -0
  19. package/docs/reference/protocols.md +97 -20
  20. package/docs/reference/pwa.md +5 -2
  21. package/docs/reference/runtime-modules.md +6 -5
  22. package/docs/reference/sdk-api.md +611 -63
  23. package/package.json +15 -3
  24. package/runtime/arcane/modules/LocalAIReadiness.js +3 -1
  25. package/schemas/arcane-app.schema.json +55 -1
  26. package/schemas/arcane-package.schema.json +44 -0
  27. package/schemas/native-build-plan.schema.json +27 -1
  28. package/schemas/target-adapter.schema.json +2 -0
  29. package/src/app-descriptor.mjs +18 -2
  30. package/src/cli/main.mjs +20 -4
  31. package/src/constants.mjs +2 -0
  32. package/src/core/host.mjs +23 -0
  33. package/src/core/hosts/macos/ArcaneCoreProcess.h +85 -0
  34. package/src/core/hosts/macos/ArcaneCoreProcess.m +357 -0
  35. package/src/core/hosts/macos/ArcaneHost.h +86 -0
  36. package/src/core/hosts/macos/ArcaneHost.m +455 -0
  37. package/src/core/hosts/macos/ArcaneLauncher.m +432 -0
  38. package/src/core/hosts/windows/ArcaneCoreProcess.cs +3 -3
  39. package/src/core/hosts/windows/ArcaneHost.cs +695 -0
  40. package/src/core/hosts/windows/ArcaneHost.manifest +22 -0
  41. package/src/core/hosts/windows/ArcaneLauncher.cs +239 -0
  42. package/src/core/services/local-ai.mjs +621 -0
  43. package/src/core/services/packaged-web.mjs +89 -0
  44. package/src/core/services/preferences.mjs +201 -0
  45. package/src/core-classic-source.mjs +2 -2
  46. package/src/dev-server.mjs +9 -5
  47. package/src/diarization/build.mjs +35 -0
  48. package/src/diarization/index.mjs +432 -0
  49. package/src/diarization/native/CMakeLists.txt +9 -0
  50. package/src/diarization/native/main.cpp +269 -0
  51. package/src/diarization/service.mjs +129 -0
  52. package/src/git-text-snapshot.mjs +265 -0
  53. package/src/import-map.mjs +2 -0
  54. package/src/index.mjs +1 -0
  55. package/src/local-ai/archive.mjs +52 -0
  56. package/src/local-ai/config.mjs +62 -0
  57. package/src/local-ai/dev.mjs +390 -0
  58. package/src/local-ai/discover.mjs +71 -0
  59. package/src/local-ai/http.mjs +106 -0
  60. package/src/local-ai/install.mjs +459 -0
  61. package/src/local-ai/onnx-worker.mjs +85 -0
  62. package/src/local-ai/onnx.mjs +368 -0
  63. package/src/local-ai/server.mjs +262 -0
  64. package/src/native/macos-provider.mjs +291 -0
  65. package/src/native/portable-layout.mjs +37 -4
  66. package/src/native/portable-provider.mjs +44 -8
  67. package/src/native/windows-provider.mjs +262 -0
  68. package/src/native-plan.mjs +9 -1
  69. package/src/native-provider-loader.mjs +10 -2
  70. package/src/packager/core.mjs +6 -2
  71. package/src/process.mjs +184 -20
  72. package/src/scaffold.mjs +1 -1
  73. package/src/targets/index.mjs +11 -1
  74. package/src/templates/workspace-template.mjs +6 -5
  75. package/src/toolchain.mjs +33 -5
@@ -47,14 +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 default and explicit checkout provider loader. |
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. |
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. |
58
65
  | `arcane-os/integrated-provider` | Fixed integrated shared-development provider. |
59
66
  | `arcane-os/packager` | Low-level browser app packager. |
60
67
  | `arcane-os/release-bundle` | Deterministic external release bundles. |
@@ -83,6 +90,7 @@ runtime layouts.
83
90
  | `arcane-os/browser-device` | Synchronous mobile or desktop identity hints for application-owned settings. |
84
91
  | `arcane-os/pwa` | Nonblocking PWA registration, worker updates, native installation state and a dismissible installation component. |
85
92
  | `arcane-os/ai/browser-wasm` | Caller-selected browser-local Wllama inference, complete DBOPFS model storage, streaming, cancellation, and structural tool-call results. |
93
+ | `arcane-os/ai/core-local` | Browser llama.cpp provider through an available Core connection; browser-local Wllama and ONNX remain independently available. |
86
94
  | `arcane-os/ai/browser-decisions` | Explicit-load Laya FP16 and Julia-1 FP32 typed decisions through the shared Transformers.js Worker owner. |
87
95
  | `arcane-os/ai/tool-text-stream` | Shared selected tool-argument text observer for provider integration. |
88
96
  | `arcane-os/ai/twin-cloud` | Stateless chat, System One state/questions and image generation with explicit key/model, complete results and operation-specific retry/cancellation. |
@@ -280,6 +288,7 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
280
288
  | `runApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
281
289
  | `runDoctor()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
282
290
  | `runProcess()` | function | `arcane-os` | Events, processes, and testing | Node |
291
+ | `createGitTextSnapshot()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node with Git |
283
292
  | `runRegisteredTests()` | function | `arcane-os` | Events, processes, and testing | Node |
284
293
  | `runRepositoryAction()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
285
294
  | `runTarget()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
@@ -362,6 +371,7 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
362
371
  | `createCoreClient()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
363
372
  | `createCoreFacade()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
364
373
  | `installCoreClient()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
374
+ | `getInstalledCoreClient()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
365
375
  | `createCoreClassicSource()` | function | `arcane-os/core/classic-source` | Core classic client projection | Node; generated source runs in browser and native WebView renderers |
366
376
  | `createCoreRuntime()` | function | `arcane-os/core/runtime` | Native Core runtime | Node on Windows, Linux and macOS native hosts; Android requires host adaptation |
367
377
  | `encodeCoreFrame()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
@@ -371,6 +381,21 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
371
381
  | `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
372
382
  | `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
373
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 |
374
399
  | `MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
375
400
  | `MAIL_OUTBOX_PROTOCOL` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
376
401
  | `MAIL_OUTBOX_STATES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
@@ -807,7 +832,7 @@ descriptor-selected browser document inventory.
807
832
  ### Signature and result
808
833
 
809
834
  ```text
810
- async inspectApp({workspaceRoot, appId, signal}={})
835
+ async inspectApp({workspaceRoot, appId, signal, target, outputDirectory}={})
811
836
  ```
812
837
 
813
838
  Import it from `arcane-os` or `arcane-os/packager`. The result includes the
@@ -834,9 +859,18 @@ such as `apps/hello-world/index.html`. The complete `files` inventory uses
834
859
  package-relative paths and includes the root `index.html`. Shared
835
860
  files retain their configured route destinations.
836
861
 
837
- `output` is the selected workspace-relative final package directory. It uses
838
- the app's optional `arcane-package.json` `outputDirectory` directly, or
839
- `dist/<app-id>` when omitted; the SDK appends no app ID to an explicit value.
862
+ `target` defaults to `'browser'`. A selected nonbrowser target adds the app's
863
+ explicit `nativeResources` to `files`, without adding those native-only paths
864
+ to `browserDocuments`. The optional normalized `nativeResources` record is
865
+ returned when authored. This inspection copies or executes no resources.
866
+
867
+ `output` is the selected workspace-relative final package directory. An explicit
868
+ operation `outputDirectory` wins. Otherwise, a nonbrowser target with a nonempty
869
+ native include list uses `dist/.native/<target>/<app-id>`; the app's saved browser
870
+ destination remains separate. Browser selection, omitted native resources and
871
+ an empty native include list use the app's saved `outputDirectory` or
872
+ `dist/<app-id>`. The SDK appends no app ID to an explicit destination. See
873
+ [native-only application resources](protocols.md#native-only-application-resources).
840
874
 
841
875
  ### Availability and normalization
842
876
 
@@ -881,9 +915,10 @@ console.log(normalizeRelativePath('apps/example/index.html'));
881
915
 
882
916
  ### Overview
883
917
 
884
- Builds one complete browser application release through the low-level packager
885
- API. It does not run tests or checks automatically; verification occurs only
886
- when explicitly requested or when required for this selected release output.
918
+ Builds one complete selected application release through the low-level packager
919
+ API, with browser selection by default. It does not run tests or checks
920
+ automatically; verification occurs only when explicitly requested or when
921
+ required for this selected release output.
887
922
 
888
923
  ### Signature and result
889
924
 
@@ -898,6 +933,21 @@ The package preserves the complete selected content, applying the documented
898
933
  asset-version and enabled browser-PWA transformations to resource references.
899
934
  Malformed configuration or descriptors fail while preserving the prior output.
900
935
 
936
+ `target` defaults to `'browser'`; supported target names are `browser`,
937
+ `portable`, `windows-x64`, `linux-x64`, `linux-arm64` and `android-arm64`.
938
+ A nonbrowser target adds the app's explicit `nativeResources` selection and
939
+ sets the effective `browserPwa` value to `false`. It does not compile or launch
940
+ that platform. Browser calls preserve the existing `browserPwa` default and
941
+ explicit setting. The app adapter's `buildArcanePackage()` context receives
942
+ the actual `target` and effective `browserPwa` alongside its existing fields.
943
+ `copyBase()` retains the browser/shared selection; native-only resources are
944
+ copied afterward, outside browser rewriting and PWA processing.
945
+
946
+ `moduleFormat` controls browser module representation independently of `target`.
947
+ In particular, `moduleFormat:'native'` alone remains a browser package and does
948
+ not add native resources. The complete selection and separate-output rules are
949
+ documented under [native-only application resources](protocols.md#native-only-application-resources).
950
+
901
951
  `moduleFormat` defaults to `'import-map'`, preserving the ordinary browser
902
952
  package. Select `'native'` to resolve saved document import maps into native
903
953
  module URLs in the package stage and emit executable inline scripts as external
@@ -938,8 +988,8 @@ manifest or an operating-system launcher. Native-mode dry runs report selected
938
988
  input files; generated script/context files are included in the completed
939
989
  package's full returned inventory.
940
990
 
941
- The app's optional schema-1 `outputDirectory` selects the final
942
- workspace-relative destination. For example, `"ai"` emits directly into
991
+ For browser selection, the app's optional schema-1 `outputDirectory` selects the
992
+ final workspace-relative destination. For example, `"ai"` emits directly into
943
993
  `<workspace>/ai`; omission retains `dist/<app-id>`. The selected directory is
944
994
  wholly replaced through the existing staged swap, not merged. Changing the
945
995
  destination preserves the former output and siblings. Conflicting source,
@@ -947,6 +997,13 @@ selected input, or required control paths fail before output writes. Source
947
997
  layout, app identity, OPFS scope, and internal package paths remain unchanged.
948
998
  See [app-selected package output](protocols.md#app-selected-package-output).
949
999
 
1000
+ For a nonbrowser target with a nonempty native include list, the default is
1001
+ instead `dist/.native/<target>/<app-id>`, preserving a separately emitted browser
1002
+ output even when its saved destination is custom. An explicit operation
1003
+ `outputDirectory` still wins; choose a dedicated destination because packaging
1004
+ replaces that selected directory. Omitted or empty native resources retain the
1005
+ existing destination rules.
1006
+
950
1007
  Root app files retain their paths at the output root; explicitly nested apps
951
1008
  retain their `apps/<id>/` paths. Shared files retain their configured route
952
1009
  destinations. When the selected content supplies no root `index.html`, the SDK
@@ -1147,9 +1204,15 @@ console.log(validateAppBundlePath('payload/apps/example/index.html'));
1147
1204
 
1148
1205
  Validates one schema-1 packager app configuration and its relationship to the root config.
1149
1206
 
1150
- Optional `outputDirectory` is the final workspace-relative package directory;
1151
- omission preserves `dist/<app-id>`. It is an app package field, not a change to
1152
- the root configuration's `distRoot` or the schema-2 app identity. Packaging
1207
+ Optional `nativeResources` contains a required literal-path `include` array
1208
+ (which may be empty) and optional `exclude` array (default `[]`). It selects
1209
+ additional app-owned resources only for a nonbrowser packaging target. Ordinary
1210
+ `include`, `exclude`, shared routes and document selection remain unchanged.
1211
+
1212
+ Optional `outputDirectory` is the saved workspace-relative browser package
1213
+ directory; omission preserves `dist/<app-id>`. Nonempty native selection uses
1214
+ the separate target-selected default described above. It is an app package
1215
+ field, not a change to the root configuration's `distRoot` or the schema-2 app identity. Packaging
1153
1216
  reports conflicting output/input selections with `ARCANE_PACKAGE_INVALID`
1154
1217
  before output writes. Authored-descriptor comparison treats the destination
1155
1218
  as package-local, and descriptor refresh preserves the existing setting.
@@ -1216,7 +1279,8 @@ async function usevalidateRootConfig(...arguments_) {
1216
1279
 
1217
1280
  ### Overview
1218
1281
 
1219
- Authenticates one existing browser app release through the low-level packager API.
1282
+ Reads one existing application release and compares its complete file inventory
1283
+ with its release manifest through the low-level packager API.
1220
1284
 
1221
1285
  ### Signature and result
1222
1286
 
@@ -1228,6 +1292,9 @@ Import it from `arcane-os` or `arcane-os/packager`. The signature above states w
1228
1292
 
1229
1293
  Optional `outputDirectory` selects the same workspace-relative override accepted
1230
1294
  by `packageApp`, without changing the app's saved destination.
1295
+ For a target-selected native input release, pass the returned `release.output`
1296
+ as this override. `verifyApp` has no target option and does not infer the native
1297
+ directory or execute the application, its services or a platform host.
1231
1298
 
1232
1299
  ### Availability and normalization
1233
1300
 
@@ -1238,9 +1305,13 @@ by `packageApp`, without changing the app's saved destination.
1238
1305
  ```javascript
1239
1306
  import {verifyApp} from 'arcane-os';
1240
1307
 
1241
- async function useverifyApp(...arguments_) {
1242
- return verifyApp(...arguments_);
1243
- }
1308
+ // release is the result of packageApp() for this app and workspace.
1309
+ const inspected = await verifyApp({
1310
+ workspaceRoot,
1311
+ appId: 'moon-dashboard',
1312
+ outputDirectory: release.output
1313
+ });
1314
+ console.log(inspected.files);
1244
1315
  ```
1245
1316
 
1246
1317
  ## verifyAppReleaseBundle()
@@ -2210,6 +2281,13 @@ omitted and an authored empty list stays `[]`, so projection preserves automatic
2210
2281
  discovery versus entry-only selection. See
2211
2282
  [application document selection](protocols.md#application-document-selection).
2212
2283
 
2284
+ Optional `package.nativeResources` becomes top-level `nativeResources`.
2285
+ Omission remains omitted, an empty include remains `[]`, and an omitted exclude
2286
+ becomes `[]`. Package-only descriptor synthesis preserves the same selection.
2287
+ This is a packaging contract; `projectNativeDescriptor()` keeps its existing
2288
+ registry shape and ordinary include list. See
2289
+ [native-only application resources](protocols.md#native-only-application-resources).
2290
+
2213
2291
  ### Signature and result
2214
2292
 
2215
2293
  ```text
@@ -2666,10 +2744,12 @@ async function useloadArcaneIntegratedProvider(...arguments_) {
2666
2744
 
2667
2745
  ### Overview
2668
2746
 
2669
- Loads the package-owned portable provider when `arcaneRoot` is omitted and
2670
- `target` is `portable`. An explicit root retains the fixed Arcane OS checkout
2671
- provider route, including its errors; there is no silent fallback. Other native
2672
- targets still require that root. Normal Node module resolution owns imports.
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.
2673
2753
 
2674
2754
  ### Signature and result
2675
2755
 
@@ -4056,7 +4136,7 @@ Import it from `arcane-os`. Source mode accepts
4056
4136
  `{workspaceRoot=process.cwd(), appId, mode='source', host='127.0.0.1', port=0, httpPort=0, http=false,
4057
4137
  certPath, keyPath, tls, signal, onEvent}` and serves one validated
4058
4138
  workspace application plus its complete SDK or integrated runtime. Packaged mode uses
4059
- `{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, certPath, keyPath, tls,
4139
+ `{mode:'packaged', releaseRoot, workspaceRoot, host, port, httpPort, http=false, certPath, keyPath, tls,
4060
4140
  signal, onEvent}` and serves the complete selected release files.
4061
4141
  External source mode accepts both the installed-package route layout and the
4062
4142
  existing physical runtime layout. Installed-package mode serves the configured
@@ -4071,8 +4151,8 @@ The SDK request hook returns `308` for HTTP with a `Location` pointing to the
4071
4151
  actual HTTPS port while preserving the original request path and query. Both listeners
4072
4152
  use the selected host.
4073
4153
 
4074
- Source servers default to HTTPS, including localhost; packaged browser previews
4075
- require HTTPS. The existing `https` option is accepted; `https:false` and
4154
+ Source servers and packaged browser previews default to HTTPS, including
4155
+ localhost. The existing `https` option is accepted; `https:false` and
4076
4156
  `tls:false` alone do not disable HTTPS. HTTPS startup reads `.arcane/dev/server-cert.pem` and
4077
4157
  `.arcane/dev/server-key.pem` relative to `workspaceRoot` unless explicit
4078
4158
  `certPath` and `keyPath` are supplied together; relative paths resolve from the
@@ -4084,10 +4164,15 @@ handshake; browser trust and address matching are evaluated when a client
4084
4164
  connects. The CLI's `--public` selects the wildcard bind;
4085
4165
  the API's `host` option alone changes only the bind address.
4086
4166
 
4087
- 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
4088
4168
  certificate loading. `port` selects that listener's port, including `0` for an
4089
- available port. The same application, runtime and generated PWA routes are
4090
- served. `http` must be boolean; `http:true` rejects packaged mode, `https:true`,
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`,
4091
4176
  explicit certificate/key paths, a `tls` value other than `undefined`, `null` or
4092
4177
  `false`, and a nonzero `httpPort`. Browser secure-context and installation
4093
4178
  requirements remain browser-owned; see [explicit HTTP development](cli.md#explicit-http-development).
@@ -4097,10 +4182,10 @@ The promise settles after all selected listeners are ready and resolves to
4097
4182
  networkUrls, httpPort, httpOrigin, httpUrl, close, closed, lifecycle}`. `server` is the raw Node
4098
4183
  server for application content: `Http2SecureServer` for PEM-backed HTTPS,
4099
4184
  `https.Server` for explicit raw `tls` options, or `http.Server` for explicit
4100
- HTTP source mode. HTTP/2 uses Node's compatibility request/response APIs;
4185
+ HTTP mode. HTTP/2 uses Node's compatibility request/response APIs;
4101
4186
  callers accessing the raw server must account for its native type.
4102
4187
  `protocol` describes the URL scheme: `'https:'` for either negotiated HTTPS
4103
- protocol or `'http:'` with explicit HTTP source mode.
4188
+ protocol or `'http:'` with explicit HTTP mode.
4104
4189
  `url` and `cleanUrl` are the same application URL. Wildcard listeners use
4105
4190
  `localhost` in that local URL; `host` retains the actual bound address.
4106
4191
  `httpPort` is the actual HTTP listener port, `httpOrigin` is its HTTP origin,
@@ -4336,7 +4421,17 @@ console.log(validation.sdkInstallation?.packageVersion);
4336
4421
 
4337
4422
  ### Overview
4338
4423
 
4339
- Builds and retained-verifies one explicitly selected native target through one paired provider.
4424
+ Builds one explicitly selected target through its adapter. A paired native
4425
+ builder packages the selected app and its explicit bundled-app closure, then
4426
+ passes those complete releases to the provider. Provider verification and host
4427
+ launch remain separate operations.
4428
+
4429
+ The selected target reaches each app's packager, so every app's own
4430
+ `nativeResources` and separate native input directory apply consistently to
4431
+ both copying and output-overlap calculations. The provider receives the actual
4432
+ release roots, manifests and complete file readers. An explicit `nativeBuilder`
4433
+ retains its existing identity and contract. See
4434
+ [portable Core packaging](core-native-packaging.md#native-only-application-resources).
4340
4435
 
4341
4436
  ### Signature and result
4342
4437
 
@@ -4632,8 +4727,10 @@ described by `packageApp()`.
4632
4727
  The same low-level operation resolves the app's optional `outputDirectory`;
4633
4728
  there is no separate high-level destination override. `release.outputRoot`
4634
4729
  names the resulting complete release directory, with omitted configuration
4635
- retaining `dist/<app-id>`. Browser preview, bundle creation, and native
4636
- browser-content input use that selected root.
4730
+ retaining `dist/<app-id>`. Browser preview and bundle creation use that selected
4731
+ root. This ordinary package operation retains browser selection; paired native
4732
+ assembly through `buildApplication()` separately passes its actual target and
4733
+ applies each app's native-resource output selection.
4637
4734
 
4638
4735
  Packaging does not automatically run tests or checks. Verification occurs only
4639
4736
  when explicitly requested or when required for the selected release output.
@@ -5023,24 +5120,85 @@ import {registeredTestCount} from 'arcane-os';
5023
5120
  console.log(registeredTestCount());
5024
5121
  ```
5025
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
+
5026
5162
  ## runProcess()
5027
5163
 
5028
5164
  ### Overview
5029
5165
 
5030
- Runs one shell-free child command with complete stdout and stderr, ordered stream events, heartbeats, and process-tree cancellation.
5166
+ Runs one shell-free child command with complete stdout and stderr, ordered stream
5167
+ events, heartbeats, and explicitly selected process cancellation behavior.
5031
5168
 
5032
5169
  ### Signature, parameters, and result
5033
5170
 
5034
5171
  ```text
5035
- 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' }={})
5036
5173
  ```
5037
5174
 
5038
5175
  Import it from `arcane-os`. `command` is executed directly with `shell:false`;
5039
5176
  `args` must be a fixed array of strings, so shell expansion, pipelines, and
5040
5177
  redirection never occur. `cwd` selects the child directory. `env` is shallowly
5041
- merged over `process.env`. When supplied, `input` is written once and stdin is
5042
- closed; otherwise stdin is closed immediately. On Microsoft NT, `npm` and `npx`
5043
- are normalized to their Node CLI entrypoints.
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.
5044
5202
 
5045
5203
  `onEvent` is awaited in order for `process.starting`, nonempty
5046
5204
  `process.stdout`/`process.stderr` lines, coalesced `process.heartbeat`, and the
@@ -5060,12 +5218,21 @@ text stream preserves its complete content. A missing executable rejects with
5060
5218
  and spawn/runtime failures use the normalized SDK error boundary, with the
5061
5219
  nonzero result retained in error details.
5062
5220
 
5063
- Aborting `signal` emits cancellation-requested state, terminates the owned
5064
- process tree, escalates to a forced tree termination after the grace interval,
5065
- drains event delivery, and rejects with `ARCANE_CANCELLED` and exit code 130.
5066
- An `onEvent` failure also stops the tree and rejects with that callback failure.
5067
- Cancellation proves only that the local process tree was stopped; it cannot
5068
- reverse external effects already performed by the command.
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.
5069
5236
 
5070
5237
  ### Availability and normalization
5071
5238
 
@@ -6505,8 +6672,8 @@ console.log(CORE_READY_EVENTS.includes('core.ready')); // true
6505
6672
  ### Overview
6506
6673
 
6507
6674
  Describes the public fields for request, response, event, single-request
6508
- cancellation and all-request cancellation frames. These are wire descriptions,
6509
- not application validation or method admission.
6675
+ cancellation, all-request cancellation and `runtime.replay` control frames.
6676
+ These are wire descriptions, not application validation or method admission.
6510
6677
 
6511
6678
  ### Value and import
6512
6679
 
@@ -6640,11 +6807,11 @@ the client.
6640
6807
  ### Signature and result
6641
6808
 
6642
6809
  ```text
6643
- createCoreClient({global=globalThis, transport=null, eventOwner=arcaneEvents, eventOwnerReady, autoConnect=true, onError}={})
6810
+ createCoreClient({global=globalThis, transport=null, eventOwner=arcaneEvents, eventOwnerReady, autoConnect=true, replayRuntimeState=false, onError}={})
6644
6811
  ```
6645
6812
 
6646
6813
  Import it from `arcane-os/core/client`. The result exposes `invoke`, `receive`,
6647
- `connect`, `close`, `cancelAll`, `events`, `eventsReady`, `runtime.current()`,
6814
+ `connect`, `close`, `failTransport`, `cancelAll`, `events`, `eventsReady`, `runtime.current()`,
6648
6815
  `uuid`, `protocol` and `Error`. A supplied transport must provide callable
6649
6816
  `send(frame)`; an invalid transport stays disconnected and reports
6650
6817
  `ARCANE_TRANSPORT_INVALID`. Optional `subscribe(receive)` may return its cleanup
@@ -6656,6 +6823,21 @@ its still-pending request; a failure arriving after response, cancellation or
6656
6823
  timeout reaches `onError`. Deferred event-owner connection preserves the FIFO
6657
6824
  order of queued frames and subscription actions, including reentrant delivery.
6658
6825
 
6826
+ `replayRuntimeState:true` sends one observed `runtime.replay` control after the
6827
+ receive listener and `transport.ready` are established, without delaying page
6828
+ startup. The default is `false`; select replay only with a supporting host.
6829
+ Repeated connection calls do not repeat that control, and send failures reach
6830
+ `onError`. The host replays actual dispatcher and service state without
6831
+ restarting services; transport, Core and service readiness remain distinct.
6832
+
6833
+ `failTransport(error)` ends the client after an actual terminal transport
6834
+ failure. Pending RPCs and WebKit acknowledgements reject with the complete
6835
+ `CoreError`, future invocations reject with that failure, and `onError` observes
6836
+ it once. The client releases its owned listeners, callbacks and timers without
6837
+ sending cancellation frames to the failed transport. The first terminal failure
6838
+ returns `true`; an already closed client returns `false`. Ordinary `close()`
6839
+ retains its separate cancellation behavior.
6840
+
6659
6841
  ### Availability and normalization
6660
6842
 
6661
6843
  **Browser and native WebView JavaScript hosts.** Built-in transports select
@@ -6729,8 +6911,8 @@ client.close();
6729
6911
  ### Overview
6730
6912
 
6731
6913
  Installs one synchronous `globalThis.Arcane` facade and native
6732
- `__arcaneReceive` callback. Repeated installation returns the same client for
6733
- that global lifetime.
6914
+ `__arcaneReceive` and `__arcaneTransportFailed` callbacks. Repeated installation
6915
+ returns the same client for that global lifetime.
6734
6916
 
6735
6917
  ### Signature and result
6736
6918
 
@@ -6742,6 +6924,12 @@ Import it from `arcane-os/core/client`. The returned client is the same contract
6742
6924
  as `createCoreClient()`. Closing it releases subscriptions, native callbacks,
6743
6925
  timers and pending renderer requests; it does not kill Core.
6744
6926
 
6927
+ `__arcaneTransportFailed(error)` delegates actual terminal host failures to
6928
+ `client.failTransport(error)`. Closing or failing restores previous facade and
6929
+ callback globals only while the installation still owns them, preserving later
6930
+ replacements. `getInstalledCoreClient()` returns `null` after release, including
6931
+ before an installed terminal failure reaches `onError`.
6932
+
6745
6933
  ### Availability and normalization
6746
6934
 
6747
6935
  **Browser and native WebView JavaScript hosts.** Installation makes synchronous
@@ -6761,6 +6949,41 @@ try {
6761
6949
  }
6762
6950
  ```
6763
6951
 
6952
+ ## getInstalledCoreClient()
6953
+
6954
+ ### Overview
6955
+
6956
+ Reads the existing live SDK-installed client without installing, connecting or
6957
+ replacing a facade. Applications use this accessor instead of private fields.
6958
+
6959
+ ### Signature and result
6960
+
6961
+ ```text
6962
+ getInstalledCoreClient(global=globalThis)
6963
+ ```
6964
+
6965
+ Import it from `arcane-os/core/client`. It returns the exact client installed in
6966
+ the selected global, including a classic document-created installation, or
6967
+ `null` when no live SDK installation exists. A foreign `Arcane` facade does not
6968
+ constitute an SDK installation. Close and terminal failure release the
6969
+ installation before subsequent reads.
6970
+
6971
+ ### Availability and normalization
6972
+
6973
+ **Browser and native WebView JavaScript hosts.** This synchronous read changes
6974
+ no globals and starts no service, transport or model. The returned client's
6975
+ `runtime.current()` describes transport state; service readiness remains with
6976
+ its authoritative owner. See [Core browser client](core-client.md).
6977
+
6978
+ ### Example
6979
+
6980
+ ```javascript
6981
+ import {getInstalledCoreClient} from 'arcane-os/core/client';
6982
+
6983
+ const client = getInstalledCoreClient();
6984
+ console.log(client ? client.runtime.current() : 'No SDK client is installed.');
6985
+ ```
6986
+
6764
6987
  ## createCoreClassicSource()
6765
6988
 
6766
6989
  ### Overview
@@ -6771,13 +6994,17 @@ client and contracts. It creates no copied client implementation or bundler.
6771
6994
  ### Signature and result
6772
6995
 
6773
6996
  ```text
6774
- async createCoreClassicSource({eventOwnerModuleURL}={})
6997
+ async createCoreClassicSource({eventOwnerModuleURL,replayRuntimeState=false}={})
6775
6998
  ```
6776
6999
 
6777
7000
  Import it from `arcane-os/core/classic-source`. Supply the actual served URL for
6778
7001
  the selected SDK event-manager module. The promise resolves to the complete
6779
7002
  classic-script source.
6780
7003
 
7004
+ Optional `replayRuntimeState:true` forwards the current runtime-replay selection
7005
+ to the installed client. Omission retains the existing no-replay behavior; use
7006
+ `true` only when the composing host supports `runtime.replay`.
7007
+
6781
7008
  ### Availability and normalization
6782
7009
 
6783
7010
  **Node; generated source runs in browser and native WebView renderers.** The
@@ -6821,6 +7048,11 @@ Shutdown stops admission, waits accepted responses, then runs each service's
6821
7048
  startup, drain and dispose in order while independent services close
6822
7049
  concurrently.
6823
7050
 
7051
+ The `runtime.replay` control publishes current dispatcher and service state
7052
+ without restarting services. Its snapshot preserves complete service errors
7053
+ and active request state; see [runtime replay](core-runtime.md#state-and-frames)
7054
+ for authoritative readiness and reentrant lifecycle ordering.
7055
+
6824
7056
  ### Availability and normalization
6825
7057
 
6826
7058
  **Node on Windows, Linux and macOS native hosts; Android requires its native host
@@ -6976,17 +7208,24 @@ await transport.closed;
6976
7208
 
6977
7209
  Creates the SDK-owned native builder for one portable Core payload. The caller
6978
7210
  selects application service modules already present in the app release. The
6979
- provider does not load Arcane OS source, choose a model, download a runtime,
6980
- compile an executable or substitute for an unavailable platform host.
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.
6981
7215
 
6982
7216
  ### Signature and result
6983
7217
 
6984
7218
  ```text
6985
- createPortableNativeProvider({services=[]}={})
7219
+ createPortableNativeProvider({services,packagedWeb=false,webKitDocumentLifecycle=false}={})
6986
7220
  ```
6987
7221
 
6988
7222
  Import it from `arcane-os/native/portable-provider`. Each service selection is
6989
- `{module, options}`. The returned `arcane-native-builder/1` provider exposes
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
6990
7229
  `describe()`, `doctor()`, `prepare()`, `build()`, `verify()` and `run()`.
6991
7230
  `describe()` and successful payload results report `executable:false`; `run()`
6992
7231
  reports `ARCANE_NATIVE_RUN_UNSUPPORTED`.
@@ -7022,8 +7261,10 @@ console.log(await provider.describe());
7022
7261
 
7023
7262
  ### Overview
7024
7263
 
7025
- Package-owned portable provider with no preconfigured application services. It
7026
- is the named binding for the same object exposed as this subpath's default.
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.
7027
7268
 
7028
7269
  ### Value and import
7029
7270
 
@@ -7031,13 +7272,16 @@ is the named binding for the same object exposed as this subpath's default.
7031
7272
  const arcaneNativeBuilderProvider
7032
7273
  ```
7033
7274
 
7034
- 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.
7035
7277
 
7036
7278
  ### Availability and normalization
7037
7279
 
7038
- **Node; produces a portable payload rather than an executable host.** The
7039
- singleton retains the complete `arcane-native-builder/1` portable-provider
7040
- contract described by `createPortableNativeProvider()`.
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.
7041
7285
 
7042
7286
  ### Example
7043
7287
 
@@ -7061,12 +7305,14 @@ Default package binding for the same object exposed as
7061
7305
  default as arcaneNativeBuilderProvider
7062
7306
  ```
7063
7307
 
7064
- 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.
7065
7310
 
7066
7311
  ### Availability and normalization
7067
7312
 
7068
- **Node; produces a portable payload rather than an executable host.** The
7069
- default and named bindings have exact object identity and the same lifecycle.
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.
7070
7316
 
7071
7317
  ### Example
7072
7318
 
@@ -7078,6 +7324,303 @@ import portableProvider, {
7078
7324
  console.log(portableProvider === arcaneNativeBuilderProvider); // true
7079
7325
  ```
7080
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
+
7081
7624
  ## startCoreHost()
7082
7625
 
7083
7626
  ### Overview
@@ -9419,3 +9962,8 @@ const cancelled = normalizeAIRequestAbort(new DOMException('Cancelled', 'AbortEr
9419
9962
  ## Data export subpaths
9420
9963
 
9421
9964
  The package also exposes eight JSON Schemas (including `arcane-os/schemas/event-stack.json`) and its package manifest. These are data contracts, not callable JavaScript members. See [schema contracts](../architecture.md) and the files under `schemas/`.
9965
+
9966
+ `arcane-os/schemas/arcane-app.json` describes schema-2 `package.nativeResources`;
9967
+ `arcane-os/schemas/arcane-package.json` describes the projected schema-1
9968
+ `nativeResources`. Both use the existing literal application-relative path
9969
+ contract. See [native-only application resources](protocols.md#native-only-application-resources).