happy-imou-cloud 2.0.2 → 2.0.4
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/{BaseReasoningProcessor-B6tJ_eL5.cjs → BaseReasoningProcessor-DEEfNi5Y.cjs} +4 -4
- package/dist/{BaseReasoningProcessor-D8VhEbs2.mjs → BaseReasoningProcessor-Di1yEMMv.mjs} +2 -2
- package/dist/{api-MYhAGPLn.mjs → api-CIHTNilH.mjs} +2 -2
- package/dist/{api-D2Njw9Im.cjs → api-CyJG1mr6.cjs} +43 -43
- package/dist/{command-nmK6O-ab.mjs → command-BERqmFB0.mjs} +3 -3
- package/dist/{command-CVldr51S.cjs → command-CPlJKXDn.cjs} +3 -3
- package/dist/{index-Bg-YziG2.cjs → index-1zlH6s7a.cjs} +313 -118
- package/dist/{index-B97L7qLD.mjs → index-vNYxNqVZ.mjs} +226 -31
- 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/{persistence-D_2GkJAO.cjs → persistence-BeFVx6kI.cjs} +28 -28
- package/dist/{persistence-Dkm7rm8k.mjs → persistence-sLEqV8vk.mjs} +1 -1
- package/dist/{registerKillSessionHandler-BAXmJQRt.cjs → registerKillSessionHandler-CCxqGFjZ.cjs} +2 -2
- package/dist/{registerKillSessionHandler-5GbrO0FM.mjs → registerKillSessionHandler-uVHqIC4h.mjs} +2 -2
- package/dist/{runClaude-Cii3R2Fv.mjs → runClaude-Dl9nIRIg.mjs} +25 -5
- package/dist/{runClaude-B-GNEkKg.cjs → runClaude-Dz-PCSvb.cjs} +53 -33
- package/dist/{runCodex-CPHyGwj9.cjs → runCodex-BtZplK1R.cjs} +275 -408
- package/dist/{runCodex-C--ZwAhl.mjs → runCodex-DgKKw3IU.mjs} +273 -409
- package/dist/{runGemini-CQp7Nuzn.mjs → runGemini-CM1v3I24.mjs} +10 -8
- package/dist/{runGemini-DaDz1bzQ.cjs → runGemini-DUyH311Z.cjs} +10 -8
- package/package.json +1 -1
- package/dist/future-Dq4Ha1Dn.cjs +0 -24
- package/dist/future-xRdLl3vf.mjs +0 -22
|
@@ -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-CIHTNilH.mjs';
|
|
3
|
+
import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-sLEqV8vk.mjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import fs from 'fs/promises';
|
|
6
6
|
import os, { homedir } from 'os';
|
|
@@ -4505,6 +4505,107 @@ function parseArgsFromContent(content) {
|
|
|
4505
4505
|
}
|
|
4506
4506
|
return {};
|
|
4507
4507
|
}
|
|
4508
|
+
function appendToolOutput(existing, next) {
|
|
4509
|
+
if (!existing || existing.length === 0) {
|
|
4510
|
+
return next;
|
|
4511
|
+
}
|
|
4512
|
+
if (next === existing || existing.endsWith(next)) {
|
|
4513
|
+
return existing;
|
|
4514
|
+
}
|
|
4515
|
+
if (next.startsWith(existing)) {
|
|
4516
|
+
return next;
|
|
4517
|
+
}
|
|
4518
|
+
return `${existing}${next}`;
|
|
4519
|
+
}
|
|
4520
|
+
function isRecord(value) {
|
|
4521
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4522
|
+
}
|
|
4523
|
+
function hasMeaningfulContent(value) {
|
|
4524
|
+
if (value === null || value === void 0) {
|
|
4525
|
+
return false;
|
|
4526
|
+
}
|
|
4527
|
+
if (typeof value === "string") {
|
|
4528
|
+
return value.length > 0;
|
|
4529
|
+
}
|
|
4530
|
+
if (Array.isArray(value)) {
|
|
4531
|
+
return value.length > 0;
|
|
4532
|
+
}
|
|
4533
|
+
if (isRecord(value)) {
|
|
4534
|
+
return Object.keys(value).length > 0;
|
|
4535
|
+
}
|
|
4536
|
+
return true;
|
|
4537
|
+
}
|
|
4538
|
+
function looksLikeToolMetadata(record) {
|
|
4539
|
+
const metadataKeys = [
|
|
4540
|
+
"command",
|
|
4541
|
+
"cmd",
|
|
4542
|
+
"script",
|
|
4543
|
+
"argv",
|
|
4544
|
+
"cwd",
|
|
4545
|
+
"workingDirectory",
|
|
4546
|
+
"description",
|
|
4547
|
+
"title",
|
|
4548
|
+
"parsed_cmd"
|
|
4549
|
+
];
|
|
4550
|
+
if (metadataKeys.some((key) => key in record)) {
|
|
4551
|
+
return true;
|
|
4552
|
+
}
|
|
4553
|
+
const nestedKeys = ["input", "toolCall", "arguments", "content"];
|
|
4554
|
+
for (const key of nestedKeys) {
|
|
4555
|
+
const nested = record[key];
|
|
4556
|
+
if (isRecord(nested) && looksLikeToolMetadata(nested)) {
|
|
4557
|
+
return true;
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
return false;
|
|
4561
|
+
}
|
|
4562
|
+
function extractToolOutputChunk(content) {
|
|
4563
|
+
if (typeof content === "string") {
|
|
4564
|
+
return content.length > 0 ? content : null;
|
|
4565
|
+
}
|
|
4566
|
+
if (Array.isArray(content)) {
|
|
4567
|
+
const parts = content.map((item) => extractToolOutputChunk(item)).filter((item) => Boolean(item));
|
|
4568
|
+
return parts.length > 0 ? parts.join("") : null;
|
|
4569
|
+
}
|
|
4570
|
+
if (!isRecord(content)) {
|
|
4571
|
+
return null;
|
|
4572
|
+
}
|
|
4573
|
+
const outputKeys = ["stdout", "stderr", "output", "text", "message", "data", "error", "reason"];
|
|
4574
|
+
const hasOutputKey = outputKeys.some((key) => key in content);
|
|
4575
|
+
if (!hasOutputKey && looksLikeToolMetadata(content)) {
|
|
4576
|
+
return null;
|
|
4577
|
+
}
|
|
4578
|
+
for (const key of outputKeys) {
|
|
4579
|
+
if (!(key in content)) {
|
|
4580
|
+
continue;
|
|
4581
|
+
}
|
|
4582
|
+
const value = content[key];
|
|
4583
|
+
const formatted2 = typeof value === "string" ? value : formatDisplayMessage(value);
|
|
4584
|
+
if (formatted2.length > 0) {
|
|
4585
|
+
return formatted2;
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
const formatted = formatDisplayMessage(content);
|
|
4589
|
+
return formatted.length > 0 ? formatted : null;
|
|
4590
|
+
}
|
|
4591
|
+
function mergeStreamedOutputWithResult(content, streamedOutput) {
|
|
4592
|
+
if (!streamedOutput || streamedOutput.length === 0) {
|
|
4593
|
+
return content;
|
|
4594
|
+
}
|
|
4595
|
+
if (!hasMeaningfulContent(content)) {
|
|
4596
|
+
return streamedOutput;
|
|
4597
|
+
}
|
|
4598
|
+
if (isRecord(content)) {
|
|
4599
|
+
const hasStructuredOutput = ["stdout", "stderr", "output", "text", "message", "data"].some((key) => key in content);
|
|
4600
|
+
if (!hasStructuredOutput) {
|
|
4601
|
+
return {
|
|
4602
|
+
...content,
|
|
4603
|
+
stdout: streamedOutput
|
|
4604
|
+
};
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
return content;
|
|
4608
|
+
}
|
|
4508
4609
|
function extractErrorDetail(content) {
|
|
4509
4610
|
if (!content) return void 0;
|
|
4510
4611
|
if (typeof content === "string") {
|
|
@@ -4652,11 +4753,13 @@ function completeToolCall(toolCallId, toolKind, content, ctx) {
|
|
|
4652
4753
|
clearTimeout(timeout);
|
|
4653
4754
|
ctx.toolCallTimeouts.delete(toolCallId);
|
|
4654
4755
|
}
|
|
4756
|
+
const streamedOutput = ctx.toolCallOutputs.get(toolCallId);
|
|
4757
|
+
ctx.toolCallOutputs.delete(toolCallId);
|
|
4655
4758
|
logger.debug(`[AcpBackend] \u2705 Tool call COMPLETED: ${toolCallId} (${toolKindStr}) - Duration: ${duration}. Active tool calls: ${ctx.activeToolCalls.size}`);
|
|
4656
4759
|
ctx.emit({
|
|
4657
4760
|
type: "tool-result",
|
|
4658
4761
|
toolName: toolKindStr,
|
|
4659
|
-
result: content,
|
|
4762
|
+
result: mergeStreamedOutputWithResult(content, streamedOutput),
|
|
4660
4763
|
callId: toolCallId
|
|
4661
4764
|
});
|
|
4662
4765
|
if (ctx.activeToolCalls.size === 0) {
|
|
@@ -4698,6 +4801,8 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
|
|
|
4698
4801
|
}
|
|
4699
4802
|
const durationStr = formatDuration(startTime);
|
|
4700
4803
|
logger.debug(`[AcpBackend] \u274C Tool call ${status.toUpperCase()}: ${toolCallId} (${toolKindStr}) - Duration: ${durationStr}. Active tool calls: ${ctx.activeToolCalls.size}`);
|
|
4804
|
+
const streamedOutput = ctx.toolCallOutputs.get(toolCallId);
|
|
4805
|
+
ctx.toolCallOutputs.delete(toolCallId);
|
|
4701
4806
|
const errorDetail = extractErrorDetail(content);
|
|
4702
4807
|
if (errorDetail) {
|
|
4703
4808
|
logger.debug(`[AcpBackend] \u274C Tool call error details: ${errorDetail.substring(0, 500)}`);
|
|
@@ -4707,7 +4812,11 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
|
|
|
4707
4812
|
ctx.emit({
|
|
4708
4813
|
type: "tool-result",
|
|
4709
4814
|
toolName: toolKindStr,
|
|
4710
|
-
result:
|
|
4815
|
+
result: streamedOutput ? {
|
|
4816
|
+
stdout: streamedOutput,
|
|
4817
|
+
error: errorDetail || `Tool call ${status}`,
|
|
4818
|
+
status
|
|
4819
|
+
} : errorDetail ? { error: errorDetail, status } : { error: `Tool call ${status}`, status },
|
|
4711
4820
|
callId: toolCallId
|
|
4712
4821
|
});
|
|
4713
4822
|
if (ctx.activeToolCalls.size === 0) {
|
|
@@ -4723,8 +4832,13 @@ function handleToolCallUpdate(update, ctx) {
|
|
|
4723
4832
|
logger.debug("[AcpBackend] Tool call update without toolCallId:", update);
|
|
4724
4833
|
return { handled: false };
|
|
4725
4834
|
}
|
|
4726
|
-
const toolKind = update.kind || "unknown";
|
|
4835
|
+
const toolKind = update.kind || ctx.toolCallIdToNameMap.get(toolCallId) || "unknown";
|
|
4727
4836
|
let toolCallCountSincePrompt = ctx.toolCallCountSincePrompt;
|
|
4837
|
+
const outputChunk = extractToolOutputChunk(update.content);
|
|
4838
|
+
if (outputChunk) {
|
|
4839
|
+
const nextOutput = appendToolOutput(ctx.toolCallOutputs.get(toolCallId), outputChunk);
|
|
4840
|
+
ctx.toolCallOutputs.set(toolCallId, nextOutput);
|
|
4841
|
+
}
|
|
4728
4842
|
if (status === "in_progress" || status === "pending") {
|
|
4729
4843
|
if (!ctx.activeToolCalls.has(toolCallId)) {
|
|
4730
4844
|
toolCallCountSincePrompt++;
|
|
@@ -4973,6 +5087,11 @@ function normalizeAcpError(error) {
|
|
|
4973
5087
|
}
|
|
4974
5088
|
return normalized;
|
|
4975
5089
|
}
|
|
5090
|
+
function createAcpAbortError(message) {
|
|
5091
|
+
const error = new Error(message);
|
|
5092
|
+
error.name = "AbortError";
|
|
5093
|
+
return error;
|
|
5094
|
+
}
|
|
4976
5095
|
function enrichAcpError(error, stderrExcerpt) {
|
|
4977
5096
|
const normalized = normalizeAcpError(error);
|
|
4978
5097
|
if (!stderrExcerpt.trim()) {
|
|
@@ -4999,6 +5118,8 @@ class AcpBackend {
|
|
|
4999
5118
|
toolCallTimeouts = /* @__PURE__ */ new Map();
|
|
5000
5119
|
/** Track tool call start times for performance monitoring */
|
|
5001
5120
|
toolCallStartTimes = /* @__PURE__ */ new Map();
|
|
5121
|
+
/** Track streamed tool output between ACP updates and final completion */
|
|
5122
|
+
toolCallOutputs = /* @__PURE__ */ new Map();
|
|
5002
5123
|
/** Pending permission requests that need response */
|
|
5003
5124
|
pendingPermissions = /* @__PURE__ */ new Map();
|
|
5004
5125
|
/** Map from permission request ID to real tool call ID for tracking */
|
|
@@ -5009,6 +5130,14 @@ class AcpBackend {
|
|
|
5009
5130
|
toolCallCountSincePrompt = 0;
|
|
5010
5131
|
/** Timeout for emitting 'idle' status after last message chunk */
|
|
5011
5132
|
idleTimeout = null;
|
|
5133
|
+
/** Promise resolver for waitForResponseComplete */
|
|
5134
|
+
idleResolver = null;
|
|
5135
|
+
/** Promise rejecter for waitForResponseComplete */
|
|
5136
|
+
idleRejecter = null;
|
|
5137
|
+
/** Completion signal captured before waitForResponseComplete is attached */
|
|
5138
|
+
responseCompletionOutcome = null;
|
|
5139
|
+
/** Whether the current prompt is still waiting for completion */
|
|
5140
|
+
waitingForResponse = false;
|
|
5012
5141
|
/** Transport handler for agent-specific behavior */
|
|
5013
5142
|
transport;
|
|
5014
5143
|
/** Keep a short rolling stderr buffer so startup failures can surface the real cause. */
|
|
@@ -5026,6 +5155,44 @@ class AcpBackend {
|
|
|
5026
5155
|
getRecentStderrExcerpt() {
|
|
5027
5156
|
return this.recentStderrLines.slice(-6).join("\n");
|
|
5028
5157
|
}
|
|
5158
|
+
clearIdleTimeoutState() {
|
|
5159
|
+
if (this.idleTimeout) {
|
|
5160
|
+
clearTimeout(this.idleTimeout);
|
|
5161
|
+
this.idleTimeout = null;
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
clearToolCallTracking() {
|
|
5165
|
+
this.activeToolCalls.clear();
|
|
5166
|
+
for (const timeout of this.toolCallTimeouts.values()) {
|
|
5167
|
+
clearTimeout(timeout);
|
|
5168
|
+
}
|
|
5169
|
+
this.toolCallTimeouts.clear();
|
|
5170
|
+
this.toolCallStartTimes.clear();
|
|
5171
|
+
this.toolCallIdToNameMap.clear();
|
|
5172
|
+
this.toolCallOutputs.clear();
|
|
5173
|
+
this.toolCallCountSincePrompt = 0;
|
|
5174
|
+
}
|
|
5175
|
+
resetResponseTrackingForNewPrompt() {
|
|
5176
|
+
this.responseCompletionOutcome = null;
|
|
5177
|
+
this.clearIdleTimeoutState();
|
|
5178
|
+
this.clearToolCallTracking();
|
|
5179
|
+
}
|
|
5180
|
+
settleResponseWaiter(outcome) {
|
|
5181
|
+
const hasActiveWaiter = Boolean(this.idleResolver || this.idleRejecter);
|
|
5182
|
+
if (!this.waitingForResponse && !hasActiveWaiter) {
|
|
5183
|
+
return;
|
|
5184
|
+
}
|
|
5185
|
+
if (!hasActiveWaiter) {
|
|
5186
|
+
this.waitingForResponse = false;
|
|
5187
|
+
this.responseCompletionOutcome = outcome;
|
|
5188
|
+
return;
|
|
5189
|
+
}
|
|
5190
|
+
if (outcome.kind === "resolved") {
|
|
5191
|
+
this.idleResolver?.();
|
|
5192
|
+
return;
|
|
5193
|
+
}
|
|
5194
|
+
this.idleRejecter?.(outcome.error);
|
|
5195
|
+
}
|
|
5029
5196
|
onMessage(handler) {
|
|
5030
5197
|
this.listeners.push(handler);
|
|
5031
5198
|
}
|
|
@@ -5100,10 +5267,15 @@ class AcpBackend {
|
|
|
5100
5267
|
});
|
|
5101
5268
|
this.process.on("error", (err) => {
|
|
5102
5269
|
logger.debug(`[AcpBackend] Process error:`, err);
|
|
5270
|
+
this.settleResponseWaiter({ kind: "rejected", error: err });
|
|
5103
5271
|
this.emit({ type: "status", status: "error", detail: err.message });
|
|
5104
5272
|
});
|
|
5105
5273
|
this.process.on("exit", (code, signal) => {
|
|
5106
5274
|
if (!this.disposed && code !== 0 && code !== null) {
|
|
5275
|
+
this.settleResponseWaiter({
|
|
5276
|
+
kind: "rejected",
|
|
5277
|
+
error: new Error(`ACP process exited with code ${code}${signal ? ` (${signal})` : ""}`)
|
|
5278
|
+
});
|
|
5107
5279
|
logger.debug(`[AcpBackend] Process exited with code ${code}, signal ${signal}`);
|
|
5108
5280
|
this.emit({ type: "status", status: "stopped", detail: `Exit code: ${code}` });
|
|
5109
5281
|
}
|
|
@@ -5434,6 +5606,7 @@ class AcpBackend {
|
|
|
5434
5606
|
toolCallStartTimes: this.toolCallStartTimes,
|
|
5435
5607
|
toolCallTimeouts: this.toolCallTimeouts,
|
|
5436
5608
|
toolCallIdToNameMap: this.toolCallIdToNameMap,
|
|
5609
|
+
toolCallOutputs: this.toolCallOutputs,
|
|
5437
5610
|
idleTimeout: this.idleTimeout,
|
|
5438
5611
|
toolCallCountSincePrompt: this.toolCallCountSincePrompt,
|
|
5439
5612
|
emit: (msg) => this.emit(msg),
|
|
@@ -5510,20 +5683,24 @@ class AcpBackend {
|
|
|
5510
5683
|
this.emitUsageTelemetry(update, "acp-usage-update");
|
|
5511
5684
|
continue;
|
|
5512
5685
|
}
|
|
5686
|
+
if (sessionUpdateType === "task_complete") {
|
|
5687
|
+
this.emitUsageTelemetry(update.usage, "acp-session-usage");
|
|
5688
|
+
ctx.clearIdleTimeout();
|
|
5689
|
+
logger.debug("[AcpBackend] task_complete received, emitting idle status");
|
|
5690
|
+
this.emitIdleStatus();
|
|
5691
|
+
continue;
|
|
5692
|
+
}
|
|
5513
5693
|
const handledLegacy = handleLegacyMessageChunk(update, ctx).handled;
|
|
5514
5694
|
const handledPlan = handlePlanUpdate(update, ctx).handled;
|
|
5515
5695
|
const handledThinking = handleThinkingUpdate(update, ctx).handled;
|
|
5516
5696
|
const handledUsage = this.emitUsageTelemetry(update.usage, "acp-session-usage");
|
|
5517
5697
|
const updateTypeStr = sessionUpdateType;
|
|
5518
|
-
const handledTypes = ["agent_message_chunk", "tool_call_update", "agent_thought_chunk", "tool_call", "usage_update"];
|
|
5698
|
+
const handledTypes = ["agent_message_chunk", "tool_call_update", "agent_thought_chunk", "tool_call", "usage_update", "task_complete"];
|
|
5519
5699
|
if (updateTypeStr && !handledTypes.includes(updateTypeStr) && !handledLegacy && !handledPlan && !handledThinking && !handledUsage) {
|
|
5520
5700
|
logger.debug(`[AcpBackend] Unhandled session update type: ${updateTypeStr}`, JSON.stringify(update, null, 2));
|
|
5521
5701
|
}
|
|
5522
5702
|
}
|
|
5523
5703
|
}
|
|
5524
|
-
// Promise resolver for waitForIdle - set when waiting for response to complete
|
|
5525
|
-
idleResolver = null;
|
|
5526
|
-
waitingForResponse = false;
|
|
5527
5704
|
async sendPrompt(sessionId, prompt) {
|
|
5528
5705
|
this.toolCallCountSincePrompt = 0;
|
|
5529
5706
|
if (this.disposed) {
|
|
@@ -5532,6 +5709,7 @@ class AcpBackend {
|
|
|
5532
5709
|
if (!this.connection || !this.acpSessionId) {
|
|
5533
5710
|
throw new Error("Session not started");
|
|
5534
5711
|
}
|
|
5712
|
+
this.resetResponseTrackingForNewPrompt();
|
|
5535
5713
|
this.emit({ type: "status", status: "running" });
|
|
5536
5714
|
this.waitingForResponse = true;
|
|
5537
5715
|
try {
|
|
@@ -5550,7 +5728,6 @@ class AcpBackend {
|
|
|
5550
5728
|
logger.debug("[AcpBackend] Prompt request sent to ACP connection");
|
|
5551
5729
|
} catch (error) {
|
|
5552
5730
|
logger.debug("[AcpBackend] Error sending prompt:", error);
|
|
5553
|
-
this.waitingForResponse = false;
|
|
5554
5731
|
let errorDetail;
|
|
5555
5732
|
if (error instanceof Error) {
|
|
5556
5733
|
errorDetail = error.message;
|
|
@@ -5564,6 +5741,10 @@ class AcpBackend {
|
|
|
5564
5741
|
status: "error",
|
|
5565
5742
|
detail: errorDetail
|
|
5566
5743
|
});
|
|
5744
|
+
this.settleResponseWaiter({
|
|
5745
|
+
kind: "rejected",
|
|
5746
|
+
error: error instanceof Error ? error : normalizeAcpError(error)
|
|
5747
|
+
});
|
|
5567
5748
|
throw error;
|
|
5568
5749
|
}
|
|
5569
5750
|
}
|
|
@@ -5572,21 +5753,38 @@ class AcpBackend {
|
|
|
5572
5753
|
* Call this after sendPrompt to wait for Gemini to finish responding
|
|
5573
5754
|
*/
|
|
5574
5755
|
async waitForResponseComplete(timeoutMs = 12e4) {
|
|
5756
|
+
const pendingOutcome = this.responseCompletionOutcome;
|
|
5757
|
+
if (pendingOutcome) {
|
|
5758
|
+
this.responseCompletionOutcome = null;
|
|
5759
|
+
if (pendingOutcome.kind === "rejected") {
|
|
5760
|
+
throw pendingOutcome.error;
|
|
5761
|
+
}
|
|
5762
|
+
return;
|
|
5763
|
+
}
|
|
5575
5764
|
if (!this.waitingForResponse) {
|
|
5576
5765
|
return;
|
|
5577
5766
|
}
|
|
5578
5767
|
return new Promise((resolve, reject) => {
|
|
5579
5768
|
const timeout = setTimeout(() => {
|
|
5580
5769
|
this.idleResolver = null;
|
|
5770
|
+
this.idleRejecter = null;
|
|
5581
5771
|
this.waitingForResponse = false;
|
|
5582
5772
|
reject(new Error("Timeout waiting for response to complete"));
|
|
5583
5773
|
}, timeoutMs);
|
|
5584
5774
|
this.idleResolver = () => {
|
|
5585
5775
|
clearTimeout(timeout);
|
|
5586
5776
|
this.idleResolver = null;
|
|
5777
|
+
this.idleRejecter = null;
|
|
5587
5778
|
this.waitingForResponse = false;
|
|
5588
5779
|
resolve();
|
|
5589
5780
|
};
|
|
5781
|
+
this.idleRejecter = (error) => {
|
|
5782
|
+
clearTimeout(timeout);
|
|
5783
|
+
this.idleResolver = null;
|
|
5784
|
+
this.idleRejecter = null;
|
|
5785
|
+
this.waitingForResponse = false;
|
|
5786
|
+
reject(error);
|
|
5787
|
+
};
|
|
5590
5788
|
});
|
|
5591
5789
|
}
|
|
5592
5790
|
/**
|
|
@@ -5594,18 +5792,19 @@ class AcpBackend {
|
|
|
5594
5792
|
*/
|
|
5595
5793
|
emitIdleStatus() {
|
|
5596
5794
|
this.emit({ type: "status", status: "idle" });
|
|
5597
|
-
|
|
5598
|
-
logger.debug("[AcpBackend] Resolving idle waiter");
|
|
5599
|
-
this.idleResolver();
|
|
5600
|
-
}
|
|
5795
|
+
this.settleResponseWaiter({ kind: "resolved" });
|
|
5601
5796
|
}
|
|
5602
5797
|
async cancel(sessionId) {
|
|
5798
|
+
const cancelError = createAcpAbortError("Cancelled by user");
|
|
5799
|
+
this.clearIdleTimeoutState();
|
|
5800
|
+
this.clearToolCallTracking();
|
|
5801
|
+
this.settleResponseWaiter({ kind: "rejected", error: cancelError });
|
|
5802
|
+
this.emit({ type: "status", status: "stopped", detail: "Cancelled by user" });
|
|
5603
5803
|
if (!this.connection || !this.acpSessionId) {
|
|
5604
5804
|
return;
|
|
5605
5805
|
}
|
|
5606
5806
|
try {
|
|
5607
5807
|
await this.connection.cancel({ sessionId: this.acpSessionId });
|
|
5608
|
-
this.emit({ type: "status", status: "stopped", detail: "Cancelled by user" });
|
|
5609
5808
|
} catch (error) {
|
|
5610
5809
|
logger.debug("[AcpBackend] Error cancelling:", error);
|
|
5611
5810
|
}
|
|
@@ -5633,6 +5832,10 @@ class AcpBackend {
|
|
|
5633
5832
|
if (this.disposed) return;
|
|
5634
5833
|
logger.debug("[AcpBackend] Disposing backend");
|
|
5635
5834
|
this.disposed = true;
|
|
5835
|
+
this.settleResponseWaiter({
|
|
5836
|
+
kind: "rejected",
|
|
5837
|
+
error: createAcpAbortError("ACP backend disposed")
|
|
5838
|
+
});
|
|
5636
5839
|
if (this.connection && this.acpSessionId) {
|
|
5637
5840
|
try {
|
|
5638
5841
|
await Promise.race([
|
|
@@ -5661,19 +5864,11 @@ class AcpBackend {
|
|
|
5661
5864
|
});
|
|
5662
5865
|
this.process = null;
|
|
5663
5866
|
}
|
|
5664
|
-
|
|
5665
|
-
clearTimeout(this.idleTimeout);
|
|
5666
|
-
this.idleTimeout = null;
|
|
5667
|
-
}
|
|
5867
|
+
this.clearIdleTimeoutState();
|
|
5668
5868
|
this.listeners = [];
|
|
5669
5869
|
this.connection = null;
|
|
5670
5870
|
this.acpSessionId = null;
|
|
5671
|
-
this.
|
|
5672
|
-
for (const timeout of this.toolCallTimeouts.values()) {
|
|
5673
|
-
clearTimeout(timeout);
|
|
5674
|
-
}
|
|
5675
|
-
this.toolCallTimeouts.clear();
|
|
5676
|
-
this.toolCallStartTimes.clear();
|
|
5871
|
+
this.clearToolCallTracking();
|
|
5677
5872
|
this.pendingPermissions.clear();
|
|
5678
5873
|
}
|
|
5679
5874
|
}
|
|
@@ -6314,12 +6509,12 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
6314
6509
|
async function executeUnifiedProvider(opts) {
|
|
6315
6510
|
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
|
|
6316
6511
|
if (opts.provider === "claude") {
|
|
6317
|
-
const { runClaude } = await import('./runClaude-
|
|
6512
|
+
const { runClaude } = await import('./runClaude-Dl9nIRIg.mjs');
|
|
6318
6513
|
await runClaude(credentials, opts.claudeOptions ?? {});
|
|
6319
6514
|
return;
|
|
6320
6515
|
}
|
|
6321
6516
|
if (opts.provider === "codex") {
|
|
6322
|
-
const { runCodex } = await import('./runCodex-
|
|
6517
|
+
const { runCodex } = await import('./runCodex-DgKKw3IU.mjs');
|
|
6323
6518
|
await runCodex({
|
|
6324
6519
|
credentials,
|
|
6325
6520
|
startedBy: opts.startedBy,
|
|
@@ -6329,7 +6524,7 @@ async function executeUnifiedProvider(opts) {
|
|
|
6329
6524
|
return;
|
|
6330
6525
|
}
|
|
6331
6526
|
if (opts.provider === "gemini") {
|
|
6332
|
-
const { runGemini } = await import('./runGemini-
|
|
6527
|
+
const { runGemini } = await import('./runGemini-CM1v3I24.mjs');
|
|
6333
6528
|
await runGemini({
|
|
6334
6529
|
credentials,
|
|
6335
6530
|
startedBy: opts.startedBy
|
|
@@ -6371,7 +6566,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6371
6566
|
return;
|
|
6372
6567
|
} else if (subcommand === "runtime") {
|
|
6373
6568
|
if (args[1] === "providers") {
|
|
6374
|
-
const { renderRuntimeProviders } = await import('./command-
|
|
6569
|
+
const { renderRuntimeProviders } = await import('./command-BERqmFB0.mjs');
|
|
6375
6570
|
console.log(renderRuntimeProviders());
|
|
6376
6571
|
return;
|
|
6377
6572
|
}
|
|
@@ -6549,8 +6744,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
6549
6744
|
const projectId = args[3];
|
|
6550
6745
|
try {
|
|
6551
6746
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
6552
|
-
const { readCredentials: readCredentials2 } = await import('./persistence-
|
|
6553
|
-
const { ApiClient: ApiClient2 } = await import('./api-
|
|
6747
|
+
const { readCredentials: readCredentials2 } = await import('./persistence-sLEqV8vk.mjs');
|
|
6748
|
+
const { ApiClient: ApiClient2 } = await import('./api-CIHTNilH.mjs').then(function (n) { return n.q; });
|
|
6554
6749
|
let userEmail = void 0;
|
|
6555
6750
|
try {
|
|
6556
6751
|
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-CyJG1mr6.cjs');
|
|
5
|
+
require('./persistence-BeFVx6kI.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-1zlH6s7a.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('@agentclientprotocol/sdk');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-CIHTNilH.mjs';
|
|
3
|
+
import './persistence-sLEqV8vk.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-vNYxNqVZ.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@agentclientprotocol/sdk';
|
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-CIHTNilH.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|