pi-all-search 1.0.11 → 1.0.13

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.
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { registerWebSearchTool } from "./src/web-search.js";
3
- import { registerExtractTool } from "./src/extract.js";
4
- import { registerGetSubDomainsTool } from "./src/get-sub-domains.js";
2
+ import { registerWebSearchTool } from "../src/web-search.js";
3
+ import { registerExtractTool } from "../src/extract.js";
4
+ import { registerGetSubDomainsTool } from "../src/get-sub-domains.js";
5
5
 
6
6
  export default function (pi: ExtensionAPI) {
7
7
  registerWebSearchTool(pi);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-all-search",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "All-in-one web search extension for Pi — exa, tavily, anysearch, firecrawl, context7",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -3,31 +3,38 @@ import { readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { homedir } from "node:os";
5
5
 
6
- const CONFIG_PATH = join(homedir(), ".pi", "web-search.json");
6
+ const CONFIG_PATH = join(homedir(), ".pi", "pi-all-search.json");
7
7
 
8
8
  export interface SearchConfig {
9
9
  apiKeys: Record<string, string>;
10
+ provider?: string;
11
+ cacheTtlMs?: number;
12
+ maxResults?: number;
10
13
  }
11
14
 
12
15
  export function loadConfig(): SearchConfig {
13
16
  const apiKeys: Record<string, string> = {};
17
+ const env = process.env;
18
+
19
+ for (const meta of PROVIDERS) {
20
+ const key = env[meta.envVar];
21
+ if (key) apiKeys[meta.name] = key;
22
+ }
23
+
24
+ let provider: string | undefined;
25
+ let cacheTtlMs: number | undefined;
26
+ let maxResults: number | undefined;
14
27
 
15
28
  try {
16
29
  const config = JSON.parse(readFileSync(CONFIG_PATH, "utf8"));
17
- for (const meta of PROVIDERS) {
18
- const key = config[meta.name + "ApiKey"];
19
- if (key) apiKeys[meta.name] = key;
20
- }
30
+ provider = config.provider;
31
+ cacheTtlMs = config.cacheTtlMs;
32
+ maxResults = config.maxResults;
21
33
  } catch {
22
- // fallback to env vars
23
- const env = process.env;
24
- for (const meta of PROVIDERS) {
25
- const key = env[meta.envVar];
26
- if (key) apiKeys[meta.name] = key;
27
- }
34
+ // use defaults
28
35
  }
29
36
 
30
- return { apiKeys };
37
+ return { apiKeys, provider, cacheTtlMs, maxResults };
31
38
  }
32
39
 
33
40
  export function resolveApiKey(name: string, envVar: string, config: SearchConfig): string | undefined {