refactor: complete pi-web rename in paths and env vars
- Config path: ~/.pi/pi-search/config.json -> ~/.pi/pi-web/config.json - Env vars: PI_SEARCH_PROVIDER -> PI_WEB_PROVIDER, PI_SEARCH_SEARXNG_URL -> PI_WEB_SEARXNG_URL - README + flake.nix description updated to match.
This commit is contained in:
12
README.md
12
README.md
@@ -18,7 +18,7 @@ For raw HTTP responses, non-text content, or simple API calls, the LLM is steere
|
||||
|
||||
## Config
|
||||
|
||||
Drop a JSON file at `~/.pi/pi-search/config.json`:
|
||||
Drop a JSON file at `~/.pi/pi-web/config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -34,11 +34,11 @@ Drop a JSON file at `~/.pi/pi-search/config.json`:
|
||||
|
||||
### Env Var Overrides
|
||||
|
||||
| Variable | Overrides |
|
||||
| ----------------------- | ----------------- |
|
||||
| `PI_SEARCH_PROVIDER` | `provider` |
|
||||
| `KAGI_TOKEN` | `kagi.token` |
|
||||
| `PI_SEARCH_SEARXNG_URL` | `searxng.baseUrl` |
|
||||
| Variable | Overrides |
|
||||
| --------------------- | ----------------- |
|
||||
| `PI_WEB_PROVIDER` | `provider` |
|
||||
| `KAGI_TOKEN` | `kagi.token` |
|
||||
| `PI_WEB_SEARXNG_URL` | `searxng.baseUrl` |
|
||||
|
||||
### Getting A Kagi Session Token
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "pi-search extension development environment";
|
||||
description = "pi-web extension development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
|
||||
2
index.ts
2
index.ts
@@ -1,6 +1,6 @@
|
||||
// Pi-Web Extension - Registers `web_search` and `web_fetch` tools backed by
|
||||
// a shared headless Firefox session. Provider config lives in
|
||||
// ~/.pi/pi-search/config.json (env overrides supported).
|
||||
// ~/.pi/pi-web/config.json (env overrides supported).
|
||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
import { Type } from "typebox";
|
||||
import { ConfigError, loadConfig, resolveSettings } from "./src/config.ts";
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ConfigError extends Error {
|
||||
export function defaultConfigPath(
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
): string {
|
||||
return join(env.HOME ?? homedir(), ".pi", "pi-search", "config.json");
|
||||
return join(env.HOME ?? homedir(), ".pi", "pi-web", "config.json");
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
@@ -85,15 +85,15 @@ export function resolveSettings(
|
||||
config: PiSearchConfig,
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
): ResolvedSettings {
|
||||
const provider = (env.PI_SEARCH_PROVIDER as Provider) ?? config.provider;
|
||||
const provider = (env.PI_WEB_PROVIDER as Provider) ?? config.provider;
|
||||
if (!provider) {
|
||||
throw new ConfigError(
|
||||
"no provider configured. Set provider in ~/.pi/pi-search/config.json or PI_SEARCH_PROVIDER env.",
|
||||
"no provider configured. Set provider in ~/.pi/pi-web/config.json or PI_WEB_PROVIDER env.",
|
||||
);
|
||||
}
|
||||
return {
|
||||
provider,
|
||||
kagiToken: env.KAGI_TOKEN ?? config.kagi?.token,
|
||||
searxngBaseUrl: env.PI_SEARCH_SEARXNG_URL ?? config.searxng?.baseUrl,
|
||||
searxngBaseUrl: env.PI_WEB_SEARXNG_URL ?? config.searxng?.baseUrl,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function searchSearxng({
|
||||
if (!baseUrl) {
|
||||
throw new SearchError(
|
||||
"SEARXNG_URL_REQUIRED",
|
||||
"SearXNG search requires a base URL. Set searxng.baseUrl in config or PI_SEARCH_SEARXNG_URL env.",
|
||||
"SearXNG search requires a base URL. Set searxng.baseUrl in config or PI_WEB_SEARXNG_URL env.",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user