opensteer 0.8.3 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/{chunk-JK4NMMM2.js → chunk-C7GWMSTV.js} +480 -321
- package/dist/chunk-C7GWMSTV.js.map +1 -0
- package/dist/cli/bin.cjs +2241 -1796
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.js +363 -69
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.cjs +503 -346
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -145
- package/dist/index.d.ts +174 -145
- package/dist/index.js +22 -27
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/skills/opensteer/SKILL.md +66 -13
- package/skills/opensteer/references/cli-reference.md +115 -20
- package/skills/opensteer/references/request-workflow.md +35 -15
- package/skills/opensteer/references/sdk-reference.md +85 -21
- package/dist/chunk-JK4NMMM2.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path6, { join, resolve, basename, relative } from 'path';
|
|
2
2
|
import { randomUUID, createHash } from 'crypto';
|
|
3
|
-
import { rm, mkdtemp, mkdir,
|
|
3
|
+
import { access, rm, mkdtemp, mkdir, readFile, cp, readdir, writeFile, rename, stat, copyFile, open } from 'fs/promises';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
5
|
import { selectAll } from 'css-select';
|
|
6
6
|
import { execFileSync, execFile, spawn } from 'child_process';
|
|
@@ -1765,12 +1765,6 @@ var opensteerRegistryProvenanceSchema = objectSchema(
|
|
|
1765
1765
|
required: ["source"]
|
|
1766
1766
|
}
|
|
1767
1767
|
);
|
|
1768
|
-
var opensteerRequestPlanLifecycleSchema = enumSchema(
|
|
1769
|
-
["draft", "active", "deprecated", "retired"],
|
|
1770
|
-
{
|
|
1771
|
-
title: "OpensteerRequestPlanLifecycle"
|
|
1772
|
-
}
|
|
1773
|
-
);
|
|
1774
1768
|
var opensteerRequestPlanFreshnessSchema = objectSchema(
|
|
1775
1769
|
{
|
|
1776
1770
|
lastValidatedAt: integerSchema({ minimum: 0 }),
|
|
@@ -1793,23 +1787,12 @@ var opensteerRequestPlanRecordSchema = objectSchema(
|
|
|
1793
1787
|
uniqueItems: true
|
|
1794
1788
|
}),
|
|
1795
1789
|
provenance: opensteerRegistryProvenanceSchema,
|
|
1796
|
-
lifecycle: opensteerRequestPlanLifecycleSchema,
|
|
1797
1790
|
freshness: opensteerRequestPlanFreshnessSchema,
|
|
1798
1791
|
payload: opensteerRequestPlanPayloadSchema
|
|
1799
1792
|
},
|
|
1800
1793
|
{
|
|
1801
1794
|
title: "OpensteerRequestPlanRecord",
|
|
1802
|
-
required: [
|
|
1803
|
-
"id",
|
|
1804
|
-
"key",
|
|
1805
|
-
"version",
|
|
1806
|
-
"createdAt",
|
|
1807
|
-
"updatedAt",
|
|
1808
|
-
"contentHash",
|
|
1809
|
-
"tags",
|
|
1810
|
-
"lifecycle",
|
|
1811
|
-
"payload"
|
|
1812
|
-
]
|
|
1795
|
+
required: ["id", "key", "version", "createdAt", "updatedAt", "contentHash", "tags", "payload"]
|
|
1813
1796
|
}
|
|
1814
1797
|
);
|
|
1815
1798
|
var jsonValueSchema = defineSchema({
|
|
@@ -2252,7 +2235,6 @@ var opensteerWriteRequestPlanInputSchema = objectSchema(
|
|
|
2252
2235
|
uniqueItems: true
|
|
2253
2236
|
}),
|
|
2254
2237
|
provenance: opensteerRegistryProvenanceSchema,
|
|
2255
|
-
lifecycle: opensteerRequestPlanLifecycleSchema,
|
|
2256
2238
|
freshness: opensteerRequestPlanFreshnessSchema,
|
|
2257
2239
|
payload: opensteerRequestPlanPayloadSchema
|
|
2258
2240
|
},
|
|
@@ -2493,7 +2475,7 @@ var opensteerInferRequestPlanInputSchema = objectSchema(
|
|
|
2493
2475
|
recordId: stringSchema({ minLength: 1 }),
|
|
2494
2476
|
key: stringSchema({ minLength: 1 }),
|
|
2495
2477
|
version: stringSchema({ minLength: 1 }),
|
|
2496
|
-
|
|
2478
|
+
transport: transportKindSchema
|
|
2497
2479
|
},
|
|
2498
2480
|
{
|
|
2499
2481
|
title: "OpensteerInferRequestPlanInput",
|
|
@@ -7097,9 +7079,7 @@ var FilesystemRegistryStore = class {
|
|
|
7097
7079
|
if (input.version !== void 0) {
|
|
7098
7080
|
return this.resolveIndexedRecord(key, normalizeNonEmptyString("version", input.version));
|
|
7099
7081
|
}
|
|
7100
|
-
const matches = (await this.readAllRecords()).filter(
|
|
7101
|
-
(record) => this.isActive(record) && record.key === key
|
|
7102
|
-
);
|
|
7082
|
+
const matches = (await this.readAllRecords()).filter((record) => record.key === key);
|
|
7103
7083
|
matches.sort(compareByCreatedAtAndId);
|
|
7104
7084
|
return matches[0];
|
|
7105
7085
|
}
|
|
@@ -7222,8 +7202,10 @@ var FilesystemDescriptorRegistry = class extends FilesystemRegistryStore {
|
|
|
7222
7202
|
};
|
|
7223
7203
|
return this.writeRecord(record);
|
|
7224
7204
|
}
|
|
7225
|
-
|
|
7226
|
-
|
|
7205
|
+
async list(input = {}) {
|
|
7206
|
+
const key = input.key === void 0 ? void 0 : normalizeNonEmptyString("key", input.key);
|
|
7207
|
+
const records = await this.readAllRecords();
|
|
7208
|
+
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7227
7209
|
}
|
|
7228
7210
|
};
|
|
7229
7211
|
var FilesystemRequestPlanRegistry = class extends FilesystemRegistryStore {
|
|
@@ -7253,7 +7235,6 @@ var FilesystemRequestPlanRegistry = class extends FilesystemRegistryStore {
|
|
|
7253
7235
|
tags: normalizeTags(input.tags),
|
|
7254
7236
|
...provenance === void 0 ? {} : { provenance },
|
|
7255
7237
|
payload,
|
|
7256
|
-
lifecycle: input.lifecycle ?? "active",
|
|
7257
7238
|
...freshness === void 0 ? {} : { freshness }
|
|
7258
7239
|
};
|
|
7259
7240
|
return this.writeRecord(record);
|
|
@@ -7263,7 +7244,7 @@ var FilesystemRequestPlanRegistry = class extends FilesystemRegistryStore {
|
|
|
7263
7244
|
const records = await this.readAllRecords();
|
|
7264
7245
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7265
7246
|
}
|
|
7266
|
-
async
|
|
7247
|
+
async updateFreshness(input) {
|
|
7267
7248
|
const id = normalizeNonEmptyString("id", input.id);
|
|
7268
7249
|
return withFilesystemLock(this.writeLockPath(), async () => {
|
|
7269
7250
|
const existing = await this.getById(id);
|
|
@@ -7281,16 +7262,12 @@ var FilesystemRequestPlanRegistry = class extends FilesystemRegistryStore {
|
|
|
7281
7262
|
const nextRecord = {
|
|
7282
7263
|
...existing,
|
|
7283
7264
|
updatedAt: nextUpdatedAt,
|
|
7284
|
-
lifecycle: input.lifecycle ?? existing.lifecycle,
|
|
7285
7265
|
...nextFreshness === void 0 ? {} : { freshness: nextFreshness }
|
|
7286
7266
|
};
|
|
7287
7267
|
await writeJsonFileAtomic(this.recordPath(id), nextRecord);
|
|
7288
7268
|
return nextRecord;
|
|
7289
7269
|
});
|
|
7290
7270
|
}
|
|
7291
|
-
isActive(record) {
|
|
7292
|
-
return record.lifecycle === "active";
|
|
7293
|
-
}
|
|
7294
7271
|
};
|
|
7295
7272
|
var FilesystemAuthRecipeRegistry = class extends FilesystemRegistryStore {
|
|
7296
7273
|
constructor(rootPath) {
|
|
@@ -7326,9 +7303,6 @@ var FilesystemAuthRecipeRegistry = class extends FilesystemRegistryStore {
|
|
|
7326
7303
|
const records = await this.readAllRecords();
|
|
7327
7304
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7328
7305
|
}
|
|
7329
|
-
isActive(_record) {
|
|
7330
|
-
return true;
|
|
7331
|
-
}
|
|
7332
7306
|
};
|
|
7333
7307
|
var FilesystemRecipeRegistry = class extends FilesystemRegistryStore {
|
|
7334
7308
|
constructor(rootPath) {
|
|
@@ -7364,9 +7338,6 @@ var FilesystemRecipeRegistry = class extends FilesystemRegistryStore {
|
|
|
7364
7338
|
const records = await this.readAllRecords();
|
|
7365
7339
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7366
7340
|
}
|
|
7367
|
-
isActive(_record) {
|
|
7368
|
-
return true;
|
|
7369
|
-
}
|
|
7370
7341
|
};
|
|
7371
7342
|
var FilesystemInteractionTraceRegistry = class extends FilesystemRegistryStore {
|
|
7372
7343
|
constructor(rootPath) {
|
|
@@ -7402,9 +7373,6 @@ var FilesystemInteractionTraceRegistry = class extends FilesystemRegistryStore {
|
|
|
7402
7373
|
const records = await this.readAllRecords();
|
|
7403
7374
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7404
7375
|
}
|
|
7405
|
-
isActive(_record) {
|
|
7406
|
-
return true;
|
|
7407
|
-
}
|
|
7408
7376
|
};
|
|
7409
7377
|
var FilesystemReverseCaseRegistry = class extends FilesystemRegistryStore {
|
|
7410
7378
|
constructor(rootPath) {
|
|
@@ -7468,9 +7436,6 @@ var FilesystemReverseCaseRegistry = class extends FilesystemRegistryStore {
|
|
|
7468
7436
|
return nextRecord;
|
|
7469
7437
|
});
|
|
7470
7438
|
}
|
|
7471
|
-
isActive(_record) {
|
|
7472
|
-
return true;
|
|
7473
|
-
}
|
|
7474
7439
|
};
|
|
7475
7440
|
var FilesystemReversePackageRegistry = class extends FilesystemRegistryStore {
|
|
7476
7441
|
constructor(rootPath) {
|
|
@@ -7506,9 +7471,6 @@ var FilesystemReversePackageRegistry = class extends FilesystemRegistryStore {
|
|
|
7506
7471
|
const records = await this.readAllRecords();
|
|
7507
7472
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7508
7473
|
}
|
|
7509
|
-
isActive(_record) {
|
|
7510
|
-
return true;
|
|
7511
|
-
}
|
|
7512
7474
|
};
|
|
7513
7475
|
var FilesystemReverseReportRegistry = class extends FilesystemRegistryStore {
|
|
7514
7476
|
constructor(rootPath) {
|
|
@@ -7544,9 +7506,6 @@ var FilesystemReverseReportRegistry = class extends FilesystemRegistryStore {
|
|
|
7544
7506
|
const records = await this.readAllRecords();
|
|
7545
7507
|
return key === void 0 ? records : records.filter((record) => record.key === key);
|
|
7546
7508
|
}
|
|
7547
|
-
isActive(_record) {
|
|
7548
|
-
return true;
|
|
7549
|
-
}
|
|
7550
7509
|
};
|
|
7551
7510
|
function createDescriptorRegistry(rootPath) {
|
|
7552
7511
|
return new FilesystemDescriptorRegistry(rootPath);
|
|
@@ -8286,8 +8245,8 @@ async function createFilesystemOpensteerWorkspace(options) {
|
|
|
8286
8245
|
const browserManifestPath = path6.join(browserPath, "manifest.json");
|
|
8287
8246
|
const browserUserDataDir = path6.join(browserPath, "user-data");
|
|
8288
8247
|
const livePath = path6.join(options.rootPath, "live");
|
|
8289
|
-
const
|
|
8290
|
-
const
|
|
8248
|
+
const liveLocalPath = path6.join(livePath, "local.json");
|
|
8249
|
+
const liveCloudPath = path6.join(livePath, "cloud.json");
|
|
8291
8250
|
const artifactsPath = path6.join(options.rootPath, "artifacts");
|
|
8292
8251
|
const tracesPath = path6.join(options.rootPath, "traces");
|
|
8293
8252
|
const registryPath = path6.join(options.rootPath, "registry");
|
|
@@ -8362,8 +8321,8 @@ async function createFilesystemOpensteerWorkspace(options) {
|
|
|
8362
8321
|
browserManifestPath,
|
|
8363
8322
|
browserUserDataDir,
|
|
8364
8323
|
livePath,
|
|
8365
|
-
|
|
8366
|
-
|
|
8324
|
+
liveLocalPath,
|
|
8325
|
+
liveCloudPath,
|
|
8367
8326
|
artifactsPath,
|
|
8368
8327
|
tracesPath,
|
|
8369
8328
|
registryPath,
|
|
@@ -8619,6 +8578,16 @@ function abortError2() {
|
|
|
8619
8578
|
return error;
|
|
8620
8579
|
}
|
|
8621
8580
|
|
|
8581
|
+
// ../runtime-core/src/runtimes/dom/errors.ts
|
|
8582
|
+
var ElementPathError = class extends Error {
|
|
8583
|
+
code;
|
|
8584
|
+
constructor(code, message) {
|
|
8585
|
+
super(message);
|
|
8586
|
+
this.name = "ElementPathError";
|
|
8587
|
+
this.code = code;
|
|
8588
|
+
}
|
|
8589
|
+
};
|
|
8590
|
+
|
|
8622
8591
|
// ../runtime-core/src/runtimes/dom/match-policy.ts
|
|
8623
8592
|
var ATTRIBUTE_DENY_KEYS = /* @__PURE__ */ new Set([
|
|
8624
8593
|
"style",
|
|
@@ -9182,16 +9151,6 @@ function readDescriptorToken(value, index) {
|
|
|
9182
9151
|
nextIndex: cursor
|
|
9183
9152
|
};
|
|
9184
9153
|
}
|
|
9185
|
-
|
|
9186
|
-
// ../runtime-core/src/runtimes/dom/errors.ts
|
|
9187
|
-
var ElementPathError = class extends Error {
|
|
9188
|
-
code;
|
|
9189
|
-
constructor(code, message) {
|
|
9190
|
-
super(message);
|
|
9191
|
-
this.name = "ElementPathError";
|
|
9192
|
-
this.code = code;
|
|
9193
|
-
}
|
|
9194
|
-
};
|
|
9195
9154
|
var selectorAdapter = {
|
|
9196
9155
|
isTag(node) {
|
|
9197
9156
|
return node.kind === "element" && node.source.nodeType === 1;
|
|
@@ -9957,23 +9916,28 @@ function getShadowScopeNodeRef(index, node) {
|
|
|
9957
9916
|
return findContainingShadowHostNode(index, node)?.nodeRef;
|
|
9958
9917
|
}
|
|
9959
9918
|
function createDomDescriptorStore(options) {
|
|
9960
|
-
const namespace =
|
|
9919
|
+
const namespace = normalizeDomDescriptorNamespace(options.namespace);
|
|
9961
9920
|
if (options.root) {
|
|
9962
9921
|
return new FilesystemDomDescriptorStore(options.root.registry.descriptors, namespace);
|
|
9963
9922
|
}
|
|
9964
9923
|
return new MemoryDomDescriptorStore(namespace);
|
|
9965
9924
|
}
|
|
9966
|
-
function
|
|
9967
|
-
return
|
|
9925
|
+
function hashDomDescriptorDescription(description) {
|
|
9926
|
+
return sha256Hex2(description.trim());
|
|
9968
9927
|
}
|
|
9969
|
-
function
|
|
9928
|
+
function buildDomDescriptorKey(options) {
|
|
9929
|
+
return `dom:${normalizeDomDescriptorNamespace(options.namespace)}:${options.method}:${hashDomDescriptorDescription(
|
|
9930
|
+
options.description
|
|
9931
|
+
)}`;
|
|
9932
|
+
}
|
|
9933
|
+
function normalizeDomDescriptorNamespace(namespace) {
|
|
9970
9934
|
const normalized = String(namespace || "default").trim();
|
|
9971
9935
|
return normalized.length === 0 ? "default" : normalized;
|
|
9972
9936
|
}
|
|
9973
9937
|
function sha256Hex2(value) {
|
|
9974
9938
|
return createHash("sha256").update(value).digest("hex");
|
|
9975
9939
|
}
|
|
9976
|
-
function
|
|
9940
|
+
function buildDomDescriptorPayload(input) {
|
|
9977
9941
|
return {
|
|
9978
9942
|
kind: "dom-target",
|
|
9979
9943
|
method: input.method,
|
|
@@ -9982,6 +9946,9 @@ function buildPayload(input) {
|
|
|
9982
9946
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
9983
9947
|
};
|
|
9984
9948
|
}
|
|
9949
|
+
function buildDomDescriptorVersion(payload) {
|
|
9950
|
+
return sha256Hex2(canonicalJsonString(payload));
|
|
9951
|
+
}
|
|
9985
9952
|
function parseDomDescriptorRecord(record) {
|
|
9986
9953
|
const payload = record.payload;
|
|
9987
9954
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
@@ -10023,7 +9990,11 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10023
9990
|
}
|
|
10024
9991
|
async read(input) {
|
|
10025
9992
|
const record = await this.registry.resolve({
|
|
10026
|
-
key:
|
|
9993
|
+
key: buildDomDescriptorKey({
|
|
9994
|
+
namespace: this.namespace,
|
|
9995
|
+
method: input.method,
|
|
9996
|
+
description: input.description
|
|
9997
|
+
})
|
|
10027
9998
|
});
|
|
10028
9999
|
if (!record) {
|
|
10029
10000
|
return void 0;
|
|
@@ -10031,9 +10002,13 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10031
10002
|
return parseDomDescriptorRecord(record);
|
|
10032
10003
|
}
|
|
10033
10004
|
async write(input) {
|
|
10034
|
-
const payload =
|
|
10035
|
-
const key =
|
|
10036
|
-
|
|
10005
|
+
const payload = buildDomDescriptorPayload(input);
|
|
10006
|
+
const key = buildDomDescriptorKey({
|
|
10007
|
+
namespace: this.namespace,
|
|
10008
|
+
method: input.method,
|
|
10009
|
+
description: input.description
|
|
10010
|
+
});
|
|
10011
|
+
const version = buildDomDescriptorVersion(payload);
|
|
10037
10012
|
const existing = await this.registry.resolve({ key, version });
|
|
10038
10013
|
if (existing) {
|
|
10039
10014
|
const parsed2 = parseDomDescriptorRecord(existing);
|
|
@@ -10071,12 +10046,22 @@ var MemoryDomDescriptorStore = class {
|
|
|
10071
10046
|
latestByKey = /* @__PURE__ */ new Map();
|
|
10072
10047
|
recordsByKey = /* @__PURE__ */ new Map();
|
|
10073
10048
|
async read(input) {
|
|
10074
|
-
return this.latestByKey.get(
|
|
10049
|
+
return this.latestByKey.get(
|
|
10050
|
+
buildDomDescriptorKey({
|
|
10051
|
+
namespace: this.namespace,
|
|
10052
|
+
method: input.method,
|
|
10053
|
+
description: input.description
|
|
10054
|
+
})
|
|
10055
|
+
);
|
|
10075
10056
|
}
|
|
10076
10057
|
async write(input) {
|
|
10077
|
-
const payload =
|
|
10078
|
-
const key =
|
|
10079
|
-
|
|
10058
|
+
const payload = buildDomDescriptorPayload(input);
|
|
10059
|
+
const key = buildDomDescriptorKey({
|
|
10060
|
+
namespace: this.namespace,
|
|
10061
|
+
method: input.method,
|
|
10062
|
+
description: input.description
|
|
10063
|
+
});
|
|
10064
|
+
const version = buildDomDescriptorVersion(payload);
|
|
10080
10065
|
const existing = this.recordsByKey.get(key)?.get(version);
|
|
10081
10066
|
if (existing) {
|
|
10082
10067
|
return existing;
|
|
@@ -10719,7 +10704,7 @@ var DefaultDomRuntime = class {
|
|
|
10719
10704
|
bridge;
|
|
10720
10705
|
constructor(options) {
|
|
10721
10706
|
this.engine = options.engine;
|
|
10722
|
-
this.descriptors = createDomDescriptorStore({
|
|
10707
|
+
this.descriptors = options.descriptorStore ?? createDomDescriptorStore({
|
|
10723
10708
|
...options.root === void 0 ? {} : { root: options.root },
|
|
10724
10709
|
...options.namespace === void 0 ? {} : { namespace: options.namespace }
|
|
10725
10710
|
});
|
|
@@ -12128,110 +12113,48 @@ function readPort(url) {
|
|
|
12128
12113
|
}
|
|
12129
12114
|
var OPENSTEER_LIVE_SESSION_LAYOUT = "opensteer-session";
|
|
12130
12115
|
var OPENSTEER_LIVE_SESSION_VERSION = 1;
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
function resolveLiveSessionRecordPath(rootPath) {
|
|
12134
|
-
return path6.join(rootPath, "live", "session.json");
|
|
12116
|
+
function resolveLiveSessionRecordPath(rootPath, provider) {
|
|
12117
|
+
return path6.join(rootPath, "live", provider === "local" ? "local.json" : "cloud.json");
|
|
12135
12118
|
}
|
|
12136
|
-
function
|
|
12137
|
-
return
|
|
12119
|
+
function resolveLocalSessionRecordPath(rootPath) {
|
|
12120
|
+
return resolveLiveSessionRecordPath(rootPath, "local");
|
|
12138
12121
|
}
|
|
12139
|
-
function
|
|
12140
|
-
return
|
|
12122
|
+
function resolveCloudSessionRecordPath(rootPath) {
|
|
12123
|
+
return resolveLiveSessionRecordPath(rootPath, "cloud");
|
|
12141
12124
|
}
|
|
12142
|
-
async function readPersistedSessionRecord(rootPath) {
|
|
12143
|
-
const sessionPath = resolveLiveSessionRecordPath(rootPath);
|
|
12144
|
-
if (await pathExists(sessionPath)) {
|
|
12145
|
-
|
|
12146
|
-
if (isPersistedLocalBrowserSessionRecord(parsed)) {
|
|
12147
|
-
return parsed;
|
|
12148
|
-
}
|
|
12149
|
-
if (isPersistedCloudSessionRecord(parsed)) {
|
|
12150
|
-
return parsed;
|
|
12151
|
-
}
|
|
12125
|
+
async function readPersistedSessionRecord(rootPath, provider) {
|
|
12126
|
+
const sessionPath = resolveLiveSessionRecordPath(rootPath, provider);
|
|
12127
|
+
if (!await pathExists(sessionPath)) {
|
|
12128
|
+
return void 0;
|
|
12152
12129
|
}
|
|
12153
|
-
const
|
|
12154
|
-
if (
|
|
12155
|
-
|
|
12156
|
-
if (isLegacyCloudSessionRecord(parsed)) {
|
|
12157
|
-
return {
|
|
12158
|
-
layout: OPENSTEER_LIVE_SESSION_LAYOUT,
|
|
12159
|
-
version: OPENSTEER_LIVE_SESSION_VERSION,
|
|
12160
|
-
provider: "cloud",
|
|
12161
|
-
mode: "cloud",
|
|
12162
|
-
...parsed.workspace === void 0 ? {} : { workspace: parsed.workspace },
|
|
12163
|
-
sessionId: parsed.sessionId,
|
|
12164
|
-
baseUrl: parsed.baseUrl,
|
|
12165
|
-
startedAt: parsed.startedAt,
|
|
12166
|
-
updatedAt: parsed.updatedAt
|
|
12167
|
-
};
|
|
12168
|
-
}
|
|
12130
|
+
const parsed = await readJsonFile(sessionPath);
|
|
12131
|
+
if (provider === "local" && isPersistedLocalBrowserSessionRecord(parsed)) {
|
|
12132
|
+
return parsed;
|
|
12169
12133
|
}
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
const parsed = await readJsonFile(legacyBrowserPath);
|
|
12173
|
-
if (isLegacyLocalBrowserSessionRecord(parsed)) {
|
|
12174
|
-
return {
|
|
12175
|
-
layout: OPENSTEER_LIVE_SESSION_LAYOUT,
|
|
12176
|
-
version: OPENSTEER_LIVE_SESSION_VERSION,
|
|
12177
|
-
provider: "local",
|
|
12178
|
-
mode: "browser",
|
|
12179
|
-
engine: parsed.engine ?? "playwright",
|
|
12180
|
-
...parsed.endpoint === void 0 ? {} : { endpoint: parsed.endpoint },
|
|
12181
|
-
...parsed.baseUrl === void 0 ? {} : { baseUrl: parsed.baseUrl },
|
|
12182
|
-
...parsed.remoteDebuggingUrl === void 0 ? {} : { remoteDebuggingUrl: parsed.remoteDebuggingUrl },
|
|
12183
|
-
...parsed.sessionDir === void 0 ? {} : { sessionDir: parsed.sessionDir },
|
|
12184
|
-
pid: parsed.pid,
|
|
12185
|
-
startedAt: parsed.startedAt,
|
|
12186
|
-
updatedAt: parsed.startedAt,
|
|
12187
|
-
...parsed.executablePath === void 0 ? {} : { executablePath: parsed.executablePath },
|
|
12188
|
-
userDataDir: parsed.userDataDir
|
|
12189
|
-
};
|
|
12190
|
-
}
|
|
12134
|
+
if (provider === "cloud" && isPersistedCloudSessionRecord(parsed)) {
|
|
12135
|
+
return parsed;
|
|
12191
12136
|
}
|
|
12192
12137
|
return void 0;
|
|
12193
12138
|
}
|
|
12194
12139
|
async function readPersistedCloudSessionRecord(rootPath) {
|
|
12195
|
-
const record = await readPersistedSessionRecord(rootPath);
|
|
12140
|
+
const record = await readPersistedSessionRecord(rootPath, "cloud");
|
|
12196
12141
|
return record?.provider === "cloud" ? record : void 0;
|
|
12197
12142
|
}
|
|
12198
12143
|
async function readPersistedLocalBrowserSessionRecord(rootPath) {
|
|
12199
|
-
const record = await readPersistedSessionRecord(rootPath);
|
|
12144
|
+
const record = await readPersistedSessionRecord(rootPath, "local");
|
|
12200
12145
|
return record?.provider === "local" ? record : void 0;
|
|
12201
12146
|
}
|
|
12202
|
-
async function hasPersistedCloudSession(rootPath) {
|
|
12203
|
-
return await readPersistedCloudSessionRecord(rootPath) !== void 0;
|
|
12204
|
-
}
|
|
12205
12147
|
async function writePersistedSessionRecord(rootPath, record) {
|
|
12206
|
-
await writeJsonFileAtomic(resolveLiveSessionRecordPath(rootPath), record);
|
|
12207
|
-
await clearLegacySessionRecordPaths(rootPath);
|
|
12148
|
+
await writeJsonFileAtomic(resolveLiveSessionRecordPath(rootPath, record.provider), record);
|
|
12208
12149
|
}
|
|
12209
|
-
async function clearPersistedSessionRecord(rootPath) {
|
|
12210
|
-
await
|
|
12211
|
-
removeIfPresent(resolveLiveSessionRecordPath(rootPath)),
|
|
12212
|
-
clearLegacySessionRecordPaths(rootPath)
|
|
12213
|
-
]);
|
|
12150
|
+
async function clearPersistedSessionRecord(rootPath, provider) {
|
|
12151
|
+
await rm(resolveLiveSessionRecordPath(rootPath, provider), { force: true });
|
|
12214
12152
|
}
|
|
12215
12153
|
function isPersistedCloudSessionRecord(value) {
|
|
12216
|
-
return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "cloud" &&
|
|
12154
|
+
return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "cloud" && typeof value.sessionId === "string" && value.sessionId.length > 0 && typeof value.baseUrl === "string" && value.baseUrl.length > 0 && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt);
|
|
12217
12155
|
}
|
|
12218
12156
|
function isPersistedLocalBrowserSessionRecord(value) {
|
|
12219
|
-
return value.layout === OPENSTEER_LIVE_SESSION_LAYOUT && value.version === OPENSTEER_LIVE_SESSION_VERSION && value.provider === "local" &&
|
|
12220
|
-
}
|
|
12221
|
-
function isLegacyCloudSessionRecord(value) {
|
|
12222
|
-
return value.layout === LEGACY_CLOUD_SESSION_LAYOUT && value.version === LEGACY_CLOUD_SESSION_VERSION && value.mode === "cloud" && typeof value.sessionId === "string" && value.sessionId.length > 0 && typeof value.baseUrl === "string" && value.baseUrl.length > 0 && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.updatedAt === "number" && Number.isFinite(value.updatedAt);
|
|
12223
|
-
}
|
|
12224
|
-
function isLegacyLocalBrowserSessionRecord(value) {
|
|
12225
|
-
return value.mode === "persistent" && typeof value.pid === "number" && Number.isFinite(value.pid) && typeof value.startedAt === "number" && Number.isFinite(value.startedAt) && typeof value.userDataDir === "string" && value.userDataDir.length > 0;
|
|
12226
|
-
}
|
|
12227
|
-
async function clearLegacySessionRecordPaths(rootPath) {
|
|
12228
|
-
await Promise.all([
|
|
12229
|
-
removeIfPresent(resolveLegacyLiveBrowserRecordPath(rootPath)),
|
|
12230
|
-
removeIfPresent(resolveLegacyCloudSessionRecordPath(rootPath))
|
|
12231
|
-
]);
|
|
12232
|
-
}
|
|
12233
|
-
async function removeIfPresent(filePath) {
|
|
12234
|
-
await rm(filePath, { force: true }).catch(() => void 0);
|
|
12157
|
+
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;
|
|
12235
12158
|
}
|
|
12236
12159
|
|
|
12237
12160
|
// ../runtime-core/src/internal/engine-selection.ts
|
|
@@ -13082,7 +13005,7 @@ var OpensteerBrowserManager = class {
|
|
|
13082
13005
|
await this.closePersistentBrowser(workspace);
|
|
13083
13006
|
await rm(resolveAbpSessionDir(workspace), { recursive: true, force: true });
|
|
13084
13007
|
await rm(workspace.browserPath, { recursive: true, force: true });
|
|
13085
|
-
await clearPersistedSessionRecord(workspace.rootPath);
|
|
13008
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local");
|
|
13086
13009
|
await ensureDirectory(workspace.browserUserDataDir);
|
|
13087
13010
|
});
|
|
13088
13011
|
}
|
|
@@ -13093,7 +13016,7 @@ var OpensteerBrowserManager = class {
|
|
|
13093
13016
|
await this.closePersistentBrowser(workspace);
|
|
13094
13017
|
await rm(resolveAbpSessionDir(workspace), { recursive: true, force: true });
|
|
13095
13018
|
await rm(workspace.browserPath, { recursive: true, force: true });
|
|
13096
|
-
await clearPersistedSessionRecord(workspace.rootPath);
|
|
13019
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local");
|
|
13097
13020
|
});
|
|
13098
13021
|
}
|
|
13099
13022
|
async close() {
|
|
@@ -13176,7 +13099,7 @@ var OpensteerBrowserManager = class {
|
|
|
13176
13099
|
return await this.createAdoptedAbpEngine(liveRecord);
|
|
13177
13100
|
} catch (error) {
|
|
13178
13101
|
await terminateProcess(launched.process.pid ?? 0).catch(() => void 0);
|
|
13179
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13102
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13180
13103
|
throw error;
|
|
13181
13104
|
}
|
|
13182
13105
|
});
|
|
@@ -13268,7 +13191,7 @@ var OpensteerBrowserManager = class {
|
|
|
13268
13191
|
});
|
|
13269
13192
|
} catch (error) {
|
|
13270
13193
|
await terminateProcess(launched.pid).catch(() => void 0);
|
|
13271
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13194
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13272
13195
|
throw error;
|
|
13273
13196
|
}
|
|
13274
13197
|
});
|
|
@@ -13374,7 +13297,7 @@ var OpensteerBrowserManager = class {
|
|
|
13374
13297
|
return void 0;
|
|
13375
13298
|
}
|
|
13376
13299
|
if (!isProcessRunning(live.pid)) {
|
|
13377
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13300
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13378
13301
|
return void 0;
|
|
13379
13302
|
}
|
|
13380
13303
|
if (live.engine === "playwright") {
|
|
@@ -13414,7 +13337,7 @@ var OpensteerBrowserManager = class {
|
|
|
13414
13337
|
async closePersistentBrowser(workspace) {
|
|
13415
13338
|
const live = await this.readStoredLiveBrowser(workspace);
|
|
13416
13339
|
if (!live) {
|
|
13417
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13340
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13418
13341
|
return;
|
|
13419
13342
|
}
|
|
13420
13343
|
if (live.engine === "playwright") {
|
|
@@ -13422,15 +13345,15 @@ var OpensteerBrowserManager = class {
|
|
|
13422
13345
|
await requestBrowserClose(live.endpoint).catch(() => void 0);
|
|
13423
13346
|
}
|
|
13424
13347
|
if (await waitForProcessExit(live.pid, BROWSER_CLOSE_TIMEOUT_MS)) {
|
|
13425
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13348
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13426
13349
|
return;
|
|
13427
13350
|
}
|
|
13428
13351
|
await terminateProcess(live.pid).catch(() => void 0);
|
|
13429
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13352
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13430
13353
|
return;
|
|
13431
13354
|
}
|
|
13432
13355
|
await terminateProcess(live.pid).catch(() => void 0);
|
|
13433
|
-
await clearPersistedSessionRecord(workspace.rootPath).catch(() => void 0);
|
|
13356
|
+
await clearPersistedSessionRecord(workspace.rootPath, "local").catch(() => void 0);
|
|
13434
13357
|
}
|
|
13435
13358
|
async writeLivePersistentBrowser(workspace, live) {
|
|
13436
13359
|
await writePersistedSessionRecord(
|
|
@@ -13453,7 +13376,6 @@ function toPersistedLocalBrowserSessionRecord(workspace, live) {
|
|
|
13453
13376
|
layout: "opensteer-session",
|
|
13454
13377
|
version: 1,
|
|
13455
13378
|
provider: "local",
|
|
13456
|
-
mode: "browser",
|
|
13457
13379
|
...workspace === void 0 ? {} : { workspace },
|
|
13458
13380
|
engine: live.engine,
|
|
13459
13381
|
...live.endpoint === void 0 ? {} : { endpoint: live.endpoint },
|
|
@@ -15041,7 +14963,7 @@ function inferRequestPlanFromNetworkRecord(record, input, options = {}) {
|
|
|
15041
14963
|
const body = inferRequestPlanBody(record.record.requestBody, requestContentType);
|
|
15042
14964
|
const payload = normalizeRequestPlanPayload({
|
|
15043
14965
|
transport: {
|
|
15044
|
-
kind: "context-http"
|
|
14966
|
+
kind: input.transport ?? "context-http"
|
|
15045
14967
|
},
|
|
15046
14968
|
endpoint: {
|
|
15047
14969
|
method: record.record.method,
|
|
@@ -15061,7 +14983,6 @@ function inferRequestPlanFromNetworkRecord(record, input, options = {}) {
|
|
|
15061
14983
|
return {
|
|
15062
14984
|
key: input.key,
|
|
15063
14985
|
version: input.version,
|
|
15064
|
-
lifecycle: input.lifecycle ?? "draft",
|
|
15065
14986
|
provenance: {
|
|
15066
14987
|
source: record.source === "saved" ? "saved-network-record" : "live-network-record",
|
|
15067
14988
|
sourceId: record.recordId,
|
|
@@ -19390,7 +19311,7 @@ async function replayOpensteerExtractionPayload(options) {
|
|
|
19390
19311
|
return extractPersistedObjectNode(options.pageRef, options.dom, options.payload);
|
|
19391
19312
|
}
|
|
19392
19313
|
function createOpensteerExtractionDescriptorStore(options) {
|
|
19393
|
-
const namespace =
|
|
19314
|
+
const namespace = normalizeNamespace(options.namespace);
|
|
19394
19315
|
if (options.root) {
|
|
19395
19316
|
return new FilesystemOpensteerExtractionDescriptorStore(
|
|
19396
19317
|
options.root.registry.descriptors,
|
|
@@ -19887,11 +19808,11 @@ function normalizeSchemaField(value) {
|
|
|
19887
19808
|
...attribute === void 0 ? {} : { attribute }
|
|
19888
19809
|
};
|
|
19889
19810
|
}
|
|
19890
|
-
function
|
|
19811
|
+
function normalizeNamespace(namespace) {
|
|
19891
19812
|
const normalized = String(namespace ?? "default").trim();
|
|
19892
19813
|
return normalized.length === 0 ? "default" : normalized;
|
|
19893
19814
|
}
|
|
19894
|
-
function
|
|
19815
|
+
function descriptionKey(namespace, description) {
|
|
19895
19816
|
return `extract:${namespace}:${sha256Hex3(description.trim())}`;
|
|
19896
19817
|
}
|
|
19897
19818
|
function parseExtractionDescriptorRecord(record) {
|
|
@@ -19994,7 +19915,7 @@ var FilesystemOpensteerExtractionDescriptorStore = class {
|
|
|
19994
19915
|
}
|
|
19995
19916
|
async read(input) {
|
|
19996
19917
|
const record = await this.registry.resolve({
|
|
19997
|
-
key:
|
|
19918
|
+
key: descriptionKey(this.namespace, input.description)
|
|
19998
19919
|
});
|
|
19999
19920
|
return record === void 0 ? void 0 : parseExtractionDescriptorRecord(record);
|
|
20000
19921
|
}
|
|
@@ -20006,7 +19927,7 @@ var FilesystemOpensteerExtractionDescriptorStore = class {
|
|
|
20006
19927
|
...input.schemaHash === void 0 ? {} : { schemaHash: input.schemaHash },
|
|
20007
19928
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
20008
19929
|
};
|
|
20009
|
-
const key =
|
|
19930
|
+
const key = descriptionKey(this.namespace, input.description);
|
|
20010
19931
|
const version = sha256Hex3(canonicalJsonString(payload));
|
|
20011
19932
|
const existing = await this.registry.resolve({ key, version });
|
|
20012
19933
|
if (existing) {
|
|
@@ -20045,7 +19966,7 @@ var MemoryOpensteerExtractionDescriptorStore = class {
|
|
|
20045
19966
|
latestByKey = /* @__PURE__ */ new Map();
|
|
20046
19967
|
recordsByKey = /* @__PURE__ */ new Map();
|
|
20047
19968
|
async read(input) {
|
|
20048
|
-
return this.latestByKey.get(
|
|
19969
|
+
return this.latestByKey.get(descriptionKey(this.namespace, input.description));
|
|
20049
19970
|
}
|
|
20050
19971
|
async write(input) {
|
|
20051
19972
|
const payload = {
|
|
@@ -20055,7 +19976,7 @@ var MemoryOpensteerExtractionDescriptorStore = class {
|
|
|
20055
19976
|
...input.schemaHash === void 0 ? {} : { schemaHash: input.schemaHash },
|
|
20056
19977
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
20057
19978
|
};
|
|
20058
|
-
const key =
|
|
19979
|
+
const key = descriptionKey(this.namespace, input.description);
|
|
20059
19980
|
const version = sha256Hex3(canonicalJsonString(payload));
|
|
20060
19981
|
const existing = this.recordsByKey.get(key)?.get(version);
|
|
20061
19982
|
if (existing) {
|
|
@@ -20099,6 +20020,7 @@ var OPENSTEER_INTERACTIVE_ATTR = "data-opensteer-interactive";
|
|
|
20099
20020
|
var OPENSTEER_HIDDEN_ATTR = "data-opensteer-hidden";
|
|
20100
20021
|
var OPENSTEER_SCROLLABLE_ATTR = "data-opensteer-scrollable";
|
|
20101
20022
|
var OPENSTEER_NODE_ID_ATTR = "data-os-node-id";
|
|
20023
|
+
var OPENSTEER_SPARSE_COUNTER_ATTR = "data-os-c";
|
|
20102
20024
|
var OPENSTEER_BOUNDARY_ATTR = "data-os-boundary";
|
|
20103
20025
|
var OPENSTEER_UNAVAILABLE_ATTR = "data-os-unavailable";
|
|
20104
20026
|
var OPENSTEER_IFRAME_BOUNDARY_TAG = "os-iframe-root";
|
|
@@ -20603,7 +20525,82 @@ var VOID_TAGS2 = /* @__PURE__ */ new Set([
|
|
|
20603
20525
|
]);
|
|
20604
20526
|
|
|
20605
20527
|
// ../runtime-core/src/sdk/snapshot/compiler.ts
|
|
20528
|
+
async function assignSparseCountersToLiveDom(engine, pageRef) {
|
|
20529
|
+
try {
|
|
20530
|
+
await engine.evaluatePage({
|
|
20531
|
+
pageRef,
|
|
20532
|
+
script: `(() => {
|
|
20533
|
+
let counter = 1;
|
|
20534
|
+
const walk = (root) => {
|
|
20535
|
+
for (const child of root.children) {
|
|
20536
|
+
child.setAttribute('data-os-c', String(counter++));
|
|
20537
|
+
walk(child);
|
|
20538
|
+
if (child.shadowRoot) walk(child.shadowRoot);
|
|
20539
|
+
}
|
|
20540
|
+
};
|
|
20541
|
+
walk(document);
|
|
20542
|
+
})()`
|
|
20543
|
+
});
|
|
20544
|
+
return true;
|
|
20545
|
+
} catch {
|
|
20546
|
+
return false;
|
|
20547
|
+
}
|
|
20548
|
+
}
|
|
20549
|
+
async function syncDenseCountersToLiveDom(engine, pageRef, sparseToDirectMapping) {
|
|
20550
|
+
const mappingObj = Object.fromEntries(sparseToDirectMapping);
|
|
20551
|
+
await engine.evaluatePage({
|
|
20552
|
+
pageRef,
|
|
20553
|
+
script: `((mapping) => {
|
|
20554
|
+
const walk = (root) => {
|
|
20555
|
+
for (const child of root.children) {
|
|
20556
|
+
child.removeAttribute('c');
|
|
20557
|
+
const sparse = child.getAttribute('data-os-c');
|
|
20558
|
+
if (sparse !== null) {
|
|
20559
|
+
const dense = mapping[sparse];
|
|
20560
|
+
if (dense !== undefined) {
|
|
20561
|
+
child.setAttribute('c', String(dense));
|
|
20562
|
+
}
|
|
20563
|
+
child.removeAttribute('data-os-c');
|
|
20564
|
+
}
|
|
20565
|
+
walk(child);
|
|
20566
|
+
if (child.shadowRoot) walk(child.shadowRoot);
|
|
20567
|
+
}
|
|
20568
|
+
};
|
|
20569
|
+
walk(document);
|
|
20570
|
+
})`,
|
|
20571
|
+
args: [mappingObj]
|
|
20572
|
+
});
|
|
20573
|
+
}
|
|
20574
|
+
function renumberCountersDensely(cleanedHtml, counterRecords) {
|
|
20575
|
+
const $ = cheerio.load(cleanedHtml, { xmlMode: false });
|
|
20576
|
+
const newRecords = /* @__PURE__ */ new Map();
|
|
20577
|
+
const sparseToDirectMapping = /* @__PURE__ */ new Map();
|
|
20578
|
+
let nextDense = 1;
|
|
20579
|
+
$("[c]").each(function renumberElement() {
|
|
20580
|
+
const el = $(this);
|
|
20581
|
+
const oldC = Number.parseInt(String(el.attr("c") || ""), 10);
|
|
20582
|
+
if (!Number.isFinite(oldC)) {
|
|
20583
|
+
return;
|
|
20584
|
+
}
|
|
20585
|
+
const record = counterRecords.get(oldC);
|
|
20586
|
+
if (!record) {
|
|
20587
|
+
return;
|
|
20588
|
+
}
|
|
20589
|
+
const denseC = nextDense++;
|
|
20590
|
+
el.attr("c", String(denseC));
|
|
20591
|
+
newRecords.set(denseC, { ...record, element: denseC });
|
|
20592
|
+
if (record.sparseCounter !== void 0) {
|
|
20593
|
+
sparseToDirectMapping.set(record.sparseCounter, denseC);
|
|
20594
|
+
}
|
|
20595
|
+
});
|
|
20596
|
+
return {
|
|
20597
|
+
html: $.html(),
|
|
20598
|
+
counterRecords: newRecords,
|
|
20599
|
+
sparseToDirectMapping
|
|
20600
|
+
};
|
|
20601
|
+
}
|
|
20606
20602
|
async function compileOpensteerSnapshot(options) {
|
|
20603
|
+
const liveCountersEnabled = await assignSparseCountersToLiveDom(options.engine, options.pageRef);
|
|
20607
20604
|
const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
|
|
20608
20605
|
const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
|
|
20609
20606
|
const snapshotsByDocumentRef = await collectDocumentSnapshots(options.engine, mainSnapshot);
|
|
@@ -20622,13 +20619,24 @@ async function compileOpensteerSnapshot(options) {
|
|
|
20622
20619
|
const compiledHtml = assignCounters(rawHtml, renderedNodes);
|
|
20623
20620
|
const cleanedHtml = options.mode === "extraction" ? cleanForExtraction(compiledHtml.html) : cleanForAction(compiledHtml.html);
|
|
20624
20621
|
const filtered = retainVisibleCounterRecords(cleanedHtml, compiledHtml.counterRecords);
|
|
20622
|
+
const dense = renumberCountersDensely(cleanedHtml, filtered);
|
|
20623
|
+
if (liveCountersEnabled && dense.sparseToDirectMapping.size > 0) {
|
|
20624
|
+
try {
|
|
20625
|
+
await syncDenseCountersToLiveDom(
|
|
20626
|
+
options.engine,
|
|
20627
|
+
options.pageRef,
|
|
20628
|
+
dense.sparseToDirectMapping
|
|
20629
|
+
);
|
|
20630
|
+
} catch {
|
|
20631
|
+
}
|
|
20632
|
+
}
|
|
20625
20633
|
return {
|
|
20626
20634
|
url: pageInfo.url,
|
|
20627
20635
|
title: pageInfo.title,
|
|
20628
20636
|
mode: options.mode,
|
|
20629
|
-
html:
|
|
20630
|
-
counters: [...
|
|
20631
|
-
counterRecords:
|
|
20637
|
+
html: dense.html,
|
|
20638
|
+
counters: [...dense.counterRecords.values()].map(toPublicCounterRecord),
|
|
20639
|
+
counterRecords: dense.counterRecords
|
|
20632
20640
|
};
|
|
20633
20641
|
}
|
|
20634
20642
|
async function getMainDocumentSnapshot(engine, pageRef) {
|
|
@@ -20857,6 +20865,9 @@ function assignCounters(rawHtml, renderedNodes) {
|
|
|
20857
20865
|
if (!rendered) {
|
|
20858
20866
|
return;
|
|
20859
20867
|
}
|
|
20868
|
+
const rawSparseCounter = el.attr(OPENSTEER_SPARSE_COUNTER_ATTR);
|
|
20869
|
+
el.removeAttr(OPENSTEER_SPARSE_COUNTER_ATTR);
|
|
20870
|
+
const sparseCounter = rawSparseCounter ? Number.parseInt(rawSparseCounter, 10) : void 0;
|
|
20860
20871
|
const counter = nextCounter++;
|
|
20861
20872
|
el.attr("c", String(counter));
|
|
20862
20873
|
counterRecords.set(counter, {
|
|
@@ -20874,7 +20885,8 @@ function assignCounters(rawHtml, renderedNodes) {
|
|
|
20874
20885
|
shadowDepth: rendered.shadowDepth,
|
|
20875
20886
|
interactive: rendered.interactive,
|
|
20876
20887
|
locator: rendered.locator,
|
|
20877
|
-
anchor: rendered.anchor
|
|
20888
|
+
anchor: rendered.anchor,
|
|
20889
|
+
...sparseCounter !== void 0 && Number.isFinite(sparseCounter) ? { sparseCounter } : {}
|
|
20878
20890
|
});
|
|
20879
20891
|
});
|
|
20880
20892
|
return {
|
|
@@ -22242,6 +22254,8 @@ var OpensteerSessionRuntime = class {
|
|
|
22242
22254
|
injectedEngine;
|
|
22243
22255
|
engineFactory;
|
|
22244
22256
|
policy;
|
|
22257
|
+
injectedDescriptorStore;
|
|
22258
|
+
registryOverrides;
|
|
22245
22259
|
cleanupRootOnClose;
|
|
22246
22260
|
sessionInfoBase;
|
|
22247
22261
|
root;
|
|
@@ -22259,13 +22273,15 @@ var OpensteerSessionRuntime = class {
|
|
|
22259
22273
|
recipeCache = /* @__PURE__ */ new Map();
|
|
22260
22274
|
ownsEngine = false;
|
|
22261
22275
|
constructor(options) {
|
|
22262
|
-
this.workspace =
|
|
22276
|
+
this.workspace = normalizeNamespace2(options.name);
|
|
22263
22277
|
this.workspaceName = options.workspaceName?.trim() === void 0 || options.workspaceName?.trim().length === 0 ? void 0 : options.workspaceName.trim();
|
|
22264
22278
|
this.root = options.workspace;
|
|
22265
22279
|
this.rootPath = options.workspace?.rootPath ?? options.rootPath ?? path6.resolve(process.cwd(), ".opensteer", "temporary", randomUUID());
|
|
22266
22280
|
this.injectedEngine = options.engine;
|
|
22267
22281
|
this.engineFactory = options.engineFactory;
|
|
22268
22282
|
this.policy = options.policy ?? defaultPolicy();
|
|
22283
|
+
this.injectedDescriptorStore = options.descriptorStore;
|
|
22284
|
+
this.registryOverrides = options.registryOverrides;
|
|
22269
22285
|
this.cleanupRootOnClose = options.cleanupRootOnClose ?? options.workspace === void 0;
|
|
22270
22286
|
this.sessionInfoBase = options.sessionInfo ?? {};
|
|
22271
22287
|
if (this.injectedEngine === void 0 && this.engineFactory === void 0) {
|
|
@@ -22301,7 +22317,7 @@ var OpensteerSessionRuntime = class {
|
|
|
22301
22317
|
}
|
|
22302
22318
|
async open(input = {}, options = {}) {
|
|
22303
22319
|
assertValidSemanticOperationInput("session.open", input);
|
|
22304
|
-
if (input.workspace !== void 0 &&
|
|
22320
|
+
if (input.workspace !== void 0 && normalizeNamespace2(input.workspace) !== this.workspace) {
|
|
22305
22321
|
throw new Error(
|
|
22306
22322
|
`session.open requested workspace "${input.workspace}" but runtime is bound to "${this.workspace}"`
|
|
22307
22323
|
);
|
|
@@ -24717,8 +24733,7 @@ var OpensteerSessionRuntime = class {
|
|
|
24717
24733
|
const inferred = inferRequestPlanFromNetworkRecord(record, {
|
|
24718
24734
|
recordId: candidate.recordId,
|
|
24719
24735
|
key: input.key,
|
|
24720
|
-
version: input.version
|
|
24721
|
-
lifecycle: "draft"
|
|
24736
|
+
version: input.version
|
|
24722
24737
|
});
|
|
24723
24738
|
const defaultHeaders = inferred.payload.endpoint.defaultHeaders === void 0 ? void 0 : stripManagedRequestHeaders(
|
|
24724
24739
|
inferred.payload.endpoint.defaultHeaders,
|
|
@@ -25346,8 +25361,7 @@ var OpensteerSessionRuntime = class {
|
|
|
25346
25361
|
recordId: input.recordId,
|
|
25347
25362
|
id: record.id,
|
|
25348
25363
|
key: record.key,
|
|
25349
|
-
version: record.version
|
|
25350
|
-
lifecycle: record.lifecycle
|
|
25364
|
+
version: record.version
|
|
25351
25365
|
}
|
|
25352
25366
|
});
|
|
25353
25367
|
return record;
|
|
@@ -25388,8 +25402,7 @@ var OpensteerSessionRuntime = class {
|
|
|
25388
25402
|
data: {
|
|
25389
25403
|
id: record.id,
|
|
25390
25404
|
key: record.key,
|
|
25391
|
-
version: record.version
|
|
25392
|
-
lifecycle: record.lifecycle
|
|
25405
|
+
version: record.version
|
|
25393
25406
|
}
|
|
25394
25407
|
});
|
|
25395
25408
|
return record;
|
|
@@ -25435,8 +25448,7 @@ var OpensteerSessionRuntime = class {
|
|
|
25435
25448
|
data: {
|
|
25436
25449
|
id: record.id,
|
|
25437
25450
|
key: record.key,
|
|
25438
|
-
version: record.version
|
|
25439
|
-
lifecycle: record.lifecycle
|
|
25451
|
+
version: record.version
|
|
25440
25452
|
}
|
|
25441
25453
|
});
|
|
25442
25454
|
return record;
|
|
@@ -26307,18 +26319,12 @@ var OpensteerSessionRuntime = class {
|
|
|
26307
26319
|
}
|
|
26308
26320
|
if (target.kind === "element") {
|
|
26309
26321
|
const counter = this.latestSnapshot?.counterRecords.get(target.element);
|
|
26310
|
-
|
|
26311
|
-
throw new Error(`no counter ${String(target.element)} is available in the latest snapshot`);
|
|
26312
|
-
}
|
|
26322
|
+
const elementTarget = counter ? { kind: "live", locator: counter.locator, anchor: counter.anchor } : { kind: "selector", selector: `[c="${String(target.element)}"]` };
|
|
26313
26323
|
const resolved2 = await timeout.runStep(
|
|
26314
26324
|
() => this.requireDom().resolveTarget({
|
|
26315
26325
|
pageRef,
|
|
26316
26326
|
method,
|
|
26317
|
-
target:
|
|
26318
|
-
kind: "live",
|
|
26319
|
-
locator: counter.locator,
|
|
26320
|
-
anchor: counter.anchor
|
|
26321
|
-
}
|
|
26327
|
+
target: elementTarget
|
|
26322
26328
|
})
|
|
26323
26329
|
);
|
|
26324
26330
|
const stablePath2 = resolved2.replayPath ?? await timeout.runStep(
|
|
@@ -27561,7 +27567,7 @@ var OpensteerSessionRuntime = class {
|
|
|
27561
27567
|
}
|
|
27562
27568
|
async touchRequestPlanFreshness(plan) {
|
|
27563
27569
|
const freshness = touchFreshness(plan.freshness);
|
|
27564
|
-
await this.requireRoot().registry.requestPlans.
|
|
27570
|
+
await this.requireRoot().registry.requestPlans.updateFreshness({
|
|
27565
27571
|
id: plan.id,
|
|
27566
27572
|
...freshness === void 0 ? {} : { freshness }
|
|
27567
27573
|
});
|
|
@@ -28230,21 +28236,40 @@ var OpensteerSessionRuntime = class {
|
|
|
28230
28236
|
};
|
|
28231
28237
|
}
|
|
28232
28238
|
const counter = this.latestSnapshot?.counterRecords.get(target.element);
|
|
28233
|
-
if (
|
|
28234
|
-
|
|
28239
|
+
if (counter) {
|
|
28240
|
+
return {
|
|
28241
|
+
kind: "live",
|
|
28242
|
+
locator: counter.locator,
|
|
28243
|
+
anchor: counter.anchor
|
|
28244
|
+
};
|
|
28235
28245
|
}
|
|
28236
28246
|
return {
|
|
28237
|
-
kind: "
|
|
28238
|
-
|
|
28239
|
-
anchor: counter.anchor
|
|
28247
|
+
kind: "selector",
|
|
28248
|
+
selector: `[c="${String(target.element)}"]`
|
|
28240
28249
|
};
|
|
28241
28250
|
}
|
|
28242
28251
|
async ensureRoot() {
|
|
28243
|
-
this.root
|
|
28244
|
-
|
|
28245
|
-
|
|
28246
|
-
|
|
28247
|
-
|
|
28252
|
+
if (!this.root) {
|
|
28253
|
+
const workspace = await createFilesystemOpensteerWorkspace({
|
|
28254
|
+
rootPath: this.rootPath,
|
|
28255
|
+
...this.workspaceName === void 0 ? {} : { workspace: this.workspaceName },
|
|
28256
|
+
scope: this.workspaceName === void 0 ? "temporary" : "workspace"
|
|
28257
|
+
});
|
|
28258
|
+
if (this.registryOverrides) {
|
|
28259
|
+
const overrides = this.registryOverrides;
|
|
28260
|
+
this.root = {
|
|
28261
|
+
...workspace,
|
|
28262
|
+
registry: {
|
|
28263
|
+
...workspace.registry,
|
|
28264
|
+
...overrides.requestPlans === void 0 ? {} : { requestPlans: overrides.requestPlans },
|
|
28265
|
+
...overrides.authRecipes === void 0 ? {} : { authRecipes: overrides.authRecipes },
|
|
28266
|
+
...overrides.recipes === void 0 ? {} : { recipes: overrides.recipes }
|
|
28267
|
+
}
|
|
28268
|
+
};
|
|
28269
|
+
} else {
|
|
28270
|
+
this.root = workspace;
|
|
28271
|
+
}
|
|
28272
|
+
}
|
|
28248
28273
|
return this.root;
|
|
28249
28274
|
}
|
|
28250
28275
|
async ensureEngine(overrides = {}) {
|
|
@@ -28270,6 +28295,7 @@ var OpensteerSessionRuntime = class {
|
|
|
28270
28295
|
engine,
|
|
28271
28296
|
root,
|
|
28272
28297
|
namespace: this.workspace,
|
|
28298
|
+
...this.injectedDescriptorStore === void 0 ? {} : { descriptorStore: this.injectedDescriptorStore },
|
|
28273
28299
|
policy: this.policy
|
|
28274
28300
|
});
|
|
28275
28301
|
this.computer = createComputerUseRuntime({
|
|
@@ -28856,7 +28882,6 @@ function buildMinimizedRequestPlan(input) {
|
|
|
28856
28882
|
sourceId: input.record.recordId,
|
|
28857
28883
|
...input.record.source === "saved" && input.record.savedAt !== void 0 ? { capturedAt: input.record.savedAt } : {}
|
|
28858
28884
|
},
|
|
28859
|
-
lifecycle: "draft",
|
|
28860
28885
|
payload: normalizeRequestPlanPayload({
|
|
28861
28886
|
transport: {
|
|
28862
28887
|
kind: input.transport
|
|
@@ -31011,7 +31036,7 @@ function directionToDelta(direction, amount) {
|
|
|
31011
31036
|
return { x: amount, y: 0 };
|
|
31012
31037
|
}
|
|
31013
31038
|
}
|
|
31014
|
-
function
|
|
31039
|
+
function normalizeNamespace2(value) {
|
|
31015
31040
|
const normalized = String(value ?? "default").trim();
|
|
31016
31041
|
return normalized.length === 0 ? "default" : normalized;
|
|
31017
31042
|
}
|
|
@@ -31072,19 +31097,22 @@ var OpensteerRuntime = class extends OpensteerSessionRuntime {
|
|
|
31072
31097
|
...options.browser === void 0 ? {} : { browser: options.browser },
|
|
31073
31098
|
...options.context === void 0 ? {} : { context: options.context }
|
|
31074
31099
|
});
|
|
31075
|
-
super(
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31086
|
-
|
|
31087
|
-
|
|
31100
|
+
super(
|
|
31101
|
+
buildSharedRuntimeOptions({
|
|
31102
|
+
name: publicWorkspace ?? "default",
|
|
31103
|
+
rootPath,
|
|
31104
|
+
...publicWorkspace === void 0 ? {} : { workspaceName: publicWorkspace },
|
|
31105
|
+
...options.browser === void 0 ? {} : { browser: options.browser },
|
|
31106
|
+
...options.launch === void 0 ? {} : { launch: options.launch },
|
|
31107
|
+
...options.context === void 0 ? {} : { context: options.context },
|
|
31108
|
+
engineName,
|
|
31109
|
+
...options.engine === void 0 ? {} : { engine: options.engine },
|
|
31110
|
+
...options.engineFactory === void 0 ? {} : { engineFactory: options.engineFactory },
|
|
31111
|
+
...options.policy === void 0 ? {} : { policy: options.policy },
|
|
31112
|
+
...options.descriptorStore === void 0 ? {} : { descriptorStore: options.descriptorStore },
|
|
31113
|
+
cleanupRootOnClose
|
|
31114
|
+
})
|
|
31115
|
+
);
|
|
31088
31116
|
}
|
|
31089
31117
|
};
|
|
31090
31118
|
var OpensteerSessionRuntime2 = class extends OpensteerSessionRuntime {
|
|
@@ -31097,18 +31125,21 @@ var OpensteerSessionRuntime2 = class extends OpensteerSessionRuntime {
|
|
|
31097
31125
|
...options.browser === void 0 ? {} : { browser: options.browser },
|
|
31098
31126
|
...options.context === void 0 ? {} : { context: options.context }
|
|
31099
31127
|
});
|
|
31100
|
-
super(
|
|
31101
|
-
|
|
31102
|
-
|
|
31103
|
-
|
|
31104
|
-
|
|
31105
|
-
|
|
31106
|
-
|
|
31107
|
-
|
|
31108
|
-
|
|
31109
|
-
|
|
31110
|
-
|
|
31111
|
-
|
|
31128
|
+
super(
|
|
31129
|
+
buildSharedRuntimeOptions({
|
|
31130
|
+
name: options.name,
|
|
31131
|
+
rootPath,
|
|
31132
|
+
...options.browser === void 0 ? {} : { browser: options.browser },
|
|
31133
|
+
...options.launch === void 0 ? {} : { launch: options.launch },
|
|
31134
|
+
...options.context === void 0 ? {} : { context: options.context },
|
|
31135
|
+
engineName,
|
|
31136
|
+
...options.engine === void 0 ? {} : { engine: options.engine },
|
|
31137
|
+
...options.engineFactory === void 0 ? {} : { engineFactory: options.engineFactory },
|
|
31138
|
+
...options.policy === void 0 ? {} : { policy: options.policy },
|
|
31139
|
+
...options.descriptorStore === void 0 ? {} : { descriptorStore: options.descriptorStore },
|
|
31140
|
+
cleanupRootOnClose
|
|
31141
|
+
})
|
|
31142
|
+
);
|
|
31112
31143
|
}
|
|
31113
31144
|
};
|
|
31114
31145
|
function buildSharedRuntimeOptions(input) {
|
|
@@ -31128,6 +31159,7 @@ function buildSharedRuntimeOptions(input) {
|
|
|
31128
31159
|
...input.engine === void 0 ? {} : { engine: input.engine },
|
|
31129
31160
|
...input.engine === void 0 ? { engineFactory } : {},
|
|
31130
31161
|
...input.policy === void 0 ? {} : { policy: input.policy },
|
|
31162
|
+
...input.descriptorStore === void 0 ? {} : { descriptorStore: input.descriptorStore },
|
|
31131
31163
|
cleanupRootOnClose: input.cleanupRootOnClose,
|
|
31132
31164
|
sessionInfo: {
|
|
31133
31165
|
provider: {
|
|
@@ -31151,45 +31183,44 @@ function resolveOwnership(browser) {
|
|
|
31151
31183
|
return typeof browser === "object" && browser.mode === "attach" ? "attached" : "owned";
|
|
31152
31184
|
}
|
|
31153
31185
|
|
|
31154
|
-
// src/
|
|
31155
|
-
var
|
|
31156
|
-
function
|
|
31186
|
+
// src/provider/config.ts
|
|
31187
|
+
var OPENSTEER_PROVIDER_KINDS = ["local", "cloud"];
|
|
31188
|
+
function assertProviderSupportsEngine(provider, engine) {
|
|
31157
31189
|
if (engine !== "abp") {
|
|
31158
31190
|
return;
|
|
31159
31191
|
}
|
|
31160
|
-
if (
|
|
31192
|
+
if (provider === "cloud") {
|
|
31161
31193
|
throw new Error(
|
|
31162
|
-
"ABP is not supported
|
|
31194
|
+
"ABP is not supported for provider=cloud. Cloud provider currently requires Playwright."
|
|
31163
31195
|
);
|
|
31164
31196
|
}
|
|
31165
31197
|
}
|
|
31166
|
-
function
|
|
31198
|
+
function normalizeOpensteerProviderKind(value, source = "OPENSTEER_PROVIDER") {
|
|
31167
31199
|
const normalized = value.trim().toLowerCase();
|
|
31168
|
-
if (normalized ===
|
|
31200
|
+
if (normalized === OPENSTEER_PROVIDER_KINDS[0] || normalized === OPENSTEER_PROVIDER_KINDS[1]) {
|
|
31169
31201
|
return normalized;
|
|
31170
31202
|
}
|
|
31171
31203
|
throw new Error(
|
|
31172
|
-
`${source} must be one of ${
|
|
31204
|
+
`${source} must be one of ${OPENSTEER_PROVIDER_KINDS.join(", ")}; received "${value}".`
|
|
31173
31205
|
);
|
|
31174
31206
|
}
|
|
31175
|
-
function
|
|
31176
|
-
|
|
31177
|
-
|
|
31178
|
-
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
return input.explicit;
|
|
31182
|
-
}
|
|
31183
|
-
if (input.local) {
|
|
31184
|
-
return "local";
|
|
31185
|
-
}
|
|
31186
|
-
if (input.cloud) {
|
|
31187
|
-
return "cloud";
|
|
31207
|
+
function resolveOpensteerProvider(input = {}) {
|
|
31208
|
+
if (input.provider) {
|
|
31209
|
+
return {
|
|
31210
|
+
kind: input.provider.kind,
|
|
31211
|
+
source: "explicit"
|
|
31212
|
+
};
|
|
31188
31213
|
}
|
|
31189
|
-
if (input.
|
|
31190
|
-
return
|
|
31214
|
+
if (input.environmentProvider !== void 0 && input.environmentProvider.trim().length > 0) {
|
|
31215
|
+
return {
|
|
31216
|
+
kind: normalizeOpensteerProviderKind(input.environmentProvider),
|
|
31217
|
+
source: "env"
|
|
31218
|
+
};
|
|
31191
31219
|
}
|
|
31192
|
-
return
|
|
31220
|
+
return {
|
|
31221
|
+
kind: "local",
|
|
31222
|
+
source: "default"
|
|
31223
|
+
};
|
|
31193
31224
|
}
|
|
31194
31225
|
var execFile2 = promisify(execFile);
|
|
31195
31226
|
var DEFAULT_CAPTURE_TIMEOUT_MS = 3e4;
|
|
@@ -31771,15 +31802,12 @@ var OpensteerCloudClient = class {
|
|
|
31771
31802
|
return await response.json();
|
|
31772
31803
|
}
|
|
31773
31804
|
async issueAccess(sessionId, capabilities) {
|
|
31774
|
-
const response = await this.request(
|
|
31775
|
-
|
|
31776
|
-
{
|
|
31777
|
-
|
|
31778
|
-
body: {
|
|
31779
|
-
capabilities
|
|
31780
|
-
}
|
|
31805
|
+
const response = await this.request(`/v1/sessions/${encodeURIComponent(sessionId)}/access`, {
|
|
31806
|
+
method: "POST",
|
|
31807
|
+
body: {
|
|
31808
|
+
capabilities
|
|
31781
31809
|
}
|
|
31782
|
-
);
|
|
31810
|
+
});
|
|
31783
31811
|
return await response.json();
|
|
31784
31812
|
}
|
|
31785
31813
|
async closeSession(sessionId) {
|
|
@@ -31837,6 +31865,34 @@ var OpensteerCloudClient = class {
|
|
|
31837
31865
|
async syncBrowserProfileCookies(input) {
|
|
31838
31866
|
return syncBrowserProfileCookies(this, input);
|
|
31839
31867
|
}
|
|
31868
|
+
async importSelectorCache(entries) {
|
|
31869
|
+
const response = await this.request("/selector-cache/import", {
|
|
31870
|
+
method: "POST",
|
|
31871
|
+
body: { entries }
|
|
31872
|
+
});
|
|
31873
|
+
return await response.json();
|
|
31874
|
+
}
|
|
31875
|
+
async importRequestPlans(entries) {
|
|
31876
|
+
const response = await this.request("/registry/request-plans/import", {
|
|
31877
|
+
method: "POST",
|
|
31878
|
+
body: { entries }
|
|
31879
|
+
});
|
|
31880
|
+
return await response.json();
|
|
31881
|
+
}
|
|
31882
|
+
async importRecipes(entries) {
|
|
31883
|
+
const response = await this.request("/registry/recipes/import", {
|
|
31884
|
+
method: "POST",
|
|
31885
|
+
body: { entries }
|
|
31886
|
+
});
|
|
31887
|
+
return await response.json();
|
|
31888
|
+
}
|
|
31889
|
+
async importAuthRecipes(entries) {
|
|
31890
|
+
const response = await this.request("/registry/auth-recipes/import", {
|
|
31891
|
+
method: "POST",
|
|
31892
|
+
body: { entries }
|
|
31893
|
+
});
|
|
31894
|
+
return await response.json();
|
|
31895
|
+
}
|
|
31840
31896
|
buildAuthorizationHeader() {
|
|
31841
31897
|
return `Bearer ${this.config.apiKey}`;
|
|
31842
31898
|
}
|
|
@@ -31907,22 +31963,26 @@ function wrapCloudFetchError(error, input) {
|
|
|
31907
31963
|
|
|
31908
31964
|
// src/cloud/config.ts
|
|
31909
31965
|
function resolveCloudConfig(input = {}) {
|
|
31910
|
-
const
|
|
31911
|
-
...input.
|
|
31912
|
-
...input.
|
|
31913
|
-
...process.env.OPENSTEER_MODE === void 0 ? {} : { environment: process.env.OPENSTEER_MODE }
|
|
31966
|
+
const provider = resolveOpensteerProvider({
|
|
31967
|
+
...input.provider === void 0 ? {} : { provider: input.provider },
|
|
31968
|
+
...input.environmentProvider === void 0 ? {} : { environmentProvider: input.environmentProvider }
|
|
31914
31969
|
});
|
|
31915
|
-
if (
|
|
31970
|
+
if (provider.kind !== "cloud") {
|
|
31916
31971
|
return void 0;
|
|
31917
31972
|
}
|
|
31918
|
-
const
|
|
31973
|
+
const cloudProvider = input.provider?.kind === "cloud" ? input.provider : void 0;
|
|
31974
|
+
const apiKey = cloudProvider?.apiKey ?? process.env.OPENSTEER_API_KEY;
|
|
31919
31975
|
if (!apiKey || apiKey.trim().length === 0) {
|
|
31920
|
-
throw new Error("
|
|
31976
|
+
throw new Error("provider=cloud requires OPENSTEER_API_KEY or provider.apiKey.");
|
|
31977
|
+
}
|
|
31978
|
+
const baseUrl = cloudProvider?.baseUrl ?? process.env.OPENSTEER_BASE_URL;
|
|
31979
|
+
if (!baseUrl || baseUrl.trim().length === 0) {
|
|
31980
|
+
throw new Error("provider=cloud requires OPENSTEER_BASE_URL or provider.baseUrl.");
|
|
31921
31981
|
}
|
|
31922
31982
|
return {
|
|
31923
31983
|
apiKey: apiKey.trim(),
|
|
31924
|
-
baseUrl:
|
|
31925
|
-
...
|
|
31984
|
+
baseUrl: baseUrl.trim().replace(/\/+$/, ""),
|
|
31985
|
+
...cloudProvider?.browserProfile === void 0 ? {} : { browserProfile: cloudProvider.browserProfile }
|
|
31926
31986
|
};
|
|
31927
31987
|
}
|
|
31928
31988
|
var OpensteerSemanticRestError = class extends Error {
|
|
@@ -32145,9 +32205,7 @@ var OpensteerCloudAutomationClient = class {
|
|
|
32145
32205
|
if (registration.kind === "route") {
|
|
32146
32206
|
await this.route(registration.input);
|
|
32147
32207
|
} else {
|
|
32148
|
-
await this.interceptScript(
|
|
32149
|
-
registration.input
|
|
32150
|
-
);
|
|
32208
|
+
await this.interceptScript(registration.input);
|
|
32151
32209
|
}
|
|
32152
32210
|
}
|
|
32153
32211
|
}
|
|
@@ -32346,6 +32404,116 @@ function asRecord(value) {
|
|
|
32346
32404
|
return value;
|
|
32347
32405
|
}
|
|
32348
32406
|
|
|
32407
|
+
// src/cloud/registry-sync.ts
|
|
32408
|
+
var REGISTRY_SYNC_MAX_PAYLOAD_BYTES = 15e5;
|
|
32409
|
+
var REGISTRY_SYNC_MAX_ENTRIES_PER_BATCH = 100;
|
|
32410
|
+
async function syncLocalRegistryToCloud(client, workspace, store) {
|
|
32411
|
+
const [descriptors, requestPlans, recipes, authRecipes] = await Promise.all([
|
|
32412
|
+
store.registry.descriptors.list(),
|
|
32413
|
+
store.registry.requestPlans.list(),
|
|
32414
|
+
store.registry.recipes.list(),
|
|
32415
|
+
store.registry.authRecipes.list()
|
|
32416
|
+
]);
|
|
32417
|
+
const selectorEntries = descriptors.flatMap((record) => {
|
|
32418
|
+
const entry = toSelectorCacheImportEntry(workspace, record);
|
|
32419
|
+
return entry === void 0 ? [] : [entry];
|
|
32420
|
+
});
|
|
32421
|
+
await Promise.all([
|
|
32422
|
+
importInBatches(selectorEntries, (entries) => client.importSelectorCache(entries)),
|
|
32423
|
+
importInBatches(
|
|
32424
|
+
requestPlans.map((record) => toRequestPlanImportEntry(workspace, record)),
|
|
32425
|
+
(entries) => client.importRequestPlans(entries)
|
|
32426
|
+
),
|
|
32427
|
+
importInBatches(
|
|
32428
|
+
recipes.map((record) => toRegistryImportEntry(workspace, record)),
|
|
32429
|
+
(entries) => client.importRecipes(entries)
|
|
32430
|
+
),
|
|
32431
|
+
importInBatches(
|
|
32432
|
+
authRecipes.map((record) => toRegistryImportEntry(workspace, record)),
|
|
32433
|
+
(entries) => client.importAuthRecipes(entries)
|
|
32434
|
+
)
|
|
32435
|
+
]);
|
|
32436
|
+
}
|
|
32437
|
+
function toSelectorCacheImportEntry(workspace, record) {
|
|
32438
|
+
const descriptor = parseDomDescriptorRecord(record);
|
|
32439
|
+
if (descriptor === void 0) {
|
|
32440
|
+
return void 0;
|
|
32441
|
+
}
|
|
32442
|
+
return {
|
|
32443
|
+
workspace,
|
|
32444
|
+
method: descriptor.payload.method,
|
|
32445
|
+
descriptionHash: hashDomDescriptorDescription(descriptor.payload.description),
|
|
32446
|
+
description: descriptor.payload.description,
|
|
32447
|
+
path: descriptor.payload.path,
|
|
32448
|
+
createdAt: descriptor.createdAt,
|
|
32449
|
+
updatedAt: descriptor.updatedAt
|
|
32450
|
+
};
|
|
32451
|
+
}
|
|
32452
|
+
function toRegistryImportEntry(workspace, record) {
|
|
32453
|
+
return {
|
|
32454
|
+
workspace,
|
|
32455
|
+
recordId: record.id,
|
|
32456
|
+
key: record.key,
|
|
32457
|
+
version: record.version,
|
|
32458
|
+
contentHash: record.contentHash,
|
|
32459
|
+
tags: record.tags,
|
|
32460
|
+
...record.provenance === void 0 ? {} : { provenance: record.provenance },
|
|
32461
|
+
payload: record.payload,
|
|
32462
|
+
createdAt: record.createdAt,
|
|
32463
|
+
updatedAt: record.updatedAt
|
|
32464
|
+
};
|
|
32465
|
+
}
|
|
32466
|
+
function toRequestPlanImportEntry(workspace, record) {
|
|
32467
|
+
return {
|
|
32468
|
+
workspace,
|
|
32469
|
+
recordId: record.id,
|
|
32470
|
+
key: record.key,
|
|
32471
|
+
version: record.version,
|
|
32472
|
+
contentHash: record.contentHash,
|
|
32473
|
+
tags: record.tags,
|
|
32474
|
+
...record.provenance === void 0 ? {} : { provenance: record.provenance },
|
|
32475
|
+
payload: record.payload,
|
|
32476
|
+
...record.freshness === void 0 ? {} : { freshness: record.freshness },
|
|
32477
|
+
createdAt: record.createdAt,
|
|
32478
|
+
updatedAt: record.updatedAt
|
|
32479
|
+
};
|
|
32480
|
+
}
|
|
32481
|
+
async function importInBatches(entries, importBatch) {
|
|
32482
|
+
if (entries.length === 0) {
|
|
32483
|
+
return;
|
|
32484
|
+
}
|
|
32485
|
+
for (const batch of chunkEntries(entries)) {
|
|
32486
|
+
await importBatch(batch);
|
|
32487
|
+
}
|
|
32488
|
+
}
|
|
32489
|
+
function chunkEntries(entries) {
|
|
32490
|
+
const batches = [];
|
|
32491
|
+
let currentBatch = [];
|
|
32492
|
+
for (const entry of entries) {
|
|
32493
|
+
if (payloadByteLength([entry]) > REGISTRY_SYNC_MAX_PAYLOAD_BYTES) {
|
|
32494
|
+
continue;
|
|
32495
|
+
}
|
|
32496
|
+
if (currentBatch.length === 0) {
|
|
32497
|
+
currentBatch = [entry];
|
|
32498
|
+
continue;
|
|
32499
|
+
}
|
|
32500
|
+
const nextBatch = [...currentBatch, entry];
|
|
32501
|
+
if (nextBatch.length > REGISTRY_SYNC_MAX_ENTRIES_PER_BATCH || payloadByteLength(nextBatch) > REGISTRY_SYNC_MAX_PAYLOAD_BYTES) {
|
|
32502
|
+
batches.push(currentBatch);
|
|
32503
|
+
currentBatch = [entry];
|
|
32504
|
+
continue;
|
|
32505
|
+
}
|
|
32506
|
+
currentBatch = nextBatch;
|
|
32507
|
+
}
|
|
32508
|
+
if (currentBatch.length > 0) {
|
|
32509
|
+
batches.push(currentBatch);
|
|
32510
|
+
}
|
|
32511
|
+
return batches;
|
|
32512
|
+
}
|
|
32513
|
+
function payloadByteLength(entries) {
|
|
32514
|
+
return Buffer.byteLength(JSON.stringify({ entries }), "utf8");
|
|
32515
|
+
}
|
|
32516
|
+
|
|
32349
32517
|
// src/cloud/session-proxy.ts
|
|
32350
32518
|
var TEMPORARY_CLOUD_WORKSPACE_PREFIX = "opensteer-cloud-workspace-";
|
|
32351
32519
|
var CloudSessionProxy = class {
|
|
@@ -32650,7 +32818,6 @@ var CloudSessionProxy = class {
|
|
|
32650
32818
|
layout: "opensteer-session",
|
|
32651
32819
|
version: 1,
|
|
32652
32820
|
provider: "cloud",
|
|
32653
|
-
mode: "cloud",
|
|
32654
32821
|
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
32655
32822
|
sessionId: this.sessionId,
|
|
32656
32823
|
baseUrl: this.sessionBaseUrl,
|
|
@@ -32697,9 +32864,11 @@ var CloudSessionProxy = class {
|
|
|
32697
32864
|
assertSupportedCloudBrowserMode(input.browser);
|
|
32698
32865
|
const persisted = await this.loadPersistedSession();
|
|
32699
32866
|
if (persisted !== void 0 && await this.isReusableCloudSession(persisted.sessionId)) {
|
|
32867
|
+
await this.syncRegistryToCloud();
|
|
32700
32868
|
this.bindClient(persisted);
|
|
32701
32869
|
return;
|
|
32702
32870
|
}
|
|
32871
|
+
await this.syncRegistryToCloud();
|
|
32703
32872
|
const session = await this.cloud.createSession({
|
|
32704
32873
|
...this.workspace === void 0 ? {} : { name: this.workspace },
|
|
32705
32874
|
...input.launch === void 0 ? {} : { browser: input.launch },
|
|
@@ -32710,7 +32879,6 @@ var CloudSessionProxy = class {
|
|
|
32710
32879
|
layout: "opensteer-session",
|
|
32711
32880
|
version: 1,
|
|
32712
32881
|
provider: "cloud",
|
|
32713
|
-
mode: "cloud",
|
|
32714
32882
|
...this.workspace === void 0 ? {} : { workspace: this.workspace },
|
|
32715
32883
|
sessionId: session.sessionId,
|
|
32716
32884
|
baseUrl: session.baseUrl,
|
|
@@ -32720,6 +32888,16 @@ var CloudSessionProxy = class {
|
|
|
32720
32888
|
await this.writePersistedSession(record);
|
|
32721
32889
|
this.bindClient(record);
|
|
32722
32890
|
}
|
|
32891
|
+
async syncRegistryToCloud() {
|
|
32892
|
+
if (this.workspace === void 0) {
|
|
32893
|
+
return;
|
|
32894
|
+
}
|
|
32895
|
+
try {
|
|
32896
|
+
const workspaceStore = await this.ensureWorkspaceStore();
|
|
32897
|
+
await syncLocalRegistryToCloud(this.cloud, this.workspace, workspaceStore);
|
|
32898
|
+
} catch {
|
|
32899
|
+
}
|
|
32900
|
+
}
|
|
32723
32901
|
bindClient(record) {
|
|
32724
32902
|
this.sessionId = record.sessionId;
|
|
32725
32903
|
this.sessionBaseUrl = record.baseUrl;
|
|
@@ -32749,7 +32927,7 @@ var CloudSessionProxy = class {
|
|
|
32749
32927
|
await writePersistedSessionRecord(workspace.rootPath, record);
|
|
32750
32928
|
}
|
|
32751
32929
|
async clearPersistedSession() {
|
|
32752
|
-
await clearPersistedSessionRecord(this.rootPath).catch(() => void 0);
|
|
32930
|
+
await clearPersistedSessionRecord(this.rootPath, "cloud").catch(() => void 0);
|
|
32753
32931
|
}
|
|
32754
32932
|
async isReusableCloudSession(sessionId) {
|
|
32755
32933
|
try {
|
|
@@ -32792,49 +32970,30 @@ function isMissingCloudSessionError(error) {
|
|
|
32792
32970
|
|
|
32793
32971
|
// src/sdk/runtime-resolution.ts
|
|
32794
32972
|
function resolveOpensteerRuntimeConfig(input = {}) {
|
|
32795
|
-
|
|
32796
|
-
|
|
32797
|
-
|
|
32798
|
-
cloud: resolveCloudConfig({
|
|
32799
|
-
enabled: true,
|
|
32800
|
-
...input.provider,
|
|
32801
|
-
mode: "cloud"
|
|
32802
|
-
})
|
|
32803
|
-
};
|
|
32804
|
-
}
|
|
32805
|
-
if (input.provider?.kind === "local") {
|
|
32806
|
-
return {
|
|
32807
|
-
mode: "local"
|
|
32808
|
-
};
|
|
32809
|
-
}
|
|
32810
|
-
const mode = resolveOpensteerExecutionMode({
|
|
32811
|
-
...input.mode === void 0 ? {} : { explicit: input.mode },
|
|
32812
|
-
cloud: input.cloud !== void 0 && input.cloud !== false,
|
|
32813
|
-
...input.environmentMode === void 0 ? {} : { environment: input.environmentMode }
|
|
32973
|
+
const provider = resolveOpensteerProvider({
|
|
32974
|
+
...input.provider === void 0 ? {} : { provider: input.provider },
|
|
32975
|
+
...input.environmentProvider === void 0 ? {} : { environmentProvider: input.environmentProvider }
|
|
32814
32976
|
});
|
|
32815
|
-
if (
|
|
32977
|
+
if (provider.kind === "cloud") {
|
|
32816
32978
|
return {
|
|
32817
|
-
|
|
32979
|
+
provider,
|
|
32818
32980
|
cloud: resolveCloudConfig({
|
|
32819
|
-
|
|
32820
|
-
...
|
|
32821
|
-
mode
|
|
32981
|
+
...input.provider === void 0 ? {} : { provider: input.provider },
|
|
32982
|
+
...input.environmentProvider === void 0 ? {} : { environmentProvider: input.environmentProvider }
|
|
32822
32983
|
})
|
|
32823
32984
|
};
|
|
32824
32985
|
}
|
|
32825
|
-
return {
|
|
32986
|
+
return { provider };
|
|
32826
32987
|
}
|
|
32827
32988
|
function createOpensteerSemanticRuntime(input = {}) {
|
|
32828
32989
|
const runtimeOptions = input.runtimeOptions ?? {};
|
|
32829
32990
|
const engine = input.engine ?? runtimeOptions.engineName ?? DEFAULT_OPENSTEER_ENGINE;
|
|
32830
32991
|
const config = resolveOpensteerRuntimeConfig({
|
|
32831
|
-
...input.cloud === void 0 ? {} : { cloud: input.cloud },
|
|
32832
32992
|
...input.provider === void 0 ? {} : { provider: input.provider },
|
|
32833
|
-
...
|
|
32834
|
-
...process.env.OPENSTEER_MODE === void 0 ? {} : { environmentMode: process.env.OPENSTEER_MODE }
|
|
32993
|
+
...process.env.OPENSTEER_PROVIDER === void 0 ? {} : { environmentProvider: process.env.OPENSTEER_PROVIDER }
|
|
32835
32994
|
});
|
|
32836
|
-
|
|
32837
|
-
if (config.
|
|
32995
|
+
assertProviderSupportsEngine(config.provider.kind, engine);
|
|
32996
|
+
if (config.provider.kind === "cloud") {
|
|
32838
32997
|
return new CloudSessionProxy(new OpensteerCloudClient(config.cloud), {
|
|
32839
32998
|
...runtimeOptions.rootDir === void 0 ? {} : { rootDir: runtimeOptions.rootDir },
|
|
32840
32999
|
...runtimeOptions.rootPath === void 0 ? {} : { rootPath: runtimeOptions.rootPath },
|
|
@@ -32848,6 +33007,6 @@ function createOpensteerSemanticRuntime(input = {}) {
|
|
|
32848
33007
|
});
|
|
32849
33008
|
}
|
|
32850
33009
|
|
|
32851
|
-
export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime2 as OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS,
|
|
32852
|
-
//# sourceMappingURL=chunk-
|
|
32853
|
-
//# sourceMappingURL=chunk-
|
|
33010
|
+
export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime2 as OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createDomRuntime, createFilesystemOpensteerWorkspace, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, inspectCdpEndpoint, isCurrentUrlField, isProcessRunning, isValidCssAttributeKey, listLocalChromeProfiles, normalizeExtractedValue, normalizeOpensteerEngineName, normalizeOpensteerProviderKind, normalizeWorkspaceId, pathExists, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord };
|
|
33011
|
+
//# sourceMappingURL=chunk-C7GWMSTV.js.map
|
|
33012
|
+
//# sourceMappingURL=chunk-C7GWMSTV.js.map
|