arcane-os 0.5.10 → 0.5.11

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 (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +117 -26
  3. package/browser-runtime/ai/browser-speech-providers.mjs +1 -1
  4. package/docs/architecture.md +303 -0
  5. package/docs/compatibility.md +38 -0
  6. package/docs/event-manager.md +263 -0
  7. package/docs/platform-targets.md +104 -0
  8. package/docs/publishing.md +126 -0
  9. package/docs/reference/README.md +206 -0
  10. package/docs/reference/ai/browser-speech.md +813 -0
  11. package/docs/reference/ai/browser-wasm.md +637 -0
  12. package/docs/reference/ai/twin-cloud.md +156 -0
  13. package/docs/reference/arcane-ollama.md +288 -0
  14. package/docs/reference/availability-and-normalization.md +224 -0
  15. package/docs/reference/behavioral-testing.md +129 -0
  16. package/docs/reference/cli.md +820 -0
  17. package/docs/reference/core/README.md +61 -0
  18. package/docs/reference/core/arcane-ai-contracts.md +907 -0
  19. package/docs/reference/core/arcane-api.md +601 -0
  20. package/docs/reference/core/arcane-entities.md +59 -0
  21. package/docs/reference/core/arcane-events.md +134 -0
  22. package/docs/reference/core/ollama-module.md +181 -0
  23. package/docs/reference/core/reference/arcane-api/ai-and-ollama.md +1909 -0
  24. package/docs/reference/core/reference/arcane-api/applications-terminal-capabilities.md +1057 -0
  25. package/docs/reference/core/reference/arcane-api/core-and-events.md +320 -0
  26. package/docs/reference/core/reference/arcane-api/filesystem-storage-preferences-appearance.md +610 -0
  27. package/docs/reference/core/reference/arcane-api/namespaces.md +1157 -0
  28. package/docs/reference/core/reference/arcane-api/platform-installation-users-system.md +1423 -0
  29. package/docs/reference/core/reference/arcane-api/session-provisioning-diagnostics-development.md +315 -0
  30. package/docs/reference/event-manager.md +1409 -0
  31. package/docs/reference/inventory/package-api.json +3194 -0
  32. package/docs/reference/inventory/runtime-components.json +1015 -0
  33. package/docs/reference/inventory/runtime-entities.json +25 -0
  34. package/docs/reference/inventory/runtime-modules.json +1367 -0
  35. package/docs/reference/mail.md +309 -0
  36. package/docs/reference/protocols.md +749 -0
  37. package/docs/reference/runtime-components.md +1529 -0
  38. package/docs/reference/runtime-entities.md +305 -0
  39. package/docs/reference/runtime-modules.md +3275 -0
  40. package/docs/reference/sdk-api.md +6733 -0
  41. package/docs/roadmap.md +79 -0
  42. package/docs/work-amplification.md +66 -0
  43. package/examples/wasm-ai-demo/README.md +80 -0
  44. package/examples/wasm-ai-demo/app.js +787 -0
  45. package/examples/wasm-ai-demo/index.html +343 -0
  46. package/examples/wasm-ai-demo/profile-tools.js +217 -0
  47. package/examples/wasm-ai-demo/profiles/BOSS.Modelfile +106 -0
  48. package/examples/wasm-ai-demo/profiles/PreCrisis.Modelfile +693 -0
  49. package/examples/wasm-ai-demo/rag/boss-library.json +3006 -0
  50. package/examples/wasm-ai-demo/rag.js +295 -0
  51. package/examples/wasm-ai-demo/server.mjs +71 -0
  52. package/package.json +10 -1
  53. package/runtime/arcane/modules/AI.js +1 -1
  54. package/runtime/arcane/modules/AIProviderRuntime.js +26 -5
@@ -0,0 +1,820 @@
1
+ # Arcane CLI reference
2
+
3
+ The `arcane` and `arcane-os` executables invoke the same headless SDK toolchain.
4
+ Use the command name that is unambiguous in the current project; project-local
5
+ scripts should resolve the exact package version pinned by the app's lockfile.
6
+
7
+ Every potentially blocking operation acknowledges before it begins, owns its
8
+ work, emits progress or heartbeat records, observes cancellation where safe,
9
+ and exits nonzero on failure. Machine output is defined by
10
+ `arcane-cli-events/1`.
11
+
12
+ ## Command inventory
13
+
14
+ | Command | Scope and result |
15
+ | --- | --- |
16
+ | `arcane new <id>` | Creates one external app workspace. |
17
+ | `arcane init [id]` | Initializes one app in an external or integrated workspace without rewriting unrelated files. |
18
+ | `arcane doctor` | Reads and reports Node/tooling, SDK runtime, workspace, optional Arcane source recognition, and supported managed ArcaneOllama readiness. |
19
+ | `arcane import-map` | Refreshes one app's managed browser import map and every directly navigable descriptor-selected HTML/HTM document. |
20
+ | `arcane upgrade` | Runs the external application's ordinary `npm upgrade` command. |
21
+ | `arcane dev` | Starts one owned browser development server for one selected app. |
22
+ | `arcane test` | Runs one app test boundary or one explicit integrated shared test file. |
23
+ | `arcane check` | Validates one app boundary or the canonical integrated shared check. |
24
+ | `arcane package` | Creates one browser release, or plans it with `--dry-run`. |
25
+ | `arcane verify` | Validates one explicitly selected existing browser release. |
26
+ | `arcane bundle` | Creates one deterministic external-app release archive. |
27
+ | `arcane verify-bundle` | Verifies one deterministic external-app release archive without extraction. |
28
+ | `arcane native-doctor` | Diagnoses one explicit native provider and host. |
29
+ | `arcane native-prepare` | Runs one standalone provider toolchain preparation diagnostic. |
30
+ | `arcane build` | Packages, plans, and builds one target artifact. |
31
+ | `arcane run` | Serves an existing browser release, or packages, plans, builds, and launches one paired native artifact. |
32
+ | `arcane update-check` | Performs one explicit, read-only npm dist-tag query for the installed SDK version. |
33
+ | `arcane targets` | Lists target ids, declared status, formats, architectures, signing profiles, methods, and pairing reason. |
34
+ | `arcane repo status\|pull\|push` | Runs one selected repository operation for the current app workspace. |
35
+ | `arcane mail key set\|status\|delete` | Manages one server-only Resend API-key profile in Windows Credential Manager. |
36
+ | `arcane mail send` | Performs one explicit, idempotency-keyed Resend attempt from a complete JSON report on redirected stdin. |
37
+ | `arcane mail serve` | Starts one credential-protected numeric-loopback Arcane-to-Resend gateway for the selected app, Origin, and recipients. |
38
+
39
+ ## Parser-wide options
40
+
41
+ The parser recognizes these names before the selected command applies its own
42
+ meaning and cardinality rules:
43
+
44
+ | Option | Value / form | Meaningful commands |
45
+ | --- | --- | --- |
46
+ | `--path` | directory | `new` |
47
+ | `--display-name` | string | `new`, `init` |
48
+ | `--workspace` | directory | Commands that select an external or integrated workspace; defaults to `.`. |
49
+ | `--app` | app id | Workspace/app operations except shared scope and `verify-bundle`; also the exact `mail serve` caller id. |
50
+ | `--arcane-root` | directory | `doctor`, native `build`/`run`, `native-doctor`, `native-prepare` |
51
+ | `--host` / `--port` | host / integer 0–65535 | Browser `dev`/`run` default to `127.0.0.1:8000`; `mail serve` defaults to `127.0.0.1:8025` and admits numeric loopback only. |
52
+ | `--target` | target id | `new`, `init`, native diagnostics, `build`, `run` |
53
+ | `--format` / `--signing` | target-supported values | Native diagnostics, `build`, `run` |
54
+ | `--output-root` | directory | Native `build` and `run` |
55
+ | `--scope` | `app` or `shared` | `test`, `check`; defaults to `app`. |
56
+ | `--test-file` | repository-relative `.test.mjs` | `test --scope shared` only |
57
+ | `--artifact` | bundle path | `bundle`, `verify-bundle` |
58
+ | `--profile` | credential profile id | `mail send`, `mail serve` |
59
+ | `--from` | verified sender | `mail send`, `mail serve` |
60
+ | `--origin` | exact browser origin | `mail serve` |
61
+ | `--allow-to` | optional comma-separated addresses | `mail serve` |
62
+ | `--report-key` | nonempty safe-character string | `mail send`; caller-owned stable Resend idempotency key |
63
+ | `--request-timeout` | optional integer from 1 through 2147483647 milliseconds | `mail send`, `mail serve` |
64
+ | `--output` | `human`, `json`, `ndjson` | Every invocation; the final occurrence wins. |
65
+ | `--git` | flag | `new` |
66
+ | `--skip-tests` | flag | `check --scope app` |
67
+ | `--dry-run` | flag | `package`; parser-supported on `build` with the boundary below |
68
+ | `--require-local-ai` | flag | `doctor` |
69
+ | `--overwrite` | flag | `bundle` only |
70
+ | `--secret-stdin` | flag | `mail key set`; requires redirected input |
71
+ | `--app-key-stdin` | flag | `mail serve`; requires redirected input |
72
+ | `--report-stdin` | flag | `mail send`; requires redirected JSON input |
73
+ | `--help`, `-h` | flag | Prints help and exits zero. |
74
+ | `--version`, `-v` | flag | Prints the exact SDK version and exits zero. |
75
+
76
+ Value options accept `--name value` and `--name=value`; a bare `--` ends option
77
+ parsing. Repeated value options currently use the last value, and repeated flags
78
+ are idempotent. Unknown names, missing values, excess positionals, invalid
79
+ command-specific enums/cardinality, and the explicitly rejected cross-command
80
+ cases fail before work begins.
81
+
82
+ Other recognized but inapplicable options are not yet uniformly rejected. They
83
+ can be parsed and then ignored by a command. Do not depend on that permissive
84
+ behavior: pass only the options listed for the selected command.
85
+
86
+ ## Output and exit contract
87
+
88
+ Human mode writes progress and terminal diagnostics to stderr and the selected
89
+ result to stdout. JSON mode writes accepted/running event envelopes to stderr
90
+ and exactly one final JSON success or error envelope to stdout. NDJSON mode
91
+ writes every ordered event, including its one terminal event, to stdout.
92
+
93
+ Structured payload normalization converts `bigint` to decimal text and errors
94
+ to the public error record, omits functions, symbols, `undefined`, and cycles,
95
+ and keeps repeated non-cyclic values. Exit status is `0` for success, `1` for an
96
+ ordinary usage/operation failure, and `130` for cancellation. The separate
97
+ `arcane-test` infrastructure runner uses status `2` for its own infrastructure
98
+ failure; it is not an `arcane` command.
99
+
100
+ ## `arcane new`
101
+
102
+ ### Overview
103
+
104
+ Creates one repository-shaped external application workspace and the selected
105
+ app. It never creates more than one app or silently installs a global SDK.
106
+
107
+ ```text
108
+ arcane new <id> [--path <directory>] [--display-name <name>] [--target <target>] [--git]
109
+ ```
110
+
111
+ ### Options and result
112
+
113
+ `--path` selects the new workspace, `--display-name` sets presentation text,
114
+ `--target` declares one initial target, and `--git` initializes that exact
115
+ directory as a repository. Native target scaffolds also retain `browser` and
116
+ include the required icon. The result reports the workspace, app, descriptor,
117
+ target, and created paths.
118
+
119
+ ### Example
120
+
121
+ ```bash
122
+ npm exec -- arcane new hello-arcane --path ./hello-arcane --target portable --git
123
+ ```
124
+
125
+ ## `arcane init`
126
+
127
+ ### Overview
128
+
129
+ Adds missing Arcane application files to one existing workspace. Integrated
130
+ initialization writes only the selected `apps/<id>/` boundary and does not add
131
+ an SDK dependency to the Arcane OS repository.
132
+
133
+ ```text
134
+ arcane init [id] [--workspace <directory>] [--app <id>] [--display-name <name>] [--target <target>]
135
+ ```
136
+
137
+ ### Errors and safety
138
+
139
+ Existing conflicting files, invalid ids, an ambiguous app selection, or an
140
+ incompatible workspace fail rather than being overwritten. Initialization is
141
+ idempotent only for files whose existing content satisfies the scaffold
142
+ contract.
143
+
144
+ ### Example
145
+
146
+ ```bash
147
+ npm exec -- arcane init reports --target browser
148
+ ```
149
+
150
+ ## `arcane doctor`
151
+
152
+ ### Overview
153
+
154
+ Performs read-only Node, npm, Git, SDK runtime, workspace, optional Arcane
155
+ source-checkout recognition, and supported ArcaneOllama managed-service
156
+ assessment. It reports unavailable optional capabilities without turning them
157
+ into packaging failures.
158
+
159
+ ```text
160
+ arcane doctor [--workspace <directory>] [--app <id>] [--arcane-root <directory>] [--require-local-ai]
161
+ ```
162
+
163
+ ### Availability
164
+
165
+ The SDK/runtime checks are **Node**. `--arcane-root` only checks for the
166
+ expected Arcane development-lifecycle source marker; it does not load or
167
+ diagnose a native target provider. Use `native-doctor --target ...` for that
168
+ boundary. Managed ArcaneOllama inspection currently runs on Windows and reports
169
+ unsupported elsewhere. Doctor never installs, repairs, starts, or mutates
170
+ Ollama. `--require-local-ai` changes an otherwise optional local-AI readiness
171
+ failure into a failed doctor result.
172
+
173
+ ### Example
174
+
175
+ ```bash
176
+ npm exec -- arcane doctor --workspace . --arcane-root "../Arcane OS"
177
+ ```
178
+
179
+ ## `arcane import-map`
180
+
181
+ ### Overview
182
+
183
+ Refreshes one selected application's physical browser runtime map, generates
184
+ its standard browser import map, discovers every directly navigable
185
+ `.html`/`.htm` document admitted by the selected descriptor's existing
186
+ include/exclude rules, and commits the map artifact plus those managed documents
187
+ as one transactional refresh. A directly navigable entry document declares exactly
188
+ one `<meta name="arcane-app-id" content="<selected-id>">`; an unmarked secondary
189
+ document may instead carry an active `<base>`.
190
+ Wrong or duplicate explicit app identity fails. The renderer then requires one
191
+ path-correct base for every selected document. Included HTML files with neither
192
+ the identity marker nor an active base are component fragments: they remain
193
+ package files and are not rewritten with a document-level import map.
194
+ Packaging and development use the same discovery owner, so directly navigable
195
+ source pages and packaged pages receive the same complete managed import-map JSON.
196
+
197
+ ```text
198
+ arcane import-map [--workspace <directory>] [--app <id>]
199
+ ```
200
+
201
+ `--workspace` defaults to the current directory. `--app` selects one app when
202
+ the workspace does not already identify exactly one. The command accepts no
203
+ positional arguments and supports app scope only. `arcane-os import-map` is the
204
+ identical executable alias.
205
+
206
+ The generated artifact is
207
+ `apps/<id>/modules/arcane.importmap.json`. Its exact JSON is also installed in
208
+ the configured entry and every other admitted browser document as `<script
209
+ type="importmap" data-arcane-import-map>` before module loading. The complete
210
+ physical-v1 runtime derives its entries from the installed runtime and
211
+ browser-runtime inventories. It intentionally has no package-root mapping;
212
+ portable runtime subpaths such as `arcane-os/preference-store` and
213
+ `arcane-os/speech-playback` instead map directly to their canonical projected
214
+ modules. The result reports the complete map written to the selected
215
+ application; no fixed entry count is a release contract.
216
+
217
+ SDK `0.5.11` preserves the physical workspace route count and ordered include
218
+ list. External and modern integrated routes require `components`, `css`,
219
+ `dependencies`, `entities`, `img`, `modules`, and `sdk`; a physical workspace
220
+ may omit only an optional trailing `security` include. The external license
221
+ route remains separate and second.
222
+
223
+ ### Result and safety
224
+
225
+ Success returns the normal selected-workspace wrapper:
226
+
227
+ ```javascript
228
+ {
229
+ workspaceRoot,
230
+ workspaceMode, // 'external' or 'integrated'
231
+ appId,
232
+ importMap:{
233
+ appId,
234
+ artifactPath,
235
+ artifactRelativePath,
236
+ entryPath,
237
+ documentPaths,
238
+ documentCount,
239
+ imports,
240
+ excludedModules:[],
241
+ committed:true
242
+ }
243
+ }
244
+ ```
245
+
246
+ For the direct CLI command, `documentPaths` contains the configured entry first
247
+ and every other descriptor-selected HTML/HTM document afterward in
248
+ deterministic order. The generated artifact and selected documents are written
249
+ together. A post-commit observer failure preserves delivery with
250
+ `eventDelivery.status === 'degraded'` and `ARCANE_EVENT_DELIVERY_FAILED`; it
251
+ does not roll back complete application content.
252
+
253
+ An external package also publishes `/ARCANE_RUNTIME_PROJECTION.json`. The JSON
254
+ is `{schemaVersion:1,kind:'arcane-app-runtime-projection',sdkVersion,
255
+ pathPrefix:'arcane/',files:[{path}]}` and lists the complete packaged runtime.
256
+ The development server exposes the same public route from its workspace
257
+ projection. The private `/ARCANE_APP_RELEASE.json` record is not served to
258
+ application code. Malformed projection data fails
259
+ `ARCANE_RUNTIME_PROJECTION_INVALID`.
260
+
261
+ `new` and `init` generate the map during scaffolding. `dev` refreshes all
262
+ selected documents once before binding; non-dry-run `package` refreshes them
263
+ once, then collects the complete release. Packaging does not run tests or
264
+ checks automatically. Browser `build` and paired native packaging reuse the
265
+ package flow. Explicit `test` and `check` operations read the existing map without regenerating it;
266
+ `verify`, `bundle`, and browser `run` do not regenerate it. There is no
267
+ watcher, polling, scheduled refresh, download, or self-update behavior.
268
+
269
+ There is no supported `--dry-run` for `import-map`: do not pass that parser-wide
270
+ flag because this command performs the real commit. Import-map-specific failures
271
+ use `ARCANE_IMPORT_MAP_INVALID`, `ARCANE_IMPORT_MAP_UNRESOLVED`, or
272
+ `ARCANE_IMPORT_MAP_COLLISION`; packaging can additionally report
273
+ `ARCANE_IMPORT_MAP_CLEANUP_FAILED`. Workspace, policy, usage, busy, and
274
+ cancellation failures retain their normal SDK codes.
275
+
276
+ ### Example
277
+
278
+ ```bash
279
+ npm exec -- arcane import-map --workspace . --app hello-world --output json
280
+ ```
281
+
282
+ Deep details: [browser runtime delivery](protocols.md#browser-runtime-delivery).
283
+
284
+ ## `arcane upgrade`
285
+
286
+ ### Overview
287
+
288
+ Runs the selected external application's normal `npm upgrade` command in its
289
+ workspace root.
290
+
291
+ ```text
292
+ arcane upgrade [--workspace <directory>] [--app <id>]
293
+ ```
294
+
295
+ The SDK delegates dependency selection, registry access, lockfile updates, and
296
+ installed package changes directly to npm. It does not add a custom Arcane lock,
297
+ runtime-projection authentication, or import-map reconciliation workflow.
298
+ Integrated workspaces reject this command.
299
+
300
+ ### Example
301
+
302
+ ```bash
303
+ npm exec -- arcane upgrade --workspace . --app hello-world
304
+ ```
305
+
306
+ ## `arcane dev`
307
+
308
+ ### Overview
309
+
310
+ Starts one loopback development server for one selected app and maps the exact
311
+ workspace/runtime routes. It is a development convenience, not a production
312
+ security boundary.
313
+
314
+ For an external workspace, the server exposes the selected projected
315
+ `arcane/` root, including `arcane/sdk` and `arcane/dependencies`, alongside the
316
+ application. Integrated workspaces retain their configured physical routes.
317
+ The explicit live-source SDK mapping remains unchanged and does not replace the
318
+ installed projection.
319
+
320
+ ```text
321
+ arcane dev [--app <id>] [--host 127.0.0.1] [--port 8000]
322
+ ```
323
+
324
+ ### Lifecycle
325
+
326
+ The command reports acceptance before bind/start work, emits the final URL,
327
+ owns the server until cancellation, and restores failure to the process exit.
328
+ The default host is loopback. Exposing another interface is an explicit
329
+ development choice and does not add authentication.
330
+
331
+ ### Example
332
+
333
+ ```bash
334
+ npm exec -- arcane dev --app hello-world --port 8000
335
+ ```
336
+
337
+ ## `arcane test`
338
+
339
+ ### Overview
340
+
341
+ Runs exactly one test scope.
342
+
343
+ ```text
344
+ arcane test [--app <id>] [--scope app]
345
+ arcane test --scope shared --test-file <repo-relative.test.mjs>
346
+ ```
347
+
348
+ ### Scope
349
+
350
+ App scope selects only the external workspace test boundary plus the selected
351
+ app tests, or only the selected integrated app's tests. Shared scope is
352
+ integrated-only and admits one exact repository-relative `.test.mjs` through
353
+ Arcane's fixed provider. It cannot run an arbitrary command, glob every test,
354
+ or cross into another app.
355
+
356
+ External and modern integrated app scope reads the existing managed import map
357
+ and selected HTML documents before starting isolated test files. The
358
+ Node loader honors only exact managed entries, including `arcane/*`,
359
+ `#arcane/*`, reached `arcane-os/*`, and URL-like dependency compatibility keys.
360
+ An unmapped reserved Arcane name is rejected before import. The compact map locator is
361
+ removed from the isolated child's environment before app test code imports.
362
+
363
+ ### Example
364
+
365
+ ```bash
366
+ node ../arcane-os-sdk/bin/arcane.mjs test \
367
+ --workspace "../Arcane OS" \
368
+ --scope shared \
369
+ --test-file test/component-contracts.test.mjs
370
+ ```
371
+
372
+ ## `arcane check`
373
+
374
+ ### Overview
375
+
376
+ Runs the canonical validation boundary for one app, or the one canonical
377
+ integrated shared development check.
378
+
379
+ ```text
380
+ arcane check [--app <id>] [--scope app] [--skip-tests]
381
+ arcane check --scope shared
382
+ ```
383
+
384
+ ### Test behavior
385
+
386
+ `--skip-tests` is app-scope-only and skips the selected app test stage without
387
+ weakening descriptor, runtime, or source checks. Shared check owns Arcane's
388
+ canonical development check and does not accept a custom command.
389
+
390
+ ### Example
391
+
392
+ ```bash
393
+ npm exec -- arcane check --app hello-world
394
+ ```
395
+
396
+ ## `arcane package`
397
+
398
+ ### Overview
399
+
400
+ Creates one complete browser release beneath `dist/<id>/`, preserving the prior
401
+ output until the replacement is complete. It refreshes the selected document
402
+ map once, then assembles `dist`. Packaging does not run tests or checks
403
+ automatically.
404
+
405
+ ```text
406
+ arcane package [--app <id>] [--dry-run]
407
+ ```
408
+
409
+ ### Result
410
+
411
+ The result includes the release root, manifest, and complete selected inventory.
412
+ `--dry-run` plans the package without refreshing source, running tests, or
413
+ replacing output.
414
+
415
+ ### Example
416
+
417
+ ```bash
418
+ npm exec -- arcane package --app hello-world
419
+ ```
420
+
421
+ ## `arcane verify`
422
+
423
+ ### Overview
424
+
425
+ Explicitly validates one selected browser release against the app descriptor,
426
+ package policy, complete inventory, and malformed-artifact rules.
427
+
428
+ ```text
429
+ arcane verify [--app <id>]
430
+ ```
431
+
432
+ ### Evidence boundary
433
+
434
+ Verification proves consistency for the exact observed release state. It does
435
+ not prove publisher authorization, native signing, installation, launch, or
436
+ release acceptance.
437
+
438
+ ### Example
439
+
440
+ ```bash
441
+ npm exec -- arcane verify --app hello-world
442
+ ```
443
+
444
+ ## `arcane bundle`
445
+
446
+ ### Overview
447
+
448
+ Bundles one already packaged external app into the documented
449
+ `.arcane-app.tar.gz` contract.
450
+
451
+ ```text
452
+ arcane bundle [--app <id>] [--artifact <file>.arcane-app.tar.gz] [--overwrite]
453
+ ```
454
+
455
+ ### Replacement behavior
456
+
457
+ The default output is `dist/<id>-<version>.arcane-app.tar.gz`. An existing path
458
+ is refused unless `--overwrite` is explicit. Even then, the prior artifact is
459
+ retained until the replacement is complete. A conflicting or uncertain path is
460
+ preserved rather than overwritten.
461
+
462
+ ### Example
463
+
464
+ ```bash
465
+ npm exec -- arcane bundle --app hello-world
466
+ ```
467
+
468
+ ## `arcane verify-bundle`
469
+
470
+ ### Overview
471
+
472
+ Parses one selected release bundle without extracting it.
473
+
474
+ ```text
475
+ arcane verify-bundle <file.arcane-app.tar.gz>
476
+ ```
477
+
478
+ ### Validation
479
+
480
+ The verifier rejects genuinely malformed archives, unsafe or colliding paths,
481
+ unsupported archive members, trailing data, and inconsistent descriptor or
482
+ inventory structure.
483
+
484
+ ### Example
485
+
486
+ ```bash
487
+ npm exec -- arcane verify-bundle dist/hello-world-1.0.0.arcane-app.tar.gz
488
+ ```
489
+
490
+ ## `arcane native-doctor`
491
+
492
+ ### Overview
493
+
494
+ Loads one fixed native provider from one explicit Arcane OS checkout and
495
+ diagnoses the selected target/host prerequisites without building an app.
496
+
497
+ ```text
498
+ arcane native-doctor --target <native-target> --arcane-root <directory>
499
+ ```
500
+
501
+ ### Availability
502
+
503
+ This is a **Node** orchestration command with **Native** provider behavior. The
504
+ provider fails honestly when the selected platform, architecture, or toolchain
505
+ is unavailable; it never returns a browser package as a substitute.
506
+
507
+ ### Example
508
+
509
+ ```bash
510
+ npm exec -- arcane native-doctor \
511
+ --target windows-x64 \
512
+ --arcane-root "../Arcane OS"
513
+ ```
514
+
515
+ ## `arcane native-prepare`
516
+
517
+ ### Overview
518
+
519
+ Runs the provider's standalone toolchain preparation diagnostic for one target.
520
+ It is not a prerequisite command to repeat immediately before `build`; `build`
521
+ prepares its own selected toolchain state.
522
+
523
+ ```text
524
+ arcane native-prepare --target <native-target> --arcane-root <directory>
525
+ ```
526
+
527
+ ### Example
528
+
529
+ ```bash
530
+ npm exec -- arcane native-prepare \
531
+ --target linux-x64 \
532
+ --arcane-root "../Arcane OS"
533
+ ```
534
+
535
+ ## `arcane build`
536
+
537
+ ### Overview
538
+
539
+ Packages one app, prepares one provider, creates one plan, and builds one target.
540
+
541
+ ```text
542
+ arcane build --target <target> [--arcane-root <directory>] [--output-root <directory>] [--format <format>] [--signing <mode>] [--dry-run]
543
+ ```
544
+
545
+ ### Cardinality and outputs
546
+
547
+ The command selects one workspace, app, target, architecture, format, signing
548
+ profile, and output root. Current providers emit a portable directory,
549
+ Windows x64 EXE bundle, Linux x64/ARM64 DEB, or development-signed Android APK.
550
+ The output remains target-specific inside the common plan contract.
551
+ `--dry-run` is implemented for the browser build path. Native builds reject it
552
+ rather than returning a fictional native artifact plan.
553
+
554
+ ### Example
555
+
556
+ ```bash
557
+ npm exec -- arcane build \
558
+ --target windows-x64 \
559
+ --arcane-root "../Arcane OS" \
560
+ --output-root "../arcane-native-output"
561
+ ```
562
+
563
+ ## `arcane run`
564
+
565
+ ### Overview
566
+
567
+ For `--target browser`, starts the existing current `dist/<app>` release; it
568
+ does not package, rebuild, test, check, or verify that release automatically.
569
+ For a paired native target, it performs package, prepare, plan, build, launch,
570
+ readiness, and owned cancellation in one process.
571
+
572
+ ```text
573
+ arcane run [--target <target>] [--app <id>] [--arcane-root <directory>] [--output-root <directory>] [--format <format>] [--signing <mode>]
574
+ ```
575
+
576
+ ### Availability
577
+
578
+ Browser run is **Node control plane / browser data plane** and requires an
579
+ existing packaged release (run `arcane package` first). Windows, Linux, and
580
+ Android providers expose supported paired native run paths. Portable output is
581
+ a directory and intentionally cannot run. Android run requires one
582
+ connected physical/native ARM64 device for the current target.
583
+
584
+ ### Example
585
+
586
+ ```bash
587
+ npm exec -- arcane run \
588
+ --target linux-x64 \
589
+ --arcane-root "../Arcane OS" \
590
+ --output-root "../arcane-native-output"
591
+ ```
592
+
593
+ ## `arcane update-check`
594
+
595
+ ### Overview
596
+
597
+ Performs one explicit, on-demand check of the installed Arcane SDK version
598
+ against its matching npm distribution tag.
599
+
600
+ ```text
601
+ arcane update-check
602
+ ```
603
+
604
+ This is a maintainer/user query, not app runtime behavior. The command never
605
+ polls, downloads a package, installs dependencies, changes files, mutates npm
606
+ configuration, or self-updates. Arcane applications do not run it automatically.
607
+
608
+ ### Request boundary
609
+
610
+ The command makes one ordinary HTTPS `GET` to the default
611
+ `registry.npmjs.org` origin for the `arcane-os` dist-tag document and accepts
612
+ JSON. The CLI does not expose registry or package overrides; callers of the
613
+ public function may select another HTTP or HTTPS npm registry URL.
614
+
615
+ An installed prerelease version selects the npm `dev` tag. A stable installed
616
+ version selects `latest`.
617
+
618
+ ### Result
619
+
620
+ Success returns:
621
+
622
+ ```javascript
623
+ {
624
+ packageName:'arcane-os',
625
+ currentVersion:'0.2.1',
626
+ registryVersion:'0.2.2',
627
+ tag:'latest',
628
+ status:'update-available', // or 'current' or 'ahead'
629
+ updateAvailable:true,
630
+ registry:'https://registry.npmjs.org',
631
+ checkedAt:'2026-08-24T04:00:00.000Z'
632
+ }
633
+ ```
634
+
635
+ `current` means the installed and registry versions match. `ahead` means the
636
+ installed version is newer than the selected registry tag. `update-available`
637
+ means the selected registry version is newer; the boolean is true only for that
638
+ status. Reporting availability does not authorize or perform installation.
639
+
640
+ ### Events, errors, and cancellation
641
+
642
+ The normal CLI envelope emits `operation.accepted`, then
643
+ `update.check.started`. Success emits `update.check.completed` followed by the
644
+ terminal `operation.completed` result. HTTP failure, timeout,
645
+ non-JSON/invalid UTF-8 content, malformed dist tags, or invalid semantic
646
+ versions emit `update.check.failed` and terminate as `operation.failed` with
647
+ `ARCANE_UPDATE_CHECK_FAILED` and exit status `1`.
648
+
649
+ `SIGINT` or `SIGTERM` cancels the owned request. Cancellation terminates as
650
+ `operation.cancelled` with exit status `130`; it does not masquerade as an update
651
+ failure. Output framing follows the global human/JSON/NDJSON contract above.
652
+
653
+ ### Example
654
+
655
+ ```bash
656
+ npm exec -- arcane update-check --output json
657
+ ```
658
+
659
+ ## `arcane targets`
660
+
661
+ ### Overview
662
+
663
+ Lists the current target descriptors without building. Descriptors report
664
+ protocol, id, display name, declared status, platforms, architectures, formats,
665
+ signing modes, advertised adapter methods, and the reason a target is deferred
666
+ or requires pairing. The `methods` list describes the adapter interface; it is
667
+ not a live runnable/readiness probe. Use `native-doctor` for an explicit
668
+ provider/host assessment, and note that portable output intentionally rejects
669
+ run even though adapters share the common method shape.
670
+
671
+ ### Example
672
+
673
+ ```bash
674
+ npm exec -- arcane targets --output json
675
+ ```
676
+
677
+ ## `arcane repo`
678
+
679
+ ### Overview
680
+
681
+ Runs one repository action for the selected application workspace.
682
+
683
+ ```text
684
+ arcane repo status|pull|push
685
+ ```
686
+
687
+ ### Behavior
688
+
689
+ `status` is read-only. `pull` and `push` use the repository's already configured
690
+ remote and credentials, stream the owned child process, and surface nonzero
691
+ failure. The command does not create credentials, choose another repository, or
692
+ loop across workspaces.
693
+
694
+ ### Example
695
+
696
+ ```bash
697
+ npm exec -- arcane repo status
698
+ ```
699
+
700
+ ## `arcane mail`
701
+
702
+ ### Resend credential profiles
703
+
704
+ The credential subcommands select one local profile:
705
+
706
+ ```text
707
+ arcane mail key set <profile> [--secret-stdin]
708
+ arcane mail key status <profile>
709
+ arcane mail key delete <profile>
710
+ ```
711
+
712
+ `key set` reads the Resend API key from a hidden terminal prompt. The
713
+ `--secret-stdin` form is for deliberately redirected non-interactive input and
714
+ rejects a TTY before reading. The key is sent to the Windows Credential Manager
715
+ helper over child-process stdin, never argv, and no plaintext fallback is
716
+ created. Status reports only whether the profile exists. Delete returns the
717
+ selected profile with `exists:false`; it intentionally does not distinguish a
718
+ new deletion from an already-absent profile. Non-Windows hosts report the
719
+ credential operation as unavailable.
720
+
721
+ Machine output for `key set` requires `--secret-stdin`. Raw CLI arguments are
722
+ not included in acceptance events, and usage errors do not echo unknown option
723
+ or positional values.
724
+
725
+ ### One-shot provider send
726
+
727
+ `mail send` performs exactly one Resend provider attempt without starting a
728
+ loopback server:
729
+
730
+ ```text
731
+ arcane mail send --profile <profile> --from <verified-sender> --report-key <id> --report-stdin [--request-timeout <ms>]
732
+ ```
733
+
734
+ `--report-stdin` is mandatory and rejects a terminal before attaching input
735
+ listeners. It reads one complete UTF-8 JSON object using the gateway report
736
+ shape:
737
+
738
+ ```json
739
+ {
740
+ "type": "report",
741
+ "to": ["recipient@example.com"],
742
+ "subject": "Example",
743
+ "text": "Message content"
744
+ }
745
+ ```
746
+
747
+ The required fields are `type`, `to`, `subject`, and at least one of `text` or
748
+ `html`; additional JSON-compatible provider fields are preserved. Direct CLI
749
+ sending requires at least one explicit recipient, including for `error`
750
+ reports. The Resend credential comes only from the selected Windows Credential
751
+ Manager profile; neither it nor report content is accepted through argv or
752
+ environment variables.
753
+
754
+ The caller owns `--report-key`. It must contain one or more ASCII letters, digits,
755
+ periods, underscores, colons, or hyphens. Reuse the same key only with the same
756
+ logical report when deliberately reconciling or retrying an
757
+ ambiguous attempt. The CLI never retries automatically.
758
+
759
+ Exit zero means Resend returned a successful response with a valid provider
760
+ acceptance id. The result preserves the complete report, provider request,
761
+ provider response, and available outcome detail without exposing the Resend API
762
+ key. It proves provider API acceptance, not inbox delivery. Permanent,
763
+ retryable, and ambiguous outcomes exit nonzero with that same complete
764
+ available request and outcome detail. Cancellation before the
765
+ provider attempt exits 130 without sending; cancellation, timeout, or transport
766
+ loss after the attempt begins is ambiguous because Resend may have accepted it.
767
+
768
+ ### Authenticated local gateway
769
+
770
+ `mail serve` starts one owned Node HTTP gateway:
771
+
772
+ ```text
773
+ arcane mail serve --profile <profile> --from <verified-sender> --app <id> --origin <exact-origin> [--allow-to <addresses>] [--app-key-stdin] [--host 127.0.0.1] [--port 8025] [--request-timeout <ms>]
774
+ ```
775
+
776
+ The selected credential profile supplies only the server-side Resend API key.
777
+ A separate local mail app key is read through a hidden prompt. Structured
778
+ output requires `--app-key-stdin` with redirected input; the app key is never an
779
+ argv value or part of the server result. The browser must use the same value as
780
+ `arcane.config.mail.appKey`.
781
+
782
+ The CLI admits only numeric loopback host values accepted by the gateway. The
783
+ gateway also binds the exact app id, Origin, and sender, and it requires the
784
+ separate app key by default. `--allow-to` optionally supplies a comma-separated
785
+ recipient allowlist with no fixed recipient-count ceiling. `--request-timeout`
786
+ adds a caller-selected provider-attempt timeout from 1 through 2147483647
787
+ milliseconds, the Node timer range. When it is omitted, the SDK adds no
788
+ provider timeout.
789
+
790
+ After binding, `server.ready` reports lifecycle fields such as
791
+ protocol, app id, loopback address, port, URL, and caller-authentication mode.
792
+ The command owns the server until its lifecycle ends or `SIGINT`/`SIGTERM`
793
+ cancels it. Resend and local app credentials never appear in results or events;
794
+ per-request observer events preserve the complete delivery, report, provider
795
+ outcome, and failure detail available to the gateway.
796
+
797
+ See [Mail gateway and durable outbox](mail.md) for request, retry,
798
+ idempotency, DBOPFS, and provider-acceptance semantics.
799
+
800
+ ## Machine output
801
+
802
+ `--output json` returns one complete JSON document after structured progress is
803
+ collected. `--output ndjson` emits one event record per line as work proceeds.
804
+ Human output is presentation only; automation should consume the versioned
805
+ machine fields and tolerate documented additive detail.
806
+
807
+ Every record identifies the CLI event protocol, sequence, operation, phase,
808
+ level, message, and structured detail as applicable. Acceptance precedes
809
+ blocking work, terminal completion/failure closes the owned stream, and stdout
810
+ in machine modes contains no unframed child-process text.
811
+
812
+ Deep details: [SDK/CLI protocols](protocols.md#sdk-package-and-cli-protocols).
813
+
814
+ ## Programmatic-only operation names
815
+
816
+ `executeOperation()` also accepts `plan` and `native-verify`. The CLI parser has
817
+ no `arcane plan` or `arcane native-verify` route in this SDK version. Call the
818
+ documented JavaScript operations directly when that lower-level lifecycle is
819
+ required; do not present those names as user commands or infer them from the
820
+ parser's recognized option set.