dsh-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 +1 -1
- package/README.md +1 -1
- package/lib/index.d.ts +5 -3
- package/lib/index.js +9 -7
- package/package.json +1 -1
package/README-zh.md
CHANGED
|
@@ -76,7 +76,7 @@ dsh plugin --profile web add ./dsh-querit-<版本号>.tgz
|
|
|
76
76
|
|
|
77
77
|
| 键 | 默认值 | 说明 |
|
|
78
78
|
|---|---|---|
|
|
79
|
-
| `apiKey` | 无 | 字面量 Querit API key(优先用 `apiKeyEnv
|
|
79
|
+
| `apiKey` | 无 | 字面量 Querit API key(优先用 `apiKeyEnv`,避免密钥进配置文件;两者同时设置时 `apiKeyEnv` 环境变量优先) |
|
|
80
80
|
| `apiKeyEnv` | `QUERIT_API_KEY` | 每次调用经凭据服务解析的凭据引用;缺失时调用失败为 `WEB_PROVIDER_CREDENTIAL_MISSING` |
|
|
81
81
|
| `baseURL` | `https://api.querit.ai` | API 基地址;可被 `$QUERIT_BASE_URL` 环境变量覆盖 |
|
|
82
82
|
| `timeoutMs` | `70000` | 单请求超时(毫秒) |
|
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ If a preset ever registers `web_fetch` itself (its `tool-web` row with `fetch: t
|
|
|
82
82
|
|
|
83
83
|
| Key | Default | Meaning |
|
|
84
84
|
|---|---|---|
|
|
85
|
-
| `apiKey` | omitted | Literal Querit API key. Prefer `apiKeyEnv` so no secret enters configuration
|
|
85
|
+
| `apiKey` | omitted | Literal Querit API key. Prefer `apiKeyEnv` so no secret enters configuration. The `apiKeyEnv` environment variable wins when both are set. |
|
|
86
86
|
| `apiKeyEnv` | `QUERIT_API_KEY` | Credential reference resolved per operation through `ctx.credentials`, or from the process environment when that seam is absent. A missing value fails the call as `WEB_PROVIDER_CREDENTIAL_MISSING`. |
|
|
87
87
|
| `baseURL` | `https://api.querit.ai` | Querit API base; `/v1/search` and `/v1/contents` are appended. Falls back to `$QUERIT_BASE_URL` from any environment layer. An unparseable value makes both providers unavailable. |
|
|
88
88
|
| `timeoutMs` | `70000` | Per-request timeout in ms (minimum 1000). |
|
package/lib/index.d.ts
CHANGED
|
@@ -76,9 +76,11 @@ export declare function resolveOptions(ctx: Context, config: Config): QueritProv
|
|
|
76
76
|
/** Register both Querit providers with `ctx.web`, the `web_fetch` tool, and the first-load key check. */
|
|
77
77
|
export declare function apply(ctx: Context, config: Config): Promise<void>;
|
|
78
78
|
/**
|
|
79
|
-
* Resolve the Querit API key for one operation in priority order:
|
|
80
|
-
*
|
|
81
|
-
*
|
|
79
|
+
* Resolve the Querit API key for one operation in priority order: the
|
|
80
|
+
* launching environment (so one exported `QUERIT_API_KEY` overrides
|
|
81
|
+
* everything for testing), then the credentials service (which itself reads
|
|
82
|
+
* the inherited environment before the managed document), then a literal row
|
|
83
|
+
* `apiKey`.
|
|
82
84
|
*/
|
|
83
85
|
export declare function resolveQueritApiKey(ctx: Context, apiKeyEnv: CredentialRef, literalApiKey: string | undefined): Promise<string | undefined>;
|
|
84
86
|
/**
|
package/lib/index.js
CHANGED
|
@@ -107,18 +107,20 @@ export async function apply(ctx, config) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* Resolve the Querit API key for one operation in priority order:
|
|
111
|
-
*
|
|
112
|
-
*
|
|
110
|
+
* Resolve the Querit API key for one operation in priority order: the
|
|
111
|
+
* launching environment (so one exported `QUERIT_API_KEY` overrides
|
|
112
|
+
* everything for testing), then the credentials service (which itself reads
|
|
113
|
+
* the inherited environment before the managed document), then a literal row
|
|
114
|
+
* `apiKey`.
|
|
113
115
|
*/
|
|
114
116
|
export async function resolveQueritApiKey(ctx, apiKeyEnv, literalApiKey) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
const ambient = launchEnvironmentOf(ctx).get(apiKeyEnv);
|
|
118
|
+
if (ambient !== undefined && ambient.value.length > 0)
|
|
119
|
+
return ambient.value;
|
|
117
120
|
const credentials = ctx.get("credentials");
|
|
118
121
|
if (credentials !== undefined)
|
|
119
122
|
return (await credentials.resolve(apiKeyEnv))?.value;
|
|
120
|
-
|
|
121
|
-
return ambient !== undefined && ambient.value.length > 0 ? ambient.value : undefined;
|
|
123
|
+
return literalApiKey !== undefined && literalApiKey.length > 0 ? literalApiKey : undefined;
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
124
126
|
* Reject a resolved settings section this plugin could not act on, for
|
package/package.json
CHANGED