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
@@ -56,6 +56,9 @@
56
56
  <script type="module">
57
57
  const host=this;
58
58
  const root=host.shadowRoot;
59
+ const {createArcaneEventSource,projectArcaneDOMEvent}=await import('arcane-os/event-manager');
60
+ const events=createArcaneEventSource(host,{source:'arcane.component.file-inspector',eventTypes:['file-inspector-change','file-inspector-action','file-inspector-error','file-inspector-cleared','file-inspector-ready']});
61
+ const lifecycleController=new AbortController();
59
62
  const region=root.querySelector('#region');
60
63
  const empty=root.querySelector('#empty');
61
64
  const content=root.querySelector('#content');
@@ -71,9 +74,12 @@
71
74
  let actionItems=[];
72
75
  let current=null;
73
76
  let options={};
77
+ let operationSequence=0;
78
+ let destroyed=false;
74
79
 
75
80
  host.clear=clear;
76
81
  host.configure=configure;
82
+ host.destroy=destroy;
77
83
  host.setActions=setActions;
78
84
  host.setBusy=setBusy;
79
85
  host.setError=setError;
@@ -81,11 +87,20 @@
81
87
  host.show=show;
82
88
 
83
89
  Object.defineProperties(host,{
84
- file:{get:()=>current?{...current}:null,set:show},
85
- options:{get:()=>({...options}),set:configure}
90
+ file:{configurable:true,get:()=>current?{...current}:null,set:show},
91
+ options:{configurable:true,get:()=>({...options}),set:configure}
86
92
  });
87
93
 
88
- actions.addEventListener('click',handleAction);
94
+ actions.addEventListener('click',handleAction,{signal:lifecycleController.signal});
95
+
96
+ function emit(type,detail={},publicDetail={},cancelable=false,operationId=null){
97
+ if(destroyed){
98
+ return false;
99
+ }
100
+ const publication=events.dispatch(type,detail,{publicDetail,cancelable,operationId});
101
+ if(cancelable&&!publication.accepted) return false;
102
+ return projectArcaneDOMEvent(host,publication.occurrence,{bubbles:true,composed:true,cancelable});
103
+ }
89
104
 
90
105
  function datasetOptions(){
91
106
  return {
@@ -96,6 +111,9 @@
96
111
  }
97
112
 
98
113
  function configure(input={}){
114
+ if(destroyed){
115
+ return false;
116
+ }
99
117
  options={...datasetOptions(),...options,...input};
100
118
  region.setAttribute('aria-label',`${options.ariaLabel||'File inspector'}`);
101
119
  empty.innerText=`${options.emptyLabel||'Select an item to inspect.'}`;
@@ -104,6 +122,9 @@
104
122
  }
105
123
 
106
124
  function show(input={}){
125
+ if(destroyed){
126
+ return false;
127
+ }
107
128
  if(!input){
108
129
  clear();
109
130
  return null;
@@ -118,11 +139,7 @@
118
139
  renderMetadata(input.metadata??defaultMetadata(input));
119
140
  setActions(input.actions||[]);
120
141
  setPreview(input.preview??input.content??'');
121
- host.dispatchEvent(new CustomEvent('file-inspector-change',{
122
- bubbles:true,
123
- composed:true,
124
- detail:{file:{...current}}
125
- }));
142
+ emit('file-inspector-change',{file:{...current}},{hasFile:true,mimeType:String(input.mimeType||input.type||'')});
126
143
  return {...current};
127
144
  }
128
145
 
@@ -156,6 +173,9 @@
156
173
  }
157
174
 
158
175
  function setPreview(value=''){
176
+ if(destroyed){
177
+ return false;
178
+ }
159
179
  preview.replaceChildren();
160
180
  if(typeof Node!=='undefined'&&value instanceof Node){
161
181
  preview.append(value);
@@ -173,6 +193,9 @@
173
193
  }
174
194
 
175
195
  function setActions(values=[]){
196
+ if(destroyed){
197
+ return [];
198
+ }
176
199
  actionItems=Array.from(values||[]).map((value,index)=>({
177
200
  disabled:Boolean(value.disabled),
178
201
  id:`${value.id??value.action??`action-${index+1}`}`,
@@ -200,15 +223,13 @@
200
223
  if(!button||!action||action.disabled){
201
224
  return;
202
225
  }
203
- host.dispatchEvent(new CustomEvent('file-inspector-action',{
204
- bubbles:true,
205
- cancelable:true,
206
- composed:true,
207
- detail:{action:{...action},file:current?{...current}:null,id:action.id}
208
- }));
226
+ emit('file-inspector-action',{action:{...action},file:current?{...current}:null,id:action.id},{actionId:action.id,hasFile:Boolean(current)},true,`${events.descriptor.instanceId}:action:${++operationSequence}`);
209
227
  }
210
228
 
211
229
  function setStatus(value=''){
230
+ if(destroyed){
231
+ return false;
232
+ }
212
233
  const next=typeof value==='object'?value:{label:value,status:value};
213
234
  status.innerText=`${next.label||''}`;
214
235
  status.dataset.status=`${next.status||''}`;
@@ -216,6 +237,9 @@
216
237
  }
217
238
 
218
239
  function setBusy(value=true,message='Loading preview…'){
240
+ if(destroyed){
241
+ return false;
242
+ }
219
243
  const busy=Boolean(value);
220
244
  previewShell.setAttribute('aria-busy',`${busy}`);
221
245
  if(busy){
@@ -228,19 +252,26 @@
228
252
  return busy;
229
253
  }
230
254
 
231
- function setError(message=''){
255
+ function setError(message='',errorDetail={}){
256
+ if(destroyed){
257
+ return '';
258
+ }
232
259
  const text=`${message||''}`;
233
260
  preview.replaceChildren();
234
261
  if(text){
262
+ const code=String(errorDetail?.code||'ARCANE_FILE_INSPECTOR_PREVIEW_REJECTED');
263
+ const reason=String(errorDetail?.reason||'file-preview-rejected');
235
264
  const state=document.createElement('p');
236
265
  state.className='arcane-state arcane-state--error';
237
266
  state.innerText=text;
238
267
  preview.append(state);
239
- host.dispatchEvent(new CustomEvent('file-inspector-error',{
240
- bubbles:true,
241
- composed:true,
242
- detail:{file:current?{...current}:null,message:text}
243
- }));
268
+ emit(
269
+ 'file-inspector-error',
270
+ {file:current?{...current}:null,message:text,code,reason},
271
+ {hasFile:Boolean(current),hasError:true,code,reason},
272
+ false,
273
+ `${events.descriptor.instanceId}:error:${++operationSequence}`
274
+ );
244
275
  }
245
276
  return text;
246
277
  }
@@ -272,6 +303,9 @@
272
303
  }
273
304
 
274
305
  function clear(){
306
+ if(destroyed){
307
+ return false;
308
+ }
275
309
  current=null;
276
310
  actionItems=[];
277
311
  content.hidden=true;
@@ -282,12 +316,28 @@
282
316
  preview.replaceChildren();
283
317
  actions.replaceChildren();
284
318
  footer.hidden=true;
285
- host.dispatchEvent(new CustomEvent('file-inspector-cleared',{bubbles:true,composed:true}));
319
+ emit('file-inspector-cleared');
320
+ return true;
321
+ }
322
+
323
+ function destroy(){
324
+ if(destroyed){
325
+ return false;
326
+ }
327
+ destroyed=true;
328
+ lifecycleController.abort('file-inspector-destroyed');
329
+ current=null;
330
+ actionItems=[];
331
+ metadata.replaceChildren();
332
+ preview.replaceChildren();
333
+ actions.replaceChildren();
334
+ events.dispose();
335
+ host.ready=false;
286
336
  return true;
287
337
  }
288
338
 
289
339
  configure(datasetOptions());
290
340
  clear();
291
341
  host.ready=true;
292
- host.dispatchEvent(new CustomEvent('file-inspector-ready',{bubbles:true,composed:true}));
342
+ emit('file-inspector-ready',{}, {ready:true});
293
343
  </script>