Skip to content

Commit eba42a1

Browse files
authored
docs(bot): unquoted placeholder values so scan examples aren't findings (#20)
* docs(bot): unquoted placeholder values so scan examples aren't findings * docs(config): fix Node floor, document MANAGE_BACKEND, dedup asRecord import - README + development: Node 18+ -> >=22.19 to match engines floor - configuration.md: canonical tool-switch header, MANAGE_BACKEND row with dual-entry note, sync inline example with config.json.example - .env.example: document OPENCODE_SERVER_URL override - proxy.ts: correct shared-verifier comment (two instances, copied keys) - grounding.ts: reuse shared asRecord from utils/guards (no behavior change) --------- Co-authored-by: samson910022 <samson910022@users.noreply.github.com>
1 parent 46b323f commit eba42a1

9 files changed

Lines changed: 27 additions & 15 deletions

File tree

‎.env.example‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ OPENCODE_PROXY_CLEANUP_MAX_AGE_MS=86400000
2929
# Optional overrides
3030
# OPENCODE_PROXY_PORT=10000
3131
# OPENCODE_SERVER_PORT=10001
32+
# OPENCODE_SERVER_URL=http://127.0.0.1:10001
3233
# BIND_HOST=0.0.0.0
3334
# OPENCODE_PROXY_BIND_HOST=0.0.0.0
3435
# Canonical tool switch (legacy DISABLE_TOOLS also read; canonical wins)

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p align="center">
44
<img src="https://img.shields.io/badge/version-1.6.0-blue" alt="Version">
55
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
6-
<img src="https://img.shields.io/badge/Node.js-18+-orange" alt="Node">
6+
<img src="https://img.shields.io/badge/Node.js-22.19+-orange" alt="Node">
77
</p>
88

99
> **Language:** [English](./README.md) | [简体中文](./README.zh-CN.md)

‎README.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<p align="center">
44
<img src="https://img.shields.io/badge/version-1.6.0-blue" alt="Version">
55
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
6-
<img src="https://img.shields.io/badge/Node.js-18+-orange" alt="Node">
6+
<img src="https://img.shields.io/badge/Node.js-22.19+-orange" alt="Node">
77
</p>
88

99
> **語言:** [English](./README.md) | [简体中文](./README.zh-CN.md)

‎docs/AI_BOT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Point at a local gateway (start one with `API_KEY= OPENCODE_PROXY_MANAGE_BACKEND
8282
or fill placeholders — never commit real values:
8383

8484
```bash
85-
export GATEWAY_BASE_URL='http://127.0.0.1:10000' GATEWAY_API_KEY='' CPA_BASE_URL='...' CPA_API_KEY='...'
85+
export GATEWAY_BASE_URL='http://127.0.0.1:10000' GATEWAY_API_KEY='' CPA_BASE_URL=your-cpa-url-here CPA_API_KEY=your-cpa-key-here
8686
export PYTHONPATH=github_bot/src
8787
python3 github_bot/src/github_runner.py --mode=review --dry-run
8888
python3 github_bot/src/github_runner.py --mode=triage --dry-run

‎docs/configuration.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
| 变量 | 默认值 | 说明 |
3232
|:-----|:-------|:-----|
33-
| `DISABLE_TOOLS` | `true` | 禁用 OpenCode 工具调用(兼容别名;`OPENCODE_DISABLE_TOOLS` 优先,二者无效值都会让位给下一顺位:canonical env > legacy env > `config.json` > 默认) |
33+
| `OPENCODE_DISABLE_TOOLS` / `DISABLE_TOOLS` | `true` | 禁用 OpenCode 工具调用(兼容别名;`OPENCODE_DISABLE_TOOLS` 优先,二者无效值都会让位给下一顺位:canonical env > legacy env > `config.json` > 默认) |
3434
| `OPENCODE_EXTERNAL_TOOLS_MODE` | `proxy-bridge` | 外部工具桥接模式;当前仅支持 `proxy-bridge` |
3535
| `OPENCODE_EXTERNAL_TOOLS_CONFLICT_POLICY` | `namespace` | 外部工具冲突隔离策略;当前仅支持 `namespace` |
3636
| `OPENCODE_INTERNAL_WEB_FETCH_ENABLED` | `false` | 兼容旧开关;未显式配置 allowlist 时,启用后默认放行 `web_fetch` |
@@ -72,6 +72,7 @@
7272
| 变量 | 默认值 | 说明 |
7373
|:-----|:-------|:-----|
7474
| `OPENCODE_PROXY_DEBUG` | `false` | 开启调试日志(`config.json` 中用短键 `DEBUG`) |
75+
| `OPENCODE_PROXY_MANAGE_BACKEND` | `false` | 是否由代理拉起本地后端(`config.json` 中用短键 `MANAGE_BACKEND`;prod/`index.ts` 默认 `false`,library/`buildProxyConfig` 默认 `true`——已知双入口差异) |
7576
| `OPENCODE_PATH` | `opencode` | OpenCode 可执行文件路径 |
7677
| `OPENCODE_ZEN_API_KEY` | - | Zen API Key 透传 |
7778

@@ -92,6 +93,10 @@
9293
"INTERNAL_ALLOWED_TOOLS": ["web_fetch"],
9394
"INTERNAL_TOOL_METRICS_ENABLED": true,
9495
"INTERNAL_TOOL_DISCOVERY_FIXTURE": [],
96+
"HEALTH_DETAILS_ENABLED": true,
97+
"HEALTH_DETAILS_REQUIRE_AUTH": true,
98+
"METRICS_ENABLED": false,
99+
"METRICS_REQUIRE_AUTH": true,
95100
"USE_ISOLATED_HOME": false,
96101
"PROMPT_MODE": "standard",
97102
"OMIT_SYSTEM_PROMPT": false,
@@ -100,9 +105,16 @@
100105
"CLEANUP_MAX_AGE_MS": 86400000,
101106
"DEBUG": false,
102107
"OPENCODE_SERVER_URL": "http://127.0.0.1:10001",
108+
"OPENCODE_SERVER_PASSWORD": "",
103109
"OPENCODE_PATH": "opencode",
110+
"ZEN_API_KEY": "",
111+
"MANAGE_BACKEND": false,
104112
"REQUEST_TIMEOUT_MS": 180000,
105-
"RETRY_MAX_RETRIES": 3
113+
"RETRY_MAX_RETRIES": 3,
114+
"UPSTREAM_PROXIES": [],
115+
"UPSTREAM_PROXY_STRATEGY": "failover-rr",
116+
"UPSTREAM_PROXY_COOLDOWN_MS": 300000,
117+
"UPSTREAM_PROXY_NO_PROXY": ["localhost", "127.0.0.1", "::1"]
106118
}
107119
```
108120

‎docs/development.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
### Node.js 环境
1212

1313
```bash
14-
# Node.js 18+
14+
# Node.js >=22.19 (engines floor; CI uses 24)
1515
node --version
1616

1717
# npm

‎github_bot/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ To use an external gateway or CPA, export names only (never commit values):
3636

3737
```bash
3838
export GATEWAY_BASE_URL='http://127.0.0.1:10000' # external override; in-job default when unset
39-
export GATEWAY_API_KEY='...' # external gateway key; empty = no-auth localhost
40-
export CPA_BASE_URL='...' # never commit (fallback channel)
41-
export CPA_API_KEY='...' # never commit (fallback channel)
39+
export GATEWAY_API_KEY=your-gateway-key-here # external gateway key; empty = no-auth localhost
40+
export CPA_BASE_URL=your-cpa-url-here # never commit (fallback channel)
41+
export CPA_API_KEY=your-cpa-key-here # never commit (fallback channel)
4242
export PYTHONPATH=github_bot/src
4343
python3 github_bot/src/github_runner.py --mode=review --dry-run
4444
python3 github_bot/src/github_runner.py --mode=triage --dry-run

‎src/proxy.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ export function createApp(config: ProxyConfig): CreateAppResult {
100100
const client = rawClient as unknown as ProxyClient;
101101

102102
// Multi-key auth (A): legacy single + list merge; empty = no auth (unchanged).
103-
// Single shared verifier instance (also exposed via ctx for system routes).
103+
// Two verifier instances read the same effective key content (middleware
104+
// here, system routes via ctx.API_KEYS); each copies at construction
105+
// (spread in system routes, filter in keys), so keep the inputs in sync
106+
// instead of assuming a shared reference.
104107
const effectiveApiKeys: string[] = buildEffectiveApiKeys(API_KEY, API_KEYS);
105108
const apiKeyVerifier = createApiKeyVerifier(effectiveApiKeys);
106109

‎src/search/grounding.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Maps OpenAI-style hosted search tools (`tools:[{type:web_search}]`) onto the
44
// opencode built-in `websearch` tool and rebuilds `web_search_call` output
55
// items + `url_citation` annotations from the backend tool parts.
6+
import { asRecord } from '../utils/guards.js';
67

78
export const HOSTED_SEARCH_TOOL_TYPES = ['web_search', 'web_search_preview', 'google_search'];
89
/** True for hosted search tool types, incl. versioned variants (e.g. Anthropic `web_search_20260222`). */
@@ -18,11 +19,6 @@ export const SEARCH_GROUNDING_INSTRUCTION =
1819
'only from the conversation plus the search results. ' +
1920
'Include the source URLs you relied on verbatim in your answer so they can be cited.';
2021

21-
function asRecord(value: unknown): Record<string, unknown> {
22-
if (value && typeof value === 'object' && !Array.isArray(value)) return value as Record<string, unknown>;
23-
return {};
24-
}
25-
2622
function toolTypeOf(def: unknown): string {
2723
return typeof asRecord(def)['type'] === 'string' ? String(asRecord(def)['type']) : '';
2824
}

0 commit comments

Comments
 (0)