bingocode 1.1.126 → 1.1.128
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/.claude/settings.local.json +8 -1
- package/bin/bingo +35 -1
- package/bin/bingo-win.cjs +29 -11
- package/package.json +1 -1
- package/scripts/install-skills.cjs +1 -0
- package/src/constants/prompts.ts +24 -12
- package/src/utils/goalEvaluator.ts +4 -1
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
"Bash(curl -s \"https://docs.anthropic.com/en/api/messages-streaming\" --max-time 30 -A \"Mozilla/5.0\")",
|
|
8
8
|
"Bash(curl -sv \"https://docs.anthropic.com/en/api/messages\" --max-time 30)",
|
|
9
9
|
"Bash(curl -sv \"https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/api.md\" --max-time 30)",
|
|
10
|
-
"Bash(curl -s \"https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/refs/heads/main/README.md\" --max-time 30)"
|
|
10
|
+
"Bash(curl -s \"https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/refs/heads/main/README.md\" --max-time 30)",
|
|
11
|
+
"Bash(findstr /i goal)",
|
|
12
|
+
"Bash(bun run:*)",
|
|
13
|
+
"Bash(bunx tsc:*)",
|
|
14
|
+
"Bash(node_modules/.bin/tsc --noEmit --skipLibCheck)",
|
|
15
|
+
"WebFetch(domain:www.npmjs.com)",
|
|
16
|
+
"Bash(npm info:*)",
|
|
17
|
+
"Bash(npm pack:*)"
|
|
11
18
|
]
|
|
12
19
|
}
|
|
13
20
|
}
|
package/bin/bingo
CHANGED
|
@@ -18,10 +18,44 @@ fi
|
|
|
18
18
|
|
|
19
19
|
cd "$ROOT_DIR"
|
|
20
20
|
|
|
21
|
+
# ── bun 检测与自动安装 ──
|
|
22
|
+
if ! command -v bun &>/dev/null && [[ ! -x "$HOME/.bun/bin/bun" ]]; then
|
|
23
|
+
echo "[bingocode] bun 未检测到,正在通过 npm 安装..."
|
|
24
|
+
_TMP_DIR="$(mktemp -d)"
|
|
25
|
+
_ARCH="$(uname -m)"
|
|
26
|
+
if [[ "$_ARCH" == "aarch64" || "$_ARCH" == "arm64" ]]; then
|
|
27
|
+
_BUN_PKG="@oven/bun-linux-aarch64"
|
|
28
|
+
else
|
|
29
|
+
_BUN_PKG="@oven/bun-linux-x64"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if npm install "$_BUN_PKG" --prefix "$_TMP_DIR" --no-save --loglevel error; then
|
|
33
|
+
_BUN_SRC="$_TMP_DIR/node_modules/$_BUN_PKG/bin/bun"
|
|
34
|
+
if [[ -f "$_BUN_SRC" ]]; then
|
|
35
|
+
mkdir -p "$HOME/.bun/bin"
|
|
36
|
+
cp "$_BUN_SRC" "$HOME/.bun/bin/bun"
|
|
37
|
+
chmod +x "$HOME/.bun/bin/bun"
|
|
38
|
+
export PATH="$HOME/.bun/bin:$PATH"
|
|
39
|
+
echo "[bingocode] bun 安装完成,正在启动..."
|
|
40
|
+
else
|
|
41
|
+
echo "[bingocode] 安装失败:未找到 $_BUN_SRC" >&2
|
|
42
|
+
rm -rf "$_TMP_DIR"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
else
|
|
46
|
+
echo "[bingocode] npm install $_BUN_PKG 失败,请手动安装 bun: https://bun.sh" >&2
|
|
47
|
+
rm -rf "$_TMP_DIR"
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
rm -rf "$_TMP_DIR"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
BUN_BIN="$(command -v bun 2>/dev/null || echo "$HOME/.bun/bin/bun")"
|
|
54
|
+
|
|
21
55
|
if [[ -f .env ]]; then
|
|
22
56
|
ENV_FILE_FLAG="--env-file=.env"
|
|
23
57
|
else
|
|
24
58
|
ENV_FILE_FLAG=""
|
|
25
59
|
fi
|
|
26
60
|
|
|
27
|
-
exec
|
|
61
|
+
exec "$BUN_BIN" --preload ./preload.ts $ENV_FILE_FLAG ./src/entrypoints/manager.tsx "$@"
|
package/bin/bingo-win.cjs
CHANGED
|
@@ -72,26 +72,44 @@ function bunExists() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// 安装 bun
|
|
75
|
+
// 安装 bun(通过 npm 拉取官方包,不走 GitHub/bun.sh)
|
|
76
76
|
function installBun() {
|
|
77
|
-
console.log('[bingocode] bun
|
|
77
|
+
console.log('[bingocode] bun 未检测到,正在通过 npm 安装...');
|
|
78
|
+
|
|
79
|
+
// 用 npm install 拉取平台对应包,安装到临时目录后复制 bun.exe
|
|
80
|
+
const tmpDir = path.join(os.tmpdir(), 'bingocode-bun-install');
|
|
78
81
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
83
|
+
|
|
84
|
+
// npm install @oven/bun-windows-x64 到临时目录
|
|
85
|
+
const npmResult = spawnSync(
|
|
86
|
+
'npm',
|
|
87
|
+
['install', '@oven/bun-windows-x64', '--prefix', tmpDir, '--no-save', '--loglevel', 'error'],
|
|
88
|
+
{ stdio: 'inherit', shell: true }
|
|
84
89
|
);
|
|
85
|
-
if (
|
|
86
|
-
throw new Error(`
|
|
90
|
+
if (npmResult.status !== 0) {
|
|
91
|
+
throw new Error(`npm install 失败,exit code ${npmResult.status}`);
|
|
87
92
|
}
|
|
93
|
+
|
|
94
|
+
// 从 node_modules 复制 bun.exe → ~/.bun/bin/bun.exe
|
|
95
|
+
const src = path.join(tmpDir, 'node_modules', '@oven', 'bun-windows-x64', 'bin', 'bun.exe');
|
|
96
|
+
if (!fs.existsSync(src)) {
|
|
97
|
+
throw new Error(`未找到 ${src}`);
|
|
98
|
+
}
|
|
99
|
+
const destDir = path.dirname(bunPath);
|
|
100
|
+
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
101
|
+
fs.copyFileSync(src, bunPath);
|
|
102
|
+
|
|
88
103
|
console.log('[bingocode] bun 安装完成,正在启动...');
|
|
104
|
+
return true;
|
|
89
105
|
} catch (err) {
|
|
90
106
|
console.error(`[bingocode] bun 自动安装失败: ${err.message}`);
|
|
91
|
-
console.log('[bingocode]
|
|
107
|
+
console.log('[bingocode] 请手动安装 bun: npm install -g @oven/bun-windows-x64');
|
|
92
108
|
return false;
|
|
109
|
+
} finally {
|
|
110
|
+
// 清理临时目录(非阻塞)
|
|
111
|
+
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch (_) {}
|
|
93
112
|
}
|
|
94
|
-
return true;
|
|
95
113
|
}
|
|
96
114
|
|
|
97
115
|
if (!bunExists()) {
|
package/package.json
CHANGED
package/src/constants/prompts.ts
CHANGED
|
@@ -230,8 +230,9 @@ function getSimpleDoingTasksSection(): string {
|
|
|
230
230
|
`In general, do not propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.`,
|
|
231
231
|
`Do not create files unless they're absolutely necessary for achieving your goal. Generally prefer editing an existing file to creating a new one, as this prevents file bloat and builds on existing work more effectively.`,
|
|
232
232
|
`Avoid giving time estimates or predictions for how long tasks will take, whether for your own work or for users planning projects. Focus on what needs to be done, not how long it might take.`,
|
|
233
|
-
`
|
|
233
|
+
`On failure: diagnose before switching tactics. Don't retry blindly or abandon after one failure. Escalate with ${ASK_USER_QUESTION_TOOL_NAME} at objective thresholds: same error 3×, same file edited 4×, non-zero exit after 2 distinct fixes.`,
|
|
234
234
|
`Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it. Prioritize writing safe, secure, and correct code.`,
|
|
235
|
+
`Done = outcome verified + no new regressions + result stated. If unverifiable, say so. Never claim done on "looks right".`,
|
|
235
236
|
...codeStyleSubitems,
|
|
236
237
|
`Avoid backwards-compatibility hacks like renaming unused _vars, re-exporting types, adding // removed comments for removed code, etc. If you are certain that something is unused, you can delete it completely.`,
|
|
237
238
|
// @[MODEL LAUNCH]: False-claims mitigation for Capybara v8 (29-30% FC rate vs v4's 16.7%)
|
|
@@ -255,15 +256,21 @@ function getSimpleDoingTasksSection(): string {
|
|
|
255
256
|
function getActionsSection(): string {
|
|
256
257
|
return `# Executing actions with care
|
|
257
258
|
|
|
258
|
-
|
|
259
|
+
Two axes govern every action — reversibility and blast radius:
|
|
260
|
+
- Local + reversible (edit files, run tests): proceed freely.
|
|
261
|
+
- Hard-to-reverse OR affects shared state OR risky/destructive: confirm with user first.
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
- Destructive operations: deleting files/branches, dropping database tables, killing processes, rm -rf, overwriting uncommitted changes
|
|
262
|
-
- Hard-to-reverse operations: force-pushing (can also overwrite upstream), git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines
|
|
263
|
-
- Actions visible to others or that affect shared state: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services, modifying shared infrastructure or permissions
|
|
264
|
-
- Uploading content to third-party web tools (diagram renderers, pastebins, gists) publishes it - consider whether it could be sensitive before sending, since it may be cached or indexed even if later deleted.
|
|
263
|
+
The cost of asking is near zero; the cost of an unwanted action (lost work, deleted branches, sent messages) can be very high.
|
|
265
264
|
|
|
266
|
-
|
|
265
|
+
Risk categories requiring confirmation:
|
|
266
|
+
- Destructive: deleting files/branches, dropping tables, killing processes, rm -rf, overwriting uncommitted changes
|
|
267
|
+
- Hard-to-reverse: force-push, git reset --hard, amending published commits, removing or downgrading packages/dependencies, modifying CI/CD pipelines
|
|
268
|
+
- Shared-state visible: pushing code, creating/closing/commenting on PRs or issues, sending messages (Slack, email, GitHub), posting to external services, modifying shared infrastructure or permissions
|
|
269
|
+
- Third-party upload: diagram renderers, pastebins, gists — may be cached or indexed even if deleted later
|
|
270
|
+
|
|
271
|
+
Authorization: one-time approval covers only that scope — confirm again outside it, unless CLAUDE.md says otherwise. If asked to operate autonomously, proceed but remain risk-aware.
|
|
272
|
+
|
|
273
|
+
Obstacles: diagnose root causes; do not use destructive actions as shortcuts (e.g. --no-verify). Investigate unexpected state (unfamiliar files, branches, lock files) before deleting or overwriting — it may be in-progress work. Measure twice, cut once.`
|
|
267
274
|
}
|
|
268
275
|
|
|
269
276
|
function getUsingYourToolsSection(enabledTools: Set<string>): string {
|
|
@@ -415,21 +422,26 @@ These user-facing text instructions do not apply to code or tool calls.`
|
|
|
415
422
|
}
|
|
416
423
|
return `# Output efficiency
|
|
417
424
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
Keep your text output brief and direct. Lead with the answer or action, not the reasoning. Skip filler words, preamble, and unnecessary transitions. Do not restate what the user said — just do it. When explaining, include only what is necessary for the user to understand.
|
|
425
|
+
Lead with the answer. Be concise. Skip preamble, filler, and restatement.
|
|
421
426
|
|
|
422
427
|
Focus text output on:
|
|
423
428
|
- Decisions that need the user's input
|
|
424
429
|
- High-level status updates at natural milestones
|
|
425
430
|
- Errors or blockers that change the plan
|
|
426
431
|
|
|
432
|
+
Format by situation:
|
|
433
|
+
- Direct question or simple task → single sentence or one short paragraph, no headers
|
|
434
|
+
- Multi-step result with distinct outcomes → bullet list, no prose wrapper
|
|
435
|
+
- Explanation of a decision or tradeoff → two sentences max, lead with conclusion
|
|
436
|
+
- Error report → one line: what failed, why, what you'll try next
|
|
437
|
+
|
|
427
438
|
If you can say it in one sentence, don't use three. Prefer short, direct sentences over long explanations. This does not apply to code or tool calls.`
|
|
428
439
|
}
|
|
429
440
|
|
|
430
441
|
function getSimpleToneAndStyleSection(): string {
|
|
431
442
|
const items = [
|
|
432
443
|
`Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.`,
|
|
444
|
+
`Mirror the user's language in all responses unless a language preference is configured.`,
|
|
433
445
|
process.env.USER_TYPE === 'ant'
|
|
434
446
|
? null
|
|
435
447
|
: `Your responses should be short and concise.`,
|
|
@@ -838,7 +850,7 @@ function getFunctionResultClearingSection(model: string): string | null {
|
|
|
838
850
|
Old tool results will be automatically cleared from context to free up space. The ${config.keepRecent} most recent results are always kept.`
|
|
839
851
|
}
|
|
840
852
|
|
|
841
|
-
const SUMMARIZE_TOOL_RESULTS_SECTION = `When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.`
|
|
853
|
+
const SUMMARIZE_TOOL_RESULTS_SECTION = `When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later. After compaction: don't assume prior state holds — re-read files and re-run verifications before continuing.`
|
|
842
854
|
|
|
843
855
|
function getBriefSection(): string | null {
|
|
844
856
|
if (!(feature('KAIROS') || feature('KAIROS_BRIEF'))) return null
|
|
@@ -19,7 +19,10 @@ export async function evaluateGoal(
|
|
|
19
19
|
goalCondition: string,
|
|
20
20
|
messages: MessageType[],
|
|
21
21
|
): Promise<GoalEvalResult> {
|
|
22
|
-
const client = new Anthropic(
|
|
22
|
+
const client = new Anthropic({
|
|
23
|
+
baseURL: process.env.ANTHROPIC_BASE_URL ?? undefined,
|
|
24
|
+
apiKey: process.env.ANTHROPIC_API_KEY ?? 'dummy',
|
|
25
|
+
})
|
|
23
26
|
|
|
24
27
|
const recentAssistantTexts = messages
|
|
25
28
|
.filter(m => m.type === 'assistant' || m.role === 'assistant')
|