very-happy-cli 0.2.158 → 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-DIDRig5G.cjs → AcpBackend-DUYFlyfN.cjs} +2 -2
  2. package/dist/{AcpBackend-vDVLHuYJ.mjs → AcpBackend-VsfkZiVF.mjs} +2 -2
  3. package/dist/{AcpSessionManager-C44U99CC.cjs → AcpSessionManager-Bdv8LWXh.cjs} +1 -1
  4. package/dist/{AcpSessionManager-CmRjfhn3.mjs → AcpSessionManager-rYtVb0kN.mjs} +1 -1
  5. package/dist/{agentGuidance-DwOWbX55.cjs → agentGuidance-BRDN1NoZ.cjs} +1 -1
  6. package/dist/{agentGuidance-CrR9l62U.mjs → agentGuidance-KgvYuF3R.mjs} +1 -1
  7. package/dist/{agentHome-Dw8Jx_CJ.cjs → agentHome-CHh4lmjM.cjs} +2 -2
  8. package/dist/{agentHome-CyLmGH5L.mjs → agentHome-CvsJyeQB.mjs} +2 -2
  9. package/dist/{auto-DZbNcTXx.cjs → auto-DKmEls8Z.cjs} +6 -6
  10. package/dist/{auto-BlMZPwOk.mjs → auto-nb8GhRRy.mjs} +6 -6
  11. package/dist/codex/happyMcpStdioBridge.cjs +2 -2
  12. package/dist/codex/happyMcpStdioBridge.mjs +2 -2
  13. package/dist/{config-BtPArqRH.mjs → config-ClLtM6F3.mjs} +4 -4
  14. package/dist/{config-DG84bjwF.cjs → config-DLx-vW3I.cjs} +4 -4
  15. package/dist/{index-ZChGsuB7.mjs → index-2mCaeKyf.mjs} +19 -9
  16. package/dist/{index-DPCsWlWK.cjs → index-BEOMECtE.cjs} +18 -8
  17. package/dist/{index-CVCt3kSt.mjs → index-BF6WfgV5.mjs} +62 -29
  18. package/dist/{index-DgO0FHOx.mjs → index-C-JazrMB.mjs} +4 -4
  19. package/dist/{index-D5ScEErM.cjs → index-blDSadUR.cjs} +4 -4
  20. package/dist/{index-BG932eCh.cjs → index-rH3DrQ5B.cjs} +66 -33
  21. package/dist/index.cjs +4 -4
  22. package/dist/index.mjs +4 -4
  23. package/dist/{install-wKQGgXvN.cjs → install-BOHrUaFM.cjs} +1 -1
  24. package/dist/{install-DarS_Wco.mjs → install-BPhJppvd.mjs} +1 -1
  25. package/dist/{installTerminalHooks-DcQfee_O.cjs → installTerminalHooks-Cou3WUf3.cjs} +4 -4
  26. package/dist/{installTerminalHooks-CpNbRFPz.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-kqFqhfsh.cjs → limits-BH5CV5vR.cjs} +38 -7
  32. package/dist/{limits-D2uN090G.mjs → limits-CjRj8IX5.mjs} +38 -8
  33. package/dist/{mcp-DGdeUUDJ.cjs → mcp-CPYbtsYG.cjs} +4 -4
  34. package/dist/{mcp-BN6bKIGb.mjs → mcp-Dy3f_K0h.mjs} +4 -4
  35. package/dist/{piRuntime-3qtbKujX.cjs → piRuntime-NtF0YqjH.cjs} +2 -2
  36. package/dist/{piRuntime-bkw2NAZU.mjs → piRuntime-kLZNpAAl.mjs} +2 -2
  37. package/dist/{piTerminal-BYxp3LMr.cjs → piTerminal-9J0GAKzb.cjs} +6 -6
  38. package/dist/{piTerminal-DilKwM7B.mjs → piTerminal-B0fEOV_2.mjs} +6 -6
  39. package/dist/{runGemini-Cjii069p.mjs → runGemini-DV6Ouadt.mjs} +6 -6
  40. package/dist/{runGemini-28O2sqyI.cjs → runGemini-F-mqx3_K.cjs} +6 -6
  41. package/dist/{runOpenClaw-jaLr7KF1.mjs → runOpenClaw-D7MlPS5n.mjs} +5 -5
  42. package/dist/{runOpenClaw-CiMZad-H.cjs → runOpenClaw-Qqo9j63M.cjs} +5 -5
  43. package/dist/{send-D5ejHPXG.cjs → send-4qJTCAYW.cjs} +2 -2
  44. package/dist/{send-C9mOtChi.mjs → send-CLhYXNgy.mjs} +2 -2
  45. package/dist/{sessions-BNMPQoLE.cjs → sessions-Bh1pyddi.cjs} +2 -2
  46. package/dist/{sessions-W6771g3X.mjs → sessions-CzIH2rGp.mjs} +2 -2
  47. package/dist/{spawn-D0QVhzRb.mjs → spawn-CPIWlPOM.mjs} +4 -4
  48. package/dist/{spawn-Ddtom1cb.cjs → spawn-CmFOSVdW.cjs} +4 -4
  49. package/dist/{teams-BZ1tayg_.cjs → teams-CB1R9-Z9.cjs} +5 -5
  50. package/dist/{teams-CqSwtw2O.mjs → teams-CEahj4cm.mjs} +5 -5
  51. package/dist/{todo-BbusB1zM.mjs → todo-Cknp5D4U.mjs} +2 -2
  52. package/dist/{todo-BYMg0fR0.cjs → todo-DqyRI4wP.cjs} +2 -2
  53. package/dist/{types-DnrPeN80.cjs → types-BbvK1Tr_.cjs} +191 -1
  54. package/dist/{types-DIBF4U0Y.mjs → types-Dh-s4Lqs.mjs} +191 -1
  55. package/package.json +7 -7
@@ -3,14 +3,14 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var index = require('./types-DnrPeN80.cjs');
7
- var persistence = require('./limits-kqFqhfsh.cjs');
6
+ var index = require('./types-BbvK1Tr_.cjs');
7
+ var persistence = require('./limits-BH5CV5vR.cjs');
8
8
  var spawn = require('cross-spawn');
9
9
  var path = require('node:path');
10
10
  var node_readline = require('node:readline');
11
11
  var node_fs = require('node:fs');
12
12
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
13
- var agentGuidance = require('./agentGuidance-DwOWbX55.cjs');
13
+ var agentGuidance = require('./agentGuidance-BRDN1NoZ.cjs');
14
14
  var promises = require('node:fs/promises');
15
15
  var fs = require('fs/promises');
16
16
  var ink = require('ink');
@@ -4336,7 +4336,7 @@ async function claudeRemoteLauncher(session, onPermissionModeChange, onEffective
4336
4336
  closeFailed: (error) => session.client.closeClaudeSessionTurn("failed", { error }),
4337
4337
  onFailed: (error) => session.onSessionError(error),
4338
4338
  onCompleted: () => {
4339
- const idle = !modeGate.hasParked && session.queue.size() === 0;
4339
+ const idle = !modeGate.hasParked && session.queue.size() === 0 && !session.client.promptQueueHasPending();
4340
4340
  session.onTurnEnd(idle);
4341
4341
  if (idle) {
4342
4342
  session.api.push().sendSessionNotification({
@@ -4492,6 +4492,12 @@ class MessageQueue2 {
4492
4492
  * so the web stops painting a silently-lost message as "queued".
4493
4493
  */
4494
4494
  onDiscardHandler = null;
4495
+ /**
4496
+ * B-509: fired when a consumer starts waiting on an EMPTY queue — the
4497
+ * runner has finished its turn and has nothing to run. The server-side
4498
+ * prompt queue drain uses it as its "idle" edge (utils/promptQueueDrain.ts).
4499
+ */
4500
+ onWaitHandler = null;
4495
4501
  modeHasher;
4496
4502
  constructor(modeHasher, onMessageHandler = null, onDiscardHandler = null) {
4497
4503
  this.modeHasher = modeHasher;
@@ -4512,6 +4518,14 @@ class MessageQueue2 {
4512
4518
  setOnDiscard(handler) {
4513
4519
  this.onDiscardHandler = handler;
4514
4520
  }
4521
+ /** B-509: observe the consumer blocking on an empty queue. */
4522
+ setOnWait(handler) {
4523
+ this.onWaitHandler = handler;
4524
+ }
4525
+ /** B-509: true while a consumer is blocked waiting for the next message. */
4526
+ isWaiting() {
4527
+ return this.waiter !== null;
4528
+ }
4515
4529
  /** Report the current items as destroyed for `reason` (caller clears next). */
4516
4530
  notifyDiscard(reason) {
4517
4531
  if (this.queue.length === 0) return;
@@ -4772,6 +4786,7 @@ class MessageQueue2 {
4772
4786
  }
4773
4787
  this.waiter = waiterFunc;
4774
4788
  persistence.logger.debug("[MessageQueue2] Waiting for messages...");
4789
+ this.onWaitHandler?.();
4775
4790
  });
4776
4791
  }
4777
4792
  }
@@ -4912,6 +4927,7 @@ function createSessionMetadata(opts) {
4912
4927
  dangerouslySkipPermissions: opts.dangerouslySkipPermissions ?? null,
4913
4928
  ...opts.parentSessionId ? { parentSessionId: opts.parentSessionId } : {},
4914
4929
  ...opts.forkedFromMessageId ? { forkedFromMessageId: opts.forkedFromMessageId } : {},
4930
+ ...opts.capabilities ? { capabilities: [...opts.capabilities] } : {},
4915
4931
  // B-091/B-303: dispatched sessions carry their spawn origin as a tag
4916
4932
  // from birth (see spawnOriginTags) — applies to every flavor the daemon
4917
4933
  // can spawn, since HAPPY_SPAWNED_BY is exported flavor-independently.
@@ -5424,8 +5440,8 @@ ${typeLabels[type] || type}:`));
5424
5440
  }
5425
5441
  console.log(chalk.gray(" An external claude command is only needed for native terminal/mirror use."));
5426
5442
  try {
5427
- const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-Dw8Jx_CJ.cjs'); });
5428
- const { describeAgentHome } = await Promise.resolve().then(function () { return require('./types-DnrPeN80.cjs'); }).then(function (n) { return n.index; });
5443
+ const { resolveAgentHomesForCli } = await Promise.resolve().then(function () { return require('./agentHome-CHh4lmjM.cjs'); });
5444
+ const { describeAgentHome } = await Promise.resolve().then(function () { return require('./types-BbvK1Tr_.cjs'); }).then(function (n) { return n.index; });
5429
5445
  const homes = await resolveAgentHomesForCli();
5430
5446
  console.log(chalk.green(`\u2713 Claude config dir: ${describeAgentHome(homes.claudeConfigDir)}`));
5431
5447
  console.log(chalk.green(`\u2713 Codex home: ${describeAgentHome(homes.codexHome)}`));
@@ -8654,7 +8670,7 @@ function parseJsonObject(text) {
8654
8670
  return null;
8655
8671
  }
8656
8672
  }
8657
- function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BG932eCh.cjs', document.baseURI).href))).resolve(s)) {
8673
+ function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-rH3DrQ5B.cjs', document.baseURI).href))).resolve(s)) {
8658
8674
  const platformArch = `${platform}-${arch}`;
8659
8675
  const candidates = [
8660
8676
  `@anthropic-ai/claude-agent-sdk-${platformArch}/claude`,
@@ -13504,7 +13520,7 @@ function registerSideQuestionHandler(rpc, deps) {
13504
13520
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
13505
13521
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
13506
13522
  const fork = deps.run ?? (async (input) => {
13507
- const { query } = await Promise.resolve().then(function () { return require('./index-D5ScEErM.cjs'); });
13523
+ const { query } = await Promise.resolve().then(function () { return require('./index-blDSadUR.cjs'); });
13508
13524
  return runSideQuestion(query, input);
13509
13525
  });
13510
13526
  const run = async (input, live) => {
@@ -13623,7 +13639,7 @@ const MAX_TITLE_CHARS = 60;
13623
13639
  const GENERATION_TIMEOUT_MS = 3e4;
13624
13640
  function resolveClaudeBinary() {
13625
13641
  try {
13626
- 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-BG932eCh.cjs', document.baseURI).href)));
13642
+ 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-rH3DrQ5B.cjs', document.baseURI).href)));
13627
13643
  const utilsPath = path.resolve(path.join(terminalTitleSuggest.projectPath(), "scripts", "claude_version_utils.cjs"));
13628
13644
  const { getClaudeCliPath } = require$1(utilsPath);
13629
13645
  const path$1 = getClaudeCliPath();
@@ -14090,7 +14106,7 @@ async function runClaude(credentials, options = {}) {
14090
14106
  // a brand-new session cannot pick a PDF until after sending once.
14091
14107
  attachmentKinds: [...CLAUDE_ATTACHMENT_KINDS],
14092
14108
  queueCancellation: true,
14093
- capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1"],
14109
+ capabilities: ["claude-steer-v1", "claude-live-permission-v1", "claude-live-permission-v2", "claude-btw-v1", "claude-runtime-controls-v1", "claude-opus-5-5-v1", persistence.PROMPT_QUEUE_CAPABILITY],
14094
14110
  // Effective mode this process enforces. Kept current by
14095
14111
  // publishPermissionMode below; the web renders it instead of guessing.
14096
14112
  permissionMode: mapToClaudeMode(initialPermissionMode ?? "default"),
@@ -14346,6 +14362,10 @@ async function runClaude(credentials, options = {}) {
14346
14362
  controlledByUser: options.startingMode !== "remote"
14347
14363
  }));
14348
14364
  const messageQueue = new MessageQueue2(claudeModeHash);
14365
+ const promptQueueDrain = session.attachPromptQueueDrain({
14366
+ isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
14367
+ });
14368
+ messageQueue.setOnWait(() => promptQueueDrain.onIdle());
14349
14369
  messageQueue.setOnDiscard((entries) => {
14350
14370
  const byReason = /* @__PURE__ */ new Map();
14351
14371
  for (const entry of entries) {
@@ -14649,6 +14669,7 @@ async function runClaude(credentials, options = {}) {
14649
14669
  return;
14650
14670
  }
14651
14671
  persistence.logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
14672
+ promptQueueDrain.close();
14652
14673
  try {
14653
14674
  if (session) {
14654
14675
  currentSession?.cleanup();
@@ -15867,9 +15888,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
15867
15888
  };
15868
15889
  }
15869
15890
 
15870
- 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-BG932eCh.cjs', document.baseURI).href)));
15891
+ 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-rH3DrQ5B.cjs', document.baseURI).href)));
15871
15892
  const __dirname$1 = path.dirname(__filename$1);
15872
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BG932eCh.cjs', document.baseURI).href)));
15893
+ const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-rH3DrQ5B.cjs', document.baseURI).href)));
15873
15894
  const PRISMA_QUERY_ENGINE_FILES = {
15874
15895
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
15875
15896
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -17910,7 +17931,8 @@ async function runCodex(opts) {
17910
17931
  sandbox: sandboxConfig,
17911
17932
  dangerouslySkipPermissions: initialPermissionMode === "yolo" || initialPermissionMode === "bypassPermissions",
17912
17933
  ...forkedFromSessionId ? { parentSessionId: forkedFromSessionId } : {},
17913
- ...forkedFromMessageId ? { forkedFromMessageId } : {}
17934
+ ...forkedFromMessageId ? { forkedFromMessageId } : {},
17935
+ capabilities: [persistence.PROMPT_QUEUE_CAPABILITY]
17914
17936
  });
17915
17937
  metadata.attachmentKinds = [...CLAUDE_ATTACHMENT_KINDS];
17916
17938
  const importCodexThreadId = process.env[IMPORT_CODEX_THREAD_ENV];
@@ -17977,6 +17999,7 @@ async function runCodex(opts) {
17977
17999
  if (permissionHandler) {
17978
18000
  permissionHandler.updateSession(newSession);
17979
18001
  }
18002
+ attachPromptQueueDrain(newSession);
17980
18003
  }
17981
18004
  });
17982
18005
  session = initialSession;
@@ -18006,6 +18029,13 @@ async function runCodex(opts) {
18006
18029
  }
18007
18030
  }
18008
18031
  const messageQueue = new MessageQueue2(hashCodexEnhancedMode);
18032
+ function attachPromptQueueDrain(client2) {
18033
+ const drain = client2.attachPromptQueueDrain({
18034
+ isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
18035
+ });
18036
+ messageQueue.setOnWait(() => drain.onIdle());
18037
+ }
18038
+ attachPromptQueueDrain(session);
18009
18039
  messageQueue.setOnDiscard((entries) => {
18010
18040
  const keys = entries.map((entry) => entry.sourceId).filter((key) => typeof key === "string");
18011
18041
  if (keys.length > 0) session.sendQueueCancelReason(keys, entries[0].reason);
@@ -18511,7 +18541,8 @@ async function runCodex(opts) {
18511
18541
  });
18512
18542
  emitReadyIfIdle({
18513
18543
  pending,
18514
- queueSize: () => messageQueue.size(),
18544
+ // B-509: server-queued prompts count as pending input (no ready/push per item).
18545
+ queueSize: () => messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
18515
18546
  shouldExit,
18516
18547
  sendReady
18517
18548
  });
@@ -18589,7 +18620,8 @@ async function runCodex(opts) {
18589
18620
  session.keepAlive(thinking, "remote");
18590
18621
  emitReadyIfIdle({
18591
18622
  pending,
18592
- queueSize: () => messageQueue.size(),
18623
+ // B-509: server-queued prompts count as pending input (no ready/push per item).
18624
+ queueSize: () => messageQueue.size() + (session.promptQueueHasPending() ? 1 : 0),
18593
18625
  shouldExit,
18594
18626
  sendReady
18595
18627
  });
@@ -18600,6 +18632,7 @@ async function runCodex(opts) {
18600
18632
  }
18601
18633
  } finally {
18602
18634
  disposeTermination?.();
18635
+ session.closePromptQueueDrain();
18603
18636
  persistence.logger.debug("[codex]: Final cleanup start");
18604
18637
  logActiveHandles("cleanup-start");
18605
18638
  if (reconnectionHandle) {
@@ -18812,7 +18845,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18812
18845
  return;
18813
18846
  } else if (subcommand === "install-terminal-hooks") {
18814
18847
  try {
18815
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-DcQfee_O.cjs'); });
18848
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-Cou3WUf3.cjs'); });
18816
18849
  const command = parseTerminalHooksArgs(args.slice(1));
18817
18850
  if (command.action === "help") {
18818
18851
  console.log(TERMINAL_HOOKS_HELP);
@@ -18829,7 +18862,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18829
18862
  }
18830
18863
  } else if (subcommand === "agent-home") {
18831
18864
  try {
18832
- const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-Dw8Jx_CJ.cjs'); });
18865
+ const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-CHh4lmjM.cjs'); });
18833
18866
  await runAgentHomeCommand(parseAgentHomeArgs(args.slice(1)));
18834
18867
  process.exit(0);
18835
18868
  } catch (error) {
@@ -18838,7 +18871,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18838
18871
  }
18839
18872
  } else if (subcommand === "spawn") {
18840
18873
  try {
18841
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-Ddtom1cb.cjs'); });
18874
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-CmFOSVdW.cjs'); });
18842
18875
  await handleSpawnCommand(args.slice(1));
18843
18876
  } catch (error) {
18844
18877
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18850,7 +18883,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18850
18883
  return;
18851
18884
  } else if (subcommand === "sessions") {
18852
18885
  try {
18853
- const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-BNMPQoLE.cjs'); });
18886
+ const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-Bh1pyddi.cjs'); });
18854
18887
  await handleSessionsCommand(args.slice(1));
18855
18888
  } catch (error) {
18856
18889
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18862,7 +18895,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18862
18895
  return;
18863
18896
  } else if (subcommand === "send") {
18864
18897
  try {
18865
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-D5ejHPXG.cjs'); });
18898
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-4qJTCAYW.cjs'); });
18866
18899
  await handleSendCommand(args.slice(1));
18867
18900
  } catch (error) {
18868
18901
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18968,9 +19001,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18968
19001
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
18969
19002
  const projectId = args[3];
18970
19003
  try {
18971
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DG84bjwF.cjs'); });
18972
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-kqFqhfsh.cjs'); }).then(function (n) { return n.persistence; });
18973
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-DnrPeN80.cjs'); }).then(function (n) { return n.api; });
19004
+ const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-DLx-vW3I.cjs'); });
19005
+ const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-BH5CV5vR.cjs'); }).then(function (n) { return n.persistence; });
19006
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-BbvK1Tr_.cjs'); }).then(function (n) { return n.api; });
18974
19007
  let userEmail = void 0;
18975
19008
  try {
18976
19009
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -19001,7 +19034,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19001
19034
  }
19002
19035
  if (geminiSubcommand === "project" && args[2] === "get") {
19003
19036
  try {
19004
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DG84bjwF.cjs'); });
19037
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DLx-vW3I.cjs'); });
19005
19038
  const config = readGeminiLocalConfig();
19006
19039
  if (config.googleCloudProject) {
19007
19040
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -19041,7 +19074,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19041
19074
  process.exit(0);
19042
19075
  }
19043
19076
  try {
19044
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-28O2sqyI.cjs'); });
19077
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-F-mqx3_K.cjs'); });
19045
19078
  let startedBy = void 0;
19046
19079
  for (let i = 1; i < args.length; i++) {
19047
19080
  if (args[i] === "--started-by") {
@@ -19064,7 +19097,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19064
19097
  } else if (subcommand === "pi") {
19065
19098
  if (args[1] === "--terminal") {
19066
19099
  try {
19067
- const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-BYxp3LMr.cjs'); });
19100
+ const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-9J0GAKzb.cjs'); });
19068
19101
  process.exitCode = await runPiTerminal(args.slice(2));
19069
19102
  } catch (error) {
19070
19103
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -19081,7 +19114,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19081
19114
  }
19082
19115
  };
19083
19116
  try {
19084
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-DPCsWlWK.cjs'); });
19117
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-BEOMECtE.cjs'); });
19085
19118
  const parsed = parsePiRunnerArgs(args.slice(1));
19086
19119
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
19087
19120
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -19109,7 +19142,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19109
19142
  return;
19110
19143
  } else if (subcommand === "acp") {
19111
19144
  try {
19112
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-DPCsWlWK.cjs'); });
19145
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-BEOMECtE.cjs'); });
19113
19146
  let startedBy = void 0;
19114
19147
  let verbose = false;
19115
19148
  const acpArgs = [];
@@ -19149,7 +19182,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19149
19182
  return;
19150
19183
  } else if (subcommand === "openclaw") {
19151
19184
  try {
19152
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-CiMZad-H.cjs'); });
19185
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-Qqo9j63M.cjs'); });
19153
19186
  let startedBy = void 0;
19154
19187
  let verbose = false;
19155
19188
  let gatewayUrl;
@@ -19200,7 +19233,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19200
19233
  return;
19201
19234
  } else if (subcommand === "todo") {
19202
19235
  try {
19203
- const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-BYMg0fR0.cjs'); });
19236
+ const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-DqyRI4wP.cjs'); });
19204
19237
  await handleTodoCommand(args.slice(1));
19205
19238
  } catch (error) {
19206
19239
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -19209,7 +19242,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19209
19242
  return;
19210
19243
  } else if (subcommand === "teams") {
19211
19244
  try {
19212
- const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-BZ1tayg_.cjs'); });
19245
+ const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-CB1R9-Z9.cjs'); });
19213
19246
  await handleTeamsCommand(args.slice(1));
19214
19247
  } catch (error) {
19215
19248
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -19218,7 +19251,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19218
19251
  return;
19219
19252
  } else if (subcommand === "auto") {
19220
19253
  try {
19221
- const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-DZbNcTXx.cjs'); });
19254
+ const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-DKmEls8Z.cjs'); });
19222
19255
  await handleAutoCommand(args.slice(1));
19223
19256
  } catch (error) {
19224
19257
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Automation command failed");
@@ -19230,7 +19263,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19230
19263
  return;
19231
19264
  } else if (subcommand === "mcp" && (args.length === 1 || args.length === 2 && args[1] === "--terminal-tools")) {
19232
19265
  try {
19233
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-DGdeUUDJ.cjs'); });
19266
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-CPYbtsYG.cjs'); });
19234
19267
  await handleMcpCommand(args[1] === "--terminal-tools");
19235
19268
  } catch (error) {
19236
19269
  process.stderr.write(`[very-happy mcp] Fatal: ${error instanceof Error ? error.message : String(error)}
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-BG932eCh.cjs');
5
- require('./limits-kqFqhfsh.cjs');
4
+ require('./index-rH3DrQ5B.cjs');
5
+ require('./limits-BH5CV5vR.cjs');
6
6
  require('zod');
7
- require('./types-DnrPeN80.cjs');
7
+ require('./types-BbvK1Tr_.cjs');
8
8
  require('node:child_process');
9
9
  require('node:os');
10
10
  require('node:crypto');
@@ -15,7 +15,7 @@ require('node:fs');
15
15
  require('./terminalTitleSuggest-Dji8I0Jy.cjs');
16
16
  require('path');
17
17
  require('url');
18
- require('./agentGuidance-DwOWbX55.cjs');
18
+ require('./agentGuidance-BRDN1NoZ.cjs');
19
19
  require('node:fs/promises');
20
20
  require('axios');
21
21
  require('socket.io-client');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'chalk';
2
- import './index-CVCt3kSt.mjs';
3
- import './limits-D2uN090G.mjs';
2
+ import './index-BF6WfgV5.mjs';
3
+ import './limits-CjRj8IX5.mjs';
4
4
  import 'zod';
5
- import './types-DIBF4U0Y.mjs';
5
+ import './types-Dh-s4Lqs.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:os';
8
8
  import 'node:crypto';
@@ -13,7 +13,7 @@ import 'node:fs';
13
13
  import './terminalTitleSuggest-DKgX3osW.mjs';
14
14
  import 'path';
15
15
  import 'url';
16
- import './agentGuidance-CrR9l62U.mjs';
16
+ import './agentGuidance-KgvYuF3R.mjs';
17
17
  import 'node:fs/promises';
18
18
  import 'axios';
19
19
  import 'socket.io-client';
@@ -3,7 +3,7 @@
3
3
  var node_crypto = require('node:crypto');
4
4
  var promises = require('node:fs/promises');
5
5
  var path = require('node:path');
6
- var index = require('./index-BG932eCh.cjs');
6
+ var index = require('./index-rH3DrQ5B.cjs');
7
7
 
8
8
  async function assertPrivateDestination(directory) {
9
9
  for (let path$1 = directory; ; path$1 = path.dirname(path$1)) {
@@ -1,7 +1,7 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
2
  import { unlink, rmdir, mkdir, lstat, readFile, writeFile, rename } from 'node:fs/promises';
3
3
  import { join, resolve, dirname } from 'node:path';
4
- import { T as TEAM_SKILL } from './index-CVCt3kSt.mjs';
4
+ import { T as TEAM_SKILL } from './index-BF6WfgV5.mjs';
5
5
 
6
6
  async function assertPrivateDestination(directory) {
7
7
  for (let path = directory; ; path = dirname(path)) {
@@ -6,14 +6,14 @@ var os = require('node:os');
6
6
  var node_child_process = require('node:child_process');
7
7
  var chalk = require('chalk');
8
8
  var terminalTitleSuggest = require('./terminalTitleSuggest-Dji8I0Jy.cjs');
9
- var index = require('./index-BG932eCh.cjs');
9
+ var index = require('./index-rH3DrQ5B.cjs');
10
10
  require('path');
11
11
  require('url');
12
12
  require('zod');
13
13
  require('node:crypto');
14
- require('./types-DnrPeN80.cjs');
14
+ require('./types-BbvK1Tr_.cjs');
15
15
  require('axios');
16
- require('./limits-kqFqhfsh.cjs');
16
+ require('./limits-BH5CV5vR.cjs');
17
17
  require('@paralleldrive/cuid2');
18
18
  require('node:fs/promises');
19
19
  require('tweetnacl');
@@ -31,7 +31,7 @@ require('fs');
31
31
  require('node:readline');
32
32
  require('@anthropic-ai/sandbox-runtime');
33
33
  require('expo-server-sdk');
34
- require('./agentGuidance-DwOWbX55.cjs');
34
+ require('./agentGuidance-BRDN1NoZ.cjs');
35
35
  require('ink');
36
36
  require('react');
37
37
  require('@anthropic-ai/claude-agent-sdk');
@@ -4,14 +4,14 @@ import { homedir } from 'node:os';
4
4
  import { spawnSync } from 'node:child_process';
5
5
  import chalk from 'chalk';
6
6
  import { p as projectPath } from './terminalTitleSuggest-DKgX3osW.mjs';
7
- import { b as tmuxSupportsSessionEnv } from './index-CVCt3kSt.mjs';
7
+ import { b as tmuxSupportsSessionEnv } from './index-BF6WfgV5.mjs';
8
8
  import 'path';
9
9
  import 'url';
10
10
  import 'zod';
11
11
  import 'node:crypto';
12
- import './types-DIBF4U0Y.mjs';
12
+ import './types-Dh-s4Lqs.mjs';
13
13
  import 'axios';
14
- import './limits-D2uN090G.mjs';
14
+ import './limits-CjRj8IX5.mjs';
15
15
  import '@paralleldrive/cuid2';
16
16
  import 'node:fs/promises';
17
17
  import 'tweetnacl';
@@ -29,7 +29,7 @@ import 'fs';
29
29
  import 'node:readline';
30
30
  import '@anthropic-ai/sandbox-runtime';
31
31
  import 'expo-server-sdk';
32
- import './agentGuidance-CrR9l62U.mjs';
32
+ import './agentGuidance-KgvYuF3R.mjs';
33
33
  import 'ink';
34
34
  import 'react';
35
35
  import '@anthropic-ai/claude-agent-sdk';
package/dist/lib.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./types-DnrPeN80.cjs');
4
- var persistence = require('./limits-kqFqhfsh.cjs');
3
+ var index = require('./types-BbvK1Tr_.cjs');
4
+ var persistence = require('./limits-BH5CV5vR.cjs');
5
5
  require('axios');
6
6
  require('node:events');
7
7
  require('socket.io-client');
package/dist/lib.d.cts CHANGED
@@ -888,6 +888,104 @@ declare class RpcHandlerManager {
888
888
  private getPrefixedMethod;
889
889
  }
890
890
 
891
+ /**
892
+ * B-509 —— server-side prompt queue drain (pure state machine, no I/O).
893
+ *
894
+ * The web no longer releases queued prompts itself; it stores them on the
895
+ * server (`/v1/sessions/:id/prompt-queue`). This process asks the server to
896
+ * pop the head item into an ordinary user message (`POST …/dispatch`) exactly
897
+ * when the runner is idle: its `MessageQueue2` is empty AND a consumer is
898
+ * blocked waiting for the next message (the turn is over). The dispatched
899
+ * message then arrives through the normal socket / catch-up path and is
900
+ * routed like anything the user typed — so it starts a turn of its own,
901
+ * never merged with a sibling (one item per turn).
902
+ *
903
+ * Guards, in order:
904
+ * - `closed` / `disabled` (404 from an old server → never retried);
905
+ * - a dispatch already in progress;
906
+ * - an `inflight` item whose message has not been routed yet (cleared by
907
+ * `onInbound(localId)`; released by timeout so a lost socket cannot wedge
908
+ * the queue — the catch-up fetch still delivers it in seq order);
909
+ * - an error backoff window;
910
+ * - `isIdle()` false.
911
+ */
912
+ type PromptQueueDispatchOutcome =
913
+ /** `remaining` = items still queued after this pop; `created:false` = the message row pre-existed (replayed localId) — nothing new will be routed. */
914
+ {
915
+ kind: 'dispatched';
916
+ localId: string;
917
+ remaining?: number;
918
+ created?: boolean;
919
+ } | {
920
+ kind: 'empty';
921
+ } | {
922
+ kind: 'unsupported';
923
+ } | {
924
+ kind: 'error';
925
+ message: string;
926
+ };
927
+ type PromptQueueDrainDeps = {
928
+ isIdle: () => boolean;
929
+ dispatch: () => Promise<PromptQueueDispatchOutcome>;
930
+ now?: () => number;
931
+ log?: (message: string) => void;
932
+ /** Schedules a retry after an error; default `setTimeout` (unref'd). */
933
+ schedule?: (fn: () => void, delayMs: number) => void;
934
+ inflightTimeoutMs?: number;
935
+ };
936
+ declare class PromptQueueDrain {
937
+ private readonly deps;
938
+ private inflight;
939
+ /**
940
+ * localIds routed while a dispatch call was still in flight. The server's
941
+ * `new-message` echo regularly beats the HTTP response (both come off the
942
+ * same transaction), so `onInbound` can precede the `dispatched` outcome;
943
+ * without this the guard armed AFTER the message had arrived and sat
944
+ * until the timeout — observed in the first isolated e2e run.
945
+ */
946
+ private arrivedDuringDispatch;
947
+ /** Items the server still holds, from the last snapshot / dispatch response. */
948
+ private pending;
949
+ private disabled;
950
+ private closed;
951
+ private busy;
952
+ private failures;
953
+ private retryAt;
954
+ private retryScheduled;
955
+ private readonly now;
956
+ private readonly log;
957
+ private readonly schedule;
958
+ private readonly inflightTimeoutMs;
959
+ constructor(deps: PromptQueueDrainDeps);
960
+ /** The runner is blocked on an empty input queue. */
961
+ onIdle(): void;
962
+ /** A `prompt-queue` snapshot arrived; only a non-empty queue is worth a call. */
963
+ onQueueChanged(count: number): void;
964
+ /**
965
+ * True while the server still holds queued prompts for this session. The
966
+ * runners fold it into their "idle, waiting for the user" judgement so a
967
+ * turn that ends with more queue behind it raises no reply_done /
968
+ * input_needed notification and no daemon `completed` report per item.
969
+ */
970
+ hasPending(): boolean;
971
+ /** A user message with this localId was routed into the runner's queue. */
972
+ onInbound(localId: string): void;
973
+ close(): void;
974
+ state(): {
975
+ inflight: {
976
+ localId: string;
977
+ since: number;
978
+ } | null;
979
+ disabled: boolean;
980
+ busy: boolean;
981
+ failures: number;
982
+ retryAt: number;
983
+ pending: number;
984
+ };
985
+ maybeDispatch(reason: string): Promise<boolean>;
986
+ private scheduleRetry;
987
+ }
988
+
891
989
  /**
892
990
  * ACP (Agent Communication Protocol) message data types.
893
991
  * This is the unified format for all agent messages - CLI adapts each provider's format to ACP.
@@ -988,6 +1086,8 @@ declare class ApiSessionClient extends EventEmitter {
988
1086
  * must wait for the first fetch, otherwise a message that lands between
989
1087
  * the seed and the first fetch is routed twice (socket + fetch). */
990
1088
  private awaitingInitialFetch;
1089
+ /** B-509: server-side prompt queue drain, attached by the runner. */
1090
+ private promptQueueDrain;
991
1091
  constructor(token: string, session: Session, opts?: {
992
1092
  initialSeq?: number;
993
1093
  });
@@ -1037,6 +1137,20 @@ declare class ApiSessionClient extends EventEmitter {
1037
1137
  name: string;
1038
1138
  }>>;
1039
1139
  private authHeaders;
1140
+ /**
1141
+ * B-509: attach the server-side prompt queue drain. `isIdle` is the
1142
+ * runner's own notion (input queue empty + blocked waiting); dispatching is
1143
+ * `POST /v1/sessions/:id/prompt-queue/dispatch`, whose message then comes
1144
+ * back through the ordinary socket / catch-up path and is routed below.
1145
+ */
1146
+ attachPromptQueueDrain(opts: {
1147
+ isIdle: () => boolean;
1148
+ }): PromptQueueDrain;
1149
+ /** B-509: the server still holds queued prompts for this session (see PromptQueueDrain.hasPending). */
1150
+ promptQueueHasPending(): boolean;
1151
+ /** B-509: stop draining before the process winds down (cleanup's first line). */
1152
+ closePromptQueueDrain(): void;
1153
+ private dispatchPromptQueueHead;
1040
1154
  private routeIncomingMessage;
1041
1155
  private fetchMessages;
1042
1156
  private static readonly MAX_OUTBOX_BATCH_SIZE;