opensteer 0.8.7 → 0.8.8
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 +7 -7
- package/dist/{chunk-IAA57HNW.js → chunk-3QJGBVWT.js} +388 -220
- package/dist/chunk-3QJGBVWT.js.map +1 -0
- package/dist/cli/bin.cjs +400 -232
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.js +2 -2
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.cjs +389 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/skills/opensteer/references/cli-reference.md +4 -4
- package/skills/opensteer/references/request-workflow.md +19 -19
- package/skills/opensteer/references/sdk-reference.md +14 -14
- package/dist/chunk-IAA57HNW.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1464,7 +1464,7 @@ var networkRecordSchema = objectSchema(
|
|
|
1464
1464
|
var networkQueryRecordSchema = objectSchema(
|
|
1465
1465
|
{
|
|
1466
1466
|
recordId: stringSchema({ minLength: 1 }),
|
|
1467
|
-
|
|
1467
|
+
capture: stringSchema({ minLength: 1 }),
|
|
1468
1468
|
tags: arraySchema(stringSchema({ minLength: 1 }), {
|
|
1469
1469
|
uniqueItems: true
|
|
1470
1470
|
}),
|
|
@@ -1944,8 +1944,7 @@ var opensteerRecipeStepSchema = oneOfSchema(
|
|
|
1944
1944
|
objectSchema(
|
|
1945
1945
|
{
|
|
1946
1946
|
kind: enumSchema(["goto"]),
|
|
1947
|
-
url: stringSchema({ minLength: 1 })
|
|
1948
|
-
networkTag: stringSchema({ minLength: 1 })
|
|
1947
|
+
url: stringSchema({ minLength: 1 })
|
|
1949
1948
|
},
|
|
1950
1949
|
{
|
|
1951
1950
|
title: "OpensteerAuthRecipeGotoStep",
|
|
@@ -1954,8 +1953,7 @@ var opensteerRecipeStepSchema = oneOfSchema(
|
|
|
1954
1953
|
),
|
|
1955
1954
|
objectSchema(
|
|
1956
1955
|
{
|
|
1957
|
-
kind: enumSchema(["reload"])
|
|
1958
|
-
networkTag: stringSchema({ minLength: 1 })
|
|
1956
|
+
kind: enumSchema(["reload"])
|
|
1959
1957
|
},
|
|
1960
1958
|
{
|
|
1961
1959
|
title: "OpensteerAuthRecipeReloadStep",
|
|
@@ -2172,7 +2170,7 @@ var opensteerNetworkQueryInputSchema = objectSchema(
|
|
|
2172
2170
|
pageRef: pageRefSchema,
|
|
2173
2171
|
recordId: stringSchema({ minLength: 1 }),
|
|
2174
2172
|
requestId: stringSchema({ minLength: 1 }),
|
|
2175
|
-
|
|
2173
|
+
capture: stringSchema({ minLength: 1 }),
|
|
2176
2174
|
tag: stringSchema({ minLength: 1 }),
|
|
2177
2175
|
url: stringSchema({ minLength: 1 }),
|
|
2178
2176
|
hostname: stringSchema({ minLength: 1 }),
|
|
@@ -2201,7 +2199,7 @@ var opensteerNetworkTagInputSchema = objectSchema(
|
|
|
2201
2199
|
pageRef: pageRefSchema,
|
|
2202
2200
|
recordId: stringSchema({ minLength: 1 }),
|
|
2203
2201
|
requestId: stringSchema({ minLength: 1 }),
|
|
2204
|
-
|
|
2202
|
+
capture: stringSchema({ minLength: 1 }),
|
|
2205
2203
|
tag: stringSchema({ minLength: 1 }),
|
|
2206
2204
|
url: stringSchema({ minLength: 1 }),
|
|
2207
2205
|
hostname: stringSchema({ minLength: 1 }),
|
|
@@ -2226,6 +2224,7 @@ var opensteerNetworkTagOutputSchema = objectSchema(
|
|
|
2226
2224
|
);
|
|
2227
2225
|
var opensteerNetworkClearInputSchema = objectSchema(
|
|
2228
2226
|
{
|
|
2227
|
+
capture: stringSchema({ minLength: 1 }),
|
|
2229
2228
|
tag: stringSchema({ minLength: 1 })
|
|
2230
2229
|
},
|
|
2231
2230
|
{
|
|
@@ -6077,7 +6076,7 @@ var opensteerPageCloseOutputSchema = objectSchema(
|
|
|
6077
6076
|
var opensteerPageGotoInputSchema = objectSchema(
|
|
6078
6077
|
{
|
|
6079
6078
|
url: stringSchema(),
|
|
6080
|
-
|
|
6079
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6081
6080
|
},
|
|
6082
6081
|
{
|
|
6083
6082
|
title: "OpensteerPageGotoInput",
|
|
@@ -6228,7 +6227,7 @@ var opensteerDomClickInputSchema = objectSchema(
|
|
|
6228
6227
|
{
|
|
6229
6228
|
target: opensteerTargetInputSchema,
|
|
6230
6229
|
persistAsDescription: stringSchema(),
|
|
6231
|
-
|
|
6230
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6232
6231
|
},
|
|
6233
6232
|
{
|
|
6234
6233
|
title: "OpensteerDomClickInput",
|
|
@@ -6239,7 +6238,7 @@ var opensteerDomHoverInputSchema = objectSchema(
|
|
|
6239
6238
|
{
|
|
6240
6239
|
target: opensteerTargetInputSchema,
|
|
6241
6240
|
persistAsDescription: stringSchema(),
|
|
6242
|
-
|
|
6241
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6243
6242
|
},
|
|
6244
6243
|
{
|
|
6245
6244
|
title: "OpensteerDomHoverInput",
|
|
@@ -6252,7 +6251,7 @@ var opensteerDomInputInputSchema = objectSchema(
|
|
|
6252
6251
|
text: stringSchema(),
|
|
6253
6252
|
pressEnter: { type: "boolean" },
|
|
6254
6253
|
persistAsDescription: stringSchema(),
|
|
6255
|
-
|
|
6254
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6256
6255
|
},
|
|
6257
6256
|
{
|
|
6258
6257
|
title: "OpensteerDomInputInput",
|
|
@@ -6265,7 +6264,7 @@ var opensteerDomScrollInputSchema = objectSchema(
|
|
|
6265
6264
|
direction: enumSchema(["up", "down", "left", "right"]),
|
|
6266
6265
|
amount: integerSchema({ minimum: 1 }),
|
|
6267
6266
|
persistAsDescription: stringSchema(),
|
|
6268
|
-
|
|
6267
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6269
6268
|
},
|
|
6270
6269
|
{
|
|
6271
6270
|
title: "OpensteerDomScrollInput",
|
|
@@ -6466,7 +6465,7 @@ var opensteerComputerExecuteInputSchema = objectSchema(
|
|
|
6466
6465
|
{
|
|
6467
6466
|
action: opensteerComputerActionSchema,
|
|
6468
6467
|
screenshot: opensteerComputerScreenshotOptionsSchema,
|
|
6469
|
-
|
|
6468
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
6470
6469
|
},
|
|
6471
6470
|
{
|
|
6472
6471
|
title: "OpensteerComputerExecuteInput",
|
|
@@ -7602,7 +7601,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
7602
7601
|
page_ref_key: pageRefKey,
|
|
7603
7602
|
frame_ref: entry.record.frameRef ?? null,
|
|
7604
7603
|
document_ref: entry.record.documentRef ?? null,
|
|
7605
|
-
|
|
7604
|
+
capture: entry.capture ?? null,
|
|
7606
7605
|
method: entry.record.method,
|
|
7607
7606
|
method_lc: entry.record.method.toLowerCase(),
|
|
7608
7607
|
url: entry.record.url,
|
|
@@ -7715,39 +7714,31 @@ var SqliteSavedNetworkStore = class {
|
|
|
7715
7714
|
}
|
|
7716
7715
|
async clear(input = {}) {
|
|
7717
7716
|
const database = await this.requireDatabase();
|
|
7718
|
-
const countAll = database.prepare(`
|
|
7719
|
-
SELECT COUNT(*) AS cleared
|
|
7720
|
-
FROM saved_network_records
|
|
7721
|
-
`);
|
|
7722
|
-
const countByTag = database.prepare(`
|
|
7723
|
-
SELECT COUNT(DISTINCT record_id) AS cleared
|
|
7724
|
-
FROM saved_network_tags
|
|
7725
|
-
WHERE tag = @tag
|
|
7726
|
-
`);
|
|
7727
|
-
const deleteAllTags = database.prepare(`DELETE FROM saved_network_tags`);
|
|
7717
|
+
const countAll = database.prepare(`SELECT COUNT(*) AS cleared FROM saved_network_records`);
|
|
7728
7718
|
const deleteAllRecords = database.prepare(`DELETE FROM saved_network_records`);
|
|
7729
|
-
const
|
|
7730
|
-
|
|
7731
|
-
|
|
7719
|
+
const { whereSql, parameters } = buildSavedNetworkWhere(input);
|
|
7720
|
+
const countFiltered = database.prepare(`
|
|
7721
|
+
SELECT COUNT(*) AS cleared
|
|
7722
|
+
FROM saved_network_records r
|
|
7723
|
+
${whereSql}
|
|
7732
7724
|
`);
|
|
7733
|
-
const
|
|
7725
|
+
const deleteFiltered = database.prepare(`
|
|
7734
7726
|
DELETE FROM saved_network_records
|
|
7735
|
-
WHERE
|
|
7736
|
-
SELECT
|
|
7737
|
-
FROM
|
|
7738
|
-
|
|
7727
|
+
WHERE record_id IN (
|
|
7728
|
+
SELECT r.record_id
|
|
7729
|
+
FROM saved_network_records r
|
|
7730
|
+
${whereSql}
|
|
7739
7731
|
)
|
|
7740
7732
|
`);
|
|
7741
7733
|
return withSqliteTransaction(database, () => {
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
if (tag === void 0) {
|
|
7745
|
-
deleteAllTags.run();
|
|
7734
|
+
if (input.capture === void 0 && input.tag === void 0) {
|
|
7735
|
+
const cleared2 = countAll.get().cleared;
|
|
7746
7736
|
deleteAllRecords.run();
|
|
7747
|
-
return
|
|
7737
|
+
return cleared2;
|
|
7748
7738
|
}
|
|
7749
|
-
|
|
7750
|
-
|
|
7739
|
+
const args = parameters;
|
|
7740
|
+
const cleared = countFiltered.get(...args).cleared;
|
|
7741
|
+
deleteFiltered.run(...args);
|
|
7751
7742
|
return cleared;
|
|
7752
7743
|
});
|
|
7753
7744
|
}
|
|
@@ -7802,7 +7793,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
7802
7793
|
page_ref_key TEXT NOT NULL,
|
|
7803
7794
|
frame_ref TEXT,
|
|
7804
7795
|
document_ref TEXT,
|
|
7805
|
-
|
|
7796
|
+
capture TEXT,
|
|
7806
7797
|
method TEXT NOT NULL,
|
|
7807
7798
|
method_lc TEXT NOT NULL,
|
|
7808
7799
|
url TEXT NOT NULL,
|
|
@@ -7841,6 +7832,9 @@ var SqliteSavedNetworkStore = class {
|
|
|
7841
7832
|
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
7842
7833
|
ON saved_network_records (saved_at DESC);
|
|
7843
7834
|
|
|
7835
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
7836
|
+
ON saved_network_records (capture);
|
|
7837
|
+
|
|
7844
7838
|
CREATE TABLE IF NOT EXISTS saved_network_tags (
|
|
7845
7839
|
record_id TEXT NOT NULL REFERENCES saved_network_records(record_id) ON DELETE CASCADE,
|
|
7846
7840
|
tag TEXT NOT NULL,
|
|
@@ -7856,6 +7850,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
7856
7850
|
"capture_state",
|
|
7857
7851
|
"TEXT NOT NULL DEFAULT 'complete'"
|
|
7858
7852
|
);
|
|
7853
|
+
this.ensureColumn(database, "saved_network_records", "capture", "TEXT");
|
|
7859
7854
|
this.ensureColumn(
|
|
7860
7855
|
database,
|
|
7861
7856
|
"saved_network_records",
|
|
@@ -7896,9 +7891,9 @@ function buildSavedNetworkWhere(input) {
|
|
|
7896
7891
|
clauses.push("r.request_id = ?");
|
|
7897
7892
|
parameters.push(input.requestId);
|
|
7898
7893
|
}
|
|
7899
|
-
if (input.
|
|
7900
|
-
clauses.push("r.
|
|
7901
|
-
parameters.push(input.
|
|
7894
|
+
if (input.capture !== void 0) {
|
|
7895
|
+
clauses.push("r.capture = ?");
|
|
7896
|
+
parameters.push(input.capture);
|
|
7902
7897
|
}
|
|
7903
7898
|
if (input.tag !== void 0) {
|
|
7904
7899
|
clauses.push(`
|
|
@@ -7960,7 +7955,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
7960
7955
|
page_ref_key,
|
|
7961
7956
|
frame_ref,
|
|
7962
7957
|
document_ref,
|
|
7963
|
-
|
|
7958
|
+
capture,
|
|
7964
7959
|
method,
|
|
7965
7960
|
method_lc,
|
|
7966
7961
|
url,
|
|
@@ -7999,7 +7994,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
7999
7994
|
@page_ref_key,
|
|
8000
7995
|
@frame_ref,
|
|
8001
7996
|
@document_ref,
|
|
8002
|
-
@
|
|
7997
|
+
@capture,
|
|
8003
7998
|
@method,
|
|
8004
7999
|
@method_lc,
|
|
8005
8000
|
@url,
|
|
@@ -8036,7 +8031,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
8036
8031
|
page_ref_key = excluded.page_ref_key,
|
|
8037
8032
|
frame_ref = excluded.frame_ref,
|
|
8038
8033
|
document_ref = excluded.document_ref,
|
|
8039
|
-
|
|
8034
|
+
capture = excluded.capture,
|
|
8040
8035
|
method = excluded.method,
|
|
8041
8036
|
method_lc = excluded.method_lc,
|
|
8042
8037
|
url = excluded.url,
|
|
@@ -8131,7 +8126,7 @@ function inflateSavedNetworkRow(row, includeBodies) {
|
|
|
8131
8126
|
}
|
|
8132
8127
|
return {
|
|
8133
8128
|
recordId: row.record_id,
|
|
8134
|
-
...row.
|
|
8129
|
+
...row.capture === null ? {} : { capture: row.capture },
|
|
8135
8130
|
...row.tags === null || row.tags.length === 0 ? {} : { tags: row.tags.split(TAG_DELIMITER).filter((tag) => tag.length > 0) },
|
|
8136
8131
|
savedAt: row.saved_at,
|
|
8137
8132
|
record
|
|
@@ -8471,9 +8466,9 @@ var DEFAULT_TIMEOUTS = {
|
|
|
8471
8466
|
"page.add-init-script": 1e4,
|
|
8472
8467
|
"page.snapshot": 15e3,
|
|
8473
8468
|
"computer.execute": 3e4,
|
|
8474
|
-
"dom.click":
|
|
8469
|
+
"dom.click": 3e4,
|
|
8475
8470
|
"dom.hover": 1e4,
|
|
8476
|
-
"dom.input":
|
|
8471
|
+
"dom.input": 3e4,
|
|
8477
8472
|
"dom.scroll": 1e4,
|
|
8478
8473
|
"dom.extract": 15e3,
|
|
8479
8474
|
"network.query": 15e3,
|
|
@@ -10270,6 +10265,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10270
10265
|
};
|
|
10271
10266
|
|
|
10272
10267
|
// ../runtime-core/src/action-boundary.ts
|
|
10268
|
+
var actionBoundaryDiagnosticsBySignal = /* @__PURE__ */ new WeakMap();
|
|
10273
10269
|
async function captureActionBoundarySnapshot(engine, pageRef) {
|
|
10274
10270
|
const frames = await engine.listFrames({ pageRef });
|
|
10275
10271
|
const mainFrame = frames.find((frame) => frame.isMainFrame);
|
|
@@ -10281,6 +10277,35 @@ async function captureActionBoundarySnapshot(engine, pageRef) {
|
|
|
10281
10277
|
documentRef: mainFrame.documentRef
|
|
10282
10278
|
};
|
|
10283
10279
|
}
|
|
10280
|
+
function createActionBoundaryDiagnostics(input) {
|
|
10281
|
+
return {
|
|
10282
|
+
trigger: input.boundary.trigger,
|
|
10283
|
+
crossDocument: input.boundary.crossDocument,
|
|
10284
|
+
bootstrapSettled: input.boundary.bootstrapSettled,
|
|
10285
|
+
visualSettled: input.visualSettled,
|
|
10286
|
+
...input.boundary.timedOutPhase !== void 0 ? { timedOutPhase: input.boundary.timedOutPhase } : !input.visualSettled ? { timedOutPhase: "visual" } : {}
|
|
10287
|
+
};
|
|
10288
|
+
}
|
|
10289
|
+
function recordActionBoundaryDiagnostics(signal, diagnostics) {
|
|
10290
|
+
actionBoundaryDiagnosticsBySignal.set(signal, diagnostics);
|
|
10291
|
+
}
|
|
10292
|
+
function takeActionBoundaryDiagnostics(signal) {
|
|
10293
|
+
const diagnostics = actionBoundaryDiagnosticsBySignal.get(signal);
|
|
10294
|
+
actionBoundaryDiagnosticsBySignal.delete(signal);
|
|
10295
|
+
return diagnostics;
|
|
10296
|
+
}
|
|
10297
|
+
function isSoftSettleTimeoutError(error, signal) {
|
|
10298
|
+
if (isTimeoutError(error)) {
|
|
10299
|
+
return true;
|
|
10300
|
+
}
|
|
10301
|
+
return signal?.aborted === true && isTimeoutError(signal.reason) && (error === signal.reason || isAbortError(error));
|
|
10302
|
+
}
|
|
10303
|
+
function isAbortError(error) {
|
|
10304
|
+
return error instanceof Error && error.name === "AbortError";
|
|
10305
|
+
}
|
|
10306
|
+
function isTimeoutError(error) {
|
|
10307
|
+
return isOpensteerProtocolError(error) && error.code === "timeout";
|
|
10308
|
+
}
|
|
10284
10309
|
|
|
10285
10310
|
// ../runtime-core/src/runtimes/dom/executor.ts
|
|
10286
10311
|
var MAX_DOM_ACTION_ATTEMPTS = 3;
|
|
@@ -10413,7 +10438,7 @@ var DomActionExecutor = class {
|
|
|
10413
10438
|
let finalResolved = resolved;
|
|
10414
10439
|
let finalSnapshot;
|
|
10415
10440
|
if (input.pressEnter) {
|
|
10416
|
-
await this.
|
|
10441
|
+
await this.waitForPressEnterReaction(timeout);
|
|
10417
10442
|
const enterSession = this.options.createResolutionSession();
|
|
10418
10443
|
const enterResolved = await timeout.runStep(
|
|
10419
10444
|
() => this.options.resolveTarget(enterSession, {
|
|
@@ -10437,7 +10462,15 @@ var DomActionExecutor = class {
|
|
|
10437
10462
|
);
|
|
10438
10463
|
finalResolved = enterResolved;
|
|
10439
10464
|
}
|
|
10440
|
-
await this.settle(
|
|
10465
|
+
const settleDiagnostics = await this.settle(
|
|
10466
|
+
finalResolved.pageRef,
|
|
10467
|
+
"dom.input",
|
|
10468
|
+
timeout,
|
|
10469
|
+
finalSnapshot
|
|
10470
|
+
);
|
|
10471
|
+
if (finalSnapshot !== void 0) {
|
|
10472
|
+
recordActionBoundaryDiagnostics(timeout.signal, settleDiagnostics);
|
|
10473
|
+
}
|
|
10441
10474
|
return finalResolved;
|
|
10442
10475
|
} catch (error) {
|
|
10443
10476
|
lastError = error;
|
|
@@ -10514,12 +10547,13 @@ var DomActionExecutor = class {
|
|
|
10514
10547
|
() => captureActionBoundarySnapshot(this.options.engine, pointerTarget.resolved.pageRef)
|
|
10515
10548
|
);
|
|
10516
10549
|
const outcome = await dispatch(pointerTarget, point, timeout);
|
|
10517
|
-
await this.settle(
|
|
10550
|
+
const settleDiagnostics = await this.settle(
|
|
10518
10551
|
pointerTarget.resolved.pageRef,
|
|
10519
10552
|
input.operation,
|
|
10520
10553
|
timeout,
|
|
10521
10554
|
actionBoundarySnapshot
|
|
10522
10555
|
);
|
|
10556
|
+
recordActionBoundaryDiagnostics(timeout.signal, settleDiagnostics);
|
|
10523
10557
|
return outcome;
|
|
10524
10558
|
} catch (error) {
|
|
10525
10559
|
lastError = error;
|
|
@@ -10539,22 +10573,47 @@ var DomActionExecutor = class {
|
|
|
10539
10573
|
}
|
|
10540
10574
|
async settle(pageRef, operation, timeout, snapshot) {
|
|
10541
10575
|
const bridge = this.requireBridge();
|
|
10542
|
-
|
|
10576
|
+
let visualSettled = true;
|
|
10577
|
+
const boundary = await timeout.runStep(
|
|
10543
10578
|
() => bridge.finalizeDomAction(pageRef, {
|
|
10544
10579
|
operation,
|
|
10545
10580
|
...snapshot === void 0 ? {} : { snapshot },
|
|
10546
10581
|
signal: timeout.signal,
|
|
10547
10582
|
remainingMs: () => timeout.remainingMs(),
|
|
10548
|
-
policySettle: (targetPageRef, trigger) =>
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10583
|
+
policySettle: async (targetPageRef, trigger) => {
|
|
10584
|
+
try {
|
|
10585
|
+
await settleWithPolicy(this.options.policy.settle, {
|
|
10586
|
+
operation,
|
|
10587
|
+
trigger,
|
|
10588
|
+
engine: this.options.engine,
|
|
10589
|
+
pageRef: targetPageRef,
|
|
10590
|
+
signal: timeout.signal,
|
|
10591
|
+
remainingMs: timeout.remainingMs()
|
|
10592
|
+
});
|
|
10593
|
+
} catch (error) {
|
|
10594
|
+
if (snapshot !== void 0 && isSoftSettleTimeoutError(error, timeout.signal)) {
|
|
10595
|
+
visualSettled = false;
|
|
10596
|
+
return;
|
|
10597
|
+
}
|
|
10598
|
+
throw error;
|
|
10599
|
+
}
|
|
10600
|
+
}
|
|
10556
10601
|
})
|
|
10557
10602
|
);
|
|
10603
|
+
return createActionBoundaryDiagnostics({
|
|
10604
|
+
boundary,
|
|
10605
|
+
visualSettled
|
|
10606
|
+
});
|
|
10607
|
+
}
|
|
10608
|
+
async waitForPressEnterReaction(timeout) {
|
|
10609
|
+
const delayMs = this.options.policy.settle.resolveDelayMs({
|
|
10610
|
+
operation: "dom.input",
|
|
10611
|
+
trigger: "dom-action"
|
|
10612
|
+
});
|
|
10613
|
+
if (delayMs <= 0) {
|
|
10614
|
+
return;
|
|
10615
|
+
}
|
|
10616
|
+
await delayWithSignal(delayMs, timeout.signal);
|
|
10558
10617
|
}
|
|
10559
10618
|
requireBridge() {
|
|
10560
10619
|
if (this.bridge !== void 0) {
|
|
@@ -15817,7 +15876,7 @@ async function sleep(ms) {
|
|
|
15817
15876
|
|
|
15818
15877
|
// ../runtime-core/package.json
|
|
15819
15878
|
var package_default = {
|
|
15820
|
-
version: "0.1.
|
|
15879
|
+
version: "0.1.2"};
|
|
15821
15880
|
|
|
15822
15881
|
// ../runtime-core/src/version.ts
|
|
15823
15882
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
|
|
@@ -16118,6 +16177,7 @@ var DefaultComputerUseRuntime = class {
|
|
|
16118
16177
|
const snapshot = await input.timeout.runStep(
|
|
16119
16178
|
() => captureActionBoundarySnapshot(this.options.engine, input.pageRef)
|
|
16120
16179
|
);
|
|
16180
|
+
let visualSettled = true;
|
|
16121
16181
|
const executed = await input.timeout.runStep(
|
|
16122
16182
|
() => bridge.execute({
|
|
16123
16183
|
pageRef: input.pageRef,
|
|
@@ -16126,16 +16186,35 @@ var DefaultComputerUseRuntime = class {
|
|
|
16126
16186
|
screenshot,
|
|
16127
16187
|
signal: input.timeout.signal,
|
|
16128
16188
|
remainingMs: () => input.timeout.remainingMs(),
|
|
16129
|
-
policySettle: async (pageRef, trigger) =>
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16189
|
+
policySettle: async (pageRef, trigger) => {
|
|
16190
|
+
try {
|
|
16191
|
+
await settleWithPolicy(this.options.policy.settle, {
|
|
16192
|
+
operation: "computer.execute",
|
|
16193
|
+
trigger,
|
|
16194
|
+
engine: this.options.engine,
|
|
16195
|
+
pageRef,
|
|
16196
|
+
signal: input.timeout.signal,
|
|
16197
|
+
remainingMs: input.timeout.remainingMs()
|
|
16198
|
+
});
|
|
16199
|
+
} catch (error) {
|
|
16200
|
+
if (pageRef === input.pageRef && isSoftSettleTimeoutError(error, input.timeout.signal)) {
|
|
16201
|
+
visualSettled = false;
|
|
16202
|
+
return;
|
|
16203
|
+
}
|
|
16204
|
+
throw error;
|
|
16205
|
+
}
|
|
16206
|
+
}
|
|
16137
16207
|
})
|
|
16138
16208
|
);
|
|
16209
|
+
if (executed.boundary !== void 0 && executed.pageRef === input.pageRef) {
|
|
16210
|
+
recordActionBoundaryDiagnostics(
|
|
16211
|
+
input.timeout.signal,
|
|
16212
|
+
createActionBoundaryDiagnostics({
|
|
16213
|
+
boundary: executed.boundary,
|
|
16214
|
+
visualSettled
|
|
16215
|
+
})
|
|
16216
|
+
);
|
|
16217
|
+
}
|
|
16139
16218
|
let trace = void 0;
|
|
16140
16219
|
if (!input.timeout.signal.aborted) {
|
|
16141
16220
|
try {
|
|
@@ -17508,7 +17587,7 @@ function resolveBodyEncoding(charset) {
|
|
|
17508
17587
|
var NetworkHistory = class {
|
|
17509
17588
|
metadataByRequestId = /* @__PURE__ */ new Map();
|
|
17510
17589
|
requestIdByRecordId = /* @__PURE__ */ new Map();
|
|
17511
|
-
|
|
17590
|
+
requestIdsByCapture = /* @__PURE__ */ new Map();
|
|
17512
17591
|
requestIdsByTag = /* @__PURE__ */ new Map();
|
|
17513
17592
|
tombstonedRequestIds = /* @__PURE__ */ new Set();
|
|
17514
17593
|
materialize(records, options = {}) {
|
|
@@ -17555,17 +17634,17 @@ var NetworkHistory = class {
|
|
|
17555
17634
|
}
|
|
17556
17635
|
return persisted;
|
|
17557
17636
|
}
|
|
17558
|
-
|
|
17637
|
+
assignCapture(records, capture) {
|
|
17559
17638
|
for (const record of records) {
|
|
17560
17639
|
const metadata = this.metadataByRequestId.get(record.record.requestId);
|
|
17561
|
-
if (!metadata || metadata.
|
|
17640
|
+
if (!metadata || metadata.capture === capture) {
|
|
17562
17641
|
continue;
|
|
17563
17642
|
}
|
|
17564
|
-
if (metadata.
|
|
17565
|
-
this.
|
|
17643
|
+
if (metadata.capture !== void 0) {
|
|
17644
|
+
this.requestIdsByCapture.get(metadata.capture)?.delete(record.record.requestId);
|
|
17566
17645
|
}
|
|
17567
|
-
metadata.
|
|
17568
|
-
this.addIndexedRequestId(this.
|
|
17646
|
+
metadata.capture = capture;
|
|
17647
|
+
this.addIndexedRequestId(this.requestIdsByCapture, capture, record.record.requestId);
|
|
17569
17648
|
}
|
|
17570
17649
|
}
|
|
17571
17650
|
addTag(records, tag) {
|
|
@@ -17585,8 +17664,8 @@ var NetworkHistory = class {
|
|
|
17585
17664
|
getRequestId(recordId) {
|
|
17586
17665
|
return this.requestIdByRecordId.get(recordId);
|
|
17587
17666
|
}
|
|
17588
|
-
|
|
17589
|
-
return new Set(this.
|
|
17667
|
+
getRequestIdsForCapture(capture) {
|
|
17668
|
+
return new Set(this.requestIdsByCapture.get(capture) ?? []);
|
|
17590
17669
|
}
|
|
17591
17670
|
getRequestIdsForTag(tag) {
|
|
17592
17671
|
return new Set(this.requestIdsByTag.get(tag) ?? []);
|
|
@@ -17597,20 +17676,6 @@ var NetworkHistory = class {
|
|
|
17597
17676
|
getKnownRequestIds() {
|
|
17598
17677
|
return new Set(this.metadataByRequestId.keys());
|
|
17599
17678
|
}
|
|
17600
|
-
clearTag(tag) {
|
|
17601
|
-
const requestIds = [...this.requestIdsByTag.get(tag) ?? []];
|
|
17602
|
-
this.requestIdsByTag.delete(tag);
|
|
17603
|
-
for (const requestId of requestIds) {
|
|
17604
|
-
const metadata = this.metadataByRequestId.get(requestId);
|
|
17605
|
-
if (!metadata) {
|
|
17606
|
-
continue;
|
|
17607
|
-
}
|
|
17608
|
-
metadata.tags.delete(tag);
|
|
17609
|
-
if (metadata.tags.size === 0) {
|
|
17610
|
-
this.tombstoneRequestIds([requestId]);
|
|
17611
|
-
}
|
|
17612
|
-
}
|
|
17613
|
-
}
|
|
17614
17679
|
tombstoneRequestIds(requestIds) {
|
|
17615
17680
|
for (const requestId of requestIds) {
|
|
17616
17681
|
this.tombstonedRequestIds.add(requestId);
|
|
@@ -17620,8 +17685,8 @@ var NetworkHistory = class {
|
|
|
17620
17685
|
}
|
|
17621
17686
|
this.metadataByRequestId.delete(requestId);
|
|
17622
17687
|
this.requestIdByRecordId.delete(metadata.recordId);
|
|
17623
|
-
if (metadata.
|
|
17624
|
-
this.
|
|
17688
|
+
if (metadata.capture !== void 0) {
|
|
17689
|
+
this.requestIdsByCapture.get(metadata.capture)?.delete(requestId);
|
|
17625
17690
|
}
|
|
17626
17691
|
for (const tag of metadata.tags) {
|
|
17627
17692
|
this.requestIdsByTag.get(tag)?.delete(requestId);
|
|
@@ -17631,7 +17696,7 @@ var NetworkHistory = class {
|
|
|
17631
17696
|
clear() {
|
|
17632
17697
|
this.metadataByRequestId.clear();
|
|
17633
17698
|
this.requestIdByRecordId.clear();
|
|
17634
|
-
this.
|
|
17699
|
+
this.requestIdsByCapture.clear();
|
|
17635
17700
|
this.requestIdsByTag.clear();
|
|
17636
17701
|
this.tombstonedRequestIds.clear();
|
|
17637
17702
|
}
|
|
@@ -17654,7 +17719,7 @@ var NetworkHistory = class {
|
|
|
17654
17719
|
}
|
|
17655
17720
|
return {
|
|
17656
17721
|
recordId: metadata.recordId,
|
|
17657
|
-
...metadata.
|
|
17722
|
+
...metadata.capture === void 0 ? {} : { capture: metadata.capture },
|
|
17658
17723
|
...metadata.tags.size === 0 ? {} : { tags: [...metadata.tags].sort() },
|
|
17659
17724
|
...metadata.savedAt === void 0 ? {} : { savedAt: metadata.savedAt },
|
|
17660
17725
|
record: toProtocolNetworkRecord(record, {
|
|
@@ -22472,6 +22537,7 @@ function diffInteractionTraces(left, right) {
|
|
|
22472
22537
|
|
|
22473
22538
|
// ../runtime-core/src/sdk/runtime.ts
|
|
22474
22539
|
var requireForAuthRecipeHook = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
22540
|
+
var MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS = 5e3;
|
|
22475
22541
|
var OpensteerSessionRuntime = class {
|
|
22476
22542
|
workspace;
|
|
22477
22543
|
rootPath;
|
|
@@ -22854,34 +22920,32 @@ var OpensteerSessionRuntime = class {
|
|
|
22854
22920
|
assertValidSemanticOperationInput("page.goto", input);
|
|
22855
22921
|
const pageRef = await this.ensurePageRef();
|
|
22856
22922
|
const startedAt = Date.now();
|
|
22923
|
+
let mutationCaptureDiagnostics;
|
|
22857
22924
|
try {
|
|
22858
|
-
const { navigation, state } = await this.
|
|
22925
|
+
const { navigation, state } = await this.runMutationCapturedOperation(
|
|
22859
22926
|
"page.goto",
|
|
22927
|
+
{
|
|
22928
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
22929
|
+
options
|
|
22930
|
+
},
|
|
22860
22931
|
async (timeout) => {
|
|
22861
|
-
const
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
await
|
|
22873
|
-
|
|
22874
|
-
navigation: navigation2,
|
|
22875
|
-
state: await timeout.runStep(() => this.readSessionState())
|
|
22876
|
-
};
|
|
22877
|
-
} catch (error) {
|
|
22878
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, input.networkTag).catch(
|
|
22879
|
-
() => void 0
|
|
22880
|
-
);
|
|
22881
|
-
throw error;
|
|
22882
|
-
}
|
|
22932
|
+
const navigation2 = await this.navigatePage(
|
|
22933
|
+
{
|
|
22934
|
+
operation: "page.goto",
|
|
22935
|
+
pageRef,
|
|
22936
|
+
url: input.url
|
|
22937
|
+
},
|
|
22938
|
+
timeout
|
|
22939
|
+
);
|
|
22940
|
+
timeout.throwIfAborted();
|
|
22941
|
+
return {
|
|
22942
|
+
navigation: navigation2,
|
|
22943
|
+
state: await timeout.runStep(() => this.readSessionState())
|
|
22944
|
+
};
|
|
22883
22945
|
},
|
|
22884
|
-
|
|
22946
|
+
(diagnostics) => {
|
|
22947
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
22948
|
+
}
|
|
22885
22949
|
);
|
|
22886
22950
|
await this.appendTrace({
|
|
22887
22951
|
operation: "page.goto",
|
|
@@ -22890,7 +22954,8 @@ var OpensteerSessionRuntime = class {
|
|
|
22890
22954
|
outcome: "ok",
|
|
22891
22955
|
data: {
|
|
22892
22956
|
url: input.url,
|
|
22893
|
-
state
|
|
22957
|
+
state,
|
|
22958
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
22894
22959
|
},
|
|
22895
22960
|
context: buildRuntimeTraceContext({
|
|
22896
22961
|
sessionRef: this.sessionRef,
|
|
@@ -22906,6 +22971,7 @@ var OpensteerSessionRuntime = class {
|
|
|
22906
22971
|
completedAt: Date.now(),
|
|
22907
22972
|
outcome: "error",
|
|
22908
22973
|
error,
|
|
22974
|
+
data: buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
22909
22975
|
context: buildRuntimeTraceContext({
|
|
22910
22976
|
sessionRef: this.sessionRef,
|
|
22911
22977
|
pageRef
|
|
@@ -22918,34 +22984,29 @@ var OpensteerSessionRuntime = class {
|
|
|
22918
22984
|
assertValidSemanticOperationInput("page.evaluate", input);
|
|
22919
22985
|
const pageRef = input.pageRef ?? await this.ensurePageRef();
|
|
22920
22986
|
const startedAt = Date.now();
|
|
22987
|
+
let mutationCaptureDiagnostics;
|
|
22921
22988
|
try {
|
|
22922
|
-
const output = await this.
|
|
22989
|
+
const output = await this.runMutationCapturedOperation(
|
|
22923
22990
|
"page.evaluate",
|
|
22991
|
+
{ options },
|
|
22924
22992
|
async (timeout) => {
|
|
22925
|
-
const
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
const evaluated = await timeout.runStep(
|
|
22929
|
-
() => this.requireEngine().evaluatePage({
|
|
22930
|
-
pageRef,
|
|
22931
|
-
script: input.script,
|
|
22932
|
-
...input.args === void 0 ? {} : { args: input.args },
|
|
22933
|
-
...remainingMs === void 0 ? {} : { timeoutMs: remainingMs }
|
|
22934
|
-
})
|
|
22935
|
-
);
|
|
22936
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, void 0);
|
|
22937
|
-
return {
|
|
22993
|
+
const remainingMs = timeout.remainingMs();
|
|
22994
|
+
const evaluated = await timeout.runStep(
|
|
22995
|
+
() => this.requireEngine().evaluatePage({
|
|
22938
22996
|
pageRef,
|
|
22939
|
-
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
|
|
22943
|
-
|
|
22944
|
-
|
|
22945
|
-
|
|
22946
|
-
|
|
22997
|
+
script: input.script,
|
|
22998
|
+
...input.args === void 0 ? {} : { args: input.args },
|
|
22999
|
+
...remainingMs === void 0 ? {} : { timeoutMs: remainingMs }
|
|
23000
|
+
})
|
|
23001
|
+
);
|
|
23002
|
+
return {
|
|
23003
|
+
pageRef,
|
|
23004
|
+
value: toJsonValueOrNull(evaluated.data)
|
|
23005
|
+
};
|
|
22947
23006
|
},
|
|
22948
|
-
|
|
23007
|
+
(diagnostics) => {
|
|
23008
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
23009
|
+
}
|
|
22949
23010
|
);
|
|
22950
23011
|
await this.appendTrace({
|
|
22951
23012
|
operation: "page.evaluate",
|
|
@@ -22954,7 +23015,8 @@ var OpensteerSessionRuntime = class {
|
|
|
22954
23015
|
outcome: "ok",
|
|
22955
23016
|
data: {
|
|
22956
23017
|
pageRef: output.pageRef,
|
|
22957
|
-
value: output.value
|
|
23018
|
+
value: output.value,
|
|
23019
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
22958
23020
|
},
|
|
22959
23021
|
context: buildRuntimeTraceContext({
|
|
22960
23022
|
sessionRef: this.sessionRef,
|
|
@@ -22969,6 +23031,7 @@ var OpensteerSessionRuntime = class {
|
|
|
22969
23031
|
completedAt: Date.now(),
|
|
22970
23032
|
outcome: "error",
|
|
22971
23033
|
error,
|
|
23034
|
+
data: buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
22972
23035
|
context: buildRuntimeTraceContext({
|
|
22973
23036
|
sessionRef: this.sessionRef,
|
|
22974
23037
|
pageRef
|
|
@@ -23408,17 +23471,29 @@ var OpensteerSessionRuntime = class {
|
|
|
23408
23471
|
"network.clear",
|
|
23409
23472
|
async (timeout) => {
|
|
23410
23473
|
if (this.sessionRef !== void 0) {
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23474
|
+
if (input.capture !== void 0 || input.tag !== void 0) {
|
|
23475
|
+
const records = await this.queryLiveNetwork(
|
|
23476
|
+
{
|
|
23477
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
23478
|
+
...input.tag === void 0 ? {} : { tag: input.tag }
|
|
23479
|
+
},
|
|
23480
|
+
timeout,
|
|
23481
|
+
{
|
|
23482
|
+
ignoreLimit: true
|
|
23483
|
+
}
|
|
23484
|
+
);
|
|
23485
|
+
this.networkHistory.tombstoneRequestIds(
|
|
23486
|
+
records.map((record) => record.record.requestId)
|
|
23487
|
+
);
|
|
23488
|
+
} else {
|
|
23489
|
+
const liveRequestIds = await this.readLiveRequestIds(timeout, {
|
|
23490
|
+
includeCurrentPageOnly: false
|
|
23491
|
+
});
|
|
23415
23492
|
this.networkHistory.tombstoneRequestIds(liveRequestIds);
|
|
23416
23493
|
}
|
|
23417
23494
|
}
|
|
23418
|
-
if (input.tag === void 0) {
|
|
23495
|
+
if (input.capture === void 0 && input.tag === void 0) {
|
|
23419
23496
|
this.networkHistory.tombstoneRequestIds(this.networkHistory.getKnownRequestIds());
|
|
23420
|
-
} else {
|
|
23421
|
-
this.networkHistory.clearTag(input.tag);
|
|
23422
23497
|
}
|
|
23423
23498
|
return {
|
|
23424
23499
|
clearedCount: await timeout.runStep(() => root.registry.savedNetwork.clear(input))
|
|
@@ -23432,6 +23507,7 @@ var OpensteerSessionRuntime = class {
|
|
|
23432
23507
|
completedAt: Date.now(),
|
|
23433
23508
|
outcome: "ok",
|
|
23434
23509
|
data: {
|
|
23510
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
23435
23511
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
23436
23512
|
clearedCount: output.clearedCount
|
|
23437
23513
|
}
|
|
@@ -24613,7 +24689,9 @@ var OpensteerSessionRuntime = class {
|
|
|
24613
24689
|
};
|
|
24614
24690
|
}
|
|
24615
24691
|
const bindings = /* @__PURE__ */ new Map();
|
|
24616
|
-
const baselineRequestIds = await this.
|
|
24692
|
+
const baselineRequestIds = await this.readLiveRequestIds(timeout, {
|
|
24693
|
+
includeCurrentPageOnly: true
|
|
24694
|
+
});
|
|
24617
24695
|
const pageRef = explicitPageRef ?? await this.ensurePageRef();
|
|
24618
24696
|
const validatorMap = new Map(
|
|
24619
24697
|
packageRecord.payload.validators.map((validator) => [validator.id, validator])
|
|
@@ -26285,33 +26363,38 @@ var OpensteerSessionRuntime = class {
|
|
|
26285
26363
|
assertValidSemanticOperationInput("computer.execute", input);
|
|
26286
26364
|
const pageRef = await this.ensurePageRef();
|
|
26287
26365
|
const startedAt = Date.now();
|
|
26366
|
+
let mutationCaptureDiagnostics;
|
|
26367
|
+
let boundaryDiagnostics;
|
|
26288
26368
|
try {
|
|
26289
|
-
const { artifacts, output } = await this.
|
|
26369
|
+
const { artifacts, output } = await this.runMutationCapturedOperation(
|
|
26290
26370
|
"computer.execute",
|
|
26371
|
+
{
|
|
26372
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
26373
|
+
options
|
|
26374
|
+
},
|
|
26291
26375
|
async (timeout) => {
|
|
26292
|
-
const baselineRequestIds = await this.beginMutationCapture(timeout);
|
|
26293
26376
|
try {
|
|
26294
26377
|
const output2 = await this.requireComputer().execute({
|
|
26295
26378
|
pageRef,
|
|
26296
26379
|
input,
|
|
26297
26380
|
timeout
|
|
26298
26381
|
});
|
|
26382
|
+
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
26299
26383
|
timeout.throwIfAborted();
|
|
26300
26384
|
this.pageRef = output2.pageRef;
|
|
26301
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, input.networkTag);
|
|
26302
26385
|
const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
|
|
26303
26386
|
return {
|
|
26304
26387
|
artifacts: { manifests: artifacts2.manifests },
|
|
26305
26388
|
output: artifacts2.output
|
|
26306
26389
|
};
|
|
26307
26390
|
} catch (error) {
|
|
26308
|
-
|
|
26309
|
-
() => void 0
|
|
26310
|
-
);
|
|
26391
|
+
boundaryDiagnostics ??= takeActionBoundaryDiagnostics(timeout.signal);
|
|
26311
26392
|
throw error;
|
|
26312
26393
|
}
|
|
26313
26394
|
},
|
|
26314
|
-
|
|
26395
|
+
(diagnostics) => {
|
|
26396
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
26397
|
+
}
|
|
26315
26398
|
);
|
|
26316
26399
|
await this.appendTrace({
|
|
26317
26400
|
operation: "computer.execute",
|
|
@@ -26327,6 +26410,8 @@ var OpensteerSessionRuntime = class {
|
|
|
26327
26410
|
nativeViewport: output.nativeViewport,
|
|
26328
26411
|
displayScale: output.displayScale,
|
|
26329
26412
|
timing: output.timing,
|
|
26413
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
26414
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
26330
26415
|
...output.trace === void 0 ? {} : { trace: output.trace }
|
|
26331
26416
|
},
|
|
26332
26417
|
context: buildRuntimeTraceContext({
|
|
@@ -26345,6 +26430,10 @@ var OpensteerSessionRuntime = class {
|
|
|
26345
26430
|
completedAt: Date.now(),
|
|
26346
26431
|
outcome: "error",
|
|
26347
26432
|
error,
|
|
26433
|
+
data: {
|
|
26434
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
26435
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
26436
|
+
},
|
|
26348
26437
|
context: buildRuntimeTraceContext({
|
|
26349
26438
|
sessionRef: this.sessionRef,
|
|
26350
26439
|
pageRef: this.pageRef
|
|
@@ -26448,33 +26537,38 @@ var OpensteerSessionRuntime = class {
|
|
|
26448
26537
|
async runDomAction(operation, input, executor, options = {}) {
|
|
26449
26538
|
const pageRef = await this.ensurePageRef();
|
|
26450
26539
|
const startedAt = Date.now();
|
|
26540
|
+
let mutationCaptureDiagnostics;
|
|
26541
|
+
let boundaryDiagnostics;
|
|
26451
26542
|
try {
|
|
26452
|
-
const { executed, preparedTarget } = await this.
|
|
26543
|
+
const { executed, preparedTarget } = await this.runMutationCapturedOperation(
|
|
26453
26544
|
operation,
|
|
26545
|
+
{
|
|
26546
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
26547
|
+
options
|
|
26548
|
+
},
|
|
26454
26549
|
async (timeout) => {
|
|
26455
|
-
const
|
|
26550
|
+
const preparedTarget2 = await this.prepareDomTarget(
|
|
26551
|
+
pageRef,
|
|
26552
|
+
operation,
|
|
26553
|
+
input.target,
|
|
26554
|
+
input.persistAsDescription,
|
|
26555
|
+
timeout
|
|
26556
|
+
);
|
|
26456
26557
|
try {
|
|
26457
|
-
const preparedTarget2 = await this.prepareDomTarget(
|
|
26458
|
-
pageRef,
|
|
26459
|
-
operation,
|
|
26460
|
-
input.target,
|
|
26461
|
-
input.persistAsDescription,
|
|
26462
|
-
timeout
|
|
26463
|
-
);
|
|
26464
26558
|
const executed2 = await executor(pageRef, preparedTarget2.target, timeout);
|
|
26465
|
-
|
|
26559
|
+
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
26466
26560
|
return {
|
|
26467
26561
|
executed: executed2,
|
|
26468
26562
|
preparedTarget: preparedTarget2
|
|
26469
26563
|
};
|
|
26470
26564
|
} catch (error) {
|
|
26471
|
-
|
|
26472
|
-
() => void 0
|
|
26473
|
-
);
|
|
26565
|
+
boundaryDiagnostics ??= takeActionBoundaryDiagnostics(timeout.signal);
|
|
26474
26566
|
throw error;
|
|
26475
26567
|
}
|
|
26476
26568
|
},
|
|
26477
|
-
|
|
26569
|
+
(diagnostics) => {
|
|
26570
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
26571
|
+
}
|
|
26478
26572
|
);
|
|
26479
26573
|
const output = toOpensteerActionResult(executed.result, preparedTarget.persistedDescription);
|
|
26480
26574
|
await this.appendTrace({
|
|
@@ -26485,7 +26579,9 @@ var OpensteerSessionRuntime = class {
|
|
|
26485
26579
|
data: {
|
|
26486
26580
|
target: output.target,
|
|
26487
26581
|
...output.point === void 0 ? {} : { point: output.point },
|
|
26488
|
-
...output.persistedDescription === void 0 ? {} : { persistedDescription: output.persistedDescription }
|
|
26582
|
+
...output.persistedDescription === void 0 ? {} : { persistedDescription: output.persistedDescription },
|
|
26583
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
26584
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
26489
26585
|
},
|
|
26490
26586
|
context: buildRuntimeTraceContext({
|
|
26491
26587
|
sessionRef: this.sessionRef,
|
|
@@ -26503,6 +26599,10 @@ var OpensteerSessionRuntime = class {
|
|
|
26503
26599
|
completedAt: Date.now(),
|
|
26504
26600
|
outcome: "error",
|
|
26505
26601
|
error,
|
|
26602
|
+
data: {
|
|
26603
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
26604
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
26605
|
+
},
|
|
26506
26606
|
context: buildRuntimeTraceContext({
|
|
26507
26607
|
sessionRef: this.sessionRef,
|
|
26508
26608
|
pageRef
|
|
@@ -26612,7 +26712,7 @@ var OpensteerSessionRuntime = class {
|
|
|
26612
26712
|
const filtered = filterNetworkQueryRecords(metadataRecords, {
|
|
26613
26713
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
26614
26714
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
26615
|
-
...input.
|
|
26715
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
26616
26716
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
26617
26717
|
...input.url === void 0 ? {} : { url: input.url },
|
|
26618
26718
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
@@ -26818,32 +26918,68 @@ var OpensteerSessionRuntime = class {
|
|
|
26818
26918
|
artifactId: manifest.artifactId
|
|
26819
26919
|
};
|
|
26820
26920
|
}
|
|
26821
|
-
|
|
26822
|
-
|
|
26823
|
-
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
{
|
|
26830
|
-
includeBodies: false,
|
|
26831
|
-
includeCurrentPageOnly: true
|
|
26921
|
+
async runMutationCapturedOperation(operation, input, execute, onFinalized) {
|
|
26922
|
+
let plan;
|
|
26923
|
+
try {
|
|
26924
|
+
const result = await this.runWithOperationTimeout(
|
|
26925
|
+
operation,
|
|
26926
|
+
async (timeout) => {
|
|
26927
|
+
plan = await this.beginMutationCapture(timeout, input.captureNetwork);
|
|
26928
|
+
return execute(timeout);
|
|
26832
26929
|
},
|
|
26833
|
-
|
|
26834
|
-
)
|
|
26930
|
+
input.options
|
|
26931
|
+
);
|
|
26932
|
+
const diagnostics = await this.finalizeMutationCaptureBestEffort(plan);
|
|
26933
|
+
onFinalized?.(diagnostics);
|
|
26934
|
+
return result;
|
|
26935
|
+
} catch (error) {
|
|
26936
|
+
const diagnostics = await this.finalizeMutationCaptureBestEffort(plan);
|
|
26937
|
+
onFinalized?.(diagnostics);
|
|
26938
|
+
throw error;
|
|
26939
|
+
}
|
|
26940
|
+
}
|
|
26941
|
+
async beginMutationCapture(timeout, capture) {
|
|
26942
|
+
if (capture === void 0) {
|
|
26943
|
+
return void 0;
|
|
26944
|
+
}
|
|
26945
|
+
return {
|
|
26946
|
+
baselineRequestIds: await this.readLiveRequestIds(timeout, {
|
|
26947
|
+
includeCurrentPageOnly: true
|
|
26948
|
+
}),
|
|
26949
|
+
capture
|
|
26950
|
+
};
|
|
26951
|
+
}
|
|
26952
|
+
async finalizeMutationCaptureBestEffort(plan) {
|
|
26953
|
+
if (plan === void 0) {
|
|
26954
|
+
return {};
|
|
26955
|
+
}
|
|
26956
|
+
try {
|
|
26957
|
+
await withDetachedTimeoutSignal(MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS, async (signal) => {
|
|
26958
|
+
await this.completeMutationCaptureWithSignal(signal, plan);
|
|
26959
|
+
});
|
|
26960
|
+
return {};
|
|
26961
|
+
} catch (error) {
|
|
26962
|
+
return {
|
|
26963
|
+
finalizeError: normalizeOpensteerError(error)
|
|
26964
|
+
};
|
|
26965
|
+
}
|
|
26966
|
+
}
|
|
26967
|
+
async completeMutationCaptureWithSignal(signal, plan) {
|
|
26968
|
+
const records = await this.readLiveNetworkRecords(
|
|
26969
|
+
{
|
|
26970
|
+
includeBodies: false,
|
|
26971
|
+
includeCurrentPageOnly: true
|
|
26972
|
+
},
|
|
26973
|
+
signal
|
|
26835
26974
|
);
|
|
26836
|
-
const delta = records.filter((record) => !baselineRequestIds.has(record.record.requestId));
|
|
26975
|
+
const delta = records.filter((record) => !plan.baselineRequestIds.has(record.record.requestId));
|
|
26837
26976
|
if (delta.length === 0) {
|
|
26838
26977
|
return;
|
|
26839
26978
|
}
|
|
26840
|
-
this.networkHistory.
|
|
26841
|
-
|
|
26842
|
-
this.networkHistory.addTag(delta, networkTag);
|
|
26843
|
-
}
|
|
26844
|
-
await this.persistLiveRequestIds(
|
|
26979
|
+
this.networkHistory.assignCapture(delta, plan.capture);
|
|
26980
|
+
await this.persistLiveRequestIdsWithSignal(
|
|
26845
26981
|
delta.map((record) => record.record.requestId),
|
|
26846
|
-
|
|
26982
|
+
signal,
|
|
26847
26983
|
{
|
|
26848
26984
|
includeCurrentPageOnly: true
|
|
26849
26985
|
}
|
|
@@ -27250,27 +27386,28 @@ var OpensteerSessionRuntime = class {
|
|
|
27250
27386
|
});
|
|
27251
27387
|
}
|
|
27252
27388
|
async persistLiveRequestIds(requestIds, timeout, options) {
|
|
27389
|
+
return timeout.runStep(
|
|
27390
|
+
() => this.persistLiveRequestIdsWithSignal(requestIds, timeout.signal, options)
|
|
27391
|
+
);
|
|
27392
|
+
}
|
|
27393
|
+
async persistLiveRequestIdsWithSignal(requestIds, signal, options) {
|
|
27253
27394
|
if (requestIds.length === 0) {
|
|
27254
27395
|
return [];
|
|
27255
27396
|
}
|
|
27256
27397
|
const root = await this.ensureRoot();
|
|
27257
|
-
const browserRecords = await
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
timeout.signal
|
|
27266
|
-
)
|
|
27267
|
-
);
|
|
27268
|
-
return timeout.runStep(
|
|
27269
|
-
() => this.networkHistory.persist(browserRecords, root.registry.savedNetwork, {
|
|
27270
|
-
bodyWriteMode: "authoritative",
|
|
27271
|
-
redactSecretHeaders: false
|
|
27272
|
-
})
|
|
27398
|
+
const browserRecords = await this.readBrowserNetworkRecords(
|
|
27399
|
+
{
|
|
27400
|
+
includeBodies: true,
|
|
27401
|
+
includeCurrentPageOnly: options.includeCurrentPageOnly,
|
|
27402
|
+
...options.pageRef === void 0 ? {} : { pageRef: options.pageRef },
|
|
27403
|
+
requestIds
|
|
27404
|
+
},
|
|
27405
|
+
signal
|
|
27273
27406
|
);
|
|
27407
|
+
return this.networkHistory.persist(browserRecords, root.registry.savedNetwork, {
|
|
27408
|
+
bodyWriteMode: "authoritative",
|
|
27409
|
+
redactSecretHeaders: false
|
|
27410
|
+
});
|
|
27274
27411
|
}
|
|
27275
27412
|
async syncPersistedNetworkSelection(timeout, input, options) {
|
|
27276
27413
|
if (this.sessionRef === void 0) {
|
|
@@ -27312,7 +27449,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27312
27449
|
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
27313
27450
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
27314
27451
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
27315
|
-
...input.
|
|
27452
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
27316
27453
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
27317
27454
|
...input.url === void 0 ? {} : { url: input.url },
|
|
27318
27455
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
@@ -27329,7 +27466,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27329
27466
|
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
27330
27467
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
27331
27468
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
27332
|
-
...input.
|
|
27469
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
27333
27470
|
...input.url === void 0 ? {} : { url: input.url },
|
|
27334
27471
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
27335
27472
|
...input.path === void 0 ? {} : { path: input.path },
|
|
@@ -28891,8 +29028,8 @@ function resolveLiveQueryRequestIds(input, history) {
|
|
|
28891
29028
|
if (input.requestId !== void 0) {
|
|
28892
29029
|
requestIdCandidates.push(/* @__PURE__ */ new Set([input.requestId]));
|
|
28893
29030
|
}
|
|
28894
|
-
if (input.
|
|
28895
|
-
requestIdCandidates.push(history.
|
|
29031
|
+
if (input.capture !== void 0) {
|
|
29032
|
+
requestIdCandidates.push(history.getRequestIdsForCapture(input.capture));
|
|
28896
29033
|
}
|
|
28897
29034
|
if (input.tag !== void 0) {
|
|
28898
29035
|
requestIdCandidates.push(history.getRequestIdsForTag(input.tag));
|
|
@@ -28939,7 +29076,7 @@ function filterNetworkQueryRecords(records, input) {
|
|
|
28939
29076
|
if (input.requestId !== void 0 && record.record.requestId !== input.requestId) {
|
|
28940
29077
|
return false;
|
|
28941
29078
|
}
|
|
28942
|
-
if (input.
|
|
29079
|
+
if (input.capture !== void 0 && record.capture !== input.capture) {
|
|
28943
29080
|
return false;
|
|
28944
29081
|
}
|
|
28945
29082
|
if (input.tag !== void 0 && !(record.tags ?? []).includes(input.tag)) {
|
|
@@ -31349,9 +31486,40 @@ function toOpensteerResolvedTarget2(target) {
|
|
|
31349
31486
|
function normalizeOpensteerError(error) {
|
|
31350
31487
|
return normalizeThrownOpensteerError(error, "Unknown Opensteer runtime failure");
|
|
31351
31488
|
}
|
|
31489
|
+
function buildMutationCaptureTraceData(diagnostics) {
|
|
31490
|
+
if (diagnostics?.finalizeError === void 0) {
|
|
31491
|
+
return {};
|
|
31492
|
+
}
|
|
31493
|
+
return {
|
|
31494
|
+
networkCapture: {
|
|
31495
|
+
finalizeError: diagnostics.finalizeError
|
|
31496
|
+
}
|
|
31497
|
+
};
|
|
31498
|
+
}
|
|
31352
31499
|
function isIgnorableRuntimeBindingError(error) {
|
|
31353
31500
|
return isBrowserCoreError(error) && (error.code === "not-found" || error.code === "page-closed" || error.code === "session-closed");
|
|
31354
31501
|
}
|
|
31502
|
+
async function withDetachedTimeoutSignal(timeoutMs, operation) {
|
|
31503
|
+
const controller = new AbortController();
|
|
31504
|
+
const timeoutError = new OpensteerProtocolError(
|
|
31505
|
+
"timeout",
|
|
31506
|
+
`mutation capture finalization exceeded ${String(timeoutMs)}ms timeout`,
|
|
31507
|
+
{
|
|
31508
|
+
details: {
|
|
31509
|
+
policy: "mutation-capture-finalize",
|
|
31510
|
+
budgetMs: timeoutMs
|
|
31511
|
+
}
|
|
31512
|
+
}
|
|
31513
|
+
);
|
|
31514
|
+
const timer = setTimeout(() => {
|
|
31515
|
+
controller.abort(timeoutError);
|
|
31516
|
+
}, timeoutMs);
|
|
31517
|
+
try {
|
|
31518
|
+
return await operation(controller.signal);
|
|
31519
|
+
} finally {
|
|
31520
|
+
clearTimeout(timer);
|
|
31521
|
+
}
|
|
31522
|
+
}
|
|
31355
31523
|
function screenshotMediaType(format2) {
|
|
31356
31524
|
switch (format2) {
|
|
31357
31525
|
case "png":
|
|
@@ -33672,7 +33840,7 @@ function normalizeTargetOptions(input) {
|
|
|
33672
33840
|
element: input.element
|
|
33673
33841
|
},
|
|
33674
33842
|
...input.description === void 0 ? {} : { persistAsDescription: input.description },
|
|
33675
|
-
...input.
|
|
33843
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
33676
33844
|
};
|
|
33677
33845
|
}
|
|
33678
33846
|
if (hasSelector) {
|
|
@@ -33682,7 +33850,7 @@ function normalizeTargetOptions(input) {
|
|
|
33682
33850
|
selector: input.selector
|
|
33683
33851
|
},
|
|
33684
33852
|
...input.description === void 0 ? {} : { persistAsDescription: input.description },
|
|
33685
|
-
...input.
|
|
33853
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
33686
33854
|
};
|
|
33687
33855
|
}
|
|
33688
33856
|
if (input.description === void 0) {
|
|
@@ -33693,7 +33861,7 @@ function normalizeTargetOptions(input) {
|
|
|
33693
33861
|
kind: "description",
|
|
33694
33862
|
description: input.description
|
|
33695
33863
|
},
|
|
33696
|
-
...input.
|
|
33864
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
33697
33865
|
};
|
|
33698
33866
|
}
|
|
33699
33867
|
function delay2(ms) {
|