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.
- package/CHANGELOG.md +29 -0
- package/README.md +8 -8
- package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +29 -22
- package/browser-runtime/ai/ARCANE_AI_BROWSER_SPEECH_COMPONENTS.json +203 -0
- package/browser-runtime/ai/browser-kokoro-worker.mjs +11 -2
- package/browser-runtime/ai/browser-speech-artifacts.mjs +3230 -397
- package/browser-runtime/ai/browser-speech-providers.mjs +1141 -157
- package/browser-runtime/ai/browser-speech.mjs +2 -0
- package/browser-runtime/ai/browser-whisper-worker.mjs +11 -2
- package/browser-runtime/ai/model-controller.mjs +285 -95
- package/browser-runtime/ai/speech-worker-client.mjs +247 -32
- package/browser-runtime/ai/speech-worker-runtime.mjs +2310 -167
- package/browser-runtime/event-manager.mjs +1097 -1
- package/docs/architecture.md +2 -2
- package/docs/event-manager.md +155 -27
- package/docs/reference/README.md +27 -27
- package/docs/reference/ai/browser-speech-package-authority.json +835 -0
- package/docs/reference/ai/browser-speech.md +1162 -246
- package/docs/reference/ai/browser-wasm.md +18 -7
- package/docs/reference/availability-and-normalization.md +6 -3
- package/docs/reference/behavioral-testing.md +29 -6
- package/docs/reference/cli.md +117 -9
- package/docs/reference/core/arcane-ai-contracts.md +1 -1
- package/docs/reference/event-manager.md +577 -32
- package/docs/reference/inventory/package-api.json +478 -2
- package/docs/reference/inventory/runtime-components.json +108 -44
- package/docs/reference/inventory/runtime-modules.json +131 -53
- package/docs/reference/mail.md +316 -0
- package/docs/reference/protocols.md +157 -43
- package/docs/reference/runtime-components.md +258 -83
- package/docs/reference/runtime-modules.md +613 -77
- package/docs/reference/sdk-api.md +1014 -25
- package/package.json +5 -4
- package/runtime/ARCANE_RUNTIME_RELEASE.json +145 -140
- package/runtime/arcane/components/app-bar.html +34 -13
- package/runtime/arcane/components/assistant-panel.html +110 -57
- package/runtime/arcane/components/calculator.html +7 -4
- package/runtime/arcane/components/chart.html +58 -17
- package/runtime/arcane/components/chat.html +606 -136
- package/runtime/arcane/components/conversation-view.html +13 -6
- package/runtime/arcane/components/dashboard-config.html +96 -59
- package/runtime/arcane/components/data-maintenance.html +69 -14
- package/runtime/arcane/components/data-view.html +53 -7
- package/runtime/arcane/components/directory-picker.html +118 -32
- package/runtime/arcane/components/document-inspector.html +47 -10
- package/runtime/arcane/components/file-drop.html +81 -35
- package/runtime/arcane/components/file-inspector.html +72 -22
- package/runtime/arcane/components/file-manager.html +374 -79
- package/runtime/arcane/components/integration-settings.html +12 -5
- package/runtime/arcane/components/local-ai-status.html +48 -19
- package/runtime/arcane/components/markdown-document.html +161 -68
- package/runtime/arcane/components/markdown-editor.html +110 -33
- package/runtime/arcane/components/media-embed.html +8 -5
- package/runtime/arcane/components/modal.html +15 -5
- package/runtime/arcane/components/output-panel.html +28 -23
- package/runtime/arcane/components/preferences-form.html +22 -4
- package/runtime/arcane/components/record-timeline.html +18 -2
- package/runtime/arcane/components/relationship-board.html +23 -3
- package/runtime/arcane/components/screen-capture.html +10 -4
- package/runtime/arcane/components/source-code-viewer.html +76 -9
- package/runtime/arcane/components/source-explanation.html +23 -3
- package/runtime/arcane/components/speech.html +462 -384
- package/runtime/arcane/components/summary-strip.html +22 -11
- package/runtime/arcane/components/table.html +39 -21
- package/runtime/arcane/components/task-progress.html +79 -21
- package/runtime/arcane/components/terminal-workspace.html +7 -4
- package/runtime/arcane/components/theme-editor.html +7 -3
- package/runtime/arcane/components/unified-inbox.html +9 -4
- package/runtime/arcane/components/voice-transcription.html +639 -98
- package/runtime/arcane/components/weather-widget.html +5 -3
- package/runtime/arcane/components/web-navigator.html +48 -8
- package/runtime/arcane/entities/Chat.js +1 -1
- package/runtime/arcane/entities/User.js +110 -23
- package/runtime/arcane/modules/AI.js +2109 -130
- package/runtime/arcane/modules/AIProviderRuntime.js +720 -13
- package/runtime/arcane/modules/AIRuntimeState.js +109 -52
- package/runtime/arcane/modules/ApiModelDatabase.js +390 -17
- package/runtime/arcane/modules/BrowserTestSuite.js +205 -28
- package/runtime/arcane/modules/CalculatorEngine.js +63 -3
- package/runtime/arcane/modules/CommunicationAppController.js +588 -28
- package/runtime/arcane/modules/CommunicationHub.js +590 -10
- package/runtime/arcane/modules/ComponentContracts.js +470 -0
- package/runtime/arcane/modules/ConversationTimebox.js +152 -33
- package/runtime/arcane/modules/DBLS.js +40 -7
- package/runtime/arcane/modules/DBOPFS.js +35 -11
- package/runtime/arcane/modules/DataMaintenance.js +12 -2
- package/runtime/arcane/modules/Errors.js +65 -7
- package/runtime/arcane/modules/HTMLImport.js +198 -14
- package/runtime/arcane/modules/LocalAIReadinessController.js +208 -29
- package/runtime/arcane/modules/Mail.js +738 -115
- package/runtime/arcane/modules/MailOutbox.mjs +1395 -0
- package/runtime/arcane/modules/MailTransport.mjs +197 -39
- package/runtime/arcane/modules/Ollama.js +36 -1
- package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +583 -7
- package/runtime/arcane/modules/PreferenceStore.js +367 -33
- package/runtime/arcane/modules/RecordReviewStore.js +322 -23
- package/runtime/arcane/modules/ScreenCapture.js +1397 -15
- package/runtime/arcane/modules/SpeechPlayback.js +438 -41
- package/runtime/arcane/modules/TerminalClient.js +277 -12
- package/runtime/arcane/modules/ThemeBootstrap.js +80 -6
- package/runtime/arcane/modules/ThemeManager.js +39 -7
- package/runtime/arcane/modules/TimeGuard.js +131 -20
- package/runtime/arcane/modules/WaitForComponent.js +386 -33
- package/schemas/arcane-lock.schema.json +2 -2
- package/src/cli/main.mjs +435 -9
- package/src/event-manager.mjs +1097 -1
- package/src/import-map.mjs +21 -3
- package/src/index.mjs +13 -0
- package/src/installed-sdk-runtime.mjs +112 -0
- package/src/mail-api.mjs +22 -0
- package/src/mail-credentials.mjs +667 -0
- package/src/mail-server.mjs +1769 -0
- package/src/mail.mjs +261 -0
- package/src/sdk-browser-runtime.mjs +85 -41
- package/src/testing-loader.mjs +7 -0
- package/src/toolchain.mjs +3 -0
- package/src/workspace.mjs +1 -1
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import Is from '../../node_modules/strong-type/index.js';
|
|
2
2
|
import './DBOPFS.js';
|
|
3
3
|
import UserEntity from '../entities/User.js';
|
|
4
|
+
import {
|
|
5
|
+
arcaneEvents,
|
|
6
|
+
createArcaneEventSource,
|
|
7
|
+
projectArcaneDOMEvent
|
|
8
|
+
} from 'arcane-os/event-manager';
|
|
4
9
|
|
|
5
10
|
const is=new Is(false);
|
|
11
|
+
const PUBLISH_TIME_GUARD_READY=Symbol('publish-time-guard-ready');
|
|
12
|
+
const USER_ENTITY_LOADED_EVENT='user-entity-loaded';
|
|
13
|
+
const TIME_GUARD_READY_EVENT='time-guard-ready';
|
|
14
|
+
const TIME_GUARD_READY_REASON='time-guard-initialized';
|
|
15
|
+
let userReadyUnsubscribe=null;
|
|
16
|
+
|
|
17
|
+
function timeGuardError(code,reason,message,ErrorConstructor=Error){
|
|
18
|
+
const error=new ErrorConstructor(message);
|
|
19
|
+
error.code=code;
|
|
20
|
+
error.reason=reason;
|
|
21
|
+
return error;
|
|
22
|
+
}
|
|
6
23
|
|
|
7
24
|
class TimeGuard {
|
|
25
|
+
#events;
|
|
26
|
+
|
|
27
|
+
#disposed=false;
|
|
28
|
+
|
|
29
|
+
#operationSequence=0;
|
|
30
|
+
|
|
31
|
+
ready=false;
|
|
32
|
+
|
|
8
33
|
// Default to 17 day grace period from last check
|
|
9
34
|
#gracePeriod = 1000 * 60 * 60 * 24 * 17;
|
|
10
35
|
// ms s m h d
|
|
@@ -22,9 +47,23 @@ class TimeGuard {
|
|
|
22
47
|
return window.timeguard;
|
|
23
48
|
}
|
|
24
49
|
|
|
50
|
+
this.#events=createArcaneEventSource(this,{
|
|
51
|
+
source:'time-guard',
|
|
52
|
+
eventTypes:Object.freeze([TIME_GUARD_READY_EVENT])
|
|
53
|
+
});
|
|
25
54
|
this.#loadTime();
|
|
26
55
|
}
|
|
27
56
|
|
|
57
|
+
#assertOpen(){
|
|
58
|
+
if(this.#disposed){
|
|
59
|
+
throw timeGuardError(
|
|
60
|
+
'ARCANE_TIME_GUARD_DISPOSED',
|
|
61
|
+
'time-guard-disposed',
|
|
62
|
+
'The time guard has been disposed.'
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
28
67
|
#loadTime() {
|
|
29
68
|
this.#storedTime = window.user?.current_time || 0;
|
|
30
69
|
this.#lastSuccessfulTime = window.user?.last_successful_time || 0;
|
|
@@ -48,15 +87,26 @@ class TimeGuard {
|
|
|
48
87
|
|
|
49
88
|
#checkTime(time=0) {
|
|
50
89
|
if(!is.number(time)) {
|
|
51
|
-
throw
|
|
90
|
+
throw timeGuardError(
|
|
91
|
+
'ARCANE_TIME_GUARD_TIME_VALUE_TYPE_MISMATCH',
|
|
92
|
+
'time-value-type-mismatch',
|
|
93
|
+
'Time guard values must be numbers.',
|
|
94
|
+
TypeError
|
|
95
|
+
);
|
|
52
96
|
}
|
|
53
97
|
|
|
54
98
|
if (!time) {
|
|
55
|
-
throw
|
|
99
|
+
throw timeGuardError(
|
|
100
|
+
'ARCANE_TIME_GUARD_TIME_VALUE_REQUIRED',
|
|
101
|
+
'time-value-required',
|
|
102
|
+
'A nonzero time guard value is required.',
|
|
103
|
+
RangeError
|
|
104
|
+
);
|
|
56
105
|
}
|
|
57
106
|
}
|
|
58
107
|
|
|
59
108
|
setStoredTime(time=0) {
|
|
109
|
+
this.#assertOpen();
|
|
60
110
|
this.#checkTime(time);
|
|
61
111
|
|
|
62
112
|
if (time < this.#storedTime) {
|
|
@@ -70,11 +120,17 @@ class TimeGuard {
|
|
|
70
120
|
}
|
|
71
121
|
|
|
72
122
|
setLastSuccessfulCheckTime(time=0) {
|
|
123
|
+
this.#assertOpen();
|
|
73
124
|
this.#checkTime(time);
|
|
74
125
|
|
|
75
126
|
if (time < this.#lastSuccessfulTime) {
|
|
76
127
|
//console.log('Clock rollback detected');
|
|
77
|
-
throw
|
|
128
|
+
throw timeGuardError(
|
|
129
|
+
'ARCANE_TIME_GUARD_SUCCESS_TIME_ROLLBACK',
|
|
130
|
+
'successful-check-time-rollback',
|
|
131
|
+
'The successful-check time cannot precede its stored value.',
|
|
132
|
+
RangeError
|
|
133
|
+
);
|
|
78
134
|
}
|
|
79
135
|
|
|
80
136
|
this.#lastSuccessfulTime = time;
|
|
@@ -84,26 +140,38 @@ class TimeGuard {
|
|
|
84
140
|
}
|
|
85
141
|
|
|
86
142
|
checkClockRollback() {
|
|
143
|
+
this.#assertOpen();
|
|
87
144
|
// Get current time and add time change grace period.
|
|
88
145
|
// This is to allow for time changes up to six hours
|
|
89
146
|
const currentTimeWithTimeChangeGracePeriod = Date.now() + this.#gracePeriodClock;
|
|
90
147
|
|
|
91
148
|
if (currentTimeWithTimeChangeGracePeriod < this.#storedTime) {
|
|
92
149
|
//console.log('Clock rollback detected');
|
|
93
|
-
throw
|
|
150
|
+
throw timeGuardError(
|
|
151
|
+
'ARCANE_TIME_GUARD_CLOCK_ROLLBACK_LIMIT_EXCEEDED',
|
|
152
|
+
'clock-rollback-limit-exceeded',
|
|
153
|
+
'The clock precedes the stored time by more than the allowed tolerance.',
|
|
154
|
+
RangeError
|
|
155
|
+
);
|
|
94
156
|
}
|
|
95
157
|
|
|
96
158
|
return true;
|
|
97
159
|
}
|
|
98
160
|
|
|
99
161
|
checkGracePeriod() {
|
|
162
|
+
this.#assertOpen();
|
|
100
163
|
this.checkClockRollback();
|
|
101
164
|
|
|
102
165
|
const currentTime = Date.now();
|
|
103
166
|
|
|
104
167
|
if (currentTime < this.#lastSuccessfulTime) {
|
|
105
168
|
//console.log('Clock rollback detected');
|
|
106
|
-
throw
|
|
169
|
+
throw timeGuardError(
|
|
170
|
+
'ARCANE_TIME_GUARD_CURRENT_TIME_PRECEDES_SUCCESS',
|
|
171
|
+
'current-time-precedes-successful-check',
|
|
172
|
+
'The current time precedes the last successful check.',
|
|
173
|
+
RangeError
|
|
174
|
+
);
|
|
107
175
|
}
|
|
108
176
|
|
|
109
177
|
const timeDifferenceBetweenChecks = currentTime - this.#lastSuccessfulTime;
|
|
@@ -112,38 +180,81 @@ class TimeGuard {
|
|
|
112
180
|
|
|
113
181
|
// Note, if the last known time check has not been set, this error will always be emitted
|
|
114
182
|
if (timeDifferenceBetweenChecks > this.#gracePeriod) {
|
|
115
|
-
throw
|
|
183
|
+
throw timeGuardError(
|
|
184
|
+
'ARCANE_TIME_GUARD_GRACE_PERIOD_EXCEEDED',
|
|
185
|
+
'grace-period-exceeded',
|
|
186
|
+
'The elapsed time exceeds the allowed time guard grace period.',
|
|
187
|
+
RangeError
|
|
188
|
+
);
|
|
116
189
|
}
|
|
117
190
|
|
|
118
191
|
return true;
|
|
119
192
|
}
|
|
120
|
-
}
|
|
121
193
|
|
|
194
|
+
[PUBLISH_TIME_GUARD_READY](){
|
|
195
|
+
this.#assertOpen();
|
|
196
|
+
const operationId=`${this.#events.instanceId}:initialize:${(++this.#operationSequence).toString(36)}`;
|
|
197
|
+
const {occurrence}=this.#events.dispatch(
|
|
198
|
+
TIME_GUARD_READY_EVENT,
|
|
199
|
+
Object.freeze({
|
|
200
|
+
db:this,
|
|
201
|
+
reason:TIME_GUARD_READY_REASON
|
|
202
|
+
}),
|
|
203
|
+
{
|
|
204
|
+
operationId,
|
|
205
|
+
publicDetail:Object.freeze({
|
|
206
|
+
ready:true,
|
|
207
|
+
reason:TIME_GUARD_READY_REASON
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
projectArcaneDOMEvent(window,occurrence);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
dispose(){
|
|
215
|
+
if(this.#disposed)return false;
|
|
216
|
+
this.#disposed=true;
|
|
217
|
+
this.ready=false;
|
|
218
|
+
if(window.timeguard===this)delete window.timeguard;
|
|
219
|
+
return this.#events.dispose();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
destroy(){
|
|
223
|
+
return this.dispose();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
122
226
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
227
|
+
function connectTimeGuardToUser(){
|
|
228
|
+
if(window.user?.ready){
|
|
229
|
+
instantiateTimeGuard();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
127
232
|
|
|
128
|
-
if(
|
|
129
|
-
|
|
233
|
+
if(userReadyUnsubscribe)return;
|
|
234
|
+
userReadyUnsubscribe=arcaneEvents.subscribe(
|
|
235
|
+
USER_ENTITY_LOADED_EVENT,
|
|
236
|
+
instantiateTimeGuard,
|
|
237
|
+
{once:true}
|
|
238
|
+
);
|
|
130
239
|
}
|
|
131
240
|
|
|
132
241
|
function instantiateTimeGuard() {
|
|
242
|
+
userReadyUnsubscribe=null;
|
|
243
|
+
if(!window.user?.ready){
|
|
244
|
+
connectTimeGuardToUser();
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
133
248
|
if(!window.timeguard){
|
|
134
249
|
window.timeguard = new TimeGuard();
|
|
135
250
|
|
|
136
251
|
window.timeguard.ready = true;
|
|
137
252
|
|
|
138
|
-
|
|
139
|
-
'time-guard-ready', {
|
|
140
|
-
detail: { db: window.timeguard }
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
window.dispatchEvent(timeguardReady);
|
|
253
|
+
window.timeguard[PUBLISH_TIME_GUARD_READY]();
|
|
145
254
|
|
|
146
255
|
}
|
|
147
256
|
}
|
|
148
257
|
|
|
258
|
+
connectTimeGuardToUser();
|
|
259
|
+
|
|
149
260
|
export default TimeGuard;
|