pi-querit 1.0.0 → 1.0.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-zh.md CHANGED
@@ -161,7 +161,7 @@ pi install npm:pi-querit
161
161
 
162
162
  POSIX 系统上文件权限为 `0600`;Windows 上依赖用户配置文件 ACL 保护。API Key 不会出现在工具结果或日志中。
163
163
 
164
- CI 或临时使用可设置环境变量 `QUERIT_API_KEY`,JSON 配置优先。
164
+ CI 或临时使用可设置环境变量 `QUERIT_API_KEY`,环境变量优先于 JSON 配置。
165
165
 
166
166
  ## 工具
167
167
 
package/README.md CHANGED
@@ -161,7 +161,7 @@ These are persistent defaults applied to every `web_search` call. They are store
161
161
 
162
162
  The extension applies mode `0600` on POSIX systems. On Windows, the file remains protected by the user profile's filesystem ACLs. The key is never included in tool results or logs.
163
163
 
164
- For CI or ephemeral use, set `QUERIT_API_KEY`. The JSON configuration takes precedence when both are present.
164
+ For CI or ephemeral use, set `QUERIT_API_KEY`. The environment variable takes precedence when both are present.
165
165
 
166
166
  ## Tools
167
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-querit",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Querit web search and content retrieval tools for the Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/config.ts CHANGED
@@ -127,11 +127,11 @@ export async function loadQueritConfig(configPath = getQueritConfigPath()): Prom
127
127
  }
128
128
 
129
129
  export async function resolveQueritApiKey(options: ApiKeyResolutionOptions = {}): Promise<string | undefined> {
130
- const config = await loadQueritConfig(options.configPath ?? getQueritConfigPath());
131
- if (config?.apiKey) return config.apiKey;
132
-
133
130
  const environmentKey = (options.env ?? process.env).QUERIT_API_KEY?.trim();
134
- return environmentKey || undefined;
131
+ if (environmentKey) return environmentKey;
132
+
133
+ const config = await loadQueritConfig(options.configPath ?? getQueritConfigPath());
134
+ return config?.apiKey || undefined;
135
135
  }
136
136
 
137
137
  export async function saveQueritConfig(
package/src/index.ts CHANGED
@@ -113,7 +113,7 @@ export function registerQueritExtension(pi: ExtensionAPI, options: QueritExtensi
113
113
 
114
114
  const requireRuntime = async (): Promise<{ client: QueritClientLike; config?: QueritConfig }> => {
115
115
  const config = await loadQueritConfig(configPath);
116
- const apiKey = config?.apiKey ?? (options.env ?? process.env).QUERIT_API_KEY?.trim();
116
+ const apiKey = (options.env ?? process.env).QUERIT_API_KEY?.trim() ?? config?.apiKey;
117
117
  if (!apiKey) {
118
118
  throw new Error(
119
119
  `Querit is not configured. Run /querit-setup in Pi or set QUERIT_API_KEY. Configuration file: ${configPath}`,