poe-code 17.0.38 → 17.0.39
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/package.json
CHANGED
|
@@ -34,8 +34,18 @@ export function observePlaywrightCapabilities(context, registerCleanup, limits)
|
|
|
34
34
|
history.set(record, { bytes: size, evict });
|
|
35
35
|
if (size > state.maxBytes)
|
|
36
36
|
forget(record);
|
|
37
|
-
while (history.size > (limits.maxEventEntries ?? Infinity) || bytes > state.maxBytes)
|
|
38
|
-
|
|
37
|
+
while (history.size > (limits.maxEventEntries ?? Infinity) || bytes > state.maxBytes) {
|
|
38
|
+
// Preserve active navigation metadata ahead of rolling diagnostics, while
|
|
39
|
+
// still applying the configured byte and entry budgets to every record.
|
|
40
|
+
let diagnostic;
|
|
41
|
+
for (const record of history.keys()) {
|
|
42
|
+
if (!('mainFrameNavigation' in record) || !record.mainFrameNavigation) {
|
|
43
|
+
diagnostic = record;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
forget(diagnostic ?? history.keys().next().value);
|
|
48
|
+
}
|
|
39
49
|
};
|
|
40
50
|
const byteLength = (text) => new TextEncoder().encode(text).byteLength;
|
|
41
51
|
const pageEvents = (page) => {
|
|
@@ -969,12 +969,7 @@ export function createPlaywrightController(options = {}) {
|
|
|
969
969
|
return { sections };
|
|
970
970
|
}
|
|
971
971
|
sections.push(...await downloadSections(session));
|
|
972
|
-
|
|
973
|
-
const consoleLink = await flushPlaywrightConsole(session.lease.context, page, { ...(session.configuration ? { configuration: session.configuration } : {}), writeArtifact });
|
|
974
|
-
if (consoleLink)
|
|
975
|
-
sections.push({ title: 'Events', content: `- New console entries: ${consoleLink}` });
|
|
976
|
-
}
|
|
977
|
-
const pageSectionIndex = sections.length;
|
|
972
|
+
let pageSectionIndex = sections.length;
|
|
978
973
|
if (snapshot !== 'none' && (page.frames || page.ariaSnapshot || page._snapshotForAI || page.ariaSnapshotJSON || session.lease?.captureSnapshotJSON)) {
|
|
979
974
|
const snapshotOptions = { timeout: sessionSnapshotTimeout(session), ...(session.configuration?.snapshot?.boxes === undefined ? {} : { boxes: session.configuration.snapshot.boxes }), ...(session.lease?.captureSnapshotReferences ? { captureReferences: session.lease.captureSnapshotReferences } : {}) };
|
|
980
975
|
if (parsed.command === 'snapshot') {
|
|
@@ -986,18 +981,24 @@ export function createPlaywrightController(options = {}) {
|
|
|
986
981
|
}
|
|
987
982
|
if (parsed.options.boxes)
|
|
988
983
|
snapshotOptions.boxes = true;
|
|
989
|
-
if (parsed.args[0])
|
|
990
|
-
snapshotOptions.root = await resolveTarget(session, parsed.args[0]);
|
|
991
984
|
}
|
|
992
985
|
const captureWithHook = async (format, capture) => {
|
|
993
986
|
let active = true;
|
|
994
|
-
|
|
987
|
+
let pending = Promise.resolve();
|
|
988
|
+
const recapture = () => {
|
|
995
989
|
if (!active)
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
990
|
+
return Promise.reject(new Error('Playwright snapshot hook has completed'));
|
|
991
|
+
const operation = pending.then(async () => {
|
|
992
|
+
check();
|
|
993
|
+
if (parsed.command === 'snapshot' && parsed.args[0])
|
|
994
|
+
snapshotOptions.root = await resolveTarget(session, parsed.args[0]);
|
|
995
|
+
const value = await capture();
|
|
996
|
+
check();
|
|
997
|
+
return value;
|
|
998
|
+
});
|
|
999
|
+
// Observe failures immediately, and serialize all admitted captures.
|
|
1000
|
+
pending = operation.then(() => { }, () => { });
|
|
1001
|
+
return operation;
|
|
1001
1002
|
};
|
|
1002
1003
|
try {
|
|
1003
1004
|
const initial = await recapture();
|
|
@@ -1011,6 +1012,7 @@ export function createPlaywrightController(options = {}) {
|
|
|
1011
1012
|
}
|
|
1012
1013
|
finally {
|
|
1013
1014
|
active = false;
|
|
1015
|
+
await pending;
|
|
1014
1016
|
}
|
|
1015
1017
|
};
|
|
1016
1018
|
retained = false;
|
|
@@ -1019,24 +1021,30 @@ export function createPlaywrightController(options = {}) {
|
|
|
1019
1021
|
check();
|
|
1020
1022
|
retained = parsed.command === 'snapshot';
|
|
1021
1023
|
sections.push({ title: 'Snapshot', content: { json: tree }, codeframe: 'json' });
|
|
1022
|
-
return { sections };
|
|
1023
1024
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1025
|
+
else {
|
|
1026
|
+
retained = false;
|
|
1027
|
+
const text = await captureWithHook('yaml', () => session.snapshot.capture(page, local.signal, snapshotOptions));
|
|
1028
|
+
check();
|
|
1029
|
+
retained = parsed.command === 'snapshot';
|
|
1030
|
+
if (filename !== undefined || snapshot === 'file' && invocation.writeArtifact) {
|
|
1031
|
+
const target = filename ?? capabilityArtifactName('page', 'yml', session.configuration);
|
|
1032
|
+
const bytes = new TextEncoder().encode(text);
|
|
1033
|
+
if (bytes.byteLength > maxArtifactBytes)
|
|
1034
|
+
throw new PlaywrightResourceLimitError('Artifact byte limit exceeded');
|
|
1035
|
+
if (!invocation.writeArtifact)
|
|
1036
|
+
throw new Error('Artifact byte destination unsupported');
|
|
1037
|
+
await writeArtifact(bytes, target);
|
|
1038
|
+
sections.push({ title: 'Snapshot', content: `- [Snapshot](${target})` });
|
|
1039
|
+
}
|
|
1040
|
+
else
|
|
1041
|
+
sections.push({ title: 'Snapshot', content: text.trimEnd(), codeframe: 'yaml' });
|
|
1037
1042
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1043
|
+
}
|
|
1044
|
+
if (invocation.writeArtifact) {
|
|
1045
|
+
const consoleLink = await flushPlaywrightConsole(session.lease.context, page, { ...(session.configuration ? { configuration: session.configuration } : {}), writeArtifact });
|
|
1046
|
+
if (consoleLink)
|
|
1047
|
+
sections.splice(pageSectionIndex++, 0, { title: 'Events', content: `- New console entries: ${consoleLink}` });
|
|
1040
1048
|
}
|
|
1041
1049
|
if (parsed.command !== 'snapshot' || !parsed.json) {
|
|
1042
1050
|
const title = await page.title?.();
|