arcane-os 0.2.2 → 0.3.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +8 -8
  3. package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +29 -22
  4. package/browser-runtime/ai/ARCANE_AI_BROWSER_SPEECH_COMPONENTS.json +203 -0
  5. package/browser-runtime/ai/browser-kokoro-worker.mjs +11 -2
  6. package/browser-runtime/ai/browser-speech-artifacts.mjs +3230 -397
  7. package/browser-runtime/ai/browser-speech-providers.mjs +1141 -157
  8. package/browser-runtime/ai/browser-speech.mjs +2 -0
  9. package/browser-runtime/ai/browser-whisper-worker.mjs +11 -2
  10. package/browser-runtime/ai/model-controller.mjs +285 -95
  11. package/browser-runtime/ai/speech-worker-client.mjs +247 -32
  12. package/browser-runtime/ai/speech-worker-runtime.mjs +2310 -167
  13. package/browser-runtime/event-manager.mjs +1097 -1
  14. package/docs/architecture.md +2 -2
  15. package/docs/event-manager.md +155 -27
  16. package/docs/reference/README.md +27 -27
  17. package/docs/reference/ai/browser-speech-package-authority.json +835 -0
  18. package/docs/reference/ai/browser-speech.md +1162 -246
  19. package/docs/reference/ai/browser-wasm.md +18 -7
  20. package/docs/reference/availability-and-normalization.md +6 -3
  21. package/docs/reference/behavioral-testing.md +29 -6
  22. package/docs/reference/cli.md +117 -9
  23. package/docs/reference/core/arcane-ai-contracts.md +1 -1
  24. package/docs/reference/event-manager.md +577 -32
  25. package/docs/reference/inventory/package-api.json +478 -2
  26. package/docs/reference/inventory/runtime-components.json +108 -44
  27. package/docs/reference/inventory/runtime-modules.json +131 -53
  28. package/docs/reference/mail.md +316 -0
  29. package/docs/reference/protocols.md +157 -43
  30. package/docs/reference/runtime-components.md +258 -83
  31. package/docs/reference/runtime-modules.md +613 -77
  32. package/docs/reference/sdk-api.md +1014 -25
  33. package/package.json +5 -4
  34. package/runtime/ARCANE_RUNTIME_RELEASE.json +145 -140
  35. package/runtime/arcane/components/app-bar.html +34 -13
  36. package/runtime/arcane/components/assistant-panel.html +110 -57
  37. package/runtime/arcane/components/calculator.html +7 -4
  38. package/runtime/arcane/components/chart.html +58 -17
  39. package/runtime/arcane/components/chat.html +606 -136
  40. package/runtime/arcane/components/conversation-view.html +13 -6
  41. package/runtime/arcane/components/dashboard-config.html +96 -59
  42. package/runtime/arcane/components/data-maintenance.html +69 -14
  43. package/runtime/arcane/components/data-view.html +53 -7
  44. package/runtime/arcane/components/directory-picker.html +118 -32
  45. package/runtime/arcane/components/document-inspector.html +47 -10
  46. package/runtime/arcane/components/file-drop.html +81 -35
  47. package/runtime/arcane/components/file-inspector.html +72 -22
  48. package/runtime/arcane/components/file-manager.html +374 -79
  49. package/runtime/arcane/components/integration-settings.html +12 -5
  50. package/runtime/arcane/components/local-ai-status.html +48 -19
  51. package/runtime/arcane/components/markdown-document.html +161 -68
  52. package/runtime/arcane/components/markdown-editor.html +110 -33
  53. package/runtime/arcane/components/media-embed.html +8 -5
  54. package/runtime/arcane/components/modal.html +15 -5
  55. package/runtime/arcane/components/output-panel.html +28 -23
  56. package/runtime/arcane/components/preferences-form.html +22 -4
  57. package/runtime/arcane/components/record-timeline.html +18 -2
  58. package/runtime/arcane/components/relationship-board.html +23 -3
  59. package/runtime/arcane/components/screen-capture.html +10 -4
  60. package/runtime/arcane/components/source-code-viewer.html +76 -9
  61. package/runtime/arcane/components/source-explanation.html +23 -3
  62. package/runtime/arcane/components/speech.html +462 -384
  63. package/runtime/arcane/components/summary-strip.html +22 -11
  64. package/runtime/arcane/components/table.html +39 -21
  65. package/runtime/arcane/components/task-progress.html +79 -21
  66. package/runtime/arcane/components/terminal-workspace.html +7 -4
  67. package/runtime/arcane/components/theme-editor.html +7 -3
  68. package/runtime/arcane/components/unified-inbox.html +9 -4
  69. package/runtime/arcane/components/voice-transcription.html +639 -98
  70. package/runtime/arcane/components/weather-widget.html +5 -3
  71. package/runtime/arcane/components/web-navigator.html +48 -8
  72. package/runtime/arcane/entities/Chat.js +1 -1
  73. package/runtime/arcane/entities/User.js +110 -23
  74. package/runtime/arcane/modules/AI.js +2109 -130
  75. package/runtime/arcane/modules/AIProviderRuntime.js +720 -13
  76. package/runtime/arcane/modules/AIRuntimeState.js +109 -52
  77. package/runtime/arcane/modules/ApiModelDatabase.js +390 -17
  78. package/runtime/arcane/modules/BrowserTestSuite.js +205 -28
  79. package/runtime/arcane/modules/CalculatorEngine.js +63 -3
  80. package/runtime/arcane/modules/CommunicationAppController.js +588 -28
  81. package/runtime/arcane/modules/CommunicationHub.js +590 -10
  82. package/runtime/arcane/modules/ComponentContracts.js +470 -0
  83. package/runtime/arcane/modules/ConversationTimebox.js +152 -33
  84. package/runtime/arcane/modules/DBLS.js +40 -7
  85. package/runtime/arcane/modules/DBOPFS.js +35 -11
  86. package/runtime/arcane/modules/DataMaintenance.js +12 -2
  87. package/runtime/arcane/modules/Errors.js +65 -7
  88. package/runtime/arcane/modules/HTMLImport.js +198 -14
  89. package/runtime/arcane/modules/LocalAIReadinessController.js +208 -29
  90. package/runtime/arcane/modules/Mail.js +738 -115
  91. package/runtime/arcane/modules/MailOutbox.mjs +1395 -0
  92. package/runtime/arcane/modules/MailTransport.mjs +197 -39
  93. package/runtime/arcane/modules/Ollama.js +36 -1
  94. package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +583 -7
  95. package/runtime/arcane/modules/PreferenceStore.js +367 -33
  96. package/runtime/arcane/modules/RecordReviewStore.js +322 -23
  97. package/runtime/arcane/modules/ScreenCapture.js +1397 -15
  98. package/runtime/arcane/modules/SpeechPlayback.js +438 -41
  99. package/runtime/arcane/modules/TerminalClient.js +277 -12
  100. package/runtime/arcane/modules/ThemeBootstrap.js +80 -6
  101. package/runtime/arcane/modules/ThemeManager.js +39 -7
  102. package/runtime/arcane/modules/TimeGuard.js +131 -20
  103. package/runtime/arcane/modules/WaitForComponent.js +386 -33
  104. package/schemas/arcane-lock.schema.json +2 -2
  105. package/src/cli/main.mjs +435 -9
  106. package/src/event-manager.mjs +1097 -1
  107. package/src/import-map.mjs +21 -3
  108. package/src/index.mjs +13 -0
  109. package/src/installed-sdk-runtime.mjs +112 -0
  110. package/src/mail-api.mjs +22 -0
  111. package/src/mail-credentials.mjs +667 -0
  112. package/src/mail-server.mjs +1769 -0
  113. package/src/mail.mjs +261 -0
  114. package/src/sdk-browser-runtime.mjs +85 -41
  115. package/src/testing-loader.mjs +7 -0
  116. package/src/toolchain.mjs +3 -0
  117. package/src/workspace.mjs +1 -1
@@ -20,6 +20,11 @@ const SDK_BROWSER_ENTRY='sdk/event-manager.mjs';
20
20
  const SDK_BROWSER_AI_ENTRY='sdk/ai/browser-wasm.mjs';
21
21
  const SDK_BROWSER_SPEECH_ENTRY='sdk/ai/browser-speech.mjs';
22
22
  const SDK_BROWSER_SPEECH_WORKER_RUNTIME='sdk/ai/speech-worker-runtime.mjs';
23
+ const SDK_BROWSER_SELF_IMPORTS=new Map([
24
+ ['arcane-os/event-manager',SDK_BROWSER_ENTRY],
25
+ ['arcane-os/ai/browser-wasm',SDK_BROWSER_AI_ENTRY],
26
+ ['arcane-os/ai/browser-speech',SDK_BROWSER_SPEECH_ENTRY]
27
+ ]);
23
28
  const SDK_BROWSER_FILES=Object.freeze([
24
29
  'sdk/ai/ARCANE_AI_BROWSER_WASM_COMPONENTS.json',
25
30
  'sdk/ai/browser-kokoro-worker.mjs',
@@ -761,8 +766,8 @@ function nonliteralDynamic(importer,offset){
761
766
 
762
767
  function isAuthorizedSpeechRuntimeImport(tokens,index,close,importer){
763
768
  if(importer!==SDK_BROWSER_SPEECH_WORKER_RUNTIME||close!==index+5)return false;
764
- const [entry,dot,moduleUrl]=tokens.slice(index+2,close);
765
- return entry?.type==='identifier'&&entry.value==='entry'
769
+ const [binding,dot,moduleUrl]=tokens.slice(index+2,close);
770
+ return binding?.type==='identifier'&&['entry','target'].includes(binding.value)
766
771
  &&dot?.value==='.'
767
772
  &&moduleUrl?.type==='identifier'&&moduleUrl.value==='moduleUrl';
768
773
  }
@@ -889,6 +894,19 @@ function resolveImport(importer,specifier,files){
889
894
  +'deterministic shipped-runtime subset'
890
895
  );
891
896
  }
897
+ const sdkBrowserTarget=SDK_BROWSER_SELF_IMPORTS.get(reachableSpecifier);
898
+ if(sdkBrowserTarget){
899
+ if(reachableSpecifier!==specifier){
900
+ unresolved(
901
+ importer,
902
+ specifier,
903
+ sdkBrowserTarget,
904
+ 'uses a query or fragment that cannot match its exact browser import-map key'
905
+ );
906
+ }
907
+ if(!files.has(sdkBrowserTarget))unresolved(importer,specifier,sdkBrowserTarget);
908
+ return {target:sdkBrowserTarget};
909
+ }
892
910
  if(reachableSpecifier===RUNTIME_STRONG_TYPE_IMPORT){
893
911
  const target='dependencies/strong-type/index.js';
894
912
  if(reachableSpecifier!==specifier){
@@ -1860,7 +1878,7 @@ function renderManagedHtml(html,json,baseHref='../../'){
1860
1878
  ...base,
1861
1879
  href:structuralAttribute(parseTagAttributes(base.open),'href','base')
1862
1880
  }));
1863
- if(renderedBases.length!==1||renderedBases[0].href!=='../../'
1881
+ if(renderedBases.length!==1||renderedBases[0].href!==baseHref
1864
1882
  ||renderedBases[0].end>managedPosition
1865
1883
  ||!/^[\t\n\f\r ]*$/u.test(rendered.slice(renderedBases[0].end,managedPosition))){
1866
1884
  fail('Generated Arcane import-map HTML has an invalid or late base element.');
package/src/index.mjs CHANGED
@@ -33,8 +33,18 @@ export {
33
33
  validateUpdateRegistry
34
34
  } from './update-check.mjs';
35
35
  export {
36
+ ARCANE_EVENT_AUTHORITY_BRAND,
37
+ ARCANE_EVENT_AUTHORITY_KIND,
38
+ ARCANE_EVENT_AUTHORITY_PROTOCOL,
39
+ ARCANE_EVENT_ERROR_CODES,
40
+ ARCANE_EVENT_LISTENER_ERROR_EVENT,
41
+ ARCANE_EVENT_OCCURRENCE_PROTOCOL,
42
+ ARCANE_EVENT_SOURCE_DISPOSED_EVENT,
43
+ ARCANE_EVENT_SOURCE_KIND,
44
+ ARCANE_EVENT_SOURCE_PROTOCOL,
36
45
  ARCANE_EVENT_STACK_PROTOCOL,
37
46
  arcaneEvents,
47
+ createArcaneEventSource,
38
48
  createDOMInstrumentation,
39
49
  createEventManager,
40
50
  DEFAULT_DOM_EVENT_TYPES,
@@ -45,12 +55,14 @@ export {
45
55
  DOM_OBSERVATION_STOPPED_EVENT,
46
56
  domSelector,
47
57
  EventManager,
58
+ isArcaneEventOccurrence,
48
59
  parseEventStack,
49
60
  PLAYBACK_CANCELLED_EVENT,
50
61
  PLAYBACK_COMPLETED_EVENT,
51
62
  PLAYBACK_FAILED_EVENT,
52
63
  PLAYBACK_RECORD_EVENT,
53
64
  PLAYBACK_STARTED_EVENT,
65
+ projectArcaneDOMEvent,
54
66
  TIME_TRAVEL_OVERFLOW_EVENT,
55
67
  TIME_TRAVEL_SEEK_EVENT
56
68
  } from './event-manager.mjs';
@@ -131,6 +143,7 @@ export {
131
143
  selectApp,
132
144
  validateWorkspace
133
145
  } from './workspace.mjs';
146
+ export {materializeInstalledSdkRuntime} from './installed-sdk-runtime.mjs';
134
147
  export {startDevServer} from './dev-server.mjs';
135
148
  export {
136
149
  NATIVE_BUILD_PLAN_PROTOCOL,
@@ -0,0 +1,112 @@
1
+ import {lstat,readFile,realpath} from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import {verifyRuntime} from './runtime.mjs';
4
+ import {verifySdkBrowserRuntime} from './sdk-browser-runtime.mjs';
5
+ import {materializeWorkspaceRuntime} from './workspace-runtime.mjs';
6
+ import {
7
+ resolveInstalledSdkInstallation,
8
+ resolveSdkPackageDeclaration
9
+ } from './workspace.mjs';
10
+
11
+ function fail(message,code='ARCANE_INSTALLED_SDK_RUNTIME_INVALID'){
12
+ const error=new Error(message);
13
+ error.code=code;
14
+ throw error;
15
+ }
16
+
17
+ function throwIfAborted(signal){
18
+ if(!signal?.aborted)return;
19
+ const error=signal.reason instanceof Error?signal.reason:new Error('Operation cancelled.');
20
+ error.code=error.code||'ARCANE_CANCELLED';
21
+ throw error;
22
+ }
23
+
24
+ function samePath(left,right){
25
+ const normalize=value=>path.resolve(value).replaceAll('\\','/');
26
+ const a=normalize(left);
27
+ const b=normalize(right);
28
+ return process.platform==='win32'?a.toLowerCase()===b.toLowerCase():a===b;
29
+ }
30
+
31
+ async function canonicalWorkspaceRoot(workspaceRoot){
32
+ if(typeof workspaceRoot!=='string'||!workspaceRoot.trim()){
33
+ fail('workspaceRoot is required to materialize an installed SDK runtime.');
34
+ }
35
+ const requested=path.resolve(workspaceRoot);
36
+ let info;
37
+ try{info=await lstat(requested);}
38
+ catch(error){
39
+ if(error?.code==='ENOENT')fail(`Workspace root does not exist: ${requested}.`);
40
+ throw error;
41
+ }
42
+ if(info.isSymbolicLink()||!info.isDirectory()){
43
+ fail(`Workspace root must be a real directory: ${requested}.`);
44
+ }
45
+ const canonical=await realpath(requested);
46
+ if(!samePath(requested,canonical)){
47
+ fail(`Workspace root must not resolve through another path: ${requested}.`);
48
+ }
49
+ return canonical;
50
+ }
51
+
52
+ async function readRootPackage(workspaceRoot){
53
+ const packagePath=path.join(workspaceRoot,'package.json');
54
+ let info;
55
+ try{info=await lstat(packagePath);}
56
+ catch(error){
57
+ if(error?.code==='ENOENT')fail(`Workspace package.json is missing: ${packagePath}.`);
58
+ throw error;
59
+ }
60
+ if(info.isSymbolicLink()||!info.isFile()){
61
+ fail('Workspace package.json must be a real file.');
62
+ }
63
+ try{return JSON.parse(await readFile(packagePath,'utf8'));}
64
+ catch(error){fail(`Workspace package.json is not valid JSON: ${error.message}`);}
65
+ }
66
+
67
+ /**
68
+ * Resolves the workspace's one exact installed Arcane SDK declaration, verifies
69
+ * both physical runtime receipts, and materializes their dynamic inventories.
70
+ */
71
+ export async function materializeInstalledSdkRuntime({
72
+ workspaceRoot,
73
+ sdkPackageSource,
74
+ signal,
75
+ onEvent
76
+ }={}){
77
+ throwIfAborted(signal);
78
+ const canonicalRoot=await canonicalWorkspaceRoot(workspaceRoot);
79
+ const rootPackage=await readRootPackage(canonicalRoot);
80
+ const declaration=resolveSdkPackageDeclaration(rootPackage,
81
+ sdkPackageSource===undefined?{}:{packageSource:sdkPackageSource});
82
+ const installation=await resolveInstalledSdkInstallation(canonicalRoot,declaration);
83
+ const [runtimeReceipt,sdkBrowserRuntimeReceipt]=await Promise.all([
84
+ verifyRuntime({
85
+ runtimeRoot:installation.runtimeRoot,
86
+ signal,
87
+ onEvent
88
+ }),
89
+ verifySdkBrowserRuntime({
90
+ browserRuntimeRoot:installation.browserRuntimeRoot,
91
+ signal,
92
+ onEvent
93
+ })
94
+ ]);
95
+ const workspaceRuntimeReceipt=await materializeWorkspaceRuntime({
96
+ workspaceRoot:canonicalRoot,
97
+ runtimeRoot:installation.runtimeRoot,
98
+ runtimeReceipt,
99
+ browserRuntimeRoot:installation.browserRuntimeRoot,
100
+ sdkBrowserRuntimeReceipt,
101
+ signal,
102
+ onEvent
103
+ });
104
+ return Object.freeze({
105
+ schemaVersion:1,
106
+ kind:'arcane-installed-sdk-runtime-materialization',
107
+ installation,
108
+ runtimeReceipt,
109
+ sdkBrowserRuntimeReceipt,
110
+ workspaceRuntimeReceipt
111
+ });
112
+ }
@@ -0,0 +1,22 @@
1
+ export {
2
+ default,
3
+ default as Mail,
4
+ resolveMailConfig
5
+ } from '../runtime/arcane/modules/Mail.js';
6
+ export {
7
+ MAIL_OUTBOX_ACCEPTANCE_AUTHORITIES,
8
+ MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS,
9
+ MAIL_OUTBOX_PROTOCOL,
10
+ MAIL_OUTBOX_STATES,
11
+ MAIL_OUTBOX_TABLE,
12
+ MailOutbox,
13
+ createMailOutbox
14
+ } from '../runtime/arcane/modules/MailOutbox.mjs';
15
+ export {
16
+ DEFAULT_MAIL_REQUEST_TIMEOUT_MS,
17
+ MAX_MAIL_RESPONSE_BYTES,
18
+ MailTransportError,
19
+ normalizeMailEndpoint,
20
+ sendMailReport,
21
+ serializeMailReport
22
+ } from '../runtime/arcane/modules/MailTransport.mjs';