@narumitw/pi-chrome-devtools 0.1.17 → 0.1.19
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
|
@@ -46,7 +46,7 @@ const listPagesTool = defineTool({
|
|
|
46
46
|
promptSnippet: "List Chrome tabs/pages available over Chrome DevTools Protocol",
|
|
47
47
|
parameters: Type.Object({}),
|
|
48
48
|
async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
|
|
49
|
-
return withStatus(ctx, "
|
|
49
|
+
return withStatus(ctx, "🌐 list pages", async () => {
|
|
50
50
|
const pages = await listPages();
|
|
51
51
|
return textResult(JSON.stringify(pages.map(formatPage), null, 2), { pages });
|
|
52
52
|
});
|
|
@@ -62,7 +62,7 @@ const selectPageTool = defineTool({
|
|
|
62
62
|
pageId: Type.String({ description: "Page id from chrome_devtools_list_pages." }),
|
|
63
63
|
}),
|
|
64
64
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
65
|
-
return withStatus(ctx, "
|
|
65
|
+
return withStatus(ctx, "🌐 select page", async () => {
|
|
66
66
|
const page = await getPage(params.pageId);
|
|
67
67
|
state.activePageId = page.id;
|
|
68
68
|
return textResult(`Selected page ${page.id}: ${page.title}\n${page.url}`, {
|
|
@@ -84,7 +84,7 @@ const navigateTool = defineTool({
|
|
|
84
84
|
),
|
|
85
85
|
}),
|
|
86
86
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
87
|
-
return withStatus(ctx, "
|
|
87
|
+
return withStatus(ctx, "🌐 navigate", async () => {
|
|
88
88
|
const page = await resolvePage(params.pageId);
|
|
89
89
|
const result = await withCdp(page, async (client) => {
|
|
90
90
|
await client.send("Page.enable");
|
|
@@ -112,7 +112,7 @@ const evaluateTool = defineTool({
|
|
|
112
112
|
),
|
|
113
113
|
}),
|
|
114
114
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
115
|
-
return withStatus(ctx, "
|
|
115
|
+
return withStatus(ctx, "🌐 evaluate", async () => {
|
|
116
116
|
const page = await resolvePage(params.pageId);
|
|
117
117
|
const result = await withCdp(page, (client) =>
|
|
118
118
|
client.send("Runtime.evaluate", {
|
|
@@ -142,7 +142,7 @@ const screenshotTool = defineTool({
|
|
|
142
142
|
),
|
|
143
143
|
}),
|
|
144
144
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
145
|
-
return withStatus(ctx, "
|
|
145
|
+
return withStatus(ctx, "🌐 screenshot", async () => {
|
|
146
146
|
const page = await resolvePage(params.pageId);
|
|
147
147
|
const result = await withCdp(page, async (client) => {
|
|
148
148
|
await client.send("Page.enable");
|