@opensteer/runtime-core 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +126 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +126 -183
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import vm from 'vm';
|
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
15
|
var package_default = {
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.7"};
|
|
17
17
|
|
|
18
18
|
// src/version.ts
|
|
19
19
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
|
|
@@ -2394,6 +2394,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
|
|
|
2394
2394
|
required: ["method", "url"]
|
|
2395
2395
|
}
|
|
2396
2396
|
);
|
|
2397
|
+
var opensteerReplayAttemptSchema = objectSchema(
|
|
2398
|
+
{
|
|
2399
|
+
transport: transportKindSchema,
|
|
2400
|
+
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2401
|
+
ok: { type: "boolean" },
|
|
2402
|
+
durationMs: integerSchema({ minimum: 0 }),
|
|
2403
|
+
note: stringSchema(),
|
|
2404
|
+
error: stringSchema()
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
title: "OpensteerReplayAttempt",
|
|
2408
|
+
required: ["transport", "ok", "durationMs"]
|
|
2409
|
+
}
|
|
2410
|
+
);
|
|
2397
2411
|
var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
2398
2412
|
{
|
|
2399
2413
|
recordId: stringSchema({ minLength: 1 }),
|
|
@@ -2417,28 +2431,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
|
2417
2431
|
}
|
|
2418
2432
|
),
|
|
2419
2433
|
redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
|
|
2420
|
-
notes: arraySchema(stringSchema())
|
|
2434
|
+
notes: arraySchema(stringSchema()),
|
|
2435
|
+
transportProbe: objectSchema(
|
|
2436
|
+
{
|
|
2437
|
+
recommended: transportKindSchema,
|
|
2438
|
+
attempts: arraySchema(opensteerReplayAttemptSchema)
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
title: "OpensteerTransportProbeResult",
|
|
2442
|
+
required: ["attempts"]
|
|
2443
|
+
}
|
|
2444
|
+
)
|
|
2421
2445
|
},
|
|
2422
2446
|
{
|
|
2423
2447
|
title: "OpensteerNetworkDetailOutput",
|
|
2424
2448
|
required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
|
|
2425
2449
|
}
|
|
2426
2450
|
);
|
|
2427
|
-
|
|
2428
|
-
{
|
|
2429
|
-
transport: transportKindSchema,
|
|
2430
|
-
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2431
|
-
ok: { type: "boolean" },
|
|
2432
|
-
durationMs: integerSchema({ minimum: 0 }),
|
|
2433
|
-
note: stringSchema(),
|
|
2434
|
-
error: stringSchema()
|
|
2435
|
-
},
|
|
2436
|
-
{
|
|
2437
|
-
title: "OpensteerReplayAttempt",
|
|
2438
|
-
required: ["transport", "ok", "durationMs"]
|
|
2439
|
-
}
|
|
2440
|
-
);
|
|
2441
|
-
var opensteerNetworkReplayInputSchema = objectSchema(
|
|
2451
|
+
objectSchema(
|
|
2442
2452
|
{
|
|
2443
2453
|
recordId: stringSchema({ minLength: 1 }),
|
|
2444
2454
|
pageRef: pageRefSchema,
|
|
@@ -2452,7 +2462,6 @@ var opensteerNetworkReplayInputSchema = objectSchema(
|
|
|
2452
2462
|
required: ["recordId"]
|
|
2453
2463
|
}
|
|
2454
2464
|
);
|
|
2455
|
-
var opensteerNetworkReplayOutputSchema;
|
|
2456
2465
|
var opensteerSessionFetchTransportSchema = enumSchema(
|
|
2457
2466
|
["auto", "direct", "matched-tls", "page"],
|
|
2458
2467
|
{
|
|
@@ -2794,7 +2803,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
|
|
|
2794
2803
|
required: ["url", "status", "statusText", "headers", "redirected"]
|
|
2795
2804
|
}
|
|
2796
2805
|
);
|
|
2797
|
-
|
|
2806
|
+
objectSchema(
|
|
2798
2807
|
{
|
|
2799
2808
|
recordId: stringSchema({ minLength: 1 }),
|
|
2800
2809
|
transport: transportKindSchema,
|
|
@@ -5761,7 +5770,6 @@ var opensteerExposedSemanticOperationNames = [
|
|
|
5761
5770
|
"dom.extract",
|
|
5762
5771
|
"network.query",
|
|
5763
5772
|
"network.detail",
|
|
5764
|
-
"network.replay",
|
|
5765
5773
|
"interaction.capture",
|
|
5766
5774
|
"interaction.get",
|
|
5767
5775
|
"interaction.diff",
|
|
@@ -5798,7 +5806,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
|
|
|
5798
5806
|
"dom.extract",
|
|
5799
5807
|
"network.query",
|
|
5800
5808
|
"network.detail",
|
|
5801
|
-
"network.replay",
|
|
5802
5809
|
"interaction.capture",
|
|
5803
5810
|
"interaction.get",
|
|
5804
5811
|
"interaction.diff",
|
|
@@ -5919,11 +5926,11 @@ var targetByElementSchema2 = objectSchema(
|
|
|
5919
5926
|
var targetByPersistSchema2 = objectSchema(
|
|
5920
5927
|
{
|
|
5921
5928
|
kind: enumSchema(["persist"]),
|
|
5922
|
-
|
|
5929
|
+
persist: stringSchema()
|
|
5923
5930
|
},
|
|
5924
5931
|
{
|
|
5925
5932
|
title: "OpensteerTargetByPersist",
|
|
5926
|
-
required: ["kind", "
|
|
5933
|
+
required: ["kind", "persist"]
|
|
5927
5934
|
}
|
|
5928
5935
|
);
|
|
5929
5936
|
var targetBySelectorSchema2 = objectSchema(
|
|
@@ -5970,8 +5977,7 @@ var opensteerResolvedTargetSchema = objectSchema(
|
|
|
5970
5977
|
var opensteerActionResultSchema = objectSchema(
|
|
5971
5978
|
{
|
|
5972
5979
|
target: opensteerResolvedTargetSchema,
|
|
5973
|
-
point: pointSchema
|
|
5974
|
-
persisted: stringSchema()
|
|
5980
|
+
point: pointSchema
|
|
5975
5981
|
},
|
|
5976
5982
|
{
|
|
5977
5983
|
title: "OpensteerActionResult",
|
|
@@ -6237,9 +6243,12 @@ var opensteerNetworkDetailInputSchema = objectSchema(
|
|
|
6237
6243
|
required: ["recordId"]
|
|
6238
6244
|
}
|
|
6239
6245
|
);
|
|
6240
|
-
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6241
|
-
|
|
6242
|
-
|
|
6246
|
+
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6247
|
+
["left", "middle", "right"],
|
|
6248
|
+
{
|
|
6249
|
+
title: "OpensteerComputerMouseButton"
|
|
6250
|
+
}
|
|
6251
|
+
);
|
|
6243
6252
|
var opensteerComputerKeyModifierSchema = enumSchema(
|
|
6244
6253
|
["Shift", "Control", "Alt", "Meta"],
|
|
6245
6254
|
{
|
|
@@ -6316,10 +6325,7 @@ var opensteerDomExtractInputSchema = defineSchema({
|
|
|
6316
6325
|
title: "OpensteerDomExtractInput"
|
|
6317
6326
|
}
|
|
6318
6327
|
),
|
|
6319
|
-
anyOf: [
|
|
6320
|
-
defineSchema({ required: ["persist"] }),
|
|
6321
|
-
defineSchema({ required: ["schema"] })
|
|
6322
|
-
]
|
|
6328
|
+
anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
|
|
6323
6329
|
});
|
|
6324
6330
|
var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
|
|
6325
6331
|
var opensteerDomExtractOutputSchema = objectSchema(
|
|
@@ -6699,13 +6705,6 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
6699
6705
|
outputSchema: opensteerNetworkDetailOutputSchema,
|
|
6700
6706
|
requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
|
|
6701
6707
|
}),
|
|
6702
|
-
defineSemanticOperationSpec({
|
|
6703
|
-
name: "network.replay",
|
|
6704
|
-
description: "Replay a captured request through the transport ladder and report the transport that worked.",
|
|
6705
|
-
inputSchema: opensteerNetworkReplayInputSchema,
|
|
6706
|
-
outputSchema: opensteerNetworkReplayOutputSchema,
|
|
6707
|
-
requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
|
|
6708
|
-
}),
|
|
6709
6708
|
defineSemanticOperationSpec({
|
|
6710
6709
|
name: "interaction.capture",
|
|
6711
6710
|
description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
|
|
@@ -10574,8 +10573,8 @@ function createDomDescriptorStore(options) {
|
|
|
10574
10573
|
}
|
|
10575
10574
|
return new MemoryDomDescriptorStore(namespace);
|
|
10576
10575
|
}
|
|
10577
|
-
function
|
|
10578
|
-
return sha256Hex2(
|
|
10576
|
+
function hashDomDescriptorPersist(persist) {
|
|
10577
|
+
return sha256Hex2(persist.trim());
|
|
10579
10578
|
}
|
|
10580
10579
|
var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
|
|
10581
10580
|
click: "dom.click",
|
|
@@ -10589,14 +10588,14 @@ function normalizeDomDescriptorMethod(method) {
|
|
|
10589
10588
|
}
|
|
10590
10589
|
function buildDomDescriptorKeys(options) {
|
|
10591
10590
|
const namespace = normalizeDomDescriptorNamespace(options.namespace);
|
|
10592
|
-
const
|
|
10591
|
+
const persistHash = hashDomDescriptorPersist(options.persist);
|
|
10593
10592
|
const rawMethod = options.method.trim();
|
|
10594
10593
|
const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
|
|
10595
10594
|
const methods = /* @__PURE__ */ new Set([canonicalMethod]);
|
|
10596
10595
|
if (rawMethod.length > 0) {
|
|
10597
10596
|
methods.add(rawMethod);
|
|
10598
10597
|
}
|
|
10599
|
-
return [...methods].map((method) => `dom:${namespace}:${method}:${
|
|
10598
|
+
return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
|
|
10600
10599
|
}
|
|
10601
10600
|
function buildDomDescriptorKey(options) {
|
|
10602
10601
|
return buildDomDescriptorKeys(options)[0];
|
|
@@ -10612,7 +10611,7 @@ function buildDomDescriptorPayload(input) {
|
|
|
10612
10611
|
return {
|
|
10613
10612
|
kind: "dom-target",
|
|
10614
10613
|
method: normalizeDomDescriptorMethod(input.method),
|
|
10615
|
-
|
|
10614
|
+
persist: input.persist,
|
|
10616
10615
|
path: sanitizeReplayElementPath(input.path),
|
|
10617
10616
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
10618
10617
|
};
|
|
@@ -10629,8 +10628,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10629
10628
|
if (raw.kind !== "dom-target") {
|
|
10630
10629
|
return void 0;
|
|
10631
10630
|
}
|
|
10632
|
-
|
|
10633
|
-
if (typeof raw.method !== "string" || name === void 0) {
|
|
10631
|
+
if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
|
|
10634
10632
|
return void 0;
|
|
10635
10633
|
}
|
|
10636
10634
|
if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
|
|
@@ -10642,7 +10640,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10642
10640
|
const normalizedPayload = {
|
|
10643
10641
|
kind: "dom-target",
|
|
10644
10642
|
method: normalizeDomDescriptorMethod(raw.method),
|
|
10645
|
-
|
|
10643
|
+
persist: raw.persist,
|
|
10646
10644
|
path: sanitizeReplayElementPath(raw.path),
|
|
10647
10645
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
10648
10646
|
};
|
|
@@ -10664,7 +10662,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10664
10662
|
for (const key of buildDomDescriptorKeys({
|
|
10665
10663
|
namespace: this.namespace,
|
|
10666
10664
|
method: input.method,
|
|
10667
|
-
|
|
10665
|
+
persist: input.persist
|
|
10668
10666
|
})) {
|
|
10669
10667
|
const record = await this.registry.resolve({ key });
|
|
10670
10668
|
if (!record) {
|
|
@@ -10679,7 +10677,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10679
10677
|
const key = buildDomDescriptorKey({
|
|
10680
10678
|
namespace: this.namespace,
|
|
10681
10679
|
method: input.method,
|
|
10682
|
-
|
|
10680
|
+
persist: input.persist
|
|
10683
10681
|
});
|
|
10684
10682
|
const version = buildDomDescriptorVersion(payload);
|
|
10685
10683
|
const existing = await this.registry.resolve({ key, version });
|
|
@@ -10722,7 +10720,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10722
10720
|
for (const key of buildDomDescriptorKeys({
|
|
10723
10721
|
namespace: this.namespace,
|
|
10724
10722
|
method: input.method,
|
|
10725
|
-
|
|
10723
|
+
persist: input.persist
|
|
10726
10724
|
})) {
|
|
10727
10725
|
const record = this.latestByKey.get(key);
|
|
10728
10726
|
if (record) {
|
|
@@ -10736,7 +10734,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10736
10734
|
const key = buildDomDescriptorKey({
|
|
10737
10735
|
namespace: this.namespace,
|
|
10738
10736
|
method: input.method,
|
|
10739
|
-
|
|
10737
|
+
persist: input.persist
|
|
10740
10738
|
});
|
|
10741
10739
|
const version = buildDomDescriptorVersion(payload);
|
|
10742
10740
|
const existing = this.recordsByKey.get(key)?.get(version);
|
|
@@ -11668,15 +11666,15 @@ var DefaultDomRuntime = class {
|
|
|
11668
11666
|
async resolveDescriptorTarget(session, pageRef, method, target) {
|
|
11669
11667
|
const descriptor = await this.descriptors.read({
|
|
11670
11668
|
method,
|
|
11671
|
-
|
|
11669
|
+
persist: target.persist
|
|
11672
11670
|
});
|
|
11673
11671
|
if (!descriptor) {
|
|
11674
11672
|
throw new OpensteerProtocolError(
|
|
11675
11673
|
"not-found",
|
|
11676
|
-
`no stored DOM descriptor found for "${target.
|
|
11674
|
+
`no stored DOM descriptor found for "${target.persist}"`,
|
|
11677
11675
|
{
|
|
11678
11676
|
details: {
|
|
11679
|
-
|
|
11677
|
+
persist: target.persist,
|
|
11680
11678
|
kind: "dom-descriptor"
|
|
11681
11679
|
}
|
|
11682
11680
|
}
|
|
@@ -11690,7 +11688,7 @@ var DefaultDomRuntime = class {
|
|
|
11690
11688
|
pageRef,
|
|
11691
11689
|
descriptor.payload.path,
|
|
11692
11690
|
"descriptor",
|
|
11693
|
-
descriptor.payload.
|
|
11691
|
+
descriptor.payload.persist,
|
|
11694
11692
|
descriptor
|
|
11695
11693
|
);
|
|
11696
11694
|
}
|
|
@@ -11720,7 +11718,7 @@ var DefaultDomRuntime = class {
|
|
|
11720
11718
|
const replayPath = await this.tryBuildPathFromNode(snapshot, node);
|
|
11721
11719
|
const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
|
|
11722
11720
|
method,
|
|
11723
|
-
|
|
11721
|
+
persist: target.persist,
|
|
11724
11722
|
path: replayPath ?? await this.buildPathForNode(snapshot, node),
|
|
11725
11723
|
sourceUrl: snapshot.url
|
|
11726
11724
|
});
|
|
@@ -14736,8 +14734,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14736
14734
|
return void 0;
|
|
14737
14735
|
}
|
|
14738
14736
|
const raw = payload;
|
|
14739
|
-
|
|
14740
|
-
if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
|
|
14737
|
+
if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
|
|
14741
14738
|
return void 0;
|
|
14742
14739
|
}
|
|
14743
14740
|
const root = normalizePersistedExtractionNode(raw.root, "root");
|
|
@@ -14752,7 +14749,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14752
14749
|
updatedAt: record.updatedAt,
|
|
14753
14750
|
payload: {
|
|
14754
14751
|
kind: "dom-extraction",
|
|
14755
|
-
persist,
|
|
14752
|
+
persist: raw.persist,
|
|
14756
14753
|
root,
|
|
14757
14754
|
...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
|
|
14758
14755
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
@@ -16007,7 +16004,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
|
|
|
16007
16004
|
)
|
|
16008
16005
|
);
|
|
16009
16006
|
}
|
|
16010
|
-
async function
|
|
16007
|
+
async function clearOpensteerLiveCounters(engine, pageRef) {
|
|
16011
16008
|
const frames = await engine.listFrames({ pageRef });
|
|
16012
16009
|
const failures = [];
|
|
16013
16010
|
for (const frame of frames) {
|
|
@@ -16105,7 +16102,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16105
16102
|
engine: options.engine,
|
|
16106
16103
|
pageRef: options.pageRef
|
|
16107
16104
|
});
|
|
16108
|
-
await
|
|
16105
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef);
|
|
16109
16106
|
await assignSparseCountersToLiveDom(options.engine, options.pageRef);
|
|
16110
16107
|
const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
|
|
16111
16108
|
const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
|
|
@@ -16142,7 +16139,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16142
16139
|
counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
|
|
16143
16140
|
};
|
|
16144
16141
|
} catch (error) {
|
|
16145
|
-
await
|
|
16142
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
|
|
16146
16143
|
if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
|
|
16147
16144
|
lastCounterSyncError = error;
|
|
16148
16145
|
continue;
|
|
@@ -18725,7 +18722,12 @@ var OpensteerSessionRuntime = class {
|
|
|
18725
18722
|
includeBodies: true,
|
|
18726
18723
|
redactSecretHeaders: false
|
|
18727
18724
|
});
|
|
18728
|
-
|
|
18725
|
+
const detail = await this.buildNetworkDetail(record, timeout);
|
|
18726
|
+
if (input.probe !== true) {
|
|
18727
|
+
return detail;
|
|
18728
|
+
}
|
|
18729
|
+
const transportProbe = await this.probeTransportsForRecord(record, timeout);
|
|
18730
|
+
return transportProbe === void 0 ? detail : { ...detail, transportProbe };
|
|
18729
18731
|
},
|
|
18730
18732
|
options
|
|
18731
18733
|
);
|
|
@@ -18760,54 +18762,6 @@ var OpensteerSessionRuntime = class {
|
|
|
18760
18762
|
throw error;
|
|
18761
18763
|
}
|
|
18762
18764
|
}
|
|
18763
|
-
async replayNetwork(input, options = {}) {
|
|
18764
|
-
const startedAt = Date.now();
|
|
18765
|
-
try {
|
|
18766
|
-
const output = await this.runWithOperationTimeout(
|
|
18767
|
-
"network.replay",
|
|
18768
|
-
async (timeout) => {
|
|
18769
|
-
const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
|
|
18770
|
-
includeBodies: true,
|
|
18771
|
-
redactSecretHeaders: false
|
|
18772
|
-
});
|
|
18773
|
-
const replayRequest = buildReplayTransportRequest(source, input);
|
|
18774
|
-
return this.executeNetworkReplay(source, replayRequest, timeout, {
|
|
18775
|
-
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
|
|
18776
|
-
});
|
|
18777
|
-
},
|
|
18778
|
-
options
|
|
18779
|
-
);
|
|
18780
|
-
await this.appendTrace({
|
|
18781
|
-
operation: "network.replay",
|
|
18782
|
-
startedAt,
|
|
18783
|
-
completedAt: Date.now(),
|
|
18784
|
-
outcome: "ok",
|
|
18785
|
-
data: {
|
|
18786
|
-
recordId: input.recordId,
|
|
18787
|
-
transport: output.transport,
|
|
18788
|
-
attempts: output.attempts.length
|
|
18789
|
-
},
|
|
18790
|
-
context: buildRuntimeTraceContext({
|
|
18791
|
-
sessionRef: this.sessionRef,
|
|
18792
|
-
pageRef: this.pageRef
|
|
18793
|
-
})
|
|
18794
|
-
});
|
|
18795
|
-
return output;
|
|
18796
|
-
} catch (error) {
|
|
18797
|
-
await this.appendTrace({
|
|
18798
|
-
operation: "network.replay",
|
|
18799
|
-
startedAt,
|
|
18800
|
-
completedAt: Date.now(),
|
|
18801
|
-
outcome: "error",
|
|
18802
|
-
error,
|
|
18803
|
-
context: buildRuntimeTraceContext({
|
|
18804
|
-
sessionRef: this.sessionRef,
|
|
18805
|
-
pageRef: this.pageRef
|
|
18806
|
-
})
|
|
18807
|
-
});
|
|
18808
|
-
throw error;
|
|
18809
|
-
}
|
|
18810
|
-
}
|
|
18811
18765
|
async captureScripts(input = {}, options = {}) {
|
|
18812
18766
|
assertValidSemanticOperationInput("scripts.capture", input);
|
|
18813
18767
|
const pageRef = input.pageRef ?? await this.ensurePageRef();
|
|
@@ -19403,7 +19357,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19403
19357
|
completedAt: Date.now(),
|
|
19404
19358
|
outcome: "ok",
|
|
19405
19359
|
data: {
|
|
19406
|
-
transport: output.transport,
|
|
19360
|
+
...output.transport === void 0 ? {} : { transport: output.transport },
|
|
19407
19361
|
attempts: output.attempts.length,
|
|
19408
19362
|
...output.response === void 0 ? {} : { status: output.response.status },
|
|
19409
19363
|
url: input.url
|
|
@@ -19506,6 +19460,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19506
19460
|
});
|
|
19507
19461
|
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
19508
19462
|
timeout.throwIfAborted();
|
|
19463
|
+
await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
|
|
19509
19464
|
this.pageRef = output2.pageRef;
|
|
19510
19465
|
const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
|
|
19511
19466
|
return {
|
|
@@ -19695,7 +19650,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19695
19650
|
mutationCaptureDiagnostics = diagnostics;
|
|
19696
19651
|
}
|
|
19697
19652
|
);
|
|
19698
|
-
const output = toOpensteerActionResult(executed.result
|
|
19653
|
+
const output = toOpensteerActionResult(executed.result);
|
|
19699
19654
|
const actionEvents = "events" in executed.result ? executed.result.events : void 0;
|
|
19700
19655
|
await this.appendTrace({
|
|
19701
19656
|
operation,
|
|
@@ -19706,7 +19661,6 @@ var OpensteerSessionRuntime = class {
|
|
|
19706
19661
|
data: {
|
|
19707
19662
|
target: output.target,
|
|
19708
19663
|
...output.point === void 0 ? {} : { point: output.point },
|
|
19709
|
-
...output.persisted === void 0 ? {} : { persisted: output.persisted },
|
|
19710
19664
|
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
19711
19665
|
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
19712
19666
|
},
|
|
@@ -19770,7 +19724,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19770
19724
|
await timeout.runStep(
|
|
19771
19725
|
() => this.requireDom().writeDescriptor({
|
|
19772
19726
|
method,
|
|
19773
|
-
|
|
19727
|
+
persist,
|
|
19774
19728
|
path: stablePath2,
|
|
19775
19729
|
sourceUrl: resolved2.snapshot.url
|
|
19776
19730
|
})
|
|
@@ -19778,9 +19732,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19778
19732
|
return {
|
|
19779
19733
|
target: {
|
|
19780
19734
|
kind: "descriptor",
|
|
19781
|
-
|
|
19782
|
-
}
|
|
19783
|
-
persisted: persist
|
|
19735
|
+
persist
|
|
19736
|
+
}
|
|
19784
19737
|
};
|
|
19785
19738
|
}
|
|
19786
19739
|
const resolved = await timeout.runStep(
|
|
@@ -19803,7 +19756,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19803
19756
|
await timeout.runStep(
|
|
19804
19757
|
() => this.requireDom().writeDescriptor({
|
|
19805
19758
|
method,
|
|
19806
|
-
|
|
19759
|
+
persist,
|
|
19807
19760
|
path: stablePath,
|
|
19808
19761
|
sourceUrl: resolved.snapshot.url
|
|
19809
19762
|
})
|
|
@@ -19811,9 +19764,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19811
19764
|
return {
|
|
19812
19765
|
target: {
|
|
19813
19766
|
kind: "descriptor",
|
|
19814
|
-
|
|
19815
|
-
}
|
|
19816
|
-
persisted: persist
|
|
19767
|
+
persist
|
|
19768
|
+
}
|
|
19817
19769
|
};
|
|
19818
19770
|
}
|
|
19819
19771
|
async queryLiveNetwork(input, timeout, options = {}) {
|
|
@@ -19869,6 +19821,18 @@ var OpensteerSessionRuntime = class {
|
|
|
19869
19821
|
const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
|
|
19870
19822
|
return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
|
|
19871
19823
|
}
|
|
19824
|
+
async invalidateLiveSnapshotCounters(pageRefs, timeout) {
|
|
19825
|
+
const engine = this.requireEngine();
|
|
19826
|
+
for (const pageRef of new Set(pageRefs)) {
|
|
19827
|
+
try {
|
|
19828
|
+
await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
|
|
19829
|
+
} catch (error) {
|
|
19830
|
+
if (!isIgnorableRuntimeBindingError(error)) {
|
|
19831
|
+
throw error;
|
|
19832
|
+
}
|
|
19833
|
+
}
|
|
19834
|
+
}
|
|
19835
|
+
}
|
|
19872
19836
|
async captureScriptsInternal(pageRef, input, timeout) {
|
|
19873
19837
|
const root = await this.ensureRoot();
|
|
19874
19838
|
const evaluated = await timeout.runStep(
|
|
@@ -20198,6 +20162,42 @@ var OpensteerSessionRuntime = class {
|
|
|
20198
20162
|
...notes.length === 0 ? {} : { notes }
|
|
20199
20163
|
};
|
|
20200
20164
|
}
|
|
20165
|
+
async probeTransportsForRecord(record, timeout) {
|
|
20166
|
+
if (record.record.status === void 0) {
|
|
20167
|
+
return void 0;
|
|
20168
|
+
}
|
|
20169
|
+
const request = buildReplayTransportRequest(record, { recordId: record.recordId });
|
|
20170
|
+
const fingerprint = buildCapturedRecordSuccessFingerprint(record);
|
|
20171
|
+
const attempts = [];
|
|
20172
|
+
let recommended;
|
|
20173
|
+
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20174
|
+
const attemptStartedAt = Date.now();
|
|
20175
|
+
try {
|
|
20176
|
+
const output = await this.executeReplayTransportAttempt(transport, request, timeout);
|
|
20177
|
+
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20178
|
+
attempts.push({
|
|
20179
|
+
transport,
|
|
20180
|
+
status: output.response.status,
|
|
20181
|
+
ok,
|
|
20182
|
+
durationMs: Date.now() - attemptStartedAt
|
|
20183
|
+
});
|
|
20184
|
+
if (ok && recommended === void 0) {
|
|
20185
|
+
recommended = transport;
|
|
20186
|
+
}
|
|
20187
|
+
} catch (error) {
|
|
20188
|
+
attempts.push({
|
|
20189
|
+
transport,
|
|
20190
|
+
ok: false,
|
|
20191
|
+
durationMs: Date.now() - attemptStartedAt,
|
|
20192
|
+
error: normalizeRuntimeErrorMessage(error)
|
|
20193
|
+
});
|
|
20194
|
+
}
|
|
20195
|
+
}
|
|
20196
|
+
return {
|
|
20197
|
+
...recommended === void 0 ? {} : { recommended },
|
|
20198
|
+
attempts
|
|
20199
|
+
};
|
|
20200
|
+
}
|
|
20201
20201
|
async buildRedirectChain(record, timeout) {
|
|
20202
20202
|
if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
|
|
20203
20203
|
return {};
|
|
@@ -20316,57 +20316,6 @@ var OpensteerSessionRuntime = class {
|
|
|
20316
20316
|
})
|
|
20317
20317
|
};
|
|
20318
20318
|
}
|
|
20319
|
-
async executeNetworkReplay(source, request, timeout, options) {
|
|
20320
|
-
const fingerprint = buildCapturedRecordSuccessFingerprint(source);
|
|
20321
|
-
const attempts = [];
|
|
20322
|
-
let lastOutput;
|
|
20323
|
-
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20324
|
-
const attemptStartedAt = Date.now();
|
|
20325
|
-
try {
|
|
20326
|
-
const output = await this.executeReplayTransportAttempt(
|
|
20327
|
-
transport,
|
|
20328
|
-
request,
|
|
20329
|
-
timeout,
|
|
20330
|
-
options.pageRef
|
|
20331
|
-
);
|
|
20332
|
-
lastOutput = output;
|
|
20333
|
-
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20334
|
-
attempts.push({
|
|
20335
|
-
transport,
|
|
20336
|
-
status: output.response.status,
|
|
20337
|
-
ok,
|
|
20338
|
-
durationMs: Date.now() - attemptStartedAt
|
|
20339
|
-
});
|
|
20340
|
-
if (ok) {
|
|
20341
|
-
const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
|
|
20342
|
-
const previewData2 = toStructuredPreviewData(output.data);
|
|
20343
|
-
return {
|
|
20344
|
-
recordId: source.recordId,
|
|
20345
|
-
transport,
|
|
20346
|
-
attempts,
|
|
20347
|
-
response: output.response,
|
|
20348
|
-
...previewData2 === void 0 ? {} : { data: previewData2 },
|
|
20349
|
-
...fallbackNote === void 0 ? {} : { note: fallbackNote }
|
|
20350
|
-
};
|
|
20351
|
-
}
|
|
20352
|
-
} catch (error) {
|
|
20353
|
-
attempts.push({
|
|
20354
|
-
transport,
|
|
20355
|
-
ok: false,
|
|
20356
|
-
durationMs: Date.now() - attemptStartedAt,
|
|
20357
|
-
error: normalizeRuntimeErrorMessage(error)
|
|
20358
|
-
});
|
|
20359
|
-
}
|
|
20360
|
-
}
|
|
20361
|
-
const previewData = toStructuredPreviewData(lastOutput?.data);
|
|
20362
|
-
return {
|
|
20363
|
-
recordId: source.recordId,
|
|
20364
|
-
attempts,
|
|
20365
|
-
...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
|
|
20366
|
-
...previewData === void 0 ? {} : { data: previewData },
|
|
20367
|
-
note: "all replay transports failed to reproduce the captured response"
|
|
20368
|
-
};
|
|
20369
|
-
}
|
|
20370
20319
|
async executeSessionFetch(request, input, timeout) {
|
|
20371
20320
|
const attempts = [];
|
|
20372
20321
|
let lastOutput;
|
|
@@ -20994,7 +20943,7 @@ var OpensteerSessionRuntime = class {
|
|
|
20994
20943
|
if (target.kind === "persist") {
|
|
20995
20944
|
return {
|
|
20996
20945
|
kind: "descriptor",
|
|
20997
|
-
|
|
20946
|
+
persist: target.persist
|
|
20998
20947
|
};
|
|
20999
20948
|
}
|
|
21000
20949
|
if (target.kind === "selector") {
|
|
@@ -22711,7 +22660,7 @@ function normalizeNamespace2(value) {
|
|
|
22711
22660
|
const normalized = String(value ?? "default").trim();
|
|
22712
22661
|
return normalized.length === 0 ? "default" : normalized;
|
|
22713
22662
|
}
|
|
22714
|
-
function toOpensteerActionResult(result
|
|
22663
|
+
function toOpensteerActionResult(result) {
|
|
22715
22664
|
return {
|
|
22716
22665
|
target: toOpensteerResolvedTarget2(result.resolved),
|
|
22717
22666
|
...result.point === void 0 ? {} : {
|
|
@@ -22719,8 +22668,7 @@ function toOpensteerActionResult(result, persisted) {
|
|
|
22719
22668
|
x: result.point.x,
|
|
22720
22669
|
y: result.point.y
|
|
22721
22670
|
}
|
|
22722
|
-
}
|
|
22723
|
-
...persisted === void 0 ? {} : { persisted }
|
|
22671
|
+
}
|
|
22724
22672
|
};
|
|
22725
22673
|
}
|
|
22726
22674
|
function toOpensteerResolvedTarget2(target) {
|
|
@@ -22970,11 +22918,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
|
|
|
22970
22918
|
input,
|
|
22971
22919
|
options
|
|
22972
22920
|
);
|
|
22973
|
-
case "network.replay":
|
|
22974
|
-
return runtime.replayNetwork(
|
|
22975
|
-
input,
|
|
22976
|
-
options
|
|
22977
|
-
);
|
|
22978
22921
|
case "interaction.capture":
|
|
22979
22922
|
return runtime.captureInteraction(
|
|
22980
22923
|
input,
|
|
@@ -24816,6 +24759,6 @@ function renderNewPageInput(openerPageId, initialUrl) {
|
|
|
24816
24759
|
return `{ ${argumentsList.join(", ")} }`;
|
|
24817
24760
|
}
|
|
24818
24761
|
|
|
24819
|
-
export { FLOW_RECORDER_DRAIN_SCRIPT, FLOW_RECORDER_INSTALL_SCRIPT, FlowRecorderCollector, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OPENSTEER_RUNTIME_CORE_VERSION, OpensteerSessionRuntime, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, createArtifactStore, createDomDescriptorStore, createFilesystemOpensteerWorkspace, createFlowRecorderInstallScript, createObservationStore, createOpensteerExtractionDescriptorStore, dispatchSemanticOperation, generateReplayScript,
|
|
24762
|
+
export { FLOW_RECORDER_DRAIN_SCRIPT, FLOW_RECORDER_INSTALL_SCRIPT, FlowRecorderCollector, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OPENSTEER_RUNTIME_CORE_VERSION, OpensteerSessionRuntime, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, createArtifactStore, createDomDescriptorStore, createFilesystemOpensteerWorkspace, createFlowRecorderInstallScript, createObservationStore, createOpensteerExtractionDescriptorStore, dispatchSemanticOperation, generateReplayScript, hashDomDescriptorPersist, manifestToExternalBinaryLocation, normalizeObservabilityConfig, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, resolveFilesystemWorkspacePath, sanitizeReplayElementPath };
|
|
24820
24763
|
//# sourceMappingURL=index.js.map
|
|
24821
24764
|
//# sourceMappingURL=index.js.map
|