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.
@@ -2949,6 +2949,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
2949
2949
  required: ["method", "url"]
2950
2950
  }
2951
2951
  );
2952
+ var opensteerReplayAttemptSchema = objectSchema(
2953
+ {
2954
+ transport: transportKindSchema,
2955
+ status: integerSchema({ minimum: 100, maximum: 599 }),
2956
+ ok: { type: "boolean" },
2957
+ durationMs: integerSchema({ minimum: 0 }),
2958
+ note: stringSchema(),
2959
+ error: stringSchema()
2960
+ },
2961
+ {
2962
+ title: "OpensteerReplayAttempt",
2963
+ required: ["transport", "ok", "durationMs"]
2964
+ }
2965
+ );
2952
2966
  var opensteerNetworkDetailOutputSchema = objectSchema(
2953
2967
  {
2954
2968
  recordId: stringSchema({ minLength: 1 }),
@@ -2972,28 +2986,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
2972
2986
  }
2973
2987
  ),
2974
2988
  redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
2975
- notes: arraySchema(stringSchema())
2989
+ notes: arraySchema(stringSchema()),
2990
+ transportProbe: objectSchema(
2991
+ {
2992
+ recommended: transportKindSchema,
2993
+ attempts: arraySchema(opensteerReplayAttemptSchema)
2994
+ },
2995
+ {
2996
+ title: "OpensteerTransportProbeResult",
2997
+ required: ["attempts"]
2998
+ }
2999
+ )
2976
3000
  },
2977
3001
  {
2978
3002
  title: "OpensteerNetworkDetailOutput",
2979
3003
  required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
2980
3004
  }
2981
3005
  );
2982
- var opensteerReplayAttemptSchema = objectSchema(
2983
- {
2984
- transport: transportKindSchema,
2985
- status: integerSchema({ minimum: 100, maximum: 599 }),
2986
- ok: { type: "boolean" },
2987
- durationMs: integerSchema({ minimum: 0 }),
2988
- note: stringSchema(),
2989
- error: stringSchema()
2990
- },
2991
- {
2992
- title: "OpensteerReplayAttempt",
2993
- required: ["transport", "ok", "durationMs"]
2994
- }
2995
- );
2996
- var opensteerNetworkReplayInputSchema = objectSchema(
3006
+ objectSchema(
2997
3007
  {
2998
3008
  recordId: stringSchema({ minLength: 1 }),
2999
3009
  pageRef: pageRefSchema,
@@ -3007,7 +3017,6 @@ var opensteerNetworkReplayInputSchema = objectSchema(
3007
3017
  required: ["recordId"]
3008
3018
  }
3009
3019
  );
3010
- var opensteerNetworkReplayOutputSchema;
3011
3020
  var opensteerSessionFetchTransportSchema = enumSchema(
3012
3021
  ["auto", "direct", "matched-tls", "page"],
3013
3022
  {
@@ -3349,7 +3358,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
3349
3358
  required: ["url", "status", "statusText", "headers", "redirected"]
3350
3359
  }
3351
3360
  );
3352
- opensteerNetworkReplayOutputSchema = objectSchema(
3361
+ objectSchema(
3353
3362
  {
3354
3363
  recordId: stringSchema({ minLength: 1 }),
3355
3364
  transport: transportKindSchema,
@@ -6329,7 +6338,6 @@ var opensteerExposedSemanticOperationNames = [
6329
6338
  "dom.extract",
6330
6339
  "network.query",
6331
6340
  "network.detail",
6332
- "network.replay",
6333
6341
  "interaction.capture",
6334
6342
  "interaction.get",
6335
6343
  "interaction.diff",
@@ -6366,7 +6374,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
6366
6374
  "dom.extract",
6367
6375
  "network.query",
6368
6376
  "network.detail",
6369
- "network.replay",
6370
6377
  "interaction.capture",
6371
6378
  "interaction.get",
6372
6379
  "interaction.diff",
@@ -6487,11 +6494,11 @@ var targetByElementSchema2 = objectSchema(
6487
6494
  var targetByPersistSchema2 = objectSchema(
6488
6495
  {
6489
6496
  kind: enumSchema(["persist"]),
6490
- name: stringSchema()
6497
+ persist: stringSchema()
6491
6498
  },
6492
6499
  {
6493
6500
  title: "OpensteerTargetByPersist",
6494
- required: ["kind", "name"]
6501
+ required: ["kind", "persist"]
6495
6502
  }
6496
6503
  );
6497
6504
  var targetBySelectorSchema2 = objectSchema(
@@ -6538,8 +6545,7 @@ var opensteerResolvedTargetSchema = objectSchema(
6538
6545
  var opensteerActionResultSchema = objectSchema(
6539
6546
  {
6540
6547
  target: opensteerResolvedTargetSchema,
6541
- point: pointSchema,
6542
- persisted: stringSchema()
6548
+ point: pointSchema
6543
6549
  },
6544
6550
  {
6545
6551
  title: "OpensteerActionResult",
@@ -6805,9 +6811,12 @@ var opensteerNetworkDetailInputSchema = objectSchema(
6805
6811
  required: ["recordId"]
6806
6812
  }
6807
6813
  );
6808
- var opensteerComputerMouseButtonSchema = enumSchema(["left", "middle", "right"], {
6809
- title: "OpensteerComputerMouseButton"
6810
- });
6814
+ var opensteerComputerMouseButtonSchema = enumSchema(
6815
+ ["left", "middle", "right"],
6816
+ {
6817
+ title: "OpensteerComputerMouseButton"
6818
+ }
6819
+ );
6811
6820
  var opensteerComputerKeyModifierSchema = enumSchema(
6812
6821
  ["Shift", "Control", "Alt", "Meta"],
6813
6822
  {
@@ -6884,10 +6893,7 @@ var opensteerDomExtractInputSchema = defineSchema({
6884
6893
  title: "OpensteerDomExtractInput"
6885
6894
  }
6886
6895
  ),
6887
- anyOf: [
6888
- defineSchema({ required: ["persist"] }),
6889
- defineSchema({ required: ["schema"] })
6890
- ]
6896
+ anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
6891
6897
  });
6892
6898
  var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
6893
6899
  var opensteerDomExtractOutputSchema = objectSchema(
@@ -7267,13 +7273,6 @@ var opensteerSemanticOperationSpecificationsBase = [
7267
7273
  outputSchema: opensteerNetworkDetailOutputSchema,
7268
7274
  requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
7269
7275
  }),
7270
- defineSemanticOperationSpec({
7271
- name: "network.replay",
7272
- description: "Replay a captured request through the transport ladder and report the transport that worked.",
7273
- inputSchema: opensteerNetworkReplayInputSchema,
7274
- outputSchema: opensteerNetworkReplayOutputSchema,
7275
- requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
7276
- }),
7277
7276
  defineSemanticOperationSpec({
7278
7277
  name: "interaction.capture",
7279
7278
  description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
@@ -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 } : {}
@@ -16201,6 +16198,108 @@ function isStealthProfile(input) {
16201
16198
  async function sleep(ms) {
16202
16199
  await new Promise((resolve4) => setTimeout(resolve4, ms));
16203
16200
  }
16201
+ var ENV_FILENAMES = [".env", ".env.local"];
16202
+ var OPENSTEER_ENV_PREFIX = "OPENSTEER_";
16203
+ var opensteerEnvironmentCache = /* @__PURE__ */ new Map();
16204
+ function resolveOpensteerEnvironment(cwd = process.cwd(), baseEnv = process.env) {
16205
+ const resolvedCwd = path7.resolve(cwd);
16206
+ const signature = buildEnvironmentSignature(baseEnv, isOpensteerEnvironmentKey);
16207
+ const cached = opensteerEnvironmentCache.get(resolvedCwd);
16208
+ if (cached && cached.signature === signature) {
16209
+ return { ...cached.values };
16210
+ }
16211
+ const resolved = resolveEnvironmentFiles(resolvedCwd, baseEnv, isOpensteerEnvironmentKey);
16212
+ opensteerEnvironmentCache.set(resolvedCwd, {
16213
+ signature,
16214
+ values: { ...resolved }
16215
+ });
16216
+ return { ...resolved };
16217
+ }
16218
+ function loadEnvironment(cwd = process.cwd()) {
16219
+ const resolved = resolveEnvironmentFiles(path7.resolve(cwd), process.env);
16220
+ for (const [key, value] of Object.entries(resolved)) {
16221
+ process.env[key] = value;
16222
+ }
16223
+ }
16224
+ function collectDirectories(cwd) {
16225
+ const directories = [];
16226
+ let current = path7.resolve(cwd);
16227
+ for (; ; ) {
16228
+ directories.unshift(current);
16229
+ const parent = path7.dirname(current);
16230
+ if (parent === current) {
16231
+ return directories;
16232
+ }
16233
+ current = parent;
16234
+ }
16235
+ }
16236
+ function parseEnvFile(contents) {
16237
+ const parsed = {};
16238
+ for (const rawLine of contents.split(/\r?\n/u)) {
16239
+ const trimmed = rawLine.trim();
16240
+ if (!trimmed || trimmed.startsWith("#")) {
16241
+ continue;
16242
+ }
16243
+ const line = trimmed.startsWith("export ") ? trimmed.slice("export ".length) : trimmed;
16244
+ const separatorIndex = line.indexOf("=");
16245
+ if (separatorIndex <= 0) {
16246
+ continue;
16247
+ }
16248
+ const key = line.slice(0, separatorIndex).trim();
16249
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) {
16250
+ continue;
16251
+ }
16252
+ const rawValue = line.slice(separatorIndex + 1).trim();
16253
+ parsed[key] = parseEnvValue(rawValue);
16254
+ }
16255
+ return parsed;
16256
+ }
16257
+ function parseEnvValue(rawValue) {
16258
+ if (rawValue.length >= 2 && rawValue.startsWith('"') && rawValue.endsWith('"')) {
16259
+ return rawValue.slice(1, -1).replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"');
16260
+ }
16261
+ if (rawValue.length >= 2 && rawValue.startsWith("'") && rawValue.endsWith("'")) {
16262
+ return rawValue.slice(1, -1);
16263
+ }
16264
+ return rawValue.replace(/\s+#.*$/u, "").trimEnd();
16265
+ }
16266
+ function resolveEnvironmentFiles(cwd, baseEnv, predicate) {
16267
+ const resolved = collectEnvironment(baseEnv, predicate);
16268
+ const protectedKeys = new Set(Object.keys(resolved));
16269
+ const directories = collectDirectories(cwd);
16270
+ for (const directory of directories) {
16271
+ for (const filename of ENV_FILENAMES) {
16272
+ const filePath = path7.join(directory, filename);
16273
+ if (!existsSync(filePath)) {
16274
+ continue;
16275
+ }
16276
+ const parsed = parseEnvFile(readFileSync(filePath, "utf8"));
16277
+ for (const [key, value] of Object.entries(parsed)) {
16278
+ if (predicate && !predicate(key) || protectedKeys.has(key)) {
16279
+ continue;
16280
+ }
16281
+ resolved[key] = value;
16282
+ }
16283
+ }
16284
+ }
16285
+ return resolved;
16286
+ }
16287
+ function collectEnvironment(baseEnv, predicate) {
16288
+ const resolved = {};
16289
+ for (const [key, value] of Object.entries(baseEnv)) {
16290
+ if (predicate && !predicate(key) || value === void 0) {
16291
+ continue;
16292
+ }
16293
+ resolved[key] = value;
16294
+ }
16295
+ return resolved;
16296
+ }
16297
+ function buildEnvironmentSignature(baseEnv, predicate) {
16298
+ return Object.entries(baseEnv).filter(([key, value]) => predicate(key) && value !== void 0).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey)).map(([key, value]) => `${key}=${value}`).join("\n");
16299
+ }
16300
+ function isOpensteerEnvironmentKey(key) {
16301
+ return key.startsWith(OPENSTEER_ENV_PREFIX);
16302
+ }
16204
16303
 
16205
16304
  // src/provider/config.ts
16206
16305
  var OPENSTEER_PROVIDER_MODES = ["local", "cloud"];
@@ -16357,12 +16456,7 @@ var BRAND_KEYCHAIN_SERVICE = {
16357
16456
  async function resolveKeychainPassword(brandId) {
16358
16457
  const service = BRAND_KEYCHAIN_SERVICE[brandId];
16359
16458
  try {
16360
- const { stdout } = await execFile2("security", [
16361
- "find-generic-password",
16362
- "-s",
16363
- service,
16364
- "-w"
16365
- ]);
16459
+ const { stdout } = await execFile2("security", ["find-generic-password", "-s", service, "-w"]);
16366
16460
  return stdout.trim();
16367
16461
  } catch {
16368
16462
  throw new Error(
@@ -16795,8 +16889,8 @@ var OpensteerCloudClient = class {
16795
16889
  entries: entries.map((entry) => ({
16796
16890
  workspace: entry.workspace,
16797
16891
  method: entry.method,
16798
- descriptionHash: entry.nameHash,
16799
- ...entry.name === void 0 ? {} : { description: entry.name },
16892
+ persistHash: entry.persistHash,
16893
+ ...entry.persist === void 0 ? {} : { persist: entry.persist },
16800
16894
  path: entry.path,
16801
16895
  ...entry.schemaHash === void 0 ? {} : { schemaHash: entry.schemaHash },
16802
16896
  createdAt: entry.createdAt,
@@ -16976,11 +17070,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
16976
17070
  input,
16977
17071
  options
16978
17072
  );
16979
- case "network.replay":
16980
- return runtime.replayNetwork(
16981
- input,
16982
- options
16983
- );
16984
17073
  case "interaction.capture":
16985
17074
  return runtime.captureInteraction(
16986
17075
  input,
@@ -17060,7 +17149,7 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
17060
17149
 
17061
17150
  // ../runtime-core/package.json
17062
17151
  var package_default = {
17063
- version: "0.1.6"};
17152
+ version: "0.1.7"};
17064
17153
 
17065
17154
  // ../runtime-core/src/version.ts
17066
17155
  var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
@@ -19090,7 +19179,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
19090
19179
  )
19091
19180
  );
19092
19181
  }
19093
- async function clearLiveCounters(engine, pageRef) {
19182
+ async function clearOpensteerLiveCounters(engine, pageRef) {
19094
19183
  const frames = await engine.listFrames({ pageRef });
19095
19184
  const failures = [];
19096
19185
  for (const frame of frames) {
@@ -19188,7 +19277,7 @@ async function compileOpensteerSnapshot(options) {
19188
19277
  engine: options.engine,
19189
19278
  pageRef: options.pageRef
19190
19279
  });
19191
- await clearLiveCounters(options.engine, options.pageRef);
19280
+ await clearOpensteerLiveCounters(options.engine, options.pageRef);
19192
19281
  await assignSparseCountersToLiveDom(options.engine, options.pageRef);
19193
19282
  const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
19194
19283
  const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
@@ -19225,7 +19314,7 @@ async function compileOpensteerSnapshot(options) {
19225
19314
  counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
19226
19315
  };
19227
19316
  } catch (error) {
19228
- await clearLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19317
+ await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
19229
19318
  if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
19230
19319
  lastCounterSyncError = error;
19231
19320
  continue;
@@ -21808,7 +21897,12 @@ var OpensteerSessionRuntime = class {
21808
21897
  includeBodies: true,
21809
21898
  redactSecretHeaders: false
21810
21899
  });
21811
- return this.buildNetworkDetail(record, timeout);
21900
+ const detail = await this.buildNetworkDetail(record, timeout);
21901
+ if (input.probe !== true) {
21902
+ return detail;
21903
+ }
21904
+ const transportProbe = await this.probeTransportsForRecord(record, timeout);
21905
+ return transportProbe === void 0 ? detail : { ...detail, transportProbe };
21812
21906
  },
21813
21907
  options
21814
21908
  );
@@ -21843,54 +21937,6 @@ var OpensteerSessionRuntime = class {
21843
21937
  throw error;
21844
21938
  }
21845
21939
  }
21846
- async replayNetwork(input, options = {}) {
21847
- const startedAt = Date.now();
21848
- try {
21849
- const output = await this.runWithOperationTimeout(
21850
- "network.replay",
21851
- async (timeout) => {
21852
- const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
21853
- includeBodies: true,
21854
- redactSecretHeaders: false
21855
- });
21856
- const replayRequest = buildReplayTransportRequest(source, input);
21857
- return this.executeNetworkReplay(source, replayRequest, timeout, {
21858
- ...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
21859
- });
21860
- },
21861
- options
21862
- );
21863
- await this.appendTrace({
21864
- operation: "network.replay",
21865
- startedAt,
21866
- completedAt: Date.now(),
21867
- outcome: "ok",
21868
- data: {
21869
- recordId: input.recordId,
21870
- transport: output.transport,
21871
- attempts: output.attempts.length
21872
- },
21873
- context: buildRuntimeTraceContext({
21874
- sessionRef: this.sessionRef,
21875
- pageRef: this.pageRef
21876
- })
21877
- });
21878
- return output;
21879
- } catch (error) {
21880
- await this.appendTrace({
21881
- operation: "network.replay",
21882
- startedAt,
21883
- completedAt: Date.now(),
21884
- outcome: "error",
21885
- error,
21886
- context: buildRuntimeTraceContext({
21887
- sessionRef: this.sessionRef,
21888
- pageRef: this.pageRef
21889
- })
21890
- });
21891
- throw error;
21892
- }
21893
- }
21894
21940
  async captureScripts(input = {}, options = {}) {
21895
21941
  assertValidSemanticOperationInput("scripts.capture", input);
21896
21942
  const pageRef = input.pageRef ?? await this.ensurePageRef();
@@ -22486,7 +22532,7 @@ var OpensteerSessionRuntime = class {
22486
22532
  completedAt: Date.now(),
22487
22533
  outcome: "ok",
22488
22534
  data: {
22489
- transport: output.transport,
22535
+ ...output.transport === void 0 ? {} : { transport: output.transport },
22490
22536
  attempts: output.attempts.length,
22491
22537
  ...output.response === void 0 ? {} : { status: output.response.status },
22492
22538
  url: input.url
@@ -22589,6 +22635,7 @@ var OpensteerSessionRuntime = class {
22589
22635
  });
22590
22636
  boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
22591
22637
  timeout.throwIfAborted();
22638
+ await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
22592
22639
  this.pageRef = output2.pageRef;
22593
22640
  const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
22594
22641
  return {
@@ -22778,7 +22825,7 @@ var OpensteerSessionRuntime = class {
22778
22825
  mutationCaptureDiagnostics = diagnostics;
22779
22826
  }
22780
22827
  );
22781
- const output = toOpensteerActionResult(executed.result, preparedTarget.persisted);
22828
+ const output = toOpensteerActionResult(executed.result);
22782
22829
  const actionEvents = "events" in executed.result ? executed.result.events : void 0;
22783
22830
  await this.appendTrace({
22784
22831
  operation,
@@ -22789,7 +22836,6 @@ var OpensteerSessionRuntime = class {
22789
22836
  data: {
22790
22837
  target: output.target,
22791
22838
  ...output.point === void 0 ? {} : { point: output.point },
22792
- ...output.persisted === void 0 ? {} : { persisted: output.persisted },
22793
22839
  ...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
22794
22840
  ...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
22795
22841
  },
@@ -22853,7 +22899,7 @@ var OpensteerSessionRuntime = class {
22853
22899
  await timeout.runStep(
22854
22900
  () => this.requireDom().writeDescriptor({
22855
22901
  method,
22856
- name: persist,
22902
+ persist,
22857
22903
  path: stablePath2,
22858
22904
  sourceUrl: resolved2.snapshot.url
22859
22905
  })
@@ -22861,9 +22907,8 @@ var OpensteerSessionRuntime = class {
22861
22907
  return {
22862
22908
  target: {
22863
22909
  kind: "descriptor",
22864
- name: persist
22865
- },
22866
- persisted: persist
22910
+ persist
22911
+ }
22867
22912
  };
22868
22913
  }
22869
22914
  const resolved = await timeout.runStep(
@@ -22886,7 +22931,7 @@ var OpensteerSessionRuntime = class {
22886
22931
  await timeout.runStep(
22887
22932
  () => this.requireDom().writeDescriptor({
22888
22933
  method,
22889
- name: persist,
22934
+ persist,
22890
22935
  path: stablePath,
22891
22936
  sourceUrl: resolved.snapshot.url
22892
22937
  })
@@ -22894,9 +22939,8 @@ var OpensteerSessionRuntime = class {
22894
22939
  return {
22895
22940
  target: {
22896
22941
  kind: "descriptor",
22897
- name: persist
22898
- },
22899
- persisted: persist
22942
+ persist
22943
+ }
22900
22944
  };
22901
22945
  }
22902
22946
  async queryLiveNetwork(input, timeout, options = {}) {
@@ -22952,6 +22996,18 @@ var OpensteerSessionRuntime = class {
22952
22996
  const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
22953
22997
  return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
22954
22998
  }
22999
+ async invalidateLiveSnapshotCounters(pageRefs, timeout) {
23000
+ const engine = this.requireEngine();
23001
+ for (const pageRef of new Set(pageRefs)) {
23002
+ try {
23003
+ await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
23004
+ } catch (error) {
23005
+ if (!isIgnorableRuntimeBindingError(error)) {
23006
+ throw error;
23007
+ }
23008
+ }
23009
+ }
23010
+ }
22955
23011
  async captureScriptsInternal(pageRef, input, timeout) {
22956
23012
  const root = await this.ensureRoot();
22957
23013
  const evaluated = await timeout.runStep(
@@ -23281,6 +23337,42 @@ var OpensteerSessionRuntime = class {
23281
23337
  ...notes.length === 0 ? {} : { notes }
23282
23338
  };
23283
23339
  }
23340
+ async probeTransportsForRecord(record, timeout) {
23341
+ if (record.record.status === void 0) {
23342
+ return void 0;
23343
+ }
23344
+ const request = buildReplayTransportRequest(record, { recordId: record.recordId });
23345
+ const fingerprint = buildCapturedRecordSuccessFingerprint(record);
23346
+ const attempts = [];
23347
+ let recommended;
23348
+ for (const transport of REPLAY_TRANSPORT_LADDER) {
23349
+ const attemptStartedAt = Date.now();
23350
+ try {
23351
+ const output = await this.executeReplayTransportAttempt(transport, request, timeout);
23352
+ const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
23353
+ attempts.push({
23354
+ transport,
23355
+ status: output.response.status,
23356
+ ok,
23357
+ durationMs: Date.now() - attemptStartedAt
23358
+ });
23359
+ if (ok && recommended === void 0) {
23360
+ recommended = transport;
23361
+ }
23362
+ } catch (error) {
23363
+ attempts.push({
23364
+ transport,
23365
+ ok: false,
23366
+ durationMs: Date.now() - attemptStartedAt,
23367
+ error: normalizeRuntimeErrorMessage(error)
23368
+ });
23369
+ }
23370
+ }
23371
+ return {
23372
+ ...recommended === void 0 ? {} : { recommended },
23373
+ attempts
23374
+ };
23375
+ }
23284
23376
  async buildRedirectChain(record, timeout) {
23285
23377
  if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
23286
23378
  return {};
@@ -23399,57 +23491,6 @@ var OpensteerSessionRuntime = class {
23399
23491
  })
23400
23492
  };
23401
23493
  }
23402
- async executeNetworkReplay(source, request, timeout, options) {
23403
- const fingerprint = buildCapturedRecordSuccessFingerprint(source);
23404
- const attempts = [];
23405
- let lastOutput;
23406
- for (const transport of REPLAY_TRANSPORT_LADDER) {
23407
- const attemptStartedAt = Date.now();
23408
- try {
23409
- const output = await this.executeReplayTransportAttempt(
23410
- transport,
23411
- request,
23412
- timeout,
23413
- options.pageRef
23414
- );
23415
- lastOutput = output;
23416
- const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
23417
- attempts.push({
23418
- transport,
23419
- status: output.response.status,
23420
- ok,
23421
- durationMs: Date.now() - attemptStartedAt
23422
- });
23423
- if (ok) {
23424
- const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
23425
- const previewData2 = toStructuredPreviewData(output.data);
23426
- return {
23427
- recordId: source.recordId,
23428
- transport,
23429
- attempts,
23430
- response: output.response,
23431
- ...previewData2 === void 0 ? {} : { data: previewData2 },
23432
- ...fallbackNote === void 0 ? {} : { note: fallbackNote }
23433
- };
23434
- }
23435
- } catch (error) {
23436
- attempts.push({
23437
- transport,
23438
- ok: false,
23439
- durationMs: Date.now() - attemptStartedAt,
23440
- error: normalizeRuntimeErrorMessage(error)
23441
- });
23442
- }
23443
- }
23444
- const previewData = toStructuredPreviewData(lastOutput?.data);
23445
- return {
23446
- recordId: source.recordId,
23447
- attempts,
23448
- ...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
23449
- ...previewData === void 0 ? {} : { data: previewData },
23450
- note: "all replay transports failed to reproduce the captured response"
23451
- };
23452
- }
23453
23494
  async executeSessionFetch(request, input, timeout) {
23454
23495
  const attempts = [];
23455
23496
  let lastOutput;
@@ -24077,7 +24118,7 @@ var OpensteerSessionRuntime = class {
24077
24118
  if (target.kind === "persist") {
24078
24119
  return {
24079
24120
  kind: "descriptor",
24080
- name: target.name
24121
+ persist: target.persist
24081
24122
  };
24082
24123
  }
24083
24124
  if (target.kind === "selector") {
@@ -25794,7 +25835,7 @@ function normalizeNamespace2(value) {
25794
25835
  const normalized = String(value ?? "default").trim();
25795
25836
  return normalized.length === 0 ? "default" : normalized;
25796
25837
  }
25797
- function toOpensteerActionResult(result, persisted) {
25838
+ function toOpensteerActionResult(result) {
25798
25839
  return {
25799
25840
  target: toOpensteerResolvedTarget2(result.resolved),
25800
25841
  ...result.point === void 0 ? {} : {
@@ -25802,8 +25843,7 @@ function toOpensteerActionResult(result, persisted) {
25802
25843
  x: result.point.x,
25803
25844
  y: result.point.y
25804
25845
  }
25805
- },
25806
- ...persisted === void 0 ? {} : { persisted }
25846
+ }
25807
25847
  };
25808
25848
  }
25809
25849
  function toOpensteerResolvedTarget2(target) {
@@ -28376,10 +28416,6 @@ var CloudSessionProxy = class {
28376
28416
  await this.ensureSession();
28377
28417
  return this.requireClient().invoke("network.detail", input);
28378
28418
  }
28379
- async replayNetwork(input) {
28380
- await this.ensureSession();
28381
- return this.requireClient().invoke("network.replay", input);
28382
- }
28383
28419
  async captureInteraction(input) {
28384
28420
  await this.ensureSession();
28385
28421
  return this.requireClient().invoke("interaction.capture", input);
@@ -28818,109 +28854,7 @@ function createOpensteerSemanticRuntime(input = {}) {
28818
28854
  engineName: engine
28819
28855
  });
28820
28856
  }
28821
- var ENV_FILENAMES = [".env", ".env.local"];
28822
- var OPENSTEER_ENV_PREFIX = "OPENSTEER_";
28823
- var opensteerEnvironmentCache = /* @__PURE__ */ new Map();
28824
- function resolveOpensteerEnvironment(cwd = process.cwd(), baseEnv = process.env) {
28825
- const resolvedCwd = path7.resolve(cwd);
28826
- const signature = buildEnvironmentSignature(baseEnv, isOpensteerEnvironmentKey);
28827
- const cached = opensteerEnvironmentCache.get(resolvedCwd);
28828
- if (cached && cached.signature === signature) {
28829
- return { ...cached.values };
28830
- }
28831
- const resolved = resolveEnvironmentFiles(resolvedCwd, baseEnv, isOpensteerEnvironmentKey);
28832
- opensteerEnvironmentCache.set(resolvedCwd, {
28833
- signature,
28834
- values: { ...resolved }
28835
- });
28836
- return { ...resolved };
28837
- }
28838
- function loadEnvironment(cwd = process.cwd()) {
28839
- const resolved = resolveEnvironmentFiles(path7.resolve(cwd), process.env);
28840
- for (const [key, value] of Object.entries(resolved)) {
28841
- process.env[key] = value;
28842
- }
28843
- }
28844
- function collectDirectories(cwd) {
28845
- const directories = [];
28846
- let current = path7.resolve(cwd);
28847
- for (; ; ) {
28848
- directories.unshift(current);
28849
- const parent = path7.dirname(current);
28850
- if (parent === current) {
28851
- return directories;
28852
- }
28853
- current = parent;
28854
- }
28855
- }
28856
- function parseEnvFile(contents) {
28857
- const parsed = {};
28858
- for (const rawLine of contents.split(/\r?\n/u)) {
28859
- const trimmed = rawLine.trim();
28860
- if (!trimmed || trimmed.startsWith("#")) {
28861
- continue;
28862
- }
28863
- const line = trimmed.startsWith("export ") ? trimmed.slice("export ".length) : trimmed;
28864
- const separatorIndex = line.indexOf("=");
28865
- if (separatorIndex <= 0) {
28866
- continue;
28867
- }
28868
- const key = line.slice(0, separatorIndex).trim();
28869
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) {
28870
- continue;
28871
- }
28872
- const rawValue = line.slice(separatorIndex + 1).trim();
28873
- parsed[key] = parseEnvValue(rawValue);
28874
- }
28875
- return parsed;
28876
- }
28877
- function parseEnvValue(rawValue) {
28878
- if (rawValue.length >= 2 && rawValue.startsWith('"') && rawValue.endsWith('"')) {
28879
- return rawValue.slice(1, -1).replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\t/g, " ").replace(/\\"/g, '"');
28880
- }
28881
- if (rawValue.length >= 2 && rawValue.startsWith("'") && rawValue.endsWith("'")) {
28882
- return rawValue.slice(1, -1);
28883
- }
28884
- return rawValue.replace(/\s+#.*$/u, "").trimEnd();
28885
- }
28886
- function resolveEnvironmentFiles(cwd, baseEnv, predicate) {
28887
- const resolved = collectEnvironment(baseEnv, predicate);
28888
- const protectedKeys = new Set(Object.keys(resolved));
28889
- const directories = collectDirectories(cwd);
28890
- for (const directory of directories) {
28891
- for (const filename of ENV_FILENAMES) {
28892
- const filePath = path7.join(directory, filename);
28893
- if (!existsSync(filePath)) {
28894
- continue;
28895
- }
28896
- const parsed = parseEnvFile(readFileSync(filePath, "utf8"));
28897
- for (const [key, value] of Object.entries(parsed)) {
28898
- if (predicate && !predicate(key) || protectedKeys.has(key)) {
28899
- continue;
28900
- }
28901
- resolved[key] = value;
28902
- }
28903
- }
28904
- }
28905
- return resolved;
28906
- }
28907
- function collectEnvironment(baseEnv, predicate) {
28908
- const resolved = {};
28909
- for (const [key, value] of Object.entries(baseEnv)) {
28910
- if (predicate && !predicate(key) || value === void 0) {
28911
- continue;
28912
- }
28913
- resolved[key] = value;
28914
- }
28915
- return resolved;
28916
- }
28917
- function buildEnvironmentSignature(baseEnv, predicate) {
28918
- return Object.entries(baseEnv).filter(([key, value]) => predicate(key) && value !== void 0).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey)).map(([key, value]) => `${key}=${value}`).join("\n");
28919
- }
28920
- function isOpensteerEnvironmentKey(key) {
28921
- return key.startsWith(OPENSTEER_ENV_PREFIX);
28922
- }
28923
28857
 
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
28858
+ 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 };
28859
+ //# sourceMappingURL=chunk-KBO7DDPF.js.map
28860
+ //# sourceMappingURL=chunk-KBO7DDPF.js.map