@opensteer/runtime-core 0.1.6 → 0.2.0
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 +13 -0
- package/dist/index.cjs +298 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -16
- package/dist/index.d.ts +21 -16
- package/dist/index.js +296 -234
- package/dist/index.js.map +1 -1
- package/package.json +18 -3
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ var vm__default = /*#__PURE__*/_interopDefault(vm);
|
|
|
41
41
|
|
|
42
42
|
// package.json
|
|
43
43
|
var package_default = {
|
|
44
|
-
version: "0.
|
|
44
|
+
version: "0.2.0"};
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
47
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
|
|
@@ -2386,6 +2386,16 @@ var opensteerNetworkQueryOutputSchema = objectSchema(
|
|
|
2386
2386
|
required: ["records"]
|
|
2387
2387
|
}
|
|
2388
2388
|
);
|
|
2389
|
+
var opensteerNetworkDetailInputSchema = objectSchema(
|
|
2390
|
+
{
|
|
2391
|
+
recordId: stringSchema({ minLength: 1 }),
|
|
2392
|
+
probe: { type: "boolean" }
|
|
2393
|
+
},
|
|
2394
|
+
{
|
|
2395
|
+
title: "OpensteerNetworkDetailInput",
|
|
2396
|
+
required: ["recordId"]
|
|
2397
|
+
}
|
|
2398
|
+
);
|
|
2389
2399
|
var opensteerParsedCookieSchema = objectSchema(
|
|
2390
2400
|
{
|
|
2391
2401
|
name: stringSchema({ minLength: 1 }),
|
|
@@ -2422,6 +2432,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
|
|
|
2422
2432
|
required: ["method", "url"]
|
|
2423
2433
|
}
|
|
2424
2434
|
);
|
|
2435
|
+
var opensteerReplayAttemptSchema = objectSchema(
|
|
2436
|
+
{
|
|
2437
|
+
transport: transportKindSchema,
|
|
2438
|
+
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2439
|
+
ok: { type: "boolean" },
|
|
2440
|
+
durationMs: integerSchema({ minimum: 0 }),
|
|
2441
|
+
note: stringSchema(),
|
|
2442
|
+
error: stringSchema()
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
title: "OpensteerReplayAttempt",
|
|
2446
|
+
required: ["transport", "ok", "durationMs"]
|
|
2447
|
+
}
|
|
2448
|
+
);
|
|
2425
2449
|
var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
2426
2450
|
{
|
|
2427
2451
|
recordId: stringSchema({ minLength: 1 }),
|
|
@@ -2445,28 +2469,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
|
2445
2469
|
}
|
|
2446
2470
|
),
|
|
2447
2471
|
redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
|
|
2448
|
-
notes: arraySchema(stringSchema())
|
|
2472
|
+
notes: arraySchema(stringSchema()),
|
|
2473
|
+
transportProbe: objectSchema(
|
|
2474
|
+
{
|
|
2475
|
+
recommended: transportKindSchema,
|
|
2476
|
+
attempts: arraySchema(opensteerReplayAttemptSchema)
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
title: "OpensteerTransportProbeResult",
|
|
2480
|
+
required: ["attempts"]
|
|
2481
|
+
}
|
|
2482
|
+
)
|
|
2449
2483
|
},
|
|
2450
2484
|
{
|
|
2451
2485
|
title: "OpensteerNetworkDetailOutput",
|
|
2452
2486
|
required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
|
|
2453
2487
|
}
|
|
2454
2488
|
);
|
|
2455
|
-
|
|
2456
|
-
{
|
|
2457
|
-
transport: transportKindSchema,
|
|
2458
|
-
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2459
|
-
ok: { type: "boolean" },
|
|
2460
|
-
durationMs: integerSchema({ minimum: 0 }),
|
|
2461
|
-
note: stringSchema(),
|
|
2462
|
-
error: stringSchema()
|
|
2463
|
-
},
|
|
2464
|
-
{
|
|
2465
|
-
title: "OpensteerReplayAttempt",
|
|
2466
|
-
required: ["transport", "ok", "durationMs"]
|
|
2467
|
-
}
|
|
2468
|
-
);
|
|
2469
|
-
var opensteerNetworkReplayInputSchema = objectSchema(
|
|
2489
|
+
objectSchema(
|
|
2470
2490
|
{
|
|
2471
2491
|
recordId: stringSchema({ minLength: 1 }),
|
|
2472
2492
|
pageRef: pageRefSchema,
|
|
@@ -2480,9 +2500,8 @@ var opensteerNetworkReplayInputSchema = objectSchema(
|
|
|
2480
2500
|
required: ["recordId"]
|
|
2481
2501
|
}
|
|
2482
2502
|
);
|
|
2483
|
-
var opensteerNetworkReplayOutputSchema;
|
|
2484
2503
|
var opensteerSessionFetchTransportSchema = enumSchema(
|
|
2485
|
-
["auto", "direct", "matched-tls", "page"],
|
|
2504
|
+
["auto", "direct", "matched-tls", "context", "page"],
|
|
2486
2505
|
{
|
|
2487
2506
|
title: "OpensteerSessionFetchTransport"
|
|
2488
2507
|
}
|
|
@@ -2822,7 +2841,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
|
|
|
2822
2841
|
required: ["url", "status", "statusText", "headers", "redirected"]
|
|
2823
2842
|
}
|
|
2824
2843
|
);
|
|
2825
|
-
|
|
2844
|
+
objectSchema(
|
|
2826
2845
|
{
|
|
2827
2846
|
recordId: stringSchema({ minLength: 1 }),
|
|
2828
2847
|
transport: transportKindSchema,
|
|
@@ -5789,7 +5808,6 @@ var opensteerExposedSemanticOperationNames = [
|
|
|
5789
5808
|
"dom.extract",
|
|
5790
5809
|
"network.query",
|
|
5791
5810
|
"network.detail",
|
|
5792
|
-
"network.replay",
|
|
5793
5811
|
"interaction.capture",
|
|
5794
5812
|
"interaction.get",
|
|
5795
5813
|
"interaction.diff",
|
|
@@ -5826,7 +5844,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
|
|
|
5826
5844
|
"dom.extract",
|
|
5827
5845
|
"network.query",
|
|
5828
5846
|
"network.detail",
|
|
5829
|
-
"network.replay",
|
|
5830
5847
|
"interaction.capture",
|
|
5831
5848
|
"interaction.get",
|
|
5832
5849
|
"interaction.diff",
|
|
@@ -5947,11 +5964,11 @@ var targetByElementSchema2 = objectSchema(
|
|
|
5947
5964
|
var targetByPersistSchema2 = objectSchema(
|
|
5948
5965
|
{
|
|
5949
5966
|
kind: enumSchema(["persist"]),
|
|
5950
|
-
|
|
5967
|
+
persist: stringSchema()
|
|
5951
5968
|
},
|
|
5952
5969
|
{
|
|
5953
5970
|
title: "OpensteerTargetByPersist",
|
|
5954
|
-
required: ["kind", "
|
|
5971
|
+
required: ["kind", "persist"]
|
|
5955
5972
|
}
|
|
5956
5973
|
);
|
|
5957
5974
|
var targetBySelectorSchema2 = objectSchema(
|
|
@@ -5998,8 +6015,7 @@ var opensteerResolvedTargetSchema = objectSchema(
|
|
|
5998
6015
|
var opensteerActionResultSchema = objectSchema(
|
|
5999
6016
|
{
|
|
6000
6017
|
target: opensteerResolvedTargetSchema,
|
|
6001
|
-
point: pointSchema
|
|
6002
|
-
persisted: stringSchema()
|
|
6018
|
+
point: pointSchema
|
|
6003
6019
|
},
|
|
6004
6020
|
{
|
|
6005
6021
|
title: "OpensteerActionResult",
|
|
@@ -6256,18 +6272,12 @@ var opensteerPageSnapshotOutputSchema = objectSchema(
|
|
|
6256
6272
|
required: ["url", "title", "mode", "html", "counters"]
|
|
6257
6273
|
}
|
|
6258
6274
|
);
|
|
6259
|
-
var
|
|
6260
|
-
|
|
6261
|
-
recordId: stringSchema({ minLength: 1 })
|
|
6262
|
-
},
|
|
6275
|
+
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6276
|
+
["left", "middle", "right"],
|
|
6263
6277
|
{
|
|
6264
|
-
title: "
|
|
6265
|
-
required: ["recordId"]
|
|
6278
|
+
title: "OpensteerComputerMouseButton"
|
|
6266
6279
|
}
|
|
6267
6280
|
);
|
|
6268
|
-
var opensteerComputerMouseButtonSchema = enumSchema(["left", "middle", "right"], {
|
|
6269
|
-
title: "OpensteerComputerMouseButton"
|
|
6270
|
-
});
|
|
6271
6281
|
var opensteerComputerKeyModifierSchema = enumSchema(
|
|
6272
6282
|
["Shift", "Control", "Alt", "Meta"],
|
|
6273
6283
|
{
|
|
@@ -6344,10 +6354,7 @@ var opensteerDomExtractInputSchema = defineSchema({
|
|
|
6344
6354
|
title: "OpensteerDomExtractInput"
|
|
6345
6355
|
}
|
|
6346
6356
|
),
|
|
6347
|
-
anyOf: [
|
|
6348
|
-
defineSchema({ required: ["persist"] }),
|
|
6349
|
-
defineSchema({ required: ["schema"] })
|
|
6350
|
-
]
|
|
6357
|
+
anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
|
|
6351
6358
|
});
|
|
6352
6359
|
var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
|
|
6353
6360
|
var opensteerDomExtractOutputSchema = objectSchema(
|
|
@@ -6727,13 +6734,6 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
6727
6734
|
outputSchema: opensteerNetworkDetailOutputSchema,
|
|
6728
6735
|
requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
|
|
6729
6736
|
}),
|
|
6730
|
-
defineSemanticOperationSpec({
|
|
6731
|
-
name: "network.replay",
|
|
6732
|
-
description: "Replay a captured request through the transport ladder and report the transport that worked.",
|
|
6733
|
-
inputSchema: opensteerNetworkReplayInputSchema,
|
|
6734
|
-
outputSchema: opensteerNetworkReplayOutputSchema,
|
|
6735
|
-
requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
|
|
6736
|
-
}),
|
|
6737
6737
|
defineSemanticOperationSpec({
|
|
6738
6738
|
name: "interaction.capture",
|
|
6739
6739
|
description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
|
|
@@ -6841,6 +6841,7 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
6841
6841
|
case "direct":
|
|
6842
6842
|
return [];
|
|
6843
6843
|
case "matched-tls":
|
|
6844
|
+
case "context":
|
|
6844
6845
|
return ["inspect.cookies"];
|
|
6845
6846
|
case "page":
|
|
6846
6847
|
return ["pages.manage"];
|
|
@@ -7540,7 +7541,6 @@ var DEFAULT_TIMEOUTS = {
|
|
|
7540
7541
|
"dom.extract": 15e3,
|
|
7541
7542
|
"network.query": 15e3,
|
|
7542
7543
|
"network.detail": 15e3,
|
|
7543
|
-
"network.replay": 3e4,
|
|
7544
7544
|
"scripts.capture": 15e3,
|
|
7545
7545
|
"session.cookies": 1e4,
|
|
7546
7546
|
"session.storage": 1e4,
|
|
@@ -8362,13 +8362,6 @@ var SqliteSavedNetworkStore = class {
|
|
|
8362
8362
|
}
|
|
8363
8363
|
async save(records, options) {
|
|
8364
8364
|
const database = await this.requireDatabase();
|
|
8365
|
-
const readExisting = database.prepare(`
|
|
8366
|
-
SELECT record_id
|
|
8367
|
-
FROM saved_network_records
|
|
8368
|
-
WHERE session_ref = @session_ref
|
|
8369
|
-
AND page_ref_key = @page_ref_key
|
|
8370
|
-
AND request_id = @request_id
|
|
8371
|
-
`);
|
|
8372
8365
|
const upsertRecord = database.prepare(buildSavedNetworkUpsertSql(options.bodyWriteMode));
|
|
8373
8366
|
const insertTag = database.prepare(`
|
|
8374
8367
|
INSERT OR IGNORE INTO saved_network_tags (record_id, tag)
|
|
@@ -8379,14 +8372,8 @@ var SqliteSavedNetworkStore = class {
|
|
|
8379
8372
|
for (const entry of records) {
|
|
8380
8373
|
const url = new URL(entry.record.url);
|
|
8381
8374
|
const pageRefKey = entry.record.pageRef ?? "";
|
|
8382
|
-
const existing = readExisting.get({
|
|
8383
|
-
session_ref: entry.record.sessionRef,
|
|
8384
|
-
page_ref_key: pageRefKey,
|
|
8385
|
-
request_id: entry.record.requestId
|
|
8386
|
-
}) ?? void 0;
|
|
8387
|
-
const recordId = existing?.record_id ?? entry.recordId;
|
|
8388
8375
|
upsertRecord.run({
|
|
8389
|
-
record_id: recordId,
|
|
8376
|
+
record_id: entry.recordId,
|
|
8390
8377
|
request_id: entry.record.requestId,
|
|
8391
8378
|
session_ref: entry.record.sessionRef,
|
|
8392
8379
|
page_ref: entry.record.pageRef ?? null,
|
|
@@ -8431,7 +8418,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
8431
8418
|
}
|
|
8432
8419
|
for (const currentTag of tags) {
|
|
8433
8420
|
const result = insertTag.run({
|
|
8434
|
-
record_id: recordId,
|
|
8421
|
+
record_id: entry.recordId,
|
|
8435
8422
|
tag: currentTag
|
|
8436
8423
|
});
|
|
8437
8424
|
savedCount += result.changes ?? 0;
|
|
@@ -8534,6 +8521,49 @@ var SqliteSavedNetworkStore = class {
|
|
|
8534
8521
|
return cleared;
|
|
8535
8522
|
});
|
|
8536
8523
|
}
|
|
8524
|
+
async *iterateBatches(options = {}) {
|
|
8525
|
+
const database = await this.requireDatabase();
|
|
8526
|
+
const batchSize = Math.max(1, Math.min(options.batchSize ?? 500, 1e3));
|
|
8527
|
+
let cursor;
|
|
8528
|
+
while (true) {
|
|
8529
|
+
const rows = database.prepare(
|
|
8530
|
+
`
|
|
8531
|
+
SELECT
|
|
8532
|
+
r.*,
|
|
8533
|
+
GROUP_CONCAT(t.tag, '${TAG_DELIMITER}') AS tags
|
|
8534
|
+
FROM saved_network_records r
|
|
8535
|
+
LEFT JOIN saved_network_tags t
|
|
8536
|
+
ON t.record_id = r.record_id
|
|
8537
|
+
${cursor === void 0 ? "" : "WHERE r.saved_at > ? OR (r.saved_at = ? AND r.record_id > ?)"}
|
|
8538
|
+
GROUP BY r.record_id
|
|
8539
|
+
ORDER BY r.saved_at ASC, r.record_id ASC
|
|
8540
|
+
LIMIT ?
|
|
8541
|
+
`
|
|
8542
|
+
).all(
|
|
8543
|
+
...cursor === void 0 ? [] : [cursor.savedAt, cursor.savedAt, cursor.recordId],
|
|
8544
|
+
batchSize
|
|
8545
|
+
);
|
|
8546
|
+
if (rows.length === 0) {
|
|
8547
|
+
return;
|
|
8548
|
+
}
|
|
8549
|
+
yield rows.map((row) => inflateSavedNetworkRow(row, options.includeBodies ?? true));
|
|
8550
|
+
const lastRow = rows.at(-1);
|
|
8551
|
+
if (lastRow === void 0) {
|
|
8552
|
+
return;
|
|
8553
|
+
}
|
|
8554
|
+
cursor = {
|
|
8555
|
+
savedAt: lastRow.saved_at,
|
|
8556
|
+
recordId: lastRow.record_id
|
|
8557
|
+
};
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
close() {
|
|
8561
|
+
if (this.database !== void 0) {
|
|
8562
|
+
closeSqliteDatabase(this.database);
|
|
8563
|
+
this.database = void 0;
|
|
8564
|
+
this.databaseInitialization = void 0;
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8537
8567
|
async requireDatabase() {
|
|
8538
8568
|
if (this.database) {
|
|
8539
8569
|
return this.database;
|
|
@@ -8618,15 +8648,6 @@ var SqliteSavedNetworkStore = class {
|
|
|
8618
8648
|
saved_at INTEGER NOT NULL
|
|
8619
8649
|
);
|
|
8620
8650
|
|
|
8621
|
-
CREATE UNIQUE INDEX IF NOT EXISTS saved_network_records_scope_request
|
|
8622
|
-
ON saved_network_records (session_ref, page_ref_key, request_id);
|
|
8623
|
-
|
|
8624
|
-
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
8625
|
-
ON saved_network_records (saved_at DESC);
|
|
8626
|
-
|
|
8627
|
-
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
8628
|
-
ON saved_network_records (capture);
|
|
8629
|
-
|
|
8630
8651
|
CREATE TABLE IF NOT EXISTS saved_network_tags (
|
|
8631
8652
|
record_id TEXT NOT NULL REFERENCES saved_network_records(record_id) ON DELETE CASCADE,
|
|
8632
8653
|
tag TEXT NOT NULL,
|
|
@@ -8636,6 +8657,19 @@ var SqliteSavedNetworkStore = class {
|
|
|
8636
8657
|
CREATE INDEX IF NOT EXISTS saved_network_tags_tag
|
|
8637
8658
|
ON saved_network_tags (tag);
|
|
8638
8659
|
`);
|
|
8660
|
+
database.exec(`DROP INDEX IF EXISTS saved_network_records_scope_request`);
|
|
8661
|
+
database.exec(`
|
|
8662
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_scope_request
|
|
8663
|
+
ON saved_network_records (session_ref, page_ref_key, request_id)
|
|
8664
|
+
`);
|
|
8665
|
+
database.exec(`
|
|
8666
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
8667
|
+
ON saved_network_records (saved_at DESC)
|
|
8668
|
+
`);
|
|
8669
|
+
database.exec(`
|
|
8670
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
8671
|
+
ON saved_network_records (capture)
|
|
8672
|
+
`);
|
|
8639
8673
|
this.ensureColumn(
|
|
8640
8674
|
database,
|
|
8641
8675
|
"saved_network_records",
|
|
@@ -8955,6 +8989,14 @@ function withSqliteTransaction(database, task) {
|
|
|
8955
8989
|
function createSavedNetworkStore(rootPath) {
|
|
8956
8990
|
return new SqliteSavedNetworkStore(rootPath);
|
|
8957
8991
|
}
|
|
8992
|
+
async function* iterateSavedNetworkRecordBatches(rootPath, options = {}) {
|
|
8993
|
+
const store = new SqliteSavedNetworkStore(rootPath);
|
|
8994
|
+
try {
|
|
8995
|
+
yield* store.iterateBatches(options);
|
|
8996
|
+
} finally {
|
|
8997
|
+
store.close();
|
|
8998
|
+
}
|
|
8999
|
+
}
|
|
8958
9000
|
function normalizeContext(context) {
|
|
8959
9001
|
return {
|
|
8960
9002
|
...context?.sessionRef === void 0 ? {} : { sessionRef: context.sessionRef },
|
|
@@ -10602,8 +10644,8 @@ function createDomDescriptorStore(options) {
|
|
|
10602
10644
|
}
|
|
10603
10645
|
return new MemoryDomDescriptorStore(namespace);
|
|
10604
10646
|
}
|
|
10605
|
-
function
|
|
10606
|
-
return sha256Hex2(
|
|
10647
|
+
function hashDomDescriptorPersist(persist) {
|
|
10648
|
+
return sha256Hex2(persist.trim());
|
|
10607
10649
|
}
|
|
10608
10650
|
var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
|
|
10609
10651
|
click: "dom.click",
|
|
@@ -10617,14 +10659,14 @@ function normalizeDomDescriptorMethod(method) {
|
|
|
10617
10659
|
}
|
|
10618
10660
|
function buildDomDescriptorKeys(options) {
|
|
10619
10661
|
const namespace = normalizeDomDescriptorNamespace(options.namespace);
|
|
10620
|
-
const
|
|
10662
|
+
const persistHash = hashDomDescriptorPersist(options.persist);
|
|
10621
10663
|
const rawMethod = options.method.trim();
|
|
10622
10664
|
const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
|
|
10623
10665
|
const methods = /* @__PURE__ */ new Set([canonicalMethod]);
|
|
10624
10666
|
if (rawMethod.length > 0) {
|
|
10625
10667
|
methods.add(rawMethod);
|
|
10626
10668
|
}
|
|
10627
|
-
return [...methods].map((method) => `dom:${namespace}:${method}:${
|
|
10669
|
+
return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
|
|
10628
10670
|
}
|
|
10629
10671
|
function buildDomDescriptorKey(options) {
|
|
10630
10672
|
return buildDomDescriptorKeys(options)[0];
|
|
@@ -10640,7 +10682,7 @@ function buildDomDescriptorPayload(input) {
|
|
|
10640
10682
|
return {
|
|
10641
10683
|
kind: "dom-target",
|
|
10642
10684
|
method: normalizeDomDescriptorMethod(input.method),
|
|
10643
|
-
|
|
10685
|
+
persist: input.persist,
|
|
10644
10686
|
path: sanitizeReplayElementPath(input.path),
|
|
10645
10687
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
10646
10688
|
};
|
|
@@ -10657,8 +10699,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10657
10699
|
if (raw.kind !== "dom-target") {
|
|
10658
10700
|
return void 0;
|
|
10659
10701
|
}
|
|
10660
|
-
|
|
10661
|
-
if (typeof raw.method !== "string" || name === void 0) {
|
|
10702
|
+
if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
|
|
10662
10703
|
return void 0;
|
|
10663
10704
|
}
|
|
10664
10705
|
if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
|
|
@@ -10670,7 +10711,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10670
10711
|
const normalizedPayload = {
|
|
10671
10712
|
kind: "dom-target",
|
|
10672
10713
|
method: normalizeDomDescriptorMethod(raw.method),
|
|
10673
|
-
|
|
10714
|
+
persist: raw.persist,
|
|
10674
10715
|
path: sanitizeReplayElementPath(raw.path),
|
|
10675
10716
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
10676
10717
|
};
|
|
@@ -10692,7 +10733,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10692
10733
|
for (const key of buildDomDescriptorKeys({
|
|
10693
10734
|
namespace: this.namespace,
|
|
10694
10735
|
method: input.method,
|
|
10695
|
-
|
|
10736
|
+
persist: input.persist
|
|
10696
10737
|
})) {
|
|
10697
10738
|
const record = await this.registry.resolve({ key });
|
|
10698
10739
|
if (!record) {
|
|
@@ -10707,7 +10748,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10707
10748
|
const key = buildDomDescriptorKey({
|
|
10708
10749
|
namespace: this.namespace,
|
|
10709
10750
|
method: input.method,
|
|
10710
|
-
|
|
10751
|
+
persist: input.persist
|
|
10711
10752
|
});
|
|
10712
10753
|
const version = buildDomDescriptorVersion(payload);
|
|
10713
10754
|
const existing = await this.registry.resolve({ key, version });
|
|
@@ -10750,7 +10791,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10750
10791
|
for (const key of buildDomDescriptorKeys({
|
|
10751
10792
|
namespace: this.namespace,
|
|
10752
10793
|
method: input.method,
|
|
10753
|
-
|
|
10794
|
+
persist: input.persist
|
|
10754
10795
|
})) {
|
|
10755
10796
|
const record = this.latestByKey.get(key);
|
|
10756
10797
|
if (record) {
|
|
@@ -10764,7 +10805,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10764
10805
|
const key = buildDomDescriptorKey({
|
|
10765
10806
|
namespace: this.namespace,
|
|
10766
10807
|
method: input.method,
|
|
10767
|
-
|
|
10808
|
+
persist: input.persist
|
|
10768
10809
|
});
|
|
10769
10810
|
const version = buildDomDescriptorVersion(payload);
|
|
10770
10811
|
const existing = this.recordsByKey.get(key)?.get(version);
|
|
@@ -11696,15 +11737,15 @@ var DefaultDomRuntime = class {
|
|
|
11696
11737
|
async resolveDescriptorTarget(session, pageRef, method, target) {
|
|
11697
11738
|
const descriptor = await this.descriptors.read({
|
|
11698
11739
|
method,
|
|
11699
|
-
|
|
11740
|
+
persist: target.persist
|
|
11700
11741
|
});
|
|
11701
11742
|
if (!descriptor) {
|
|
11702
11743
|
throw new OpensteerProtocolError(
|
|
11703
11744
|
"not-found",
|
|
11704
|
-
`no stored DOM descriptor found for "${target.
|
|
11745
|
+
`no stored DOM descriptor found for "${target.persist}"`,
|
|
11705
11746
|
{
|
|
11706
11747
|
details: {
|
|
11707
|
-
|
|
11748
|
+
persist: target.persist,
|
|
11708
11749
|
kind: "dom-descriptor"
|
|
11709
11750
|
}
|
|
11710
11751
|
}
|
|
@@ -11718,7 +11759,7 @@ var DefaultDomRuntime = class {
|
|
|
11718
11759
|
pageRef,
|
|
11719
11760
|
descriptor.payload.path,
|
|
11720
11761
|
"descriptor",
|
|
11721
|
-
descriptor.payload.
|
|
11762
|
+
descriptor.payload.persist,
|
|
11722
11763
|
descriptor
|
|
11723
11764
|
);
|
|
11724
11765
|
}
|
|
@@ -11748,7 +11789,7 @@ var DefaultDomRuntime = class {
|
|
|
11748
11789
|
const replayPath = await this.tryBuildPathFromNode(snapshot, node);
|
|
11749
11790
|
const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
|
|
11750
11791
|
method,
|
|
11751
|
-
|
|
11792
|
+
persist: target.persist,
|
|
11752
11793
|
path: replayPath ?? await this.buildPathForNode(snapshot, node),
|
|
11753
11794
|
sourceUrl: snapshot.url
|
|
11754
11795
|
});
|
|
@@ -14764,8 +14805,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14764
14805
|
return void 0;
|
|
14765
14806
|
}
|
|
14766
14807
|
const raw = payload;
|
|
14767
|
-
|
|
14768
|
-
if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
|
|
14808
|
+
if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
|
|
14769
14809
|
return void 0;
|
|
14770
14810
|
}
|
|
14771
14811
|
const root = normalizePersistedExtractionNode(raw.root, "root");
|
|
@@ -14780,7 +14820,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14780
14820
|
updatedAt: record.updatedAt,
|
|
14781
14821
|
payload: {
|
|
14782
14822
|
kind: "dom-extraction",
|
|
14783
|
-
persist,
|
|
14823
|
+
persist: raw.persist,
|
|
14784
14824
|
root,
|
|
14785
14825
|
...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
|
|
14786
14826
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
@@ -16035,7 +16075,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
|
|
|
16035
16075
|
)
|
|
16036
16076
|
);
|
|
16037
16077
|
}
|
|
16038
|
-
async function
|
|
16078
|
+
async function clearOpensteerLiveCounters(engine, pageRef) {
|
|
16039
16079
|
const frames = await engine.listFrames({ pageRef });
|
|
16040
16080
|
const failures = [];
|
|
16041
16081
|
for (const frame of frames) {
|
|
@@ -16133,7 +16173,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16133
16173
|
engine: options.engine,
|
|
16134
16174
|
pageRef: options.pageRef
|
|
16135
16175
|
});
|
|
16136
|
-
await
|
|
16176
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef);
|
|
16137
16177
|
await assignSparseCountersToLiveDom(options.engine, options.pageRef);
|
|
16138
16178
|
const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
|
|
16139
16179
|
const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
|
|
@@ -16170,7 +16210,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16170
16210
|
counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
|
|
16171
16211
|
};
|
|
16172
16212
|
} catch (error) {
|
|
16173
|
-
await
|
|
16213
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
|
|
16174
16214
|
if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
|
|
16175
16215
|
lastCounterSyncError = error;
|
|
16176
16216
|
continue;
|
|
@@ -17823,6 +17863,9 @@ var MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS = 5e3;
|
|
|
17823
17863
|
var PERSISTED_NETWORK_FLUSH_TIMEOUT_MS = 5e3;
|
|
17824
17864
|
var PENDING_OPERATION_EVENT_CAPTURE_LIMIT = 64;
|
|
17825
17865
|
var PENDING_OPERATION_EVENT_CAPTURE_SKEW_MS = 1e3;
|
|
17866
|
+
var REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS = 3e3;
|
|
17867
|
+
var REPLAY_PROBE_MAX_ATTEMPT_TIMEOUT_MS = 15e3;
|
|
17868
|
+
var REPLAY_PROBE_POST_SUCCESS_ATTEMPT_TIMEOUT_MS = 5e3;
|
|
17826
17869
|
var OpensteerSessionRuntime = class {
|
|
17827
17870
|
workspace;
|
|
17828
17871
|
rootPath;
|
|
@@ -18684,26 +18727,27 @@ var OpensteerSessionRuntime = class {
|
|
|
18684
18727
|
}
|
|
18685
18728
|
}
|
|
18686
18729
|
async queryNetwork(input = {}, options = {}) {
|
|
18687
|
-
|
|
18730
|
+
const normalizedInput = normalizeNetworkQueryInput(input);
|
|
18731
|
+
assertValidSemanticOperationInput("network.query", normalizedInput);
|
|
18688
18732
|
const root = await this.ensureRoot();
|
|
18689
18733
|
const startedAt = Date.now();
|
|
18690
18734
|
try {
|
|
18691
18735
|
const output = await this.runWithOperationTimeout(
|
|
18692
18736
|
"network.query",
|
|
18693
18737
|
async (timeout) => {
|
|
18694
|
-
await this.syncPersistedNetworkSelection(timeout,
|
|
18738
|
+
await this.syncPersistedNetworkSelection(timeout, normalizedInput, {
|
|
18695
18739
|
includeBodies: false
|
|
18696
18740
|
});
|
|
18697
18741
|
const rawRecords = await timeout.runStep(
|
|
18698
18742
|
() => root.registry.savedNetwork.query({
|
|
18699
|
-
...this.toSavedNetworkQueryInput(
|
|
18700
|
-
limit: Math.max(
|
|
18743
|
+
...this.toSavedNetworkQueryInput(normalizedInput),
|
|
18744
|
+
limit: Math.max(normalizedInput.limit ?? 50, 1e3)
|
|
18701
18745
|
})
|
|
18702
18746
|
);
|
|
18703
|
-
const filtered = filterNetworkSummaryRecords(rawRecords,
|
|
18747
|
+
const filtered = filterNetworkSummaryRecords(rawRecords, normalizedInput);
|
|
18704
18748
|
const sorted = sortPersistedNetworkRecordsChronologically(filtered);
|
|
18705
|
-
const sliced = sliceNetworkSummaryWindow(sorted,
|
|
18706
|
-
const limited = sliced.slice(0, Math.max(1, Math.min(
|
|
18749
|
+
const sliced = sliceNetworkSummaryWindow(sorted, normalizedInput);
|
|
18750
|
+
const limited = sliced.slice(0, Math.max(1, Math.min(normalizedInput.limit ?? 50, 200)));
|
|
18707
18751
|
const summaries = await this.buildNetworkSummaryRecords(limited, timeout);
|
|
18708
18752
|
return {
|
|
18709
18753
|
records: summaries
|
|
@@ -18717,9 +18761,9 @@ var OpensteerSessionRuntime = class {
|
|
|
18717
18761
|
completedAt: Date.now(),
|
|
18718
18762
|
outcome: "ok",
|
|
18719
18763
|
data: {
|
|
18720
|
-
limit:
|
|
18721
|
-
...
|
|
18722
|
-
...
|
|
18764
|
+
limit: normalizedInput.limit ?? 50,
|
|
18765
|
+
...normalizedInput.capture === void 0 ? {} : { capture: normalizedInput.capture },
|
|
18766
|
+
...normalizedInput.json === true ? { json: true } : {},
|
|
18723
18767
|
count: output.records.length
|
|
18724
18768
|
},
|
|
18725
18769
|
context: buildRuntimeTraceContext({
|
|
@@ -18744,16 +18788,22 @@ var OpensteerSessionRuntime = class {
|
|
|
18744
18788
|
}
|
|
18745
18789
|
}
|
|
18746
18790
|
async getNetworkDetail(input, options = {}) {
|
|
18791
|
+
const normalizedRecordId = normalizeNetworkRecordId(input.recordId);
|
|
18747
18792
|
const startedAt = Date.now();
|
|
18748
18793
|
try {
|
|
18749
18794
|
const output = await this.runWithOperationTimeout(
|
|
18750
18795
|
"network.detail",
|
|
18751
18796
|
async (timeout) => {
|
|
18752
|
-
const record = await this.resolveNetworkRecordByRecordId(
|
|
18797
|
+
const record = await this.resolveNetworkRecordByRecordId(normalizedRecordId, timeout, {
|
|
18753
18798
|
includeBodies: true,
|
|
18754
18799
|
redactSecretHeaders: false
|
|
18755
18800
|
});
|
|
18756
|
-
|
|
18801
|
+
const detail = await this.buildNetworkDetail(record, timeout);
|
|
18802
|
+
if (input.probe !== true) {
|
|
18803
|
+
return detail;
|
|
18804
|
+
}
|
|
18805
|
+
const transportProbe = await this.probeTransportsForRecord(record, timeout);
|
|
18806
|
+
return transportProbe === void 0 ? detail : { ...detail, transportProbe };
|
|
18757
18807
|
},
|
|
18758
18808
|
options
|
|
18759
18809
|
);
|
|
@@ -18763,8 +18813,8 @@ var OpensteerSessionRuntime = class {
|
|
|
18763
18813
|
completedAt: Date.now(),
|
|
18764
18814
|
outcome: "ok",
|
|
18765
18815
|
data: {
|
|
18766
|
-
recordId:
|
|
18767
|
-
status: output.summary.status,
|
|
18816
|
+
recordId: normalizedRecordId,
|
|
18817
|
+
...output.summary.status === void 0 ? {} : { status: output.summary.status },
|
|
18768
18818
|
url: output.summary.url
|
|
18769
18819
|
},
|
|
18770
18820
|
context: buildRuntimeTraceContext({
|
|
@@ -18788,54 +18838,6 @@ var OpensteerSessionRuntime = class {
|
|
|
18788
18838
|
throw error;
|
|
18789
18839
|
}
|
|
18790
18840
|
}
|
|
18791
|
-
async replayNetwork(input, options = {}) {
|
|
18792
|
-
const startedAt = Date.now();
|
|
18793
|
-
try {
|
|
18794
|
-
const output = await this.runWithOperationTimeout(
|
|
18795
|
-
"network.replay",
|
|
18796
|
-
async (timeout) => {
|
|
18797
|
-
const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
|
|
18798
|
-
includeBodies: true,
|
|
18799
|
-
redactSecretHeaders: false
|
|
18800
|
-
});
|
|
18801
|
-
const replayRequest = buildReplayTransportRequest(source, input);
|
|
18802
|
-
return this.executeNetworkReplay(source, replayRequest, timeout, {
|
|
18803
|
-
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
|
|
18804
|
-
});
|
|
18805
|
-
},
|
|
18806
|
-
options
|
|
18807
|
-
);
|
|
18808
|
-
await this.appendTrace({
|
|
18809
|
-
operation: "network.replay",
|
|
18810
|
-
startedAt,
|
|
18811
|
-
completedAt: Date.now(),
|
|
18812
|
-
outcome: "ok",
|
|
18813
|
-
data: {
|
|
18814
|
-
recordId: input.recordId,
|
|
18815
|
-
transport: output.transport,
|
|
18816
|
-
attempts: output.attempts.length
|
|
18817
|
-
},
|
|
18818
|
-
context: buildRuntimeTraceContext({
|
|
18819
|
-
sessionRef: this.sessionRef,
|
|
18820
|
-
pageRef: this.pageRef
|
|
18821
|
-
})
|
|
18822
|
-
});
|
|
18823
|
-
return output;
|
|
18824
|
-
} catch (error) {
|
|
18825
|
-
await this.appendTrace({
|
|
18826
|
-
operation: "network.replay",
|
|
18827
|
-
startedAt,
|
|
18828
|
-
completedAt: Date.now(),
|
|
18829
|
-
outcome: "error",
|
|
18830
|
-
error,
|
|
18831
|
-
context: buildRuntimeTraceContext({
|
|
18832
|
-
sessionRef: this.sessionRef,
|
|
18833
|
-
pageRef: this.pageRef
|
|
18834
|
-
})
|
|
18835
|
-
});
|
|
18836
|
-
throw error;
|
|
18837
|
-
}
|
|
18838
|
-
}
|
|
18839
18841
|
async captureScripts(input = {}, options = {}) {
|
|
18840
18842
|
assertValidSemanticOperationInput("scripts.capture", input);
|
|
18841
18843
|
const pageRef = input.pageRef ?? await this.ensurePageRef();
|
|
@@ -19431,7 +19433,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19431
19433
|
completedAt: Date.now(),
|
|
19432
19434
|
outcome: "ok",
|
|
19433
19435
|
data: {
|
|
19434
|
-
transport: output.transport,
|
|
19436
|
+
...output.transport === void 0 ? {} : { transport: output.transport },
|
|
19435
19437
|
attempts: output.attempts.length,
|
|
19436
19438
|
...output.response === void 0 ? {} : { status: output.response.status },
|
|
19437
19439
|
url: input.url
|
|
@@ -19534,6 +19536,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19534
19536
|
});
|
|
19535
19537
|
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
19536
19538
|
timeout.throwIfAborted();
|
|
19539
|
+
await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
|
|
19537
19540
|
this.pageRef = output2.pageRef;
|
|
19538
19541
|
const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
|
|
19539
19542
|
return {
|
|
@@ -19723,7 +19726,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19723
19726
|
mutationCaptureDiagnostics = diagnostics;
|
|
19724
19727
|
}
|
|
19725
19728
|
);
|
|
19726
|
-
const output = toOpensteerActionResult(executed.result
|
|
19729
|
+
const output = toOpensteerActionResult(executed.result);
|
|
19727
19730
|
const actionEvents = "events" in executed.result ? executed.result.events : void 0;
|
|
19728
19731
|
await this.appendTrace({
|
|
19729
19732
|
operation,
|
|
@@ -19734,7 +19737,6 @@ var OpensteerSessionRuntime = class {
|
|
|
19734
19737
|
data: {
|
|
19735
19738
|
target: output.target,
|
|
19736
19739
|
...output.point === void 0 ? {} : { point: output.point },
|
|
19737
|
-
...output.persisted === void 0 ? {} : { persisted: output.persisted },
|
|
19738
19740
|
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
19739
19741
|
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
19740
19742
|
},
|
|
@@ -19798,7 +19800,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19798
19800
|
await timeout.runStep(
|
|
19799
19801
|
() => this.requireDom().writeDescriptor({
|
|
19800
19802
|
method,
|
|
19801
|
-
|
|
19803
|
+
persist,
|
|
19802
19804
|
path: stablePath2,
|
|
19803
19805
|
sourceUrl: resolved2.snapshot.url
|
|
19804
19806
|
})
|
|
@@ -19806,9 +19808,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19806
19808
|
return {
|
|
19807
19809
|
target: {
|
|
19808
19810
|
kind: "descriptor",
|
|
19809
|
-
|
|
19810
|
-
}
|
|
19811
|
-
persisted: persist
|
|
19811
|
+
persist
|
|
19812
|
+
}
|
|
19812
19813
|
};
|
|
19813
19814
|
}
|
|
19814
19815
|
const resolved = await timeout.runStep(
|
|
@@ -19831,7 +19832,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19831
19832
|
await timeout.runStep(
|
|
19832
19833
|
() => this.requireDom().writeDescriptor({
|
|
19833
19834
|
method,
|
|
19834
|
-
|
|
19835
|
+
persist,
|
|
19835
19836
|
path: stablePath,
|
|
19836
19837
|
sourceUrl: resolved.snapshot.url
|
|
19837
19838
|
})
|
|
@@ -19839,9 +19840,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19839
19840
|
return {
|
|
19840
19841
|
target: {
|
|
19841
19842
|
kind: "descriptor",
|
|
19842
|
-
|
|
19843
|
-
}
|
|
19844
|
-
persisted: persist
|
|
19843
|
+
persist
|
|
19844
|
+
}
|
|
19845
19845
|
};
|
|
19846
19846
|
}
|
|
19847
19847
|
async queryLiveNetwork(input, timeout, options = {}) {
|
|
@@ -19897,6 +19897,18 @@ var OpensteerSessionRuntime = class {
|
|
|
19897
19897
|
const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
|
|
19898
19898
|
return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
|
|
19899
19899
|
}
|
|
19900
|
+
async invalidateLiveSnapshotCounters(pageRefs, timeout) {
|
|
19901
|
+
const engine = this.requireEngine();
|
|
19902
|
+
for (const pageRef of new Set(pageRefs)) {
|
|
19903
|
+
try {
|
|
19904
|
+
await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
|
|
19905
|
+
} catch (error) {
|
|
19906
|
+
if (!isIgnorableRuntimeBindingError(error)) {
|
|
19907
|
+
throw error;
|
|
19908
|
+
}
|
|
19909
|
+
}
|
|
19910
|
+
}
|
|
19911
|
+
}
|
|
19900
19912
|
async captureScriptsInternal(pageRef, input, timeout) {
|
|
19901
19913
|
const root = await this.ensureRoot();
|
|
19902
19914
|
const evaluated = await timeout.runStep(
|
|
@@ -20206,7 +20218,9 @@ var OpensteerSessionRuntime = class {
|
|
|
20206
20218
|
...graphql.persisted === void 0 ? {} : { persisted: graphql.persisted },
|
|
20207
20219
|
...graphqlVariables === void 0 ? {} : { variables: graphqlVariables }
|
|
20208
20220
|
};
|
|
20209
|
-
const requestBody = shouldShowRequestBody(record.record.method) && record.record.requestBody !== void 0 ? buildStructuredBodyPreview(record.record.requestBody, record.record.requestHeaders
|
|
20221
|
+
const requestBody = shouldShowRequestBody(record.record.method) && record.record.requestBody !== void 0 ? buildStructuredBodyPreview(record.record.requestBody, record.record.requestHeaders, {
|
|
20222
|
+
truncateData: false
|
|
20223
|
+
}) : void 0;
|
|
20210
20224
|
const responseBody = record.record.responseBody === void 0 ? void 0 : buildStructuredBodyPreview(record.record.responseBody, record.record.responseHeaders);
|
|
20211
20225
|
const notes = detectNetworkRecordNotes(record);
|
|
20212
20226
|
return {
|
|
@@ -20226,6 +20240,52 @@ var OpensteerSessionRuntime = class {
|
|
|
20226
20240
|
...notes.length === 0 ? {} : { notes }
|
|
20227
20241
|
};
|
|
20228
20242
|
}
|
|
20243
|
+
async probeTransportsForRecord(record, timeout) {
|
|
20244
|
+
if (record.record.status === void 0) {
|
|
20245
|
+
return void 0;
|
|
20246
|
+
}
|
|
20247
|
+
const request = buildReplayTransportRequest(record, { recordId: record.recordId });
|
|
20248
|
+
const fingerprint = buildCapturedRecordSuccessFingerprint(record);
|
|
20249
|
+
const attempts = [];
|
|
20250
|
+
let recommended;
|
|
20251
|
+
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20252
|
+
const attemptStartedAt = Date.now();
|
|
20253
|
+
const attemptTimeoutMs = resolveReplayProbeAttemptTimeoutMs({
|
|
20254
|
+
remainingMs: timeout.remainingMs(),
|
|
20255
|
+
transportsRemaining: REPLAY_TRANSPORT_LADDER.length - attempts.length,
|
|
20256
|
+
recommendedFound: recommended !== void 0
|
|
20257
|
+
});
|
|
20258
|
+
try {
|
|
20259
|
+
const output = await this.executeReplayTransportAttemptWithinBudget(
|
|
20260
|
+
transport,
|
|
20261
|
+
request,
|
|
20262
|
+
timeout,
|
|
20263
|
+
attemptTimeoutMs
|
|
20264
|
+
);
|
|
20265
|
+
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20266
|
+
attempts.push({
|
|
20267
|
+
transport,
|
|
20268
|
+
status: output.response.status,
|
|
20269
|
+
ok,
|
|
20270
|
+
durationMs: Date.now() - attemptStartedAt
|
|
20271
|
+
});
|
|
20272
|
+
if (ok && recommended === void 0) {
|
|
20273
|
+
recommended = transport;
|
|
20274
|
+
}
|
|
20275
|
+
} catch (error) {
|
|
20276
|
+
attempts.push({
|
|
20277
|
+
transport,
|
|
20278
|
+
ok: false,
|
|
20279
|
+
durationMs: Date.now() - attemptStartedAt,
|
|
20280
|
+
error: normalizeProbeTransportAttemptError(transport, error, attemptTimeoutMs)
|
|
20281
|
+
});
|
|
20282
|
+
}
|
|
20283
|
+
}
|
|
20284
|
+
return {
|
|
20285
|
+
...recommended === void 0 ? {} : { recommended },
|
|
20286
|
+
attempts
|
|
20287
|
+
};
|
|
20288
|
+
}
|
|
20229
20289
|
async buildRedirectChain(record, timeout) {
|
|
20230
20290
|
if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
|
|
20231
20291
|
return {};
|
|
@@ -20344,57 +20404,6 @@ var OpensteerSessionRuntime = class {
|
|
|
20344
20404
|
})
|
|
20345
20405
|
};
|
|
20346
20406
|
}
|
|
20347
|
-
async executeNetworkReplay(source, request, timeout, options) {
|
|
20348
|
-
const fingerprint = buildCapturedRecordSuccessFingerprint(source);
|
|
20349
|
-
const attempts = [];
|
|
20350
|
-
let lastOutput;
|
|
20351
|
-
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20352
|
-
const attemptStartedAt = Date.now();
|
|
20353
|
-
try {
|
|
20354
|
-
const output = await this.executeReplayTransportAttempt(
|
|
20355
|
-
transport,
|
|
20356
|
-
request,
|
|
20357
|
-
timeout,
|
|
20358
|
-
options.pageRef
|
|
20359
|
-
);
|
|
20360
|
-
lastOutput = output;
|
|
20361
|
-
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20362
|
-
attempts.push({
|
|
20363
|
-
transport,
|
|
20364
|
-
status: output.response.status,
|
|
20365
|
-
ok,
|
|
20366
|
-
durationMs: Date.now() - attemptStartedAt
|
|
20367
|
-
});
|
|
20368
|
-
if (ok) {
|
|
20369
|
-
const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
|
|
20370
|
-
const previewData2 = toStructuredPreviewData(output.data);
|
|
20371
|
-
return {
|
|
20372
|
-
recordId: source.recordId,
|
|
20373
|
-
transport,
|
|
20374
|
-
attempts,
|
|
20375
|
-
response: output.response,
|
|
20376
|
-
...previewData2 === void 0 ? {} : { data: previewData2 },
|
|
20377
|
-
...fallbackNote === void 0 ? {} : { note: fallbackNote }
|
|
20378
|
-
};
|
|
20379
|
-
}
|
|
20380
|
-
} catch (error) {
|
|
20381
|
-
attempts.push({
|
|
20382
|
-
transport,
|
|
20383
|
-
ok: false,
|
|
20384
|
-
durationMs: Date.now() - attemptStartedAt,
|
|
20385
|
-
error: normalizeRuntimeErrorMessage(error)
|
|
20386
|
-
});
|
|
20387
|
-
}
|
|
20388
|
-
}
|
|
20389
|
-
const previewData = toStructuredPreviewData(lastOutput?.data);
|
|
20390
|
-
return {
|
|
20391
|
-
recordId: source.recordId,
|
|
20392
|
-
attempts,
|
|
20393
|
-
...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
|
|
20394
|
-
...previewData === void 0 ? {} : { data: previewData },
|
|
20395
|
-
note: "all replay transports failed to reproduce the captured response"
|
|
20396
|
-
};
|
|
20397
|
-
}
|
|
20398
20407
|
async executeSessionFetch(request, input, timeout) {
|
|
20399
20408
|
const attempts = [];
|
|
20400
20409
|
let lastOutput;
|
|
@@ -20472,6 +20481,23 @@ var OpensteerSessionRuntime = class {
|
|
|
20472
20481
|
}
|
|
20473
20482
|
}
|
|
20474
20483
|
}
|
|
20484
|
+
async executeReplayTransportAttemptWithinBudget(transport, request, timeout, attemptTimeoutMs) {
|
|
20485
|
+
if (attemptTimeoutMs === void 0) {
|
|
20486
|
+
return this.executeReplayTransportAttempt(transport, request, timeout);
|
|
20487
|
+
}
|
|
20488
|
+
return runWithPolicyTimeout(
|
|
20489
|
+
{
|
|
20490
|
+
resolveTimeoutMs() {
|
|
20491
|
+
return attemptTimeoutMs;
|
|
20492
|
+
}
|
|
20493
|
+
},
|
|
20494
|
+
{
|
|
20495
|
+
operation: timeout.operation,
|
|
20496
|
+
signal: timeout.signal
|
|
20497
|
+
},
|
|
20498
|
+
(attemptTimeout) => this.executeReplayTransportAttempt(transport, request, attemptTimeout)
|
|
20499
|
+
);
|
|
20500
|
+
}
|
|
20475
20501
|
async executeFetchTransportAttempt(transport, request, timeout, input) {
|
|
20476
20502
|
let prepared = finalizeMaterializedTransportRequest(request, transport);
|
|
20477
20503
|
if (input.cookies !== false && transport === "direct-http" && this.currentBinding() !== void 0) {
|
|
@@ -21022,7 +21048,7 @@ var OpensteerSessionRuntime = class {
|
|
|
21022
21048
|
if (target.kind === "persist") {
|
|
21023
21049
|
return {
|
|
21024
21050
|
kind: "descriptor",
|
|
21025
|
-
|
|
21051
|
+
persist: target.persist
|
|
21026
21052
|
};
|
|
21027
21053
|
}
|
|
21028
21054
|
if (target.kind === "selector") {
|
|
@@ -21386,10 +21412,15 @@ var OpensteerSessionRuntime = class {
|
|
|
21386
21412
|
return this.observationSessionId ?? this.sessionRef;
|
|
21387
21413
|
}
|
|
21388
21414
|
runWithOperationTimeout(operation, callback, options = {}) {
|
|
21415
|
+
const timeoutPolicy = options.timeoutMs === void 0 ? this.policy.timeout : {
|
|
21416
|
+
resolveTimeoutMs() {
|
|
21417
|
+
return options.timeoutMs;
|
|
21418
|
+
}
|
|
21419
|
+
};
|
|
21389
21420
|
const existingCollector = this.operationEventStorage.getStore();
|
|
21390
21421
|
if (existingCollector !== void 0) {
|
|
21391
21422
|
return runWithPolicyTimeout(
|
|
21392
|
-
|
|
21423
|
+
timeoutPolicy,
|
|
21393
21424
|
{
|
|
21394
21425
|
operation,
|
|
21395
21426
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
@@ -21402,7 +21433,7 @@ var OpensteerSessionRuntime = class {
|
|
|
21402
21433
|
return this.operationEventStorage.run(collector, async () => {
|
|
21403
21434
|
try {
|
|
21404
21435
|
return await runWithPolicyTimeout(
|
|
21405
|
-
|
|
21436
|
+
timeoutPolicy,
|
|
21406
21437
|
{
|
|
21407
21438
|
operation,
|
|
21408
21439
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
@@ -21572,6 +21603,21 @@ function buildEngineNetworkRecordFilters(input) {
|
|
|
21572
21603
|
function normalizeNetworkStatusFilter(status) {
|
|
21573
21604
|
return String(status);
|
|
21574
21605
|
}
|
|
21606
|
+
function normalizeNetworkQueryInput(input) {
|
|
21607
|
+
return {
|
|
21608
|
+
...input,
|
|
21609
|
+
...input.recordId === void 0 ? {} : { recordId: normalizeNetworkRecordId(input.recordId) },
|
|
21610
|
+
...input.before === void 0 ? {} : { before: normalizeNetworkRecordId(input.before) },
|
|
21611
|
+
...input.after === void 0 ? {} : { after: normalizeNetworkRecordId(input.after) }
|
|
21612
|
+
};
|
|
21613
|
+
}
|
|
21614
|
+
function normalizeNetworkRecordId(recordId) {
|
|
21615
|
+
const trimmed = recordId.trim();
|
|
21616
|
+
if (trimmed.length === 0 || trimmed.startsWith("record:")) {
|
|
21617
|
+
return trimmed;
|
|
21618
|
+
}
|
|
21619
|
+
return `record:${trimmed}`;
|
|
21620
|
+
}
|
|
21575
21621
|
function resolveLiveQueryRequestIds(input, history) {
|
|
21576
21622
|
const requestIdCandidates = [];
|
|
21577
21623
|
if (input.recordId !== void 0) {
|
|
@@ -21784,6 +21830,20 @@ var REPLAY_TRANSPORT_LADDER = [
|
|
|
21784
21830
|
"context-http",
|
|
21785
21831
|
"page-http"
|
|
21786
21832
|
];
|
|
21833
|
+
function resolveReplayProbeAttemptTimeoutMs(input) {
|
|
21834
|
+
const attemptCapMs = input.recommendedFound ? REPLAY_PROBE_POST_SUCCESS_ATTEMPT_TIMEOUT_MS : REPLAY_PROBE_MAX_ATTEMPT_TIMEOUT_MS;
|
|
21835
|
+
const clampedRemaining = input.remainingMs === void 0 ? void 0 : Math.max(0, input.remainingMs);
|
|
21836
|
+
if (clampedRemaining === 0) {
|
|
21837
|
+
return 0;
|
|
21838
|
+
}
|
|
21839
|
+
if (clampedRemaining === void 0) {
|
|
21840
|
+
return attemptCapMs;
|
|
21841
|
+
}
|
|
21842
|
+
const sliceMs = Math.floor(clampedRemaining / Math.max(1, input.transportsRemaining));
|
|
21843
|
+
const minimumBudgetAffordable = clampedRemaining >= REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS * input.transportsRemaining;
|
|
21844
|
+
const attemptBudgetMs = minimumBudgetAffordable ? Math.max(REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS, sliceMs) : sliceMs;
|
|
21845
|
+
return Math.min(clampedRemaining, attemptCapMs, Math.max(1, attemptBudgetMs));
|
|
21846
|
+
}
|
|
21787
21847
|
function filterNetworkSummaryRecords(records, input) {
|
|
21788
21848
|
return records.filter((record) => {
|
|
21789
21849
|
if (record.record.resourceType === "preflight" || record.record.method === "OPTIONS") {
|
|
@@ -21956,10 +22016,10 @@ function extractGraphqlOperationName(queryText) {
|
|
|
21956
22016
|
function shouldShowRequestBody(method) {
|
|
21957
22017
|
return !["GET", "HEAD", "DELETE", "OPTIONS"].includes(method.trim().toUpperCase());
|
|
21958
22018
|
}
|
|
21959
|
-
function buildStructuredBodyPreview(body, headers) {
|
|
22019
|
+
function buildStructuredBodyPreview(body, headers, options = {}) {
|
|
21960
22020
|
const contentType = headerValue(headers, "content-type") ?? body?.mimeType;
|
|
21961
22021
|
const parsed = parseStructuredPayload(body, contentType);
|
|
21962
|
-
const data = parsed === void 0 ? void 0 : typeof parsed === "string" ? truncateInlineText(parsed) : truncateStructuredValue(parsed);
|
|
22022
|
+
const data = parsed === void 0 ? void 0 : options.truncateData === false ? parsed : typeof parsed === "string" ? truncateInlineText(parsed) : truncateStructuredValue(parsed);
|
|
21963
22023
|
return {
|
|
21964
22024
|
bytes: body?.originalByteLength ?? body?.capturedByteLength ?? 0,
|
|
21965
22025
|
...contentType === void 0 ? {} : { contentType },
|
|
@@ -22172,10 +22232,12 @@ function resolveSessionFetchTransportLadder(transport) {
|
|
|
22172
22232
|
return ["direct-http"];
|
|
22173
22233
|
case "matched-tls":
|
|
22174
22234
|
return ["matched-tls"];
|
|
22235
|
+
case "context":
|
|
22236
|
+
return ["context-http"];
|
|
22175
22237
|
case "page":
|
|
22176
22238
|
return ["page-http"];
|
|
22177
22239
|
case "auto":
|
|
22178
|
-
return ["direct-http", "matched-tls", "page-http"];
|
|
22240
|
+
return ["direct-http", "matched-tls", "context-http", "page-http"];
|
|
22179
22241
|
}
|
|
22180
22242
|
}
|
|
22181
22243
|
function detectChallengeNoteFromRecord(record) {
|
|
@@ -22320,6 +22382,12 @@ function diffStorageSnapshot(left, right) {
|
|
|
22320
22382
|
function normalizeRuntimeErrorMessage(error) {
|
|
22321
22383
|
return error instanceof Error ? error.message : String(error);
|
|
22322
22384
|
}
|
|
22385
|
+
function normalizeProbeTransportAttemptError(transport, error, attemptTimeoutMs) {
|
|
22386
|
+
if (attemptTimeoutMs !== void 0 && error instanceof OpensteerProtocolError && error.code === "timeout") {
|
|
22387
|
+
return `${transport} probe exceeded ${String(attemptTimeoutMs)}ms`;
|
|
22388
|
+
}
|
|
22389
|
+
return normalizeRuntimeErrorMessage(error);
|
|
22390
|
+
}
|
|
22323
22391
|
function applyBrowserCookiesToTransportRequest(request, cookies) {
|
|
22324
22392
|
if (cookies.length === 0) {
|
|
22325
22393
|
return request;
|
|
@@ -22739,7 +22807,7 @@ function normalizeNamespace2(value) {
|
|
|
22739
22807
|
const normalized = String(value ?? "default").trim();
|
|
22740
22808
|
return normalized.length === 0 ? "default" : normalized;
|
|
22741
22809
|
}
|
|
22742
|
-
function toOpensteerActionResult(result
|
|
22810
|
+
function toOpensteerActionResult(result) {
|
|
22743
22811
|
return {
|
|
22744
22812
|
target: toOpensteerResolvedTarget2(result.resolved),
|
|
22745
22813
|
...result.point === void 0 ? {} : {
|
|
@@ -22747,8 +22815,7 @@ function toOpensteerActionResult(result, persisted) {
|
|
|
22747
22815
|
x: result.point.x,
|
|
22748
22816
|
y: result.point.y
|
|
22749
22817
|
}
|
|
22750
|
-
}
|
|
22751
|
-
...persisted === void 0 ? {} : { persisted }
|
|
22818
|
+
}
|
|
22752
22819
|
};
|
|
22753
22820
|
}
|
|
22754
22821
|
function toOpensteerResolvedTarget2(target) {
|
|
@@ -22998,11 +23065,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
|
|
|
22998
23065
|
input,
|
|
22999
23066
|
options
|
|
23000
23067
|
);
|
|
23001
|
-
case "network.replay":
|
|
23002
|
-
return runtime.replayNetwork(
|
|
23003
|
-
input,
|
|
23004
|
-
options
|
|
23005
|
-
);
|
|
23006
23068
|
case "interaction.capture":
|
|
23007
23069
|
return runtime.captureInteraction(
|
|
23008
23070
|
input,
|
|
@@ -24860,9 +24922,11 @@ exports.createFilesystemOpensteerWorkspace = createFilesystemOpensteerWorkspace;
|
|
|
24860
24922
|
exports.createFlowRecorderInstallScript = createFlowRecorderInstallScript;
|
|
24861
24923
|
exports.createObservationStore = createObservationStore;
|
|
24862
24924
|
exports.createOpensteerExtractionDescriptorStore = createOpensteerExtractionDescriptorStore;
|
|
24925
|
+
exports.createSavedNetworkStore = createSavedNetworkStore;
|
|
24863
24926
|
exports.dispatchSemanticOperation = dispatchSemanticOperation;
|
|
24864
24927
|
exports.generateReplayScript = generateReplayScript;
|
|
24865
|
-
exports.
|
|
24928
|
+
exports.hashDomDescriptorPersist = hashDomDescriptorPersist;
|
|
24929
|
+
exports.iterateSavedNetworkRecordBatches = iterateSavedNetworkRecordBatches;
|
|
24866
24930
|
exports.manifestToExternalBinaryLocation = manifestToExternalBinaryLocation;
|
|
24867
24931
|
exports.normalizeObservabilityConfig = normalizeObservabilityConfig;
|
|
24868
24932
|
exports.normalizeWorkspaceId = normalizeWorkspaceId;
|