arcane-os 0.5.9 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +117 -26
  3. package/browser-runtime/ai/browser-speech-providers.mjs +1 -1
  4. package/browser-runtime/ai/browser-wasm-llm-provider.mjs +63 -39
  5. package/docs/architecture.md +303 -0
  6. package/docs/compatibility.md +38 -0
  7. package/docs/event-manager.md +263 -0
  8. package/docs/platform-targets.md +104 -0
  9. package/docs/publishing.md +126 -0
  10. package/docs/reference/README.md +206 -0
  11. package/docs/reference/ai/browser-speech.md +813 -0
  12. package/docs/reference/ai/browser-wasm.md +637 -0
  13. package/docs/reference/ai/twin-cloud.md +156 -0
  14. package/docs/reference/arcane-ollama.md +288 -0
  15. package/docs/reference/availability-and-normalization.md +224 -0
  16. package/docs/reference/behavioral-testing.md +129 -0
  17. package/docs/reference/cli.md +820 -0
  18. package/docs/reference/core/README.md +61 -0
  19. package/docs/reference/core/arcane-ai-contracts.md +907 -0
  20. package/docs/reference/core/arcane-api.md +601 -0
  21. package/docs/reference/core/arcane-entities.md +59 -0
  22. package/docs/reference/core/arcane-events.md +134 -0
  23. package/docs/reference/core/ollama-module.md +181 -0
  24. package/docs/reference/core/reference/arcane-api/ai-and-ollama.md +1909 -0
  25. package/docs/reference/core/reference/arcane-api/applications-terminal-capabilities.md +1057 -0
  26. package/docs/reference/core/reference/arcane-api/core-and-events.md +320 -0
  27. package/docs/reference/core/reference/arcane-api/filesystem-storage-preferences-appearance.md +610 -0
  28. package/docs/reference/core/reference/arcane-api/namespaces.md +1157 -0
  29. package/docs/reference/core/reference/arcane-api/platform-installation-users-system.md +1423 -0
  30. package/docs/reference/core/reference/arcane-api/session-provisioning-diagnostics-development.md +315 -0
  31. package/docs/reference/event-manager.md +1409 -0
  32. package/docs/reference/inventory/package-api.json +3194 -0
  33. package/docs/reference/inventory/runtime-components.json +1015 -0
  34. package/docs/reference/inventory/runtime-entities.json +25 -0
  35. package/docs/reference/inventory/runtime-modules.json +1367 -0
  36. package/docs/reference/mail.md +309 -0
  37. package/docs/reference/protocols.md +749 -0
  38. package/docs/reference/runtime-components.md +1529 -0
  39. package/docs/reference/runtime-entities.md +305 -0
  40. package/docs/reference/runtime-modules.md +3275 -0
  41. package/docs/reference/sdk-api.md +6733 -0
  42. package/docs/roadmap.md +79 -0
  43. package/docs/work-amplification.md +66 -0
  44. package/examples/wasm-ai-demo/README.md +80 -0
  45. package/examples/wasm-ai-demo/app.js +787 -0
  46. package/examples/wasm-ai-demo/index.html +343 -0
  47. package/examples/wasm-ai-demo/profile-tools.js +217 -0
  48. package/examples/wasm-ai-demo/profiles/BOSS.Modelfile +106 -0
  49. package/examples/wasm-ai-demo/profiles/PreCrisis.Modelfile +693 -0
  50. package/examples/wasm-ai-demo/rag/boss-library.json +3006 -0
  51. package/examples/wasm-ai-demo/rag.js +295 -0
  52. package/examples/wasm-ai-demo/server.mjs +71 -0
  53. package/package.json +11 -2
  54. package/runtime/arcane/modules/AI.js +1 -1
  55. package/runtime/arcane/modules/AIProviderRuntime.js +26 -5
@@ -0,0 +1,305 @@
1
+ # Arcane runtime entity modules
2
+
3
+ The synchronized runtime ships 14 entity modules with 29 public ESM bindings.
4
+ This page explains each module's capability and host assumptions. The exact
5
+ constructor/function/value contracts are canonical in the
6
+ [Arcane shared entity inventory](core/arcane-entities.md).
7
+
8
+ Entity creation and serialization are usually cross-host. Methods that touch
9
+ DOM, DBOPFS, local storage, AI, or object URLs require the corresponding browser
10
+ or native-WebView dependency.
11
+
12
+ ## Canonical inventory
13
+
14
+ | Module | Exports | Capability | Availability / normalization |
15
+ | --- | --- | --- | --- |
16
+ | `ApiModelRecord.js` | `default` | Frozen HTTP(S) model response snapshot. | Cross-host; normalized. |
17
+ | `Calculation.js` | `default` | Frozen bounded expression and finite result. | Cross-host; normalized. |
18
+ | `Chat.js` | `default` | Conversation messages, tool exchanges, memories, and optional persistence. | Browser/native WebView; AI/DBOPFS behavior mixed. |
19
+ | `CommunicationMessage.js` | `default`, `communicationChannels` | Frozen provider-neutral message. | Cross-host; normalized. |
20
+ | `CommunicationThread.js` | `default` | Frozen provider-neutral thread containing normalized messages. | Cross-host; normalized. |
21
+ | `Document.js` | `default` | File entity specialization for the `documents` table. | Browser/native WebView; DBOPFS behavior mixed. |
22
+ | `File.js` | `default` | MIME-aware file open/save and DBOPFS persistence. | Browser/native WebView; mixed storage/rendering errors. |
23
+ | `Image.js` | `default` | Image validation, upload, persistence, data URL, Blob URL, and revocation. | Browser/native WebView; mixed File/Blob/DBOPFS errors. |
24
+ | `IntentEnvelope.js` | six named exports | Immutable canonical intent record, serialization, rehydration, and privacy-safe audit projection. | Cross-host; strict normalized coded errors. |
25
+ | `Preference.js` | `default`, `preferenceSchema` | Boolean, number, select, and text preference definitions. | Cross-host; normalized. |
26
+ | `TerminalSession.js` | `default`, `terminalShells` | Frozen terminal session identity, shell, and state. | Cross-host; normalized. |
27
+ | `Theme.js` | five exports | Semantic theme tokens, conversion, serialization, and DOM application. | Values cross-host; apply/clear need DOM; normalized/mixed. |
28
+ | `User.js` | `default` | User preferences/profile state with DBLS/DBOPFS lifecycle. | Browser/native WebView; storage behavior mixed. |
29
+ | `Weather.js` | four classes | Frozen location, observation, day, and snapshot weather entities. | Cross-host; normalized. |
30
+
31
+ ## ApiModelRecord.js
32
+
33
+ ### Overview
34
+
35
+ `ApiModelRecord` freezes an endpoint, fetch time, metadata, and parsed value so
36
+ provider reads can be cached or emitted without leaking mutable response state.
37
+
38
+ ### Example
39
+
40
+ ```javascript
41
+ import ApiModelRecord from '/arcane/entities/ApiModelRecord.js';
42
+
43
+ const record = new ApiModelRecord({
44
+ endpoint: 'https://example.invalid/model',
45
+ fetchedAt: new Date().toISOString(),
46
+ metadata: {},
47
+ value: {ready: true}
48
+ });
49
+ ```
50
+
51
+ ## Calculation.js
52
+
53
+ ### Overview
54
+
55
+ `Calculation` owns a bounded expression, finite result, creation time, and
56
+ `toJSON()` projection. Use `CalculatorEngine` to produce validated instances.
57
+
58
+ ### Example
59
+
60
+ ```javascript
61
+ import Calculation from '/arcane/entities/Calculation.js';
62
+
63
+ console.log(new Calculation({expression: '2 + 2', result: 4}).toJSON());
64
+ ```
65
+
66
+ ## Chat.js
67
+
68
+ ### Overview
69
+
70
+ `ChatEntity` owns message history, saved state, tool exchanges, memory lookup,
71
+ and optional app-scoped DBOPFS persistence. It installs no independent native
72
+ authority; AI and storage dependencies must be available to the host.
73
+
74
+ `messages` returns provider-facing recurring context. An unresolved structural
75
+ call and its matching results remain raw only through their one active provider
76
+ continuation. Once that continuation settles, `messages` replaces the protocol
77
+ with complete ordinary visible call, public result, and assistant content.
78
+ `transcript` returns the narrow human-readable projection owned by the durable
79
+ storage boundary. User and assistant records contain only role, complete
80
+ visible content, and their real timestamp. A visible tool record may
81
+ additionally carry its public name and plain result status, while its `content`
82
+ comes only from the tool call's required user-facing `message`. System prompts,
83
+ reasoning, provider-extension fields, memory flags, raw tool calls, call IDs,
84
+ argument objects, and raw tool returns never enter new DBOPFS writes.
85
+ Messages added with `persist:false` participate only in their current operation;
86
+ they are not retained in `messages`, `transcript`, memory extraction, or DBOPFS.
87
+ One complete nonblank assistant record is also a durable conversation entry, so
88
+ a model-authored opening can be stored and survive maintenance before the first
89
+ ordinary user turn. No synthetic user record is required or written.
90
+
91
+ An assistant record may open an ordered array of structural calls with unique
92
+ IDs in transient provider state. Until every pending ID receives exactly one
93
+ matching nonblank `role:'tool'` result in the same active session, another
94
+ user/provider turn is rejected. The durable transcript keeps only each call's
95
+ user-facing message and any normalized tool name or result status. Existing
96
+ stored files are not rewritten on load. Persistence failures roll
97
+ back the complete turn rather than leaving provider and stored history
98
+ divergent.
99
+
100
+ ### Example
101
+
102
+ ```javascript
103
+ import Chat from '/arcane/entities/Chat.js';
104
+
105
+ const chat = new Chat();
106
+ chat.addUserMessage('Hello.');
107
+ ```
108
+
109
+ ## CommunicationMessage.js
110
+
111
+ ### Overview
112
+
113
+ Normalizes one provider message and exports the supported channel values:
114
+ email, SMS, MMS, RCS, WhatsApp, and other.
115
+
116
+ ### Example
117
+
118
+ ```javascript
119
+ import CommunicationMessage from '/arcane/entities/CommunicationMessage.js';
120
+
121
+ const message = new CommunicationMessage({
122
+ id: 'message-1',
123
+ channel: 'email',
124
+ body: 'Hello'
125
+ });
126
+ ```
127
+
128
+ ## CommunicationThread.js
129
+
130
+ ### Overview
131
+
132
+ Normalizes one conversation thread and its `CommunicationMessage` records into
133
+ a frozen provider-neutral object.
134
+
135
+ ### Example
136
+
137
+ ```javascript
138
+ import CommunicationThread from '/arcane/entities/CommunicationThread.js';
139
+
140
+ const thread = new CommunicationThread({id: 'thread-1', messages: []});
141
+ ```
142
+
143
+ ## Document.js
144
+
145
+ ### Overview
146
+
147
+ `DocumentEntity` specializes `FileEntity` for the app-scoped `documents` table.
148
+ Its persistence methods require the same DBOPFS lifecycle and ownership proof as
149
+ the base file entity.
150
+
151
+ ### Example
152
+
153
+ ```javascript
154
+ import DocumentEntity from '/arcane/entities/Document.js';
155
+
156
+ const document = new DocumentEntity();
157
+ console.log(document.tableName);
158
+ ```
159
+
160
+ ## File.js
161
+
162
+ ### Overview
163
+
164
+ `FileEntity` loads and saves supported file formats through app-scoped DBOPFS
165
+ and uses the shared Markdown renderer where appropriate.
166
+
167
+ ### Example
168
+
169
+ ```javascript
170
+ import FileEntity from '/arcane/entities/File.js';
171
+
172
+ const file = new FileEntity();
173
+ console.log(file.fileName);
174
+ ```
175
+
176
+ ## Image.js
177
+
178
+ ### Overview
179
+
180
+ `ImageEntity` extends `FileEntity` with image validation, upload, base64 data
181
+ URLs, Blob URLs, and explicit Blob URL revocation.
182
+
183
+ ### Example
184
+
185
+ ```javascript
186
+ import ImageEntity from '/arcane/entities/Image.js';
187
+
188
+ console.log(typeof ImageEntity.prototype.revokeBlobURL);
189
+ ```
190
+
191
+ ## IntentEnvelope.js
192
+
193
+ ### Overview
194
+
195
+ Creates immutable canonical v1 intent records while keeping trusted provenance
196
+ separate from hostile payload input. Serialization, rehydration, and the audit
197
+ projection are bounded and deterministic.
198
+
199
+ ### Example
200
+
201
+ ```javascript
202
+ import {
203
+ createIntentEnvelope,
204
+ serializeIntentEnvelope
205
+ } from '/arcane/entities/IntentEnvelope.js';
206
+
207
+ const intent = createIntentEnvelope(
208
+ {originalExpression: 'Summarize the record.', normalizedGoal: 'summarize'},
209
+ {source: 'example'}
210
+ );
211
+
212
+ console.log(serializeIntentEnvelope(intent));
213
+ ```
214
+
215
+ ## Preference.js
216
+
217
+ ### Overview
218
+
219
+ Defines preference types, option normalization, value validation, JSON
220
+ projection, and schema normalization for shared stores and forms.
221
+
222
+ ### Example
223
+
224
+ ```javascript
225
+ import Preference from '/arcane/entities/Preference.js';
226
+
227
+ const preference = new Preference({
228
+ key: 'density',
229
+ type: 'select',
230
+ defaultValue: 'comfortable',
231
+ options: ['comfortable', 'compact']
232
+ });
233
+ ```
234
+
235
+ ## TerminalSession.js
236
+
237
+ ### Overview
238
+
239
+ Normalizes terminal session id, shell, state, updates, and JSON projection. The
240
+ entity does not start a process; `TerminalClient` owns the native bridge call.
241
+
242
+ ### Example
243
+
244
+ ```javascript
245
+ import TerminalSession from '/arcane/entities/TerminalSession.js';
246
+
247
+ console.log(TerminalSession.shell('auto'));
248
+ ```
249
+
250
+ ## Theme.js
251
+
252
+ ### Overview
253
+
254
+ Owns the shared light/dark semantic token sets, color conversion, JSON
255
+ projection, DOM application, and clearing. Token work is cross-host; `apply()`
256
+ and `clear()` require a document root.
257
+
258
+ ### Example
259
+
260
+ ```javascript
261
+ import Theme, {arcaneDarkThemeTokens} from '/arcane/entities/Theme.js';
262
+
263
+ const theme = new Theme({name: 'example', tokens: arcaneDarkThemeTokens});
264
+ console.log(theme.toJSON());
265
+ ```
266
+
267
+ ## User.js
268
+
269
+ ### Overview
270
+
271
+ Owns persisted user preference/profile fields, explicit-preference updates,
272
+ fresh reads, saves, and JSON projection. It installs `window.user` after its
273
+ DBLS/DBOPFS lifecycle and emits `user-entity-loaded`.
274
+
275
+ ### Example
276
+
277
+ ```javascript
278
+ import UserEntity from '/arcane/entities/User.js';
279
+
280
+ console.log(typeof UserEntity.prototype.toJSON);
281
+ ```
282
+
283
+ ## Weather.js
284
+
285
+ ### Overview
286
+
287
+ Exports four frozen normalized records: `WeatherLocation`,
288
+ `WeatherObservation`, `WeatherDay`, and `WeatherSnapshot`.
289
+
290
+ ### Example
291
+
292
+ ```javascript
293
+ import {WeatherLocation} from '/arcane/entities/Weather.js';
294
+
295
+ const location = new WeatherLocation({name: 'Houston'});
296
+ console.log(location.toJSON());
297
+ ```
298
+
299
+ ## Availability and protocol details
300
+
301
+ Entity modules are delivered by browser ESM at `/arcane/entities/`. They do not
302
+ cross Core by being imported. Individual persistence, AI, DOM, or native calls
303
+ cross the dependency named by that entity. See
304
+ [availability and normalization](availability-and-normalization.md) and the
305
+ [deep protocol guide](protocols.md).