@narumitw/pi-chrome-devtools 0.5.0 → 0.6.0
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 +1 -1
- package/src/chrome-devtools.ts +5 -5
package/package.json
CHANGED
package/src/chrome-devtools.ts
CHANGED
|
@@ -193,7 +193,7 @@ const listPagesTool = defineTool({
|
|
|
193
193
|
renderCall: renderToolCall("list pages"),
|
|
194
194
|
renderResult: renderTextResult,
|
|
195
195
|
async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
|
|
196
|
-
return withStatus(ctx, "
|
|
196
|
+
return withStatus(ctx, "list pages", async () => {
|
|
197
197
|
const pages = await listPages();
|
|
198
198
|
return textResult(JSON.stringify(pages.map(formatPage), null, 2), { pages });
|
|
199
199
|
});
|
|
@@ -211,7 +211,7 @@ const selectPageTool = defineTool({
|
|
|
211
211
|
renderCall: renderToolCall("select page"),
|
|
212
212
|
renderResult: renderTextResult,
|
|
213
213
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
214
|
-
return withStatus(ctx, "
|
|
214
|
+
return withStatus(ctx, "select page", async () => {
|
|
215
215
|
const page = await getPage(params.pageId);
|
|
216
216
|
state.activePageId = page.id;
|
|
217
217
|
return textResult(`Selected page ${page.id}: ${page.title}\n${page.url}`, {
|
|
@@ -236,7 +236,7 @@ const navigateTool = defineTool({
|
|
|
236
236
|
renderCall: renderToolCall("navigate"),
|
|
237
237
|
renderResult: renderTextResult,
|
|
238
238
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
239
|
-
return withStatus(ctx, "
|
|
239
|
+
return withStatus(ctx, "navigate", async () => {
|
|
240
240
|
const { created, page } = await resolvePageForNavigation(params.pageId);
|
|
241
241
|
const result = await withCdp(page, async (client) => {
|
|
242
242
|
await client.send("Page.enable");
|
|
@@ -271,7 +271,7 @@ const evaluateTool = defineTool({
|
|
|
271
271
|
renderCall: renderToolCall("evaluate"),
|
|
272
272
|
renderResult: renderTextResult,
|
|
273
273
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
274
|
-
return withStatus(ctx, "
|
|
274
|
+
return withStatus(ctx, "evaluate", async () => {
|
|
275
275
|
const page = await resolvePage(params.pageId);
|
|
276
276
|
const result = await withCdp(page, (client) =>
|
|
277
277
|
client.send("Runtime.evaluate", {
|
|
@@ -309,7 +309,7 @@ const screenshotTool = defineTool({
|
|
|
309
309
|
renderCall: renderToolCall("screenshot"),
|
|
310
310
|
renderResult: renderScreenshotResult,
|
|
311
311
|
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
|
|
312
|
-
return withStatus(ctx, "
|
|
312
|
+
return withStatus(ctx, "screenshot", async () => {
|
|
313
313
|
const page = await resolvePage(params.pageId);
|
|
314
314
|
const result = await withCdp(page, async (client) => {
|
|
315
315
|
throwIfAborted(signal);
|