very-happy-cli 0.2.157 → 0.2.159

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 (55) hide show
  1. package/dist/{AcpBackend-BymWX-LI.cjs → AcpBackend-DUYFlyfN.cjs} +2 -2
  2. package/dist/{AcpBackend-Cy18U7yw.mjs → AcpBackend-VsfkZiVF.mjs} +2 -2
  3. package/dist/{AcpSessionManager-BF7zBGAi.cjs → AcpSessionManager-Bdv8LWXh.cjs} +1 -1
  4. package/dist/{AcpSessionManager-Ds8rcp95.mjs → AcpSessionManager-rYtVb0kN.mjs} +1 -1
  5. package/dist/{agentGuidance-Db76O1kw.cjs → agentGuidance-BRDN1NoZ.cjs} +3 -2
  6. package/dist/{agentGuidance-CU6YD_Ms.mjs → agentGuidance-KgvYuF3R.mjs} +3 -2
  7. package/dist/{agentHome-B0CLy0Qx.cjs → agentHome-CHh4lmjM.cjs} +2 -2
  8. package/dist/{agentHome-BaJ9xtxB.mjs → agentHome-CvsJyeQB.mjs} +2 -2
  9. package/dist/{auto-DqKGFq8U.cjs → auto-DKmEls8Z.cjs} +19 -10
  10. package/dist/{auto-B1YAwaeU.mjs → auto-nb8GhRRy.mjs} +19 -10
  11. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  13. package/dist/{config-aAbhJllb.mjs → config-ClLtM6F3.mjs} +4 -4
  14. package/dist/{config-CzkBjZnV.cjs → config-DLx-vW3I.cjs} +4 -4
  15. package/dist/{index-BVu8Cufk.mjs → index-2mCaeKyf.mjs} +19 -9
  16. package/dist/{index-CTbGqVFY.cjs → index-BEOMECtE.cjs} +18 -8
  17. package/dist/{index-BYU1e81k.mjs → index-BF6WfgV5.mjs} +63 -29
  18. package/dist/{index-DQcRkI9r.mjs → index-C-JazrMB.mjs} +4 -4
  19. package/dist/{index-Cz-uqnJk.cjs → index-blDSadUR.cjs} +4 -4
  20. package/dist/{index-C9QzZsUQ.cjs → index-rH3DrQ5B.cjs} +67 -33
  21. package/dist/index.cjs +4 -4
  22. package/dist/index.mjs +4 -4
  23. package/dist/{install-BMlV0Tnr.cjs → install-BOHrUaFM.cjs} +1 -1
  24. package/dist/{install-BuYnqtVa.mjs → install-BPhJppvd.mjs} +1 -1
  25. package/dist/{installTerminalHooks-BVVOEGhG.cjs → installTerminalHooks-Cou3WUf3.cjs} +4 -4
  26. package/dist/{installTerminalHooks-ELDoqh0A.mjs → installTerminalHooks-WeznjkuC.mjs} +4 -4
  27. package/dist/lib.cjs +2 -2
  28. package/dist/lib.d.cts +114 -0
  29. package/dist/lib.d.mts +114 -0
  30. package/dist/lib.mjs +2 -2
  31. package/dist/{limits-CyuIt-Vl.cjs → limits-BH5CV5vR.cjs} +39 -7
  32. package/dist/{limits-A2c-3M-_.mjs → limits-CjRj8IX5.mjs} +39 -8
  33. package/dist/{mcp-CXkvnztT.cjs → mcp-CPYbtsYG.cjs} +4 -4
  34. package/dist/{mcp-Bo934Kpy.mjs → mcp-Dy3f_K0h.mjs} +4 -4
  35. package/dist/{piRuntime-CJjA26oD.cjs → piRuntime-NtF0YqjH.cjs} +2 -2
  36. package/dist/{piRuntime-DdEY2mE9.mjs → piRuntime-kLZNpAAl.mjs} +2 -2
  37. package/dist/{piTerminal-CpU3hzrX.cjs → piTerminal-9J0GAKzb.cjs} +6 -6
  38. package/dist/{piTerminal-DwWmgumi.mjs → piTerminal-B0fEOV_2.mjs} +6 -6
  39. package/dist/{runGemini-Cj6oJQ-I.mjs → runGemini-DV6Ouadt.mjs} +6 -6
  40. package/dist/{runGemini-DS-0qm0L.cjs → runGemini-F-mqx3_K.cjs} +6 -6
  41. package/dist/{runOpenClaw-DUCQxkI-.mjs → runOpenClaw-D7MlPS5n.mjs} +5 -5
  42. package/dist/{runOpenClaw-CvSm8oTc.cjs → runOpenClaw-Qqo9j63M.cjs} +5 -5
  43. package/dist/{send-CHxobaoI.cjs → send-4qJTCAYW.cjs} +2 -2
  44. package/dist/{send-D5CyRyZ_.mjs → send-CLhYXNgy.mjs} +2 -2
  45. package/dist/{sessions-BFlIrKCY.cjs → sessions-Bh1pyddi.cjs} +2 -2
  46. package/dist/{sessions-DsE01xKc.mjs → sessions-CzIH2rGp.mjs} +2 -2
  47. package/dist/{spawn-CdihhwHs.mjs → spawn-CPIWlPOM.mjs} +4 -4
  48. package/dist/{spawn-HV345RN-.cjs → spawn-CmFOSVdW.cjs} +4 -4
  49. package/dist/{teams-BahinMnH.cjs → teams-CB1R9-Z9.cjs} +5 -5
  50. package/dist/{teams-BE8nMB6O.mjs → teams-CEahj4cm.mjs} +5 -5
  51. package/dist/{todo-CuQAkSp2.mjs → todo-Cknp5D4U.mjs} +2 -2
  52. package/dist/{todo-CMMQ6yhU.cjs → todo-DqyRI4wP.cjs} +2 -2
  53. package/dist/{types-B0sSi6eM.cjs → types-BbvK1Tr_.cjs} +192 -2
  54. package/dist/{types-BrGJ7PJz.mjs → types-Dh-s4Lqs.mjs} +192 -2
  55. package/package.json +7 -7
@@ -1,14 +1,14 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
2
  import os, { homedir, hostname, userInfo, tmpdir } from 'node:os';
3
3
  import { randomUUID, randomInt, randomBytes, createHash as createHash$1, timingSafeEqual } from 'node:crypto';
4
- import { g as getProjectPath, k as initializeSandbox, w as wrapCommand, j as contentLogMetadata, I as InvalidateSync, R as RawJSONLinesSchema, l as AsyncLock, M as MAX_CHAT_ATTACHMENT_SOURCE_BYTES, m as commandOnPath, n as deriveLocalCliUpdateSummary, o as isClaudeSessionId, q as getLocalHappyAgentCredentialPath, s as readLocalHappyAgentCredentials, t as parseExactVersion, u as compareExactVersions, v as extractCompleteLines, x as decideBackfill, y as parseTerminalHookPayload, z as tmuxArgs, B as scrubTmuxClientEnv, D as decideMirrorBinding, E as MIRROR_BACKFILL_LINES_DEFAULT, G as mirrorLineKey, H as mirrorLocalId, J as detectCLIAvailability, K as detectResumeSupport, L as refreshAgentHomes, d as describeAgentHome, T as TurnActivityTracker, N as summarizeSpawnSessionForLog, O as locateClaudeConversation, P as agentHomeSpawnEnv, Q as shellescape, A as ApiClient, S as fetchCliUpdateState, U as resolveCliUpdateCheckInterval, V as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS, W as listVhTerminals, X as readVhTerminal, Y as sendToVhTerminal, Z as TITLE_PROMPT_PREFIX, _ as BOARD_ANALYZER_PROMPT_PREFIX, h as connectionState, $ as startOfflineReconnection, C as CodexAppServerClient } from './types-BrGJ7PJz.mjs';
5
- import { l as logger, aa as sameBackgroundTasks, ab as notifyDaemonSessionEvent, x as BUILTIN_TODO_DISCOVERY, g as delay, ac as STREAM_DELTA_MAX_CHARS, ad as ensurePrivateDirectory, ae as hardenPrivateFile, c as configuration, af as notifyDaemonClaudeAuthFailed, ag as createBackgroundTaskTracker, F as packageJson, r as readSettings, ah as readCredentials, a0 as credentialRelayProblem, k as checkIfDaemonRunningAndCleanupStaleState, ai as readDaemonState, aj as AGENT_VERSION_SOURCES, w as encodeBase64, ak as readSettingsOutcome, u as updateSettings, al as encodeBase64Url, M as decodeBase64, am as writeCredentialsLegacy, an as writeCredentialsDataKey, ao as BACKGROUND_TASK_DESCRIPTION_MAX, ap as BACKGROUND_TASKS_MAX, d as readPersistedSessions, E as writePrivateFileSync, aq as decryptWithDataKey, ar as decryptLegacy, as as persistSession, z as ensurePrivateDirectorySync, at as getAgentCodeDefaults, au as normalizeAgentKey, av as isClaudeOpus55Model, aw as supportsClaudeOpus55, ax as AUTOMATION_SUMMARY_MAX_CHARS, ay as AUTOMATION_CLAIM_MAX_RUNS, az as AUTOMATION_DEFAULT_LEASE_MS, f as isAutomationRunTerminal, aA as isDaemonRunningCurrentlyInstalledHappyVersion, aB as stopDaemon, aC as acquireDaemonLock, aD as BackgroundTaskTracker, aE as deletePersistedSessions, N as decrypt, aF as writeDaemonState, aG as writeSettings, aH as cleanupDaemonState, aI as releaseDaemonLock, i as isValidSessionId, m as spawnDaemonSession, a4 as isValidTerminalId, aJ as ContextUsageSchema, C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, o as CLIPBOARD_MAX_BYTES, v as notifyDaemonSessionStarted, y as reportSessionEditToDaemon, aK as clearCredentials, aL as clearMachineId, h as readCredentialsForConfiguredRelay, aM as SandboxConfigSchema, e as createEnvelope, O as listDaemonSessions, n as stopDaemonSession, aN as getLatestDaemonLog } from './limits-A2c-3M-_.mjs';
4
+ import { g as getProjectPath, k as initializeSandbox, w as wrapCommand, j as contentLogMetadata, I as InvalidateSync, R as RawJSONLinesSchema, l as AsyncLock, M as MAX_CHAT_ATTACHMENT_SOURCE_BYTES, m as commandOnPath, n as deriveLocalCliUpdateSummary, o as isClaudeSessionId, q as getLocalHappyAgentCredentialPath, s as readLocalHappyAgentCredentials, t as parseExactVersion, u as compareExactVersions, v as extractCompleteLines, x as decideBackfill, y as parseTerminalHookPayload, z as tmuxArgs, B as scrubTmuxClientEnv, D as decideMirrorBinding, E as MIRROR_BACKFILL_LINES_DEFAULT, G as mirrorLineKey, H as mirrorLocalId, J as detectCLIAvailability, K as detectResumeSupport, L as refreshAgentHomes, d as describeAgentHome, T as TurnActivityTracker, N as summarizeSpawnSessionForLog, O as locateClaudeConversation, P as agentHomeSpawnEnv, Q as shellescape, A as ApiClient, S as fetchCliUpdateState, U as resolveCliUpdateCheckInterval, V as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS, W as listVhTerminals, X as readVhTerminal, Y as sendToVhTerminal, Z as TITLE_PROMPT_PREFIX, _ as BOARD_ANALYZER_PROMPT_PREFIX, h as connectionState, $ as startOfflineReconnection, C as CodexAppServerClient } from './types-Dh-s4Lqs.mjs';
5
+ import { l as logger, ab as sameBackgroundTasks, ac as notifyDaemonSessionEvent, x as BUILTIN_TODO_DISCOVERY, g as delay, ad as STREAM_DELTA_MAX_CHARS, ae as ensurePrivateDirectory, af as hardenPrivateFile, c as configuration, ag as notifyDaemonClaudeAuthFailed, ah as createBackgroundTaskTracker, F as packageJson, r as readSettings, ai as readCredentials, a1 as credentialRelayProblem, k as checkIfDaemonRunningAndCleanupStaleState, aj as readDaemonState, ak as AGENT_VERSION_SOURCES, w as encodeBase64, al as readSettingsOutcome, u as updateSettings, am as encodeBase64Url, M as decodeBase64, an as writeCredentialsLegacy, ao as writeCredentialsDataKey, ap as BACKGROUND_TASK_DESCRIPTION_MAX, aq as BACKGROUND_TASKS_MAX, d as readPersistedSessions, E as writePrivateFileSync, ar as decryptWithDataKey, as as decryptLegacy, at as persistSession, z as ensurePrivateDirectorySync, au as getAgentCodeDefaults, av as normalizeAgentKey, aw as isClaudeOpus55Model, ax as supportsClaudeOpus55, ay as AUTOMATION_SUMMARY_MAX_CHARS, az as AUTOMATION_CLAIM_MAX_RUNS, aA as AUTOMATION_DEFAULT_LEASE_MS, f as isAutomationRunTerminal, aB as isDaemonRunningCurrentlyInstalledHappyVersion, aC as stopDaemon, aD as acquireDaemonLock, aE as BackgroundTaskTracker, aF as deletePersistedSessions, N as decrypt, aG as writeDaemonState, aH as writeSettings, aI as cleanupDaemonState, aJ as releaseDaemonLock, i as isValidSessionId, m as spawnDaemonSession, a5 as isValidTerminalId, aK as ContextUsageSchema, C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION, o as CLIPBOARD_MAX_BYTES, P as PROMPT_QUEUE_CAPABILITY, v as notifyDaemonSessionStarted, y as reportSessionEditToDaemon, aL as clearCredentials, aM as clearMachineId, h as readCredentialsForConfiguredRelay, aN as SandboxConfigSchema, e as createEnvelope, O as listDaemonSessions, n as stopDaemonSession, aO as getLatestDaemonLog } from './limits-CjRj8IX5.mjs';
6
6
  import spawn$1, { spawn } from 'cross-spawn';
7
7
  import path, { join, resolve, basename, delimiter, isAbsolute, dirname, sep, normalize } from 'node:path';
8
8
  import { createInterface } from 'node:readline';
9
9
  import { existsSync, readFileSync, readdirSync, statSync, mkdirSync, realpathSync, unlinkSync, renameSync, writeFileSync, accessSync, constants as constants$1, openSync, fsyncSync, closeSync, rmSync as rmSync$1, chmodSync as chmodSync$1 } from 'node:fs';
10
10
  import { p as projectPath } from './terminalTitleSuggest-DKgX3osW.mjs';
11
- import { K as trimIdent, L as AGENT_GUIDANCE, N as formatEditConflictNotice, H as sendUserMessage, S as SESSION_PEER_SENT_FROM, F as readSessionMetadata, R as RemoteCallBudget, O as REMOTE_WRITE_CALLS_PER_MINUTE, s as sendPeerMessage, j as listPeerSessions, u as deliverToSession, k as readSessionTranscript, l as listAccountSessions, g as listSessions, Q as guardRemoteSessionOpsRequest, U as remoteError, V as REMOTE_OP_DEADLINE_MS, W as formatRemoteAuditLine, X as REMOTE_SEND_COMMIT_DEADLINE_MS, Y as REMOTE_RESUME_WAIT_MS, Z as CLI_PEER_SENDER_ID, M as MAX_READ_LIMIT, _ as capRemoteTranscript, $ as capRemoteText, x as sessionWebUrl, a0 as REMOTE_ANSWER_MAX_BYTES, a1 as REMOTE_TITLE_MAX_BYTES, G as waitForSessionKey, q as archiveSession, a2 as createAutomationsClient, A as isAutomationsUnavailable, a3 as AutomationsRequestError, a4 as analyzeLatestTurn, a5 as readSessionLog$1, a6 as TURN_WINDOW, a7 as userPromptText, E as teamScopePath, a8 as TeamConnectionPreflightError, J as createTeamsClient, n as readRemoteTranscript, v as sendRemoteMessage, a9 as RemoteSessionOpsError, o as stopSession, P as PREVIEW_TOOL_NAME, aa as REPORT_PROGRESS_TOOL_NAME, ab as TEAM_TOOL_NAMES, ac as AUTOMATION_TOOL_NAMES, ad as SESSION_PEER_TOOL_NAMES, r as registerTeamsTools, c as registerAutomationTools, d as registerSessionPeerTools, ae as createSessionPeerToolExecutor, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, af as REPORT_PROGRESS_TOOL_TITLE, ag as REPORT_PROGRESS_TOOL_DESCRIPTION } from './agentGuidance-CU6YD_Ms.mjs';
11
+ import { K as trimIdent, L as AGENT_GUIDANCE, N as formatEditConflictNotice, H as sendUserMessage, S as SESSION_PEER_SENT_FROM, F as readSessionMetadata, R as RemoteCallBudget, O as REMOTE_WRITE_CALLS_PER_MINUTE, s as sendPeerMessage, j as listPeerSessions, u as deliverToSession, k as readSessionTranscript, l as listAccountSessions, g as listSessions, Q as guardRemoteSessionOpsRequest, U as remoteError, V as REMOTE_OP_DEADLINE_MS, W as formatRemoteAuditLine, X as REMOTE_SEND_COMMIT_DEADLINE_MS, Y as REMOTE_RESUME_WAIT_MS, Z as CLI_PEER_SENDER_ID, M as MAX_READ_LIMIT, _ as capRemoteTranscript, $ as capRemoteText, x as sessionWebUrl, a0 as REMOTE_ANSWER_MAX_BYTES, a1 as REMOTE_TITLE_MAX_BYTES, G as waitForSessionKey, q as archiveSession, a2 as createAutomationsClient, A as isAutomationsUnavailable, a3 as AutomationsRequestError, a4 as analyzeLatestTurn, a5 as readSessionLog$1, a6 as TURN_WINDOW, a7 as userPromptText, E as teamScopePath, a8 as TeamConnectionPreflightError, J as createTeamsClient, n as readRemoteTranscript, v as sendRemoteMessage, a9 as RemoteSessionOpsError, o as stopSession, P as PREVIEW_TOOL_NAME, aa as REPORT_PROGRESS_TOOL_NAME, ab as TEAM_TOOL_NAMES, ac as AUTOMATION_TOOL_NAMES, ad as SESSION_PEER_TOOL_NAMES, r as registerTeamsTools, c as registerAutomationTools, d as registerSessionPeerTools, ae as createSessionPeerToolExecutor, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, af as REPORT_PROGRESS_TOOL_TITLE, ag as REPORT_PROGRESS_TOOL_DESCRIPTION } from './agentGuidance-KgvYuF3R.mjs';
12
12
  import { readFile, writeFile, rename, unlink, mkdir, access as access$1, symlink, rm, readlink, lstat, constants, stat, open as open$1, appendFile } from 'node:fs/promises';
13
13
  import fs, { watch, access } from 'fs/promises';
14
14
  import { useStdout, useInput, Box, Text, render } from 'ink';
@@ -4314,7 +4314,7 @@ async function claudeRemoteLauncher(session, onPermissionModeChange, onEffective
4314
4314
  closeFailed: (error) => session.client.closeClaudeSessionTurn("failed", { error }),
4315
4315
  onFailed: (error) => session.onSessionError(error),
4316
4316
  onCompleted: () => {
4317
- const idle = !modeGate.hasParked && session.queue.size() === 0;
4317
+ const idle = !modeGate.hasParked && session.queue.size() === 0 && !session.client.promptQueueHasPending();
4318
4318
  session.onTurnEnd(idle);
4319
4319
  if (idle) {
4320
4320
  session.api.push().sendSessionNotification({
@@ -4470,6 +4470,12 @@ class MessageQueue2 {
4470
4470
  * so the web stops painting a silently-lost message as "queued".
4471
4471
  */
4472
4472
  onDiscardHandler = null;
4473
+ /**
4474
+ * B-509: fired when a consumer starts waiting on an EMPTY queue — the
4475
+ * runner has finished its turn and has nothing to run. The server-side
4476
+ * prompt queue drain uses it as its "idle" edge (utils/promptQueueDrain.ts).
4477
+ */
4478
+ onWaitHandler = null;
4473
4479
  modeHasher;
4474
4480
  constructor(modeHasher, onMessageHandler = null, onDiscardHandler = null) {
4475
4481
  this.modeHasher = modeHasher;
@@ -4490,6 +4496,14 @@ class MessageQueue2 {
4490
4496
  setOnDiscard(handler) {
4491
4497
  this.onDiscardHandler = handler;
4492
4498
  }
4499
+ /** B-509: observe the consumer blocking on an empty queue. */
4500
+ setOnWait(handler) {
4501
+ this.onWaitHandler = handler;
4502
+ }
4503
+ /** B-509: true while a consumer is blocked waiting for the next message. */
4504
+ isWaiting() {
4505
+ return this.waiter !== null;
4506
+ }
4493
4507
  /** Report the current items as destroyed for `reason` (caller clears next). */
4494
4508
  notifyDiscard(reason) {
4495
4509
  if (this.queue.length === 0) return;
@@ -4750,6 +4764,7 @@ class MessageQueue2 {
4750
4764
  }
4751
4765
  this.waiter = waiterFunc;
4752
4766
  logger.debug("[MessageQueue2] Waiting for messages...");
4767
+ this.onWaitHandler?.();
4753
4768
  });
4754
4769
  }
4755
4770
  }
@@ -4890,6 +4905,7 @@ function createSessionMetadata(opts) {
4890
4905
  dangerouslySkipPermissions: opts.dangerouslySkipPermissions ?? null,
4891
4906
  ...opts.parentSessionId ? { parentSessionId: opts.parentSessionId } : {},
4892
4907
  ...opts.forkedFromMessageId ? { forkedFromMessageId: opts.forkedFromMessageId } : {},
4908
+ ...opts.capabilities ? { capabilities: [...opts.capabilities] } : {},
4893
4909
  // B-091/B-303: dispatched sessions carry their spawn origin as a tag
4894
4910
  // from birth (see spawnOriginTags) — applies to every flavor the daemon
4895
4911
  // can spawn, since HAPPY_SPAWNED_BY is exported flavor-independently.
@@ -5402,8 +5418,8 @@ ${typeLabels[type] || type}:`));
5402
5418
  }
5403
5419
  console.log(chalk.gray(" An external claude command is only needed for native terminal/mirror use."));
5404
5420
  try {
5405
- const { resolveAgentHomesForCli } = await import('./agentHome-BaJ9xtxB.mjs');
5406
- const { describeAgentHome } = await import('./types-BrGJ7PJz.mjs').then(function (n) { return n.a0; });
5421
+ const { resolveAgentHomesForCli } = await import('./agentHome-CvsJyeQB.mjs');
5422
+ const { describeAgentHome } = await import('./types-Dh-s4Lqs.mjs').then(function (n) { return n.a0; });
5407
5423
  const homes = await resolveAgentHomesForCli();
5408
5424
  console.log(chalk.green(`\u2713 Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}`));
5409
5425
  console.log(chalk.green(`\u2713 Codex home: ${describeAgentHome(homes.codexHome)}`));
@@ -10895,6 +10911,7 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
10895
10911
  for (const item of tracked.values()) {
10896
10912
  if (item.sessionId !== sessionId) continue;
10897
10913
  if (event === "exited") item.exited = true;
10914
+ if (event === "idle") item.attentionReported = false;
10898
10915
  if (event === "blocked" && !item.attentionReported) {
10899
10916
  item.attentionReported = true;
10900
10917
  void client.report(item.runId, { claimId: item.claimId, needsAttention: true, attentionReason: "needs_input" }).catch(() => deps.log(`Automation run ${item.runId} attention report failed`));
@@ -13481,7 +13498,7 @@ function registerSideQuestionHandler(rpc, deps) {
13481
13498
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
13482
13499
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
13483
13500
  const fork = deps.run ?? (async (input) => {
13484
- const { query } = await import('./index-DQcRkI9r.mjs');
13501
+ const { query } = await import('./index-C-JazrMB.mjs');
13485
13502
  return runSideQuestion(query, input);
13486
13503
  });
13487
13504
  const run = async (input, live) => {
@@ -14067,7 +14084,7 @@ async function runClaude(credentials, options = {}) {
14067
14084
  // a brand-new session cannot pick a PDF until after sending once.
14068
14085
  attachmentKinds: [...CLAUDE_ATTACHMENT_KINDS],
14069
14086
  queueCancellation: true,
14070
- capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1"],
14087
+ capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", PROMPT_QUEUE_CAPABILITY],
14071
14088
  // Effective mode this process enforces. Kept current by
14072
14089
  // publishPermissionMode below; the web renders it instead of guessing.
14073
14090
  permissionMode: mapToClaudeMode(initialPermissionMode ?? "default"),
@@ -14323,6 +14340,10 @@ async function runClaude(credentials, options = {}) {
14323
14340
  controlledByUser: options.startingMode !== "remote"
14324
14341
  }));
14325
14342
  const messageQueue = new MessageQueue2(claudeModeHash);
14343
+ const promptQueueDrain = session.attachPromptQueueDrain({
14344
+ isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
14345
+ });
14346
+ messageQueue.setOnWait(() => promptQueueDrain.onIdle());
14326
14347
  messageQueue.setOnDiscard((entries) => {
14327
14348
  const byReason = /* @__PURE__ */ new Map();
14328
14349
  for (const entry of entries) {
@@ -14626,6 +14647,7 @@ async function runClaude(credentials, options = {}) {
14626
14647
  return;
14627
14648
  }
14628
14649
  logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
14650
+ promptQueueDrain.close();
14629
14651
  try {
14630
14652
  if (session) {
14631
14653
  currentSession?.cleanup();
@@ -17887,7 +17909,8 @@ async function runCodex(opts) {
17887
17909
  sandbox: sandboxConfig,
17888
17910
  dangerouslySkipPermissions: initialPermissionMode === "yolo" || initialPermissionMode === "bypassPermissions",
17889
17911
  ...forkedFromSessionId ? { parentSessionId: forkedFromSessionId } : {},
17890
- ...forkedFromMessageId ? { forkedFromMessageId } : {}
17912
+ ...forkedFromMessageId ? { forkedFromMessageId } : {},
17913
+ capabilities: [PROMPT_QUEUE_CAPABILITY]
17891
17914
  });
17892
17915
  metadata.attachmentKinds = [...CLAUDE_ATTACHMENT_KINDS];
17893
17916
  const importCodexThreadId = process.env[IMPORT_CODEX_THREAD_ENV];
@@ -17954,6 +17977,7 @@ async function runCodex(opts) {
17954
17977
  if (permissionHandler) {
17955
17978
  permissionHandler.updateSession(newSession);
17956
17979
  }
17980
+ attachPromptQueueDrain(newSession);
17957
17981
  }
17958
17982
  });
17959
17983
  session = initialSession;
@@ -17983,6 +18007,13 @@ async function runCodex(opts) {
17983
18007
  }
17984
18008
  }
17985
18009
  const messageQueue = new MessageQueue2(hashCodexEnhancedMode);
18010
+ function attachPromptQueueDrain(client2) {
18011
+ const drain = client2.attachPromptQueueDrain({
18012
+ isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
18013
+ });
18014
+ messageQueue.setOnWait(() => drain.onIdle());
18015
+ }
18016
+ attachPromptQueueDrain(session);
17986
18017
  messageQueue.setOnDiscard((entries) => {
17987
18018
  const keys = entries.map((entry) => entry.sourceId).filter((key) => typeof key === "string");
17988
18019
  if (keys.length > 0) session.sendQueueCancelReason(keys, entries[0].reason);
@@ -18488,7 +18519,8 @@ async function runCodex(opts) {
18488
18519
  });
18489
18520
  emitReadyIfIdle({
18490
18521
  pending,
18491
- queueSize: () => messageQueue.size(),
18522
+ // B-509: server-queued prompts count as pending input (no ready/push per item).
18523
+ queueSize: () => messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
18492
18524
  shouldExit,
18493
18525
  sendReady
18494
18526
  });
@@ -18566,7 +18598,8 @@ async function runCodex(opts) {
18566
18598
  session.keepAlive(thinking, "remote");
18567
18599
  emitReadyIfIdle({
18568
18600
  pending,
18569
- queueSize: () => messageQueue.size(),
18601
+ // B-509: server-queued prompts count as pending input (no ready/push per item).
18602
+ queueSize: () => messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
18570
18603
  shouldExit,
18571
18604
  sendReady
18572
18605
  });
@@ -18577,6 +18610,7 @@ async function runCodex(opts) {
18577
18610
  }
18578
18611
  } finally {
18579
18612
  disposeTermination?.();
18613
+ session.closePromptQueueDrain();
18580
18614
  logger.debug("[codex]: Final cleanup start");
18581
18615
  logActiveHandles("cleanup-start");
18582
18616
  if (reconnectionHandle) {
@@ -18789,7 +18823,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18789
18823
  return;
18790
18824
  } else if (subcommand === "install-terminal-hooks") {
18791
18825
  try {
18792
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await import('./installTerminalHooks-ELDoqh0A.mjs');
18826
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await import('./installTerminalHooks-WeznjkuC.mjs');
18793
18827
  const command = parseTerminalHooksArgs(args.slice(1));
18794
18828
  if (command.action === "help") {
18795
18829
  console.log(TERMINAL_HOOKS_HELP);
@@ -18806,7 +18840,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18806
18840
  }
18807
18841
  } else if (subcommand === "agent-home") {
18808
18842
  try {
18809
- const { parseAgentHomeArgs, runAgentHomeCommand } = await import('./agentHome-BaJ9xtxB.mjs');
18843
+ const { parseAgentHomeArgs, runAgentHomeCommand } = await import('./agentHome-CvsJyeQB.mjs');
18810
18844
  await runAgentHomeCommand(parseAgentHomeArgs(args.slice(1)));
18811
18845
  process.exit(0);
18812
18846
  } catch (error) {
@@ -18815,7 +18849,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18815
18849
  }
18816
18850
  } else if (subcommand === "spawn") {
18817
18851
  try {
18818
- const { handleSpawnCommand } = await import('./spawn-CdihhwHs.mjs');
18852
+ const { handleSpawnCommand } = await import('./spawn-CPIWlPOM.mjs');
18819
18853
  await handleSpawnCommand(args.slice(1));
18820
18854
  } catch (error) {
18821
18855
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18827,7 +18861,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18827
18861
  return;
18828
18862
  } else if (subcommand === "sessions") {
18829
18863
  try {
18830
- const { handleSessionsCommand } = await import('./sessions-DsE01xKc.mjs');
18864
+ const { handleSessionsCommand } = await import('./sessions-CzIH2rGp.mjs');
18831
18865
  await handleSessionsCommand(args.slice(1));
18832
18866
  } catch (error) {
18833
18867
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18839,7 +18873,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18839
18873
  return;
18840
18874
  } else if (subcommand === "send") {
18841
18875
  try {
18842
- const { handleSendCommand } = await import('./send-D5CyRyZ_.mjs');
18876
+ const { handleSendCommand } = await import('./send-CLhYXNgy.mjs');
18843
18877
  await handleSendCommand(args.slice(1));
18844
18878
  } catch (error) {
18845
18879
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18945,9 +18979,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18945
18979
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
18946
18980
  const projectId = args[3];
18947
18981
  try {
18948
- const { saveGoogleCloudProjectToConfig } = await import('./config-aAbhJllb.mjs');
18949
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await import('./limits-A2c-3M-_.mjs').then(function (n) { return n.aO; });
18950
- const { ApiClient: ApiClient2 } = await import('./types-BrGJ7PJz.mjs').then(function (n) { return n.a1; });
18982
+ const { saveGoogleCloudProjectToConfig } = await import('./config-ClLtM6F3.mjs');
18983
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await import('./limits-CjRj8IX5.mjs').then(function (n) { return n.aP; });
18984
+ const { ApiClient: ApiClient2 } = await import('./types-Dh-s4Lqs.mjs').then(function (n) { return n.a1; });
18951
18985
  let userEmail = void 0;
18952
18986
  try {
18953
18987
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -18978,7 +19012,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18978
19012
  }
18979
19013
  if (geminiSubcommand === "project" && args[2] === "get") {
18980
19014
  try {
18981
- const { readGeminiLocalConfig } = await import('./config-aAbhJllb.mjs');
19015
+ const { readGeminiLocalConfig } = await import('./config-ClLtM6F3.mjs');
18982
19016
  const config = readGeminiLocalConfig();
18983
19017
  if (config.googleCloudProject) {
18984
19018
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -19018,7 +19052,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19018
19052
  process.exit(0);
19019
19053
  }
19020
19054
  try {
19021
- const { runGemini } = await import('./runGemini-Cj6oJQ-I.mjs');
19055
+ const { runGemini } = await import('./runGemini-DV6Ouadt.mjs');
19022
19056
  let startedBy = void 0;
19023
19057
  for (let i = 1; i < args.length; i++) {
19024
19058
  if (args[i] === "--started-by") {
@@ -19041,7 +19075,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19041
19075
  } else if (subcommand === "pi") {
19042
19076
  if (args[1] === "--terminal") {
19043
19077
  try {
19044
- const { runPiTerminal } = await import('./piTerminal-DwWmgumi.mjs');
19078
+ const { runPiTerminal } = await import('./piTerminal-B0fEOV_2.mjs');
19045
19079
  process.exitCode = await runPiTerminal(args.slice(2));
19046
19080
  } catch (error) {
19047
19081
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -19058,7 +19092,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19058
19092
  }
19059
19093
  };
19060
19094
  try {
19061
- const { runAcp, resolveAcpAgentConfig } = await import('./index-BVu8Cufk.mjs');
19095
+ const { runAcp, resolveAcpAgentConfig } = await import('./index-2mCaeKyf.mjs');
19062
19096
  const parsed = parsePiRunnerArgs(args.slice(1));
19063
19097
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
19064
19098
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -19086,7 +19120,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19086
19120
  return;
19087
19121
  } else if (subcommand === "acp") {
19088
19122
  try {
19089
- const { runAcp, resolveAcpAgentConfig } = await import('./index-BVu8Cufk.mjs');
19123
+ const { runAcp, resolveAcpAgentConfig } = await import('./index-2mCaeKyf.mjs');
19090
19124
  let startedBy = void 0;
19091
19125
  let verbose = false;
19092
19126
  const acpArgs = [];
@@ -19126,7 +19160,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19126
19160
  return;
19127
19161
  } else if (subcommand === "openclaw") {
19128
19162
  try {
19129
- const { runOpenClaw } = await import('./runOpenClaw-DUCQxkI-.mjs');
19163
+ const { runOpenClaw } = await import('./runOpenClaw-D7MlPS5n.mjs');
19130
19164
  let startedBy = void 0;
19131
19165
  let verbose = false;
19132
19166
  let gatewayUrl;
@@ -19177,7 +19211,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19177
19211
  return;
19178
19212
  } else if (subcommand === "todo") {
19179
19213
  try {
19180
- const { handleTodoCommand } = await import('./todo-CuQAkSp2.mjs');
19214
+ const { handleTodoCommand } = await import('./todo-Cknp5D4U.mjs');
19181
19215
  await handleTodoCommand(args.slice(1));
19182
19216
  } catch (error) {
19183
19217
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -19186,7 +19220,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19186
19220
  return;
19187
19221
  } else if (subcommand === "teams") {
19188
19222
  try {
19189
- const { handleTeamsCommand } = await import('./teams-BE8nMB6O.mjs');
19223
+ const { handleTeamsCommand } = await import('./teams-CEahj4cm.mjs');
19190
19224
  await handleTeamsCommand(args.slice(1));
19191
19225
  } catch (error) {
19192
19226
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -19195,7 +19229,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19195
19229
  return;
19196
19230
  } else if (subcommand === "auto") {
19197
19231
  try {
19198
- const { handleAutoCommand } = await import('./auto-B1YAwaeU.mjs');
19232
+ const { handleAutoCommand } = await import('./auto-nb8GhRRy.mjs');
19199
19233
  await handleAutoCommand(args.slice(1));
19200
19234
  } catch (error) {
19201
19235
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Automation command failed");
@@ -19207,7 +19241,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19207
19241
  return;
19208
19242
  } else if (subcommand === "mcp" && (args.length === 1 || args.length === 2 && args[1] === "--terminal-tools")) {
19209
19243
  try {
19210
- const { handleMcpCommand } = await import('./mcp-Bo934Kpy.mjs');
19244
+ const { handleMcpCommand } = await import('./mcp-Dy3f_K0h.mjs');
19211
19245
  await handleMcpCommand(args[1] === "--terminal-tools");
19212
19246
  } catch (error) {
19213
19247
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
@@ -1,11 +1,11 @@
1
- import { q as query } from './index-BYU1e81k.mjs';
1
+ import { q as query } from './index-BF6WfgV5.mjs';
2
2
  export { AbortError } from '@anthropic-ai/claude-agent-sdk';
3
3
  import 'chalk';
4
4
  import 'node:os';
5
5
  import 'node:crypto';
6
- import './types-BrGJ7PJz.mjs';
6
+ import './types-Dh-s4Lqs.mjs';
7
7
  import 'axios';
8
- import './limits-A2c-3M-_.mjs';
8
+ import './limits-CjRj8IX5.mjs';
9
9
  import 'zod';
10
10
  import '@paralleldrive/cuid2';
11
11
  import 'node:fs/promises';
@@ -30,7 +30,7 @@ import 'fs';
30
30
  import 'node:readline';
31
31
  import '@anthropic-ai/sandbox-runtime';
32
32
  import 'expo-server-sdk';
33
- import './agentGuidance-CU6YD_Ms.mjs';
33
+ import './agentGuidance-KgvYuF3R.mjs';
34
34
  import 'ink';
35
35
  import 'react';
36
36
  import 'ps-list';
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-C9QzZsUQ.cjs');
3
+ var index = require('./index-rH3DrQ5B.cjs');
4
4
  var claudeAgentSdk = require('@anthropic-ai/claude-agent-sdk');
5
5
  require('chalk');
6
6
  require('node:os');
7
7
  require('node:crypto');
8
- require('./types-B0sSi6eM.cjs');
8
+ require('./types-BbvK1Tr_.cjs');
9
9
  require('axios');
10
- require('./limits-CyuIt-Vl.cjs');
10
+ require('./limits-BH5CV5vR.cjs');
11
11
  require('zod');
12
12
  require('@paralleldrive/cuid2');
13
13
  require('node:fs/promises');
@@ -32,7 +32,7 @@ require('fs');
32
32
  require('node:readline');
33
33
  require('@anthropic-ai/sandbox-runtime');
34
34
  require('expo-server-sdk');
35
- require('./agentGuidance-Db76O1kw.cjs');
35
+ require('./agentGuidance-BRDN1NoZ.cjs');
36
36
  require('ink');
37
37
  require('react');
38
38
  require('ps-list');