@sagentlab/navarch-runtime 0.1.140 → 0.1.141
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/local-browser.cjs +9 -3
- package/package.json +1 -1
package/dist/local-browser.cjs
CHANGED
|
@@ -97,6 +97,7 @@ function createLocalBrowser(options) {
|
|
|
97
97
|
await context?.close().catch(() => undefined);
|
|
98
98
|
context = undefined;
|
|
99
99
|
page = undefined;
|
|
100
|
+
notes = [];
|
|
100
101
|
try {
|
|
101
102
|
browser ??= await options.launch();
|
|
102
103
|
}
|
|
@@ -159,14 +160,20 @@ function createLocalBrowser(options) {
|
|
|
159
160
|
}
|
|
160
161
|
if (tree.length > MAX_SNAPSHOT_CHARS)
|
|
161
162
|
tree = `${tree.slice(0, MAX_SNAPSHOT_CHARS)}\n… (truncated)`;
|
|
163
|
+
const title = await active.title().catch(() => "");
|
|
164
|
+
// Take the notes only after the last await, so a tab that opens while
|
|
165
|
+
// this snapshot is being built is reported here (its body may still show
|
|
166
|
+
// the previous tab) instead of being cleared unreported.
|
|
167
|
+
const reported = notes;
|
|
168
|
+
notes = [];
|
|
162
169
|
const lines = [
|
|
163
170
|
...(heading ? [heading] : []),
|
|
164
|
-
...
|
|
171
|
+
...reported,
|
|
165
172
|
...(active.url().startsWith("chrome-error://")
|
|
166
173
|
? ["The last navigation failed or tried to leave this machine and was blocked. Use local_browser_open to continue."]
|
|
167
174
|
: []),
|
|
168
175
|
`URL: ${active.url()}`,
|
|
169
|
-
`Title: ${
|
|
176
|
+
`Title: ${title}`,
|
|
170
177
|
`Viewport: ${viewport}`,
|
|
171
178
|
...(logs.length ? ["Recent console/page errors:", ...logs.map((line) => ` ${line}`)] : []),
|
|
172
179
|
...(blocked.size
|
|
@@ -175,7 +182,6 @@ function createLocalBrowser(options) {
|
|
|
175
182
|
"",
|
|
176
183
|
tree,
|
|
177
184
|
];
|
|
178
|
-
notes = [];
|
|
179
185
|
return [{ type: "text", text: lines.join("\n") }];
|
|
180
186
|
}
|
|
181
187
|
/** Runs tool calls one at a time; a lease ending stops further use. */
|
package/package.json
CHANGED