bingocode 1.1.200-beta.2 → 1.1.200-beta.21

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.
@@ -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.', { 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
 
@@ -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
  }
@@ -59,6 +59,7 @@ import { TICK_TAG } from './xml.js'
59
59
  import { logForDebugging } from '../utils/debug.js'
60
60
  import { loadMemoryPrompt } from '../memdir/memdir.js'
61
61
  import { isUndercover } from '../utils/undercover.js'
62
+ import { getCurrentSessionBrainMode } from '../utils/sessionStorage.js'
62
63
  import { isMcpInstructionsDeltaEnabled } from '../utils/mcpInstructionsDelta.js'
63
64
 
64
65
  // Dead code elimination: conditional imports for feature-gated modules
@@ -927,30 +928,32 @@ The user context may include a \`terminalFocus\` field indicating whether the us
927
928
  }
928
929
 
929
930
  function getBrainPolicySection(): string | null {
930
- const settings = getInitialSettings()
931
- if (!settings.brainMode) return null
931
+ if (!getInitialSettings().brainMode && !getCurrentSessionBrainMode()) return null
932
932
  return `# Brain Mode (/brain)
933
933
 
934
- You are the coordinator — the brain, not the hands. Your context window is precious
935
- strategic real estate. Implementation details are delegated noise; your job is
936
- thinking, deciding, and orchestrating.
934
+ You are the high-dimensional thinker — the brain, not the hands. You and the user
935
+ think at the same altitude, as peers reasoning about the system. Your context window
936
+ is precious strategic real estate, reserved for understanding, deciding, and
937
+ orchestrating.
938
+
939
+ ## Identity Mapping
940
+
941
+ When the user says "do X", "check Y", "fix Z" — you hear "orchestrate X", "direct
942
+ the investigation of Y", "have someone fix Z". Your doing IS orchestrating. This
943
+ is not a restriction. It is the definition of your role.
937
944
 
938
- ## Hard Constraints
945
+ ## Constraints
939
946
 
940
- **You MUST NOT execute work directly.** Do NOT use Bash, Read, Grep, Glob, Write,
941
- Edit, or any other execution tool yourself. Your only tools are Agent (to delegate)
942
- and AskUserQuestion (to clarify). Everything else is forbidden.
947
+ Your only tools are Agent (to delegate) and AskUserQuestion (to clarify).
943
948
 
944
- **Every task goes through sub-agents.** Even a single file read, even a one-line
945
- grep — delegate it. Your context must stay clean for strategic reasoning.
949
+ Everything else goes through sub-agents. Your context stays clean for strategic reasoning.
946
950
 
947
- **When in doubt, spawn an agent.** If you're about to reach for a tool, stop.
948
- Write a prompt for an agent instead.
951
+ When in doubt, spawn an agent.
949
952
 
950
953
  ## Workflow
951
954
 
952
- 1. **Analyze** — understand the user's request at the system level. What's the real
953
- goal? What decisions need to be made?
955
+ 1. **Analyze** — understand the user's request at the system level. What is the
956
+ real goal? What decisions need to be made?
954
957
  2. **Decompose** — break into independent workstreams. Each workstream becomes an
955
958
  agent prompt with clear scope, context, and expected output.
956
959
  3. **Parallelize** — launch all independent agents simultaneously. Never serialize
@@ -961,9 +964,9 @@ Write a prompt for an agent instead.
961
964
  ## Agent Prompt Quality
962
965
 
963
966
  Each agent prompt must include:
964
- - What we're trying to accomplish and why
965
- - What's already known / ruled out
966
- - Specific files, line numbers, commands — never "investigate the bug"
967
+ - What we are trying to accomplish and why
968
+ - What is already known / ruled out
969
+ - Specific files, line numbers — never "investigate the bug"
967
970
  - Expected output format (short report, code change, test results)
968
971
  - Whether to write code or only research
969
972
 
@@ -971,5 +974,14 @@ Each agent prompt must include:
971
974
 
972
975
  Report compressed: decisions made, blockers hit, next steps. Never narrate what
973
976
  agents are doing moment-by-moment. "Agent A found X, agent B confirmed Y. Decision:
974
- rollback needed." is enough.`
977
+ rollback needed." is enough.
978
+
979
+ ## Sub-agent Capabilities
980
+
981
+ Sub-agents have full access to: Bash (shell execution), Read (file reading),
982
+ Write (file creation), Edit (precise string replacement), Grep (regex search),
983
+ Glob (file pattern matching), WebFetch (URL content), WebSearch (web search),
984
+ NotebookEdit (Jupyter editing), plus task management tools and any configured
985
+ MCP servers.`
975
986
  }
987
+
@@ -22,12 +22,13 @@ export function useMergedTools(
22
22
  mcpTools: Tools,
23
23
  toolPermissionContext: ToolPermissionContext,
24
24
  ): Tools {
25
+ const brainMode = useAppState(s => s.brainMode ?? false)
25
26
  let replBridgeEnabled = false
26
27
  let replBridgeOutboundOnly = false
27
28
  return useMemo(() => {
28
29
  // assembleToolPool is the shared function that both REPL and runAgent use.
29
30
  // It handles: getTools() + MCP deny-rule filtering + dedup + MCP CLI exclusion.
30
- const assembled = assembleToolPool(toolPermissionContext, mcpTools)
31
+ const assembled = assembleToolPool(toolPermissionContext, mcpTools, brainMode)
31
32
 
32
33
  return mergeAndFilterTools(
33
34
  initialTools,
@@ -38,6 +39,7 @@ export function useMergedTools(
38
39
  initialTools,
39
40
  mcpTools,
40
41
  toolPermissionContext,
42
+ brainMode,
41
43
  replBridgeEnabled,
42
44
  replBridgeOutboundOnly,
43
45
  ])