arcane-os 0.54.1 → 0.55.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 +31 -0
- package/README.md +31 -26
- package/browser-runtime/core/client.mjs +491 -0
- package/browser-runtime/core/contracts.mjs +84 -0
- package/docs/architecture.md +31 -23
- package/docs/compatibility.md +10 -1
- package/docs/platform-targets.md +20 -11
- package/docs/reference/README.md +8 -6
- package/docs/reference/availability-and-normalization.md +4 -2
- package/docs/reference/behavioral-testing.md +7 -6
- package/docs/reference/cli.md +12 -4
- package/docs/reference/core-client.md +120 -0
- package/docs/reference/core-native-packaging.md +149 -0
- package/docs/reference/core-runtime.md +175 -0
- package/docs/reference/inventory/package-api.json +257 -5
- package/docs/reference/protocols.md +16 -1
- package/docs/reference/sdk-api.md +772 -15
- package/package.json +10 -3
- package/schemas/native-build-plan.schema.json +8 -0
- package/src/cli/main.mjs +8 -6
- package/src/core/host.mjs +23 -0
- package/src/core/runtime.mjs +333 -0
- package/src/core/stdio.mjs +209 -0
- package/src/core-classic-source.mjs +43 -0
- package/src/import-map.mjs +62 -0
- package/src/native/portable-layout.mjs +184 -0
- package/src/native/portable-provider.mjs +211 -0
- package/src/native-plan.mjs +10 -4
- package/src/native-provider-loader.mjs +15 -4
- package/src/packager/core.mjs +47 -18
- package/src/targets/index.mjs +3 -1
- package/src/toolchain.mjs +20 -5
|
@@ -47,7 +47,14 @@ runtime layouts.
|
|
|
47
47
|
| `arcane-os/testing` | Isolated test registration and execution. |
|
|
48
48
|
| `arcane-os/targets` | Target adapters and dispatch. |
|
|
49
49
|
| `arcane-os/native` | Native plan and builder protocol. |
|
|
50
|
-
| `arcane-os/native-provider` |
|
|
50
|
+
| `arcane-os/native-provider` | SDK portable default and explicit checkout provider loader. |
|
|
51
|
+
| `arcane-os/native/portable-provider` | Node-only portable payload provider and explicit app-service composition; not an executable host. |
|
|
52
|
+
| `arcane-os/core/client` | Browser-safe Core RPC client, application facade, readiness and request cancellation. |
|
|
53
|
+
| `arcane-os/core/contracts` | Shared Core protocol, frame, method and diagnostic error contracts. |
|
|
54
|
+
| `arcane-os/core/classic-source` | Node generator for the canonical classic-script Core client projection. |
|
|
55
|
+
| `arcane-os/core/runtime` | App-neutral native Core dispatcher and service lifecycle. |
|
|
56
|
+
| `arcane-os/core/stdio` | Framed Node stdio transport with graceful runtime drain. |
|
|
57
|
+
| `arcane-os/core/host` | Node-only reusable Core host lifecycle with explicitly supplied services. |
|
|
51
58
|
| `arcane-os/integrated-provider` | Fixed integrated shared-development provider. |
|
|
52
59
|
| `arcane-os/packager` | Low-level browser app packager. |
|
|
53
60
|
| `arcane-os/release-bundle` | Deterministic external release bundles. |
|
|
@@ -346,6 +353,24 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
|
|
|
346
353
|
| `isArcaneEventOccurrence()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
|
|
347
354
|
| `parseEventStack()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
|
|
348
355
|
| `projectArcaneDOMEvent()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or a DOM-compatible test host |
|
|
356
|
+
| `CORE_PROTOCOL` | constant | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
357
|
+
| `CORE_READY_EVENTS` | constant | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
358
|
+
| `CORE_FRAME_CONTRACTS` | constant | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
359
|
+
| `CORE_METHOD_CONTRACTS` | constant | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
360
|
+
| `CoreError` | class | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
361
|
+
| `serializeCoreError()` | function | `arcane-os/core/contracts` | Core protocol contracts | Node and browser/bundler |
|
|
362
|
+
| `createCoreClient()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
|
|
363
|
+
| `createCoreFacade()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
|
|
364
|
+
| `installCoreClient()` | function | `arcane-os/core/client` | Core browser client | Browser and native WebView JavaScript hosts |
|
|
365
|
+
| `createCoreClassicSource()` | function | `arcane-os/core/classic-source` | Core classic client projection | Node; generated source runs in browser and native WebView renderers |
|
|
366
|
+
| `createCoreRuntime()` | function | `arcane-os/core/runtime` | Native Core runtime | Node on Windows, Linux and macOS native hosts; Android requires host adaptation |
|
|
367
|
+
| `encodeCoreFrame()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
|
|
368
|
+
| `createCoreFrameDecoder()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
|
|
369
|
+
| `startCoreStdio()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
|
|
370
|
+
| `createPortableNativeProvider()` | function | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
371
|
+
| `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
372
|
+
| `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
|
|
373
|
+
| `startCoreHost()` | function | `arcane-os/core/host` | Native Core host composition | Node with readable input and writable output streams |
|
|
349
374
|
| `MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
350
375
|
| `MAIL_OUTBOX_PROTOCOL` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
351
376
|
| `MAIL_OUTBOX_STATES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
|
|
@@ -902,8 +927,12 @@ const release = await packageApp({
|
|
|
902
927
|
The override uses the same workspace-relative destination and staged replacement
|
|
903
928
|
rules as the saved field. It replaces only `dist/extension/app`, leaving its
|
|
904
929
|
extension-root siblings and an existing browser output intact. `browserPwa:false`
|
|
905
|
-
omits generated PWA artifacts
|
|
906
|
-
|
|
930
|
+
omits generated PWA artifacts and removes their active references from selected
|
|
931
|
+
output documents before native-module processing. This removes SDK-marked
|
|
932
|
+
`data-arcane-pwa` scripts and manifest relationships resolving to the package's
|
|
933
|
+
`arcane.webmanifest`, preserving unrelated authored links and inactive HTML.
|
|
934
|
+
It does not change source documents or the app's saved PWA configuration.
|
|
935
|
+
The app owns extension metadata, permissions and toolbar
|
|
907
936
|
launch behavior. This API builds the application directory, not an extension
|
|
908
937
|
manifest or an operating-system launcher. Native-mode dry runs report selected
|
|
909
938
|
input files; generated script/context files are included in the completed
|
|
@@ -2317,7 +2346,9 @@ console.log(ARCANE_INTEGRATED_PROVIDER_RELATIVE_PATH);
|
|
|
2317
2346
|
|
|
2318
2347
|
### Overview
|
|
2319
2348
|
|
|
2320
|
-
|
|
2349
|
+
Target-to-provider path registry for explicitly selected Arcane OS checkout
|
|
2350
|
+
providers. The package-owned portable default resolves directly from the SDK
|
|
2351
|
+
module location and leaves this existing registry unchanged.
|
|
2321
2352
|
|
|
2322
2353
|
### Value and import
|
|
2323
2354
|
|
|
@@ -2325,11 +2356,13 @@ Frozen target-to-provider path registry for native development providers.
|
|
|
2325
2356
|
const ARCANE_NATIVE_PROVIDER_PATHS
|
|
2326
2357
|
```
|
|
2327
2358
|
|
|
2328
|
-
Import it from `arcane-os` or `arcane-os/native-provider`.
|
|
2359
|
+
Import it from `arcane-os` or `arcane-os/native-provider`. The exported path arrays
|
|
2360
|
+
are ordinary copies; changing them does not change the loader's fixed paths.
|
|
2329
2361
|
|
|
2330
2362
|
### Availability and normalization
|
|
2331
2363
|
|
|
2332
|
-
**Node
|
|
2364
|
+
**Node.** Checkout provider path metadata; it does not load a provider or report
|
|
2365
|
+
runtime readiness. Deep protocol: [native provider protocols](protocols.md).
|
|
2333
2366
|
|
|
2334
2367
|
### Example
|
|
2335
2368
|
|
|
@@ -2343,12 +2376,14 @@ console.log(ARCANE_NATIVE_PROVIDER_PATHS);
|
|
|
2343
2376
|
|
|
2344
2377
|
### Overview
|
|
2345
2378
|
|
|
2346
|
-
Requires an integrated workspace and selected
|
|
2379
|
+
Requires an integrated workspace and explicitly selected checkout provider to
|
|
2380
|
+
use the same canonical Arcane checkout. The SDK-owned portable pairing uses its
|
|
2381
|
+
installed package root instead; other targets retain the existing requirement.
|
|
2347
2382
|
|
|
2348
2383
|
### Signature and result
|
|
2349
2384
|
|
|
2350
2385
|
```text
|
|
2351
|
-
assertIntegratedNativeToolchain({workspaceMode, workspaceRoot, toolchainRoot, target}={})
|
|
2386
|
+
assertIntegratedNativeToolchain({workspaceMode, workspaceRoot, toolchainRoot, target, providerSource='arcane-checkout'}={})
|
|
2352
2387
|
```
|
|
2353
2388
|
|
|
2354
2389
|
Import it from `arcane-os` or `arcane-os/toolchain`. The signature above states whether settlement is synchronous or promise-based. The overview and owning group define result authority, side effects, callbacks, events, cancellation, and lifecycle.
|
|
@@ -2399,12 +2434,23 @@ async function usebuildTarget(...arguments_) {
|
|
|
2399
2434
|
|
|
2400
2435
|
### Overview
|
|
2401
2436
|
|
|
2402
|
-
Creates
|
|
2437
|
+
Creates a native plan carrying the complete selected app release, dependency
|
|
2438
|
+
releases, toolchain, target request and output roots. Release inputs use
|
|
2439
|
+
`{files, ...releaseFields}` records; dependency inputs use
|
|
2440
|
+
`{appId,releaseRoot,release}`. Selected-file readers return the complete contents.
|
|
2441
|
+
Both nested CLI `signing:{mode,profileId}` and existing flat
|
|
2442
|
+
`signing`/`signingProfileId` inputs normalize to the same flat plan request.
|
|
2443
|
+
Optional `selectedSdk:{packageRoot,packageSource}` carries the app's actual
|
|
2444
|
+
installed SDK source through the plan and builder request. The high-level
|
|
2445
|
+
toolchain reads this from the workspace's existing installed SDK layout once
|
|
2446
|
+
per build. Direct callers composing services over a partial direct SDK
|
|
2447
|
+
projection supply the actual source; the builder does not infer it from the
|
|
2448
|
+
browser file inventory or substitute its own version.
|
|
2403
2449
|
|
|
2404
2450
|
### Signature and result
|
|
2405
2451
|
|
|
2406
2452
|
```text
|
|
2407
|
-
async createNativeBuildPlan({ nativeBuilder, toolchainRoot,
|
|
2453
|
+
async createNativeBuildPlan({ nativeBuilder, toolchainRoot, toolchain, appReleaseRoot, release, appDescriptor, selectedSdk, dependencyReleases, minimumCoreVersion, protectedRoots=[], outputRoot, targetRequest, signal, onEvent }={})
|
|
2408
2454
|
```
|
|
2409
2455
|
|
|
2410
2456
|
Import it from `arcane-os` or `arcane-os/native`. The signature above states whether settlement is synchronous or promise-based. The overview and owning group define result authority, side effects, callbacks, events, cancellation, and lifecycle.
|
|
@@ -2483,7 +2529,8 @@ async function usedoctorNativeTarget(...arguments_) {
|
|
|
2483
2529
|
|
|
2484
2530
|
### Overview
|
|
2485
2531
|
|
|
2486
|
-
|
|
2532
|
+
Invokes the plan's selected builder with complete app/dependency release records,
|
|
2533
|
+
their file readers, the flat target request and event/cancellation lifecycle.
|
|
2487
2534
|
|
|
2488
2535
|
### Signature and result
|
|
2489
2536
|
|
|
@@ -2619,15 +2666,26 @@ async function useloadArcaneIntegratedProvider(...arguments_) {
|
|
|
2619
2666
|
|
|
2620
2667
|
### Overview
|
|
2621
2668
|
|
|
2622
|
-
Loads the
|
|
2623
|
-
|
|
2669
|
+
Loads the package-owned portable provider when `arcaneRoot` is omitted and
|
|
2670
|
+
`target` is `portable`. An explicit root retains the fixed Arcane OS checkout
|
|
2671
|
+
provider route, including its errors; there is no silent fallback. Other native
|
|
2672
|
+
targets still require that root. Normal Node module resolution owns imports.
|
|
2624
2673
|
|
|
2625
2674
|
### Signature and result
|
|
2626
2675
|
|
|
2627
2676
|
```text
|
|
2628
|
-
loadArcaneNativeProvider({ arcaneRoot, target, inspect=lstat, canonicalize=realpath,
|
|
2677
|
+
async loadArcaneNativeProvider({ arcaneRoot, target, inspect=lstat, canonicalize=realpath, importModule=specifier=>import(specifier), signal, onEvent }={})
|
|
2629
2678
|
```
|
|
2630
2679
|
|
|
2680
|
+
The result retains `arcaneRoot`, `toolchainRoot`, `providerPath` and
|
|
2681
|
+
`nativeBuilder`, and adds `providerSource`. Package pairing returns
|
|
2682
|
+
`providerSource:'sdk-package'`, `arcaneRoot:null` and the installed SDK root as
|
|
2683
|
+
`toolchainRoot`. Explicit checkout pairing returns
|
|
2684
|
+
`providerSource:'arcane-checkout'` with the selected root. Load completion means
|
|
2685
|
+
the builder interface was loaded, not that an app, native host or service is ready.
|
|
2686
|
+
For explicit service composition and host lifecycle, use the separate
|
|
2687
|
+
[`arcane-os/native/portable-provider` and `arcane-os/core/host` guide](core-native-packaging.md).
|
|
2688
|
+
|
|
2631
2689
|
Import it from `arcane-os` or `arcane-os/native-provider`. The signature above states whether settlement is synchronous or promise-based. The overview and owning group define result authority, side effects, callbacks, events, cancellation, and lifecycle.
|
|
2632
2690
|
|
|
2633
2691
|
### Availability and normalization
|
|
@@ -2648,7 +2706,7 @@ async function useloadArcaneNativeProvider(...arguments_) {
|
|
|
2648
2706
|
|
|
2649
2707
|
### Overview
|
|
2650
2708
|
|
|
2651
|
-
Protocol identifier for
|
|
2709
|
+
Protocol identifier for native plans with complete selected release inputs.
|
|
2652
2710
|
|
|
2653
2711
|
### Value and import
|
|
2654
2712
|
|
|
@@ -6370,6 +6428,705 @@ const stack = parseEventStack(serialized);
|
|
|
6370
6428
|
console.log(stack.sessionId, stack.events.length);
|
|
6371
6429
|
```
|
|
6372
6430
|
|
|
6431
|
+
# Core client and native runtime
|
|
6432
|
+
|
|
6433
|
+
The focused Core entrypoints share the `arcane/1` wire contract while retaining
|
|
6434
|
+
separate owners for renderer RPC, native dispatch and stdio framing. Start with
|
|
6435
|
+
the complete [Core browser client](core-client.md) and
|
|
6436
|
+
[native Core runtime](core-runtime.md) guides for lifecycle and composition.
|
|
6437
|
+
|
|
6438
|
+
## CORE_PROTOCOL
|
|
6439
|
+
|
|
6440
|
+
### Overview
|
|
6441
|
+
|
|
6442
|
+
Protocol identifier shared by Core requests, responses, events and controls.
|
|
6443
|
+
The identifier describes the wire contract; it does not grant a method,
|
|
6444
|
+
transport, service or model capability.
|
|
6445
|
+
|
|
6446
|
+
### Value and import
|
|
6447
|
+
|
|
6448
|
+
```text
|
|
6449
|
+
const CORE_PROTOCOL = 'arcane/1'
|
|
6450
|
+
```
|
|
6451
|
+
|
|
6452
|
+
Import it from `arcane-os/core/contracts`.
|
|
6453
|
+
|
|
6454
|
+
### Availability and normalization
|
|
6455
|
+
|
|
6456
|
+
**Node and browser/bundler.** The exported value is the exact protocol string
|
|
6457
|
+
used in every Core frame.
|
|
6458
|
+
|
|
6459
|
+
### Example
|
|
6460
|
+
|
|
6461
|
+
```javascript
|
|
6462
|
+
import {CORE_PROTOCOL} from 'arcane-os/core/contracts';
|
|
6463
|
+
|
|
6464
|
+
const request = {
|
|
6465
|
+
protocol: CORE_PROTOCOL,
|
|
6466
|
+
type: 'request',
|
|
6467
|
+
id: 'moon-cheese-1',
|
|
6468
|
+
method: 'catalog.read',
|
|
6469
|
+
parameters: {name: 'Lunar cheddar'}
|
|
6470
|
+
};
|
|
6471
|
+
```
|
|
6472
|
+
|
|
6473
|
+
## CORE_READY_EVENTS
|
|
6474
|
+
|
|
6475
|
+
### Overview
|
|
6476
|
+
|
|
6477
|
+
Names the two events the browser client retains as durable completions:
|
|
6478
|
+
`transport.ready` and `core.ready`. Transport connection and dispatcher
|
|
6479
|
+
readiness remain distinct from application-service, repository and model
|
|
6480
|
+
readiness.
|
|
6481
|
+
|
|
6482
|
+
### Value and import
|
|
6483
|
+
|
|
6484
|
+
```text
|
|
6485
|
+
const CORE_READY_EVENTS
|
|
6486
|
+
```
|
|
6487
|
+
|
|
6488
|
+
Import it from `arcane-os/core/contracts`.
|
|
6489
|
+
|
|
6490
|
+
### Availability and normalization
|
|
6491
|
+
|
|
6492
|
+
**Node and browser/bundler.** These names define the events accepted by
|
|
6493
|
+
`client.events.when()` and reported by `client.events.completed()`.
|
|
6494
|
+
|
|
6495
|
+
### Example
|
|
6496
|
+
|
|
6497
|
+
```javascript
|
|
6498
|
+
import {CORE_READY_EVENTS} from 'arcane-os/core/contracts';
|
|
6499
|
+
|
|
6500
|
+
console.log(CORE_READY_EVENTS.includes('core.ready')); // true
|
|
6501
|
+
```
|
|
6502
|
+
|
|
6503
|
+
## CORE_FRAME_CONTRACTS
|
|
6504
|
+
|
|
6505
|
+
### Overview
|
|
6506
|
+
|
|
6507
|
+
Describes the public fields for request, response, event, single-request
|
|
6508
|
+
cancellation and all-request cancellation frames. These are wire descriptions,
|
|
6509
|
+
not application validation or method admission.
|
|
6510
|
+
|
|
6511
|
+
### Value and import
|
|
6512
|
+
|
|
6513
|
+
```text
|
|
6514
|
+
const CORE_FRAME_CONTRACTS
|
|
6515
|
+
```
|
|
6516
|
+
|
|
6517
|
+
Import it from `arcane-os/core/contracts`.
|
|
6518
|
+
|
|
6519
|
+
### Availability and normalization
|
|
6520
|
+
|
|
6521
|
+
**Node and browser/bundler.** Each record names its frame type and required,
|
|
6522
|
+
success, failure or optional fields without starting a transport.
|
|
6523
|
+
|
|
6524
|
+
### Example
|
|
6525
|
+
|
|
6526
|
+
```javascript
|
|
6527
|
+
import {CORE_FRAME_CONTRACTS} from 'arcane-os/core/contracts';
|
|
6528
|
+
|
|
6529
|
+
console.log(CORE_FRAME_CONTRACTS.response.failure); // ['error']
|
|
6530
|
+
```
|
|
6531
|
+
|
|
6532
|
+
## CORE_METHOD_CONTRACTS
|
|
6533
|
+
|
|
6534
|
+
### Overview
|
|
6535
|
+
|
|
6536
|
+
Describes existing Core method input and output shapes plus semantic distinctions
|
|
6537
|
+
that callers must preserve. The active host and its registered services remain
|
|
6538
|
+
the authority for actual method availability.
|
|
6539
|
+
|
|
6540
|
+
### Value and import
|
|
6541
|
+
|
|
6542
|
+
```text
|
|
6543
|
+
const CORE_METHOD_CONTRACTS
|
|
6544
|
+
```
|
|
6545
|
+
|
|
6546
|
+
Import it from `arcane-os/core/contracts`.
|
|
6547
|
+
|
|
6548
|
+
### Availability and normalization
|
|
6549
|
+
|
|
6550
|
+
**Node and browser/bundler.** Reading the metadata starts no request and grants
|
|
6551
|
+
no host capability.
|
|
6552
|
+
|
|
6553
|
+
### Example
|
|
6554
|
+
|
|
6555
|
+
```javascript
|
|
6556
|
+
import {CORE_METHOD_CONTRACTS} from 'arcane-os/core/contracts';
|
|
6557
|
+
|
|
6558
|
+
console.log(CORE_METHOD_CONTRACTS['system.ping'].meaning);
|
|
6559
|
+
```
|
|
6560
|
+
|
|
6561
|
+
## CoreError
|
|
6562
|
+
|
|
6563
|
+
### Overview
|
|
6564
|
+
|
|
6565
|
+
Common Core error class for complete service, transport and host diagnostics.
|
|
6566
|
+
It retains supplied own fields, stack and cause while filling absent Arcane
|
|
6567
|
+
error metadata with ordinary defaults.
|
|
6568
|
+
|
|
6569
|
+
### Constructor and result
|
|
6570
|
+
|
|
6571
|
+
```text
|
|
6572
|
+
new CoreError(value)
|
|
6573
|
+
```
|
|
6574
|
+
|
|
6575
|
+
Import it from `arcane-os/core/contracts`. The instance exposes its supplied
|
|
6576
|
+
fields plus normalized `name`, `code`, `message`, `resolution`, `diagnosticId`,
|
|
6577
|
+
`technicalMessage`, `hresult` and `causeName` values.
|
|
6578
|
+
|
|
6579
|
+
### Availability and normalization
|
|
6580
|
+
|
|
6581
|
+
**Node and browser/bundler.** Native bridge codes and messages remain available
|
|
6582
|
+
when supplied; normalized defaults fill only absent fields.
|
|
6583
|
+
|
|
6584
|
+
### Example
|
|
6585
|
+
|
|
6586
|
+
```javascript
|
|
6587
|
+
import {CoreError} from 'arcane-os/core/contracts';
|
|
6588
|
+
|
|
6589
|
+
const error = new CoreError({
|
|
6590
|
+
code: 'MOON_CHEESE_MISSING',
|
|
6591
|
+
message: 'The emergency lunar cheddar is missing.',
|
|
6592
|
+
diagnosticId: 'catalog-7'
|
|
6593
|
+
});
|
|
6594
|
+
console.log(error.code, error.diagnosticId);
|
|
6595
|
+
```
|
|
6596
|
+
|
|
6597
|
+
## serializeCoreError()
|
|
6598
|
+
|
|
6599
|
+
### Overview
|
|
6600
|
+
|
|
6601
|
+
Projects an error into the plain diagnostic record used by Core responses and
|
|
6602
|
+
events. It retains own properties and the ordinary name, message, stack and
|
|
6603
|
+
cause fields, recursively including Error causes and AggregateError members.
|
|
6604
|
+
|
|
6605
|
+
### Signature and result
|
|
6606
|
+
|
|
6607
|
+
```text
|
|
6608
|
+
serializeCoreError(error)
|
|
6609
|
+
```
|
|
6610
|
+
|
|
6611
|
+
Import it from `arcane-os/core/contracts`. The result is a plain object suitable
|
|
6612
|
+
for the selected transport's JSON encoding.
|
|
6613
|
+
|
|
6614
|
+
### Availability and normalization
|
|
6615
|
+
|
|
6616
|
+
**Node and browser/bundler.** Missing error metadata receives explicit ordinary
|
|
6617
|
+
defaults; complete supplied diagnostic fields remain present.
|
|
6618
|
+
|
|
6619
|
+
### Example
|
|
6620
|
+
|
|
6621
|
+
```javascript
|
|
6622
|
+
import {serializeCoreError} from 'arcane-os/core/contracts';
|
|
6623
|
+
|
|
6624
|
+
const record = serializeCoreError(new AggregateError([
|
|
6625
|
+
new Error('The moon vault door jammed.'),
|
|
6626
|
+
new Error('The backup raccoon lost the key.')
|
|
6627
|
+
], 'Catalog startup failed.'));
|
|
6628
|
+
console.log(record.errors.map(error => error.message));
|
|
6629
|
+
```
|
|
6630
|
+
|
|
6631
|
+
## createCoreClient()
|
|
6632
|
+
|
|
6633
|
+
### Overview
|
|
6634
|
+
|
|
6635
|
+
Creates one correlated renderer RPC client. It owns pending requests,
|
|
6636
|
+
cancellation, timeouts, durable readiness events and one source in the shared
|
|
6637
|
+
SDK event authority. Native host execution and service policy remain outside
|
|
6638
|
+
the client.
|
|
6639
|
+
|
|
6640
|
+
### Signature and result
|
|
6641
|
+
|
|
6642
|
+
```text
|
|
6643
|
+
createCoreClient({global=globalThis, transport=null, eventOwner=arcaneEvents, eventOwnerReady, autoConnect=true, onError}={})
|
|
6644
|
+
```
|
|
6645
|
+
|
|
6646
|
+
Import it from `arcane-os/core/client`. The result exposes `invoke`, `receive`,
|
|
6647
|
+
`connect`, `close`, `cancelAll`, `events`, `eventsReady`, `runtime.current()`,
|
|
6648
|
+
`uuid`, `protocol` and `Error`. A supplied transport must provide callable
|
|
6649
|
+
`send(frame)`; an invalid transport stays disconnected and reports
|
|
6650
|
+
`ARCANE_TRANSPORT_INVALID`. Optional `subscribe(receive)` may return its cleanup
|
|
6651
|
+
function.
|
|
6652
|
+
|
|
6653
|
+
`invoke(method, parameters, {signal, timeoutMs})` preserves complete supplied
|
|
6654
|
+
parameters and resolves the correlated response result. A send failure rejects
|
|
6655
|
+
its still-pending request; a failure arriving after response, cancellation or
|
|
6656
|
+
timeout reaches `onError`. Deferred event-owner connection preserves the FIFO
|
|
6657
|
+
order of queued frames and subscription actions, including reentrant delivery.
|
|
6658
|
+
|
|
6659
|
+
### Availability and normalization
|
|
6660
|
+
|
|
6661
|
+
**Browser and native WebView JavaScript hosts.** Built-in transports select
|
|
6662
|
+
WebView2, WebKitGTK, Android WebView or an explicitly enabled development HTTP
|
|
6663
|
+
bridge. An ordinary browser remains disconnected. Full lifecycle guidance:
|
|
6664
|
+
[Core browser client](core-client.md).
|
|
6665
|
+
|
|
6666
|
+
### Example
|
|
6667
|
+
|
|
6668
|
+
```javascript
|
|
6669
|
+
import {createCoreClient} from 'arcane-os/core/client';
|
|
6670
|
+
import {CORE_PROTOCOL} from 'arcane-os/core/contracts';
|
|
6671
|
+
|
|
6672
|
+
let outbound;
|
|
6673
|
+
const client = createCoreClient({
|
|
6674
|
+
transport: {
|
|
6675
|
+
name: 'moon-wire',
|
|
6676
|
+
send(frame) { outbound = frame; }
|
|
6677
|
+
}
|
|
6678
|
+
});
|
|
6679
|
+
const operation = client.invoke('catalog.read', {name: 'Lunar cheddar'});
|
|
6680
|
+
client.receive({
|
|
6681
|
+
protocol: CORE_PROTOCOL,
|
|
6682
|
+
type: 'response',
|
|
6683
|
+
id: outbound.id,
|
|
6684
|
+
ok: true,
|
|
6685
|
+
result: {found: true, location: 'Vault 7'}
|
|
6686
|
+
});
|
|
6687
|
+
console.log(await operation);
|
|
6688
|
+
client.close();
|
|
6689
|
+
```
|
|
6690
|
+
|
|
6691
|
+
## createCoreFacade()
|
|
6692
|
+
|
|
6693
|
+
### Overview
|
|
6694
|
+
|
|
6695
|
+
Projects a Core client into the established application-facing Arcane namespace.
|
|
6696
|
+
The facade retains the existing method names, operation-specific parameters,
|
|
6697
|
+
timeouts, streaming correlations and cancellation while the selected host owns
|
|
6698
|
+
their implementations and availability.
|
|
6699
|
+
|
|
6700
|
+
### Signature and result
|
|
6701
|
+
|
|
6702
|
+
```text
|
|
6703
|
+
createCoreFacade(client)
|
|
6704
|
+
```
|
|
6705
|
+
|
|
6706
|
+
Import it from `arcane-os/core/client`. The result includes `runtime`, `events`,
|
|
6707
|
+
`Error` and the existing `ai`, `environment`, `mail`, `speech`, `localAI`,
|
|
6708
|
+
`ollama`, application, platform, storage and other host namespaces.
|
|
6709
|
+
|
|
6710
|
+
### Availability and normalization
|
|
6711
|
+
|
|
6712
|
+
**Browser and native WebView JavaScript hosts with a Core client.** Creating the
|
|
6713
|
+
facade starts no service and grants no method capability. Full method routing is
|
|
6714
|
+
documented in the [Core browser client guide](core-client.md).
|
|
6715
|
+
|
|
6716
|
+
### Example
|
|
6717
|
+
|
|
6718
|
+
```javascript
|
|
6719
|
+
import {createCoreClient, createCoreFacade} from 'arcane-os/core/client';
|
|
6720
|
+
|
|
6721
|
+
const client = createCoreClient({autoConnect: false});
|
|
6722
|
+
const Arcane = createCoreFacade(client);
|
|
6723
|
+
console.log(Arcane.protocol, Arcane.runtime.current());
|
|
6724
|
+
client.close();
|
|
6725
|
+
```
|
|
6726
|
+
|
|
6727
|
+
## installCoreClient()
|
|
6728
|
+
|
|
6729
|
+
### Overview
|
|
6730
|
+
|
|
6731
|
+
Installs one synchronous `globalThis.Arcane` facade and native
|
|
6732
|
+
`__arcaneReceive` callback. Repeated installation returns the same client for
|
|
6733
|
+
that global lifetime.
|
|
6734
|
+
|
|
6735
|
+
### Signature and result
|
|
6736
|
+
|
|
6737
|
+
```text
|
|
6738
|
+
installCoreClient(global=globalThis, options={})
|
|
6739
|
+
```
|
|
6740
|
+
|
|
6741
|
+
Import it from `arcane-os/core/client`. The returned client is the same contract
|
|
6742
|
+
as `createCoreClient()`. Closing it releases subscriptions, native callbacks,
|
|
6743
|
+
timers and pending renderer requests; it does not kill Core.
|
|
6744
|
+
|
|
6745
|
+
### Availability and normalization
|
|
6746
|
+
|
|
6747
|
+
**Browser and native WebView JavaScript hosts.** Installation makes synchronous
|
|
6748
|
+
facade and current-state shapes available even while the selected transport is
|
|
6749
|
+
disconnected. Service readiness remains separately host-owned.
|
|
6750
|
+
|
|
6751
|
+
### Example
|
|
6752
|
+
|
|
6753
|
+
```javascript
|
|
6754
|
+
import {installCoreClient} from 'arcane-os/core/client';
|
|
6755
|
+
|
|
6756
|
+
const client = installCoreClient();
|
|
6757
|
+
try {
|
|
6758
|
+
console.log(globalThis.Arcane.runtime.current());
|
|
6759
|
+
} finally {
|
|
6760
|
+
client.close();
|
|
6761
|
+
}
|
|
6762
|
+
```
|
|
6763
|
+
|
|
6764
|
+
## createCoreClassicSource()
|
|
6765
|
+
|
|
6766
|
+
### Overview
|
|
6767
|
+
|
|
6768
|
+
Generates the native host's classic script from the installed canonical ESM
|
|
6769
|
+
client and contracts. It creates no copied client implementation or bundler.
|
|
6770
|
+
|
|
6771
|
+
### Signature and result
|
|
6772
|
+
|
|
6773
|
+
```text
|
|
6774
|
+
async createCoreClassicSource({eventOwnerModuleURL}={})
|
|
6775
|
+
```
|
|
6776
|
+
|
|
6777
|
+
Import it from `arcane-os/core/classic-source`. Supply the actual served URL for
|
|
6778
|
+
the selected SDK event-manager module. The promise resolves to the complete
|
|
6779
|
+
classic-script source.
|
|
6780
|
+
|
|
6781
|
+
### Availability and normalization
|
|
6782
|
+
|
|
6783
|
+
**Node; generated source runs in browser and native WebView renderers.** The
|
|
6784
|
+
facade and native receive callback install synchronously. Only the shared event
|
|
6785
|
+
owner import waits for document parsing when needed, while queued event frames,
|
|
6786
|
+
subscription actions and final responses retain FIFO order. See
|
|
6787
|
+
[classic native-host injection](core-client.md#classic-native-host-injection).
|
|
6788
|
+
|
|
6789
|
+
### Example
|
|
6790
|
+
|
|
6791
|
+
```javascript
|
|
6792
|
+
import {createCoreClassicSource} from 'arcane-os/core/classic-source';
|
|
6793
|
+
|
|
6794
|
+
const source = await createCoreClassicSource({
|
|
6795
|
+
eventOwnerModuleURL: '/arcane/sdk/event-manager.mjs'
|
|
6796
|
+
});
|
|
6797
|
+
nativeHost.setDocumentCreatedScript(source);
|
|
6798
|
+
```
|
|
6799
|
+
|
|
6800
|
+
## createCoreRuntime()
|
|
6801
|
+
|
|
6802
|
+
### Overview
|
|
6803
|
+
|
|
6804
|
+
Creates the app-neutral native dispatcher. The composing host supplies its
|
|
6805
|
+
application identity, version and explicit services; product data, prompts,
|
|
6806
|
+
privileges and persistence remain with those owners.
|
|
6807
|
+
|
|
6808
|
+
### Signature and result
|
|
6809
|
+
|
|
6810
|
+
```text
|
|
6811
|
+
createCoreRuntime({application, version, services=[]}={})
|
|
6812
|
+
```
|
|
6813
|
+
|
|
6814
|
+
Import it from `arcane-os/core/runtime`. The runtime exposes `current()`,
|
|
6815
|
+
`subscribe()`, `onFrame()`, `emit()`, `registerService()`, `start()`, `handle()`
|
|
6816
|
+
and idempotent `close()`.
|
|
6817
|
+
|
|
6818
|
+
Services start independently. Request-lifetime work receives cooperative
|
|
6819
|
+
cancellation; accepted `lifetime:'service'` work survives renderer cancellation.
|
|
6820
|
+
Shutdown stops admission, waits accepted responses, then runs each service's
|
|
6821
|
+
startup, drain and dispose in order while independent services close
|
|
6822
|
+
concurrently.
|
|
6823
|
+
|
|
6824
|
+
### Availability and normalization
|
|
6825
|
+
|
|
6826
|
+
**Node on Windows, Linux and macOS native hosts; Android requires its native host
|
|
6827
|
+
adaptation.** Request parameters, results, correlations and serialized errors
|
|
6828
|
+
remain complete. The runtime uses the shared SDK event authority and never exits
|
|
6829
|
+
the host. Full contract: [native Core runtime](core-runtime.md).
|
|
6830
|
+
|
|
6831
|
+
### Example
|
|
6832
|
+
|
|
6833
|
+
```javascript
|
|
6834
|
+
import {createCoreRuntime} from 'arcane-os/core/runtime';
|
|
6835
|
+
|
|
6836
|
+
const runtime = createCoreRuntime({
|
|
6837
|
+
application: {id: 'moon-catalog', name: 'Moon Cheese Catalog'},
|
|
6838
|
+
version: '1.0.0',
|
|
6839
|
+
services: [{
|
|
6840
|
+
name: 'catalog',
|
|
6841
|
+
methods: {
|
|
6842
|
+
'catalog.read': parameters => ({found: true, name: parameters.name})
|
|
6843
|
+
}
|
|
6844
|
+
}]
|
|
6845
|
+
});
|
|
6846
|
+
runtime.start();
|
|
6847
|
+
const response = await runtime.handle({
|
|
6848
|
+
protocol: 'arcane/1',
|
|
6849
|
+
type: 'request',
|
|
6850
|
+
id: 'catalog-1',
|
|
6851
|
+
method: 'catalog.read',
|
|
6852
|
+
parameters: {name: 'Lunar cheddar'}
|
|
6853
|
+
});
|
|
6854
|
+
console.log(response.result);
|
|
6855
|
+
await runtime.close();
|
|
6856
|
+
```
|
|
6857
|
+
|
|
6858
|
+
## encodeCoreFrame()
|
|
6859
|
+
|
|
6860
|
+
### Overview
|
|
6861
|
+
|
|
6862
|
+
Encodes one Core frame as UTF-8 JSON preceded by the native transport's
|
|
6863
|
+
`Content-Length` header. The length is transport framing only, never
|
|
6864
|
+
application policy or capability admission.
|
|
6865
|
+
|
|
6866
|
+
### Signature and result
|
|
6867
|
+
|
|
6868
|
+
```text
|
|
6869
|
+
encodeCoreFrame(frame)
|
|
6870
|
+
```
|
|
6871
|
+
|
|
6872
|
+
Import it from `arcane-os/core/stdio`. The result is one Node `Buffer` ready for
|
|
6873
|
+
the selected writable stream.
|
|
6874
|
+
|
|
6875
|
+
### Availability and normalization
|
|
6876
|
+
|
|
6877
|
+
**Node.** JSON encoding preserves the supplied frame fields supported by JSON.
|
|
6878
|
+
The helper neither writes the buffer nor starts a runtime. See
|
|
6879
|
+
[stdio transport](core-runtime.md#stdio-transport).
|
|
6880
|
+
|
|
6881
|
+
### Example
|
|
6882
|
+
|
|
6883
|
+
```javascript
|
|
6884
|
+
import {encodeCoreFrame} from 'arcane-os/core/stdio';
|
|
6885
|
+
|
|
6886
|
+
const encoded = encodeCoreFrame({
|
|
6887
|
+
protocol: 'arcane/1',
|
|
6888
|
+
type: 'control',
|
|
6889
|
+
control: 'requests.cancelAll'
|
|
6890
|
+
});
|
|
6891
|
+
output.write(encoded);
|
|
6892
|
+
```
|
|
6893
|
+
|
|
6894
|
+
## createCoreFrameDecoder()
|
|
6895
|
+
|
|
6896
|
+
### Overview
|
|
6897
|
+
|
|
6898
|
+
Creates the incremental decoder for fragmented or consecutive native Core
|
|
6899
|
+
frames.
|
|
6900
|
+
|
|
6901
|
+
### Signature and result
|
|
6902
|
+
|
|
6903
|
+
```text
|
|
6904
|
+
createCoreFrameDecoder(onFrame)
|
|
6905
|
+
```
|
|
6906
|
+
|
|
6907
|
+
Import it from `arcane-os/core/stdio`. The result exposes `push(chunk)` and
|
|
6908
|
+
`finish()`. `push()` calls `onFrame` once for each complete parsed JSON value in
|
|
6909
|
+
arrival order. `finish()` reports an incomplete final header or body instead of
|
|
6910
|
+
dropping it.
|
|
6911
|
+
|
|
6912
|
+
### Availability and normalization
|
|
6913
|
+
|
|
6914
|
+
**Node.** Malformed framing, UTF-8 and JSON remain observable at their owning
|
|
6915
|
+
parser. Full transport lifecycle: [stdio transport](core-runtime.md#stdio-transport).
|
|
6916
|
+
|
|
6917
|
+
### Example
|
|
6918
|
+
|
|
6919
|
+
```javascript
|
|
6920
|
+
import {createCoreFrameDecoder, encodeCoreFrame} from 'arcane-os/core/stdio';
|
|
6921
|
+
|
|
6922
|
+
const frames = [];
|
|
6923
|
+
const decoder = createCoreFrameDecoder(frame => frames.push(frame));
|
|
6924
|
+
decoder.push(encodeCoreFrame({
|
|
6925
|
+
protocol: 'arcane/1',
|
|
6926
|
+
type: 'event',
|
|
6927
|
+
event: 'moon.opened',
|
|
6928
|
+
data: {vault: 7}
|
|
6929
|
+
}));
|
|
6930
|
+
decoder.finish();
|
|
6931
|
+
console.log(frames[0].data.vault);
|
|
6932
|
+
```
|
|
6933
|
+
|
|
6934
|
+
## startCoreStdio()
|
|
6935
|
+
|
|
6936
|
+
### Overview
|
|
6937
|
+
|
|
6938
|
+
Attaches an existing runtime to framed input and output, then starts that
|
|
6939
|
+
runtime. Requests dispatch concurrently while outgoing frames retain queued
|
|
6940
|
+
writable-callback order.
|
|
6941
|
+
|
|
6942
|
+
### Signature and result
|
|
6943
|
+
|
|
6944
|
+
```text
|
|
6945
|
+
startCoreStdio({runtime, input=process.stdin, output=process.stdout, onError}={})
|
|
6946
|
+
```
|
|
6947
|
+
|
|
6948
|
+
Import it from `arcane-os/core/stdio`. The result is
|
|
6949
|
+
`{runtime, closed, close}`. EOF or input close starts graceful shutdown;
|
|
6950
|
+
`closed` settles only after accepted runtime work and queued output settle.
|
|
6951
|
+
|
|
6952
|
+
### Availability and normalization
|
|
6953
|
+
|
|
6954
|
+
**Node with readable input and writable output streams.** Parser, input, output
|
|
6955
|
+
and shutdown failures reach `onError` and reject `closed`. The transport pauses
|
|
6956
|
+
and detaches input without ending caller-owned output or exiting the host. See
|
|
6957
|
+
[stdio transport](core-runtime.md#stdio-transport).
|
|
6958
|
+
|
|
6959
|
+
### Example
|
|
6960
|
+
|
|
6961
|
+
```javascript
|
|
6962
|
+
import {createCoreRuntime} from 'arcane-os/core/runtime';
|
|
6963
|
+
import {startCoreStdio} from 'arcane-os/core/stdio';
|
|
6964
|
+
|
|
6965
|
+
const runtime = createCoreRuntime({
|
|
6966
|
+
application: {id: 'moon-catalog'},
|
|
6967
|
+
version: '1.0.0'
|
|
6968
|
+
});
|
|
6969
|
+
const transport = startCoreStdio({runtime});
|
|
6970
|
+
await transport.closed;
|
|
6971
|
+
```
|
|
6972
|
+
|
|
6973
|
+
## createPortableNativeProvider()
|
|
6974
|
+
|
|
6975
|
+
### Overview
|
|
6976
|
+
|
|
6977
|
+
Creates the SDK-owned native builder for one portable Core payload. The caller
|
|
6978
|
+
selects application service modules already present in the app release. The
|
|
6979
|
+
provider does not load Arcane OS source, choose a model, download a runtime,
|
|
6980
|
+
compile an executable or substitute for an unavailable platform host.
|
|
6981
|
+
|
|
6982
|
+
### Signature and result
|
|
6983
|
+
|
|
6984
|
+
```text
|
|
6985
|
+
createPortableNativeProvider({services=[]}={})
|
|
6986
|
+
```
|
|
6987
|
+
|
|
6988
|
+
Import it from `arcane-os/native/portable-provider`. Each service selection is
|
|
6989
|
+
`{module, options}`. The returned `arcane-native-builder/1` provider exposes
|
|
6990
|
+
`describe()`, `doctor()`, `prepare()`, `build()`, `verify()` and `run()`.
|
|
6991
|
+
`describe()` and successful payload results report `executable:false`; `run()`
|
|
6992
|
+
reports `ARCANE_NATIVE_RUN_UNSUPPORTED`.
|
|
6993
|
+
|
|
6994
|
+
`build()` copies the complete selected app and dependency releases, the
|
|
6995
|
+
published SDK/runtime dependencies and the canonical Core entry/client into a
|
|
6996
|
+
fresh output directory. Service factories are imported only when a real native
|
|
6997
|
+
host later launches the generated Core entry, never during packaging.
|
|
6998
|
+
|
|
6999
|
+
### Availability and normalization
|
|
7000
|
+
|
|
7001
|
+
**Node; produces a portable payload rather than an executable host.** Existing
|
|
7002
|
+
outputs remain untouched, cancellation removes only the incomplete new output,
|
|
7003
|
+
and verification reads the semantic manifest and listed files without executing
|
|
7004
|
+
a host. Full ownership and layout contract:
|
|
7005
|
+
[portable Core packaging](core-native-packaging.md).
|
|
7006
|
+
|
|
7007
|
+
### Example
|
|
7008
|
+
|
|
7009
|
+
```javascript
|
|
7010
|
+
import {createPortableNativeProvider} from 'arcane-os/native/portable-provider';
|
|
7011
|
+
|
|
7012
|
+
const provider = createPortableNativeProvider({
|
|
7013
|
+
services: [{
|
|
7014
|
+
module: 'native/moon-ledger.mjs',
|
|
7015
|
+
options: {ledgerName: 'Cheese debts'}
|
|
7016
|
+
}]
|
|
7017
|
+
});
|
|
7018
|
+
console.log(await provider.describe());
|
|
7019
|
+
```
|
|
7020
|
+
|
|
7021
|
+
## arcaneNativeBuilderProvider
|
|
7022
|
+
|
|
7023
|
+
### Overview
|
|
7024
|
+
|
|
7025
|
+
Package-owned portable provider with no preconfigured application services. It
|
|
7026
|
+
is the named binding for the same object exposed as this subpath's default.
|
|
7027
|
+
|
|
7028
|
+
### Value and import
|
|
7029
|
+
|
|
7030
|
+
```text
|
|
7031
|
+
const arcaneNativeBuilderProvider
|
|
7032
|
+
```
|
|
7033
|
+
|
|
7034
|
+
Import it from `arcane-os/native/portable-provider`.
|
|
7035
|
+
|
|
7036
|
+
### Availability and normalization
|
|
7037
|
+
|
|
7038
|
+
**Node; produces a portable payload rather than an executable host.** The
|
|
7039
|
+
singleton retains the complete `arcane-native-builder/1` portable-provider
|
|
7040
|
+
contract described by `createPortableNativeProvider()`.
|
|
7041
|
+
|
|
7042
|
+
### Example
|
|
7043
|
+
|
|
7044
|
+
```javascript
|
|
7045
|
+
import {arcaneNativeBuilderProvider} from 'arcane-os/native/portable-provider';
|
|
7046
|
+
|
|
7047
|
+
const description = await arcaneNativeBuilderProvider.describe();
|
|
7048
|
+
console.log(description.targets, description.executable);
|
|
7049
|
+
```
|
|
7050
|
+
|
|
7051
|
+
## arcaneNativeBuilderProvider default export
|
|
7052
|
+
|
|
7053
|
+
### Overview
|
|
7054
|
+
|
|
7055
|
+
Default package binding for the same object exposed as
|
|
7056
|
+
`arcaneNativeBuilderProvider`.
|
|
7057
|
+
|
|
7058
|
+
### Value and import
|
|
7059
|
+
|
|
7060
|
+
```text
|
|
7061
|
+
default as arcaneNativeBuilderProvider
|
|
7062
|
+
```
|
|
7063
|
+
|
|
7064
|
+
Import it from `arcane-os/native/portable-provider`.
|
|
7065
|
+
|
|
7066
|
+
### Availability and normalization
|
|
7067
|
+
|
|
7068
|
+
**Node; produces a portable payload rather than an executable host.** The
|
|
7069
|
+
default and named bindings have exact object identity and the same lifecycle.
|
|
7070
|
+
|
|
7071
|
+
### Example
|
|
7072
|
+
|
|
7073
|
+
```javascript
|
|
7074
|
+
import portableProvider, {
|
|
7075
|
+
arcaneNativeBuilderProvider
|
|
7076
|
+
} from 'arcane-os/native/portable-provider';
|
|
7077
|
+
|
|
7078
|
+
console.log(portableProvider === arcaneNativeBuilderProvider); // true
|
|
7079
|
+
```
|
|
7080
|
+
|
|
7081
|
+
## startCoreHost()
|
|
7082
|
+
|
|
7083
|
+
### Overview
|
|
7084
|
+
|
|
7085
|
+
Composes explicitly supplied application services with the shared Core runtime
|
|
7086
|
+
and stdio transport. It is a lifecycle helper for a host-owned Node process,
|
|
7087
|
+
not an executable host or another dispatcher implementation.
|
|
7088
|
+
|
|
7089
|
+
### Signature and result
|
|
7090
|
+
|
|
7091
|
+
```text
|
|
7092
|
+
startCoreHost({application, version, services=[], input, output, onError, signal}={})
|
|
7093
|
+
```
|
|
7094
|
+
|
|
7095
|
+
Import it from `arcane-os/core/host`. The result is the existing stdio owner
|
|
7096
|
+
`{runtime, closed, close}`. An optional abort signal invokes that same
|
|
7097
|
+
idempotent `close()` and its graceful drain.
|
|
7098
|
+
|
|
7099
|
+
Dispatcher readiness does not wait for service or model readiness. Renderer
|
|
7100
|
+
cancellation reaches request-lifetime work, while accepted
|
|
7101
|
+
`lifetime:'service'` work survives and settles before service drain, disposal
|
|
7102
|
+
and final output completion.
|
|
7103
|
+
|
|
7104
|
+
### Availability and normalization
|
|
7105
|
+
|
|
7106
|
+
**Node with readable input and writable output streams.** Errors remain
|
|
7107
|
+
observable through `onError` and `closed`. The helper never kills or exits the
|
|
7108
|
+
process and does not end caller-owned output. See
|
|
7109
|
+
[portable Core packaging](core-native-packaging.md#explicit-application-services)
|
|
7110
|
+
and the [native Core runtime](core-runtime.md).
|
|
7111
|
+
|
|
7112
|
+
### Example
|
|
7113
|
+
|
|
7114
|
+
```javascript
|
|
7115
|
+
import {startCoreHost} from 'arcane-os/core/host';
|
|
7116
|
+
|
|
7117
|
+
const host = startCoreHost({
|
|
7118
|
+
application: {id: 'moon-catalog', name: 'Moon Cheese Catalog'},
|
|
7119
|
+
version: '1.0.0',
|
|
7120
|
+
services: [{
|
|
7121
|
+
name: 'catalog',
|
|
7122
|
+
methods: {
|
|
7123
|
+
'catalog.read': parameters => ({found: true, name: parameters.name})
|
|
7124
|
+
}
|
|
7125
|
+
}]
|
|
7126
|
+
});
|
|
7127
|
+
await host.closed;
|
|
7128
|
+
```
|
|
7129
|
+
|
|
6373
7130
|
## BROWSER_WASM_RUNTIME_AUTHORITY
|
|
6374
7131
|
|
|
6375
7132
|
### Overview
|