arcane-os 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0
4
+
5
+ - Add `arcane dev --public`, including forwarding through
6
+ `npm run dev -- --app <id> --public`, to bind the selected app's existing
7
+ source server to all IPv4 interfaces. Keep the ordinary localhost default
8
+ and let an explicit `--host` select the bind address.
9
+ - Allow explicit network hosts in the shared development server. Report usable
10
+ local and network application URLs, including `networkUrls` in server results
11
+ and lifecycle events, while preserving selected routes and cancellation.
12
+ - Document LAN use and the browser HTTPS requirement for features that need a
13
+ secure context. No app-specific server, firewall rule, or tunnel is added.
14
+
3
15
  ## 0.6.2
4
16
 
5
17
  - Replace browser NPU setup buttons with direct browser-specific flags links
package/README.md CHANGED
@@ -19,7 +19,7 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles preserve the same app URLs, theme, packaging,
20
20
  event, cancellation, and browser run contracts.
21
21
 
22
- This checkout defines the `0.6.2` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.7.0` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
@@ -35,12 +35,27 @@ Create one browser application, install its pinned SDK, and start its source
35
35
  server:
36
36
 
37
37
  ```bash
38
- npx arcane-os@0.6.2 new hello-speech --path ./hello-speech --target browser
38
+ npx arcane-os@0.7.0 new hello-speech --path ./hello-speech --target browser
39
39
  cd hello-speech
40
40
  npm install
41
41
  npm run dev
42
42
  ```
43
43
 
44
+ To open a selected app from another device on the network, append `--public`
45
+ to the same command:
46
+
47
+ ```bash
48
+ npm run dev -- --app hello-speech --public
49
+ ```
50
+
51
+ Replace `hello-speech` with any app in the workspace. The server binds to
52
+ `0.0.0.0` and prints network URLs to open on the other device. Plain `npm run dev`
53
+ keeps its localhost default. An explicit `--host` overrides the public bind
54
+ address, and `--port` selects the port. Network reachability depends on the
55
+ machine's firewall and network; the command does not configure internet hosting
56
+ or HTTPS. Browser features requiring a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Secure_Contexts)
57
+ need HTTPS when opened through a LAN address.
58
+
44
59
  Open the URL printed by the server. The generated page owns its import map and
45
60
  Arcane theme; its application module is `apps/hello-speech/modules/App.js`.
46
61
  `arcane/AI` is a managed **browser import**, not an npm-exported Node inference
@@ -363,7 +378,7 @@ uses the same controller for automatic memory extraction.
363
378
  Create a new repository-shaped Arcane application with the exact stable SDK:
364
379
 
365
380
  ```bash
366
- npx arcane-os@0.6.2 new my-app --path ./my-app --target portable --git
381
+ npx arcane-os@0.7.0 new my-app --path ./my-app --target portable --git
367
382
  cd my-app
368
383
  npm install
369
384
  npm run dev
@@ -373,7 +388,7 @@ To enroll an existing repository, install the exact SDK and initialize only
373
388
  missing Arcane files:
374
389
 
375
390
  ```bash
376
- npm install --save-dev --save-exact arcane-os@0.6.2
391
+ npm install --save-dev --save-exact arcane-os@0.7.0
377
392
  npm exec -- arcane init my-app --target portable
378
393
  ```
379
394
 
@@ -389,7 +404,7 @@ npm exec -- arcane-os targets
389
404
  No global SDK install or standalone Arcane CLI is required. The application
390
405
  repository's exact npm dependency and lockfile own the CLI and toolchain version.
391
406
 
392
- Use `npx arcane-os@0.6.2` for the initial bootstrap because it names this npm
407
+ Use `npx arcane-os@0.7.0` for the initial bootstrap because it names this npm
393
408
  package explicitly; bare `npx arcane` outside an installed project could resolve
394
409
  a different package. Both installed commands invoke the same headless toolchain.
395
410
  Project-local npm scripts use the SDK pinned by that app's `package-lock.json`,
@@ -409,7 +424,7 @@ node ./bin/arcane.mjs new local-app --path ../local-app --target portable --git
409
424
 
410
425
  # From the generated app repository
411
426
  cd ../local-app
412
- npm install --save-dev --save-exact ../arcane-os-sdk/arcane-os-0.6.2.tgz
427
+ npm install --save-dev --save-exact ../arcane-os-sdk/arcane-os-0.7.0.tgz
413
428
  npm ci
414
429
  ```
415
430
 
@@ -418,7 +433,7 @@ same location. The lockfile retains the selected package dependency while
418
433
  Arcane uses the installed package name and version. Local directory `file:` dependencies are not
419
434
  accepted because npm may install them as links; use a packed `.tgz`. A GitHub
420
435
  runner also needs that tarball at the locked path. After publication, replace
421
- the local declaration with the exact `arcane-os@0.6.2` registry package and
436
+ the local declaration with the exact `arcane-os@0.7.0` registry package and
422
437
  commit the regenerated lock.
423
438
 
424
439
  Generated repositories use `npm ci --ignore-scripts` in CI. Run dependency
@@ -475,7 +490,7 @@ arcane new <id> [--path <directory>] [--display-name <name>] [--target <target>]
475
490
  arcane init [id] [--workspace <directory>] [--display-name <name>] [--target <target>]
476
491
  arcane doctor [--workspace <directory>] [--arcane-root <directory>]
477
492
  arcane import-map [--workspace <directory>] [--app <id>]
478
- arcane dev [--app <id>] [--host 127.0.0.1] [--port 8000]
493
+ arcane dev [--app <id>] [--public] [--host <address>] [--port 8000]
479
494
  arcane test [--app <id>] [--scope app]
480
495
  arcane test --scope shared --test-file <repo-relative.test.mjs>
481
496
  arcane check [--app <id>] [--scope app] [--skip-tests]
@@ -557,7 +572,7 @@ package installation, or assertions.
557
572
 
558
573
  ## Current target support
559
574
 
560
- Version `0.6.2` exposes one browser target and five explicitly paired
575
+ Version `0.7.0` exposes one browser target and five explicitly paired
561
576
  native development targets: a non-runnable portable directory, a
562
577
  Windows x64 unsigned-local-test EXE bundle, Linux x64 and Linux ARM64
563
578
  unsigned-local-test DEBs, and an Android development-signed APK. The
@@ -683,7 +698,7 @@ read-only managed-service assessment where the host supports one. Native apps
683
698
  use an app-scoped Arcane Core and `Arcane.localAI.status()` in this SDK version.
684
699
  Ollama is optional for packaging and non-AI applications.
685
700
 
686
- The loopback development server serves complete selected files and does not
701
+ The development server serves complete selected files and does not
687
702
  apply byte-count or truncation gates. Optional hardening is inactive unless the
688
703
  caller explicitly selects `secure:true`. Required credential protection,
689
704
  malformed-request rejection, and unavoidable browser or operating-system safety
@@ -236,7 +236,7 @@ Packaging writes the complete schema-1 release inventory to
236
236
  `ARCANE_APP_RELEASE.json`. Ordinary development, packaging, serving, and run
237
237
  paths do not count, limit, hash, truncate, tail, clip, or identify content by
238
238
  bytes, and they do not require provenance or verification receipts. The
239
- loopback server reads and returns each complete selected source, runtime, or
239
+ development server reads and returns each complete selected source, runtime, or
240
240
  packaged file. Required credential protection, malformed-input rejection,
241
241
  applicable law, unavoidable protocol rules, and operating-system or browser
242
242
  safety remain in effect.
@@ -279,7 +279,7 @@ paths are withheld from the native provider. The provider copies the complete
279
279
  selected release rather than accepting an unrelated source path. Verification
280
280
  is a separate explicit operation for a selected release artifact.
281
281
 
282
- The SDK `0.6.2` runtime requires Arcane `0.8.12` or newer. Compatibility
282
+ The SDK `0.7.0` runtime requires Arcane `0.8.12` or newer. Compatibility
283
283
  is contractual rather than exact-version pinning: the prepared Core must meet
284
284
  the highest minimum declared by the runtime, selected app, and bundled app
285
285
  dependencies; keep each app's Arcane protocol generation; and provide every
@@ -49,6 +49,7 @@ meaning and cardinality rules:
49
49
  | `--app` | app id | Workspace/app operations except shared scope and `verify-bundle`; also the exact `mail serve` caller id. |
50
50
  | `--arcane-root` | directory | `doctor`, native `build`/`run`, `native-doctor`, `native-prepare` |
51
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
+ | `--public` | flag | `dev`; binds to `0.0.0.0` unless `--host` explicitly selects another address. |
52
53
  | `--target` | target id | `new`, `init`, native diagnostics, `build`, `run` |
53
54
  | `--format` / `--signing` | target-supported values | Native diagnostics, `build`, `run` |
54
55
  | `--output-root` | directory | Native `build` and `run` |
@@ -307,9 +308,9 @@ npm exec -- arcane upgrade --workspace . --app hello-world
307
308
 
308
309
  ### Overview
309
310
 
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.
311
+ Starts one development server for one selected app and maps the exact
312
+ workspace/runtime routes. It defaults to localhost; `--public` enables access
313
+ from other devices on the network.
313
314
 
314
315
  For an external workspace, the server exposes the selected projected
315
316
  `arcane/` root, including `arcane/sdk` and `arcane/dependencies`, alongside the
@@ -318,20 +319,35 @@ The explicit live-source SDK mapping remains unchanged and does not replace the
318
319
  installed projection.
319
320
 
320
321
  ```text
321
- arcane dev [--app <id>] [--host 127.0.0.1] [--port 8000]
322
+ arcane dev [--app <id>] [--public] [--host <address>] [--port 8000]
322
323
  ```
323
324
 
324
325
  ### Lifecycle
325
326
 
326
327
  The command reports acceptance before bind/start work, emits the final URL,
327
328
  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.
329
+ The default host is `127.0.0.1`. `--public` selects `0.0.0.0` (all IPv4
330
+ interfaces); an explicit `--host` takes precedence. The command prints the
331
+ local URL and available network URLs. Use a printed network URL on the other
332
+ device, since `localhost` refers to that device and `0.0.0.0` is a bind address.
333
+ Network URLs come from one interface snapshot at startup and do not establish
334
+ remote reachability through the machine's firewall or network.
335
+
336
+ This option changes the listener address. It does not configure a firewall,
337
+ router forwarding, an internet tunnel, authentication, or HTTPS. Browser
338
+ features that require a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Secure_Contexts)
339
+ still require HTTPS when accessed through a LAN address.
330
340
 
331
341
  ### Example
332
342
 
333
343
  ```bash
334
344
  npm exec -- arcane dev --app hello-world --port 8000
345
+
346
+ # Forward the public option through an existing dev script, for any app id.
347
+ npm run dev -- --app hello-world --public
348
+
349
+ # Equivalent direct CLI invocation, with an optional port.
350
+ npm exec -- arcane dev --app hello-world --public --port 8000
335
351
  ```
336
352
 
337
353
  ## `arcane test`
@@ -3451,7 +3451,7 @@ async function useselectApp(...arguments_) {
3451
3451
 
3452
3452
  ### Overview
3453
3453
 
3454
- Starts one owned browser development server with exact runtime/app route mappings and an unguessable session capability.
3454
+ Starts one owned browser development server with exact runtime/app route mappings and a caller-selected bind address.
3455
3455
 
3456
3456
  ### Signature, modes, and result
3457
3457
 
@@ -3464,19 +3464,23 @@ Import it from `arcane-os`. Source mode accepts
3464
3464
  signal, onEvent}` and serves one validated workspace application plus its
3465
3465
  complete SDK or integrated runtime. Packaged mode uses
3466
3466
  `{mode:'packaged', releaseRoot, host, port, signal, onEvent}` and serves the
3467
- complete selected release files. `host` must be
3468
- numeric loopback `127.0.0.1` or `::1`; port `0` asks the operating system for an
3469
- available port.
3467
+ complete selected release files. `host` defaults to `127.0.0.1` and accepts an
3468
+ explicit network address or hostname. Use `0.0.0.0` for all IPv4 interfaces or
3469
+ `::` for the platform's IPv6 wildcard listener; port `0` asks the operating
3470
+ system for an available port.
3470
3471
 
3471
3472
  The promise settles after the listener is ready and resolves to
3472
- `{server, mode, workspaceRoot, appId, host, port, origin, cleanUrl, url, close,
3473
- closed, lifecycle}`. `server` is the raw Node HTTP server. `url` contains the
3474
- unguessable bootstrap capability that establishes an HttpOnly session
3475
- cookie; do not log, persist, or disclose it. `cleanUrl` contains no capability
3476
- but does not bootstrap a new browser session by itself. In packaged mode,
3477
- `workspaceRoot` and `appId` are `null`.
3478
-
3479
- Starting the server opens a loopback listener and emits awaited,
3473
+ `{server, mode, workspaceRoot, appId, host, port, origin, cleanUrl, url,
3474
+ networkUrls, close, closed, lifecycle}`. `server` is the raw Node HTTP server.
3475
+ `url` and `cleanUrl` are the same application URL. Wildcard listeners use
3476
+ `localhost` in that local URL; `host` retains the actual bound address.
3477
+ `networkUrls` lists application URLs for applicable non-loopback interface
3478
+ addresses discovered once at startup. These URLs are connection candidates,
3479
+ not evidence of reachability from another device. The server adds no session
3480
+ capability or authentication. In packaged mode, `workspaceRoot` and `appId`
3481
+ are `null`.
3482
+
3483
+ Starting the server opens the selected listener and emits awaited,
3480
3484
  backpressured `server.starting` and `server.started` events. Request failures
3481
3485
  emit `server.request.failed`; shutdown emits `server.stopped` after owned
3482
3486
  requests and event delivery drain. Call `await result.close()` in a `finally`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
package/src/cli/main.mjs CHANGED
@@ -35,6 +35,7 @@ const VALUE_OPTIONS=new Set([
35
35
  ]);
36
36
  const FLAG_OPTIONS=new Set([
37
37
  'git',
38
+ 'public',
38
39
  'skip-tests',
39
40
  'dry-run',
40
41
  'require-local-ai',
@@ -60,7 +61,7 @@ Usage:
60
61
  ${CLI_NAME} upgrade [--workspace <directory>] [--app <id>]
61
62
  ${CLI_NAME} doctor [--workspace <directory>] [--arcane-root <directory>]
62
63
  ${CLI_NAME} import-map [--workspace <directory>] [--app <id>]
63
- ${CLI_NAME} dev [--app <id>] [--host 127.0.0.1] [--port 8000] [--sdk-runtime-source <sdk-root>]
64
+ ${CLI_NAME} dev [--app <id>] [--public] [--host <address>] [--port 8000] [--sdk-runtime-source <sdk-root>]
64
65
  ${CLI_NAME} test [--app <id>] [--scope app]
65
66
  ${CLI_NAME} test --scope shared --test-file <repo-relative.test.mjs>
66
67
  ${CLI_NAME} check [--app <id>] [--scope app] [--skip-tests]
@@ -83,6 +84,8 @@ Usage:
83
84
  ${CLI_NAME} mail serve --profile <profile> --from <address> --app <id> --origin <origin> [--allow-to <addresses>] [--app-key-stdin] [--host 127.0.0.1] [--port 8025] [--request-timeout <ms>]
84
85
 
85
86
  Development:
87
+ --public Bind all IPv4 interfaces (0.0.0.0) and print network URLs.
88
+ --host <address> Override the bind address; takes precedence over --public.
86
89
  --sdk-runtime-source <sdk-root> Dev-only live SDK checkout; omitted preserves the workspace runtime mode.
87
90
 
88
91
  Global:
@@ -445,6 +448,9 @@ function operationOptions(command,parsed,cwd){
445
448
  if(values['sdk-runtime-source']!==undefined&&command!=='dev'){
446
449
  usage('--sdk-runtime-source is supported only by dev.');
447
450
  }
451
+ if(flags.has('public')&&command!=='dev'){
452
+ usage('--public is supported only by dev.');
453
+ }
448
454
  if(flags.has('overwrite')&&command!=='bundle'){
449
455
  usage('--overwrite is supported only by bundle.');
450
456
  }
@@ -506,7 +512,7 @@ function operationOptions(command,parsed,cwd){
506
512
  noExtraPositionals(command,positionals);
507
513
  return {
508
514
  ...common,
509
- host:values.host??'127.0.0.1',
515
+ host:values.host??(flags.has('public')?'0.0.0.0':'127.0.0.1'),
510
516
  port:readPort(values.port,8000),
511
517
  ...(values['sdk-runtime-source']===undefined?{}:{
512
518
  sdkRuntimeSourceRoot:path.resolve(cwd,values['sdk-runtime-source'])
@@ -831,6 +837,7 @@ function serverSummary(result){
831
837
  host:result.host,
832
838
  port:result.port,
833
839
  url:result.url,
840
+ ...(result.networkUrls===undefined?{}:{networkUrls:result.networkUrls}),
834
841
  ...(result.callerAuthentication
835
842
  ?{callerAuthentication:result.callerAuthentication}
836
843
  :{}),
@@ -841,7 +848,11 @@ function serverSummary(result){
841
848
  }
842
849
 
843
850
  async function waitForServer(result,signal,reporter){
844
- reporter.emit('server.ready',serverSummary(result),`Development server ready at ${result.url}`);
851
+ const readyMessage=[
852
+ `Development server ready at ${result.url}`,
853
+ ...(result.networkUrls??[]).map(function networkAddress(url){return `Network: ${url}`;})
854
+ ].join('\n');
855
+ reporter.emit('server.ready',serverSummary(result),readyMessage);
845
856
  if(result.lifecycle&&is.function(result.lifecycle.then)){
846
857
  const abort=()=>{
847
858
  void Promise.resolve().then(()=>result.close?.()).catch(()=>{});
@@ -2,6 +2,7 @@ import Is from 'strong-type';
2
2
  import {constants as FS_CONSTANTS} from 'node:fs';
3
3
  import {lstat,open,readFile,realpath} from 'node:fs/promises';
4
4
  import http from 'node:http';
5
+ import os from 'node:os';
5
6
  import path from 'node:path';
6
7
  import {resolveWorkspace} from './workspace.mjs';
7
8
  import {createEventQueue} from './event-queue.mjs';
@@ -489,6 +490,29 @@ function listen(server,{host,port,signal}){
489
490
  });
490
491
  }
491
492
 
493
+ function browserHostname(host){
494
+ return host.includes(':')?`[${host}]`:host;
495
+ }
496
+
497
+ function networkUrlsForAddress(address,startPath){
498
+ if(address.address==='127.0.0.1'||address.address==='::1')return [];
499
+ const allIPv4=address.address==='0.0.0.0';
500
+ const allInterfaces=address.address==='::';
501
+ const urls=new Set();
502
+ for(const entries of Object.values(os.networkInterfaces())){
503
+ for(const entry of entries??[]){
504
+ if(entry.internal)continue;
505
+ // Scoped IPv6 addresses need the receiving device's interface,
506
+ // so they cannot provide a portable browser link for another device.
507
+ if(entry.family==='IPv6'&&entry.scopeid)continue;
508
+ if(allIPv4&&entry.family!=='IPv4')continue;
509
+ if(!allIPv4&&!allInterfaces&&entry.address!==address.address)continue;
510
+ urls.add(`http://${browserHostname(entry.address)}:${address.port}${startPath}`);
511
+ }
512
+ }
513
+ return [...urls];
514
+ }
515
+
492
516
  async function startOwnedDevServer({
493
517
  workspaceRoot=process.cwd(),
494
518
  appId,
@@ -504,8 +528,8 @@ async function startOwnedDevServer({
504
528
  if(sdkRuntimeSourceRoot!==undefined&&mode!=='source'){
505
529
  fail('sdkRuntimeSourceRoot is supported only in source development mode.','ARCANE_USAGE');
506
530
  }
507
- if(host!=='127.0.0.1'&&host!=='::1'){
508
- fail('Development server host must be a numeric loopback address (127.0.0.1 or ::1).','ARCANE_POLICY_DENIED');
531
+ if(!is.string(host)||!host.trim()){
532
+ fail('Development server host must be a nonempty string.','ARCANE_USAGE');
509
533
  }
510
534
  if(!is.integer(port)||port<0||port>65535)fail('port must be an integer from 0 through 65535.','ARCANE_USAGE');
511
535
  const requestedRuntimeMode=mode==='source'&&sdkRuntimeSourceRoot!==undefined
@@ -631,7 +655,9 @@ async function startOwnedDevServer({
631
655
  server.close();
632
656
  fail('Development server did not expose a TCP address.');
633
657
  }
634
- const visibleHost=address.family==='IPv6'?`[${address.address}]`:address.address;
658
+ const visibleHost=address.address==='0.0.0.0'||address.address==='::'
659
+ ?'localhost'
660
+ :browserHostname(address.address);
635
661
  const endpoint=new URL(`http://${visibleHost}:${address.port}`);
636
662
  const origin=endpoint.origin;
637
663
  const cleanUrl=`${origin}${routeSet.startPath}`;
@@ -728,17 +754,20 @@ async function startOwnedDevServer({
728
754
  origin,
729
755
  cleanUrl,
730
756
  url,
757
+ networkUrls:[],
731
758
  close,
732
759
  closed:lifecycle,
733
760
  lifecycle
734
761
  };
735
762
  try{
763
+ result.networkUrls=networkUrlsForAddress(address,routeSet.startPath);
736
764
  await events.send({
737
765
  type:'server.started',
738
766
  mode,
739
767
  host:result.host,
740
768
  port:result.port,
741
769
  url,
770
+ networkUrls:result.networkUrls,
742
771
  appId:result.appId,
743
772
  ...(routeSet.runtime?{
744
773
  runtimeMode:routeSet.runtime.mode,