arcane-os 0.3.0 → 0.3.2
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 +27 -0
- package/README.md +86 -117
- package/bin/arcane-test.mjs +170 -46
- package/browser-runtime/ai/browser-speech-artifacts.mjs +887 -909
- package/browser-runtime/ai/browser-speech-providers.mjs +96 -152
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +627 -819
- package/browser-runtime/ai/browser-wasm.mjs +24 -35
- package/browser-runtime/ai/browser-wllama-runtime.mjs +64 -316
- package/browser-runtime/ai/model-controller.mjs +584 -181
- package/browser-runtime/ai/speech-worker-client.mjs +8 -146
- package/browser-runtime/ai/speech-worker-runtime.mjs +643 -363
- package/browser-runtime/dom-event-instrumentation.mjs +55 -147
- package/browser-runtime/event-manager.mjs +239 -624
- package/package.json +5 -6
- package/runtime/arcane/components/app-bar.html +3 -15
- package/runtime/arcane/components/assistant-panel.html +10 -10
- package/runtime/arcane/components/calculator.html +1 -1
- package/runtime/arcane/components/chat.html +1359 -135
- package/runtime/arcane/components/conversation-view.html +2 -2
- package/runtime/arcane/components/document-inspector.html +11 -17
- package/runtime/arcane/components/file-manager.html +13 -56
- package/runtime/arcane/components/markdown-document.html +82 -281
- package/runtime/arcane/components/markdown-editor.html +7 -10
- package/runtime/arcane/components/media-embed.html +6 -6
- package/runtime/arcane/components/screen-capture.html +4 -4
- package/runtime/arcane/components/source-explanation.html +2 -2
- package/runtime/arcane/components/speech.html +112 -68
- package/runtime/arcane/components/terminal-workspace.html +4 -4
- package/runtime/arcane/components/theme-editor.html +1 -1
- package/runtime/arcane/components/unified-inbox.html +2 -2
- package/runtime/arcane/components/voice-transcription.html +31 -21
- package/runtime/arcane/entities/Calculation.js +2 -3
- package/runtime/arcane/entities/Chat.js +228 -43
- package/runtime/arcane/entities/Preference.js +3 -5
- package/runtime/arcane/entities/Weather.js +5 -5
- package/runtime/arcane/modules/AI.js +1050 -427
- package/runtime/arcane/modules/AIProviderRuntime.js +658 -363
- package/runtime/arcane/modules/AIResponseLength.js +9 -19
- package/runtime/arcane/modules/AIRuntimeState.js +109 -72
- package/runtime/arcane/modules/ArcaneNavigationPolicy.js +45 -32
- package/runtime/arcane/modules/BrowserTestSuite.js +78 -122
- package/runtime/arcane/modules/CalculatorEngine.js +9 -9
- package/runtime/arcane/modules/CommunicationAppController.js +3 -7
- package/runtime/arcane/modules/ComponentContracts.js +30 -32
- package/runtime/arcane/modules/ConfiguredAIChatSession.js +281 -230
- package/runtime/arcane/modules/ConversationActionItems.js +26 -59
- package/runtime/arcane/modules/ConversationClosingReport.js +34 -61
- package/runtime/arcane/modules/ConversationTimebox.js +27 -15
- package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +152 -344
- package/runtime/arcane/modules/DocumentLexicalSearch.js +25 -91
- package/runtime/arcane/modules/HTMLImport.js +54 -1
- package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +40 -203
- package/runtime/arcane/modules/LocalAIReadiness.js +40 -60
- package/runtime/arcane/modules/LocalAIReadinessController.js +15 -13
- package/runtime/arcane/modules/MD.js +1 -45
- package/runtime/arcane/modules/Mail.js +51 -103
- package/runtime/arcane/modules/MailOutbox.mjs +95 -193
- package/runtime/arcane/modules/MailTransport.mjs +36 -57
- package/runtime/arcane/modules/ModelDefinition.js +22 -106
- package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +39 -101
- package/runtime/arcane/modules/PersistentAIChatSession.js +281 -18
- package/runtime/arcane/modules/PreferenceStore.js +102 -30
- package/runtime/arcane/modules/RiskSignalAnalyzer.js +8 -9
- package/runtime/arcane/modules/ScopedOPFSCache.js +7 -42
- package/runtime/arcane/modules/ScreenCapture.js +175 -128
- package/runtime/arcane/modules/SpeechPlayback.js +46 -149
- package/runtime/arcane/modules/StaticDocumentCatalog.js +173 -407
- package/runtime/arcane/modules/ToolCallRouter.js +25 -12
- package/runtime/arcane/modules/YouTubeMedia.js +6 -5
- package/schemas/arcane-app-bundle.schema.json +13 -78
- package/schemas/arcane-app.schema.json +9 -25
- package/schemas/arcane-lock.schema.json +18 -151
- package/schemas/arcane-package.schema.json +2 -16
- package/schemas/native-build-plan.schema.json +119 -122
- package/src/app-descriptor.mjs +75 -132
- package/src/application-tests.mjs +200 -0
- package/src/cli/main.mjs +27 -46
- package/src/constants.mjs +3 -4
- package/src/dev-server.mjs +30 -324
- package/src/doctor.mjs +92 -154
- package/src/dom-event-instrumentation.mjs +55 -147
- package/src/errors.mjs +2 -3
- package/src/event-manager.mjs +239 -624
- package/src/event-queue.mjs +3 -3
- package/src/import-map.mjs +273 -1028
- package/src/index.mjs +14 -16
- package/src/installed-sdk-runtime.mjs +40 -62
- package/src/integrated-provider-loader.mjs +53 -382
- package/src/mail-api.mjs +0 -2
- package/src/mail-server.mjs +224 -580
- package/src/mail.mjs +4 -10
- package/src/native-plan.mjs +163 -598
- package/src/native-provider-loader.mjs +104 -1063
- package/src/packager/core.mjs +485 -3229
- package/src/process.mjs +5 -10
- package/src/release-bundle.mjs +292 -2405
- package/src/runtime.mjs +76 -396
- package/src/scaffold.mjs +30 -80
- package/src/sdk-browser-runtime.mjs +70 -626
- package/src/source-server.mjs +588 -0
- package/src/targets/index.mjs +78 -188
- package/src/templates/workspace-template.mjs +19 -135
- package/src/testing-loader.mjs +164 -0
- package/src/testing.mjs +1 -1
- package/src/toolchain.mjs +131 -544
- package/src/update-check.mjs +26 -64
- package/src/workspace-operation-lock.mjs +139 -430
- package/src/workspace-runtime.mjs +112 -779
- package/src/workspace.mjs +40 -302
- package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +0 -218
- package/browser-runtime/ai/ARCANE_AI_BROWSER_SPEECH_COMPONENTS.json +0 -203
- package/browser-runtime/ai/ARCANE_AI_BROWSER_WASM_COMPONENTS.json +0 -80
- package/browser-runtime/ai/internal/sha256.mjs +0 -166
- package/docs/architecture.md +0 -344
- package/docs/compatibility.md +0 -36
- package/docs/event-manager.md +0 -294
- package/docs/platform-targets.md +0 -108
- package/docs/publishing.md +0 -201
- package/docs/reference/README.md +0 -187
- package/docs/reference/ai/browser-speech-package-authority.json +0 -835
- package/docs/reference/ai/browser-speech.md +0 -1252
- package/docs/reference/ai/browser-wasm.md +0 -530
- package/docs/reference/arcane-ollama.md +0 -288
- package/docs/reference/availability-and-normalization.md +0 -183
- package/docs/reference/behavioral-testing.md +0 -133
- package/docs/reference/cli.md +0 -779
- package/docs/reference/core/README.md +0 -62
- package/docs/reference/core/arcane-ai-contracts.md +0 -907
- package/docs/reference/core/arcane-api.md +0 -601
- package/docs/reference/core/arcane-entities.md +0 -65
- package/docs/reference/core/arcane-events.md +0 -134
- package/docs/reference/core/ollama-module.md +0 -181
- package/docs/reference/core/reference/arcane-api/ai-and-ollama.md +0 -1909
- package/docs/reference/core/reference/arcane-api/applications-terminal-capabilities.md +0 -1057
- package/docs/reference/core/reference/arcane-api/core-and-events.md +0 -320
- package/docs/reference/core/reference/arcane-api/filesystem-storage-preferences-appearance.md +0 -610
- package/docs/reference/core/reference/arcane-api/namespaces.md +0 -1157
- package/docs/reference/core/reference/arcane-api/platform-installation-users-system.md +0 -1423
- package/docs/reference/core/reference/arcane-api/session-provisioning-diagnostics-development.md +0 -315
- package/docs/reference/event-manager.md +0 -1511
- package/docs/reference/inventory/package-api.json +0 -3284
- package/docs/reference/inventory/runtime-components.json +0 -1011
- package/docs/reference/inventory/runtime-entities.json +0 -26
- package/docs/reference/inventory/runtime-modules.json +0 -1431
- package/docs/reference/mail.md +0 -316
- package/docs/reference/protocols.md +0 -677
- package/docs/reference/runtime-components.md +0 -1366
- package/docs/reference/runtime-entities.md +0 -303
- package/docs/reference/runtime-modules.md +0 -2960
- package/docs/reference/sdk-api.md +0 -6694
- package/docs/roadmap.md +0 -79
- package/docs/work-amplification.md +0 -129
- package/runtime/ARCANE_RUNTIME_RELEASE.json +0 -826
|
@@ -3,7 +3,7 @@ export const DOM_MUTATION_EVENT='arcane.dom.mutation';
|
|
|
3
3
|
export const DOM_OBSERVATION_STARTED_EVENT='arcane.dom.observation.started';
|
|
4
4
|
export const DOM_OBSERVATION_STOPPED_EVENT='arcane.dom.observation.stopped';
|
|
5
5
|
|
|
6
|
-
export const DEFAULT_DOM_EVENT_TYPES=
|
|
6
|
+
export const DEFAULT_DOM_EVENT_TYPES=[
|
|
7
7
|
'auxclick','beforeinput','blur','change','click','compositionend',
|
|
8
8
|
'compositionstart','compositionupdate','contextmenu','copy','cut','dblclick',
|
|
9
9
|
'drag','dragend','dragenter','dragleave','dragover','dragstart','drop','focus',
|
|
@@ -11,24 +11,17 @@ export const DEFAULT_DOM_EVENT_TYPES=Object.freeze([
|
|
|
11
11
|
'pointerdown','pointerenter','pointerleave','pointermove','pointerout','pointerover',
|
|
12
12
|
'pointerup','reset','scroll','selectionchange','submit','touchcancel','touchend',
|
|
13
13
|
'touchmove','touchstart','wheel'
|
|
14
|
-
]
|
|
14
|
+
];
|
|
15
15
|
|
|
16
|
-
const EVENT_FIELDS=
|
|
16
|
+
const EVENT_FIELDS=[
|
|
17
17
|
'altKey','button','buttons','charCode','clientX','clientY','code','ctrlKey','data',
|
|
18
18
|
'deltaMode','deltaX','deltaY','deltaZ','detail','inputType','key','keyCode',
|
|
19
19
|
'location','metaKey','movementX','movementY','offsetX','offsetY','pageX','pageY',
|
|
20
20
|
'pointerId','pointerType','repeat','screenX','screenY','shiftKey','which'
|
|
21
|
-
]
|
|
21
|
+
];
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const URL_IDENTIFIER_PATTERN=/\b(?:blob|data|file|ftp|ftps|http|https|ws|wss):/iu;
|
|
26
|
-
const URL_ATTRIBUTE_PATTERN=/^(?:action|cite|data|formaction|href|poster|src|srcset)$/iu;
|
|
27
|
-
const SENSITIVE_ATTRIBUTE_PATTERN=/(?:authorization|cookie|credential|password|secret|session|srcdoc|style|token|value|api[-_]?key)/iu;
|
|
28
|
-
|
|
29
|
-
function boundedString(value,maximum){
|
|
30
|
-
const text=String(value??'');
|
|
31
|
-
return text.length<=maximum?text:`${text.slice(0,maximum)}…`;
|
|
23
|
+
function capturedString(value){
|
|
24
|
+
return String(value??'');
|
|
32
25
|
}
|
|
33
26
|
|
|
34
27
|
function cssEscape(value){
|
|
@@ -44,14 +37,6 @@ function readAttribute(target,name){
|
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
39
|
|
|
47
|
-
function hasAttribute(target,name){
|
|
48
|
-
try{
|
|
49
|
-
return typeof target?.hasAttribute==='function'&&target.hasAttribute(name);
|
|
50
|
-
}catch{
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
40
|
function elementName(target){
|
|
56
41
|
return String(target?.localName??target?.tagName??'element').toLowerCase();
|
|
57
42
|
}
|
|
@@ -71,16 +56,10 @@ function siblingIndex(target){
|
|
|
71
56
|
|
|
72
57
|
function selectorSegment(target){
|
|
73
58
|
const id=String(target?.id??readAttribute(target,'id')??'');
|
|
74
|
-
if(id){
|
|
75
|
-
return URL_IDENTIFIER_PATTERN.test(id)?`${elementName(target)}[id]`:`#${cssEscape(id)}`;
|
|
76
|
-
}
|
|
59
|
+
if(id)return `#${cssEscape(id)}`;
|
|
77
60
|
for(const attribute of ['data-arcane-id','data-testid']){
|
|
78
61
|
const value=readAttribute(target,attribute);
|
|
79
|
-
if(value){
|
|
80
|
-
return URL_IDENTIFIER_PATTERN.test(value)
|
|
81
|
-
?`[${attribute}]`
|
|
82
|
-
:`[${attribute}="${cssEscape(value)}"]`;
|
|
83
|
-
}
|
|
62
|
+
if(value)return `[${attribute}="${cssEscape(value)}"]`;
|
|
84
63
|
}
|
|
85
64
|
const name=elementName(target);
|
|
86
65
|
const index=siblingIndex(target);
|
|
@@ -131,51 +110,29 @@ export function domSelector(target,root){
|
|
|
131
110
|
return groups.join(' >>> ')||selectorSegment(target);
|
|
132
111
|
}
|
|
133
112
|
|
|
134
|
-
function privateElement(target){
|
|
135
|
-
let current=target?.nodeType===3?target.parentElement??target.parentNode:target;
|
|
136
|
-
const visited=new Set();
|
|
137
|
-
while(current&&typeof current==='object'&&!visited.has(current)){
|
|
138
|
-
visited.add(current);
|
|
139
|
-
const type=String(current.type??readAttribute(current,'type')??'').toLowerCase();
|
|
140
|
-
const autocomplete=String(readAttribute(current,'autocomplete')??'').toLowerCase();
|
|
141
|
-
if(type==='password'||hasAttribute(current,'data-arcane-private')
|
|
142
|
-
||autocomplete.includes('password')){
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
if(current.parentElement){
|
|
146
|
-
current=current.parentElement;
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
let currentRoot=null;
|
|
150
|
-
try{currentRoot=current.getRootNode?.()??null;}catch{}
|
|
151
|
-
current=currentRoot?.host??null;
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
113
|
export function describeDOMTarget(target,root){
|
|
157
114
|
if(!target||typeof target!=='object')return null;
|
|
158
115
|
if(target.nodeType===9){
|
|
159
|
-
return
|
|
116
|
+
return {kind:'document',selector:':document'};
|
|
160
117
|
}
|
|
161
118
|
if(target.nodeType===11){
|
|
162
|
-
return
|
|
119
|
+
return {
|
|
163
120
|
kind:'shadow-root',
|
|
164
121
|
selector:domSelector(target.host,root),
|
|
165
122
|
host:target.host?describeDOMTarget(target.host,root):null
|
|
166
|
-
}
|
|
123
|
+
};
|
|
167
124
|
}
|
|
168
125
|
if(target.nodeType===3){
|
|
169
|
-
return
|
|
126
|
+
return {
|
|
170
127
|
kind:'text',
|
|
171
128
|
selector:domSelector(target,root),
|
|
172
|
-
|
|
173
|
-
}
|
|
129
|
+
content:String(target.data??target.textContent??'')
|
|
130
|
+
};
|
|
174
131
|
}
|
|
175
132
|
if(target.nodeType!==1&&target.localName===undefined&&target.tagName===undefined){
|
|
176
|
-
return
|
|
133
|
+
return {kind:target===globalThis?'global':'event-target',selector:null};
|
|
177
134
|
}
|
|
178
|
-
return
|
|
135
|
+
return {
|
|
179
136
|
kind:'element',
|
|
180
137
|
selector:domSelector(target,root),
|
|
181
138
|
tagName:elementName(target),
|
|
@@ -183,60 +140,44 @@ export function describeDOMTarget(target,root){
|
|
|
183
140
|
role:readAttribute(target,'role'),
|
|
184
141
|
name:readAttribute(target,'name'),
|
|
185
142
|
type:String(target.type??readAttribute(target,'type')??'')||null,
|
|
186
|
-
|
|
187
|
-
}
|
|
143
|
+
content:String(target.outerHTML??target.textContent??'')
|
|
144
|
+
};
|
|
188
145
|
}
|
|
189
146
|
|
|
190
|
-
function targetValue(target
|
|
191
|
-
if(!
|
|
192
|
-
if(privateElement(target))return '[REDACTED]';
|
|
147
|
+
function targetValue(target){
|
|
148
|
+
if(!target||typeof target!=='object')return undefined;
|
|
193
149
|
const type=String(target.type??'').toLowerCase();
|
|
194
150
|
if(type==='checkbox'||type==='radio')return Boolean(target.checked);
|
|
195
151
|
if(type==='file'){
|
|
196
|
-
return Array.from(target.files??[]
|
|
152
|
+
return Array.from(target.files??[]);
|
|
197
153
|
}
|
|
198
154
|
if(!('value' in target))return undefined;
|
|
199
|
-
|
|
200
|
-
if(value.length<=maxValueLength)return value;
|
|
201
|
-
return `${value.slice(0,maxValueLength)}…`;
|
|
155
|
+
return String(target.value??'');
|
|
202
156
|
}
|
|
203
157
|
|
|
204
|
-
function safeEventDetail(
|
|
205
|
-
if(
|
|
206
|
-
return '[REDACTED]';
|
|
207
|
-
}
|
|
208
|
-
if(field==='data'||field==='detail'){
|
|
209
|
-
if(!captureEventDetails)return value===null?null:'[REDACTED]';
|
|
210
|
-
}
|
|
211
|
-
if(field==='key'||field==='code'){
|
|
212
|
-
const text=String(value??'');
|
|
213
|
-
const sensitive=TEXT_ENTRY_EVENT_PATTERN.test(eventType)
|
|
214
|
-
&&(field==='code'||text.length===1||text==='Unidentified');
|
|
215
|
-
if(sensitive&&!captureEventDetails)return '[REDACTED]';
|
|
216
|
-
}
|
|
217
|
-
if(LEGACY_CHARACTER_CODE_PATTERN.test(field)
|
|
218
|
-
&&(isPrivate||(TEXT_ENTRY_EVENT_PATTERN.test(eventType)&&!captureEventDetails))){
|
|
219
|
-
return '[REDACTED]';
|
|
220
|
-
}
|
|
221
|
-
if(typeof value==='string')return boundedString(value,maxValueLength);
|
|
158
|
+
function safeEventDetail(value){
|
|
159
|
+
if(typeof value==='string')return capturedString(value);
|
|
222
160
|
if(value===null||typeof value==='number'||typeof value==='boolean')return value;
|
|
223
|
-
return
|
|
161
|
+
return value;
|
|
224
162
|
}
|
|
225
163
|
|
|
226
|
-
function interactionRecord(event,root
|
|
164
|
+
function interactionRecord(event,root){
|
|
227
165
|
const path=typeof event?.composedPath==='function'?event.composedPath():[event?.target];
|
|
228
166
|
const target=path.find(item=>item&&typeof item==='object')??event?.target??null;
|
|
229
|
-
const isPrivate=privateElement(target);
|
|
230
167
|
const eventType=String(event?.type??'');
|
|
231
168
|
const details={};
|
|
232
|
-
|
|
169
|
+
const fields=new Set([
|
|
170
|
+
...EVENT_FIELDS,
|
|
171
|
+
...Reflect.ownKeys(event??{}).filter(field=>typeof field==='string')
|
|
172
|
+
]);
|
|
173
|
+
for(const field of fields){
|
|
233
174
|
let value;
|
|
234
175
|
try{value=event?.[field];}catch{continue;}
|
|
235
176
|
if(value!==undefined&&typeof value!=='function'){
|
|
236
|
-
details[field]=safeEventDetail(
|
|
177
|
+
details[field]=safeEventDetail(value);
|
|
237
178
|
}
|
|
238
179
|
}
|
|
239
|
-
const value=targetValue(target
|
|
180
|
+
const value=targetValue(target);
|
|
240
181
|
return {
|
|
241
182
|
eventType,
|
|
242
183
|
target:describeDOMTarget(target,root),
|
|
@@ -251,31 +192,20 @@ function interactionRecord(event,root,options){
|
|
|
251
192
|
};
|
|
252
193
|
}
|
|
253
194
|
|
|
254
|
-
function serializeNode(node,root
|
|
195
|
+
function serializeNode(node,root){
|
|
255
196
|
const descriptor=describeDOMTarget(node,root);
|
|
256
|
-
if(privateContext||privateElement(node)){
|
|
257
|
-
return {target:descriptor,content:'[REDACTED]',truncated:false};
|
|
258
|
-
}
|
|
259
|
-
if(!captureNodeMarkup)return {target:descriptor,content:'[CONTENT OMITTED]',truncated:false};
|
|
260
197
|
let content='';
|
|
261
198
|
if(node?.nodeType===3||node?.nodeType===8)content=String(node.data??node.textContent??'');
|
|
262
199
|
else content=String(node?.outerHTML??node?.textContent??'');
|
|
263
|
-
|
|
264
|
-
return {
|
|
265
|
-
target:descriptor,
|
|
266
|
-
content:truncated?`${content.slice(0,maxSerializedNodeLength)}…`:content,
|
|
267
|
-
truncated
|
|
268
|
-
};
|
|
200
|
+
return {target:descriptor,content};
|
|
269
201
|
}
|
|
270
202
|
|
|
271
|
-
function attributeValue(value
|
|
203
|
+
function attributeValue(value){
|
|
272
204
|
if(value===null||value===undefined)return null;
|
|
273
|
-
|
|
274
|
-
if(URL_ATTRIBUTE_PATTERN.test(attributeName))return '[REDACTED URL]';
|
|
275
|
-
return boundedString(value,options.maxValueLength);
|
|
205
|
+
return capturedString(value);
|
|
276
206
|
}
|
|
277
207
|
|
|
278
|
-
function mutationRecord(record,root
|
|
208
|
+
function mutationRecord(record,root){
|
|
279
209
|
const target=describeDOMTarget(record?.target,root);
|
|
280
210
|
if(record?.type==='attributes'){
|
|
281
211
|
const attributeName=String(record.attributeName??'');
|
|
@@ -283,39 +213,37 @@ function mutationRecord(record,root,options){
|
|
|
283
213
|
return {
|
|
284
214
|
mutationType:'attributes',target,attributeName,
|
|
285
215
|
namespace:record.attributeNamespace??null,
|
|
286
|
-
before:attributeValue(record.oldValue
|
|
287
|
-
after:attributeValue(current
|
|
216
|
+
before:attributeValue(record.oldValue),
|
|
217
|
+
after:attributeValue(current)
|
|
288
218
|
};
|
|
289
219
|
}
|
|
290
220
|
if(record?.type==='characterData'){
|
|
291
|
-
const redacted=privateElement(record.target)||!options.captureNodeMarkup;
|
|
292
221
|
return {
|
|
293
222
|
mutationType:'characterData',target,
|
|
294
|
-
before:
|
|
295
|
-
after:
|
|
223
|
+
before:record.oldValue??null,
|
|
224
|
+
after:String(record.target?.data??record.target?.textContent??'')
|
|
296
225
|
};
|
|
297
226
|
}
|
|
298
|
-
const privateContext=privateElement(record?.target);
|
|
299
227
|
return {
|
|
300
228
|
mutationType:'childList',target,
|
|
301
229
|
previousSibling:describeDOMTarget(record?.previousSibling,root),
|
|
302
230
|
nextSibling:describeDOMTarget(record?.nextSibling,root),
|
|
303
231
|
added:Array.from(
|
|
304
|
-
record?.addedNodes??[],node=>serializeNode(node,root
|
|
232
|
+
record?.addedNodes??[],node=>serializeNode(node,root)
|
|
305
233
|
),
|
|
306
234
|
removed:Array.from(
|
|
307
|
-
record?.removedNodes??[],node=>serializeNode(node,root
|
|
235
|
+
record?.removedNodes??[],node=>serializeNode(node,root)
|
|
308
236
|
)
|
|
309
237
|
};
|
|
310
238
|
}
|
|
311
239
|
|
|
312
|
-
function rootDescription(root
|
|
240
|
+
function rootDescription(root){
|
|
313
241
|
if(root?.nodeType===9){
|
|
314
242
|
const title=String(root.title??'');
|
|
315
243
|
return {
|
|
316
244
|
kind:'document',
|
|
317
|
-
url:root.location?.href?
|
|
318
|
-
title:title?(
|
|
245
|
+
url:root.location?.href?capturedString(root.location.href):null,
|
|
246
|
+
title:title?capturedString(title):null,
|
|
319
247
|
root:describeDOMTarget(root.documentElement,root)
|
|
320
248
|
};
|
|
321
249
|
}
|
|
@@ -339,12 +267,7 @@ export function createDOMInstrumentation({
|
|
|
339
267
|
root=globalThis.document,
|
|
340
268
|
eventTypes=DEFAULT_DOM_EVENT_TYPES,
|
|
341
269
|
MutationObserver:MutationObserverImpl=globalThis.MutationObserver,
|
|
342
|
-
captureEventDetails=false,
|
|
343
|
-
captureInputValues=false,
|
|
344
|
-
captureNodeMarkup=false,
|
|
345
270
|
captureMutations=true,
|
|
346
|
-
maxValueLength=10_000,
|
|
347
|
-
maxSerializedNodeLength=100_000,
|
|
348
271
|
observeOpenShadowRoots=true
|
|
349
272
|
}={}){
|
|
350
273
|
if(!eventManager||typeof eventManager.emit!=='function'){
|
|
@@ -356,22 +279,10 @@ export function createDOMInstrumentation({
|
|
|
356
279
|
if(!Array.isArray(eventTypes)||eventTypes.some(type=>typeof type!=='string'||!type)){
|
|
357
280
|
throw new TypeError('DOM event types must be non-empty strings.');
|
|
358
281
|
}
|
|
359
|
-
eventTypes=
|
|
360
|
-
|
|
361
|
-
||!Number.isSafeInteger(maxSerializedNodeLength)||maxSerializedNodeLength<0){
|
|
362
|
-
throw new RangeError('DOM capture length limits must be non-negative safe integers.');
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
for(const [name,value] of Object.entries({
|
|
366
|
-
captureEventDetails,captureInputValues,captureNodeMarkup,captureMutations,observeOpenShadowRoots
|
|
367
|
-
})){
|
|
282
|
+
eventTypes=[...new Set(eventTypes)];
|
|
283
|
+
for(const [name,value] of Object.entries({captureMutations,observeOpenShadowRoots})){
|
|
368
284
|
if(typeof value!=='boolean')throw new TypeError(`${name} must be boolean.`);
|
|
369
285
|
}
|
|
370
|
-
|
|
371
|
-
const options={
|
|
372
|
-
captureEventDetails,captureInputValues,captureNodeMarkup,
|
|
373
|
-
maxValueLength,maxSerializedNodeLength
|
|
374
|
-
};
|
|
375
286
|
const observedRoots=new Set();
|
|
376
287
|
const listenerRegistrations=new Map();
|
|
377
288
|
let observer=null;
|
|
@@ -465,7 +376,7 @@ export function createDOMInstrumentation({
|
|
|
465
376
|
}
|
|
466
377
|
const record=publish(
|
|
467
378
|
DOM_INTERACTION_EVENT,
|
|
468
|
-
interactionRecord(event,root
|
|
379
|
+
interactionRecord(event,root),
|
|
469
380
|
{category:'interaction'}
|
|
470
381
|
);
|
|
471
382
|
if(record?.id){
|
|
@@ -515,7 +426,7 @@ export function createDOMInstrumentation({
|
|
|
515
426
|
|
|
516
427
|
const mutations=records=>{
|
|
517
428
|
for(const record of records){
|
|
518
|
-
publish(DOM_MUTATION_EVENT,mutationRecord(record,root
|
|
429
|
+
publish(DOM_MUTATION_EVENT,mutationRecord(record,root),{
|
|
519
430
|
category:'mutation',
|
|
520
431
|
...(pendingCausationId?{causationId:pendingCausationId}: {})
|
|
521
432
|
});
|
|
@@ -547,11 +458,8 @@ export function createDOMInstrumentation({
|
|
|
547
458
|
active=true;
|
|
548
459
|
cleanupPending=false;
|
|
549
460
|
publish(DOM_OBSERVATION_STARTED_EVENT,{
|
|
550
|
-
root:rootDescription(root
|
|
461
|
+
root:rootDescription(root),
|
|
551
462
|
eventTypes:[...eventTypes],
|
|
552
|
-
captureEventDetails,
|
|
553
|
-
captureInputValues,
|
|
554
|
-
captureNodeMarkup,
|
|
555
463
|
captureMutations,
|
|
556
464
|
observeOpenShadowRoots
|
|
557
465
|
},{category:'lifecycle'});
|
|
@@ -575,20 +483,20 @@ export function createDOMInstrumentation({
|
|
|
575
483
|
if(shouldEmitLifecycle){
|
|
576
484
|
publish(
|
|
577
485
|
DOM_OBSERVATION_STOPPED_EVENT,
|
|
578
|
-
{root:rootDescription(root
|
|
486
|
+
{root:rootDescription(root)},
|
|
579
487
|
{category:'lifecycle'}
|
|
580
488
|
);
|
|
581
489
|
}
|
|
582
490
|
return api;
|
|
583
491
|
}
|
|
584
492
|
|
|
585
|
-
const api=
|
|
493
|
+
const api={
|
|
586
494
|
root,
|
|
587
495
|
start,
|
|
588
496
|
stop,
|
|
589
497
|
get active(){return active;},
|
|
590
498
|
get cleanupPending(){return cleanupPending;},
|
|
591
499
|
get observedRootCount(){return observedRoots.size;}
|
|
592
|
-
}
|
|
500
|
+
};
|
|
593
501
|
return api;
|
|
594
502
|
}
|
package/src/errors.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const ERROR_CODES=
|
|
1
|
+
export const ERROR_CODES={
|
|
2
2
|
usage:'ARCANE_USAGE',
|
|
3
3
|
workspaceInvalid:'ARCANE_WORKSPACE_INVALID',
|
|
4
4
|
prerequisiteMissing:'ARCANE_PREREQUISITE_MISSING',
|
|
@@ -7,10 +7,9 @@ export const ERROR_CODES=Object.freeze({
|
|
|
7
7
|
nativeRunUnsupported:'ARCANE_NATIVE_RUN_UNSUPPORTED',
|
|
8
8
|
updateCheckFailed:'ARCANE_UPDATE_CHECK_FAILED',
|
|
9
9
|
policyDenied:'ARCANE_POLICY_DENIED',
|
|
10
|
-
integrityFailed:'ARCANE_INTEGRITY_FAILED',
|
|
11
10
|
operationFailed:'ARCANE_OPERATION_FAILED',
|
|
12
11
|
cancelled:'ARCANE_CANCELLED'
|
|
13
|
-
}
|
|
12
|
+
};
|
|
14
13
|
|
|
15
14
|
export class ArcaneError extends Error{
|
|
16
15
|
constructor(code,message,{details,cause,exitCode}={}){
|