@opensteer/runtime-core 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.1.6"};
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 }),
@@ -2394,6 +2404,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
2394
2404
  required: ["method", "url"]
2395
2405
  }
2396
2406
  );
2407
+ var opensteerReplayAttemptSchema = objectSchema(
2408
+ {
2409
+ transport: transportKindSchema,
2410
+ status: integerSchema({ minimum: 100, maximum: 599 }),
2411
+ ok: { type: "boolean" },
2412
+ durationMs: integerSchema({ minimum: 0 }),
2413
+ note: stringSchema(),
2414
+ error: stringSchema()
2415
+ },
2416
+ {
2417
+ title: "OpensteerReplayAttempt",
2418
+ required: ["transport", "ok", "durationMs"]
2419
+ }
2420
+ );
2397
2421
  var opensteerNetworkDetailOutputSchema = objectSchema(
2398
2422
  {
2399
2423
  recordId: stringSchema({ minLength: 1 }),
@@ -2417,28 +2441,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
2417
2441
  }
2418
2442
  ),
2419
2443
  redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
2420
- notes: arraySchema(stringSchema())
2444
+ notes: arraySchema(stringSchema()),
2445
+ transportProbe: objectSchema(
2446
+ {
2447
+ recommended: transportKindSchema,
2448
+ attempts: arraySchema(opensteerReplayAttemptSchema)
2449
+ },
2450
+ {
2451
+ title: "OpensteerTransportProbeResult",
2452
+ required: ["attempts"]
2453
+ }
2454
+ )
2421
2455
  },
2422
2456
  {
2423
2457
  title: "OpensteerNetworkDetailOutput",
2424
2458
  required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
2425
2459
  }
2426
2460
  );
2427
- var opensteerReplayAttemptSchema = objectSchema(
2428
- {
2429
- transport: transportKindSchema,
2430
- status: integerSchema({ minimum: 100, maximum: 599 }),
2431
- ok: { type: "boolean" },
2432
- durationMs: integerSchema({ minimum: 0 }),
2433
- note: stringSchema(),
2434
- error: stringSchema()
2435
- },
2436
- {
2437
- title: "OpensteerReplayAttempt",
2438
- required: ["transport", "ok", "durationMs"]
2439
- }
2440
- );
2441
- var opensteerNetworkReplayInputSchema = objectSchema(
2461
+ objectSchema(
2442
2462
  {
2443
2463
  recordId: stringSchema({ minLength: 1 }),
2444
2464
  pageRef: pageRefSchema,
@@ -2452,9 +2472,8 @@ var opensteerNetworkReplayInputSchema = objectSchema(
2452
2472
  required: ["recordId"]
2453
2473
  }
2454
2474
  );
2455
- var opensteerNetworkReplayOutputSchema;
2456
2475
  var opensteerSessionFetchTransportSchema = enumSchema(
2457
- ["auto", "direct", "matched-tls", "page"],
2476
+ ["auto", "direct", "matched-tls", "context", "page"],
2458
2477
  {
2459
2478
  title: "OpensteerSessionFetchTransport"
2460
2479
  }
@@ -2794,7 +2813,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
2794
2813
  required: ["url", "status", "statusText", "headers", "redirected"]
2795
2814
  }
2796
2815
  );
2797
- opensteerNetworkReplayOutputSchema = objectSchema(
2816
+ objectSchema(
2798
2817
  {
2799
2818
  recordId: stringSchema({ minLength: 1 }),
2800
2819
  transport: transportKindSchema,
@@ -5761,7 +5780,6 @@ var opensteerExposedSemanticOperationNames = [
5761
5780
  "dom.extract",
5762
5781
  "network.query",
5763
5782
  "network.detail",
5764
- "network.replay",
5765
5783
  "interaction.capture",
5766
5784
  "interaction.get",
5767
5785
  "interaction.diff",
@@ -5798,7 +5816,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
5798
5816
  "dom.extract",
5799
5817
  "network.query",
5800
5818
  "network.detail",
5801
- "network.replay",
5802
5819
  "interaction.capture",
5803
5820
  "interaction.get",
5804
5821
  "interaction.diff",
@@ -5919,11 +5936,11 @@ var targetByElementSchema2 = objectSchema(
5919
5936
  var targetByPersistSchema2 = objectSchema(
5920
5937
  {
5921
5938
  kind: enumSchema(["persist"]),
5922
- name: stringSchema()
5939
+ persist: stringSchema()
5923
5940
  },
5924
5941
  {
5925
5942
  title: "OpensteerTargetByPersist",
5926
- required: ["kind", "name"]
5943
+ required: ["kind", "persist"]
5927
5944
  }
5928
5945
  );
5929
5946
  var targetBySelectorSchema2 = objectSchema(
@@ -5970,8 +5987,7 @@ var opensteerResolvedTargetSchema = objectSchema(
5970
5987
  var opensteerActionResultSchema = objectSchema(
5971
5988
  {
5972
5989
  target: opensteerResolvedTargetSchema,
5973
- point: pointSchema,
5974
- persisted: stringSchema()
5990
+ point: pointSchema
5975
5991
  },
5976
5992
  {
5977
5993
  title: "OpensteerActionResult",
@@ -6228,18 +6244,12 @@ var opensteerPageSnapshotOutputSchema = objectSchema(
6228
6244
  required: ["url", "title", "mode", "html", "counters"]
6229
6245
  }
6230
6246
  );
6231
- var opensteerNetworkDetailInputSchema = objectSchema(
6232
- {
6233
- recordId: stringSchema({ minLength: 1 })
6234
- },
6247
+ var opensteerComputerMouseButtonSchema = enumSchema(
6248
+ ["left", "middle", "right"],
6235
6249
  {
6236
- title: "OpensteerNetworkDetailInput",
6237
- required: ["recordId"]
6250
+ title: "OpensteerComputerMouseButton"
6238
6251
  }
6239
6252
  );
6240
- var opensteerComputerMouseButtonSchema = enumSchema(["left", "middle", "right"], {
6241
- title: "OpensteerComputerMouseButton"
6242
- });
6243
6253
  var opensteerComputerKeyModifierSchema = enumSchema(
6244
6254
  ["Shift", "Control", "Alt", "Meta"],
6245
6255
  {
@@ -6316,10 +6326,7 @@ var opensteerDomExtractInputSchema = defineSchema({
6316
6326
  title: "OpensteerDomExtractInput"
6317
6327
  }
6318
6328
  ),
6319
- anyOf: [
6320
- defineSchema({ required: ["persist"] }),
6321
- defineSchema({ required: ["schema"] })
6322
- ]
6329
+ anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
6323
6330
  });
6324
6331
  var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
6325
6332
  var opensteerDomExtractOutputSchema = objectSchema(
@@ -6699,13 +6706,6 @@ var opensteerSemanticOperationSpecificationsBase = [
6699
6706
  outputSchema: opensteerNetworkDetailOutputSchema,
6700
6707
  requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
6701
6708
  }),
6702
- defineSemanticOperationSpec({
6703
- name: "network.replay",
6704
- description: "Replay a captured request through the transport ladder and report the transport that worked.",
6705
- inputSchema: opensteerNetworkReplayInputSchema,
6706
- outputSchema: opensteerNetworkReplayOutputSchema,
6707
- requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
6708
- }),
6709
6709
  defineSemanticOperationSpec({
6710
6710
  name: "interaction.capture",
6711
6711
  description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
@@ -6813,6 +6813,7 @@ var opensteerSemanticOperationSpecificationsBase = [
6813
6813
  case "direct":
6814
6814
  return [];
6815
6815
  case "matched-tls":
6816
+ case "context":
6816
6817
  return ["inspect.cookies"];
6817
6818
  case "page":
6818
6819
  return ["pages.manage"];
@@ -7512,7 +7513,6 @@ var DEFAULT_TIMEOUTS = {
7512
7513
  "dom.extract": 15e3,
7513
7514
  "network.query": 15e3,
7514
7515
  "network.detail": 15e3,
7515
- "network.replay": 3e4,
7516
7516
  "scripts.capture": 15e3,
7517
7517
  "session.cookies": 1e4,
7518
7518
  "session.storage": 1e4,
@@ -8334,13 +8334,6 @@ var SqliteSavedNetworkStore = class {
8334
8334
  }
8335
8335
  async save(records, options) {
8336
8336
  const database = await this.requireDatabase();
8337
- const readExisting = database.prepare(`
8338
- SELECT record_id
8339
- FROM saved_network_records
8340
- WHERE session_ref = @session_ref
8341
- AND page_ref_key = @page_ref_key
8342
- AND request_id = @request_id
8343
- `);
8344
8337
  const upsertRecord = database.prepare(buildSavedNetworkUpsertSql(options.bodyWriteMode));
8345
8338
  const insertTag = database.prepare(`
8346
8339
  INSERT OR IGNORE INTO saved_network_tags (record_id, tag)
@@ -8351,14 +8344,8 @@ var SqliteSavedNetworkStore = class {
8351
8344
  for (const entry of records) {
8352
8345
  const url = new URL(entry.record.url);
8353
8346
  const pageRefKey = entry.record.pageRef ?? "";
8354
- const existing = readExisting.get({
8355
- session_ref: entry.record.sessionRef,
8356
- page_ref_key: pageRefKey,
8357
- request_id: entry.record.requestId
8358
- }) ?? void 0;
8359
- const recordId = existing?.record_id ?? entry.recordId;
8360
8347
  upsertRecord.run({
8361
- record_id: recordId,
8348
+ record_id: entry.recordId,
8362
8349
  request_id: entry.record.requestId,
8363
8350
  session_ref: entry.record.sessionRef,
8364
8351
  page_ref: entry.record.pageRef ?? null,
@@ -8403,7 +8390,7 @@ var SqliteSavedNetworkStore = class {
8403
8390
  }
8404
8391
  for (const currentTag of tags) {
8405
8392
  const result = insertTag.run({
8406
- record_id: recordId,
8393
+ record_id: entry.recordId,
8407
8394
  tag: currentTag
8408
8395
  });
8409
8396
  savedCount += result.changes ?? 0;
@@ -8506,6 +8493,49 @@ var SqliteSavedNetworkStore = class {
8506
8493
  return cleared;
8507
8494
  });
8508
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
+ }
8509
8539
  async requireDatabase() {
8510
8540
  if (this.database) {
8511
8541
  return this.database;
@@ -8590,15 +8620,6 @@ var SqliteSavedNetworkStore = class {
8590
8620
  saved_at INTEGER NOT NULL
8591
8621
  );
8592
8622
 
8593
- CREATE UNIQUE INDEX IF NOT EXISTS saved_network_records_scope_request
8594
- ON saved_network_records (session_ref, page_ref_key, request_id);
8595
-
8596
- CREATE INDEX IF NOT EXISTS saved_network_records_saved_at
8597
- ON saved_network_records (saved_at DESC);
8598
-
8599
- CREATE INDEX IF NOT EXISTS saved_network_records_capture
8600
- ON saved_network_records (capture);
8601
-
8602
8623
  CREATE TABLE IF NOT EXISTS saved_network_tags (
8603
8624
  record_id TEXT NOT NULL REFERENCES saved_network_records(record_id) ON DELETE CASCADE,
8604
8625
  tag TEXT NOT NULL,
@@ -8608,6 +8629,19 @@ var SqliteSavedNetworkStore = class {
8608
8629
  CREATE INDEX IF NOT EXISTS saved_network_tags_tag
8609
8630
  ON saved_network_tags (tag);
8610
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
+ `);
8611
8645
  this.ensureColumn(
8612
8646
  database,
8613
8647
  "saved_network_records",
@@ -8927,6 +8961,14 @@ function withSqliteTransaction(database, task) {
8927
8961
  function createSavedNetworkStore(rootPath) {
8928
8962
  return new SqliteSavedNetworkStore(rootPath);
8929
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
+ }
8930
8972
  function normalizeContext(context) {
8931
8973
  return {
8932
8974
  ...context?.sessionRef === void 0 ? {} : { sessionRef: context.sessionRef },
@@ -10574,8 +10616,8 @@ function createDomDescriptorStore(options) {
10574
10616
  }
10575
10617
  return new MemoryDomDescriptorStore(namespace);
10576
10618
  }
10577
- function hashDomDescriptorName(name) {
10578
- return sha256Hex2(name.trim());
10619
+ function hashDomDescriptorPersist(persist) {
10620
+ return sha256Hex2(persist.trim());
10579
10621
  }
10580
10622
  var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
10581
10623
  click: "dom.click",
@@ -10589,14 +10631,14 @@ function normalizeDomDescriptorMethod(method) {
10589
10631
  }
10590
10632
  function buildDomDescriptorKeys(options) {
10591
10633
  const namespace = normalizeDomDescriptorNamespace(options.namespace);
10592
- const nameHash = hashDomDescriptorName(options.name);
10634
+ const persistHash = hashDomDescriptorPersist(options.persist);
10593
10635
  const rawMethod = options.method.trim();
10594
10636
  const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
10595
10637
  const methods = /* @__PURE__ */ new Set([canonicalMethod]);
10596
10638
  if (rawMethod.length > 0) {
10597
10639
  methods.add(rawMethod);
10598
10640
  }
10599
- return [...methods].map((method) => `dom:${namespace}:${method}:${nameHash}`);
10641
+ return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
10600
10642
  }
10601
10643
  function buildDomDescriptorKey(options) {
10602
10644
  return buildDomDescriptorKeys(options)[0];
@@ -10612,7 +10654,7 @@ function buildDomDescriptorPayload(input) {
10612
10654
  return {
10613
10655
  kind: "dom-target",
10614
10656
  method: normalizeDomDescriptorMethod(input.method),
10615
- name: input.name,
10657
+ persist: input.persist,
10616
10658
  path: sanitizeReplayElementPath(input.path),
10617
10659
  ...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
10618
10660
  };
@@ -10629,8 +10671,7 @@ function parseDomDescriptorRecord(record) {
10629
10671
  if (raw.kind !== "dom-target") {
10630
10672
  return void 0;
10631
10673
  }
10632
- const name = typeof raw.name === "string" ? raw.name : typeof raw.description === "string" ? raw.description : void 0;
10633
- if (typeof raw.method !== "string" || name === void 0) {
10674
+ if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
10634
10675
  return void 0;
10635
10676
  }
10636
10677
  if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
@@ -10642,7 +10683,7 @@ function parseDomDescriptorRecord(record) {
10642
10683
  const normalizedPayload = {
10643
10684
  kind: "dom-target",
10644
10685
  method: normalizeDomDescriptorMethod(raw.method),
10645
- name,
10686
+ persist: raw.persist,
10646
10687
  path: sanitizeReplayElementPath(raw.path),
10647
10688
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
10648
10689
  };
@@ -10664,7 +10705,7 @@ var FilesystemDomDescriptorStore = class {
10664
10705
  for (const key of buildDomDescriptorKeys({
10665
10706
  namespace: this.namespace,
10666
10707
  method: input.method,
10667
- name: input.name
10708
+ persist: input.persist
10668
10709
  })) {
10669
10710
  const record = await this.registry.resolve({ key });
10670
10711
  if (!record) {
@@ -10679,7 +10720,7 @@ var FilesystemDomDescriptorStore = class {
10679
10720
  const key = buildDomDescriptorKey({
10680
10721
  namespace: this.namespace,
10681
10722
  method: input.method,
10682
- name: input.name
10723
+ persist: input.persist
10683
10724
  });
10684
10725
  const version = buildDomDescriptorVersion(payload);
10685
10726
  const existing = await this.registry.resolve({ key, version });
@@ -10722,7 +10763,7 @@ var MemoryDomDescriptorStore = class {
10722
10763
  for (const key of buildDomDescriptorKeys({
10723
10764
  namespace: this.namespace,
10724
10765
  method: input.method,
10725
- name: input.name
10766
+ persist: input.persist
10726
10767
  })) {
10727
10768
  const record = this.latestByKey.get(key);
10728
10769
  if (record) {
@@ -10736,7 +10777,7 @@ var MemoryDomDescriptorStore = class {
10736
10777
  const key = buildDomDescriptorKey({
10737
10778
  namespace: this.namespace,
10738
10779
  method: input.method,
10739
- name: input.name
10780
+ persist: input.persist
10740
10781
  });
10741
10782
  const version = buildDomDescriptorVersion(payload);
10742
10783
  const existing = this.recordsByKey.get(key)?.get(version);
@@ -11668,15 +11709,15 @@ var DefaultDomRuntime = class {
11668
11709
  async resolveDescriptorTarget(session, pageRef, method, target) {
11669
11710
  const descriptor = await this.descriptors.read({
11670
11711
  method,
11671
- name: target.name
11712
+ persist: target.persist
11672
11713
  });
11673
11714
  if (!descriptor) {
11674
11715
  throw new OpensteerProtocolError(
11675
11716
  "not-found",
11676
- `no stored DOM descriptor found for "${target.name}"`,
11717
+ `no stored DOM descriptor found for "${target.persist}"`,
11677
11718
  {
11678
11719
  details: {
11679
- name: target.name,
11720
+ persist: target.persist,
11680
11721
  kind: "dom-descriptor"
11681
11722
  }
11682
11723
  }
@@ -11690,7 +11731,7 @@ var DefaultDomRuntime = class {
11690
11731
  pageRef,
11691
11732
  descriptor.payload.path,
11692
11733
  "descriptor",
11693
- descriptor.payload.name,
11734
+ descriptor.payload.persist,
11694
11735
  descriptor
11695
11736
  );
11696
11737
  }
@@ -11720,7 +11761,7 @@ var DefaultDomRuntime = class {
11720
11761
  const replayPath = await this.tryBuildPathFromNode(snapshot, node);
11721
11762
  const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
11722
11763
  method,
11723
- name: target.persist,
11764
+ persist: target.persist,
11724
11765
  path: replayPath ?? await this.buildPathForNode(snapshot, node),
11725
11766
  sourceUrl: snapshot.url
11726
11767
  });
@@ -14736,8 +14777,7 @@ function parseExtractionDescriptorRecord(record) {
14736
14777
  return void 0;
14737
14778
  }
14738
14779
  const raw = payload;
14739
- const persist = typeof raw.persist === "string" ? raw.persist : raw.description;
14740
- if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
14780
+ if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
14741
14781
  return void 0;
14742
14782
  }
14743
14783
  const root = normalizePersistedExtractionNode(raw.root, "root");
@@ -14752,7 +14792,7 @@ function parseExtractionDescriptorRecord(record) {
14752
14792
  updatedAt: record.updatedAt,
14753
14793
  payload: {
14754
14794
  kind: "dom-extraction",
14755
- persist,
14795
+ persist: raw.persist,
14756
14796
  root,
14757
14797
  ...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
14758
14798
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
@@ -16007,7 +16047,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
16007
16047
  )
16008
16048
  );
16009
16049
  }
16010
- async function clearLiveCounters(engine, pageRef) {
16050
+ async function clearOpensteerLiveCounters(engine, pageRef) {
16011
16051
  const frames = await engine.listFrames({ pageRef });
16012
16052
  const failures = [];
16013
16053
  for (const frame of frames) {
@@ -16105,7 +16145,7 @@ async function compileOpensteerSnapshot(options) {
16105
16145
  engine: options.engine,
16106
16146
  pageRef: options.pageRef
16107
16147
  });
16108
- await clearLiveCounters(options.engine, options.pageRef);
16148
+ await clearOpensteerLiveCounters(options.engine, options.pageRef);
16109
16149
  await assignSparseCountersToLiveDom(options.engine, options.pageRef);
16110
16150
  const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
16111
16151
  const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
@@ -16142,7 +16182,7 @@ async function compileOpensteerSnapshot(options) {
16142
16182
  counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
16143
16183
  };
16144
16184
  } catch (error) {
16145
- await clearLiveCounters(options.engine, options.pageRef).catch(() => void 0);
16185
+ await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
16146
16186
  if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
16147
16187
  lastCounterSyncError = error;
16148
16188
  continue;
@@ -17795,6 +17835,9 @@ var MUTATION_CAPTURE_FINALIZE_TIMEOUT_MS = 5e3;
17795
17835
  var PERSISTED_NETWORK_FLUSH_TIMEOUT_MS = 5e3;
17796
17836
  var PENDING_OPERATION_EVENT_CAPTURE_LIMIT = 64;
17797
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;
17798
17841
  var OpensteerSessionRuntime = class {
17799
17842
  workspace;
17800
17843
  rootPath;
@@ -18656,26 +18699,27 @@ var OpensteerSessionRuntime = class {
18656
18699
  }
18657
18700
  }
18658
18701
  async queryNetwork(input = {}, options = {}) {
18659
- assertValidSemanticOperationInput("network.query", input);
18702
+ const normalizedInput = normalizeNetworkQueryInput(input);
18703
+ assertValidSemanticOperationInput("network.query", normalizedInput);
18660
18704
  const root = await this.ensureRoot();
18661
18705
  const startedAt = Date.now();
18662
18706
  try {
18663
18707
  const output = await this.runWithOperationTimeout(
18664
18708
  "network.query",
18665
18709
  async (timeout) => {
18666
- await this.syncPersistedNetworkSelection(timeout, input, {
18710
+ await this.syncPersistedNetworkSelection(timeout, normalizedInput, {
18667
18711
  includeBodies: false
18668
18712
  });
18669
18713
  const rawRecords = await timeout.runStep(
18670
18714
  () => root.registry.savedNetwork.query({
18671
- ...this.toSavedNetworkQueryInput(input),
18672
- limit: Math.max(input.limit ?? 50, 1e3)
18715
+ ...this.toSavedNetworkQueryInput(normalizedInput),
18716
+ limit: Math.max(normalizedInput.limit ?? 50, 1e3)
18673
18717
  })
18674
18718
  );
18675
- const filtered = filterNetworkSummaryRecords(rawRecords, input);
18719
+ const filtered = filterNetworkSummaryRecords(rawRecords, normalizedInput);
18676
18720
  const sorted = sortPersistedNetworkRecordsChronologically(filtered);
18677
- const sliced = sliceNetworkSummaryWindow(sorted, input);
18678
- const limited = sliced.slice(0, Math.max(1, Math.min(input.limit ?? 50, 200)));
18721
+ const sliced = sliceNetworkSummaryWindow(sorted, normalizedInput);
18722
+ const limited = sliced.slice(0, Math.max(1, Math.min(normalizedInput.limit ?? 50, 200)));
18679
18723
  const summaries = await this.buildNetworkSummaryRecords(limited, timeout);
18680
18724
  return {
18681
18725
  records: summaries
@@ -18689,9 +18733,9 @@ var OpensteerSessionRuntime = class {
18689
18733
  completedAt: Date.now(),
18690
18734
  outcome: "ok",
18691
18735
  data: {
18692
- limit: input.limit ?? 50,
18693
- ...input.capture === void 0 ? {} : { capture: input.capture },
18694
- ...input.json === true ? { json: true } : {},
18736
+ limit: normalizedInput.limit ?? 50,
18737
+ ...normalizedInput.capture === void 0 ? {} : { capture: normalizedInput.capture },
18738
+ ...normalizedInput.json === true ? { json: true } : {},
18695
18739
  count: output.records.length
18696
18740
  },
18697
18741
  context: buildRuntimeTraceContext({
@@ -18716,16 +18760,22 @@ var OpensteerSessionRuntime = class {
18716
18760
  }
18717
18761
  }
18718
18762
  async getNetworkDetail(input, options = {}) {
18763
+ const normalizedRecordId = normalizeNetworkRecordId(input.recordId);
18719
18764
  const startedAt = Date.now();
18720
18765
  try {
18721
18766
  const output = await this.runWithOperationTimeout(
18722
18767
  "network.detail",
18723
18768
  async (timeout) => {
18724
- const record = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
18769
+ const record = await this.resolveNetworkRecordByRecordId(normalizedRecordId, timeout, {
18725
18770
  includeBodies: true,
18726
18771
  redactSecretHeaders: false
18727
18772
  });
18728
- return this.buildNetworkDetail(record, timeout);
18773
+ const detail = await this.buildNetworkDetail(record, timeout);
18774
+ if (input.probe !== true) {
18775
+ return detail;
18776
+ }
18777
+ const transportProbe = await this.probeTransportsForRecord(record, timeout);
18778
+ return transportProbe === void 0 ? detail : { ...detail, transportProbe };
18729
18779
  },
18730
18780
  options
18731
18781
  );
@@ -18735,8 +18785,8 @@ var OpensteerSessionRuntime = class {
18735
18785
  completedAt: Date.now(),
18736
18786
  outcome: "ok",
18737
18787
  data: {
18738
- recordId: input.recordId,
18739
- status: output.summary.status,
18788
+ recordId: normalizedRecordId,
18789
+ ...output.summary.status === void 0 ? {} : { status: output.summary.status },
18740
18790
  url: output.summary.url
18741
18791
  },
18742
18792
  context: buildRuntimeTraceContext({
@@ -18760,54 +18810,6 @@ var OpensteerSessionRuntime = class {
18760
18810
  throw error;
18761
18811
  }
18762
18812
  }
18763
- async replayNetwork(input, options = {}) {
18764
- const startedAt = Date.now();
18765
- try {
18766
- const output = await this.runWithOperationTimeout(
18767
- "network.replay",
18768
- async (timeout) => {
18769
- const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
18770
- includeBodies: true,
18771
- redactSecretHeaders: false
18772
- });
18773
- const replayRequest = buildReplayTransportRequest(source, input);
18774
- return this.executeNetworkReplay(source, replayRequest, timeout, {
18775
- ...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
18776
- });
18777
- },
18778
- options
18779
- );
18780
- await this.appendTrace({
18781
- operation: "network.replay",
18782
- startedAt,
18783
- completedAt: Date.now(),
18784
- outcome: "ok",
18785
- data: {
18786
- recordId: input.recordId,
18787
- transport: output.transport,
18788
- attempts: output.attempts.length
18789
- },
18790
- context: buildRuntimeTraceContext({
18791
- sessionRef: this.sessionRef,
18792
- pageRef: this.pageRef
18793
- })
18794
- });
18795
- return output;
18796
- } catch (error) {
18797
- await this.appendTrace({
18798
- operation: "network.replay",
18799
- startedAt,
18800
- completedAt: Date.now(),
18801
- outcome: "error",
18802
- error,
18803
- context: buildRuntimeTraceContext({
18804
- sessionRef: this.sessionRef,
18805
- pageRef: this.pageRef
18806
- })
18807
- });
18808
- throw error;
18809
- }
18810
- }
18811
18813
  async captureScripts(input = {}, options = {}) {
18812
18814
  assertValidSemanticOperationInput("scripts.capture", input);
18813
18815
  const pageRef = input.pageRef ?? await this.ensurePageRef();
@@ -19403,7 +19405,7 @@ var OpensteerSessionRuntime = class {
19403
19405
  completedAt: Date.now(),
19404
19406
  outcome: "ok",
19405
19407
  data: {
19406
- transport: output.transport,
19408
+ ...output.transport === void 0 ? {} : { transport: output.transport },
19407
19409
  attempts: output.attempts.length,
19408
19410
  ...output.response === void 0 ? {} : { status: output.response.status },
19409
19411
  url: input.url
@@ -19506,6 +19508,7 @@ var OpensteerSessionRuntime = class {
19506
19508
  });
19507
19509
  boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
19508
19510
  timeout.throwIfAborted();
19511
+ await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
19509
19512
  this.pageRef = output2.pageRef;
19510
19513
  const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
19511
19514
  return {
@@ -19695,7 +19698,7 @@ var OpensteerSessionRuntime = class {
19695
19698
  mutationCaptureDiagnostics = diagnostics;
19696
19699
  }
19697
19700
  );
19698
- const output = toOpensteerActionResult(executed.result, preparedTarget.persisted);
19701
+ const output = toOpensteerActionResult(executed.result);
19699
19702
  const actionEvents = "events" in executed.result ? executed.result.events : void 0;
19700
19703
  await this.appendTrace({
19701
19704
  operation,
@@ -19706,7 +19709,6 @@ var OpensteerSessionRuntime = class {
19706
19709
  data: {
19707
19710
  target: output.target,
19708
19711
  ...output.point === void 0 ? {} : { point: output.point },
19709
- ...output.persisted === void 0 ? {} : { persisted: output.persisted },
19710
19712
  ...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
19711
19713
  ...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
19712
19714
  },
@@ -19770,7 +19772,7 @@ var OpensteerSessionRuntime = class {
19770
19772
  await timeout.runStep(
19771
19773
  () => this.requireDom().writeDescriptor({
19772
19774
  method,
19773
- name: persist,
19775
+ persist,
19774
19776
  path: stablePath2,
19775
19777
  sourceUrl: resolved2.snapshot.url
19776
19778
  })
@@ -19778,9 +19780,8 @@ var OpensteerSessionRuntime = class {
19778
19780
  return {
19779
19781
  target: {
19780
19782
  kind: "descriptor",
19781
- name: persist
19782
- },
19783
- persisted: persist
19783
+ persist
19784
+ }
19784
19785
  };
19785
19786
  }
19786
19787
  const resolved = await timeout.runStep(
@@ -19803,7 +19804,7 @@ var OpensteerSessionRuntime = class {
19803
19804
  await timeout.runStep(
19804
19805
  () => this.requireDom().writeDescriptor({
19805
19806
  method,
19806
- name: persist,
19807
+ persist,
19807
19808
  path: stablePath,
19808
19809
  sourceUrl: resolved.snapshot.url
19809
19810
  })
@@ -19811,9 +19812,8 @@ var OpensteerSessionRuntime = class {
19811
19812
  return {
19812
19813
  target: {
19813
19814
  kind: "descriptor",
19814
- name: persist
19815
- },
19816
- persisted: persist
19815
+ persist
19816
+ }
19817
19817
  };
19818
19818
  }
19819
19819
  async queryLiveNetwork(input, timeout, options = {}) {
@@ -19869,6 +19869,18 @@ var OpensteerSessionRuntime = class {
19869
19869
  const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
19870
19870
  return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
19871
19871
  }
19872
+ async invalidateLiveSnapshotCounters(pageRefs, timeout) {
19873
+ const engine = this.requireEngine();
19874
+ for (const pageRef of new Set(pageRefs)) {
19875
+ try {
19876
+ await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
19877
+ } catch (error) {
19878
+ if (!isIgnorableRuntimeBindingError(error)) {
19879
+ throw error;
19880
+ }
19881
+ }
19882
+ }
19883
+ }
19872
19884
  async captureScriptsInternal(pageRef, input, timeout) {
19873
19885
  const root = await this.ensureRoot();
19874
19886
  const evaluated = await timeout.runStep(
@@ -20178,7 +20190,9 @@ var OpensteerSessionRuntime = class {
20178
20190
  ...graphql.persisted === void 0 ? {} : { persisted: graphql.persisted },
20179
20191
  ...graphqlVariables === void 0 ? {} : { variables: graphqlVariables }
20180
20192
  };
20181
- const requestBody = shouldShowRequestBody(record.record.method) && record.record.requestBody !== void 0 ? buildStructuredBodyPreview(record.record.requestBody, record.record.requestHeaders) : void 0;
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;
20182
20196
  const responseBody = record.record.responseBody === void 0 ? void 0 : buildStructuredBodyPreview(record.record.responseBody, record.record.responseHeaders);
20183
20197
  const notes = detectNetworkRecordNotes(record);
20184
20198
  return {
@@ -20198,6 +20212,52 @@ var OpensteerSessionRuntime = class {
20198
20212
  ...notes.length === 0 ? {} : { notes }
20199
20213
  };
20200
20214
  }
20215
+ async probeTransportsForRecord(record, timeout) {
20216
+ if (record.record.status === void 0) {
20217
+ return void 0;
20218
+ }
20219
+ const request = buildReplayTransportRequest(record, { recordId: record.recordId });
20220
+ const fingerprint = buildCapturedRecordSuccessFingerprint(record);
20221
+ const attempts = [];
20222
+ let recommended;
20223
+ for (const transport of REPLAY_TRANSPORT_LADDER) {
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
+ });
20230
+ try {
20231
+ const output = await this.executeReplayTransportAttemptWithinBudget(
20232
+ transport,
20233
+ request,
20234
+ timeout,
20235
+ attemptTimeoutMs
20236
+ );
20237
+ const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
20238
+ attempts.push({
20239
+ transport,
20240
+ status: output.response.status,
20241
+ ok,
20242
+ durationMs: Date.now() - attemptStartedAt
20243
+ });
20244
+ if (ok && recommended === void 0) {
20245
+ recommended = transport;
20246
+ }
20247
+ } catch (error) {
20248
+ attempts.push({
20249
+ transport,
20250
+ ok: false,
20251
+ durationMs: Date.now() - attemptStartedAt,
20252
+ error: normalizeProbeTransportAttemptError(transport, error, attemptTimeoutMs)
20253
+ });
20254
+ }
20255
+ }
20256
+ return {
20257
+ ...recommended === void 0 ? {} : { recommended },
20258
+ attempts
20259
+ };
20260
+ }
20201
20261
  async buildRedirectChain(record, timeout) {
20202
20262
  if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
20203
20263
  return {};
@@ -20316,57 +20376,6 @@ var OpensteerSessionRuntime = class {
20316
20376
  })
20317
20377
  };
20318
20378
  }
20319
- async executeNetworkReplay(source, request, timeout, options) {
20320
- const fingerprint = buildCapturedRecordSuccessFingerprint(source);
20321
- const attempts = [];
20322
- let lastOutput;
20323
- for (const transport of REPLAY_TRANSPORT_LADDER) {
20324
- const attemptStartedAt = Date.now();
20325
- try {
20326
- const output = await this.executeReplayTransportAttempt(
20327
- transport,
20328
- request,
20329
- timeout,
20330
- options.pageRef
20331
- );
20332
- lastOutput = output;
20333
- const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
20334
- attempts.push({
20335
- transport,
20336
- status: output.response.status,
20337
- ok,
20338
- durationMs: Date.now() - attemptStartedAt
20339
- });
20340
- if (ok) {
20341
- const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
20342
- const previewData2 = toStructuredPreviewData(output.data);
20343
- return {
20344
- recordId: source.recordId,
20345
- transport,
20346
- attempts,
20347
- response: output.response,
20348
- ...previewData2 === void 0 ? {} : { data: previewData2 },
20349
- ...fallbackNote === void 0 ? {} : { note: fallbackNote }
20350
- };
20351
- }
20352
- } catch (error) {
20353
- attempts.push({
20354
- transport,
20355
- ok: false,
20356
- durationMs: Date.now() - attemptStartedAt,
20357
- error: normalizeRuntimeErrorMessage(error)
20358
- });
20359
- }
20360
- }
20361
- const previewData = toStructuredPreviewData(lastOutput?.data);
20362
- return {
20363
- recordId: source.recordId,
20364
- attempts,
20365
- ...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
20366
- ...previewData === void 0 ? {} : { data: previewData },
20367
- note: "all replay transports failed to reproduce the captured response"
20368
- };
20369
- }
20370
20379
  async executeSessionFetch(request, input, timeout) {
20371
20380
  const attempts = [];
20372
20381
  let lastOutput;
@@ -20444,6 +20453,23 @@ var OpensteerSessionRuntime = class {
20444
20453
  }
20445
20454
  }
20446
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
+ }
20447
20473
  async executeFetchTransportAttempt(transport, request, timeout, input) {
20448
20474
  let prepared = finalizeMaterializedTransportRequest(request, transport);
20449
20475
  if (input.cookies !== false && transport === "direct-http" && this.currentBinding() !== void 0) {
@@ -20994,7 +21020,7 @@ var OpensteerSessionRuntime = class {
20994
21020
  if (target.kind === "persist") {
20995
21021
  return {
20996
21022
  kind: "descriptor",
20997
- name: target.name
21023
+ persist: target.persist
20998
21024
  };
20999
21025
  }
21000
21026
  if (target.kind === "selector") {
@@ -21358,10 +21384,15 @@ var OpensteerSessionRuntime = class {
21358
21384
  return this.observationSessionId ?? this.sessionRef;
21359
21385
  }
21360
21386
  runWithOperationTimeout(operation, callback, options = {}) {
21387
+ const timeoutPolicy = options.timeoutMs === void 0 ? this.policy.timeout : {
21388
+ resolveTimeoutMs() {
21389
+ return options.timeoutMs;
21390
+ }
21391
+ };
21361
21392
  const existingCollector = this.operationEventStorage.getStore();
21362
21393
  if (existingCollector !== void 0) {
21363
21394
  return runWithPolicyTimeout(
21364
- this.policy.timeout,
21395
+ timeoutPolicy,
21365
21396
  {
21366
21397
  operation,
21367
21398
  ...options.signal === void 0 ? {} : { signal: options.signal }
@@ -21374,7 +21405,7 @@ var OpensteerSessionRuntime = class {
21374
21405
  return this.operationEventStorage.run(collector, async () => {
21375
21406
  try {
21376
21407
  return await runWithPolicyTimeout(
21377
- this.policy.timeout,
21408
+ timeoutPolicy,
21378
21409
  {
21379
21410
  operation,
21380
21411
  ...options.signal === void 0 ? {} : { signal: options.signal }
@@ -21544,6 +21575,21 @@ function buildEngineNetworkRecordFilters(input) {
21544
21575
  function normalizeNetworkStatusFilter(status) {
21545
21576
  return String(status);
21546
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
+ }
21547
21593
  function resolveLiveQueryRequestIds(input, history) {
21548
21594
  const requestIdCandidates = [];
21549
21595
  if (input.recordId !== void 0) {
@@ -21756,6 +21802,20 @@ var REPLAY_TRANSPORT_LADDER = [
21756
21802
  "context-http",
21757
21803
  "page-http"
21758
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
+ }
21759
21819
  function filterNetworkSummaryRecords(records, input) {
21760
21820
  return records.filter((record) => {
21761
21821
  if (record.record.resourceType === "preflight" || record.record.method === "OPTIONS") {
@@ -21928,10 +21988,10 @@ function extractGraphqlOperationName(queryText) {
21928
21988
  function shouldShowRequestBody(method) {
21929
21989
  return !["GET", "HEAD", "DELETE", "OPTIONS"].includes(method.trim().toUpperCase());
21930
21990
  }
21931
- function buildStructuredBodyPreview(body, headers) {
21991
+ function buildStructuredBodyPreview(body, headers, options = {}) {
21932
21992
  const contentType = headerValue(headers, "content-type") ?? body?.mimeType;
21933
21993
  const parsed = parseStructuredPayload(body, contentType);
21934
- 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);
21935
21995
  return {
21936
21996
  bytes: body?.originalByteLength ?? body?.capturedByteLength ?? 0,
21937
21997
  ...contentType === void 0 ? {} : { contentType },
@@ -22144,10 +22204,12 @@ function resolveSessionFetchTransportLadder(transport) {
22144
22204
  return ["direct-http"];
22145
22205
  case "matched-tls":
22146
22206
  return ["matched-tls"];
22207
+ case "context":
22208
+ return ["context-http"];
22147
22209
  case "page":
22148
22210
  return ["page-http"];
22149
22211
  case "auto":
22150
- return ["direct-http", "matched-tls", "page-http"];
22212
+ return ["direct-http", "matched-tls", "context-http", "page-http"];
22151
22213
  }
22152
22214
  }
22153
22215
  function detectChallengeNoteFromRecord(record) {
@@ -22292,6 +22354,12 @@ function diffStorageSnapshot(left, right) {
22292
22354
  function normalizeRuntimeErrorMessage(error) {
22293
22355
  return error instanceof Error ? error.message : String(error);
22294
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
+ }
22295
22363
  function applyBrowserCookiesToTransportRequest(request, cookies) {
22296
22364
  if (cookies.length === 0) {
22297
22365
  return request;
@@ -22711,7 +22779,7 @@ function normalizeNamespace2(value) {
22711
22779
  const normalized = String(value ?? "default").trim();
22712
22780
  return normalized.length === 0 ? "default" : normalized;
22713
22781
  }
22714
- function toOpensteerActionResult(result, persisted) {
22782
+ function toOpensteerActionResult(result) {
22715
22783
  return {
22716
22784
  target: toOpensteerResolvedTarget2(result.resolved),
22717
22785
  ...result.point === void 0 ? {} : {
@@ -22719,8 +22787,7 @@ function toOpensteerActionResult(result, persisted) {
22719
22787
  x: result.point.x,
22720
22788
  y: result.point.y
22721
22789
  }
22722
- },
22723
- ...persisted === void 0 ? {} : { persisted }
22790
+ }
22724
22791
  };
22725
22792
  }
22726
22793
  function toOpensteerResolvedTarget2(target) {
@@ -22970,11 +23037,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
22970
23037
  input,
22971
23038
  options
22972
23039
  );
22973
- case "network.replay":
22974
- return runtime.replayNetwork(
22975
- input,
22976
- options
22977
- );
22978
23040
  case "interaction.capture":
22979
23041
  return runtime.captureInteraction(
22980
23042
  input,
@@ -24816,6 +24878,6 @@ function renderNewPageInput(openerPageId, initialUrl) {
24816
24878
  return `{ ${argumentsList.join(", ")} }`;
24817
24879
  }
24818
24880
 
24819
- 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, hashDomDescriptorName, 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 };
24820
24882
  //# sourceMappingURL=index.js.map
24821
24883
  //# sourceMappingURL=index.js.map