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
@@ -0,0 +1,331 @@
1
+ # Local AI through Core
2
+
3
+ Core owns native llama.cpp and Ollama processes and ONNX worker sessions. The browser retains its own
4
+ Wllama and ONNX implementations, and can also use an explicitly connected Core
5
+ when that system service is available. Runtime installation, model loading and
6
+ inference are separate operations.
7
+
8
+ Native ONNX runs caller-selected graphs with complete named input/output tensors.
9
+ Applications own preprocessing, tokenization and model-specific pipelines.
10
+ Browser ONNX continues through its existing browser implementation.
11
+
12
+ ## Application requirements
13
+
14
+ Declare required native runtimes in `arcane-app.json` under `native.localAI`.
15
+ The package projection retains the same record as `arcane-package.json.localAI`.
16
+ Existing native fields remain alongside this record:
17
+
18
+ ```json
19
+ {
20
+ "runtimes": [
21
+ {"id": "llama.cpp"},
22
+ {"id": "ollama"},
23
+ {"id": "onnx"}
24
+ ],
25
+ "llamaCpp": {
26
+ "modelsDirectory": "models/llama"
27
+ },
28
+ "ollama": {
29
+ "modelsDirectory": "models/ollama"
30
+ }
31
+ }
32
+ ```
33
+
34
+ Each runtime requirement accepts `id`, optional upstream `version`, and an
35
+ optional runtime archive `url`. ONNX resolves its official npm package or an
36
+ explicitly supplied package archive. A string runtime ID is also accepted.
37
+ Omitting the version allows reuse of an available runtime. Explicit versions
38
+ select that upstream distribution; an existing service must match the requested
39
+ version before it is reused. A service occupying the selected address is
40
+ preserved when its version cannot be established.
41
+
42
+ `llamaCpp` accepts `url`, `model`, `modelsDirectory`, and an `args` string array.
43
+ `model` selects a single GGUF file; `modelsDirectory` selects llama.cpp router
44
+ mode. Paths resolve from the application root. Ollama accepts `url`,
45
+ `modelsDirectory`, and `args`. The default endpoints are
46
+ `http://127.0.0.1:8080` and `http://127.0.0.1:11434`, respectively. Default model
47
+ directories are `.arcane/models/llama.cpp` and `.arcane/models/ollama` inside the
48
+ application. Applications choose and provision their models explicitly.
49
+
50
+ ## Development
51
+
52
+ ```sh
53
+ arcane dev --local-ai llama.cpp,ollama,onnx
54
+ ```
55
+
56
+ The option adds those runtime requirements to the authored application
57
+ configuration. Subsequent `arcane dev` runs reuse the saved requirements.
58
+ Development checks selected endpoints and existing executable paths, then
59
+ installs missing runtimes under the application's `.arcane/local-ai/runtimes`.
60
+ Runtime preparation runs alongside HTTP serving. Browser rendering continues
61
+ while installation and model readiness are pending.
62
+
63
+ The SDK downloads the official llama.cpp or Ollama distribution directly and
64
+ preserves its runtime libraries. Installation changes no global PATH, system
65
+ service or machine environment. Windows and macOS use the host archive utility;
66
+ Linux requires `tar`, and `unzip` when extracting a selected Windows ZIP.
67
+ Zstandard archives use the supported Node runtime's decompressor.
68
+
69
+ Selected ONNX preparation installs `onnxruntime-node@1.30.0` by default into a
70
+ managed npm prefix, retaining its complete published runtime dependency tree.
71
+ It uses the upstream CPU installation option to skip supplementary GPU downloads.
72
+ Node/npm must be available while preparing that runtime; a native app consumes
73
+ the bundled tree without installing it again. Applications that omit ONNX do
74
+ not install its package.
75
+
76
+ For the optional development browser connection, load the bootstrap after the
77
+ managed import map and before creating a Core-backed provider:
78
+
79
+ ```js
80
+ const {client} = await import('/arcane-local-ai.js');
81
+ const status = await client.invoke('localai.status');
82
+ console.log(status);
83
+ ```
84
+
85
+ The bootstrap uses the existing Core client with RPC and ordered SSE events.
86
+ Each browser connection owns its requests and cancellation. Closing a tab
87
+ cancels that tab's requests; closing development stops its owned runtime
88
+ processes. An already running external service remains running.
89
+
90
+ `developApplication()` returns its usual server handle and an optional `localAI`
91
+ handle with `ready`, `current()`, `handler()` and `close()`. Its `ready` promise
92
+ means installation and Core composition completed. Runtime/model readiness is
93
+ reported separately by Core status and lifecycle events. Preparation failures
94
+ remain on that promise and the operation event stream.
95
+
96
+ ## Core service
97
+
98
+ ```js
99
+ import {createLocalAIService} from 'arcane-os/core/local-ai';
100
+
101
+ const service = createLocalAIService(application.native.localAI, {
102
+ appRoot,
103
+ runtimes,
104
+ signal,
105
+ onEvent
106
+ });
107
+ ```
108
+
109
+ The result is a Core service definition. The launch context contains resolved
110
+ runtime records; the native builder supplies them automatically for a selected
111
+ application. `current()` returns the current snapshot without starting another
112
+ process. The service starts each selected runtime independently, retains its
113
+ process between requests, and joins cleanup during disposal.
114
+
115
+ `localai.status` returns `{runtimes}` and, when Ollama is selected, the existing
116
+ `ollama` and `models.ollama` catalog fields. Runtime records distinguish
117
+ `installed`, `available`, `state`, `models`, ownership and errors. A listening
118
+ service and a loaded model are separate facts.
119
+
120
+ `localai.services.recover({runtimes: ['llama.cpp']})` makes one explicit recovery
121
+ attempt for the selected runtimes; omission selects all configured runtimes.
122
+ Recovery restarts only SDK-owned processes and reconnects to external services.
123
+ Recovering ONNX releases its sessions; explicitly load models again afterward.
124
+ Its state is `recovering` and unavailable until the previous workers exit and
125
+ the new session owner is ready.
126
+ An external llama.cpp server returns HTTP 503 during initial model loading and
127
+ offers no readiness subscription at that stage. Core retains `state: 'loading'`;
128
+ a subsequent explicit load or recovery request checks again. There is no
129
+ background health polling.
130
+
131
+ | Method | Parameters | Result |
132
+ | --- | --- | --- |
133
+ | `llama.status` | `{}` | Runtime state and model catalog |
134
+ | `llama.models` | `{}` | `{models}` |
135
+ | `llama.load` | `{model}` | State after the exact model reports loaded |
136
+ | `llama.unload` | `{model}` | Current state after release |
137
+ | `llama.chat` | `{model,payload,stream?,streamId?}` | Complete OpenAI-shaped completion |
138
+
139
+ The `payload` is the complete request. SDK option names are translated only at
140
+ the upstream protocol boundary; messages, tool definitions and documents remain
141
+ unchanged. An explicit `payload.model` selects that request's model. Core waits
142
+ for its actual readiness before inference. Router model-load work is shared
143
+ between concurrent callers for the same model. Cancelling a caller stops its
144
+ wait; explicit unloading releases the model.
145
+
146
+ Streaming publishes every actual parsed upstream chunk as
147
+ `llama.chunk: {streamId,chunk}` and assembles the terminal completion. Upstream
148
+ stream errors remain visible as their original chunks and fail the request.
149
+ `localai.state` carries current runtime/model state. Router lifecycle events
150
+ observe load, sleep and unload changes. Direct servers expose readiness at
151
+ request boundaries; they do not offer the router's passive model event stream.
152
+
153
+ Unloading a model from an owned single-model server closes that owned process;
154
+ a subsequent load can start it again. Releasing an externally owned direct
155
+ server returns `released: true, unloaded: false`, retaining the real catalog
156
+ and leaving that server running.
157
+
158
+ Ollama retains the existing Core calls for `version`, `models`/`list`, `running`,
159
+ `show`, `chat`, `generate`, `embed`, `pull`, `push`, `create`, `copy`, and `delete`.
160
+ Those methods use Ollama's native API. Streaming uses the existing
161
+ `ollama.chunk: {streamId,chunk}` event. Application/OS preference operations
162
+ such as selection, settings and brain creation remain with their existing
163
+ owners; they are separate from this runtime service.
164
+
165
+ ## Browser llama.cpp provider
166
+
167
+ ```js
168
+ import {createCoreLocalAIProvider} from 'arcane-os/ai/core-local';
169
+ import {getAIProviderRuntime} from 'arcane-os/ai-provider-runtime';
170
+
171
+ const provider = createCoreLocalAIProvider({client});
172
+ const runtime = getAIProviderRuntime();
173
+ const unregister = runtime.register(provider);
174
+ ```
175
+
176
+ The provider implements `arcane-ai-provider/2` for the LLM role, with ID
177
+ `llama.cpp` by default. Configure an exact model through the existing provider
178
+ runtime, then load it. `catalog()`, `status()`, `inspect()`, `load()`, `request()`,
179
+ `unload()` and `dispose()` retain the shared lifecycle. Creating the provider
180
+ does not install software or select a model. A missing Core connection reports
181
+ unavailability, leaving browser Wllama/ONNX routes available for the application
182
+ to select.
183
+
184
+ If a router evicts the primary model while serving a request-specific model,
185
+ reload the primary selection before its next request. The provider does not
186
+ silently change the application's saved model choice. Release registration
187
+ with `unregister()` and dispose the provider at the application's owning
188
+ lifecycle boundary.
189
+
190
+ ## Native ONNX sessions
191
+
192
+ ```js
193
+ import {ensureLocalAIRuntimes} from 'arcane-os/local-ai';
194
+ import {createONNXRuntime} from 'arcane-os/local-ai/onnx';
195
+
196
+ const [runtime] = await ensureLocalAIRuntimes({
197
+ runtimes: ['onnx'], directory: '.arcane/local-ai/runtimes'
198
+ });
199
+ const onnx = createONNXRuntime({modulePath: runtime.modulePath});
200
+ try {
201
+ const loaded = await onnx.load({id: 'cheese-radar', model: absoluteModelPath});
202
+ // Supply the actual names, shapes and values expected by this graph.
203
+ const outputs = await onnx.run({id: loaded.id, feeds});
204
+ console.log(outputs);
205
+ } finally {
206
+ await onnx.close();
207
+ }
208
+ ```
209
+
210
+ The factory accepts `{modulePath,signal?,onEvent?}` and starts no worker until
211
+ `load({id,model,sessionOptions?,signal?})`. The model path is absolute for this
212
+ direct Node API. Session creation defaults to the CPU execution provider;
213
+ explicit native session options remain caller-owned. The returned session
214
+ record contains `id`, `model`, `state`, `loaded`, `error`, input/output names and
215
+ metadata. A live ID requires explicit unload before replacement. An ID may be
216
+ loaded again once its previous worker exits after a failed load or unload.
217
+ A run error retains the loaded session so a corrected request can use it.
218
+
219
+ `run({id,feeds,fetches?,runOptions?,signal?})` returns the complete output-name
220
+ map of `{type,dims,data}` tensors. Input records use that same shape with native
221
+ typed data or string arrays. Optional `fetches` selects output names or supplies
222
+ output tensors using the upstream API. Worker transport copies supplied tensor
223
+ data; returned output records contain the results, and caller-owned preallocated
224
+ buffers are not mutated in place. Each session retains its own worker and
225
+ loaded graph; work for independent sessions proceeds concurrently. Runs for one
226
+ session execute in order and wait at that session's loading boundary. There is
227
+ no token streaming in the generic tensor operation.
228
+
229
+ String input containing U+0000 reports an incompatibility at the native tensor
230
+ boundary: the Node binding uses null-terminated strings and cannot preserve
231
+ that input completely. The SDK does not alter the supplied string.
232
+
233
+ `current()` returns `{sessions,closed}`. `subscribe(listener)` replays current
234
+ state synchronously and returns an unsubscribe function. Load, readiness,
235
+ unload and failures remain observable. `unload({id,signal?})` releases that
236
+ session; `close()` owns all remaining workers and awaits their actual exits.
237
+
238
+ Cancelling a queued run removes that run. Cancelling active native work stops
239
+ delivery and retires its worker; the session becomes unavailable until loaded
240
+ again. ONNX Runtime's Node binding offers no native inference interruption:
241
+ worker termination can wait for a native call to return. Shutdown observes the
242
+ actual exit and does not claim that rejecting a request stopped native work.
243
+ Other sessions retain their own lifetimes.
244
+
245
+ ### ONNX through Core and the browser
246
+
247
+ | Core method | Parameters | Result |
248
+ | --- | --- | --- |
249
+ | `onnx.status` | `{}` | Runtime availability and current `models` session records |
250
+ | `onnx.load` | `{id,model,sessionOptions?}` | Loaded session; relative model paths resolve from `appRoot` |
251
+ | `onnx.run` | `{id,feeds,fetches?,runOptions?}` | Complete encoded tensor output map |
252
+ | `onnx.unload` | `{id}` | Released session record |
253
+
254
+ Use the browser accessor to handle the Core tensor transport:
255
+
256
+ ```js
257
+ import {createCoreONNXRuntime} from 'arcane-os/ai/core-onnx';
258
+
259
+ const onnx = createCoreONNXRuntime({client});
260
+ const stop = onnx.subscribe(function showRuntime(state) { console.log(state); });
261
+ await onnx.inspect();
262
+ await onnx.load({id: 'cheese-radar', model: 'models/cheese-radar.onnx'});
263
+ const outputs = await onnx.run({id: 'cheese-radar', feeds});
264
+ await onnx.unload({id: 'cheese-radar'});
265
+ stop();
266
+ onnx.close();
267
+ ```
268
+
269
+ The accessor exposes `load`, `run`, `unload`, `inspect`, `current`, `subscribe`
270
+ and `close`. Request methods accept `signal` and optional `timeoutMs` (default
271
+ `0`, no elapsed-time cutoff). It preserves full typed tensor values, including
272
+ 64-bit integers, floating-point special values and strings, through the
273
+ transport codec. `current()` adds `busy` and `closed` to its latest Core state.
274
+ Closing the accessor cancels its requests and subscriptions; model unloading
275
+ is explicit because other accessors may share the Core session. It never
276
+ closes the shared Core client.
277
+
278
+ Construction neither opens a connection nor installs a runtime. A browser needs
279
+ an already available native Core service or the explicit development bridge.
280
+ Unavailable native ONNX leaves browser ONNX/Wllama under the application's
281
+ existing selection. This tensor API does not select an LLM, tokenizer, speech,
282
+ image or avatar pipeline.
283
+
284
+ Native ONNX CPU package targets are Windows, Linux and macOS on `x64`/`arm64`,
285
+ as listed in Microsoft's [Node binding platform matrix](https://github.com/microsoft/onnxruntime/blob/v1.30.0/js/node/README.md).
286
+ Android needs its host's native ONNX adapter; the Node package contains no
287
+ Android binding. Platform support here describes upstream package targets,
288
+ not execution evidence on each platform.
289
+
290
+ ## Native bundling
291
+
292
+ The SDK portable native build includes selected official runtime trees under
293
+ `runtime/local-ai/<runtime-id>`. Runtime records in the artifact are relative
294
+ to the artifact root and resolve on the destination machine. The generated
295
+ Core entry composes the local AI service only when the application selects it.
296
+ Model files remain application-selected native resources.
297
+
298
+ `ensureLocalAIRuntimes()` and `bundleLocalAIRuntimes()` are exported from
299
+ `arcane-os/local-ai`. Both accept `{runtimes,directory,platform,architecture,
300
+ signal,onEvent}`; bundling also requires `outputRoot`. Platform names follow
301
+ Node: `win32`, `linux`, `darwin`, and supported Android distributions.
302
+ Architectures are `x64` or `arm64`. Availability depends on the upstream
303
+ runtime's published platform assets; Ollama has no official Android runtime
304
+ archive in this installer.
305
+
306
+ Ensure returns absolute `{id,version,platform,architecture,root}` records.
307
+ Server runtimes also include `executable`; ONNX includes `modulePath` pointing
308
+ to its public package entry. Bundle returns `{runtimes,files}`,
309
+ with artifact-relative runtime paths and a complete emitted file inventory.
310
+ Bundling requires a fresh native staging destination, preserving existing
311
+ completed outputs.
312
+
313
+ ### NeMo Speech library runtime
314
+
315
+ The runtime helpers also accept `{id: 'nemo-speech', version: '0.2.0'}` to
316
+ prepare NVIDIA's official CPU library distribution. An omitted NeMo version
317
+ selects `0.2.0`. Its published targets are Windows `x64`, Linux `x64`/`arm64`,
318
+ and macOS `x64`/`arm64`.
319
+
320
+ NeMo records include `includeDirectory`, `libraryDirectory`, `binaryDirectory`,
321
+ and `cmakeDirectory`; they have no server `executable`. The complete upstream
322
+ tree remains under `root`, including any archive prefix directory. Use the
323
+ returned `cmakeDirectory` as `NeMoSpeech_DIR` when calling
324
+ `find_package(NeMoSpeech CONFIG REQUIRED COMPONENTS Diarization)`, then link
325
+ the upstream `NeMoSpeech::Diarization` target. Bundling preserves the complete
326
+ tree and makes all these paths relative to the native artifact root.
327
+
328
+ This helper installs the library. The application configuration and development
329
+ CLI select llama.cpp, Ollama and ONNX services described above;
330
+ NeMo model selection and a native diarization helper belong to their owning
331
+ integration.
@@ -47,12 +47,14 @@ These protocols normalize orchestration and results. They do not normalize a
47
47
  Windows EXE, Linux DEB, Android APK, and portable directory into the same
48
48
  artifact kind.
49
49
 
50
- Portable CLI operations load the installed SDK's
51
- `arcane-os/native/portable-provider` by default. Explicit `--arcane-root`
52
- selection retains the checkout provider route; executable targets still need
53
- their platform provider/toolchain. `arcane-os/core/host` composes the reusable
54
- native runtime with explicitly supplied app services. Neither export is a
55
- browser import, executable host or installer. The synchronous classic facade
50
+ Portable CLI operations load `arcane-os/native/portable-provider`; Windows x64
51
+ loads `arcane-os/native/windows-provider`, both from the installed SDK by
52
+ default. The Windows provider assembles the matching precompiled WebView2/SEA
53
+ host release asset. Explicit `--arcane-root` selection retains the checkout
54
+ route; Linux and Android still need their platform provider/toolchain.
55
+ `arcane-os/core/host` composes the reusable native runtime with explicitly
56
+ supplied app services. These Node entries remain separate from browser imports;
57
+ portable itself remains a non-executable payload. The synchronous classic facade
56
58
  and browser-safe client retain their separate public entries. Integrated
57
59
  shared checks keep their existing Arcane OS development provider.
58
60
 
@@ -147,9 +149,70 @@ included resources without receiving application-document processing.
147
149
  Component processing and shared runtime-resource traversal retain their existing
148
150
  behavior. Offline inclusion still follows the app's PWA resource selection.
149
151
 
152
+ ## Native-only application resources
153
+
154
+ An application's schema-2 `arcane-app.json` can explicitly select server modules
155
+ and their complete app-owned source closure without adding them to its browser
156
+ or PWA output:
157
+
158
+ ```json
159
+ {
160
+ "package": {
161
+ "include": ["index.html", "modules", "css"],
162
+ "nativeResources": {
163
+ "include": ["server", "src", "package.json"],
164
+ "exclude": ["server/drafts"]
165
+ }
166
+ }
167
+ }
168
+ ```
169
+
170
+ This is a package excerpt. Each path is literal and relative to the application
171
+ root; a directory includes its descendants. The app selects the full required
172
+ closure explicitly. The SDK does not crawl imports to discover server source,
173
+ filter it by extension, install app dependencies or execute a service.
174
+ `nativeResources.include` is required and may be empty; `exclude` defaults to
175
+ `[]`. Descriptor projection writes the same record at the top level of schema-1
176
+ `arcane-package.json`, and package-only apps may author it there directly.
177
+ Omission remains omission. The native registry descriptor is unchanged.
178
+
179
+ `packageApp({target})` and `inspectApp({target})` default to `'browser'`. A
180
+ nonbrowser SDK target adds these resources to the ordinary app/shared selection.
181
+ Native exclusions apply only to the additional selection, not the browser
182
+ selection. A file selected by both is emitted once through its ordinary browser
183
+ processing. Files selected only as native resources retain their complete
184
+ original content, including imports, HTML, line endings and data. They are copied
185
+ after browser document discovery, module projection, asset rewriting and PWA
186
+ processing, and appear in the complete release inventory. A collision with
187
+ generated output reports an error instead of replacing that output.
188
+
189
+ Target and module representation are independent: `moduleFormat:'native'`
190
+ controls browser module/script packaging and does not select native resources.
191
+ Nonbrowser targets use effective `browserPwa:false`; ordinary browser calls keep
192
+ their configured PWA behavior. An app adapter receives `target` and effective
193
+ `browserPwa` in its existing `buildArcanePackage()` context. Its `copyBase()`
194
+ copies ordinary browser/shared files; the packager appends native-only files
195
+ after the adapter and browser transformations finish.
196
+
197
+ A nonbrowser target with a nonempty native include list writes its app input to
198
+ `dist/.native/<target>/<app-id>`, even when the saved browser `outputDirectory`
199
+ is custom. This keeps an existing browser/PWA output separate. An explicit
200
+ low-level `outputDirectory` override takes precedence; it must name the
201
+ dedicated output the caller intends to replace. Omitted or empty native
202
+ resources preserve the existing output rules. `inspectApp()` reports the
203
+ effective `output` and complete selected files without writing them.
204
+
205
+ Paired native `buildApplication()` applies the same selected target and output
206
+ resolution to the selected app and every explicitly bundled app. Each app keeps
207
+ its own declaration; the provider receives actual release roots and complete
208
+ release records. Native artifact `outputRoot` remains a different directory.
209
+ Use `verifyApp({workspaceRoot,appId,outputDirectory:release.output})` to inspect
210
+ that emitted app release; verification does not launch its services or host.
211
+ See [the portable service composition guide](core-native-packaging.md#native-only-application-resources).
212
+
150
213
  ## App-selected package output
151
214
 
152
- An app may set `"outputDirectory": "ai"` in its schema-1
215
+ For browser selection, an app may set `"outputDirectory": "ai"` in its schema-1
153
216
  `arcane-package.json`. This selects the final directory relative to the
154
217
  workspace: `<workspace>/ai`, not `<workspace>/ai/<app-id>`. Omitting the
155
218
  field retains `dist/<app-id>`. The root `arcane-packager.json` configuration
@@ -185,6 +248,10 @@ output must remain separate; a conflicting native assembly fails before it
185
248
  packages any app. App launch paths, resource URLs, and enabled PWA
186
249
  representations retain their package-relative layout.
187
250
 
251
+ The [native-only resource selection](#native-only-application-resources) above
252
+ adds a separate default native input directory when its include list is nonempty.
253
+ An explicit low-level output override still selects the exact directory to replace.
254
+
188
255
  ## Native-module package output
189
256
 
190
257
  The public `packageApp` operation accepts `moduleFormat:'native'`. Omission, or
@@ -193,6 +260,9 @@ The public `packageApp` operation accepts `moduleFormat:'native'`. Omission, or
193
260
  accepts that same override. Configuration, source layout, app identity, storage
194
261
  scope and previously generated sibling outputs remain unchanged.
195
262
 
263
+ This module format does not select a native target. Use the separate `target`
264
+ option for [native-only resources](#native-only-application-resources).
265
+
196
266
  The native transformation runs in the selected package stage after application
197
267
  adapter work, before the final inventory and any enabled PWA artifacts. It uses
198
268
  the existing selected document/runtime records and shared lexical/HTML owners.
@@ -979,10 +1049,15 @@ or a dependency is ready.
979
1049
 
980
1050
  ### Microsoft NT / WebView2
981
1051
 
982
- The renderer uses the WebView2 host messaging surface. The host binds one app
983
- identity and native policy to the session before Core dispatch. Microsoft NT
984
- can expose managed-service and privileged platform operations that do not exist
985
- in an ordinary browser.
1052
+ The SDK Windows host mounts the selected app at a virtual HTTPS origin and
1053
+ injects the canonical classic facade before application scripts. Ordered
1054
+ `arcane/1` requests and complete responses cross its owned WebView2/Core bridge;
1055
+ each connected document requests authoritative runtime/service replay. Its
1056
+ selected service composition supplies the actual methods. Closing the window
1057
+ cancels renderer requests and drains accepted service work before Core exits.
1058
+ See [Windows executable packaging](core-native-packaging.md#windows-executable).
1059
+ Arcane OS can separately compose product policy and privileged services; the
1060
+ generic SDK host does not copy that product composition.
986
1061
 
987
1062
  ### Linux / WebKitGTK
988
1063
 
@@ -1002,12 +1077,13 @@ reachable.
1002
1077
 
1003
1078
  ### macOS
1004
1079
 
1005
- No macOS executable target, native bridge, platform host, artifact, or run
1006
- contract is exposed by this SDK version. A browser may still run browser-only
1007
- application code. A separately composed macOS host may use the reusable Node
1008
- Core runtime, framed stdio transport, host composition, and portable payload,
1009
- but those SDK primitives do not create a native bridge or executable host and
1010
- do not by themselves satisfy a native capability.
1080
+ This version includes Foundation-only `ArcaneCoreProcess` source for an
1081
+ explicit executable, framed pipes and graceful child lifecycle. It supplies no
1082
+ macOS renderer bridge, executable target, artifact or run command. A separately
1083
+ composed macOS host may combine that source with the reusable Node runtime,
1084
+ stdio transport, host composition and portable payload. Source delivery does
1085
+ not establish compilation or execution on macOS. See
1086
+ [the macOS process-source contract](core-native-packaging.md#macos-process-source).
1011
1087
 
1012
1088
  ## Development and remote HTTP transport
1013
1089
 
@@ -1091,9 +1167,10 @@ The common contract ends where platform truth must remain different:
1091
1167
  not run an unrelated browser implementation as a substitute;
1092
1168
  - the portable target defaults to the installed SDK provider and assembles a
1093
1169
  non-executable payload without an Arcane OS checkout;
1094
- - executable native targets require their explicit checkout/provider, and the
1095
- composed host must supply the protocol, version, features, capabilities,
1096
- methods, and services that its application contract requires;
1170
+ - Windows x64 defaults to the installed SDK's matching precompiled host;
1171
+ Linux/Android retain explicit checkout/providers. Every composed host must
1172
+ supply the protocol, version, features, capabilities, methods and services
1173
+ that its application contract requires;
1097
1174
  - that current-build compatibility does not promise that a future SDK will accept
1098
1175
  this Core or that this SDK will accept a future Core.
1099
1176
 
@@ -261,11 +261,14 @@ origin root and starts at the selected app entry: `/index.html` for a standalone
261
261
  root app with that entry, or `/apps/<id>/<entry>` for a nested app. Use one
262
262
  selected app per development origin. The SDK uses `node-http-server` for source
263
263
  and packaged-preview serving, including conditional resource responses.
264
- Arcane development servers default to HTTPS, including localhost, and packaged
265
- browser previews require HTTPS. Configure the workspace certificate pair before
264
+ Arcane development servers and packaged browser previews default to HTTPS,
265
+ including localhost. Configure the workspace certificate pair before
266
266
  starting the ordinary command; see [development HTTPS setup](cli.md#development-https-setup).
267
267
  Explicit source-only `arcane dev --http` serves the same generated PWA routes
268
268
  without loading certificates; see [explicit HTTP development](cli.md#explicit-http-development).
269
+ API callers may select `http:true` in packaged mode to serve the existing
270
+ packaged web root, without generating or changing its PWA files. Browser
271
+ secure-context and installation requirements remain browser-owned.
269
272
  `--public` selects the IPv4 wildcard bind address; it does not enable PWA
270
273
  configuration, change manifest metadata, or determine browser installability.
271
274
 
@@ -2252,10 +2252,11 @@ and `read`, filters source metadata before calling
2252
2252
  ### Availability and normalization
2253
2253
 
2254
2254
  **Browser or compatible host with an injected DBOPFS adapter.** The adapter
2255
- keeps the existing `get`, `set`, `getAllKeys`, and `delete` method names; Node
2256
- can use the same class only through an explicitly imported runtime module and a
2257
- compatible storage adapter; SDK `0.5.12` publishes no Node package subpath or
2258
- Node storage implementation for it. Bootstrap uses a concurrent
2255
+ keeps the existing `get`, `set`, `getAllKeys`, and `delete` method names. Node
2256
+ callers import the same class and factory from the public
2257
+ `arcane-os/dbopfs-document-library` subpath and supply a compatible storage
2258
+ adapter. That export supplies no Node filesystem storage implementation.
2259
+ Bootstrap uses a concurrent
2259
2260
  generation, commits its manifest last, cleans partial data on failure, and
2260
2261
  rejects case-colliding IDs. Search
2261
2262
  returns `{failures,matches,total}` so one malformed record remains visible
@@ -2414,7 +2415,7 @@ const search = new DocumentLexicalSearch([{
2414
2415
  kind: 'guide',
2415
2416
  tags: ['intro']
2416
2417
  }]);
2417
- console.log(search.search('portable', {limit: 5}));
2418
+ console.log(search.search('portable'));
2418
2419
  ```
2419
2420
 
2420
2421
  ## DocumentNavigation.js