bingocode 1.1.200-beta.2 → 1.1.200-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bingocode",
3
- "version": "1.1.200-beta.2",
3
+ "version": "1.1.200-beta.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -5,7 +5,7 @@ import {
5
5
  logEvent,
6
6
  } from '../../services/analytics/index.js'
7
7
  import { logError } from '../../utils/log.js'
8
- import { updateSettingsForSource } from '../../utils/settings/settings.js'
8
+ import { saveBrainMode } from '../../utils/sessionStorage.js'
9
9
 
10
10
  export async function call(
11
11
  onDone: LocalJSXCommandOnDone,
@@ -16,18 +16,13 @@ export async function call(
16
16
  const arg = (args ?? '').trim().toLowerCase()
17
17
  const enable = arg !== 'off'
18
18
 
19
- const result = updateSettingsForSource('userSettings', { brainMode: enable })
20
- if (result.error) {
21
- logError(result.error)
22
- onDone(`Failed to ${enable ? 'enable' : 'disable'} Brain Mode: ${result.error.message}`, { display: 'system' })
23
- return null
24
- }
25
-
26
19
  if (enable) {
27
20
  context.setAppState(prev => ({ ...prev, brainMode: true }))
28
- onDone('✓ Brain Mode enabled — thinking, deciding, orchestrating.', { display: 'system' })
21
+ saveBrainMode(true)
22
+ onDone('✓ Brain Mode enabled — this session only.', { display: 'system' })
29
23
  } else {
30
24
  context.setAppState(prev => ({ ...prev, brainMode: false }))
25
+ saveBrainMode(false)
31
26
  onDone('✗ Brain Mode disabled — back to full execution.', { display: 'system' })
32
27
  }
33
28
 
@@ -927,8 +927,8 @@ The user context may include a \`terminalFocus\` field indicating whether the us
927
927
  }
928
928
 
929
929
  function getBrainPolicySection(): string | null {
930
- const settings = getInitialSettings()
931
- if (!settings.brainMode) return null
930
+ const { getCurrentSessionBrainMode } = require('./sessionStorage.js')
931
+ if (!getInitialSettings().brainMode && !getCurrentSessionBrainMode()) return null
932
932
  return `# Brain Mode (/brain)
933
933
 
934
934
  You are the coordinator — the brain, not the hands. Your context window is precious
package/src/main.tsx CHANGED
@@ -126,7 +126,7 @@ import { getGlobExclusionsForPluginCache } from './utils/plugins/orphanedPluginF
126
126
  import { getPluginSeedDirs } from './utils/plugins/pluginDirectories.js';
127
127
  import { countFilesRoundedRg } from './utils/ripgrep.js';
128
128
  import { processSessionStartHooks, processSetupHooks } from './utils/sessionStart.js';
129
- import { cacheSessionTitle, getSessionIdFromLog, loadTranscriptFromFile, saveAgentSetting, saveMode, searchSessionsByCustomTitle, sessionIdExists } from './utils/sessionStorage.js';
129
+ import { cacheSessionTitle, getCurrentSessionBrainMode, getSessionIdFromLog, loadTranscriptFromFile, saveAgentSetting, saveMode, searchSessionsByCustomTitle, sessionIdExists } from './utils/sessionStorage.js';
130
130
  import { ensureMdmSettingsLoaded } from './utils/settings/mdm/settings.js';
131
131
  import { getInitialSettings, getManagedSettingsKeysForLogging, getSettingsForSource, getSettingsWithErrors } from './utils/settings/settings.js';
132
132
  import { resetSettingsCache } from './utils/settings/settingsCache.js';
@@ -2640,7 +2640,7 @@ async function run(): Promise<CommanderCommand> {
2640
2640
  ...(isFastModeEnabled() && {
2641
2641
  fastMode: getInitialFastModeSetting(effectiveModel ?? null)
2642
2642
  }),
2643
- brainMode: getInitialSettings().brainMode === true,
2643
+ brainMode: getInitialSettings().brainMode === true || getCurrentSessionBrainMode() === true,
2644
2644
  ...(isAdvisorEnabled() && advisorModel && {
2645
2645
  advisorModel
2646
2646
  }),
@@ -627,8 +627,14 @@ export class ProviderService {
627
627
  }
628
628
 
629
629
  /**
630
- * Remove claudeCode keys from all previously-linked VS Code settings files.
631
- * Does NOT delete the entire file — it only removes the claudeCode key.
630
+ * Write explicit overrides so VS Code's Claude extension bypasses bingo
631
+ * and goes directly to the official Anthropic API.
632
+ *
633
+ * Simply deleting claudeCode is NOT enough — the spawned CLI falls back to
634
+ * ~/.claude/bingo/settings.json which still has proxy routing + auth token.
635
+ * By writing ANTHROPIC_BASE_URL=https://api.anthropic.com (without
636
+ * ANTHROPIC_AUTH_TOKEN), the extension's environmentVariables take highest
637
+ * priority and override any bingo fallback, forcing the login screen.
632
638
  */
633
639
  async unlinkVscode(): Promise<{ paths: string[]; linked: boolean }> {
634
640
  const bingoSettings = await this.readSettings()
@@ -638,12 +644,7 @@ export class ProviderService {
638
644
  try {
639
645
  const raw = await fs.readFile(settingsPath, "utf-8")
640
646
  const settings = JSON.parse(raw)
641
- // Point away from bingo proxy to official Anthropic API.
642
- // env vars take precedence over ~/.claude/bingo/settings.json
643
- // so the spawned CLI does NOT route through bingo.
644
647
  settings.claudeCode = {
645
- preferredLocation: "panel",
646
- disableLoginPrompt: true,
647
648
  environmentVariables: [
648
649
  { name: "ANTHROPIC_BASE_URL", value: "https://api.anthropic.com" },
649
650
  ],
@@ -659,26 +660,6 @@ export class ProviderService {
659
660
  delete bingoSettings.vscodeLinkedPaths
660
661
  await this.writeSettings(bingoSettings)
661
662
 
662
- return { paths: linkedPaths, linked: false }
663
- }> {
664
- const bingoSettings = await this.readSettings()
665
- const linkedPaths = (bingoSettings.vscodeLinkedPaths as string[]) || []
666
-
667
- for (const settingsPath of linkedPaths) {
668
- try {
669
- const raw = await fs.readFile(settingsPath, "utf-8")
670
- const settings = JSON.parse(raw)
671
- delete settings.claudeCode
672
- await fs.writeFile(settingsPath, JSON.stringify(settings, null, 4) + '\n')
673
- } catch {
674
- // File may have been moved or deleted since linking — harmless
675
- }
676
- }
677
-
678
- bingoSettings.vscodeLinked = false
679
- delete bingoSettings.vscodeLinkedPaths
680
- await this.writeSettings(bingoSettings)
681
-
682
663
  return { paths: linkedPaths, linked: false }
683
664
  }
684
665
 
@@ -1594,7 +1594,8 @@ function getCriticalSystemReminderAttachment(
1594
1594
  }
1595
1595
 
1596
1596
  function getBrainModeReminderAttachment(): Attachment[] {
1597
- if (!getInitialSettings().brainMode) {
1597
+ const { getCurrentSessionBrainMode } = require('./sessionStorage.js')
1598
+ if (!getInitialSettings().brainMode && !getCurrentSessionBrainMode()) {
1598
1599
  return []
1599
1600
  }
1600
1601
  return [
@@ -546,6 +546,7 @@ export async function processResumedConversation(
546
546
  ...(restoredAttribution && { attribution: restoredAttribution }),
547
547
  ...(standaloneAgentContext && { standaloneAgentContext }),
548
548
  agentDefinitions: refreshedAgentDefs,
549
+ brainMode: result.brainMode ?? false,
549
550
  },
550
551
  }
551
552
  }