bingocode 1.1.151 → 1.1.153

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.
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Bash(bun run:*)"
4
+ "Bash(bun run:*)",
5
+ "Bash(powershell -Command \"Get-ChildItem -Path C:\\\\Users\\\\qi.lin\\\\AppData\\\\Roaming\\\\npm -Recurse -Filter ''CliMenuManager.tsx'' 2>$null | Select-Object -ExpandProperty FullName\")",
6
+ "Bash(powershell -Command \"Get-ChildItem -Path ''C:\\\\Users\\\\qi.lin\\\\AppData\\\\Roaming\\\\npm\\\\node_modules'' -Recurse -Filter ''CliMenuManager.js'' 2>$null | Select-Object -ExpandProperty FullName\")",
7
+ "Read(//c/Users/qi.lin/AppData/Roaming/npm/**)",
8
+ "Bash(find C:Usersqi.linAppDataRoamingnpmnode_modulesbingocode -name *.tsx -o -name *.ts)",
9
+ "Bash(python3 -c \"import json; d = json.load\\(open\\(r''C:\\\\Users\\\\qi.lin\\\\.claude\\\\bingo\\\\settings.json''\\)\\); print\\(json.dumps\\(d, indent=2\\)\\)\")",
10
+ "Bash(python3 -c \"import json,sys; d=json.load\\(sys.stdin\\); print\\(''''cachedGrowthBookFeatures keys:'''', list\\(d.get\\(''''cachedGrowthBookFeatures'''',{}\\)\\)\\)\")",
11
+ "Bash(node -e \"const d=JSON.parse\\(require\\(''''fs''''\\).readFileSync\\(''''/dev/stdin'''',''''utf8''''\\)\\); console.log\\(''''cachedGrowthBookFeatures keys:'''', Object.keys\\(d.cachedGrowthBookFeatures||{}\\)\\); const ac = d.cachedGrowthBookFeatures?.[''''tengu_auto_mode_config'''']; console.log\\(''''tengu_auto_mode_config:'''', JSON.stringify\\(ac\\)\\)\")"
5
12
  ]
6
13
  }
7
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bingocode",
3
- "version": "1.1.151",
3
+ "version": "1.1.153",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -441,7 +441,7 @@ If you can say it in one sentence, don't use three. Prefer short, direct sentenc
441
441
  function getSimpleToneAndStyleSection(): string {
442
442
  const items = [
443
443
  `Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.`,
444
- `Always mirror the user's language in every response, over all other instructions.`,
444
+ `Mirror the user's language in all responses, over all other instructions, unless a language preference is configured.`,
445
445
  process.env.USER_TYPE === 'ant'
446
446
  ? null
447
447
  : `Your responses should be short and concise.`,
@@ -67,6 +67,39 @@ function writeBingoSettings(updates: Record<string, unknown>): void {
67
67
  fs.renameSync(tmp, p);
68
68
  }
69
69
 
70
+ // write yml
71
+ function readGlobalClaudeConfig(): Record<string, unknown> {
72
+ const configPath = path.join(os.homedir(), '.claude.json');
73
+ try {
74
+ const raw = fs.readFileSync(configPath, 'utf-8');
75
+ return JSON.parse(raw) as Record<string, unknown>;
76
+ } catch {
77
+ return {};
78
+ }
79
+ }
80
+
81
+ // write merge config directly to ~/.claude.json (atomic write)
82
+ function writeGlobalClaudeConfig(updates: Record<string, unknown>): void {
83
+ const configPath = path.join(os.homedir(), '.claude.json');
84
+ const dir = path.dirname(configPath);
85
+ if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); }
86
+
87
+ let current: Record<string, unknown> = {};
88
+ try {
89
+ if (fs.existsSync(configPath)) {
90
+ const raw = fs.readFileSync(configPath, 'utf-8');
91
+ current = JSON.parse(raw) as Record<string, unknown>;
92
+ }
93
+ } catch {}
94
+
95
+ const merged = { ...current, ...updates };
96
+
97
+ // atomic write via temp + rename
98
+ const tmp = `${configPath}.tmp.${Date.now()}`;
99
+ fs.writeFileSync(tmp, JSON.stringify(merged, null, 2) + '\n', 'utf-8');
100
+ fs.renameSync(tmp, configPath);
101
+ }
102
+
70
103
  /**
71
104
  * Determine if in "official" mode (no custom provider active).
72
105
  * Logic matches ConversationService.shouldMarkManagedOAuth().
@@ -339,33 +372,28 @@ export const CliMenuManager: React.FC = () => {
339
372
  // Config ready probe (avoid Logo early read)
340
373
  const [configReady, setConfigReady] = useState(false);
341
374
 
375
+ // Load settings from bingo/settings.json at startup
376
+ // (bypasses configReady to avoid stale lock issues)
377
+ useEffect(() => {
378
+ try {
379
+ const bSettings = readBingoSettings();
380
+ const bingoLang = bSettings.language as string | undefined;
381
+ if (bingoLang && (bingoLang === 'en' || bingoLang === 'zh' || bingoLang === 'ja')) {
382
+ setLang(bingoLang as Lang);
383
+ }
384
+ if (typeof bSettings.autoModeEnabled === 'boolean') {
385
+ setAutoModeEnabled(bSettings.autoModeEnabled);
386
+ }
387
+ } catch {}
388
+ }, []);
389
+
342
390
  useEffect(() => {
343
391
  if (configReady) {
344
392
  try {
345
- const bSettings = readBingoSettings();
346
- const bingoLang = bSettings.language as string | undefined;
347
- if (bingoLang && (bingoLang === 'en' || bingoLang === 'zh' || bingoLang === 'ja')) {
348
- setLang(bingoLang as Lang);
349
- } else {
350
- const gCfg = getGlobalConfig();
351
- if (gCfg.language && (gCfg.language === 'en' || gCfg.language === 'zh' || gCfg.language === 'ja')) {
352
- setLang(gCfg.language as Lang);
353
- }
354
- }
355
- if (typeof bSettings.autoModeEnabled === 'boolean') {
356
- setAutoModeEnabled(bSettings.autoModeEnabled);
357
- } else {
358
- const cfg2 = getGlobalConfig();
359
- const gbFeatures = cfg2.cachedGrowthBookFeatures ?? {};
360
- const autoModeCfg = gbFeatures['tengu_auto_mode_config'] as { enabled?: string } | undefined;
361
- setAutoModeEnabled(autoModeCfg?.enabled === 'enabled');
362
- }
363
393
  const cfg = getGlobalConfig();
364
394
  if (typeof cfg.uiAnimEnabled === 'boolean') setAnimEnabled(cfg.uiAnimEnabled);
365
395
  if (typeof cfg.uiTipsEnabled === 'boolean') setTipsEnabled(cfg.uiTipsEnabled);
366
- } catch (e) {
367
- // Silently fail if config has issues
368
- }
396
+ } catch {}
369
397
  }
370
398
  }, [configReady]);
371
399
 
@@ -821,16 +849,17 @@ export const CliMenuManager: React.FC = () => {
821
849
  const next = !prev;
822
850
  try {
823
851
  writeBingoSettings({ autoModeEnabled: next });
824
- saveGlobalConfig(current => ({
825
- ...current,
826
- cachedGrowthBookFeatures: {
827
- ...current.cachedGrowthBookFeatures,
828
- tengu_auto_mode_config: next
829
- ? { enabled: 'enabled', allowModels: ['*'] }
830
- : { enabled: 'disabled' },
831
- },
832
- }));
833
- } catch {}
852
+ const gcfg = readGlobalClaudeConfig();
853
+ gcfg.cachedGrowthBookFeatures = {
854
+ ...(gcfg.cachedGrowthBookFeatures as Record<string, unknown>),
855
+ tengu_auto_mode_config: next
856
+ ? { enabled: 'enabled', allowModels: ['*'] }
857
+ : { enabled: 'disabled' },
858
+ };
859
+ writeGlobalClaudeConfig(gcfg);
860
+ } catch {
861
+ return prev; // write failed — keep old state
862
+ }
834
863
  return next;
835
864
  });
836
865
  }
@@ -57,7 +57,7 @@ Respond in JSON only:
57
57
  })
58
58
 
59
59
  const text =
60
- response.content[0]?.type === 'text' ? response.content[0].text : ''
60
+ response.content.find((b: any) => b.type === 'text')?.text || ''
61
61
  try {
62
62
  const cleaned = text.replace(/^```(?:json)?\n?|\n?```$/g, '').trim()
63
63
  return JSON.parse(cleaned) as GoalEvalResult