happy-imou-cloud 2.0.6 → 2.0.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/bin/happy-cloud.mjs +1 -1
- package/dist/{api-DccDghmF.cjs → api-CN-WqYd_.cjs} +3 -4
- package/dist/{api-Emo3rSZH.mjs → api-D-uiH_TF.mjs} +3 -4
- package/dist/{command-D8Zz6B4t.mjs → command-DGFsZx58.mjs} +3 -3
- package/dist/{command-C2v0VkPq.cjs → command-DjIfRZQS.cjs} +3 -3
- package/dist/{index-Buq7nurH.cjs → index-DM6z3aeG.cjs} +189 -27
- package/dist/{index-Dh8UTgm4.mjs → index-DhheEtRl.mjs} +187 -25
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{BaseReasoningProcessor-1EzrE03x.mjs → names-BjEof0E2.mjs} +98 -3
- package/dist/{BaseReasoningProcessor-BMyfwx3p.cjs → names-BnV67N_O.cjs} +100 -2
- package/dist/{persistence-BrTyBuT7.cjs → persistence-DBGkO8gB.cjs} +110 -1
- package/dist/{persistence-Blm1hTQA.mjs → persistence-DiNg1DPF.mjs} +100 -4
- package/dist/{registerKillSessionHandler-EFAsOnR_.cjs → registerKillSessionHandler-CYc0SIjF.cjs} +26 -2
- package/dist/{registerKillSessionHandler-Bm7E-03E.mjs → registerKillSessionHandler-Cu9rHGsI.mjs} +26 -2
- package/dist/{runClaude-COy1pLhn.cjs → runClaude-CPhWaFrX.cjs} +5 -5
- package/dist/{runClaude-CwA5UCO-.mjs → runClaude-DAR_hw3C.mjs} +4 -4
- package/dist/{runCodex-BRMOT2dJ.cjs → runCodex--QLrOs8X.cjs} +53 -82
- package/dist/{runCodex-DTPmqCyS.mjs → runCodex-B4QAb-Go.mjs} +35 -63
- package/dist/{runGemini-BVPmTGxQ.cjs → runGemini-CDyhCucw.cjs} +20 -21
- package/dist/{runGemini-DDSR8BtO.mjs → runGemini-DqowSR2w.mjs} +5 -6
- package/package.json +3 -4
- package/scripts/build.mjs +66 -0
- package/scripts/release-smoke.mjs +166 -30
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
|
|
2
|
-
import { l as logger, e as encodeBase64, c as configuration, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o as getLatestDaemonLog } from './api-
|
|
3
|
-
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-
|
|
2
|
+
import { l as logger, e as encodeBase64, c as configuration, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o as getLatestDaemonLog } from './api-D-uiH_TF.mjs';
|
|
3
|
+
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-DiNg1DPF.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import fs from 'fs/promises';
|
|
6
6
|
import os, { homedir } from 'os';
|
|
@@ -4191,6 +4191,9 @@ class DefaultTransport {
|
|
|
4191
4191
|
getInitTimeout() {
|
|
4192
4192
|
return DEFAULT_TIMEOUTS.init;
|
|
4193
4193
|
}
|
|
4194
|
+
getInitDelayMs() {
|
|
4195
|
+
return 0;
|
|
4196
|
+
}
|
|
4194
4197
|
/**
|
|
4195
4198
|
* Default: pass through all lines that are valid JSON objects/arrays
|
|
4196
4199
|
*/
|
|
@@ -4251,11 +4254,16 @@ class DefaultTransport {
|
|
|
4251
4254
|
determineToolName(toolName, _toolCallId, _input, _context) {
|
|
4252
4255
|
return toolName;
|
|
4253
4256
|
}
|
|
4257
|
+
getPostPromptNoUpdatesTimeoutMs() {
|
|
4258
|
+
return 3e4;
|
|
4259
|
+
}
|
|
4254
4260
|
}
|
|
4255
4261
|
|
|
4256
4262
|
const GEMINI_TIMEOUTS = {
|
|
4257
4263
|
/** Gemini CLI can be slow on first start (downloading models, etc.) */
|
|
4258
4264
|
init: 12e4,
|
|
4265
|
+
/** Gemini ACP can swallow an initialize request sent too early after spawn */
|
|
4266
|
+
initDelay: 2500,
|
|
4259
4267
|
/** Standard tool call timeout */
|
|
4260
4268
|
toolCall: 12e4,
|
|
4261
4269
|
/** Investigation tools (codebase_investigator) can run for a long time */
|
|
@@ -4290,6 +4298,9 @@ class GeminiTransport {
|
|
|
4290
4298
|
getInitTimeout() {
|
|
4291
4299
|
return GEMINI_TIMEOUTS.init;
|
|
4292
4300
|
}
|
|
4301
|
+
getInitDelayMs() {
|
|
4302
|
+
return GEMINI_TIMEOUTS.initDelay;
|
|
4303
|
+
}
|
|
4293
4304
|
/**
|
|
4294
4305
|
* Filter Gemini CLI debug output from stdout.
|
|
4295
4306
|
*
|
|
@@ -5026,6 +5037,10 @@ ${line}` : line;
|
|
|
5026
5037
|
controller.error(error);
|
|
5027
5038
|
} finally {
|
|
5028
5039
|
reader.releaseLock();
|
|
5040
|
+
try {
|
|
5041
|
+
params.onDone?.();
|
|
5042
|
+
} catch {
|
|
5043
|
+
}
|
|
5029
5044
|
if (!controllerErrored) {
|
|
5030
5045
|
controller.close();
|
|
5031
5046
|
}
|
|
@@ -5088,7 +5103,7 @@ async function killProcessTree(proc, options) {
|
|
|
5088
5103
|
if (!pid) {
|
|
5089
5104
|
return;
|
|
5090
5105
|
}
|
|
5091
|
-
const graceMs = Math.max(1, options?.graceMs);
|
|
5106
|
+
const graceMs = Math.max(1, options?.graceMs ?? 1e3);
|
|
5092
5107
|
const descendants = await resolveDescendantPids(pid).catch(() => []);
|
|
5093
5108
|
const allPids = [...descendants, pid];
|
|
5094
5109
|
for (const targetPid of allPids) {
|
|
@@ -5113,6 +5128,29 @@ const RETRY_CONFIG = {
|
|
|
5113
5128
|
/** Maximum delay between retries in ms */
|
|
5114
5129
|
maxDelayMs: 5e3
|
|
5115
5130
|
};
|
|
5131
|
+
const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 3e4;
|
|
5132
|
+
function readPositiveIntegerEnv(name) {
|
|
5133
|
+
const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
|
|
5134
|
+
if (!raw) {
|
|
5135
|
+
return null;
|
|
5136
|
+
}
|
|
5137
|
+
const value = Number(raw);
|
|
5138
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
|
|
5139
|
+
return null;
|
|
5140
|
+
}
|
|
5141
|
+
return value;
|
|
5142
|
+
}
|
|
5143
|
+
function resolvePostPromptNoUpdatesTimeoutMs(transport) {
|
|
5144
|
+
const transportValue = transport.getPostPromptNoUpdatesTimeoutMs?.();
|
|
5145
|
+
if (typeof transportValue === "number" && Number.isFinite(transportValue) && transportValue > 0) {
|
|
5146
|
+
return Math.trunc(transportValue);
|
|
5147
|
+
}
|
|
5148
|
+
const envValue = readPositiveIntegerEnv("HAPPY_ACP_POST_PROMPT_NO_UPDATES_TIMEOUT_MS") ?? readPositiveIntegerEnv("HAPPIER_ACP_POST_PROMPT_NO_UPDATES_TIMEOUT_MS");
|
|
5149
|
+
if (envValue != null) {
|
|
5150
|
+
return envValue;
|
|
5151
|
+
}
|
|
5152
|
+
return DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS;
|
|
5153
|
+
}
|
|
5116
5154
|
function getSessionUpdates(params) {
|
|
5117
5155
|
const notification = params;
|
|
5118
5156
|
const updates = Array.isArray(notification.updates) ? notification.updates.filter((update) => Boolean(update && typeof update === "object")) : [];
|
|
@@ -5288,6 +5326,17 @@ function normalizeAcpError(error) {
|
|
|
5288
5326
|
}
|
|
5289
5327
|
return normalized;
|
|
5290
5328
|
}
|
|
5329
|
+
function getStatusErrorDetail(message) {
|
|
5330
|
+
if (message.type !== "status" || message.status !== "error") {
|
|
5331
|
+
return null;
|
|
5332
|
+
}
|
|
5333
|
+
const detail = typeof message.detail === "string" ? message.detail.trim() : "";
|
|
5334
|
+
return detail || "Unknown ACP transport error";
|
|
5335
|
+
}
|
|
5336
|
+
function looksLikeDroppedStdoutError(text) {
|
|
5337
|
+
const lower = text.toLowerCase();
|
|
5338
|
+
return lower.startsWith("error") || lower.includes("error:") || lower.includes("exception") || lower.includes("traceback") || lower.includes("invalid request") || lower.includes("invalid_request") || lower.includes("unauthorized") || lower.includes("forbidden") || lower.includes("permission denied") || /\b(4\d\d|5\d\d)\b/.test(lower) && (lower.includes("http") || lower.includes("status") || lower.includes("request"));
|
|
5339
|
+
}
|
|
5291
5340
|
function createAcpAbortError(message) {
|
|
5292
5341
|
const error = new Error(message);
|
|
5293
5342
|
error.name = "AbortError";
|
|
@@ -5410,6 +5459,12 @@ class AcpBackend {
|
|
|
5410
5459
|
responseCompletionOutcome = null;
|
|
5411
5460
|
/** Whether the current prompt is still waiting for completion */
|
|
5412
5461
|
waitingForResponse = false;
|
|
5462
|
+
/** First fatal prompt-level error observed for the current turn */
|
|
5463
|
+
responseCompletionError = null;
|
|
5464
|
+
/** Fallback completion when prompt returns but the agent emits no session updates */
|
|
5465
|
+
postPromptCompletionIdleTimeout = null;
|
|
5466
|
+
/** Whether at least one session/update arrived after the current prompt */
|
|
5467
|
+
sawSessionUpdateSincePrompt = false;
|
|
5413
5468
|
/** Transport handler for agent-specific behavior */
|
|
5414
5469
|
transport;
|
|
5415
5470
|
/** Keep a short rolling stderr buffer so startup failures can surface the real cause. */
|
|
@@ -5433,6 +5488,12 @@ class AcpBackend {
|
|
|
5433
5488
|
this.idleTimeout = null;
|
|
5434
5489
|
}
|
|
5435
5490
|
}
|
|
5491
|
+
clearPostPromptCompletionIdleTimeout() {
|
|
5492
|
+
if (this.postPromptCompletionIdleTimeout) {
|
|
5493
|
+
clearTimeout(this.postPromptCompletionIdleTimeout);
|
|
5494
|
+
this.postPromptCompletionIdleTimeout = null;
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5436
5497
|
clearToolCallTracking() {
|
|
5437
5498
|
this.activeToolCalls.clear();
|
|
5438
5499
|
for (const timeout of this.toolCallTimeouts.values()) {
|
|
@@ -5446,9 +5507,26 @@ class AcpBackend {
|
|
|
5446
5507
|
}
|
|
5447
5508
|
resetResponseTrackingForNewPrompt() {
|
|
5448
5509
|
this.responseCompletionOutcome = null;
|
|
5510
|
+
this.responseCompletionError = null;
|
|
5511
|
+
this.sawSessionUpdateSincePrompt = false;
|
|
5449
5512
|
this.clearIdleTimeoutState();
|
|
5513
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
5450
5514
|
this.clearToolCallTracking();
|
|
5451
5515
|
}
|
|
5516
|
+
failPendingResponseWait(error) {
|
|
5517
|
+
if (this.responseCompletionError) {
|
|
5518
|
+
return;
|
|
5519
|
+
}
|
|
5520
|
+
this.responseCompletionError = error;
|
|
5521
|
+
this.responseCompletionOutcome = null;
|
|
5522
|
+
this.waitingForResponse = false;
|
|
5523
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
5524
|
+
if (this.idleRejecter) {
|
|
5525
|
+
this.idleRejecter(error);
|
|
5526
|
+
}
|
|
5527
|
+
this.idleResolver = null;
|
|
5528
|
+
this.idleRejecter = null;
|
|
5529
|
+
}
|
|
5452
5530
|
settleResponseWaiter(outcome) {
|
|
5453
5531
|
const hasActiveWaiter = Boolean(this.idleResolver || this.idleRejecter);
|
|
5454
5532
|
if (!this.waitingForResponse && !hasActiveWaiter) {
|
|
@@ -5484,6 +5562,38 @@ class AcpBackend {
|
|
|
5484
5562
|
}
|
|
5485
5563
|
}
|
|
5486
5564
|
}
|
|
5565
|
+
handleDroppedStdoutLine(entry) {
|
|
5566
|
+
if (entry.reason !== "transport_filter_null" || !this.waitingForResponse || this.responseCompletionError) {
|
|
5567
|
+
return;
|
|
5568
|
+
}
|
|
5569
|
+
const raw = entry.line.trim();
|
|
5570
|
+
if (!raw) {
|
|
5571
|
+
return;
|
|
5572
|
+
}
|
|
5573
|
+
const context = {
|
|
5574
|
+
activeToolCalls: this.activeToolCalls,
|
|
5575
|
+
hasActiveInvestigation: this.transport.isInvestigationTool ? Array.from(this.activeToolCalls).some((id) => this.transport.isInvestigationTool(id)) : false
|
|
5576
|
+
};
|
|
5577
|
+
const transportResult = this.transport.handleStderr?.(entry.line, context);
|
|
5578
|
+
const transportMessage = transportResult?.message ?? null;
|
|
5579
|
+
if (transportMessage) {
|
|
5580
|
+
this.emit(transportMessage);
|
|
5581
|
+
const errorDetail = getStatusErrorDetail(transportMessage);
|
|
5582
|
+
if (errorDetail) {
|
|
5583
|
+
this.failPendingResponseWait(new Error(errorDetail));
|
|
5584
|
+
}
|
|
5585
|
+
return;
|
|
5586
|
+
}
|
|
5587
|
+
if (!looksLikeDroppedStdoutError(raw)) {
|
|
5588
|
+
return;
|
|
5589
|
+
}
|
|
5590
|
+
this.emit({
|
|
5591
|
+
type: "status",
|
|
5592
|
+
status: "error",
|
|
5593
|
+
detail: raw
|
|
5594
|
+
});
|
|
5595
|
+
this.failPendingResponseWait(new Error(raw));
|
|
5596
|
+
}
|
|
5487
5597
|
async startSession(initialPrompt) {
|
|
5488
5598
|
if (this.disposed) {
|
|
5489
5599
|
throw new Error("Backend has been disposed");
|
|
@@ -5523,20 +5633,27 @@ class AcpBackend {
|
|
|
5523
5633
|
const result = this.transport.handleStderr(text, context);
|
|
5524
5634
|
if (result.message) {
|
|
5525
5635
|
this.emit(result.message);
|
|
5636
|
+
const errorDetail = getStatusErrorDetail(result.message);
|
|
5637
|
+
if (errorDetail && this.waitingForResponse) {
|
|
5638
|
+
this.failPendingResponseWait(new Error(errorDetail));
|
|
5639
|
+
}
|
|
5526
5640
|
}
|
|
5527
5641
|
}
|
|
5528
5642
|
});
|
|
5529
5643
|
this.process.on("error", (err) => {
|
|
5530
5644
|
logger.debug(`[AcpBackend] Process error:`, err);
|
|
5531
|
-
this.
|
|
5645
|
+
if (this.waitingForResponse) {
|
|
5646
|
+
this.failPendingResponseWait(err);
|
|
5647
|
+
}
|
|
5532
5648
|
this.emit({ type: "status", status: "error", detail: err.message });
|
|
5533
5649
|
});
|
|
5534
5650
|
this.process.on("exit", (code, signal) => {
|
|
5535
5651
|
if (!this.disposed && code !== 0 && code !== null) {
|
|
5536
|
-
this.
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5652
|
+
if (this.waitingForResponse) {
|
|
5653
|
+
this.failPendingResponseWait(
|
|
5654
|
+
new Error(`ACP process exited with code ${code}${signal ? ` (${signal})` : ""}`)
|
|
5655
|
+
);
|
|
5656
|
+
}
|
|
5540
5657
|
logger.debug(`[AcpBackend] Process exited with code ${code}, signal ${signal}`);
|
|
5541
5658
|
this.emit({ type: "status", status: "stopped", detail: `Exit code: ${code}` });
|
|
5542
5659
|
}
|
|
@@ -5553,14 +5670,17 @@ class AcpBackend {
|
|
|
5553
5670
|
transport: this.transport,
|
|
5554
5671
|
onDroppedLine: (entry) => {
|
|
5555
5672
|
droppedStdoutLines.push(entry);
|
|
5673
|
+
this.handleDroppedStdoutLine(entry);
|
|
5674
|
+
},
|
|
5675
|
+
onDone: () => {
|
|
5676
|
+
if (droppedStdoutLines.length > 0) {
|
|
5677
|
+
logger.debug(
|
|
5678
|
+
`[AcpBackend] Filtered out ${droppedStdoutLines.length} stdout lines from ${this.transport.agentName}`,
|
|
5679
|
+
droppedStdoutLines.slice(0, 5)
|
|
5680
|
+
);
|
|
5681
|
+
}
|
|
5556
5682
|
}
|
|
5557
5683
|
});
|
|
5558
|
-
if (droppedStdoutLines.length > 0) {
|
|
5559
|
-
logger.debug(
|
|
5560
|
-
`[AcpBackend] Filtered out ${droppedStdoutLines.length} stdout lines from ${this.transport.agentName}`,
|
|
5561
|
-
droppedStdoutLines.slice(0, 5)
|
|
5562
|
-
);
|
|
5563
|
-
}
|
|
5564
5684
|
const stream = ndJsonStream(writable, filteredReadable);
|
|
5565
5685
|
const client = {
|
|
5566
5686
|
sessionUpdate: async (params) => {
|
|
@@ -5722,6 +5842,11 @@ class AcpBackend {
|
|
|
5722
5842
|
}
|
|
5723
5843
|
};
|
|
5724
5844
|
const initTimeout = this.transport.getInitTimeout();
|
|
5845
|
+
const initDelayMs = this.transport.getInitDelayMs?.() ?? 0;
|
|
5846
|
+
if (initDelayMs > 0) {
|
|
5847
|
+
logger.debug(`[AcpBackend] Waiting ${initDelayMs}ms before initialize (${this.transport.agentName})...`);
|
|
5848
|
+
await delay(initDelayMs);
|
|
5849
|
+
}
|
|
5725
5850
|
logger.debug(`[AcpBackend] Initializing connection (timeout: ${initTimeout}ms)...`);
|
|
5726
5851
|
await withRetry(
|
|
5727
5852
|
async () => {
|
|
@@ -5827,6 +5952,16 @@ class AcpBackend {
|
|
|
5827
5952
|
return { sessionId };
|
|
5828
5953
|
} catch (error) {
|
|
5829
5954
|
const enrichedError = enrichAcpError(error, this.getRecentStderrExcerpt());
|
|
5955
|
+
if (this.process) {
|
|
5956
|
+
try {
|
|
5957
|
+
await killProcessTree(this.process, { graceMs: 250 });
|
|
5958
|
+
} catch {
|
|
5959
|
+
} finally {
|
|
5960
|
+
this.process = null;
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
this.connection = null;
|
|
5964
|
+
this.acpSessionId = null;
|
|
5830
5965
|
logger.debug("[AcpBackend] Error starting session:", enrichedError);
|
|
5831
5966
|
this.emit({
|
|
5832
5967
|
type: "status",
|
|
@@ -5887,6 +6022,8 @@ class AcpBackend {
|
|
|
5887
6022
|
logger.debug("[AcpBackend] Received session update without update field:", params);
|
|
5888
6023
|
return;
|
|
5889
6024
|
}
|
|
6025
|
+
this.sawSessionUpdateSincePrompt = true;
|
|
6026
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
5890
6027
|
for (const update of updates) {
|
|
5891
6028
|
const sessionUpdateType = update.sessionUpdate;
|
|
5892
6029
|
if (sessionUpdateType !== "agent_message_chunk") {
|
|
@@ -5966,6 +6103,29 @@ class AcpBackend {
|
|
|
5966
6103
|
logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
|
|
5967
6104
|
await this.connection.prompt(promptRequest);
|
|
5968
6105
|
logger.debug("[AcpBackend] Prompt request sent to ACP connection");
|
|
6106
|
+
if (this.waitingForResponse && this.activeToolCalls.size === 0 && this.sawSessionUpdateSincePrompt === false) {
|
|
6107
|
+
const noUpdatesTimeoutMs = resolvePostPromptNoUpdatesTimeoutMs(this.transport);
|
|
6108
|
+
this.postPromptCompletionIdleTimeout = setTimeout(() => {
|
|
6109
|
+
this.postPromptCompletionIdleTimeout = null;
|
|
6110
|
+
if (this.responseCompletionError || !this.waitingForResponse) {
|
|
6111
|
+
return;
|
|
6112
|
+
}
|
|
6113
|
+
if (this.sawSessionUpdateSincePrompt || this.activeToolCalls.size > 0) {
|
|
6114
|
+
return;
|
|
6115
|
+
}
|
|
6116
|
+
const exitCode = this.process?.exitCode;
|
|
6117
|
+
if (typeof exitCode === "number" && Number.isFinite(exitCode) && exitCode !== 0) {
|
|
6118
|
+
this.failPendingResponseWait(new Error(`Exit code: ${exitCode}`));
|
|
6119
|
+
return;
|
|
6120
|
+
}
|
|
6121
|
+
const signalCode = this.process?.signalCode;
|
|
6122
|
+
if (typeof signalCode === "string" && signalCode.trim().length > 0) {
|
|
6123
|
+
this.failPendingResponseWait(new Error(`Signal: ${signalCode}`));
|
|
6124
|
+
return;
|
|
6125
|
+
}
|
|
6126
|
+
this.emitIdleStatus();
|
|
6127
|
+
}, Math.max(100, noUpdatesTimeoutMs));
|
|
6128
|
+
}
|
|
5969
6129
|
} catch (error) {
|
|
5970
6130
|
logger.debug("[AcpBackend] Error sending prompt:", error);
|
|
5971
6131
|
let errorDetail;
|
|
@@ -5981,10 +6141,7 @@ class AcpBackend {
|
|
|
5981
6141
|
status: "error",
|
|
5982
6142
|
detail: errorDetail
|
|
5983
6143
|
});
|
|
5984
|
-
this.
|
|
5985
|
-
kind: "rejected",
|
|
5986
|
-
error: error instanceof Error ? error : normalizeAcpError(error)
|
|
5987
|
-
});
|
|
6144
|
+
this.failPendingResponseWait(error instanceof Error ? error : normalizeAcpError(error));
|
|
5988
6145
|
throw error;
|
|
5989
6146
|
}
|
|
5990
6147
|
}
|
|
@@ -5993,6 +6150,9 @@ class AcpBackend {
|
|
|
5993
6150
|
* Call this after sendPrompt to wait for Gemini to finish responding
|
|
5994
6151
|
*/
|
|
5995
6152
|
async waitForResponseComplete(timeoutMs = 12e4) {
|
|
6153
|
+
if (this.responseCompletionError) {
|
|
6154
|
+
throw this.responseCompletionError;
|
|
6155
|
+
}
|
|
5996
6156
|
const pendingOutcome = this.responseCompletionOutcome;
|
|
5997
6157
|
if (pendingOutcome) {
|
|
5998
6158
|
this.responseCompletionOutcome = null;
|
|
@@ -6031,12 +6191,14 @@ class AcpBackend {
|
|
|
6031
6191
|
* Helper to emit idle status and resolve any waiting promises
|
|
6032
6192
|
*/
|
|
6033
6193
|
emitIdleStatus() {
|
|
6194
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
6034
6195
|
this.emit({ type: "status", status: "idle" });
|
|
6035
6196
|
this.settleResponseWaiter({ kind: "resolved" });
|
|
6036
6197
|
}
|
|
6037
6198
|
async cancel(sessionId) {
|
|
6038
6199
|
const cancelError = createAcpAbortError("Cancelled by user");
|
|
6039
6200
|
this.clearIdleTimeoutState();
|
|
6201
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
6040
6202
|
this.clearToolCallTracking();
|
|
6041
6203
|
this.settleResponseWaiter({ kind: "rejected", error: cancelError });
|
|
6042
6204
|
this.emit({ type: "status", status: "stopped", detail: "Cancelled by user" });
|
|
@@ -6097,6 +6259,7 @@ class AcpBackend {
|
|
|
6097
6259
|
}
|
|
6098
6260
|
}
|
|
6099
6261
|
this.clearIdleTimeoutState();
|
|
6262
|
+
this.clearPostPromptCompletionIdleTimeout();
|
|
6100
6263
|
this.listeners = [];
|
|
6101
6264
|
this.connection = null;
|
|
6102
6265
|
this.acpSessionId = null;
|
|
@@ -6538,7 +6701,6 @@ function createCodexBackend(options) {
|
|
|
6538
6701
|
...options.env,
|
|
6539
6702
|
NODE_ENV: "production"
|
|
6540
6703
|
},
|
|
6541
|
-
mcpServers: options.mcpServers,
|
|
6542
6704
|
permissionHandler: options.permissionHandler,
|
|
6543
6705
|
selectionHandler: options.selectionHandler,
|
|
6544
6706
|
transportHandler: resolveCodexTransport(spawn.command)
|
|
@@ -6746,12 +6908,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6746
6908
|
async function executeUnifiedProvider(opts) {
|
|
6747
6909
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6748
6910
|
if (opts.provider === "claude") {
|
|
6749
|
-
const { runClaude } = await import('./runClaude-
|
|
6911
|
+
const { runClaude } = await import('./runClaude-DAR_hw3C.mjs');
|
|
6750
6912
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6751
6913
|
return;
|
|
6752
6914
|
}
|
|
6753
6915
|
if (opts.provider === "codex") {
|
|
6754
|
-
const { runCodex } = await import('./runCodex-
|
|
6916
|
+
const { runCodex } = await import('./runCodex-B4QAb-Go.mjs');
|
|
6755
6917
|
await runCodex({
|
|
6756
6918
|
credentials,
|
|
6757
6919
|
startedBy: opts.startedBy,
|
|
@@ -6761,7 +6923,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6761
6923
|
return;
|
|
6762
6924
|
}
|
|
6763
6925
|
if (opts.provider === "gemini") {
|
|
6764
|
-
const { runGemini } = await import('./runGemini-
|
|
6926
|
+
const { runGemini } = await import('./runGemini-DqowSR2w.mjs');
|
|
6765
6927
|
await runGemini({
|
|
6766
6928
|
credentials,
|
|
6767
6929
|
startedBy: opts.startedBy
|
|
@@ -6803,7 +6965,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6803
6965
|
return;
|
|
6804
6966
|
} else if (subcommand === "runtime") {
|
|
6805
6967
|
if (args[1] === "providers") {
|
|
6806
|
-
const { renderRuntimeProviders } = await import('./command-
|
|
6968
|
+
const { renderRuntimeProviders } = await import('./command-DGFsZx58.mjs');
|
|
6807
6969
|
console.log(renderRuntimeProviders());
|
|
6808
6970
|
return;
|
|
6809
6971
|
}
|
|
@@ -6981,8 +7143,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6981
7143
|
const projectId = args[3];
|
|
6982
7144
|
try {
|
|
6983
7145
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6984
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
6985
|
-
const { ApiClient: ApiClient2 } = await import('./api-
|
|
7146
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-DiNg1DPF.mjs');
|
|
7147
|
+
const { ApiClient: ApiClient2 } = await import('./api-D-uiH_TF.mjs').then(function (n) { return n.q; });
|
|
6986
7148
|
let userEmail = void 0;
|
|
6987
7149
|
try {
|
|
6988
7150
|
const credentials = await readCredentials2();
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
5
|
-
require('./persistence-
|
|
4
|
+
require('./api-CN-WqYd_.cjs');
|
|
5
|
+
require('./persistence-DBGkO8gB.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-DM6z3aeG.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('cross-spawn');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-D-uiH_TF.mjs';
|
|
3
|
+
import './persistence-DiNg1DPF.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-DhheEtRl.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'cross-spawn';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-D-uiH_TF.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-
|
|
4
|
-
import { p as projectPath } from './index-
|
|
3
|
+
import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-D-uiH_TF.mjs';
|
|
4
|
+
import { p as projectPath } from './index-DhheEtRl.mjs';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
7
|
|
|
@@ -527,4 +527,99 @@ class BaseReasoningProcessor {
|
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
|
|
530
|
+
function inferToolResultError(result) {
|
|
531
|
+
if (!result || typeof result !== "object") {
|
|
532
|
+
return false;
|
|
533
|
+
}
|
|
534
|
+
const record = result;
|
|
535
|
+
if (record.isError === true || record.is_error === true) {
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
if (typeof record.error === "string" && record.error.trim().length > 0) {
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
if (record.success === false) {
|
|
542
|
+
return true;
|
|
543
|
+
}
|
|
544
|
+
const status = typeof record.status === "string" ? record.status.toLowerCase() : "";
|
|
545
|
+
return status === "failed" || status === "cancelled" || status === "error" || status === "denied" || status === "aborted";
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function buildToolHappierMetaV2(input) {
|
|
549
|
+
return {
|
|
550
|
+
...input,
|
|
551
|
+
v: 2
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
function attachToolHappierMetaV2(value, meta) {
|
|
555
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
556
|
+
return value;
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
...value,
|
|
560
|
+
_happier: buildToolHappierMetaV2(meta)
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const KNOWN_CANONICAL_TOOL_NAMES_V2 = [
|
|
565
|
+
"Bash",
|
|
566
|
+
"Read",
|
|
567
|
+
"Write",
|
|
568
|
+
"Edit",
|
|
569
|
+
"MultiEdit",
|
|
570
|
+
"Delete",
|
|
571
|
+
"Patch",
|
|
572
|
+
"Diff",
|
|
573
|
+
"Glob",
|
|
574
|
+
"Grep",
|
|
575
|
+
"LS",
|
|
576
|
+
"CodeSearch",
|
|
577
|
+
"WebFetch",
|
|
578
|
+
"WebSearch",
|
|
579
|
+
"TodoWrite",
|
|
580
|
+
"TodoRead",
|
|
581
|
+
"Task",
|
|
582
|
+
"Reasoning",
|
|
583
|
+
"EnterPlanMode",
|
|
584
|
+
"ExitPlanMode",
|
|
585
|
+
"AskUserQuestion",
|
|
586
|
+
"AcpHistoryImport",
|
|
587
|
+
"WorkspaceIndexingPermission",
|
|
588
|
+
"SubAgentRun",
|
|
589
|
+
"AgentTeamCreate",
|
|
590
|
+
"AgentTeamDelete",
|
|
591
|
+
"AgentTeamSendMessage"
|
|
592
|
+
];
|
|
593
|
+
const CANONICAL_TOOL_NAME_LOOKUP = new Map(
|
|
594
|
+
KNOWN_CANONICAL_TOOL_NAMES_V2.map((name) => [name.toLowerCase(), name])
|
|
595
|
+
);
|
|
596
|
+
const RAW_TO_CANONICAL_TOOL_NAME_LOOKUP = {
|
|
597
|
+
bash: "Bash",
|
|
598
|
+
shell: "Bash",
|
|
599
|
+
execute: "Bash",
|
|
600
|
+
codexbash: "Bash",
|
|
601
|
+
geminibash: "Bash",
|
|
602
|
+
codexpatch: "Patch",
|
|
603
|
+
geminipatch: "Patch"
|
|
604
|
+
};
|
|
605
|
+
function resolveCanonicalToolNameV2(rawToolName) {
|
|
606
|
+
const normalized = typeof rawToolName === "string" ? rawToolName.trim() : "";
|
|
607
|
+
if (!normalized) {
|
|
608
|
+
return "Bash";
|
|
609
|
+
}
|
|
610
|
+
if (normalized.startsWith("mcp__")) {
|
|
611
|
+
return normalized;
|
|
612
|
+
}
|
|
613
|
+
const lower = normalized.toLowerCase();
|
|
614
|
+
const known = CANONICAL_TOOL_NAME_LOOKUP.get(lower);
|
|
615
|
+
if (known) {
|
|
616
|
+
return known;
|
|
617
|
+
}
|
|
618
|
+
const mapped = RAW_TO_CANONICAL_TOOL_NAME_LOOKUP[lower];
|
|
619
|
+
if (mapped) {
|
|
620
|
+
return mapped;
|
|
621
|
+
}
|
|
622
|
+
return normalized;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export { BasePermissionHandler as B, INTERACTION_SUPERSEDED_ERROR as I, BaseReasoningProcessor as a, attachToolHappierMetaV2 as b, createSessionMetadata as c, INTERACTION_TIMED_OUT_ERROR as d, getPendingInteractionTimeoutMs as g, inferToolResultError as i, resolveCanonicalToolNameV2 as r, setupOfflineReconnection as s };
|