@opensteer/runtime-core 0.1.7 → 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 +178 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +177 -58
- package/dist/index.js.map +1 -1
- package/package.json +18 -3
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import vm from 'vm';
|
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
15
|
var package_default = {
|
|
16
|
-
version: "0.
|
|
16
|
+
version: "0.2.0"};
|
|
17
17
|
|
|
18
18
|
// src/version.ts
|
|
19
19
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
|
|
@@ -2358,6 +2358,16 @@ var opensteerNetworkQueryOutputSchema = objectSchema(
|
|
|
2358
2358
|
required: ["records"]
|
|
2359
2359
|
}
|
|
2360
2360
|
);
|
|
2361
|
+
var opensteerNetworkDetailInputSchema = objectSchema(
|
|
2362
|
+
{
|
|
2363
|
+
recordId: stringSchema({ minLength: 1 }),
|
|
2364
|
+
probe: { type: "boolean" }
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
title: "OpensteerNetworkDetailInput",
|
|
2368
|
+
required: ["recordId"]
|
|
2369
|
+
}
|
|
2370
|
+
);
|
|
2361
2371
|
var opensteerParsedCookieSchema = objectSchema(
|
|
2362
2372
|
{
|
|
2363
2373
|
name: stringSchema({ minLength: 1 }),
|
|
@@ -2463,7 +2473,7 @@ objectSchema(
|
|
|
2463
2473
|
}
|
|
2464
2474
|
);
|
|
2465
2475
|
var opensteerSessionFetchTransportSchema = enumSchema(
|
|
2466
|
-
["auto", "direct", "matched-tls", "page"],
|
|
2476
|
+
["auto", "direct", "matched-tls", "context", "page"],
|
|
2467
2477
|
{
|
|
2468
2478
|
title: "OpensteerSessionFetchTransport"
|
|
2469
2479
|
}
|
|
@@ -6234,15 +6244,6 @@ var opensteerPageSnapshotOutputSchema = objectSchema(
|
|
|
6234
6244
|
required: ["url", "title", "mode", "html", "counters"]
|
|
6235
6245
|
}
|
|
6236
6246
|
);
|
|
6237
|
-
var opensteerNetworkDetailInputSchema = objectSchema(
|
|
6238
|
-
{
|
|
6239
|
-
recordId: stringSchema({ minLength: 1 })
|
|
6240
|
-
},
|
|
6241
|
-
{
|
|
6242
|
-
title: "OpensteerNetworkDetailInput",
|
|
6243
|
-
required: ["recordId"]
|
|
6244
|
-
}
|
|
6245
|
-
);
|
|
6246
6247
|
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6247
6248
|
["left", "middle", "right"],
|
|
6248
6249
|
{
|
|
@@ -6812,6 +6813,7 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
6812
6813
|
case "direct":
|
|
6813
6814
|
return [];
|
|
6814
6815
|
case "matched-tls":
|
|
6816
|
+
case "context":
|
|
6815
6817
|
return ["inspect.cookies"];
|
|
6816
6818
|
case "page":
|
|
6817
6819
|
return ["pages.manage"];
|
|
@@ -7511,7 +7513,6 @@ var DEFAULT_TIMEOUTS = {
|
|
|
7511
7513
|
"dom.extract": 15e3,
|
|
7512
7514
|
"network.query": 15e3,
|
|
7513
7515
|
"network.detail": 15e3,
|
|
7514
|
-
"network.replay": 3e4,
|
|
7515
7516
|
"scripts.capture": 15e3,
|
|
7516
7517
|
"session.cookies": 1e4,
|
|
7517
7518
|
"session.storage": 1e4,
|
|
@@ -8333,13 +8334,6 @@ var SqliteSavedNetworkStore = class {
|
|
|
8333
8334
|
}
|
|
8334
8335
|
async save(records, options) {
|
|
8335
8336
|
const database = await this.requireDatabase();
|
|
8336
|
-
const readExisting = database.prepare(`
|
|
8337
|
-
SELECT record_id
|
|
8338
|
-
FROM saved_network_records
|
|
8339
|
-
WHERE session_ref = @session_ref
|
|
8340
|
-
AND page_ref_key = @page_ref_key
|
|
8341
|
-
AND request_id = @request_id
|
|
8342
|
-
`);
|
|
8343
8337
|
const upsertRecord = database.prepare(buildSavedNetworkUpsertSql(options.bodyWriteMode));
|
|
8344
8338
|
const insertTag = database.prepare(`
|
|
8345
8339
|
INSERT OR IGNORE INTO saved_network_tags (record_id, tag)
|
|
@@ -8350,14 +8344,8 @@ var SqliteSavedNetworkStore = class {
|
|
|
8350
8344
|
for (const entry of records) {
|
|
8351
8345
|
const url = new URL(entry.record.url);
|
|
8352
8346
|
const pageRefKey = entry.record.pageRef ?? "";
|
|
8353
|
-
const existing = readExisting.get({
|
|
8354
|
-
session_ref: entry.record.sessionRef,
|
|
8355
|
-
page_ref_key: pageRefKey,
|
|
8356
|
-
request_id: entry.record.requestId
|
|
8357
|
-
}) ?? void 0;
|
|
8358
|
-
const recordId = existing?.record_id ?? entry.recordId;
|
|
8359
8347
|
upsertRecord.run({
|
|
8360
|
-
record_id: recordId,
|
|
8348
|
+
record_id: entry.recordId,
|
|
8361
8349
|
request_id: entry.record.requestId,
|
|
8362
8350
|
session_ref: entry.record.sessionRef,
|
|
8363
8351
|
page_ref: entry.record.pageRef ?? null,
|
|
@@ -8402,7 +8390,7 @@ var SqliteSavedNetworkStore = class {
|
|
|
8402
8390
|
}
|
|
8403
8391
|
for (const currentTag of tags) {
|
|
8404
8392
|
const result = insertTag.run({
|
|
8405
|
-
record_id: recordId,
|
|
8393
|
+
record_id: entry.recordId,
|
|
8406
8394
|
tag: currentTag
|
|
8407
8395
|
});
|
|
8408
8396
|
savedCount += result.changes ?? 0;
|
|
@@ -8505,6 +8493,49 @@ var SqliteSavedNetworkStore = class {
|
|
|
8505
8493
|
return cleared;
|
|
8506
8494
|
});
|
|
8507
8495
|
}
|
|
8496
|
+
async *iterateBatches(options = {}) {
|
|
8497
|
+
const database = await this.requireDatabase();
|
|
8498
|
+
const batchSize = Math.max(1, Math.min(options.batchSize ?? 500, 1e3));
|
|
8499
|
+
let cursor;
|
|
8500
|
+
while (true) {
|
|
8501
|
+
const rows = database.prepare(
|
|
8502
|
+
`
|
|
8503
|
+
SELECT
|
|
8504
|
+
r.*,
|
|
8505
|
+
GROUP_CONCAT(t.tag, '${TAG_DELIMITER}') AS tags
|
|
8506
|
+
FROM saved_network_records r
|
|
8507
|
+
LEFT JOIN saved_network_tags t
|
|
8508
|
+
ON t.record_id = r.record_id
|
|
8509
|
+
${cursor === void 0 ? "" : "WHERE r.saved_at > ? OR (r.saved_at = ? AND r.record_id > ?)"}
|
|
8510
|
+
GROUP BY r.record_id
|
|
8511
|
+
ORDER BY r.saved_at ASC, r.record_id ASC
|
|
8512
|
+
LIMIT ?
|
|
8513
|
+
`
|
|
8514
|
+
).all(
|
|
8515
|
+
...cursor === void 0 ? [] : [cursor.savedAt, cursor.savedAt, cursor.recordId],
|
|
8516
|
+
batchSize
|
|
8517
|
+
);
|
|
8518
|
+
if (rows.length === 0) {
|
|
8519
|
+
return;
|
|
8520
|
+
}
|
|
8521
|
+
yield rows.map((row) => inflateSavedNetworkRow(row, options.includeBodies ?? true));
|
|
8522
|
+
const lastRow = rows.at(-1);
|
|
8523
|
+
if (lastRow === void 0) {
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8526
|
+
cursor = {
|
|
8527
|
+
savedAt: lastRow.saved_at,
|
|
8528
|
+
recordId: lastRow.record_id
|
|
8529
|
+
};
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
close() {
|
|
8533
|
+
if (this.database !== void 0) {
|
|
8534
|
+
closeSqliteDatabase(this.database);
|
|
8535
|
+
this.database = void 0;
|
|
8536
|
+
this.databaseInitialization = void 0;
|
|
8537
|
+
}
|
|
8538
|
+
}
|
|
8508
8539
|
async requireDatabase() {
|
|
8509
8540
|
if (this.database) {
|
|
8510
8541
|
return this.database;
|
|
@@ -8589,15 +8620,6 @@ var SqliteSavedNetworkStore = class {
|
|
|
8589
8620
|
saved_at INTEGER NOT NULL
|
|
8590
8621
|
);
|
|
8591
8622
|
|
|
8592
|
-
CREATE UNIQUE INDEX IF NOT EXISTS saved_network_records_scope_request
|
|
8593
|
-
ON saved_network_records (session_ref, page_ref_key, request_id);
|
|
8594
|
-
|
|
8595
|
-
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
8596
|
-
ON saved_network_records (saved_at DESC);
|
|
8597
|
-
|
|
8598
|
-
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
8599
|
-
ON saved_network_records (capture);
|
|
8600
|
-
|
|
8601
8623
|
CREATE TABLE IF NOT EXISTS saved_network_tags (
|
|
8602
8624
|
record_id TEXT NOT NULL REFERENCES saved_network_records(record_id) ON DELETE CASCADE,
|
|
8603
8625
|
tag TEXT NOT NULL,
|
|
@@ -8607,6 +8629,19 @@ var SqliteSavedNetworkStore = class {
|
|
|
8607
8629
|
CREATE INDEX IF NOT EXISTS saved_network_tags_tag
|
|
8608
8630
|
ON saved_network_tags (tag);
|
|
8609
8631
|
`);
|
|
8632
|
+
database.exec(`DROP INDEX IF EXISTS saved_network_records_scope_request`);
|
|
8633
|
+
database.exec(`
|
|
8634
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_scope_request
|
|
8635
|
+
ON saved_network_records (session_ref, page_ref_key, request_id)
|
|
8636
|
+
`);
|
|
8637
|
+
database.exec(`
|
|
8638
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
|
|
8639
|
+
ON saved_network_records (saved_at DESC)
|
|
8640
|
+
`);
|
|
8641
|
+
database.exec(`
|
|
8642
|
+
CREATE INDEX IF NOT EXISTS saved_network_records_capture
|
|
8643
|
+
ON saved_network_records (capture)
|
|
8644
|
+
`);
|
|
8610
8645
|
this.ensureColumn(
|
|
8611
8646
|
database,
|
|
8612
8647
|
"saved_network_records",
|
|
@@ -8926,6 +8961,14 @@ function withSqliteTransaction(database, task) {
|
|
|
8926
8961
|
function createSavedNetworkStore(rootPath) {
|
|
8927
8962
|
return new SqliteSavedNetworkStore(rootPath);
|
|
8928
8963
|
}
|
|
8964
|
+
async function* iterateSavedNetworkRecordBatches(rootPath, options = {}) {
|
|
8965
|
+
const store = new SqliteSavedNetworkStore(rootPath);
|
|
8966
|
+
try {
|
|
8967
|
+
yield* store.iterateBatches(options);
|
|
8968
|
+
} finally {
|
|
8969
|
+
store.close();
|
|
8970
|
+
}
|
|
8971
|
+
}
|
|
8929
8972
|
function normalizeContext(context) {
|
|
8930
8973
|
return {
|
|
8931
8974
|
...context?.sessionRef === void 0 ? {} : { sessionRef: context.sessionRef },
|
|
@@ -17792,6 +17835,9 @@ var MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS = 5e3;
|
|
|
17792
17835
|
var PERSISTED_NETWORK_FLUSH_TIMEOUT_MS = 5e3;
|
|
17793
17836
|
var PENDING_OPERATION_EVENT_CAPTURE_LIMIT = 64;
|
|
17794
17837
|
var PENDING_OPERATION_EVENT_CAPTURE_SKEW_MS = 1e3;
|
|
17838
|
+
var REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS = 3e3;
|
|
17839
|
+
var REPLAY_PROBE_MAX_ATTEMPT_TIMEOUT_MS = 15e3;
|
|
17840
|
+
var REPLAY_PROBE_POST_SUCCESS_ATTEMPT_TIMEOUT_MS = 5e3;
|
|
17795
17841
|
var OpensteerSessionRuntime = class {
|
|
17796
17842
|
workspace;
|
|
17797
17843
|
rootPath;
|
|
@@ -18653,26 +18699,27 @@ var OpensteerSessionRuntime = class {
|
|
|
18653
18699
|
}
|
|
18654
18700
|
}
|
|
18655
18701
|
async queryNetwork(input = {}, options = {}) {
|
|
18656
|
-
|
|
18702
|
+
const normalizedInput = normalizeNetworkQueryInput(input);
|
|
18703
|
+
assertValidSemanticOperationInput("network.query", normalizedInput);
|
|
18657
18704
|
const root = await this.ensureRoot();
|
|
18658
18705
|
const startedAt = Date.now();
|
|
18659
18706
|
try {
|
|
18660
18707
|
const output = await this.runWithOperationTimeout(
|
|
18661
18708
|
"network.query",
|
|
18662
18709
|
async (timeout) => {
|
|
18663
|
-
await this.syncPersistedNetworkSelection(timeout,
|
|
18710
|
+
await this.syncPersistedNetworkSelection(timeout, normalizedInput, {
|
|
18664
18711
|
includeBodies: false
|
|
18665
18712
|
});
|
|
18666
18713
|
const rawRecords = await timeout.runStep(
|
|
18667
18714
|
() => root.registry.savedNetwork.query({
|
|
18668
|
-
...this.toSavedNetworkQueryInput(
|
|
18669
|
-
limit: Math.max(
|
|
18715
|
+
...this.toSavedNetworkQueryInput(normalizedInput),
|
|
18716
|
+
limit: Math.max(normalizedInput.limit ?? 50, 1e3)
|
|
18670
18717
|
})
|
|
18671
18718
|
);
|
|
18672
|
-
const filtered = filterNetworkSummaryRecords(rawRecords,
|
|
18719
|
+
const filtered = filterNetworkSummaryRecords(rawRecords, normalizedInput);
|
|
18673
18720
|
const sorted = sortPersistedNetworkRecordsChronologically(filtered);
|
|
18674
|
-
const sliced = sliceNetworkSummaryWindow(sorted,
|
|
18675
|
-
const limited = sliced.slice(0, Math.max(1, Math.min(
|
|
18721
|
+
const sliced = sliceNetworkSummaryWindow(sorted, normalizedInput);
|
|
18722
|
+
const limited = sliced.slice(0, Math.max(1, Math.min(normalizedInput.limit ?? 50, 200)));
|
|
18676
18723
|
const summaries = await this.buildNetworkSummaryRecords(limited, timeout);
|
|
18677
18724
|
return {
|
|
18678
18725
|
records: summaries
|
|
@@ -18686,9 +18733,9 @@ var OpensteerSessionRuntime = class {
|
|
|
18686
18733
|
completedAt: Date.now(),
|
|
18687
18734
|
outcome: "ok",
|
|
18688
18735
|
data: {
|
|
18689
|
-
limit:
|
|
18690
|
-
...
|
|
18691
|
-
...
|
|
18736
|
+
limit: normalizedInput.limit ?? 50,
|
|
18737
|
+
...normalizedInput.capture === void 0 ? {} : { capture: normalizedInput.capture },
|
|
18738
|
+
...normalizedInput.json === true ? { json: true } : {},
|
|
18692
18739
|
count: output.records.length
|
|
18693
18740
|
},
|
|
18694
18741
|
context: buildRuntimeTraceContext({
|
|
@@ -18713,12 +18760,13 @@ var OpensteerSessionRuntime = class {
|
|
|
18713
18760
|
}
|
|
18714
18761
|
}
|
|
18715
18762
|
async getNetworkDetail(input, options = {}) {
|
|
18763
|
+
const normalizedRecordId = normalizeNetworkRecordId(input.recordId);
|
|
18716
18764
|
const startedAt = Date.now();
|
|
18717
18765
|
try {
|
|
18718
18766
|
const output = await this.runWithOperationTimeout(
|
|
18719
18767
|
"network.detail",
|
|
18720
18768
|
async (timeout) => {
|
|
18721
|
-
const record = await this.resolveNetworkRecordByRecordId(
|
|
18769
|
+
const record = await this.resolveNetworkRecordByRecordId(normalizedRecordId, timeout, {
|
|
18722
18770
|
includeBodies: true,
|
|
18723
18771
|
redactSecretHeaders: false
|
|
18724
18772
|
});
|
|
@@ -18737,8 +18785,8 @@ var OpensteerSessionRuntime = class {
|
|
|
18737
18785
|
completedAt: Date.now(),
|
|
18738
18786
|
outcome: "ok",
|
|
18739
18787
|
data: {
|
|
18740
|
-
recordId:
|
|
18741
|
-
status: output.summary.status,
|
|
18788
|
+
recordId: normalizedRecordId,
|
|
18789
|
+
...output.summary.status === void 0 ? {} : { status: output.summary.status },
|
|
18742
18790
|
url: output.summary.url
|
|
18743
18791
|
},
|
|
18744
18792
|
context: buildRuntimeTraceContext({
|
|
@@ -20142,7 +20190,9 @@ var OpensteerSessionRuntime = class {
|
|
|
20142
20190
|
...graphql.persisted === void 0 ? {} : { persisted: graphql.persisted },
|
|
20143
20191
|
...graphqlVariables === void 0 ? {} : { variables: graphqlVariables }
|
|
20144
20192
|
};
|
|
20145
|
-
const requestBody = shouldShowRequestBody(record.record.method) && record.record.requestBody !== void 0 ? buildStructuredBodyPreview(record.record.requestBody, record.record.requestHeaders
|
|
20193
|
+
const requestBody = shouldShowRequestBody(record.record.method) && record.record.requestBody !== void 0 ? buildStructuredBodyPreview(record.record.requestBody, record.record.requestHeaders, {
|
|
20194
|
+
truncateData: false
|
|
20195
|
+
}) : void 0;
|
|
20146
20196
|
const responseBody = record.record.responseBody === void 0 ? void 0 : buildStructuredBodyPreview(record.record.responseBody, record.record.responseHeaders);
|
|
20147
20197
|
const notes = detectNetworkRecordNotes(record);
|
|
20148
20198
|
return {
|
|
@@ -20172,8 +20222,18 @@ var OpensteerSessionRuntime = class {
|
|
|
20172
20222
|
let recommended;
|
|
20173
20223
|
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20174
20224
|
const attemptStartedAt = Date.now();
|
|
20225
|
+
const attemptTimeoutMs = resolveReplayProbeAttemptTimeoutMs({
|
|
20226
|
+
remainingMs: timeout.remainingMs(),
|
|
20227
|
+
transportsRemaining: REPLAY_TRANSPORT_LADDER.length - attempts.length,
|
|
20228
|
+
recommendedFound: recommended !== void 0
|
|
20229
|
+
});
|
|
20175
20230
|
try {
|
|
20176
|
-
const output = await this.
|
|
20231
|
+
const output = await this.executeReplayTransportAttemptWithinBudget(
|
|
20232
|
+
transport,
|
|
20233
|
+
request,
|
|
20234
|
+
timeout,
|
|
20235
|
+
attemptTimeoutMs
|
|
20236
|
+
);
|
|
20177
20237
|
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20178
20238
|
attempts.push({
|
|
20179
20239
|
transport,
|
|
@@ -20189,7 +20249,7 @@ var OpensteerSessionRuntime = class {
|
|
|
20189
20249
|
transport,
|
|
20190
20250
|
ok: false,
|
|
20191
20251
|
durationMs: Date.now() - attemptStartedAt,
|
|
20192
|
-
error:
|
|
20252
|
+
error: normalizeProbeTransportAttemptError(transport, error, attemptTimeoutMs)
|
|
20193
20253
|
});
|
|
20194
20254
|
}
|
|
20195
20255
|
}
|
|
@@ -20393,6 +20453,23 @@ var OpensteerSessionRuntime = class {
|
|
|
20393
20453
|
}
|
|
20394
20454
|
}
|
|
20395
20455
|
}
|
|
20456
|
+
async executeReplayTransportAttemptWithinBudget(transport, request, timeout, attemptTimeoutMs) {
|
|
20457
|
+
if (attemptTimeoutMs === void 0) {
|
|
20458
|
+
return this.executeReplayTransportAttempt(transport, request, timeout);
|
|
20459
|
+
}
|
|
20460
|
+
return runWithPolicyTimeout(
|
|
20461
|
+
{
|
|
20462
|
+
resolveTimeoutMs() {
|
|
20463
|
+
return attemptTimeoutMs;
|
|
20464
|
+
}
|
|
20465
|
+
},
|
|
20466
|
+
{
|
|
20467
|
+
operation: timeout.operation,
|
|
20468
|
+
signal: timeout.signal
|
|
20469
|
+
},
|
|
20470
|
+
(attemptTimeout) => this.executeReplayTransportAttempt(transport, request, attemptTimeout)
|
|
20471
|
+
);
|
|
20472
|
+
}
|
|
20396
20473
|
async executeFetchTransportAttempt(transport, request, timeout, input) {
|
|
20397
20474
|
let prepared = finalizeMaterializedTransportRequest(request, transport);
|
|
20398
20475
|
if (input.cookies !== false && transport === "direct-http" && this.currentBinding() !== void 0) {
|
|
@@ -21307,10 +21384,15 @@ var OpensteerSessionRuntime = class {
|
|
|
21307
21384
|
return this.observationSessionId ?? this.sessionRef;
|
|
21308
21385
|
}
|
|
21309
21386
|
runWithOperationTimeout(operation, callback, options = {}) {
|
|
21387
|
+
const timeoutPolicy = options.timeoutMs === void 0 ? this.policy.timeout : {
|
|
21388
|
+
resolveTimeoutMs() {
|
|
21389
|
+
return options.timeoutMs;
|
|
21390
|
+
}
|
|
21391
|
+
};
|
|
21310
21392
|
const existingCollector = this.operationEventStorage.getStore();
|
|
21311
21393
|
if (existingCollector !== void 0) {
|
|
21312
21394
|
return runWithPolicyTimeout(
|
|
21313
|
-
|
|
21395
|
+
timeoutPolicy,
|
|
21314
21396
|
{
|
|
21315
21397
|
operation,
|
|
21316
21398
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
@@ -21323,7 +21405,7 @@ var OpensteerSessionRuntime = class {
|
|
|
21323
21405
|
return this.operationEventStorage.run(collector, async () => {
|
|
21324
21406
|
try {
|
|
21325
21407
|
return await runWithPolicyTimeout(
|
|
21326
|
-
|
|
21408
|
+
timeoutPolicy,
|
|
21327
21409
|
{
|
|
21328
21410
|
operation,
|
|
21329
21411
|
...options.signal === void 0 ? {} : { signal: options.signal }
|
|
@@ -21493,6 +21575,21 @@ function buildEngineNetworkRecordFilters(input) {
|
|
|
21493
21575
|
function normalizeNetworkStatusFilter(status) {
|
|
21494
21576
|
return String(status);
|
|
21495
21577
|
}
|
|
21578
|
+
function normalizeNetworkQueryInput(input) {
|
|
21579
|
+
return {
|
|
21580
|
+
...input,
|
|
21581
|
+
...input.recordId === void 0 ? {} : { recordId: normalizeNetworkRecordId(input.recordId) },
|
|
21582
|
+
...input.before === void 0 ? {} : { before: normalizeNetworkRecordId(input.before) },
|
|
21583
|
+
...input.after === void 0 ? {} : { after: normalizeNetworkRecordId(input.after) }
|
|
21584
|
+
};
|
|
21585
|
+
}
|
|
21586
|
+
function normalizeNetworkRecordId(recordId) {
|
|
21587
|
+
const trimmed = recordId.trim();
|
|
21588
|
+
if (trimmed.length === 0 || trimmed.startsWith("record:")) {
|
|
21589
|
+
return trimmed;
|
|
21590
|
+
}
|
|
21591
|
+
return `record:${trimmed}`;
|
|
21592
|
+
}
|
|
21496
21593
|
function resolveLiveQueryRequestIds(input, history) {
|
|
21497
21594
|
const requestIdCandidates = [];
|
|
21498
21595
|
if (input.recordId !== void 0) {
|
|
@@ -21705,6 +21802,20 @@ var REPLAY_TRANSPORT_LADDER = [
|
|
|
21705
21802
|
"context-http",
|
|
21706
21803
|
"page-http"
|
|
21707
21804
|
];
|
|
21805
|
+
function resolveReplayProbeAttemptTimeoutMs(input) {
|
|
21806
|
+
const attemptCapMs = input.recommendedFound ? REPLAY_PROBE_POST_SUCCESS_ATTEMPT_TIMEOUT_MS : REPLAY_PROBE_MAX_ATTEMPT_TIMEOUT_MS;
|
|
21807
|
+
const clampedRemaining = input.remainingMs === void 0 ? void 0 : Math.max(0, input.remainingMs);
|
|
21808
|
+
if (clampedRemaining === 0) {
|
|
21809
|
+
return 0;
|
|
21810
|
+
}
|
|
21811
|
+
if (clampedRemaining === void 0) {
|
|
21812
|
+
return attemptCapMs;
|
|
21813
|
+
}
|
|
21814
|
+
const sliceMs = Math.floor(clampedRemaining / Math.max(1, input.transportsRemaining));
|
|
21815
|
+
const minimumBudgetAffordable = clampedRemaining >= REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS * input.transportsRemaining;
|
|
21816
|
+
const attemptBudgetMs = minimumBudgetAffordable ? Math.max(REPLAY_PROBE_MIN_ATTEMPT_TIMEOUT_MS, sliceMs) : sliceMs;
|
|
21817
|
+
return Math.min(clampedRemaining, attemptCapMs, Math.max(1, attemptBudgetMs));
|
|
21818
|
+
}
|
|
21708
21819
|
function filterNetworkSummaryRecords(records, input) {
|
|
21709
21820
|
return records.filter((record) => {
|
|
21710
21821
|
if (record.record.resourceType === "preflight" || record.record.method === "OPTIONS") {
|
|
@@ -21877,10 +21988,10 @@ function extractGraphqlOperationName(queryText) {
|
|
|
21877
21988
|
function shouldShowRequestBody(method) {
|
|
21878
21989
|
return !["GET", "HEAD", "DELETE", "OPTIONS"].includes(method.trim().toUpperCase());
|
|
21879
21990
|
}
|
|
21880
|
-
function buildStructuredBodyPreview(body, headers) {
|
|
21991
|
+
function buildStructuredBodyPreview(body, headers, options = {}) {
|
|
21881
21992
|
const contentType = headerValue(headers, "content-type") ?? body?.mimeType;
|
|
21882
21993
|
const parsed = parseStructuredPayload(body, contentType);
|
|
21883
|
-
const data = parsed === void 0 ? void 0 : typeof parsed === "string" ? truncateInlineText(parsed) : truncateStructuredValue(parsed);
|
|
21994
|
+
const data = parsed === void 0 ? void 0 : options.truncateData === false ? parsed : typeof parsed === "string" ? truncateInlineText(parsed) : truncateStructuredValue(parsed);
|
|
21884
21995
|
return {
|
|
21885
21996
|
bytes: body?.originalByteLength ?? body?.capturedByteLength ?? 0,
|
|
21886
21997
|
...contentType === void 0 ? {} : { contentType },
|
|
@@ -22093,10 +22204,12 @@ function resolveSessionFetchTransportLadder(transport) {
|
|
|
22093
22204
|
return ["direct-http"];
|
|
22094
22205
|
case "matched-tls":
|
|
22095
22206
|
return ["matched-tls"];
|
|
22207
|
+
case "context":
|
|
22208
|
+
return ["context-http"];
|
|
22096
22209
|
case "page":
|
|
22097
22210
|
return ["page-http"];
|
|
22098
22211
|
case "auto":
|
|
22099
|
-
return ["direct-http", "matched-tls", "page-http"];
|
|
22212
|
+
return ["direct-http", "matched-tls", "context-http", "page-http"];
|
|
22100
22213
|
}
|
|
22101
22214
|
}
|
|
22102
22215
|
function detectChallengeNoteFromRecord(record) {
|
|
@@ -22241,6 +22354,12 @@ function diffStorageSnapshot(left, right) {
|
|
|
22241
22354
|
function normalizeRuntimeErrorMessage(error) {
|
|
22242
22355
|
return error instanceof Error ? error.message : String(error);
|
|
22243
22356
|
}
|
|
22357
|
+
function normalizeProbeTransportAttemptError(transport, error, attemptTimeoutMs) {
|
|
22358
|
+
if (attemptTimeoutMs !== void 0 && error instanceof OpensteerProtocolError && error.code === "timeout") {
|
|
22359
|
+
return `${transport} probe exceeded ${String(attemptTimeoutMs)}ms`;
|
|
22360
|
+
}
|
|
22361
|
+
return normalizeRuntimeErrorMessage(error);
|
|
22362
|
+
}
|
|
22244
22363
|
function applyBrowserCookiesToTransportRequest(request, cookies) {
|
|
22245
22364
|
if (cookies.length === 0) {
|
|
22246
22365
|
return request;
|
|
@@ -24759,6 +24878,6 @@ function renderNewPageInput(openerPageId, initialUrl) {
|
|
|
24759
24878
|
return `{ ${argumentsList.join(", ")} }`;
|
|
24760
24879
|
}
|
|
24761
24880
|
|
|
24762
|
-
export { FLOW_RECORDER_DRAIN_SCRIPT, FLOW_RECORDER_INSTALL_SCRIPT, FlowRecorderCollector, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OPENSTEER_RUNTIME_CORE_VERSION, OpensteerSessionRuntime, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, createArtifactStore, createDomDescriptorStore, createFilesystemOpensteerWorkspace, createFlowRecorderInstallScript, createObservationStore, createOpensteerExtractionDescriptorStore, dispatchSemanticOperation, generateReplayScript, hashDomDescriptorPersist, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, resolveFilesystemWorkspacePath, sanitizeReplayElementPath };
|
|
24881
|
+
export { FLOW_RECORDER_DRAIN_SCRIPT, FLOW_RECORDER_INSTALL_SCRIPT, FlowRecorderCollector, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OPENSTEER_RUNTIME_CORE_VERSION, OpensteerSessionRuntime, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, createArtifactStore, createDomDescriptorStore, createFilesystemOpensteerWorkspace, createFlowRecorderInstallScript, createObservationStore, createOpensteerExtractionDescriptorStore, createSavedNetworkStore, dispatchSemanticOperation, generateReplayScript, hashDomDescriptorPersist, iterateSavedNetworkRecordBatches, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, resolveFilesystemWorkspacePath, sanitizeReplayElementPath };
|
|
24763
24882
|
//# sourceMappingURL=index.js.map
|
|
24764
24883
|
//# sourceMappingURL=index.js.map
|