@bacnh85/pi-web 0.2.0 → 0.2.1
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/README.md +2 -2
- package/index.ts +15 -2
- package/lib/config.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,8 +33,8 @@ Environment lookup order:
|
|
|
33
33
|
1. Process environment
|
|
34
34
|
2. Current working directory `.env.local`
|
|
35
35
|
3. Current working directory `.env`
|
|
36
|
-
4. Pi global config `.env.local` (`$PI_CODING_AGENT_DIR/.env.local` when set; otherwise `~/.pi/agent/.env.local`
|
|
37
|
-
5. Pi global config `.env` (`$PI_CODING_AGENT_DIR/.env` when set; otherwise `~/.pi/agent/.env`
|
|
36
|
+
4. Pi global config `.env.local` (`$PI_CODING_AGENT_DIR/.env.local` when set; otherwise `~/.pi/agent/.env.local`)
|
|
37
|
+
5. Pi global config `.env` (`$PI_CODING_AGENT_DIR/.env` when set; otherwise `~/.pi/agent/.env`)
|
|
38
38
|
|
|
39
39
|
Variables:
|
|
40
40
|
|
package/index.ts
CHANGED
|
@@ -261,18 +261,31 @@ export default function piWebExtension(pi: ExtensionAPI) {
|
|
|
261
261
|
url: Type.String(),
|
|
262
262
|
limit: Type.Optional(Type.Number({ default: 100 })),
|
|
263
263
|
include_subdomains: Type.Optional(Type.Boolean({ default: false })),
|
|
264
|
+
search: Type.Optional(Type.String({ description: "Optional search query to guide URL discovery (semantic map)." })),
|
|
265
|
+
sitemap: Type.Optional(Type.Union([Type.Literal("only"), Type.Literal("include"), Type.Literal("skip")], { description: "Sitemap mode: include (default), only (sitemap-only), or skip." })),
|
|
266
|
+
use_index: Type.Optional(Type.Boolean({ default: true, description: "Whether to use the Firecrawl search index for URL discovery." })),
|
|
267
|
+
ignore_cache: Type.Optional(Type.Boolean({ default: false, description: "Ignore cached map results." })),
|
|
264
268
|
}),
|
|
265
269
|
async execute(_id: string, params: Record<string, unknown>, signal: AbortSignal, _onUpdate: unknown, ctx: any) {
|
|
270
|
+
const body: Record<string, unknown> = {
|
|
271
|
+
url: params.url,
|
|
272
|
+
limit: (params.limit as number) ?? 100,
|
|
273
|
+
includeSubdomains: Boolean(params.include_subdomains),
|
|
274
|
+
};
|
|
275
|
+
if (params.search !== undefined) body.search = params.search;
|
|
276
|
+
if (params.sitemap !== undefined) body.sitemap = params.sitemap;
|
|
277
|
+
if (params.use_index !== undefined) body.useIndex = params.use_index;
|
|
278
|
+
if (params.ignore_cache !== undefined) body.ignoreCache = params.ignore_cache;
|
|
266
279
|
const result = await firecrawlRequest(
|
|
267
280
|
loadFirecrawlConfig(params, cwdFromContext(ctx), includeProjectEnv(ctx)),
|
|
268
281
|
"POST",
|
|
269
282
|
"/map",
|
|
270
|
-
|
|
283
|
+
body,
|
|
271
284
|
true,
|
|
272
285
|
signal,
|
|
273
286
|
);
|
|
274
287
|
const urls = result.data || result.links || result.urls || [];
|
|
275
|
-
const text = Array.isArray(urls)
|
|
288
|
+
const text = Array.isArray(urls) && urls.length > 0
|
|
276
289
|
? (urls as Array<Record<string, unknown> | string>).map((u: any) => u.url || u).join("\n")
|
|
277
290
|
: JSON.stringify(result, null, 2);
|
|
278
291
|
return { content: [{ type: "text" as const, text: truncateText(text) }], details: result };
|
package/lib/config.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const DEFAULT_SEARXNG_BASE_URL = "http://172.30.55.22:8888";
|
|
|
20
20
|
export function piConfigDirs(): string[] {
|
|
21
21
|
return process.env.PI_CODING_AGENT_DIR
|
|
22
22
|
? [process.env.PI_CODING_AGENT_DIR]
|
|
23
|
-
: [path.join(os.homedir(), ".pi", "agent")
|
|
23
|
+
: [path.join(os.homedir(), ".pi", "agent")];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function envFileCandidates(cwd = process.cwd(), includeCwd = true): string[] {
|