arcane-os 0.3.0 → 0.3.2

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