@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.cjs
CHANGED
|
@@ -41,7 +41,7 @@ var vm__default = /*#__PURE__*/_interopDefault(vm);
|
|
|
41
41
|
|
|
42
42
|
// package.json
|
|
43
43
|
var package_default = {
|
|
44
|
-
version: "0.1.
|
|
44
|
+
version: "0.1.7"};
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
47
|
var OPENSTEER_RUNTIME_CORE_VERSION = package_default.version;
|
|
@@ -2422,6 +2422,20 @@ var opensteerNetworkRedirectHopSchema = objectSchema(
|
|
|
2422
2422
|
required: ["method", "url"]
|
|
2423
2423
|
}
|
|
2424
2424
|
);
|
|
2425
|
+
var opensteerReplayAttemptSchema = objectSchema(
|
|
2426
|
+
{
|
|
2427
|
+
transport: transportKindSchema,
|
|
2428
|
+
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2429
|
+
ok: { type: "boolean" },
|
|
2430
|
+
durationMs: integerSchema({ minimum: 0 }),
|
|
2431
|
+
note: stringSchema(),
|
|
2432
|
+
error: stringSchema()
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
title: "OpensteerReplayAttempt",
|
|
2436
|
+
required: ["transport", "ok", "durationMs"]
|
|
2437
|
+
}
|
|
2438
|
+
);
|
|
2425
2439
|
var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
2426
2440
|
{
|
|
2427
2441
|
recordId: stringSchema({ minLength: 1 }),
|
|
@@ -2445,28 +2459,24 @@ var opensteerNetworkDetailOutputSchema = objectSchema(
|
|
|
2445
2459
|
}
|
|
2446
2460
|
),
|
|
2447
2461
|
redirectChain: arraySchema(opensteerNetworkRedirectHopSchema),
|
|
2448
|
-
notes: arraySchema(stringSchema())
|
|
2462
|
+
notes: arraySchema(stringSchema()),
|
|
2463
|
+
transportProbe: objectSchema(
|
|
2464
|
+
{
|
|
2465
|
+
recommended: transportKindSchema,
|
|
2466
|
+
attempts: arraySchema(opensteerReplayAttemptSchema)
|
|
2467
|
+
},
|
|
2468
|
+
{
|
|
2469
|
+
title: "OpensteerTransportProbeResult",
|
|
2470
|
+
required: ["attempts"]
|
|
2471
|
+
}
|
|
2472
|
+
)
|
|
2449
2473
|
},
|
|
2450
2474
|
{
|
|
2451
2475
|
title: "OpensteerNetworkDetailOutput",
|
|
2452
2476
|
required: ["recordId", "summary", "requestHeaders", "responseHeaders"]
|
|
2453
2477
|
}
|
|
2454
2478
|
);
|
|
2455
|
-
|
|
2456
|
-
{
|
|
2457
|
-
transport: transportKindSchema,
|
|
2458
|
-
status: integerSchema({ minimum: 100, maximum: 599 }),
|
|
2459
|
-
ok: { type: "boolean" },
|
|
2460
|
-
durationMs: integerSchema({ minimum: 0 }),
|
|
2461
|
-
note: stringSchema(),
|
|
2462
|
-
error: stringSchema()
|
|
2463
|
-
},
|
|
2464
|
-
{
|
|
2465
|
-
title: "OpensteerReplayAttempt",
|
|
2466
|
-
required: ["transport", "ok", "durationMs"]
|
|
2467
|
-
}
|
|
2468
|
-
);
|
|
2469
|
-
var opensteerNetworkReplayInputSchema = objectSchema(
|
|
2479
|
+
objectSchema(
|
|
2470
2480
|
{
|
|
2471
2481
|
recordId: stringSchema({ minLength: 1 }),
|
|
2472
2482
|
pageRef: pageRefSchema,
|
|
@@ -2480,7 +2490,6 @@ var opensteerNetworkReplayInputSchema = objectSchema(
|
|
|
2480
2490
|
required: ["recordId"]
|
|
2481
2491
|
}
|
|
2482
2492
|
);
|
|
2483
|
-
var opensteerNetworkReplayOutputSchema;
|
|
2484
2493
|
var opensteerSessionFetchTransportSchema = enumSchema(
|
|
2485
2494
|
["auto", "direct", "matched-tls", "page"],
|
|
2486
2495
|
{
|
|
@@ -2822,7 +2831,7 @@ var opensteerRequestResponseResultSchema = objectSchema(
|
|
|
2822
2831
|
required: ["url", "status", "statusText", "headers", "redirected"]
|
|
2823
2832
|
}
|
|
2824
2833
|
);
|
|
2825
|
-
|
|
2834
|
+
objectSchema(
|
|
2826
2835
|
{
|
|
2827
2836
|
recordId: stringSchema({ minLength: 1 }),
|
|
2828
2837
|
transport: transportKindSchema,
|
|
@@ -5789,7 +5798,6 @@ var opensteerExposedSemanticOperationNames = [
|
|
|
5789
5798
|
"dom.extract",
|
|
5790
5799
|
"network.query",
|
|
5791
5800
|
"network.detail",
|
|
5792
|
-
"network.replay",
|
|
5793
5801
|
"interaction.capture",
|
|
5794
5802
|
"interaction.get",
|
|
5795
5803
|
"interaction.diff",
|
|
@@ -5826,7 +5834,6 @@ var opensteerPackageRunnableSemanticOperationNames = /* @__PURE__ */ new Set([
|
|
|
5826
5834
|
"dom.extract",
|
|
5827
5835
|
"network.query",
|
|
5828
5836
|
"network.detail",
|
|
5829
|
-
"network.replay",
|
|
5830
5837
|
"interaction.capture",
|
|
5831
5838
|
"interaction.get",
|
|
5832
5839
|
"interaction.diff",
|
|
@@ -5947,11 +5954,11 @@ var targetByElementSchema2 = objectSchema(
|
|
|
5947
5954
|
var targetByPersistSchema2 = objectSchema(
|
|
5948
5955
|
{
|
|
5949
5956
|
kind: enumSchema(["persist"]),
|
|
5950
|
-
|
|
5957
|
+
persist: stringSchema()
|
|
5951
5958
|
},
|
|
5952
5959
|
{
|
|
5953
5960
|
title: "OpensteerTargetByPersist",
|
|
5954
|
-
required: ["kind", "
|
|
5961
|
+
required: ["kind", "persist"]
|
|
5955
5962
|
}
|
|
5956
5963
|
);
|
|
5957
5964
|
var targetBySelectorSchema2 = objectSchema(
|
|
@@ -5998,8 +6005,7 @@ var opensteerResolvedTargetSchema = objectSchema(
|
|
|
5998
6005
|
var opensteerActionResultSchema = objectSchema(
|
|
5999
6006
|
{
|
|
6000
6007
|
target: opensteerResolvedTargetSchema,
|
|
6001
|
-
point: pointSchema
|
|
6002
|
-
persisted: stringSchema()
|
|
6008
|
+
point: pointSchema
|
|
6003
6009
|
},
|
|
6004
6010
|
{
|
|
6005
6011
|
title: "OpensteerActionResult",
|
|
@@ -6265,9 +6271,12 @@ var opensteerNetworkDetailInputSchema = objectSchema(
|
|
|
6265
6271
|
required: ["recordId"]
|
|
6266
6272
|
}
|
|
6267
6273
|
);
|
|
6268
|
-
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6269
|
-
|
|
6270
|
-
|
|
6274
|
+
var opensteerComputerMouseButtonSchema = enumSchema(
|
|
6275
|
+
["left", "middle", "right"],
|
|
6276
|
+
{
|
|
6277
|
+
title: "OpensteerComputerMouseButton"
|
|
6278
|
+
}
|
|
6279
|
+
);
|
|
6271
6280
|
var opensteerComputerKeyModifierSchema = enumSchema(
|
|
6272
6281
|
["Shift", "Control", "Alt", "Meta"],
|
|
6273
6282
|
{
|
|
@@ -6344,10 +6353,7 @@ var opensteerDomExtractInputSchema = defineSchema({
|
|
|
6344
6353
|
title: "OpensteerDomExtractInput"
|
|
6345
6354
|
}
|
|
6346
6355
|
),
|
|
6347
|
-
anyOf: [
|
|
6348
|
-
defineSchema({ required: ["persist"] }),
|
|
6349
|
-
defineSchema({ required: ["schema"] })
|
|
6350
|
-
]
|
|
6356
|
+
anyOf: [defineSchema({ required: ["persist"] }), defineSchema({ required: ["schema"] })]
|
|
6351
6357
|
});
|
|
6352
6358
|
var jsonValueSchema3 = recordSchema({}, { title: "JsonValueRecord" });
|
|
6353
6359
|
var opensteerDomExtractOutputSchema = objectSchema(
|
|
@@ -6727,13 +6733,6 @@ var opensteerSemanticOperationSpecificationsBase = [
|
|
|
6727
6733
|
outputSchema: opensteerNetworkDetailOutputSchema,
|
|
6728
6734
|
requiredCapabilities: ["inspect.network", "inspect.networkBodies"]
|
|
6729
6735
|
}),
|
|
6730
|
-
defineSemanticOperationSpec({
|
|
6731
|
-
name: "network.replay",
|
|
6732
|
-
description: "Replay a captured request through the transport ladder and report the transport that worked.",
|
|
6733
|
-
inputSchema: opensteerNetworkReplayInputSchema,
|
|
6734
|
-
outputSchema: opensteerNetworkReplayOutputSchema,
|
|
6735
|
-
requiredCapabilities: ["inspect.network", "inspect.cookies", "pages.manage"]
|
|
6736
|
-
}),
|
|
6737
6736
|
defineSemanticOperationSpec({
|
|
6738
6737
|
name: "interaction.capture",
|
|
6739
6738
|
description: "Capture a guarded interaction window, including event properties, state changes, and downstream network.",
|
|
@@ -10602,8 +10601,8 @@ function createDomDescriptorStore(options) {
|
|
|
10602
10601
|
}
|
|
10603
10602
|
return new MemoryDomDescriptorStore(namespace);
|
|
10604
10603
|
}
|
|
10605
|
-
function
|
|
10606
|
-
return sha256Hex2(
|
|
10604
|
+
function hashDomDescriptorPersist(persist) {
|
|
10605
|
+
return sha256Hex2(persist.trim());
|
|
10607
10606
|
}
|
|
10608
10607
|
var DOM_DESCRIPTOR_METHOD_ALIASES = Object.freeze({
|
|
10609
10608
|
click: "dom.click",
|
|
@@ -10617,14 +10616,14 @@ function normalizeDomDescriptorMethod(method) {
|
|
|
10617
10616
|
}
|
|
10618
10617
|
function buildDomDescriptorKeys(options) {
|
|
10619
10618
|
const namespace = normalizeDomDescriptorNamespace(options.namespace);
|
|
10620
|
-
const
|
|
10619
|
+
const persistHash = hashDomDescriptorPersist(options.persist);
|
|
10621
10620
|
const rawMethod = options.method.trim();
|
|
10622
10621
|
const canonicalMethod = normalizeDomDescriptorMethod(rawMethod);
|
|
10623
10622
|
const methods = /* @__PURE__ */ new Set([canonicalMethod]);
|
|
10624
10623
|
if (rawMethod.length > 0) {
|
|
10625
10624
|
methods.add(rawMethod);
|
|
10626
10625
|
}
|
|
10627
|
-
return [...methods].map((method) => `dom:${namespace}:${method}:${
|
|
10626
|
+
return [...methods].map((method) => `dom:${namespace}:${method}:${persistHash}`);
|
|
10628
10627
|
}
|
|
10629
10628
|
function buildDomDescriptorKey(options) {
|
|
10630
10629
|
return buildDomDescriptorKeys(options)[0];
|
|
@@ -10640,7 +10639,7 @@ function buildDomDescriptorPayload(input) {
|
|
|
10640
10639
|
return {
|
|
10641
10640
|
kind: "dom-target",
|
|
10642
10641
|
method: normalizeDomDescriptorMethod(input.method),
|
|
10643
|
-
|
|
10642
|
+
persist: input.persist,
|
|
10644
10643
|
path: sanitizeReplayElementPath(input.path),
|
|
10645
10644
|
...input.sourceUrl === void 0 ? {} : { sourceUrl: input.sourceUrl }
|
|
10646
10645
|
};
|
|
@@ -10657,8 +10656,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10657
10656
|
if (raw.kind !== "dom-target") {
|
|
10658
10657
|
return void 0;
|
|
10659
10658
|
}
|
|
10660
|
-
|
|
10661
|
-
if (typeof raw.method !== "string" || name === void 0) {
|
|
10659
|
+
if (typeof raw.method !== "string" || typeof raw.persist !== "string") {
|
|
10662
10660
|
return void 0;
|
|
10663
10661
|
}
|
|
10664
10662
|
if (!raw.path || typeof raw.path !== "object" || Array.isArray(raw.path)) {
|
|
@@ -10670,7 +10668,7 @@ function parseDomDescriptorRecord(record) {
|
|
|
10670
10668
|
const normalizedPayload = {
|
|
10671
10669
|
kind: "dom-target",
|
|
10672
10670
|
method: normalizeDomDescriptorMethod(raw.method),
|
|
10673
|
-
|
|
10671
|
+
persist: raw.persist,
|
|
10674
10672
|
path: sanitizeReplayElementPath(raw.path),
|
|
10675
10673
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
10676
10674
|
};
|
|
@@ -10692,7 +10690,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10692
10690
|
for (const key of buildDomDescriptorKeys({
|
|
10693
10691
|
namespace: this.namespace,
|
|
10694
10692
|
method: input.method,
|
|
10695
|
-
|
|
10693
|
+
persist: input.persist
|
|
10696
10694
|
})) {
|
|
10697
10695
|
const record = await this.registry.resolve({ key });
|
|
10698
10696
|
if (!record) {
|
|
@@ -10707,7 +10705,7 @@ var FilesystemDomDescriptorStore = class {
|
|
|
10707
10705
|
const key = buildDomDescriptorKey({
|
|
10708
10706
|
namespace: this.namespace,
|
|
10709
10707
|
method: input.method,
|
|
10710
|
-
|
|
10708
|
+
persist: input.persist
|
|
10711
10709
|
});
|
|
10712
10710
|
const version = buildDomDescriptorVersion(payload);
|
|
10713
10711
|
const existing = await this.registry.resolve({ key, version });
|
|
@@ -10750,7 +10748,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10750
10748
|
for (const key of buildDomDescriptorKeys({
|
|
10751
10749
|
namespace: this.namespace,
|
|
10752
10750
|
method: input.method,
|
|
10753
|
-
|
|
10751
|
+
persist: input.persist
|
|
10754
10752
|
})) {
|
|
10755
10753
|
const record = this.latestByKey.get(key);
|
|
10756
10754
|
if (record) {
|
|
@@ -10764,7 +10762,7 @@ var MemoryDomDescriptorStore = class {
|
|
|
10764
10762
|
const key = buildDomDescriptorKey({
|
|
10765
10763
|
namespace: this.namespace,
|
|
10766
10764
|
method: input.method,
|
|
10767
|
-
|
|
10765
|
+
persist: input.persist
|
|
10768
10766
|
});
|
|
10769
10767
|
const version = buildDomDescriptorVersion(payload);
|
|
10770
10768
|
const existing = this.recordsByKey.get(key)?.get(version);
|
|
@@ -11696,15 +11694,15 @@ var DefaultDomRuntime = class {
|
|
|
11696
11694
|
async resolveDescriptorTarget(session, pageRef, method, target) {
|
|
11697
11695
|
const descriptor = await this.descriptors.read({
|
|
11698
11696
|
method,
|
|
11699
|
-
|
|
11697
|
+
persist: target.persist
|
|
11700
11698
|
});
|
|
11701
11699
|
if (!descriptor) {
|
|
11702
11700
|
throw new OpensteerProtocolError(
|
|
11703
11701
|
"not-found",
|
|
11704
|
-
`no stored DOM descriptor found for "${target.
|
|
11702
|
+
`no stored DOM descriptor found for "${target.persist}"`,
|
|
11705
11703
|
{
|
|
11706
11704
|
details: {
|
|
11707
|
-
|
|
11705
|
+
persist: target.persist,
|
|
11708
11706
|
kind: "dom-descriptor"
|
|
11709
11707
|
}
|
|
11710
11708
|
}
|
|
@@ -11718,7 +11716,7 @@ var DefaultDomRuntime = class {
|
|
|
11718
11716
|
pageRef,
|
|
11719
11717
|
descriptor.payload.path,
|
|
11720
11718
|
"descriptor",
|
|
11721
|
-
descriptor.payload.
|
|
11719
|
+
descriptor.payload.persist,
|
|
11722
11720
|
descriptor
|
|
11723
11721
|
);
|
|
11724
11722
|
}
|
|
@@ -11748,7 +11746,7 @@ var DefaultDomRuntime = class {
|
|
|
11748
11746
|
const replayPath = await this.tryBuildPathFromNode(snapshot, node);
|
|
11749
11747
|
const descriptor = target.persist === void 0 ? void 0 : await writeDescriptor({
|
|
11750
11748
|
method,
|
|
11751
|
-
|
|
11749
|
+
persist: target.persist,
|
|
11752
11750
|
path: replayPath ?? await this.buildPathForNode(snapshot, node),
|
|
11753
11751
|
sourceUrl: snapshot.url
|
|
11754
11752
|
});
|
|
@@ -14764,8 +14762,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14764
14762
|
return void 0;
|
|
14765
14763
|
}
|
|
14766
14764
|
const raw = payload;
|
|
14767
|
-
|
|
14768
|
-
if (raw.kind !== "dom-extraction" || typeof persist !== "string") {
|
|
14765
|
+
if (raw.kind !== "dom-extraction" || typeof raw.persist !== "string") {
|
|
14769
14766
|
return void 0;
|
|
14770
14767
|
}
|
|
14771
14768
|
const root = normalizePersistedExtractionNode(raw.root, "root");
|
|
@@ -14780,7 +14777,7 @@ function parseExtractionDescriptorRecord(record) {
|
|
|
14780
14777
|
updatedAt: record.updatedAt,
|
|
14781
14778
|
payload: {
|
|
14782
14779
|
kind: "dom-extraction",
|
|
14783
|
-
persist,
|
|
14780
|
+
persist: raw.persist,
|
|
14784
14781
|
root,
|
|
14785
14782
|
...typeof raw.schemaHash === "string" ? { schemaHash: raw.schemaHash } : {},
|
|
14786
14783
|
...typeof raw.sourceUrl === "string" ? { sourceUrl: raw.sourceUrl } : {}
|
|
@@ -16035,7 +16032,7 @@ function ensureSparseCountersForAllRecords(counterRecords) {
|
|
|
16035
16032
|
)
|
|
16036
16033
|
);
|
|
16037
16034
|
}
|
|
16038
|
-
async function
|
|
16035
|
+
async function clearOpensteerLiveCounters(engine, pageRef) {
|
|
16039
16036
|
const frames = await engine.listFrames({ pageRef });
|
|
16040
16037
|
const failures = [];
|
|
16041
16038
|
for (const frame of frames) {
|
|
@@ -16133,7 +16130,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16133
16130
|
engine: options.engine,
|
|
16134
16131
|
pageRef: options.pageRef
|
|
16135
16132
|
});
|
|
16136
|
-
await
|
|
16133
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef);
|
|
16137
16134
|
await assignSparseCountersToLiveDom(options.engine, options.pageRef);
|
|
16138
16135
|
const pageInfo = await options.engine.getPageInfo({ pageRef: options.pageRef });
|
|
16139
16136
|
const mainSnapshot = await getMainDocumentSnapshot(options.engine, options.pageRef);
|
|
@@ -16170,7 +16167,7 @@ async function compileOpensteerSnapshot(options) {
|
|
|
16170
16167
|
counters: [...compiledHtml.counterRecords.values()].map(toPublicCounterRecord)
|
|
16171
16168
|
};
|
|
16172
16169
|
} catch (error) {
|
|
16173
|
-
await
|
|
16170
|
+
await clearOpensteerLiveCounters(options.engine, options.pageRef).catch(() => void 0);
|
|
16174
16171
|
if (attempt < MAX_LIVE_COUNTER_SYNC_ATTEMPTS && isLiveCounterSyncError(error)) {
|
|
16175
16172
|
lastCounterSyncError = error;
|
|
16176
16173
|
continue;
|
|
@@ -18753,7 +18750,12 @@ var OpensteerSessionRuntime = class {
|
|
|
18753
18750
|
includeBodies: true,
|
|
18754
18751
|
redactSecretHeaders: false
|
|
18755
18752
|
});
|
|
18756
|
-
|
|
18753
|
+
const detail = await this.buildNetworkDetail(record, timeout);
|
|
18754
|
+
if (input.probe !== true) {
|
|
18755
|
+
return detail;
|
|
18756
|
+
}
|
|
18757
|
+
const transportProbe = await this.probeTransportsForRecord(record, timeout);
|
|
18758
|
+
return transportProbe === void 0 ? detail : { ...detail, transportProbe };
|
|
18757
18759
|
},
|
|
18758
18760
|
options
|
|
18759
18761
|
);
|
|
@@ -18788,54 +18790,6 @@ var OpensteerSessionRuntime = class {
|
|
|
18788
18790
|
throw error;
|
|
18789
18791
|
}
|
|
18790
18792
|
}
|
|
18791
|
-
async replayNetwork(input, options = {}) {
|
|
18792
|
-
const startedAt = Date.now();
|
|
18793
|
-
try {
|
|
18794
|
-
const output = await this.runWithOperationTimeout(
|
|
18795
|
-
"network.replay",
|
|
18796
|
-
async (timeout) => {
|
|
18797
|
-
const source = await this.resolveNetworkRecordByRecordId(input.recordId, timeout, {
|
|
18798
|
-
includeBodies: true,
|
|
18799
|
-
redactSecretHeaders: false
|
|
18800
|
-
});
|
|
18801
|
-
const replayRequest = buildReplayTransportRequest(source, input);
|
|
18802
|
-
return this.executeNetworkReplay(source, replayRequest, timeout, {
|
|
18803
|
-
...input.pageRef === void 0 ? {} : { pageRef: input.pageRef }
|
|
18804
|
-
});
|
|
18805
|
-
},
|
|
18806
|
-
options
|
|
18807
|
-
);
|
|
18808
|
-
await this.appendTrace({
|
|
18809
|
-
operation: "network.replay",
|
|
18810
|
-
startedAt,
|
|
18811
|
-
completedAt: Date.now(),
|
|
18812
|
-
outcome: "ok",
|
|
18813
|
-
data: {
|
|
18814
|
-
recordId: input.recordId,
|
|
18815
|
-
transport: output.transport,
|
|
18816
|
-
attempts: output.attempts.length
|
|
18817
|
-
},
|
|
18818
|
-
context: buildRuntimeTraceContext({
|
|
18819
|
-
sessionRef: this.sessionRef,
|
|
18820
|
-
pageRef: this.pageRef
|
|
18821
|
-
})
|
|
18822
|
-
});
|
|
18823
|
-
return output;
|
|
18824
|
-
} catch (error) {
|
|
18825
|
-
await this.appendTrace({
|
|
18826
|
-
operation: "network.replay",
|
|
18827
|
-
startedAt,
|
|
18828
|
-
completedAt: Date.now(),
|
|
18829
|
-
outcome: "error",
|
|
18830
|
-
error,
|
|
18831
|
-
context: buildRuntimeTraceContext({
|
|
18832
|
-
sessionRef: this.sessionRef,
|
|
18833
|
-
pageRef: this.pageRef
|
|
18834
|
-
})
|
|
18835
|
-
});
|
|
18836
|
-
throw error;
|
|
18837
|
-
}
|
|
18838
|
-
}
|
|
18839
18793
|
async captureScripts(input = {}, options = {}) {
|
|
18840
18794
|
assertValidSemanticOperationInput("scripts.capture", input);
|
|
18841
18795
|
const pageRef = input.pageRef ?? await this.ensurePageRef();
|
|
@@ -19431,7 +19385,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19431
19385
|
completedAt: Date.now(),
|
|
19432
19386
|
outcome: "ok",
|
|
19433
19387
|
data: {
|
|
19434
|
-
transport: output.transport,
|
|
19388
|
+
...output.transport === void 0 ? {} : { transport: output.transport },
|
|
19435
19389
|
attempts: output.attempts.length,
|
|
19436
19390
|
...output.response === void 0 ? {} : { status: output.response.status },
|
|
19437
19391
|
url: input.url
|
|
@@ -19534,6 +19488,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19534
19488
|
});
|
|
19535
19489
|
boundaryDiagnostics = takeActionBoundaryDiagnostics(timeout.signal);
|
|
19536
19490
|
timeout.throwIfAborted();
|
|
19491
|
+
await this.invalidateLiveSnapshotCounters([pageRef, output2.pageRef], timeout);
|
|
19537
19492
|
this.pageRef = output2.pageRef;
|
|
19538
19493
|
const artifacts2 = await this.persistComputerArtifacts(output2, timeout);
|
|
19539
19494
|
return {
|
|
@@ -19723,7 +19678,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19723
19678
|
mutationCaptureDiagnostics = diagnostics;
|
|
19724
19679
|
}
|
|
19725
19680
|
);
|
|
19726
|
-
const output = toOpensteerActionResult(executed.result
|
|
19681
|
+
const output = toOpensteerActionResult(executed.result);
|
|
19727
19682
|
const actionEvents = "events" in executed.result ? executed.result.events : void 0;
|
|
19728
19683
|
await this.appendTrace({
|
|
19729
19684
|
operation,
|
|
@@ -19734,7 +19689,6 @@ var OpensteerSessionRuntime = class {
|
|
|
19734
19689
|
data: {
|
|
19735
19690
|
target: output.target,
|
|
19736
19691
|
...output.point === void 0 ? {} : { point: output.point },
|
|
19737
|
-
...output.persisted === void 0 ? {} : { persisted: output.persisted },
|
|
19738
19692
|
...boundaryDiagnostics === void 0 ? {} : { settle: boundaryDiagnostics },
|
|
19739
19693
|
...buildMutationCaptureTraceData(mutationCaptureDiagnostics)
|
|
19740
19694
|
},
|
|
@@ -19798,7 +19752,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19798
19752
|
await timeout.runStep(
|
|
19799
19753
|
() => this.requireDom().writeDescriptor({
|
|
19800
19754
|
method,
|
|
19801
|
-
|
|
19755
|
+
persist,
|
|
19802
19756
|
path: stablePath2,
|
|
19803
19757
|
sourceUrl: resolved2.snapshot.url
|
|
19804
19758
|
})
|
|
@@ -19806,9 +19760,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19806
19760
|
return {
|
|
19807
19761
|
target: {
|
|
19808
19762
|
kind: "descriptor",
|
|
19809
|
-
|
|
19810
|
-
}
|
|
19811
|
-
persisted: persist
|
|
19763
|
+
persist
|
|
19764
|
+
}
|
|
19812
19765
|
};
|
|
19813
19766
|
}
|
|
19814
19767
|
const resolved = await timeout.runStep(
|
|
@@ -19831,7 +19784,7 @@ var OpensteerSessionRuntime = class {
|
|
|
19831
19784
|
await timeout.runStep(
|
|
19832
19785
|
() => this.requireDom().writeDescriptor({
|
|
19833
19786
|
method,
|
|
19834
|
-
|
|
19787
|
+
persist,
|
|
19835
19788
|
path: stablePath,
|
|
19836
19789
|
sourceUrl: resolved.snapshot.url
|
|
19837
19790
|
})
|
|
@@ -19839,9 +19792,8 @@ var OpensteerSessionRuntime = class {
|
|
|
19839
19792
|
return {
|
|
19840
19793
|
target: {
|
|
19841
19794
|
kind: "descriptor",
|
|
19842
|
-
|
|
19843
|
-
}
|
|
19844
|
-
persisted: persist
|
|
19795
|
+
persist
|
|
19796
|
+
}
|
|
19845
19797
|
};
|
|
19846
19798
|
}
|
|
19847
19799
|
async queryLiveNetwork(input, timeout, options = {}) {
|
|
@@ -19897,6 +19849,18 @@ var OpensteerSessionRuntime = class {
|
|
|
19897
19849
|
const byRequestId = new Map(withBodies.map((record) => [record.record.requestId, record]));
|
|
19898
19850
|
return limited.map((record) => byRequestId.get(record.record.requestId) ?? record);
|
|
19899
19851
|
}
|
|
19852
|
+
async invalidateLiveSnapshotCounters(pageRefs, timeout) {
|
|
19853
|
+
const engine = this.requireEngine();
|
|
19854
|
+
for (const pageRef of new Set(pageRefs)) {
|
|
19855
|
+
try {
|
|
19856
|
+
await timeout.runStep(() => clearOpensteerLiveCounters(engine, pageRef));
|
|
19857
|
+
} catch (error) {
|
|
19858
|
+
if (!isIgnorableRuntimeBindingError(error)) {
|
|
19859
|
+
throw error;
|
|
19860
|
+
}
|
|
19861
|
+
}
|
|
19862
|
+
}
|
|
19863
|
+
}
|
|
19900
19864
|
async captureScriptsInternal(pageRef, input, timeout) {
|
|
19901
19865
|
const root = await this.ensureRoot();
|
|
19902
19866
|
const evaluated = await timeout.runStep(
|
|
@@ -20226,6 +20190,42 @@ var OpensteerSessionRuntime = class {
|
|
|
20226
20190
|
...notes.length === 0 ? {} : { notes }
|
|
20227
20191
|
};
|
|
20228
20192
|
}
|
|
20193
|
+
async probeTransportsForRecord(record, timeout) {
|
|
20194
|
+
if (record.record.status === void 0) {
|
|
20195
|
+
return void 0;
|
|
20196
|
+
}
|
|
20197
|
+
const request = buildReplayTransportRequest(record, { recordId: record.recordId });
|
|
20198
|
+
const fingerprint = buildCapturedRecordSuccessFingerprint(record);
|
|
20199
|
+
const attempts = [];
|
|
20200
|
+
let recommended;
|
|
20201
|
+
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20202
|
+
const attemptStartedAt = Date.now();
|
|
20203
|
+
try {
|
|
20204
|
+
const output = await this.executeReplayTransportAttempt(transport, request, timeout);
|
|
20205
|
+
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20206
|
+
attempts.push({
|
|
20207
|
+
transport,
|
|
20208
|
+
status: output.response.status,
|
|
20209
|
+
ok,
|
|
20210
|
+
durationMs: Date.now() - attemptStartedAt
|
|
20211
|
+
});
|
|
20212
|
+
if (ok && recommended === void 0) {
|
|
20213
|
+
recommended = transport;
|
|
20214
|
+
}
|
|
20215
|
+
} catch (error) {
|
|
20216
|
+
attempts.push({
|
|
20217
|
+
transport,
|
|
20218
|
+
ok: false,
|
|
20219
|
+
durationMs: Date.now() - attemptStartedAt,
|
|
20220
|
+
error: normalizeRuntimeErrorMessage(error)
|
|
20221
|
+
});
|
|
20222
|
+
}
|
|
20223
|
+
}
|
|
20224
|
+
return {
|
|
20225
|
+
...recommended === void 0 ? {} : { recommended },
|
|
20226
|
+
attempts
|
|
20227
|
+
};
|
|
20228
|
+
}
|
|
20229
20229
|
async buildRedirectChain(record, timeout) {
|
|
20230
20230
|
if (record.record.redirectFromRequestId === void 0 && record.record.redirectToRequestId === void 0) {
|
|
20231
20231
|
return {};
|
|
@@ -20344,57 +20344,6 @@ var OpensteerSessionRuntime = class {
|
|
|
20344
20344
|
})
|
|
20345
20345
|
};
|
|
20346
20346
|
}
|
|
20347
|
-
async executeNetworkReplay(source, request, timeout, options) {
|
|
20348
|
-
const fingerprint = buildCapturedRecordSuccessFingerprint(source);
|
|
20349
|
-
const attempts = [];
|
|
20350
|
-
let lastOutput;
|
|
20351
|
-
for (const transport of REPLAY_TRANSPORT_LADDER) {
|
|
20352
|
-
const attemptStartedAt = Date.now();
|
|
20353
|
-
try {
|
|
20354
|
-
const output = await this.executeReplayTransportAttempt(
|
|
20355
|
-
transport,
|
|
20356
|
-
request,
|
|
20357
|
-
timeout,
|
|
20358
|
-
options.pageRef
|
|
20359
|
-
);
|
|
20360
|
-
lastOutput = output;
|
|
20361
|
-
const ok = matchesSuccessFingerprintFromProtocolResponse(output.response, fingerprint);
|
|
20362
|
-
attempts.push({
|
|
20363
|
-
transport,
|
|
20364
|
-
status: output.response.status,
|
|
20365
|
-
ok,
|
|
20366
|
-
durationMs: Date.now() - attemptStartedAt
|
|
20367
|
-
});
|
|
20368
|
-
if (ok) {
|
|
20369
|
-
const fallbackNote = attempts.length > 1 ? buildReplayFallbackNote(attempts, transport) : void 0;
|
|
20370
|
-
const previewData2 = toStructuredPreviewData(output.data);
|
|
20371
|
-
return {
|
|
20372
|
-
recordId: source.recordId,
|
|
20373
|
-
transport,
|
|
20374
|
-
attempts,
|
|
20375
|
-
response: output.response,
|
|
20376
|
-
...previewData2 === void 0 ? {} : { data: previewData2 },
|
|
20377
|
-
...fallbackNote === void 0 ? {} : { note: fallbackNote }
|
|
20378
|
-
};
|
|
20379
|
-
}
|
|
20380
|
-
} catch (error) {
|
|
20381
|
-
attempts.push({
|
|
20382
|
-
transport,
|
|
20383
|
-
ok: false,
|
|
20384
|
-
durationMs: Date.now() - attemptStartedAt,
|
|
20385
|
-
error: normalizeRuntimeErrorMessage(error)
|
|
20386
|
-
});
|
|
20387
|
-
}
|
|
20388
|
-
}
|
|
20389
|
-
const previewData = toStructuredPreviewData(lastOutput?.data);
|
|
20390
|
-
return {
|
|
20391
|
-
recordId: source.recordId,
|
|
20392
|
-
attempts,
|
|
20393
|
-
...lastOutput?.response === void 0 ? {} : { response: lastOutput.response },
|
|
20394
|
-
...previewData === void 0 ? {} : { data: previewData },
|
|
20395
|
-
note: "all replay transports failed to reproduce the captured response"
|
|
20396
|
-
};
|
|
20397
|
-
}
|
|
20398
20347
|
async executeSessionFetch(request, input, timeout) {
|
|
20399
20348
|
const attempts = [];
|
|
20400
20349
|
let lastOutput;
|
|
@@ -21022,7 +20971,7 @@ var OpensteerSessionRuntime = class {
|
|
|
21022
20971
|
if (target.kind === "persist") {
|
|
21023
20972
|
return {
|
|
21024
20973
|
kind: "descriptor",
|
|
21025
|
-
|
|
20974
|
+
persist: target.persist
|
|
21026
20975
|
};
|
|
21027
20976
|
}
|
|
21028
20977
|
if (target.kind === "selector") {
|
|
@@ -22739,7 +22688,7 @@ function normalizeNamespace2(value) {
|
|
|
22739
22688
|
const normalized = String(value ?? "default").trim();
|
|
22740
22689
|
return normalized.length === 0 ? "default" : normalized;
|
|
22741
22690
|
}
|
|
22742
|
-
function toOpensteerActionResult(result
|
|
22691
|
+
function toOpensteerActionResult(result) {
|
|
22743
22692
|
return {
|
|
22744
22693
|
target: toOpensteerResolvedTarget2(result.resolved),
|
|
22745
22694
|
...result.point === void 0 ? {} : {
|
|
@@ -22747,8 +22696,7 @@ function toOpensteerActionResult(result, persisted) {
|
|
|
22747
22696
|
x: result.point.x,
|
|
22748
22697
|
y: result.point.y
|
|
22749
22698
|
}
|
|
22750
|
-
}
|
|
22751
|
-
...persisted === void 0 ? {} : { persisted }
|
|
22699
|
+
}
|
|
22752
22700
|
};
|
|
22753
22701
|
}
|
|
22754
22702
|
function toOpensteerResolvedTarget2(target) {
|
|
@@ -22998,11 +22946,6 @@ async function dispatchSemanticOperation(runtime, operation, input, options = {}
|
|
|
22998
22946
|
input,
|
|
22999
22947
|
options
|
|
23000
22948
|
);
|
|
23001
|
-
case "network.replay":
|
|
23002
|
-
return runtime.replayNetwork(
|
|
23003
|
-
input,
|
|
23004
|
-
options
|
|
23005
|
-
);
|
|
23006
22949
|
case "interaction.capture":
|
|
23007
22950
|
return runtime.captureInteraction(
|
|
23008
22951
|
input,
|
|
@@ -24862,7 +24805,7 @@ exports.createObservationStore = createObservationStore;
|
|
|
24862
24805
|
exports.createOpensteerExtractionDescriptorStore = createOpensteerExtractionDescriptorStore;
|
|
24863
24806
|
exports.dispatchSemanticOperation = dispatchSemanticOperation;
|
|
24864
24807
|
exports.generateReplayScript = generateReplayScript;
|
|
24865
|
-
exports.
|
|
24808
|
+
exports.hashDomDescriptorPersist = hashDomDescriptorPersist;
|
|
24866
24809
|
exports.manifestToExternalBinaryLocation = manifestToExternalBinaryLocation;
|
|
24867
24810
|
exports.normalizeObservabilityConfig = normalizeObservabilityConfig;
|
|
24868
24811
|
exports.normalizeWorkspaceId = normalizeWorkspaceId;
|