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
@@ -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-B0sSi6eM.cjs');
7
- var persistence = require('./limits-CyuIt-Vl.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-Db76O1kw.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-B0CLy0Qx.cjs'); });
5428
- const { describeAgentHome } = await Promise.resolve().then(function () { return require('./types-B0sSi6eM.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-C9QzZsUQ.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`,
@@ -10917,6 +10933,7 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
10917
10933
  for (const item of tracked.values()) {
10918
10934
  if (item.sessionId !== sessionId) continue;
10919
10935
  if (event === "exited") item.exited = true;
10936
+ if (event === "idle") item.attentionReported = false;
10920
10937
  if (event === "blocked" && !item.attentionReported) {
10921
10938
  item.attentionReported = true;
10922
10939
  void client.report(item.runId, { claimId: item.claimId, needsAttention: true, attentionReason: "needs_input" }).catch(() => deps.log(`Automation run ${item.runId} attention report failed`));
@@ -13503,7 +13520,7 @@ function registerSideQuestionHandler(rpc, deps) {
13503
13520
  const retainMs = deps.retainMs ?? SIDE_QUESTION_RETAIN_MS;
13504
13521
  const maxRunMs = deps.maxRunMs ?? SIDE_QUESTION_MAX_RUN_MS;
13505
13522
  const fork = deps.run ?? (async (input) => {
13506
- const { query } = await Promise.resolve().then(function () { return require('./index-Cz-uqnJk.cjs'); });
13523
+ const { query } = await Promise.resolve().then(function () { return require('./index-blDSadUR.cjs'); });
13507
13524
  return runSideQuestion(query, input);
13508
13525
  });
13509
13526
  const run = async (input, live) => {
@@ -13622,7 +13639,7 @@ const MAX_TITLE_CHARS = 60;
13622
13639
  const GENERATION_TIMEOUT_MS = 3e4;
13623
13640
  function resolveClaudeBinary() {
13624
13641
  try {
13625
- 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-C9QzZsUQ.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)));
13626
13643
  const utilsPath = path.resolve(path.join(terminalTitleSuggest.projectPath(), "scripts", "claude_version_utils.cjs"));
13627
13644
  const { getClaudeCliPath } = require$1(utilsPath);
13628
13645
  const path$1 = getClaudeCliPath();
@@ -14089,7 +14106,7 @@ async function runClaude(credentials, options = {}) {
14089
14106
  // a brand-new session cannot pick a PDF until after sending once.
14090
14107
  attachmentKinds: [...CLAUDE_ATTACHMENT_KINDS],
14091
14108
  queueCancellation: true,
14092
- 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],
14093
14110
  // Effective mode this process enforces. Kept current by
14094
14111
  // publishPermissionMode below; the web renders it instead of guessing.
14095
14112
  permissionMode: mapToClaudeMode(initialPermissionMode ?? "default"),
@@ -14345,6 +14362,10 @@ async function runClaude(credentials, options = {}) {
14345
14362
  controlledByUser: options.startingMode !== "remote"
14346
14363
  }));
14347
14364
  const messageQueue = new MessageQueue2(claudeModeHash);
14365
+ const promptQueueDrain = session.attachPromptQueueDrain({
14366
+ isIdle: () => messageQueue.size() === 0 && messageQueue.isWaiting()
14367
+ });
14368
+ messageQueue.setOnWait(() => promptQueueDrain.onIdle());
14348
14369
  messageQueue.setOnDiscard((entries) => {
14349
14370
  const byReason = /* @__PURE__ */ new Map();
14350
14371
  for (const entry of entries) {
@@ -14648,6 +14669,7 @@ async function runClaude(credentials, options = {}) {
14648
14669
  return;
14649
14670
  }
14650
14671
  persistence.logger.debug(`[START] Received termination signal, cleaning up (archive=${intent === "archive"})...`);
14672
+ promptQueueDrain.close();
14651
14673
  try {
14652
14674
  if (session) {
14653
14675
  currentSession?.cleanup();
@@ -15866,9 +15888,9 @@ function resolveLocalSignupBootstrap(configuredMode, configuredInviteCodes, gene
15866
15888
  };
15867
15889
  }
15868
15890
 
15869
- 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-C9QzZsUQ.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)));
15870
15892
  const __dirname$1 = path.dirname(__filename$1);
15871
- const require_ = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-C9QzZsUQ.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)));
15872
15894
  const PRISMA_QUERY_ENGINE_FILES = {
15873
15895
  "arm64-darwin": "libquery_engine-darwin-arm64.dylib.node",
15874
15896
  "x64-darwin": "libquery_engine-darwin.dylib.node",
@@ -17909,7 +17931,8 @@ async function runCodex(opts) {
17909
17931
  sandbox: sandboxConfig,
17910
17932
  dangerouslySkipPermissions: initialPermissionMode === "yolo" || initialPermissionMode === "bypassPermissions",
17911
17933
  ...forkedFromSessionId ? { parentSessionId: forkedFromSessionId } : {},
17912
- ...forkedFromMessageId ? { forkedFromMessageId } : {}
17934
+ ...forkedFromMessageId ? { forkedFromMessageId } : {},
17935
+ capabilities: [persistence.PROMPT_QUEUE_CAPABILITY]
17913
17936
  });
17914
17937
  metadata.attachmentKinds = [...CLAUDE_ATTACHMENT_KINDS];
17915
17938
  const importCodexThreadId = process.env[IMPORT_CODEX_THREAD_ENV];
@@ -17976,6 +17999,7 @@ async function runCodex(opts) {
17976
17999
  if (permissionHandler) {
17977
18000
  permissionHandler.updateSession(newSession);
17978
18001
  }
18002
+ attachPromptQueueDrain(newSession);
17979
18003
  }
17980
18004
  });
17981
18005
  session = initialSession;
@@ -18005,6 +18029,13 @@ async function runCodex(opts) {
18005
18029
  }
18006
18030
  }
18007
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);
18008
18039
  messageQueue.setOnDiscard((entries) => {
18009
18040
  const keys = entries.map((entry) => entry.sourceId).filter((key) => typeof key === "string");
18010
18041
  if (keys.length > 0) session.sendQueueCancelReason(keys, entries[0].reason);
@@ -18510,7 +18541,8 @@ async function runCodex(opts) {
18510
18541
  });
18511
18542
  emitReadyIfIdle({
18512
18543
  pending,
18513
- 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),
18514
18546
  shouldExit,
18515
18547
  sendReady
18516
18548
  });
@@ -18588,7 +18620,8 @@ async function runCodex(opts) {
18588
18620
  session.keepAlive(thinking, "remote");
18589
18621
  emitReadyIfIdle({
18590
18622
  pending,
18591
- 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),
18592
18625
  shouldExit,
18593
18626
  sendReady
18594
18627
  });
@@ -18599,6 +18632,7 @@ async function runCodex(opts) {
18599
18632
  }
18600
18633
  } finally {
18601
18634
  disposeTermination?.();
18635
+ session.closePromptQueueDrain();
18602
18636
  persistence.logger.debug("[codex]: Final cleanup start");
18603
18637
  logActiveHandles("cleanup-start");
18604
18638
  if (reconnectionHandle) {
@@ -18811,7 +18845,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18811
18845
  return;
18812
18846
  } else if (subcommand === "install-terminal-hooks") {
18813
18847
  try {
18814
- const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-BVVOEGhG.cjs'); });
18848
+ const { installTerminalHooks, parseTerminalHooksArgs, TERMINAL_HOOKS_HELP } = await Promise.resolve().then(function () { return require('./installTerminalHooks-Cou3WUf3.cjs'); });
18815
18849
  const command = parseTerminalHooksArgs(args.slice(1));
18816
18850
  if (command.action === "help") {
18817
18851
  console.log(TERMINAL_HOOKS_HELP);
@@ -18828,7 +18862,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18828
18862
  }
18829
18863
  } else if (subcommand === "agent-home") {
18830
18864
  try {
18831
- const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-B0CLy0Qx.cjs'); });
18865
+ const { parseAgentHomeArgs, runAgentHomeCommand } = await Promise.resolve().then(function () { return require('./agentHome-CHh4lmjM.cjs'); });
18832
18866
  await runAgentHomeCommand(parseAgentHomeArgs(args.slice(1)));
18833
18867
  process.exit(0);
18834
18868
  } catch (error) {
@@ -18837,7 +18871,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18837
18871
  }
18838
18872
  } else if (subcommand === "spawn") {
18839
18873
  try {
18840
- const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-HV345RN-.cjs'); });
18874
+ const { handleSpawnCommand } = await Promise.resolve().then(function () { return require('./spawn-CmFOSVdW.cjs'); });
18841
18875
  await handleSpawnCommand(args.slice(1));
18842
18876
  } catch (error) {
18843
18877
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18849,7 +18883,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18849
18883
  return;
18850
18884
  } else if (subcommand === "sessions") {
18851
18885
  try {
18852
- const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-BFlIrKCY.cjs'); });
18886
+ const { handleSessionsCommand } = await Promise.resolve().then(function () { return require('./sessions-Bh1pyddi.cjs'); });
18853
18887
  await handleSessionsCommand(args.slice(1));
18854
18888
  } catch (error) {
18855
18889
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18861,7 +18895,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18861
18895
  return;
18862
18896
  } else if (subcommand === "send") {
18863
18897
  try {
18864
- const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-CHxobaoI.cjs'); });
18898
+ const { handleSendCommand } = await Promise.resolve().then(function () { return require('./send-4qJTCAYW.cjs'); });
18865
18899
  await handleSendCommand(args.slice(1));
18866
18900
  } catch (error) {
18867
18901
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -18967,9 +19001,9 @@ Conversation history is preserved on the server, but in-flight tool calls are in
18967
19001
  if (geminiSubcommand === "project" && args[2] === "set" && args[3]) {
18968
19002
  const projectId = args[3];
18969
19003
  try {
18970
- const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return require('./config-CzkBjZnV.cjs'); });
18971
- const { readCredentialsForConfiguredRelay: readCredentialsForConfiguredRelay2 } = await Promise.resolve().then(function () { return require('./limits-CyuIt-Vl.cjs'); }).then(function (n) { return n.persistence; });
18972
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./types-B0sSi6eM.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; });
18973
19007
  let userEmail = void 0;
18974
19008
  try {
18975
19009
  const credentials = await readCredentialsForConfiguredRelay2();
@@ -19000,7 +19034,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19000
19034
  }
19001
19035
  if (geminiSubcommand === "project" && args[2] === "get") {
19002
19036
  try {
19003
- const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-CzkBjZnV.cjs'); });
19037
+ const { readGeminiLocalConfig } = await Promise.resolve().then(function () { return require('./config-DLx-vW3I.cjs'); });
19004
19038
  const config = readGeminiLocalConfig();
19005
19039
  if (config.googleCloudProject) {
19006
19040
  console.log(`Current Google Cloud Project: ${config.googleCloudProject}`);
@@ -19040,7 +19074,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19040
19074
  process.exit(0);
19041
19075
  }
19042
19076
  try {
19043
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DS-0qm0L.cjs'); });
19077
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-F-mqx3_K.cjs'); });
19044
19078
  let startedBy = void 0;
19045
19079
  for (let i = 1; i < args.length; i++) {
19046
19080
  if (args[i] === "--started-by") {
@@ -19063,7 +19097,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19063
19097
  } else if (subcommand === "pi") {
19064
19098
  if (args[1] === "--terminal") {
19065
19099
  try {
19066
- const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-CpU3hzrX.cjs'); });
19100
+ const { runPiTerminal } = await Promise.resolve().then(function () { return require('./piTerminal-9J0GAKzb.cjs'); });
19067
19101
  process.exitCode = await runPiTerminal(args.slice(2));
19068
19102
  } catch (error) {
19069
19103
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -19080,7 +19114,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19080
19114
  }
19081
19115
  };
19082
19116
  try {
19083
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CTbGqVFY.cjs'); });
19117
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-BEOMECtE.cjs'); });
19084
19118
  const parsed = parsePiRunnerArgs(args.slice(1));
19085
19119
  const resolved = resolveAcpAgentConfig(["pi", ...parsed.passthrough]);
19086
19120
  const { credentials } = await authAndSetupMachineIfNeeded();
@@ -19108,7 +19142,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19108
19142
  return;
19109
19143
  } else if (subcommand === "acp") {
19110
19144
  try {
19111
- const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-CTbGqVFY.cjs'); });
19145
+ const { runAcp, resolveAcpAgentConfig } = await Promise.resolve().then(function () { return require('./index-BEOMECtE.cjs'); });
19112
19146
  let startedBy = void 0;
19113
19147
  let verbose = false;
19114
19148
  const acpArgs = [];
@@ -19148,7 +19182,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19148
19182
  return;
19149
19183
  } else if (subcommand === "openclaw") {
19150
19184
  try {
19151
- const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-CvSm8oTc.cjs'); });
19185
+ const { runOpenClaw } = await Promise.resolve().then(function () { return require('./runOpenClaw-Qqo9j63M.cjs'); });
19152
19186
  let startedBy = void 0;
19153
19187
  let verbose = false;
19154
19188
  let gatewayUrl;
@@ -19199,7 +19233,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19199
19233
  return;
19200
19234
  } else if (subcommand === "todo") {
19201
19235
  try {
19202
- const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-CMMQ6yhU.cjs'); });
19236
+ const { handleTodoCommand } = await Promise.resolve().then(function () { return require('./todo-DqyRI4wP.cjs'); });
19203
19237
  await handleTodoCommand(args.slice(1));
19204
19238
  } catch (error) {
19205
19239
  console.error(JSON.stringify({ error: error instanceof Error ? error.message : "Todo command failed" }));
@@ -19208,7 +19242,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19208
19242
  return;
19209
19243
  } else if (subcommand === "teams") {
19210
19244
  try {
19211
- const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-BahinMnH.cjs'); });
19245
+ const { handleTeamsCommand } = await Promise.resolve().then(function () { return require('./teams-CB1R9-Z9.cjs'); });
19212
19246
  await handleTeamsCommand(args.slice(1));
19213
19247
  } catch (error) {
19214
19248
  console.error(error instanceof Error ? error.message : "Teams command failed");
@@ -19217,7 +19251,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19217
19251
  return;
19218
19252
  } else if (subcommand === "auto") {
19219
19253
  try {
19220
- const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-DqKGFq8U.cjs'); });
19254
+ const { handleAutoCommand } = await Promise.resolve().then(function () { return require('./auto-DKmEls8Z.cjs'); });
19221
19255
  await handleAutoCommand(args.slice(1));
19222
19256
  } catch (error) {
19223
19257
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Automation command failed");
@@ -19229,7 +19263,7 @@ Conversation history is preserved on the server, but in-flight tool calls are in
19229
19263
  return;
19230
19264
  } else if (subcommand === "mcp" && (args.length === 1 || args.length === 2 && args[1] === "--terminal-tools")) {
19231
19265
  try {
19232
- const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-CXkvnztT.cjs'); });
19266
+ const { handleMcpCommand } = await Promise.resolve().then(function () { return require('./mcp-CPYbtsYG.cjs'); });
19233
19267
  await handleMcpCommand(args[1] === "--terminal-tools");
19234
19268
  } catch (error) {
19235
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-C9QzZsUQ.cjs');
5
- require('./limits-CyuIt-Vl.cjs');
4
+ require('./index-rH3DrQ5B.cjs');
5
+ require('./limits-BH5CV5vR.cjs');
6
6
  require('zod');
7
- require('./types-B0sSi6eM.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-Db76O1kw.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-BYU1e81k.mjs';
3
- import './limits-A2c-3M-_.mjs';
2
+ import './index-BF6WfgV5.mjs';
3
+ import './limits-CjRj8IX5.mjs';
4
4
  import 'zod';
5
- import './types-BrGJ7PJz.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-CU6YD_Ms.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-C9QzZsUQ.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-BYU1e81k.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-C9QzZsUQ.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-B0sSi6eM.cjs');
14
+ require('./types-BbvK1Tr_.cjs');
15
15
  require('axios');
16
- require('./limits-CyuIt-Vl.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-Db76O1kw.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-BYU1e81k.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-BrGJ7PJz.mjs';
12
+ import './types-Dh-s4Lqs.mjs';
13
13
  import 'axios';
14
- import './limits-A2c-3M-_.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-CU6YD_Ms.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-B0sSi6eM.cjs');
4
- var persistence = require('./limits-CyuIt-Vl.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;