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/cli/bin.cjs
CHANGED
|
@@ -51,7 +51,7 @@ var WebSocket2__default = /*#__PURE__*/_interopDefault(WebSocket2);
|
|
|
51
51
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
|
-
version: "0.8.
|
|
54
|
+
version: "0.8.8"};
|
|
55
55
|
util.promisify(child_process.execFile);
|
|
56
56
|
Math.floor(Date.now() - process.uptime() * 1e3);
|
|
57
57
|
({ ...process.env});
|
|
@@ -2851,7 +2851,7 @@ var networkRecordSchema = objectSchema(
|
|
|
2851
2851
|
var networkQueryRecordSchema = objectSchema(
|
|
2852
2852
|
{
|
|
2853
2853
|
recordId: stringSchema({ minLength: 1 }),
|
|
2854
|
-
|
|
2854
|
+
capture: stringSchema({ minLength: 1 }),
|
|
2855
2855
|
tags: arraySchema(stringSchema({ minLength: 1 }), {
|
|
2856
2856
|
uniqueItems: true
|
|
2857
2857
|
}),
|
|
@@ -3331,8 +3331,7 @@ var opensteerRecipeStepSchema = oneOfSchema(
|
|
|
3331
3331
|
objectSchema(
|
|
3332
3332
|
{
|
|
3333
3333
|
kind: enumSchema(["goto"]),
|
|
3334
|
-
url: stringSchema({ minLength: 1 })
|
|
3335
|
-
networkTag: stringSchema({ minLength: 1 })
|
|
3334
|
+
url: stringSchema({ minLength: 1 })
|
|
3336
3335
|
},
|
|
3337
3336
|
{
|
|
3338
3337
|
title: "OpensteerAuthRecipeGotoStep",
|
|
@@ -3341,8 +3340,7 @@ var opensteerRecipeStepSchema = oneOfSchema(
|
|
|
3341
3340
|
),
|
|
3342
3341
|
objectSchema(
|
|
3343
3342
|
{
|
|
3344
|
-
kind: enumSchema(["reload"])
|
|
3345
|
-
networkTag: stringSchema({ minLength: 1 })
|
|
3343
|
+
kind: enumSchema(["reload"])
|
|
3346
3344
|
},
|
|
3347
3345
|
{
|
|
3348
3346
|
title: "OpensteerAuthRecipeReloadStep",
|
|
@@ -3559,7 +3557,7 @@ var opensteerNetworkQueryInputSchema = objectSchema(
|
|
|
3559
3557
|
pageRef: pageRefSchema,
|
|
3560
3558
|
recordId: stringSchema({ minLength: 1 }),
|
|
3561
3559
|
requestId: stringSchema({ minLength: 1 }),
|
|
3562
|
-
|
|
3560
|
+
capture: stringSchema({ minLength: 1 }),
|
|
3563
3561
|
tag: stringSchema({ minLength: 1 }),
|
|
3564
3562
|
url: stringSchema({ minLength: 1 }),
|
|
3565
3563
|
hostname: stringSchema({ minLength: 1 }),
|
|
@@ -3588,7 +3586,7 @@ var opensteerNetworkTagInputSchema = objectSchema(
|
|
|
3588
3586
|
pageRef: pageRefSchema,
|
|
3589
3587
|
recordId: stringSchema({ minLength: 1 }),
|
|
3590
3588
|
requestId: stringSchema({ minLength: 1 }),
|
|
3591
|
-
|
|
3589
|
+
capture: stringSchema({ minLength: 1 }),
|
|
3592
3590
|
tag: stringSchema({ minLength: 1 }),
|
|
3593
3591
|
url: stringSchema({ minLength: 1 }),
|
|
3594
3592
|
hostname: stringSchema({ minLength: 1 }),
|
|
@@ -3613,6 +3611,7 @@ var opensteerNetworkTagOutputSchema = objectSchema(
|
|
|
3613
3611
|
);
|
|
3614
3612
|
var opensteerNetworkClearInputSchema = objectSchema(
|
|
3615
3613
|
{
|
|
3614
|
+
capture: stringSchema({ minLength: 1 }),
|
|
3616
3615
|
tag: stringSchema({ minLength: 1 })
|
|
3617
3616
|
},
|
|
3618
3617
|
{
|
|
@@ -7464,7 +7463,7 @@ var opensteerPageCloseOutputSchema = objectSchema(
|
|
|
7464
7463
|
var opensteerPageGotoInputSchema = objectSchema(
|
|
7465
7464
|
{
|
|
7466
7465
|
url: stringSchema(),
|
|
7467
|
-
|
|
7466
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7468
7467
|
},
|
|
7469
7468
|
{
|
|
7470
7469
|
title: "OpensteerPageGotoInput",
|
|
@@ -7615,7 +7614,7 @@ var opensteerDomClickInputSchema = objectSchema(
|
|
|
7615
7614
|
{
|
|
7616
7615
|
target: opensteerTargetInputSchema,
|
|
7617
7616
|
persistAsDescription: stringSchema(),
|
|
7618
|
-
|
|
7617
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7619
7618
|
},
|
|
7620
7619
|
{
|
|
7621
7620
|
title: "OpensteerDomClickInput",
|
|
@@ -7626,7 +7625,7 @@ var opensteerDomHoverInputSchema = objectSchema(
|
|
|
7626
7625
|
{
|
|
7627
7626
|
target: opensteerTargetInputSchema,
|
|
7628
7627
|
persistAsDescription: stringSchema(),
|
|
7629
|
-
|
|
7628
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7630
7629
|
},
|
|
7631
7630
|
{
|
|
7632
7631
|
title: "OpensteerDomHoverInput",
|
|
@@ -7639,7 +7638,7 @@ var opensteerDomInputInputSchema = objectSchema(
|
|
|
7639
7638
|
text: stringSchema(),
|
|
7640
7639
|
pressEnter: { type: "boolean" },
|
|
7641
7640
|
persistAsDescription: stringSchema(),
|
|
7642
|
-
|
|
7641
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7643
7642
|
},
|
|
7644
7643
|
{
|
|
7645
7644
|
title: "OpensteerDomInputInput",
|
|
@@ -7652,7 +7651,7 @@ var opensteerDomScrollInputSchema = objectSchema(
|
|
|
7652
7651
|
direction: enumSchema(["up", "down", "left", "right"]),
|
|
7653
7652
|
amount: integerSchema({ minimum: 1 }),
|
|
7654
7653
|
persistAsDescription: stringSchema(),
|
|
7655
|
-
|
|
7654
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7656
7655
|
},
|
|
7657
7656
|
{
|
|
7658
7657
|
title: "OpensteerDomScrollInput",
|
|
@@ -7853,7 +7852,7 @@ var opensteerComputerExecuteInputSchema = objectSchema(
|
|
|
7853
7852
|
{
|
|
7854
7853
|
action: opensteerComputerActionSchema,
|
|
7855
7854
|
screenshot: opensteerComputerScreenshotOptionsSchema,
|
|
7856
|
-
|
|
7855
|
+
captureNetwork: stringSchema({ minLength: 1 })
|
|
7857
7856
|
},
|
|
7858
7857
|
{
|
|
7859
7858
|
title: "OpensteerComputerExecuteInput",
|
|
@@ -8989,7 +8988,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
8989
8988
|
page_ref_key: pageRefKey,
|
|
8990
8989
|
frame_ref: entry.record.frameRef ?? null,
|
|
8991
8990
|
document_ref: entry.record.documentRef ?? null,
|
|
8992
|
-
|
|
8991
|
+
capture: entry.capture ?? null,
|
|
8993
8992
|
method: entry.record.method,
|
|
8994
8993
|
method_lc: entry.record.method.toLowerCase(),
|
|
8995
8994
|
url: entry.record.url,
|
|
@@ -9102,39 +9101,31 @@ var SqliteSavedNetworkStore = class {
|
|
|
9102
9101
|
}
|
|
9103
9102
|
async clear(input = {}) {
|
|
9104
9103
|
const database = await this.requireDatabase();
|
|
9105
|
-
const countAll = database.prepare(`
|
|
9106
|
-
SELECT COUNT(*) AS cleared
|
|
9107
|
-
FROM saved_network_records
|
|
9108
|
-
`);
|
|
9109
|
-
const countByTag = database.prepare(`
|
|
9110
|
-
SELECT COUNT(DISTINCT record_id) AS cleared
|
|
9111
|
-
FROM saved_network_tags
|
|
9112
|
-
WHERE tag = @tag
|
|
9113
|
-
`);
|
|
9114
|
-
const deleteAllTags = database.prepare(`DELETE FROM saved_network_tags`);
|
|
9104
|
+
const countAll = database.prepare(`SELECT COUNT(*) AS cleared FROM saved_network_records`);
|
|
9115
9105
|
const deleteAllRecords = database.prepare(`DELETE FROM saved_network_records`);
|
|
9116
|
-
const
|
|
9117
|
-
|
|
9118
|
-
|
|
9106
|
+
const { whereSql, parameters } = buildSavedNetworkWhere(input);
|
|
9107
|
+
const countFiltered = database.prepare(`
|
|
9108
|
+
SELECT COUNT(*) AS cleared
|
|
9109
|
+
FROM saved_network_records r
|
|
9110
|
+
${whereSql}
|
|
9119
9111
|
`);
|
|
9120
|
-
const
|
|
9112
|
+
const deleteFiltered = database.prepare(`
|
|
9121
9113
|
DELETE FROM saved_network_records
|
|
9122
|
-
WHERE
|
|
9123
|
-
SELECT
|
|
9124
|
-
FROM
|
|
9125
|
-
|
|
9114
|
+
WHERE record_id IN (
|
|
9115
|
+
SELECT r.record_id
|
|
9116
|
+
FROM saved_network_records r
|
|
9117
|
+
${whereSql}
|
|
9126
9118
|
)
|
|
9127
9119
|
`);
|
|
9128
9120
|
return withSqliteTransaction(database, () => {
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
if (tag === void 0) {
|
|
9132
|
-
deleteAllTags.run();
|
|
9121
|
+
if (input.capture === void 0 && input.tag === void 0) {
|
|
9122
|
+
const cleared2 = countAll.get().cleared;
|
|
9133
9123
|
deleteAllRecords.run();
|
|
9134
|
-
return
|
|
9124
|
+
return cleared2;
|
|
9135
9125
|
}
|
|
9136
|
-
|
|
9137
|
-
|
|
9126
|
+
const args = parameters;
|
|
9127
|
+
const cleared = countFiltered.get(...args).cleared;
|
|
9128
|
+
deleteFiltered.run(...args);
|
|
9138
9129
|
return cleared;
|
|
9139
9130
|
});
|
|
9140
9131
|
}
|
|
@@ -9189,7 +9180,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
9189
9180
|
page_ref_key TEXT NOT NULL,
|
|
9190
9181
|
frame_ref TEXT,
|
|
9191
9182
|
document_ref TEXT,
|
|
9192
|
-
|
|
9183
|
+
capture TEXT,
|
|
9193
9184
|
method TEXT NOT NULL,
|
|
9194
9185
|
method_lc TEXT NOT NULL,
|
|
9195
9186
|
url TEXT NOT NULL,
|
|
@@ -9228,6 +9219,9 @@ var SqliteSavedNetworkStore = class {
|
|
|
9228
9219
|
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
9229
9220
|
ON saved_network_records (saved_at DESC);
|
|
9230
9221
|
|
|
9222
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
9223
|
+
ON saved_network_records (capture);
|
|
9224
|
+
|
|
9231
9225
|
CREATE TABLE IF NOT EXISTS saved_network_tags (
|
|
9232
9226
|
record_id TEXT NOT NULL REFERENCES saved_network_records(record_id) ON DELETE CASCADE,
|
|
9233
9227
|
tag TEXT NOT NULL,
|
|
@@ -9243,6 +9237,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
9243
9237
|
"capture_state",
|
|
9244
9238
|
"TEXT NOT NULL DEFAULT 'complete'"
|
|
9245
9239
|
);
|
|
9240
|
+
this.ensureColumn(database, "saved_network_records", "capture", "TEXT");
|
|
9246
9241
|
this.ensureColumn(
|
|
9247
9242
|
database,
|
|
9248
9243
|
"saved_network_records",
|
|
@@ -9283,9 +9278,9 @@ function buildSavedNetworkWhere(input) {
|
|
|
9283
9278
|
clauses.push("r.request_id = ?");
|
|
9284
9279
|
parameters.push(input.requestId);
|
|
9285
9280
|
}
|
|
9286
|
-
if (input.
|
|
9287
|
-
clauses.push("r.
|
|
9288
|
-
parameters.push(input.
|
|
9281
|
+
if (input.capture !== void 0) {
|
|
9282
|
+
clauses.push("r.capture = ?");
|
|
9283
|
+
parameters.push(input.capture);
|
|
9289
9284
|
}
|
|
9290
9285
|
if (input.tag !== void 0) {
|
|
9291
9286
|
clauses.push(`
|
|
@@ -9347,7 +9342,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
9347
9342
|
page_ref_key,
|
|
9348
9343
|
frame_ref,
|
|
9349
9344
|
document_ref,
|
|
9350
|
-
|
|
9345
|
+
capture,
|
|
9351
9346
|
method,
|
|
9352
9347
|
method_lc,
|
|
9353
9348
|
url,
|
|
@@ -9386,7 +9381,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
9386
9381
|
@page_ref_key,
|
|
9387
9382
|
@frame_ref,
|
|
9388
9383
|
@document_ref,
|
|
9389
|
-
@
|
|
9384
|
+
@capture,
|
|
9390
9385
|
@method,
|
|
9391
9386
|
@method_lc,
|
|
9392
9387
|
@url,
|
|
@@ -9423,7 +9418,7 @@ function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
|
9423
9418
|
page_ref_key = excluded.page_ref_key,
|
|
9424
9419
|
frame_ref = excluded.frame_ref,
|
|
9425
9420
|
document_ref = excluded.document_ref,
|
|
9426
|
-
|
|
9421
|
+
capture = excluded.capture,
|
|
9427
9422
|
method = excluded.method,
|
|
9428
9423
|
method_lc = excluded.method_lc,
|
|
9429
9424
|
url = excluded.url,
|
|
@@ -9518,7 +9513,7 @@ function inflateSavedNetworkRow(row, includeBodies) {
|
|
|
9518
9513
|
}
|
|
9519
9514
|
return {
|
|
9520
9515
|
recordId: row.record_id,
|
|
9521
|
-
...row.
|
|
9516
|
+
...row.capture === null ? {} : { capture: row.capture },
|
|
9522
9517
|
...row.tags === null || row.tags.length === 0 ? {} : { tags: row.tags.split(TAG_DELIMITER).filter((tag) => tag.length > 0) },
|
|
9523
9518
|
savedAt: row.saved_at,
|
|
9524
9519
|
record
|
|
@@ -12007,11 +12002,54 @@ function resolveCloudConfig(input = {}) {
|
|
|
12007
12002
|
|
|
12008
12003
|
// ../runtime-core/package.json
|
|
12009
12004
|
var package_default2 = {
|
|
12010
|
-
version: "0.1.
|
|
12005
|
+
version: "0.1.2"};
|
|
12011
12006
|
|
|
12012
12007
|
// ../runtime-core/src/version.ts
|
|
12013
12008
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default2.version;
|
|
12014
12009
|
|
|
12010
|
+
// ../runtime-core/src/action-boundary.ts
|
|
12011
|
+
var actionBoundaryDiagnosticsBySignal = /* @__PURE__ */ new WeakMap();
|
|
12012
|
+
async function captureActionBoundarySnapshot(engine, pageRef) {
|
|
12013
|
+
const frames = await engine.listFrames({ pageRef });
|
|
12014
|
+
const mainFrame = frames.find((frame) => frame.isMainFrame);
|
|
12015
|
+
if (!mainFrame) {
|
|
12016
|
+
throw new Error(`page ${pageRef} does not expose a main frame`);
|
|
12017
|
+
}
|
|
12018
|
+
return {
|
|
12019
|
+
pageRef,
|
|
12020
|
+
documentRef: mainFrame.documentRef
|
|
12021
|
+
};
|
|
12022
|
+
}
|
|
12023
|
+
function createActionBoundaryDiagnostics(input) {
|
|
12024
|
+
return {
|
|
12025
|
+
trigger: input.boundary.trigger,
|
|
12026
|
+
crossDocument: input.boundary.crossDocument,
|
|
12027
|
+
bootstrapSettled: input.boundary.bootstrapSettled,
|
|
12028
|
+
visualSettled: input.visualSettled,
|
|
12029
|
+
...input.boundary.timedOutPhase !== void 0 ? { timedOutPhase: input.boundary.timedOutPhase } : !input.visualSettled ? { timedOutPhase: "visual" } : {}
|
|
12030
|
+
};
|
|
12031
|
+
}
|
|
12032
|
+
function recordActionBoundaryDiagnostics(signal, diagnostics) {
|
|
12033
|
+
actionBoundaryDiagnosticsBySignal.set(signal, diagnostics);
|
|
12034
|
+
}
|
|
12035
|
+
function takeActionBoundaryDiagnostics(signal) {
|
|
12036
|
+
const diagnostics = actionBoundaryDiagnosticsBySignal.get(signal);
|
|
12037
|
+
actionBoundaryDiagnosticsBySignal.delete(signal);
|
|
12038
|
+
return diagnostics;
|
|
12039
|
+
}
|
|
12040
|
+
function isSoftSettleTimeoutError(error, signal) {
|
|
12041
|
+
if (isTimeoutError(error)) {
|
|
12042
|
+
return true;
|
|
12043
|
+
}
|
|
12044
|
+
return signal?.aborted === true && isTimeoutError(signal.reason) && (error === signal.reason || isAbortError(error));
|
|
12045
|
+
}
|
|
12046
|
+
function isAbortError(error) {
|
|
12047
|
+
return error instanceof Error && error.name === "AbortError";
|
|
12048
|
+
}
|
|
12049
|
+
function isTimeoutError(error) {
|
|
12050
|
+
return isOpensteerProtocolError(error) && error.code === "timeout";
|
|
12051
|
+
}
|
|
12052
|
+
|
|
12015
12053
|
// ../runtime-core/src/internal/errors.ts
|
|
12016
12054
|
function normalizeThrownOpensteerError(error, fallbackMessage) {
|
|
12017
12055
|
if (isOpensteerProtocolError(error)) {
|
|
@@ -12044,9 +12082,9 @@ var DEFAULT_TIMEOUTS = {
|
|
|
12044
12082
|
"page.add-init-script": 1e4,
|
|
12045
12083
|
"page.snapshot": 15e3,
|
|
12046
12084
|
"computer.execute": 3e4,
|
|
12047
|
-
"dom.click":
|
|
12085
|
+
"dom.click": 3e4,
|
|
12048
12086
|
"dom.hover": 1e4,
|
|
12049
|
-
"dom.input":
|
|
12087
|
+
"dom.input": 3e4,
|
|
12050
12088
|
"dom.scroll": 1e4,
|
|
12051
12089
|
"dom.extract": 15e3,
|
|
12052
12090
|
"network.query": 15e3,
|
|
@@ -13829,19 +13867,6 @@ var MemoryDomDescriptorStore = class {
|
|
|
13829
13867
|
}
|
|
13830
13868
|
};
|
|
13831
13869
|
|
|
13832
|
-
// ../runtime-core/src/action-boundary.ts
|
|
13833
|
-
async function captureActionBoundarySnapshot(engine, pageRef) {
|
|
13834
|
-
const frames = await engine.listFrames({ pageRef });
|
|
13835
|
-
const mainFrame = frames.find((frame) => frame.isMainFrame);
|
|
13836
|
-
if (!mainFrame) {
|
|
13837
|
-
throw new Error(`page ${pageRef} does not expose a main frame`);
|
|
13838
|
-
}
|
|
13839
|
-
return {
|
|
13840
|
-
pageRef,
|
|
13841
|
-
documentRef: mainFrame.documentRef
|
|
13842
|
-
};
|
|
13843
|
-
}
|
|
13844
|
-
|
|
13845
13870
|
// ../runtime-core/src/runtimes/dom/executor.ts
|
|
13846
13871
|
var MAX_DOM_ACTION_ATTEMPTS = 3;
|
|
13847
13872
|
var DEFAULT_SCROLL_OPTIONS = {
|
|
@@ -13973,7 +13998,7 @@ var DomActionExecutor = class {
|
|
|
13973
13998
|
let finalResolved = resolved;
|
|
13974
13999
|
let finalSnapshot;
|
|
13975
14000
|
if (input.pressEnter) {
|
|
13976
|
-
await this.
|
|
14001
|
+
await this.waitForPressEnterReaction(timeout);
|
|
13977
14002
|
const enterSession = this.options.createResolutionSession();
|
|
13978
14003
|
const enterResolved = await timeout.runStep(
|
|
13979
14004
|
() => this.options.resolveTarget(enterSession, {
|
|
@@ -13997,7 +14022,15 @@ var DomActionExecutor = class {
|
|
|
13997
14022
|
);
|
|
13998
14023
|
finalResolved = enterResolved;
|
|
13999
14024
|
}
|
|
14000
|
-
await this.settle(
|
|
14025
|
+
const settleDiagnostics = await this.settle(
|
|
14026
|
+
finalResolved.pageRef,
|
|
14027
|
+
"dom.input",
|
|
14028
|
+
timeout,
|
|
14029
|
+
finalSnapshot
|
|
14030
|
+
);
|
|
14031
|
+
if (finalSnapshot !== void 0) {
|
|
14032
|
+
recordActionBoundaryDiagnostics(timeout.signal, settleDiagnostics);
|
|
14033
|
+
}
|
|
14001
14034
|
return finalResolved;
|
|
14002
14035
|
} catch (error) {
|
|
14003
14036
|
lastError = error;
|
|
@@ -14074,12 +14107,13 @@ var DomActionExecutor = class {
|
|
|
14074
14107
|
() => captureActionBoundarySnapshot(this.options.engine, pointerTarget.resolved.pageRef)
|
|
14075
14108
|
);
|
|
14076
14109
|
const outcome = await dispatch(pointerTarget, point, timeout);
|
|
14077
|
-
await this.settle(
|
|
14110
|
+
const settleDiagnostics = await this.settle(
|
|
14078
14111
|
pointerTarget.resolved.pageRef,
|
|
14079
14112
|
input.operation,
|
|
14080
14113
|
timeout,
|
|
14081
14114
|
actionBoundarySnapshot
|
|
14082
14115
|
);
|
|
14116
|
+
recordActionBoundaryDiagnostics(timeout.signal, settleDiagnostics);
|
|
14083
14117
|
return outcome;
|
|
14084
14118
|
} catch (error) {
|
|
14085
14119
|
lastError = error;
|
|
@@ -14099,22 +14133,47 @@ var DomActionExecutor = class {
|
|
|
14099
14133
|
}
|
|
14100
14134
|
async settle(pageRef, operation, timeout, snapshot) {
|
|
14101
14135
|
const bridge = this.requireBridge();
|
|
14102
|
-
|
|
14136
|
+
let visualSettled = true;
|
|
14137
|
+
const boundary = await timeout.runStep(
|
|
14103
14138
|
() => bridge.finalizeDomAction(pageRef, {
|
|
14104
14139
|
operation,
|
|
14105
14140
|
...snapshot === void 0 ? {} : { snapshot },
|
|
14106
14141
|
signal: timeout.signal,
|
|
14107
14142
|
remainingMs: () => timeout.remainingMs(),
|
|
14108
|
-
policySettle: (targetPageRef, trigger) =>
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14143
|
+
policySettle: async (targetPageRef, trigger) => {
|
|
14144
|
+
try {
|
|
14145
|
+
await settleWithPolicy(this.options.policy.settle, {
|
|
14146
|
+
operation,
|
|
14147
|
+
trigger,
|
|
14148
|
+
engine: this.options.engine,
|
|
14149
|
+
pageRef: targetPageRef,
|
|
14150
|
+
signal: timeout.signal,
|
|
14151
|
+
remainingMs: timeout.remainingMs()
|
|
14152
|
+
});
|
|
14153
|
+
} catch (error) {
|
|
14154
|
+
if (snapshot !== void 0 && isSoftSettleTimeoutError(error, timeout.signal)) {
|
|
14155
|
+
visualSettled = false;
|
|
14156
|
+
return;
|
|
14157
|
+
}
|
|
14158
|
+
throw error;
|
|
14159
|
+
}
|
|
14160
|
+
}
|
|
14116
14161
|
})
|
|
14117
14162
|
);
|
|
14163
|
+
return createActionBoundaryDiagnostics({
|
|
14164
|
+
boundary,
|
|
14165
|
+
visualSettled
|
|
14166
|
+
});
|
|
14167
|
+
}
|
|
14168
|
+
async waitForPressEnterReaction(timeout) {
|
|
14169
|
+
const delayMs = this.options.policy.settle.resolveDelayMs({
|
|
14170
|
+
operation: "dom.input",
|
|
14171
|
+
trigger: "dom-action"
|
|
14172
|
+
});
|
|
14173
|
+
if (delayMs <= 0) {
|
|
14174
|
+
return;
|
|
14175
|
+
}
|
|
14176
|
+
await delayWithSignal(delayMs, timeout.signal);
|
|
14118
14177
|
}
|
|
14119
14178
|
requireBridge() {
|
|
14120
14179
|
if (this.bridge !== void 0) {
|
|
@@ -15384,6 +15443,7 @@ var DefaultComputerUseRuntime = class {
|
|
|
15384
15443
|
const snapshot = await input.timeout.runStep(
|
|
15385
15444
|
() => captureActionBoundarySnapshot(this.options.engine, input.pageRef)
|
|
15386
15445
|
);
|
|
15446
|
+
let visualSettled = true;
|
|
15387
15447
|
const executed = await input.timeout.runStep(
|
|
15388
15448
|
() => bridge.execute({
|
|
15389
15449
|
pageRef: input.pageRef,
|
|
@@ -15392,16 +15452,35 @@ var DefaultComputerUseRuntime = class {
|
|
|
15392
15452
|
screenshot,
|
|
15393
15453
|
signal: input.timeout.signal,
|
|
15394
15454
|
remainingMs: () => input.timeout.remainingMs(),
|
|
15395
|
-
policySettle: async (pageRef, trigger) =>
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15455
|
+
policySettle: async (pageRef, trigger) => {
|
|
15456
|
+
try {
|
|
15457
|
+
await settleWithPolicy(this.options.policy.settle, {
|
|
15458
|
+
operation: "computer.execute",
|
|
15459
|
+
trigger,
|
|
15460
|
+
engine: this.options.engine,
|
|
15461
|
+
pageRef,
|
|
15462
|
+
signal: input.timeout.signal,
|
|
15463
|
+
remainingMs: input.timeout.remainingMs()
|
|
15464
|
+
});
|
|
15465
|
+
} catch (error) {
|
|
15466
|
+
if (pageRef === input.pageRef && isSoftSettleTimeoutError(error, input.timeout.signal)) {
|
|
15467
|
+
visualSettled = false;
|
|
15468
|
+
return;
|
|
15469
|
+
}
|
|
15470
|
+
throw error;
|
|
15471
|
+
}
|
|
15472
|
+
}
|
|
15403
15473
|
})
|
|
15404
15474
|
);
|
|
15475
|
+
if (executed.boundary !== void 0 && executed.pageRef === input.pageRef) {
|
|
15476
|
+
recordActionBoundaryDiagnostics(
|
|
15477
|
+
input.timeout.signal,
|
|
15478
|
+
createActionBoundaryDiagnostics({
|
|
15479
|
+
boundary: executed.boundary,
|
|
15480
|
+
visualSettled
|
|
15481
|
+
})
|
|
15482
|
+
);
|
|
15483
|
+
}
|
|
15405
15484
|
let trace = void 0;
|
|
15406
15485
|
if (!input.timeout.signal.aborted) {
|
|
15407
15486
|
try {
|
|
@@ -16513,7 +16592,7 @@ function resolveBodyEncoding(charset) {
|
|
|
16513
16592
|
var NetworkHistory = class {
|
|
16514
16593
|
metadataByRequestId = /* @__PURE__ */ new Map();
|
|
16515
16594
|
requestIdByRecordId = /* @__PURE__ */ new Map();
|
|
16516
|
-
|
|
16595
|
+
requestIdsByCapture = /* @__PURE__ */ new Map();
|
|
16517
16596
|
requestIdsByTag = /* @__PURE__ */ new Map();
|
|
16518
16597
|
tombstonedRequestIds = /* @__PURE__ */ new Set();
|
|
16519
16598
|
materialize(records, options = {}) {
|
|
@@ -16560,17 +16639,17 @@ var NetworkHistory = class {
|
|
|
16560
16639
|
}
|
|
16561
16640
|
return persisted;
|
|
16562
16641
|
}
|
|
16563
|
-
|
|
16642
|
+
assignCapture(records, capture) {
|
|
16564
16643
|
for (const record of records) {
|
|
16565
16644
|
const metadata = this.metadataByRequestId.get(record.record.requestId);
|
|
16566
|
-
if (!metadata || metadata.
|
|
16645
|
+
if (!metadata || metadata.capture === capture) {
|
|
16567
16646
|
continue;
|
|
16568
16647
|
}
|
|
16569
|
-
if (metadata.
|
|
16570
|
-
this.
|
|
16648
|
+
if (metadata.capture !== void 0) {
|
|
16649
|
+
this.requestIdsByCapture.get(metadata.capture)?.delete(record.record.requestId);
|
|
16571
16650
|
}
|
|
16572
|
-
metadata.
|
|
16573
|
-
this.addIndexedRequestId(this.
|
|
16651
|
+
metadata.capture = capture;
|
|
16652
|
+
this.addIndexedRequestId(this.requestIdsByCapture, capture, record.record.requestId);
|
|
16574
16653
|
}
|
|
16575
16654
|
}
|
|
16576
16655
|
addTag(records, tag) {
|
|
@@ -16590,8 +16669,8 @@ var NetworkHistory = class {
|
|
|
16590
16669
|
getRequestId(recordId) {
|
|
16591
16670
|
return this.requestIdByRecordId.get(recordId);
|
|
16592
16671
|
}
|
|
16593
|
-
|
|
16594
|
-
return new Set(this.
|
|
16672
|
+
getRequestIdsForCapture(capture) {
|
|
16673
|
+
return new Set(this.requestIdsByCapture.get(capture) ?? []);
|
|
16595
16674
|
}
|
|
16596
16675
|
getRequestIdsForTag(tag) {
|
|
16597
16676
|
return new Set(this.requestIdsByTag.get(tag) ?? []);
|
|
@@ -16602,20 +16681,6 @@ var NetworkHistory = class {
|
|
|
16602
16681
|
getKnownRequestIds() {
|
|
16603
16682
|
return new Set(this.metadataByRequestId.keys());
|
|
16604
16683
|
}
|
|
16605
|
-
clearTag(tag) {
|
|
16606
|
-
const requestIds = [...this.requestIdsByTag.get(tag) ?? []];
|
|
16607
|
-
this.requestIdsByTag.delete(tag);
|
|
16608
|
-
for (const requestId of requestIds) {
|
|
16609
|
-
const metadata = this.metadataByRequestId.get(requestId);
|
|
16610
|
-
if (!metadata) {
|
|
16611
|
-
continue;
|
|
16612
|
-
}
|
|
16613
|
-
metadata.tags.delete(tag);
|
|
16614
|
-
if (metadata.tags.size === 0) {
|
|
16615
|
-
this.tombstoneRequestIds([requestId]);
|
|
16616
|
-
}
|
|
16617
|
-
}
|
|
16618
|
-
}
|
|
16619
16684
|
tombstoneRequestIds(requestIds) {
|
|
16620
16685
|
for (const requestId of requestIds) {
|
|
16621
16686
|
this.tombstonedRequestIds.add(requestId);
|
|
@@ -16625,8 +16690,8 @@ var NetworkHistory = class {
|
|
|
16625
16690
|
}
|
|
16626
16691
|
this.metadataByRequestId.delete(requestId);
|
|
16627
16692
|
this.requestIdByRecordId.delete(metadata.recordId);
|
|
16628
|
-
if (metadata.
|
|
16629
|
-
this.
|
|
16693
|
+
if (metadata.capture !== void 0) {
|
|
16694
|
+
this.requestIdsByCapture.get(metadata.capture)?.delete(requestId);
|
|
16630
16695
|
}
|
|
16631
16696
|
for (const tag of metadata.tags) {
|
|
16632
16697
|
this.requestIdsByTag.get(tag)?.delete(requestId);
|
|
@@ -16636,7 +16701,7 @@ var NetworkHistory = class {
|
|
|
16636
16701
|
clear() {
|
|
16637
16702
|
this.metadataByRequestId.clear();
|
|
16638
16703
|
this.requestIdByRecordId.clear();
|
|
16639
|
-
this.
|
|
16704
|
+
this.requestIdsByCapture.clear();
|
|
16640
16705
|
this.requestIdsByTag.clear();
|
|
16641
16706
|
this.tombstonedRequestIds.clear();
|
|
16642
16707
|
}
|
|
@@ -16659,7 +16724,7 @@ var NetworkHistory = class {
|
|
|
16659
16724
|
}
|
|
16660
16725
|
return {
|
|
16661
16726
|
recordId: metadata.recordId,
|
|
16662
|
-
...metadata.
|
|
16727
|
+
...metadata.capture === void 0 ? {} : { capture: metadata.capture },
|
|
16663
16728
|
...metadata.tags.size === 0 ? {} : { tags: [...metadata.tags].sort() },
|
|
16664
16729
|
...metadata.savedAt === void 0 ? {} : { savedAt: metadata.savedAt },
|
|
16665
16730
|
record: toProtocolNetworkRecord(record, {
|
|
@@ -23400,6 +23465,7 @@ function diffInteractionTraces(left, right) {
|
|
|
23400
23465
|
|
|
23401
23466
|
// ../runtime-core/src/sdk/runtime.ts
|
|
23402
23467
|
var requireForAuthRecipeHook = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bin.cjs', document.baseURI).href)));
|
|
23468
|
+
var MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS = 5e3;
|
|
23403
23469
|
var OpensteerSessionRuntime = class {
|
|
23404
23470
|
workspace;
|
|
23405
23471
|
rootPath;
|
|
@@ -23782,34 +23848,32 @@ var OpensteerSessionRuntime = class {
|
|
|
23782
23848
|
assertValidSemanticOperationInput("page.goto", input);
|
|
23783
23849
|
const pageRef = await this.ensurePageRef();
|
|
23784
23850
|
const startedAt = Date.now();
|
|
23851
|
+
let mutationCaptureDiagnostics;
|
|
23785
23852
|
try {
|
|
23786
|
-
const { navigation, state } = await this.
|
|
23853
|
+
const { navigation, state } = await this.runMutationCapturedOperation(
|
|
23787
23854
|
"page.goto",
|
|
23855
|
+
{
|
|
23856
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
23857
|
+
options
|
|
23858
|
+
},
|
|
23788
23859
|
async (timeout) => {
|
|
23789
|
-
const
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
|
|
23797
|
-
|
|
23798
|
-
|
|
23799
|
-
|
|
23800
|
-
await
|
|
23801
|
-
|
|
23802
|
-
navigation: navigation2,
|
|
23803
|
-
state: await timeout.runStep(() => this.readSessionState())
|
|
23804
|
-
};
|
|
23805
|
-
} catch (error) {
|
|
23806
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, input.networkTag).catch(
|
|
23807
|
-
() => void 0
|
|
23808
|
-
);
|
|
23809
|
-
throw error;
|
|
23810
|
-
}
|
|
23860
|
+
const navigation2 = await this.navigatePage(
|
|
23861
|
+
{
|
|
23862
|
+
operation: "page.goto",
|
|
23863
|
+
pageRef,
|
|
23864
|
+
url: input.url
|
|
23865
|
+
},
|
|
23866
|
+
timeout
|
|
23867
|
+
);
|
|
23868
|
+
timeout.throwIfAborted();
|
|
23869
|
+
return {
|
|
23870
|
+
navigation: navigation2,
|
|
23871
|
+
state: await timeout.runStep(() => this.readSessionState())
|
|
23872
|
+
};
|
|
23811
23873
|
},
|
|
23812
|
-
|
|
23874
|
+
(diagnostics) => {
|
|
23875
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
23876
|
+
}
|
|
23813
23877
|
);
|
|
23814
23878
|
await this.appendTrace({
|
|
23815
23879
|
operation: "page.goto",
|
|
@@ -23818,7 +23882,8 @@ var OpensteerSessionRuntime = class {
|
|
|
23818
23882
|
outcome: "ok",
|
|
23819
23883
|
data: {
|
|
23820
23884
|
url: input.url,
|
|
23821
|
-
state
|
|
23885
|
+
state,
|
|
23886
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
23822
23887
|
},
|
|
23823
23888
|
context: buildRuntimeTraceContext({
|
|
23824
23889
|
sessionRef: this.sessionRef,
|
|
@@ -23834,6 +23899,7 @@ var OpensteerSessionRuntime = class {
|
|
|
23834
23899
|
completedAt: Date.now(),
|
|
23835
23900
|
outcome: "error",
|
|
23836
23901
|
error,
|
|
23902
|
+
data: buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
23837
23903
|
context: buildRuntimeTraceContext({
|
|
23838
23904
|
sessionRef: this.sessionRef,
|
|
23839
23905
|
pageRef
|
|
@@ -23846,34 +23912,29 @@ var OpensteerSessionRuntime = class {
|
|
|
23846
23912
|
assertValidSemanticOperationInput("page.evaluate", input);
|
|
23847
23913
|
const pageRef = input.pageRef ?? await this.ensurePageRef();
|
|
23848
23914
|
const startedAt = Date.now();
|
|
23915
|
+
let mutationCaptureDiagnostics;
|
|
23849
23916
|
try {
|
|
23850
|
-
const output = await this.
|
|
23917
|
+
const output = await this.runMutationCapturedOperation(
|
|
23851
23918
|
"page.evaluate",
|
|
23919
|
+
{ options },
|
|
23852
23920
|
async (timeout) => {
|
|
23853
|
-
const
|
|
23854
|
-
|
|
23855
|
-
|
|
23856
|
-
const evaluated = await timeout.runStep(
|
|
23857
|
-
() => this.requireEngine().evaluatePage({
|
|
23858
|
-
pageRef,
|
|
23859
|
-
script: input.script,
|
|
23860
|
-
...input.args === void 0 ? {} : { args: input.args },
|
|
23861
|
-
...remainingMs === void 0 ? {} : { timeoutMs: remainingMs }
|
|
23862
|
-
})
|
|
23863
|
-
);
|
|
23864
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, void 0);
|
|
23865
|
-
return {
|
|
23921
|
+
const remainingMs = timeout.remainingMs();
|
|
23922
|
+
const evaluated = await timeout.runStep(
|
|
23923
|
+
() => this.requireEngine().evaluatePage({
|
|
23866
23924
|
pageRef,
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
|
|
23925
|
+
script: input.script,
|
|
23926
|
+
...input.args === void 0 ? {} : { args: input.args },
|
|
23927
|
+
...remainingMs === void 0 ? {} : { timeoutMs: remainingMs }
|
|
23928
|
+
})
|
|
23929
|
+
);
|
|
23930
|
+
return {
|
|
23931
|
+
pageRef,
|
|
23932
|
+
value: toJsonValueOrNull(evaluated.data)
|
|
23933
|
+
};
|
|
23875
23934
|
},
|
|
23876
|
-
|
|
23935
|
+
(diagnostics) => {
|
|
23936
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
23937
|
+
}
|
|
23877
23938
|
);
|
|
23878
23939
|
await this.appendTrace({
|
|
23879
23940
|
operation: "page.evaluate",
|
|
@@ -23882,7 +23943,8 @@ var OpensteerSessionRuntime = class {
|
|
|
23882
23943
|
outcome: "ok",
|
|
23883
23944
|
data: {
|
|
23884
23945
|
pageRef: output.pageRef,
|
|
23885
|
-
value: output.value
|
|
23946
|
+
value: output.value,
|
|
23947
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
23886
23948
|
},
|
|
23887
23949
|
context: buildRuntimeTraceContext({
|
|
23888
23950
|
sessionRef: this.sessionRef,
|
|
@@ -23897,6 +23959,7 @@ var OpensteerSessionRuntime = class {
|
|
|
23897
23959
|
completedAt: Date.now(),
|
|
23898
23960
|
outcome: "error",
|
|
23899
23961
|
error,
|
|
23962
|
+
data: buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
23900
23963
|
context: buildRuntimeTraceContext({
|
|
23901
23964
|
sessionRef: this.sessionRef,
|
|
23902
23965
|
pageRef
|
|
@@ -24336,17 +24399,29 @@ var OpensteerSessionRuntime = class {
|
|
|
24336
24399
|
"network.clear",
|
|
24337
24400
|
async (timeout) => {
|
|
24338
24401
|
if (this.sessionRef !== void 0) {
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24402
|
+
if (input.capture !== void 0 || input.tag !== void 0) {
|
|
24403
|
+
const records = await this.queryLiveNetwork(
|
|
24404
|
+
{
|
|
24405
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
24406
|
+
...input.tag === void 0 ? {} : { tag: input.tag }
|
|
24407
|
+
},
|
|
24408
|
+
timeout,
|
|
24409
|
+
{
|
|
24410
|
+
ignoreLimit: true
|
|
24411
|
+
}
|
|
24412
|
+
);
|
|
24413
|
+
this.networkHistory.tombstoneRequestIds(
|
|
24414
|
+
records.map((record) => record.record.requestId)
|
|
24415
|
+
);
|
|
24416
|
+
} else {
|
|
24417
|
+
const liveRequestIds = await this.readLiveRequestIds(timeout, {
|
|
24418
|
+
includeCurrentPageOnly: false
|
|
24419
|
+
});
|
|
24343
24420
|
this.networkHistory.tombstoneRequestIds(liveRequestIds);
|
|
24344
24421
|
}
|
|
24345
24422
|
}
|
|
24346
|
-
if (input.tag === void 0) {
|
|
24423
|
+
if (input.capture === void 0 && input.tag === void 0) {
|
|
24347
24424
|
this.networkHistory.tombstoneRequestIds(this.networkHistory.getKnownRequestIds());
|
|
24348
|
-
} else {
|
|
24349
|
-
this.networkHistory.clearTag(input.tag);
|
|
24350
24425
|
}
|
|
24351
24426
|
return {
|
|
24352
24427
|
clearedCount: await timeout.runStep(() => root.registry.savedNetwork.clear(input))
|
|
@@ -24360,6 +24435,7 @@ var OpensteerSessionRuntime = class {
|
|
|
24360
24435
|
completedAt: Date.now(),
|
|
24361
24436
|
outcome: "ok",
|
|
24362
24437
|
data: {
|
|
24438
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
24363
24439
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
24364
24440
|
clearedCount: output.clearedCount
|
|
24365
24441
|
}
|
|
@@ -25541,7 +25617,9 @@ var OpensteerSessionRuntime = class {
|
|
|
25541
25617
|
};
|
|
25542
25618
|
}
|
|
25543
25619
|
const bindings = /* @__PURE__ */ new Map();
|
|
25544
|
-
const baselineRequestIds = await this.
|
|
25620
|
+
const baselineRequestIds = await this.readLiveRequestIds(timeout, {
|
|
25621
|
+
includeCurrentPageOnly: true
|
|
25622
|
+
});
|
|
25545
25623
|
const pageRef = explicitPageRef ?? await this.ensurePageRef();
|
|
25546
25624
|
const validatorMap = new Map(
|
|
25547
25625
|
packageRecord.payload.validators.map((validator) => [validator.id, validator])
|
|
@@ -27213,33 +27291,38 @@ var OpensteerSessionRuntime = class {
|
|
|
27213
27291
|
assertValidSemanticOperationInput("computer.execute", input);
|
|
27214
27292
|
const pageRef = await this.ensurePageRef();
|
|
27215
27293
|
const startedAt = Date.now();
|
|
27294
|
+
let mutationCaptureDiagnostics;
|
|
27295
|
+
let boundaryDiagnostics;
|
|
27216
27296
|
try {
|
|
27217
|
-
const { artifacts, output } = await this.
|
|
27297
|
+
const { artifacts, output } = await this.runMutationCapturedOperation(
|
|
27218
27298
|
"computer.execute",
|
|
27299
|
+
{
|
|
27300
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
27301
|
+
options
|
|
27302
|
+
},
|
|
27219
27303
|
async (timeout) => {
|
|
27220
|
-
const baselineRequestIds = await this.beginMutationCapture(timeout);
|
|
27221
27304
|
try {
|
|
27222
27305
|
const output2 = await this.requireComputer().execute({
|
|
27223
27306
|
pageRef,
|
|
27224
27307
|
input,
|
|
27225
27308
|
timeout
|
|
27226
27309
|
});
|
|
27310
|
+
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
27227
27311
|
timeout.throwIfAborted();
|
|
27228
27312
|
this.pageRef = output2.pageRef;
|
|
27229
|
-
await this.completeMutationCapture(timeout, baselineRequestIds, input.networkTag);
|
|
27230
27313
|
const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
|
|
27231
27314
|
return {
|
|
27232
27315
|
artifacts: { manifests: artifacts2.manifests },
|
|
27233
27316
|
output: artifacts2.output
|
|
27234
27317
|
};
|
|
27235
27318
|
} catch (error) {
|
|
27236
|
-
|
|
27237
|
-
() => void 0
|
|
27238
|
-
);
|
|
27319
|
+
boundaryDiagnostics ??= takeActionBoundaryDiagnostics(timeout.signal);
|
|
27239
27320
|
throw error;
|
|
27240
27321
|
}
|
|
27241
27322
|
},
|
|
27242
|
-
|
|
27323
|
+
(diagnostics) => {
|
|
27324
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
27325
|
+
}
|
|
27243
27326
|
);
|
|
27244
27327
|
await this.appendTrace({
|
|
27245
27328
|
operation: "computer.execute",
|
|
@@ -27255,6 +27338,8 @@ var OpensteerSessionRuntime = class {
|
|
|
27255
27338
|
nativeViewport: output.nativeViewport,
|
|
27256
27339
|
displayScale: output.displayScale,
|
|
27257
27340
|
timing: output.timing,
|
|
27341
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
27342
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics),
|
|
27258
27343
|
...output.trace === void 0 ? {} : { trace: output.trace }
|
|
27259
27344
|
},
|
|
27260
27345
|
context: buildRuntimeTraceContext({
|
|
@@ -27273,6 +27358,10 @@ var OpensteerSessionRuntime = class {
|
|
|
27273
27358
|
completedAt: Date.now(),
|
|
27274
27359
|
outcome: "error",
|
|
27275
27360
|
error,
|
|
27361
|
+
data: {
|
|
27362
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
27363
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
27364
|
+
},
|
|
27276
27365
|
context: buildRuntimeTraceContext({
|
|
27277
27366
|
sessionRef: this.sessionRef,
|
|
27278
27367
|
pageRef: this.pageRef
|
|
@@ -27376,33 +27465,38 @@ var OpensteerSessionRuntime = class {
|
|
|
27376
27465
|
async runDomAction(operation, input, executor, options = {}) {
|
|
27377
27466
|
const pageRef = await this.ensurePageRef();
|
|
27378
27467
|
const startedAt = Date.now();
|
|
27468
|
+
let mutationCaptureDiagnostics;
|
|
27469
|
+
let boundaryDiagnostics;
|
|
27379
27470
|
try {
|
|
27380
|
-
const { executed, preparedTarget } = await this.
|
|
27471
|
+
const { executed, preparedTarget } = await this.runMutationCapturedOperation(
|
|
27381
27472
|
operation,
|
|
27473
|
+
{
|
|
27474
|
+
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork },
|
|
27475
|
+
options
|
|
27476
|
+
},
|
|
27382
27477
|
async (timeout) => {
|
|
27383
|
-
const
|
|
27478
|
+
const preparedTarget2 = await this.prepareDomTarget(
|
|
27479
|
+
pageRef,
|
|
27480
|
+
operation,
|
|
27481
|
+
input.target,
|
|
27482
|
+
input.persistAsDescription,
|
|
27483
|
+
timeout
|
|
27484
|
+
);
|
|
27384
27485
|
try {
|
|
27385
|
-
const preparedTarget2 = await this.prepareDomTarget(
|
|
27386
|
-
pageRef,
|
|
27387
|
-
operation,
|
|
27388
|
-
input.target,
|
|
27389
|
-
input.persistAsDescription,
|
|
27390
|
-
timeout
|
|
27391
|
-
);
|
|
27392
27486
|
const executed2 = await executor(pageRef, preparedTarget2.target, timeout);
|
|
27393
|
-
|
|
27487
|
+
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
27394
27488
|
return {
|
|
27395
27489
|
executed: executed2,
|
|
27396
27490
|
preparedTarget: preparedTarget2
|
|
27397
27491
|
};
|
|
27398
27492
|
} catch (error) {
|
|
27399
|
-
|
|
27400
|
-
() => void 0
|
|
27401
|
-
);
|
|
27493
|
+
boundaryDiagnostics ??= takeActionBoundaryDiagnostics(timeout.signal);
|
|
27402
27494
|
throw error;
|
|
27403
27495
|
}
|
|
27404
27496
|
},
|
|
27405
|
-
|
|
27497
|
+
(diagnostics) => {
|
|
27498
|
+
mutationCaptureDiagnostics = diagnostics;
|
|
27499
|
+
}
|
|
27406
27500
|
);
|
|
27407
27501
|
const output = toOpensteerActionResult(executed.result, preparedTarget.persistedDescription);
|
|
27408
27502
|
await this.appendTrace({
|
|
@@ -27413,7 +27507,9 @@ var OpensteerSessionRuntime = class {
|
|
|
27413
27507
|
data: {
|
|
27414
27508
|
target: output.target,
|
|
27415
27509
|
...output.point === void 0 ? {} : { point: output.point },
|
|
27416
|
-
...output.persistedDescription === void 0 ? {} : { persistedDescription: output.persistedDescription }
|
|
27510
|
+
...output.persistedDescription === void 0 ? {} : { persistedDescription: output.persistedDescription },
|
|
27511
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
27512
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
27417
27513
|
},
|
|
27418
27514
|
context: buildRuntimeTraceContext({
|
|
27419
27515
|
sessionRef: this.sessionRef,
|
|
@@ -27431,6 +27527,10 @@ var OpensteerSessionRuntime = class {
|
|
|
27431
27527
|
completedAt: Date.now(),
|
|
27432
27528
|
outcome: "error",
|
|
27433
27529
|
error,
|
|
27530
|
+
data: {
|
|
27531
|
+
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
27532
|
+
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
27533
|
+
},
|
|
27434
27534
|
context: buildRuntimeTraceContext({
|
|
27435
27535
|
sessionRef: this.sessionRef,
|
|
27436
27536
|
pageRef
|
|
@@ -27540,7 +27640,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27540
27640
|
const filtered = filterNetworkQueryRecords(metadataRecords, {
|
|
27541
27641
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
27542
27642
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
27543
|
-
...input.
|
|
27643
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
27544
27644
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
27545
27645
|
...input.url === void 0 ? {} : { url: input.url },
|
|
27546
27646
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
@@ -27746,32 +27846,68 @@ var OpensteerSessionRuntime = class {
|
|
|
27746
27846
|
artifactId: manifest.artifactId
|
|
27747
27847
|
};
|
|
27748
27848
|
}
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
{
|
|
27758
|
-
includeBodies: false,
|
|
27759
|
-
includeCurrentPageOnly: true
|
|
27849
|
+
async runMutationCapturedOperation(operation, input, execute, onFinalized) {
|
|
27850
|
+
let plan;
|
|
27851
|
+
try {
|
|
27852
|
+
const result = await this.runWithOperationTimeout(
|
|
27853
|
+
operation,
|
|
27854
|
+
async (timeout) => {
|
|
27855
|
+
plan = await this.beginMutationCapture(timeout, input.captureNetwork);
|
|
27856
|
+
return execute(timeout);
|
|
27760
27857
|
},
|
|
27761
|
-
|
|
27762
|
-
)
|
|
27858
|
+
input.options
|
|
27859
|
+
);
|
|
27860
|
+
const diagnostics = await this.finalizeMutationCaptureBestEffort(plan);
|
|
27861
|
+
onFinalized?.(diagnostics);
|
|
27862
|
+
return result;
|
|
27863
|
+
} catch (error) {
|
|
27864
|
+
const diagnostics = await this.finalizeMutationCaptureBestEffort(plan);
|
|
27865
|
+
onFinalized?.(diagnostics);
|
|
27866
|
+
throw error;
|
|
27867
|
+
}
|
|
27868
|
+
}
|
|
27869
|
+
async beginMutationCapture(timeout, capture) {
|
|
27870
|
+
if (capture === void 0) {
|
|
27871
|
+
return void 0;
|
|
27872
|
+
}
|
|
27873
|
+
return {
|
|
27874
|
+
baselineRequestIds: await this.readLiveRequestIds(timeout, {
|
|
27875
|
+
includeCurrentPageOnly: true
|
|
27876
|
+
}),
|
|
27877
|
+
capture
|
|
27878
|
+
};
|
|
27879
|
+
}
|
|
27880
|
+
async finalizeMutationCaptureBestEffort(plan) {
|
|
27881
|
+
if (plan === void 0) {
|
|
27882
|
+
return {};
|
|
27883
|
+
}
|
|
27884
|
+
try {
|
|
27885
|
+
await withDetachedTimeoutSignal(MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS, async (signal) => {
|
|
27886
|
+
await this.completeMutationCaptureWithSignal(signal, plan);
|
|
27887
|
+
});
|
|
27888
|
+
return {};
|
|
27889
|
+
} catch (error) {
|
|
27890
|
+
return {
|
|
27891
|
+
finalizeError: normalizeOpensteerError(error)
|
|
27892
|
+
};
|
|
27893
|
+
}
|
|
27894
|
+
}
|
|
27895
|
+
async completeMutationCaptureWithSignal(signal, plan) {
|
|
27896
|
+
const records = await this.readLiveNetworkRecords(
|
|
27897
|
+
{
|
|
27898
|
+
includeBodies: false,
|
|
27899
|
+
includeCurrentPageOnly: true
|
|
27900
|
+
},
|
|
27901
|
+
signal
|
|
27763
27902
|
);
|
|
27764
|
-
const delta = records.filter((record) => !baselineRequestIds.has(record.record.requestId));
|
|
27903
|
+
const delta = records.filter((record) => !plan.baselineRequestIds.has(record.record.requestId));
|
|
27765
27904
|
if (delta.length === 0) {
|
|
27766
27905
|
return;
|
|
27767
27906
|
}
|
|
27768
|
-
this.networkHistory.
|
|
27769
|
-
|
|
27770
|
-
this.networkHistory.addTag(delta, networkTag);
|
|
27771
|
-
}
|
|
27772
|
-
await this.persistLiveRequestIds(
|
|
27907
|
+
this.networkHistory.assignCapture(delta, plan.capture);
|
|
27908
|
+
await this.persistLiveRequestIdsWithSignal(
|
|
27773
27909
|
delta.map((record) => record.record.requestId),
|
|
27774
|
-
|
|
27910
|
+
signal,
|
|
27775
27911
|
{
|
|
27776
27912
|
includeCurrentPageOnly: true
|
|
27777
27913
|
}
|
|
@@ -28178,27 +28314,28 @@ var OpensteerSessionRuntime = class {
|
|
|
28178
28314
|
});
|
|
28179
28315
|
}
|
|
28180
28316
|
async persistLiveRequestIds(requestIds, timeout, options) {
|
|
28317
|
+
return timeout.runStep(
|
|
28318
|
+
() => this.persistLiveRequestIdsWithSignal(requestIds, timeout.signal, options)
|
|
28319
|
+
);
|
|
28320
|
+
}
|
|
28321
|
+
async persistLiveRequestIdsWithSignal(requestIds, signal, options) {
|
|
28181
28322
|
if (requestIds.length === 0) {
|
|
28182
28323
|
return [];
|
|
28183
28324
|
}
|
|
28184
28325
|
const root = await this.ensureRoot();
|
|
28185
|
-
const browserRecords = await
|
|
28186
|
-
|
|
28187
|
-
|
|
28188
|
-
|
|
28189
|
-
|
|
28190
|
-
|
|
28191
|
-
|
|
28192
|
-
|
|
28193
|
-
timeout.signal
|
|
28194
|
-
)
|
|
28195
|
-
);
|
|
28196
|
-
return timeout.runStep(
|
|
28197
|
-
() => this.networkHistory.persist(browserRecords, root.registry.savedNetwork, {
|
|
28198
|
-
bodyWriteMode: "authoritative",
|
|
28199
|
-
redactSecretHeaders: false
|
|
28200
|
-
})
|
|
28326
|
+
const browserRecords = await this.readBrowserNetworkRecords(
|
|
28327
|
+
{
|
|
28328
|
+
includeBodies: true,
|
|
28329
|
+
includeCurrentPageOnly: options.includeCurrentPageOnly,
|
|
28330
|
+
...options.pageRef === void 0 ? {} : { pageRef: options.pageRef },
|
|
28331
|
+
requestIds
|
|
28332
|
+
},
|
|
28333
|
+
signal
|
|
28201
28334
|
);
|
|
28335
|
+
return this.networkHistory.persist(browserRecords, root.registry.savedNetwork, {
|
|
28336
|
+
bodyWriteMode: "authoritative",
|
|
28337
|
+
redactSecretHeaders: false
|
|
28338
|
+
});
|
|
28202
28339
|
}
|
|
28203
28340
|
async syncPersistedNetworkSelection(timeout, input, options) {
|
|
28204
28341
|
if (this.sessionRef === void 0) {
|
|
@@ -28240,7 +28377,7 @@ var OpensteerSessionRuntime = class {
|
|
|
28240
28377
|
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
28241
28378
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
28242
28379
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
28243
|
-
...input.
|
|
28380
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
28244
28381
|
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
28245
28382
|
...input.url === void 0 ? {} : { url: input.url },
|
|
28246
28383
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
@@ -28257,7 +28394,7 @@ var OpensteerSessionRuntime = class {
|
|
|
28257
28394
|
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
28258
28395
|
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
28259
28396
|
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
28260
|
-
...input.
|
|
28397
|
+
...input.capture === void 0 ? {} : { capture: input.capture },
|
|
28261
28398
|
...input.url === void 0 ? {} : { url: input.url },
|
|
28262
28399
|
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
28263
28400
|
...input.path === void 0 ? {} : { path: input.path },
|
|
@@ -29819,8 +29956,8 @@ function resolveLiveQueryRequestIds(input, history) {
|
|
|
29819
29956
|
if (input.requestId !== void 0) {
|
|
29820
29957
|
requestIdCandidates.push(/* @__PURE__ */ new Set([input.requestId]));
|
|
29821
29958
|
}
|
|
29822
|
-
if (input.
|
|
29823
|
-
requestIdCandidates.push(history.
|
|
29959
|
+
if (input.capture !== void 0) {
|
|
29960
|
+
requestIdCandidates.push(history.getRequestIdsForCapture(input.capture));
|
|
29824
29961
|
}
|
|
29825
29962
|
if (input.tag !== void 0) {
|
|
29826
29963
|
requestIdCandidates.push(history.getRequestIdsForTag(input.tag));
|
|
@@ -29867,7 +30004,7 @@ function filterNetworkQueryRecords(records, input) {
|
|
|
29867
30004
|
if (input.requestId !== void 0 && record.record.requestId !== input.requestId) {
|
|
29868
30005
|
return false;
|
|
29869
30006
|
}
|
|
29870
|
-
if (input.
|
|
30007
|
+
if (input.capture !== void 0 && record.capture !== input.capture) {
|
|
29871
30008
|
return false;
|
|
29872
30009
|
}
|
|
29873
30010
|
if (input.tag !== void 0 && !(record.tags ?? []).includes(input.tag)) {
|
|
@@ -32277,9 +32414,40 @@ function toOpensteerResolvedTarget2(target) {
|
|
|
32277
32414
|
function normalizeOpensteerError(error) {
|
|
32278
32415
|
return normalizeThrownOpensteerError(error, "Unknown Opensteer runtime failure");
|
|
32279
32416
|
}
|
|
32417
|
+
function buildMutationCaptureTraceData(diagnostics) {
|
|
32418
|
+
if (diagnostics?.finalizeError === void 0) {
|
|
32419
|
+
return {};
|
|
32420
|
+
}
|
|
32421
|
+
return {
|
|
32422
|
+
networkCapture: {
|
|
32423
|
+
finalizeError: diagnostics.finalizeError
|
|
32424
|
+
}
|
|
32425
|
+
};
|
|
32426
|
+
}
|
|
32280
32427
|
function isIgnorableRuntimeBindingError(error) {
|
|
32281
32428
|
return isBrowserCoreError(error) && (error.code === "not-found" || error.code === "page-closed" || error.code === "session-closed");
|
|
32282
32429
|
}
|
|
32430
|
+
async function withDetachedTimeoutSignal(timeoutMs, operation) {
|
|
32431
|
+
const controller = new AbortController();
|
|
32432
|
+
const timeoutError = new OpensteerProtocolError(
|
|
32433
|
+
"timeout",
|
|
32434
|
+
`mutation capture finalization exceeded ${String(timeoutMs)}ms timeout`,
|
|
32435
|
+
{
|
|
32436
|
+
details: {
|
|
32437
|
+
policy: "mutation-capture-finalize",
|
|
32438
|
+
budgetMs: timeoutMs
|
|
32439
|
+
}
|
|
32440
|
+
}
|
|
32441
|
+
);
|
|
32442
|
+
const timer = setTimeout(() => {
|
|
32443
|
+
controller.abort(timeoutError);
|
|
32444
|
+
}, timeoutMs);
|
|
32445
|
+
try {
|
|
32446
|
+
return await operation(controller.signal);
|
|
32447
|
+
} finally {
|
|
32448
|
+
clearTimeout(timer);
|
|
32449
|
+
}
|
|
32450
|
+
}
|
|
32283
32451
|
function screenshotMediaType(format2) {
|
|
32284
32452
|
switch (format2) {
|
|
32285
32453
|
case "png":
|