very-happy-cli 0.2.78 → 0.2.79

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 (31) hide show
  1. package/dist/{AcpBackend-BxZ-KvBy.cjs → AcpBackend-BuxJntPo.cjs} +1 -1
  2. package/dist/{AcpBackend-CDngyx5G.mjs → AcpBackend-DPcRh_3n.mjs} +1 -1
  3. package/dist/{AcpSessionManager-BWFM_8f9.cjs → AcpSessionManager-BOZPQZUQ.cjs} +1 -1
  4. package/dist/{AcpSessionManager-Dcq8dl4l.mjs → AcpSessionManager-DVGWPtBC.mjs} +1 -1
  5. package/dist/{config-Byay91xM.cjs → config-DB0v5eoc.cjs} +2 -2
  6. package/dist/{config-Co1Tpb5e.mjs → config-T7eM_8eT.mjs} +2 -2
  7. package/dist/{index-CuvhWx_d.cjs → index-BGvGqzc1.cjs} +252 -73
  8. package/dist/{index-DdOYA0qe.mjs → index-CuLe9SB7.mjs} +5 -5
  9. package/dist/{index-CkjEzh-Y.cjs → index-D_ZjCYNI.cjs} +4 -4
  10. package/dist/{index-w0zkr6EM.mjs → index-HYOkniru.mjs} +249 -70
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/{installTerminalHooks-nXjKPP3D.cjs → installTerminalHooks-CAViJyYh.cjs} +2 -2
  14. package/dist/{installTerminalHooks-DFmjn6EQ.mjs → installTerminalHooks-CPKThY28.mjs} +2 -2
  15. package/dist/lib.cjs +1 -1
  16. package/dist/lib.d.cts +8 -2
  17. package/dist/lib.d.mts +8 -2
  18. package/dist/lib.mjs +1 -1
  19. package/dist/{mcp-BreMIH5r.cjs → mcp-DhQcmKO7.cjs} +2 -2
  20. package/dist/{mcp-nlZLEkmO.mjs → mcp-DhUA22wj.mjs} +2 -2
  21. package/dist/{runGemini-DEZ0neEl.mjs → runGemini-BVxviS8T.mjs} +4 -4
  22. package/dist/{runGemini-by29Tp8r.cjs → runGemini-CfWCL9K7.cjs} +4 -4
  23. package/dist/{runOpenClaw-DyJQFzoX.mjs → runOpenClaw-DVTaZJtj.mjs} +3 -3
  24. package/dist/{runOpenClaw-DENpTXhw.cjs → runOpenClaw-kSy7Os3C.cjs} +3 -3
  25. package/dist/{send-pX36Sd4p.mjs → send-DjjJQXJt.mjs} +2 -2
  26. package/dist/{send-e6BSMl0m.cjs → send-jzwPToBN.cjs} +2 -2
  27. package/dist/{spawn-Da-94Ejo.mjs → spawn-DBpgsEkS.mjs} +2 -2
  28. package/dist/{spawn-C87d_KDj.cjs → spawn-DFnYIiKP.cjs} +2 -2
  29. package/dist/{types-Clmu74iY.mjs → types-BRDN6zN2.mjs} +25 -11
  30. package/dist/{types-Dua2iF5S.cjs → types-Dy7P_1bh.cjs} +26 -12
  31. package/package.json +7 -7
@@ -3,7 +3,7 @@
3
3
  var node_child_process = require('node:child_process');
4
4
  var sdk = require('@agentclientprotocol/sdk');
5
5
  var node_crypto = require('node:crypto');
6
- var persistence = require('./types-Dua2iF5S.cjs');
6
+ var persistence = require('./types-Dy7P_1bh.cjs');
7
7
 
8
8
  const DEFAULT_TIMEOUTS = {
9
9
  /** Default initialization timeout: 60 seconds */
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, d as contentLogMetadata, e as errorLogMetadata, f as packageJson, g as delay } from './types-Clmu74iY.mjs';
4
+ import { l as logger, d as contentLogMetadata, e as errorLogMetadata, f as packageJson, g as delay } from './types-BRDN6zN2.mjs';
5
5
 
6
6
  const DEFAULT_TIMEOUTS = {
7
7
  /** Default initialization timeout: 60 seconds */
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var cuid2 = require('@paralleldrive/cuid2');
4
- var persistence = require('./types-Dua2iF5S.cjs');
4
+ var persistence = require('./types-Dy7P_1bh.cjs');
5
5
 
6
6
  function turnOptions(turnId, time) {
7
7
  return turnId ? { turn: turnId, time } : { time };
@@ -1,5 +1,5 @@
1
1
  import { createId } from '@paralleldrive/cuid2';
2
- import { b as createEnvelope } from './types-Clmu74iY.mjs';
2
+ import { b as createEnvelope } from './types-BRDN6zN2.mjs';
3
3
 
4
4
  function turnOptions(turnId, time) {
5
5
  return turnId ? { turn: turnId, time } : { time };
@@ -4,8 +4,8 @@ var fs = require('fs');
4
4
  var path = require('path');
5
5
  var os = require('os');
6
6
  var child_process = require('child_process');
7
- var persistence = require('./types-Dua2iF5S.cjs');
8
- var index = require('./index-CuvhWx_d.cjs');
7
+ var persistence = require('./types-Dy7P_1bh.cjs');
8
+ var index = require('./index-BGvGqzc1.cjs');
9
9
  require('axios');
10
10
  require('chalk');
11
11
  require('node:util');
@@ -2,8 +2,8 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { homedir } from 'os';
4
4
  import { execSync } from 'child_process';
5
- import { l as logger } from './types-Clmu74iY.mjs';
6
- import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-w0zkr6EM.mjs';
5
+ import { l as logger } from './types-BRDN6zN2.mjs';
6
+ import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-HYOkniru.mjs';
7
7
  import 'axios';
8
8
  import 'chalk';
9
9
  import 'node:util';
@@ -3,7 +3,7 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var persistence = require('./types-Dua2iF5S.cjs');
6
+ var persistence = require('./types-Dy7P_1bh.cjs');
7
7
  var spawn = require('cross-spawn');
8
8
  var path = require('node:path');
9
9
  var node_readline = require('node:readline');
@@ -1511,6 +1511,7 @@ function query(params) {
1511
1511
  fallbackModel: opts?.fallbackModel,
1512
1512
  maxTurns: opts?.maxTurns,
1513
1513
  permissionMode: opts?.permissionMode,
1514
+ allowDangerouslySkipPermissions: opts?.permissionMode === "bypassPermissions",
1514
1515
  allowedTools: opts?.allowedTools,
1515
1516
  disallowedTools: opts?.disallowedTools,
1516
1517
  mcpServers: opts?.mcpServers,
@@ -1529,11 +1530,18 @@ function query(params) {
1529
1530
  settingSources: ["user", "project", "local"],
1530
1531
  strictMcpConfig: opts?.strictMcpConfig,
1531
1532
  sessionId: void 0,
1532
- effort: opts?.effort
1533
+ effort: opts?.effort,
1534
+ onElicitation: opts?.onElicitation,
1535
+ onUserDialog: opts?.onUserDialog,
1536
+ supportedDialogKinds: opts?.onUserDialog ? opts.supportedDialogKinds : void 0
1533
1537
  };
1534
1538
  if (opts?.abort) {
1535
1539
  const controller = new AbortController();
1536
- opts.abort.addEventListener("abort", () => controller.abort(), { once: true });
1540
+ if (opts.abort.aborted) {
1541
+ controller.abort(opts.abort.reason);
1542
+ } else {
1543
+ opts.abort.addEventListener("abort", () => controller.abort(opts.abort?.reason), { once: true });
1544
+ }
1537
1545
  sdkOptions.abortController = controller;
1538
1546
  }
1539
1547
  const env = {};
@@ -1886,6 +1894,9 @@ async function claudeRemote(opts) {
1886
1894
  disallowedTools: initial.mode.disallowedTools,
1887
1895
  effort: initial.mode.effort,
1888
1896
  canCallTool: (toolName, input, options) => opts.canCallTool(toolName, input, mode, options),
1897
+ onElicitation: opts.onElicitation,
1898
+ onUserDialog: opts.onUserDialog,
1899
+ supportedDialogKinds: opts.onUserDialog ? ["refusal_fallback_prompt"] : void 0,
1889
1900
  abort: opts.signal,
1890
1901
  settingsPath: opts.hookSettingsPath
1891
1902
  };
@@ -1951,13 +1962,14 @@ async function claudeRemote(opts) {
1951
1962
  updateThinking(false);
1952
1963
  persistence.logger.debug("[claudeRemote] Result received");
1953
1964
  if (isCompactCommand) {
1954
- persistence.logger.debug("[claudeRemote] Compaction completed");
1965
+ const compactSucceeded = message.subtype === "success";
1966
+ persistence.logger.debug(`[claudeRemote] Compaction ${compactSucceeded ? "completed" : "failed"}`);
1955
1967
  if (opts.onCompletionEvent) {
1956
- opts.onCompletionEvent("Compaction completed");
1968
+ opts.onCompletionEvent(message.subtype === "success" ? "Compaction completed" : `Compaction failed: ${message.errors?.join("\n") || message.subtype}`);
1957
1969
  }
1958
1970
  isCompactCommand = false;
1959
1971
  }
1960
- opts.onReady();
1972
+ opts.onReady(message);
1961
1973
  opts.nextMessage().then((next) => {
1962
1974
  if (!next) {
1963
1975
  messages.end();
@@ -2005,6 +2017,16 @@ function getToolDescriptor(toolName) {
2005
2017
  return { edit: false, exitPlan: false, dangerous: false };
2006
2018
  }
2007
2019
 
2020
+ function elicitationContent(input) {
2021
+ if (!input) return void 0;
2022
+ const content = {};
2023
+ for (const [key, value] of Object.entries(input)) {
2024
+ if (typeof value === "string" || typeof value === "number" && Number.isFinite(value) || typeof value === "boolean" || Array.isArray(value) && value.every((item) => typeof item === "string")) {
2025
+ content[key] = value;
2026
+ }
2027
+ }
2028
+ return content;
2029
+ }
2008
2030
  class PermissionHandler {
2009
2031
  responses = /* @__PURE__ */ new Map();
2010
2032
  pendingRequests = /* @__PURE__ */ new Map();
@@ -2039,19 +2061,7 @@ class PermissionHandler {
2039
2061
  /**
2040
2062
  * Handler response
2041
2063
  */
2042
- handlePermissionResponse(response, pending) {
2043
- if (response.allowTools && response.allowTools.length > 0) {
2044
- response.allowTools.forEach((tool) => {
2045
- if (tool.startsWith("Bash(") || tool === "Bash") {
2046
- this.parseBashPermission(tool);
2047
- } else {
2048
- this.allowedTools.add(tool);
2049
- }
2050
- });
2051
- }
2052
- if (response.mode) {
2053
- this.permissionMode = response.mode;
2054
- }
2064
+ async handlePermissionResponse(response, pending) {
2055
2065
  if (pending.toolName === "exit_plan_mode" || pending.toolName === "ExitPlanMode") {
2056
2066
  persistence.logger.debug("Plan mode result received", {
2057
2067
  approved: response.approved,
@@ -2063,10 +2073,14 @@ class PermissionHandler {
2063
2073
  if (response.approved) {
2064
2074
  const newMode = response.mode && ["default", "acceptEdits", "bypassPermissions"].includes(response.mode) ? response.mode : "default";
2065
2075
  persistence.logger.debug(`Plan approved - switching to ${newMode} mode and allowing ExitPlanMode`);
2066
- if (this.setPermissionModeCallback) {
2067
- this.setPermissionModeCallback(newMode).catch((err) => {
2068
- persistence.logger.debug("Failed to set permission mode via SDK:", err);
2069
- });
2076
+ try {
2077
+ if (!this.setPermissionModeCallback) throw new Error("permission mode updater unavailable");
2078
+ await this.setPermissionModeCallback(newMode);
2079
+ } catch (err) {
2080
+ const reason = `Failed to switch permission mode: ${err instanceof Error ? err.message : String(err)}`;
2081
+ persistence.logger.debug(reason);
2082
+ pending.resolve({ behavior: "deny", message: reason });
2083
+ return { ...response, approved: false, reason };
2070
2084
  }
2071
2085
  this.permissionMode = newMode;
2072
2086
  pending.resolve({ behavior: "allow", updatedInput: pending.input || {} });
@@ -2074,11 +2088,36 @@ class PermissionHandler {
2074
2088
  pending.resolve({ behavior: "deny", message: response.reason || "Plan rejected" });
2075
2089
  }
2076
2090
  } else {
2091
+ if (response.approved && response.mode) {
2092
+ try {
2093
+ if (!this.setPermissionModeCallback) throw new Error("permission mode updater unavailable");
2094
+ await this.setPermissionModeCallback(response.mode);
2095
+ this.permissionMode = response.mode;
2096
+ } catch (err) {
2097
+ const reason = `Failed to switch permission mode: ${err instanceof Error ? err.message : String(err)}`;
2098
+ pending.resolve({ behavior: "deny", message: reason });
2099
+ return { ...response, approved: false, reason };
2100
+ }
2101
+ }
2102
+ if (response.approved && !pending.suggestions?.length && response.allowTools?.length) {
2103
+ response.allowTools.forEach((tool) => {
2104
+ if (tool.startsWith("Bash(") || tool === "Bash") {
2105
+ this.parseBashPermission(tool);
2106
+ } else {
2107
+ this.allowedTools.add(tool);
2108
+ }
2109
+ });
2110
+ }
2077
2111
  const originalInput = pending.input || {};
2078
2112
  const updatedInput = response.updatedInput ? { ...originalInput, ...response.updatedInput } : originalInput;
2079
- const result = response.approved ? { behavior: "allow", updatedInput } : { behavior: "deny", message: response.reason || `The user doesn't want to proceed with this tool use. The tool use was rejected (eg. if it was a file edit, the new_string was NOT written to the file). STOP what you are doing and wait for the user to tell you how to proceed.` };
2113
+ const result = response.approved ? {
2114
+ behavior: "allow",
2115
+ updatedInput,
2116
+ ...response.decision === "approved_for_session" && pending.suggestions?.length ? { updatedPermissions: pending.suggestions } : {}
2117
+ } : { behavior: "deny", message: response.reason || `The user doesn't want to proceed with this tool use. The tool use was rejected (eg. if it was a file edit, the new_string was NOT written to the file). STOP what you are doing and wait for the user to tell you how to proceed.` };
2080
2118
  pending.resolve(result);
2081
2119
  }
2120
+ return response;
2082
2121
  }
2083
2122
  /**
2084
2123
  * Creates the canCallTool callback for the SDK.
@@ -2087,7 +2126,7 @@ class PermissionHandler {
2087
2126
  handleToolCall = async (toolName, input, mode, options) => {
2088
2127
  const toolCallId = options.toolUseID;
2089
2128
  if (toolName === "AskUserQuestion") {
2090
- return this.handlePermissionRequest(toolCallId, toolName, input, options.signal);
2129
+ return this.handlePermissionRequest(toolCallId, toolName, input, options.signal, options.suggestions);
2091
2130
  }
2092
2131
  if (toolName === "Bash") {
2093
2132
  const inputObj = input;
@@ -2106,7 +2145,7 @@ class PermissionHandler {
2106
2145
  }
2107
2146
  const descriptor = getToolDescriptor(toolName);
2108
2147
  if (descriptor.exitPlan) {
2109
- return this.handlePermissionRequest(toolCallId, toolName, input, options.signal);
2148
+ return this.handlePermissionRequest(toolCallId, toolName, input, options.signal, options.suggestions);
2110
2149
  }
2111
2150
  if (this.permissionMode === "bypassPermissions") {
2112
2151
  return { behavior: "allow", updatedInput: input };
@@ -2117,19 +2156,25 @@ class PermissionHandler {
2117
2156
  if (this.permissionMode === "plan" && !descriptor.dangerous) {
2118
2157
  return { behavior: "allow", updatedInput: input };
2119
2158
  }
2120
- return this.handlePermissionRequest(toolCallId, toolName, input, options.signal);
2159
+ return this.handlePermissionRequest(toolCallId, toolName, input, options.signal, options.suggestions);
2121
2160
  };
2122
2161
  /**
2123
2162
  * Handles individual permission requests
2124
2163
  */
2125
- async handlePermissionRequest(id, toolName, input, signal) {
2164
+ async handlePermissionRequest(id, toolName, input, signal, suggestions) {
2126
2165
  return new Promise((resolve, reject) => {
2166
+ if (signal.aborted) {
2167
+ reject(new Error("Permission request aborted", { cause: signal.reason }));
2168
+ return;
2169
+ }
2127
2170
  const abortHandler = () => {
2128
2171
  this.pendingRequests.delete(id);
2172
+ this.cancelRequestInAgentState(id, "Permission request aborted");
2129
2173
  reject(new Error("Permission request aborted"));
2130
2174
  };
2131
2175
  signal.addEventListener("abort", abortHandler, { once: true });
2132
2176
  this.pendingRequests.set(id, {
2177
+ kind: "tool",
2133
2178
  resolve: (result) => {
2134
2179
  signal.removeEventListener("abort", abortHandler);
2135
2180
  resolve(result);
@@ -2139,7 +2184,8 @@ class PermissionHandler {
2139
2184
  reject(error);
2140
2185
  },
2141
2186
  toolName,
2142
- input
2187
+ input,
2188
+ suggestions
2143
2189
  });
2144
2190
  if (this.onPermissionRequestCallback) {
2145
2191
  this.onPermissionRequestCallback(id);
@@ -2162,7 +2208,9 @@ class PermissionHandler {
2162
2208
  [id]: {
2163
2209
  tool: toolName,
2164
2210
  arguments: input,
2165
- createdAt: Date.now()
2211
+ createdAt: Date.now(),
2212
+ kind: "tool",
2213
+ ...suggestions?.length ? { permissionSuggestions: suggestions } : {}
2166
2214
  }
2167
2215
  }
2168
2216
  }));
@@ -2171,6 +2219,98 @@ class PermissionHandler {
2171
2219
  persistence.logger.debug(`Permission request sent for tool call ${id}: ${toolName}`);
2172
2220
  });
2173
2221
  }
2222
+ handleElicitation = async (request, options) => {
2223
+ return this.handleInteractionRequest(options.requestId, "elicitation", request, options.signal);
2224
+ };
2225
+ handleUserDialog = async (request, options) => {
2226
+ if (request.dialogKind !== "refusal_fallback_prompt") {
2227
+ return { behavior: "cancelled" };
2228
+ }
2229
+ return this.handleInteractionRequest(options.requestId, "user_dialog", request, options.signal);
2230
+ };
2231
+ handleInteractionRequest(id, kind, request, signal) {
2232
+ return new Promise((resolve, reject) => {
2233
+ if (signal.aborted) {
2234
+ reject(new Error("Interaction request aborted", { cause: signal.reason }));
2235
+ return;
2236
+ }
2237
+ const abortHandler = () => {
2238
+ this.pendingRequests.delete(id);
2239
+ this.cancelRequestInAgentState(id, "Interaction request aborted");
2240
+ reject(new Error("Interaction request aborted", { cause: signal.reason }));
2241
+ };
2242
+ signal.addEventListener("abort", abortHandler, { once: true });
2243
+ const finishResolve = (value) => {
2244
+ signal.removeEventListener("abort", abortHandler);
2245
+ resolve(value);
2246
+ };
2247
+ const finishReject = (error) => {
2248
+ signal.removeEventListener("abort", abortHandler);
2249
+ reject(error);
2250
+ };
2251
+ if (kind === "elicitation") {
2252
+ this.pendingRequests.set(id, {
2253
+ kind,
2254
+ request,
2255
+ resolve: finishResolve,
2256
+ reject: finishReject
2257
+ });
2258
+ } else {
2259
+ this.pendingRequests.set(id, {
2260
+ kind,
2261
+ request,
2262
+ resolve: finishResolve,
2263
+ reject: finishReject
2264
+ });
2265
+ }
2266
+ const tool = "AskUserQuestion";
2267
+ this.publishRequest(id, tool, request, kind);
2268
+ });
2269
+ }
2270
+ publishRequest(id, tool, args, kind) {
2271
+ this.session.api.push().sendSessionNotification({
2272
+ kind: "permission",
2273
+ metadata: this.session.client.getMetadata(),
2274
+ data: {
2275
+ sessionId: this.session.client.sessionId,
2276
+ requestId: id,
2277
+ tool,
2278
+ type: "permission_request",
2279
+ provider: "claude"
2280
+ }
2281
+ });
2282
+ this.session.client.updateAgentState((currentState) => ({
2283
+ ...currentState,
2284
+ requests: {
2285
+ ...currentState.requests,
2286
+ [id]: { tool, arguments: args, createdAt: Date.now(), kind }
2287
+ }
2288
+ }));
2289
+ this.session.notificationProducer?.permissionRequest(tool);
2290
+ this.session.reportEventToDaemon("needs_input");
2291
+ persistence.logger.debug(`${kind} request sent: ${id}`);
2292
+ }
2293
+ cancelRequestInAgentState(id, reason) {
2294
+ this.session.client.updateAgentState((currentState) => {
2295
+ const request = currentState.requests?.[id];
2296
+ if (!request) return currentState;
2297
+ const requests = { ...currentState.requests };
2298
+ delete requests[id];
2299
+ return {
2300
+ ...currentState,
2301
+ requests,
2302
+ completedRequests: {
2303
+ ...currentState.completedRequests,
2304
+ [id]: {
2305
+ ...request,
2306
+ completedAt: Date.now(),
2307
+ status: "canceled",
2308
+ reason
2309
+ }
2310
+ }
2311
+ };
2312
+ });
2313
+ }
2174
2314
  /**
2175
2315
  * Parses Bash permission strings into literal and prefix sets
2176
2316
  */
@@ -2251,9 +2391,16 @@ class PermissionHandler {
2251
2391
  persistence.logger.debug("Permission request not found or already resolved");
2252
2392
  return;
2253
2393
  }
2254
- this.responses.set(id, { ...message, receivedAt: Date.now() });
2255
2394
  this.pendingRequests.delete(id);
2256
- this.handlePermissionResponse(message, pending);
2395
+ let effectiveResponse = message;
2396
+ if (pending.kind === "tool") {
2397
+ effectiveResponse = await this.handlePermissionResponse(message, pending);
2398
+ this.responses.set(id, { ...effectiveResponse, receivedAt: Date.now() });
2399
+ } else if (pending.kind === "elicitation") {
2400
+ pending.resolve(message.approved ? { action: "accept", content: elicitationContent(message.updatedInput) } : { action: message.decision === "abort" ? "cancel" : "decline" });
2401
+ } else {
2402
+ pending.resolve(message.approved ? { behavior: "completed", result: message.updatedInput?.result ?? "retry_fallback" } : { behavior: "cancelled" });
2403
+ }
2257
2404
  this.session.client.updateAgentState((currentState) => {
2258
2405
  const request = currentState.requests?.[id];
2259
2406
  if (!request) return currentState;
@@ -2267,10 +2414,11 @@ class PermissionHandler {
2267
2414
  [id]: {
2268
2415
  ...request,
2269
2416
  completedAt: Date.now(),
2270
- status: message.approved ? "approved" : "denied",
2271
- reason: message.reason,
2272
- mode: message.mode,
2273
- allowTools: message.allowTools
2417
+ status: effectiveResponse.approved ? "approved" : "denied",
2418
+ reason: effectiveResponse.reason,
2419
+ mode: effectiveResponse.mode,
2420
+ decision: effectiveResponse.decision,
2421
+ allowedTools: effectiveResponse.allowTools
2274
2422
  }
2275
2423
  }
2276
2424
  };
@@ -2491,7 +2639,8 @@ class SDKToLogConverter {
2491
2639
  // Assistant messages often have additional fields
2492
2640
  requestId: assistantMsg.requestId,
2493
2641
  ...assistantMsg.isCompactSummary ? { isCompactSummary: true } : {},
2494
- ...assistantMsg.parent_tool_use_id ? { parent_tool_use_id: assistantMsg.parent_tool_use_id } : {}
2642
+ ...assistantMsg.parent_tool_use_id ? { parent_tool_use_id: assistantMsg.parent_tool_use_id } : {},
2643
+ ...assistantMsg.error ? { error: assistantMsg.error } : {}
2495
2644
  };
2496
2645
  break;
2497
2646
  }
@@ -2522,17 +2671,28 @@ class SDKToLogConverter {
2522
2671
  total_cost_usd: resultMsg.total_cost_usd,
2523
2672
  duration_ms: resultMsg.duration_ms,
2524
2673
  num_turns: resultMsg.num_turns,
2525
- usage: resultMsg.usage
2674
+ usage: resultMsg.usage,
2675
+ ..."errors" in resultMsg ? { errors: resultMsg.errors } : {},
2676
+ ..."terminal_reason" in resultMsg && resultMsg.terminal_reason ? { terminal_reason: resultMsg.terminal_reason } : {}
2526
2677
  };
2527
2678
  break;
2528
2679
  }
2529
- default:
2530
- logMessage = {
2531
- ...baseFields,
2532
- ...sdkMessage,
2533
- type: sdkMessage.type
2534
- // Override type last to ensure it's set
2535
- };
2680
+ // These SDK lifecycle/advisory frames are intentionally not part
2681
+ // of the persisted Claude transcript. Enumerating them keeps SDK
2682
+ // upgrades type-visible instead of silently passing new frames
2683
+ // through as conversation messages.
2684
+ case "stream_event":
2685
+ case "tool_progress":
2686
+ case "auth_status":
2687
+ case "tool_use_summary":
2688
+ case "rate_limit_event":
2689
+ case "prompt_suggestion":
2690
+ case "conversation_reset":
2691
+ return null;
2692
+ default: {
2693
+ const exhaustive = sdkMessage;
2694
+ return exhaustive;
2695
+ }
2536
2696
  }
2537
2697
  if (logMessage && logMessage.type !== "summary" && logMessage.type !== "result") {
2538
2698
  this.lastUuid = uuid;
@@ -2828,6 +2988,17 @@ async function cleanupStdinAfterInk(opts) {
2828
2988
  }
2829
2989
  }
2830
2990
 
2991
+ function applyClaudeResultLifecycle(result, callbacks) {
2992
+ if (result && result.subtype !== "success") {
2993
+ const error = result.errors?.filter(Boolean).join("\n").trim() || result.subtype;
2994
+ callbacks.closeFailed(error);
2995
+ callbacks.onFailed(error);
2996
+ return;
2997
+ }
2998
+ callbacks.closeCompleted();
2999
+ callbacks.onCompleted();
3000
+ }
3001
+
2831
3002
  async function claudeRemoteLauncher(session) {
2832
3003
  persistence.logger.debug("[claudeRemoteLauncher] Starting remote launcher");
2833
3004
  const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
@@ -3040,6 +3211,8 @@ async function claudeRemoteLauncher(session) {
3040
3211
  hookSettingsPath: session.hookSettingsPath,
3041
3212
  jsRuntime: session.jsRuntime,
3042
3213
  canCallTool: permissionHandler.handleToolCall,
3214
+ onElicitation: permissionHandler.handleElicitation,
3215
+ onUserDialog: permissionHandler.handleUserDialog,
3043
3216
  isAborted: (toolCallId) => {
3044
3217
  return permissionHandler.isAborted(toolCallId);
3045
3218
  },
@@ -3128,21 +3301,27 @@ async function claudeRemoteLauncher(session) {
3128
3301
  persistence.logger.debug("[remote]: Session reset");
3129
3302
  session.clearSessionId();
3130
3303
  },
3131
- onReady: () => {
3132
- session.client.closeClaudeSessionTurn("completed");
3133
- const idle = !pending && session.queue.size() === 0;
3134
- session.onTurnEnd(idle);
3135
- if (idle) {
3136
- session.api.push().sendSessionNotification({
3137
- kind: "done",
3138
- metadata: session.client.getMetadata(),
3139
- data: {
3140
- sessionId: session.client.sessionId,
3141
- type: "ready",
3142
- provider: "claude"
3304
+ onReady: (result) => {
3305
+ applyClaudeResultLifecycle(result, {
3306
+ closeCompleted: () => session.client.closeClaudeSessionTurn("completed"),
3307
+ closeFailed: (error) => session.client.closeClaudeSessionTurn("failed", { error }),
3308
+ onFailed: (error) => session.onSessionError(error),
3309
+ onCompleted: () => {
3310
+ const idle = !pending && session.queue.size() === 0;
3311
+ session.onTurnEnd(idle);
3312
+ if (idle) {
3313
+ session.api.push().sendSessionNotification({
3314
+ kind: "done",
3315
+ metadata: session.client.getMetadata(),
3316
+ data: {
3317
+ sessionId: session.client.sessionId,
3318
+ type: "ready",
3319
+ provider: "claude"
3320
+ }
3321
+ });
3143
3322
  }
3144
- });
3145
- }
3323
+ }
3324
+ });
3146
3325
  },
3147
3326
  signal: abortController.signal
3148
3327
  });
@@ -8274,7 +8453,7 @@ const MAX_TITLE_CHARS = 60;
8274
8453
  const GENERATION_TIMEOUT_MS = 3e4;
8275
8454
  function resolveClaudeBinary() {
8276
8455
  try {
8277
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CuvhWx_d.cjs', document.baseURI).href)));
8456
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BGvGqzc1.cjs', document.baseURI).href)));
8278
8457
  const utilsPath = path.resolve(path.join(persistence.projectPath(), "scripts", "claude_version_utils.cjs"));
8279
8458
  const { getClaudeCliPath } = require$1(utilsPath);
8280
8459
  const path$1 = getClaudeCliPath();
@@ -10391,9 +10570,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
10391
10570
  };
10392
10571
  }
10393
10572
 
10394
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CuvhWx_d.cjs', document.baseURI).href)));
10573
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BGvGqzc1.cjs', document.baseURI).href)));
10395
10574
  const __dirname$1 = path.dirname(__filename$1);
10396
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CuvhWx_d.cjs', document.baseURI).href)));
10575
+ const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BGvGqzc1.cjs', document.baseURI).href)));
10397
10576
  const PRISMA_QUERY_ENGINE_FILES = {
10398
10577
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
10399
10578
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -13005,7 +13184,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13005
13184
  process.exit(0);
13006
13185
  } else if (subcommand === "install-terminal-hooks") {
13007
13186
  try {
13008
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-nXjKPP3D.cjs'); });
13187
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-CAViJyYh.cjs'); });
13009
13188
  const command = parseTerminalHooksArgs(args.slice(1));
13010
13189
  if (command.action === "help") {
13011
13190
  console.log(TERMINAL_HOOKS_HELP);
@@ -13022,7 +13201,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13022
13201
  }
13023
13202
  } else if (subcommand === "spawn") {
13024
13203
  try {
13025
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-C87d_KDj.cjs'); });
13204
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-DFnYIiKP.cjs'); });
13026
13205
  await handleSpawnCommand(args.slice(1));
13027
13206
  } catch (error) {
13028
13207
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13034,7 +13213,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13034
13213
  return;
13035
13214
  } else if (subcommand === "send") {
13036
13215
  try {
13037
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-e6BSMl0m.cjs'); });
13216
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-jzwPToBN.cjs'); });
13038
13217
  await handleSendCommand(args.slice(1));
13039
13218
  } catch (error) {
13040
13219
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13140,9 +13319,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13140
13319
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
13141
13320
  const projectId = args[3];
13142
13321
  try {
13143
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-Byay91xM.cjs'); });
13144
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./types-Dua2iF5S.cjs'); }).then(function (n) { return n.persistence; });
13145
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-Dua2iF5S.cjs'); }).then(function (n) { return n.api; });
13322
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DB0v5eoc.cjs'); });
13323
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./types-Dy7P_1bh.cjs'); }).then(function (n) { return n.persistence; });
13324
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-Dy7P_1bh.cjs'); }).then(function (n) { return n.api; });
13146
13325
  let userEmail = void 0;
13147
13326
  try {
13148
13327
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -13173,7 +13352,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13173
13352
  }
13174
13353
  if (geminiSubcommand === "project" && args[2] === "get") {
13175
13354
  try {
13176
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-Byay91xM.cjs'); });
13355
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DB0v5eoc.cjs'); });
13177
13356
  const config = readGeminiLocalConfig();
13178
13357
  if (config.googleCloudProject) {
13179
13358
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -13213,7 +13392,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13213
13392
  process.exit(0);
13214
13393
  }
13215
13394
  try {
13216
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-by29Tp8r.cjs'); });
13395
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CfWCL9K7.cjs'); });
13217
13396
  let startedBy = void 0;
13218
13397
  for (let i = 1; i < args.length; i++) {
13219
13398
  if (args[i] === "--started-by") {
@@ -13235,7 +13414,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13235
13414
  return;
13236
13415
  } else if (subcommand === "acp") {
13237
13416
  try {
13238
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CkjEzh-Y.cjs'); });
13417
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-D_ZjCYNI.cjs'); });
13239
13418
  let startedBy = void 0;
13240
13419
  let verbose = false;
13241
13420
  const acpArgs = [];
@@ -13275,7 +13454,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13275
13454
  return;
13276
13455
  } else if (subcommand === "openclaw") {
13277
13456
  try {
13278
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-DENpTXhw.cjs'); });
13457
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-kSy7Os3C.cjs'); });
13279
13458
  let startedBy = void 0;
13280
13459
  let verbose = false;
13281
13460
  let gatewayUrl;
@@ -13326,7 +13505,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13326
13505
  return;
13327
13506
  } else if (subcommand === "mcp" && args.length === 1) {
13328
13507
  try {
13329
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-BreMIH5r.cjs'); });
13508
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-DhQcmKO7.cjs'); });
13330
13509
  await handleMcpCommand();
13331
13510
  } catch (error) {
13332
13511
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
@@ -1,10 +1,10 @@
1
- import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-CDngyx5G.mjs';
2
- export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-CDngyx5G.mjs';
3
- import { h as connectionState, A as ApiClient, i as readSettings, j as encodeBase64, l as logger, p as projectPath } from './types-Clmu74iY.mjs';
4
- import { A as AcpSessionManager } from './AcpSessionManager-Dcq8dl4l.mjs';
1
+ import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-DPcRh_3n.mjs';
2
+ export { a as DEFAULT_IDLE_TIMEOUT_MS, b as DEFAULT_TOOL_CALL_TIMEOUT_MS, e as extractErrorDetail, f as formatDuration, c as formatDurationMinutes, h as handleAgentMessageChunk, d as handleAgentThoughtChunk, g as handleLegacyMessageChunk, i as handlePlanUpdate, j as handleThinkingUpdate, k as handleToolCall, l as handleToolCallUpdate, p as parseArgsFromContent } from './AcpBackend-DPcRh_3n.mjs';
3
+ import { h as connectionState, A as ApiClient, i as readSettings, j as encodeBase64, l as logger, p as projectPath } from './types-BRDN6zN2.mjs';
4
+ import { A as AcpSessionManager } from './AcpSessionManager-DVGWPtBC.mjs';
5
5
  import { randomUUID } from 'node:crypto';
6
6
  import { join } from 'node:path';
7
- import { i as initialMachineMetadata, d as createSessionMetadata, e as setupOfflineReconnection, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, f as startHappyServer, r as registerKillSessionHandler, B as BasePermissionHandler } from './index-w0zkr6EM.mjs';
7
+ import { i as initialMachineMetadata, d as createSessionMetadata, e as setupOfflineReconnection, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, f as startHappyServer, r as registerKillSessionHandler, B as BasePermissionHandler } from './index-HYOkniru.mjs';
8
8
  import 'node:child_process';
9
9
  import '@agentclientprotocol/sdk';
10
10
  import 'axios';