opensteer 0.8.14 → 0.8.16

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.cjs CHANGED
@@ -2428,6 +2428,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
2428
2428
  required: ["method", "url"]
2429
2429
  }
2430
2430
  );
2431
+ var opensteerReplayAttemptSchema = objectSchema(
2432
+ {
2433
+ transport: transportKindSchema,
2434
+ status: integerSchema({ minimum: 100, maximum: 599 }),
2435
+ ok: { type: "boolean" },
2436
+ durationMs: integerSchema({ minimum: 0 }),
2437
+ note: stringSchema(),
2438
+ error: stringSchema()
2439
+ },
2440
+ {
2441
+ title: "OpensteerReplayAttempt",
2442
+ required: ["transport", "ok", "durationMs"]
2443
+ }
2444
+ );
2431
2445
  var opensteerNetworkDetailOutputSchema = objectSchema(
2432
2446
  {
2433
2447
  recordId: stringSchema({ minLength: 1 }),
@@ -2451,28 +2465,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
2451
2465
  }
2452
2466
  ),
2453
2467
  redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
2454
- notes: arraySchema(stringSchema())
2468
+ notes: arraySchema(stringSchema()),
2469
+ transportProbe: objectSchema(
2470
+ {
2471
+ recommended: transportKindSchema,
2472
+ attempts: arraySchema(opensteerReplayAttemptSchema)
2473
+ },
2474
+ {
2475
+ title: "OpensteerTransportProbeResult",
2476
+ required: ["attempts"]
2477
+ }
2478
+ )
2455
2479
  },
2456
2480
  {
2457
2481
  title: "OpensteerNetworkDetailOutput",
2458
2482
  required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
2459
2483
  }
2460
2484
  );
2461
- var opensteerReplayAttemptSchema = objectSchema(
2462
- {
2463
- transport: transportKindSchema,
2464
- status: integerSchema({ minimum: 100, maximum: 599 }),
2465
- ok: { type: "boolean" },
2466
- durationMs: integerSchema({ minimum: 0 }),
2467
- note: stringSchema(),
2468
- error: stringSchema()
2469
- },
2470
- {
2471
- title: "OpensteerReplayAttempt",
2472
- required: ["transport", "ok", "durationMs"]
2473
- }
2474
- );
2475
- var opensteerNetworkReplayInputSchema = objectSchema(
2485
+ objectSchema(
2476
2486
  {
2477
2487
  recordId: stringSchema({ minLength: 1 }),
2478
2488
  pageRef: pageRefSchema,
@@ -2486,7 +2496,6 @@ var opensteerNetworkReplayInputSchema = objectSchema(
2486
2496
  required: ["recordId"]
2487
2497
  }
2488
2498
  );
2489
- var opensteerNetworkReplayOutputSchema;
2490
2499
  var opensteerSessionFetchTransportSchema = enumSchema(
2491
2500
  ["auto", "direct", "matched-tls", "page"],
2492
2501
  {
@@ -2828,7 +2837,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
2828
2837
  required: ["url", "status", "statusText", "headers", "redirected"]
2829
2838
  }
2830
2839
  );
2831
- opensteerNetworkReplayOutputSchema = objectSchema(
2840
+ objectSchema(
2832
2841
  {
2833
2842
  recordId: stringSchema({ minLength: 1 }),
2834
2843
  transport: transportKindSchema,
@@ -5808,7 +5817,6 @@ var opensteerExposedSemanticOperationNames = [
5808
5817
  "dom.extract",
5809
5818
  "network.query",
5810
5819
  "network.detail",
5811
- "network.replay",
5812
5820
  "interaction.capture",
5813
5821
  "interaction.get",
5814
5822
  "interaction.diff",
@@ -5845,7 +5853,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
5845
5853
  "dom.extract",
5846
5854
  "network.query",
5847
5855
  "network.detail",
5848
- "network.replay",
5849
5856
  "interaction.capture",
5850
5857
  "interaction.get",
5851
5858
  "interaction.diff",
@@ -5966,11 +5973,11 @@ var targetByElementSchema2 = objectSchema(
5966
5973
  var targetByPersistSchema2 = objectSchema(
5967
5974
  {
5968
5975
  kind: enumSchema(["persist"]),
5969
- name: stringSchema()
5976
+ persist: stringSchema()
5970
5977
  },
5971
5978
  {
5972
5979
  title: "OpensteerTargetByPersist",
5973
- required: ["kind", "name"]
5980
+ required: ["kind", "persist"]
5974
5981
  }
5975
5982
  );
5976
5983
  var targetBySelectorSchema2 = objectSchema(
@@ -6017,8 +6024,7 @@ var opensteerResolvedTargetSchema = objectSchema(
6017
6024
  var opensteerActionResultSchema = objectSchema(
6018
6025
  {
6019
6026
  target: opensteerResolvedTargetSchema,
6020
- point: pointSchema,
6021
- persisted: stringSchema()
6027
+ point: pointSchema
6022
6028
  },
6023
6029
  {
6024
6030
  title: "OpensteerActionResult",
@@ -6284,9 +6290,12 @@ var opensteerNetworkDetailInputSchema = objectSchema(
6284
6290
  required: ["recordId"]
6285
6291
  }
6286
6292
  );
6287
- var opensteerComputerMouseButtonSchema = enumSchema(["left", "middle", "right"], {
6288
- title: "OpensteerComputerMouseButton"
6289
- });
6293
+ var opensteerComputerMouseButtonSchema = enumSchema(
6294
+ ["left", "middle", "right"],
6295
+ {
6296
+ title: "OpensteerComputerMouseButton"
6297
+ }
6298
+ );
6290
6299
  var opensteerComputerKeyModifierSchema = enumSchema(
6291
6300
  ["Shift", "Control", "Alt", "Meta"],
6292
6301
  {
@@ -6363,10 +6372,7 @@ var opensteerDomExtractInputSchema = defineSchema({
6363
6372
  title: "OpensteerDomExtractInput"
6364
6373
  }
6365
6374
  ),
6366
- anyOf: [
6367
- defineSchema({ required: ["persist"] }),
6368
- defineSchema({ required: ["schema"] })
6369
- ]
6375
+ anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
6370
6376
  });
6371
6377
  var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
6372
6378
  var opensteerDomExtractOutputSchema = objectSchema(
@@ -6746,13 +6752,6 @@ var opensteerSemanticOperationSpecificationsBase = [
6746
6752
  outputSchema: opensteerNetworkDetailOutputSchema,
6747
6753
  requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
6748
6754
  }),
6749
- defineSemanticOperationSpec({
6750
- name: "network.replay",
6751
- description: "Replay a captured request through the transport ladder and report the transport that worked.",
6752
- inputSchema: opensteerNetworkReplayInputSchema,
6753
- outputSchema: opensteerNetworkReplayOutputSchema,
6754
- requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
6755
- }),
6756
6755
  defineSemanticOperationSpec({
6757
6756
  name: "interaction.capture",
6758
6757
  description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
@@ -10578,8 +10577,8 @@ function createDomDescriptorStore(options) {
10578
10577
  }
10579
10578
  return new MemoryDomDescriptorStore(namespace);
10580
10579
  }
10581
- function hashDomDescriptorName(name) {
10582
- return sha256Hex2(name.trim());
10580
+ function hashDomDescriptorPersist(persist) {
10581
+ return sha256Hex2(persist.trim());
10583
10582
  }
10584
10583
  var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
10585
10584
  click: "dom.click",
@@ -10593,14 +10592,14 @@ function normalizeDomDescriptorMethod(method) {
10593
10592
  }
10594
10593
  function buildDomDescriptorKeys(options) {
10595
10594
  const namespace = normalizeDomDescriptorNamespace(options.namespace);
10596
- const nameHash = hashDomDescriptorName(options.name);
10595
+ const persistHash = hashDomDescriptorPersist(options.persist);
10597
10596
  const rawMethod = options.method.trim();
10598
10597
  const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
10599
10598
  const methods = /* @__PURE__ */ new Set([canonicalMethod]);
10600
10599
  if (rawMethod.length > 0) {
10601
10600
  methods.add(rawMethod);
10602
10601
  }
10603
- return [...methods].map((method) => `dom:${namespace}:${method}:${nameHash}`);
10602
+ return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
10604
10603
  }
10605
10604
  function buildDomDescriptorKey(options) {
10606
10605
  return buildDomDescriptorKeys(options)[0];
@@ -10616,7 +10615,7 @@ function buildDomDescriptorPayload(input) {
10616
10615
  return {
10617
10616
  kind: "dom-target",
10618
10617
  method: normalizeDomDescriptorMethod(input.method),
10619
- name: input.name,
10618
+ persist: input.persist,
10620
10619
  path: sanitizeReplayElementPath(input.path),
10621
10620
  ...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
10622
10621
  };
@@ -10633,8 +10632,7 @@ function parseDomDescriptorRecord(record) {
10633
10632
  if (raw.kind !== "dom-target") {
10634
10633
  return void 0;
10635
10634
  }
10636
- const name = typeof raw.name === "string" ? raw.name : typeof raw.description === "string" ? raw.description : void 0;
10637
- if (typeof raw.method !== "string" || name === void 0) {
10635
+ if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
10638
10636
  return void 0;
10639
10637
  }
10640
10638
  if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
@@ -10646,7 +10644,7 @@ function parseDomDescriptorRecord(record) {
10646
10644
  const normalizedPayload = {
10647
10645
  kind: "dom-target",
10648
10646
  method: normalizeDomDescriptorMethod(raw.method),
10649
- name,
10647
+ persist: raw.persist,
10650
10648
  path: sanitizeReplayElementPath(raw.path),
10651
10649
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
10652
10650
  };
@@ -10668,7 +10666,7 @@ var FilesystemDomDescriptorStore = class {
10668
10666
  for (const key of buildDomDescriptorKeys({
10669
10667
  namespace: this.namespace,
10670
10668
  method: input.method,
10671
- name: input.name
10669
+ persist: input.persist
10672
10670
  })) {
10673
10671
  const record = await this.registry.resolve({ key });
10674
10672
  if (!record) {
@@ -10683,7 +10681,7 @@ var FilesystemDomDescriptorStore = class {
10683
10681
  const key = buildDomDescriptorKey({
10684
10682
  namespace: this.namespace,
10685
10683
  method: input.method,
10686
- name: input.name
10684
+ persist: input.persist
10687
10685
  });
10688
10686
  const version = buildDomDescriptorVersion(payload);
10689
10687
  const existing = await this.registry.resolve({ key, version });
@@ -10726,7 +10724,7 @@ var MemoryDomDescriptorStore = class {
10726
10724
  for (const key of buildDomDescriptorKeys({
10727
10725
  namespace: this.namespace,
10728
10726
  method: input.method,
10729
- name: input.name
10727
+ persist: input.persist
10730
10728
  })) {
10731
10729
  const record = this.latestByKey.get(key);
10732
10730
  if (record) {
@@ -10740,7 +10738,7 @@ var MemoryDomDescriptorStore = class {
10740
10738
  const key = buildDomDescriptorKey({
10741
10739
  namespace: this.namespace,
10742
10740
  method: input.method,
10743
- name: input.name
10741
+ persist: input.persist
10744
10742
  });
10745
10743
  const version = buildDomDescriptorVersion(payload);
10746
10744
  const existing = this.recordsByKey.get(key)?.get(version);
@@ -11707,15 +11705,15 @@ var DefaultDomRuntime = class {
11707
11705
  async resolveDescriptorTarget(session, pageRef, method, target) {
11708
11706
  const descriptor = await this.descriptors.read({
11709
11707
  method,
11710
- name: target.name
11708
+ persist: target.persist
11711
11709
  });
11712
11710
  if (!descriptor) {
11713
11711
  throw new OpensteerProtocolError(
11714
11712
  "not-found",
11715
- `no stored DOM descriptor found for "${target.name}"`,
11713
+ `no stored DOM descriptor found for "${target.persist}"`,
11716
11714
  {
11717
11715
  details: {
11718
- name: target.name,
11716
+ persist: target.persist,
11719
11717
  kind: "dom-descriptor"
11720
11718
  }
11721
11719
  }
@@ -11729,7 +11727,7 @@ var DefaultDomRuntime = class {
11729
11727
  pageRef,
11730
11728
  descriptor.payload.path,
11731
11729
  "descriptor",
11732
- descriptor.payload.name,
11730
+ descriptor.payload.persist,
11733
11731
  descriptor
11734
11732
  );
11735
11733
  }
@@ -11759,7 +11757,7 @@ var DefaultDomRuntime = class {
11759
11757
  const replayPath = await this.tryBuildPathFromNode(snapshot, node);
11760
11758
  const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
11761
11759
  method,
11762
- name: target.persist,
11760
+ persist: target.persist,
11763
11761
  path: replayPath ?? await this.buildPathForNode(snapshot, node),
11764
11762
  sourceUrl: snapshot.url
11765
11763
  });
@@ -13851,8 +13849,7 @@ function parseExtractionDescriptorRecord(record) {
13851
13849
  return void 0;
13852
13850
  }
13853
13851
  const raw = payload;
13854
- const persist = typeof raw.persist === "string" ? raw.persist : raw.description;
13855
- if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
13852
+ if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
13856
13853
  return void 0;
13857
13854
  }
13858
13855
  const root = normalizePersistedExtractionNode(raw.root, "root");
@@ -13867,7 +13864,7 @@ function parseExtractionDescriptorRecord(record) {
13867
13864
  updatedAt: record.updatedAt,
13868
13865
  payload: {
13869
13866
  kind: "dom-extraction",
13870
- persist,
13867
+ persist: raw.persist,
13871
13868
  root,
13872
13869
  ...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
13873
13870
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
@@ -16484,12 +16481,7 @@ var BRAND_KEYCHAIN_SERVICE = {
16484
16481
  async function resolveKeychainPassword(brandId) {
16485
16482
  const service = BRAND_KEYCHAIN_SERVICE[brandId];
16486
16483
  try {
16487
- const { stdout } = await execFile2("security", [
16488
- "find-generic-password",
16489
- "-s",
16490
- service,
16491
- "-w"
16492
- ]);
16484
+ const { stdout } = await execFile2("security", ["find-generic-password", "-s", service, "-w"]);
16493
16485
  return stdout.trim();
16494
16486
  } catch {
16495
16487
  throw new Error(
@@ -16922,8 +16914,8 @@ var OpensteerCloudClient = class {
16922
16914
  entries: entries.map((entry) => ({
16923
16915
  workspace: entry.workspace,
16924
16916
  method: entry.method,
16925
- descriptionHash: entry.nameHash,
16926
- ...entry.name === void 0 ? {} : { description: entry.name },
16917
+ persistHash: entry.persistHash,
16918
+ ...entry.persist === void 0 ? {} : { persist: entry.persist },
16927
16919
  path: entry.path,
16928
16920
  ...entry.schemaHash === void 0 ? {} : { schemaHash: entry.schemaHash },
16929
16921
  createdAt: entry.createdAt,
@@ -17037,7 +17029,7 @@ function resolveCloudConfig(input = {}) {
17037
17029
 
17038
17030
  // ../runtime-core/package.json
17039
17031
  var package_default = {
17040
- version: "0.1.6"};
17032
+ version: "0.1.7"};
17041
17033
 
17042
17034
  // ../runtime-core/src/version.ts
17043
17035
  var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
@@ -19067,7 +19059,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
19067
19059
  )
19068
19060
  );
19069
19061
  }
19070
- async function clearLiveCounters(engine, pageRef) {
19062
+ async function clearOpensteerLiveCounters(engine, pageRef) {
19071
19063
  const frames = await engine.listFrames({ pageRef });
19072
19064
  const failures = [];
19073
19065
  for (const frame of frames) {
@@ -19165,7 +19157,7 @@ async function compileOpensteerSnapshot(options) {
19165
19157
  engine: options.engine,
19166
19158
  pageRef: options.pageRef
19167
19159
  });
19168
- await clearLiveCounters(options.engine, options.pageRef);
19160
+ await clearOpensteerLiveCounters(options.engine, options.pageRef);
19169
19161
  await assignSparseCountersToLiveDom(options.engine, options.pageRef);
19170
19162
  const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
19171
19163
  const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
@@ -19202,7 +19194,7 @@ async function compileOpensteerSnapshot(options) {
19202
19194
  counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
19203
19195
  };
19204
19196
  } catch (error) {
19205
- await clearLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19197
+ await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19206
19198
  if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
19207
19199
  lastCounterSyncError = error;
19208
19200
  continue;
@@ -21785,7 +21777,12 @@ var OpensteerSessionRuntime = class {
21785
21777
  includeBodies: true,
21786
21778
  redactSecretHeaders: false
21787
21779
  });
21788
- return this.buildNetworkDetail(record, timeout);
21780
+ const detail = await this.buildNetworkDetail(record, timeout);
21781
+ if (input.probe !== true) {
21782
+ return detail;
21783
+ }
21784
+ const transportProbe = await this.probeTransportsForRecord(record, timeout);
21785
+ return transportProbe === void 0 ? detail : { ...detail, transportProbe };
21789
21786
  },
21790
21787
  options
21791
21788
  );
@@ -21820,54 +21817,6 @@ var OpensteerSessionRuntime = class {
21820
21817
  throw error;
21821
21818
  }
21822
21819
  }
21823
- async replayNetwork(input, options = {}) {
21824
- const startedAt = Date.now();
21825
- try {
21826
- const output = await this.runWithOperationTimeout(
21827
- "network.replay",
21828
- async (timeout) => {
21829
- const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
21830
- includeBodies: true,
21831
- redactSecretHeaders: false
21832
- });
21833
- const replayRequest = buildReplayTransportRequest(source, input);
21834
- return this.executeNetworkReplay(source, replayRequest, timeout, {
21835
- ...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
21836
- });
21837
- },
21838
- options
21839
- );
21840
- await this.appendTrace({
21841
- operation: "network.replay",
21842
- startedAt,
21843
- completedAt: Date.now(),
21844
- outcome: "ok",
21845
- data: {
21846
- recordId: input.recordId,
21847
- transport: output.transport,
21848
- attempts: output.attempts.length
21849
- },
21850
- context: buildRuntimeTraceContext({
21851
- sessionRef: this.sessionRef,
21852
- pageRef: this.pageRef
21853
- })
21854
- });
21855
- return output;
21856
- } catch (error) {
21857
- await this.appendTrace({
21858
- operation: "network.replay",
21859
- startedAt,
21860
- completedAt: Date.now(),
21861
- outcome: "error",
21862
- error,
21863
- context: buildRuntimeTraceContext({
21864
- sessionRef: this.sessionRef,
21865
- pageRef: this.pageRef
21866
- })
21867
- });
21868
- throw error;
21869
- }
21870
- }
21871
21820
  async captureScripts(input = {}, options = {}) {
21872
21821
  assertValidSemanticOperationInput("scripts.capture", input);
21873
21822
  const pageRef = input.pageRef ?? await this.ensurePageRef();
@@ -22463,7 +22412,7 @@ var OpensteerSessionRuntime = class {
22463
22412
  completedAt: Date.now(),
22464
22413
  outcome: "ok",
22465
22414
  data: {
22466
- transport: output.transport,
22415
+ ...output.transport === void 0 ? {} : { transport: output.transport },
22467
22416
  attempts: output.attempts.length,
22468
22417
  ...output.response === void 0 ? {} : { status: output.response.status },
22469
22418
  url: input.url
@@ -22566,6 +22515,7 @@ var OpensteerSessionRuntime = class {
22566
22515
  });
22567
22516
  boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
22568
22517
  timeout.throwIfAborted();
22518
+ await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
22569
22519
  this.pageRef = output2.pageRef;
22570
22520
  const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
22571
22521
  return {
@@ -22755,7 +22705,7 @@ var OpensteerSessionRuntime = class {
22755
22705
  mutationCaptureDiagnostics = diagnostics;
22756
22706
  }
22757
22707
  );
22758
- const output = toOpensteerActionResult(executed.result, preparedTarget.persisted);
22708
+ const output = toOpensteerActionResult(executed.result);
22759
22709
  const actionEvents = "events" in executed.result ? executed.result.events : void 0;
22760
22710
  await this.appendTrace({
22761
22711
  operation,
@@ -22766,7 +22716,6 @@ var OpensteerSessionRuntime = class {
22766
22716
  data: {
22767
22717
  target: output.target,
22768
22718
  ...output.point === void 0 ? {} : { point: output.point },
22769
- ...output.persisted === void 0 ? {} : { persisted: output.persisted },
22770
22719
  ...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
22771
22720
  ...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
22772
22721
  },
@@ -22830,7 +22779,7 @@ var OpensteerSessionRuntime = class {
22830
22779
  await timeout.runStep(
22831
22780
  () => this.requireDom().writeDescriptor({
22832
22781
  method,
22833
- name: persist,
22782
+ persist,
22834
22783
  path: stablePath2,
22835
22784
  sourceUrl: resolved2.snapshot.url
22836
22785
  })
@@ -22838,9 +22787,8 @@ var OpensteerSessionRuntime = class {
22838
22787
  return {
22839
22788
  target: {
22840
22789
  kind: "descriptor",
22841
- name: persist
22842
- },
22843
- persisted: persist
22790
+ persist
22791
+ }
22844
22792
  };
22845
22793
  }
22846
22794
  const resolved = await timeout.runStep(
@@ -22863,7 +22811,7 @@ var OpensteerSessionRuntime = class {
22863
22811
  await timeout.runStep(
22864
22812
  () => this.requireDom().writeDescriptor({
22865
22813
  method,
22866
- name: persist,
22814
+ persist,
22867
22815
  path: stablePath,
22868
22816
  sourceUrl: resolved.snapshot.url
22869
22817
  })
@@ -22871,9 +22819,8 @@ var OpensteerSessionRuntime = class {
22871
22819
  return {
22872
22820
  target: {
22873
22821
  kind: "descriptor",
22874
- name: persist
22875
- },
22876
- persisted: persist
22822
+ persist
22823
+ }
22877
22824
  };
22878
22825
  }
22879
22826
  async queryLiveNetwork(input, timeout, options = {}) {
@@ -22929,6 +22876,18 @@ var OpensteerSessionRuntime = class {
22929
22876
  const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
22930
22877
  return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
22931
22878
  }
22879
+ async invalidateLiveSnapshotCounters(pageRefs, timeout) {
22880
+ const engine = this.requireEngine();
22881
+ for (const pageRef of new Set(pageRefs)) {
22882
+ try {
22883
+ await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
22884
+ } catch (error) {
22885
+ if (!isIgnorableRuntimeBindingError(error)) {
22886
+ throw error;
22887
+ }
22888
+ }
22889
+ }
22890
+ }
22932
22891
  async captureScriptsInternal(pageRef, input, timeout) {
22933
22892
  const root = await this.ensureRoot();
22934
22893
  const evaluated = await timeout.runStep(
@@ -23258,6 +23217,42 @@ var OpensteerSessionRuntime = class {
23258
23217
  ...notes.length === 0 ? {} : { notes }
23259
23218
  };
23260
23219
  }
23220
+ async probeTransportsForRecord(record, timeout) {
23221
+ if (record.record.status === void 0) {
23222
+ return void 0;
23223
+ }
23224
+ const request = buildReplayTransportRequest(record, { recordId: record.recordId });
23225
+ const fingerprint = buildCapturedRecordSuccessFingerprint(record);
23226
+ const attempts = [];
23227
+ let recommended;
23228
+ for (const transport of REPLAY_TRANSPORT_LADDER) {
23229
+ const attemptStartedAt = Date.now();
23230
+ try {
23231
+ const output = await this.executeReplayTransportAttempt(transport, request, timeout);
23232
+ const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
23233
+ attempts.push({
23234
+ transport,
23235
+ status: output.response.status,
23236
+ ok,
23237
+ durationMs: Date.now() - attemptStartedAt
23238
+ });
23239
+ if (ok && recommended === void 0) {
23240
+ recommended = transport;
23241
+ }
23242
+ } catch (error) {
23243
+ attempts.push({
23244
+ transport,
23245
+ ok: false,
23246
+ durationMs: Date.now() - attemptStartedAt,
23247
+ error: normalizeRuntimeErrorMessage(error)
23248
+ });
23249
+ }
23250
+ }
23251
+ return {
23252
+ ...recommended === void 0 ? {} : { recommended },
23253
+ attempts
23254
+ };
23255
+ }
23261
23256
  async buildRedirectChain(record, timeout) {
23262
23257
  if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
23263
23258
  return {};
@@ -23376,57 +23371,6 @@ var OpensteerSessionRuntime = class {
23376
23371
  })
23377
23372
  };
23378
23373
  }
23379
- async executeNetworkReplay(source, request, timeout, options) {
23380
- const fingerprint = buildCapturedRecordSuccessFingerprint(source);
23381
- const attempts = [];
23382
- let lastOutput;
23383
- for (const transport of REPLAY_TRANSPORT_LADDER) {
23384
- const attemptStartedAt = Date.now();
23385
- try {
23386
- const output = await this.executeReplayTransportAttempt(
23387
- transport,
23388
- request,
23389
- timeout,
23390
- options.pageRef
23391
- );
23392
- lastOutput = output;
23393
- const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
23394
- attempts.push({
23395
- transport,
23396
- status: output.response.status,
23397
- ok,
23398
- durationMs: Date.now() - attemptStartedAt
23399
- });
23400
- if (ok) {
23401
- const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
23402
- const previewData2 = toStructuredPreviewData(output.data);
23403
- return {
23404
- recordId: source.recordId,
23405
- transport,
23406
- attempts,
23407
- response: output.response,
23408
- ...previewData2 === void 0 ? {} : { data: previewData2 },
23409
- ...fallbackNote === void 0 ? {} : { note: fallbackNote }
23410
- };
23411
- }
23412
- } catch (error) {
23413
- attempts.push({
23414
- transport,
23415
- ok: false,
23416
- durationMs: Date.now() - attemptStartedAt,
23417
- error: normalizeRuntimeErrorMessage(error)
23418
- });
23419
- }
23420
- }
23421
- const previewData = toStructuredPreviewData(lastOutput?.data);
23422
- return {
23423
- recordId: source.recordId,
23424
- attempts,
23425
- ...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
23426
- ...previewData === void 0 ? {} : { data: previewData },
23427
- note: "all replay transports failed to reproduce the captured response"
23428
- };
23429
- }
23430
23374
  async executeSessionFetch(request, input, timeout) {
23431
23375
  const attempts = [];
23432
23376
  let lastOutput;
@@ -24054,7 +23998,7 @@ var OpensteerSessionRuntime = class {
24054
23998
  if (target.kind === "persist") {
24055
23999
  return {
24056
24000
  kind: "descriptor",
24057
- name: target.name
24001
+ persist: target.persist
24058
24002
  };
24059
24003
  }
24060
24004
  if (target.kind === "selector") {
@@ -25771,7 +25715,7 @@ function normalizeNamespace2(value) {
25771
25715
  const normalized = String(value ?? "default").trim();
25772
25716
  return normalized.length === 0 ? "default" : normalized;
25773
25717
  }
25774
- function toOpensteerActionResult(result, persisted) {
25718
+ function toOpensteerActionResult(result) {
25775
25719
  return {
25776
25720
  target: toOpensteerResolvedTarget2(result.resolved),
25777
25721
  ...result.point === void 0 ? {} : {
@@ -25779,8 +25723,7 @@ function toOpensteerActionResult(result, persisted) {
25779
25723
  x: result.point.x,
25780
25724
  y: result.point.y
25781
25725
  }
25782
- },
25783
- ...persisted === void 0 ? {} : { persisted }
25726
+ }
25784
25727
  };
25785
25728
  }
25786
25729
  function toOpensteerResolvedTarget2(target) {
@@ -26030,11 +25973,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
26030
25973
  input,
26031
25974
  options
26032
25975
  );
26033
- case "network.replay":
26034
- return runtime.replayNetwork(
26035
- input,
26036
- options
26037
- );
26038
25976
  case "interaction.capture":
26039
25977
  return runtime.captureInteraction(
26040
25978
  input,
@@ -26730,10 +26668,6 @@ var CloudSessionProxy = class {
26730
26668
  await this.ensureSession();
26731
26669
  return this.requireClient().invoke("network.detail", input);
26732
26670
  }
26733
- async replayNetwork(input) {
26734
- await this.ensureSession();
26735
- return this.requireClient().invoke("network.replay", input);
26736
- }
26737
26671
  async captureInteraction(input) {
26738
26672
  await this.ensureSession();
26739
26673
  return this.requireClient().invoke("interaction.capture", input);
@@ -27253,11 +27187,7 @@ var Opensteer = class {
27253
27187
  };
27254
27188
  this.network = {
27255
27189
  query: (input = {}) => this.queryNetwork(input),
27256
- detail: (recordId) => this.runtime.getNetworkDetail({ recordId }),
27257
- replay: (recordId, overrides = {}) => this.runtime.replayNetwork({
27258
- recordId,
27259
- ...overrides
27260
- })
27190
+ detail: (recordId, options2) => this.runtime.getNetworkDetail({ recordId, ...options2 })
27261
27191
  };
27262
27192
  }
27263
27193
  async open(input = {}) {
@@ -27404,10 +27334,8 @@ var Opensteer = class {
27404
27334
  return this.runtime.getBrowserState(domain === void 0 ? {} : { domain });
27405
27335
  }
27406
27336
  async fetch(url, options = {}) {
27407
- const result = await this.runtime.fetch({
27408
- url,
27409
- ...options
27410
- });
27337
+ const input = buildFetchInput(url, options);
27338
+ const result = await this.runtime.fetch(input);
27411
27339
  if (result.response === void 0) {
27412
27340
  throw new Error(result.note ?? `session.fetch did not produce a response for ${url}`);
27413
27341
  }
@@ -27483,7 +27411,7 @@ function normalizeTargetOptions(input) {
27483
27411
  return {
27484
27412
  target: {
27485
27413
  kind: "persist",
27486
- name: input.persist
27414
+ persist: input.persist
27487
27415
  },
27488
27416
  ...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
27489
27417
  };
@@ -27497,6 +27425,25 @@ function pickStorageDomainSnapshot(snapshot, domain) {
27497
27425
  }
27498
27426
  return snapshot.domains.find((entry) => entry.domain === domain);
27499
27427
  }
27428
+ function buildFetchInput(url, options) {
27429
+ return {
27430
+ url,
27431
+ ...options.method !== void 0 && { method: options.method },
27432
+ ...options.headers !== void 0 && { headers: options.headers },
27433
+ ...options.query !== void 0 && { query: options.query },
27434
+ ...options.transport !== void 0 && { transport: options.transport },
27435
+ ...options.cookies !== void 0 && { cookies: options.cookies },
27436
+ ...options.followRedirects !== void 0 && { followRedirects: options.followRedirects },
27437
+ ...options.body !== void 0 && { body: toRuntimeBody(options.body) }
27438
+ };
27439
+ }
27440
+ function toRuntimeBody(body) {
27441
+ try {
27442
+ return { json: JSON.parse(body) };
27443
+ } catch {
27444
+ return { text: body };
27445
+ }
27446
+ }
27500
27447
  function toResponse(response) {
27501
27448
  return new Response(decodeBody(response), {
27502
27449
  status: response.status,
@@ -27557,7 +27504,7 @@ exports.defaultTimeoutPolicy = defaultTimeoutPolicy;
27557
27504
  exports.delayWithSignal = delayWithSignal;
27558
27505
  exports.discoverLocalCdpBrowsers = discoverLocalCdpBrowsers;
27559
27506
  exports.dispatchSemanticOperation = dispatchSemanticOperation;
27560
- exports.hashDomDescriptorName = hashDomDescriptorName;
27507
+ exports.hashDomDescriptorPersist = hashDomDescriptorPersist;
27561
27508
  exports.inspectCdpEndpoint = inspectCdpEndpoint;
27562
27509
  exports.isCurrentUrlField = isCurrentUrlField;
27563
27510
  exports.isValidCssAttributeKey = isValidCssAttributeKey;