happy-imou-cloud 2.1.49 → 2.1.51
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/dist/AcpBackend-CqO3D07V.mjs +2619 -0
- package/dist/AcpBackend-XPiTd6ph.cjs +2621 -0
- package/dist/{BaseReasoningProcessor-Dn9NcoHz.cjs → BaseReasoningProcessor-BD9tiwep.cjs} +1 -144
- package/dist/{BaseReasoningProcessor-CAVeOdyo.mjs → BaseReasoningProcessor-CjlayL2f.mjs} +2 -144
- package/dist/ConversationHistory-Bl2doTA-.cjs +780 -0
- package/dist/ConversationHistory-CI5bBfuA.mjs +771 -0
- package/dist/{ProviderSelectionHandler-BJJc7qOR.cjs → ProviderSelectionHandler-C7GE5QjX.cjs} +6 -6
- package/dist/{ProviderSelectionHandler-DIYidT13.mjs → ProviderSelectionHandler-uQ8jzdzr.mjs} +2 -2
- package/dist/RuntimeShell-BDt42io_.mjs +252 -0
- package/dist/RuntimeShell-D_Te12wq.cjs +258 -0
- package/dist/bootstrapManagedProviderSession-Bln-TwyB.cjs +147 -0
- package/dist/bootstrapManagedProviderSession-D2Z6YU3n.mjs +145 -0
- package/dist/claude-BKNT-2fG.cjs +1080 -0
- package/dist/claude-CnN5WCWj.mjs +1073 -0
- package/dist/codex-DLGP8WF6.mjs +577 -0
- package/dist/codex-Fv2eali8.cjs +582 -0
- package/dist/{command-VcH4hbhi.cjs → command-BWPlJyCN.cjs} +16 -8
- package/dist/{command-CzfRRhVe.mjs → command-CELwsYoG.mjs} +15 -7
- package/dist/config-CFL0Gkqt.cjs +184 -0
- package/dist/config-ChSPe7p9.mjs +174 -0
- package/dist/createDefaultRuntimeShell-BXu3vCvT.cjs +33 -0
- package/dist/createDefaultRuntimeShell-DOg6g3-G.mjs +31 -0
- package/dist/cursor-Blq1cHdr.cjs +91 -0
- package/dist/cursor-CwPNSy_A.mjs +88 -0
- package/dist/future-Dq4Ha1Dn.cjs +24 -0
- package/dist/future-xRdLl3vf.mjs +22 -0
- package/dist/{index-xa1kwZoj.cjs → index-B_JYgMUS.cjs} +189 -5352
- package/dist/{index-7Z93BoVn.mjs → index-CX-F_fuk.mjs} +177 -5331
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/installFatalProcessHandlers-0vaw9MAz.mjs +55 -0
- package/dist/installFatalProcessHandlers-CyURn5Bp.cjs +57 -0
- package/dist/launch-BoCCEd5p.mjs +63 -0
- package/dist/launch-wZA5BcvS.cjs +66 -0
- package/dist/lib.cjs +2 -3
- package/dist/lib.d.cts +20 -17
- package/dist/lib.d.mts +20 -17
- package/dist/lib.mjs +1 -2
- package/dist/resolveCommand-B3BGyBE2.mjs +189 -0
- package/dist/resolveCommand-DYMd9PNC.cjs +193 -0
- package/dist/{runClaude-zCwRhpOw.mjs → runClaude-Be0myF9k.mjs} +8 -5
- package/dist/{runClaude-BBGNmGj6.cjs → runClaude-DZJt5er7.cjs} +46 -43
- package/dist/{runCodex-BbgLVjb9.mjs → runCodex-BSnyN4m7.mjs} +226 -117
- package/dist/{runCodex-jUU6U2tZ.cjs → runCodex-DTCcGRue.cjs} +269 -160
- package/dist/runCursor-Bn1PuwJy.cjs +506 -0
- package/dist/runCursor-M6dQ6bGF.mjs +504 -0
- package/dist/{runGemini-DcwNsudA.mjs → runGemini-BNm4vYKA.mjs} +279 -5
- package/dist/{runGemini-C0NT8MHK.cjs → runGemini-Bn3lFhz6.cjs} +309 -35
- package/dist/{registerKillSessionHandler-DLDg2EES.mjs → sessionControl-1bT_7OI6.mjs} +1643 -2405
- package/dist/{registerKillSessionHandler-CfCya6si.cjs → sessionControl-flKnQrx0.cjs} +1647 -2417
- package/dist/{api-DnqaNvyV.mjs → types-B5vtxa38.mjs} +55 -5
- package/dist/{api-D7nAeZi7.cjs → types-CttABk32.cjs} +55 -4
- package/package.json +2 -2
- package/dist/types-CiliQpqS.mjs +0 -52
- package/dist/types-DVk3crez.cjs +0 -54
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var persistence = require('./
|
|
4
|
+
var persistence = require('./types-CttABk32.cjs');
|
|
5
5
|
require('cross-spawn');
|
|
6
6
|
require('@agentclientprotocol/sdk');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-B_JYgMUS.cjs');
|
|
8
8
|
require('ps-list');
|
|
9
9
|
require('fs');
|
|
10
10
|
require('path');
|
|
@@ -25,11 +25,14 @@ require('tweetnacl');
|
|
|
25
25
|
require('open');
|
|
26
26
|
var React = require('react');
|
|
27
27
|
var ink = require('ink');
|
|
28
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
29
|
-
var types = require('./types-DVk3crez.cjs');
|
|
30
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-CfCya6si.cjs');
|
|
28
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-C7GE5QjX.cjs');
|
|
31
29
|
require('socket.io-client');
|
|
32
30
|
require('expo-server-sdk');
|
|
31
|
+
var future = require('./future-Dq4Ha1Dn.cjs');
|
|
32
|
+
var ConversationHistory = require('./ConversationHistory-Bl2doTA-.cjs');
|
|
33
|
+
var claude = require('./claude-BKNT-2fG.cjs');
|
|
34
|
+
var sessionControl = require('./sessionControl-flKnQrx0.cjs');
|
|
35
|
+
var RuntimeShell = require('./RuntimeShell-D_Te12wq.cjs');
|
|
33
36
|
var node_util = require('node:util');
|
|
34
37
|
var node_http = require('node:http');
|
|
35
38
|
require('zod');
|
|
@@ -570,7 +573,7 @@ async function readSessionLog(sessionFilePath) {
|
|
|
570
573
|
if (message.type && INTERNAL_CLAUDE_EVENT_TYPES.has(message.type)) {
|
|
571
574
|
continue;
|
|
572
575
|
}
|
|
573
|
-
let parsed =
|
|
576
|
+
let parsed = persistence.RawJSONLinesSchema.safeParse(message);
|
|
574
577
|
if (!parsed.success) {
|
|
575
578
|
continue;
|
|
576
579
|
}
|
|
@@ -609,7 +612,7 @@ async function claudeLocalLauncher(session) {
|
|
|
609
612
|
session.addSessionFoundCallback(scannerSessionCallback);
|
|
610
613
|
let exitReason = null;
|
|
611
614
|
const processAbortController = new AbortController();
|
|
612
|
-
let exutFuture = new
|
|
615
|
+
let exutFuture = new future.Future();
|
|
613
616
|
try {
|
|
614
617
|
async function abort() {
|
|
615
618
|
if (!processAbortController.signal.aborted) {
|
|
@@ -925,7 +928,7 @@ function getToolDescriptor(toolName) {
|
|
|
925
928
|
return { edit: false, exitPlan: false };
|
|
926
929
|
}
|
|
927
930
|
|
|
928
|
-
class ClaudeAcpPermissionHandler extends
|
|
931
|
+
class ClaudeAcpPermissionHandler extends sessionControl.BasePermissionHandler {
|
|
929
932
|
currentPermissionMode = "default";
|
|
930
933
|
constructor(session) {
|
|
931
934
|
super(session);
|
|
@@ -980,17 +983,17 @@ class ClaudeAcpPermissionHandler extends registerKillSessionHandler.BasePermissi
|
|
|
980
983
|
|
|
981
984
|
function normalizeClaudeBackendError(error) {
|
|
982
985
|
const record = typeof error === "object" && error !== null ? error : null;
|
|
983
|
-
const text =
|
|
984
|
-
const stderrText = record ?
|
|
985
|
-
const detailText = record ?
|
|
986
|
+
const text = RuntimeShell.formatDisplayMessage(error).trim();
|
|
987
|
+
const stderrText = record ? RuntimeShell.formatDisplayMessage(record.stderr).trim() : "";
|
|
988
|
+
const detailText = record ? RuntimeShell.formatDisplayMessage(record.detail).trim() : "";
|
|
986
989
|
const searchable = [text, stderrText, detailText].filter(Boolean).join("\n").trim();
|
|
987
990
|
return searchable || "Claude ACP backend exited unexpectedly";
|
|
988
991
|
}
|
|
989
992
|
const CLAUDE_ACP_LEGACY_FINAL_MESSAGE_SHADOW = "claude-acp-final-message-shadow";
|
|
990
993
|
async function claudeAcpRemoteLauncher(session) {
|
|
991
994
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
992
|
-
const messageBuffer = new
|
|
993
|
-
const renderSessionTranscript =
|
|
995
|
+
const messageBuffer = new ConversationHistory.MessageBuffer({ enabled: hasTTY });
|
|
996
|
+
const renderSessionTranscript = ConversationHistory.createSessionTranscriptInkRenderer({ messageBuffer });
|
|
994
997
|
let inkInstance = null;
|
|
995
998
|
let shouldExit = false;
|
|
996
999
|
let abortController = new AbortController();
|
|
@@ -1013,7 +1016,7 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1013
1016
|
const assistantMessageStream = new persistence.AssistantMessageStream();
|
|
1014
1017
|
const permissionHandler = new ClaudeAcpPermissionHandler(session.client);
|
|
1015
1018
|
const selectionHandler = new ProviderSelectionHandler.ProviderSelectionHandler(session.client, "Claude");
|
|
1016
|
-
const conversationHistory = new
|
|
1019
|
+
const conversationHistory = new ConversationHistory.ConversationHistory({
|
|
1017
1020
|
maxMessages: 20,
|
|
1018
1021
|
maxCharacters: 5e4
|
|
1019
1022
|
});
|
|
@@ -1028,7 +1031,7 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1028
1031
|
return;
|
|
1029
1032
|
}
|
|
1030
1033
|
try {
|
|
1031
|
-
const notification =
|
|
1034
|
+
const notification = ConversationHistory.buildReadyPushNotification({
|
|
1032
1035
|
providerLabel: "Claude",
|
|
1033
1036
|
metadata: session.client.getMetadataSnapshot?.() ?? null,
|
|
1034
1037
|
sessionId: session.client.sessionId
|
|
@@ -1210,7 +1213,7 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1210
1213
|
};
|
|
1211
1214
|
const setupRuntimeMessageHandler = (activeRuntimeHandle) => {
|
|
1212
1215
|
const forwardAgentMessage = (agentMessage) => {
|
|
1213
|
-
|
|
1216
|
+
sessionControl.forwardAgentMessageToProviderSession(agentMessage, {
|
|
1214
1217
|
provider: "claude",
|
|
1215
1218
|
send: (body) => session.client.sendAgentMessage("claude", body)
|
|
1216
1219
|
});
|
|
@@ -1273,7 +1276,7 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1273
1276
|
case "tool-call": {
|
|
1274
1277
|
commitActiveAssistantMessageStream();
|
|
1275
1278
|
emitPendingThinkingMessage();
|
|
1276
|
-
const toolArgs =
|
|
1279
|
+
const toolArgs = RuntimeShell.truncateDisplayMessage(msg.args, 100);
|
|
1277
1280
|
messageBuffer.addMessage(
|
|
1278
1281
|
`Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}` : ""}`,
|
|
1279
1282
|
"tool"
|
|
@@ -1283,7 +1286,7 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1283
1286
|
}
|
|
1284
1287
|
case "tool-result": {
|
|
1285
1288
|
emitPendingThinkingMessage();
|
|
1286
|
-
const resultText =
|
|
1289
|
+
const resultText = RuntimeShell.truncateDisplayMessage(msg.result, 200);
|
|
1287
1290
|
messageBuffer.addMessage(resultText ? `Result: ${resultText}` : "Tool completed", "result");
|
|
1288
1291
|
forwardAgentMessage(msg);
|
|
1289
1292
|
return;
|
|
@@ -1296,12 +1299,12 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1296
1299
|
}
|
|
1297
1300
|
case "terminal-output": {
|
|
1298
1301
|
emitPendingThinkingMessage();
|
|
1299
|
-
const output =
|
|
1302
|
+
const output = sessionControl.renderTerminalOutputPreview(msg.data);
|
|
1300
1303
|
if (!output) {
|
|
1301
1304
|
return;
|
|
1302
1305
|
}
|
|
1303
1306
|
messageBuffer.addMessage(output, "result");
|
|
1304
|
-
const forwardedOutput =
|
|
1307
|
+
const forwardedOutput = sessionControl.prepareTerminalOutputForForwarding(msg.data);
|
|
1305
1308
|
if (forwardedOutput) {
|
|
1306
1309
|
forwardAgentMessage({
|
|
1307
1310
|
...msg,
|
|
@@ -1351,10 +1354,10 @@ async function claudeAcpRemoteLauncher(session) {
|
|
|
1351
1354
|
});
|
|
1352
1355
|
};
|
|
1353
1356
|
const createRuntimeHandle = async (mode) => {
|
|
1354
|
-
const { session: nextRuntimeHandle, factoryResult } = await
|
|
1357
|
+
const { session: nextRuntimeHandle, factoryResult } = await ConversationHistory.launchRuntimeHandleWithFactoryResult({
|
|
1355
1358
|
provider: "claude",
|
|
1356
1359
|
cwd: session.path,
|
|
1357
|
-
createBackendResult: (opts) =>
|
|
1360
|
+
createBackendResult: (opts) => claude.createClaudeBackend({
|
|
1358
1361
|
...opts,
|
|
1359
1362
|
baseArgs: session.claudeArgs,
|
|
1360
1363
|
mcpServers: session.mcpServers,
|
|
@@ -1518,14 +1521,14 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1518
1521
|
persistence.logger.debug(`[ClaudeACP] Injected conversation history context (${historyContext.length} chars)`);
|
|
1519
1522
|
}
|
|
1520
1523
|
if (message.mode.happyOrg) {
|
|
1521
|
-
promptToSend =
|
|
1524
|
+
promptToSend = sessionControl.buildHappyOrgTurnPrompt(promptToSend, message.mode.happyOrg);
|
|
1522
1525
|
}
|
|
1523
1526
|
if (specialCommand.type === "compact") {
|
|
1524
1527
|
emitStatusMessage("Compaction started");
|
|
1525
1528
|
}
|
|
1526
1529
|
conversationHistory.addUserMessage(message.message);
|
|
1527
1530
|
await activeRuntimeHandle.sendPrompt(promptToSend);
|
|
1528
|
-
await
|
|
1531
|
+
await sessionControl.waitForResponseCompleteWithAbort(activeRuntimeHandle.backend, abortController.signal);
|
|
1529
1532
|
shouldCommitAccumulatedResponse = true;
|
|
1530
1533
|
shouldInjectHistoryOnNextSession = false;
|
|
1531
1534
|
shouldClearHistoryAfterTurn = specialCommand.type === "compact";
|
|
@@ -1553,7 +1556,7 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1553
1556
|
}
|
|
1554
1557
|
} finally {
|
|
1555
1558
|
turnInFlight = false;
|
|
1556
|
-
const finalizedTurn = await
|
|
1559
|
+
const finalizedTurn = await sessionControl.finalizeHappyOrgTurnWithBusinessAck({
|
|
1557
1560
|
metadata: session.client.getMetadataSnapshot?.() ?? null,
|
|
1558
1561
|
queuedTurn: message.mode.happyOrg,
|
|
1559
1562
|
responseText: accumulatedResponse,
|
|
@@ -1579,7 +1582,7 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1579
1582
|
emitFinalAssistantMessage(finalizedTurn.cleanedText);
|
|
1580
1583
|
if (!shouldExit) {
|
|
1581
1584
|
try {
|
|
1582
|
-
const notification =
|
|
1585
|
+
const notification = ConversationHistory.buildTurnResultPushNotification({
|
|
1583
1586
|
providerLabel: "Claude",
|
|
1584
1587
|
metadata: finalizedTurn.nextMetadata ?? session.client.getMetadataSnapshot?.() ?? null,
|
|
1585
1588
|
sessionId: session.client.sessionId,
|
|
@@ -1717,7 +1720,7 @@ async function claudeRemote(opts) {
|
|
|
1717
1720
|
cwd: opts.path,
|
|
1718
1721
|
resume: startFrom ?? void 0,
|
|
1719
1722
|
mcpServers: opts.mcpServers,
|
|
1720
|
-
permissionMode:
|
|
1723
|
+
permissionMode: claude.mapToClaudeMode(initial.mode.permissionMode),
|
|
1721
1724
|
model: initial.mode.model,
|
|
1722
1725
|
fallbackModel: initial.mode.fallbackModel,
|
|
1723
1726
|
customSystemPrompt: initial.mode.customSystemPrompt ? initial.mode.customSystemPrompt + "\n\n" + systemPrompt : void 0,
|
|
@@ -1742,7 +1745,7 @@ async function claudeRemote(opts) {
|
|
|
1742
1745
|
}
|
|
1743
1746
|
}
|
|
1744
1747
|
};
|
|
1745
|
-
let messages = new
|
|
1748
|
+
let messages = new claude.PushableAsyncIterable();
|
|
1746
1749
|
messages.push({
|
|
1747
1750
|
type: "user",
|
|
1748
1751
|
message: {
|
|
@@ -1750,7 +1753,7 @@ async function claudeRemote(opts) {
|
|
|
1750
1753
|
content: initial.message
|
|
1751
1754
|
}
|
|
1752
1755
|
});
|
|
1753
|
-
const response =
|
|
1756
|
+
const response = claude.query({
|
|
1754
1757
|
prompt: messages,
|
|
1755
1758
|
options: sdkOptions
|
|
1756
1759
|
});
|
|
@@ -1806,7 +1809,7 @@ async function claudeRemote(opts) {
|
|
|
1806
1809
|
}
|
|
1807
1810
|
}
|
|
1808
1811
|
} catch (e) {
|
|
1809
|
-
if (e instanceof
|
|
1812
|
+
if (e instanceof claude.AbortError) {
|
|
1810
1813
|
persistence.logger.debug(`[claudeRemote] Aborted`);
|
|
1811
1814
|
} else {
|
|
1812
1815
|
throw e;
|
|
@@ -1979,7 +1982,7 @@ class PermissionHandler {
|
|
|
1979
1982
|
if (this.onPermissionRequestCallback) {
|
|
1980
1983
|
this.onPermissionRequestCallback(id);
|
|
1981
1984
|
}
|
|
1982
|
-
const notification =
|
|
1985
|
+
const notification = ConversationHistory.buildPermissionPushNotification({
|
|
1983
1986
|
providerLabel: "Claude",
|
|
1984
1987
|
metadata: this.session.client.getMetadataSnapshot?.() ?? null,
|
|
1985
1988
|
sessionId: this.session.client.sessionId,
|
|
@@ -2717,7 +2720,7 @@ async function claudeRemoteLauncher(session, options = {}) {
|
|
|
2717
2720
|
const allowSwitchToLocal = options.allowSwitchToLocal ?? true;
|
|
2718
2721
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
2719
2722
|
persistence.logger.debug(`[claudeRemoteLauncher] TTY available: ${hasTTY}`);
|
|
2720
|
-
let messageBuffer = new
|
|
2723
|
+
let messageBuffer = new ConversationHistory.MessageBuffer();
|
|
2721
2724
|
let inkInstance = null;
|
|
2722
2725
|
if (hasTTY) {
|
|
2723
2726
|
console.clear();
|
|
@@ -2942,7 +2945,7 @@ async function claudeRemoteLauncher(session, options = {}) {
|
|
|
2942
2945
|
previousSessionId = session.sessionId;
|
|
2943
2946
|
const controller = new AbortController();
|
|
2944
2947
|
abortController = controller;
|
|
2945
|
-
abortFuture = new
|
|
2948
|
+
abortFuture = new future.Future();
|
|
2946
2949
|
let modeHash = null;
|
|
2947
2950
|
let mode = null;
|
|
2948
2951
|
try {
|
|
@@ -3001,7 +3004,7 @@ async function claudeRemoteLauncher(session, options = {}) {
|
|
|
3001
3004
|
onReady: () => {
|
|
3002
3005
|
if (!pending && session.queue.size() === 0) {
|
|
3003
3006
|
session.client.sendSessionEvent({ type: "ready" });
|
|
3004
|
-
const notification =
|
|
3007
|
+
const notification = ConversationHistory.buildReadyPushNotification({
|
|
3005
3008
|
providerLabel: "Claude",
|
|
3006
3009
|
metadata: session.client.getMetadataSnapshot?.() ?? null,
|
|
3007
3010
|
sessionId: session.client.sessionId
|
|
@@ -3114,7 +3117,7 @@ async function extractSDKMetadata() {
|
|
|
3114
3117
|
const abortController = new AbortController();
|
|
3115
3118
|
try {
|
|
3116
3119
|
persistence.logger.debug("[metadataExtractor] Starting SDK metadata extraction");
|
|
3117
|
-
const sdkQuery =
|
|
3120
|
+
const sdkQuery = claude.query({
|
|
3118
3121
|
prompt: "hello",
|
|
3119
3122
|
options: {
|
|
3120
3123
|
allowedTools: ["Bash(echo)"],
|
|
@@ -3281,7 +3284,7 @@ async function runOfflineClaudeLocalFallback(opts) {
|
|
|
3281
3284
|
}
|
|
3282
3285
|
await index.publishSessionRegistration(response.id, opts.metadata);
|
|
3283
3286
|
const session = opts.api.sessionSyncClient(response);
|
|
3284
|
-
await
|
|
3287
|
+
await sessionControl.syncControlledByUserState(session, true);
|
|
3285
3288
|
const scanner = await createSessionScanner({
|
|
3286
3289
|
sessionId: null,
|
|
3287
3290
|
workingDirectory: opts.workingDirectory,
|
|
@@ -3391,7 +3394,7 @@ function resolveClaudeQueuedMessage(message, currentState) {
|
|
|
3391
3394
|
function bindClaudeUserMessageQueue(opts) {
|
|
3392
3395
|
let currentState = { ...opts.initialState };
|
|
3393
3396
|
opts.session.onUserMessage((message) => {
|
|
3394
|
-
const happyOrgResult = opts.happyOrg ?
|
|
3397
|
+
const happyOrgResult = opts.happyOrg ? sessionControl.resolveHappyOrgQueuedTurn({
|
|
3395
3398
|
metadata: opts.happyOrg.getMetadata(),
|
|
3396
3399
|
message,
|
|
3397
3400
|
sessionId: opts.happyOrg.getSessionId?.() ?? null
|
|
@@ -3438,12 +3441,12 @@ async function runClaude(credentials, options = {}) {
|
|
|
3438
3441
|
const api = await persistence.ApiClient.create(credentials);
|
|
3439
3442
|
let machineId;
|
|
3440
3443
|
try {
|
|
3441
|
-
machineId = await
|
|
3444
|
+
machineId = await sessionControl.ensureManagedProviderMachine({
|
|
3442
3445
|
api,
|
|
3443
3446
|
missingMachineIdMessage: "[START] No machine ID found in settings, which is unexpected since authAndSetupMachineIfNeeded should have created it. Please report this issue on https://github.com/slopus/happy-cli/issues"
|
|
3444
3447
|
});
|
|
3445
3448
|
} catch (error) {
|
|
3446
|
-
if (error instanceof
|
|
3449
|
+
if (error instanceof sessionControl.MissingMachineIdError) {
|
|
3447
3450
|
console.error(error.message);
|
|
3448
3451
|
process.exit(1);
|
|
3449
3452
|
}
|
|
@@ -3508,12 +3511,12 @@ async function runClaude(credentials, options = {}) {
|
|
|
3508
3511
|
const logPath = persistence.logger.logFilePath;
|
|
3509
3512
|
persistence.logger.infoDeveloper(`Session: ${response.id}`);
|
|
3510
3513
|
persistence.logger.infoDeveloper(`Logs: ${logPath}`);
|
|
3511
|
-
await
|
|
3514
|
+
await sessionControl.syncControlledByUserState(session, options.startingMode !== "remote");
|
|
3512
3515
|
const caffeinateStarted = index.startCaffeinate();
|
|
3513
3516
|
if (caffeinateStarted) {
|
|
3514
3517
|
persistence.logger.infoDeveloper("Sleep prevention enabled (macOS)");
|
|
3515
3518
|
}
|
|
3516
|
-
const messageQueue = new
|
|
3519
|
+
const messageQueue = new sessionControl.MessageQueue2((mode) => persistence.hashObject({
|
|
3517
3520
|
isPlan: mode.permissionMode === "plan",
|
|
3518
3521
|
model: mode.model,
|
|
3519
3522
|
fallbackModel: mode.fallbackModel,
|
|
@@ -3578,7 +3581,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
3578
3581
|
persistence.logger.debug("[START] Unhandled rejection:", reason);
|
|
3579
3582
|
cleanup();
|
|
3580
3583
|
});
|
|
3581
|
-
|
|
3584
|
+
sessionControl.registerKillSessionHandler(session.rpcHandlerManager, cleanup);
|
|
3582
3585
|
const exitCode = await loop({
|
|
3583
3586
|
path: workingDirectory,
|
|
3584
3587
|
model: options.model,
|
|
@@ -3590,7 +3593,7 @@ async function runClaude(credentials, options = {}) {
|
|
|
3590
3593
|
mcpServers: {},
|
|
3591
3594
|
onModeChange: async (newMode) => {
|
|
3592
3595
|
session.sendSessionEvent({ type: "switch", mode: newMode });
|
|
3593
|
-
await
|
|
3596
|
+
await sessionControl.syncControlledByUserState(session, newMode === "local");
|
|
3594
3597
|
},
|
|
3595
3598
|
onSessionReady: (sessionInstance) => {
|
|
3596
3599
|
currentSession = sessionInstance;
|