@narumitw/pi-chrome-devtools 0.46.0 → 0.49.2
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 +8 -4
- package/src/chrome-devtools.ts +6 -3
- package/src/tool-selector.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-chrome-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.2",
|
|
4
4
|
"description": "Pi extension that exposes Chrome DevTools Protocol tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,15 +28,19 @@
|
|
|
28
28
|
"format": "biome check --write .",
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
32
|
-
"@
|
|
33
|
-
"typebox": "
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
33
|
+
"typebox": "*"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@biomejs/biome": "2.5.6",
|
|
37
37
|
"@earendil-works/pi-coding-agent": "0.83.0",
|
|
38
|
+
"typebox": "1.3.9",
|
|
38
39
|
"typescript": "7.0.2"
|
|
39
40
|
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@narumitw/pi-tui-kit": "^0.49.1"
|
|
43
|
+
},
|
|
40
44
|
"repository": {
|
|
41
45
|
"type": "git",
|
|
42
46
|
"url": "https://github.com/narumiruna/pi-extensions",
|
package/src/chrome-devtools.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
3
2
|
import { shutdownManagedBrowser } from "./browser-manager.js";
|
|
4
3
|
import { state } from "./runtime.js";
|
|
5
4
|
import { loadSettings } from "./settings.js";
|
|
@@ -136,6 +135,10 @@ async function showMenu(pi: ExtensionAPI, ctx: CommandContext, generation: numbe
|
|
|
136
135
|
ctx.ui.notify(`${buildCommandGuide()}\n\n${status}`, "info");
|
|
137
136
|
return;
|
|
138
137
|
}
|
|
138
|
+
const menuSignal = state.sessionController.signal;
|
|
139
|
+
const isCurrent = () => generation === state.sessionGeneration && !menuSignal.aborted;
|
|
140
|
+
const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
|
|
141
|
+
if (!isCurrent()) return;
|
|
139
142
|
|
|
140
143
|
type Screen = "main";
|
|
141
144
|
type Action = keyof typeof MENU_OPTIONS;
|
|
@@ -183,8 +186,8 @@ async function showMenu(pi: ExtensionAPI, ctx: CommandContext, generation: numbe
|
|
|
183
186
|
});
|
|
184
187
|
await runMenu(ctx, menu, {
|
|
185
188
|
getState: () => undefined,
|
|
186
|
-
signal:
|
|
187
|
-
isCurrent
|
|
189
|
+
signal: menuSignal,
|
|
190
|
+
isCurrent,
|
|
188
191
|
});
|
|
189
192
|
}
|
|
190
193
|
|
package/src/tool-selector.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
3
2
|
import {
|
|
4
3
|
browserCandidateHint,
|
|
5
4
|
devToolsEndpoint,
|
|
@@ -38,6 +37,10 @@ interface ToolStatusSummary {
|
|
|
38
37
|
export async function showToolSelector(pi: ExtensionAPI, ctx: CommandContext) {
|
|
39
38
|
const generation = state.sessionGeneration;
|
|
40
39
|
if (!ctx.hasUI) return;
|
|
40
|
+
const menuSignal = state.sessionController.signal;
|
|
41
|
+
const isCurrent = () => generation === state.sessionGeneration && !menuSignal.aborted;
|
|
42
|
+
const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
|
|
43
|
+
if (!isCurrent()) return;
|
|
41
44
|
const menu = defineMenu<undefined, ToolSelectorScreen, ToolSelectorAction>({
|
|
42
45
|
start: "tools",
|
|
43
46
|
screens: {
|
|
@@ -96,8 +99,8 @@ export async function showToolSelector(pi: ExtensionAPI, ctx: CommandContext) {
|
|
|
96
99
|
});
|
|
97
100
|
const result = await runMenu(ctx, menu, {
|
|
98
101
|
getState: () => undefined,
|
|
99
|
-
signal:
|
|
100
|
-
isCurrent
|
|
102
|
+
signal: menuSignal,
|
|
103
|
+
isCurrent,
|
|
101
104
|
});
|
|
102
105
|
if (result.kind !== "closed" || generation !== state.sessionGeneration) return;
|
|
103
106
|
const status = await buildToolStatusMessage(pi);
|