@juicesharp/rpiv-web-tools 2.14.2 → 2.15.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/docs/configuration.md +1 -1
- package/docs/providers.md +3 -2
- package/package.json +2 -2
- package/providers/index.ts +1 -1
- package/providers/types.ts +2 -0
- package/providers/youcom.ts +2 -0
- package/web-tools.ts +11 -2
package/docs/configuration.md
CHANGED
|
@@ -131,7 +131,7 @@ Any other argument is ignored and falls through to the interactive picker.
|
|
|
131
131
|
| --- | --- |
|
|
132
132
|
| `XDG_CONFIG_HOME` | Config directory root; must be absolute or `~`-prefixed, else ignored |
|
|
133
133
|
| `WEB_SEARCH_PROVIDER` | Pins the active provider above the config file |
|
|
134
|
-
| `BRAVE_SEARCH_API_KEY`, `TAVILY_API_KEY`, `SERPER_API_KEY`, `EXA_API_KEY`, `YOUCOM_API_KEY
|
|
134
|
+
| `BRAVE_SEARCH_API_KEY`, `TAVILY_API_KEY`, `SERPER_API_KEY`, `EXA_API_KEY`, `YOUCOM_API_KEY` (or `YDC_API_KEY`), `JINA_API_KEY`, `FIRECRAWL_API_KEY`, `PERPLEXITY_API_KEY`, `SEARXNG_API_KEY`, `OLLAMA_API_KEY` | Per-provider keys; win over `apiKeys.<provider>` |
|
|
135
135
|
| `SEARXNG_URL`, `OLLAMA_HOST` | Self-hosted base URLs; win over `baseUrls.<provider>` |
|
|
136
136
|
| `GITHUB_TOKEN` | Read only to display it masked in `/web-tools --show`; GitHub auth itself flows through `gh` |
|
|
137
137
|
|
package/docs/providers.md
CHANGED
|
@@ -15,7 +15,7 @@ keys — they are stored per provider under `apiKeys.<name>`.
|
|
|
15
15
|
| Tavily | `tavily` | `TAVILY_API_KEY` | [tavily.com](https://tavily.com) | native extraction (plain text) |
|
|
16
16
|
| Serper | `serper` | `SERPER_API_KEY` | [serper.dev](https://serper.dev) | built-in HTTP → text, honours `raw` |
|
|
17
17
|
| Exa | `exa` | `EXA_API_KEY` | [exa.ai](https://exa.ai) | native extraction (plain text) |
|
|
18
|
-
| You.com | `youcom` | `YOUCOM_API_KEY` | [you.com](https://you.com) | native extraction (markdown) |
|
|
18
|
+
| You.com | `youcom` | `YOUCOM_API_KEY` (or `YDC_API_KEY`) | [you.com](https://you.com) | native extraction (markdown) |
|
|
19
19
|
| Jina | `jina` | `JINA_API_KEY` | [jina.ai/reader](https://jina.ai/reader) | native extraction (markdown) |
|
|
20
20
|
| Firecrawl | `firecrawl` | `FIRECRAWL_API_KEY` | [firecrawl.dev](https://firecrawl.dev) | native extraction (markdown) |
|
|
21
21
|
| Perplexity | `perplexity` | `PERPLEXITY_API_KEY` | [docs.perplexity.ai](https://docs.perplexity.ai/) | built-in HTTP → text, honours `raw` |
|
|
@@ -64,7 +64,8 @@ first match wins:
|
|
|
64
64
|
1. **The provider's own environment variable** (`BRAVE_SEARCH_API_KEY`,
|
|
65
65
|
`TAVILY_API_KEY`, `SERPER_API_KEY`, `EXA_API_KEY`, `YOUCOM_API_KEY`,
|
|
66
66
|
`JINA_API_KEY`, `FIRECRAWL_API_KEY`, `PERPLEXITY_API_KEY`,
|
|
67
|
-
`SEARXNG_API_KEY`, `OLLAMA_API_KEY`).
|
|
67
|
+
`SEARXNG_API_KEY`, `OLLAMA_API_KEY`). You.com also reads `YDC_API_KEY`
|
|
68
|
+
when `YOUCOM_API_KEY` is unset.
|
|
68
69
|
2. **`apiKeys.<provider>`** in the config file.
|
|
69
70
|
3. **Legacy top-level `apiKey`**, Brave only. It is auto-migrated into
|
|
70
71
|
`apiKeys.brave` and deleted from the file on the next `/web-tools` save.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-web-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Pi extension. Web search and fetch for the model with pluggable providers (Brave, Tavily, Serper, Exa, You.com, Jina, Firecrawl, Perplexity, SearXNG, Ollama).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@juicesharp/rpiv-config": "^2.
|
|
68
|
+
"@juicesharp/rpiv-config": "^2.15.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@earendil-works/pi-coding-agent": "*",
|
package/providers/index.ts
CHANGED
|
@@ -61,7 +61,7 @@ export type {
|
|
|
61
61
|
SearchResponse,
|
|
62
62
|
SearchResult,
|
|
63
63
|
} from "./types.ts";
|
|
64
|
-
export { YOUCOM_API_KEY_ENV_VAR, YOUCOM_PROVIDER_META, YouComProvider } from "./youcom.ts";
|
|
64
|
+
export { YDC_API_KEY_ENV_VAR, YOUCOM_API_KEY_ENV_VAR, YOUCOM_PROVIDER_META, YouComProvider } from "./youcom.ts";
|
|
65
65
|
|
|
66
66
|
// Typed as readonly ProviderMeta[] (not `as const`) so iterators can access
|
|
67
67
|
// the optional META fields (baseUrlEnvVar, defaultBaseUrl, configure) without
|
package/providers/types.ts
CHANGED
|
@@ -80,6 +80,7 @@ export interface ProviderConfigChange {
|
|
|
80
80
|
// touching the orchestrator.
|
|
81
81
|
//
|
|
82
82
|
// envVar — the API-key env var (omit if the provider has no key)
|
|
83
|
+
// fallbackEnvVar — a second API-key env var, read when envVar is unset
|
|
83
84
|
// baseUrlEnvVar — the URL env var (set for self-hosted providers)
|
|
84
85
|
// defaultBaseUrl — fallback URL when neither env nor config supplies one
|
|
85
86
|
// configure — interactive setup; if present, /web-tools
|
|
@@ -88,6 +89,7 @@ export interface ProviderMeta {
|
|
|
88
89
|
name: string;
|
|
89
90
|
label: string;
|
|
90
91
|
envVar?: string;
|
|
92
|
+
fallbackEnvVar?: string;
|
|
91
93
|
baseUrlEnvVar?: string;
|
|
92
94
|
defaultBaseUrl?: string;
|
|
93
95
|
// Which role(s) the provider plays. Search-only providers (Brave, Serper,
|
package/providers/youcom.ts
CHANGED
|
@@ -3,10 +3,12 @@ import type { FetchResponse, FullProvider, SearchResponse, SearchResult } from "
|
|
|
3
3
|
const YOUCOM_SEARCH_URL = "https://ydc-index.io/v1/search";
|
|
4
4
|
const YOUCOM_CONTENTS_URL = "https://ydc-index.io/v1/contents";
|
|
5
5
|
export const YOUCOM_API_KEY_ENV_VAR = "YOUCOM_API_KEY";
|
|
6
|
+
export const YDC_API_KEY_ENV_VAR = "YDC_API_KEY";
|
|
6
7
|
export const YOUCOM_PROVIDER_META = {
|
|
7
8
|
name: "youcom",
|
|
8
9
|
label: "You.com",
|
|
9
10
|
envVar: YOUCOM_API_KEY_ENV_VAR,
|
|
11
|
+
fallbackEnvVar: YDC_API_KEY_ENV_VAR,
|
|
10
12
|
roles: ["search", "fetch"] as const,
|
|
11
13
|
} as const;
|
|
12
14
|
|
package/web-tools.ts
CHANGED
|
@@ -97,11 +97,20 @@ export const DEFAULT_WEB_FETCH_GUIDELINES: string[] = [
|
|
|
97
97
|
// API key resolution + masking
|
|
98
98
|
// ---------------------------------------------------------------------------
|
|
99
99
|
|
|
100
|
+
/** The provider's key from the environment: `envVar`, else `fallbackEnvVar`. */
|
|
101
|
+
function envApiKey(meta: ProviderMeta): string | undefined {
|
|
102
|
+
for (const name of [meta.envVar, meta.fallbackEnvVar]) {
|
|
103
|
+
const value = name ? process.env[name]?.trim() : undefined;
|
|
104
|
+
if (value) return value;
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
100
109
|
function resolveProviderApiKey(providerName: string, config: WebToolsConfig): string | undefined {
|
|
101
110
|
const meta = PROVIDERS.find((p) => p.name === providerName);
|
|
102
111
|
if (!meta) return undefined;
|
|
103
112
|
|
|
104
|
-
const envKey = meta
|
|
113
|
+
const envKey = envApiKey(meta);
|
|
105
114
|
if (envKey) return envKey;
|
|
106
115
|
|
|
107
116
|
const configKey = config.apiKeys?.[providerName]?.trim();
|
|
@@ -564,7 +573,7 @@ function formatShowConfigMessage(current: WebToolsConfig): string {
|
|
|
564
573
|
lines.push(` active provider: ${providerName} (source: ${providerSource})`);
|
|
565
574
|
|
|
566
575
|
for (const meta of PROVIDERS) {
|
|
567
|
-
const envKey = meta
|
|
576
|
+
const envKey = envApiKey(meta);
|
|
568
577
|
const configKey = current.apiKeys?.[meta.name]?.trim();
|
|
569
578
|
const legacyKey = meta.name === LEGACY_TOP_LEVEL_KEY_PROVIDER ? current.apiKey?.trim() : undefined;
|
|
570
579
|
const resolved = envKey ?? configKey ?? legacyKey;
|