dual-brain 0.3.34 → 0.3.35
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/bin/dual-brain.mjs +20 -5
- package/package.json +1 -1
package/bin/dual-brain.mjs
CHANGED
|
@@ -1552,6 +1552,10 @@ async function cmdRuntimeSwitch(args = []) {
|
|
|
1552
1552
|
? runtimeLaunchArgsForPending(sess, cwd, pending)
|
|
1553
1553
|
: ['handoff', '--to', provider];
|
|
1554
1554
|
|
|
1555
|
+
const activeForSwitch = confirmed ? readActiveConversation(cwd) : null;
|
|
1556
|
+
const activeMatches = activeForSwitch?.sessionId === sess.id;
|
|
1557
|
+
let restartSignaled = false;
|
|
1558
|
+
|
|
1555
1559
|
console.log('');
|
|
1556
1560
|
console.log(`Runtime switch ${confirmed ? 'confirmed' : 'prepared'} for ${pending?.sessionName || sess.id}`);
|
|
1557
1561
|
console.log(`Provider: ${provider}`);
|
|
@@ -1561,10 +1565,16 @@ async function cmdRuntimeSwitch(args = []) {
|
|
|
1561
1565
|
console.log(`Reason: ${reason}`);
|
|
1562
1566
|
console.log(`Launch: ${provider} ${launchArgs.join(' ')}`);
|
|
1563
1567
|
if (confirmed) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
+
if (activeMatches) {
|
|
1569
|
+
restartSignaled = signalActiveConversation(cwd, sess.id);
|
|
1570
|
+
if (restartSignaled) {
|
|
1571
|
+
const terminalNote = activeForSwitch.terminalId && activeForSwitch.terminalId !== getTerminalId()
|
|
1572
|
+
? ` in ${activeForSwitch.terminalId}`
|
|
1573
|
+
: '';
|
|
1574
|
+
console.log(`Active supervisor detected${terminalNote}: restart signal sent.`);
|
|
1575
|
+
} else {
|
|
1576
|
+
console.log('Active supervisor was detected, but the restart signal could not be delivered.');
|
|
1577
|
+
}
|
|
1568
1578
|
} else if (!args.includes('--apply')) {
|
|
1569
1579
|
console.log('No active supervisor detected: saved for the next dual-brain resume/switch, not live yet.');
|
|
1570
1580
|
}
|
|
@@ -1573,7 +1583,12 @@ async function cmdRuntimeSwitch(args = []) {
|
|
|
1573
1583
|
|
|
1574
1584
|
if (args.includes('--apply')) {
|
|
1575
1585
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
1576
|
-
|
|
1586
|
+
if (restartSignaled) {
|
|
1587
|
+
console.log('Non-interactive shell detected: command applied by signaling the active dual-brain terminal.');
|
|
1588
|
+
} else {
|
|
1589
|
+
console.log('Non-interactive shell detected: saved for the next dual-brain resume/switch.');
|
|
1590
|
+
console.log('This command cannot mutate an unattached API/chat surface that is already running under another provider.');
|
|
1591
|
+
}
|
|
1577
1592
|
} else {
|
|
1578
1593
|
const applied = await processPendingRuntimeSwitch(cwd);
|
|
1579
1594
|
if (!applied) console.log('Could not apply live here; resume the session through dual-brain to use these settings.');
|
package/package.json
CHANGED