dual-brain 0.3.30 → 0.3.32

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.
Files changed (2) hide show
  1. package/bin/dual-brain.mjs +26 -3
  2. package/package.json +1 -1
@@ -1481,6 +1481,9 @@ async function cmdRuntimeSwitch(args = []) {
1481
1481
  let provider = _sessionTool(sess);
1482
1482
  let reason = 'head-runtime-switch';
1483
1483
  const confirmed = args.includes('--confirm') || args.includes('--go');
1484
+ const explicitModel = args.includes('--model') || args.includes('--head-model');
1485
+ const explicitEffort = args.includes('--effort');
1486
+ const explicitLevel = args.includes('--level') || args.includes('--intelligence') || args.includes('--intelligence-level');
1484
1487
 
1485
1488
  for (let i = 0; i < args.length; i += 1) {
1486
1489
  const a = args[i];
@@ -1514,6 +1517,12 @@ async function cmdRuntimeSwitch(args = []) {
1514
1517
  settings.bypassPermissions = true;
1515
1518
  }
1516
1519
 
1520
+ const existingPending = readPendingRuntimeSwitch(cwd);
1521
+ if (!explicitModel && !explicitLevel && existingPending?.sessionId === sess.id && existingPending.provider === provider && _modelMatchesProvider(existingPending.model, provider)) {
1522
+ settings.headModel = existingPending.model;
1523
+ if (!explicitEffort && existingPending.effort) settings.effort = existingPending.effort;
1524
+ }
1525
+
1517
1526
  const headPolicy = _headPolicyFor(provider, profile, settings);
1518
1527
  if (!settings.headModel || !_modelMatchesProvider(settings.headModel, provider)) {
1519
1528
  settings.headModel = headPolicy.model;
@@ -1536,6 +1545,7 @@ async function cmdRuntimeSwitch(args = []) {
1536
1545
  effort: settings.effort,
1537
1546
  confirmed,
1538
1547
  reason,
1548
+ changedBy: 'HEAD',
1539
1549
  });
1540
1550
 
1541
1551
  const launchArgs = provider === _sessionTool(sess)
@@ -1546,6 +1556,9 @@ async function cmdRuntimeSwitch(args = []) {
1546
1556
  console.log(`Runtime switch ${confirmed ? 'confirmed' : 'prepared'} for ${pending?.sessionName || sess.id}`);
1547
1557
  console.log(`Provider: ${provider}`);
1548
1558
  console.log(`Mode: ${getEffectiveConversationMode(profile, cwd)}`);
1559
+ console.log(`Model: ${settings.headModel || 'default'}${settings.effort ? ` (${settings.effort})` : ''}`);
1560
+ console.log(`Changed by: HEAD`);
1561
+ console.log(`Reason: ${reason}`);
1549
1562
  console.log(`Launch: ${provider} ${launchArgs.join(' ')}`);
1550
1563
  if (confirmed) {
1551
1564
  const activeForSwitch = readActiveConversation(cwd);
@@ -1558,8 +1571,12 @@ async function cmdRuntimeSwitch(args = []) {
1558
1571
  console.log('');
1559
1572
 
1560
1573
  if (args.includes('--apply')) {
1561
- const applied = await processPendingRuntimeSwitch(cwd);
1562
- if (!applied) console.log('Could not apply live here; resume the session through dual-brain to use these settings.');
1574
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1575
+ console.log('Non-interactive shell detected: saved for the active dual-brain terminal to apply.');
1576
+ } else {
1577
+ const applied = await processPendingRuntimeSwitch(cwd);
1578
+ if (!applied) console.log('Could not apply live here; resume the session through dual-brain to use these settings.');
1579
+ }
1563
1580
  }
1564
1581
  }
1565
1582
 
@@ -1571,6 +1588,12 @@ async function cmdAuto(args = []) {
1571
1588
  }
1572
1589
 
1573
1590
  async function cmdSwitchover(args = []) {
1591
+ const joined = args.join(' ').toLowerCase();
1592
+ if (/\b(auto|automode|auto mode|smart auto)\b/.test(joined)) {
1593
+ await cmdAuto(args);
1594
+ return;
1595
+ }
1596
+
1574
1597
  const cwd = process.cwd();
1575
1598
  let sessions = [];
1576
1599
  try { sessions = enrichSessions(importReplitSessions(cwd), cwd); } catch {}
@@ -1588,7 +1611,6 @@ async function cmdSwitchover(args = []) {
1588
1611
  }
1589
1612
 
1590
1613
  let target = null;
1591
- const joined = args.join(' ').toLowerCase();
1592
1614
  if (/\b(gpt|codex|openai)\b/.test(joined)) target = 'codex';
1593
1615
  if (/\bclaude\b/.test(joined)) target = 'claude';
1594
1616
  target ||= _sessionTool(sess) === 'codex' ? 'claude' : 'codex';
@@ -2705,6 +2727,7 @@ function writePendingRuntimeSwitch(cwd, session, updates = {}) {
2705
2727
  automode: typeof updates.automode === 'boolean' ? updates.automode : null,
2706
2728
  bypassPermissions: typeof updates.bypassPermissions === 'boolean' ? updates.bypassPermissions : null,
2707
2729
  reason: updates.reason || 'runtime-settings-change',
2730
+ changedBy: updates.changedBy || 'HEAD',
2708
2731
  autoLaunch: updates.autoLaunch !== false,
2709
2732
  handoffBrief: updates.handoffBrief || _sessionBrief(session, tool),
2710
2733
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dual-brain",
3
- "version": "0.3.30",
3
+ "version": "0.3.32",
4
4
  "description": "AI orchestration across Claude + OpenAI subscriptions — smart routing, budget awareness, and dual-brain collaboration",
5
5
  "type": "module",
6
6
  "bin": {