@nuanu-ai/agentbrowse 0.2.47 → 0.2.49
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/README.md +81 -10
- package/dist/agentpay-gateway.d.ts +9 -0
- package/dist/agentpay-gateway.d.ts.map +1 -1
- package/dist/agentpay-gateway.js +31 -1
- package/dist/agentpay-stagehand-llm.d.ts.map +1 -1
- package/dist/agentpay-stagehand-llm.js +9 -1
- package/dist/command-api-tracing.d.ts +19 -0
- package/dist/command-api-tracing.d.ts.map +1 -0
- package/dist/command-api-tracing.js +137 -0
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +822 -670
- package/dist/commands/act.test-harness.d.ts +6 -0
- package/dist/commands/act.test-harness.d.ts.map +1 -1
- package/dist/commands/act.test-harness.js +44 -1
- package/dist/commands/action-acceptance.d.ts.map +1 -1
- package/dist/commands/action-acceptance.js +115 -0
- package/dist/commands/captcha-solve.d.ts.map +1 -1
- package/dist/commands/captcha-solve.js +83 -16
- package/dist/commands/click-action-executor.d.ts +0 -1
- package/dist/commands/click-action-executor.d.ts.map +1 -1
- package/dist/commands/click-action-executor.js +31 -77
- package/dist/commands/close.d.ts +3 -3
- package/dist/commands/close.d.ts.map +1 -1
- package/dist/commands/close.js +178 -0
- package/dist/commands/descriptor-validation.d.ts.map +1 -1
- package/dist/commands/descriptor-validation.js +75 -57
- package/dist/commands/end-session.d.ts +25 -0
- package/dist/commands/end-session.d.ts.map +1 -0
- package/dist/commands/end-session.js +161 -0
- package/dist/commands/extract-stagehand-executor.js +1 -1
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +339 -202
- package/dist/commands/fill-secret.d.ts +3 -3
- package/dist/commands/fill-secret.d.ts.map +1 -1
- package/dist/commands/fill-secret.js +419 -234
- package/dist/commands/get-secrets-catalog.d.ts.map +1 -1
- package/dist/commands/get-secrets-catalog.js +66 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +6 -3
- package/dist/commands/interaction-kernel.d.ts +46 -0
- package/dist/commands/interaction-kernel.d.ts.map +1 -0
- package/dist/commands/interaction-kernel.js +215 -0
- package/dist/commands/launch.d.ts +1 -3
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +115 -27
- package/dist/commands/navigate.d.ts.map +1 -1
- package/dist/commands/navigate.js +188 -45
- package/dist/commands/observe-accessibility.d.ts.map +1 -1
- package/dist/commands/observe-accessibility.js +46 -39
- package/dist/commands/observe-dom-label-contract.d.ts.map +1 -1
- package/dist/commands/observe-dom-label-contract.js +5 -0
- package/dist/commands/observe-inventory.d.ts +13 -0
- package/dist/commands/observe-inventory.d.ts.map +1 -1
- package/dist/commands/observe-inventory.js +320 -65
- package/dist/commands/observe-persistence.d.ts.map +1 -1
- package/dist/commands/observe-persistence.js +3 -0
- package/dist/commands/observe-projection.d.ts +1 -0
- package/dist/commands/observe-projection.d.ts.map +1 -1
- package/dist/commands/observe-projection.js +7 -2
- package/dist/commands/observe-protected.d.ts +1 -0
- package/dist/commands/observe-protected.d.ts.map +1 -1
- package/dist/commands/observe-protected.js +9 -4
- package/dist/commands/observe-semantics.d.ts.map +1 -1
- package/dist/commands/observe-semantics.js +5 -2
- package/dist/commands/observe-stagehand.d.ts +1 -0
- package/dist/commands/observe-stagehand.d.ts.map +1 -1
- package/dist/commands/observe-stagehand.js +2 -0
- package/dist/commands/observe.d.ts +2 -0
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +387 -203
- package/dist/commands/observe.test-harness.d.ts +8 -0
- package/dist/commands/observe.test-harness.d.ts.map +1 -1
- package/dist/commands/observe.test-harness.js +48 -1
- package/dist/commands/poll-secret.d.ts +6 -0
- package/dist/commands/poll-secret.d.ts.map +1 -0
- package/dist/commands/poll-secret.js +159 -0
- package/dist/commands/request-secret.d.ts +6 -0
- package/dist/commands/request-secret.d.ts.map +1 -0
- package/dist/commands/request-secret.js +284 -0
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/screenshot.js +172 -7
- package/dist/commands/select-action-executor.d.ts.map +1 -1
- package/dist/commands/semantic-observe.d.ts +4 -0
- package/dist/commands/semantic-observe.d.ts.map +1 -1
- package/dist/commands/semantic-observe.js +388 -17
- package/dist/commands/start-session.d.ts +31 -0
- package/dist/commands/start-session.d.ts.map +1 -0
- package/dist/commands/start-session.js +347 -0
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +166 -144
- package/dist/control-semantics.d.ts +1 -0
- package/dist/control-semantics.d.ts.map +1 -1
- package/dist/control-semantics.js +51 -9
- package/dist/generated/build-config.d.ts +2 -0
- package/dist/generated/build-config.d.ts.map +1 -0
- package/dist/generated/build-config.js +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -63
- package/dist/otel-exporter.d.ts +58 -0
- package/dist/otel-exporter.d.ts.map +1 -0
- package/dist/otel-exporter.js +263 -0
- package/dist/otel-projector.d.ts +75 -0
- package/dist/otel-projector.d.ts.map +1 -0
- package/dist/otel-projector.js +409 -0
- package/dist/owned-browser.d.ts +1 -1
- package/dist/owned-browser.d.ts.map +1 -1
- package/dist/owned-browser.js +13 -1
- package/dist/owned-process.d.ts +2 -0
- package/dist/owned-process.d.ts.map +1 -1
- package/dist/owned-process.js +7 -3
- package/dist/playwright-runtime.d.ts +1 -1
- package/dist/playwright-runtime.d.ts.map +1 -1
- package/dist/playwright-runtime.js +8 -8
- package/dist/run-observability.d.ts +25 -0
- package/dist/run-observability.d.ts.map +1 -0
- package/dist/run-observability.js +115 -0
- package/dist/run-store.d.ts +274 -0
- package/dist/run-store.d.ts.map +1 -0
- package/dist/run-store.js +631 -0
- package/dist/runtime-metrics.d.ts +27 -0
- package/dist/runtime-metrics.d.ts.map +1 -0
- package/dist/runtime-metrics.js +66 -0
- package/dist/runtime-page-state.d.ts +11 -0
- package/dist/runtime-page-state.d.ts.map +1 -0
- package/dist/runtime-page-state.js +62 -0
- package/dist/runtime-protected-state.d.ts +16 -0
- package/dist/runtime-protected-state.d.ts.map +1 -0
- package/dist/runtime-protected-state.js +157 -0
- package/dist/runtime-state.d.ts +10 -44
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +57 -222
- package/dist/secrets/backend.d.ts +65 -16
- package/dist/secrets/backend.d.ts.map +1 -1
- package/dist/secrets/backend.js +135 -95
- package/dist/secrets/catalog-sync.d.ts.map +1 -1
- package/dist/secrets/catalog-sync.js +4 -1
- package/dist/secrets/form-matcher.d.ts +5 -5
- package/dist/secrets/form-matcher.d.ts.map +1 -1
- package/dist/secrets/form-matcher.js +292 -164
- package/dist/secrets/intent-output.d.ts +6 -10
- package/dist/secrets/intent-output.d.ts.map +1 -1
- package/dist/secrets/intent-output.js +4 -58
- package/dist/secrets/mock-agentpay-cabinet.d.ts +38 -27
- package/dist/secrets/mock-agentpay-cabinet.d.ts.map +1 -1
- package/dist/secrets/mock-agentpay-cabinet.js +177 -111
- package/dist/secrets/protected-artifact-guard.d.ts +2 -2
- package/dist/secrets/protected-artifact-guard.d.ts.map +1 -1
- package/dist/secrets/protected-artifact-guard.js +2 -2
- package/dist/secrets/protected-bindings.d.ts +1 -1
- package/dist/secrets/protected-bindings.d.ts.map +1 -1
- package/dist/secrets/protected-bindings.js +6 -0
- package/dist/secrets/protected-field-semantics.d.ts +9 -0
- package/dist/secrets/protected-field-semantics.d.ts.map +1 -0
- package/dist/secrets/protected-field-semantics.js +154 -0
- package/dist/secrets/protected-field-values.d.ts.map +1 -1
- package/dist/secrets/protected-field-values.js +3 -3
- package/dist/secrets/protected-fill.d.ts +1 -1
- package/dist/secrets/protected-fill.d.ts.map +1 -1
- package/dist/secrets/protected-fill.js +45 -149
- package/dist/secrets/protected-value-adapters.d.ts +2 -1
- package/dist/secrets/protected-value-adapters.d.ts.map +1 -1
- package/dist/secrets/protected-value-adapters.js +80 -1
- package/dist/secrets/request-output.d.ts +11 -0
- package/dist/secrets/request-output.d.ts.map +1 -0
- package/dist/secrets/request-output.js +75 -0
- package/dist/secrets/types.d.ts +15 -9
- package/dist/secrets/types.d.ts.map +1 -1
- package/dist/secrets/types.js +3 -0
- package/dist/session-event-exporter.d.ts +36 -0
- package/dist/session-event-exporter.d.ts.map +1 -0
- package/dist/session-event-exporter.js +428 -0
- package/dist/session.d.ts +16 -7
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +150 -23
- package/dist/sessions-backend.d.ts +354 -0
- package/dist/sessions-backend.d.ts.map +1 -0
- package/dist/sessions-backend.js +126 -0
- package/dist/solver/browser-launcher.d.ts +1 -1
- package/dist/solver/browser-launcher.d.ts.map +1 -1
- package/dist/solver/browser-launcher.js +39 -13
- package/dist/solver/captcha-solver.d.ts.map +1 -1
- package/dist/solver/captcha-solver.js +8 -1
- package/dist/solver/config.d.ts +0 -1
- package/dist/solver/config.d.ts.map +1 -1
- package/dist/solver/config.js +0 -22
- package/dist/solver/types.d.ts +1 -0
- package/dist/solver/types.d.ts.map +1 -1
- package/dist/workflow-session-completion.d.ts +33 -0
- package/dist/workflow-session-completion.d.ts.map +1 -0
- package/dist/workflow-session-completion.js +156 -0
- package/package.json +11 -1
- package/dist/commands/create-intent.d.ts +0 -6
- package/dist/commands/create-intent.d.ts.map +0 -1
- package/dist/commands/create-intent.js +0 -75
- package/dist/commands/poll-intent.d.ts +0 -6
- package/dist/commands/poll-intent.d.ts.map +0 -1
- package/dist/commands/poll-intent.js +0 -57
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { listRunEventRecordsForStep, loadArtifactManifest, loadBrowserStateSnapshot, loadRunRecord, loadStepRecord, setRunIngestState, } from './run-store.js';
|
|
2
|
+
import { projectRunRootToOtlpTraceRequest, projectStepToOtlpTraceRequest, } from './otel-projector.js';
|
|
3
|
+
import { exportRunStepViaSessionEvent } from './session-event-exporter.js';
|
|
4
|
+
import { buildAgentpayTelemetryTracesUrl, tryResolveAgentpayGatewayConfig, } from './agentpay-gateway.js';
|
|
5
|
+
const DEFAULT_HTTP_TIMEOUT_MS = 5_000;
|
|
6
|
+
function trimEnv(value) {
|
|
7
|
+
const trimmed = value?.trim();
|
|
8
|
+
return trimmed ? trimmed : undefined;
|
|
9
|
+
}
|
|
10
|
+
function parseHeaderList(value) {
|
|
11
|
+
if (!value) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const headers = {};
|
|
15
|
+
for (const chunk of value.split(',')) {
|
|
16
|
+
const separatorIndex = chunk.indexOf('=');
|
|
17
|
+
if (separatorIndex === -1) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const key = chunk.slice(0, separatorIndex).trim();
|
|
21
|
+
const headerValue = chunk.slice(separatorIndex + 1).trim();
|
|
22
|
+
if (!key || !headerValue) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
headers[key] = headerValue;
|
|
26
|
+
}
|
|
27
|
+
return headers;
|
|
28
|
+
}
|
|
29
|
+
function parseTimeoutMs(value) {
|
|
30
|
+
const parsed = value ? Number(value) : NaN;
|
|
31
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_HTTP_TIMEOUT_MS;
|
|
32
|
+
}
|
|
33
|
+
function buildTracesEndpoint(base) {
|
|
34
|
+
return `${base.replace(/\/+$/, '')}/v1/traces`;
|
|
35
|
+
}
|
|
36
|
+
async function postOtlpTraceRequest(params) {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timeout = setTimeout(() => controller.abort(), params.config.timeoutMs);
|
|
39
|
+
try {
|
|
40
|
+
return await params.fetchImpl(params.config.tracesEndpoint, {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: {
|
|
43
|
+
'content-type': 'application/json',
|
|
44
|
+
...params.config.headers,
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify(params.payload),
|
|
47
|
+
signal: controller.signal,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function loadOtlpHttpJsonExporterConfig(env = process.env) {
|
|
55
|
+
const protocol = trimEnv(env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) ??
|
|
56
|
+
trimEnv(env.OTEL_EXPORTER_OTLP_PROTOCOL) ??
|
|
57
|
+
'http/json';
|
|
58
|
+
if (protocol !== 'http/json') {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const tracesEndpoint = trimEnv(env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT);
|
|
62
|
+
const baseEndpoint = trimEnv(env.OTEL_EXPORTER_OTLP_ENDPOINT);
|
|
63
|
+
const gateway = tryResolveAgentpayGatewayConfig();
|
|
64
|
+
const resolvedEndpoint = tracesEndpoint ??
|
|
65
|
+
(baseEndpoint ? buildTracesEndpoint(baseEndpoint) : null) ??
|
|
66
|
+
(gateway ? buildAgentpayTelemetryTracesUrl(gateway.apiUrl) : null);
|
|
67
|
+
if (!resolvedEndpoint) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const timeoutMs = parseTimeoutMs(trimEnv(env.OTEL_EXPORTER_OTLP_TRACES_TIMEOUT) ??
|
|
71
|
+
trimEnv(env.OTEL_EXPORTER_OTLP_TIMEOUT));
|
|
72
|
+
const headers = {
|
|
73
|
+
...parseHeaderList(trimEnv(env.OTEL_EXPORTER_OTLP_HEADERS)),
|
|
74
|
+
...parseHeaderList(trimEnv(env.OTEL_EXPORTER_OTLP_TRACES_HEADERS)),
|
|
75
|
+
};
|
|
76
|
+
if (!headers.authorization && gateway) {
|
|
77
|
+
headers.authorization = `Bearer ${gateway.apiKey}`;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
tracesEndpoint: resolvedEndpoint,
|
|
81
|
+
headers,
|
|
82
|
+
timeoutMs,
|
|
83
|
+
protocol: 'http/json',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export async function exportRunStepToOtlpHttpJson(params = {
|
|
87
|
+
runId: '',
|
|
88
|
+
stepId: '',
|
|
89
|
+
}) {
|
|
90
|
+
const run = loadRunRecord(params.runId);
|
|
91
|
+
if (!run) {
|
|
92
|
+
return { attempted: false, reason: 'run_missing' };
|
|
93
|
+
}
|
|
94
|
+
const step = loadStepRecord(params.runId, params.stepId);
|
|
95
|
+
if (!step) {
|
|
96
|
+
return { attempted: false, reason: 'step_missing' };
|
|
97
|
+
}
|
|
98
|
+
const payload = buildRunStepOtlpTraceRequest(params.runId, params.stepId);
|
|
99
|
+
if (!payload) {
|
|
100
|
+
return { attempted: false, reason: 'step_missing' };
|
|
101
|
+
}
|
|
102
|
+
const fetchImpl = params.fetchImpl ?? fetch;
|
|
103
|
+
const sessionEventResult = await exportRunStepViaSessionEvent({
|
|
104
|
+
runId: params.runId,
|
|
105
|
+
stepId: params.stepId,
|
|
106
|
+
telemetryPayload: payload,
|
|
107
|
+
fetchImpl,
|
|
108
|
+
});
|
|
109
|
+
if (sessionEventResult.attempted) {
|
|
110
|
+
if (sessionEventResult.success) {
|
|
111
|
+
return {
|
|
112
|
+
attempted: true,
|
|
113
|
+
success: true,
|
|
114
|
+
status: sessionEventResult.status,
|
|
115
|
+
payload,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
attempted: true,
|
|
120
|
+
success: false,
|
|
121
|
+
...(sessionEventResult.status !== undefined ? { status: sessionEventResult.status } : {}),
|
|
122
|
+
reason: sessionEventResult.reason,
|
|
123
|
+
payload,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const config = params.config ?? loadOtlpHttpJsonExporterConfig();
|
|
127
|
+
if (!config) {
|
|
128
|
+
return { attempted: false, reason: 'config_missing' };
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const response = await postOtlpTraceRequest({
|
|
132
|
+
payload,
|
|
133
|
+
config,
|
|
134
|
+
fetchImpl,
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
setRunIngestState(params.runId, 'export_failed');
|
|
138
|
+
return {
|
|
139
|
+
attempted: true,
|
|
140
|
+
success: false,
|
|
141
|
+
status: response.status,
|
|
142
|
+
reason: `otlp_http_status_${response.status}`,
|
|
143
|
+
payload,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
setRunIngestState(params.runId, 'exported');
|
|
147
|
+
return {
|
|
148
|
+
attempted: true,
|
|
149
|
+
success: true,
|
|
150
|
+
status: response.status,
|
|
151
|
+
payload,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
setRunIngestState(params.runId, 'export_failed');
|
|
156
|
+
return {
|
|
157
|
+
attempted: true,
|
|
158
|
+
success: false,
|
|
159
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
160
|
+
payload,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export function buildRunStepOtlpTraceRequest(runId, stepId) {
|
|
165
|
+
const run = loadRunRecord(runId);
|
|
166
|
+
if (!run) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const step = loadStepRecord(runId, stepId);
|
|
170
|
+
if (!step) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
return projectStepToOtlpTraceRequest({
|
|
174
|
+
run,
|
|
175
|
+
step,
|
|
176
|
+
events: listRunEventRecordsForStep(runId, stepId),
|
|
177
|
+
beforeSnapshot: step.beforeSnapshotId
|
|
178
|
+
? loadBrowserStateSnapshot(runId, step.beforeSnapshotId)
|
|
179
|
+
: null,
|
|
180
|
+
afterSnapshot: step.afterSnapshotId
|
|
181
|
+
? loadBrowserStateSnapshot(runId, step.afterSnapshotId)
|
|
182
|
+
: null,
|
|
183
|
+
artifactManifest: step.artifactManifestId
|
|
184
|
+
? loadArtifactManifest(runId, step.artifactManifestId)
|
|
185
|
+
: null,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
export async function exportRunRootToOtlpHttpJson(params = {
|
|
189
|
+
runId: '',
|
|
190
|
+
}) {
|
|
191
|
+
const config = params.config ?? loadOtlpHttpJsonExporterConfig();
|
|
192
|
+
if (!config) {
|
|
193
|
+
return { attempted: false, reason: 'config_missing' };
|
|
194
|
+
}
|
|
195
|
+
const run = loadRunRecord(params.runId);
|
|
196
|
+
if (!run) {
|
|
197
|
+
return { attempted: false, reason: 'run_missing' };
|
|
198
|
+
}
|
|
199
|
+
const payload = buildRunRootOtlpTraceRequest(params.runId);
|
|
200
|
+
if (!payload) {
|
|
201
|
+
return { attempted: false, reason: 'run_missing' };
|
|
202
|
+
}
|
|
203
|
+
const fetchImpl = params.fetchImpl ?? fetch;
|
|
204
|
+
try {
|
|
205
|
+
const response = await postOtlpTraceRequest({
|
|
206
|
+
payload,
|
|
207
|
+
config,
|
|
208
|
+
fetchImpl,
|
|
209
|
+
});
|
|
210
|
+
if (!response.ok) {
|
|
211
|
+
setRunIngestState(params.runId, 'export_failed');
|
|
212
|
+
return {
|
|
213
|
+
attempted: true,
|
|
214
|
+
success: false,
|
|
215
|
+
status: response.status,
|
|
216
|
+
reason: `otlp_http_status_${response.status}`,
|
|
217
|
+
payload,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
setRunIngestState(params.runId, 'exported');
|
|
221
|
+
return {
|
|
222
|
+
attempted: true,
|
|
223
|
+
success: true,
|
|
224
|
+
status: response.status,
|
|
225
|
+
payload,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
setRunIngestState(params.runId, 'export_failed');
|
|
230
|
+
return {
|
|
231
|
+
attempted: true,
|
|
232
|
+
success: false,
|
|
233
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
234
|
+
payload,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
export function buildRunRootOtlpTraceRequest(runId) {
|
|
239
|
+
const run = loadRunRecord(runId);
|
|
240
|
+
if (!run) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
return projectRunRootToOtlpTraceRequest({ run });
|
|
244
|
+
}
|
|
245
|
+
export async function exportRunStepToOtlpHttpJsonBestEffort(runId, stepId, options = {}) {
|
|
246
|
+
if (!runId || !stepId) {
|
|
247
|
+
return { attempted: false, reason: 'step_missing' };
|
|
248
|
+
}
|
|
249
|
+
return exportRunStepToOtlpHttpJson({
|
|
250
|
+
runId,
|
|
251
|
+
stepId,
|
|
252
|
+
fetchImpl: options.fetchImpl,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
export async function exportRunRootToOtlpHttpJsonBestEffort(runId, options = {}) {
|
|
256
|
+
if (!runId) {
|
|
257
|
+
return { attempted: false, reason: 'run_missing' };
|
|
258
|
+
}
|
|
259
|
+
return exportRunRootToOtlpHttpJson({
|
|
260
|
+
runId,
|
|
261
|
+
fetchImpl: options.fetchImpl,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ArtifactManifest, BrowserStateSnapshot, RunEventRecord, RunRecord, StepRecord } from './run-store.js';
|
|
2
|
+
type OtlpAnyValue = {
|
|
3
|
+
stringValue: string;
|
|
4
|
+
} | {
|
|
5
|
+
boolValue: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
intValue: string;
|
|
8
|
+
} | {
|
|
9
|
+
doubleValue: number;
|
|
10
|
+
} | {
|
|
11
|
+
arrayValue: {
|
|
12
|
+
values: OtlpAnyValue[];
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
kvlistValue: {
|
|
16
|
+
values: OtlpKeyValue[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type OtlpKeyValue = {
|
|
20
|
+
key: string;
|
|
21
|
+
value: OtlpAnyValue;
|
|
22
|
+
};
|
|
23
|
+
type OtlpSpanEvent = {
|
|
24
|
+
name: string;
|
|
25
|
+
timeUnixNano: string;
|
|
26
|
+
attributes?: OtlpKeyValue[];
|
|
27
|
+
};
|
|
28
|
+
type OtlpSpanLink = {
|
|
29
|
+
traceId: string;
|
|
30
|
+
spanId: string;
|
|
31
|
+
attributes?: OtlpKeyValue[];
|
|
32
|
+
};
|
|
33
|
+
type OtlpSpan = {
|
|
34
|
+
traceId: string;
|
|
35
|
+
spanId: string;
|
|
36
|
+
parentSpanId?: string;
|
|
37
|
+
name: string;
|
|
38
|
+
kind: number;
|
|
39
|
+
startTimeUnixNano: string;
|
|
40
|
+
endTimeUnixNano: string;
|
|
41
|
+
attributes?: OtlpKeyValue[];
|
|
42
|
+
events?: OtlpSpanEvent[];
|
|
43
|
+
links?: OtlpSpanLink[];
|
|
44
|
+
status?: {
|
|
45
|
+
code: number;
|
|
46
|
+
message?: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type OtlpTraceRequest = {
|
|
50
|
+
resourceSpans: Array<{
|
|
51
|
+
resource: {
|
|
52
|
+
attributes: OtlpKeyValue[];
|
|
53
|
+
};
|
|
54
|
+
scopeSpans: Array<{
|
|
55
|
+
scope: {
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
58
|
+
spans: OtlpSpan[];
|
|
59
|
+
}>;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
export declare function sanitizeUrlForTelemetry(url: string): string;
|
|
63
|
+
export declare function projectStepToOtlpTraceRequest(params: {
|
|
64
|
+
run: RunRecord;
|
|
65
|
+
step: StepRecord;
|
|
66
|
+
events?: RunEventRecord[];
|
|
67
|
+
beforeSnapshot?: BrowserStateSnapshot | null;
|
|
68
|
+
afterSnapshot?: BrowserStateSnapshot | null;
|
|
69
|
+
artifactManifest?: ArtifactManifest | null;
|
|
70
|
+
}): OtlpTraceRequest;
|
|
71
|
+
export declare function projectRunRootToOtlpTraceRequest(params: {
|
|
72
|
+
run: RunRecord;
|
|
73
|
+
}): OtlpTraceRequest;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=otel-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|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