opensteer 0.9.0 → 0.9.2

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.
Files changed (39) hide show
  1. package/README.md +0 -3
  2. package/dist/chunk-2TIVULZY.js +4103 -0
  3. package/dist/chunk-2TIVULZY.js.map +1 -0
  4. package/dist/chunk-BMPUL66S.js +1170 -0
  5. package/dist/chunk-BMPUL66S.js.map +1 -0
  6. package/dist/chunk-FIMNKEG5.js +1800 -0
  7. package/dist/chunk-FIMNKEG5.js.map +1 -0
  8. package/dist/{chunk-656MQUSM.js → chunk-HD6KVZ42.js} +6080 -12739
  9. package/dist/chunk-HD6KVZ42.js.map +1 -0
  10. package/dist/{chunk-OIKLSFXA.js → chunk-KPYLS2KQ.js} +5 -35
  11. package/dist/chunk-KPYLS2KQ.js.map +1 -0
  12. package/dist/cli/bin.cjs +7436 -6861
  13. package/dist/cli/bin.cjs.map +1 -1
  14. package/dist/cli/bin.js +124 -7
  15. package/dist/cli/bin.js.map +1 -1
  16. package/dist/index.cjs +1048 -2584
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +60 -757
  19. package/dist/index.d.ts +60 -757
  20. package/dist/index.js +4 -2
  21. package/dist/local-view/public/assets/app.css +770 -0
  22. package/dist/local-view/public/assets/app.js +2053 -0
  23. package/dist/local-view/public/index.html +235 -0
  24. package/dist/local-view/serve-entry.cjs +7203 -0
  25. package/dist/local-view/serve-entry.cjs.map +1 -0
  26. package/dist/local-view/serve-entry.d.cts +1 -0
  27. package/dist/local-view/serve-entry.d.ts +1 -0
  28. package/dist/local-view/serve-entry.js +23 -0
  29. package/dist/local-view/serve-entry.js.map +1 -0
  30. package/dist/opensteer-MIQ43CY4.js +6 -0
  31. package/dist/{opensteer-LKX3233A.js.map → opensteer-MIQ43CY4.js.map} +1 -1
  32. package/dist/session-control-IFE3IPS3.js +39 -0
  33. package/dist/session-control-IFE3IPS3.js.map +1 -0
  34. package/package.json +8 -8
  35. package/skills/README.md +3 -0
  36. package/skills/opensteer/SKILL.md +230 -49
  37. package/dist/chunk-656MQUSM.js.map +0 -1
  38. package/dist/chunk-OIKLSFXA.js.map +0 -1
  39. package/dist/opensteer-LKX3233A.js +0 -4
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var path7 = require('path');
3
+ var path10 = require('path');
4
4
  var crypto = require('crypto');
5
5
  var promises = require('fs/promises');
6
6
  var url = require('url');
@@ -10,6 +10,7 @@ var os = require('os');
10
10
  var enginePlaywright = require('@opensteer/engine-playwright');
11
11
  var util = require('util');
12
12
  var fs = require('fs');
13
+ var module$1 = require('module');
13
14
  var zlib = require('zlib');
14
15
  var async_hooks = require('async_hooks');
15
16
  var sharp = require('sharp');
@@ -18,6 +19,7 @@ var prettier = require('prettier');
18
19
  var vm = require('vm');
19
20
  var WebSocket2 = require('ws');
20
21
 
22
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
21
23
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
22
24
 
23
25
  function _interopNamespace(e) {
@@ -38,7 +40,7 @@ function _interopNamespace(e) {
38
40
  return Object.freeze(n);
39
41
  }
40
42
 
41
- var path7__default = /*#__PURE__*/_interopDefault(path7);
43
+ var path10__default = /*#__PURE__*/_interopDefault(path10);
42
44
  var sharp__default = /*#__PURE__*/_interopDefault(sharp);
43
45
  var cheerio__namespace = /*#__PURE__*/_interopNamespace(cheerio);
44
46
  var prettier__namespace = /*#__PURE__*/_interopNamespace(prettier);
@@ -60,30 +62,30 @@ function isPlainObject(value) {
60
62
  const prototype = Object.getPrototypeOf(value);
61
63
  return prototype === Object.prototype || prototype === null;
62
64
  }
63
- function canonicalizeJsonValue(value, path15) {
65
+ function canonicalizeJsonValue(value, path18) {
64
66
  if (value === null || typeof value === "string" || typeof value === "boolean") {
65
67
  return value;
66
68
  }
67
69
  if (typeof value === "number") {
68
70
  if (!Number.isFinite(value)) {
69
- throw new TypeError(`${path15} must be a finite JSON number`);
71
+ throw new TypeError(`${path18} must be a finite JSON number`);
70
72
  }
71
73
  return value;
72
74
  }
73
75
  if (Array.isArray(value)) {
74
- return value.map((entry, index) => canonicalizeJsonValue(entry, `${path15}[${index}]`));
76
+ return value.map((entry, index) => canonicalizeJsonValue(entry, `${path18}[${index}]`));
75
77
  }
76
78
  if (!isPlainObject(value)) {
77
- throw new TypeError(`${path15} must be a plain JSON object`);
79
+ throw new TypeError(`${path18} must be a plain JSON object`);
78
80
  }
79
81
  const sorted = Object.keys(value).sort((left, right) => left.localeCompare(right));
80
82
  const result = {};
81
83
  for (const key of sorted) {
82
84
  const entry = value[key];
83
85
  if (entry === void 0) {
84
- throw new TypeError(`${path15}.${key} must not be undefined`);
86
+ throw new TypeError(`${path18}.${key} must not be undefined`);
85
87
  }
86
- result[key] = canonicalizeJsonValue(entry, `${path15}.${key}`);
88
+ result[key] = canonicalizeJsonValue(entry, `${path18}.${key}`);
87
89
  }
88
90
  return result;
89
91
  }
@@ -120,7 +122,7 @@ function joinStoragePath(...segments) {
120
122
  return segments.join("/");
121
123
  }
122
124
  function resolveStoragePath(rootPath, relativePath) {
123
- if (path7__default.default.isAbsolute(relativePath)) {
125
+ if (path10__default.default.isAbsolute(relativePath)) {
124
126
  throw new TypeError(`storage path ${relativePath} must be relative`);
125
127
  }
126
128
  const segments = relativePath.split("/");
@@ -132,7 +134,7 @@ function resolveStoragePath(rootPath, relativePath) {
132
134
  throw new TypeError(`storage path ${relativePath} must not contain path traversal`);
133
135
  }
134
136
  }
135
- return path7__default.default.join(rootPath, ...segments);
137
+ return path10__default.default.join(rootPath, ...segments);
136
138
  }
137
139
  async function ensureDirectory(directoryPath) {
138
140
  await promises.mkdir(directoryPath, { recursive: true });
@@ -152,7 +154,7 @@ async function writeJsonFileAtomic(filePath, value) {
152
154
  await writeTextFileAtomic(filePath, stableJsonString(value));
153
155
  }
154
156
  async function writeTextFileAtomic(filePath, value) {
155
- await ensureDirectory(path7__default.default.dirname(filePath));
157
+ await ensureDirectory(path10__default.default.dirname(filePath));
156
158
  const temporaryPath = `${filePath}.${crypto.randomUUID()}.tmp`;
157
159
  await promises.writeFile(temporaryPath, value, "utf8");
158
160
  await promises.rename(temporaryPath, filePath);
@@ -161,7 +163,7 @@ async function writeJsonFileExclusive(filePath, value) {
161
163
  await writeTextFileExclusive(filePath, stableJsonString(value));
162
164
  }
163
165
  async function writeTextFileExclusive(filePath, value) {
164
- await ensureDirectory(path7__default.default.dirname(filePath));
166
+ await ensureDirectory(path10__default.default.dirname(filePath));
165
167
  const handle = await promises.open(filePath, "wx");
166
168
  try {
167
169
  await handle.writeFile(value, "utf8");
@@ -170,7 +172,7 @@ async function writeTextFileExclusive(filePath, value) {
170
172
  }
171
173
  }
172
174
  async function writeBufferIfMissing(filePath, value) {
173
- await ensureDirectory(path7__default.default.dirname(filePath));
175
+ await ensureDirectory(path10__default.default.dirname(filePath));
174
176
  try {
175
177
  const handle = await promises.open(filePath, "wx");
176
178
  try {
@@ -204,7 +206,7 @@ function isAlreadyExistsError(error) {
204
206
  return error?.code === "EEXIST";
205
207
  }
206
208
  async function withFilesystemLock(lockPath, task) {
207
- await ensureDirectory(path7__default.default.dirname(lockPath));
209
+ await ensureDirectory(path10__default.default.dirname(lockPath));
208
210
  let attempt = 0;
209
211
  while (true) {
210
212
  try {
@@ -259,8 +261,8 @@ async function readStructuredPayload(objectPath) {
259
261
  var FilesystemArtifactStore = class {
260
262
  constructor(rootPath) {
261
263
  this.rootPath = rootPath;
262
- this.manifestsDirectory = path7__default.default.join(this.rootPath, "artifacts", "manifests");
263
- this.objectsDirectory = path7__default.default.join(this.rootPath, "artifacts", "objects", "sha256");
264
+ this.manifestsDirectory = path10__default.default.join(this.rootPath, "artifacts", "manifests");
265
+ this.objectsDirectory = path10__default.default.join(this.rootPath, "artifacts", "objects", "sha256");
264
266
  }
265
267
  manifestsDirectory;
266
268
  objectsDirectory;
@@ -485,7 +487,7 @@ var FilesystemArtifactStore = class {
485
487
  }
486
488
  }
487
489
  manifestPath(artifactId) {
488
- return path7__default.default.join(this.manifestsDirectory, `${encodePathSegment(artifactId)}.json`);
490
+ return path10__default.default.join(this.manifestsDirectory, `${encodePathSegment(artifactId)}.json`);
489
491
  }
490
492
  };
491
493
  function createArtifactStore(rootPath) {
@@ -580,31 +582,31 @@ function oneOfSchema(members, options = {}) {
580
582
  }
581
583
 
582
584
  // ../protocol/src/validation.ts
583
- function validateJsonSchema(schema, value, path15 = "$") {
584
- return validateSchemaNode(schema, value, path15);
585
+ function validateJsonSchema(schema, value, path18 = "$") {
586
+ return validateSchemaNode(schema, value, path18);
585
587
  }
586
- function validateSchemaNode(schema, value, path15) {
588
+ function validateSchemaNode(schema, value, path18) {
587
589
  const issues = [];
588
590
  if ("const" in schema && !isJsonValueEqual(schema.const, value)) {
589
591
  issues.push({
590
- path: path15,
592
+ path: path18,
591
593
  message: `must equal ${JSON.stringify(schema.const)}`
592
594
  });
593
595
  return issues;
594
596
  }
595
597
  if (schema.enum !== void 0 && !schema.enum.some((candidate) => isJsonValueEqual(candidate, value))) {
596
598
  issues.push({
597
- path: path15,
599
+ path: path18,
598
600
  message: `must be one of ${schema.enum.map((candidate) => JSON.stringify(candidate)).join(", ")}`
599
601
  });
600
602
  return issues;
601
603
  }
602
604
  if (schema.oneOf !== void 0) {
603
- const branchIssues = schema.oneOf.map((member) => validateSchemaNode(member, value, path15));
605
+ const branchIssues = schema.oneOf.map((member) => validateSchemaNode(member, value, path18));
604
606
  const validBranches = branchIssues.filter((current) => current.length === 0).length;
605
607
  if (validBranches !== 1) {
606
608
  issues.push({
607
- path: path15,
609
+ path: path18,
608
610
  message: validBranches === 0 ? "must match exactly one supported shape" : "matches multiple supported shapes"
609
611
  });
610
612
  return issues;
@@ -612,11 +614,11 @@ function validateSchemaNode(schema, value, path15) {
612
614
  }
613
615
  if (schema.anyOf !== void 0) {
614
616
  const hasMatch = schema.anyOf.some(
615
- (member) => validateSchemaNode(member, value, path15).length === 0
617
+ (member) => validateSchemaNode(member, value, path18).length === 0
616
618
  );
617
619
  if (!hasMatch) {
618
620
  issues.push({
619
- path: path15,
621
+ path: path18,
620
622
  message: "must match at least one supported shape"
621
623
  });
622
624
  return issues;
@@ -624,7 +626,7 @@ function validateSchemaNode(schema, value, path15) {
624
626
  }
625
627
  if (schema.allOf !== void 0) {
626
628
  for (const member of schema.allOf) {
627
- issues.push(...validateSchemaNode(member, value, path15));
629
+ issues.push(...validateSchemaNode(member, value, path18));
628
630
  }
629
631
  if (issues.length > 0) {
630
632
  return issues;
@@ -632,7 +634,7 @@ function validateSchemaNode(schema, value, path15) {
632
634
  }
633
635
  if (schema.type !== void 0 && !matchesSchemaType(schema.type, value)) {
634
636
  issues.push({
635
- path: path15,
637
+ path: path18,
636
638
  message: `must be ${describeSchemaType(schema.type)}`
637
639
  });
638
640
  return issues;
@@ -640,19 +642,19 @@ function validateSchemaNode(schema, value, path15) {
640
642
  if (typeof value === "string") {
641
643
  if (schema.minLength !== void 0 && value.length < schema.minLength) {
642
644
  issues.push({
643
- path: path15,
645
+ path: path18,
644
646
  message: `must have length >= ${String(schema.minLength)}`
645
647
  });
646
648
  }
647
649
  if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
648
650
  issues.push({
649
- path: path15,
651
+ path: path18,
650
652
  message: `must have length <= ${String(schema.maxLength)}`
651
653
  });
652
654
  }
653
655
  if (schema.pattern !== void 0 && !new RegExp(schema.pattern).test(value)) {
654
656
  issues.push({
655
- path: path15,
657
+ path: path18,
656
658
  message: `must match pattern ${schema.pattern}`
657
659
  });
658
660
  }
@@ -661,25 +663,25 @@ function validateSchemaNode(schema, value, path15) {
661
663
  if (typeof value === "number") {
662
664
  if (schema.minimum !== void 0 && value < schema.minimum) {
663
665
  issues.push({
664
- path: path15,
666
+ path: path18,
665
667
  message: `must be >= ${String(schema.minimum)}`
666
668
  });
667
669
  }
668
670
  if (schema.maximum !== void 0 && value > schema.maximum) {
669
671
  issues.push({
670
- path: path15,
672
+ path: path18,
671
673
  message: `must be <= ${String(schema.maximum)}`
672
674
  });
673
675
  }
674
676
  if (schema.exclusiveMinimum !== void 0 && value <= schema.exclusiveMinimum) {
675
677
  issues.push({
676
- path: path15,
678
+ path: path18,
677
679
  message: `must be > ${String(schema.exclusiveMinimum)}`
678
680
  });
679
681
  }
680
682
  if (schema.exclusiveMaximum !== void 0 && value >= schema.exclusiveMaximum) {
681
683
  issues.push({
682
- path: path15,
684
+ path: path18,
683
685
  message: `must be < ${String(schema.exclusiveMaximum)}`
684
686
  });
685
687
  }
@@ -688,13 +690,13 @@ function validateSchemaNode(schema, value, path15) {
688
690
  if (Array.isArray(value)) {
689
691
  if (schema.minItems !== void 0 && value.length < schema.minItems) {
690
692
  issues.push({
691
- path: path15,
693
+ path: path18,
692
694
  message: `must have at least ${String(schema.minItems)} items`
693
695
  });
694
696
  }
695
697
  if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
696
698
  issues.push({
697
- path: path15,
699
+ path: path18,
698
700
  message: `must have at most ${String(schema.maxItems)} items`
699
701
  });
700
702
  }
@@ -704,7 +706,7 @@ function validateSchemaNode(schema, value, path15) {
704
706
  const key = JSON.stringify(item);
705
707
  if (seen.has(key)) {
706
708
  issues.push({
707
- path: path15,
709
+ path: path18,
708
710
  message: "must not contain duplicate items"
709
711
  });
710
712
  break;
@@ -714,7 +716,7 @@ function validateSchemaNode(schema, value, path15) {
714
716
  }
715
717
  if (schema.items !== void 0) {
716
718
  for (let index = 0; index < value.length; index += 1) {
717
- issues.push(...validateSchemaNode(schema.items, value[index], `${path15}[${String(index)}]`));
719
+ issues.push(...validateSchemaNode(schema.items, value[index], `${path18}[${String(index)}]`));
718
720
  }
719
721
  }
720
722
  return issues;
@@ -724,7 +726,7 @@ function validateSchemaNode(schema, value, path15) {
724
726
  for (const requiredKey of schema.required ?? []) {
725
727
  if (!(requiredKey in value)) {
726
728
  issues.push({
727
- path: joinObjectPath(path15, requiredKey),
729
+ path: joinObjectPath(path18, requiredKey),
728
730
  message: "is required"
729
731
  });
730
732
  }
@@ -733,13 +735,13 @@ function validateSchemaNode(schema, value, path15) {
733
735
  const propertySchema = properties[key];
734
736
  if (propertySchema !== void 0) {
735
737
  issues.push(
736
- ...validateSchemaNode(propertySchema, propertyValue, joinObjectPath(path15, key))
738
+ ...validateSchemaNode(propertySchema, propertyValue, joinObjectPath(path18, key))
737
739
  );
738
740
  continue;
739
741
  }
740
742
  if (schema.additionalProperties === false) {
741
743
  issues.push({
742
- path: joinObjectPath(path15, key),
744
+ path: joinObjectPath(path18, key),
743
745
  message: "is not allowed"
744
746
  });
745
747
  continue;
@@ -749,7 +751,7 @@ function validateSchemaNode(schema, value, path15) {
749
751
  ...validateSchemaNode(
750
752
  schema.additionalProperties,
751
753
  propertyValue,
752
- joinObjectPath(path15, key)
754
+ joinObjectPath(path18, key)
753
755
  )
754
756
  );
755
757
  }
@@ -993,8 +995,8 @@ function matchesNetworkRecordFilters(record, filters) {
993
995
  }
994
996
  }
995
997
  if (filters.path !== void 0) {
996
- const path15 = getParsedUrl().pathname;
997
- if (!includesCaseInsensitive(path15, filters.path)) {
998
+ const path18 = getParsedUrl().pathname;
999
+ if (!includesCaseInsensitive(path18, filters.path)) {
998
1000
  return false;
999
1001
  }
1000
1002
  }
@@ -1487,55 +1489,6 @@ arraySchema(headerEntrySchema, {
1487
1489
  title: "OrderedHeaders"
1488
1490
  });
1489
1491
 
1490
- // ../protocol/src/captcha.ts
1491
- var captchaTypeSchema = enumSchema(
1492
- ["recaptcha-v2", "hcaptcha", "turnstile"],
1493
- {
1494
- title: "CaptchaType"
1495
- }
1496
- );
1497
- var captchaProviderSchema = enumSchema(["2captcha", "capsolver"], {
1498
- title: "CaptchaProvider"
1499
- });
1500
- var captchaDetectionResultSchema = objectSchema(
1501
- {
1502
- type: captchaTypeSchema,
1503
- siteKey: stringSchema({ minLength: 1 }),
1504
- pageUrl: stringSchema({ minLength: 1 })
1505
- },
1506
- {
1507
- title: "CaptchaDetectionResult",
1508
- required: ["type", "siteKey", "pageUrl"]
1509
- }
1510
- );
1511
- var opensteerCaptchaSolveInputSchema = objectSchema(
1512
- {
1513
- provider: captchaProviderSchema,
1514
- apiKey: stringSchema({ minLength: 1 }),
1515
- pageRef: pageRefSchema,
1516
- timeoutMs: integerSchema({ minimum: 1 }),
1517
- type: captchaTypeSchema,
1518
- siteKey: stringSchema({ minLength: 1 }),
1519
- pageUrl: stringSchema({ minLength: 1 })
1520
- },
1521
- {
1522
- title: "OpensteerCaptchaSolveInput",
1523
- required: ["provider", "apiKey"]
1524
- }
1525
- );
1526
- var opensteerCaptchaSolveOutputSchema = objectSchema(
1527
- {
1528
- captcha: captchaDetectionResultSchema,
1529
- token: stringSchema({ minLength: 1 }),
1530
- injected: { type: "boolean" },
1531
- provider: captchaProviderSchema
1532
- },
1533
- {
1534
- title: "OpensteerCaptchaSolveOutput",
1535
- required: ["captcha", "token", "injected", "provider"]
1536
- }
1537
- );
1538
-
1539
1492
  // ../protocol/src/storage.ts
1540
1493
  var jsonUnknownSchema = {};
1541
1494
  var cookieSameSiteSchema = enumSchema(["strict", "lax", "none"], {
@@ -1788,16 +1741,6 @@ var opensteerRequestPlanResponseExpectationSchema = objectSchema(
1788
1741
  required: ["status"]
1789
1742
  }
1790
1743
  );
1791
- var opensteerRecipeRefSchema = objectSchema(
1792
- {
1793
- key: stringSchema({ minLength: 1 }),
1794
- version: stringSchema({ minLength: 1 })
1795
- },
1796
- {
1797
- title: "OpensteerRecipeRef",
1798
- required: ["key"]
1799
- }
1800
- );
1801
1744
  var opensteerRequestFailurePolicyHeaderMatchSchema = objectSchema(
1802
1745
  {
1803
1746
  name: stringSchema({ minLength: 1 }),
@@ -1853,46 +1796,9 @@ var opensteerRequestRetryPolicySchema = objectSchema(
1853
1796
  required: ["maxRetries"]
1854
1797
  }
1855
1798
  );
1856
- var opensteerRecipeCachePolicySchema = enumSchema(
1857
- ["none", "untilFailure"],
1858
- {
1859
- title: "OpensteerRecipeCachePolicy"
1860
- }
1861
- );
1862
- var opensteerRequestPlanRecipeBindingSchema = objectSchema(
1863
- {
1864
- recipe: opensteerRecipeRefSchema,
1865
- cachePolicy: opensteerRecipeCachePolicySchema
1866
- },
1867
- {
1868
- title: "OpensteerRequestPlanRecipeBinding",
1869
- required: ["recipe"]
1870
- }
1871
- );
1872
- var opensteerRequestPlanRecoverBindingSchema = objectSchema(
1873
- {
1874
- recipe: opensteerRecipeRefSchema,
1875
- cachePolicy: opensteerRecipeCachePolicySchema,
1876
- failurePolicy: opensteerRequestFailurePolicySchema
1877
- },
1878
- {
1879
- title: "OpensteerRequestPlanRecoverBinding",
1880
- required: ["recipe", "failurePolicy"]
1881
- }
1882
- );
1883
- var opensteerRequestPlanRecipesSchema = objectSchema(
1884
- {
1885
- prepare: opensteerRequestPlanRecipeBindingSchema,
1886
- recover: opensteerRequestPlanRecoverBindingSchema
1887
- },
1888
- {
1889
- title: "OpensteerRequestPlanRecipes"
1890
- }
1891
- );
1892
1799
  var opensteerRequestPlanAuthSchema = objectSchema(
1893
1800
  {
1894
1801
  strategy: enumSchema(["session-cookie", "bearer-token", "api-key", "custom"]),
1895
- recipe: opensteerRecipeRefSchema,
1896
1802
  failurePolicy: opensteerRequestFailurePolicySchema,
1897
1803
  description: stringSchema({ minLength: 1 })
1898
1804
  },
@@ -1908,7 +1814,6 @@ var opensteerRequestPlanPayloadSchema = objectSchema(
1908
1814
  parameters: arraySchema(opensteerRequestPlanParameterSchema),
1909
1815
  body: opensteerRequestPlanBodySchema,
1910
1816
  response: opensteerRequestPlanResponseExpectationSchema,
1911
- recipes: opensteerRequestPlanRecipesSchema,
1912
1817
  retryPolicy: opensteerRequestRetryPolicySchema,
1913
1818
  auth: opensteerRequestPlanAuthSchema
1914
1819
  },
@@ -1999,317 +1904,6 @@ var opensteerRequestBodyInputSchema = oneOfSchema(
1999
1904
  title: "OpensteerRequestBodyInput"
2000
1905
  }
2001
1906
  );
2002
- var opensteerRecipeRetryOverridesSchema = objectSchema(
2003
- {
2004
- params: recordSchema(stringSchema(), {
2005
- title: "OpensteerRecipeParams"
2006
- }),
2007
- headers: recordSchema(stringSchema(), {
2008
- title: "OpensteerRecipeHeaders"
2009
- }),
2010
- query: recordSchema(stringSchema(), {
2011
- title: "OpensteerRecipeQuery"
2012
- }),
2013
- body: recordSchema(stringSchema(), {
2014
- title: "OpensteerRecipeBodyVariables"
2015
- })
2016
- },
2017
- {
2018
- title: "OpensteerRecipeRetryOverrides"
2019
- }
2020
- );
2021
- var opensteerRecipeStepResponseCaptureSchema = objectSchema(
2022
- {
2023
- header: objectSchema(
2024
- {
2025
- name: stringSchema({ minLength: 1 }),
2026
- saveAs: stringSchema({ minLength: 1 })
2027
- },
2028
- {
2029
- title: "OpensteerAuthRecipeHeaderCapture",
2030
- required: ["name", "saveAs"]
2031
- }
2032
- ),
2033
- bodyJsonPointer: objectSchema(
2034
- {
2035
- pointer: stringSchema({ minLength: 1 }),
2036
- saveAs: stringSchema({ minLength: 1 })
2037
- },
2038
- {
2039
- title: "OpensteerAuthRecipeBodyJsonPointerCapture",
2040
- required: ["pointer", "saveAs"]
2041
- }
2042
- ),
2043
- bodyText: objectSchema(
2044
- {
2045
- saveAs: stringSchema({ minLength: 1 })
2046
- },
2047
- {
2048
- title: "OpensteerAuthRecipeBodyTextCapture",
2049
- required: ["saveAs"]
2050
- }
2051
- )
2052
- },
2053
- {
2054
- title: "OpensteerRecipeStepResponseCapture"
2055
- }
2056
- );
2057
- var opensteerRecipeRequestStepInputSchema = objectSchema(
2058
- {
2059
- url: stringSchema({ minLength: 1 }),
2060
- transport: transportKindSchema,
2061
- pageRef: pageRefSchema,
2062
- cookieJar: stringSchema({ minLength: 1 }),
2063
- method: stringSchema({ minLength: 1 }),
2064
- headers: recordSchema(stringSchema(), {
2065
- title: "OpensteerRecipeRequestHeaders"
2066
- }),
2067
- query: recordSchema(stringSchema(), {
2068
- title: "OpensteerRecipeRequestQuery"
2069
- }),
2070
- body: opensteerRequestBodyInputSchema,
2071
- followRedirects: { type: "boolean" }
2072
- },
2073
- {
2074
- title: "OpensteerRecipeRequestStepInput",
2075
- required: ["url"]
2076
- }
2077
- );
2078
- var opensteerRecipeHookRefSchema = objectSchema(
2079
- {
2080
- specifier: stringSchema({ minLength: 1 }),
2081
- export: stringSchema({ minLength: 1 })
2082
- },
2083
- {
2084
- title: "OpensteerRecipeHookRef",
2085
- required: ["specifier", "export"]
2086
- }
2087
- );
2088
- var opensteerRecipeStepSchema = oneOfSchema(
2089
- [
2090
- objectSchema(
2091
- {
2092
- kind: enumSchema(["goto"]),
2093
- url: stringSchema({ minLength: 1 })
2094
- },
2095
- {
2096
- title: "OpensteerAuthRecipeGotoStep",
2097
- required: ["kind", "url"]
2098
- }
2099
- ),
2100
- objectSchema(
2101
- {
2102
- kind: enumSchema(["reload"])
2103
- },
2104
- {
2105
- title: "OpensteerAuthRecipeReloadStep",
2106
- required: ["kind"]
2107
- }
2108
- ),
2109
- objectSchema(
2110
- {
2111
- kind: enumSchema(["waitForUrl"]),
2112
- includes: stringSchema({ minLength: 1 }),
2113
- timeoutMs: integerSchema({ minimum: 0 })
2114
- },
2115
- {
2116
- title: "OpensteerAuthRecipeWaitForUrlStep",
2117
- required: ["kind", "includes"]
2118
- }
2119
- ),
2120
- objectSchema(
2121
- {
2122
- kind: enumSchema(["waitForNetwork"]),
2123
- url: stringSchema({ minLength: 1 }),
2124
- hostname: stringSchema({ minLength: 1 }),
2125
- path: stringSchema({ minLength: 1 }),
2126
- method: stringSchema({ minLength: 1 }),
2127
- status: stringSchema({ minLength: 1 }),
2128
- includeBodies: { type: "boolean" },
2129
- timeoutMs: integerSchema({ minimum: 0 }),
2130
- saveAs: stringSchema({ minLength: 1 })
2131
- },
2132
- {
2133
- title: "OpensteerRecipeWaitForNetworkStep",
2134
- required: ["kind"]
2135
- }
2136
- ),
2137
- objectSchema(
2138
- {
2139
- kind: enumSchema(["waitForCookie"]),
2140
- name: stringSchema({ minLength: 1 }),
2141
- url: stringSchema({ minLength: 1 }),
2142
- timeoutMs: integerSchema({ minimum: 0 }),
2143
- saveAs: stringSchema({ minLength: 1 })
2144
- },
2145
- {
2146
- title: "OpensteerAuthRecipeWaitForCookieStep",
2147
- required: ["kind", "name"]
2148
- }
2149
- ),
2150
- objectSchema(
2151
- {
2152
- kind: enumSchema(["waitForStorage"]),
2153
- area: enumSchema(["local", "session"]),
2154
- origin: stringSchema({ minLength: 1 }),
2155
- key: stringSchema({ minLength: 1 }),
2156
- timeoutMs: integerSchema({ minimum: 0 }),
2157
- saveAs: stringSchema({ minLength: 1 })
2158
- },
2159
- {
2160
- title: "OpensteerAuthRecipeWaitForStorageStep",
2161
- required: ["kind", "area", "origin", "key"]
2162
- }
2163
- ),
2164
- objectSchema(
2165
- {
2166
- kind: enumSchema(["readCookie"]),
2167
- name: stringSchema({ minLength: 1 }),
2168
- url: stringSchema({ minLength: 1 }),
2169
- saveAs: stringSchema({ minLength: 1 })
2170
- },
2171
- {
2172
- title: "OpensteerAuthRecipeReadCookieStep",
2173
- required: ["kind", "name", "saveAs"]
2174
- }
2175
- ),
2176
- objectSchema(
2177
- {
2178
- kind: enumSchema(["readStorage"]),
2179
- area: enumSchema(["local", "session"]),
2180
- origin: stringSchema({ minLength: 1 }),
2181
- key: stringSchema({ minLength: 1 }),
2182
- pageUrl: stringSchema({ minLength: 1 }),
2183
- saveAs: stringSchema({ minLength: 1 })
2184
- },
2185
- {
2186
- title: "OpensteerRecipeReadStorageStep",
2187
- required: ["kind", "area", "origin", "key", "saveAs"]
2188
- }
2189
- ),
2190
- objectSchema(
2191
- {
2192
- kind: enumSchema(["evaluate"]),
2193
- script: stringSchema({ minLength: 1 }),
2194
- args: arraySchema(jsonValueSchema),
2195
- pageRef: pageRefSchema,
2196
- saveAs: stringSchema({ minLength: 1 })
2197
- },
2198
- {
2199
- title: "OpensteerRecipeEvaluateStep",
2200
- required: ["kind", "script"]
2201
- }
2202
- ),
2203
- objectSchema(
2204
- {
2205
- kind: enumSchema(["syncCookiesToJar"]),
2206
- jar: stringSchema({ minLength: 1 }),
2207
- urls: arraySchema(stringSchema({ minLength: 1 }), {
2208
- minItems: 1
2209
- })
2210
- },
2211
- {
2212
- title: "OpensteerRecipeSyncCookiesToJarStep",
2213
- required: ["kind", "jar"]
2214
- }
2215
- ),
2216
- objectSchema(
2217
- {
2218
- kind: enumSchema(["request"]),
2219
- request: opensteerRecipeRequestStepInputSchema,
2220
- capture: opensteerRecipeStepResponseCaptureSchema
2221
- },
2222
- {
2223
- title: "OpensteerRecipeRequestStep",
2224
- required: ["kind", "request"]
2225
- }
2226
- ),
2227
- objectSchema(
2228
- {
2229
- kind: enumSchema(["sessionRequest"]),
2230
- request: opensteerRecipeRequestStepInputSchema,
2231
- capture: opensteerRecipeStepResponseCaptureSchema
2232
- },
2233
- {
2234
- title: "OpensteerAuthRecipeSessionRequestStep",
2235
- required: ["kind", "request"]
2236
- }
2237
- ),
2238
- objectSchema(
2239
- {
2240
- kind: enumSchema(["directRequest"]),
2241
- request: opensteerRecipeRequestStepInputSchema,
2242
- capture: opensteerRecipeStepResponseCaptureSchema
2243
- },
2244
- {
2245
- title: "OpensteerAuthRecipeDirectRequestStep",
2246
- required: ["kind", "request"]
2247
- }
2248
- ),
2249
- objectSchema(
2250
- {
2251
- kind: enumSchema(["solveCaptcha"]),
2252
- provider: captchaProviderSchema,
2253
- apiKey: stringSchema({ minLength: 1 }),
2254
- pageRef: pageRefSchema,
2255
- timeoutMs: integerSchema({ minimum: 1 }),
2256
- type: captchaTypeSchema,
2257
- siteKey: stringSchema({ minLength: 1 }),
2258
- pageUrl: stringSchema({ minLength: 1 }),
2259
- saveAs: stringSchema({ minLength: 1 })
2260
- },
2261
- {
2262
- title: "OpensteerRecipeSolveCaptchaStep",
2263
- required: ["kind", "provider", "apiKey"]
2264
- }
2265
- ),
2266
- objectSchema(
2267
- {
2268
- kind: enumSchema(["hook"]),
2269
- hook: opensteerRecipeHookRefSchema
2270
- },
2271
- {
2272
- title: "OpensteerRecipeHookStep",
2273
- required: ["kind", "hook"]
2274
- }
2275
- )
2276
- ],
2277
- {
2278
- title: "OpensteerRecipeStep"
2279
- }
2280
- );
2281
- var opensteerRecipePayloadSchema = objectSchema(
2282
- {
2283
- description: stringSchema({ minLength: 1 }),
2284
- steps: arraySchema(opensteerRecipeStepSchema, {
2285
- minItems: 1
2286
- }),
2287
- outputs: opensteerRecipeRetryOverridesSchema
2288
- },
2289
- {
2290
- title: "OpensteerRecipePayload",
2291
- required: ["steps"]
2292
- }
2293
- );
2294
- var opensteerRecipeRecordSchema = objectSchema(
2295
- {
2296
- id: stringSchema({ minLength: 1 }),
2297
- key: stringSchema({ minLength: 1 }),
2298
- version: stringSchema({ minLength: 1 }),
2299
- createdAt: integerSchema({ minimum: 0 }),
2300
- updatedAt: integerSchema({ minimum: 0 }),
2301
- contentHash: stringSchema({ minLength: 1 }),
2302
- tags: arraySchema(stringSchema({ minLength: 1 }), {
2303
- uniqueItems: true
2304
- }),
2305
- provenance: opensteerRegistryProvenanceSchema,
2306
- payload: opensteerRecipePayloadSchema
2307
- },
2308
- {
2309
- title: "OpensteerRecipeRecord",
2310
- required: ["id", "key", "version", "createdAt", "updatedAt", "contentHash", "tags", "payload"]
2311
- }
2312
- );
2313
1907
  var opensteerNetworkQueryInputSchema = objectSchema(
2314
1908
  {
2315
1909
  pageRef: pageRefSchema,
@@ -2708,85 +2302,6 @@ objectSchema(
2708
2302
  required: ["plans"]
2709
2303
  }
2710
2304
  );
2711
- objectSchema(
2712
- {
2713
- id: stringSchema({ minLength: 1 }),
2714
- key: stringSchema({ minLength: 1 }),
2715
- version: stringSchema({ minLength: 1 }),
2716
- tags: arraySchema(stringSchema({ minLength: 1 }), {
2717
- uniqueItems: true
2718
- }),
2719
- provenance: opensteerRegistryProvenanceSchema,
2720
- payload: opensteerRecipePayloadSchema
2721
- },
2722
- {
2723
- title: "OpensteerWriteRecipeInput",
2724
- required: ["key", "version", "payload"]
2725
- }
2726
- );
2727
- objectSchema(
2728
- {
2729
- key: stringSchema({ minLength: 1 }),
2730
- version: stringSchema({ minLength: 1 })
2731
- },
2732
- {
2733
- title: "OpensteerGetRecipeInput",
2734
- required: ["key"]
2735
- }
2736
- );
2737
- objectSchema(
2738
- {
2739
- key: stringSchema({ minLength: 1 })
2740
- },
2741
- {
2742
- title: "OpensteerListRecipesInput"
2743
- }
2744
- );
2745
- objectSchema(
2746
- {
2747
- recipes: arraySchema(opensteerRecipeRecordSchema)
2748
- },
2749
- {
2750
- title: "OpensteerListRecipesOutput",
2751
- required: ["recipes"]
2752
- }
2753
- );
2754
- objectSchema(
2755
- {
2756
- key: stringSchema({ minLength: 1 }),
2757
- version: stringSchema({ minLength: 1 }),
2758
- variables: recordSchema(stringSchema(), {
2759
- title: "OpensteerRecipeVariables"
2760
- })
2761
- },
2762
- {
2763
- title: "OpensteerRunRecipeInput",
2764
- required: ["key"]
2765
- }
2766
- );
2767
- objectSchema(
2768
- {
2769
- recipe: objectSchema(
2770
- {
2771
- id: stringSchema({ minLength: 1 }),
2772
- key: stringSchema({ minLength: 1 }),
2773
- version: stringSchema({ minLength: 1 })
2774
- },
2775
- {
2776
- title: "OpensteerResolvedRecipeRef",
2777
- required: ["id", "key", "version"]
2778
- }
2779
- ),
2780
- variables: recordSchema(stringSchema(), {
2781
- title: "OpensteerResolvedRecipeVariables"
2782
- }),
2783
- overrides: opensteerRecipeRetryOverridesSchema
2784
- },
2785
- {
2786
- title: "OpensteerRunRecipeOutput",
2787
- required: ["recipe", "variables"]
2788
- }
2789
- );
2790
2305
  objectSchema(
2791
2306
  {
2792
2307
  key: stringSchema({ minLength: 1 }),
@@ -2893,17 +2408,7 @@ objectSchema(
2893
2408
  {
2894
2409
  attempted: { type: "boolean" },
2895
2410
  succeeded: { type: "boolean" },
2896
- matchedFailurePolicy: { type: "boolean" },
2897
- recipe: objectSchema(
2898
- {
2899
- key: stringSchema({ minLength: 1 }),
2900
- version: stringSchema({ minLength: 1 })
2901
- },
2902
- {
2903
- title: "OpensteerResolvedRecoveryRecipeRef",
2904
- required: ["key", "version"]
2905
- }
2906
- )
2411
+ matchedFailurePolicy: { type: "boolean" }
2907
2412
  },
2908
2413
  {
2909
2414
  title: "OpensteerRequestRecoveryMetadata",
@@ -2942,6 +2447,69 @@ objectSchema(
2942
2447
  }
2943
2448
  );
2944
2449
 
2450
+ // ../protocol/src/state.ts
2451
+ var opensteerStateSnapshotCookieSchema = objectSchema(
2452
+ {
2453
+ name: stringSchema({ minLength: 1 }),
2454
+ value: stringSchema(),
2455
+ domain: stringSchema({ minLength: 1 }),
2456
+ path: stringSchema({ minLength: 1 }),
2457
+ secure: { type: "boolean" },
2458
+ httpOnly: { type: "boolean" },
2459
+ sameSite: enumSchema(["strict", "lax", "none"]),
2460
+ priority: enumSchema(["low", "medium", "high"]),
2461
+ partitionKey: stringSchema({ minLength: 1 }),
2462
+ session: { type: "boolean" },
2463
+ expiresAt: oneOfSchema([integerSchema({ minimum: 0 }), { type: "null" }])
2464
+ },
2465
+ {
2466
+ title: "OpensteerStateSnapshotCookie",
2467
+ required: ["name", "value", "domain", "path", "secure", "httpOnly", "session"]
2468
+ }
2469
+ );
2470
+ var opensteerStateSnapshotSchema = objectSchema(
2471
+ {
2472
+ id: stringSchema({ minLength: 1 }),
2473
+ capturedAt: integerSchema({ minimum: 0 }),
2474
+ pageRef: pageRefSchema,
2475
+ url: stringSchema({ minLength: 1 }),
2476
+ cookies: arraySchema(opensteerStateSnapshotCookieSchema),
2477
+ storage: storageSnapshotSchema,
2478
+ hiddenFields: arraySchema(
2479
+ objectSchema(
2480
+ {
2481
+ path: stringSchema({ minLength: 1 }),
2482
+ name: stringSchema({ minLength: 1 }),
2483
+ value: stringSchema()
2484
+ },
2485
+ {
2486
+ title: "OpensteerStateSnapshotHiddenField",
2487
+ required: ["path", "name", "value"]
2488
+ }
2489
+ )
2490
+ ),
2491
+ globals: recordSchema({}, { title: "OpensteerStateSnapshotGlobals" })
2492
+ },
2493
+ {
2494
+ title: "OpensteerStateSnapshot",
2495
+ required: ["id", "capturedAt"]
2496
+ }
2497
+ );
2498
+ var opensteerStateDeltaSchema = objectSchema(
2499
+ {
2500
+ beforeStateId: stringSchema({ minLength: 1 }),
2501
+ afterStateId: stringSchema({ minLength: 1 }),
2502
+ cookiesChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
2503
+ storageChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
2504
+ hiddenFieldsChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
2505
+ globalsChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
2506
+ },
2507
+ {
2508
+ title: "OpensteerStateDelta",
2509
+ required: ["cookiesChanged", "storageChanged", "hiddenFieldsChanged", "globalsChanged"]
2510
+ }
2511
+ );
2512
+
2945
2513
  // ../protocol/src/snapshots.ts
2946
2514
  var screenshotFormatSchema = enumSchema(["png", "jpeg", "webp"], {
2947
2515
  title: "ScreenshotFormat"
@@ -3715,6 +3283,55 @@ var opensteerArtifactReadOutputSchema = objectSchema(
3715
3283
  }
3716
3284
  );
3717
3285
 
3286
+ // ../protocol/src/captcha.ts
3287
+ var captchaTypeSchema = enumSchema(
3288
+ ["recaptcha-v2", "hcaptcha", "turnstile"],
3289
+ {
3290
+ title: "CaptchaType"
3291
+ }
3292
+ );
3293
+ var captchaProviderSchema = enumSchema(["2captcha", "capsolver"], {
3294
+ title: "CaptchaProvider"
3295
+ });
3296
+ var captchaDetectionResultSchema = objectSchema(
3297
+ {
3298
+ type: captchaTypeSchema,
3299
+ siteKey: stringSchema({ minLength: 1 }),
3300
+ pageUrl: stringSchema({ minLength: 1 })
3301
+ },
3302
+ {
3303
+ title: "CaptchaDetectionResult",
3304
+ required: ["type", "siteKey", "pageUrl"]
3305
+ }
3306
+ );
3307
+ var opensteerCaptchaSolveInputSchema = objectSchema(
3308
+ {
3309
+ provider: captchaProviderSchema,
3310
+ apiKey: stringSchema({ minLength: 1 }),
3311
+ pageRef: pageRefSchema,
3312
+ timeoutMs: integerSchema({ minimum: 1 }),
3313
+ type: captchaTypeSchema,
3314
+ siteKey: stringSchema({ minLength: 1 }),
3315
+ pageUrl: stringSchema({ minLength: 1 })
3316
+ },
3317
+ {
3318
+ title: "OpensteerCaptchaSolveInput",
3319
+ required: ["provider", "apiKey"]
3320
+ }
3321
+ );
3322
+ var opensteerCaptchaSolveOutputSchema = objectSchema(
3323
+ {
3324
+ captcha: captchaDetectionResultSchema,
3325
+ token: stringSchema({ minLength: 1 }),
3326
+ injected: { type: "boolean" },
3327
+ provider: captchaProviderSchema
3328
+ },
3329
+ {
3330
+ title: "OpensteerCaptchaSolveOutput",
3331
+ required: ["captcha", "token", "injected", "provider"]
3332
+ }
3333
+ );
3334
+
3718
3335
  // ../protocol/src/traces.ts
3719
3336
  var traceContextSchema = objectSchema(
3720
3337
  {
@@ -3970,1557 +3587,15 @@ var opensteerScriptSandboxOutputSchema = objectSchema(
3970
3587
  ],
3971
3588
  {
3972
3589
  title: "SandboxResult"
3973
- }
3974
- ),
3975
- capturedAjax: arraySchema(sandboxCapturedAjaxCallSchema),
3976
- errors: arraySchema(stringSchema({ minLength: 1 })),
3977
- durationMs: integerSchema({ minimum: 0 })
3978
- },
3979
- {
3980
- title: "OpensteerScriptSandboxOutput",
3981
- required: ["capturedAjax", "errors", "durationMs"]
3982
- }
3983
- );
3984
-
3985
- // ../protocol/src/reverse.ts
3986
- var opensteerStateSourceKindSchema = enumSchema(
3987
- ["temporary", "persistent", "attach"],
3988
- { title: "OpensteerStateSourceKind" }
3989
- );
3990
- var opensteerReverseCaseStatusSchema = enumSchema(
3991
- ["capturing", "analyzing", "ready", "attention"],
3992
- { title: "OpensteerReverseCaseStatus" }
3993
- );
3994
- var opensteerReverseChannelKindSchema = enumSchema(
3995
- ["http", "event-stream", "websocket"],
3996
- { title: "OpensteerReverseChannelKind" }
3997
- );
3998
- var opensteerReverseManualCalibrationModeSchema = enumSchema(
3999
- ["allow", "avoid", "require"],
4000
- { title: "OpensteerReverseManualCalibrationMode" }
4001
- );
4002
- var opensteerReverseCandidateBoundarySchema = enumSchema(
4003
- ["first-party", "same-site", "third-party"],
4004
- { title: "OpensteerReverseCandidateBoundary" }
4005
- );
4006
- var opensteerReverseAdvisoryTagSchema = enumSchema(
4007
- [
4008
- "data",
4009
- "facet",
4010
- "telemetry",
4011
- "subscription",
4012
- "navigation",
4013
- "document",
4014
- "route-data",
4015
- "search",
4016
- "tracking",
4017
- "unknown"
4018
- ],
4019
- { title: "OpensteerReverseAdvisoryTag" }
4020
- );
4021
- var opensteerReverseConstraintKindSchema = enumSchema(
4022
- [
4023
- "requires-browser",
4024
- "requires-cookie",
4025
- "requires-storage",
4026
- "requires-script",
4027
- "requires-guard",
4028
- "requires-live-state",
4029
- "opaque-body",
4030
- "unsupported"
4031
- ],
4032
- { title: "OpensteerReverseConstraintKind" }
4033
- );
4034
- var opensteerRequestInputLocationSchema = enumSchema(
4035
- ["path", "query", "header", "cookie", "body-field"],
4036
- { title: "OpensteerRequestInputLocation" }
4037
- );
4038
- var opensteerRequestInputRequirednessSchema = enumSchema(
4039
- ["required", "optional", "unknown"],
4040
- { title: "OpensteerRequestInputRequiredness" }
4041
- );
4042
- var opensteerRequestInputClassificationSchema = enumSchema(
4043
- ["managed", "static", "contextual", "volatile"],
4044
- { title: "OpensteerRequestInputClassification" }
4045
- );
4046
- var opensteerRequestInputSourceSchema = enumSchema(
4047
- [
4048
- "literal",
4049
- "cookie",
4050
- "storage",
4051
- "prior-response",
4052
- "page",
4053
- "script",
4054
- "guard-output",
4055
- "runtime-managed",
4056
- "unknown"
4057
- ],
4058
- { title: "OpensteerRequestInputSource" }
4059
- );
4060
- var opensteerRequestInputMaterializationPolicySchema = enumSchema(
4061
- ["copy", "omit", "recompute", "resolve"],
4062
- { title: "OpensteerRequestInputMaterializationPolicy" }
4063
- );
4064
- var opensteerRequestInputExportPolicySchema = enumSchema(
4065
- ["portable", "browser-bound", "blocked"],
4066
- { title: "OpensteerRequestInputExportPolicy" }
4067
- );
4068
- var opensteerReverseQueryViewSchema = enumSchema(
4069
- ["records", "clusters", "candidates"],
4070
- { title: "OpensteerReverseQueryView" }
4071
- );
4072
- var opensteerReverseSortKeySchema = enumSchema(
4073
- [
4074
- "observed-at",
4075
- "advisory-rank",
4076
- "target-hint-matches",
4077
- "response-richness",
4078
- "portability",
4079
- "boundary",
4080
- "success"
4081
- ],
4082
- { title: "OpensteerReverseSortKey" }
4083
- );
4084
- var opensteerReverseSortPresetSchema = enumSchema(
4085
- [
4086
- "advisory-rank",
4087
- "observed-at",
4088
- "portability",
4089
- "first-party",
4090
- "hint-match",
4091
- "response-richness"
4092
- ],
4093
- { title: "OpensteerReverseSortPreset" }
4094
- );
4095
- var opensteerReverseSortDirectionSchema = enumSchema(
4096
- ["asc", "desc"],
4097
- {
4098
- title: "OpensteerReverseSortDirection"
4099
- }
4100
- );
4101
- var opensteerObservationClusterRelationshipKindSchema = enumSchema(
4102
- ["seed", "preflight", "redirect", "retry", "duplicate", "follow-on"],
4103
- { title: "OpensteerObservationClusterRelationshipKind" }
4104
- );
4105
- var opensteerReverseReportKindSchema = enumSchema(
4106
- ["discovery", "package"],
4107
- { title: "OpensteerReverseReportKind" }
4108
- );
4109
- var opensteerReversePackageKindSchema = enumSchema(
4110
- ["portable-http", "browser-workflow"],
4111
- { title: "OpensteerReversePackageKind" }
4112
- );
4113
- var opensteerReversePackageReadinessSchema = enumSchema(
4114
- ["runnable", "draft", "unsupported"],
4115
- { title: "OpensteerReversePackageReadiness" }
4116
- );
4117
- var opensteerBodyCodecKindSchema = enumSchema(
4118
- [
4119
- "json",
4120
- "form-urlencoded",
4121
- "multipart",
4122
- "graphql",
4123
- "persisted-graphql",
4124
- "text",
4125
- "opaque-binary",
4126
- "sse",
4127
- "websocket-json",
4128
- "websocket-text",
4129
- "unknown"
4130
- ],
4131
- { title: "OpensteerBodyCodecKind" }
4132
- );
4133
- var opensteerExecutableResolverKindSchema = enumSchema(
4134
- [
4135
- "literal",
4136
- "cookie",
4137
- "storage",
4138
- "prior-record",
4139
- "binding",
4140
- "candidate",
4141
- "case",
4142
- "state-snapshot",
4143
- "artifact",
4144
- "manual",
4145
- "runtime-managed"
4146
- ],
4147
- { title: "OpensteerExecutableResolverKind" }
4148
- );
4149
- var opensteerValueReferenceKindSchema = enumSchema(
4150
- [
4151
- "literal",
4152
- "resolver",
4153
- "binding",
4154
- "candidate",
4155
- "case",
4156
- "record",
4157
- "artifact",
4158
- "state-snapshot",
4159
- "runtime",
4160
- "manual"
4161
- ],
4162
- { title: "OpensteerValueReferenceKind" }
4163
- );
4164
- var opensteerRuntimeValueKeySchema = enumSchema(
4165
- ["pageRef", "packageId", "caseId", "candidateId", "objective"],
4166
- { title: "OpensteerRuntimeValueKey" }
4167
- );
4168
- var opensteerValidationRuleKindSchema = enumSchema(
4169
- [
4170
- "status",
4171
- "json-structure",
4172
- "text-includes",
4173
- "stream-first-chunk",
4174
- "websocket-open",
4175
- "message-count-at-least"
4176
- ],
4177
- { title: "OpensteerValidationRuleKind" }
4178
- );
4179
- enumSchema(
4180
- ["operation", "await-record", "assert"],
4181
- { title: "OpensteerReverseWorkflowStepKind" }
4182
- );
4183
- var opensteerReverseRequirementKindSchema = enumSchema(
4184
- ["resolver", "guard", "workflow-step", "state", "channel", "unsupported"],
4185
- { title: "OpensteerReverseRequirementKind" }
4186
- );
4187
- var opensteerReverseRequirementStatusSchema = enumSchema(
4188
- ["required", "recommended"],
4189
- { title: "OpensteerReverseRequirementStatus" }
4190
- );
4191
- var opensteerReverseSuggestedEditKindSchema = enumSchema(
4192
- [
4193
- "set-resolver",
4194
- "attach-trace",
4195
- "replace-workflow",
4196
- "patch-step-input",
4197
- "switch-state-source",
4198
- "inspect-evidence",
4199
- "mark-unsupported"
4200
- ],
4201
- { title: "OpensteerReverseSuggestedEditKind" }
4202
- );
4203
- var jsonValueSchema2 = defineSchema({
4204
- title: "JsonValue"
4205
- });
4206
- var opensteerValueReferenceSchema = objectSchema(
4207
- {
4208
- kind: opensteerValueReferenceKindSchema,
4209
- pointer: stringSchema({ minLength: 1 }),
4210
- resolverId: stringSchema({ minLength: 1 }),
4211
- binding: stringSchema({ minLength: 1 }),
4212
- recordId: stringSchema({ minLength: 1 }),
4213
- artifactId: stringSchema({ minLength: 1 }),
4214
- stateSnapshotId: stringSchema({ minLength: 1 }),
4215
- runtimeKey: opensteerRuntimeValueKeySchema,
4216
- value: jsonValueSchema2,
4217
- placeholder: stringSchema({ minLength: 1 })
4218
- },
4219
- {
4220
- title: "OpensteerValueReference",
4221
- required: ["kind"]
4222
- }
4223
- );
4224
- var opensteerValueTemplateSchema = defineSchema({
4225
- title: "OpensteerValueTemplate"
4226
- });
4227
- var opensteerReverseTargetHintsSchema = objectSchema(
4228
- {
4229
- hosts: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4230
- paths: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4231
- operationNames: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4232
- channels: arraySchema(opensteerReverseChannelKindSchema, { uniqueItems: true })
4233
- },
4234
- {
4235
- title: "OpensteerReverseTargetHints"
4236
- }
4237
- );
4238
- var opensteerBodyCodecDescriptorSchema = objectSchema(
4239
- {
4240
- kind: opensteerBodyCodecKindSchema,
4241
- contentType: stringSchema({ minLength: 1 }),
4242
- operationName: stringSchema({ minLength: 1 }),
4243
- fieldPaths: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
4244
- },
4245
- {
4246
- title: "OpensteerBodyCodecDescriptor",
4247
- required: ["kind", "fieldPaths"]
4248
- }
4249
- );
4250
- var opensteerObservationClusterSchema = objectSchema(
4251
- {
4252
- id: stringSchema({ minLength: 1 }),
4253
- observationId: stringSchema({ minLength: 1 }),
4254
- label: stringSchema({ minLength: 1 }),
4255
- channel: opensteerReverseChannelKindSchema,
4256
- method: stringSchema({ minLength: 1 }),
4257
- url: stringSchema({ minLength: 1 }),
4258
- matchedTargetHints: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4259
- members: arraySchema(
4260
- objectSchema(
4261
- {
4262
- recordId: stringSchema({ minLength: 1 }),
4263
- observedAt: integerSchema({ minimum: 0 }),
4264
- resourceType: stringSchema({ minLength: 1 }),
4265
- status: integerSchema({ minimum: 0 }),
4266
- relation: opensteerObservationClusterRelationshipKindSchema,
4267
- relatedRecordId: stringSchema({ minLength: 1 }),
4268
- matchedTargetHints: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
4269
- },
4270
- {
4271
- title: "OpensteerObservationClusterMember",
4272
- required: ["recordId", "relation", "matchedTargetHints"]
4273
- }
4274
- )
4275
- )
4276
- },
4277
- {
4278
- title: "OpensteerObservationCluster",
4279
- required: ["id", "observationId", "label", "channel", "url", "matchedTargetHints", "members"]
4280
- }
4281
- );
4282
- var opensteerStateSnapshotCookieSchema = objectSchema(
4283
- {
4284
- name: stringSchema({ minLength: 1 }),
4285
- value: stringSchema(),
4286
- domain: stringSchema({ minLength: 1 }),
4287
- path: stringSchema({ minLength: 1 }),
4288
- secure: { type: "boolean" },
4289
- httpOnly: { type: "boolean" },
4290
- sameSite: enumSchema(["strict", "lax", "none"]),
4291
- priority: enumSchema(["low", "medium", "high"]),
4292
- partitionKey: stringSchema({ minLength: 1 }),
4293
- session: { type: "boolean" },
4294
- expiresAt: oneOfSchema([integerSchema({ minimum: 0 }), { type: "null" }])
4295
- },
4296
- {
4297
- title: "OpensteerStateSnapshotCookie",
4298
- required: ["name", "value", "domain", "path", "secure", "httpOnly", "session"]
4299
- }
4300
- );
4301
- var opensteerStateSnapshotSchema = objectSchema(
4302
- {
4303
- id: stringSchema({ minLength: 1 }),
4304
- capturedAt: integerSchema({ minimum: 0 }),
4305
- pageRef: pageRefSchema,
4306
- url: stringSchema({ minLength: 1 }),
4307
- cookies: arraySchema(opensteerStateSnapshotCookieSchema),
4308
- storage: storageSnapshotSchema,
4309
- hiddenFields: arraySchema(
4310
- objectSchema(
4311
- {
4312
- path: stringSchema({ minLength: 1 }),
4313
- name: stringSchema({ minLength: 1 }),
4314
- value: stringSchema()
4315
- },
4316
- {
4317
- title: "OpensteerStateSnapshotHiddenField",
4318
- required: ["path", "name", "value"]
4319
- }
4320
- )
4321
- ),
4322
- globals: recordSchema({}, { title: "OpensteerStateSnapshotGlobals" })
4323
- },
4324
- {
4325
- title: "OpensteerStateSnapshot",
4326
- required: ["id", "capturedAt"]
4327
- }
4328
- );
4329
- var opensteerStateDeltaSchema = objectSchema(
4330
- {
4331
- beforeStateId: stringSchema({ minLength: 1 }),
4332
- afterStateId: stringSchema({ minLength: 1 }),
4333
- cookiesChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4334
- storageChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4335
- hiddenFieldsChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4336
- globalsChanged: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
4337
- },
4338
- {
4339
- title: "OpensteerStateDelta",
4340
- required: ["cookiesChanged", "storageChanged", "hiddenFieldsChanged", "globalsChanged"]
4341
- }
4342
- );
4343
- var opensteerRequestInputDescriptorSchema = objectSchema(
4344
- {
4345
- name: stringSchema({ minLength: 1 }),
4346
- location: opensteerRequestInputLocationSchema,
4347
- path: stringSchema({ minLength: 1 }),
4348
- wireName: stringSchema({ minLength: 1 }),
4349
- requiredness: opensteerRequestInputRequirednessSchema,
4350
- classification: opensteerRequestInputClassificationSchema,
4351
- source: opensteerRequestInputSourceSchema,
4352
- materializationPolicy: opensteerRequestInputMaterializationPolicySchema,
4353
- exportPolicy: opensteerRequestInputExportPolicySchema,
4354
- originalValue: stringSchema(),
4355
- provenance: objectSchema(
4356
- {
4357
- recordId: stringSchema({ minLength: 1 }),
4358
- observationId: stringSchema({ minLength: 1 }),
4359
- sourcePointer: stringSchema({ minLength: 1 }),
4360
- notes: stringSchema({ minLength: 1 })
4361
- },
4362
- {
4363
- title: "OpensteerRequestInputDescriptorProvenance"
4364
- }
4365
- ),
4366
- unlockedByGuardIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
4367
- },
4368
- {
4369
- title: "OpensteerRequestInputDescriptor",
4370
- required: [
4371
- "name",
4372
- "location",
4373
- "requiredness",
4374
- "classification",
4375
- "source",
4376
- "materializationPolicy",
4377
- "exportPolicy"
4378
- ]
4379
- }
4380
- );
4381
- var opensteerExecutableResolverSchema = objectSchema(
4382
- {
4383
- id: stringSchema({ minLength: 1 }),
4384
- kind: opensteerExecutableResolverKindSchema,
4385
- label: stringSchema({ minLength: 1 }),
4386
- status: enumSchema(["ready", "missing"]),
4387
- requiresBrowser: { type: "boolean" },
4388
- requiresLiveState: { type: "boolean" },
4389
- description: stringSchema({ minLength: 1 }),
4390
- inputNames: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4391
- guardId: stringSchema({ minLength: 1 }),
4392
- traceId: stringSchema({ minLength: 1 }),
4393
- valueRef: opensteerValueReferenceSchema
4394
- },
4395
- {
4396
- title: "OpensteerExecutableResolver",
4397
- required: ["id", "kind", "label", "status", "requiresBrowser", "requiresLiveState"]
4398
- }
4399
- );
4400
- var opensteerReverseAdvisorySignalsSchema = objectSchema(
4401
- {
4402
- advisoryRank: numberSchema(),
4403
- observedAt: integerSchema({ minimum: 0 }),
4404
- targetHintMatches: integerSchema({ minimum: 0 }),
4405
- responseRichness: integerSchema({ minimum: 0 }),
4406
- portabilityWeight: integerSchema({ minimum: 0 }),
4407
- boundaryWeight: integerSchema({ minimum: 0 }),
4408
- successfulStatus: { type: "boolean" },
4409
- fetchLike: { type: "boolean" },
4410
- hasResponseBody: { type: "boolean" },
4411
- dataPathMatch: { type: "boolean" },
4412
- cookieInputCount: integerSchema({ minimum: 0 }),
4413
- storageInputCount: integerSchema({ minimum: 0 }),
4414
- volatileInputCount: integerSchema({ minimum: 0 }),
4415
- guardCount: integerSchema({ minimum: 0 })
4416
- },
4417
- {
4418
- title: "OpensteerReverseAdvisorySignals",
4419
- required: [
4420
- "advisoryRank",
4421
- "targetHintMatches",
4422
- "responseRichness",
4423
- "portabilityWeight",
4424
- "boundaryWeight",
4425
- "successfulStatus",
4426
- "fetchLike",
4427
- "hasResponseBody",
4428
- "dataPathMatch",
4429
- "cookieInputCount",
4430
- "storageInputCount",
4431
- "volatileInputCount",
4432
- "guardCount"
4433
- ]
4434
- }
4435
- );
4436
- var opensteerValidationRuleSchema = objectSchema(
4437
- {
4438
- id: stringSchema({ minLength: 1 }),
4439
- kind: opensteerValidationRuleKindSchema,
4440
- label: stringSchema({ minLength: 1 }),
4441
- required: { type: "boolean" },
4442
- expectedStatus: integerSchema({ minimum: 0 }),
4443
- structureHash: stringSchema({ minLength: 1 }),
4444
- textIncludes: stringSchema({ minLength: 1 }),
4445
- minimumCount: integerSchema({ minimum: 0 })
4446
- },
4447
- {
4448
- title: "OpensteerValidationRule",
4449
- required: ["id", "kind", "label", "required"]
4450
- }
4451
- );
4452
- var opensteerChannelDescriptorSchema = objectSchema(
4453
- {
4454
- kind: opensteerReverseChannelKindSchema,
4455
- recordKind: networkRecordKindSchema,
4456
- method: stringSchema({ minLength: 1 }),
4457
- url: stringSchema({ minLength: 1 }),
4458
- subprotocol: stringSchema({ minLength: 1 })
4459
- },
4460
- {
4461
- title: "OpensteerChannelDescriptor",
4462
- required: ["kind", "recordKind", "url"]
4463
- }
4464
- );
4465
- var opensteerReverseOperationWorkflowStepSchema = objectSchema(
4466
- {
4467
- id: stringSchema({ minLength: 1 }),
4468
- kind: enumSchema(["operation"]),
4469
- label: stringSchema({ minLength: 1 }),
4470
- operation: stringSchema({ minLength: 1 }),
4471
- input: opensteerValueTemplateSchema,
4472
- bindAs: stringSchema({ minLength: 1 })
4473
- },
4474
- {
4475
- title: "OpensteerReverseOperationWorkflowStep",
4476
- required: ["id", "kind", "label", "operation", "input"]
4477
- }
4478
- );
4479
- var opensteerReverseAwaitRecordWorkflowStepSchema = objectSchema(
4480
- {
4481
- id: stringSchema({ minLength: 1 }),
4482
- kind: enumSchema(["await-record"]),
4483
- label: stringSchema({ minLength: 1 }),
4484
- channel: opensteerChannelDescriptorSchema,
4485
- recordId: stringSchema({ minLength: 1 }),
4486
- match: objectSchema(
4487
- {
4488
- recordId: stringSchema({ minLength: 1 }),
4489
- host: stringSchema({ minLength: 1 }),
4490
- path: stringSchema({ minLength: 1 }),
4491
- method: stringSchema({ minLength: 1 }),
4492
- channel: opensteerReverseChannelKindSchema,
4493
- status: integerSchema({ minimum: 0 }),
4494
- text: stringSchema({ minLength: 1 })
4495
- },
4496
- {
4497
- title: "OpensteerReverseAwaitRecordMatch"
4498
- }
4499
- ),
4500
- validationRuleIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4501
- timeoutMs: integerSchema({ minimum: 0 }),
4502
- bindAs: stringSchema({ minLength: 1 })
4503
- },
4504
- {
4505
- title: "OpensteerReverseAwaitRecordWorkflowStep",
4506
- required: ["id", "kind", "label", "channel"]
4507
- }
4508
- );
4509
- var opensteerReverseAssertWorkflowStepSchema = objectSchema(
4510
- {
4511
- id: stringSchema({ minLength: 1 }),
4512
- kind: enumSchema(["assert"]),
4513
- label: stringSchema({ minLength: 1 }),
4514
- validationRuleIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4515
- binding: stringSchema({ minLength: 1 })
4516
- },
4517
- {
4518
- title: "OpensteerReverseAssertWorkflowStep",
4519
- required: ["id", "kind", "label", "validationRuleIds"]
4520
- }
4521
- );
4522
- var opensteerReverseWorkflowStepSchema = oneOfSchema(
4523
- [
4524
- opensteerReverseOperationWorkflowStepSchema,
4525
- opensteerReverseAwaitRecordWorkflowStepSchema,
4526
- opensteerReverseAssertWorkflowStepSchema
4527
- ],
4528
- {
4529
- title: "OpensteerReverseWorkflowStep"
4530
- }
4531
- );
4532
- var opensteerReversePackageRequirementsSchema = objectSchema(
4533
- {
4534
- requiresBrowser: { type: "boolean" },
4535
- requiresLiveState: { type: "boolean" },
4536
- manualCalibration: enumSchema(["not-needed", "recommended", "required"]),
4537
- stateSources: arraySchema(opensteerStateSourceKindSchema, { uniqueItems: true })
4538
- },
4539
- {
4540
- title: "OpensteerReversePackageRequirements",
4541
- required: ["requiresBrowser", "requiresLiveState", "manualCalibration", "stateSources"]
4542
- }
4543
- );
4544
- var opensteerReverseAdvisoryTemplateSchema = objectSchema(
4545
- {
4546
- id: stringSchema({ minLength: 1 }),
4547
- label: stringSchema({ minLength: 1 }),
4548
- channel: opensteerReverseChannelKindSchema,
4549
- execution: enumSchema(["transport", "page-observation"]),
4550
- stateSource: opensteerStateSourceKindSchema,
4551
- observationId: stringSchema({ minLength: 1 }),
4552
- transport: transportKindSchema,
4553
- guardIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4554
- resolverIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4555
- requiresBrowser: { type: "boolean" },
4556
- requiresLiveState: { type: "boolean" },
4557
- viability: enumSchema(["ready", "draft", "unsupported"]),
4558
- notes: stringSchema({ minLength: 1 })
4559
- },
4560
- {
4561
- title: "OpensteerReverseAdvisoryTemplate",
4562
- required: [
4563
- "id",
4564
- "label",
4565
- "channel",
4566
- "execution",
4567
- "stateSource",
4568
- "guardIds",
4569
- "resolverIds",
4570
- "requiresBrowser",
4571
- "requiresLiveState",
4572
- "viability"
4573
- ]
4574
- }
4575
- );
4576
- var opensteerReverseGuardRecordSchema = objectSchema(
4577
- {
4578
- id: stringSchema({ minLength: 1 }),
4579
- kind: enumSchema(["interaction", "state", "script", "manual"]),
4580
- label: stringSchema({ minLength: 1 }),
4581
- status: enumSchema(["required", "satisfied", "unresolved"]),
4582
- interactionTraceId: stringSchema({ minLength: 1 }),
4583
- notes: stringSchema({ minLength: 1 })
4584
- },
4585
- {
4586
- title: "OpensteerReverseGuardRecord",
4587
- required: ["id", "kind", "label", "status"]
4588
- }
4589
- );
4590
- var opensteerReverseObservationRecordSchema = objectSchema(
4591
- {
4592
- id: stringSchema({ minLength: 1 }),
4593
- capturedAt: integerSchema({ minimum: 0 }),
4594
- pageRef: pageRefSchema,
4595
- url: stringSchema({ minLength: 1 }),
4596
- stateSource: opensteerStateSourceKindSchema,
4597
- networkRecordIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4598
- scriptArtifactIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4599
- interactionTraceIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4600
- stateSnapshotIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4601
- notes: stringSchema({ minLength: 1 })
4602
- },
4603
- {
4604
- title: "OpensteerReverseObservationRecord",
4605
- required: [
4606
- "id",
4607
- "capturedAt",
4608
- "stateSource",
4609
- "networkRecordIds",
4610
- "scriptArtifactIds",
4611
- "interactionTraceIds",
4612
- "stateSnapshotIds"
4613
- ]
4614
- }
4615
- );
4616
- var opensteerReverseObservedRecordSchema = objectSchema(
4617
- {
4618
- recordId: stringSchema({ minLength: 1 }),
4619
- observationId: stringSchema({ minLength: 1 }),
4620
- clusterId: stringSchema({ minLength: 1 }),
4621
- observedAt: integerSchema({ minimum: 0 }),
4622
- channel: opensteerChannelDescriptorSchema,
4623
- bodyCodec: opensteerBodyCodecDescriptorSchema,
4624
- resourceType: stringSchema({ minLength: 1 }),
4625
- status: integerSchema({ minimum: 0 }),
4626
- matchedTargetHints: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4627
- relationKinds: arraySchema(opensteerObservationClusterRelationshipKindSchema, {
4628
- uniqueItems: true
4629
- })
4630
- },
4631
- {
4632
- title: "OpensteerReverseObservedRecord",
4633
- required: [
4634
- "recordId",
4635
- "observationId",
4636
- "clusterId",
4637
- "channel",
4638
- "bodyCodec",
4639
- "matchedTargetHints",
4640
- "relationKinds"
4641
- ]
4642
- }
4643
- );
4644
- var opensteerReverseCandidateRecordSchema = objectSchema(
4645
- {
4646
- id: stringSchema({ minLength: 1 }),
4647
- observationId: stringSchema({ minLength: 1 }),
4648
- clusterId: stringSchema({ minLength: 1 }),
4649
- recordId: stringSchema({ minLength: 1 }),
4650
- channel: opensteerChannelDescriptorSchema,
4651
- bodyCodec: opensteerBodyCodecDescriptorSchema,
4652
- boundary: opensteerReverseCandidateBoundarySchema,
4653
- summary: stringSchema({ minLength: 1 }),
4654
- matchedTargetHints: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4655
- advisoryTags: arraySchema(opensteerReverseAdvisoryTagSchema, { uniqueItems: true }),
4656
- constraints: arraySchema(opensteerReverseConstraintKindSchema, { uniqueItems: true }),
4657
- signals: opensteerReverseAdvisorySignalsSchema,
4658
- inputs: arraySchema(opensteerRequestInputDescriptorSchema),
4659
- resolvers: arraySchema(opensteerExecutableResolverSchema),
4660
- guardIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4661
- scriptArtifactIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4662
- advisoryTemplates: arraySchema(opensteerReverseAdvisoryTemplateSchema)
4663
- },
4664
- {
4665
- title: "OpensteerReverseCandidateRecord",
4666
- required: [
4667
- "id",
4668
- "observationId",
4669
- "clusterId",
4670
- "recordId",
4671
- "channel",
4672
- "bodyCodec",
4673
- "boundary",
4674
- "summary",
4675
- "matchedTargetHints",
4676
- "advisoryTags",
4677
- "constraints",
4678
- "signals",
4679
- "inputs",
4680
- "resolvers",
4681
- "guardIds",
4682
- "scriptArtifactIds",
4683
- "advisoryTemplates"
4684
- ]
4685
- }
4686
- );
4687
- var opensteerReverseReplayValidationSchema = objectSchema(
4688
- {
4689
- statusMatches: { type: "boolean" },
4690
- structureMatches: { type: "boolean" },
4691
- opened: { type: "boolean" },
4692
- firstChunkObserved: { type: "boolean" },
4693
- firstChunkMatches: { type: "boolean" },
4694
- messageObserved: { type: "boolean" },
4695
- messageCount: integerSchema({ minimum: 0 })
4696
- },
4697
- {
4698
- title: "OpensteerReverseReplayValidation"
4699
- }
4700
- );
4701
- var opensteerReverseReplayRunRecordSchema = objectSchema(
4702
- {
4703
- id: stringSchema({ minLength: 1 }),
4704
- createdAt: integerSchema({ minimum: 0 }),
4705
- candidateId: stringSchema({ minLength: 1 }),
4706
- templateId: stringSchema({ minLength: 1 }),
4707
- packageId: stringSchema({ minLength: 1 }),
4708
- success: { type: "boolean" },
4709
- channel: opensteerReverseChannelKindSchema,
4710
- kind: opensteerReversePackageKindSchema,
4711
- readiness: opensteerReversePackageReadinessSchema,
4712
- transport: transportKindSchema,
4713
- stateSource: opensteerStateSourceKindSchema,
4714
- executedStepIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4715
- failedStepId: stringSchema({ minLength: 1 }),
4716
- bindings: recordSchema({}, { title: "OpensteerReverseReplayRunBindings" }),
4717
- recordId: stringSchema({ minLength: 1 }),
4718
- status: integerSchema({ minimum: 0 }),
4719
- validation: opensteerReverseReplayValidationSchema,
4720
- error: stringSchema({ minLength: 1 })
4721
- },
4722
- {
4723
- title: "OpensteerReverseReplayRunRecord",
4724
- required: [
4725
- "id",
4726
- "createdAt",
4727
- "packageId",
4728
- "success",
4729
- "kind",
4730
- "readiness",
4731
- "executedStepIds",
4732
- "validation"
4733
- ]
4734
- }
4735
- );
4736
- var opensteerReverseExperimentRecordSchema = objectSchema(
4737
- {
4738
- id: stringSchema({ minLength: 1 }),
4739
- createdAt: integerSchema({ minimum: 0 }),
4740
- candidateId: stringSchema({ minLength: 1 }),
4741
- templateId: stringSchema({ minLength: 1 }),
4742
- kind: enumSchema(["replay-attempt", "field-variation"]),
4743
- hypothesis: stringSchema({ minLength: 1 }),
4744
- success: { type: "boolean" },
4745
- status: integerSchema({ minimum: 0 }),
4746
- notes: stringSchema({ minLength: 1 }),
4747
- validation: opensteerReverseReplayValidationSchema
4748
- },
4749
- {
4750
- title: "OpensteerReverseExperimentRecord",
4751
- required: ["id", "createdAt", "kind", "hypothesis", "success"]
4752
- }
4753
- );
4754
- var opensteerReverseRequirementSchema = objectSchema(
4755
- {
4756
- id: stringSchema({ minLength: 1 }),
4757
- kind: opensteerReverseRequirementKindSchema,
4758
- status: opensteerReverseRequirementStatusSchema,
4759
- label: stringSchema({ minLength: 1 }),
4760
- description: stringSchema({ minLength: 1 }),
4761
- blocking: { type: "boolean" },
4762
- resolverId: stringSchema({ minLength: 1 }),
4763
- guardId: stringSchema({ minLength: 1 }),
4764
- stepId: stringSchema({ minLength: 1 }),
4765
- inputNames: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4766
- traceId: stringSchema({ minLength: 1 }),
4767
- artifactId: stringSchema({ minLength: 1 }),
4768
- recordId: stringSchema({ minLength: 1 })
4769
- },
4770
- {
4771
- title: "OpensteerReverseRequirement",
4772
- required: ["id", "kind", "status", "label", "blocking"]
4773
- }
4774
- );
4775
- var opensteerReverseSuggestedEditSchema = objectSchema(
4776
- {
4777
- id: stringSchema({ minLength: 1 }),
4778
- kind: opensteerReverseSuggestedEditKindSchema,
4779
- label: stringSchema({ minLength: 1 }),
4780
- description: stringSchema({ minLength: 1 }),
4781
- resolverId: stringSchema({ minLength: 1 }),
4782
- guardId: stringSchema({ minLength: 1 }),
4783
- stepId: stringSchema({ minLength: 1 }),
4784
- traceId: stringSchema({ minLength: 1 }),
4785
- artifactId: stringSchema({ minLength: 1 }),
4786
- recordId: stringSchema({ minLength: 1 }),
4787
- payload: jsonValueSchema2
4788
- },
4789
- {
4790
- title: "OpensteerReverseSuggestedEdit",
4791
- required: ["id", "kind", "label"]
4792
- }
4793
- );
4794
- var opensteerReverseExportRecordSchema = objectSchema(
4795
- {
4796
- id: stringSchema({ minLength: 1 }),
4797
- createdAt: integerSchema({ minimum: 0 }),
4798
- candidateId: stringSchema({ minLength: 1 }),
4799
- templateId: stringSchema({ minLength: 1 }),
4800
- packageId: stringSchema({ minLength: 1 }),
4801
- kind: opensteerReversePackageKindSchema,
4802
- readiness: opensteerReversePackageReadinessSchema,
4803
- requestPlanId: stringSchema({ minLength: 1 })
4804
- },
4805
- {
4806
- title: "OpensteerReverseExportRecord",
4807
- required: ["id", "createdAt", "packageId", "kind", "readiness"]
4808
- }
4809
- );
4810
- var opensteerReverseCasePayloadSchema = objectSchema(
4811
- {
4812
- objective: stringSchema({ minLength: 1 }),
4813
- notes: stringSchema({ minLength: 1 }),
4814
- status: opensteerReverseCaseStatusSchema,
4815
- stateSource: opensteerStateSourceKindSchema,
4816
- observations: arraySchema(opensteerReverseObservationRecordSchema),
4817
- observationClusters: arraySchema(opensteerObservationClusterSchema),
4818
- observedRecords: arraySchema(opensteerReverseObservedRecordSchema),
4819
- candidates: arraySchema(opensteerReverseCandidateRecordSchema),
4820
- guards: arraySchema(opensteerReverseGuardRecordSchema),
4821
- stateSnapshots: arraySchema(opensteerStateSnapshotSchema),
4822
- stateDeltas: arraySchema(opensteerStateDeltaSchema),
4823
- experiments: arraySchema(opensteerReverseExperimentRecordSchema),
4824
- replayRuns: arraySchema(opensteerReverseReplayRunRecordSchema),
4825
- exports: arraySchema(opensteerReverseExportRecordSchema)
4826
- },
4827
- {
4828
- title: "OpensteerReverseCasePayload",
4829
- required: [
4830
- "objective",
4831
- "status",
4832
- "stateSource",
4833
- "observations",
4834
- "observationClusters",
4835
- "observedRecords",
4836
- "candidates",
4837
- "guards",
4838
- "stateSnapshots",
4839
- "stateDeltas",
4840
- "experiments",
4841
- "replayRuns",
4842
- "exports"
4843
- ]
4844
- }
4845
- );
4846
- objectSchema(
4847
- {
4848
- id: stringSchema({ minLength: 1 }),
4849
- key: stringSchema({ minLength: 1 }),
4850
- version: stringSchema({ minLength: 1 }),
4851
- createdAt: integerSchema({ minimum: 0 }),
4852
- updatedAt: integerSchema({ minimum: 0 }),
4853
- contentHash: stringSchema({ minLength: 1 }),
4854
- tags: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4855
- provenance: opensteerRegistryProvenanceSchema,
4856
- payload: opensteerReverseCasePayloadSchema
4857
- },
4858
- {
4859
- title: "OpensteerReverseCaseRecord",
4860
- required: ["id", "key", "version", "createdAt", "updatedAt", "contentHash", "tags", "payload"]
4861
- }
4862
- );
4863
- var opensteerReversePackagePayloadSchema = objectSchema(
4864
- {
4865
- kind: opensteerReversePackageKindSchema,
4866
- readiness: opensteerReversePackageReadinessSchema,
4867
- caseId: stringSchema({ minLength: 1 }),
4868
- objective: stringSchema({ minLength: 1 }),
4869
- source: objectSchema(
4870
- {
4871
- kind: enumSchema(["record", "candidate"]),
4872
- id: stringSchema({ minLength: 1 })
4873
- },
4874
- {
4875
- title: "OpensteerReversePackageSource",
4876
- required: ["kind", "id"]
4877
- }
4878
- ),
4879
- sourceRecordId: stringSchema({ minLength: 1 }),
4880
- candidateId: stringSchema({ minLength: 1 }),
4881
- candidate: opensteerReverseCandidateRecordSchema,
4882
- templateId: stringSchema({ minLength: 1 }),
4883
- template: opensteerReverseAdvisoryTemplateSchema,
4884
- channel: opensteerChannelDescriptorSchema,
4885
- stateSource: opensteerStateSourceKindSchema,
4886
- observationId: stringSchema({ minLength: 1 }),
4887
- transport: transportKindSchema,
4888
- guardIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4889
- workflow: arraySchema(opensteerReverseWorkflowStepSchema),
4890
- resolvers: arraySchema(opensteerExecutableResolverSchema),
4891
- validators: arraySchema(opensteerValidationRuleSchema),
4892
- stateSnapshots: arraySchema(opensteerStateSnapshotSchema),
4893
- requirements: opensteerReversePackageRequirementsSchema,
4894
- requestPlanId: stringSchema({ minLength: 1 }),
4895
- unresolvedRequirements: arraySchema(opensteerReverseRequirementSchema),
4896
- suggestedEdits: arraySchema(opensteerReverseSuggestedEditSchema),
4897
- attachedTraceIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4898
- attachedArtifactIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4899
- attachedRecordIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4900
- notes: stringSchema({ minLength: 1 }),
4901
- parentPackageId: stringSchema({ minLength: 1 })
4902
- },
4903
- {
4904
- title: "OpensteerReversePackagePayload",
4905
- required: [
4906
- "kind",
4907
- "readiness",
4908
- "caseId",
4909
- "objective",
4910
- "source",
4911
- "sourceRecordId",
4912
- "guardIds",
4913
- "workflow",
4914
- "resolvers",
4915
- "validators",
4916
- "stateSnapshots",
4917
- "requirements",
4918
- "unresolvedRequirements",
4919
- "suggestedEdits",
4920
- "attachedTraceIds",
4921
- "attachedArtifactIds",
4922
- "attachedRecordIds"
4923
- ]
4924
- }
4925
- );
4926
- var opensteerReversePackageRecordSchema = objectSchema(
4927
- {
4928
- id: stringSchema({ minLength: 1 }),
4929
- key: stringSchema({ minLength: 1 }),
4930
- version: stringSchema({ minLength: 1 }),
4931
- createdAt: integerSchema({ minimum: 0 }),
4932
- updatedAt: integerSchema({ minimum: 0 }),
4933
- contentHash: stringSchema({ minLength: 1 }),
4934
- tags: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
4935
- provenance: opensteerRegistryProvenanceSchema,
4936
- payload: opensteerReversePackagePayloadSchema
4937
- },
4938
- {
4939
- title: "OpensteerReversePackageRecord",
4940
- required: ["id", "key", "version", "createdAt", "updatedAt", "contentHash", "tags", "payload"]
4941
- }
4942
- );
4943
- var opensteerReverseCandidateReportItemSchema = objectSchema(
4944
- {
4945
- candidateId: stringSchema({ minLength: 1 }),
4946
- clusterId: stringSchema({ minLength: 1 }),
4947
- advisoryRank: numberSchema(),
4948
- bodyCodec: opensteerBodyCodecDescriptorSchema,
4949
- summary: stringSchema({ minLength: 1 }),
4950
- advisoryTags: arraySchema(opensteerReverseAdvisoryTagSchema, { uniqueItems: true }),
4951
- constraints: arraySchema(opensteerReverseConstraintKindSchema, { uniqueItems: true }),
4952
- signals: opensteerReverseAdvisorySignalsSchema,
4953
- reasons: arraySchema(stringSchema({ minLength: 1 }))
4954
- },
4955
- {
4956
- title: "OpensteerReverseCandidateAdvisoryItem",
4957
- required: [
4958
- "candidateId",
4959
- "clusterId",
4960
- "advisoryRank",
4961
- "bodyCodec",
4962
- "summary",
4963
- "advisoryTags",
4964
- "constraints",
4965
- "signals",
4966
- "reasons"
4967
- ]
4968
- }
4969
- );
4970
- var opensteerReverseDiscoverySummaryCountsSchema = objectSchema(
4971
- {
4972
- hosts: recordSchema(integerSchema({ minimum: 0 }), { title: "OpensteerReverseSummaryHosts" }),
4973
- channels: recordSchema(integerSchema({ minimum: 0 }), {
4974
- title: "OpensteerReverseSummaryChannels"
4975
- }),
4976
- resourceTypes: recordSchema(integerSchema({ minimum: 0 }), {
4977
- title: "OpensteerReverseSummaryResourceTypes"
4978
- }),
4979
- advisoryTags: recordSchema(integerSchema({ minimum: 0 }), {
4980
- title: "OpensteerReverseSummaryAdvisoryTags"
4981
- }),
4982
- constraints: recordSchema(integerSchema({ minimum: 0 }), {
4983
- title: "OpensteerReverseSummaryConstraints"
4984
- }),
4985
- relationKinds: recordSchema(integerSchema({ minimum: 0 }), {
4986
- title: "OpensteerReverseSummaryRelationKinds"
4987
- })
4988
- },
4989
- {
4990
- title: "OpensteerReverseDiscoverySummaryCounts",
4991
- required: [
4992
- "hosts",
4993
- "channels",
4994
- "resourceTypes",
4995
- "advisoryTags",
4996
- "constraints",
4997
- "relationKinds"
4998
- ]
4999
- }
5000
- );
5001
- var opensteerReverseReportPayloadSchema = objectSchema(
5002
- {
5003
- kind: opensteerReverseReportKindSchema,
5004
- caseId: stringSchema({ minLength: 1 }),
5005
- objective: stringSchema({ minLength: 1 }),
5006
- packageId: stringSchema({ minLength: 1 }),
5007
- packageKind: opensteerReversePackageKindSchema,
5008
- packageReadiness: opensteerReversePackageReadinessSchema,
5009
- observations: arraySchema(opensteerReverseObservationRecordSchema),
5010
- observationClusters: arraySchema(opensteerObservationClusterSchema),
5011
- observedRecords: arraySchema(opensteerReverseObservedRecordSchema),
5012
- guards: arraySchema(opensteerReverseGuardRecordSchema),
5013
- stateDeltas: arraySchema(opensteerStateDeltaSchema),
5014
- summaryCounts: opensteerReverseDiscoverySummaryCountsSchema,
5015
- candidateAdvisories: arraySchema(opensteerReverseCandidateReportItemSchema),
5016
- query: objectSchema(
5017
- {
5018
- view: opensteerReverseQueryViewSchema,
5019
- filters: objectSchema(
5020
- {
5021
- recordId: stringSchema({ minLength: 1 }),
5022
- clusterId: stringSchema({ minLength: 1 }),
5023
- candidateId: stringSchema({ minLength: 1 }),
5024
- host: stringSchema({ minLength: 1 }),
5025
- path: stringSchema({ minLength: 1 }),
5026
- method: stringSchema({ minLength: 1 }),
5027
- status: stringSchema({ minLength: 1 }),
5028
- resourceType: stringSchema({ minLength: 1 }),
5029
- channel: opensteerReverseChannelKindSchema,
5030
- boundary: opensteerReverseCandidateBoundarySchema,
5031
- advisoryTag: opensteerReverseAdvisoryTagSchema,
5032
- constraint: opensteerReverseConstraintKindSchema,
5033
- bodyCodec: opensteerBodyCodecKindSchema,
5034
- relationKind: opensteerObservationClusterRelationshipKindSchema,
5035
- hasGuards: { type: "boolean" },
5036
- hasResolvers: { type: "boolean" },
5037
- artifactId: stringSchema({ minLength: 1 }),
5038
- stateSnapshotId: stringSchema({ minLength: 1 }),
5039
- traceId: stringSchema({ minLength: 1 }),
5040
- evidenceRef: stringSchema({ minLength: 1 }),
5041
- text: stringSchema({ minLength: 1 })
5042
- },
5043
- {
5044
- title: "OpensteerReverseReportQueryFilters"
5045
- }
5046
- ),
5047
- sort: objectSchema(
5048
- {
5049
- preset: opensteerReverseSortPresetSchema,
5050
- keys: arraySchema(
5051
- objectSchema(
5052
- {
5053
- key: opensteerReverseSortKeySchema,
5054
- direction: opensteerReverseSortDirectionSchema
5055
- },
5056
- {
5057
- title: "OpensteerReverseReportQuerySortTerm",
5058
- required: ["key"]
5059
- }
5060
- ),
5061
- { minItems: 1 }
5062
- )
5063
- },
5064
- {
5065
- title: "OpensteerReverseReportQuerySort"
5066
- }
5067
- ),
5068
- limit: integerSchema({ minimum: 1 }),
5069
- totalCount: integerSchema({ minimum: 0 }),
5070
- nextCursor: stringSchema({ minLength: 1 }),
5071
- resultIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
5072
- },
5073
- {
5074
- title: "OpensteerReverseQuerySnapshot",
5075
- required: ["view", "sort", "limit", "totalCount", "resultIds"]
5076
- }
5077
- ),
5078
- experiments: arraySchema(opensteerReverseExperimentRecordSchema),
5079
- replayRuns: arraySchema(opensteerReverseReplayRunRecordSchema),
5080
- unresolvedRequirements: arraySchema(opensteerReverseRequirementSchema),
5081
- suggestedEdits: arraySchema(opensteerReverseSuggestedEditSchema),
5082
- linkedNetworkRecordIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5083
- linkedInteractionTraceIds: arraySchema(stringSchema({ minLength: 1 }), {
5084
- uniqueItems: true
5085
- }),
5086
- linkedArtifactIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5087
- linkedStateSnapshotIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5088
- package: opensteerReversePackageRecordSchema
5089
- },
5090
- {
5091
- title: "OpensteerReverseReportPayload",
5092
- required: [
5093
- "kind",
5094
- "caseId",
5095
- "objective",
5096
- "observations",
5097
- "observationClusters",
5098
- "observedRecords",
5099
- "guards",
5100
- "stateDeltas",
5101
- "summaryCounts",
5102
- "candidateAdvisories",
5103
- "experiments",
5104
- "replayRuns",
5105
- "linkedNetworkRecordIds",
5106
- "linkedInteractionTraceIds",
5107
- "linkedArtifactIds",
5108
- "linkedStateSnapshotIds"
5109
- ]
5110
- }
5111
- );
5112
- var opensteerReverseReportRecordSchema = objectSchema(
5113
- {
5114
- id: stringSchema({ minLength: 1 }),
5115
- key: stringSchema({ minLength: 1 }),
5116
- version: stringSchema({ minLength: 1 }),
5117
- createdAt: integerSchema({ minimum: 0 }),
5118
- updatedAt: integerSchema({ minimum: 0 }),
5119
- contentHash: stringSchema({ minLength: 1 }),
5120
- tags: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5121
- provenance: opensteerRegistryProvenanceSchema,
5122
- payload: opensteerReverseReportPayloadSchema
5123
- },
5124
- {
5125
- title: "OpensteerReverseReportRecord",
5126
- required: ["id", "key", "version", "createdAt", "updatedAt", "contentHash", "tags", "payload"]
5127
- }
5128
- );
5129
- var opensteerReverseNetworkFilterSchema = objectSchema(
5130
- {
5131
- url: stringSchema({ minLength: 1 }),
5132
- hostname: stringSchema({ minLength: 1 }),
5133
- path: stringSchema({ minLength: 1 }),
5134
- method: stringSchema({ minLength: 1 }),
5135
- resourceType: stringSchema({ minLength: 1 }),
5136
- includeBodies: { type: "boolean" }
5137
- },
5138
- {
5139
- title: "OpensteerReverseCaptureNetworkFilter"
5140
- }
5141
- );
5142
- var opensteerReverseQueryFiltersSchema = objectSchema(
5143
- {
5144
- recordId: stringSchema({ minLength: 1 }),
5145
- clusterId: stringSchema({ minLength: 1 }),
5146
- candidateId: stringSchema({ minLength: 1 }),
5147
- host: stringSchema({ minLength: 1 }),
5148
- path: stringSchema({ minLength: 1 }),
5149
- method: stringSchema({ minLength: 1 }),
5150
- status: stringSchema({ minLength: 1 }),
5151
- resourceType: stringSchema({ minLength: 1 }),
5152
- channel: opensteerReverseChannelKindSchema,
5153
- boundary: opensteerReverseCandidateBoundarySchema,
5154
- advisoryTag: opensteerReverseAdvisoryTagSchema,
5155
- constraint: opensteerReverseConstraintKindSchema,
5156
- bodyCodec: opensteerBodyCodecKindSchema,
5157
- relationKind: opensteerObservationClusterRelationshipKindSchema,
5158
- hasGuards: { type: "boolean" },
5159
- hasResolvers: { type: "boolean" },
5160
- artifactId: stringSchema({ minLength: 1 }),
5161
- stateSnapshotId: stringSchema({ minLength: 1 }),
5162
- traceId: stringSchema({ minLength: 1 }),
5163
- evidenceRef: stringSchema({ minLength: 1 }),
5164
- text: stringSchema({ minLength: 1 })
5165
- },
5166
- {
5167
- title: "OpensteerReverseQueryFilters"
5168
- }
5169
- );
5170
- var opensteerReverseQuerySortSchema = objectSchema(
5171
- {
5172
- preset: opensteerReverseSortPresetSchema,
5173
- keys: arraySchema(
5174
- objectSchema(
5175
- {
5176
- key: opensteerReverseSortKeySchema,
5177
- direction: opensteerReverseSortDirectionSchema
5178
- },
5179
- {
5180
- title: "OpensteerReverseSortTerm",
5181
- required: ["key"]
5182
- }
5183
- ),
5184
- { minItems: 1 }
5185
- )
5186
- },
5187
- {
5188
- title: "OpensteerReverseQuerySort"
5189
- }
5190
- );
5191
- var opensteerReverseQuerySnapshotSchema = objectSchema(
5192
- {
5193
- view: opensteerReverseQueryViewSchema,
5194
- filters: opensteerReverseQueryFiltersSchema,
5195
- sort: opensteerReverseQuerySortSchema,
5196
- limit: integerSchema({ minimum: 1, maximum: 200 }),
5197
- totalCount: integerSchema({ minimum: 0 }),
5198
- nextCursor: stringSchema({ minLength: 1 }),
5199
- resultIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
5200
- },
5201
- {
5202
- title: "OpensteerReverseQuerySnapshot",
5203
- required: ["view", "sort", "limit", "totalCount", "resultIds"]
5204
- }
5205
- );
5206
- var opensteerReverseQueryRecordItemSchema = objectSchema(
5207
- {
5208
- record: opensteerReverseObservedRecordSchema,
5209
- candidateIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
5210
- },
5211
- {
5212
- title: "OpensteerReverseQueryRecordItem",
5213
- required: ["record", "candidateIds"]
5214
- }
5215
- );
5216
- var opensteerReverseQueryClusterItemSchema = objectSchema(
5217
- {
5218
- cluster: opensteerObservationClusterSchema,
5219
- candidateIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
5220
- },
5221
- {
5222
- title: "OpensteerReverseQueryClusterItem",
5223
- required: ["cluster", "candidateIds"]
5224
- }
5225
- );
5226
- var opensteerReverseQueryCandidateItemSchema = objectSchema(
5227
- {
5228
- candidate: opensteerReverseCandidateRecordSchema,
5229
- reasons: arraySchema(stringSchema({ minLength: 1 }))
5230
- },
5231
- {
5232
- title: "OpensteerReverseQueryCandidateItem",
5233
- required: ["candidate", "reasons"]
5234
- }
5235
- );
5236
- objectSchema(
5237
- {
5238
- caseId: stringSchema({ minLength: 1 }),
5239
- key: stringSchema({ minLength: 1 }),
5240
- objective: stringSchema({ minLength: 1 }),
5241
- notes: stringSchema({ minLength: 1 }),
5242
- tags: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5243
- pageRef: pageRefSchema,
5244
- stateSource: opensteerStateSourceKindSchema,
5245
- network: opensteerReverseNetworkFilterSchema,
5246
- includeScripts: { type: "boolean" },
5247
- includeStorage: { type: "boolean" },
5248
- includeSessionStorage: { type: "boolean" },
5249
- includeIndexedDb: { type: "boolean" },
5250
- interactionTraceIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5251
- targetHints: opensteerReverseTargetHintsSchema,
5252
- captureWindowMs: integerSchema({ minimum: 0 }),
5253
- manualCalibration: opensteerReverseManualCalibrationModeSchema
5254
- },
5255
- {
5256
- title: "OpensteerReverseDiscoverInput"
5257
- }
5258
- );
5259
- objectSchema(
5260
- {
5261
- caseId: stringSchema({ minLength: 1 }),
5262
- reportId: stringSchema({ minLength: 1 }),
5263
- summary: objectSchema(
5264
- {
5265
- observationIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5266
- recordCount: integerSchema({ minimum: 0 }),
5267
- clusterCount: integerSchema({ minimum: 0 }),
5268
- candidateCount: integerSchema({ minimum: 0 })
5269
- },
5270
- {
5271
- title: "OpensteerReverseDiscoverSummary",
5272
- required: ["observationIds", "recordCount", "clusterCount", "candidateCount"]
5273
- }
5274
- ),
5275
- index: objectSchema(
5276
- {
5277
- views: arraySchema(opensteerReverseQueryViewSchema, { uniqueItems: true }),
5278
- sortableKeys: arraySchema(opensteerReverseSortKeySchema, { uniqueItems: true }),
5279
- channels: arraySchema(opensteerReverseChannelKindSchema, { uniqueItems: true }),
5280
- hosts: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5281
- relationKinds: arraySchema(opensteerObservationClusterRelationshipKindSchema, {
5282
- uniqueItems: true
5283
- })
5284
- },
5285
- {
5286
- title: "OpensteerReverseDiscoverIndex",
5287
- required: ["views", "sortableKeys", "channels", "hosts", "relationKinds"]
5288
- }
5289
- )
5290
- },
5291
- {
5292
- title: "OpensteerReverseDiscoverOutput",
5293
- required: ["caseId", "reportId", "summary", "index"]
5294
- }
5295
- );
5296
- objectSchema(
5297
- {
5298
- caseId: stringSchema({ minLength: 1 }),
5299
- view: opensteerReverseQueryViewSchema,
5300
- filters: opensteerReverseQueryFiltersSchema,
5301
- sort: opensteerReverseQuerySortSchema,
5302
- limit: integerSchema({ minimum: 1, maximum: 200 }),
5303
- cursor: stringSchema({ minLength: 1 })
5304
- },
5305
- {
5306
- title: "OpensteerReverseQueryInput",
5307
- required: ["caseId"]
5308
- }
5309
- );
5310
- objectSchema(
5311
- {
5312
- caseId: stringSchema({ minLength: 1 }),
5313
- view: opensteerReverseQueryViewSchema,
5314
- query: opensteerReverseQuerySnapshotSchema,
5315
- totalCount: integerSchema({ minimum: 0 }),
5316
- nextCursor: stringSchema({ minLength: 1 }),
5317
- records: arraySchema(opensteerReverseQueryRecordItemSchema),
5318
- clusters: arraySchema(opensteerReverseQueryClusterItemSchema),
5319
- candidates: arraySchema(opensteerReverseQueryCandidateItemSchema)
5320
- },
5321
- {
5322
- title: "OpensteerReverseQueryOutput",
5323
- required: ["caseId", "view", "query", "totalCount"]
5324
- }
5325
- );
5326
- objectSchema(
5327
- {
5328
- caseId: stringSchema({ minLength: 1 }),
5329
- source: objectSchema(
5330
- {
5331
- kind: enumSchema(["record", "candidate"]),
5332
- id: stringSchema({ minLength: 1 })
5333
- },
5334
- {
5335
- title: "OpensteerReversePackageCreateSource",
5336
- required: ["kind", "id"]
5337
- }
5338
- ),
5339
- templateId: stringSchema({ minLength: 1 }),
5340
- key: stringSchema({ minLength: 1 }),
5341
- version: stringSchema({ minLength: 1 }),
5342
- notes: stringSchema({ minLength: 1 })
5343
- },
5344
- {
5345
- title: "OpensteerReversePackageCreateInput",
5346
- required: ["caseId", "source"]
5347
- }
5348
- );
5349
- objectSchema(
5350
- {
5351
- package: opensteerReversePackageRecordSchema,
5352
- report: opensteerReverseReportRecordSchema
5353
- },
5354
- {
5355
- title: "OpensteerReversePackageCreateOutput",
5356
- required: ["package", "report"]
5357
- }
5358
- );
5359
- objectSchema(
5360
- {
5361
- packageId: stringSchema({ minLength: 1 }),
5362
- pageRef: pageRefSchema
5363
- },
5364
- {
5365
- title: "OpensteerReversePackageRunInput",
5366
- required: ["packageId"]
5367
- }
5368
- );
5369
- objectSchema(
5370
- {
5371
- packageId: stringSchema({ minLength: 1 }),
5372
- caseId: stringSchema({ minLength: 1 }),
5373
- source: objectSchema(
5374
- {
5375
- kind: enumSchema(["record", "candidate"]),
5376
- id: stringSchema({ minLength: 1 })
5377
- },
5378
- {
5379
- title: "OpensteerReversePackageRunSource",
5380
- required: ["kind", "id"]
5381
- }
5382
- ),
5383
- candidateId: stringSchema({ minLength: 1 }),
5384
- templateId: stringSchema({ minLength: 1 }),
5385
- success: { type: "boolean" },
5386
- kind: opensteerReversePackageKindSchema,
5387
- readiness: opensteerReversePackageReadinessSchema,
5388
- channel: opensteerReverseChannelKindSchema,
5389
- transport: transportKindSchema,
5390
- stateSource: opensteerStateSourceKindSchema,
5391
- recordId: stringSchema({ minLength: 1 }),
5392
- status: integerSchema({ minimum: 0 }),
5393
- validation: opensteerReverseReplayValidationSchema,
5394
- executedStepIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5395
- failedStepId: stringSchema({ minLength: 1 }),
5396
- bindings: recordSchema({}, { title: "OpensteerReversePackageRunBindings" }),
5397
- replayRunId: stringSchema({ minLength: 1 }),
5398
- unresolvedRequirements: arraySchema(opensteerReverseRequirementSchema),
5399
- suggestedEdits: arraySchema(opensteerReverseSuggestedEditSchema),
5400
- error: stringSchema({ minLength: 1 })
5401
- },
5402
- {
5403
- title: "OpensteerReversePackageRunOutput",
5404
- required: [
5405
- "packageId",
5406
- "source",
5407
- "success",
5408
- "kind",
5409
- "readiness",
5410
- "validation",
5411
- "executedStepIds",
5412
- "bindings",
5413
- "unresolvedRequirements",
5414
- "suggestedEdits"
5415
- ]
5416
- }
5417
- );
5418
- objectSchema(
5419
- {
5420
- packageId: stringSchema({ minLength: 1 }),
5421
- key: stringSchema({ minLength: 1 }),
5422
- version: stringSchema({ minLength: 1 })
5423
- },
5424
- {
5425
- title: "OpensteerReverseExportInput",
5426
- required: ["packageId"]
5427
- }
5428
- );
5429
- objectSchema(
5430
- {
5431
- package: opensteerReversePackageRecordSchema,
5432
- requestPlan: opensteerRequestPlanRecordSchema
5433
- },
5434
- {
5435
- title: "OpensteerReverseExportOutput",
5436
- required: ["package"]
5437
- }
5438
- );
5439
- objectSchema(
5440
- {
5441
- caseId: stringSchema({ minLength: 1 }),
5442
- packageId: stringSchema({ minLength: 1 }),
5443
- reportId: stringSchema({ minLength: 1 }),
5444
- kind: opensteerReverseReportKindSchema
5445
- },
5446
- {
5447
- title: "OpensteerReverseReportInput"
5448
- }
5449
- );
5450
- objectSchema(
5451
- {
5452
- report: opensteerReverseReportRecordSchema
5453
- },
5454
- {
5455
- title: "OpensteerReverseReportOutput",
5456
- required: ["report"]
5457
- }
5458
- );
5459
- objectSchema(
5460
- {
5461
- packageId: stringSchema({ minLength: 1 })
5462
- },
5463
- {
5464
- title: "OpensteerReversePackageGetInput",
5465
- required: ["packageId"]
5466
- }
5467
- );
5468
- objectSchema(
5469
- {
5470
- package: opensteerReversePackageRecordSchema
5471
- },
5472
- {
5473
- title: "OpensteerReversePackageGetOutput",
5474
- required: ["package"]
5475
- }
5476
- );
5477
- objectSchema(
5478
- {
5479
- caseId: stringSchema({ minLength: 1 }),
5480
- key: stringSchema({ minLength: 1 }),
5481
- kind: opensteerReversePackageKindSchema,
5482
- readiness: opensteerReversePackageReadinessSchema
5483
- },
5484
- {
5485
- title: "OpensteerReversePackageListInput"
5486
- }
5487
- );
5488
- objectSchema(
5489
- {
5490
- packages: arraySchema(opensteerReversePackageRecordSchema)
5491
- },
5492
- {
5493
- title: "OpensteerReversePackageListOutput",
5494
- required: ["packages"]
5495
- }
5496
- );
5497
- objectSchema(
5498
- {
5499
- packageId: stringSchema({ minLength: 1 }),
5500
- key: stringSchema({ minLength: 1 }),
5501
- version: stringSchema({ minLength: 1 }),
5502
- notes: stringSchema({ minLength: 1 }),
5503
- workflow: arraySchema(opensteerReverseWorkflowStepSchema),
5504
- resolvers: arraySchema(opensteerExecutableResolverSchema),
5505
- validators: arraySchema(opensteerValidationRuleSchema),
5506
- attachedTraceIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5507
- attachedArtifactIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5508
- attachedRecordIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true }),
5509
- stateSnapshotIds: arraySchema(stringSchema({ minLength: 1 }), { uniqueItems: true })
5510
- },
5511
- {
5512
- title: "OpensteerReversePackagePatchInput",
5513
- required: ["packageId"]
5514
- }
5515
- );
5516
- objectSchema(
5517
- {
5518
- package: opensteerReversePackageRecordSchema,
5519
- report: opensteerReverseReportRecordSchema
3590
+ }
3591
+ ),
3592
+ capturedAjax: arraySchema(sandboxCapturedAjaxCallSchema),
3593
+ errors: arraySchema(stringSchema({ minLength: 1 })),
3594
+ durationMs: integerSchema({ minimum: 0 })
5520
3595
  },
5521
3596
  {
5522
- title: "OpensteerReversePackagePatchOutput",
5523
- required: ["package", "report"]
3597
+ title: "OpensteerScriptSandboxOutput",
3598
+ required: ["capturedAjax", "errors", "durationMs"]
5524
3599
  }
5525
3600
  );
5526
3601
 
@@ -6375,12 +4450,12 @@ var opensteerDomExtractInputSchema = defineSchema({
6375
4450
  ),
6376
4451
  anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
6377
4452
  });
6378
- var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
4453
+ var jsonValueSchema2 = recordSchema({}, { title: "JsonValueRecord" });
6379
4454
  var opensteerDomExtractOutputSchema = objectSchema(
6380
4455
  {
6381
4456
  data: oneOfSchema(
6382
4457
  [
6383
- jsonValueSchema3,
4458
+ jsonValueSchema2,
6384
4459
  arraySchema({}),
6385
4460
  stringSchema(),
6386
4461
  numberSchema(),
@@ -6783,7 +4858,7 @@ var opensteerSemanticOperationSpecificationsBase = [
6783
4858
  }),
6784
4859
  defineSemanticOperationSpec({
6785
4860
  name: "artifact.read",
6786
- description: "Read a persisted artifact by ID so agents can inspect captured scripts, storage, cookies, or snapshots linked from reverse packages and reports.",
4861
+ description: "Read a persisted artifact by ID so agents can inspect captured scripts, storage, cookies, or snapshots linked from recorded workflows.",
6787
4862
  inputSchema: opensteerArtifactReadInputSchema,
6788
4863
  outputSchema: opensteerArtifactReadOutputSchema,
6789
4864
  requiredCapabilities: []
@@ -6992,9 +5067,9 @@ function compareByCreatedAtAndId(left, right) {
6992
5067
  var FilesystemRegistryStore = class {
6993
5068
  constructor(rootPath, registryRelativePath) {
6994
5069
  this.registryRelativePath = registryRelativePath;
6995
- const basePath = path7__default.default.join(rootPath, ...registryRelativePath);
6996
- this.recordsDirectory = path7__default.default.join(basePath, "records");
6997
- this.indexesDirectory = path7__default.default.join(basePath, "indexes", "by-key");
5070
+ const basePath = path10__default.default.join(rootPath, ...registryRelativePath);
5071
+ this.recordsDirectory = path10__default.default.join(basePath, "records");
5072
+ this.indexesDirectory = path10__default.default.join(basePath, "indexes", "by-key");
6998
5073
  }
6999
5074
  recordsDirectory;
7000
5075
  indexesDirectory;
@@ -7063,7 +5138,7 @@ var FilesystemRegistryStore = class {
7063
5138
  async readRecordsFromDirectory() {
7064
5139
  const files = await listJsonFiles(this.recordsDirectory);
7065
5140
  const records = await Promise.all(
7066
- files.map((fileName) => readJsonFile(path7__default.default.join(this.recordsDirectory, fileName)))
5141
+ files.map((fileName) => readJsonFile(path10__default.default.join(this.recordsDirectory, fileName)))
7067
5142
  );
7068
5143
  records.sort(compareByCreatedAtAndId);
7069
5144
  return records;
@@ -7095,17 +5170,17 @@ var FilesystemRegistryStore = class {
7095
5170
  return record;
7096
5171
  }
7097
5172
  recordPath(id) {
7098
- return path7__default.default.join(this.recordsDirectory, `${encodePathSegment(id)}.json`);
5173
+ return path10__default.default.join(this.recordsDirectory, `${encodePathSegment(id)}.json`);
7099
5174
  }
7100
5175
  indexPath(key, version) {
7101
- return path7__default.default.join(
5176
+ return path10__default.default.join(
7102
5177
  this.indexesDirectory,
7103
5178
  encodePathSegment(key),
7104
5179
  `${encodePathSegment(version)}.json`
7105
5180
  );
7106
5181
  }
7107
5182
  writeLockPath() {
7108
- return path7__default.default.join(path7__default.default.dirname(this.recordsDirectory), ".write.lock");
5183
+ return path10__default.default.join(path10__default.default.dirname(this.recordsDirectory), ".write.lock");
7109
5184
  }
7110
5185
  };
7111
5186
  var FilesystemDescriptorRegistry = class extends FilesystemRegistryStore {
@@ -7204,76 +5279,6 @@ var FilesystemRequestPlanRegistry = class extends FilesystemRegistryStore {
7204
5279
  });
7205
5280
  }
7206
5281
  };
7207
- var FilesystemAuthRecipeRegistry = class extends FilesystemRegistryStore {
7208
- constructor(rootPath) {
7209
- super(rootPath, ["registry", "auth-recipes"]);
7210
- }
7211
- async write(input) {
7212
- const id = normalizeNonEmptyString("id", input.id ?? `auth-recipe:${crypto.randomUUID()}`);
7213
- const key = normalizeNonEmptyString("key", input.key);
7214
- const version = normalizeNonEmptyString("version", input.version);
7215
- const createdAt = normalizeTimestamp("createdAt", input.createdAt ?? Date.now());
7216
- const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? createdAt);
7217
- if (updatedAt < createdAt) {
7218
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7219
- }
7220
- const payload = input.payload;
7221
- const contentHash = sha256Hex(Buffer.from(canonicalJsonString(payload), "utf8"));
7222
- const provenance = normalizeProvenance2(input.provenance);
7223
- const record = {
7224
- id,
7225
- key,
7226
- version,
7227
- createdAt,
7228
- updatedAt,
7229
- contentHash,
7230
- tags: normalizeTags(input.tags),
7231
- ...provenance === void 0 ? {} : { provenance },
7232
- payload
7233
- };
7234
- return this.writeRecord(record);
7235
- }
7236
- async list(input = {}) {
7237
- const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
7238
- const records = await this.readAllRecords();
7239
- return key === void 0 ? records : records.filter((record) => record.key === key);
7240
- }
7241
- };
7242
- var FilesystemRecipeRegistry = class extends FilesystemRegistryStore {
7243
- constructor(rootPath) {
7244
- super(rootPath, ["registry", "recipes"]);
7245
- }
7246
- async write(input) {
7247
- const id = normalizeNonEmptyString("id", input.id ?? `recipe:${crypto.randomUUID()}`);
7248
- const key = normalizeNonEmptyString("key", input.key);
7249
- const version = normalizeNonEmptyString("version", input.version);
7250
- const createdAt = normalizeTimestamp("createdAt", input.createdAt ?? Date.now());
7251
- const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? createdAt);
7252
- if (updatedAt < createdAt) {
7253
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7254
- }
7255
- const payload = input.payload;
7256
- const contentHash = sha256Hex(Buffer.from(canonicalJsonString(payload), "utf8"));
7257
- const provenance = normalizeProvenance2(input.provenance);
7258
- const record = {
7259
- id,
7260
- key,
7261
- version,
7262
- createdAt,
7263
- updatedAt,
7264
- contentHash,
7265
- tags: normalizeTags(input.tags),
7266
- ...provenance === void 0 ? {} : { provenance },
7267
- payload
7268
- };
7269
- return this.writeRecord(record);
7270
- }
7271
- async list(input = {}) {
7272
- const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
7273
- const records = await this.readAllRecords();
7274
- return key === void 0 ? records : records.filter((record) => record.key === key);
7275
- }
7276
- };
7277
5282
  var FilesystemInteractionTraceRegistry = class extends FilesystemRegistryStore {
7278
5283
  constructor(rootPath) {
7279
5284
  super(rootPath, ["registry", "interaction-traces"]);
@@ -7309,163 +5314,15 @@ var FilesystemInteractionTraceRegistry = class extends FilesystemRegistryStore {
7309
5314
  return key === void 0 ? records : records.filter((record) => record.key === key);
7310
5315
  }
7311
5316
  };
7312
- var FilesystemReverseCaseRegistry = class extends FilesystemRegistryStore {
7313
- constructor(rootPath) {
7314
- super(rootPath, ["registry", "reverse-cases"]);
7315
- }
7316
- async write(input) {
7317
- const id = normalizeNonEmptyString("id", input.id ?? `reverse-case:${crypto.randomUUID()}`);
7318
- const key = normalizeNonEmptyString("key", input.key);
7319
- const version = normalizeNonEmptyString("version", input.version);
7320
- const createdAt = normalizeTimestamp("createdAt", input.createdAt ?? Date.now());
7321
- const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? createdAt);
7322
- if (updatedAt < createdAt) {
7323
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7324
- }
7325
- const payload = input.payload;
7326
- const contentHash = sha256Hex(Buffer.from(canonicalJsonString(payload), "utf8"));
7327
- const provenance = normalizeProvenance2(input.provenance);
7328
- const record = {
7329
- id,
7330
- key,
7331
- version,
7332
- createdAt,
7333
- updatedAt,
7334
- contentHash,
7335
- tags: normalizeTags(input.tags),
7336
- ...provenance === void 0 ? {} : { provenance },
7337
- payload
7338
- };
7339
- return this.writeRecord(record);
7340
- }
7341
- async list(input = {}) {
7342
- const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
7343
- const records = await this.readAllRecords();
7344
- return key === void 0 ? records : records.filter((record) => record.key === key);
7345
- }
7346
- async update(input) {
7347
- const id = normalizeNonEmptyString("id", input.id);
7348
- return withFilesystemLock(this.writeLockPath(), async () => {
7349
- const existing = await this.getById(id);
7350
- if (existing === void 0) {
7351
- throw new Error(`registry record ${id} was not found`);
7352
- }
7353
- const nextUpdatedAt = normalizeTimestamp(
7354
- "updatedAt",
7355
- input.updatedAt ?? Math.max(Date.now(), existing.updatedAt)
7356
- );
7357
- if (nextUpdatedAt < existing.createdAt) {
7358
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7359
- }
7360
- const nextPayload = input.payload;
7361
- const nextProvenance = normalizeProvenance2(input.provenance ?? existing.provenance);
7362
- const nextRecord = {
7363
- ...existing,
7364
- updatedAt: nextUpdatedAt,
7365
- contentHash: sha256Hex(Buffer.from(canonicalJsonString(nextPayload), "utf8")),
7366
- tags: normalizeTags(input.tags ?? existing.tags),
7367
- ...nextProvenance === void 0 ? {} : { provenance: nextProvenance },
7368
- payload: nextPayload
7369
- };
7370
- await writeJsonFileAtomic(this.recordPath(id), nextRecord);
7371
- return nextRecord;
7372
- });
7373
- }
7374
- };
7375
- var FilesystemReversePackageRegistry = class extends FilesystemRegistryStore {
7376
- constructor(rootPath) {
7377
- super(rootPath, ["registry", "reverse-packages"]);
7378
- }
7379
- async write(input) {
7380
- const id = normalizeNonEmptyString("id", input.id ?? `reverse-package:${crypto.randomUUID()}`);
7381
- const key = normalizeNonEmptyString("key", input.key);
7382
- const version = normalizeNonEmptyString("version", input.version);
7383
- const createdAt = normalizeTimestamp("createdAt", input.createdAt ?? Date.now());
7384
- const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? createdAt);
7385
- if (updatedAt < createdAt) {
7386
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7387
- }
7388
- const payload = input.payload;
7389
- const contentHash = sha256Hex(Buffer.from(canonicalJsonString(payload), "utf8"));
7390
- const provenance = normalizeProvenance2(input.provenance);
7391
- const record = {
7392
- id,
7393
- key,
7394
- version,
7395
- createdAt,
7396
- updatedAt,
7397
- contentHash,
7398
- tags: normalizeTags(input.tags),
7399
- ...provenance === void 0 ? {} : { provenance },
7400
- payload
7401
- };
7402
- return this.writeRecord(record);
7403
- }
7404
- async list(input = {}) {
7405
- const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
7406
- const records = await this.readAllRecords();
7407
- return key === void 0 ? records : records.filter((record) => record.key === key);
7408
- }
7409
- };
7410
- var FilesystemReverseReportRegistry = class extends FilesystemRegistryStore {
7411
- constructor(rootPath) {
7412
- super(rootPath, ["registry", "reverse-reports"]);
7413
- }
7414
- async write(input) {
7415
- const id = normalizeNonEmptyString("id", input.id ?? `reverse-report:${crypto.randomUUID()}`);
7416
- const key = normalizeNonEmptyString("key", input.key);
7417
- const version = normalizeNonEmptyString("version", input.version);
7418
- const createdAt = normalizeTimestamp("createdAt", input.createdAt ?? Date.now());
7419
- const updatedAt = normalizeTimestamp("updatedAt", input.updatedAt ?? createdAt);
7420
- if (updatedAt < createdAt) {
7421
- throw new RangeError("updatedAt must be greater than or equal to createdAt");
7422
- }
7423
- const payload = input.payload;
7424
- const contentHash = sha256Hex(Buffer.from(canonicalJsonString(payload), "utf8"));
7425
- const provenance = normalizeProvenance2(input.provenance);
7426
- const record = {
7427
- id,
7428
- key,
7429
- version,
7430
- createdAt,
7431
- updatedAt,
7432
- contentHash,
7433
- tags: normalizeTags(input.tags),
7434
- ...provenance === void 0 ? {} : { provenance },
7435
- payload
7436
- };
7437
- return this.writeRecord(record);
7438
- }
7439
- async list(input = {}) {
7440
- const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
7441
- const records = await this.readAllRecords();
7442
- return key === void 0 ? records : records.filter((record) => record.key === key);
7443
- }
7444
- };
7445
5317
  function createDescriptorRegistry(rootPath) {
7446
5318
  return new FilesystemDescriptorRegistry(rootPath);
7447
5319
  }
7448
5320
  function createRequestPlanRegistry(rootPath) {
7449
5321
  return new FilesystemRequestPlanRegistry(rootPath);
7450
5322
  }
7451
- function createAuthRecipeRegistry(rootPath) {
7452
- return new FilesystemAuthRecipeRegistry(rootPath);
7453
- }
7454
- function createRecipeRegistry(rootPath) {
7455
- return new FilesystemRecipeRegistry(rootPath);
7456
- }
7457
5323
  function createInteractionTraceRegistry(rootPath) {
7458
5324
  return new FilesystemInteractionTraceRegistry(rootPath);
7459
5325
  }
7460
- function createReverseCaseRegistry(rootPath) {
7461
- return new FilesystemReverseCaseRegistry(rootPath);
7462
- }
7463
- function createReversePackageRegistry(rootPath) {
7464
- return new FilesystemReversePackageRegistry(rootPath);
7465
- }
7466
- function createReverseReportRegistry(rootPath) {
7467
- return new FilesystemReverseReportRegistry(rootPath);
7468
- }
7469
5326
  var TAG_DELIMITER = "";
7470
5327
  var NODE_SQLITE_SPECIFIER = `node:${"sqlite"}`;
7471
5328
  var SAVED_NETWORK_SQLITE_SUPPORT_ERROR = "Saved-network operations require Node's built-in SQLite support. Use a Node runtime with node:sqlite enabled.";
@@ -7475,7 +5332,7 @@ var SqliteSavedNetworkStore = class {
7475
5332
  directoryInitialization;
7476
5333
  databaseInitialization;
7477
5334
  constructor(rootPath) {
7478
- this.databasePath = path7__default.default.join(rootPath, "registry", "saved-network.sqlite");
5335
+ this.databasePath = path10__default.default.join(rootPath, "registry", "saved-network.sqlite");
7479
5336
  }
7480
5337
  async initialize() {
7481
5338
  await this.ensureDatabaseDirectory();
@@ -7715,7 +5572,7 @@ var SqliteSavedNetworkStore = class {
7715
5572
  }
7716
5573
  }
7717
5574
  async ensureDatabaseDirectory() {
7718
- this.directoryInitialization ??= ensureDirectory(path7__default.default.dirname(this.databasePath)).catch(
5575
+ this.directoryInitialization ??= ensureDirectory(path10__default.default.dirname(this.databasePath)).catch(
7719
5576
  (error) => {
7720
5577
  this.directoryInitialization = void 0;
7721
5578
  throw error;
@@ -8314,7 +6171,7 @@ var FilesystemObservationStoreImpl = class {
8314
6171
  constructor(rootPath, artifacts) {
8315
6172
  this.rootPath = rootPath;
8316
6173
  this.artifacts = artifacts;
8317
- this.sessionsDirectory = path7__default.default.join(this.rootPath, "observations", "sessions");
6174
+ this.sessionsDirectory = path10__default.default.join(this.rootPath, "observations", "sessions");
8318
6175
  }
8319
6176
  sessionsDirectory;
8320
6177
  redactors = /* @__PURE__ */ new Map();
@@ -8411,7 +6268,7 @@ var FilesystemObservationStoreImpl = class {
8411
6268
  ...raw.artifactIds === void 0 || raw.artifactIds.length === 0 ? {} : { artifactIds: [...raw.artifactIds] }
8412
6269
  };
8413
6270
  await writeJsonFileExclusive(
8414
- path7__default.default.join(this.sessionEventsDirectory(sessionId), eventFileName(sequence)),
6271
+ path10__default.default.join(this.sessionEventsDirectory(sessionId), eventFileName(sequence)),
8415
6272
  event
8416
6273
  );
8417
6274
  updatedAt = Math.max(updatedAt, createdAt);
@@ -8469,7 +6326,7 @@ var FilesystemObservationStoreImpl = class {
8469
6326
  }
8470
6327
  const files = await listJsonFiles(directoryPath);
8471
6328
  const events = await Promise.all(
8472
- files.map((fileName) => readJsonFile(path7__default.default.join(directoryPath, fileName)))
6329
+ files.map((fileName) => readJsonFile(path10__default.default.join(directoryPath, fileName)))
8473
6330
  );
8474
6331
  const filtered = events.filter((event) => {
8475
6332
  if (input.kind !== void 0 && event.kind !== input.kind) return false;
@@ -8496,7 +6353,7 @@ var FilesystemObservationStoreImpl = class {
8496
6353
  const files = await listJsonFiles(directoryPath);
8497
6354
  const artifacts = await Promise.all(
8498
6355
  files.map(
8499
- (fileName) => readJsonFile(path7__default.default.join(directoryPath, fileName))
6356
+ (fileName) => readJsonFile(path10__default.default.join(directoryPath, fileName))
8500
6357
  )
8501
6358
  );
8502
6359
  const filtered = artifacts.filter((artifact) => {
@@ -8559,25 +6416,25 @@ var FilesystemObservationStoreImpl = class {
8559
6416
  )).filter((value) => value !== void 0);
8560
6417
  }
8561
6418
  sessionDirectory(sessionId) {
8562
- return path7__default.default.join(this.sessionsDirectory, encodePathSegment(sessionId));
6419
+ return path10__default.default.join(this.sessionsDirectory, encodePathSegment(sessionId));
8563
6420
  }
8564
6421
  sessionManifestPath(sessionId) {
8565
- return path7__default.default.join(this.sessionDirectory(sessionId), "session.json");
6422
+ return path10__default.default.join(this.sessionDirectory(sessionId), "session.json");
8566
6423
  }
8567
6424
  sessionEventsDirectory(sessionId) {
8568
- return path7__default.default.join(this.sessionDirectory(sessionId), "events");
6425
+ return path10__default.default.join(this.sessionDirectory(sessionId), "events");
8569
6426
  }
8570
6427
  sessionArtifactsDirectory(sessionId) {
8571
- return path7__default.default.join(this.sessionDirectory(sessionId), "artifacts");
6428
+ return path10__default.default.join(this.sessionDirectory(sessionId), "artifacts");
8572
6429
  }
8573
6430
  sessionArtifactPath(sessionId, artifactId) {
8574
- return path7__default.default.join(
6431
+ return path10__default.default.join(
8575
6432
  this.sessionArtifactsDirectory(sessionId),
8576
6433
  `${encodePathSegment(artifactId)}.json`
8577
6434
  );
8578
6435
  }
8579
6436
  sessionLockPath(sessionId) {
8580
- return path7__default.default.join(this.sessionDirectory(sessionId), ".lock");
6437
+ return path10__default.default.join(this.sessionDirectory(sessionId), ".lock");
8581
6438
  }
8582
6439
  async reconcileSessionManifest(sessionId) {
8583
6440
  const session = await this.getSession(sessionId);
@@ -8605,14 +6462,14 @@ var FilesystemObservationStoreImpl = class {
8605
6462
  Promise.all(
8606
6463
  eventFiles.map(
8607
6464
  (fileName) => readJsonFile(
8608
- path7__default.default.join(this.sessionEventsDirectory(sessionId), fileName)
6465
+ path10__default.default.join(this.sessionEventsDirectory(sessionId), fileName)
8609
6466
  )
8610
6467
  )
8611
6468
  ),
8612
6469
  Promise.all(
8613
6470
  artifactFiles.map(
8614
6471
  (fileName) => readJsonFile(
8615
- path7__default.default.join(this.sessionArtifactsDirectory(sessionId), fileName)
6472
+ path10__default.default.join(this.sessionArtifactsDirectory(sessionId), fileName)
8616
6473
  )
8617
6474
  )
8618
6475
  )
@@ -8665,7 +6522,7 @@ var FilesystemTraceStore = class {
8665
6522
  constructor(rootPath, artifacts) {
8666
6523
  this.rootPath = rootPath;
8667
6524
  this.artifacts = artifacts;
8668
- this.runsDirectory = path7__default.default.join(this.rootPath, "traces", "runs");
6525
+ this.runsDirectory = path10__default.default.join(this.rootPath, "traces", "runs");
8669
6526
  }
8670
6527
  runsDirectory;
8671
6528
  async initialize() {
@@ -8742,7 +6599,7 @@ var FilesystemTraceStore = class {
8742
6599
  ...input.error === void 0 ? {} : { error: input.error }
8743
6600
  };
8744
6601
  await writeJsonFileExclusive(
8745
- path7__default.default.join(this.runEntriesDirectory(runId), sequenceFileName(sequence)),
6602
+ path10__default.default.join(this.runEntriesDirectory(runId), sequenceFileName(sequence)),
8746
6603
  entry
8747
6604
  );
8748
6605
  await writeJsonFileAtomic(this.runManifestPath(runId), {
@@ -8761,7 +6618,7 @@ var FilesystemTraceStore = class {
8761
6618
  const files = await listJsonFiles(entriesDirectory);
8762
6619
  return Promise.all(
8763
6620
  files.map(
8764
- (fileName) => readJsonFile(path7__default.default.join(entriesDirectory, fileName))
6621
+ (fileName) => readJsonFile(path10__default.default.join(entriesDirectory, fileName))
8765
6622
  )
8766
6623
  );
8767
6624
  }
@@ -8807,16 +6664,16 @@ var FilesystemTraceStore = class {
8807
6664
  return { trace, artifacts };
8808
6665
  }
8809
6666
  runDirectory(runId) {
8810
- return path7__default.default.join(this.runsDirectory, encodeURIComponent(runId));
6667
+ return path10__default.default.join(this.runsDirectory, encodeURIComponent(runId));
8811
6668
  }
8812
6669
  runEntriesDirectory(runId) {
8813
- return path7__default.default.join(this.runDirectory(runId), "entries");
6670
+ return path10__default.default.join(this.runDirectory(runId), "entries");
8814
6671
  }
8815
6672
  runManifestPath(runId) {
8816
- return path7__default.default.join(this.runDirectory(runId), "manifest.json");
6673
+ return path10__default.default.join(this.runDirectory(runId), "manifest.json");
8817
6674
  }
8818
6675
  runWriteLockPath(runId) {
8819
- return path7__default.default.join(this.runDirectory(runId), ".append.lock");
6676
+ return path10__default.default.join(this.runDirectory(runId), ".append.lock");
8820
6677
  }
8821
6678
  };
8822
6679
  function createTraceStore(rootPath, artifacts) {
@@ -8830,7 +6687,7 @@ function normalizeWorkspaceId(workspace) {
8830
6687
  return encodePathSegment(workspace);
8831
6688
  }
8832
6689
  function resolveFilesystemWorkspacePath(input) {
8833
- return path7__default.default.join(
6690
+ return path10__default.default.join(
8834
6691
  input.rootDir,
8835
6692
  ".opensteer",
8836
6693
  "workspaces",
@@ -8839,18 +6696,18 @@ function resolveFilesystemWorkspacePath(input) {
8839
6696
  }
8840
6697
  async function createFilesystemOpensteerWorkspace(options) {
8841
6698
  await ensureDirectory(options.rootPath);
8842
- const manifestPath = path7__default.default.join(options.rootPath, "workspace.json");
8843
- const browserPath = path7__default.default.join(options.rootPath, "browser");
8844
- const browserManifestPath = path7__default.default.join(browserPath, "manifest.json");
8845
- const browserUserDataDir = path7__default.default.join(browserPath, "user-data");
8846
- const livePath = path7__default.default.join(options.rootPath, "live");
8847
- const liveLocalPath = path7__default.default.join(livePath, "local.json");
8848
- const liveCloudPath = path7__default.default.join(livePath, "cloud.json");
8849
- const artifactsPath = path7__default.default.join(options.rootPath, "artifacts");
8850
- const tracesPath = path7__default.default.join(options.rootPath, "traces");
8851
- const observationsPath = path7__default.default.join(options.rootPath, "observations");
8852
- const registryPath = path7__default.default.join(options.rootPath, "registry");
8853
- const lockPath = path7__default.default.join(options.rootPath, ".lock");
6699
+ const manifestPath = path10__default.default.join(options.rootPath, "workspace.json");
6700
+ const browserPath = path10__default.default.join(options.rootPath, "browser");
6701
+ const browserManifestPath = path10__default.default.join(browserPath, "manifest.json");
6702
+ const browserUserDataDir = path10__default.default.join(browserPath, "user-data");
6703
+ const livePath = path10__default.default.join(options.rootPath, "live");
6704
+ const liveLocalPath = path10__default.default.join(livePath, "local.json");
6705
+ const liveCloudPath = path10__default.default.join(livePath, "cloud.json");
6706
+ const artifactsPath = path10__default.default.join(options.rootPath, "artifacts");
6707
+ const tracesPath = path10__default.default.join(options.rootPath, "traces");
6708
+ const observationsPath = path10__default.default.join(options.rootPath, "observations");
6709
+ const registryPath = path10__default.default.join(options.rootPath, "registry");
6710
+ const lockPath = path10__default.default.join(options.rootPath, ".lock");
8854
6711
  let manifest;
8855
6712
  if (await pathExists(manifestPath)) {
8856
6713
  manifest = await readJsonFile(manifestPath);
@@ -8910,20 +6767,10 @@ async function createFilesystemOpensteerWorkspace(options) {
8910
6767
  await descriptors.initialize();
8911
6768
  const requestPlans = createRequestPlanRegistry(options.rootPath);
8912
6769
  await requestPlans.initialize();
8913
- const authRecipes = createAuthRecipeRegistry(options.rootPath);
8914
- await authRecipes.initialize();
8915
- const recipes = createRecipeRegistry(options.rootPath);
8916
- await recipes.initialize();
8917
6770
  const savedNetwork = createSavedNetworkStore(options.rootPath);
8918
6771
  await savedNetwork.initialize();
8919
- const reverseCases = createReverseCaseRegistry(options.rootPath);
8920
- await reverseCases.initialize();
8921
6772
  const interactionTraces = createInteractionTraceRegistry(options.rootPath);
8922
6773
  await interactionTraces.initialize();
8923
- const reversePackages = createReversePackageRegistry(options.rootPath);
8924
- await reversePackages.initialize();
8925
- const reverseReports = createReverseReportRegistry(options.rootPath);
8926
- await reverseReports.initialize();
8927
6774
  const traces = createTraceStore(options.rootPath, artifacts);
8928
6775
  await traces.initialize();
8929
6776
  const observations = createObservationStore(options.rootPath, artifacts);
@@ -8949,13 +6796,8 @@ async function createFilesystemOpensteerWorkspace(options) {
8949
6796
  registry: {
8950
6797
  descriptors,
8951
6798
  requestPlans,
8952
- authRecipes,
8953
- recipes,
8954
6799
  savedNetwork,
8955
- reverseCases,
8956
- interactionTraces,
8957
- reversePackages,
8958
- reverseReports
6800
+ interactionTraces
8959
6801
  },
8960
6802
  lock(task) {
8961
6803
  return withFilesystemLock(lockPath, task);
@@ -9605,9 +7447,9 @@ var IFRAME_URL_ATTRIBUTES = /* @__PURE__ */ new Set([
9605
7447
  "poster",
9606
7448
  "ping"
9607
7449
  ]);
9608
- function buildArrayFieldPathCandidates(path15) {
9609
- const strict = path15.nodes.length ? buildPathCandidates(path15.nodes) : [];
9610
- const relaxedNodes = stripPositionClauses(path15.nodes);
7450
+ function buildArrayFieldPathCandidates(path18) {
7451
+ const strict = path18.nodes.length ? buildPathCandidates(path18.nodes) : [];
7452
+ const relaxedNodes = stripPositionClauses(path18.nodes);
9611
7453
  const relaxed = relaxedNodes.length ? buildPathCandidates(relaxedNodes) : [];
9612
7454
  return dedupeSelectors([...strict, ...relaxed]);
9613
7455
  }
@@ -10137,18 +7979,18 @@ function cloneStructuralElementAnchor(anchor) {
10137
7979
  nodes: anchor.nodes.map(clonePathNode)
10138
7980
  };
10139
7981
  }
10140
- function cloneReplayElementPath(path15) {
7982
+ function cloneReplayElementPath(path18) {
10141
7983
  return {
10142
7984
  resolution: "deterministic",
10143
- context: cloneContext(path15.context),
10144
- nodes: path15.nodes.map(clonePathNode)
7985
+ context: cloneContext(path18.context),
7986
+ nodes: path18.nodes.map(clonePathNode)
10145
7987
  };
10146
7988
  }
10147
- function cloneElementPath(path15) {
10148
- return cloneReplayElementPath(path15);
7989
+ function cloneElementPath(path18) {
7990
+ return cloneReplayElementPath(path18);
10149
7991
  }
10150
- function buildPathSelectorHint(path15) {
10151
- const nodes = path15?.nodes || [];
7992
+ function buildPathSelectorHint(path18) {
7993
+ const nodes = path18?.nodes || [];
10152
7994
  const last = nodes[nodes.length - 1];
10153
7995
  if (!last) {
10154
7996
  return "*";
@@ -10197,15 +8039,15 @@ function sanitizeStructuralElementAnchor(anchor) {
10197
8039
  nodes: sanitizeNodes(anchor.nodes)
10198
8040
  };
10199
8041
  }
10200
- function sanitizeReplayElementPath(path15) {
8042
+ function sanitizeReplayElementPath(path18) {
10201
8043
  return {
10202
8044
  resolution: "deterministic",
10203
- context: sanitizeContext(path15.context),
10204
- nodes: sanitizeNodes(path15.nodes)
8045
+ context: sanitizeContext(path18.context),
8046
+ nodes: sanitizeNodes(path18.nodes)
10205
8047
  };
10206
8048
  }
10207
- function sanitizeElementPath(path15) {
10208
- return sanitizeReplayElementPath(path15);
8049
+ function sanitizeElementPath(path18) {
8050
+ return sanitizeReplayElementPath(path18);
10209
8051
  }
10210
8052
  function buildLocalStructuralElementAnchor(index, rawTargetNode) {
10211
8053
  const targetNode = requireElementNode(index, rawTargetNode);
@@ -10328,8 +8170,8 @@ function buildTargetNotFoundMessage(domPath, diagnostics) {
10328
8170
  }
10329
8171
  return `${base} Target depth ${String(depth)}. Candidate counts: ${sample}.`;
10330
8172
  }
10331
- function buildArrayFieldCandidates(path15) {
10332
- return buildArrayFieldPathCandidates(path15);
8173
+ function buildArrayFieldCandidates(path18) {
8174
+ return buildArrayFieldPathCandidates(path18);
10333
8175
  }
10334
8176
  function firstDefinedAttribute(node, keys) {
10335
8177
  for (const key of keys) {
@@ -11865,21 +9707,21 @@ var DefaultDomRuntime = class {
11865
9707
  return match;
11866
9708
  }
11867
9709
  async resolvePathTarget(session, pageRef, rawPath, source, persist, descriptor) {
11868
- const path15 = sanitizeReplayElementPath(rawPath);
11869
- const context = await this.resolvePathContext(session, pageRef, path15.context);
11870
- const target = resolveDomPathInScope(context.index, path15.nodes, context.scope);
9710
+ const path18 = sanitizeReplayElementPath(rawPath);
9711
+ const context = await this.resolvePathContext(session, pageRef, path18.context);
9712
+ const target = resolveDomPathInScope(context.index, path18.nodes, context.scope);
11871
9713
  if (!target) {
11872
- throwTargetNotFound(context.index, path15.nodes, context.scope);
9714
+ throwTargetNotFound(context.index, path18.nodes, context.scope);
11873
9715
  }
11874
9716
  if (target.node.nodeRef === void 0) {
11875
9717
  throw new Error(
11876
- `resolved path "${buildPathSelectorHint(path15)}" does not point to a live element`
9718
+ `resolved path "${buildPathSelectorHint(path18)}" does not point to a live element`
11877
9719
  );
11878
9720
  }
11879
9721
  const anchor = await this.buildAnchorFromSnapshotNode(session, context.snapshot, target.node);
11880
9722
  return this.createResolvedTarget(source, context.snapshot, target.node, anchor, {
11881
9723
  ...persist === void 0 ? {} : { persist },
11882
- replayPath: path15,
9724
+ replayPath: path18,
11883
9725
  ...source === "path" || source === "descriptor" ? { selectorUsed: target.selector } : {},
11884
9726
  ...descriptor === void 0 ? {} : { descriptor }
11885
9727
  });
@@ -11900,9 +9742,9 @@ var DefaultDomRuntime = class {
11900
9742
  });
11901
9743
  }
11902
9744
  async queryAllByElementPath(session, pageRef, rawPath) {
11903
- const path15 = sanitizeReplayElementPath(rawPath);
11904
- const context = await this.resolvePathContext(session, pageRef, path15.context);
11905
- return queryAllDomPathInScope(context.index, path15.nodes, context.scope).filter(
9745
+ const path18 = sanitizeReplayElementPath(rawPath);
9746
+ const context = await this.resolvePathContext(session, pageRef, path18.context);
9747
+ return queryAllDomPathInScope(context.index, path18.nodes, context.scope).filter(
11906
9748
  (node) => node.nodeRef !== void 0
11907
9749
  ).map((node) => this.createSnapshotTarget(context.snapshot, node));
11908
9750
  }
@@ -12088,16 +9930,16 @@ var DefaultDomRuntime = class {
12088
9930
  const index = createSnapshotIndex(item.snapshot);
12089
9931
  return this.resolveFirstArrayFieldTargetInNode(index, item.node, field.path);
12090
9932
  }
12091
- resolveFirstArrayFieldTargetInNode(index, rootNode, path15) {
12092
- const normalizedPath = sanitizeElementPath(path15);
9933
+ resolveFirstArrayFieldTargetInNode(index, rootNode, path18) {
9934
+ const normalizedPath = sanitizeElementPath(path18);
12093
9935
  const selectors = buildArrayFieldCandidates(normalizedPath);
12094
9936
  if (!selectors.length) {
12095
9937
  return rootNode;
12096
9938
  }
12097
9939
  return resolveFirstWithinNodeBySelectors(index, rootNode, selectors);
12098
9940
  }
12099
- resolveUniqueArrayFieldTargetInNode(index, rootNode, path15) {
12100
- const normalizedPath = sanitizeElementPath(path15);
9941
+ resolveUniqueArrayFieldTargetInNode(index, rootNode, path18) {
9942
+ const normalizedPath = sanitizeElementPath(path18);
12101
9943
  const selectors = buildArrayFieldCandidates(normalizedPath);
12102
9944
  if (!selectors.length) {
12103
9945
  return rootNode;
@@ -12186,8 +10028,8 @@ function encodeDataPath(tokens) {
12186
10028
  }
12187
10029
  return out;
12188
10030
  }
12189
- function parseDataPath(path15) {
12190
- const input = path15.trim();
10031
+ function parseDataPath(path18) {
10032
+ const input = path18.trim();
12191
10033
  if (input.length === 0) {
12192
10034
  return [];
12193
10035
  }
@@ -12237,8 +10079,8 @@ function parseDataPath(path15) {
12237
10079
  function inflateDataPathObject(flat) {
12238
10080
  let root = {};
12239
10081
  let initialized = false;
12240
- for (const [path15, value] of Object.entries(flat)) {
12241
- const tokens = parseDataPath(path15);
10082
+ for (const [path18, value] of Object.entries(flat)) {
10083
+ const tokens = parseDataPath(path18);
12242
10084
  if (!tokens || tokens.length === 0) {
12243
10085
  continue;
12244
10086
  }
@@ -12570,8 +10412,8 @@ function buildVariantDescriptorFromCluster(descriptors) {
12570
10412
  fields: mergedFields
12571
10413
  };
12572
10414
  }
12573
- function minimizePathMatchClauses(path15, mode) {
12574
- const normalized = sanitizeElementPath(path15);
10415
+ function minimizePathMatchClauses(path18, mode) {
10416
+ const normalized = sanitizeElementPath(path18);
12575
10417
  const nodes = normalized.nodes.map((node, index) => {
12576
10418
  const isLast = index === normalized.nodes.length - 1;
12577
10419
  const attrs = node.attrs || {};
@@ -12675,8 +10517,8 @@ function seedMinimalAttrClause(attrs) {
12675
10517
  }
12676
10518
  return null;
12677
10519
  }
12678
- function relaxPathForSingleSample(path15, mode) {
12679
- const normalized = sanitizeElementPath(path15);
10520
+ function relaxPathForSingleSample(path18, mode) {
10521
+ const normalized = sanitizeElementPath(path18);
12680
10522
  const relaxedNodes = normalized.nodes.map((node, index) => {
12681
10523
  const isLast = index === normalized.nodes.length - 1;
12682
10524
  const attrs = normalizeAttrsForSingleSample(node.attrs || {});
@@ -12761,8 +10603,8 @@ function shouldKeepAttrForSingleSample(key) {
12761
10603
  }
12762
10604
  return true;
12763
10605
  }
12764
- function buildPathStructureKey(path15) {
12765
- const normalized = sanitizeElementPath(path15);
10606
+ function buildPathStructureKey(path18) {
10607
+ const normalized = sanitizeElementPath(path18);
12766
10608
  return canonicalJsonString({
12767
10609
  context: (normalized.context || []).map((hop) => ({
12768
10610
  kind: hop.kind,
@@ -12889,30 +10731,30 @@ function buildArrayItemNode(fields) {
12889
10731
  }
12890
10732
  return node;
12891
10733
  }
12892
- function insertNodeAtPath(root, path15, node) {
12893
- const tokens = parseDataPath(path15);
10734
+ function insertNodeAtPath(root, path18, node) {
10735
+ const tokens = parseDataPath(path18);
12894
10736
  if (!tokens || !tokens.length) {
12895
10737
  throw new Error(
12896
- `Invalid persisted extraction path "${path15}": expected a non-empty object path.`
10738
+ `Invalid persisted extraction path "${path18}": expected a non-empty object path.`
12897
10739
  );
12898
10740
  }
12899
10741
  if (tokens.some((token) => token.kind === "index")) {
12900
10742
  throw new Error(
12901
- `Invalid persisted extraction path "${path15}": nested array indices are not supported in cached descriptors.`
10743
+ `Invalid persisted extraction path "${path18}": nested array indices are not supported in cached descriptors.`
12902
10744
  );
12903
10745
  }
12904
10746
  let current = root;
12905
10747
  for (let index = 0; index < tokens.length; index += 1) {
12906
10748
  const token = tokens[index];
12907
10749
  if (!token || token.kind !== "prop") {
12908
- throw new Error(`Invalid persisted extraction path "${path15}": expected object segment.`);
10750
+ throw new Error(`Invalid persisted extraction path "${path18}": expected object segment.`);
12909
10751
  }
12910
10752
  const isLast = index === tokens.length - 1;
12911
10753
  if (isLast) {
12912
10754
  const existing = current[token.key];
12913
10755
  if (existing) {
12914
10756
  throw new Error(
12915
- `Conflicting persisted extraction path "${path15}" detected while building descriptor tree.`
10757
+ `Conflicting persisted extraction path "${path18}" detected while building descriptor tree.`
12916
10758
  );
12917
10759
  }
12918
10760
  current[token.key] = node;
@@ -12927,7 +10769,7 @@ function insertNodeAtPath(root, path15, node) {
12927
10769
  }
12928
10770
  if (!isPersistedObjectNode(next)) {
12929
10771
  throw new Error(
12930
- `Conflicting persisted extraction path "${path15}" detected at "${token.key}".`
10772
+ `Conflicting persisted extraction path "${path18}" detected at "${token.key}".`
12931
10773
  );
12932
10774
  }
12933
10775
  current = next;
@@ -12962,7 +10804,7 @@ function buildItemRootForArrayIndex(entries) {
12962
10804
  }
12963
10805
  const paths = entries.map(
12964
10806
  (entry) => isPersistablePathField(entry.source) ? sanitizeElementPath(entry.source.path) : null
12965
- ).filter((path15) => path15 !== null);
10807
+ ).filter((path18) => path18 !== null);
12966
10808
  if (!paths.length) {
12967
10809
  return null;
12968
10810
  }
@@ -12983,7 +10825,7 @@ function getCommonPathPrefixLength(paths) {
12983
10825
  if (!paths.length) {
12984
10826
  return 0;
12985
10827
  }
12986
- const nodeChains = paths.map((path15) => path15.nodes);
10828
+ const nodeChains = paths.map((path18) => path18.nodes);
12987
10829
  const minLength = Math.min(...nodeChains.map((nodes) => nodes.length));
12988
10830
  if (!Number.isFinite(minLength) || minLength <= 0) {
12989
10831
  return 0;
@@ -13052,30 +10894,30 @@ function mergeElementPathsByMajority(paths) {
13052
10894
  if (!paths.length) {
13053
10895
  return null;
13054
10896
  }
13055
- const normalized = paths.map((path15) => sanitizeElementPath(path15));
10897
+ const normalized = paths.map((path18) => sanitizeElementPath(path18));
13056
10898
  const contextKey = pickModeString(
13057
- normalized.map((path15) => canonicalJsonString(path15.context)),
10899
+ normalized.map((path18) => canonicalJsonString(path18.context)),
13058
10900
  1
13059
10901
  );
13060
10902
  if (!contextKey) {
13061
10903
  return null;
13062
10904
  }
13063
- const sameContext = normalized.filter((path15) => canonicalJsonString(path15.context) === contextKey);
10905
+ const sameContext = normalized.filter((path18) => canonicalJsonString(path18.context) === contextKey);
13064
10906
  if (!sameContext.length) {
13065
10907
  return null;
13066
10908
  }
13067
10909
  const targetLength = pickModeNumber(
13068
- sameContext.map((path15) => path15.nodes.length),
10910
+ sameContext.map((path18) => path18.nodes.length),
13069
10911
  1
13070
10912
  ) ?? sameContext[0]?.nodes.length ?? 0;
13071
- const aligned = sameContext.filter((path15) => path15.nodes.length === targetLength);
10913
+ const aligned = sameContext.filter((path18) => path18.nodes.length === targetLength);
13072
10914
  if (!aligned.length) {
13073
10915
  return null;
13074
10916
  }
13075
10917
  const threshold = majorityThreshold(aligned.length);
13076
10918
  const nodes = [];
13077
10919
  for (let index = 0; index < targetLength; index += 1) {
13078
- const nodesAtIndex = aligned.map((path15) => path15.nodes[index]).filter((node) => node !== void 0);
10920
+ const nodesAtIndex = aligned.map((path18) => path18.nodes[index]).filter((node) => node !== void 0);
13079
10921
  if (!nodesAtIndex.length) {
13080
10922
  return null;
13081
10923
  }
@@ -13321,8 +11163,8 @@ function clonePathContext(context) {
13321
11163
  function clonePathNodes(nodes) {
13322
11164
  return JSON.parse(JSON.stringify(nodes || []));
13323
11165
  }
13324
- function cloneElementPath2(path15) {
13325
- return JSON.parse(JSON.stringify(path15));
11166
+ function cloneElementPath2(path18) {
11167
+ return JSON.parse(JSON.stringify(path18));
13326
11168
  }
13327
11169
  function clonePersistedOpensteerExtractionNode(node) {
13328
11170
  return JSON.parse(JSON.stringify(node));
@@ -13640,8 +11482,8 @@ function collectPersistedValueNodeRefs(node) {
13640
11482
  return [
13641
11483
  {
13642
11484
  path: sanitizeElementPath(node.$path),
13643
- replacePath: (path15) => {
13644
- node.$path = sanitizeElementPath(path15);
11485
+ replacePath: (path18) => {
11486
+ node.$path = sanitizeElementPath(path18);
13645
11487
  }
13646
11488
  }
13647
11489
  ];
@@ -13655,13 +11497,13 @@ function collectPersistedValueNodeRefs(node) {
13655
11497
  }
13656
11498
  return refs;
13657
11499
  }
13658
- function hasPositionClause(path15) {
13659
- return path15.nodes.some((node) => node.match.some((clause) => clause.kind === "position"));
11500
+ function hasPositionClause(path18) {
11501
+ return path18.nodes.some((node) => node.match.some((clause) => clause.kind === "position"));
13660
11502
  }
13661
- function stripPositionClauses2(path15) {
11503
+ function stripPositionClauses2(path18) {
13662
11504
  return sanitizeElementPath({
13663
- context: path15.context,
13664
- nodes: path15.nodes.map((node) => ({
11505
+ context: path18.context,
11506
+ nodes: path18.nodes.map((node) => ({
13665
11507
  ...node,
13666
11508
  match: node.match.filter((clause) => clause.kind !== "position")
13667
11509
  }))
@@ -14071,24 +11913,174 @@ function normalizeNonEmptyString2(name, value) {
14071
11913
  function normalizeKey(value) {
14072
11914
  return String(value ?? "").trim();
14073
11915
  }
14074
- function labelForPath(path15) {
14075
- return path15.trim().length === 0 ? "$" : path15;
11916
+ function labelForPath(path18) {
11917
+ return path18.trim().length === 0 ? "$" : path18;
14076
11918
  }
14077
11919
  function sha256Hex3(value) {
14078
11920
  return crypto.createHash("sha256").update(value).digest("hex");
14079
11921
  }
14080
- util.promisify(child_process.execFile);
14081
- Math.floor(Date.now() - process.uptime() * 1e3);
14082
- ({ ...process.env});
14083
- ({
14084
- pid: process.pid});
14085
- function isProcessRunning(pid) {
11922
+ var execFileAsync = util.promisify(child_process.execFile);
11923
+ var PROCESS_STARTED_AT_MS = Math.floor(Date.now() - process.uptime() * 1e3);
11924
+ var PROCESS_START_TIME_TOLERANCE_MS = 1e3;
11925
+ var PROCESS_LIST_MAX_BUFFER_BYTES = 16 * 1024 * 1024;
11926
+ var PS_COMMAND_ENV = { ...process.env, LC_ALL: "C" };
11927
+ var LINUX_STAT_START_TIME_FIELD_INDEX = 19;
11928
+ var CURRENT_PROCESS_OWNER = {
11929
+ pid: process.pid,
11930
+ processStartedAtMs: PROCESS_STARTED_AT_MS
11931
+ };
11932
+ var linuxClockTicksPerSecondPromise = null;
11933
+ function parseProcessOwner(value) {
11934
+ if (!value || typeof value !== "object") {
11935
+ return null;
11936
+ }
11937
+ const parsed = value;
11938
+ const pid = Number(parsed.pid);
11939
+ const processStartedAtMs = Number(parsed.processStartedAtMs);
11940
+ if (!Number.isInteger(pid) || pid <= 0) {
11941
+ return null;
11942
+ }
11943
+ if (!Number.isInteger(processStartedAtMs) || processStartedAtMs <= 0) {
11944
+ return null;
11945
+ }
11946
+ return {
11947
+ pid,
11948
+ processStartedAtMs
11949
+ };
11950
+ }
11951
+ function processOwnersEqual(left, right) {
11952
+ if (!left || !right) {
11953
+ return left === right;
11954
+ }
11955
+ return left.pid === right.pid && left.processStartedAtMs === right.processStartedAtMs;
11956
+ }
11957
+ async function getProcessLiveness(owner) {
11958
+ if (owner.pid === process.pid && hasMatchingProcessStartTime(owner.processStartedAtMs, PROCESS_STARTED_AT_MS)) {
11959
+ return "live";
11960
+ }
11961
+ const startedAtMs = await readProcessStartedAtMs(owner.pid);
11962
+ if (typeof startedAtMs === "number") {
11963
+ return hasMatchingProcessStartTime(owner.processStartedAtMs, startedAtMs) ? "live" : "dead";
11964
+ }
11965
+ return isProcessRunning(owner.pid) ? "unknown" : "dead";
11966
+ }
11967
+ function isProcessRunning(pid) {
11968
+ try {
11969
+ process.kill(pid, 0);
11970
+ return true;
11971
+ } catch (error) {
11972
+ const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : void 0;
11973
+ return code !== "ESRCH";
11974
+ }
11975
+ }
11976
+ function hasMatchingProcessStartTime(expectedStartedAtMs, actualStartedAtMs) {
11977
+ return Math.abs(expectedStartedAtMs - actualStartedAtMs) <= PROCESS_START_TIME_TOLERANCE_MS;
11978
+ }
11979
+ async function readProcessStartedAtMs(pid) {
11980
+ if (pid <= 0) {
11981
+ return null;
11982
+ }
11983
+ if (process.platform === "linux") {
11984
+ return readLinuxProcessStartedAtMs(pid);
11985
+ }
11986
+ if (process.platform === "win32") {
11987
+ return readWindowsProcessStartedAtMs(pid);
11988
+ }
11989
+ return readPsProcessStartedAtMs(pid);
11990
+ }
11991
+ async function readLinuxProcessStartedAtMs(pid) {
11992
+ let statRaw;
11993
+ try {
11994
+ statRaw = await promises.readFile(`/proc/${String(pid)}/stat`, "utf8");
11995
+ } catch {
11996
+ return null;
11997
+ }
11998
+ const startTicks = parseLinuxProcessStartTicks(statRaw);
11999
+ if (startTicks === null) {
12000
+ return null;
12001
+ }
12002
+ const [bootTimeMs, clockTicksPerSecond] = await Promise.all([
12003
+ readLinuxBootTimeMs(),
12004
+ readLinuxClockTicksPerSecond()
12005
+ ]);
12006
+ if (bootTimeMs === null || clockTicksPerSecond === null) {
12007
+ return null;
12008
+ }
12009
+ return Math.floor(bootTimeMs + startTicks * 1e3 / clockTicksPerSecond);
12010
+ }
12011
+ function parseLinuxProcessStartTicks(statRaw) {
12012
+ const closingParenIndex = statRaw.lastIndexOf(")");
12013
+ if (closingParenIndex === -1) {
12014
+ return null;
12015
+ }
12016
+ const fields = statRaw.slice(closingParenIndex + 2).trim().split(/\s+/);
12017
+ const startTicks = Number(fields[LINUX_STAT_START_TIME_FIELD_INDEX]);
12018
+ return Number.isFinite(startTicks) && startTicks >= 0 ? startTicks : null;
12019
+ }
12020
+ async function readLinuxBootTimeMs() {
12021
+ try {
12022
+ const statRaw = await promises.readFile("/proc/stat", "utf8");
12023
+ const bootTimeLine = statRaw.split("\n").find((line) => line.startsWith("btime "));
12024
+ if (!bootTimeLine) {
12025
+ return null;
12026
+ }
12027
+ const bootTimeSeconds = Number.parseInt(bootTimeLine.slice("btime ".length), 10);
12028
+ return Number.isFinite(bootTimeSeconds) ? bootTimeSeconds * 1e3 : null;
12029
+ } catch {
12030
+ return null;
12031
+ }
12032
+ }
12033
+ async function readLinuxClockTicksPerSecond() {
12034
+ if (!linuxClockTicksPerSecondPromise) {
12035
+ linuxClockTicksPerSecondPromise = execFileAsync("getconf", ["CLK_TCK"], {
12036
+ encoding: "utf8",
12037
+ maxBuffer: PROCESS_LIST_MAX_BUFFER_BYTES
12038
+ }).then(({ stdout }) => {
12039
+ const value = Number.parseInt(stdout.trim(), 10);
12040
+ return Number.isFinite(value) && value > 0 ? value : null;
12041
+ }).catch(() => null);
12042
+ }
12043
+ return linuxClockTicksPerSecondPromise;
12044
+ }
12045
+ async function readWindowsProcessStartedAtMs(pid) {
12046
+ try {
12047
+ const { stdout } = await execFileAsync(
12048
+ "powershell.exe",
12049
+ [
12050
+ "-NoProfile",
12051
+ "-Command",
12052
+ `(Get-Process -Id ${String(pid)}).StartTime.ToUniversalTime().ToString("o")`
12053
+ ],
12054
+ {
12055
+ encoding: "utf8",
12056
+ maxBuffer: PROCESS_LIST_MAX_BUFFER_BYTES
12057
+ }
12058
+ );
12059
+ const isoTimestamp = stdout.trim();
12060
+ if (!isoTimestamp) {
12061
+ return null;
12062
+ }
12063
+ const startedAtMs = Date.parse(isoTimestamp);
12064
+ return Number.isFinite(startedAtMs) ? startedAtMs : null;
12065
+ } catch {
12066
+ return null;
12067
+ }
12068
+ }
12069
+ async function readPsProcessStartedAtMs(pid) {
14086
12070
  try {
14087
- process.kill(pid, 0);
14088
- return true;
14089
- } catch (error) {
14090
- const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : void 0;
14091
- return code !== "ESRCH";
12071
+ const { stdout } = await execFileAsync("ps", ["-o", "lstart=", "-p", String(pid)], {
12072
+ encoding: "utf8",
12073
+ env: PS_COMMAND_ENV,
12074
+ maxBuffer: PROCESS_LIST_MAX_BUFFER_BYTES
12075
+ });
12076
+ const startedAt = stdout.trim();
12077
+ if (!startedAt) {
12078
+ return null;
12079
+ }
12080
+ const startedAtMs = Date.parse(startedAt.replace(/\s+/g, " "));
12081
+ return Number.isFinite(startedAtMs) ? startedAtMs : null;
12082
+ } catch {
12083
+ return null;
14092
12084
  }
14093
12085
  }
14094
12086
  var CHROME_SINGLETON_ARTIFACTS = [
@@ -14101,7 +12093,7 @@ var CHROME_SINGLETON_ARTIFACTS = [
14101
12093
  async function clearChromeSingletonEntries(userDataDir) {
14102
12094
  await Promise.all(
14103
12095
  CHROME_SINGLETON_ARTIFACTS.map(
14104
- (entry) => promises.rm(path7.join(userDataDir, entry), {
12096
+ (entry) => promises.rm(path10.join(userDataDir, entry), {
14105
12097
  recursive: true,
14106
12098
  force: true
14107
12099
  }).catch(() => void 0)
@@ -14116,7 +12108,7 @@ async function sanitizeChromeProfile(userDataDir) {
14116
12108
  await Promise.all(profileDirs.map((dir) => sanitizeProfilePreferences(userDataDir, dir)));
14117
12109
  }
14118
12110
  async function sanitizeProfilePreferences(userDataDir, profileDir) {
14119
- const prefsPath = path7.join(userDataDir, profileDir, "Preferences");
12111
+ const prefsPath = path10.join(userDataDir, profileDir, "Preferences");
14120
12112
  try {
14121
12113
  const raw = await promises.readFile(prefsPath, "utf8");
14122
12114
  const prefs = JSON.parse(raw);
@@ -14128,7 +12120,7 @@ async function sanitizeProfilePreferences(userDataDir, profileDir) {
14128
12120
  profile.exited_cleanly = true;
14129
12121
  prefs.profile = profile;
14130
12122
  await promises.writeFile(prefsPath, JSON.stringify(prefs), "utf8");
14131
- await promises.rm(path7.join(userDataDir, profileDir, "Secure Preferences"), { force: true }).catch(
12123
+ await promises.rm(path10.join(userDataDir, profileDir, "Secure Preferences"), { force: true }).catch(
14132
12124
  () => void 0
14133
12125
  );
14134
12126
  } catch {
@@ -14149,9 +12141,9 @@ var BROWSER_BRANDS = [
14149
12141
  },
14150
12142
  win32: {
14151
12143
  executableCandidates: [
14152
- path7.join(WINDOWS_PROGRAM_FILES, "Google", "Chrome", "Application", "chrome.exe"),
14153
- path7.join(WINDOWS_PROGRAM_FILES_X86, "Google", "Chrome", "Application", "chrome.exe"),
14154
- path7.join("~", "AppData", "Local", "Google", "Chrome", "Application", "chrome.exe")
12144
+ path10.join(WINDOWS_PROGRAM_FILES, "Google", "Chrome", "Application", "chrome.exe"),
12145
+ path10.join(WINDOWS_PROGRAM_FILES_X86, "Google", "Chrome", "Application", "chrome.exe"),
12146
+ path10.join("~", "AppData", "Local", "Google", "Chrome", "Application", "chrome.exe")
14155
12147
  ],
14156
12148
  userDataDir: "~/AppData/Local/Google/Chrome/User Data",
14157
12149
  processNames: ["/google/chrome/application/chrome.exe"]
@@ -14181,7 +12173,7 @@ var BROWSER_BRANDS = [
14181
12173
  },
14182
12174
  win32: {
14183
12175
  executableCandidates: [
14184
- path7.join("~", "AppData", "Local", "Google", "Chrome SxS", "Application", "chrome.exe")
12176
+ path10.join("~", "AppData", "Local", "Google", "Chrome SxS", "Application", "chrome.exe")
14185
12177
  ],
14186
12178
  userDataDir: "~/AppData/Local/Google/Chrome SxS/User Data",
14187
12179
  processNames: ["/google/chrome sxs/application/chrome.exe"]
@@ -14198,9 +12190,9 @@ var BROWSER_BRANDS = [
14198
12190
  },
14199
12191
  win32: {
14200
12192
  executableCandidates: [
14201
- path7.join(WINDOWS_PROGRAM_FILES, "Chromium", "Application", "chrome.exe"),
14202
- path7.join(WINDOWS_PROGRAM_FILES_X86, "Chromium", "Application", "chrome.exe"),
14203
- path7.join("~", "AppData", "Local", "Chromium", "Application", "chrome.exe")
12193
+ path10.join(WINDOWS_PROGRAM_FILES, "Chromium", "Application", "chrome.exe"),
12194
+ path10.join(WINDOWS_PROGRAM_FILES_X86, "Chromium", "Application", "chrome.exe"),
12195
+ path10.join("~", "AppData", "Local", "Chromium", "Application", "chrome.exe")
14204
12196
  ],
14205
12197
  userDataDir: "~/AppData/Local/Chromium/User Data",
14206
12198
  processNames: ["/chromium/application/chrome.exe"]
@@ -14227,15 +12219,15 @@ var BROWSER_BRANDS = [
14227
12219
  },
14228
12220
  win32: {
14229
12221
  executableCandidates: [
14230
- path7.join(WINDOWS_PROGRAM_FILES, "BraveSoftware", "Brave-Browser", "Application", "brave.exe"),
14231
- path7.join(
12222
+ path10.join(WINDOWS_PROGRAM_FILES, "BraveSoftware", "Brave-Browser", "Application", "brave.exe"),
12223
+ path10.join(
14232
12224
  WINDOWS_PROGRAM_FILES_X86,
14233
12225
  "BraveSoftware",
14234
12226
  "Brave-Browser",
14235
12227
  "Application",
14236
12228
  "brave.exe"
14237
12229
  ),
14238
- path7.join("~", "AppData", "Local", "BraveSoftware", "Brave-Browser", "Application", "brave.exe")
12230
+ path10.join("~", "AppData", "Local", "BraveSoftware", "Brave-Browser", "Application", "brave.exe")
14239
12231
  ],
14240
12232
  userDataDir: "~/AppData/Local/BraveSoftware/Brave-Browser/User Data",
14241
12233
  processNames: ["/bravesoftware/brave-browser/application/brave.exe"]
@@ -14261,9 +12253,9 @@ var BROWSER_BRANDS = [
14261
12253
  },
14262
12254
  win32: {
14263
12255
  executableCandidates: [
14264
- path7.join(WINDOWS_PROGRAM_FILES, "Microsoft", "Edge", "Application", "msedge.exe"),
14265
- path7.join(WINDOWS_PROGRAM_FILES_X86, "Microsoft", "Edge", "Application", "msedge.exe"),
14266
- path7.join("~", "AppData", "Local", "Microsoft", "Edge", "Application", "msedge.exe")
12256
+ path10.join(WINDOWS_PROGRAM_FILES, "Microsoft", "Edge", "Application", "msedge.exe"),
12257
+ path10.join(WINDOWS_PROGRAM_FILES_X86, "Microsoft", "Edge", "Application", "msedge.exe"),
12258
+ path10.join("~", "AppData", "Local", "Microsoft", "Edge", "Application", "msedge.exe")
14267
12259
  ],
14268
12260
  userDataDir: "~/AppData/Local/Microsoft/Edge/User Data",
14269
12261
  processNames: ["/microsoft/edge/application/msedge.exe"]
@@ -14291,9 +12283,9 @@ var BROWSER_BRANDS = [
14291
12283
  },
14292
12284
  win32: {
14293
12285
  executableCandidates: [
14294
- path7.join(WINDOWS_PROGRAM_FILES, "Vivaldi", "Application", "vivaldi.exe"),
14295
- path7.join(WINDOWS_PROGRAM_FILES_X86, "Vivaldi", "Application", "vivaldi.exe"),
14296
- path7.join("~", "AppData", "Local", "Vivaldi", "Application", "vivaldi.exe")
12286
+ path10.join(WINDOWS_PROGRAM_FILES, "Vivaldi", "Application", "vivaldi.exe"),
12287
+ path10.join(WINDOWS_PROGRAM_FILES_X86, "Vivaldi", "Application", "vivaldi.exe"),
12288
+ path10.join("~", "AppData", "Local", "Vivaldi", "Application", "vivaldi.exe")
14297
12289
  ],
14298
12290
  userDataDir: "~/AppData/Local/Vivaldi/User Data",
14299
12291
  processNames: ["/vivaldi/application/vivaldi.exe"]
@@ -14357,35 +12349,35 @@ function detectInstalledBrowserBrands() {
14357
12349
  brandId: brand2.id,
14358
12350
  displayName: brand2.displayName,
14359
12351
  executablePath,
14360
- userDataDir: path7.resolve(expandHome(platformConfig.userDataDir))
12352
+ userDataDir: path10.resolve(expandHome(platformConfig.userDataDir))
14361
12353
  });
14362
12354
  }
14363
12355
  return installations;
14364
12356
  }
14365
12357
  function resolveBrandUserDataDir(brand2, explicitDir) {
14366
12358
  if (explicitDir !== void 0) {
14367
- return path7.resolve(expandHome(explicitDir));
12359
+ return path10.resolve(expandHome(explicitDir));
14368
12360
  }
14369
12361
  const platformConfig = resolveBrandPlatformConfig(brand2);
14370
12362
  if (!platformConfig) {
14371
12363
  throw new Error(`${brand2.displayName} is not supported on ${process.platform}.`);
14372
12364
  }
14373
- return path7.resolve(expandHome(platformConfig.userDataDir));
12365
+ return path10.resolve(expandHome(platformConfig.userDataDir));
14374
12366
  }
14375
12367
  function resolveExecutableCandidates(candidates) {
14376
- return candidates.map((candidate) => candidate ? path7.resolve(expandHome(candidate)) : null);
12368
+ return candidates.map((candidate) => candidate ? path10.resolve(expandHome(candidate)) : null);
14377
12369
  }
14378
12370
 
14379
12371
  // src/local-browser/chrome-discovery.ts
14380
12372
  function expandHome(value) {
14381
12373
  if (value === "~" || value.startsWith("~/")) {
14382
- return path7.join(os.homedir(), value.slice(1));
12374
+ return path10.join(os.homedir(), value.slice(1));
14383
12375
  }
14384
12376
  return value;
14385
12377
  }
14386
12378
  function resolveChromeUserDataDir(userDataDir) {
14387
12379
  const installation = detectLocalChromeInstallations().find(
14388
- (candidate) => fs.existsSync(path7.join(candidate.userDataDir, "Local State")) || candidate.executablePath !== null
12380
+ (candidate) => fs.existsSync(path10.join(candidate.userDataDir, "Local State")) || candidate.executablePath !== null
14389
12381
  );
14390
12382
  if (!installation) {
14391
12383
  throw new Error("Could not find a local Chrome or Chromium profile directory.");
@@ -14394,7 +12386,7 @@ function resolveChromeUserDataDir(userDataDir) {
14394
12386
  }
14395
12387
  function resolveChromeExecutablePath(executablePath) {
14396
12388
  if (executablePath !== void 0) {
14397
- const resolvedPath = path7.resolve(expandHome(executablePath));
12389
+ const resolvedPath = path10.resolve(expandHome(executablePath));
14398
12390
  if (!fs.existsSync(resolvedPath)) {
14399
12391
  throw new Error(`Chrome executable was not found at "${resolvedPath}".`);
14400
12392
  }
@@ -14418,37 +12410,37 @@ function detectLocalChromeInstallations() {
14418
12410
  "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
14419
12411
  "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
14420
12412
  ]),
14421
- userDataDir: path7.join(os.homedir(), "Library", "Application Support", "Google", "Chrome")
12413
+ userDataDir: path10.join(os.homedir(), "Library", "Application Support", "Google", "Chrome")
14422
12414
  },
14423
12415
  {
14424
12416
  brand: "chromium",
14425
12417
  executablePath: firstExistingPath(["/Applications/Chromium.app/Contents/MacOS/Chromium"]),
14426
- userDataDir: path7.join(os.homedir(), "Library", "Application Support", "Chromium")
12418
+ userDataDir: path10.join(os.homedir(), "Library", "Application Support", "Chromium")
14427
12419
  }
14428
12420
  ];
14429
12421
  }
14430
12422
  if (process.platform === "win32") {
14431
12423
  const programFiles = process.env.PROGRAMFILES ?? "C:\\Program Files";
14432
12424
  const programFilesX86 = process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)";
14433
- const localAppData = process.env.LOCALAPPDATA ?? path7.join(os.homedir(), "AppData", "Local");
12425
+ const localAppData = process.env.LOCALAPPDATA ?? path10.join(os.homedir(), "AppData", "Local");
14434
12426
  return [
14435
12427
  {
14436
12428
  brand: "chrome",
14437
12429
  executablePath: firstExistingPath([
14438
- path7.join(programFiles, "Google", "Chrome", "Application", "chrome.exe"),
14439
- path7.join(programFilesX86, "Google", "Chrome", "Application", "chrome.exe"),
14440
- path7.join(localAppData, "Google", "Chrome", "Application", "chrome.exe")
12430
+ path10.join(programFiles, "Google", "Chrome", "Application", "chrome.exe"),
12431
+ path10.join(programFilesX86, "Google", "Chrome", "Application", "chrome.exe"),
12432
+ path10.join(localAppData, "Google", "Chrome", "Application", "chrome.exe")
14441
12433
  ]),
14442
- userDataDir: path7.join(localAppData, "Google", "Chrome", "User Data")
12434
+ userDataDir: path10.join(localAppData, "Google", "Chrome", "User Data")
14443
12435
  },
14444
12436
  {
14445
12437
  brand: "chromium",
14446
12438
  executablePath: firstExistingPath([
14447
- path7.join(programFiles, "Chromium", "Application", "chrome.exe"),
14448
- path7.join(programFilesX86, "Chromium", "Application", "chrome.exe"),
14449
- path7.join(localAppData, "Chromium", "Application", "chrome.exe")
12439
+ path10.join(programFiles, "Chromium", "Application", "chrome.exe"),
12440
+ path10.join(programFilesX86, "Chromium", "Application", "chrome.exe"),
12441
+ path10.join(localAppData, "Chromium", "Application", "chrome.exe")
14450
12442
  ]),
14451
- userDataDir: path7.join(localAppData, "Chromium", "User Data")
12443
+ userDataDir: path10.join(localAppData, "Chromium", "User Data")
14452
12444
  }
14453
12445
  ];
14454
12446
  }
@@ -14461,7 +12453,7 @@ function detectLocalChromeInstallations() {
14461
12453
  resolveBinaryFromPath("google-chrome"),
14462
12454
  resolveBinaryFromPath("google-chrome-stable")
14463
12455
  ]),
14464
- userDataDir: path7.join(os.homedir(), ".config", "google-chrome")
12456
+ userDataDir: path10.join(os.homedir(), ".config", "google-chrome")
14465
12457
  },
14466
12458
  {
14467
12459
  brand: "chromium",
@@ -14471,7 +12463,7 @@ function detectLocalChromeInstallations() {
14471
12463
  resolveBinaryFromPath("chromium"),
14472
12464
  resolveBinaryFromPath("chromium-browser")
14473
12465
  ]),
14474
- userDataDir: path7.join(os.homedir(), ".config", "chromium")
12466
+ userDataDir: path10.join(os.homedir(), ".config", "chromium")
14475
12467
  }
14476
12468
  ];
14477
12469
  }
@@ -14483,8 +12475,8 @@ function detectLocalBrowserInstallations() {
14483
12475
  }));
14484
12476
  }
14485
12477
  function listLocalChromeProfiles(userDataDir = resolveChromeUserDataDir()) {
14486
- const resolvedUserDataDir = path7.resolve(expandHome(userDataDir));
14487
- const localStatePath = path7.join(resolvedUserDataDir, "Local State");
12478
+ const resolvedUserDataDir = path10.resolve(expandHome(userDataDir));
12479
+ const localStatePath = path10.join(resolvedUserDataDir, "Local State");
14488
12480
  if (!fs.existsSync(localStatePath)) {
14489
12481
  return [];
14490
12482
  }
@@ -14496,7 +12488,7 @@ function listLocalChromeProfiles(userDataDir = resolveChromeUserDataDir()) {
14496
12488
  }
14497
12489
  return Object.entries(infoCache).map(([directory, info]) => {
14498
12490
  const record = info && typeof info === "object" && !Array.isArray(info) ? info : {};
14499
- const name = typeof record.name === "string" && record.name.trim().length > 0 ? record.name.trim() : directory || path7.basename(directory);
12491
+ const name = typeof record.name === "string" && record.name.trim().length > 0 ? record.name.trim() : directory || path10.basename(directory);
14500
12492
  return {
14501
12493
  directory,
14502
12494
  name,
@@ -14508,7 +12500,7 @@ function listLocalChromeProfiles(userDataDir = resolveChromeUserDataDir()) {
14508
12500
  }
14509
12501
  }
14510
12502
  function readDevToolsActivePort(userDataDir) {
14511
- const devToolsPath = path7.join(userDataDir, "DevToolsActivePort");
12503
+ const devToolsPath = path10.join(userDataDir, "DevToolsActivePort");
14512
12504
  if (!fs.existsSync(devToolsPath)) {
14513
12505
  return null;
14514
12506
  }
@@ -14741,8 +12733,8 @@ function buildBrowserWebSocketUrl(httpUrl, webSocketPath) {
14741
12733
  const protocol = httpUrl.protocol === "https:" ? "wss:" : "ws:";
14742
12734
  return `${protocol}//${httpUrl.host}${normalizeWebSocketPath(webSocketPath)}`;
14743
12735
  }
14744
- function normalizeWebSocketPath(path15) {
14745
- return path15.startsWith("/") ? path15 : `/${path15}`;
12736
+ function normalizeWebSocketPath(path18) {
12737
+ return path18.startsWith("/") ? path18 : `/${path18}`;
14746
12738
  }
14747
12739
  function rewriteBrowserWebSocketHost(browserWsUrl, requestedUrl) {
14748
12740
  try {
@@ -14788,20 +12780,20 @@ var SESSION_SKIPPED_PROFILE_DIRECTORIES = /* @__PURE__ */ new Set([
14788
12780
  "Network"
14789
12781
  ]);
14790
12782
  async function createBrowserProfileSnapshot(input) {
14791
- const sourceUserDataDir = path7.resolve(expandHome(input.sourceUserDataDir));
14792
- const targetUserDataDir = path7.resolve(expandHome(input.targetUserDataDir));
12783
+ const sourceUserDataDir = path10.resolve(expandHome(input.sourceUserDataDir));
12784
+ const targetUserDataDir = path10.resolve(expandHome(input.targetUserDataDir));
14793
12785
  const profileDirectory = input.profileDirectory?.trim();
14794
12786
  const copyMode = input.copyMode;
14795
12787
  await promises.mkdir(targetUserDataDir, { recursive: true });
14796
12788
  await clearChromeSingletonEntries(targetUserDataDir);
14797
12789
  if (profileDirectory) {
14798
- const sourceProfileDir = path7.join(sourceUserDataDir, profileDirectory);
12790
+ const sourceProfileDir = path10.join(sourceUserDataDir, profileDirectory);
14799
12791
  if (!fs.existsSync(sourceProfileDir)) {
14800
12792
  throw new Error(
14801
12793
  `Chrome profile "${profileDirectory}" was not found in "${sourceUserDataDir}".`
14802
12794
  );
14803
12795
  }
14804
- await promises.cp(sourceProfileDir, path7.join(targetUserDataDir, profileDirectory), {
12796
+ await promises.cp(sourceProfileDir, path10.join(targetUserDataDir, profileDirectory), {
14805
12797
  recursive: true,
14806
12798
  filter: (candidate) => shouldCopyEntry({
14807
12799
  candidatePath: candidate,
@@ -14825,8 +12817,8 @@ async function copyRootLevelEntries(input) {
14825
12817
  if (CHROME_SINGLETON_ENTRIES.has(entry) || entry === input.selectedProfileDirectory) {
14826
12818
  continue;
14827
12819
  }
14828
- const sourcePath = path7.join(input.sourceUserDataDir, entry);
14829
- const targetPath = path7.join(input.targetUserDataDir, entry);
12820
+ const sourcePath = path10.join(input.sourceUserDataDir, entry);
12821
+ const targetPath = path10.join(input.targetUserDataDir, entry);
14830
12822
  const entryStat = await promises.stat(sourcePath).catch(() => null);
14831
12823
  if (!entryStat) {
14832
12824
  continue;
@@ -14858,7 +12850,7 @@ async function copyRootLevelEntries(input) {
14858
12850
  }
14859
12851
  }
14860
12852
  function isProfileDirectory(userDataDir, entry) {
14861
- return fs.existsSync(path7.join(userDataDir, entry, "Preferences"));
12853
+ return fs.existsSync(path10.join(userDataDir, entry, "Preferences"));
14862
12854
  }
14863
12855
  function shouldCopyEntry(input) {
14864
12856
  const entryName = input.candidatePath.split("/").at(-1)?.split("\\").at(-1) ?? input.candidatePath;
@@ -14868,7 +12860,7 @@ function shouldCopyEntry(input) {
14868
12860
  if (input.copyMode !== "session") {
14869
12861
  return true;
14870
12862
  }
14871
- const relativePath = path7.relative(input.rootPath, input.candidatePath);
12863
+ const relativePath = path10.relative(input.rootPath, input.candidatePath);
14872
12864
  if (relativePath.length === 0) {
14873
12865
  return true;
14874
12866
  }
@@ -15350,7 +13342,7 @@ function pickStealthProfilePreset(overrides) {
15350
13342
  var OPENSTEER_LIVE_SESSION_LAYOUT = "opensteer-session";
15351
13343
  var OPENSTEER_LIVE_SESSION_VERSION = 1;
15352
13344
  function resolveLiveSessionRecordPath(rootPath, provider) {
15353
- return path7__default.default.join(rootPath, "live", provider === "local" ? "local.json" : "cloud.json");
13345
+ return path10__default.default.join(rootPath, "live", provider === "local" ? "local.json" : "cloud.json");
15354
13346
  }
15355
13347
  function resolveLocalSessionRecordPath(rootPath) {
15356
13348
  return resolveLiveSessionRecordPath(rootPath, "local");
@@ -15392,6 +13384,446 @@ function isPersistedCloudSessionRecord(value) {
15392
13384
  function isPersistedLocalBrowserSessionRecord(value) {
15393
13385
  return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "local" && (value.engine === "playwright" || value.engine === "abp") && typeof value.pid === "number" && Number.isFinite(value.pid) && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt) && typeof value.userDataDir === "string" && value.userDataDir.length > 0;
15394
13386
  }
13387
+ function resolveOpensteerStateDir() {
13388
+ const explicit = process.env.OPENSTEER_HOME?.trim();
13389
+ if (explicit) {
13390
+ return path10__default.default.resolve(explicit);
13391
+ }
13392
+ if (process.platform === "win32") {
13393
+ return path10__default.default.join(
13394
+ process.env.LOCALAPPDATA ?? path10__default.default.join(os.homedir(), "AppData", "Local"),
13395
+ "Opensteer"
13396
+ );
13397
+ }
13398
+ if (process.platform === "darwin") {
13399
+ return path10__default.default.join(os.homedir(), "Library", "Application Support", "Opensteer");
13400
+ }
13401
+ return path10__default.default.join(
13402
+ process.env.XDG_STATE_HOME ?? path10__default.default.join(os.homedir(), ".local", "state"),
13403
+ "opensteer"
13404
+ );
13405
+ }
13406
+ function resolveLocalViewRootDir() {
13407
+ return path10__default.default.join(resolveOpensteerStateDir(), "local-view");
13408
+ }
13409
+ function resolveLocalViewPreferencesPath() {
13410
+ return path10__default.default.join(resolveLocalViewRootDir(), "preferences.json");
13411
+ }
13412
+ function resolveLocalViewServiceDir() {
13413
+ return path10__default.default.join(resolveLocalViewRootDir(), "service");
13414
+ }
13415
+ function resolveLocalViewSessionsDir() {
13416
+ return path10__default.default.join(resolveLocalViewRootDir(), "sessions");
13417
+ }
13418
+ function resolveLocalViewServiceLockDir() {
13419
+ return path10__default.default.join(resolveLocalViewServiceDir(), "startup.lock");
13420
+ }
13421
+ function resolveLocalViewServiceStatePath() {
13422
+ return path10__default.default.join(resolveLocalViewServiceDir(), "state.json");
13423
+ }
13424
+
13425
+ // src/local-view/preferences.ts
13426
+ var OPENSTEER_LOCAL_VIEW_PREFERENCES_LAYOUT = "opensteer-local-view-preferences";
13427
+ var OPENSTEER_LOCAL_VIEW_PREFERENCES_VERSION = 1;
13428
+ async function resolveLocalViewMode() {
13429
+ const preferences = await readLocalViewPreferences();
13430
+ return preferences?.mode ?? "auto";
13431
+ }
13432
+ async function readLocalViewPreferences() {
13433
+ const preferencesPath = resolveLocalViewPreferencesPath();
13434
+ if (!await pathExists(preferencesPath)) {
13435
+ return void 0;
13436
+ }
13437
+ const parsed = await readJsonFile(preferencesPath);
13438
+ return isPersistedLocalViewPreferences(parsed) ? parsed : void 0;
13439
+ }
13440
+ function isPersistedLocalViewPreferences(value) {
13441
+ return value?.layout === OPENSTEER_LOCAL_VIEW_PREFERENCES_LAYOUT && value.version === OPENSTEER_LOCAL_VIEW_PREFERENCES_VERSION && (value.mode === "auto" || value.mode === "manual") && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt);
13442
+ }
13443
+ var LOCK_OWNER_FILE = "owner.json";
13444
+ var LOCK_RECLAIMER_DIR = "reclaimer";
13445
+ var LOCK_RETRY_DELAY_MS = 50;
13446
+ async function acquireDirLock(lockDirPath) {
13447
+ while (true) {
13448
+ const releaseLock = await tryAcquireDirLock(lockDirPath);
13449
+ if (releaseLock) {
13450
+ return releaseLock;
13451
+ }
13452
+ await sleep(LOCK_RETRY_DELAY_MS);
13453
+ }
13454
+ }
13455
+ async function tryAcquireDirLock(lockDirPath) {
13456
+ await promises.mkdir(path10.dirname(lockDirPath), { recursive: true });
13457
+ while (true) {
13458
+ const tempLockDirPath = `${lockDirPath}-${String(process.pid)}-${String(CURRENT_PROCESS_OWNER.processStartedAtMs)}-${crypto.randomUUID()}`;
13459
+ try {
13460
+ await promises.mkdir(tempLockDirPath);
13461
+ await writeLockOwner(tempLockDirPath, CURRENT_PROCESS_OWNER);
13462
+ try {
13463
+ await promises.rename(tempLockDirPath, lockDirPath);
13464
+ break;
13465
+ } catch (error) {
13466
+ if (!wasDirPublishedByAnotherProcess(error, lockDirPath)) {
13467
+ throw error;
13468
+ }
13469
+ }
13470
+ } finally {
13471
+ await promises.rm(tempLockDirPath, {
13472
+ recursive: true,
13473
+ force: true
13474
+ }).catch(() => void 0);
13475
+ }
13476
+ const owner = await readLockOwner(lockDirPath);
13477
+ if ((!owner || await getProcessLiveness(owner) === "dead") && await tryReclaimStaleLock(lockDirPath, owner)) {
13478
+ continue;
13479
+ }
13480
+ return null;
13481
+ }
13482
+ return async () => {
13483
+ await promises.rm(lockDirPath, {
13484
+ recursive: true,
13485
+ force: true
13486
+ }).catch(() => void 0);
13487
+ };
13488
+ }
13489
+ function getErrorCode(error) {
13490
+ return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : void 0;
13491
+ }
13492
+ function wasDirPublishedByAnotherProcess(error, targetDirPath) {
13493
+ const code = getErrorCode(error);
13494
+ return fs.existsSync(targetDirPath) && (code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM");
13495
+ }
13496
+ async function writeLockOwner(lockDirPath, owner) {
13497
+ await promises.writeFile(path10.join(lockDirPath, LOCK_OWNER_FILE), JSON.stringify(owner));
13498
+ }
13499
+ async function readLockOwner(lockDirPath) {
13500
+ return readLockParticipant(path10.join(lockDirPath, LOCK_OWNER_FILE));
13501
+ }
13502
+ async function readLockParticipant(filePath) {
13503
+ return (await readLockParticipantRecord(filePath)).owner;
13504
+ }
13505
+ async function readLockParticipantRecord(filePath) {
13506
+ try {
13507
+ const raw = await promises.readFile(filePath, "utf8");
13508
+ return {
13509
+ exists: true,
13510
+ owner: parseProcessOwner(JSON.parse(raw))
13511
+ };
13512
+ } catch (error) {
13513
+ return {
13514
+ exists: getErrorCode(error) !== "ENOENT",
13515
+ owner: null
13516
+ };
13517
+ }
13518
+ }
13519
+ async function readLockReclaimerRecord(lockDirPath) {
13520
+ return readLockParticipantRecord(path10.join(buildLockReclaimerDirPath(lockDirPath), LOCK_OWNER_FILE));
13521
+ }
13522
+ async function tryReclaimStaleLock(lockDirPath, expectedOwner) {
13523
+ if (!await tryAcquireLockReclaimer(lockDirPath)) {
13524
+ return false;
13525
+ }
13526
+ let reclaimed = false;
13527
+ try {
13528
+ const owner = await readLockOwner(lockDirPath);
13529
+ if (!processOwnersEqual(owner, expectedOwner)) {
13530
+ return false;
13531
+ }
13532
+ if (owner && await getProcessLiveness(owner) !== "dead") {
13533
+ return false;
13534
+ }
13535
+ await promises.rm(lockDirPath, {
13536
+ recursive: true,
13537
+ force: true
13538
+ }).catch(() => void 0);
13539
+ reclaimed = !fs.existsSync(lockDirPath);
13540
+ return reclaimed;
13541
+ } finally {
13542
+ if (!reclaimed) {
13543
+ await promises.rm(buildLockReclaimerDirPath(lockDirPath), {
13544
+ recursive: true,
13545
+ force: true
13546
+ }).catch(() => void 0);
13547
+ }
13548
+ }
13549
+ }
13550
+ async function tryAcquireLockReclaimer(lockDirPath) {
13551
+ const reclaimerDirPath = buildLockReclaimerDirPath(lockDirPath);
13552
+ while (true) {
13553
+ const tempReclaimerDirPath = `${reclaimerDirPath}-${String(process.pid)}-${String(CURRENT_PROCESS_OWNER.processStartedAtMs)}-${crypto.randomUUID()}`;
13554
+ try {
13555
+ await promises.mkdir(tempReclaimerDirPath);
13556
+ await writeLockOwner(tempReclaimerDirPath, CURRENT_PROCESS_OWNER);
13557
+ try {
13558
+ await promises.rename(tempReclaimerDirPath, reclaimerDirPath);
13559
+ return true;
13560
+ } catch (error) {
13561
+ if (getErrorCode(error) === "ENOENT") {
13562
+ return false;
13563
+ }
13564
+ if (!wasDirPublishedByAnotherProcess(error, reclaimerDirPath)) {
13565
+ throw error;
13566
+ }
13567
+ }
13568
+ } catch (error) {
13569
+ if (getErrorCode(error) === "ENOENT") {
13570
+ return false;
13571
+ }
13572
+ throw error;
13573
+ } finally {
13574
+ await promises.rm(tempReclaimerDirPath, {
13575
+ recursive: true,
13576
+ force: true
13577
+ }).catch(() => void 0);
13578
+ }
13579
+ const reclaimerRecord = await readLockReclaimerRecord(lockDirPath);
13580
+ if (!reclaimerRecord.exists || !reclaimerRecord.owner) {
13581
+ return false;
13582
+ }
13583
+ if (await getProcessLiveness(reclaimerRecord.owner) !== "dead") {
13584
+ return false;
13585
+ }
13586
+ await promises.rm(reclaimerDirPath, {
13587
+ recursive: true,
13588
+ force: true
13589
+ }).catch(() => void 0);
13590
+ }
13591
+ }
13592
+ function buildLockReclaimerDirPath(lockDirPath) {
13593
+ return path10.join(lockDirPath, LOCK_RECLAIMER_DIR);
13594
+ }
13595
+ async function sleep(ms) {
13596
+ await new Promise((resolve4) => setTimeout(resolve4, ms));
13597
+ }
13598
+ var OPENSTEER_LOCAL_VIEW_SERVICE_LAYOUT = "opensteer-local-view-service";
13599
+ var OPENSTEER_LOCAL_VIEW_SERVICE_VERSION = 3;
13600
+ async function readLocalViewServiceState() {
13601
+ const statePath = resolveLocalViewServiceStatePath();
13602
+ if (!await pathExists(statePath)) {
13603
+ return void 0;
13604
+ }
13605
+ const parsed = await readJsonFile(statePath);
13606
+ if (!isPersistedLocalViewServiceState(parsed)) {
13607
+ return void 0;
13608
+ }
13609
+ return parsed;
13610
+ }
13611
+ async function isLocalViewServiceStateLive(state) {
13612
+ return await getLocalViewServiceStateLiveness(state) !== "dead";
13613
+ }
13614
+ async function getLocalViewServiceStateLiveness(state) {
13615
+ if (state === void 0) {
13616
+ return "dead";
13617
+ }
13618
+ return getProcessLiveness({
13619
+ pid: state.pid,
13620
+ processStartedAtMs: state.processStartedAtMs
13621
+ });
13622
+ }
13623
+ function isPersistedLocalViewServiceState(value) {
13624
+ return value?.layout === OPENSTEER_LOCAL_VIEW_SERVICE_LAYOUT && value.version === OPENSTEER_LOCAL_VIEW_SERVICE_VERSION && typeof value.pid === "number" && Number.isFinite(value.pid) && typeof value.processStartedAtMs === "number" && Number.isFinite(value.processStartedAtMs) && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.port === "number" && Number.isFinite(value.port) && typeof value.token === "string" && value.token.length > 0 && typeof value.url === "string" && value.url.length > 0;
13625
+ }
13626
+
13627
+ // src/local-view/service.ts
13628
+ var LOCAL_VIEW_STARTUP_TIMEOUT_MS = 1e4;
13629
+ var LOCAL_VIEW_STARTUP_POLL_MS = 100;
13630
+ async function ensureLocalViewServiceRunning() {
13631
+ const current = await readReachableLocalViewServiceState();
13632
+ if (current !== void 0) {
13633
+ return current;
13634
+ }
13635
+ const releaseLock = await acquireDirLock(resolveLocalViewServiceLockDir());
13636
+ try {
13637
+ const lockedState = await readReachableLocalViewServiceState();
13638
+ if (lockedState !== void 0) {
13639
+ return lockedState;
13640
+ }
13641
+ await spawnLocalViewService();
13642
+ const started = await waitForLocalViewService();
13643
+ if (!started) {
13644
+ throw new Error("Timed out while starting the local view service.");
13645
+ }
13646
+ return started;
13647
+ } finally {
13648
+ await releaseLock();
13649
+ }
13650
+ }
13651
+ function spawnLocalViewService() {
13652
+ const command = resolveLocalViewSpawnCommand();
13653
+ const child = child_process.spawn(command.executable, command.args, {
13654
+ cwd: process.cwd(),
13655
+ env: {
13656
+ ...process.env,
13657
+ ...command.env ?? {},
13658
+ OPENSTEER_LOCAL_VIEW_BOOT_TOKEN: process.env.OPENSTEER_LOCAL_VIEW_BOOT_TOKEN ?? crypto.randomBytes(24).toString("hex")
13659
+ },
13660
+ detached: process.platform !== "win32",
13661
+ stdio: "ignore"
13662
+ });
13663
+ child.unref();
13664
+ }
13665
+ async function waitForLocalViewService() {
13666
+ const deadline = Date.now() + LOCAL_VIEW_STARTUP_TIMEOUT_MS;
13667
+ while (Date.now() < deadline) {
13668
+ const state = await readReachableLocalViewServiceState();
13669
+ if (state !== void 0) {
13670
+ return state;
13671
+ }
13672
+ await delay(LOCAL_VIEW_STARTUP_POLL_MS);
13673
+ }
13674
+ return void 0;
13675
+ }
13676
+ async function readReachableLocalViewServiceState() {
13677
+ const state = await readLocalViewServiceState();
13678
+ if (state === void 0 || !await isLocalViewServiceStateLive(state)) {
13679
+ return void 0;
13680
+ }
13681
+ return await isLocalViewServiceReachable(state.url, state.token) ? state : void 0;
13682
+ }
13683
+ async function isLocalViewServiceReachable(baseUrl, token) {
13684
+ try {
13685
+ const response = await fetch(new URL("/api/health", baseUrl), {
13686
+ headers: {
13687
+ "x-opensteer-local-token": token
13688
+ }
13689
+ });
13690
+ return response.ok;
13691
+ } catch {
13692
+ return false;
13693
+ }
13694
+ }
13695
+ function resolveLocalViewSpawnCommand() {
13696
+ const moduleDir = path10__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
13697
+ const distServicePath = findExistingPath([
13698
+ path10__default.default.join(moduleDir, "local-view", "serve-entry.js"),
13699
+ path10__default.default.join(moduleDir, "serve-entry.js"),
13700
+ path10__default.default.join(moduleDir, "..", "local-view", "serve-entry.js")
13701
+ ]);
13702
+ if (distServicePath) {
13703
+ return {
13704
+ executable: process.execPath,
13705
+ args: [distServicePath]
13706
+ };
13707
+ }
13708
+ const distCliPath = findExistingPath([
13709
+ path10__default.default.join(moduleDir, "cli", "bin.js"),
13710
+ path10__default.default.join(moduleDir, "..", "cli", "bin.js")
13711
+ ]);
13712
+ if (distCliPath) {
13713
+ return {
13714
+ executable: process.execPath,
13715
+ args: [distCliPath, "view", "serve"]
13716
+ };
13717
+ }
13718
+ const srcServicePath = findExistingPath([
13719
+ path10__default.default.join(moduleDir, "serve-entry.ts"),
13720
+ path10__default.default.join(moduleDir, "..", "local-view", "serve-entry.ts"),
13721
+ path10__default.default.join(moduleDir, "..", "src", "local-view", "serve-entry.ts")
13722
+ ]);
13723
+ if (srcServicePath) {
13724
+ const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
13725
+ const tsxLoaderPath = require2.resolve("tsx");
13726
+ const tsconfigPath = findNearestTsconfig(path10__default.default.resolve(moduleDir, "..", "..", ".."));
13727
+ return {
13728
+ executable: process.execPath,
13729
+ args: ["--import", tsxLoaderPath, srcServicePath],
13730
+ ...tsconfigPath ? { env: { TSX_TSCONFIG_PATH: tsconfigPath } } : {}
13731
+ };
13732
+ }
13733
+ const srcCliPath = findExistingPath([
13734
+ path10__default.default.join(moduleDir, "..", "cli", "bin.ts"),
13735
+ path10__default.default.join(moduleDir, "..", "src", "cli", "bin.ts")
13736
+ ]);
13737
+ if (srcCliPath) {
13738
+ const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
13739
+ const tsxLoaderPath = require2.resolve("tsx");
13740
+ const tsconfigPath = findNearestTsconfig(path10__default.default.resolve(moduleDir, "..", "..", ".."));
13741
+ return {
13742
+ executable: process.execPath,
13743
+ args: ["--import", tsxLoaderPath, srcCliPath, "view", "serve"],
13744
+ ...tsconfigPath ? { env: { TSX_TSCONFIG_PATH: tsconfigPath } } : {}
13745
+ };
13746
+ }
13747
+ throw new Error(`Could not resolve the Opensteer CLI entrypoint from ${moduleDir}.`);
13748
+ }
13749
+ function findExistingPath(candidates) {
13750
+ return candidates.find((candidate) => fs.existsSync(candidate));
13751
+ }
13752
+ function findNearestTsconfig(startDir) {
13753
+ let currentDir = startDir;
13754
+ while (true) {
13755
+ const candidate = path10__default.default.join(currentDir, "tsconfig.json");
13756
+ if (fs.existsSync(candidate)) {
13757
+ return candidate;
13758
+ }
13759
+ const parentDir = path10__default.default.dirname(currentDir);
13760
+ if (parentDir === currentDir) {
13761
+ return void 0;
13762
+ }
13763
+ currentDir = parentDir;
13764
+ }
13765
+ }
13766
+ function delay(ms) {
13767
+ return new Promise((resolve4) => {
13768
+ setTimeout(resolve4, ms);
13769
+ });
13770
+ }
13771
+ var OPENSTEER_LOCAL_VIEW_SESSION_LAYOUT = "opensteer-local-view-session";
13772
+ var OPENSTEER_LOCAL_VIEW_SESSION_VERSION = 1;
13773
+ function buildLocalViewSessionId(input) {
13774
+ const hash = crypto.createHash("sha256").update(`${input.rootPath}
13775
+ ${String(input.pid)}
13776
+ ${String(input.startedAt)}`).digest("hex");
13777
+ return `local_${hash.slice(0, 24)}`;
13778
+ }
13779
+ function createLocalViewSessionManifest(input) {
13780
+ return {
13781
+ layout: OPENSTEER_LOCAL_VIEW_SESSION_LAYOUT,
13782
+ version: OPENSTEER_LOCAL_VIEW_SESSION_VERSION,
13783
+ sessionId: buildLocalViewSessionId({
13784
+ rootPath: input.rootPath,
13785
+ pid: input.live.pid,
13786
+ startedAt: input.live.startedAt
13787
+ }),
13788
+ rootPath: input.rootPath,
13789
+ ...input.workspace === void 0 ? {} : { workspace: input.workspace },
13790
+ engine: input.live.engine,
13791
+ ownership: input.ownership,
13792
+ pid: input.live.pid,
13793
+ startedAt: input.live.startedAt,
13794
+ updatedAt: Date.now()
13795
+ };
13796
+ }
13797
+ async function writeLocalViewSessionManifest(manifest) {
13798
+ await ensureDirectory(resolveLocalViewSessionsDir());
13799
+ await writeJsonFileAtomic(resolveLocalViewSessionManifestPath(manifest.sessionId), manifest);
13800
+ }
13801
+ async function deleteLocalViewSessionManifest(sessionId) {
13802
+ await promises.rm(resolveLocalViewSessionManifestPath(sessionId), { force: true }).catch(() => void 0);
13803
+ }
13804
+ function resolveLocalViewSessionManifestPath(sessionId) {
13805
+ return path10__default.default.join(resolveLocalViewSessionsDir(), `${sessionId}.json`);
13806
+ }
13807
+
13808
+ // src/local-view/registration.ts
13809
+ async function bestEffortRegisterLocalViewSession(input) {
13810
+ try {
13811
+ const manifest = createLocalViewSessionManifest(input);
13812
+ await writeLocalViewSessionManifest(manifest);
13813
+ if (await resolveLocalViewMode() === "auto") {
13814
+ void ensureLocalViewServiceRunning().catch(() => void 0);
13815
+ }
13816
+ return manifest;
13817
+ } catch {
13818
+ return void 0;
13819
+ }
13820
+ }
13821
+ async function bestEffortUnregisterLocalViewSession(sessionId) {
13822
+ if (!sessionId) {
13823
+ return;
13824
+ }
13825
+ await deleteLocalViewSessionManifest(sessionId).catch(() => void 0);
13826
+ }
15395
13827
 
15396
13828
  // ../runtime-core/src/internal/engine-selection.ts
15397
13829
  var OPENSTEER_ENGINE_NAMES = ["playwright", "abp"];
@@ -15510,8 +13942,8 @@ var OpensteerBrowserManager = class {
15510
13942
  ...options.browser === void 0 ? {} : { browser: options.browser },
15511
13943
  ...this.contextOptions === void 0 ? {} : { context: this.contextOptions }
15512
13944
  });
15513
- this.rootPath = options.rootPath ?? (this.workspace === void 0 ? path7__default.default.join(os.tmpdir(), `${TEMPORARY_WORKSPACE_PREFIX}${crypto.randomUUID()}`) : resolveFilesystemWorkspacePath({
15514
- rootDir: path7__default.default.resolve(options.rootDir ?? process.cwd()),
13945
+ this.rootPath = options.rootPath ?? (this.workspace === void 0 ? path10__default.default.join(os.tmpdir(), `${TEMPORARY_WORKSPACE_PREFIX}${crypto.randomUUID()}`) : resolveFilesystemWorkspacePath({
13946
+ rootDir: path10__default.default.resolve(options.rootDir ?? process.cwd()),
15515
13947
  workspace: this.workspace
15516
13948
  }));
15517
13949
  this.cleanupRootOnDisconnect = this.workspace === void 0;
@@ -15572,7 +14004,7 @@ var OpensteerBrowserManager = class {
15572
14004
  userDataDir: "browser/user-data",
15573
14005
  bootstrap: {
15574
14006
  kind: "cloneLocalProfile",
15575
- sourceUserDataDir: path7__default.default.resolve(input.sourceUserDataDir),
14007
+ sourceUserDataDir: path10__default.default.resolve(input.sourceUserDataDir),
15576
14008
  ...input.sourceProfileDirectory === void 0 ? {} : { sourceProfileDirectory: input.sourceProfileDirectory }
15577
14009
  }
15578
14010
  };
@@ -15645,6 +14077,12 @@ var OpensteerBrowserManager = class {
15645
14077
  `workspace "${this.workspace}" already has a live ${live.engine} browser. Close it before reopening with engine "abp".`
15646
14078
  );
15647
14079
  }
14080
+ await bestEffortRegisterLocalViewSession({
14081
+ rootPath: workspace.rootPath,
14082
+ ...this.workspace === void 0 ? {} : { workspace: this.workspace },
14083
+ live: toPersistedLocalBrowserSessionRecord(this.workspace, live),
14084
+ ownership: "owned"
14085
+ });
15648
14086
  return this.createAdoptedAbpEngine(live);
15649
14087
  }
15650
14088
  await this.ensurePersistentBrowserManifest(workspace);
@@ -15677,9 +14115,17 @@ var OpensteerBrowserManager = class {
15677
14115
  ...launch?.browserExecutablePath === void 0 ? {} : { executablePath: launch.browserExecutablePath }
15678
14116
  };
15679
14117
  await this.writeLivePersistentBrowser(workspace, liveRecord);
14118
+ const persistedLiveRecord = toPersistedLocalBrowserSessionRecord(this.workspace, liveRecord);
14119
+ await bestEffortRegisterLocalViewSession({
14120
+ rootPath: workspace.rootPath,
14121
+ ...this.workspace === void 0 ? {} : { workspace: this.workspace },
14122
+ live: persistedLiveRecord,
14123
+ ownership: "owned"
14124
+ });
15680
14125
  try {
15681
14126
  return await this.createAdoptedAbpEngine(liveRecord);
15682
14127
  } catch (error) {
14128
+ await this.unregisterLocalViewSessionForRecord(workspace.rootPath, persistedLiveRecord);
15683
14129
  await terminateProcess(launched.process.pid ?? 0).catch(() => void 0);
15684
14130
  await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
15685
14131
  throw error;
@@ -15699,23 +14145,45 @@ var OpensteerBrowserManager = class {
15699
14145
  });
15700
14146
  }
15701
14147
  async createTemporaryEngine() {
15702
- const userDataDir = await promises.mkdtemp(path7__default.default.join(os.tmpdir(), "opensteer-temporary-browser-"));
14148
+ const userDataDir = await promises.mkdtemp(path10__default.default.join(os.tmpdir(), "opensteer-temporary-browser-"));
15703
14149
  await clearChromeSingletonEntries(userDataDir);
15704
14150
  const launched = await launchOwnedBrowser({
15705
14151
  userDataDir,
15706
14152
  ...this.launchOptions === void 0 ? {} : { launch: this.launchOptions },
15707
14153
  ...this.contextOptions?.viewport === void 0 ? {} : { viewport: this.contextOptions.viewport }
15708
14154
  });
14155
+ const temporaryLiveRecord = {
14156
+ layout: "opensteer-session",
14157
+ version: 1,
14158
+ provider: "local",
14159
+ engine: "playwright",
14160
+ endpoint: launched.endpoint,
14161
+ pid: launched.pid,
14162
+ startedAt: Date.now(),
14163
+ updatedAt: Date.now(),
14164
+ executablePath: launched.executablePath,
14165
+ userDataDir
14166
+ };
14167
+ await writePersistedSessionRecord(this.rootPath, temporaryLiveRecord);
14168
+ const localViewManifest = await bestEffortRegisterLocalViewSession({
14169
+ rootPath: this.rootPath,
14170
+ live: temporaryLiveRecord,
14171
+ ownership: "owned"
14172
+ });
15709
14173
  try {
15710
14174
  return await this.createAttachedEngine({
15711
14175
  endpoint: launched.endpoint,
15712
14176
  freshTab: false,
15713
14177
  onDispose: async () => {
14178
+ await bestEffortUnregisterLocalViewSession(localViewManifest?.sessionId);
14179
+ await clearPersistedSessionRecord(this.rootPath, "local").catch(() => void 0);
15714
14180
  await terminateProcess(launched.pid).catch(() => void 0);
15715
14181
  await promises.rm(userDataDir, { recursive: true, force: true }).catch(() => void 0);
15716
14182
  }
15717
14183
  });
15718
14184
  } catch (error) {
14185
+ await bestEffortUnregisterLocalViewSession(localViewManifest?.sessionId);
14186
+ await clearPersistedSessionRecord(this.rootPath, "local").catch(() => void 0);
15719
14187
  await terminateProcess(launched.pid).catch(() => void 0);
15720
14188
  await promises.rm(userDataDir, { recursive: true, force: true }).catch(() => void 0);
15721
14189
  throw error;
@@ -15743,6 +14211,12 @@ var OpensteerBrowserManager = class {
15743
14211
  if (live.endpoint === void 0) {
15744
14212
  throw new Error("workspace live browser record is missing a DevTools endpoint.");
15745
14213
  }
14214
+ await bestEffortRegisterLocalViewSession({
14215
+ rootPath: workspace.rootPath,
14216
+ ...this.workspace === void 0 ? {} : { workspace: this.workspace },
14217
+ live: toPersistedLocalBrowserSessionRecord(this.workspace, live),
14218
+ ownership: "owned"
14219
+ });
15746
14220
  return this.createAttachedEngine({
15747
14221
  endpoint: live.endpoint,
15748
14222
  freshTab: false,
@@ -15765,6 +14239,13 @@ var OpensteerBrowserManager = class {
15765
14239
  userDataDir: workspace.browserUserDataDir
15766
14240
  };
15767
14241
  await this.writeLivePersistentBrowser(workspace, liveRecord);
14242
+ const persistedLiveRecord = toPersistedLocalBrowserSessionRecord(this.workspace, liveRecord);
14243
+ await bestEffortRegisterLocalViewSession({
14244
+ rootPath: workspace.rootPath,
14245
+ ...this.workspace === void 0 ? {} : { workspace: this.workspace },
14246
+ live: persistedLiveRecord,
14247
+ ownership: "owned"
14248
+ });
15768
14249
  try {
15769
14250
  return await this.createAttachedEngine({
15770
14251
  endpoint: launched.endpoint,
@@ -15772,6 +14253,7 @@ var OpensteerBrowserManager = class {
15772
14253
  onDispose: async () => void 0
15773
14254
  });
15774
14255
  } catch (error) {
14256
+ await this.unregisterLocalViewSessionForRecord(workspace.rootPath, persistedLiveRecord);
15775
14257
  await terminateProcess(launched.pid).catch(() => void 0);
15776
14258
  await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
15777
14259
  throw error;
@@ -15922,6 +14404,10 @@ var OpensteerBrowserManager = class {
15922
14404
  await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
15923
14405
  return;
15924
14406
  }
14407
+ await this.unregisterLocalViewSessionForRecord(
14408
+ workspace.rootPath,
14409
+ toPersistedLocalBrowserSessionRecord(this.workspace, live)
14410
+ );
15925
14411
  if (live.engine === "playwright") {
15926
14412
  if (live.endpoint !== void 0) {
15927
14413
  await requestBrowserClose(live.endpoint).catch(() => void 0);
@@ -15948,6 +14434,15 @@ var OpensteerBrowserManager = class {
15948
14434
  throw new Error(`browser.${method}() requires a persistent workspace browser.`);
15949
14435
  }
15950
14436
  }
14437
+ async unregisterLocalViewSessionForRecord(rootPath, record) {
14438
+ await bestEffortUnregisterLocalViewSession(
14439
+ buildLocalViewSessionId({
14440
+ rootPath,
14441
+ pid: record.pid,
14442
+ startedAt: record.startedAt
14443
+ })
14444
+ );
14445
+ }
15951
14446
  };
15952
14447
  function normalizeWorkspace(workspace) {
15953
14448
  const normalized = workspace?.trim();
@@ -16113,7 +14608,7 @@ async function waitForDevToolsEndpoint(input) {
16113
14608
  if (exitCode !== null) {
16114
14609
  throw new Error(formatChromeLaunchError(input.stderrLines));
16115
14610
  }
16116
- await sleep(DEVTOOLS_POLL_INTERVAL_MS);
14611
+ await sleep2(DEVTOOLS_POLL_INTERVAL_MS);
16117
14612
  }
16118
14613
  throw new Error(formatChromeLaunchError(input.stderrLines));
16119
14614
  }
@@ -16261,12 +14756,12 @@ async function waitForProcessExit(pid, timeoutMs) {
16261
14756
  if (!isProcessRunning(pid)) {
16262
14757
  return true;
16263
14758
  }
16264
- await sleep(50);
14759
+ await sleep2(50);
16265
14760
  }
16266
14761
  return !isProcessRunning(pid);
16267
14762
  }
16268
14763
  function resolveAbpSessionDir(workspace) {
16269
- return path7__default.default.join(workspace.livePath, "abp-session");
14764
+ return path10__default.default.join(workspace.livePath, "abp-session");
16270
14765
  }
16271
14766
  async function allocateEphemeralPort() {
16272
14767
  const { allocatePort } = await loadAbpModule();
@@ -16323,14 +14818,14 @@ function resolveStealthProfile(input) {
16323
14818
  function isStealthProfile(input) {
16324
14819
  return input.id !== void 0 && input.platform !== void 0 && input.browserBrand !== void 0 && input.browserVersion !== void 0 && input.userAgent !== void 0 && input.viewport !== void 0 && input.screenResolution !== void 0 && input.devicePixelRatio !== void 0 && input.maxTouchPoints !== void 0 && input.webglVendor !== void 0 && input.webglRenderer !== void 0 && input.fonts !== void 0 && input.canvasNoiseSeed !== void 0 && input.audioNoiseSeed !== void 0 && input.locale !== void 0 && input.timezoneId !== void 0;
16325
14820
  }
16326
- async function sleep(ms) {
14821
+ async function sleep2(ms) {
16327
14822
  await new Promise((resolve4) => setTimeout(resolve4, ms));
16328
14823
  }
16329
14824
  var ENV_FILENAMES = [".env", ".env.local"];
16330
14825
  var OPENSTEER_ENV_PREFIX = "OPENSTEER_";
16331
14826
  var opensteerEnvironmentCache = /* @__PURE__ */ new Map();
16332
14827
  function resolveOpensteerEnvironment(cwd = process.cwd(), baseEnv = process.env) {
16333
- const resolvedCwd = path7__default.default.resolve(cwd);
14828
+ const resolvedCwd = path10__default.default.resolve(cwd);
16334
14829
  const signature = buildEnvironmentSignature(baseEnv, isOpensteerEnvironmentKey);
16335
14830
  const cached = opensteerEnvironmentCache.get(resolvedCwd);
16336
14831
  if (cached && cached.signature === signature) {
@@ -16345,10 +14840,10 @@ function resolveOpensteerEnvironment(cwd = process.cwd(), baseEnv = process.env)
16345
14840
  }
16346
14841
  function collectDirectories(cwd) {
16347
14842
  const directories = [];
16348
- let current = path7__default.default.resolve(cwd);
14843
+ let current = path10__default.default.resolve(cwd);
16349
14844
  for (; ; ) {
16350
14845
  directories.unshift(current);
16351
- const parent = path7__default.default.dirname(current);
14846
+ const parent = path10__default.default.dirname(current);
16352
14847
  if (parent === current) {
16353
14848
  return directories;
16354
14849
  }
@@ -16391,7 +14886,7 @@ function resolveEnvironmentFiles(cwd, baseEnv, predicate) {
16391
14886
  const directories = collectDirectories(cwd);
16392
14887
  for (const directory of directories) {
16393
14888
  for (const filename of ENV_FILENAMES) {
16394
- const filePath = path7__default.default.join(directory, filename);
14889
+ const filePath = path10__default.default.join(directory, filename);
16395
14890
  if (!fs.existsSync(filePath)) {
16396
14891
  continue;
16397
14892
  }
@@ -16470,17 +14965,17 @@ async function readBrowserCookies(input = {}) {
16470
14965
  const brand2 = resolveRequestedBrand(input);
16471
14966
  const userDataDir = resolveBrandUserDataDir(brand2, input.userDataDir);
16472
14967
  const profileDirectory = input.profileDirectory ?? "Default";
16473
- const cookiesPath = path7.join(userDataDir, profileDirectory, "Cookies");
14968
+ const cookiesPath = path10.join(userDataDir, profileDirectory, "Cookies");
16474
14969
  if (!fs.existsSync(cookiesPath)) {
16475
14970
  throw new Error(
16476
14971
  `Cookies database not found at "${cookiesPath}". Verify the browser brand, user-data-dir, and profile-directory are correct.`
16477
14972
  );
16478
14973
  }
16479
- const tempDir = await promises.mkdtemp(path7.join(os.tmpdir(), "opensteer-cookies-"));
14974
+ const tempDir = await promises.mkdtemp(path10.join(os.tmpdir(), "opensteer-cookies-"));
16480
14975
  try {
16481
14976
  await copyCookiesDatabase(cookiesPath, tempDir);
16482
14977
  const decryptionKey = await resolveDecryptionKey(brand2.id, userDataDir);
16483
- const rows = queryAllCookies(path7.join(tempDir, "Cookies"));
14978
+ const rows = queryAllCookies(path10.join(tempDir, "Cookies"));
16484
14979
  const cookies = decryptCookieRows(rows, decryptionKey);
16485
14980
  return {
16486
14981
  cookies,
@@ -16506,11 +15001,11 @@ function resolveRequestedBrand(input) {
16506
15001
  return installed.brand;
16507
15002
  }
16508
15003
  async function copyCookiesDatabase(cookiesPath, destDir) {
16509
- await promises.copyFile(cookiesPath, path7.join(destDir, "Cookies"));
15004
+ await promises.copyFile(cookiesPath, path10.join(destDir, "Cookies"));
16510
15005
  for (const suffix of ["-wal", "-journal", "-shm"]) {
16511
15006
  const src = cookiesPath + suffix;
16512
15007
  if (fs.existsSync(src)) {
16513
- await promises.copyFile(src, path7.join(destDir, "Cookies" + suffix)).catch(() => void 0);
15008
+ await promises.copyFile(src, path10.join(destDir, "Cookies" + suffix)).catch(() => void 0);
16514
15009
  }
16515
15010
  }
16516
15011
  }
@@ -16587,7 +15082,7 @@ async function resolveKeychainPassword(brandId) {
16587
15082
  }
16588
15083
  }
16589
15084
  async function resolveWindowsMasterKey(userDataDir) {
16590
- const localStatePath = path7.join(userDataDir, "Local State");
15085
+ const localStatePath = path10.join(userDataDir, "Local State");
16591
15086
  let localState;
16592
15087
  try {
16593
15088
  localState = JSON.parse(await promises.readFile(localStatePath, "utf8"));
@@ -16788,14 +15283,14 @@ function toPortableBrowserProfileCookieRecord(cookie) {
16788
15283
  if (!name || !domain) {
16789
15284
  return null;
16790
15285
  }
16791
- const path15 = typeof cookie.path === "string" && cookie.path.trim().length > 0 ? cookie.path : "/";
15286
+ const path18 = typeof cookie.path === "string" && cookie.path.trim().length > 0 ? cookie.path : "/";
16792
15287
  const expiresAt = typeof cookie.expires === "number" && Number.isFinite(cookie.expires) && cookie.expires > 0 ? Math.floor(cookie.expires * 1e3) : null;
16793
15288
  const sameSite = normalizeSameSite(cookie.sameSite);
16794
15289
  return {
16795
15290
  name,
16796
15291
  value: cookie.value,
16797
15292
  domain,
16798
- path: path15,
15293
+ path: path18,
16799
15294
  secure: cookie.secure,
16800
15295
  httpOnly: cookie.httpOnly,
16801
15296
  ...sameSite === void 0 ? {} : { sameSite },
@@ -16864,7 +15359,7 @@ async function waitForBrowserProfileImport(client, importId) {
16864
15359
  if (current.status === "failed") {
16865
15360
  throw new Error(current.error ?? "Browser profile sync failed.");
16866
15361
  }
16867
- await sleep2(DEFAULT_POLL_INTERVAL_MS);
15362
+ await sleep3(DEFAULT_POLL_INTERVAL_MS);
16868
15363
  }
16869
15364
  throw new Error(`Timed out waiting for browser profile sync "${importId}" to finish.`);
16870
15365
  }
@@ -16873,7 +15368,7 @@ function normalizePlatform(platform) {
16873
15368
  if (platform === "win32") return "windows";
16874
15369
  return platform;
16875
15370
  }
16876
- async function sleep2(ms) {
15371
+ async function sleep3(ms) {
16877
15372
  await new Promise((resolve4) => setTimeout(resolve4, ms));
16878
15373
  }
16879
15374
 
@@ -17071,7 +15566,7 @@ var OpensteerCloudClient = class {
17071
15566
  `Unexpected cloud session status "${String(session.status)}" while waiting for close.`
17072
15567
  );
17073
15568
  }
17074
- await delay(CLOUD_CLOSE_POLL_INTERVAL_MS);
15569
+ await delay2(CLOUD_CLOSE_POLL_INTERVAL_MS);
17075
15570
  }
17076
15571
  throw new Error(`Timed out waiting for cloud session ${sessionId} to close.`);
17077
15572
  }
@@ -17083,7 +15578,7 @@ function createRequestSignal(options) {
17083
15578
  }
17084
15579
  return AbortSignal.any([options.signal, timeoutSignal]);
17085
15580
  }
17086
- function delay(ms) {
15581
+ function delay2(ms) {
17087
15582
  return new Promise((resolve4) => {
17088
15583
  setTimeout(resolve4, ms);
17089
15584
  });
@@ -17133,7 +15628,7 @@ function resolveCloudConfig(input = {}) {
17133
15628
 
17134
15629
  // ../runtime-core/package.json
17135
15630
  var package_default = {
17136
- version: "0.2.0"};
15631
+ version: "0.2.2"};
17137
15632
 
17138
15633
  // ../runtime-core/src/version.ts
17139
15634
  var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
@@ -17889,11 +16384,11 @@ var NetworkHistory = class {
17889
16384
  var MATCHED_TLS_BINARY_NAMES = ["curl-impersonate-chrome", "curl_chrome"];
17890
16385
  async function executeMatchedTlsTransportRequest(input) {
17891
16386
  const binary = await resolveMatchedTlsBinary();
17892
- const workingDirectory = await promises.mkdtemp(path7__default.default.join(os.tmpdir(), "opensteer-matched-tls-"));
17893
- const headersPath = path7__default.default.join(workingDirectory, "headers.txt");
17894
- const bodyPath = path7__default.default.join(workingDirectory, "body.bin");
17895
- const cookiesPath = path7__default.default.join(workingDirectory, "cookies.txt");
17896
- const requestBodyPath = path7__default.default.join(workingDirectory, "request-body.bin");
16387
+ const workingDirectory = await promises.mkdtemp(path10__default.default.join(os.tmpdir(), "opensteer-matched-tls-"));
16388
+ const headersPath = path10__default.default.join(workingDirectory, "headers.txt");
16389
+ const bodyPath = path10__default.default.join(workingDirectory, "body.bin");
16390
+ const cookiesPath = path10__default.default.join(workingDirectory, "cookies.txt");
16391
+ const requestBodyPath = path10__default.default.join(workingDirectory, "request-body.bin");
17897
16392
  try {
17898
16393
  await promises.writeFile(cookiesPath, toNetscapeCookieJar(input.cookies ?? []), "utf8");
17899
16394
  if (input.request.body !== void 0) {
@@ -17950,10 +16445,10 @@ async function executeMatchedTlsTransportRequest(input) {
17950
16445
  }
17951
16446
  }
17952
16447
  async function resolveMatchedTlsBinary() {
17953
- const pathEntries = (process.env.PATH ?? "").split(path7__default.default.delimiter).filter((entry) => entry.length > 0);
16448
+ const pathEntries = (process.env.PATH ?? "").split(path10__default.default.delimiter).filter((entry) => entry.length > 0);
17954
16449
  for (const directory of pathEntries) {
17955
16450
  for (const name of MATCHED_TLS_BINARY_NAMES) {
17956
- const candidate = path7__default.default.join(directory, name);
16451
+ const candidate = path10__default.default.join(directory, name);
17957
16452
  if (await isExecutable(candidate)) {
17958
16453
  return candidate;
17959
16454
  }
@@ -17961,7 +16456,7 @@ async function resolveMatchedTlsBinary() {
17961
16456
  const files = await readDirSafe(directory);
17962
16457
  const discovered = files.find((file) => file.startsWith("curl_chrome"));
17963
16458
  if (discovered !== void 0) {
17964
- const candidate = path7__default.default.join(directory, discovered);
16459
+ const candidate = path10__default.default.join(directory, discovered);
17965
16460
  if (await isExecutable(candidate)) {
17966
16461
  return candidate;
17967
16462
  }
@@ -20415,11 +18910,11 @@ var SandboxClock = class {
20415
18910
  performanceNow() {
20416
18911
  return this.mode === "manual" ? this.manualNow - this.startedAt : (globalThis.performance?.now() ?? 0) - this.performanceStartedAt;
20417
18912
  }
20418
- setTimeout(callback, delay3 = 0, ...args) {
20419
- return this.registerTimer(false, callback, delay3, args);
18913
+ setTimeout(callback, delay4 = 0, ...args) {
18914
+ return this.registerTimer(false, callback, delay4, args);
20420
18915
  }
20421
- setInterval(callback, delay3 = 0, ...args) {
20422
- return this.registerTimer(true, callback, delay3, args);
18916
+ setInterval(callback, delay4 = 0, ...args) {
18917
+ return this.registerTimer(true, callback, delay4, args);
20423
18918
  }
20424
18919
  clearTimeout(timerId) {
20425
18920
  this.clearTimer(timerId);
@@ -20440,9 +18935,9 @@ var SandboxClock = class {
20440
18935
  this.clearTimer(timerId);
20441
18936
  }
20442
18937
  }
20443
- registerTimer(repeat, callback, delay3, args) {
18938
+ registerTimer(repeat, callback, delay4, args) {
20444
18939
  const timerId = this.nextTimerId++;
20445
- const normalizedDelay = Math.max(0, delay3);
18940
+ const normalizedDelay = Math.max(0, delay4);
20446
18941
  const record = {
20447
18942
  callback,
20448
18943
  args,
@@ -20606,7 +19101,7 @@ async function pollTask(apiKey, taskId, signal) {
20606
19101
  const deadline = Date.now() + 12e4;
20607
19102
  while (Date.now() < deadline) {
20608
19103
  signal?.throwIfAborted?.();
20609
- await sleep3(3e3, signal);
19104
+ await sleep4(3e3, signal);
20610
19105
  const response = await fetch(CAPSOLVER_GET_TASK_RESULT_URL, {
20611
19106
  method: "POST",
20612
19107
  headers: {
@@ -20650,7 +19145,7 @@ function extractCaptchaToken(solution) {
20650
19145
  function readString(value) {
20651
19146
  return typeof value === "string" && value.length > 0 ? value : void 0;
20652
19147
  }
20653
- function sleep3(ms, signal) {
19148
+ function sleep4(ms, signal) {
20654
19149
  return new Promise((resolve4, reject) => {
20655
19150
  const timeout = setTimeout(resolve4, ms);
20656
19151
  const abort = () => {
@@ -20704,7 +19199,7 @@ async function pollTask2(apiKey, taskId, signal) {
20704
19199
  const deadline = Date.now() + 12e4;
20705
19200
  while (Date.now() < deadline) {
20706
19201
  signal?.throwIfAborted?.();
20707
- await sleep4(5e3, signal);
19202
+ await sleep5(5e3, signal);
20708
19203
  const response = await fetch(TWO_CAPTCHA_GET_TASK_RESULT_URL, {
20709
19204
  method: "POST",
20710
19205
  headers: {
@@ -20748,7 +19243,7 @@ function extractCaptchaToken2(solution) {
20748
19243
  function readString2(value) {
20749
19244
  return typeof value === "string" && value.length > 0 ? value : void 0;
20750
19245
  }
20751
- function sleep4(ms, signal) {
19246
+ function sleep5(ms, signal) {
20752
19247
  return new Promise((resolve4, reject) => {
20753
19248
  const timeout = setTimeout(resolve4, ms);
20754
19249
  const abort = () => {
@@ -20985,7 +19480,7 @@ var OpensteerSessionRuntime = class {
20985
19480
  this.workspace = normalizeNamespace2(options.name);
20986
19481
  this.workspaceName = options.workspaceName?.trim() === void 0 || options.workspaceName?.trim().length === 0 ? void 0 : options.workspaceName.trim();
20987
19482
  this.root = options.workspace;
20988
- this.rootPath = options.workspace?.rootPath ?? options.rootPath ?? path7__default.default.resolve(process.cwd(), ".opensteer", "temporary", crypto.randomUUID());
19483
+ this.rootPath = options.workspace?.rootPath ?? options.rootPath ?? path10__default.default.resolve(process.cwd(), ".opensteer", "temporary", crypto.randomUUID());
20989
19484
  this.injectedEngine = options.engine;
20990
19485
  this.engineFactory = options.engineFactory;
20991
19486
  this.policy = options.policy ?? defaultPolicy();
@@ -26774,8 +25269,8 @@ var CloudSessionProxy = class {
26774
25269
  this.workspace = options.workspace;
26775
25270
  this.policy = options.policy ?? defaultPolicy();
26776
25271
  this.observability = options.observability;
26777
- this.rootPath = options.rootPath ?? (this.workspace === void 0 ? path7__default.default.join(os.tmpdir(), `${TEMPORARY_CLOUD_WORKSPACE_PREFIX}${crypto.randomUUID()}`) : resolveFilesystemWorkspacePath({
26778
- rootDir: path7__default.default.resolve(options.rootDir ?? process.cwd()),
25272
+ this.rootPath = options.rootPath ?? (this.workspace === void 0 ? path10__default.default.join(os.tmpdir(), `${TEMPORARY_CLOUD_WORKSPACE_PREFIX}${crypto.randomUUID()}`) : resolveFilesystemWorkspacePath({
25273
+ rootDir: path10__default.default.resolve(options.rootDir ?? process.cwd()),
26779
25274
  workspace: this.workspace
26780
25275
  }));
26781
25276
  this.cleanupRootOnClose = options.cleanupRootOnClose ?? this.workspace === void 0;
@@ -27197,8 +25692,8 @@ function isLoopbackBaseUrl(baseUrl) {
27197
25692
  var OpensteerRuntime = class extends OpensteerSessionRuntime {
27198
25693
  constructor(options = {}) {
27199
25694
  const publicWorkspace = normalizeWorkspace2(options.workspace);
27200
- const rootPath = options.rootPath ?? (publicWorkspace === void 0 ? path7__default.default.resolve(options.rootDir ?? process.cwd(), ".opensteer", "temporary", crypto.randomUUID()) : resolveFilesystemWorkspacePath({
27201
- rootDir: path7__default.default.resolve(options.rootDir ?? process.cwd()),
25695
+ const rootPath = options.rootPath ?? (publicWorkspace === void 0 ? path10__default.default.resolve(options.rootDir ?? process.cwd(), ".opensteer", "temporary", crypto.randomUUID()) : resolveFilesystemWorkspacePath({
25696
+ rootDir: path10__default.default.resolve(options.rootDir ?? process.cwd()),
27202
25697
  workspace: publicWorkspace
27203
25698
  }));
27204
25699
  const cleanupRootOnClose = options.cleanupRootOnClose ?? publicWorkspace === void 0;
@@ -27232,7 +25727,7 @@ var OpensteerRuntime = class extends OpensteerSessionRuntime {
27232
25727
  };
27233
25728
  var OpensteerSessionRuntime2 = class extends OpensteerSessionRuntime {
27234
25729
  constructor(options) {
27235
- const rootPath = options.rootPath ?? path7__default.default.resolve(options.rootDir ?? process.cwd());
25730
+ const rootPath = options.rootPath ?? path10__default.default.resolve(options.rootDir ?? process.cwd());
27236
25731
  const cleanupRootOnClose = options.cleanupRootOnClose ?? false;
27237
25732
  const engineName = options.engineName ?? DEFAULT_OPENSTEER_ENGINE;
27238
25733
  assertSupportedEngineOptions({
@@ -27427,7 +25922,7 @@ var Opensteer = class {
27427
25922
  scroll: (input) => this.scroll(input)
27428
25923
  };
27429
25924
  this.network = {
27430
- query: (input = {}) => this.queryNetwork(input),
25925
+ query: (input = {}) => this.runtime.queryNetwork(input),
27431
25926
  detail: (recordId, options2) => this.runtime.getNetworkDetail({ recordId, ...options2 })
27432
25927
  };
27433
25928
  }
@@ -27461,9 +25956,6 @@ var Opensteer = class {
27461
25956
  } : input;
27462
25957
  return (await this.runtime.evaluate(normalized)).value;
27463
25958
  }
27464
- async evaluateJson(input) {
27465
- return this.evaluate(input);
27466
- }
27467
25959
  async addInitScript(input) {
27468
25960
  return this.runtime.addInitScript(
27469
25961
  typeof input === "string" ? {
@@ -27500,34 +25992,6 @@ var Opensteer = class {
27500
25992
  async extract(input) {
27501
25993
  return (await this.runtime.extract(input)).data;
27502
25994
  }
27503
- async queryNetwork(input = {}) {
27504
- return this.runtime.queryNetwork(input);
27505
- }
27506
- async waitForNetwork(input) {
27507
- const { timeoutMs, pollIntervalMs, ...query } = input;
27508
- const timeoutAt = Date.now() + (timeoutMs ?? 3e4);
27509
- const pollInterval = pollIntervalMs ?? 100;
27510
- const baseline = new Set(
27511
- (await this.runtime.queryNetwork({ ...query, limit: 200 })).records.map(
27512
- (record) => record.recordId
27513
- )
27514
- );
27515
- while (true) {
27516
- const next = (await this.runtime.queryNetwork({ ...query, limit: 200 })).records.find(
27517
- (record) => !baseline.has(record.recordId)
27518
- );
27519
- if (next !== void 0) {
27520
- return next;
27521
- }
27522
- if (Date.now() >= timeoutAt) {
27523
- throw new Error("waitForNetwork timed out");
27524
- }
27525
- await delay2(pollInterval);
27526
- }
27527
- }
27528
- async waitForResponse(input) {
27529
- return this.waitForNetwork(input);
27530
- }
27531
25995
  async waitForPage(input = {}) {
27532
25996
  const baseline = new Set((await this.runtime.listPages()).pages.map((page) => page.pageRef));
27533
25997
  const timeoutAt = Date.now() + (input.timeoutMs ?? 3e4);
@@ -27551,7 +26015,7 @@ var Opensteer = class {
27551
26015
  if (Date.now() >= timeoutAt) {
27552
26016
  throw new Error("waitForPage timed out");
27553
26017
  }
27554
- await delay2(pollIntervalMs);
26018
+ await delay3(pollIntervalMs);
27555
26019
  }
27556
26020
  }
27557
26021
  async snapshot(mode = "action") {
@@ -27703,7 +26167,7 @@ function decodeBody(response) {
27703
26167
  }
27704
26168
  return Uint8Array.from(Buffer.from(response.body.data, "base64"));
27705
26169
  }
27706
- function delay2(ms) {
26170
+ function delay3(ms) {
27707
26171
  return new Promise((resolve4) => setTimeout(resolve4, ms));
27708
26172
  }
27709
26173