bingocode 1.1.200-beta.6 → 1.1.200-beta.8

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.6",
3
+ "version": "1.1.200-beta.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -2328,7 +2328,7 @@ function buildBorderText(showFastIcon: boolean, showFastIconHint: boolean, fastM
2328
2328
  segments.push(showFastIconHint ? `${getFastIconString(true, fastModeCooldown)} ${chalk.dim('/fast')}` : getFastIconString(true, fastModeCooldown))
2329
2329
  }
2330
2330
  if (isBrainMode) {
2331
- segments.push(chalk.yellow('» EXEC'))
2331
+ segments.push(chalk.yellow('BRAIN'))
2332
2332
  }
2333
2333
  return { content: ` ${segments.join(' ')} `, position: 'top', align: 'end', offset: 0 }
2334
2334
  }
@@ -530,6 +530,14 @@ export class ProviderService {
530
530
 
531
531
  // --- VS Code linking ---
532
532
 
533
+ private buildBingoEnv(envVars: Array<{ name: string; value: string }>): Record<string, string> {
534
+ const env: Record<string, string> = {}
535
+ for (const v of envVars) {
536
+ env[v.name] = v.value
537
+ }
538
+ return env
539
+ }
540
+
533
541
  /**
534
542
  * Build the environmentVariables array for VS Code claudeCode settings
535
543
  * based on current slot configuration. Uses user-set labels or falls back
@@ -582,6 +590,12 @@ export class ProviderService {
582
590
  const candidatePaths = getVscodeSettingsPaths()
583
591
  const writtenPaths: string[] = []
584
592
 
593
+ // Save pre-link bingo env so we can restore it on disconnect.
594
+ const bingoSettings = await this.readSettings()
595
+ const preLinkEnv = bingoSettings.env ?? null
596
+ bingoSettings.vscodePreLinkEnv = preLinkEnv
597
+ await this.writeSettings(bingoSettings)
598
+
585
599
  for (const settingsPath of candidatePaths) {
586
600
  // Only write if the editor config directory exists (editor is installed)
587
601
  const editorDir = path.dirname(path.dirname(settingsPath))
@@ -618,40 +632,45 @@ export class ProviderService {
618
632
  }
619
633
 
620
634
  // Persist so re-sync on restart and unlink work correctly
621
- const bingoSettings = await this.readSettings()
622
635
  bingoSettings.vscodeLinked = true
623
636
  bingoSettings.vscodeLinkedPaths = writtenPaths
637
+ bingoSettings.env = this.buildBingoEnv(envVars)
624
638
  await this.writeSettings(bingoSettings)
625
639
 
626
640
  return { paths: writtenPaths, linked: true }
627
641
  }
628
642
 
629
643
  /**
630
- * Write explicit overrides so VS Code's Claude extension bypasses bingo
631
- * and goes directly to the official Anthropic API.
644
+ * Restore pre-link bingo env so the CLI no longer routes through the proxy,
645
+ * and reset VS Code settings to a clean state without disableLoginPrompt.
632
646
  *
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.
647
+ * Without this, the only way to stop VS Code from using bingo would be to
648
+ * delete ~/.claude/bingo/settings.json entirely which would also kill CLI
649
+ * routing. Saving/restoring the pre-link env keeps CLI and VS Code independent.
638
650
  */
639
651
  async unlinkVscode(): Promise<{ paths: string[]; linked: boolean }> {
640
652
  const bingoSettings = await this.readSettings()
641
653
  const linkedPaths = (bingoSettings.vscodeLinkedPaths as string[]) || []
642
654
 
655
+ // Restore bingo env to pre-link state
656
+ const preLinkEnv = bingoSettings.vscodePreLinkEnv
657
+ if (preLinkEnv !== undefined) {
658
+ if (preLinkEnv === null || Object.keys(preLinkEnv as Record<string, unknown>).length === 0) {
659
+ delete bingoSettings.env
660
+ } else {
661
+ bingoSettings.env = preLinkEnv
662
+ }
663
+ delete bingoSettings.vscodePreLinkEnv
664
+ }
665
+
643
666
  for (const settingsPath of linkedPaths) {
644
667
  try {
645
668
  const raw = await fs.readFile(settingsPath, "utf-8")
646
669
  const settings = JSON.parse(raw)
647
670
  settings.claudeCode = {
648
- environmentVariables: [
649
- { name: "ANTHROPIC_BASE_URL", value: "https://api.anthropic.com" },
650
- { name: "ANTHROPIC_AUTH_TOKEN", value: "" },
651
- ],
671
+ preferredLocation: "panel",
652
672
  }
653
- await fs.writeFile(settingsPath, JSON.stringify(settings, null, 4) + '
654
- ')
673
+ await fs.writeFile(settingsPath, JSON.stringify(settings, null, 4) + '\n')
655
674
  } catch {
656
675
  // File may have been moved or deleted since linking — harmless
657
676
  }
package/src/types/logs.ts CHANGED
@@ -48,6 +48,7 @@ export type LogOption = {
48
48
  prUrl?: string // Full URL to the linked PR
49
49
  prRepository?: string // Repository in "owner/repo" format
50
50
  mode?: 'coordinator' | 'normal' // Session mode for coordinator/normal detection
51
+ brainMode?: boolean
51
52
  worktreeSession?: PersistedWorktreeSession | null // Worktree state at session end (null = exited, undefined = never entered)
52
53
  contentReplacements?: ContentReplacementRecord[] // Replacement decisions for resume reconstruction
53
54
  }
@@ -583,6 +583,7 @@ export async function loadConversationForResume(
583
583
  customTitle: log?.customTitle,
584
584
  tag: log?.tag,
585
585
  mode: log?.mode,
586
+ brainMode: log?.brainMode,
586
587
  worktreeSession: log?.worktreeSession,
587
588
  prNumber: log?.prNumber,
588
589
  prUrl: log?.prUrl,
@@ -308,6 +308,7 @@ type ResumeLoadResult = {
308
308
  customTitle?: string
309
309
  tag?: string
310
310
  mode?: 'coordinator' | 'normal'
311
+ brainMode?: boolean
311
312
  worktreeSession?: PersistedWorktreeSession | null
312
313
  prNumber?: number
313
314
  prUrl?: string
@@ -2892,7 +2892,17 @@ export function saveMode(mode: 'coordinator' | 'normal'): void {
2892
2892
  }
2893
2893
 
2894
2894
  export function saveBrainMode(enabled: boolean): void {
2895
- getProject().currentSessionBrainMode = enabled
2895
+ const project = getProject()
2896
+ project.currentSessionBrainMode = enabled
2897
+ // Write eagerly when session file already exists, so /brain toggle
2898
+ // persists even if the session is exited before the first message.
2899
+ if (project.sessionFile !== null) {
2900
+ appendEntryToFile(project.sessionFile, {
2901
+ type: 'brain-mode',
2902
+ brainMode: enabled,
2903
+ sessionId: getSessionId(),
2904
+ })
2905
+ }
2896
2906
  }
2897
2907
 
2898
2908
  export function getCurrentSessionBrainMode(): boolean | undefined {
@@ -2990,6 +3000,7 @@ export async function loadFullLog(log: LogOption): Promise<LogOption> {
2990
3000
  prUrls,
2991
3001
  prRepositories,
2992
3002
  modes,
3003
+ brainModes,
2993
3004
  worktreeStates,
2994
3005
  fileHistorySnapshots,
2995
3006
  attributionSnapshots,
@@ -3033,6 +3044,7 @@ export async function loadFullLog(log: LogOption): Promise<LogOption> {
3033
3044
  agentColor: sessionId ? agentColors.get(sessionId) : log.agentColor,
3034
3045
  agentSetting: sessionId ? agentSettings.get(sessionId) : log.agentSetting,
3035
3046
  mode: sessionId ? (modes.get(sessionId) as LogOption['mode']) : log.mode,
3047
+ brainMode: sessionId ? brainModes.get(sessionId) : log.brainMode,
3036
3048
  worktreeSession:
3037
3049
  sessionId && worktreeStates.has(sessionId)
3038
3050
  ? worktreeStates.get(sessionId)
@@ -3504,6 +3516,7 @@ export async function loadTranscriptFile(
3504
3516
  prUrls: Map<UUID, string>
3505
3517
  prRepositories: Map<UUID, string>
3506
3518
  modes: Map<UUID, string>
3519
+ brainModes: Map<UUID, boolean>
3507
3520
  worktreeStates: Map<UUID, PersistedWorktreeSession | null>
3508
3521
  fileHistorySnapshots: Map<UUID, FileHistorySnapshotMessage>
3509
3522
  attributionSnapshots: Map<UUID, AttributionSnapshotMessage>
@@ -3826,6 +3839,7 @@ export async function loadTranscriptFile(
3826
3839
  prUrls,
3827
3840
  prRepositories,
3828
3841
  modes,
3842
+ brainModes,
3829
3843
  worktreeStates,
3830
3844
  fileHistorySnapshots,
3831
3845
  attributionSnapshots,
@@ -4636,6 +4650,7 @@ export async function loadAllLogsFromSessionFile(
4636
4650
  prUrls,
4637
4651
  prRepositories,
4638
4652
  modes,
4653
+ brainModes,
4639
4654
  fileHistorySnapshots,
4640
4655
  attributionSnapshots,
4641
4656
  contentReplacements,