@narumitw/pi-firecrawl 0.43.0 → 0.49.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-firecrawl",
3
- "version": "0.43.0",
3
+ "version": "0.49.0",
4
4
  "description": "Pi extension that exposes Firecrawl web scraping and crawling 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
- "dependencies": {
32
- "@narumitw/pi-tui-kit": "^0.40.0",
33
- "typebox": "^1.3.9"
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.46.0"
43
+ },
40
44
  "repository": {
41
45
  "type": "git",
42
46
  "url": "https://github.com/narumiruna/pi-extensions",
package/src/firecrawl.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 { hasApiKey } from "./client.js";
4
3
  import { cleanupResponseArtifacts, openResponseArtifacts } from "./response-format.js";
5
4
  import { loadSettings } from "./settings.js";
@@ -138,6 +137,10 @@ async function showMenu(pi: ExtensionAPI, ctx: CommandContext, generation: numbe
138
137
  ctx.ui.notify(`${buildCommandGuide()}\n\n${status}`, hasApiKey() ? "info" : "warning");
139
138
  return;
140
139
  }
140
+ const menuSignal = currentFirecrawlSessionSignal();
141
+ const isCurrent = () => isCurrentFirecrawlSession(generation) && !menuSignal.aborted;
142
+ const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
143
+ if (!isCurrent()) return;
141
144
 
142
145
  type Screen = "main";
143
146
  type Action = keyof typeof MENU_OPTIONS;
@@ -187,8 +190,8 @@ async function showMenu(pi: ExtensionAPI, ctx: CommandContext, generation: numbe
187
190
  });
188
191
  await runMenu(ctx, menu, {
189
192
  getState: () => undefined,
190
- signal: currentFirecrawlSessionSignal(),
191
- isCurrent: () => isCurrentFirecrawlSession(generation),
193
+ signal: menuSignal,
194
+ isCurrent,
192
195
  });
193
196
  }
194
197
 
@@ -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 { configuredApiUrl, hasApiKey } from "./client.js";
4
3
  import {
5
4
  loadSettings,
@@ -52,6 +51,10 @@ export function recordSettingsNotice(settings: SettingsLoadResult) {
52
51
  export async function showToolSelector(pi: ExtensionAPI, ctx: CommandContext) {
53
52
  const generation = sessionGeneration;
54
53
  if (!ctx.hasUI) return;
54
+ const menuSignal = sessionController.signal;
55
+ const isCurrent = () => isCurrentFirecrawlSession(generation) && !menuSignal.aborted;
56
+ const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
57
+ if (!isCurrent()) return;
55
58
  const menu = defineMenu<undefined, ToolSelectorScreen, ToolSelectorAction>({
56
59
  start: "tools",
57
60
  screens: {
@@ -110,8 +113,8 @@ export async function showToolSelector(pi: ExtensionAPI, ctx: CommandContext) {
110
113
  });
111
114
  const result = await runMenu(ctx, menu, {
112
115
  getState: () => undefined,
113
- signal: sessionController.signal,
114
- isCurrent: () => isCurrentFirecrawlSession(generation),
116
+ signal: menuSignal,
117
+ isCurrent,
115
118
  });
116
119
  if (result.kind !== "closed" || !isCurrentFirecrawlSession(generation)) return;
117
120
  const status = await buildStatusMessage(pi);