arcane-os 0.83.1 → 0.85.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.
@@ -1,17 +1,59 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sdkVersion": "0.82.0",
3
+ "sdkVersion": "0.83.1",
4
4
  "environment": {
5
5
  "runtime": "Node.js for Node entrypoints; browser for browser-only entrypoints",
6
6
  "minimumVersion": "22.23.2 for Node entrypoints",
7
7
  "moduleSystem": "ESM"
8
8
  },
9
- "memberCount": 302,
9
+ "memberCount": 306,
10
10
  "runtimeSubpathPatterns": {
11
11
  "arcane-os/modules/*": "./runtime/arcane/modules/*",
12
12
  "arcane-os/entities/*": "./runtime/arcane/entities/*"
13
13
  },
14
14
  "members": [
15
+ {
16
+ "id": "core-model-observation:createModelObservationService",
17
+ "name": "createModelObservationService",
18
+ "displayName": "createModelObservationService()",
19
+ "kind": "function",
20
+ "signature": "createModelObservationService({runtime,localAI=null,image=null,decisions=null}={})",
21
+ "entrypoints": ["arcane-os/core/model-observation"],
22
+ "primaryImport": "arcane-os/core/model-observation",
23
+ "group": "Existing model observation",
24
+ "summary": "Observes an existing Core runtime and supplied actual native model service owners without creating or starting them.",
25
+ "availability": "Node with an existing Core runtime and optional existing native model services",
26
+ "protocol": "arcane/1 model.observation current, watch, renderer.attach and renderer.publish methods",
27
+ "normalization": "Returns name:model-observation, current(), dispose() and four methods. Complete current snapshots retain core, optional native localAI/image/decisions and request-owned renderer attachments. Missing owners are null; watch diagnostics defaults false and explicit true exposes complete live failed response frames for supplied native method keys without retained failure history. Actual clientRequestId identifies acknowledgements; coreRequestId keys renderer lifetime. Disposal cancels only observation requests/subscriptions, never models or the supplied runtime. No getService, readiness barrier, model creation, inference, polling or fabricated operation identities."
28
+ },
29
+ {
30
+ "id": "ai-model-observation:attachModelObservation",
31
+ "name": "attachModelObservation",
32
+ "displayName": "attachModelObservation()",
33
+ "kind": "function",
34
+ "signature": "attachModelObservation({client,aiRuntimeState=null,imageRuntime=null,decisionModel=null,modelController=null,signal,onError}={})",
35
+ "entrypoints": ["arcane-os/ai/model-observation"],
36
+ "primaryImport": "arcane-os/ai/model-observation",
37
+ "group": "Existing model observation",
38
+ "summary": "Attaches the application's existing renderer model owners through its existing Core client.",
39
+ "availability": "JavaScript with an existing Core client and optional existing renderer owners",
40
+ "protocol": "Request-owned model.observation.renderer attachment and complete snapshot publication",
41
+ "normalization": "Returns ready, closed, current() and close(). Ready acknowledges actual attachmentRequestId/coreRequestId; subscriptions publish complete current owner snapshots and reread after acknowledgement. Existing Core serialization encodes owner Error fields at the JSON boundary without changing other fields. Abort, page retirement, exact installed-client retirement, transport failure or explicit close retires only observation RPCs/subscriptions and leaves models/client owned by the caller. Normal cancellation closes cleanly; pre-acknowledgement cancellation rejects ready. Other failures reject public promises and reach onError or complete console diagnostics. No automatic reattachment, owner creation, model work or page-render barrier."
42
+ },
43
+ {
44
+ "id": "ai-model-observation:subscribeModelObservation",
45
+ "name": "subscribeModelObservation",
46
+ "displayName": "subscribeModelObservation()",
47
+ "kind": "function",
48
+ "signature": "subscribeModelObservation({client,signal,onState,onDiagnostic,onError}={})",
49
+ "entrypoints": ["arcane-os/ai/model-observation"],
50
+ "primaryImport": "arcane-os/ai/model-observation",
51
+ "group": "Existing model observation",
52
+ "summary": "Subscribes to complete existing model-owner snapshots and explicitly selected live Core diagnostics.",
53
+ "availability": "JavaScript with an existing Core client and composed observation service",
54
+ "protocol": "Request-owned model.observation.watch with targeted state and optional error events",
55
+ "normalization": "Requires onState; returns ready, closed, current() and close(). Ready resolves the first current snapshot; onDiagnostic explicitly selects diagnostics:true and receives complete correlated live failed Core response frames, without recovered history or inferred model IDs. Closing, abort, page/client retirement and transport failures retire only observation work. Normal cancellation closes cleanly; other errors reach onError and reject public promises. Callback errors close the observation while callback promises remain caller-owned. No model refresh, inference, polling, host launch, endpoint discovery, reconnect or saved conversation content."
56
+ },
15
57
  {
16
58
  "id": "core-app-control:connectAppControl",
17
59
  "name": "connectAppControl",
@@ -4374,7 +4416,7 @@
4374
4416
  "summary": "Creates an app-neutral Core dispatcher with explicit services, request lifetimes, events and graceful drain.",
4375
4417
  "availability": "Node on Windows, Linux and macOS native hosts; Android requires its host adaptation",
4376
4418
  "protocol": "arcane/1 dispatcher and service lifecycle",
4377
- "normalization": "Starts services independently; runtime.getService(name) and context.getService(name) return the same registered object after only its shared startup, without a renderer or global barrier. Lookup is readiness, not a lifetime lease; new lookups reject during shutdown. Preserves complete results/errors, cancels request-lifetime work and drains accepted service work; runtime.replay publishes current dispatcher/service state without restart and preserves reentrant lifecycle publication order. Missing dispatch retains METHOD_NOT_ALLOWED with exact method/namespace and core-namespace-unavailable or core-method-unavailable; named services, registered methods and built-in namespaces establish presence. Handler/startup/permission errors remain unchanged."
4419
+ "normalization": "Starts services independently; runtime.getService(name) and context.getService(name) return the same registered object after only its shared startup, without a renderer or global barrier. Lookup is readiness, not a lifetime lease; new lookups reject during shutdown. runtime.handle(frame,{contextRequestId,contextClientRequestId}) sets requestId=contextRequestId??frame.id, clientRequestId=contextClientRequestId??contextRequestId??frame.id and coreRequestId=frame.id; omitted metadata exposes all three equal. Transports always supply the actual client ID separately, preserving the owning shared-host internal requestId contract. Internal IDs continue to own cancellation/state/event envelopes and payloads remain unchanged. Preserves complete results/errors, cancels request-lifetime work and drains accepted service work; runtime.replay publishes current dispatcher/service state without restart and preserves reentrant lifecycle publication order. Missing dispatch retains METHOD_NOT_ALLOWED with exact method/namespace and core-namespace-unavailable or core-method-unavailable; named services, registered methods and built-in namespaces establish presence. Handler/startup/permission errors remain unchanged."
4378
4420
  },
4379
4421
  {
4380
4422
  "id": "core-stdio:encodeCoreFrame",
@@ -4416,7 +4458,7 @@
4416
4458
  "summary": "Attaches an existing Core runtime to framed input and output with concurrent dispatch and graceful shutdown.",
4417
4459
  "availability": "Node with readable input and writable output streams",
4418
4460
  "protocol": "Content-Length framed arcane/1 stdio",
4419
- "normalization": "Returns {runtime,closed,close}; preserves queued output order, reports parser and stream failures, drains accepted runtime work on EOF and never exits the host or ends caller-owned output"
4461
+ "normalization": "Returns {runtime,closed,close}; scopes responses/request events, cancellation and current-state replay to its connection, preserving original service-facing requestId/clientRequestId and complete payloads while coreRequestId identifies unique internal dispatch. Preserves queued output order, reports parser and stream failures, drains accepted runtime work on EOF and never exits the host or ends caller-owned output"
4420
4462
  },
4421
4463
  {
4422
4464
  "id": "native-portable-provider:createPortableNativeProvider",
@@ -4430,7 +4472,7 @@
4430
4472
  "summary": "Creates the SDK-owned provider that assembles one selected app and explicit services into a portable Core payload.",
4431
4473
  "availability": "Node; produces a portable payload rather than an executable host",
4432
4474
  "protocol": "arcane-native-builder/1 portable provider",
4433
- "normalization": "Preserves complete selected app and dependency releases; an explicit services selection overrides appDescriptor.native.services, otherwise the descriptor selection is used; optional appDescriptor.native.window carries positive integral logical client width/height and optional resizable into manifest.window with omitted fields preserved; reports executable:false and never substitutes for an unavailable platform host"
4475
+ "normalization": "Preserves complete selected app and dependency releases; an explicit services selection overrides appDescriptor.native.services, otherwise the descriptor selection is used; optional appDescriptor.native.window carries positive integral logical client width/height and optional resizable into manifest.window with omitted fields preserved. Generated coreListener opt-in composes one passive model-observation service from the existing host.runtime and actual services exposing localai.status/image.status/decisions.status before listener binding, with absent owners null and renderer attachment separate. Ordinary stdio and sharedHost/headless behavior remains unchanged; no model creation, getService or readiness barrier. Reports executable:false and never substitutes for an unavailable platform host"
4434
4476
  },
4435
4477
  {
4436
4478
  "id": "native-portable-provider:arcaneNativeBuilderProvider",
@@ -4598,7 +4640,7 @@
4598
4640
  "summary": "Resolves matching per-app native state, workspace and optional shared endpoint defaults for packaged UI and external MCP.",
4599
4641
  "availability": "Node native locations on Windows/Linux/macOS; Android and other hosts supply stateRoot and native adaptation",
4600
4642
  "protocol": "Pure native launch-context resolution and existing local IPC",
4601
- "normalization": "Returns a new complete context with only omitted stateRoot/workspaceRoot and selected sharedHost endpoint/log fields filled; preserves explicit values and additional payloads. Native launchContext presence opts generated entry into resolution; omitted sharedHost retains stdio. No I/O, saved-state discovery, process startup, migration or ArcaneData/Repos change. Malformed selected appId/stateRoot/sharedHost inputs report TypeError; platform IPC errors remain operation-owned."
4643
+ "normalization": "Returns a new complete context with only omitted stateRoot/workspaceRoot and selected sharedHost endpoint/log fields filled; preserves explicit values and additional payloads. Native launchContext presence opts generated entry into resolution; omitted sharedHost retains stdio. Optional coreListener:{endpoint} is preserved without endpoint defaults and attaches to that same window-owned runtime in the generated entry; selecting it together with sharedHost reports TypeError there. No I/O, saved-state discovery, process startup, migration or ArcaneData/Repos change. Malformed selected appId/stateRoot/sharedHost inputs report TypeError; platform IPC errors remain operation-owned."
4602
4644
  },
4603
4645
  {
4604
4646
  "id": "core-host:readCoreLaunchContext",
@@ -4628,6 +4670,20 @@
4628
4670
  "protocol": "arcane/1 over Content-Length framed stdio",
4629
4671
  "normalization": "Returns the existing {runtime,closed,close} transport owner; an optional abort signal invokes the same idempotent drain without killing the process, replacing service readiness or cancelling accepted service-lifetime work"
4630
4672
  },
4673
+ {
4674
+ "id": "core-host:startCoreListener",
4675
+ "name": "startCoreListener",
4676
+ "displayName": "startCoreListener()",
4677
+ "kind": "function",
4678
+ "signature": "startCoreListener({runtime,endpoint,onError}={})",
4679
+ "entrypoints": ["arcane-os/core/host"],
4680
+ "primaryImport": "arcane-os/core/host",
4681
+ "group": "Shared Core host",
4682
+ "summary": "Attaches local IPC to an existing window-owned Core runtime without changing its services or lifetime.",
4683
+ "availability": "Node named pipes on Windows and Unix-domain sockets on Linux/macOS; Android requires its host adaptation",
4684
+ "protocol": "arcane/1 over local IPC with per-connection correlation, cancellation and current-state replay",
4685
+ "normalization": "Returns {endpoint,closed,close}; never constructs, starts or closes the supplied runtime or registers services. Explicit close flushes queued output and disconnects its clients while accepted service work remains runtime-owned. Runtime shutdown retains the endpoint through service drain then closes the listener. Preserves parameters/results/event data, original handler requestId/clientRequestId and internal coreRequestId; no host shutdown RPC. Bind errors reject startup; transport errors reach onError and terminal errors reject closed. Native launchContext.coreListener:{endpoint} selects the existing stdio branch and its existing-instance observation composition; no sharedHost/headless selection or inferred endpoint."
4686
+ },
4631
4687
  {
4632
4688
  "id": "core-host:startSharedCoreHost",
4633
4689
  "name": "startSharedCoreHost",
@@ -4640,7 +4696,7 @@
4640
4696
  "summary": "Claims an app-selected local endpoint before composing one shared Core runtime.",
4641
4697
  "availability": "Node named pipes on Windows and Unix-domain sockets on Linux/macOS; Android requires its host adaptation",
4642
4698
  "protocol": "arcane/1 over local IPC with per-connection request correlation and current-state replay",
4643
- "normalization": "Returns {runtime,endpoint,closed,close}; configure(runtime,{signal}) registers independently started services after the endpoint claim. Close joins composition, accepted service work, disposal and queued frames before releasing the endpoint. Complete transport/startup/shutdown errors remain observable; an occupied endpoint never invokes the factory"
4699
+ "normalization": "Returns {runtime,endpoint,closed,close}; configure(runtime,{signal}) registers independently started services after the endpoint claim. Preserves internal handler requestId/coreRequestId and the existing matching data.requestId adapter mapping while additive clientRequestId exposes the actual client ID independently. Other payload fields remain unchanged. Close joins composition, accepted service work, disposal and queued frames before releasing the endpoint. Complete transport/startup/shutdown errors remain observable; an occupied endpoint never invokes the factory"
4644
4700
  },
4645
4701
  {
4646
4702
  "id": "core-host:connectSharedCoreHost",
@@ -4654,7 +4710,7 @@
4654
4710
  "summary": "Connects to one selected host and optionally starts an explicit headless entry when absent.",
4655
4711
  "availability": "Node local IPC and optional explicit child process with diagnostic file",
4656
4712
  "protocol": "arcane/1 Core client; optional Node startup IPC handshake",
4657
- "normalization": "Returns {client,endpoint,closed,close,shutdown}. Only ENOENT/ECONNREFUSED selects start {command,args,cwd,env,logFile}; no request retry. Close cancels this connection's request work while preserving the host and accepted service work. Explicit shutdown drains all clients' shared host; cancelling a launch wait does not kill the host"
4713
+ "normalization": "Returns {client,endpoint,closed,close,shutdown}. Only ENOENT/ECONNREFUSED selects start {command,args,cwd,env,logFile}; no request retry. Close cancels this connection's request work while preserving the host and accepted service work. Explicit shutdown drains an owning shared host for all clients; cancelling a launch wait does not kill the host. Connect to startCoreListener with start omitted; that borrowed listener implements no core.host.shutdown operation and its runtime owner retains shutdown."
4658
4714
  },
4659
4715
  {
4660
4716
  "id": "core-host:runSharedCoreHost",
@@ -0,0 +1,220 @@
1
+ # Existing model observation
2
+
3
+ Model observation reads the existing renderer and Core owners selected by the
4
+ application. It exposes their current lifecycle, progress, retained errors and
5
+ actual operation identities to an explicitly selected developer observer.
6
+ Model loading, inference, selection, cancellation and saved application state
7
+ remain with those owners. Observation creates no model, accessor or Core runtime.
8
+
9
+ ## Compose the existing Core
10
+
11
+ ```js
12
+ import {createModelObservationService} from 'arcane-os/core/model-observation';
13
+
14
+ const observation = createModelObservationService({
15
+ runtime: host.runtime,
16
+ localAI: existingLocalAIService,
17
+ image: existingImageService,
18
+ decisions: existingDecisionService
19
+ });
20
+ host.runtime.registerService(observation);
21
+ ```
22
+
23
+ `host` and the three services in this example are the application's existing
24
+ instances. `localAI`, `image` and `decisions` are optional and default to `null`.
25
+ Supply their actual service definitions, including `current()` and `methods`.
26
+ The constructor neither looks up nor starts a service. Registration can follow
27
+ `startCoreHost()` on its returned runtime, before opening an additional listener;
28
+ it requires no model readiness barrier.
29
+
30
+ The service is named `model-observation` and exposes `current()`, `dispose()` and
31
+ the fixed Core methods below. `dispose()` retires only its observation requests
32
+ and subscriptions. The host continues to own the Core and model services.
33
+
34
+ An external local caller can connect through the explicitly selected
35
+ [`startCoreListener`](core-shared-host.md) endpoint on that same runtime.
36
+ For a packaged window, `native.launchContext.coreListener: {endpoint}` selects
37
+ that same-runtime listener. Before binding it, the generated Core entry registers
38
+ `model-observation` with the actual existing `services` definitions that expose
39
+ `localai.status`, `image.status` and `decisions.status`; absent owners are `null`.
40
+ The observer reuses those model-service owners and creates no accessor or model.
41
+ The application supplies its renderer attachment separately.
42
+ The observation module does not discover endpoints, launch a host, reconnect,
43
+ change a profile, or create a second runtime. Native DOM inspection and actions
44
+ retain their separate [app-control contract](native-app-control.md).
45
+
46
+ ## Attach existing renderer owners
47
+
48
+ ```js
49
+ import * as aiRuntimeState from 'arcane-os/ai-runtime-state';
50
+ import {attachModelObservation} from 'arcane-os/ai/model-observation';
51
+
52
+ const attachment = attachModelObservation({
53
+ client: existingCoreClient,
54
+ aiRuntimeState,
55
+ imageRuntime: existingImageAccessor,
56
+ decisionModel: existingBrowserDecisionModel,
57
+ modelController: existingModelController,
58
+ signal: pageLifetime.signal,
59
+ onError: function reportObservationFailure(error) {
60
+ developerDiagnostics.report(error);
61
+ }
62
+ });
63
+ await attachment.ready;
64
+ ```
65
+
66
+ Each optional owner defaults to `null`. Pass the instances already used by the
67
+ application. Creating another image accessor would describe that new accessor's
68
+ requests rather than the existing work. The supported owner methods are:
69
+
70
+ | Input | Read | Subscribe |
71
+ |---|---|---|
72
+ | `aiRuntimeState` | `getAIRuntimeState()` | `subscribeAIRuntimeState()` |
73
+ | `imageRuntime` | `current()` | `subscribe()` |
74
+ | `decisionModel` | `status()` | `subscribe()` |
75
+ | `modelController` | `status()` | `on('statechange')`, `on('progress')` |
76
+
77
+ The attachment returns `{ready, closed, current, close}`. `ready` resolves with
78
+ `{attachmentRequestId, coreRequestId}` after Core acknowledges the attachment.
79
+ `current()` returns the latest complete renderer snapshot read by this
80
+ attachment, or `null` when it was cancelled before reading. Subscriptions begin
81
+ after acknowledgement; the attachment then reads and publishes current state
82
+ again to cover changes during that handshake.
83
+
84
+ Caller abort, `pagehide`, retirement of the exact installed Core client,
85
+ transport failure, or `close()` removes the observation subscriptions and
86
+ cancels only this attachment's observation RPCs. A supplied client remains
87
+ caller-owned. The attachment never follows a replacement client or automatically
88
+ reattaches. Native document retirement also cancels its long-lived Core request.
89
+ Core then removes the renderer record; late publication to that retired
90
+ attachment fails honestly. Detachment does not unload or cancel a model.
91
+
92
+ `close()` returns `closed`, which settles after the attachment's observation
93
+ RPC promises settle locally. It does not claim that a remote model or host has
94
+ closed. Transport and observation errors remain available through `onError`
95
+ and the rejected public promises. With `onError` omitted they reach the developer
96
+ console. Normal cancellation, including cancellation initiated by the existing
97
+ client or native document owner, closes observation without a model error. When
98
+ cancellation precedes acknowledgement, `ready` rejects with the cancellation
99
+ while `closed` resolves after the observation RPCs settle.
100
+
101
+ ## Read or subscribe from an existing client
102
+
103
+ ```js
104
+ import {subscribeModelObservation} from 'arcane-os/ai/model-observation';
105
+
106
+ const current = await client.invoke('model.observation.current', {}, {signal});
107
+ const observation = subscribeModelObservation({
108
+ client,
109
+ signal,
110
+ onState: function showRetainedOwners(snapshot) {
111
+ developerDiagnostics.show(snapshot);
112
+ },
113
+ onDiagnostic: function showModelFailure(record) {
114
+ developerDiagnostics.report(record);
115
+ },
116
+ onError: function showObservationFailure(error) {
117
+ developerDiagnostics.report(error);
118
+ }
119
+ });
120
+ await observation.ready;
121
+ ```
122
+
123
+ `onState` is required. The returned `{ready, closed, current, close}` has the same
124
+ observation-only lifecycle as the renderer attachment. `ready` resolves with
125
+ the first current-state replay; `current()` holds the latest complete snapshot,
126
+ initially `null`. `onDiagnostic` explicitly selects live correlated Core model
127
+ failure frames. Omitting it requests state observation only. Callback failures
128
+ close that observation and reach `onError`; callback promises remain
129
+ caller-owned and may await `close()` without becoming its completion barrier.
130
+
131
+ Every snapshot is:
132
+
133
+ ```js
134
+ {
135
+ core: existingCoreRuntime.current(),
136
+ native: {localAI, image, decisions},
137
+ renderers: [{attachmentRequestId, coreRequestId, owners: {
138
+ aiRuntimeState, imageRuntime, decisionModel, modelController
139
+ }}]
140
+ }
141
+ ```
142
+
143
+ The values represent complete supplied-owner snapshots. Absent optional owners
144
+ are `null`; absent renderer attachments produce an empty array. Core state also
145
+ contains its real active observation requests, identified by their actual
146
+ methods, alongside other active requests. Observation does not relabel them as
147
+ model work. Snapshots are current observations of independent owners, rather
148
+ than an atomic transaction across all owners.
149
+
150
+ ## Fixed transport and correlation
151
+
152
+ | Method/event | Contract |
153
+ |---|---|
154
+ | `model.observation.current` | Empty parameters; returns the current snapshot without model refresh or readiness waits. |
155
+ | `model.observation.watch` | `{diagnostics:false}` by default; remains pending until cancellation. |
156
+ | `model.observation.state` | Targeted watch event `{watchRequestId,snapshot}`; the first event acknowledges the watch and replays current state. |
157
+ | `model.observation.error` | Targeted diagnostic `{watchRequestId,source:'core',method,frame}` preserving the complete original failed response frame. |
158
+ | `model.observation.renderer.attach` | `{snapshot}`; remains pending to own the renderer publication lifetime. |
159
+ | `model.observation.renderer.attached` | Targeted acknowledgement `{attachmentRequestId,coreRequestId}`. |
160
+ | `model.observation.renderer.publish` | `{attachmentRequestId,coreRequestId,snapshot}`; replaces that attachment's current snapshot and returns both attachment identities. |
161
+
162
+ Both helpers register listeners before invoking. Existing
163
+ [`client.invoke`](core-client.md) supplies `onRequest({requestId})` before send;
164
+ long-lived observation requests use `timeoutMs:0`. Their acknowledgement is a
165
+ targeted request event, while the invocation promise remains pending.
166
+
167
+ `attachmentRequestId` and `watchRequestId` are the actual client-visible Core
168
+ request identities supplied by service context `clientRequestId`.
169
+ `coreRequestId` is the actual internal Core frame identity;
170
+ renderer attachments are keyed by that value so clients with identical local
171
+ request IDs cannot collide. The renderer echoes both values when publishing.
172
+ `snapshot.core.activeRequests[].id` and diagnostic `frame.id` use internal Core
173
+ identities. They can differ from client-visible IDs under connection routing.
174
+ None of these observation/transport IDs is a model-operation ID.
175
+
176
+ Core supplies both metadata fields for direct runtime calls, stdio connections,
177
+ `startCoreListener()` connections and the existing `startSharedCoreHost()` path.
178
+ Each connection preserves the original incoming request ID as `clientRequestId`
179
+ independently of its established `requestId` mapping. Direct calls use the
180
+ incoming frame ID for both identities. Observation requires these actual
181
+ context fields; it does not infer them from `requestId` or rewrite event
182
+ payloads to manufacture correlation.
183
+
184
+ The exact `methods` keys on the supplied native service definitions select the
185
+ Core operations whose live failures can be observed. The observer tracks their
186
+ actual active request IDs while a watch exists. Core publishes request removal
187
+ before emitting its response; the observer retains that correlation until the
188
+ response arrives, then removes it. Removing the final watcher releases frame
189
+ observation and remaining transient correlation. It retains no failure history.
190
+
191
+ ## Evidence and lifecycle limits
192
+
193
+ - AIRuntimeState exposes its existing llm/stt/tts records, including the reported
194
+ operation ID. Its retained errors contain only code/message. Concurrent role
195
+ work is not a complete request enumeration in this snapshot.
196
+ - The existing image accessor exposes its own active method, stream ID, status
197
+ and progress records. Its retained error is preserved; that error has no
198
+ reliable explicit stream association. Constructor-only diagnostic callbacks
199
+ cannot be retroactively attached through this API.
200
+ - Browser and native decision snapshots retain their existing errors and active
201
+ request counts. A count does not supply missing per-evaluation IDs.
202
+ - ModelController status exposes its existing state/progress and code/message
203
+ error. Its load/unload event IDs are not retained by `status()`, and are not
204
+ presented as inference IDs or reconstructed history here.
205
+ - Core supplies its real active request identities and complete live failed
206
+ response frames. A watch cannot recover responses that settled before it
207
+ observed them. Retained owner errors remain available in current snapshots.
208
+
209
+ Renderer `Error` values in owner error fields use the existing Core error
210
+ serializer at the JSON boundary; other owner fields remain unchanged. A value
211
+ the selected transport cannot encode fails through the observation error path
212
+ rather than being replaced with shortened or invented content. Observation
213
+ does not alter model inputs, outputs, prompts or their persistence policy.
214
+
215
+ The shared JavaScript contract is portable wherever the existing Core client
216
+ and supplied owners are available. Endpoint and native-host availability belong
217
+ to their documented adapters. Developer observation remains separate from
218
+ ordinary user status, app-owned stage/avatar association and actual model
219
+ execution verification. This capability does not establish that an inference
220
+ failure has been corrected.
@@ -55,6 +55,8 @@ runtime layouts.
55
55
  | `arcane-os/core/contracts` | Shared Core protocol, frame, method and diagnostic error contracts. |
56
56
  | `arcane-os/core/classic-source` | Node generator for the canonical classic-script Core client projection. |
57
57
  | `arcane-os/core/runtime` | App-neutral native Core dispatcher and service lifecycle. |
58
+ | `arcane-os/core/model-observation` | Passive observation of an existing Core and its actual native model service owners. |
59
+ | `arcane-os/ai/model-observation` | Attach existing renderer model owners and subscribe through an existing Core client. |
58
60
  | `arcane-os/core/development` | App-service composition and document-owned Core transport during source development, independently of local AI. |
59
61
  | `arcane-os/core/stdio` | Framed Node stdio transport with graceful runtime drain. |
60
62
  | `arcane-os/core/host` | Node-only reusable Core host lifecycle, app-selected native launch defaults and shared native location resolution. |
@@ -420,6 +422,9 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
420
422
  | `McpProtocolError` | class | `arcane-os/mcp/stdio` | MCP STDIO | Node |
421
423
  | `createCoreClassicSource()` | function | `arcane-os/core/classic-source` | Core classic client projection | Node; generated source runs in browser and native WebView renderers |
422
424
  | `createCoreRuntime()` | function | `arcane-os/core/runtime` | Native Core runtime | Node on Windows, Linux and macOS native hosts; Android requires host adaptation |
425
+ | `createModelObservationService()` | function | `arcane-os/core/model-observation` | Existing model observation | Node with an existing Core runtime and optional existing native model services |
426
+ | `attachModelObservation()` | function | `arcane-os/ai/model-observation` | Existing model observation | JavaScript with an existing Core client and optional existing renderer owners |
427
+ | `subscribeModelObservation()` | function | `arcane-os/ai/model-observation` | Existing model observation | JavaScript with an existing Core client and composed observation service |
423
428
  | `encodeCoreFrame()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
424
429
  | `createCoreFrameDecoder()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
425
430
  | `startCoreStdio()` | function | `arcane-os/core/stdio` | Native Core stdio transport | Node |
@@ -427,6 +432,7 @@ The remaining data-only subpaths are eight JSON Schemas and package metadata.
427
432
  | `arcaneNativeBuilderProvider` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
428
433
  | `arcaneNativeBuilderProvider default export` | singleton | `arcane-os/native/portable-provider` | Portable native provider | Node; produces a portable payload rather than an executable host |
429
434
  | `startCoreHost()` | function | `arcane-os/core/host` | Native Core host composition | Node with readable input and writable output streams |
435
+ | `startCoreListener()` | function | `arcane-os/core/host` | Shared Core host | Node local IPC attached to an existing runtime |
430
436
  | `startSharedCoreHost()` | function | `arcane-os/core/host` | Shared Core host | Node local IPC on Windows, Linux and macOS |
431
437
  | `connectSharedCoreHost()` | function | `arcane-os/core/host` | Shared Core host | Node local IPC and optional explicit headless startup |
432
438
  | `connectAppControl()` | function | `arcane-os/core/app-control` | Native application control | Node local IPC; current window adapter is Windows WebView2 |
@@ -7394,6 +7400,18 @@ Import it from `arcane-os/core/runtime`. The runtime exposes `current()`,
7394
7400
  `subscribe()`, `onFrame()`, `emit()`, `registerService()`, `getService()`, `start()`, `handle()`
7395
7401
  and idempotent `close()`.
7396
7402
 
7403
+ `runtime.handle(frame, {contextRequestId, contextClientRequestId})` accepts
7404
+ optional nonempty transport metadata strings. Handler `requestId` remains
7405
+ `contextRequestId ?? frame.id`; additive `clientRequestId` is
7406
+ `contextClientRequestId ?? contextRequestId ?? frame.id`; `coreRequestId` always
7407
+ exposes the actual internal `frame.id`. Direct `handle(frame)` exposes all three
7408
+ equal. Stdio and both IPC paths supply the actual client identity separately,
7409
+ preserving the owning shared-host adapter's established internal `requestId`.
7410
+ Active requests, cancellation, response IDs and request-event envelopes retain
7411
+ the internal ID. Parameters, results and event data stay unchanged; transports
7412
+ own client-facing protocol correlation. See
7413
+ [the runtime contract](core-runtime.md#state-and-frames).
7414
+
7397
7415
  `await runtime.getService(name)` and service `context.getService(name)` return
7398
7416
  the actual registered service after its shared startup. They wait for that
7399
7417
  dependency alone, may start it before `runtime.start()`, and add no renderer or
@@ -7551,6 +7569,13 @@ Import it from `arcane-os/core/stdio`. The result is
7551
7569
  `{runtime, closed, close}`. EOF or input close starts graceful shutdown;
7552
7570
  `closed` settles only after accepted runtime work and queued output settle.
7553
7571
 
7572
+ Responses, request events, cancellation controls and current-state replay are
7573
+ connection-scoped even when an additional IPC listener shares the runtime.
7574
+ Stdio preserves original handler `requestId` values while routing fresh internal
7575
+ IDs; uncorrelated service events remain shared. EOF retains its existing
7576
+ runtime-wide shutdown ownership. Additional clients attach through
7577
+ [`startCoreListener()`](#startcorelistener).
7578
+
7554
7579
  ### Availability and normalization
7555
7580
 
7556
7581
  **Node with readable input and writable output streams.** Parser, input, output
@@ -7572,6 +7597,80 @@ const transport = startCoreStdio({runtime});
7572
7597
  await transport.closed;
7573
7598
  ```
7574
7599
 
7600
+ ## createModelObservationService()
7601
+
7602
+ ```text
7603
+ createModelObservationService({runtime,localAI=null,image=null,decisions=null}={})
7604
+ ```
7605
+
7606
+ Import from `arcane-os/core/model-observation`. Supply the existing Core runtime
7607
+ and actual native service definitions, including their `current()` and `methods`.
7608
+ Returns `{name:'model-observation',current,dispose,methods}`. Register it on that
7609
+ runtime after ordinary host creation and before opening an additional listener.
7610
+ Construction starts no service, model, worker or readiness wait.
7611
+
7612
+ The four methods are `model.observation.current`, `model.observation.watch`,
7613
+ `model.observation.renderer.attach` and `model.observation.renderer.publish`.
7614
+ `current()` returns `{core,native:{localAI,image,decisions},renderers}` from the
7615
+ supplied owners. Absent model owners are `null`; absent attachments produce `[]`.
7616
+ The watch replays current state and remains pending until cancellation. Its
7617
+ `diagnostics:false` default excludes live failure frames; explicit `true`
7618
+ observes complete failed Core responses for the supplied owners' method keys.
7619
+ It retains no failure history and invents no model-operation identities.
7620
+
7621
+ Renderer attachment and watch acknowledgements use actual `clientRequestId`;
7622
+ attachments are keyed by the actual `coreRequestId` to distinguish clients with
7623
+ equal local IDs. `dispose()` retires observation requests/subscriptions only.
7624
+ Core still owns model services and shutdown. See
7625
+ [complete methods, events and evidence limits](model-observation.md).
7626
+
7627
+ ## attachModelObservation()
7628
+
7629
+ ```text
7630
+ attachModelObservation({client,aiRuntimeState=null,imageRuntime=null,decisionModel=null,modelController=null,signal,onError}={})
7631
+ ```
7632
+
7633
+ Import from `arcane-os/ai/model-observation`. Pass the existing Core client and
7634
+ the application-owned instances already doing the work. Supported owner methods
7635
+ are AIRuntimeState's `getAIRuntimeState/subscribeAIRuntimeState`, image runtime's
7636
+ `current/subscribe`, decision model's `status/subscribe`, and ModelController's
7637
+ `status/on`. It creates no replacement owner or transport.
7638
+
7639
+ Returns `{ready,closed,current,close}`. `ready` resolves with the Core-supplied
7640
+ `{attachmentRequestId,coreRequestId}` acknowledgement. Subscriptions then publish
7641
+ complete current owner snapshots, including a fresh read after acknowledgement.
7642
+ `current()` returns the latest renderer snapshot, initially `null`. The existing
7643
+ Core error serializer represents owner `Error` fields at the JSON boundary;
7644
+ other fields remain unchanged.
7645
+
7646
+ Caller abort, page retirement, retirement of the exact installed client,
7647
+ transport failure or `close()` retires only observation RPCs/subscriptions.
7648
+ `close()` returns `closed`; it never closes the supplied client or unloads models.
7649
+ Normal cancellation closes cleanly; cancellation before acknowledgement rejects
7650
+ `ready`. Other errors reject public promises and reach `onError`, defaulting to
7651
+ complete console diagnostics. A replacement client requires a new explicit
7652
+ attachment. Keep attachment readiness independent of page rendering. See
7653
+ [renderer ownership and lifecycle](model-observation.md#attach-existing-renderer-owners).
7654
+
7655
+ ## subscribeModelObservation()
7656
+
7657
+ ```text
7658
+ subscribeModelObservation({client,signal,onState,onDiagnostic,onError}={})
7659
+ ```
7660
+
7661
+ Import from `arcane-os/ai/model-observation`. Requires an existing client and
7662
+ `onState`; returns `{ready,closed,current,close}`. `ready` resolves with the first
7663
+ current-state snapshot and `current()` retains the latest snapshot, initially
7664
+ `null`. Providing `onDiagnostic` explicitly selects live complete correlated Core
7665
+ model failure frames; omission selects state only. These are developer
7666
+ diagnostics, not ordinary user status or saved conversation content.
7667
+
7668
+ The observer uses the same observation-only cancellation/error lifecycle as
7669
+ the attachment. Callback failures retire it and reach `onError`; callback
7670
+ promises may await `close()` without becoming its completion barrier. It starts
7671
+ no model, refresh, polling, endpoint discovery, host or reconnect. See
7672
+ [observation records and limits](model-observation.md#read-or-subscribe-from-an-existing-client).
7673
+
7575
7674
  ## createPortableNativeProvider()
7576
7675
 
7577
7676
  ### Overview
@@ -7605,6 +7704,13 @@ published SDK/runtime dependencies and the canonical Core entry/client into a
7605
7704
  fresh output directory. Service factories are imported only when a real native
7606
7705
  host later launches the generated Core entry, never during packaging.
7607
7706
 
7707
+ Explicit `native.launchContext.coreListener:{endpoint}` also composes one passive
7708
+ model observation service after `startCoreHost()` and before listener binding,
7709
+ using that runtime and existing services exposing `localai.status`, `image.status`
7710
+ and `decisions.status`. Missing owners remain `null`; renderer attachment stays
7711
+ application-owned. Ordinary stdio and shared/headless branches gain no model
7712
+ startup or readiness barrier. See [native observation composition](core-native-packaging.md#launch-time-locations).
7713
+
7608
7714
  An optional `appDescriptor.native.window` record carries `width`, `height` and
7609
7715
  `resizable` into `manifest.window`. Dimensions are positive integral logical
7610
7716
  client units; `resizable` is an optional boolean. Omitted fields remain omitted.
@@ -7995,6 +8101,14 @@ the caller's working-directory meaning. `appId` and the selected state path
7995
8101
  must be nonempty strings; a selected `sharedHost` must be an object. Malformed
7996
8102
  inputs report `TypeError`; native endpoint failures belong to the IPC operation.
7997
8103
 
8104
+ `native.launchContext.coreListener:{endpoint}` instead attaches local IPC to
8105
+ the existing window/stdio runtime. Its endpoint remains explicit and receives
8106
+ no default. The generated entry rejects simultaneous `coreListener` and
8107
+ `sharedHost` selections. Client disconnect affects that connection; window
8108
+ shutdown still drains Core and closes the additional listener. See
8109
+ [`startCoreListener()`](#startcorelistener) and
8110
+ [native launch locations](core-native-packaging.md#launch-time-locations).
8111
+
7998
8112
  ```javascript
7999
8113
  import {resolveNativeLaunchContext} from 'arcane-os/core/host';
8000
8114
 
@@ -8793,6 +8907,62 @@ async function bundleMoonCheeseRuntime(outputRoot){
8793
8907
  The ordinary provider invokes this owner only for an explicit native local-AI
8794
8908
  selection. See [selected local-AI runtimes](core-native-packaging.md#selected-local-ai-runtimes).
8795
8909
 
8910
+ ## startCoreListener()
8911
+
8912
+ ### Overview and signature
8913
+
8914
+ Attaches a local IPC listener to an existing Core runtime, without creating,
8915
+ starting or taking ownership of that runtime or its services.
8916
+
8917
+ ```text
8918
+ startCoreListener({runtime,endpoint,onError}={})
8919
+ ```
8920
+
8921
+ Import from `arcane-os/core/host`. Resolves `{endpoint,closed,close}` after the
8922
+ selected endpoint binds. `close()` is idempotent, cancels the listener's
8923
+ request-lifetime work, flushes queued output and closes its connections. It
8924
+ does not call `runtime.close()` or wait for accepted service-lifetime work;
8925
+ that work remains tracked by the existing runtime. Runtime shutdown rejects
8926
+ new listener requests, retains the endpoint through service drain/disposal,
8927
+ and closes the listener automatically. Observe both owners' `closed` promises.
8928
+ Bind errors reject startup without closing the supplied runtime. Transport
8929
+ errors reach `onError`, with complete console diagnostics by default; terminal
8930
+ listener errors reject `closed`. Attaching to a draining/closed runtime reports
8931
+ `CORE_CLOSING`.
8932
+
8933
+ Node supports named pipes on Windows and Unix-domain sockets on Linux/macOS;
8934
+ Android requires its host adaptation. Supply a nonempty endpoint and an existing
8935
+ parent directory where required. Connect with `connectSharedCoreHost({endpoint})`
8936
+ and omit `start`. Its current-runtime replay does not replay requests. The
8937
+ borrowed listener implements no `core.host.shutdown` operation; use client
8938
+ `close()` for disconnection and the existing runtime's owner for host shutdown.
8939
+
8940
+ Each connection owns response/event correlation and request cancellation.
8941
+ Handler `requestId` and `clientRequestId` preserve the client ID; `coreRequestId` is the distinct
8942
+ internal dispatch ID. Parameters, results and event data, including
8943
+ `data.requestId`, remain unchanged. Runtime-state snapshots retain internal
8944
+ active IDs; no service event is invented or retained for later replay.
8945
+
8946
+ ```js
8947
+ import {startCoreListener} from 'arcane-os/core/host';
8948
+
8949
+ const listener = await startCoreListener({runtime: host.runtime, endpoint: selectedEndpoint});
8950
+ try {
8951
+ await host.closed;
8952
+ } finally {
8953
+ await listener.close();
8954
+ }
8955
+ ```
8956
+
8957
+ `host` is the application's existing stdio host. Generated native entries
8958
+ select this attachment with `native.launchContext.coreListener:{endpoint}`,
8959
+ preserving their actual runtime, service set, profile, origin and state root.
8960
+ That generated opt-in registers the passive observation service from existing
8961
+ native model owners before binding; direct `startCoreListener()` itself never
8962
+ registers services. Renderer owners are attached separately by the application.
8963
+ Omit `sharedHost`; the two options describe alternative lifetimes. Full
8964
+ contract: [existing-runtime listener](core-shared-host.md#attach-to-an-existing-window-owned-core).
8965
+
8796
8966
  ## startSharedCoreHost()
8797
8967
 
8798
8968
  ### Overview
@@ -8817,6 +8987,11 @@ service-owned. The supplied signal begins the same shutdown. `closed` rejects
8817
8987
  on shutdown failure; `onError` observes transport/background failures, with
8818
8988
  complete console diagnostics by default.
8819
8989
 
8990
+ The owning adapter preserves its existing internal handler `requestId`, equal
8991
+ to `coreRequestId`, and its matching `data.requestId` compatibility mapping.
8992
+ Additive `clientRequestId` exposes the original client ID independently; other
8993
+ parameters, results and event data remain unchanged.
8994
+
8820
8995
  ### Availability and example
8821
8996
 
8822
8997
  Node supports app-selected named pipes on Windows and Unix-domain sockets on
@@ -8871,6 +9046,12 @@ not kill a host another client may use. No startup timeout is imposed; supply
8871
9046
  before disconnecting. It affects every client; cancellation after acceptance
8872
9047
  does not reverse it. A drain failure returns the full Core error.
8873
9048
 
9049
+ The same connector can attach to `startCoreListener()` with `start` omitted.
9050
+ There, `close()` still disconnects only this client, and `shutdown()` has no
9051
+ listener-owned operation: absent an application method of that name, the
9052
+ ordinary dispatcher returns `METHOD_NOT_ALLOWED`. The existing window/runtime
9053
+ owner remains responsible for shutdown.
9054
+
8874
9055
  ```js
8875
9056
  import {connectSharedCoreHost} from 'arcane-os/core/host';
8876
9057
 
@@ -8967,9 +9148,10 @@ stdio-owned Core lifetime. See [native shared-host launch](core-shared-host.md#n
8967
9148
 
8968
9149
  ## startCoreHost()
8969
9150
 
8970
- For independent UI and MCP processes sharing one application runtime, use the
8971
- [shared host functions](#startsharedcorehost) above. Ordinary `startCoreHost()`
8972
- retains its existing stdio-owned lifetime.
9151
+ For an external client of the actual window-owned runtime, attach
9152
+ [`startCoreListener()`](#startcorelistener) to `host.runtime`. For an explicitly
9153
+ independent headless lifetime, use the [shared host functions](#startsharedcorehost).
9154
+ Ordinary `startCoreHost()` retains its existing stdio-owned lifetime.
8973
9155
 
8974
9156
  ### Overview
8975
9157