very-happy-cli 0.2.75 → 0.2.77

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-5CPQMP3H.mjs → AcpBackend-BFFC77vV.mjs} +5 -2
  2. package/dist/{AcpBackend-B0qCm-bY.cjs → AcpBackend-CsLnh1So.cjs} +5 -2
  3. package/dist/{AcpSessionManager-B4M0y5fI.cjs → AcpSessionManager--CixPN-p.cjs} +1 -1
  4. package/dist/{AcpSessionManager-BTmJyKDO.mjs → AcpSessionManager-CU5vsxgF.mjs} +1 -1
  5. package/dist/{config-DbY2R-H7.mjs → config-CRFTYuTN.mjs} +2 -2
  6. package/dist/{config-DBIfKaNJ.cjs → config-pv17N6Kg.cjs} +2 -2
  7. package/dist/{index-CJaqyq4z.mjs → index-BkvUwyIU.mjs} +8 -5
  8. package/dist/{index-CqxywXyf.cjs → index-C1OnwMx0.cjs} +7 -4
  9. package/dist/{index-Cq30c63l.mjs → index-DOb57EGb.mjs} +16 -12
  10. package/dist/{index-edEH95Mf.cjs → index-Dcv1RKe8.cjs} +19 -15
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/{installTerminalHooks-8TUdSFCY.mjs → installTerminalHooks-IXvZMGJq.mjs} +2 -2
  14. package/dist/{installTerminalHooks-BvQbDFcE.cjs → installTerminalHooks-YyT3fv6w.cjs} +2 -2
  15. package/dist/lib.cjs +1 -1
  16. package/dist/lib.d.cts +23 -1
  17. package/dist/lib.d.mts +23 -1
  18. package/dist/lib.mjs +1 -1
  19. package/dist/{mcp-B4UxtBKQ.mjs → mcp-B-GdhlKD.mjs} +2 -2
  20. package/dist/{mcp-D12X7XKG.cjs → mcp-CsKnmeE5.cjs} +2 -2
  21. package/dist/{runGemini-BD8OGMQr.mjs → runGemini-D0lddF43.mjs} +5 -4
  22. package/dist/{runGemini-LIck5ard.cjs → runGemini-DuUdmlVZ.cjs} +5 -4
  23. package/dist/{runOpenClaw-ENAgQy1E.mjs → runOpenClaw-BiwwYnYf.mjs} +15 -3
  24. package/dist/{runOpenClaw-B5XNV1zZ.cjs → runOpenClaw-DEMCYSoD.cjs} +15 -3
  25. package/dist/{send-BVbiwtrQ.mjs → send-DM8oqJFp.mjs} +2 -2
  26. package/dist/{send-o4xljyoV.cjs → send-DijSXAMp.cjs} +2 -2
  27. package/dist/{spawn-DTA6f9TE.cjs → spawn-De3b5Hsu.cjs} +2 -2
  28. package/dist/{spawn-BmqqHUYI.mjs → spawn-nISXbZD5.mjs} +2 -2
  29. package/dist/{types-Dj9JEGDh.mjs → types-D2qSKjsO.mjs} +400 -79
  30. package/dist/{types-DEre2zxO.cjs → types-NwtcBgfS.cjs} +401 -80
  31. package/package.json +7 -7
@@ -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-Dj9JEGDh.mjs';
4
+ import { l as logger, d as contentLogMetadata, e as errorLogMetadata, f as packageJson, g as delay } from './types-D2qSKjsO.mjs';
5
5
 
6
6
  const DEFAULT_TIMEOUTS = {
7
7
  /** Default initialization timeout: 60 seconds */
@@ -1094,7 +1094,10 @@ class AcpBackend {
1094
1094
  sessionId: this.acpSessionId,
1095
1095
  blockCount: promptRequest.prompt.length
1096
1096
  });
1097
- await this.connection.prompt(promptRequest);
1097
+ const response = await this.connection.prompt(promptRequest);
1098
+ if (response.usage) {
1099
+ this.emit({ type: "token-count", ...response.usage });
1100
+ }
1098
1101
  logger.debug("[AcpBackend] Prompt request sent to ACP connection");
1099
1102
  } catch (error) {
1100
1103
  logger.debug("[AcpBackend] Error sending prompt:", errorLogMetadata(error));
@@ -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-DEre2zxO.cjs');
6
+ var persistence = require('./types-NwtcBgfS.cjs');
7
7
 
8
8
  const DEFAULT_TIMEOUTS = {
9
9
  /** Default initialization timeout: 60 seconds */
@@ -1096,7 +1096,10 @@ class AcpBackend {
1096
1096
  sessionId: this.acpSessionId,
1097
1097
  blockCount: promptRequest.prompt.length
1098
1098
  });
1099
- await this.connection.prompt(promptRequest);
1099
+ const response = await this.connection.prompt(promptRequest);
1100
+ if (response.usage) {
1101
+ this.emit({ type: "token-count", ...response.usage });
1102
+ }
1100
1103
  persistence.logger.debug("[AcpBackend] Prompt request sent to ACP connection");
1101
1104
  } catch (error) {
1102
1105
  persistence.logger.debug("[AcpBackend] Error sending prompt:", persistence.errorLogMetadata(error));
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var cuid2 = require('@paralleldrive/cuid2');
4
- var persistence = require('./types-DEre2zxO.cjs');
4
+ var persistence = require('./types-NwtcBgfS.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-Dj9JEGDh.mjs';
2
+ import { b as createEnvelope } from './types-D2qSKjsO.mjs';
3
3
 
4
4
  function turnOptions(turnId, time) {
5
5
  return turnId ? { turn: turnId, time } : { time };
@@ -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-Dj9JEGDh.mjs';
6
- import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-Cq30c63l.mjs';
5
+ import { l as logger } from './types-D2qSKjsO.mjs';
6
+ import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './index-DOb57EGb.mjs';
7
7
  import 'axios';
8
8
  import 'chalk';
9
9
  import 'node:util';
@@ -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-DEre2zxO.cjs');
8
- var index = require('./index-edEH95Mf.cjs');
7
+ var persistence = require('./types-NwtcBgfS.cjs');
8
+ var index = require('./index-Dcv1RKe8.cjs');
9
9
  require('axios');
10
10
  require('chalk');
11
11
  require('node:util');
@@ -1,10 +1,10 @@
1
- import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-5CPQMP3H.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-5CPQMP3H.mjs';
3
- import { h as connectionState, A as ApiClient, i as readSettings, j as encodeBase64, l as logger, p as projectPath } from './types-Dj9JEGDh.mjs';
4
- import { A as AcpSessionManager } from './AcpSessionManager-BTmJyKDO.mjs';
1
+ import { D as DefaultTransport, A as AcpBackend } from './AcpBackend-BFFC77vV.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-BFFC77vV.mjs';
3
+ import { h as connectionState, A as ApiClient, i as readSettings, j as encodeBase64, l as logger, p as projectPath } from './types-D2qSKjsO.mjs';
4
+ import { A as AcpSessionManager } from './AcpSessionManager-CU5vsxgF.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-Cq30c63l.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-DOb57EGb.mjs';
8
8
  import 'node:child_process';
9
9
  import '@agentclientprotocol/sdk';
10
10
  import 'axios';
@@ -912,6 +912,9 @@ async function runAcp(opts) {
912
912
  if (frontendMessage) {
913
913
  logAcp(frontendMessage.kind, frontendMessage.text);
914
914
  }
915
+ if (msg.type === "token-count") {
916
+ session.sendAgentUsageSnapshot(resolveSessionFlavor(opts.agentName), msg);
917
+ }
915
918
  sendEnvelopes(sessionManager.mapMessage(msg));
916
919
  };
917
920
  backend.onMessage(onBackendMessage);
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var AcpBackend = require('./AcpBackend-B0qCm-bY.cjs');
4
- var persistence = require('./types-DEre2zxO.cjs');
5
- var AcpSessionManager = require('./AcpSessionManager-B4M0y5fI.cjs');
3
+ var AcpBackend = require('./AcpBackend-CsLnh1So.cjs');
4
+ var persistence = require('./types-NwtcBgfS.cjs');
5
+ var AcpSessionManager = require('./AcpSessionManager--CixPN-p.cjs');
6
6
  var node_crypto = require('node:crypto');
7
7
  var path = require('node:path');
8
- var index = require('./index-edEH95Mf.cjs');
8
+ var index = require('./index-Dcv1RKe8.cjs');
9
9
  require('node:child_process');
10
10
  require('@agentclientprotocol/sdk');
11
11
  require('axios');
@@ -913,6 +913,9 @@ async function runAcp(opts) {
913
913
  if (frontendMessage) {
914
914
  logAcp(frontendMessage.kind, frontendMessage.text);
915
915
  }
916
+ if (msg.type === "token-count") {
917
+ session.sendAgentUsageSnapshot(resolveSessionFlavor(opts.agentName), msg);
918
+ }
916
919
  sendEnvelopes(sessionManager.mapMessage(msg));
917
920
  };
918
921
  backend.onMessage(onBackendMessage);
@@ -1,7 +1,7 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
2
  import os, { homedir } from 'node:os';
3
3
  import { randomUUID, randomBytes, createHash as createHash$1, timingSafeEqual } from 'node:crypto';
4
- import { n as readDaemonState, l as logger, c as configuration, o as clearDaemonState, q as getProjectPath, p as projectPath, s as initializeSandbox, t as wrapCommand, d as contentLogMetadata, I as InvalidateSync, R as RawJSONLinesSchema, g as delay, u as AsyncLock, f as packageJson, i as readSettings, v as readCredentials, x as credentialRelayProblem, y as deriveLocalCliUpdateSummary, j as encodeBase64, z as updateSettings, B as encodeBase64Url, C as decodeBase64, D as writeCredentialsLegacy, E as writeCredentialsDataKey, F as readCredentialsForConfiguredRelay, G as encrypt, r as readPersistedSessions, H as getLocalHappyAgentCredentialPath, J as readLocalHappyAgentCredentials, K as decryptWithDataKey, L as decryptLegacy, M as extractCompleteLines, N as decideBackfill, O as parseTerminalHookPayload, P as decideMirrorBinding, Q as persistSession, S as MIRROR_BACKFILL_LINES_DEFAULT, T as mirrorLineKey, U as mirrorLocalId, V as detectResumeSupport, W as detectCLIAvailability, X as acquireDaemonLock, Y as summarizeSpawnSessionForLog, Z as deletePersistedSessions, _ as decrypt, $ as writeDaemonState, A as ApiClient, a0 as fetchCliUpdateState, a1 as resolveCliUpdateCheckInterval, a2 as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS, a3 as releaseDaemonLock, a4 as isValidSessionId, a5 as listVhTerminals, a6 as isValidTerminalId, a7 as readVhTerminal, a8 as sendToVhTerminal, h as connectionState, a9 as startOfflineReconnection, aa as clearCredentials, ab as clearMachineId, k as ensurePrivateDirectorySync, w as writePrivateFileSync, ac as SandboxConfigSchema, b as createEnvelope, ad as CodexAppServerClient, ae as getLatestDaemonLog } from './types-Dj9JEGDh.mjs';
4
+ import { n as readDaemonState, l as logger, c as configuration, o as clearDaemonState, q as getProjectPath, p as projectPath, s as initializeSandbox, t as wrapCommand, d as contentLogMetadata, I as InvalidateSync, R as RawJSONLinesSchema, g as delay, u as AsyncLock, f as packageJson, i as readSettings, v as readCredentials, x as credentialRelayProblem, y as deriveLocalCliUpdateSummary, j as encodeBase64, z as updateSettings, B as encodeBase64Url, C as decodeBase64, D as writeCredentialsLegacy, E as writeCredentialsDataKey, F as readCredentialsForConfiguredRelay, G as encrypt, r as readPersistedSessions, H as getLocalHappyAgentCredentialPath, J as readLocalHappyAgentCredentials, K as decryptWithDataKey, L as decryptLegacy, M as extractCompleteLines, N as decideBackfill, O as parseTerminalHookPayload, P as decideMirrorBinding, Q as persistSession, S as MIRROR_BACKFILL_LINES_DEFAULT, T as mirrorLineKey, U as mirrorLocalId, V as detectResumeSupport, W as detectCLIAvailability, X as acquireDaemonLock, Y as summarizeSpawnSessionForLog, Z as deletePersistedSessions, _ as decrypt, $ as writeDaemonState, A as ApiClient, a0 as fetchCliUpdateState, a1 as resolveCliUpdateCheckInterval, a2 as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS, a3 as releaseDaemonLock, a4 as isValidSessionId, a5 as listVhTerminals, a6 as isValidTerminalId, a7 as readVhTerminal, a8 as sendToVhTerminal, h as connectionState, a9 as startOfflineReconnection, aa as clearCredentials, ab as clearMachineId, k as ensurePrivateDirectorySync, w as writePrivateFileSync, ac as SandboxConfigSchema, b as createEnvelope, ad as CodexAppServerClient, ae as getLatestDaemonLog } from './types-D2qSKjsO.mjs';
5
5
  import spawn$1, { spawn } from 'cross-spawn';
6
6
  import path, { join, resolve, isAbsolute, normalize, sep, dirname } from 'node:path';
7
7
  import { createInterface } from 'node:readline';
@@ -11409,6 +11409,7 @@ function createOfflineSessionStub(sessionTag) {
11409
11409
  },
11410
11410
  sendAgentMessage: () => {
11411
11411
  },
11412
+ sendAgentUsageSnapshot: () => false,
11412
11413
  sendClaudeSessionMessage: () => {
11413
11414
  },
11414
11415
  keepAlive: () => {
@@ -12526,6 +12527,9 @@ async function runCodex(opts) {
12526
12527
  }
12527
12528
  });
12528
12529
  client.setEventHandler((msg) => {
12530
+ if (msg.type === "token_count") {
12531
+ session.sendAgentUsageSnapshot("codex", msg);
12532
+ }
12529
12533
  logger.debug("[Codex] Event metadata", codexEventLogMetadata(msg));
12530
12534
  if (msg.type === "agent_message") {
12531
12535
  messageBuffer.addMessage(msg.message, "assistant");
@@ -12979,7 +12983,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
12979
12983
  process.exit(0);
12980
12984
  } else if (subcommand === "install-terminal-hooks") {
12981
12985
  try {
12982
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await import('./installTerminalHooks-8TUdSFCY.mjs');
12986
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await import('./installTerminalHooks-IXvZMGJq.mjs');
12983
12987
  const command = parseTerminalHooksArgs(args.slice(1));
12984
12988
  if (command.action === "help") {
12985
12989
  console.log(TERMINAL_HOOKS_HELP);
@@ -12996,7 +13000,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
12996
13000
  }
12997
13001
  } else if (subcommand === "spawn") {
12998
13002
  try {
12999
- const { handleSpawnCommand } = await import('./spawn-BmqqHUYI.mjs');
13003
+ const { handleSpawnCommand } = await import('./spawn-nISXbZD5.mjs');
13000
13004
  await handleSpawnCommand(args.slice(1));
13001
13005
  } catch (error) {
13002
13006
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13008,7 +13012,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13008
13012
  return;
13009
13013
  } else if (subcommand === "send") {
13010
13014
  try {
13011
- const { handleSendCommand } = await import('./send-BVbiwtrQ.mjs');
13015
+ const { handleSendCommand } = await import('./send-DM8oqJFp.mjs');
13012
13016
  await handleSendCommand(args.slice(1));
13013
13017
  } catch (error) {
13014
13018
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13114,9 +13118,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13114
13118
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
13115
13119
  const projectId = args[3];
13116
13120
  try {
13117
- const { saveGoogleCloudProjectToConfig } = await import('./config-DbY2R-H7.mjs');
13118
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await import('./types-Dj9JEGDh.mjs').then(function (n) { return n.af; });
13119
- const { ApiClient: ApiClient2 } = await import('./types-Dj9JEGDh.mjs').then(function (n) { return n.ag; });
13121
+ const { saveGoogleCloudProjectToConfig } = await import('./config-CRFTYuTN.mjs');
13122
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await import('./types-D2qSKjsO.mjs').then(function (n) { return n.af; });
13123
+ const { ApiClient: ApiClient2 } = await import('./types-D2qSKjsO.mjs').then(function (n) { return n.ag; });
13120
13124
  let userEmail = void 0;
13121
13125
  try {
13122
13126
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -13147,7 +13151,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13147
13151
  }
13148
13152
  if (geminiSubcommand === "project" && args[2] === "get") {
13149
13153
  try {
13150
- const { readGeminiLocalConfig } = await import('./config-DbY2R-H7.mjs');
13154
+ const { readGeminiLocalConfig } = await import('./config-CRFTYuTN.mjs');
13151
13155
  const config = readGeminiLocalConfig();
13152
13156
  if (config.googleCloudProject) {
13153
13157
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -13187,7 +13191,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13187
13191
  process.exit(0);
13188
13192
  }
13189
13193
  try {
13190
- const { runGemini } = await import('./runGemini-BD8OGMQr.mjs');
13194
+ const { runGemini } = await import('./runGemini-D0lddF43.mjs');
13191
13195
  let startedBy = void 0;
13192
13196
  for (let i = 1; i < args.length; i++) {
13193
13197
  if (args[i] === "--started-by") {
@@ -13209,7 +13213,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13209
13213
  return;
13210
13214
  } else if (subcommand === "acp") {
13211
13215
  try {
13212
- const { runAcp, resolveAcpAgentConfig } = await import('./index-CJaqyq4z.mjs');
13216
+ const { runAcp, resolveAcpAgentConfig } = await import('./index-BkvUwyIU.mjs');
13213
13217
  let startedBy = void 0;
13214
13218
  let verbose = false;
13215
13219
  const acpArgs = [];
@@ -13249,7 +13253,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13249
13253
  return;
13250
13254
  } else if (subcommand === "openclaw") {
13251
13255
  try {
13252
- const { runOpenClaw } = await import('./runOpenClaw-ENAgQy1E.mjs');
13256
+ const { runOpenClaw } = await import('./runOpenClaw-BiwwYnYf.mjs');
13253
13257
  let startedBy = void 0;
13254
13258
  let verbose = false;
13255
13259
  let gatewayUrl;
@@ -13300,7 +13304,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13300
13304
  return;
13301
13305
  } else if (subcommand === "mcp" && args.length === 1) {
13302
13306
  try {
13303
- const { handleMcpCommand } = await import('./mcp-B4UxtBKQ.mjs');
13307
+ const { handleMcpCommand } = await import('./mcp-B-GdhlKD.mjs');
13304
13308
  await handleMcpCommand();
13305
13309
  } catch (error) {
13306
13310
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
@@ -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-DEre2zxO.cjs');
6
+ var persistence = require('./types-NwtcBgfS.cjs');
7
7
  var spawn = require('cross-spawn');
8
8
  var path = require('node:path');
9
9
  var node_readline = require('node:readline');
@@ -8274,7 +8274,7 @@ const MAX_TITLE_CHARS = 60;
8274
8274
  const GENERATION_TIMEOUT_MS = 3e4;
8275
8275
  function resolveClaudeBinary() {
8276
8276
  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-edEH95Mf.cjs', document.baseURI).href)));
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-Dcv1RKe8.cjs', document.baseURI).href)));
8278
8278
  const utilsPath = path.resolve(path.join(persistence.projectPath(), "scripts", "claude_version_utils.cjs"));
8279
8279
  const { getClaudeCliPath } = require$1(utilsPath);
8280
8280
  const path$1 = getClaudeCliPath();
@@ -10391,9 +10391,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
10391
10391
  };
10392
10392
  }
10393
10393
 
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-edEH95Mf.cjs', document.baseURI).href)));
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-Dcv1RKe8.cjs', document.baseURI).href)));
10395
10395
  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-edEH95Mf.cjs', document.baseURI).href)));
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-Dcv1RKe8.cjs', document.baseURI).href)));
10397
10397
  const PRISMA_QUERY_ENGINE_FILES = {
10398
10398
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
10399
10399
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -11431,6 +11431,7 @@ function createOfflineSessionStub(sessionTag) {
11431
11431
  },
11432
11432
  sendAgentMessage: () => {
11433
11433
  },
11434
+ sendAgentUsageSnapshot: () => false,
11434
11435
  sendClaudeSessionMessage: () => {
11435
11436
  },
11436
11437
  keepAlive: () => {
@@ -12548,6 +12549,9 @@ async function runCodex(opts) {
12548
12549
  }
12549
12550
  });
12550
12551
  client.setEventHandler((msg) => {
12552
+ if (msg.type === "token_count") {
12553
+ session.sendAgentUsageSnapshot("codex", msg);
12554
+ }
12551
12555
  persistence.logger.debug("[Codex] Event metadata", codexEventLogMetadata(msg));
12552
12556
  if (msg.type === "agent_message") {
12553
12557
  messageBuffer.addMessage(msg.message, "assistant");
@@ -13001,7 +13005,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13001
13005
  process.exit(0);
13002
13006
  } else if (subcommand === "install-terminal-hooks") {
13003
13007
  try {
13004
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-BvQbDFcE.cjs'); });
13008
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-YyT3fv6w.cjs'); });
13005
13009
  const command = parseTerminalHooksArgs(args.slice(1));
13006
13010
  if (command.action === "help") {
13007
13011
  console.log(TERMINAL_HOOKS_HELP);
@@ -13018,7 +13022,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13018
13022
  }
13019
13023
  } else if (subcommand === "spawn") {
13020
13024
  try {
13021
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-DTA6f9TE.cjs'); });
13025
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-De3b5Hsu.cjs'); });
13022
13026
  await handleSpawnCommand(args.slice(1));
13023
13027
  } catch (error) {
13024
13028
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13030,7 +13034,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13030
13034
  return;
13031
13035
  } else if (subcommand === "send") {
13032
13036
  try {
13033
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-o4xljyoV.cjs'); });
13037
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-DijSXAMp.cjs'); });
13034
13038
  await handleSendCommand(args.slice(1));
13035
13039
  } catch (error) {
13036
13040
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -13136,9 +13140,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13136
13140
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
13137
13141
  const projectId = args[3];
13138
13142
  try {
13139
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DBIfKaNJ.cjs'); });
13140
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./types-DEre2zxO.cjs'); }).then(function (n) { return n.persistence; });
13141
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-DEre2zxO.cjs'); }).then(function (n) { return n.api; });
13143
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-pv17N6Kg.cjs'); });
13144
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./types-NwtcBgfS.cjs'); }).then(function (n) { return n.persistence; });
13145
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-NwtcBgfS.cjs'); }).then(function (n) { return n.api; });
13142
13146
  let userEmail = void 0;
13143
13147
  try {
13144
13148
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -13169,7 +13173,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13169
13173
  }
13170
13174
  if (geminiSubcommand === "project" && args[2] === "get") {
13171
13175
  try {
13172
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DBIfKaNJ.cjs'); });
13176
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-pv17N6Kg.cjs'); });
13173
13177
  const config = readGeminiLocalConfig();
13174
13178
  if (config.googleCloudProject) {
13175
13179
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -13209,7 +13213,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13209
13213
  process.exit(0);
13210
13214
  }
13211
13215
  try {
13212
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-LIck5ard.cjs'); });
13216
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DuUdmlVZ.cjs'); });
13213
13217
  let startedBy = void 0;
13214
13218
  for (let i = 1; i < args.length; i++) {
13215
13219
  if (args[i] === "--started-by") {
@@ -13231,7 +13235,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13231
13235
  return;
13232
13236
  } else if (subcommand === "acp") {
13233
13237
  try {
13234
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CqxywXyf.cjs'); });
13238
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-C1OnwMx0.cjs'); });
13235
13239
  let startedBy = void 0;
13236
13240
  let verbose = false;
13237
13241
  const acpArgs = [];
@@ -13271,7 +13275,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13271
13275
  return;
13272
13276
  } else if (subcommand === "openclaw") {
13273
13277
  try {
13274
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-B5XNV1zZ.cjs'); });
13278
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-DEMCYSoD.cjs'); });
13275
13279
  let startedBy = void 0;
13276
13280
  let verbose = false;
13277
13281
  let gatewayUrl;
@@ -13322,7 +13326,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
13322
13326
  return;
13323
13327
  } else if (subcommand === "mcp" && args.length === 1) {
13324
13328
  try {
13325
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-D12X7XKG.cjs'); });
13329
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-CsKnmeE5.cjs'); });
13326
13330
  await handleMcpCommand();
13327
13331
  } catch (error) {
13328
13332
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-edEH95Mf.cjs');
5
- require('./types-DEre2zxO.cjs');
4
+ require('./index-Dcv1RKe8.cjs');
5
+ require('./types-NwtcBgfS.cjs');
6
6
  require('zod');
7
7
  require('node:child_process');
8
8
  require('node:os');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'chalk';
2
- import './index-Cq30c63l.mjs';
3
- import './types-Dj9JEGDh.mjs';
2
+ import './index-DOb57EGb.mjs';
3
+ import './types-D2qSKjsO.mjs';
4
4
  import 'zod';
5
5
  import 'node:child_process';
6
6
  import 'node:os';
@@ -3,8 +3,8 @@ import { join, resolve } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
  import { spawnSync } from 'node:child_process';
5
5
  import chalk from 'chalk';
6
- import { p as projectPath } from './types-Dj9JEGDh.mjs';
7
- import { t as tmuxSupportsSessionEnv } from './index-Cq30c63l.mjs';
6
+ import { p as projectPath } from './types-D2qSKjsO.mjs';
7
+ import { t as tmuxSupportsSessionEnv } from './index-DOb57EGb.mjs';
8
8
  import 'axios';
9
9
  import 'node:util';
10
10
  import 'node:fs/promises';
@@ -5,8 +5,8 @@ var path = require('node:path');
5
5
  var os = require('node:os');
6
6
  var node_child_process = require('node:child_process');
7
7
  var chalk = require('chalk');
8
- var persistence = require('./types-DEre2zxO.cjs');
9
- var index = require('./index-edEH95Mf.cjs');
8
+ var persistence = require('./types-NwtcBgfS.cjs');
9
+ var index = require('./index-Dcv1RKe8.cjs');
10
10
  require('axios');
11
11
  require('node:util');
12
12
  require('node:fs/promises');
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./types-DEre2zxO.cjs');
3
+ var persistence = require('./types-NwtcBgfS.cjs');
4
4
  require('axios');
5
5
  require('chalk');
6
6
  require('node:util');
package/dist/lib.d.cts CHANGED
@@ -545,6 +545,11 @@ declare class RpcHandlerManager {
545
545
  */
546
546
  handleRequest(request: RpcRequest): Promise<any>;
547
547
  onSocketConnect(socket: Socket): void;
548
+ /**
549
+ * Attach a candidate transport and wait until the server confirms every
550
+ * method before a release handover closes the old transport.
551
+ */
552
+ onSocketConnectAndWait(socket: Socket, timeoutMs?: number): Promise<void>;
548
553
  onSocketDisconnect(socket?: Socket): void;
549
554
  /**
550
555
  * Get the number of registered handlers
@@ -652,13 +657,19 @@ declare class ApiSessionClient extends EventEmitter {
652
657
  private ignoreArchiveSignal;
653
658
  private skipInitialMessages;
654
659
  private claudeSessionProtocolState;
660
+ private readonly seenClaudeUsageEvents;
661
+ private claudeUsageTotals;
655
662
  private lastSeq;
656
663
  private pendingOutbox;
657
664
  private readonly sendSync;
658
665
  private readonly receiveSync;
659
666
  private readonly directInboundLocalIds;
660
667
  private readonly routedInboundLocalIds;
668
+ private handoverInFlight;
661
669
  constructor(token: string, session: Session);
670
+ private createControlSocket;
671
+ private startReleaseHandover;
672
+ private releaseHandover;
662
673
  onUserMessage(callback: (data: UserMessage) => void): void;
663
674
  onFileEvent(callback: (data: FileEventMessage) => void): void;
664
675
  /**
@@ -787,7 +798,9 @@ declare class ApiSessionClient extends EventEmitter {
787
798
  /**
788
799
  * Send usage data to the server
789
800
  */
790
- sendUsageData(usage: Usage, model?: string): void;
801
+ sendUsageData(usage: Usage, model?: string, eventId?: string): void;
802
+ /** Save a provider's cumulative session snapshot under one upsert key. */
803
+ sendAgentUsageSnapshot(agent: string, rawUsage: unknown): boolean;
791
804
  /**
792
805
  * Returns the latest session metadata known to the client.
793
806
  */
@@ -1009,6 +1022,7 @@ declare class ApiMachineClient {
1009
1022
  private stopSessionHandler;
1010
1023
  private listTrackedSessionIds;
1011
1024
  private reconnectInterval;
1025
+ private handoverInFlight;
1012
1026
  private encTerminals;
1013
1027
  private webTerminal;
1014
1028
  /**
@@ -1068,7 +1082,15 @@ declare class ApiMachineClient {
1068
1082
  */
1069
1083
  updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
1070
1084
  connect(): void;
1085
+ private createControlSocket;
1086
+ private activateControlSocket;
1087
+ private bindControlDataHandlers;
1088
+ private startReleaseHandover;
1089
+ private releaseHandover;
1071
1090
  private startKeepAlive;
1091
+ private bindRpcRequestHandler;
1092
+ private bindMachineCommandHandlers;
1093
+ private unbindMachineCommandHandlers;
1072
1094
  private bindRealtimeHandlers;
1073
1095
  /** Reconcile commands missed while the daemon was offline. The server
1074
1096
  * returns only ids owned by this account and durably archived in the DB. */
package/dist/lib.d.mts CHANGED
@@ -545,6 +545,11 @@ declare class RpcHandlerManager {
545
545
  */
546
546
  handleRequest(request: RpcRequest): Promise<any>;
547
547
  onSocketConnect(socket: Socket): void;
548
+ /**
549
+ * Attach a candidate transport and wait until the server confirms every
550
+ * method before a release handover closes the old transport.
551
+ */
552
+ onSocketConnectAndWait(socket: Socket, timeoutMs?: number): Promise<void>;
548
553
  onSocketDisconnect(socket?: Socket): void;
549
554
  /**
550
555
  * Get the number of registered handlers
@@ -652,13 +657,19 @@ declare class ApiSessionClient extends EventEmitter {
652
657
  private ignoreArchiveSignal;
653
658
  private skipInitialMessages;
654
659
  private claudeSessionProtocolState;
660
+ private readonly seenClaudeUsageEvents;
661
+ private claudeUsageTotals;
655
662
  private lastSeq;
656
663
  private pendingOutbox;
657
664
  private readonly sendSync;
658
665
  private readonly receiveSync;
659
666
  private readonly directInboundLocalIds;
660
667
  private readonly routedInboundLocalIds;
668
+ private handoverInFlight;
661
669
  constructor(token: string, session: Session);
670
+ private createControlSocket;
671
+ private startReleaseHandover;
672
+ private releaseHandover;
662
673
  onUserMessage(callback: (data: UserMessage) => void): void;
663
674
  onFileEvent(callback: (data: FileEventMessage) => void): void;
664
675
  /**
@@ -787,7 +798,9 @@ declare class ApiSessionClient extends EventEmitter {
787
798
  /**
788
799
  * Send usage data to the server
789
800
  */
790
- sendUsageData(usage: Usage, model?: string): void;
801
+ sendUsageData(usage: Usage, model?: string, eventId?: string): void;
802
+ /** Save a provider's cumulative session snapshot under one upsert key. */
803
+ sendAgentUsageSnapshot(agent: string, rawUsage: unknown): boolean;
791
804
  /**
792
805
  * Returns the latest session metadata known to the client.
793
806
  */
@@ -1009,6 +1022,7 @@ declare class ApiMachineClient {
1009
1022
  private stopSessionHandler;
1010
1023
  private listTrackedSessionIds;
1011
1024
  private reconnectInterval;
1025
+ private handoverInFlight;
1012
1026
  private encTerminals;
1013
1027
  private webTerminal;
1014
1028
  /**
@@ -1068,7 +1082,15 @@ declare class ApiMachineClient {
1068
1082
  */
1069
1083
  updateDaemonState(handler: (state: DaemonState | null) => DaemonState): Promise<void>;
1070
1084
  connect(): void;
1085
+ private createControlSocket;
1086
+ private activateControlSocket;
1087
+ private bindControlDataHandlers;
1088
+ private startReleaseHandover;
1089
+ private releaseHandover;
1071
1090
  private startKeepAlive;
1091
+ private bindRpcRequestHandler;
1092
+ private bindMachineCommandHandlers;
1093
+ private unbindMachineCommandHandlers;
1072
1094
  private bindRealtimeHandlers;
1073
1095
  /** Reconcile commands missed while the daemon was offline. The server
1074
1096
  * returns only ids owned by this account and durably archived in the DB. */
package/dist/lib.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-Dj9JEGDh.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-D2qSKjsO.mjs';
2
2
  import 'axios';
3
3
  import 'chalk';
4
4
  import 'node:util';
@@ -1,9 +1,9 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
3
  import { z } from 'zod';
4
- import { p as pushClipboardViaDaemon } from './index-Cq30c63l.mjs';
4
+ import { p as pushClipboardViaDaemon } from './index-DOb57EGb.mjs';
5
5
  import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, c as CLIPBOARD_MAX_BYTES } from './limits-CwFb5S2b.mjs';
6
- import { l as logger } from './types-Dj9JEGDh.mjs';
6
+ import { l as logger } from './types-D2qSKjsO.mjs';
7
7
  import 'chalk';
8
8
  import 'node:os';
9
9
  import 'node:crypto';
@@ -3,9 +3,9 @@
3
3
  var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
4
4
  var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
5
5
  var z = require('zod');
6
- var index = require('./index-edEH95Mf.cjs');
6
+ var index = require('./index-Dcv1RKe8.cjs');
7
7
  var limits = require('./limits-KdWKmwtH.cjs');
8
- var persistence = require('./types-DEre2zxO.cjs');
8
+ var persistence = require('./types-NwtcBgfS.cjs');
9
9
  require('chalk');
10
10
  require('node:os');
11
11
  require('node:crypto');
@@ -2,10 +2,10 @@ import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { join } from 'node:path';
5
- import { l as logger, h as connectionState, A as ApiClient, i as readSettings, e as errorLogMetadata, j as encodeBase64, p as projectPath, d as contentLogMetadata } from './types-Dj9JEGDh.mjs';
6
- import { g as GEMINI_API_KEY_ENV, j as GOOGLE_API_KEY_ENV, G as GEMINI_MODEL_ENV, B as BasePermissionHandler, k as BaseReasoningProcessor, i as initialMachineMetadata, d as createSessionMetadata, e as setupOfflineReconnection, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, l as MessageBuffer, C as CHANGE_TITLE_INSTRUCTION, r as registerKillSessionHandler, f as startHappyServer } from './index-Cq30c63l.mjs';
7
- import { A as AcpBackend } from './AcpBackend-5CPQMP3H.mjs';
8
- import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-DbY2R-H7.mjs';
5
+ import { l as logger, h as connectionState, A as ApiClient, i as readSettings, e as errorLogMetadata, j as encodeBase64, p as projectPath, d as contentLogMetadata } from './types-D2qSKjsO.mjs';
6
+ import { g as GEMINI_API_KEY_ENV, j as GOOGLE_API_KEY_ENV, G as GEMINI_MODEL_ENV, B as BasePermissionHandler, k as BaseReasoningProcessor, i as initialMachineMetadata, d as createSessionMetadata, e as setupOfflineReconnection, n as notifyDaemonSessionStarted, M as MessageQueue2, h as hashObject, l as MessageBuffer, C as CHANGE_TITLE_INSTRUCTION, r as registerKillSessionHandler, f as startHappyServer } from './index-DOb57EGb.mjs';
7
+ import { A as AcpBackend } from './AcpBackend-BFFC77vV.mjs';
8
+ import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-CRFTYuTN.mjs';
9
9
  import 'axios';
10
10
  import 'chalk';
11
11
  import 'node:util';
@@ -1314,6 +1314,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1314
1314
  break;
1315
1315
  default:
1316
1316
  if (msg.type === "token-count") {
1317
+ session.sendAgentUsageSnapshot("gemini", msg);
1317
1318
  session.sendAgentMessage("gemini", {
1318
1319
  type: "token_count",
1319
1320
  ...msg,