@predicatelabs/sdk 0.99.9
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/LICENSE +24 -0
- package/README.md +252 -0
- package/dist/actions.d.ts +185 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +1120 -0
- package/dist/actions.js.map +1 -0
- package/dist/agent-runtime.d.ts +352 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +1170 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/agent.d.ts +164 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +408 -0
- package/dist/agent.js.map +1 -0
- package/dist/asserts/expect.d.ts +159 -0
- package/dist/asserts/expect.d.ts.map +1 -0
- package/dist/asserts/expect.js +547 -0
- package/dist/asserts/expect.js.map +1 -0
- package/dist/asserts/index.d.ts +58 -0
- package/dist/asserts/index.d.ts.map +1 -0
- package/dist/asserts/index.js +70 -0
- package/dist/asserts/index.js.map +1 -0
- package/dist/asserts/query.d.ts +199 -0
- package/dist/asserts/query.d.ts.map +1 -0
- package/dist/asserts/query.js +288 -0
- package/dist/asserts/query.js.map +1 -0
- package/dist/backends/actions.d.ts +119 -0
- package/dist/backends/actions.d.ts.map +1 -0
- package/dist/backends/actions.js +291 -0
- package/dist/backends/actions.js.map +1 -0
- package/dist/backends/browser-use-adapter.d.ts +131 -0
- package/dist/backends/browser-use-adapter.d.ts.map +1 -0
- package/dist/backends/browser-use-adapter.js +219 -0
- package/dist/backends/browser-use-adapter.js.map +1 -0
- package/dist/backends/cdp-backend.d.ts +66 -0
- package/dist/backends/cdp-backend.d.ts.map +1 -0
- package/dist/backends/cdp-backend.js +273 -0
- package/dist/backends/cdp-backend.js.map +1 -0
- package/dist/backends/index.d.ts +80 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +101 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/protocol.d.ts +156 -0
- package/dist/backends/protocol.d.ts.map +1 -0
- package/dist/backends/protocol.js +16 -0
- package/dist/backends/protocol.js.map +1 -0
- package/dist/backends/sentience-context.d.ts +143 -0
- package/dist/backends/sentience-context.d.ts.map +1 -0
- package/dist/backends/sentience-context.js +359 -0
- package/dist/backends/sentience-context.js.map +1 -0
- package/dist/backends/snapshot.d.ts +188 -0
- package/dist/backends/snapshot.d.ts.map +1 -0
- package/dist/backends/snapshot.js +360 -0
- package/dist/backends/snapshot.js.map +1 -0
- package/dist/browser.d.ts +154 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +920 -0
- package/dist/browser.js.map +1 -0
- package/dist/canonicalization.d.ts +126 -0
- package/dist/canonicalization.d.ts.map +1 -0
- package/dist/canonicalization.js +161 -0
- package/dist/canonicalization.js.map +1 -0
- package/dist/captcha/strategies.d.ts +12 -0
- package/dist/captcha/strategies.d.ts.map +1 -0
- package/dist/captcha/strategies.js +43 -0
- package/dist/captcha/strategies.js.map +1 -0
- package/dist/captcha/types.d.ts +45 -0
- package/dist/captcha/types.d.ts.map +1 -0
- package/dist/captcha/types.js +12 -0
- package/dist/captcha/types.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +422 -0
- package/dist/cli.js.map +1 -0
- package/dist/conversational-agent.d.ts +123 -0
- package/dist/conversational-agent.d.ts.map +1 -0
- package/dist/conversational-agent.js +341 -0
- package/dist/conversational-agent.js.map +1 -0
- package/dist/cursor-policy.d.ts +41 -0
- package/dist/cursor-policy.d.ts.map +1 -0
- package/dist/cursor-policy.js +81 -0
- package/dist/cursor-policy.js.map +1 -0
- package/dist/debugger.d.ts +28 -0
- package/dist/debugger.d.ts.map +1 -0
- package/dist/debugger.js +107 -0
- package/dist/debugger.js.map +1 -0
- package/dist/expect.d.ts +16 -0
- package/dist/expect.d.ts.map +1 -0
- package/dist/expect.js +67 -0
- package/dist/expect.js.map +1 -0
- package/dist/failure-artifacts.d.ts +95 -0
- package/dist/failure-artifacts.d.ts.map +1 -0
- package/dist/failure-artifacts.js +805 -0
- package/dist/failure-artifacts.js.map +1 -0
- package/dist/generator.d.ts +16 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +205 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector.d.ts +13 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +153 -0
- package/dist/inspector.js.map +1 -0
- package/dist/llm-provider.d.ts +144 -0
- package/dist/llm-provider.d.ts.map +1 -0
- package/dist/llm-provider.js +460 -0
- package/dist/llm-provider.js.map +1 -0
- package/dist/ordinal.d.ts +90 -0
- package/dist/ordinal.d.ts.map +1 -0
- package/dist/ordinal.js +249 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/overlay.d.ts +63 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +102 -0
- package/dist/overlay.js.map +1 -0
- package/dist/protocols/browser-protocol.d.ts +79 -0
- package/dist/protocols/browser-protocol.d.ts.map +1 -0
- package/dist/protocols/browser-protocol.js +9 -0
- package/dist/protocols/browser-protocol.js.map +1 -0
- package/dist/query.d.ts +66 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +482 -0
- package/dist/query.js.map +1 -0
- package/dist/read.d.ts +47 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +128 -0
- package/dist/read.js.map +1 -0
- package/dist/recorder.d.ts +44 -0
- package/dist/recorder.d.ts.map +1 -0
- package/dist/recorder.js +262 -0
- package/dist/recorder.js.map +1 -0
- package/dist/runtime-agent.d.ts +72 -0
- package/dist/runtime-agent.d.ts.map +1 -0
- package/dist/runtime-agent.js +357 -0
- package/dist/runtime-agent.js.map +1 -0
- package/dist/screenshot.d.ts +17 -0
- package/dist/screenshot.d.ts.map +1 -0
- package/dist/screenshot.js +40 -0
- package/dist/screenshot.js.map +1 -0
- package/dist/snapshot-diff.d.ts +23 -0
- package/dist/snapshot-diff.d.ts.map +1 -0
- package/dist/snapshot-diff.js +119 -0
- package/dist/snapshot-diff.js.map +1 -0
- package/dist/snapshot.d.ts +47 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +358 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/textSearch.d.ts +64 -0
- package/dist/textSearch.d.ts.map +1 -0
- package/dist/textSearch.js +113 -0
- package/dist/textSearch.js.map +1 -0
- package/dist/tools/context.d.ts +18 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +40 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/defaults.d.ts +5 -0
- package/dist/tools/defaults.d.ts.map +1 -0
- package/dist/tools/defaults.js +368 -0
- package/dist/tools/defaults.js.map +1 -0
- package/dist/tools/filesystem.d.ts +12 -0
- package/dist/tools/filesystem.d.ts.map +1 -0
- package/dist/tools/filesystem.js +137 -0
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +15 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +38 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +100 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tracing/cloud-sink.d.ts +189 -0
- package/dist/tracing/cloud-sink.d.ts.map +1 -0
- package/dist/tracing/cloud-sink.js +1067 -0
- package/dist/tracing/cloud-sink.js.map +1 -0
- package/dist/tracing/index-schema.d.ts +231 -0
- package/dist/tracing/index-schema.d.ts.map +1 -0
- package/dist/tracing/index-schema.js +235 -0
- package/dist/tracing/index-schema.js.map +1 -0
- package/dist/tracing/index.d.ts +12 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +28 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/indexer.d.ts +20 -0
- package/dist/tracing/indexer.d.ts.map +1 -0
- package/dist/tracing/indexer.js +347 -0
- package/dist/tracing/indexer.js.map +1 -0
- package/dist/tracing/jsonl-sink.d.ts +51 -0
- package/dist/tracing/jsonl-sink.d.ts.map +1 -0
- package/dist/tracing/jsonl-sink.js +329 -0
- package/dist/tracing/jsonl-sink.js.map +1 -0
- package/dist/tracing/sink.d.ts +25 -0
- package/dist/tracing/sink.d.ts.map +1 -0
- package/dist/tracing/sink.js +15 -0
- package/dist/tracing/sink.js.map +1 -0
- package/dist/tracing/tracer-factory.d.ts +102 -0
- package/dist/tracing/tracer-factory.d.ts.map +1 -0
- package/dist/tracing/tracer-factory.js +375 -0
- package/dist/tracing/tracer-factory.js.map +1 -0
- package/dist/tracing/tracer.d.ts +140 -0
- package/dist/tracing/tracer.d.ts.map +1 -0
- package/dist/tracing/tracer.js +336 -0
- package/dist/tracing/tracer.js.map +1 -0
- package/dist/tracing/types.d.ts +203 -0
- package/dist/tracing/types.d.ts.map +1 -0
- package/dist/tracing/types.js +8 -0
- package/dist/tracing/types.js.map +1 -0
- package/dist/types.d.ts +422 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/action-executor.d.ts +25 -0
- package/dist/utils/action-executor.d.ts.map +1 -0
- package/dist/utils/action-executor.js +121 -0
- package/dist/utils/action-executor.js.map +1 -0
- package/dist/utils/browser-evaluator.d.ts +76 -0
- package/dist/utils/browser-evaluator.d.ts.map +1 -0
- package/dist/utils/browser-evaluator.js +130 -0
- package/dist/utils/browser-evaluator.js.map +1 -0
- package/dist/utils/browser.d.ts +30 -0
- package/dist/utils/browser.d.ts.map +1 -0
- package/dist/utils/browser.js +75 -0
- package/dist/utils/browser.js.map +1 -0
- package/dist/utils/element-filter.d.ts +76 -0
- package/dist/utils/element-filter.d.ts.map +1 -0
- package/dist/utils/element-filter.js +195 -0
- package/dist/utils/element-filter.js.map +1 -0
- package/dist/utils/grid-utils.d.ts +37 -0
- package/dist/utils/grid-utils.d.ts.map +1 -0
- package/dist/utils/grid-utils.js +283 -0
- package/dist/utils/grid-utils.js.map +1 -0
- package/dist/utils/llm-interaction-handler.d.ts +41 -0
- package/dist/utils/llm-interaction-handler.d.ts.map +1 -0
- package/dist/utils/llm-interaction-handler.js +171 -0
- package/dist/utils/llm-interaction-handler.js.map +1 -0
- package/dist/utils/llm-response-builder.d.ts +56 -0
- package/dist/utils/llm-response-builder.d.ts.map +1 -0
- package/dist/utils/llm-response-builder.js +130 -0
- package/dist/utils/llm-response-builder.js.map +1 -0
- package/dist/utils/selector-utils.d.ts +12 -0
- package/dist/utils/selector-utils.d.ts.map +1 -0
- package/dist/utils/selector-utils.js +32 -0
- package/dist/utils/selector-utils.js.map +1 -0
- package/dist/utils/snapshot-event-builder.d.ts +28 -0
- package/dist/utils/snapshot-event-builder.d.ts.map +1 -0
- package/dist/utils/snapshot-event-builder.js +88 -0
- package/dist/utils/snapshot-event-builder.js.map +1 -0
- package/dist/utils/snapshot-processor.d.ts +27 -0
- package/dist/utils/snapshot-processor.d.ts.map +1 -0
- package/dist/utils/snapshot-processor.js +47 -0
- package/dist/utils/snapshot-processor.js.map +1 -0
- package/dist/utils/trace-event-builder.d.ts +122 -0
- package/dist/utils/trace-event-builder.d.ts.map +1 -0
- package/dist/utils/trace-event-builder.js +365 -0
- package/dist/utils/trace-event-builder.js.map +1 -0
- package/dist/utils/trace-file-manager.d.ts +70 -0
- package/dist/utils/trace-file-manager.d.ts.map +1 -0
- package/dist/utils/trace-file-manager.js +194 -0
- package/dist/utils/trace-file-manager.js.map +1 -0
- package/dist/utils/zod.d.ts +5 -0
- package/dist/utils/zod.d.ts.map +1 -0
- package/dist/utils/zod.js +80 -0
- package/dist/utils/zod.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +13 -0
- package/dist/utils.js.map +1 -0
- package/dist/verification.d.ts +194 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +530 -0
- package/dist/verification.js.map +1 -0
- package/dist/vision-executor.d.ts +18 -0
- package/dist/vision-executor.d.ts.map +1 -0
- package/dist/vision-executor.js +60 -0
- package/dist/vision-executor.js.map +1 -0
- package/dist/visual-agent.d.ts +120 -0
- package/dist/visual-agent.d.ts.map +1 -0
- package/dist/visual-agent.js +796 -0
- package/dist/visual-agent.js.map +1 -0
- package/dist/wait.d.ts +35 -0
- package/dist/wait.d.ts.map +1 -0
- package/dist/wait.js +76 -0
- package/dist/wait.js.map +1 -0
- package/package.json +94 -0
- package/spec/README.md +72 -0
- package/spec/SNAPSHOT_V1.md +208 -0
- package/spec/sdk-types.md +259 -0
- package/spec/snapshot.schema.json +148 -0
- package/src/extension/background.js +104 -0
- package/src/extension/content.js +162 -0
- package/src/extension/injected_api.js +1399 -0
- package/src/extension/manifest.json +36 -0
- package/src/extension/pkg/README.md +1340 -0
- package/src/extension/pkg/package.json +15 -0
- package/src/extension/pkg/sentience_core.d.ts +51 -0
- package/src/extension/pkg/sentience_core.js +371 -0
- package/src/extension/pkg/sentience_core_bg.wasm +0 -0
- package/src/extension/pkg/sentience_core_bg.wasm.d.ts +10 -0
- package/src/extension/release.json +116 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TraceEventBuilder - Common trace event building patterns
|
|
4
|
+
*
|
|
5
|
+
* This utility class extracts common trace event building logic to reduce duplication
|
|
6
|
+
* and ensure consistency across different parts of the codebase.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TraceEventBuilder = void 0;
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
11
|
+
/**
|
|
12
|
+
* TraceEventBuilder provides static methods for building trace events
|
|
13
|
+
*/
|
|
14
|
+
class TraceEventBuilder {
|
|
15
|
+
/**
|
|
16
|
+
* Compute SHA256 hash of text
|
|
17
|
+
*
|
|
18
|
+
* @param text - Text to hash
|
|
19
|
+
* @returns SHA256 hash as hex string
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
static computeHash(text) {
|
|
24
|
+
return (0, crypto_1.createHash)('sha256').update(text, 'utf8').digest('hex');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build snapshot digest from snapshot data
|
|
28
|
+
*
|
|
29
|
+
* @param snapshot - Snapshot to compute digest for
|
|
30
|
+
* @returns Digest string in format "sha256:..."
|
|
31
|
+
*/
|
|
32
|
+
static buildSnapshotDigest(snapshot) {
|
|
33
|
+
const digestInput = `${snapshot.url}${snapshot.timestamp || ''}`;
|
|
34
|
+
return `sha256:${this.computeHash(digestInput)}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build LLM usage data from LLM response
|
|
38
|
+
*
|
|
39
|
+
* @param llmResponse - LLM response object
|
|
40
|
+
* @returns LLM usage data for trace event
|
|
41
|
+
*/
|
|
42
|
+
static buildLLMData(llmResponse) {
|
|
43
|
+
const responseText = llmResponse.content;
|
|
44
|
+
const responseHash = `sha256:${this.computeHash(responseText)}`;
|
|
45
|
+
return {
|
|
46
|
+
model: llmResponse.modelName,
|
|
47
|
+
response_text: responseText,
|
|
48
|
+
response_hash: responseHash,
|
|
49
|
+
usage: {
|
|
50
|
+
prompt_tokens: llmResponse.promptTokens || 0,
|
|
51
|
+
completion_tokens: llmResponse.completionTokens || 0,
|
|
52
|
+
total_tokens: llmResponse.totalTokens || 0,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Build execution data from action result
|
|
58
|
+
*
|
|
59
|
+
* @param result - Agent action result
|
|
60
|
+
* @param snapshot - Snapshot used for the action
|
|
61
|
+
* @returns Execution data for trace event
|
|
62
|
+
*/
|
|
63
|
+
static buildExecutionData(result, snapshot) {
|
|
64
|
+
const execData = {
|
|
65
|
+
success: result.success,
|
|
66
|
+
action: result.action || 'unknown',
|
|
67
|
+
outcome: result.outcome ||
|
|
68
|
+
(result.success
|
|
69
|
+
? `Action ${result.action || 'unknown'} executed successfully`
|
|
70
|
+
: `Action ${result.action || 'unknown'} failed`),
|
|
71
|
+
duration_ms: result.durationMs,
|
|
72
|
+
};
|
|
73
|
+
if (result.cursor !== undefined) {
|
|
74
|
+
execData.cursor = result.cursor;
|
|
75
|
+
}
|
|
76
|
+
// Add optional exec fields
|
|
77
|
+
if (result.elementId !== undefined) {
|
|
78
|
+
execData.element_id = result.elementId;
|
|
79
|
+
// Add bounding box if element found
|
|
80
|
+
const element = snapshot.elements.find(e => e.id === result.elementId);
|
|
81
|
+
if (element) {
|
|
82
|
+
execData.bounding_box = {
|
|
83
|
+
x: element.bbox.x,
|
|
84
|
+
y: element.bbox.y,
|
|
85
|
+
width: element.bbox.width,
|
|
86
|
+
height: element.bbox.height,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (result.text !== undefined) {
|
|
91
|
+
execData.text = result.text;
|
|
92
|
+
}
|
|
93
|
+
if (result.key !== undefined) {
|
|
94
|
+
execData.key = result.key;
|
|
95
|
+
}
|
|
96
|
+
if (result.error !== undefined) {
|
|
97
|
+
execData.error = result.error;
|
|
98
|
+
}
|
|
99
|
+
return execData;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Build verify data from action result
|
|
103
|
+
*
|
|
104
|
+
* @param result - Agent action result
|
|
105
|
+
* @param snapshot - Snapshot used for the action
|
|
106
|
+
* @returns Verify data for trace event
|
|
107
|
+
*/
|
|
108
|
+
static buildVerifyData(result, snapshot) {
|
|
109
|
+
const verifyPassed = result.success && (result.urlChanged || result.action !== 'click');
|
|
110
|
+
const verifySignals = {
|
|
111
|
+
passed: verifyPassed,
|
|
112
|
+
signals: {
|
|
113
|
+
url_changed: result.urlChanged || false,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
if (result.error) {
|
|
117
|
+
verifySignals.signals.error = result.error;
|
|
118
|
+
}
|
|
119
|
+
// Add elements_found array if element was targeted
|
|
120
|
+
if (result.elementId !== undefined) {
|
|
121
|
+
const element = snapshot.elements.find(e => e.id === result.elementId);
|
|
122
|
+
if (element) {
|
|
123
|
+
verifySignals.signals.elements_found = [
|
|
124
|
+
{
|
|
125
|
+
label: `Element ${result.elementId}`,
|
|
126
|
+
bounding_box: {
|
|
127
|
+
x: element.bbox.x,
|
|
128
|
+
y: element.bbox.y,
|
|
129
|
+
width: element.bbox.width,
|
|
130
|
+
height: element.bbox.height,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return verifySignals;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Build complete step_end event data
|
|
140
|
+
*
|
|
141
|
+
* @param params - Parameters for building step_end event
|
|
142
|
+
* @returns Complete step_end event data
|
|
143
|
+
*/
|
|
144
|
+
static buildStepEndData(params) {
|
|
145
|
+
const { stepId, stepIndex, goal, attempt, preUrl, postUrl, postSnapshotDigest, snapshot, llmResponse, result, } = params;
|
|
146
|
+
const snapshotDigest = this.buildSnapshotDigest(snapshot);
|
|
147
|
+
const llmData = this.buildLLMData(llmResponse);
|
|
148
|
+
const execData = this.buildExecutionData(result, snapshot);
|
|
149
|
+
const verifyData = this.buildVerifyData(result, snapshot);
|
|
150
|
+
// Build elements data for pre field (include diff_status from snapshot)
|
|
151
|
+
// Normalize importance values to importance_score (0-1 range) per snapshot
|
|
152
|
+
const importanceValues = snapshot.elements.map(el => el.importance);
|
|
153
|
+
const minImportance = importanceValues.length > 0 ? Math.min(...importanceValues) : 0;
|
|
154
|
+
const maxImportance = importanceValues.length > 0 ? Math.max(...importanceValues) : 0;
|
|
155
|
+
const importanceRange = maxImportance - minImportance;
|
|
156
|
+
const preElements = snapshot.elements.map(el => {
|
|
157
|
+
// Compute normalized importance_score
|
|
158
|
+
let importanceScore;
|
|
159
|
+
if (importanceRange > 0) {
|
|
160
|
+
importanceScore = (el.importance - minImportance) / importanceRange;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
importanceScore = 0.5;
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
id: el.id,
|
|
167
|
+
role: el.role,
|
|
168
|
+
text: el.text,
|
|
169
|
+
bbox: el.bbox,
|
|
170
|
+
importance: el.importance,
|
|
171
|
+
importance_score: importanceScore,
|
|
172
|
+
visual_cues: el.visual_cues,
|
|
173
|
+
in_viewport: el.in_viewport,
|
|
174
|
+
is_occluded: el.is_occluded,
|
|
175
|
+
z_index: el.z_index,
|
|
176
|
+
fused_rank_index: el.fused_rank_index,
|
|
177
|
+
heuristic_index: el.heuristic_index,
|
|
178
|
+
ml_probability: el.ml_probability,
|
|
179
|
+
ml_score: el.ml_score,
|
|
180
|
+
diff_status: el.diff_status,
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
v: 1,
|
|
185
|
+
step_id: stepId,
|
|
186
|
+
step_index: stepIndex,
|
|
187
|
+
goal: goal,
|
|
188
|
+
attempt: attempt,
|
|
189
|
+
pre: {
|
|
190
|
+
url: preUrl,
|
|
191
|
+
snapshot_digest: snapshotDigest,
|
|
192
|
+
elements: preElements, // Add elements array with diff_status
|
|
193
|
+
},
|
|
194
|
+
llm: llmData,
|
|
195
|
+
exec: execData,
|
|
196
|
+
post: {
|
|
197
|
+
url: postUrl || undefined,
|
|
198
|
+
snapshot_digest: postSnapshotDigest,
|
|
199
|
+
},
|
|
200
|
+
verify: verifyData,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Build step_end event data for AgentRuntime (verification loop).
|
|
205
|
+
*/
|
|
206
|
+
static buildRuntimeStepEndData(params) {
|
|
207
|
+
const { stepId, stepIndex, goal, attempt, preUrl, postUrl, preSnapshotDigest, postSnapshotDigest, execData, verifyData, assertions, taskDone, taskDoneLabel, } = params;
|
|
208
|
+
const signals = { ...(verifyData?.signals || {}) };
|
|
209
|
+
if (assertions && assertions.length > 0) {
|
|
210
|
+
signals.assertions = assertions;
|
|
211
|
+
}
|
|
212
|
+
if (typeof taskDone === 'boolean') {
|
|
213
|
+
signals.task_done = taskDone;
|
|
214
|
+
}
|
|
215
|
+
if (taskDoneLabel) {
|
|
216
|
+
signals.task_done_label = taskDoneLabel;
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
v: 1,
|
|
220
|
+
step_id: stepId,
|
|
221
|
+
step_index: stepIndex,
|
|
222
|
+
goal,
|
|
223
|
+
attempt,
|
|
224
|
+
pre: {
|
|
225
|
+
url: preUrl,
|
|
226
|
+
snapshot_digest: preSnapshotDigest,
|
|
227
|
+
},
|
|
228
|
+
llm: {},
|
|
229
|
+
exec: execData,
|
|
230
|
+
post: {
|
|
231
|
+
url: postUrl,
|
|
232
|
+
snapshot_digest: postSnapshotDigest,
|
|
233
|
+
},
|
|
234
|
+
verify: {
|
|
235
|
+
passed: verifyData?.passed ?? false,
|
|
236
|
+
signals,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Build snapshot event data
|
|
242
|
+
*
|
|
243
|
+
* @param snapshot - Snapshot to build event data for
|
|
244
|
+
* @param goal - Optional goal/task description
|
|
245
|
+
* @returns Snapshot event data
|
|
246
|
+
*/
|
|
247
|
+
static buildSnapshotData(snapshot, goal) {
|
|
248
|
+
const data = {
|
|
249
|
+
url: snapshot.url,
|
|
250
|
+
element_count: snapshot.elements.length,
|
|
251
|
+
timestamp: snapshot.timestamp,
|
|
252
|
+
};
|
|
253
|
+
if (goal) {
|
|
254
|
+
data.goal = goal;
|
|
255
|
+
}
|
|
256
|
+
// Convert elements to trace elements (simplified - just include IDs and basic info)
|
|
257
|
+
if (snapshot.elements.length > 0) {
|
|
258
|
+
data.elements = snapshot.elements.slice(0, 100).map((el) => ({
|
|
259
|
+
id: el.id,
|
|
260
|
+
role: el.role,
|
|
261
|
+
text: el.text || undefined,
|
|
262
|
+
importance: el.importance,
|
|
263
|
+
bbox: {
|
|
264
|
+
x: el.bbox.x,
|
|
265
|
+
y: el.bbox.y,
|
|
266
|
+
width: el.bbox.width,
|
|
267
|
+
height: el.bbox.height,
|
|
268
|
+
},
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
if (snapshot.screenshot) {
|
|
272
|
+
data.screenshot_base64 = snapshot.screenshot;
|
|
273
|
+
data.screenshot_format = snapshot.screenshot_format || 'png';
|
|
274
|
+
}
|
|
275
|
+
return data;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Build partial step_end event data for failed steps
|
|
279
|
+
*
|
|
280
|
+
* This is used when a step fails after collecting some data (snapshot, LLM response, etc.)
|
|
281
|
+
* but before completing execution. It ensures diff_status and other fields are preserved
|
|
282
|
+
* in traces even when the agent run fails.
|
|
283
|
+
*
|
|
284
|
+
* @param params - Parameters for building partial step_end event
|
|
285
|
+
* @returns Partial step_end event data
|
|
286
|
+
*/
|
|
287
|
+
static buildPartialStepEndData(params) {
|
|
288
|
+
const { stepId, stepIndex, goal, attempt, preUrl, postUrl, snapshot, postSnapshotDigest, llmResponse, error, durationMs, } = params;
|
|
289
|
+
// Build pre data
|
|
290
|
+
const preData = {
|
|
291
|
+
url: preUrl || undefined,
|
|
292
|
+
snapshot_digest: snapshot ? this.buildSnapshotDigest(snapshot) : undefined,
|
|
293
|
+
};
|
|
294
|
+
// Add elements with diff_status if snapshot is available
|
|
295
|
+
if (snapshot && snapshot.elements.length > 0) {
|
|
296
|
+
const importanceValues = snapshot.elements.map(el => el.importance);
|
|
297
|
+
const minImportance = importanceValues.length > 0 ? Math.min(...importanceValues) : 0;
|
|
298
|
+
const maxImportance = importanceValues.length > 0 ? Math.max(...importanceValues) : 0;
|
|
299
|
+
const importanceRange = maxImportance - minImportance;
|
|
300
|
+
preData.elements = snapshot.elements.map(el => {
|
|
301
|
+
let importanceScore;
|
|
302
|
+
if (importanceRange > 0) {
|
|
303
|
+
importanceScore = (el.importance - minImportance) / importanceRange;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
importanceScore = 0.5;
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
id: el.id,
|
|
310
|
+
role: el.role,
|
|
311
|
+
text: el.text,
|
|
312
|
+
bbox: el.bbox,
|
|
313
|
+
importance: el.importance,
|
|
314
|
+
importance_score: importanceScore,
|
|
315
|
+
visual_cues: el.visual_cues,
|
|
316
|
+
in_viewport: el.in_viewport,
|
|
317
|
+
is_occluded: el.is_occluded,
|
|
318
|
+
z_index: el.z_index,
|
|
319
|
+
fused_rank_index: el.fused_rank_index,
|
|
320
|
+
heuristic_index: el.heuristic_index,
|
|
321
|
+
ml_probability: el.ml_probability,
|
|
322
|
+
ml_score: el.ml_score,
|
|
323
|
+
diff_status: el.diff_status,
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
// Build LLM data if available
|
|
328
|
+
let llmData;
|
|
329
|
+
if (llmResponse) {
|
|
330
|
+
llmData = this.buildLLMData(llmResponse);
|
|
331
|
+
}
|
|
332
|
+
// Build exec data for failure
|
|
333
|
+
const execData = {
|
|
334
|
+
success: false,
|
|
335
|
+
action: 'error',
|
|
336
|
+
outcome: error,
|
|
337
|
+
duration_ms: durationMs,
|
|
338
|
+
error: error,
|
|
339
|
+
};
|
|
340
|
+
// Build verify data for failure
|
|
341
|
+
const verifyData = {
|
|
342
|
+
passed: false,
|
|
343
|
+
signals: {
|
|
344
|
+
error: error,
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
return {
|
|
348
|
+
v: 1,
|
|
349
|
+
step_id: stepId,
|
|
350
|
+
step_index: stepIndex,
|
|
351
|
+
goal: goal,
|
|
352
|
+
attempt: attempt,
|
|
353
|
+
pre: preData,
|
|
354
|
+
llm: llmData,
|
|
355
|
+
exec: execData,
|
|
356
|
+
post: {
|
|
357
|
+
url: postUrl || undefined,
|
|
358
|
+
snapshot_digest: postSnapshotDigest,
|
|
359
|
+
},
|
|
360
|
+
verify: verifyData,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
exports.TraceEventBuilder = TraceEventBuilder;
|
|
365
|
+
//# sourceMappingURL=trace-event-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-event-builder.js","sourceRoot":"","sources":["../../src/utils/trace-event-builder.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAMH,mCAAoC;AAEpC;;GAEG;AACH,MAAa,iBAAiB;IAC5B;;;;;;;OAOG;IACK,MAAM,CAAC,WAAW,CAAC,IAAY;QACrC,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAkB;QAC3C,MAAM,WAAW,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QACjE,OAAO,UAAU,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,WAAwB;QAC1C,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC;QACzC,MAAM,YAAY,GAAG,UAAU,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC;QAEhE,OAAO;YACL,KAAK,EAAE,WAAW,CAAC,SAAS;YAC5B,aAAa,EAAE,YAAY;YAC3B,aAAa,EAAE,YAAY;YAC3B,KAAK,EAAE;gBACL,aAAa,EAAE,WAAW,CAAC,YAAY,IAAI,CAAC;gBAC5C,iBAAiB,EAAE,WAAW,CAAC,gBAAgB,IAAI,CAAC;gBACpD,YAAY,EAAE,WAAW,CAAC,WAAW,IAAI,CAAC;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AAE,UAAU;SACnB,CAAC;IACJ,CAAC;CACF;AA/cD,8CA+cC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TraceFileManager - Common trace file operations
|
|
3
|
+
*
|
|
4
|
+
* Extracts common file operations from CloudTraceSink and JsonlTraceSink
|
|
5
|
+
* to reduce duplication and standardize error handling
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import { TraceEvent } from '../tracing/types';
|
|
9
|
+
export interface TraceFileOptions {
|
|
10
|
+
flags?: string;
|
|
11
|
+
encoding?: BufferEncoding;
|
|
12
|
+
autoClose?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* TraceFileManager provides static methods for common trace file operations
|
|
16
|
+
*/
|
|
17
|
+
export declare class TraceFileManager {
|
|
18
|
+
/**
|
|
19
|
+
* Ensure directory exists and is writable
|
|
20
|
+
*
|
|
21
|
+
* @param dirPath - Directory path to ensure exists
|
|
22
|
+
* @throws Error if directory cannot be created or is not writable
|
|
23
|
+
*/
|
|
24
|
+
static ensureDirectory(dirPath: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Create a write stream for trace file
|
|
27
|
+
*
|
|
28
|
+
* @param filePath - Path to trace file
|
|
29
|
+
* @param options - Stream options
|
|
30
|
+
* @returns WriteStream or null if creation fails
|
|
31
|
+
*/
|
|
32
|
+
static createWriteStream(filePath: string, options?: TraceFileOptions): fs.WriteStream | null;
|
|
33
|
+
/**
|
|
34
|
+
* Write a trace event as JSON line
|
|
35
|
+
*
|
|
36
|
+
* @param stream - Write stream
|
|
37
|
+
* @param event - Trace event to write
|
|
38
|
+
* @returns True if written successfully, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
static writeEvent(stream: fs.WriteStream, event: TraceEvent): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Close and flush a write stream
|
|
43
|
+
*
|
|
44
|
+
* @param stream - Write stream to close
|
|
45
|
+
* @returns Promise that resolves when stream is closed
|
|
46
|
+
*/
|
|
47
|
+
static closeStream(stream: fs.WriteStream): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a file exists
|
|
50
|
+
*
|
|
51
|
+
* @param filePath - File path to check
|
|
52
|
+
* @returns True if file exists, false otherwise
|
|
53
|
+
*/
|
|
54
|
+
static fileExists(filePath: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Get file size in bytes
|
|
57
|
+
*
|
|
58
|
+
* @param filePath - File path
|
|
59
|
+
* @returns File size in bytes, or 0 if file doesn't exist
|
|
60
|
+
*/
|
|
61
|
+
static getFileSize(filePath: string): number;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a file safely
|
|
64
|
+
*
|
|
65
|
+
* @param filePath - File path to delete
|
|
66
|
+
* @returns True if deleted successfully, false otherwise
|
|
67
|
+
*/
|
|
68
|
+
static deleteFile(filePath: string): boolean;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=trace-file-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-file-manager.d.ts","sourceRoot":"","sources":["../../src/utils/trace-file-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAY7C;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,EAAE,CAAC,WAAW,GAAG,IAAI;IAkBxB;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO;IAmBrE;;;;;OAKG;WACU,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB/D;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQ5C;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAY5C;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAY7C"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TraceFileManager - Common trace file operations
|
|
4
|
+
*
|
|
5
|
+
* Extracts common file operations from CloudTraceSink and JsonlTraceSink
|
|
6
|
+
* to reduce duplication and standardize error handling
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.TraceFileManager = void 0;
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
/**
|
|
46
|
+
* TraceFileManager provides static methods for common trace file operations
|
|
47
|
+
*/
|
|
48
|
+
class TraceFileManager {
|
|
49
|
+
/**
|
|
50
|
+
* Ensure directory exists and is writable
|
|
51
|
+
*
|
|
52
|
+
* @param dirPath - Directory path to ensure exists
|
|
53
|
+
* @throws Error if directory cannot be created or is not writable
|
|
54
|
+
*/
|
|
55
|
+
static ensureDirectory(dirPath) {
|
|
56
|
+
try {
|
|
57
|
+
if (!fs.existsSync(dirPath)) {
|
|
58
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
// Verify directory is writable
|
|
61
|
+
fs.accessSync(dirPath, fs.constants.W_OK);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw new Error(`Failed to create or access directory ${dirPath}: ${error}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a write stream for trace file
|
|
69
|
+
*
|
|
70
|
+
* @param filePath - Path to trace file
|
|
71
|
+
* @param options - Stream options
|
|
72
|
+
* @returns WriteStream or null if creation fails
|
|
73
|
+
*/
|
|
74
|
+
static createWriteStream(filePath, options = {}) {
|
|
75
|
+
try {
|
|
76
|
+
const dir = path.dirname(filePath);
|
|
77
|
+
this.ensureDirectory(dir);
|
|
78
|
+
const stream = fs.createWriteStream(filePath, {
|
|
79
|
+
flags: options.flags || 'a',
|
|
80
|
+
encoding: options.encoding || 'utf-8',
|
|
81
|
+
autoClose: options.autoClose !== false,
|
|
82
|
+
});
|
|
83
|
+
return stream;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error(`[TraceFileManager] Failed to create write stream for ${filePath}:`, error);
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Write a trace event as JSON line
|
|
92
|
+
*
|
|
93
|
+
* @param stream - Write stream
|
|
94
|
+
* @param event - Trace event to write
|
|
95
|
+
* @returns True if written successfully, false otherwise
|
|
96
|
+
*/
|
|
97
|
+
static writeEvent(stream, event) {
|
|
98
|
+
try {
|
|
99
|
+
const jsonLine = JSON.stringify(event) + '\n';
|
|
100
|
+
const written = stream.write(jsonLine);
|
|
101
|
+
// Handle backpressure
|
|
102
|
+
if (!written) {
|
|
103
|
+
stream.once('drain', () => {
|
|
104
|
+
// Stream is ready again
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error('[TraceFileManager] Failed to write event:', error);
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Close and flush a write stream
|
|
116
|
+
*
|
|
117
|
+
* @param stream - Write stream to close
|
|
118
|
+
* @returns Promise that resolves when stream is closed
|
|
119
|
+
*/
|
|
120
|
+
static async closeStream(stream) {
|
|
121
|
+
return new Promise((resolve, reject) => {
|
|
122
|
+
if (stream.destroyed) {
|
|
123
|
+
resolve();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
stream.end(() => {
|
|
127
|
+
resolve();
|
|
128
|
+
});
|
|
129
|
+
stream.once('error', error => {
|
|
130
|
+
reject(error);
|
|
131
|
+
});
|
|
132
|
+
// Timeout after 5 seconds
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
if (!stream.destroyed) {
|
|
135
|
+
stream.destroy();
|
|
136
|
+
resolve();
|
|
137
|
+
}
|
|
138
|
+
}, 5000);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Check if a file exists
|
|
143
|
+
*
|
|
144
|
+
* @param filePath - File path to check
|
|
145
|
+
* @returns True if file exists, false otherwise
|
|
146
|
+
*/
|
|
147
|
+
static fileExists(filePath) {
|
|
148
|
+
try {
|
|
149
|
+
return fs.existsSync(filePath);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get file size in bytes
|
|
157
|
+
*
|
|
158
|
+
* @param filePath - File path
|
|
159
|
+
* @returns File size in bytes, or 0 if file doesn't exist
|
|
160
|
+
*/
|
|
161
|
+
static getFileSize(filePath) {
|
|
162
|
+
try {
|
|
163
|
+
if (fs.existsSync(filePath)) {
|
|
164
|
+
const stats = fs.statSync(filePath);
|
|
165
|
+
return stats.size;
|
|
166
|
+
}
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Delete a file safely
|
|
175
|
+
*
|
|
176
|
+
* @param filePath - File path to delete
|
|
177
|
+
* @returns True if deleted successfully, false otherwise
|
|
178
|
+
*/
|
|
179
|
+
static deleteFile(filePath) {
|
|
180
|
+
try {
|
|
181
|
+
if (fs.existsSync(filePath)) {
|
|
182
|
+
fs.unlinkSync(filePath);
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
console.error(`[TraceFileManager] Failed to delete file ${filePath}:`, error);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.TraceFileManager = TraceFileManager;
|
|
194
|
+
//# sourceMappingURL=trace-file-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-file-manager.js","sourceRoot":"","sources":["../../src/utils/trace-file-manager.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAS7B;;GAEG;AACH,MAAa,gBAAgB;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,OAAe;QACpC,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7C,CAAC;YACD,+BAA+B;YAC/B,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CACtB,QAAgB,EAChB,UAA4B,EAAE;QAE9B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAE1B,MAAM,MAAM,GAAG,EA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