arcane-os 0.1.0-dev.5
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 +154 -0
- package/COMMERCIAL-LICENSE.md +13 -0
- package/LICENSE +661 -0
- package/NOTICE +70 -0
- package/README.md +448 -0
- package/bin/arcane-test.mjs +741 -0
- package/bin/arcane.mjs +5 -0
- package/docs/architecture.md +234 -0
- package/docs/compatibility.md +36 -0
- package/docs/event-manager.md +166 -0
- package/docs/platform-targets.md +108 -0
- package/docs/publishing.md +203 -0
- package/docs/reference/README.md +117 -0
- package/docs/reference/arcane-ollama.md +288 -0
- package/docs/reference/availability-and-normalization.md +123 -0
- package/docs/reference/behavioral-testing.md +86 -0
- package/docs/reference/cli.md +569 -0
- package/docs/reference/core/README.md +62 -0
- package/docs/reference/core/arcane-ai-contracts.md +873 -0
- package/docs/reference/core/arcane-api.md +601 -0
- package/docs/reference/core/arcane-entities.md +65 -0
- package/docs/reference/core/arcane-events.md +134 -0
- package/docs/reference/core/ollama-module.md +181 -0
- package/docs/reference/core/reference/arcane-api/ai-and-ollama.md +1909 -0
- package/docs/reference/core/reference/arcane-api/applications-terminal-capabilities.md +1057 -0
- package/docs/reference/core/reference/arcane-api/core-and-events.md +320 -0
- package/docs/reference/core/reference/arcane-api/filesystem-storage-preferences-appearance.md +610 -0
- package/docs/reference/core/reference/arcane-api/namespaces.md +1157 -0
- package/docs/reference/core/reference/arcane-api/platform-installation-users-system.md +1423 -0
- package/docs/reference/core/reference/arcane-api/session-provisioning-diagnostics-development.md +315 -0
- package/docs/reference/event-manager.md +957 -0
- package/docs/reference/inventory/package-api.json +2632 -0
- package/docs/reference/inventory/runtime-components.json +934 -0
- package/docs/reference/inventory/runtime-entities.json +26 -0
- package/docs/reference/inventory/runtime-modules.json +1249 -0
- package/docs/reference/protocols.md +242 -0
- package/docs/reference/runtime-components.md +1098 -0
- package/docs/reference/runtime-entities.md +303 -0
- package/docs/reference/runtime-modules.md +2010 -0
- package/docs/reference/sdk-api.md +4901 -0
- package/docs/roadmap.md +79 -0
- package/docs/work-amplification.md +124 -0
- package/node_modules/event-pubsub/CHANGELOG.md +55 -0
- package/node_modules/event-pubsub/MIGRATION.md +70 -0
- package/node_modules/event-pubsub/README.md +363 -0
- package/node_modules/event-pubsub/SECURITY.md +37 -0
- package/node_modules/event-pubsub/index.js +141 -0
- package/node_modules/event-pubsub/licence +21 -0
- package/node_modules/event-pubsub/package.json +59 -0
- package/node_modules/strong-type/README.md +408 -0
- package/node_modules/strong-type/assets/strong-type-header.png +0 -0
- package/node_modules/strong-type/index.js +1151 -0
- package/node_modules/strong-type/licence +21 -0
- package/node_modules/strong-type/node.js +125 -0
- package/node_modules/strong-type/package.json +61 -0
- package/package.json +95 -0
- package/runtime/ARCANE_RUNTIME_RELEASE.json +791 -0
- package/runtime/arcane/components/app-bar.html +468 -0
- package/runtime/arcane/components/assistant-panel.html +715 -0
- package/runtime/arcane/components/calculator.html +8 -0
- package/runtime/arcane/components/chart.html +655 -0
- package/runtime/arcane/components/chat.html +1225 -0
- package/runtime/arcane/components/conversation-view.html +13 -0
- package/runtime/arcane/components/dashboard-config.html +341 -0
- package/runtime/arcane/components/data-maintenance.html +112 -0
- package/runtime/arcane/components/data-view.html +92 -0
- package/runtime/arcane/components/directory-picker.html +197 -0
- package/runtime/arcane/components/document-inspector.html +252 -0
- package/runtime/arcane/components/file-drop.html +264 -0
- package/runtime/arcane/components/file-inspector.html +293 -0
- package/runtime/arcane/components/file-manager.html +1715 -0
- package/runtime/arcane/components/header.html +142 -0
- package/runtime/arcane/components/integration-settings.html +14 -0
- package/runtime/arcane/components/local-ai-status.html +360 -0
- package/runtime/arcane/components/markdown-document.html +1048 -0
- package/runtime/arcane/components/markdown-editor.html +360 -0
- package/runtime/arcane/components/media-embed.html +8 -0
- package/runtime/arcane/components/modal.html +402 -0
- package/runtime/arcane/components/output-panel.html +259 -0
- package/runtime/arcane/components/preferences-form.html +135 -0
- package/runtime/arcane/components/record-timeline.html +105 -0
- package/runtime/arcane/components/relationship-board.html +116 -0
- package/runtime/arcane/components/screen-capture.html +8 -0
- package/runtime/arcane/components/source-code-viewer.html +441 -0
- package/runtime/arcane/components/source-explanation.html +124 -0
- package/runtime/arcane/components/speech.html +365 -0
- package/runtime/arcane/components/summary-strip.html +177 -0
- package/runtime/arcane/components/table.html +77 -0
- package/runtime/arcane/components/task-progress.html +282 -0
- package/runtime/arcane/components/terminal-workspace.html +65 -0
- package/runtime/arcane/components/theme-editor.html +41 -0
- package/runtime/arcane/components/theme-switcher.html +46 -0
- package/runtime/arcane/components/unified-inbox.html +20 -0
- package/runtime/arcane/components/voice-transcription.html +476 -0
- package/runtime/arcane/components/weather-widget.html +8 -0
- package/runtime/arcane/components/web-navigator.html +239 -0
- package/runtime/arcane/css/communications.css +1 -0
- package/runtime/arcane/css/dashboard-config.css +45 -0
- package/runtime/arcane/css/document-site.css +981 -0
- package/runtime/arcane/css/layout.css +438 -0
- package/runtime/arcane/css/primitives.css +321 -0
- package/runtime/arcane/css/theme.css +112 -0
- package/runtime/arcane/css/utility-workspace.css +1 -0
- package/runtime/arcane/entities/ApiModelRecord.js +20 -0
- package/runtime/arcane/entities/Calculation.js +13 -0
- package/runtime/arcane/entities/Chat.js +581 -0
- package/runtime/arcane/entities/CommunicationMessage.js +29 -0
- package/runtime/arcane/entities/CommunicationThread.js +21 -0
- package/runtime/arcane/entities/Document.js +10 -0
- package/runtime/arcane/entities/File.js +143 -0
- package/runtime/arcane/entities/Image.js +135 -0
- package/runtime/arcane/entities/IntentEnvelope.js +834 -0
- package/runtime/arcane/entities/Preference.js +83 -0
- package/runtime/arcane/entities/TWiNPolicyDecision.js +1092 -0
- package/runtime/arcane/entities/TerminalSession.js +46 -0
- package/runtime/arcane/entities/Theme.js +107 -0
- package/runtime/arcane/entities/User.js +1046 -0
- package/runtime/arcane/entities/Weather.js +23 -0
- package/runtime/arcane/img/arcane-os-everywhere.png +0 -0
- package/runtime/arcane/img/arrow-left.png +0 -0
- package/runtime/arcane/img/arrow-right.png +0 -0
- package/runtime/arcane/img/doc.svg +5 -0
- package/runtime/arcane/img/folder.svg +4 -0
- package/runtime/arcane/img/image.svg +5 -0
- package/runtime/arcane/img/refresh.png +0 -0
- package/runtime/arcane/img/send.svg +9 -0
- package/runtime/arcane/img/trash.svg +5 -0
- package/runtime/arcane/img/upload.svg +5 -0
- package/runtime/arcane/modules/AI.js +2048 -0
- package/runtime/arcane/modules/AIPreferenceRuntime.js +32 -0
- package/runtime/arcane/modules/AIPreferenceTuple.js +92 -0
- package/runtime/arcane/modules/AIResponseLength.js +42 -0
- package/runtime/arcane/modules/AIResponseURLPolicy.js +626 -0
- package/runtime/arcane/modules/AnsiText.js +53 -0
- package/runtime/arcane/modules/ApiModelDatabase.js +25 -0
- package/runtime/arcane/modules/AppDataScope.js +245 -0
- package/runtime/arcane/modules/AppearancePreferences.js +28 -0
- package/runtime/arcane/modules/ArcaneCommunicationBridge.js +22 -0
- package/runtime/arcane/modules/ArcaneNavigationPolicy.js +135 -0
- package/runtime/arcane/modules/ArcaneNetworkPolicy.js +255 -0
- package/runtime/arcane/modules/AsyncBoundary.js +161 -0
- package/runtime/arcane/modules/BrowserTestSuite.js +326 -0
- package/runtime/arcane/modules/CalculatorEngine.js +20 -0
- package/runtime/arcane/modules/CaseEvidenceIndexer.js +134 -0
- package/runtime/arcane/modules/ChartLibrary.js +35 -0
- package/runtime/arcane/modules/ChatRecords.js +13 -0
- package/runtime/arcane/modules/CommunicationAppController.js +43 -0
- package/runtime/arcane/modules/CommunicationHub.js +16 -0
- package/runtime/arcane/modules/CommunicationPreferences.js +13 -0
- package/runtime/arcane/modules/CommunicationProviderRegistry.js +16 -0
- package/runtime/arcane/modules/ComponentContracts.js +586 -0
- package/runtime/arcane/modules/ConfiguredAIChatSession.js +288 -0
- package/runtime/arcane/modules/ConversationActionItems.js +488 -0
- package/runtime/arcane/modules/ConversationClosingReport.js +274 -0
- package/runtime/arcane/modules/ConversationTimebox.js +527 -0
- package/runtime/arcane/modules/CoreLocalModelCatalog.js +255 -0
- package/runtime/arcane/modules/DBLS.js +171 -0
- package/runtime/arcane/modules/DBOPFS.js +1154 -0
- package/runtime/arcane/modules/DBOPFSWorker.js +116 -0
- package/runtime/arcane/modules/DataMaintenance.js +91 -0
- package/runtime/arcane/modules/DevelopmentWorkspace.js +74 -0
- package/runtime/arcane/modules/DirectoryPicker.js +109 -0
- package/runtime/arcane/modules/DocumentNavigation.js +223 -0
- package/runtime/arcane/modules/Errors.js +1025 -0
- package/runtime/arcane/modules/GifEncoder.js +29 -0
- package/runtime/arcane/modules/HTMLImport.js +114 -0
- package/runtime/arcane/modules/InMemoryCommunicationProvider.js +14 -0
- package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +275 -0
- package/runtime/arcane/modules/LocalAIReadiness.js +870 -0
- package/runtime/arcane/modules/LocalAIReadinessController.js +156 -0
- package/runtime/arcane/modules/MD.js +111 -0
- package/runtime/arcane/modules/Mail.js +352 -0
- package/runtime/arcane/modules/MailTransport.mjs +180 -0
- package/runtime/arcane/modules/Marked.min.js +71 -0
- package/runtime/arcane/modules/MemoryRecords.js +44 -0
- package/runtime/arcane/modules/MessageAdvisory.js +38 -0
- package/runtime/arcane/modules/ModelDefinition.js +189 -0
- package/runtime/arcane/modules/Ollama.js +74 -0
- package/runtime/arcane/modules/OllamaModelIdentifier.js +21 -0
- package/runtime/arcane/modules/OllamaSettings.js +24 -0
- package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +14 -0
- package/runtime/arcane/modules/PreferenceStore.js +109 -0
- package/runtime/arcane/modules/QRCode.min.js +1 -0
- package/runtime/arcane/modules/Questionnaire.js +61 -0
- package/runtime/arcane/modules/RecordLinkIndex.js +24 -0
- package/runtime/arcane/modules/RecordPassageIndex.js +222 -0
- package/runtime/arcane/modules/RecordReviewStore.js +94 -0
- package/runtime/arcane/modules/RevocableProjectionLedger.js +1623 -0
- package/runtime/arcane/modules/RiskSignalAnalyzer.js +37 -0
- package/runtime/arcane/modules/ScamRiskPolicy.js +62 -0
- package/runtime/arcane/modules/ScopedOPFSCache.js +183 -0
- package/runtime/arcane/modules/ScreenCapture.js +20 -0
- package/runtime/arcane/modules/SpeechPlayback.js +581 -0
- package/runtime/arcane/modules/StaticDocumentCatalog.js +1248 -0
- package/runtime/arcane/modules/SystemAppearance.js +20 -0
- package/runtime/arcane/modules/SystemPlatformPresentation.js +51 -0
- package/runtime/arcane/modules/SystemToolRegistry.js +28 -0
- package/runtime/arcane/modules/TerminalClient.js +52 -0
- package/runtime/arcane/modules/TerminalCommandRegistry.js +50 -0
- package/runtime/arcane/modules/ThemeBootstrap.js +26 -0
- package/runtime/arcane/modules/ThemeManager.js +131 -0
- package/runtime/arcane/modules/TimeGuard.js +149 -0
- package/runtime/arcane/modules/ToolCallRouter.js +83 -0
- package/runtime/arcane/modules/WaitForComponent.js +102 -0
- package/runtime/arcane/modules/YouTubeMedia.js +16 -0
- package/runtime/arcane/modules/uPlot.LICENSE.txt +21 -0
- package/runtime/arcane/modules/uPlot.iife.min.js +2 -0
- package/runtime/arcane/modules/uPlot.min.css +1 -0
- package/runtime/arcane/security/arcane-network-policy.json +6 -0
- package/runtime/strong-type/index.js +352 -0
- package/runtime/strong-type/licence +21 -0
- package/runtime/strong-type/package.json +45 -0
- package/schemas/arcane-app-bundle.schema.json +125 -0
- package/schemas/arcane-app.schema.json +329 -0
- package/schemas/arcane-lock.schema.json +86 -0
- package/schemas/arcane-package.schema.json +224 -0
- package/schemas/cli-event.schema.json +122 -0
- package/schemas/event-stack.schema.json +152 -0
- package/schemas/native-build-plan.schema.json +176 -0
- package/schemas/target-adapter.schema.json +117 -0
- package/src/app-descriptor.mjs +500 -0
- package/src/cli/main.mjs +561 -0
- package/src/constants.mjs +31 -0
- package/src/dev-server.mjs +718 -0
- package/src/doctor.mjs +315 -0
- package/src/dom-event-instrumentation.mjs +594 -0
- package/src/errors.mjs +75 -0
- package/src/event-manager.mjs +1342 -0
- package/src/event-queue.mjs +138 -0
- package/src/events.mjs +219 -0
- package/src/index.mjs +177 -0
- package/src/integrated-provider-loader.mjs +432 -0
- package/src/native-plan.mjs +698 -0
- package/src/native-provider-loader.mjs +1126 -0
- package/src/packager/core.mjs +2691 -0
- package/src/process.mjs +353 -0
- package/src/release-bundle.mjs +2523 -0
- package/src/repository.mjs +90 -0
- package/src/runtime.mjs +452 -0
- package/src/scaffold.mjs +380 -0
- package/src/targets/index.mjs +436 -0
- package/src/templates/assets/app-icon.png +0 -0
- package/src/templates/workspace-template.mjs +388 -0
- package/src/testing-loader.mjs +9 -0
- package/src/testing.mjs +427 -0
- package/src/toolchain.mjs +1335 -0
- package/src/update-check.mjs +307 -0
- package/src/workspace.mjs +449 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Arcane Shared Entities
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
The modules under `arcane/entities/` provide shared JavaScript records, value
|
|
6
|
+
objects, validation helpers, and contract vocabularies for Arcane applications.
|
|
7
|
+
This reference is the canonical inventory of their public module exports. The
|
|
8
|
+
export key is `<module path>#<export name>`; `default` denotes a module's default
|
|
9
|
+
export. Import only the exports listed here, and do not depend on unexported
|
|
10
|
+
implementation details.
|
|
11
|
+
|
|
12
|
+
The `Kind` column describes the exported JavaScript value: `class`, `function`,
|
|
13
|
+
or `constant`. Detailed, versioned rules for intent envelopes and TWiN policy
|
|
14
|
+
decisions remain authoritative in the linked contract documents.
|
|
15
|
+
|
|
16
|
+
## Export inventory
|
|
17
|
+
|
|
18
|
+
| Export key | Kind | Runtime symbol | Public contract |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| `arcane/entities/ApiModelRecord.js#default` | class | `ApiModelRecord` | Validates and freezes an HTTP(S) API response snapshot containing its endpoint, fetch time, metadata, and value. |
|
|
21
|
+
| `arcane/entities/Calculation.js#default` | class | `Calculation` | Validates and freezes a bounded expression, finite numeric result, and creation time. |
|
|
22
|
+
| `arcane/entities/Chat.js#default` | class | `ChatEntity` | Owns a browser chat session's messages, tool exchanges, memory extraction, and optional DBOPFS persistence in the `chats` table. |
|
|
23
|
+
| `arcane/entities/CommunicationMessage.js#default` | class | `CommunicationMessage` | Normalizes and freezes one provider message, including addressing, channel, direction, delivery state, timestamp, and attachment metadata. |
|
|
24
|
+
| `arcane/entities/CommunicationMessage.js#communicationChannels` | constant | `communicationChannels` | Shared `Set` of recognized message-channel identifiers: `email`, `sms`, `mms`, `rcs`, `whatsapp`, and `other`; consumers must not mutate it. |
|
|
25
|
+
| `arcane/entities/CommunicationThread.js#default` | class | `CommunicationThread` | Normalizes and freezes a provider conversation snapshot with participants, unread state, and `CommunicationMessage` records. |
|
|
26
|
+
| `arcane/entities/Document.js#default` | class | `DocumentEntity` | Specializes `FileEntity` with `documents` as its default DBOPFS table. |
|
|
27
|
+
| `arcane/entities/File.js#default` | class | `FileEntity` | Addresses a DBOPFS file by table and name, saves supported file data, and opens files with MIME and format-aware parsing metadata. |
|
|
28
|
+
| `arcane/entities/Image.js#default` | class | `ImageEntity` | Specializes `FileEntity` for the `images` table and exposes image validation, storage, data-URL, and blob-URL helpers. |
|
|
29
|
+
| `arcane/entities/IntentEnvelope.js#IntentEnvelopeValidationError` | class | `IntentEnvelopeValidationError` | Privacy-safe validation error with stable `code` and structural `path` fields; see the [intent-envelope contract](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/intent-envelope.md#errors). |
|
|
30
|
+
| `arcane/entities/IntentEnvelope.js#createIntentEnvelope` | function | `createIntentEnvelope` | Validates an intake payload separately from trusted identity, time, and provenance context, then returns an immutable v1 envelope; see the [creation authority boundary](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/intent-envelope.md#creation-authority-boundary). |
|
|
31
|
+
| `arcane/entities/IntentEnvelope.js#rehydrateIntentEnvelope` | function | `rehydrateIntentEnvelope` | Validates and reconstructs a canonical v1 envelope object or JSON string without asserting authenticity or authority. |
|
|
32
|
+
| `arcane/entities/IntentEnvelope.js#serializeIntentEnvelope` | function | `serializeIntentEnvelope` | Produces deterministic canonical JSON for a valid v1 intent envelope. |
|
|
33
|
+
| `arcane/entities/IntentEnvelope.js#intentEnvelopeAuditProjection` | function | `intentEnvelopeAuditProjection` | Produces a frozen, bounded structural projection that excludes original expression and other documented content fields; see the [public API contract](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/intent-envelope.md#public-api). |
|
|
34
|
+
| `arcane/entities/IntentEnvelope.js#intentEnvelopeContract` | constant | `intentEnvelopeContract` | Frozen v1 schema identifier, version, closed enum vocabularies, and size/count limits. |
|
|
35
|
+
| `arcane/entities/Preference.js#default` | class | `Preference` | Validates and freezes one typed preference definition and normalizes candidate values against its type, bounds, and options. |
|
|
36
|
+
| `arcane/entities/Preference.js#preferenceSchema` | function | `preferenceSchema` | Converts definitions to `Preference` instances, rejects duplicate keys, and returns a frozen schema array. |
|
|
37
|
+
| `arcane/entities/TerminalSession.js#default` | class | `TerminalSession` | Validates terminal identity, shell, and lifecycle state and supports immutable-style patched copies through `with()`. |
|
|
38
|
+
| `arcane/entities/TerminalSession.js#terminalShells` | constant | `terminalShells` | Frozen array of supported shell identifiers: `auto`, `powershell`, `cmd`, `bash`, and `sh`. |
|
|
39
|
+
| `arcane/entities/Theme.js#arcaneLightThemeTokens` | constant | `arcaneLightThemeTokens` | Frozen map of the default light-scheme semantic color tokens. |
|
|
40
|
+
| `arcane/entities/Theme.js#arcaneDarkThemeTokens` | constant | `arcaneDarkThemeTokens` | Frozen map of the default dark-scheme semantic color tokens. |
|
|
41
|
+
| `arcane/entities/Theme.js#themeTokens` | constant | `themeTokens` | Frozen ordered definitions that map public theme-token keys to CSS custom properties, labels, and defaults. |
|
|
42
|
+
| `arcane/entities/Theme.js#themeColorToHex` | function | `themeColorToHex` | Validates an RGB, RGBA, or six-digit hexadecimal color and returns its RGB channels as a normalized six-digit hexadecimal color. |
|
|
43
|
+
| `arcane/entities/Theme.js#default` | class | `Theme` | Validates and freezes a named light or dark token set and can serialize, restore, apply, or clear that theme on a document root. |
|
|
44
|
+
| `arcane/entities/TWiNPolicyDecision.js#TWiNPolicyDecisionValidationError` | class | `TWiNPolicyDecisionValidationError` | Privacy-safe policy-decision validation error with stable `code` and structural `path` fields; see the [TWiN error contract](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/twin-policy-decision.md#failure-and-recovery). |
|
|
45
|
+
| `arcane/entities/TWiNPolicyDecision.js#createTWiNPolicyDecision` | function | `createTWiNPolicyDecision` | Validates an evaluator payload separately from trusted decision and policy provenance, then returns an immutable v1 decision; see the [trusted creation boundary](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/twin-policy-decision.md#trusted-creation-boundary). |
|
|
46
|
+
| `arcane/entities/TWiNPolicyDecision.js#rehydrateTWiNPolicyDecision` | function | `rehydrateTWiNPolicyDecision` | Validates and reconstructs a canonical v1 policy-decision object or exact canonical JSON without asserting authenticity, freshness, or authority. |
|
|
47
|
+
| `arcane/entities/TWiNPolicyDecision.js#serializeTWiNPolicyDecision` | function | `serializeTWiNPolicyDecision` | Produces deterministic canonical JSON for a valid v1 TWiN policy decision. |
|
|
48
|
+
| `arcane/entities/TWiNPolicyDecision.js#twinPolicyDecisionAuditProjection` | function | `twinPolicyDecisionAuditProjection` | Produces a frozen structural audit projection that omits requirement targets and values; see [privacy and audit behavior](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/docs/twin-policy-decision.md#privacy-and-audit-behavior). |
|
|
49
|
+
| `arcane/entities/TWiNPolicyDecision.js#twinPolicyDecisionContract` | constant | `twinPolicyDecisionContract` | Frozen v1 schema identifier, version, layers, outcomes, core reason codes, and size/count limits. |
|
|
50
|
+
| `arcane/entities/User.js#default` | class | `UserEntity` | Owns the browser user's validated settings and profile record, including DBOPFS load, refresh, serialized updates, and optional persistence. |
|
|
51
|
+
| `arcane/entities/Weather.js#WeatherLocation` | class | `WeatherLocation` | Validates and freezes geographic identity, coordinates, and timezone metadata for a weather location. |
|
|
52
|
+
| `arcane/entities/Weather.js#WeatherObservation` | class | `WeatherObservation` | Validates and freezes one timestamped current-weather observation and its units. |
|
|
53
|
+
| `arcane/entities/Weather.js#WeatherDay` | class | `WeatherDay` | Validates and freezes one daily forecast with temperature, precipitation, and optional sunrise and sunset times. |
|
|
54
|
+
| `arcane/entities/Weather.js#WeatherSnapshot` | class | `WeatherSnapshot` | Validates and freezes a location, current observation, daily forecast list, source, and fetch time as one weather snapshot. |
|
|
55
|
+
|
|
56
|
+
## Compatibility boundary
|
|
57
|
+
|
|
58
|
+
An exported entity validates and represents data; it does not grant a capability,
|
|
59
|
+
authorization, native resource handle, provider credential, or policy approval.
|
|
60
|
+
Consumers must preserve the separate Arcane capability and trust boundaries that
|
|
61
|
+
govern persistence, networking, native execution, and protected data.
|
|
62
|
+
|
|
63
|
+
Changing an export name, kind, meaning, enum, accepted shape, serialization, or
|
|
64
|
+
validation invariant is a public-contract change. Update the implementation,
|
|
65
|
+
this inventory, its focused tests, and any linked versioned contract together.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Arcane events
|
|
2
|
+
|
|
3
|
+
`Arcane.events` delivers renderer-visible host and Core events. A named subscription such as `Arcane.events.on('operation.progress', listener)` receives that event's payload object directly. A wildcard subscription made with `Arcane.events.on('*', listener)` receives an envelope shaped as `{ event, data }`; `*` is a subscription selector, not an emitted event name.
|
|
4
|
+
|
|
5
|
+
`Arcane.events.on()` and `Arcane.events.once()` observe only future deliveries. `Arcane.events.once()` removes its subscription before invoking the listener and therefore observes only the next matching delivery. Most events are live notifications and are not replayed, so subscribe before starting the work that can emit them.
|
|
6
|
+
|
|
7
|
+
`transport.ready` and `core.ready` are the two durable completion events. `Arcane.events.when(name, listener)` accepts only those names. It waits once when completion has not happened, or asynchronously replays the first deeply frozen JSON snapshot when completion has already happened. `Arcane.events.completed(name)` reports whether a designated durable event has completed; it is not a payload accessor.
|
|
8
|
+
|
|
9
|
+
Every subscription method returns an unsubscribe function. Call it when the owning view or task is torn down. An exception thrown by one listener is caught and reported to the console, and does not stop the remaining named or wildcard listeners.
|
|
10
|
+
|
|
11
|
+
## Event inventory
|
|
12
|
+
|
|
13
|
+
| Event | Delivery | Hosts | Trigger | Payload |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `transport.ready` | Durable completion. The first payload is frozen; a late `when()` subscriber receives an asynchronous replay. | Every initialized Arcane transport: Microsoft NT WebView2, Linux WebKitGTK, Android WebView, and development HTTP. | The renderer initializes the bridge and selects its available transport. | `protocol` is the selected wire-protocol identifier; `transport` is `webview2`, `webkitgtk`, `android-webview`, or `development-http`. |
|
|
16
|
+
| `core.ready` | Durable completion. The first payload is frozen; a late `when()` subscriber receives an asynchronous replay. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | The Core has installed its input handlers and is ready to accept requests. | `pid` is the Core process ID; `version` is its Arcane version; `app` is the active application mode; `platform` is the public operating-system snapshot; `elevated` reports elevated execution; `simulation` reports simulation mode. |
|
|
17
|
+
| `core.error` | Live, future-only notification. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | The Core cannot decode or handle an inbound control frame. | A normalized error object: `code` and `message` identify the failure; fields such as `resolution`, `technicalMessage`, `status`, `retryable`, and `diagnosticId` provide recovery and diagnostic context when available. |
|
|
18
|
+
| `operation.started` | Live, future-only operation notification. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | A tracked Core operation is created. | `requestId` correlates the initiating API request; `operationId` identifies the tracked operation; `operationType` names its kind; `time` is the operation start timestamp. |
|
|
19
|
+
| `operation.log` | Live, future-only operation notification; one operation can emit many entries. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | A tracked operation records a log entry. | `requestId`, `operationId`, and `operationType` correlate the operation; `time` timestamps the entry; `level` classifies it; `message` is the readable entry; `details` carries optional structured context. |
|
|
20
|
+
| `operation.progress` | Live, future-only operation notification; one operation can emit many updates. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | A tracked operation advances or reports its current step. | `requestId`, `operationId`, and `operationType` correlate the operation; `progress` is its nondecreasing percentage; `message` describes the current step; `details` is optional structured progress context. |
|
|
21
|
+
| `operation.completed` | Live, future-only terminal operation notification. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | A tracked operation finishes successfully, including success with warnings. | `requestId`, `operationId`, and `operationType` correlate the operation; `result` is its public result; `credentials` carries any operation-issued credentials and must be treated as sensitive; `details` is final progress context; `warningCount` counts warnings; `message` summarizes completion; `time` is the completion timestamp. |
|
|
22
|
+
| `operation.failed` | Live, future-only terminal operation notification. | Core-backed Microsoft NT, Linux, and development HTTP hosts. | A tracked operation reaches its failure path. | `requestId`, `operationId`, and `operationType` correlate the operation; `error` is the normalized failure object; `details` is final progress context; `time` is the failure timestamp. |
|
|
23
|
+
| `ollama.chunk` | Live, future-only correlated stream notification. | Core-backed hosts and admitted Android application hosts for proxied chat streaming. | An Ollama streaming operation receives its next response chunk. | `streamId` identifies the stream selected by the caller or Arcane; `operation` names the streamed Ollama operation; `chunk` is the provider response object for that delivery. |
|
|
24
|
+
| `localai.isolated.phase` | Live, future-only correlated operation notification. | Core-backed hosts for an application admitted to isolated inference. | An isolated-model question enters a lifecycle phase or emits a chat heartbeat. | `operationId` correlates the request; `phase` is `unload_before`, `verify_before`, `chat`, `unload_after`, or `verify_after`; chat heartbeats additionally set `heartbeat` to `true`, report `elapsedMs`, and timestamp themselves with `at`. |
|
|
25
|
+
| `terminal.output` | Live, future-only correlated session stream. | Core-backed Arcane Terminal and Android Arcane Terminal hosts. | A terminal process produces standard output or standard error. | `sessionId` identifies the terminal session; `stream` is `stdout` or `stderr`; `data` is a UTF-8 text chunk and is not guaranteed to be a complete line. |
|
|
26
|
+
| `terminal.exit` | Live, future-only terminal session notification. | Core-backed Arcane Terminal and Android Arcane Terminal hosts. | A terminal process exits and the host removes its session. | `sessionId` identifies the terminal session; `exitCode` is the process exit code when available; `signal` is the terminating signal name or `null`. |
|
|
27
|
+
| `terminal.error` | Live, future-only terminal session notification. | Android Arcane Terminal hosts. | Android stops a session at its output limit or cannot read one of its output streams. | `sessionId` identifies the terminal session; `message` explains the output-limit or stream-reading failure. |
|
|
28
|
+
| `appearance.changed` | Live, future-only host notification. | Microsoft NT WebView2 hosts. | The host observes an operating-system appearance change. | `scheme` is the configured host scheme; `effectiveScheme` is the resolved `dark` or `light` scheme; `source` is `windows`. |
|
|
29
|
+
|
|
30
|
+
### Subscribe and clean up
|
|
31
|
+
|
|
32
|
+
Keep the returned function with the UI or operation that owns the subscription:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
const stopProgress = Arcane.events.on('operation.progress', function handleOperationProgress(data) {
|
|
36
|
+
console.info(`${data.operationId}: ${data.progress}%`, data.message);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
window.addEventListener('pagehide', stopProgress, { once: true });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A wildcard listener is useful for routing or diagnostics, but its callback shape differs from a named listener. Avoid logging payloads indiscriminately because results can contain credentials or other sensitive values.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const observedEventNames = [];
|
|
46
|
+
const stopObserving = Arcane.events.on('*', function handleAnyArcaneEvent({ event, data }) {
|
|
47
|
+
observedEventNames.push(event);
|
|
48
|
+
routeArcaneEvent(event, data);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
window.addEventListener('pagehide', stopObserving, { once: true });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Wait for durable readiness
|
|
55
|
+
|
|
56
|
+
Use `when()` when a component can mount before or after readiness. The callback is still asynchronous when the durable completion already exists.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
const stopReady = Arcane.events.when('core.ready', function handleCoreReady({ version, platform }) {
|
|
60
|
+
showRuntimeReady({ version, platform });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (Arcane.events.completed('core.ready')) {
|
|
64
|
+
showRuntimeConnecting(false);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
window.addEventListener('pagehide', stopReady, { once: true });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Do not use `when()` for operation, streaming, terminal, appearance, or error events. Those events have no retained completion value.
|
|
71
|
+
|
|
72
|
+
### Follow a terminal lifecycle
|
|
73
|
+
|
|
74
|
+
Subscribe before `Arcane.terminal.start()`. Output, exit, or error delivery can race the start response, so buffer by `sessionId` until the returned session identifies the stream to keep. Append `data` chunks as delivered rather than assuming one event equals one line.
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const terminalOutput = document.querySelector('[data-terminal-output]');
|
|
78
|
+
const buffered = [];
|
|
79
|
+
const maxBufferedEvents = 128;
|
|
80
|
+
let sessionId = null;
|
|
81
|
+
|
|
82
|
+
function handleTerminalEvent(event, data) {
|
|
83
|
+
if (sessionId === null) {
|
|
84
|
+
buffered.push({ event, data });
|
|
85
|
+
// Bound pre-identification buffering; surface truncation in a real UI.
|
|
86
|
+
if (buffered.length > maxBufferedEvents) buffered.shift();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (data.sessionId !== sessionId) return;
|
|
90
|
+
if (event === 'terminal.output') {
|
|
91
|
+
terminalOutput?.append(document.createTextNode(data.data));
|
|
92
|
+
} else if (event === 'terminal.exit') {
|
|
93
|
+
terminalOutput?.append(document.createTextNode(`\n[exit ${data.exitCode}]`));
|
|
94
|
+
} else {
|
|
95
|
+
terminalOutput?.append(document.createTextNode(`\n[terminal error: ${data.message}]`));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const stopTerminalEvents = [
|
|
100
|
+
Arcane.events.on('terminal.output', function handleTerminalOutput(data) {
|
|
101
|
+
handleTerminalEvent('terminal.output', data);
|
|
102
|
+
}),
|
|
103
|
+
Arcane.events.on('terminal.exit', function handleTerminalExit(data) {
|
|
104
|
+
handleTerminalEvent('terminal.exit', data);
|
|
105
|
+
}),
|
|
106
|
+
Arcane.events.on('terminal.error', function handleTerminalError(data) {
|
|
107
|
+
handleTerminalEvent('terminal.error', data);
|
|
108
|
+
}),
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
const session = await Arcane.terminal.start({ shell: 'auto' });
|
|
113
|
+
sessionId = session.id;
|
|
114
|
+
for (const item of buffered.splice(0)) handleTerminalEvent(item.event, item.data);
|
|
115
|
+
const lineEnding = ['powershell', 'cmd'].includes(session.shell) ? '\r\n' : '\n';
|
|
116
|
+
await Arcane.terminal.write(sessionId, `echo ready${lineEnding}`);
|
|
117
|
+
} finally {
|
|
118
|
+
if (sessionId !== null) {
|
|
119
|
+
await Arcane.terminal.close(sessionId).catch(function ignoreTerminalCloseFailure() {});
|
|
120
|
+
}
|
|
121
|
+
for (const stop of stopTerminalEvents) stop();
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Use the host-appropriate line ending when submitting interactive commands: `\r\n` for PowerShell or Command Prompt and `\n` for POSIX shells.
|
|
126
|
+
|
|
127
|
+
### Event lifecycle guidance
|
|
128
|
+
|
|
129
|
+
- Subscribe before starting work, then correlate with `requestId`, `operationId`, `streamId`, or `sessionId`. Unrelated work can emit the same named event concurrently.
|
|
130
|
+
- Treat `operation.completed` and `operation.failed` as the terminal event for an `operationId`; progress and log events are intermediate and are not retained.
|
|
131
|
+
- Treat `operation.completed.credentials` as sensitive. Do not write it to logs or durable application storage.
|
|
132
|
+
- Treat streaming and terminal payloads as ordered deliveries for their correlation ID, not as complete messages or lines. Apply resource bounds when buffering.
|
|
133
|
+
- Unsubscribe on teardown even after a one-shot workflow. `once()` and a pending `when()` clean themselves up when invoked, but their returned unsubscribe function cancels an abandoned wait.
|
|
134
|
+
- Host scope describes where an event can be emitted; it does not grant the capability needed to start the underlying operation.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Arcane Ollama module
|
|
2
|
+
|
|
3
|
+
Arcane applications can use the managed, machine-wide Ollama service only
|
|
4
|
+
through their app-scoped Core, without connecting directly to
|
|
5
|
+
`localhost:11434`. Import the shared module and let Core enforce the packaged
|
|
6
|
+
application policy, native resource admission, and declared capabilities. An
|
|
7
|
+
ordinary browser has no Core local-model authority and is OpenAI-only.
|
|
8
|
+
|
|
9
|
+
## Upstream Arcane OS model
|
|
10
|
+
|
|
11
|
+
This section describes assets and maintainer commands in the pinned upstream
|
|
12
|
+
[ARCANE-OS repository](https://github.com/TheWizardNexus/ARCANE-OS/tree/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e),
|
|
13
|
+
not files or npm scripts supplied by `arcane-os`. SDK application developers
|
|
14
|
+
use the browser module and an external Core/service only after this SDK's
|
|
15
|
+
current native plan admits the selected checkout and Core through its exact
|
|
16
|
+
protocol, version, feature, capability, method, provider, and identity-bound
|
|
17
|
+
receipt checks. That admission is current-build evidence, not a future SDK/Core
|
|
18
|
+
compatibility promise. Developers do not run these repository-maintenance
|
|
19
|
+
commands from an app or SDK checkout.
|
|
20
|
+
|
|
21
|
+
Arcane OS includes `arcane/models/Arcane-3B.Modelfile`, `arcane/models/Arcane-8B.Modelfile`, `arcane/models/Arcane-12B.Modelfile`, `arcane/models/Arcane-20B.Modelfile`, and `arcane/models/Arcane-120B.Modelfile`. They create the durable `arcane:3b`, `arcane:8b`, `arcane:12b`, `arcane:20b`, and `arcane:120b` variants, while `arcane:latest` points to the user's effective choice through the machine-wide `ArcaneOllama` service. The 3B definition uses `granite4.1:3b-q4_K_M` with a memory-bounded 16,384-token context.
|
|
22
|
+
|
|
23
|
+
After base installation succeeds and its installation transaction is complete,
|
|
24
|
+
opening Provisioner performs one fresh live machine-requirement check. On
|
|
25
|
+
Microsoft NT, if the installed Arcane identity is valid and the candidate is trusted, global Ollama is missing or
|
|
26
|
+
unhealthy, and the user-scoped Ollama process is confirmed inactive, Provisioner
|
|
27
|
+
starts exactly one noninterrupting verified global ensure. An installed
|
|
28
|
+
user-scoped copy neither satisfies nor blocks that action. An active or unknown
|
|
29
|
+
process state requires explicit close-and-retry confirmation, and the automatic
|
|
30
|
+
request carries a native deny-user-process-interruption policy so a process that
|
|
31
|
+
appears or restarts at the mutation boundary is not terminated. Provisioner open
|
|
32
|
+
never starts model reconciliation. A separate explicit post-install flow may
|
|
33
|
+
request one non-privileged model reconciliation after Core verifies that the
|
|
34
|
+
machine-wide service is ready. Arcane Shell is the sole automatic boot-recovery owner and
|
|
35
|
+
idempotently reconciles the selected model after Core is ready. The Shell's
|
|
36
|
+
Settings dialog lets the user
|
|
37
|
+
choose Automatic or an explicit 3B, 8B, 12B, 20B, or 120B variant. Automatic
|
|
38
|
+
considers only 8B and then 3B; 12B, 20B, and 120B are explicit choices and are
|
|
39
|
+
not probed or downloaded by the automatic policy. Core admits a candidate from
|
|
40
|
+
actual installed model bytes and metadata, requested context and K/V-cache
|
|
41
|
+
estimate, current free system and GPU memory, loaded-model residency, safety
|
|
42
|
+
reserves, and pull storage when applicable. Missing evidence fails closed; a
|
|
43
|
+
GPU name or variant label is never fit evidence.
|
|
44
|
+
|
|
45
|
+
When 8B and 3B both receive conclusive native capacity rejections, the user may
|
|
46
|
+
explicitly select a configured account-accessible OpenAI model. Arcane never
|
|
47
|
+
rewrites the provider automatically. Missing credentials, an unavailable
|
|
48
|
+
account model, unreachable local services, registry or metadata failures, and
|
|
49
|
+
unavailable resource evidence do not prove that no local model fits and never
|
|
50
|
+
authorize cloud use.
|
|
51
|
+
|
|
52
|
+
Only the effective Arcane candidate is processed. Core reports owned model
|
|
53
|
+
progress through `operation.progress`, creates the named variant from an
|
|
54
|
+
already-installed admitted base when needed, selects it as `arcane:latest`, and
|
|
55
|
+
verifies both names through the service API. For a missing base, the managed
|
|
56
|
+
path uses bounded library-registry manifest/configuration evidence and GGUF
|
|
57
|
+
prefix ranges up to 256 KiB for pull admission. A range is not full integrity
|
|
58
|
+
proof: Ollama must complete full-layer digest verification before Core creates
|
|
59
|
+
or verifies an alias. Missing pre-download bytes or metadata fails closed. Model
|
|
60
|
+
progress is coalesced to at most four transfer updates per second, with a
|
|
61
|
+
five-second heartbeat while Ollama is silent. Its structured
|
|
62
|
+
`details` distinguish overall setup progress from the current layer and expose
|
|
63
|
+
phase, model and digest identity, per-layer and observed aggregate bytes,
|
|
64
|
+
elapsed time, evidence-based rate and layer ETA, and truthful
|
|
65
|
+
interruption/resume guidance. Unknown totals remain unknown.
|
|
66
|
+
|
|
67
|
+
When the Provisioner explicitly starts its post-install reconciliation after the global service requirement succeeds, it renders those details as a dedicated model-transfer bar beside the already-completed installation result. Opening Provisioner may run the single guarded global-service ensure described above, but it never starts model reconciliation. The Shell uses the same progress contract for its automatic idempotent recovery and for Settings changes. The Microsoft NT and Linux hosts warn before closing a host during a managed model request. A download retry reuses Ollama's saved partial data; an interrupted model load restarts when Arcane reopens.
|
|
68
|
+
|
|
69
|
+
Each application's supported model list exists only in its
|
|
70
|
+
`arcane-package.json.localAIModelPolicy`, and every product definition remains
|
|
71
|
+
under its owning app. The app release carries the policy as native admission metadata;
|
|
72
|
+
the native packager injects it only into compiled Core. Profile controls render
|
|
73
|
+
the ordered, filtered, and admitted `Arcane.localAI.status().models.ollama`
|
|
74
|
+
catalog without a second renderer list. Product aliases are lazy: Core creates
|
|
75
|
+
or repairs only the exact selected declared alias from an installed admitted
|
|
76
|
+
base on first native inference. Ordinary browsers have no local-model authority.
|
|
77
|
+
|
|
78
|
+
The service is configured with the global `OLLAMA_MODELS` directory. Arcane clients never write model layers directly into that protected directory. Fresh installation and verified service repair choose bounded service capacity from hardware evidence; ordinary startup and model selection do not rewrite service settings. An explicitly authorized application may call `Arcane.localAI.setParallelRequests({model,parallelRequests,contextTokens?})`: Core solves the current model-specific memory ceiling directly from model and machine evidence without a product-defined parallelism cap, changes only the global `OLLAMA_NUM_PARALLEL` value when necessary, restarts the managed service only on a tentative change, re-evaluates once while stopped, and then ensures, loads, and confirms that model. Automatic mutation is currently Microsoft NT-only; Linux returns administrator-managed systemd guidance and Android user-managed loopback sessions do not call it. A restart unloads other resident Ollama models and can interrupt in-flight local inference. In the upstream ARCANE-OS maintainer checkout only, a maintenance run follows the saved Arcane preference with `npm run model:ensure`. To pull the one 3B base and build both aliases without running Provisioner, an upstream maintainer uses:
|
|
79
|
+
|
|
80
|
+
```powershell
|
|
81
|
+
# Run only from the canonical upstream ARCANE-OS repository.
|
|
82
|
+
npm run model:ensure -- --target=all --model=3b --smoke
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`--target=arcane` is the backward-compatible platform default. Product-specific targets and definitions remain documented by their owning applications. `--target=all` reuses one base pull across both currently configured targets, selects `arcane:3b` as `arcane:latest`, and preserves unrelated settings. `--smoke` adds one bounded local inference probe per selected alias. The equivalent platform-only raw Ollama sequence is `ollama pull granite4.1:3b-q4_K_M` followed by `ollama create arcane:3b -f arcane/models/Arcane-3B.Modelfile`; the npm command additionally verifies lineage and is the supported repository workflow.
|
|
86
|
+
|
|
87
|
+
The managed service's aliases and model layers are machine-wide, while Arcane model preference and application profile selection remain per-user. `model:ensure` does not install or attest `ArcaneOllama`, does not update an already installed Core or UI after a source pull, and does not create application aliases outside the selected target set. Use the verified Provisioner to establish or repair the machine service and to install current application/runtime bytes. The public [Device and model support](https://github.com/TheWizardNexus/ARCANE-OS/blob/567ad110bf57a1c2d4a3daa22ae93716cc5f4d7e/apps/docs/guides/device-support.md) page tracks the exact product matrix, platform maturity, and COTS physical-validation backlog; 16B and 30B are validation targets, not managed variants.
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
import ollama from '/arcane/modules/Ollama.js'
|
|
91
|
+
|
|
92
|
+
const reply = await ollama.chatText({
|
|
93
|
+
model: 'arcane:latest',
|
|
94
|
+
messages: [{ role: 'user', content: 'Summarize this record.' }],
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Capabilities
|
|
99
|
+
|
|
100
|
+
Add only the capabilities the application needs to its native app descriptor:
|
|
101
|
+
|
|
102
|
+
- `ai.inference` — admitted `localAI.status`, `generate`, `chat`, and `embed`
|
|
103
|
+
- `ai.models.read` — raw `version`, `models`, `running`, and `show` diagnostics,
|
|
104
|
+
restricted to Settings, Terminal, and Shell
|
|
105
|
+
- `ai.models.manage` — policy-bound model-management operations
|
|
106
|
+
- `ai.models.unverified.inference` — inference-only access to
|
|
107
|
+
already-installed, hardware-admitted unverified models, valid only with
|
|
108
|
+
`localAIModelPolicy.verified_only:false`
|
|
109
|
+
- `ai.runtime.manage` — model-bound managed Ollama parallel-request changes;
|
|
110
|
+
currently Core-only, privileged/exclusive, and granted only to the registered
|
|
111
|
+
owning application
|
|
112
|
+
|
|
113
|
+
The sole model declaration remains `apps/<id>/arcane-package.json`:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"localAIModelPolicy": {
|
|
118
|
+
"verified_only": true,
|
|
119
|
+
"models": [
|
|
120
|
+
{"name": "EXAMPLE:8b", "definition": "Example-8B.Modelfile"}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Verified-only Core may create or repair only an exact declared alias. False
|
|
127
|
+
mode never pulls, creates, repairs, copies, pushes, or deletes an unverified
|
|
128
|
+
model. Browser runtime and generic metadata APIs do not consume or project this
|
|
129
|
+
policy or declared mapping; the generated release-root record still physically
|
|
130
|
+
contains it.
|
|
131
|
+
|
|
132
|
+
The pinned runtime also exposes `Arcane.ai.chat()`. Applications populate local
|
|
133
|
+
model controls from `Arcane.localAI.status()` and use admitted inference
|
|
134
|
+
methods; raw `Arcane.ai.models()` and Ollama inventory methods are diagnostic
|
|
135
|
+
surfaces for Settings, Terminal, and Shell only.
|
|
136
|
+
|
|
137
|
+
## Streaming
|
|
138
|
+
|
|
139
|
+
Pass an `onChunk` callback as the second argument to `chat` or `generate`.
|
|
140
|
+
Mutation streaming remains subject to verified package policy and native
|
|
141
|
+
admission. Direct application pull fails closed; Core's separate managed
|
|
142
|
+
lifecycle owns bounded preflight and the full-digest-verified pull.
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
await ollama.chat({
|
|
146
|
+
model: 'EXAMPLE:8b',
|
|
147
|
+
messages: [{ role: 'user', content: 'Hello' }],
|
|
148
|
+
}, {
|
|
149
|
+
onChunk(chunk) {
|
|
150
|
+
output.append(chunk.message?.content || '')
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Chunk callbacks run as `ollama.chunk` events arrive from Arcane Core. The returned promise resolves with Ollama's final chunk. All operations are bounded by Arcane request and response limits and remain restricted to the loopback ArcaneOllama service.
|
|
156
|
+
|
|
157
|
+
## API
|
|
158
|
+
|
|
159
|
+
The pinned `Ollama` class exposes exactly 24 public methods:
|
|
160
|
+
|
|
161
|
+
- 20 bridge delegates: `version()`, `models()`, `list()`, `running()`,
|
|
162
|
+
`show()`, `generate()`, `chat()`, `embed()`, `pull()`, `push()`, `create()`,
|
|
163
|
+
`copy()`, `delete()`, `selection()`, `select()`, `settings()`,
|
|
164
|
+
`saveSettings()`, `createBrain()`, `serviceSettings()`, and
|
|
165
|
+
`saveServiceSettings()`.
|
|
166
|
+
- Four helpers: `readiness()`, `generateText()`, `chatText()`, and `unload()`.
|
|
167
|
+
|
|
168
|
+
`generateText()` returns `String(response?.response || '')`, and `chatText()`
|
|
169
|
+
returns `String(response?.message?.content || '')`. Valid provider envelopes
|
|
170
|
+
document both fields as strings. For an out-of-contract envelope, a truthy
|
|
171
|
+
nonstring value is stringified, while a missing, null, undefined, or other
|
|
172
|
+
falsy nonstring value becomes an empty string.
|
|
173
|
+
|
|
174
|
+
Exposure of a method does not grant its effect: Core applies capability,
|
|
175
|
+
package-policy, exact-definition, mutation, and resource-admission checks. The
|
|
176
|
+
selection methods are restricted to Arcane Shell. See
|
|
177
|
+
[Arcane AI Data Contracts](arcane-ai-contracts.md#direct-ollama-api) for every
|
|
178
|
+
accepted top-level request field, argument type, streaming callback, settings
|
|
179
|
+
range, raw-management restriction, and the boundary between normalized Arcane
|
|
180
|
+
results and version-dependent Ollama response envelopes. Arcane forces
|
|
181
|
+
non-streaming mode unless a chunk callback is supplied.
|