bingocode 1.1.200-beta.7 → 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.7",
3
+ "version": "1.1.200-beta.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -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
- disableLoginPrompt: false,
649
- environmentVariables: [
650
- { name: "ANTHROPIC_BASE_URL", value: "https://api.anthropic.com" },
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
  }
@@ -3000,6 +3000,7 @@ export async function loadFullLog(log: LogOption): Promise<LogOption> {
3000
3000
  prUrls,
3001
3001
  prRepositories,
3002
3002
  modes,
3003
+ brainModes,
3003
3004
  worktreeStates,
3004
3005
  fileHistorySnapshots,
3005
3006
  attributionSnapshots,
@@ -3043,6 +3044,7 @@ export async function loadFullLog(log: LogOption): Promise<LogOption> {
3043
3044
  agentColor: sessionId ? agentColors.get(sessionId) : log.agentColor,
3044
3045
  agentSetting: sessionId ? agentSettings.get(sessionId) : log.agentSetting,
3045
3046
  mode: sessionId ? (modes.get(sessionId) as LogOption['mode']) : log.mode,
3047
+ brainMode: sessionId ? brainModes.get(sessionId) : log.brainMode,
3046
3048
  worktreeSession:
3047
3049
  sessionId && worktreeStates.has(sessionId)
3048
3050
  ? worktreeStates.get(sessionId)
@@ -3514,6 +3516,7 @@ export async function loadTranscriptFile(
3514
3516
  prUrls: Map<UUID, string>
3515
3517
  prRepositories: Map<UUID, string>
3516
3518
  modes: Map<UUID, string>
3519
+ brainModes: Map<UUID, boolean>
3517
3520
  worktreeStates: Map<UUID, PersistedWorktreeSession | null>
3518
3521
  fileHistorySnapshots: Map<UUID, FileHistorySnapshotMessage>
3519
3522
  attributionSnapshots: Map<UUID, AttributionSnapshotMessage>
@@ -3836,6 +3839,7 @@ export async function loadTranscriptFile(
3836
3839
  prUrls,
3837
3840
  prRepositories,
3838
3841
  modes,
3842
+ brainModes,
3839
3843
  worktreeStates,
3840
3844
  fileHistorySnapshots,
3841
3845
  attributionSnapshots,
@@ -4646,6 +4650,7 @@ export async function loadAllLogsFromSessionFile(
4646
4650
  prUrls,
4647
4651
  prRepositories,
4648
4652
  modes,
4653
+ brainModes,
4649
4654
  fileHistorySnapshots,
4650
4655
  attributionSnapshots,
4651
4656
  contentReplacements,