opensteer 0.8.14 → 0.8.15

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 CHANGED
@@ -185,7 +185,7 @@ Use `snapshot("action")` or `snapshot("extraction")` during exploration. The sna
185
185
  - `hover({ element? | selector? | persist?, captureNetwork? })`
186
186
  - `input({ text, element? | selector? | persist?, captureNetwork? })`
187
187
  - `scroll({ direction, amount, element? | selector? | persist?, captureNetwork? })`
188
- - `extract({ persist, schema? })`
188
+ - `extract({ schema } | { persist, schema? })`
189
189
  - `network.query(input?)`
190
190
  - `network.detail(recordId)`
191
191
  - `network.replay(recordId, overrides?)`
@@ -6487,11 +6487,11 @@ var targetByElementSchema2 = objectSchema(
6487
6487
  var targetByPersistSchema2 = objectSchema(
6488
6488
  {
6489
6489
  kind: enumSchema(["persist"]),
6490
- name: stringSchema()
6490
+ persist: stringSchema()
6491
6491
  },
6492
6492
  {
6493
6493
  title: "OpensteerTargetByPersist",
6494
- required: ["kind", "name"]
6494
+ required: ["kind", "persist"]
6495
6495
  }
6496
6496
  );
6497
6497
  var targetBySelectorSchema2 = objectSchema(
@@ -6538,8 +6538,7 @@ var opensteerResolvedTargetSchema = objectSchema(
6538
6538
  var opensteerActionResultSchema = objectSchema(
6539
6539
  {
6540
6540
  target: opensteerResolvedTargetSchema,
6541
- point: pointSchema,
6542
- persisted: stringSchema()
6541
+ point: pointSchema
6543
6542
  },
6544
6543
  {
6545
6544
  title: "OpensteerActionResult",
@@ -10547,8 +10546,8 @@ function createDomDescriptorStore(options) {
10547
10546
  }
10548
10547
  return new MemoryDomDescriptorStore(namespace);
10549
10548
  }
10550
- function hashDomDescriptorName(name) {
10551
- return sha256Hex2(name.trim());
10549
+ function hashDomDescriptorPersist(persist) {
10550
+ return sha256Hex2(persist.trim());
10552
10551
  }
10553
10552
  var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
10554
10553
  click: "dom.click",
@@ -10562,14 +10561,14 @@ function normalizeDomDescriptorMethod(method) {
10562
10561
  }
10563
10562
  function buildDomDescriptorKeys(options) {
10564
10563
  const namespace = normalizeDomDescriptorNamespace(options.namespace);
10565
- const nameHash = hashDomDescriptorName(options.name);
10564
+ const persistHash = hashDomDescriptorPersist(options.persist);
10566
10565
  const rawMethod = options.method.trim();
10567
10566
  const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
10568
10567
  const methods = /* @__PURE__ */ new Set([canonicalMethod]);
10569
10568
  if (rawMethod.length > 0) {
10570
10569
  methods.add(rawMethod);
10571
10570
  }
10572
- return [...methods].map((method) => `dom:${namespace}:${method}:${nameHash}`);
10571
+ return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
10573
10572
  }
10574
10573
  function buildDomDescriptorKey(options) {
10575
10574
  return buildDomDescriptorKeys(options)[0];
@@ -10585,7 +10584,7 @@ function buildDomDescriptorPayload(input) {
10585
10584
  return {
10586
10585
  kind: "dom-target",
10587
10586
  method: normalizeDomDescriptorMethod(input.method),
10588
- name: input.name,
10587
+ persist: input.persist,
10589
10588
  path: sanitizeReplayElementPath(input.path),
10590
10589
  ...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
10591
10590
  };
@@ -10602,8 +10601,7 @@ function parseDomDescriptorRecord(record) {
10602
10601
  if (raw.kind !== "dom-target") {
10603
10602
  return void 0;
10604
10603
  }
10605
- const name = typeof raw.name === "string" ? raw.name : typeof raw.description === "string" ? raw.description : void 0;
10606
- if (typeof raw.method !== "string" || name === void 0) {
10604
+ if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
10607
10605
  return void 0;
10608
10606
  }
10609
10607
  if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
@@ -10615,7 +10613,7 @@ function parseDomDescriptorRecord(record) {
10615
10613
  const normalizedPayload = {
10616
10614
  kind: "dom-target",
10617
10615
  method: normalizeDomDescriptorMethod(raw.method),
10618
- name,
10616
+ persist: raw.persist,
10619
10617
  path: sanitizeReplayElementPath(raw.path),
10620
10618
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
10621
10619
  };
@@ -10637,7 +10635,7 @@ var FilesystemDomDescriptorStore = class {
10637
10635
  for (const key of buildDomDescriptorKeys({
10638
10636
  namespace: this.namespace,
10639
10637
  method: input.method,
10640
- name: input.name
10638
+ persist: input.persist
10641
10639
  })) {
10642
10640
  const record = await this.registry.resolve({ key });
10643
10641
  if (!record) {
@@ -10652,7 +10650,7 @@ var FilesystemDomDescriptorStore = class {
10652
10650
  const key = buildDomDescriptorKey({
10653
10651
  namespace: this.namespace,
10654
10652
  method: input.method,
10655
- name: input.name
10653
+ persist: input.persist
10656
10654
  });
10657
10655
  const version = buildDomDescriptorVersion(payload);
10658
10656
  const existing = await this.registry.resolve({ key, version });
@@ -10695,7 +10693,7 @@ var MemoryDomDescriptorStore = class {
10695
10693
  for (const key of buildDomDescriptorKeys({
10696
10694
  namespace: this.namespace,
10697
10695
  method: input.method,
10698
- name: input.name
10696
+ persist: input.persist
10699
10697
  })) {
10700
10698
  const record = this.latestByKey.get(key);
10701
10699
  if (record) {
@@ -10709,7 +10707,7 @@ var MemoryDomDescriptorStore = class {
10709
10707
  const key = buildDomDescriptorKey({
10710
10708
  namespace: this.namespace,
10711
10709
  method: input.method,
10712
- name: input.name
10710
+ persist: input.persist
10713
10711
  });
10714
10712
  const version = buildDomDescriptorVersion(payload);
10715
10713
  const existing = this.recordsByKey.get(key)?.get(version);
@@ -11676,15 +11674,15 @@ var DefaultDomRuntime = class {
11676
11674
  async resolveDescriptorTarget(session, pageRef, method, target) {
11677
11675
  const descriptor = await this.descriptors.read({
11678
11676
  method,
11679
- name: target.name
11677
+ persist: target.persist
11680
11678
  });
11681
11679
  if (!descriptor) {
11682
11680
  throw new OpensteerProtocolError(
11683
11681
  "not-found",
11684
- `no stored DOM descriptor found for "${target.name}"`,
11682
+ `no stored DOM descriptor found for "${target.persist}"`,
11685
11683
  {
11686
11684
  details: {
11687
- name: target.name,
11685
+ persist: target.persist,
11688
11686
  kind: "dom-descriptor"
11689
11687
  }
11690
11688
  }
@@ -11698,7 +11696,7 @@ var DefaultDomRuntime = class {
11698
11696
  pageRef,
11699
11697
  descriptor.payload.path,
11700
11698
  "descriptor",
11701
- descriptor.payload.name,
11699
+ descriptor.payload.persist,
11702
11700
  descriptor
11703
11701
  );
11704
11702
  }
@@ -11728,7 +11726,7 @@ var DefaultDomRuntime = class {
11728
11726
  const replayPath = await this.tryBuildPathFromNode(snapshot, node);
11729
11727
  const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
11730
11728
  method,
11731
- name: target.persist,
11729
+ persist: target.persist,
11732
11730
  path: replayPath ?? await this.buildPathForNode(snapshot, node),
11733
11731
  sourceUrl: snapshot.url
11734
11732
  });
@@ -13820,8 +13818,7 @@ function parseExtractionDescriptorRecord(record) {
13820
13818
  return void 0;
13821
13819
  }
13822
13820
  const raw = payload;
13823
- const persist = typeof raw.persist === "string" ? raw.persist : raw.description;
13824
- if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
13821
+ if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
13825
13822
  return void 0;
13826
13823
  }
13827
13824
  const root = normalizePersistedExtractionNode(raw.root, "root");
@@ -13836,7 +13833,7 @@ function parseExtractionDescriptorRecord(record) {
13836
13833
  updatedAt: record.updatedAt,
13837
13834
  payload: {
13838
13835
  kind: "dom-extraction",
13839
- persist,
13836
+ persist: raw.persist,
13840
13837
  root,
13841
13838
  ...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
13842
13839
  ...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
@@ -16795,8 +16792,8 @@ var OpensteerCloudClient = class {
16795
16792
  entries: entries.map((entry) => ({
16796
16793
  workspace: entry.workspace,
16797
16794
  method: entry.method,
16798
- descriptionHash: entry.nameHash,
16799
- ...entry.name === void 0 ? {} : { description: entry.name },
16795
+ persistHash: entry.persistHash,
16796
+ ...entry.persist === void 0 ? {} : { persist: entry.persist },
16800
16797
  path: entry.path,
16801
16798
  ...entry.schemaHash === void 0 ? {} : { schemaHash: entry.schemaHash },
16802
16799
  createdAt: entry.createdAt,
@@ -19090,7 +19087,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
19090
19087
  )
19091
19088
  );
19092
19089
  }
19093
- async function clearLiveCounters(engine, pageRef) {
19090
+ async function clearOpensteerLiveCounters(engine, pageRef) {
19094
19091
  const frames = await engine.listFrames({ pageRef });
19095
19092
  const failures = [];
19096
19093
  for (const frame of frames) {
@@ -19188,7 +19185,7 @@ async function compileOpensteerSnapshot(options) {
19188
19185
  engine: options.engine,
19189
19186
  pageRef: options.pageRef
19190
19187
  });
19191
- await clearLiveCounters(options.engine, options.pageRef);
19188
+ await clearOpensteerLiveCounters(options.engine, options.pageRef);
19192
19189
  await assignSparseCountersToLiveDom(options.engine, options.pageRef);
19193
19190
  const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
19194
19191
  const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
@@ -19225,7 +19222,7 @@ async function compileOpensteerSnapshot(options) {
19225
19222
  counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
19226
19223
  };
19227
19224
  } catch (error) {
19228
- await clearLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19225
+ await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19229
19226
  if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
19230
19227
  lastCounterSyncError = error;
19231
19228
  continue;
@@ -22589,6 +22586,7 @@ var OpensteerSessionRuntime = class {
22589
22586
  });
22590
22587
  boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
22591
22588
  timeout.throwIfAborted();
22589
+ await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
22592
22590
  this.pageRef = output2.pageRef;
22593
22591
  const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
22594
22592
  return {
@@ -22778,7 +22776,7 @@ var OpensteerSessionRuntime = class {
22778
22776
  mutationCaptureDiagnostics = diagnostics;
22779
22777
  }
22780
22778
  );
22781
- const output = toOpensteerActionResult(executed.result, preparedTarget.persisted);
22779
+ const output = toOpensteerActionResult(executed.result);
22782
22780
  const actionEvents = "events" in executed.result ? executed.result.events : void 0;
22783
22781
  await this.appendTrace({
22784
22782
  operation,
@@ -22789,7 +22787,6 @@ var OpensteerSessionRuntime = class {
22789
22787
  data: {
22790
22788
  target: output.target,
22791
22789
  ...output.point === void 0 ? {} : { point: output.point },
22792
- ...output.persisted === void 0 ? {} : { persisted: output.persisted },
22793
22790
  ...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
22794
22791
  ...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
22795
22792
  },
@@ -22853,7 +22850,7 @@ var OpensteerSessionRuntime = class {
22853
22850
  await timeout.runStep(
22854
22851
  () => this.requireDom().writeDescriptor({
22855
22852
  method,
22856
- name: persist,
22853
+ persist,
22857
22854
  path: stablePath2,
22858
22855
  sourceUrl: resolved2.snapshot.url
22859
22856
  })
@@ -22861,9 +22858,8 @@ var OpensteerSessionRuntime = class {
22861
22858
  return {
22862
22859
  target: {
22863
22860
  kind: "descriptor",
22864
- name: persist
22865
- },
22866
- persisted: persist
22861
+ persist
22862
+ }
22867
22863
  };
22868
22864
  }
22869
22865
  const resolved = await timeout.runStep(
@@ -22886,7 +22882,7 @@ var OpensteerSessionRuntime = class {
22886
22882
  await timeout.runStep(
22887
22883
  () => this.requireDom().writeDescriptor({
22888
22884
  method,
22889
- name: persist,
22885
+ persist,
22890
22886
  path: stablePath,
22891
22887
  sourceUrl: resolved.snapshot.url
22892
22888
  })
@@ -22894,9 +22890,8 @@ var OpensteerSessionRuntime = class {
22894
22890
  return {
22895
22891
  target: {
22896
22892
  kind: "descriptor",
22897
- name: persist
22898
- },
22899
- persisted: persist
22893
+ persist
22894
+ }
22900
22895
  };
22901
22896
  }
22902
22897
  async queryLiveNetwork(input, timeout, options = {}) {
@@ -22952,6 +22947,18 @@ var OpensteerSessionRuntime = class {
22952
22947
  const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
22953
22948
  return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
22954
22949
  }
22950
+ async invalidateLiveSnapshotCounters(pageRefs, timeout) {
22951
+ const engine = this.requireEngine();
22952
+ for (const pageRef of new Set(pageRefs)) {
22953
+ try {
22954
+ await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
22955
+ } catch (error) {
22956
+ if (!isIgnorableRuntimeBindingError(error)) {
22957
+ throw error;
22958
+ }
22959
+ }
22960
+ }
22961
+ }
22955
22962
  async captureScriptsInternal(pageRef, input, timeout) {
22956
22963
  const root = await this.ensureRoot();
22957
22964
  const evaluated = await timeout.runStep(
@@ -24077,7 +24084,7 @@ var OpensteerSessionRuntime = class {
24077
24084
  if (target.kind === "persist") {
24078
24085
  return {
24079
24086
  kind: "descriptor",
24080
- name: target.name
24087
+ persist: target.persist
24081
24088
  };
24082
24089
  }
24083
24090
  if (target.kind === "selector") {
@@ -25794,7 +25801,7 @@ function normalizeNamespace2(value) {
25794
25801
  const normalized = String(value ?? "default").trim();
25795
25802
  return normalized.length === 0 ? "default" : normalized;
25796
25803
  }
25797
- function toOpensteerActionResult(result, persisted) {
25804
+ function toOpensteerActionResult(result) {
25798
25805
  return {
25799
25806
  target: toOpensteerResolvedTarget2(result.resolved),
25800
25807
  ...result.point === void 0 ? {} : {
@@ -25802,8 +25809,7 @@ function toOpensteerActionResult(result, persisted) {
25802
25809
  x: result.point.x,
25803
25810
  y: result.point.y
25804
25811
  }
25805
- },
25806
- ...persisted === void 0 ? {} : { persisted }
25812
+ }
25807
25813
  };
25808
25814
  }
25809
25815
  function toOpensteerResolvedTarget2(target) {
@@ -28921,6 +28927,6 @@ function isOpensteerEnvironmentKey(key) {
28921
28927
  return key.startsWith(OPENSTEER_ENV_PREFIX);
28922
28928
  }
28923
28929
 
28924
- export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, FlowRecorderCollector, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime2 as OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, generateReplayScript, hashDomDescriptorName, inspectCdpEndpoint, isCurrentUrlField, isProcessRunning, isValidCssAttributeKey, listLocalChromeProfiles, loadEnvironment, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, pathExists, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, requireCloudAppBaseUrl, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerEnvironment, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
28925
- //# sourceMappingURL=chunk-BRUJHMWO.js.map
28926
- //# sourceMappingURL=chunk-BRUJHMWO.js.map
28930
+ export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, FlowRecorderCollector, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime2 as OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, generateReplayScript, hashDomDescriptorPersist, inspectCdpEndpoint, isCurrentUrlField, isProcessRunning, isValidCssAttributeKey, listLocalChromeProfiles, loadEnvironment, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, pathExists, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, requireCloudAppBaseUrl, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerEnvironment, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
28931
+ //# sourceMappingURL=chunk-DFQCK2U6.js.map
28932
+ //# sourceMappingURL=chunk-DFQCK2U6.js.map