opensteer 0.8.6 → 0.8.7
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 +2 -2
- package/dist/{chunk-KYRC6CLB.js → chunk-IAA57HNW.js} +596 -363
- package/dist/chunk-IAA57HNW.js.map +1 -0
- package/dist/cli/bin.cjs +596 -364
- 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 +606 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -15
- package/dist/index.d.ts +42 -15
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/opensteer/SKILL.md +2 -2
- package/skills/opensteer/references/cli-reference.md +2 -2
- package/skills/opensteer/references/request-workflow.md +65 -10
- package/skills/opensteer/references/sdk-reference.md +5 -5
- package/dist/chunk-KYRC6CLB.js.map +0 -1
package/dist/cli/bin.cjs
CHANGED
|
@@ -2848,13 +2848,9 @@ var networkRecordSchema = objectSchema(
|
|
|
2848
2848
|
]
|
|
2849
2849
|
}
|
|
2850
2850
|
);
|
|
2851
|
-
var networkQuerySourceSchema = enumSchema(["live", "saved"], {
|
|
2852
|
-
title: "NetworkQuerySource"
|
|
2853
|
-
});
|
|
2854
2851
|
var networkQueryRecordSchema = objectSchema(
|
|
2855
2852
|
{
|
|
2856
2853
|
recordId: stringSchema({ minLength: 1 }),
|
|
2857
|
-
source: networkQuerySourceSchema,
|
|
2858
2854
|
actionId: stringSchema({ minLength: 1 }),
|
|
2859
2855
|
tags: arraySchema(stringSchema({ minLength: 1 }), {
|
|
2860
2856
|
uniqueItems: true
|
|
@@ -2864,7 +2860,7 @@ var networkQueryRecordSchema = objectSchema(
|
|
|
2864
2860
|
},
|
|
2865
2861
|
{
|
|
2866
2862
|
title: "NetworkQueryRecord",
|
|
2867
|
-
required: ["recordId", "
|
|
2863
|
+
required: ["recordId", "record"]
|
|
2868
2864
|
}
|
|
2869
2865
|
);
|
|
2870
2866
|
arraySchema(headerEntrySchema, {
|
|
@@ -3560,9 +3556,6 @@ var opensteerRecipeRecordSchema = objectSchema(
|
|
|
3560
3556
|
var opensteerAuthRecipeRecordSchema = opensteerRecipeRecordSchema;
|
|
3561
3557
|
var opensteerNetworkQueryInputSchema = objectSchema(
|
|
3562
3558
|
{
|
|
3563
|
-
source: enumSchema(["live", "saved"], {
|
|
3564
|
-
title: "OpensteerNetworkQuerySource"
|
|
3565
|
-
}),
|
|
3566
3559
|
pageRef: pageRefSchema,
|
|
3567
3560
|
recordId: stringSchema({ minLength: 1 }),
|
|
3568
3561
|
requestId: stringSchema({ minLength: 1 }),
|
|
@@ -3590,7 +3583,7 @@ var opensteerNetworkQueryOutputSchema = objectSchema(
|
|
|
3590
3583
|
required: ["records"]
|
|
3591
3584
|
}
|
|
3592
3585
|
);
|
|
3593
|
-
var
|
|
3586
|
+
var opensteerNetworkTagInputSchema = objectSchema(
|
|
3594
3587
|
{
|
|
3595
3588
|
pageRef: pageRefSchema,
|
|
3596
3589
|
recordId: stringSchema({ minLength: 1 }),
|
|
@@ -3605,17 +3598,17 @@ var opensteerNetworkSaveInputSchema = objectSchema(
|
|
|
3605
3598
|
resourceType: networkResourceTypeSchema
|
|
3606
3599
|
},
|
|
3607
3600
|
{
|
|
3608
|
-
title: "
|
|
3601
|
+
title: "OpensteerNetworkTagInput",
|
|
3609
3602
|
required: ["tag"]
|
|
3610
3603
|
}
|
|
3611
3604
|
);
|
|
3612
|
-
var
|
|
3605
|
+
var opensteerNetworkTagOutputSchema = objectSchema(
|
|
3613
3606
|
{
|
|
3614
|
-
|
|
3607
|
+
taggedCount: integerSchema({ minimum: 0 })
|
|
3615
3608
|
},
|
|
3616
3609
|
{
|
|
3617
|
-
title: "
|
|
3618
|
-
required: ["
|
|
3610
|
+
title: "OpensteerNetworkTagOutput",
|
|
3611
|
+
required: ["taggedCount"]
|
|
3619
3612
|
}
|
|
3620
3613
|
);
|
|
3621
3614
|
var opensteerNetworkClearInputSchema = objectSchema(
|
|
@@ -7090,7 +7083,7 @@ var opensteerSemanticOperationNames = [
|
|
|
7090
7083
|
"dom.scroll",
|
|
7091
7084
|
"dom.extract",
|
|
7092
7085
|
"network.query",
|
|
7093
|
-
"network.
|
|
7086
|
+
"network.tag",
|
|
7094
7087
|
"network.clear",
|
|
7095
7088
|
"network.minimize",
|
|
7096
7089
|
"network.diff",
|
|
@@ -7151,7 +7144,7 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
|
|
|
7151
7144
|
"dom.scroll",
|
|
7152
7145
|
"dom.extract",
|
|
7153
7146
|
"network.query",
|
|
7154
|
-
"network.
|
|
7147
|
+
"network.tag",
|
|
7155
7148
|
"network.clear",
|
|
7156
7149
|
"network.minimize",
|
|
7157
7150
|
"network.diff",
|
|
@@ -8061,18 +8054,17 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
8061
8054
|
}),
|
|
8062
8055
|
defineSemanticOperationSpec({
|
|
8063
8056
|
name: "network.query",
|
|
8064
|
-
description: "Query
|
|
8057
|
+
description: "Query persisted network records for reverse engineering workflows.",
|
|
8065
8058
|
inputSchema: opensteerNetworkQueryInputSchema,
|
|
8066
8059
|
outputSchema: opensteerNetworkQueryOutputSchema,
|
|
8067
|
-
requiredCapabilities: []
|
|
8068
|
-
resolveRequiredCapabilities: (input) => input.source === "saved" ? [] : input.includeBodies === true ? ["inspect.network", "inspect.networkBodies"] : ["inspect.network"]
|
|
8060
|
+
requiredCapabilities: []
|
|
8069
8061
|
}),
|
|
8070
8062
|
defineSemanticOperationSpec({
|
|
8071
|
-
name: "network.
|
|
8072
|
-
description: "
|
|
8073
|
-
inputSchema:
|
|
8074
|
-
outputSchema:
|
|
8075
|
-
requiredCapabilities: [
|
|
8063
|
+
name: "network.tag",
|
|
8064
|
+
description: "Apply a tag to persisted network records matching the provided filters.",
|
|
8065
|
+
inputSchema: opensteerNetworkTagInputSchema,
|
|
8066
|
+
outputSchema: opensteerNetworkTagOutputSchema,
|
|
8067
|
+
requiredCapabilities: []
|
|
8076
8068
|
}),
|
|
8077
8069
|
defineSemanticOperationSpec({
|
|
8078
8070
|
name: "network.clear",
|
|
@@ -8964,7 +8956,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
8964
8956
|
async initialize() {
|
|
8965
8957
|
await this.ensureDatabaseDirectory();
|
|
8966
8958
|
}
|
|
8967
|
-
async save(records,
|
|
8959
|
+
async save(records, options) {
|
|
8968
8960
|
const database = await this.requireDatabase();
|
|
8969
8961
|
const readExisting = database.prepare(`
|
|
8970
8962
|
SELECT record_id
|
|
@@ -8973,123 +8965,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
8973
8965
|
AND page_ref_key = @page_ref_key
|
|
8974
8966
|
AND request_id = @request_id
|
|
8975
8967
|
`);
|
|
8976
|
-
const upsertRecord = database.prepare(
|
|
8977
|
-
INSERT INTO saved_network_records (
|
|
8978
|
-
record_id,
|
|
8979
|
-
request_id,
|
|
8980
|
-
session_ref,
|
|
8981
|
-
page_ref,
|
|
8982
|
-
page_ref_key,
|
|
8983
|
-
frame_ref,
|
|
8984
|
-
document_ref,
|
|
8985
|
-
action_id,
|
|
8986
|
-
method,
|
|
8987
|
-
method_lc,
|
|
8988
|
-
url,
|
|
8989
|
-
url_lc,
|
|
8990
|
-
hostname,
|
|
8991
|
-
hostname_lc,
|
|
8992
|
-
path,
|
|
8993
|
-
path_lc,
|
|
8994
|
-
status,
|
|
8995
|
-
status_text,
|
|
8996
|
-
resource_type,
|
|
8997
|
-
navigation_request,
|
|
8998
|
-
request_headers_json,
|
|
8999
|
-
response_headers_json,
|
|
9000
|
-
request_body_json,
|
|
9001
|
-
response_body_json,
|
|
9002
|
-
initiator_json,
|
|
9003
|
-
timing_json,
|
|
9004
|
-
transfer_json,
|
|
9005
|
-
source_json,
|
|
9006
|
-
capture_state,
|
|
9007
|
-
request_body_state,
|
|
9008
|
-
response_body_state,
|
|
9009
|
-
request_body_skip_reason,
|
|
9010
|
-
response_body_skip_reason,
|
|
9011
|
-
request_body_error,
|
|
9012
|
-
response_body_error,
|
|
9013
|
-
redirect_from_request_id,
|
|
9014
|
-
redirect_to_request_id,
|
|
9015
|
-
saved_at
|
|
9016
|
-
) VALUES (
|
|
9017
|
-
@record_id,
|
|
9018
|
-
@request_id,
|
|
9019
|
-
@session_ref,
|
|
9020
|
-
@page_ref,
|
|
9021
|
-
@page_ref_key,
|
|
9022
|
-
@frame_ref,
|
|
9023
|
-
@document_ref,
|
|
9024
|
-
@action_id,
|
|
9025
|
-
@method,
|
|
9026
|
-
@method_lc,
|
|
9027
|
-
@url,
|
|
9028
|
-
@url_lc,
|
|
9029
|
-
@hostname,
|
|
9030
|
-
@hostname_lc,
|
|
9031
|
-
@path,
|
|
9032
|
-
@path_lc,
|
|
9033
|
-
@status,
|
|
9034
|
-
@status_text,
|
|
9035
|
-
@resource_type,
|
|
9036
|
-
@navigation_request,
|
|
9037
|
-
@request_headers_json,
|
|
9038
|
-
@response_headers_json,
|
|
9039
|
-
@request_body_json,
|
|
9040
|
-
@response_body_json,
|
|
9041
|
-
@initiator_json,
|
|
9042
|
-
@timing_json,
|
|
9043
|
-
@transfer_json,
|
|
9044
|
-
@source_json,
|
|
9045
|
-
@capture_state,
|
|
9046
|
-
@request_body_state,
|
|
9047
|
-
@response_body_state,
|
|
9048
|
-
@request_body_skip_reason,
|
|
9049
|
-
@response_body_skip_reason,
|
|
9050
|
-
@request_body_error,
|
|
9051
|
-
@response_body_error,
|
|
9052
|
-
@redirect_from_request_id,
|
|
9053
|
-
@redirect_to_request_id,
|
|
9054
|
-
@saved_at
|
|
9055
|
-
)
|
|
9056
|
-
ON CONFLICT(record_id) DO UPDATE SET
|
|
9057
|
-
page_ref = excluded.page_ref,
|
|
9058
|
-
page_ref_key = excluded.page_ref_key,
|
|
9059
|
-
frame_ref = excluded.frame_ref,
|
|
9060
|
-
document_ref = excluded.document_ref,
|
|
9061
|
-
action_id = excluded.action_id,
|
|
9062
|
-
method = excluded.method,
|
|
9063
|
-
method_lc = excluded.method_lc,
|
|
9064
|
-
url = excluded.url,
|
|
9065
|
-
url_lc = excluded.url_lc,
|
|
9066
|
-
hostname = excluded.hostname,
|
|
9067
|
-
hostname_lc = excluded.hostname_lc,
|
|
9068
|
-
path = excluded.path,
|
|
9069
|
-
path_lc = excluded.path_lc,
|
|
9070
|
-
status = excluded.status,
|
|
9071
|
-
status_text = excluded.status_text,
|
|
9072
|
-
resource_type = excluded.resource_type,
|
|
9073
|
-
navigation_request = excluded.navigation_request,
|
|
9074
|
-
request_headers_json = excluded.request_headers_json,
|
|
9075
|
-
response_headers_json = excluded.response_headers_json,
|
|
9076
|
-
request_body_json = excluded.request_body_json,
|
|
9077
|
-
response_body_json = excluded.response_body_json,
|
|
9078
|
-
initiator_json = excluded.initiator_json,
|
|
9079
|
-
timing_json = excluded.timing_json,
|
|
9080
|
-
transfer_json = excluded.transfer_json,
|
|
9081
|
-
source_json = excluded.source_json,
|
|
9082
|
-
capture_state = excluded.capture_state,
|
|
9083
|
-
request_body_state = excluded.request_body_state,
|
|
9084
|
-
response_body_state = excluded.response_body_state,
|
|
9085
|
-
request_body_skip_reason = excluded.request_body_skip_reason,
|
|
9086
|
-
response_body_skip_reason = excluded.response_body_skip_reason,
|
|
9087
|
-
request_body_error = excluded.request_body_error,
|
|
9088
|
-
response_body_error = excluded.response_body_error,
|
|
9089
|
-
redirect_from_request_id = excluded.redirect_from_request_id,
|
|
9090
|
-
redirect_to_request_id = excluded.redirect_to_request_id,
|
|
9091
|
-
saved_at = excluded.saved_at
|
|
9092
|
-
`);
|
|
8968
|
+
const upsertRecord = database.prepare(buildSavedNetworkUpsertSql(options.bodyWriteMode));
|
|
9093
8969
|
const insertTag = database.prepare(`
|
|
9094
8970
|
INSERT OR IGNORE INTO saved_network_tags (record_id, tag)
|
|
9095
8971
|
VALUES (@record_id, @tag)
|
|
@@ -9145,10 +9021,14 @@ var SqliteSavedNetworkStore = class {
|
|
|
9145
9021
|
redirect_to_request_id: entry.record.redirectToRequestId ?? null,
|
|
9146
9022
|
saved_at: entry.savedAt ?? Date.now()
|
|
9147
9023
|
});
|
|
9148
|
-
|
|
9024
|
+
const tags = new Set(entry.tags ?? []);
|
|
9025
|
+
if (options.tag !== void 0) {
|
|
9026
|
+
tags.add(options.tag);
|
|
9027
|
+
}
|
|
9028
|
+
for (const currentTag of tags) {
|
|
9149
9029
|
const result = insertTag.run({
|
|
9150
9030
|
record_id: recordId,
|
|
9151
|
-
tag
|
|
9031
|
+
tag: currentTag
|
|
9152
9032
|
});
|
|
9153
9033
|
savedCount += result.changes ?? 0;
|
|
9154
9034
|
}
|
|
@@ -9156,6 +9036,39 @@ var SqliteSavedNetworkStore = class {
|
|
|
9156
9036
|
return savedCount;
|
|
9157
9037
|
});
|
|
9158
9038
|
}
|
|
9039
|
+
async tagByFilter(filter, tag) {
|
|
9040
|
+
const database = await this.requireDatabase();
|
|
9041
|
+
const { whereSql, parameters } = buildSavedNetworkWhere(filter);
|
|
9042
|
+
const selectRecords = database.prepare(
|
|
9043
|
+
`
|
|
9044
|
+
SELECT r.record_id
|
|
9045
|
+
FROM saved_network_records r
|
|
9046
|
+
${whereSql}
|
|
9047
|
+
`
|
|
9048
|
+
);
|
|
9049
|
+
const insertTag = database.prepare(`
|
|
9050
|
+
INSERT OR IGNORE INTO saved_network_tags (record_id, tag)
|
|
9051
|
+
VALUES (@record_id, @tag)
|
|
9052
|
+
`);
|
|
9053
|
+
return withSqliteTransaction(database, () => {
|
|
9054
|
+
let taggedCount = 0;
|
|
9055
|
+
const rows = selectRecords.all(
|
|
9056
|
+
...parameters
|
|
9057
|
+
);
|
|
9058
|
+
for (const row of rows) {
|
|
9059
|
+
const recordId = row.record_id;
|
|
9060
|
+
if (typeof recordId !== "string") {
|
|
9061
|
+
continue;
|
|
9062
|
+
}
|
|
9063
|
+
const result = insertTag.run({
|
|
9064
|
+
record_id: recordId,
|
|
9065
|
+
tag
|
|
9066
|
+
});
|
|
9067
|
+
taggedCount += result.changes ?? 0;
|
|
9068
|
+
}
|
|
9069
|
+
return taggedCount;
|
|
9070
|
+
});
|
|
9071
|
+
}
|
|
9159
9072
|
async query(input = {}) {
|
|
9160
9073
|
const database = await this.requireDatabase();
|
|
9161
9074
|
const limit = Math.max(1, Math.min(input.limit ?? 50, 200));
|
|
@@ -9358,6 +9271,10 @@ var SqliteSavedNetworkStore = class {
|
|
|
9358
9271
|
function buildSavedNetworkWhere(input) {
|
|
9359
9272
|
const clauses = [];
|
|
9360
9273
|
const parameters = [];
|
|
9274
|
+
if (input.pageRef !== void 0) {
|
|
9275
|
+
clauses.push("r.page_ref_key = ?");
|
|
9276
|
+
parameters.push(input.pageRef);
|
|
9277
|
+
}
|
|
9361
9278
|
if (input.recordId !== void 0) {
|
|
9362
9279
|
clauses.push("r.record_id = ?");
|
|
9363
9280
|
parameters.push(input.recordId);
|
|
@@ -9410,6 +9327,127 @@ function buildSavedNetworkWhere(input) {
|
|
|
9410
9327
|
parameters
|
|
9411
9328
|
};
|
|
9412
9329
|
}
|
|
9330
|
+
function buildSavedNetworkUpsertSql(bodyWriteMode) {
|
|
9331
|
+
const bodyUpdateSql = bodyWriteMode === "authoritative" ? `
|
|
9332
|
+
request_body_json = excluded.request_body_json,
|
|
9333
|
+
response_body_json = excluded.response_body_json,
|
|
9334
|
+
request_body_state = excluded.request_body_state,
|
|
9335
|
+
response_body_state = excluded.response_body_state,
|
|
9336
|
+
request_body_skip_reason = excluded.request_body_skip_reason,
|
|
9337
|
+
response_body_skip_reason = excluded.response_body_skip_reason,
|
|
9338
|
+
request_body_error = excluded.request_body_error,
|
|
9339
|
+
response_body_error = excluded.response_body_error,
|
|
9340
|
+
` : "";
|
|
9341
|
+
return `
|
|
9342
|
+
INSERT INTO saved_network_records (
|
|
9343
|
+
record_id,
|
|
9344
|
+
request_id,
|
|
9345
|
+
session_ref,
|
|
9346
|
+
page_ref,
|
|
9347
|
+
page_ref_key,
|
|
9348
|
+
frame_ref,
|
|
9349
|
+
document_ref,
|
|
9350
|
+
action_id,
|
|
9351
|
+
method,
|
|
9352
|
+
method_lc,
|
|
9353
|
+
url,
|
|
9354
|
+
url_lc,
|
|
9355
|
+
hostname,
|
|
9356
|
+
hostname_lc,
|
|
9357
|
+
path,
|
|
9358
|
+
path_lc,
|
|
9359
|
+
status,
|
|
9360
|
+
status_text,
|
|
9361
|
+
resource_type,
|
|
9362
|
+
navigation_request,
|
|
9363
|
+
request_headers_json,
|
|
9364
|
+
response_headers_json,
|
|
9365
|
+
request_body_json,
|
|
9366
|
+
response_body_json,
|
|
9367
|
+
initiator_json,
|
|
9368
|
+
timing_json,
|
|
9369
|
+
transfer_json,
|
|
9370
|
+
source_json,
|
|
9371
|
+
capture_state,
|
|
9372
|
+
request_body_state,
|
|
9373
|
+
response_body_state,
|
|
9374
|
+
request_body_skip_reason,
|
|
9375
|
+
response_body_skip_reason,
|
|
9376
|
+
request_body_error,
|
|
9377
|
+
response_body_error,
|
|
9378
|
+
redirect_from_request_id,
|
|
9379
|
+
redirect_to_request_id,
|
|
9380
|
+
saved_at
|
|
9381
|
+
) VALUES (
|
|
9382
|
+
@record_id,
|
|
9383
|
+
@request_id,
|
|
9384
|
+
@session_ref,
|
|
9385
|
+
@page_ref,
|
|
9386
|
+
@page_ref_key,
|
|
9387
|
+
@frame_ref,
|
|
9388
|
+
@document_ref,
|
|
9389
|
+
@action_id,
|
|
9390
|
+
@method,
|
|
9391
|
+
@method_lc,
|
|
9392
|
+
@url,
|
|
9393
|
+
@url_lc,
|
|
9394
|
+
@hostname,
|
|
9395
|
+
@hostname_lc,
|
|
9396
|
+
@path,
|
|
9397
|
+
@path_lc,
|
|
9398
|
+
@status,
|
|
9399
|
+
@status_text,
|
|
9400
|
+
@resource_type,
|
|
9401
|
+
@navigation_request,
|
|
9402
|
+
@request_headers_json,
|
|
9403
|
+
@response_headers_json,
|
|
9404
|
+
@request_body_json,
|
|
9405
|
+
@response_body_json,
|
|
9406
|
+
@initiator_json,
|
|
9407
|
+
@timing_json,
|
|
9408
|
+
@transfer_json,
|
|
9409
|
+
@source_json,
|
|
9410
|
+
@capture_state,
|
|
9411
|
+
@request_body_state,
|
|
9412
|
+
@response_body_state,
|
|
9413
|
+
@request_body_skip_reason,
|
|
9414
|
+
@response_body_skip_reason,
|
|
9415
|
+
@request_body_error,
|
|
9416
|
+
@response_body_error,
|
|
9417
|
+
@redirect_from_request_id,
|
|
9418
|
+
@redirect_to_request_id,
|
|
9419
|
+
@saved_at
|
|
9420
|
+
)
|
|
9421
|
+
ON CONFLICT(record_id) DO UPDATE SET
|
|
9422
|
+
page_ref = excluded.page_ref,
|
|
9423
|
+
page_ref_key = excluded.page_ref_key,
|
|
9424
|
+
frame_ref = excluded.frame_ref,
|
|
9425
|
+
document_ref = excluded.document_ref,
|
|
9426
|
+
action_id = excluded.action_id,
|
|
9427
|
+
method = excluded.method,
|
|
9428
|
+
method_lc = excluded.method_lc,
|
|
9429
|
+
url = excluded.url,
|
|
9430
|
+
url_lc = excluded.url_lc,
|
|
9431
|
+
hostname = excluded.hostname,
|
|
9432
|
+
hostname_lc = excluded.hostname_lc,
|
|
9433
|
+
path = excluded.path,
|
|
9434
|
+
path_lc = excluded.path_lc,
|
|
9435
|
+
status = excluded.status,
|
|
9436
|
+
status_text = excluded.status_text,
|
|
9437
|
+
resource_type = excluded.resource_type,
|
|
9438
|
+
navigation_request = excluded.navigation_request,
|
|
9439
|
+
request_headers_json = excluded.request_headers_json,
|
|
9440
|
+
response_headers_json = excluded.response_headers_json,
|
|
9441
|
+
${bodyUpdateSql} initiator_json = excluded.initiator_json,
|
|
9442
|
+
timing_json = excluded.timing_json,
|
|
9443
|
+
transfer_json = excluded.transfer_json,
|
|
9444
|
+
source_json = excluded.source_json,
|
|
9445
|
+
capture_state = excluded.capture_state,
|
|
9446
|
+
redirect_from_request_id = excluded.redirect_from_request_id,
|
|
9447
|
+
redirect_to_request_id = excluded.redirect_to_request_id,
|
|
9448
|
+
saved_at = MIN(saved_network_records.saved_at, excluded.saved_at)
|
|
9449
|
+
`;
|
|
9450
|
+
}
|
|
9413
9451
|
function inflateSavedNetworkRow(row, includeBodies) {
|
|
9414
9452
|
const requestBody = includeBodies && row.request_body_json !== null ? JSON.parse(row.request_body_json) : void 0;
|
|
9415
9453
|
const responseBody = includeBodies && row.response_body_json !== null ? JSON.parse(row.response_body_json) : void 0;
|
|
@@ -9480,7 +9518,6 @@ function inflateSavedNetworkRow(row, includeBodies) {
|
|
|
9480
9518
|
}
|
|
9481
9519
|
return {
|
|
9482
9520
|
recordId: row.record_id,
|
|
9483
|
-
source: "saved",
|
|
9484
9521
|
...row.action_id === null ? {} : { actionId: row.action_id },
|
|
9485
9522
|
...row.tags === null || row.tags.length === 0 ? {} : { tags: row.tags.split(TAG_DELIMITER).filter((tag) => tag.length > 0) },
|
|
9486
9523
|
savedAt: row.saved_at,
|
|
@@ -10785,8 +10822,8 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
|
|
|
10785
10822
|
input,
|
|
10786
10823
|
options
|
|
10787
10824
|
);
|
|
10788
|
-
case "network.
|
|
10789
|
-
return runtime.
|
|
10825
|
+
case "network.tag":
|
|
10826
|
+
return runtime.tagNetwork(
|
|
10790
10827
|
input,
|
|
10791
10828
|
options
|
|
10792
10829
|
);
|
|
@@ -11854,8 +11891,22 @@ var OpensteerCloudClient = class {
|
|
|
11854
11891
|
});
|
|
11855
11892
|
return await response.json();
|
|
11856
11893
|
}
|
|
11857
|
-
async importAuthRecipes(entries) {
|
|
11858
|
-
const response = await this.request("/registry/auth-recipes/import", {
|
|
11894
|
+
async importAuthRecipes(entries) {
|
|
11895
|
+
const response = await this.request("/registry/auth-recipes/import", {
|
|
11896
|
+
method: "POST",
|
|
11897
|
+
body: { entries }
|
|
11898
|
+
});
|
|
11899
|
+
return await response.json();
|
|
11900
|
+
}
|
|
11901
|
+
async importReverseCases(entries) {
|
|
11902
|
+
const response = await this.request("/registry/reverse-cases/import", {
|
|
11903
|
+
method: "POST",
|
|
11904
|
+
body: { entries }
|
|
11905
|
+
});
|
|
11906
|
+
return await response.json();
|
|
11907
|
+
}
|
|
11908
|
+
async importReversePackages(entries) {
|
|
11909
|
+
const response = await this.request("/registry/reverse-packages/import", {
|
|
11859
11910
|
method: "POST",
|
|
11860
11911
|
body: { entries }
|
|
11861
11912
|
});
|
|
@@ -11999,7 +12050,7 @@ var DEFAULT_TIMEOUTS = {
|
|
|
11999
12050
|
"dom.scroll": 1e4,
|
|
12000
12051
|
"dom.extract": 15e3,
|
|
12001
12052
|
"network.query": 15e3,
|
|
12002
|
-
"network.
|
|
12053
|
+
"network.tag": 15e3,
|
|
12003
12054
|
"network.clear": 1e4,
|
|
12004
12055
|
"scripts.capture": 15e3,
|
|
12005
12056
|
"request.raw": 3e4,
|
|
@@ -13778,6 +13829,19 @@ var MemoryDomDescriptorStore = class {
|
|
|
13778
13829
|
}
|
|
13779
13830
|
};
|
|
13780
13831
|
|
|
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
|
+
|
|
13781
13845
|
// ../runtime-core/src/runtimes/dom/executor.ts
|
|
13782
13846
|
var MAX_DOM_ACTION_ATTEMPTS = 3;
|
|
13783
13847
|
var DEFAULT_SCROLL_OPTIONS = {
|
|
@@ -13907,6 +13971,7 @@ var DomActionExecutor = class {
|
|
|
13907
13971
|
})
|
|
13908
13972
|
);
|
|
13909
13973
|
let finalResolved = resolved;
|
|
13974
|
+
let finalSnapshot;
|
|
13910
13975
|
if (input.pressEnter) {
|
|
13911
13976
|
await this.settle(resolved.pageRef, "dom.input", timeout);
|
|
13912
13977
|
const enterSession = this.options.createResolutionSession();
|
|
@@ -13922,6 +13987,9 @@ var DomActionExecutor = class {
|
|
|
13922
13987
|
() => bridge.inspectActionTarget(enterResolved.locator)
|
|
13923
13988
|
);
|
|
13924
13989
|
this.assertKeyboardActionable("dom.input", enterResolved, inspectionBeforeEnter);
|
|
13990
|
+
finalSnapshot = await timeout.runStep(
|
|
13991
|
+
() => captureActionBoundarySnapshot(this.options.engine, enterResolved.pageRef)
|
|
13992
|
+
);
|
|
13925
13993
|
await timeout.runStep(
|
|
13926
13994
|
() => bridge.pressKey(enterResolved.locator, {
|
|
13927
13995
|
key: "Enter"
|
|
@@ -13929,7 +13997,7 @@ var DomActionExecutor = class {
|
|
|
13929
13997
|
);
|
|
13930
13998
|
finalResolved = enterResolved;
|
|
13931
13999
|
}
|
|
13932
|
-
await this.settle(finalResolved.pageRef, "dom.input", timeout);
|
|
14000
|
+
await this.settle(finalResolved.pageRef, "dom.input", timeout, finalSnapshot);
|
|
13933
14001
|
return finalResolved;
|
|
13934
14002
|
} catch (error) {
|
|
13935
14003
|
lastError = error;
|
|
@@ -14002,8 +14070,16 @@ var DomActionExecutor = class {
|
|
|
14002
14070
|
);
|
|
14003
14071
|
}
|
|
14004
14072
|
}
|
|
14073
|
+
const actionBoundarySnapshot = await timeout.runStep(
|
|
14074
|
+
() => captureActionBoundarySnapshot(this.options.engine, pointerTarget.resolved.pageRef)
|
|
14075
|
+
);
|
|
14005
14076
|
const outcome = await dispatch(pointerTarget, point, timeout);
|
|
14006
|
-
await this.settle(
|
|
14077
|
+
await this.settle(
|
|
14078
|
+
pointerTarget.resolved.pageRef,
|
|
14079
|
+
input.operation,
|
|
14080
|
+
timeout,
|
|
14081
|
+
actionBoundarySnapshot
|
|
14082
|
+
);
|
|
14007
14083
|
return outcome;
|
|
14008
14084
|
} catch (error) {
|
|
14009
14085
|
lastError = error;
|
|
@@ -14021,16 +14097,17 @@ var DomActionExecutor = class {
|
|
|
14021
14097
|
}
|
|
14022
14098
|
return runWithPolicyTimeout(this.options.policy.timeout, { operation }, execute);
|
|
14023
14099
|
}
|
|
14024
|
-
async settle(pageRef, operation, timeout) {
|
|
14100
|
+
async settle(pageRef, operation, timeout, snapshot) {
|
|
14025
14101
|
const bridge = this.requireBridge();
|
|
14026
14102
|
await timeout.runStep(
|
|
14027
14103
|
() => bridge.finalizeDomAction(pageRef, {
|
|
14028
14104
|
operation,
|
|
14105
|
+
...snapshot === void 0 ? {} : { snapshot },
|
|
14029
14106
|
signal: timeout.signal,
|
|
14030
14107
|
remainingMs: () => timeout.remainingMs(),
|
|
14031
|
-
policySettle: (targetPageRef) => settleWithPolicy(this.options.policy.settle, {
|
|
14108
|
+
policySettle: (targetPageRef, trigger) => settleWithPolicy(this.options.policy.settle, {
|
|
14032
14109
|
operation,
|
|
14033
|
-
trigger
|
|
14110
|
+
trigger,
|
|
14034
14111
|
engine: this.options.engine,
|
|
14035
14112
|
pageRef: targetPageRef,
|
|
14036
14113
|
signal: timeout.signal,
|
|
@@ -15304,16 +15381,20 @@ var DefaultComputerUseRuntime = class {
|
|
|
15304
15381
|
const preActionDisplay = createComputerDisplayTransform(preActionNativeViewport);
|
|
15305
15382
|
const nativeAction = toNativeComputerAction(input.input.action, preActionDisplay);
|
|
15306
15383
|
const screenshot = normalizeScreenshotOptions(input.input.screenshot);
|
|
15384
|
+
const snapshot = await input.timeout.runStep(
|
|
15385
|
+
() => captureActionBoundarySnapshot(this.options.engine, input.pageRef)
|
|
15386
|
+
);
|
|
15307
15387
|
const executed = await input.timeout.runStep(
|
|
15308
15388
|
() => bridge.execute({
|
|
15309
15389
|
pageRef: input.pageRef,
|
|
15390
|
+
snapshot,
|
|
15310
15391
|
action: nativeAction,
|
|
15311
15392
|
screenshot,
|
|
15312
15393
|
signal: input.timeout.signal,
|
|
15313
15394
|
remainingMs: () => input.timeout.remainingMs(),
|
|
15314
|
-
policySettle: async (pageRef) => settleWithPolicy(this.options.policy.settle, {
|
|
15395
|
+
policySettle: async (pageRef, trigger) => settleWithPolicy(this.options.policy.settle, {
|
|
15315
15396
|
operation: "computer.execute",
|
|
15316
|
-
trigger
|
|
15397
|
+
trigger,
|
|
15317
15398
|
engine: this.options.engine,
|
|
15318
15399
|
pageRef,
|
|
15319
15400
|
signal: input.timeout.signal,
|
|
@@ -16047,9 +16128,9 @@ function inferRequestPlanFromNetworkRecord(record, input, options = {}) {
|
|
|
16047
16128
|
key: input.key,
|
|
16048
16129
|
version: input.version,
|
|
16049
16130
|
provenance: {
|
|
16050
|
-
source: record.
|
|
16131
|
+
source: record.savedAt === void 0 ? "network-record" : "saved-network-record",
|
|
16051
16132
|
sourceId: record.recordId,
|
|
16052
|
-
...record.
|
|
16133
|
+
...record.savedAt === void 0 ? options.observedAt === void 0 ? {} : { capturedAt: options.observedAt } : { capturedAt: record.savedAt }
|
|
16053
16134
|
},
|
|
16054
16135
|
payload,
|
|
16055
16136
|
...record.tags === void 0 || record.tags.length === 0 ? {} : { tags: record.tags }
|
|
@@ -16429,51 +16510,55 @@ function resolveBodyEncoding(charset) {
|
|
|
16429
16510
|
return "utf8";
|
|
16430
16511
|
}
|
|
16431
16512
|
}
|
|
16432
|
-
var
|
|
16513
|
+
var NetworkHistory = class {
|
|
16433
16514
|
metadataByRequestId = /* @__PURE__ */ new Map();
|
|
16434
16515
|
requestIdByRecordId = /* @__PURE__ */ new Map();
|
|
16435
16516
|
requestIdsByActionId = /* @__PURE__ */ new Map();
|
|
16436
16517
|
requestIdsByTag = /* @__PURE__ */ new Map();
|
|
16437
|
-
|
|
16518
|
+
tombstonedRequestIds = /* @__PURE__ */ new Set();
|
|
16519
|
+
materialize(records, options = {}) {
|
|
16438
16520
|
const observedAt = Date.now();
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
recordId: `record:${crypto.randomUUID()}`,
|
|
16446
|
-
observedAt,
|
|
16447
|
-
...record.pageRef === void 0 ? {} : { pageRef: record.pageRef },
|
|
16448
|
-
tags: /* @__PURE__ */ new Set()
|
|
16449
|
-
};
|
|
16450
|
-
this.metadataByRequestId.set(record.requestId, metadata);
|
|
16451
|
-
this.requestIdByRecordId.set(metadata.recordId, record.requestId);
|
|
16452
|
-
} else if (metadata.pageRef === void 0 && record.pageRef !== void 0) {
|
|
16453
|
-
metadata.pageRef = record.pageRef;
|
|
16521
|
+
const materialized = [];
|
|
16522
|
+
for (const record of records) {
|
|
16523
|
+
const entry = this.materializeRecord(record, observedAt, options);
|
|
16524
|
+
if (entry !== void 0) {
|
|
16525
|
+
materialized.push(entry);
|
|
16526
|
+
}
|
|
16454
16527
|
}
|
|
16455
|
-
return
|
|
16456
|
-
recordId: metadata.recordId,
|
|
16457
|
-
source: "live",
|
|
16458
|
-
...metadata.actionId === void 0 ? {} : { actionId: metadata.actionId },
|
|
16459
|
-
...metadata.tags.size === 0 ? {} : { tags: [...metadata.tags].sort() },
|
|
16460
|
-
record: toProtocolNetworkRecord(record, {
|
|
16461
|
-
redactSecretHeaders: options.redactSecretHeaders ?? true
|
|
16462
|
-
})
|
|
16463
|
-
};
|
|
16528
|
+
return materialized;
|
|
16464
16529
|
}
|
|
16465
|
-
|
|
16466
|
-
const observedAt = Date.now();
|
|
16467
|
-
const
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16530
|
+
async persist(records, store, options) {
|
|
16531
|
+
const observedAt = options.observedAt ?? Date.now();
|
|
16532
|
+
const metadataToSave = /* @__PURE__ */ new Set();
|
|
16533
|
+
const persisted = [];
|
|
16534
|
+
for (const record of records) {
|
|
16535
|
+
const entry = this.materializeRecord(record, observedAt, {
|
|
16536
|
+
...options.redactSecretHeaders === void 0 ? {} : { redactSecretHeaders: options.redactSecretHeaders }
|
|
16537
|
+
});
|
|
16538
|
+
if (entry === void 0) {
|
|
16539
|
+
continue;
|
|
16540
|
+
}
|
|
16541
|
+
const requestId = entry.record.requestId;
|
|
16542
|
+
const metadata = this.metadataByRequestId.get(requestId);
|
|
16543
|
+
if (metadata === void 0) {
|
|
16544
|
+
continue;
|
|
16545
|
+
}
|
|
16546
|
+
const savedAt = metadata.savedAt ?? observedAt;
|
|
16547
|
+
metadataToSave.add(metadata);
|
|
16548
|
+
persisted.push({
|
|
16549
|
+
...entry,
|
|
16550
|
+
savedAt
|
|
16551
|
+
});
|
|
16552
|
+
}
|
|
16553
|
+
if (persisted.length > 0) {
|
|
16554
|
+
await store.save(persisted, {
|
|
16555
|
+
bodyWriteMode: options.bodyWriteMode
|
|
16556
|
+
});
|
|
16557
|
+
for (const metadata of metadataToSave) {
|
|
16558
|
+
metadata.savedAt ??= observedAt;
|
|
16559
|
+
}
|
|
16560
|
+
}
|
|
16561
|
+
return persisted;
|
|
16477
16562
|
}
|
|
16478
16563
|
assignActionId(records, actionId) {
|
|
16479
16564
|
for (const record of records) {
|
|
@@ -16514,11 +16599,73 @@ var NetworkJournal = class {
|
|
|
16514
16599
|
getPageRefForRequestId(requestId) {
|
|
16515
16600
|
return this.metadataByRequestId.get(requestId)?.pageRef;
|
|
16516
16601
|
}
|
|
16602
|
+
getKnownRequestIds() {
|
|
16603
|
+
return new Set(this.metadataByRequestId.keys());
|
|
16604
|
+
}
|
|
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
|
+
tombstoneRequestIds(requestIds) {
|
|
16620
|
+
for (const requestId of requestIds) {
|
|
16621
|
+
this.tombstonedRequestIds.add(requestId);
|
|
16622
|
+
const metadata = this.metadataByRequestId.get(requestId);
|
|
16623
|
+
if (!metadata) {
|
|
16624
|
+
continue;
|
|
16625
|
+
}
|
|
16626
|
+
this.metadataByRequestId.delete(requestId);
|
|
16627
|
+
this.requestIdByRecordId.delete(metadata.recordId);
|
|
16628
|
+
if (metadata.actionId !== void 0) {
|
|
16629
|
+
this.requestIdsByActionId.get(metadata.actionId)?.delete(requestId);
|
|
16630
|
+
}
|
|
16631
|
+
for (const tag of metadata.tags) {
|
|
16632
|
+
this.requestIdsByTag.get(tag)?.delete(requestId);
|
|
16633
|
+
}
|
|
16634
|
+
}
|
|
16635
|
+
}
|
|
16517
16636
|
clear() {
|
|
16518
16637
|
this.metadataByRequestId.clear();
|
|
16519
16638
|
this.requestIdByRecordId.clear();
|
|
16520
16639
|
this.requestIdsByActionId.clear();
|
|
16521
16640
|
this.requestIdsByTag.clear();
|
|
16641
|
+
this.tombstonedRequestIds.clear();
|
|
16642
|
+
}
|
|
16643
|
+
materializeRecord(record, observedAt, options) {
|
|
16644
|
+
if (this.tombstonedRequestIds.has(record.requestId)) {
|
|
16645
|
+
return void 0;
|
|
16646
|
+
}
|
|
16647
|
+
let metadata = this.metadataByRequestId.get(record.requestId);
|
|
16648
|
+
if (!metadata) {
|
|
16649
|
+
metadata = {
|
|
16650
|
+
recordId: `record:${crypto.randomUUID()}`,
|
|
16651
|
+
observedAt,
|
|
16652
|
+
...record.pageRef === void 0 ? {} : { pageRef: record.pageRef },
|
|
16653
|
+
tags: /* @__PURE__ */ new Set()
|
|
16654
|
+
};
|
|
16655
|
+
this.metadataByRequestId.set(record.requestId, metadata);
|
|
16656
|
+
this.requestIdByRecordId.set(metadata.recordId, record.requestId);
|
|
16657
|
+
} else if (metadata.pageRef === void 0 && record.pageRef !== void 0) {
|
|
16658
|
+
metadata.pageRef = record.pageRef;
|
|
16659
|
+
}
|
|
16660
|
+
return {
|
|
16661
|
+
recordId: metadata.recordId,
|
|
16662
|
+
...metadata.actionId === void 0 ? {} : { actionId: metadata.actionId },
|
|
16663
|
+
...metadata.tags.size === 0 ? {} : { tags: [...metadata.tags].sort() },
|
|
16664
|
+
...metadata.savedAt === void 0 ? {} : { savedAt: metadata.savedAt },
|
|
16665
|
+
record: toProtocolNetworkRecord(record, {
|
|
16666
|
+
redactSecretHeaders: options.redactSecretHeaders ?? true
|
|
16667
|
+
})
|
|
16668
|
+
};
|
|
16522
16669
|
}
|
|
16523
16670
|
addIndexedRequestId(index, key, requestId) {
|
|
16524
16671
|
const requestIds = index.get(key) ?? /* @__PURE__ */ new Set();
|
|
@@ -23269,12 +23416,11 @@ var OpensteerSessionRuntime = class {
|
|
|
23269
23416
|
engine;
|
|
23270
23417
|
dom;
|
|
23271
23418
|
computer;
|
|
23272
|
-
|
|
23419
|
+
networkHistory = new NetworkHistory();
|
|
23273
23420
|
extractionDescriptors;
|
|
23274
23421
|
sessionRef;
|
|
23275
23422
|
pageRef;
|
|
23276
23423
|
runId;
|
|
23277
|
-
backgroundNetworkPersistence = /* @__PURE__ */ new Set();
|
|
23278
23424
|
cookieJars = /* @__PURE__ */ new Map();
|
|
23279
23425
|
recipeCache = /* @__PURE__ */ new Map();
|
|
23280
23426
|
ownsEngine = false;
|
|
@@ -23704,19 +23850,28 @@ var OpensteerSessionRuntime = class {
|
|
|
23704
23850
|
const output = await this.runWithOperationTimeout(
|
|
23705
23851
|
"page.evaluate",
|
|
23706
23852
|
async (timeout) => {
|
|
23707
|
-
const
|
|
23708
|
-
|
|
23709
|
-
|
|
23853
|
+
const baselineRequestIds = await this.beginMutationCapture(timeout);
|
|
23854
|
+
try {
|
|
23855
|
+
const remainingMs = timeout.remainingMs();
|
|
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 {
|
|
23710
23866
|
pageRef,
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
};
|
|
23867
|
+
value: toJsonValueOrNull(evaluated.data)
|
|
23868
|
+
};
|
|
23869
|
+
} catch (error) {
|
|
23870
|
+
await this.completeMutationCapture(timeout, baselineRequestIds, void 0).catch(
|
|
23871
|
+
() => void 0
|
|
23872
|
+
);
|
|
23873
|
+
throw error;
|
|
23874
|
+
}
|
|
23720
23875
|
},
|
|
23721
23876
|
options
|
|
23722
23877
|
);
|
|
@@ -24080,38 +24235,19 @@ var OpensteerSessionRuntime = class {
|
|
|
24080
24235
|
}
|
|
24081
24236
|
async queryNetwork(input = {}, options = {}) {
|
|
24082
24237
|
assertValidSemanticOperationInput("network.query", input);
|
|
24083
|
-
if (input.source !== "saved") {
|
|
24084
|
-
await this.ensurePageRef();
|
|
24085
|
-
}
|
|
24086
24238
|
const root = await this.ensureRoot();
|
|
24087
24239
|
const startedAt = Date.now();
|
|
24088
24240
|
try {
|
|
24089
24241
|
const output = await this.runWithOperationTimeout(
|
|
24090
24242
|
"network.query",
|
|
24091
24243
|
async (timeout) => {
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
records: await timeout.runStep(
|
|
24096
|
-
() => root.registry.savedNetwork.query({
|
|
24097
|
-
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
24098
|
-
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
24099
|
-
...input.actionId === void 0 ? {} : { actionId: input.actionId },
|
|
24100
|
-
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
24101
|
-
...input.url === void 0 ? {} : { url: input.url },
|
|
24102
|
-
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
24103
|
-
...input.path === void 0 ? {} : { path: input.path },
|
|
24104
|
-
...input.method === void 0 ? {} : { method: input.method },
|
|
24105
|
-
...input.status === void 0 ? {} : { status: input.status },
|
|
24106
|
-
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType },
|
|
24107
|
-
...input.includeBodies === void 0 ? {} : { includeBodies: input.includeBodies },
|
|
24108
|
-
...input.limit === void 0 ? {} : { limit: input.limit }
|
|
24109
|
-
})
|
|
24110
|
-
)
|
|
24111
|
-
};
|
|
24112
|
-
}
|
|
24244
|
+
await this.syncPersistedNetworkSelection(timeout, input, {
|
|
24245
|
+
includeBodies: input.includeBodies ?? false
|
|
24246
|
+
});
|
|
24113
24247
|
return {
|
|
24114
|
-
records: await
|
|
24248
|
+
records: await timeout.runStep(
|
|
24249
|
+
() => root.registry.savedNetwork.query(this.toSavedNetworkQueryInput(input))
|
|
24250
|
+
)
|
|
24115
24251
|
};
|
|
24116
24252
|
},
|
|
24117
24253
|
options
|
|
@@ -24122,7 +24258,6 @@ var OpensteerSessionRuntime = class {
|
|
|
24122
24258
|
completedAt: Date.now(),
|
|
24123
24259
|
outcome: "ok",
|
|
24124
24260
|
data: {
|
|
24125
|
-
source: input.source ?? "live",
|
|
24126
24261
|
includeBodies: input.includeBodies ?? false,
|
|
24127
24262
|
limit: input.limit ?? 50,
|
|
24128
24263
|
count: output.records.length
|
|
@@ -24148,56 +24283,42 @@ var OpensteerSessionRuntime = class {
|
|
|
24148
24283
|
throw error;
|
|
24149
24284
|
}
|
|
24150
24285
|
}
|
|
24151
|
-
async
|
|
24152
|
-
assertValidSemanticOperationInput("network.
|
|
24153
|
-
await this.ensurePageRef();
|
|
24286
|
+
async tagNetwork(input, options = {}) {
|
|
24287
|
+
assertValidSemanticOperationInput("network.tag", input);
|
|
24154
24288
|
const root = await this.ensureRoot();
|
|
24289
|
+
const filter = this.toQueryInputFromTagInput(input);
|
|
24290
|
+
const savedFilter = this.toSavedNetworkQueryInput(filter);
|
|
24155
24291
|
const startedAt = Date.now();
|
|
24156
24292
|
try {
|
|
24157
24293
|
const output = await this.runWithOperationTimeout(
|
|
24158
|
-
"network.
|
|
24294
|
+
"network.tag",
|
|
24159
24295
|
async (timeout) => {
|
|
24160
|
-
const records = await this.
|
|
24161
|
-
|
|
24162
|
-
|
|
24163
|
-
|
|
24164
|
-
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
24165
|
-
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
24166
|
-
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
24167
|
-
...input.actionId === void 0 ? {} : { actionId: input.actionId },
|
|
24168
|
-
...input.url === void 0 ? {} : { url: input.url },
|
|
24169
|
-
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
24170
|
-
...input.path === void 0 ? {} : { path: input.path },
|
|
24171
|
-
...input.method === void 0 ? {} : { method: input.method },
|
|
24172
|
-
...input.status === void 0 ? {} : { status: input.status },
|
|
24173
|
-
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType }
|
|
24174
|
-
},
|
|
24175
|
-
timeout,
|
|
24176
|
-
{ ignoreLimit: true, redactSecretHeaders: false }
|
|
24177
|
-
);
|
|
24178
|
-
this.networkJournal.addTag(records, input.tag);
|
|
24296
|
+
const records = await this.syncPersistedNetworkSelection(timeout, filter, {
|
|
24297
|
+
includeBodies: false
|
|
24298
|
+
});
|
|
24299
|
+
this.networkHistory.addTag(records, input.tag);
|
|
24179
24300
|
return {
|
|
24180
|
-
|
|
24181
|
-
() => root.registry.savedNetwork.
|
|
24301
|
+
taggedCount: await timeout.runStep(
|
|
24302
|
+
() => root.registry.savedNetwork.tagByFilter(savedFilter, input.tag)
|
|
24182
24303
|
)
|
|
24183
24304
|
};
|
|
24184
24305
|
},
|
|
24185
24306
|
options
|
|
24186
24307
|
);
|
|
24187
24308
|
await this.appendTrace({
|
|
24188
|
-
operation: "network.
|
|
24309
|
+
operation: "network.tag",
|
|
24189
24310
|
startedAt,
|
|
24190
24311
|
completedAt: Date.now(),
|
|
24191
24312
|
outcome: "ok",
|
|
24192
24313
|
data: {
|
|
24193
24314
|
tag: input.tag,
|
|
24194
|
-
|
|
24315
|
+
taggedCount: output.taggedCount
|
|
24195
24316
|
}
|
|
24196
24317
|
});
|
|
24197
24318
|
return output;
|
|
24198
24319
|
} catch (error) {
|
|
24199
24320
|
await this.appendTrace({
|
|
24200
|
-
operation: "network.
|
|
24321
|
+
operation: "network.tag",
|
|
24201
24322
|
startedAt,
|
|
24202
24323
|
completedAt: Date.now(),
|
|
24203
24324
|
outcome: "error",
|
|
@@ -24214,7 +24335,19 @@ var OpensteerSessionRuntime = class {
|
|
|
24214
24335
|
const output = await this.runWithOperationTimeout(
|
|
24215
24336
|
"network.clear",
|
|
24216
24337
|
async (timeout) => {
|
|
24217
|
-
|
|
24338
|
+
if (this.sessionRef !== void 0) {
|
|
24339
|
+
const liveRequestIds = await this.readLiveRequestIds(timeout, {
|
|
24340
|
+
includeCurrentPageOnly: false
|
|
24341
|
+
});
|
|
24342
|
+
if (input.tag === void 0) {
|
|
24343
|
+
this.networkHistory.tombstoneRequestIds(liveRequestIds);
|
|
24344
|
+
}
|
|
24345
|
+
}
|
|
24346
|
+
if (input.tag === void 0) {
|
|
24347
|
+
this.networkHistory.tombstoneRequestIds(this.networkHistory.getKnownRequestIds());
|
|
24348
|
+
} else {
|
|
24349
|
+
this.networkHistory.clearTag(input.tag);
|
|
24350
|
+
}
|
|
24218
24351
|
return {
|
|
24219
24352
|
clearedCount: await timeout.runStep(() => root.registry.savedNetwork.clear(input))
|
|
24220
24353
|
};
|
|
@@ -24931,7 +25064,6 @@ var OpensteerSessionRuntime = class {
|
|
|
24931
25064
|
});
|
|
24932
25065
|
const networkRecords = await this.queryLiveNetwork(
|
|
24933
25066
|
{
|
|
24934
|
-
source: "live",
|
|
24935
25067
|
pageRef,
|
|
24936
25068
|
...input.network?.url === void 0 ? {} : { url: input.network.url },
|
|
24937
25069
|
...input.network?.hostname === void 0 ? {} : { hostname: input.network.hostname },
|
|
@@ -24947,7 +25079,7 @@ var OpensteerSessionRuntime = class {
|
|
|
24947
25079
|
);
|
|
24948
25080
|
const persistedNetwork = filterReverseObservationWindow(
|
|
24949
25081
|
networkRecords.filter(isReverseRelevantNetworkRecord),
|
|
24950
|
-
this.
|
|
25082
|
+
this.networkHistory,
|
|
24951
25083
|
input.captureWindowMs
|
|
24952
25084
|
);
|
|
24953
25085
|
const fallbackSavedNetwork = persistedNetwork.length === 0 ? (await root.registry.savedNetwork.query({
|
|
@@ -24962,7 +25094,10 @@ var OpensteerSessionRuntime = class {
|
|
|
24962
25094
|
const observationId = `observation:${crypto.randomUUID()}`;
|
|
24963
25095
|
const networkTag = `reverse-case:${caseRecord.id}:${observationId}`;
|
|
24964
25096
|
if (observationNetwork.length > 0) {
|
|
24965
|
-
await root.registry.savedNetwork.save(observationNetwork,
|
|
25097
|
+
await root.registry.savedNetwork.save(observationNetwork, {
|
|
25098
|
+
tag: networkTag,
|
|
25099
|
+
bodyWriteMode: input.network?.includeBodies === false ? "metadata-only" : "authoritative"
|
|
25100
|
+
});
|
|
24966
25101
|
}
|
|
24967
25102
|
const scriptArtifactIds = input.includeScripts === false ? [] : (await this.captureScriptsInternal(
|
|
24968
25103
|
pageRef,
|
|
@@ -25058,7 +25193,7 @@ var OpensteerSessionRuntime = class {
|
|
|
25058
25193
|
includeBodies: true,
|
|
25059
25194
|
redactSecretHeaders: false
|
|
25060
25195
|
}),
|
|
25061
|
-
observedAt: this.
|
|
25196
|
+
observedAt: this.networkHistory.getObservedAt(recordId)
|
|
25062
25197
|
}))
|
|
25063
25198
|
);
|
|
25064
25199
|
const clusteredRecords = observationRecords.map((entry) => {
|
|
@@ -25998,7 +26133,10 @@ var OpensteerSessionRuntime = class {
|
|
|
25998
26133
|
timeout.signal
|
|
25999
26134
|
)).filter((record) => !baselineRequestIds.has(record.record.requestId));
|
|
26000
26135
|
if (deltaRecords.length > 0) {
|
|
26001
|
-
await root.registry.savedNetwork.save(deltaRecords,
|
|
26136
|
+
await root.registry.savedNetwork.save(deltaRecords, {
|
|
26137
|
+
tag: `interaction:${pageRef}`,
|
|
26138
|
+
bodyWriteMode: "authoritative"
|
|
26139
|
+
});
|
|
26002
26140
|
}
|
|
26003
26141
|
const trace = await root.registry.interactionTraces.write({
|
|
26004
26142
|
key: input.key ?? buildInteractionTraceKey(pageInfo.url),
|
|
@@ -26341,7 +26479,7 @@ var OpensteerSessionRuntime = class {
|
|
|
26341
26479
|
includeBodies: true
|
|
26342
26480
|
});
|
|
26343
26481
|
const inferred = inferRequestPlanFromNetworkRecord(source, input, {
|
|
26344
|
-
...this.
|
|
26482
|
+
...this.networkHistory.getObservedAt(source.recordId) === void 0 ? {} : { observedAt: this.networkHistory.getObservedAt(source.recordId) }
|
|
26345
26483
|
});
|
|
26346
26484
|
return timeout.runStep(
|
|
26347
26485
|
() => root.registry.requestPlans.write({
|
|
@@ -27153,7 +27291,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27153
27291
|
await this.runWithOperationTimeout(
|
|
27154
27292
|
"session.close",
|
|
27155
27293
|
async (timeout) => {
|
|
27156
|
-
await timeout.runStep(() => this.
|
|
27294
|
+
await timeout.runStep(() => this.flushPersistedNetworkHistory());
|
|
27157
27295
|
if (engine === void 0) {
|
|
27158
27296
|
return;
|
|
27159
27297
|
}
|
|
@@ -27222,10 +27360,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27222
27360
|
}
|
|
27223
27361
|
async disconnect() {
|
|
27224
27362
|
try {
|
|
27225
|
-
await this.
|
|
27226
|
-
if (this.sessionRef !== void 0 && this.pageRef !== void 0) {
|
|
27227
|
-
await this.saveNetwork({ tag: "auto" }).catch(() => void 0);
|
|
27228
|
-
}
|
|
27363
|
+
await this.flushPersistedNetworkHistory();
|
|
27229
27364
|
} finally {
|
|
27230
27365
|
await this.resetRuntimeState({
|
|
27231
27366
|
disposeEngine: true
|
|
@@ -27317,7 +27452,10 @@ var OpensteerSessionRuntime = class {
|
|
|
27317
27452
|
};
|
|
27318
27453
|
}
|
|
27319
27454
|
if (target.kind === "element") {
|
|
27320
|
-
const elementTarget = {
|
|
27455
|
+
const elementTarget = {
|
|
27456
|
+
kind: "selector",
|
|
27457
|
+
selector: `[c="${String(target.element)}"]`
|
|
27458
|
+
};
|
|
27321
27459
|
const resolved2 = await timeout.runStep(
|
|
27322
27460
|
() => this.requireDom().resolveTarget({
|
|
27323
27461
|
pageRef,
|
|
@@ -27380,11 +27518,11 @@ var OpensteerSessionRuntime = class {
|
|
|
27380
27518
|
};
|
|
27381
27519
|
}
|
|
27382
27520
|
async queryLiveNetwork(input, timeout, options = {}) {
|
|
27383
|
-
const requestIds = resolveLiveQueryRequestIds(input, this.
|
|
27521
|
+
const requestIds = resolveLiveQueryRequestIds(input, this.networkHistory);
|
|
27384
27522
|
if (requestIds !== void 0 && requestIds.length === 0) {
|
|
27385
27523
|
return [];
|
|
27386
27524
|
}
|
|
27387
|
-
const pageRef = resolveLiveQueryPageRef(input, this.pageRef, requestIds, this.
|
|
27525
|
+
const pageRef = resolveLiveQueryPageRef(input, this.pageRef, requestIds, this.networkHistory);
|
|
27388
27526
|
const includeCurrentPageOnly = pageRef === void 0 && input.recordId === void 0;
|
|
27389
27527
|
const metadataRecords = await timeout.runStep(
|
|
27390
27528
|
() => this.readLiveNetworkRecords(
|
|
@@ -27411,7 +27549,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27411
27549
|
...input.status === void 0 ? {} : { status: input.status },
|
|
27412
27550
|
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType }
|
|
27413
27551
|
});
|
|
27414
|
-
const sorted = sortLiveNetworkRecords(filtered, this.
|
|
27552
|
+
const sorted = sortLiveNetworkRecords(filtered, this.networkHistory);
|
|
27415
27553
|
const limit = options.ignoreLimit ? sorted.length : Math.max(1, Math.min(input.limit ?? 50, 200));
|
|
27416
27554
|
const limited = sorted.slice(0, limit);
|
|
27417
27555
|
if (!(input.includeBodies ?? false) || limited.length === 0) {
|
|
@@ -27627,21 +27765,40 @@ var OpensteerSessionRuntime = class {
|
|
|
27627
27765
|
if (delta.length === 0) {
|
|
27628
27766
|
return;
|
|
27629
27767
|
}
|
|
27630
|
-
this.
|
|
27631
|
-
if (networkTag
|
|
27632
|
-
|
|
27768
|
+
this.networkHistory.assignActionId(delta, `action:${crypto.randomUUID()}`);
|
|
27769
|
+
if (networkTag !== void 0) {
|
|
27770
|
+
this.networkHistory.addTag(delta, networkTag);
|
|
27633
27771
|
}
|
|
27634
|
-
this.
|
|
27635
|
-
this.scheduleBackgroundNetworkSaveByRequestIds(
|
|
27772
|
+
await this.persistLiveRequestIds(
|
|
27636
27773
|
delta.map((record) => record.record.requestId),
|
|
27637
|
-
|
|
27774
|
+
timeout,
|
|
27775
|
+
{
|
|
27776
|
+
includeCurrentPageOnly: true
|
|
27777
|
+
}
|
|
27638
27778
|
);
|
|
27639
27779
|
}
|
|
27640
27780
|
async resolveNetworkRecordByRecordId(recordId, timeout, options) {
|
|
27641
27781
|
const root = await this.ensureRoot();
|
|
27782
|
+
await this.syncPersistedNetworkSelection(
|
|
27783
|
+
timeout,
|
|
27784
|
+
{
|
|
27785
|
+
recordId,
|
|
27786
|
+
includeBodies: options.includeBodies
|
|
27787
|
+
},
|
|
27788
|
+
{
|
|
27789
|
+
includeBodies: options.includeBodies
|
|
27790
|
+
}
|
|
27791
|
+
);
|
|
27792
|
+
const saved = await timeout.runStep(
|
|
27793
|
+
() => root.registry.savedNetwork.getByRecordId(recordId, {
|
|
27794
|
+
includeBodies: options.includeBodies
|
|
27795
|
+
})
|
|
27796
|
+
);
|
|
27797
|
+
if (saved) {
|
|
27798
|
+
return saved;
|
|
27799
|
+
}
|
|
27642
27800
|
const live = await this.queryLiveNetwork(
|
|
27643
27801
|
{
|
|
27644
|
-
source: "live",
|
|
27645
27802
|
recordId,
|
|
27646
27803
|
includeBodies: options.includeBodies,
|
|
27647
27804
|
limit: 1
|
|
@@ -27652,24 +27809,15 @@ var OpensteerSessionRuntime = class {
|
|
|
27652
27809
|
...options.redactSecretHeaders === void 0 ? {} : { redactSecretHeaders: options.redactSecretHeaders }
|
|
27653
27810
|
}
|
|
27654
27811
|
);
|
|
27655
|
-
if (live
|
|
27812
|
+
if (live[0] !== void 0) {
|
|
27656
27813
|
return live[0];
|
|
27657
27814
|
}
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
}
|
|
27663
|
-
);
|
|
27664
|
-
if (!saved) {
|
|
27665
|
-
throw new OpensteerProtocolError("not-found", `network record ${recordId} was not found`, {
|
|
27666
|
-
details: {
|
|
27667
|
-
recordId,
|
|
27668
|
-
kind: "network-record"
|
|
27669
|
-
}
|
|
27670
|
-
});
|
|
27671
|
-
}
|
|
27672
|
-
return saved;
|
|
27815
|
+
throw new OpensteerProtocolError("not-found", `network record ${recordId} was not found`, {
|
|
27816
|
+
details: {
|
|
27817
|
+
recordId,
|
|
27818
|
+
kind: "network-record"
|
|
27819
|
+
}
|
|
27820
|
+
});
|
|
27673
27821
|
}
|
|
27674
27822
|
resolveCurrentStateSource() {
|
|
27675
27823
|
const ownership = this.sessionInfoBase.provider?.ownership;
|
|
@@ -27909,7 +28057,6 @@ var OpensteerSessionRuntime = class {
|
|
|
27909
28057
|
timeout.throwIfAborted();
|
|
27910
28058
|
const records = await this.queryLiveNetwork(
|
|
27911
28059
|
{
|
|
27912
|
-
source: "live",
|
|
27913
28060
|
pageRef,
|
|
27914
28061
|
url,
|
|
27915
28062
|
method,
|
|
@@ -27940,7 +28087,6 @@ var OpensteerSessionRuntime = class {
|
|
|
27940
28087
|
timeout.throwIfAborted();
|
|
27941
28088
|
const records = await this.queryLiveNetwork(
|
|
27942
28089
|
{
|
|
27943
|
-
source: "live",
|
|
27944
28090
|
pageRef,
|
|
27945
28091
|
...filter.url === void 0 ? {} : { url: filter.url },
|
|
27946
28092
|
...filter.host === void 0 ? {} : { hostname: filter.host },
|
|
@@ -28006,12 +28152,12 @@ var OpensteerSessionRuntime = class {
|
|
|
28006
28152
|
};
|
|
28007
28153
|
}
|
|
28008
28154
|
}
|
|
28009
|
-
async
|
|
28155
|
+
async readBrowserNetworkRecords(input, signal) {
|
|
28010
28156
|
const sessionRef = this.sessionRef;
|
|
28011
28157
|
if (!sessionRef) {
|
|
28012
28158
|
throw new Error("Opensteer session is not initialized");
|
|
28013
28159
|
}
|
|
28014
|
-
|
|
28160
|
+
return this.requireEngine().getNetworkRecords({
|
|
28015
28161
|
sessionRef,
|
|
28016
28162
|
...input.includeCurrentPageOnly === false || input.pageRef !== void 0 ? input.pageRef === void 0 ? {} : { pageRef: input.pageRef } : this.pageRef === void 0 ? {} : { pageRef: this.pageRef },
|
|
28017
28163
|
...input.requestIds === void 0 ? {} : { requestIds: input.requestIds },
|
|
@@ -28024,10 +28170,102 @@ var OpensteerSessionRuntime = class {
|
|
|
28024
28170
|
includeBodies: input.includeBodies,
|
|
28025
28171
|
signal
|
|
28026
28172
|
});
|
|
28027
|
-
|
|
28173
|
+
}
|
|
28174
|
+
async readLiveNetworkRecords(input, signal) {
|
|
28175
|
+
const records = await this.readBrowserNetworkRecords(input, signal);
|
|
28176
|
+
return this.networkHistory.materialize(records, {
|
|
28028
28177
|
redactSecretHeaders: input.redactSecretHeaders ?? true
|
|
28029
28178
|
});
|
|
28030
28179
|
}
|
|
28180
|
+
async persistLiveRequestIds(requestIds, timeout, options) {
|
|
28181
|
+
if (requestIds.length === 0) {
|
|
28182
|
+
return [];
|
|
28183
|
+
}
|
|
28184
|
+
const root = await this.ensureRoot();
|
|
28185
|
+
const browserRecords = await timeout.runStep(
|
|
28186
|
+
() => this.readBrowserNetworkRecords(
|
|
28187
|
+
{
|
|
28188
|
+
includeBodies: true,
|
|
28189
|
+
includeCurrentPageOnly: options.includeCurrentPageOnly,
|
|
28190
|
+
...options.pageRef === void 0 ? {} : { pageRef: options.pageRef },
|
|
28191
|
+
requestIds
|
|
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
|
+
})
|
|
28201
|
+
);
|
|
28202
|
+
}
|
|
28203
|
+
async syncPersistedNetworkSelection(timeout, input, options) {
|
|
28204
|
+
if (this.sessionRef === void 0) {
|
|
28205
|
+
return [];
|
|
28206
|
+
}
|
|
28207
|
+
const requestIds = resolveLiveQueryRequestIds(input, this.networkHistory);
|
|
28208
|
+
if (requestIds !== void 0 && requestIds.length === 0) {
|
|
28209
|
+
return [];
|
|
28210
|
+
}
|
|
28211
|
+
const pageRef = resolveLiveQueryPageRef(input, this.pageRef, requestIds, this.networkHistory);
|
|
28212
|
+
const includeCurrentPageOnly = pageRef === void 0 && input.recordId === void 0;
|
|
28213
|
+
const browserRecords = await timeout.runStep(
|
|
28214
|
+
() => this.readBrowserNetworkRecords(
|
|
28215
|
+
{
|
|
28216
|
+
...pageRef === void 0 ? {} : { pageRef },
|
|
28217
|
+
...requestIds === void 0 ? {} : { requestIds },
|
|
28218
|
+
...input.url === void 0 ? {} : { url: input.url },
|
|
28219
|
+
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
28220
|
+
...input.path === void 0 ? {} : { path: input.path },
|
|
28221
|
+
...input.method === void 0 ? {} : { method: input.method },
|
|
28222
|
+
...input.status === void 0 ? {} : { status: input.status },
|
|
28223
|
+
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType },
|
|
28224
|
+
includeBodies: options.includeBodies,
|
|
28225
|
+
includeCurrentPageOnly
|
|
28226
|
+
},
|
|
28227
|
+
timeout.signal
|
|
28228
|
+
)
|
|
28229
|
+
);
|
|
28230
|
+
const root = await this.ensureRoot();
|
|
28231
|
+
return timeout.runStep(
|
|
28232
|
+
() => this.networkHistory.persist(browserRecords, root.registry.savedNetwork, {
|
|
28233
|
+
bodyWriteMode: options.includeBodies ? "authoritative" : "metadata-only",
|
|
28234
|
+
redactSecretHeaders: false
|
|
28235
|
+
})
|
|
28236
|
+
);
|
|
28237
|
+
}
|
|
28238
|
+
toSavedNetworkQueryInput(input) {
|
|
28239
|
+
return {
|
|
28240
|
+
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
28241
|
+
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
28242
|
+
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
28243
|
+
...input.actionId === void 0 ? {} : { actionId: input.actionId },
|
|
28244
|
+
...input.tag === void 0 ? {} : { tag: input.tag },
|
|
28245
|
+
...input.url === void 0 ? {} : { url: input.url },
|
|
28246
|
+
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
28247
|
+
...input.path === void 0 ? {} : { path: input.path },
|
|
28248
|
+
...input.method === void 0 ? {} : { method: input.method },
|
|
28249
|
+
...input.status === void 0 ? {} : { status: input.status },
|
|
28250
|
+
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType },
|
|
28251
|
+
...input.includeBodies === void 0 ? {} : { includeBodies: input.includeBodies },
|
|
28252
|
+
...input.limit === void 0 ? {} : { limit: input.limit }
|
|
28253
|
+
};
|
|
28254
|
+
}
|
|
28255
|
+
toQueryInputFromTagInput(input) {
|
|
28256
|
+
return {
|
|
28257
|
+
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef },
|
|
28258
|
+
...input.recordId === void 0 ? {} : { recordId: input.recordId },
|
|
28259
|
+
...input.requestId === void 0 ? {} : { requestId: input.requestId },
|
|
28260
|
+
...input.actionId === void 0 ? {} : { actionId: input.actionId },
|
|
28261
|
+
...input.url === void 0 ? {} : { url: input.url },
|
|
28262
|
+
...input.hostname === void 0 ? {} : { hostname: input.hostname },
|
|
28263
|
+
...input.path === void 0 ? {} : { path: input.path },
|
|
28264
|
+
...input.method === void 0 ? {} : { method: input.method },
|
|
28265
|
+
...input.status === void 0 ? {} : { status: input.status },
|
|
28266
|
+
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType }
|
|
28267
|
+
};
|
|
28268
|
+
}
|
|
28031
28269
|
async readLiveRequestIds(timeout, options) {
|
|
28032
28270
|
const records = await timeout.runStep(
|
|
28033
28271
|
() => this.readLiveNetworkRecords(
|
|
@@ -28051,7 +28289,17 @@ var OpensteerSessionRuntime = class {
|
|
|
28051
28289
|
)
|
|
28052
28290
|
);
|
|
28053
28291
|
const delta = records.filter((record) => !baselineRequestIds.has(record.record.requestId));
|
|
28054
|
-
|
|
28292
|
+
if (delta.length === 0) {
|
|
28293
|
+
return void 0;
|
|
28294
|
+
}
|
|
28295
|
+
await this.persistLiveRequestIds(
|
|
28296
|
+
delta.map((record) => record.record.requestId),
|
|
28297
|
+
timeout,
|
|
28298
|
+
{
|
|
28299
|
+
includeCurrentPageOnly: options.includeCurrentPageOnly
|
|
28300
|
+
}
|
|
28301
|
+
);
|
|
28302
|
+
return sortLiveNetworkRecords(delta, this.networkHistory)[0]?.recordId;
|
|
28055
28303
|
}
|
|
28056
28304
|
async executeTransportRequestWithJournal(request, timeout, sessionRef) {
|
|
28057
28305
|
const baselineRequestIds = await this.readLiveRequestIds(timeout, {
|
|
@@ -28335,7 +28583,6 @@ var OpensteerSessionRuntime = class {
|
|
|
28335
28583
|
const syntheticSessionRef = binding?.sessionRef ?? createSessionRef(`${transportLabel}-${this.workspace}`);
|
|
28336
28584
|
const record = {
|
|
28337
28585
|
recordId,
|
|
28338
|
-
source: "saved",
|
|
28339
28586
|
savedAt: now,
|
|
28340
28587
|
record: {
|
|
28341
28588
|
kind: "http",
|
|
@@ -28357,7 +28604,10 @@ var OpensteerSessionRuntime = class {
|
|
|
28357
28604
|
...response.body === void 0 ? {} : { responseBody: toProtocolBodyPayload(response.body) }
|
|
28358
28605
|
}
|
|
28359
28606
|
};
|
|
28360
|
-
await root.registry.savedNetwork.save([record],
|
|
28607
|
+
await root.registry.savedNetwork.save([record], {
|
|
28608
|
+
bodyWriteMode: "authoritative",
|
|
28609
|
+
...tag === void 0 ? {} : { tag }
|
|
28610
|
+
});
|
|
28361
28611
|
return recordId;
|
|
28362
28612
|
}
|
|
28363
28613
|
async executeResolvedRequestPlan(plan, input, timeout, binding) {
|
|
@@ -28730,7 +28980,6 @@ var OpensteerSessionRuntime = class {
|
|
|
28730
28980
|
const record = await pollUntilResult(timeout, async () => {
|
|
28731
28981
|
const matches = await this.queryLiveNetwork(
|
|
28732
28982
|
{
|
|
28733
|
-
source: "live",
|
|
28734
28983
|
...step.url === void 0 ? {} : { url: interpolateTemplate(step.url, variables) },
|
|
28735
28984
|
...step.hostname === void 0 ? {} : { hostname: interpolateTemplate(step.hostname, variables) },
|
|
28736
28985
|
...step.path === void 0 ? {} : { path: interpolateTemplate(step.path, variables) },
|
|
@@ -29188,37 +29437,7 @@ var OpensteerSessionRuntime = class {
|
|
|
29188
29437
|
const pageUrl = step.pageUrl === void 0 ? void 0 : interpolateTemplate(step.pageUrl, variables);
|
|
29189
29438
|
return snapshot.sessionStorage?.filter((entry) => entry.origin === origin).find((entry) => pageUrl === void 0 || entry.origin === new URL(pageUrl).origin)?.entries.find((entry) => entry.key === key)?.value;
|
|
29190
29439
|
}
|
|
29191
|
-
|
|
29192
|
-
const task = (async () => {
|
|
29193
|
-
const root = await this.ensureRoot();
|
|
29194
|
-
const requestIdSet = new Set(requestIds);
|
|
29195
|
-
const records = await this.readLiveNetworkRecords(
|
|
29196
|
-
{
|
|
29197
|
-
includeBodies: true,
|
|
29198
|
-
includeCurrentPageOnly: false,
|
|
29199
|
-
...this.pageRef === void 0 ? {} : { pageRef: this.pageRef },
|
|
29200
|
-
requestIds,
|
|
29201
|
-
redactSecretHeaders: false
|
|
29202
|
-
},
|
|
29203
|
-
new AbortController().signal
|
|
29204
|
-
);
|
|
29205
|
-
const filtered = records.filter((record) => requestIdSet.has(record.record.requestId));
|
|
29206
|
-
if (filtered.length === 0) {
|
|
29207
|
-
return;
|
|
29208
|
-
}
|
|
29209
|
-
await root.registry.savedNetwork.save(filtered, tag);
|
|
29210
|
-
})();
|
|
29211
|
-
this.backgroundNetworkPersistence.add(task);
|
|
29212
|
-
task.finally(() => {
|
|
29213
|
-
this.backgroundNetworkPersistence.delete(task);
|
|
29214
|
-
});
|
|
29215
|
-
void task.catch(() => void 0);
|
|
29216
|
-
}
|
|
29217
|
-
async flushBackgroundNetworkPersistence() {
|
|
29218
|
-
if (this.backgroundNetworkPersistence.size === 0) {
|
|
29219
|
-
return;
|
|
29220
|
-
}
|
|
29221
|
-
await Promise.all([...this.backgroundNetworkPersistence]);
|
|
29440
|
+
async flushPersistedNetworkHistory() {
|
|
29222
29441
|
}
|
|
29223
29442
|
toDomTargetRef(target) {
|
|
29224
29443
|
if (target.kind === "description") {
|
|
@@ -29253,7 +29472,9 @@ var OpensteerSessionRuntime = class {
|
|
|
29253
29472
|
...workspace.registry,
|
|
29254
29473
|
...overrides.requestPlans === void 0 ? {} : { requestPlans: overrides.requestPlans },
|
|
29255
29474
|
...overrides.authRecipes === void 0 ? {} : { authRecipes: overrides.authRecipes },
|
|
29256
|
-
...overrides.recipes === void 0 ? {} : { recipes: overrides.recipes }
|
|
29475
|
+
...overrides.recipes === void 0 ? {} : { recipes: overrides.recipes },
|
|
29476
|
+
...overrides.reverseCases === void 0 ? {} : { reverseCases: overrides.reverseCases },
|
|
29477
|
+
...overrides.reversePackages === void 0 ? {} : { reversePackages: overrides.reversePackages }
|
|
29257
29478
|
}
|
|
29258
29479
|
};
|
|
29259
29480
|
} else {
|
|
@@ -29510,8 +29731,7 @@ var OpensteerSessionRuntime = class {
|
|
|
29510
29731
|
}
|
|
29511
29732
|
async resetRuntimeState(options) {
|
|
29512
29733
|
const engine = this.engine;
|
|
29513
|
-
this.
|
|
29514
|
-
this.backgroundNetworkPersistence.clear();
|
|
29734
|
+
this.networkHistory.clear();
|
|
29515
29735
|
this.sessionRef = void 0;
|
|
29516
29736
|
this.pageRef = void 0;
|
|
29517
29737
|
this.runId = void 0;
|
|
@@ -29587,10 +29807,10 @@ function buildEngineNetworkRecordFilters(input) {
|
|
|
29587
29807
|
...input.resourceType === void 0 ? {} : { resourceType: input.resourceType }
|
|
29588
29808
|
};
|
|
29589
29809
|
}
|
|
29590
|
-
function resolveLiveQueryRequestIds(input,
|
|
29810
|
+
function resolveLiveQueryRequestIds(input, history) {
|
|
29591
29811
|
const requestIdCandidates = [];
|
|
29592
29812
|
if (input.recordId !== void 0) {
|
|
29593
|
-
const requestId =
|
|
29813
|
+
const requestId = history.getRequestId(input.recordId);
|
|
29594
29814
|
if (requestId === void 0) {
|
|
29595
29815
|
return [];
|
|
29596
29816
|
}
|
|
@@ -29600,24 +29820,24 @@ function resolveLiveQueryRequestIds(input, journal) {
|
|
|
29600
29820
|
requestIdCandidates.push(/* @__PURE__ */ new Set([input.requestId]));
|
|
29601
29821
|
}
|
|
29602
29822
|
if (input.actionId !== void 0) {
|
|
29603
|
-
requestIdCandidates.push(
|
|
29823
|
+
requestIdCandidates.push(history.getRequestIdsForActionId(input.actionId));
|
|
29604
29824
|
}
|
|
29605
29825
|
if (input.tag !== void 0) {
|
|
29606
|
-
requestIdCandidates.push(
|
|
29826
|
+
requestIdCandidates.push(history.getRequestIdsForTag(input.tag));
|
|
29607
29827
|
}
|
|
29608
29828
|
if (requestIdCandidates.length === 0) {
|
|
29609
29829
|
return void 0;
|
|
29610
29830
|
}
|
|
29611
29831
|
return intersectRequestIdSets(requestIdCandidates);
|
|
29612
29832
|
}
|
|
29613
|
-
function resolveLiveQueryPageRef(input, currentPageRef, requestIds,
|
|
29833
|
+
function resolveLiveQueryPageRef(input, currentPageRef, requestIds, history) {
|
|
29614
29834
|
const requestedPageRef = selectLiveQueryPageRef(input, currentPageRef);
|
|
29615
29835
|
if (requestedPageRef !== void 0 || requestIds === void 0) {
|
|
29616
29836
|
return requestedPageRef;
|
|
29617
29837
|
}
|
|
29618
29838
|
const pageRefs = /* @__PURE__ */ new Set();
|
|
29619
29839
|
for (const requestId of requestIds) {
|
|
29620
|
-
const pageRef =
|
|
29840
|
+
const pageRef = history.getPageRefForRequestId(requestId);
|
|
29621
29841
|
if (pageRef === void 0) {
|
|
29622
29842
|
continue;
|
|
29623
29843
|
}
|
|
@@ -29659,10 +29879,10 @@ function filterNetworkQueryRecords(records, input) {
|
|
|
29659
29879
|
return true;
|
|
29660
29880
|
});
|
|
29661
29881
|
}
|
|
29662
|
-
function sortLiveNetworkRecords(records,
|
|
29882
|
+
function sortLiveNetworkRecords(records, history) {
|
|
29663
29883
|
return [...records].sort((left, right) => {
|
|
29664
|
-
const leftObservedAt =
|
|
29665
|
-
const rightObservedAt =
|
|
29884
|
+
const leftObservedAt = history.getObservedAt(left.recordId) ?? 0;
|
|
29885
|
+
const rightObservedAt = history.getObservedAt(right.recordId) ?? 0;
|
|
29666
29886
|
if (leftObservedAt !== rightObservedAt) {
|
|
29667
29887
|
return rightObservedAt - leftObservedAt;
|
|
29668
29888
|
}
|
|
@@ -29869,7 +30089,7 @@ function buildMinimizedRequestPlan(input) {
|
|
|
29869
30089
|
provenance: {
|
|
29870
30090
|
source: "network-minimize",
|
|
29871
30091
|
sourceId: input.record.recordId,
|
|
29872
|
-
...input.record.
|
|
30092
|
+
...input.record.savedAt === void 0 ? {} : { capturedAt: input.record.savedAt }
|
|
29873
30093
|
},
|
|
29874
30094
|
payload: normalizeRequestPlanPayload({
|
|
29875
30095
|
transport: {
|
|
@@ -30088,12 +30308,12 @@ function originFromUrl(url) {
|
|
|
30088
30308
|
return void 0;
|
|
30089
30309
|
}
|
|
30090
30310
|
}
|
|
30091
|
-
function filterReverseObservationWindow(records,
|
|
30311
|
+
function filterReverseObservationWindow(records, history, captureWindowMs) {
|
|
30092
30312
|
if (captureWindowMs === void 0) {
|
|
30093
30313
|
return records;
|
|
30094
30314
|
}
|
|
30095
30315
|
const observedAfter = Date.now() - captureWindowMs;
|
|
30096
|
-
return records.filter((record) => (
|
|
30316
|
+
return records.filter((record) => (history.getObservedAt(record.recordId) ?? 0) >= observedAfter);
|
|
30097
30317
|
}
|
|
30098
30318
|
function isReverseRelevantNetworkRecord(record) {
|
|
30099
30319
|
return record.record.resourceType === "document" || record.record.resourceType === "fetch" || record.record.resourceType === "xhr" || record.record.resourceType === "websocket" || record.record.resourceType === "event-stream";
|
|
@@ -32493,11 +32713,13 @@ function asRecord(value) {
|
|
|
32493
32713
|
var REGISTRY_SYNC_MAX_PAYLOAD_BYTES = 15e5;
|
|
32494
32714
|
var REGISTRY_SYNC_MAX_ENTRIES_PER_BATCH = 100;
|
|
32495
32715
|
async function syncLocalRegistryToCloud(client, workspace, store) {
|
|
32496
|
-
const [descriptors, requestPlans, recipes, authRecipes] = await Promise.all([
|
|
32716
|
+
const [descriptors, requestPlans, recipes, authRecipes, reverseCases, reversePackages] = await Promise.all([
|
|
32497
32717
|
store.registry.descriptors.list(),
|
|
32498
32718
|
store.registry.requestPlans.list(),
|
|
32499
32719
|
store.registry.recipes.list(),
|
|
32500
|
-
store.registry.authRecipes.list()
|
|
32720
|
+
store.registry.authRecipes.list(),
|
|
32721
|
+
store.registry.reverseCases.list(),
|
|
32722
|
+
store.registry.reversePackages.list()
|
|
32501
32723
|
]);
|
|
32502
32724
|
const descriptorEntries = descriptors.map((record) => toDescriptorImportEntry(workspace, record));
|
|
32503
32725
|
await Promise.all([
|
|
@@ -32513,6 +32735,14 @@ async function syncLocalRegistryToCloud(client, workspace, store) {
|
|
|
32513
32735
|
importInBatches(
|
|
32514
32736
|
authRecipes.map((record) => toRegistryImportEntry(workspace, record)),
|
|
32515
32737
|
(entries) => client.importAuthRecipes(entries)
|
|
32738
|
+
),
|
|
32739
|
+
importInBatches(
|
|
32740
|
+
reverseCases.map((record) => toRegistryImportEntry(workspace, record)),
|
|
32741
|
+
(entries) => client.importReverseCases(entries)
|
|
32742
|
+
),
|
|
32743
|
+
importInBatches(
|
|
32744
|
+
reversePackages.map((record) => toRegistryImportEntry(workspace, record)),
|
|
32745
|
+
(entries) => client.importReversePackages(entries)
|
|
32516
32746
|
)
|
|
32517
32747
|
]);
|
|
32518
32748
|
}
|
|
@@ -32722,9 +32952,9 @@ var CloudSessionProxy = class {
|
|
|
32722
32952
|
await this.ensureSession();
|
|
32723
32953
|
return this.requireClient().invoke("network.query", input);
|
|
32724
32954
|
}
|
|
32725
|
-
async
|
|
32955
|
+
async tagNetwork(input) {
|
|
32726
32956
|
await this.ensureSession();
|
|
32727
|
-
return this.requireClient().invoke("network.
|
|
32957
|
+
return this.requireClient().invoke("network.tag", input);
|
|
32728
32958
|
}
|
|
32729
32959
|
async minimizeNetwork(input) {
|
|
32730
32960
|
await this.ensureSession();
|
|
@@ -33076,6 +33306,7 @@ var OpensteerRuntime = class extends OpensteerSessionRuntime {
|
|
|
33076
33306
|
...options.policy === void 0 ? {} : { policy: options.policy },
|
|
33077
33307
|
...options.descriptorStore === void 0 ? {} : { descriptorStore: options.descriptorStore },
|
|
33078
33308
|
...options.extractionDescriptorStore === void 0 ? {} : { extractionDescriptorStore: options.extractionDescriptorStore },
|
|
33309
|
+
...options.registryOverrides === void 0 ? {} : { registryOverrides: options.registryOverrides },
|
|
33079
33310
|
cleanupRootOnClose
|
|
33080
33311
|
})
|
|
33081
33312
|
);
|
|
@@ -33100,6 +33331,7 @@ function buildSharedRuntimeOptions(input) {
|
|
|
33100
33331
|
...input.policy === void 0 ? {} : { policy: input.policy },
|
|
33101
33332
|
...input.descriptorStore === void 0 ? {} : { descriptorStore: input.descriptorStore },
|
|
33102
33333
|
...input.extractionDescriptorStore === void 0 ? {} : { extractionDescriptorStore: input.extractionDescriptorStore },
|
|
33334
|
+
...input.registryOverrides === void 0 ? {} : { registryOverrides: input.registryOverrides },
|
|
33103
33335
|
cleanupRootOnClose: input.cleanupRootOnClose,
|
|
33104
33336
|
sessionInfo: {
|
|
33105
33337
|
provider: {
|
|
@@ -33328,7 +33560,7 @@ var OPERATION_ALIASES = /* @__PURE__ */ new Map([
|
|
|
33328
33560
|
["scroll", "dom.scroll"],
|
|
33329
33561
|
["extract", "dom.extract"],
|
|
33330
33562
|
["network query", "network.query"],
|
|
33331
|
-
["network
|
|
33563
|
+
["network tag", "network.tag"],
|
|
33332
33564
|
["network clear", "network.clear"],
|
|
33333
33565
|
["network minimize", "network.minimize"],
|
|
33334
33566
|
["network diff", "network.diff"],
|