@pushary/agent-hooks 0.95.6 → 0.95.8

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 (83) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
  3. package/data/cursor-plugin/CHANGELOG.md +7 -0
  4. package/data/cursor-plugin/scripts/pushary-gate.mjs +72 -17
  5. package/data/vscode-plugin/.claude-plugin/plugin.json +1 -1
  6. package/data/vscode-plugin/CHANGELOG.md +6 -0
  7. package/data/vscode-plugin/scripts/pushary-gate.mjs +76 -24
  8. package/dist/bin/pushary-bell-hook.js +18 -18
  9. package/dist/bin/pushary-bell.js +5 -5
  10. package/dist/bin/pushary-claude.js +24 -24
  11. package/dist/bin/pushary-clean.js +64 -26
  12. package/dist/bin/pushary-codex-bridge.js +29 -12
  13. package/dist/bin/pushary-codex-hook.js +29 -29
  14. package/dist/bin/pushary-codex.js +7 -7
  15. package/dist/bin/pushary-connect.js +6 -6
  16. package/dist/bin/pushary-cowork.js +3 -3
  17. package/dist/bin/pushary-daemon.js +22 -22
  18. package/dist/bin/pushary-disconnect.js +6 -6
  19. package/dist/bin/pushary-doctor.js +22 -21
  20. package/dist/bin/pushary-elicitation-hook.js +17 -17
  21. package/dist/bin/pushary-gemini-bridge.js +9 -9
  22. package/dist/bin/pushary-gemini-hook.js +65 -50
  23. package/dist/bin/pushary-hook.js +22 -22
  24. package/dist/bin/pushary-login.js +7 -7
  25. package/dist/bin/pushary-logout.js +4 -4
  26. package/dist/bin/pushary-mode.js +3 -3
  27. package/dist/bin/pushary-notification-hook.js +19 -19
  28. package/dist/bin/pushary-opencode-hook.js +29 -29
  29. package/dist/bin/pushary-permission-denied-hook.js +22 -22
  30. package/dist/bin/pushary-permission-hook.js +22 -22
  31. package/dist/bin/pushary-post-hook.js +19 -19
  32. package/dist/bin/pushary-prompt-hook.js +19 -19
  33. package/dist/bin/pushary-session-end-hook.js +19 -19
  34. package/dist/bin/pushary-session-start-hook.js +22 -22
  35. package/dist/bin/pushary-setup.js +24 -24
  36. package/dist/bin/pushary-stats.js +2 -2
  37. package/dist/bin/pushary-status.js +10 -10
  38. package/dist/bin/pushary-stop-hook.js +19 -19
  39. package/dist/bin/pushary-stopfailure-hook.js +19 -19
  40. package/dist/bin/pushary-transcript-register.js +16 -16
  41. package/dist/bin/pushary-transcripts.js +5 -5
  42. package/dist/bin/pushary-upgrade.js +14 -14
  43. package/dist/bin/pushary-wait.js +6 -5
  44. package/dist/{chunk-XKIB2FQY.js → chunk-3YFJGKJQ.js} +8 -8
  45. package/dist/{chunk-OIZVYUED.js → chunk-4DUEIUUO.js} +1 -1
  46. package/dist/{chunk-HKQ6CD32.js → chunk-54W7ELDQ.js} +1 -1
  47. package/dist/{chunk-32WFHA77.js → chunk-5GKNAQTG.js} +1 -1
  48. package/dist/{chunk-FHIVWF4B.js → chunk-A22VQ5ZL.js} +14 -14
  49. package/dist/{chunk-HHODMHTH.js → chunk-ATKGKAP6.js} +3 -3
  50. package/dist/{chunk-6II5RBAS.js → chunk-BQL7UDIB.js} +1 -1
  51. package/dist/chunk-CVWG2N3Y.js +16 -0
  52. package/dist/{chunk-C7BFOC35.js → chunk-E47WV7BJ.js} +2 -2
  53. package/dist/{chunk-WZ63WTAZ.js → chunk-EMGGUO2Q.js} +1 -1
  54. package/dist/{chunk-RPHXG4HI.js → chunk-F4TMY6XI.js} +2 -2
  55. package/dist/{chunk-KNIVXEW4.js → chunk-FRXZMCVA.js} +1 -1
  56. package/dist/{chunk-ZJ6QXXBC.js → chunk-HUGIKB5O.js} +11 -11
  57. package/dist/{chunk-7N3D4GN7.js → chunk-I7LKI4WO.js} +4 -4
  58. package/dist/{chunk-KAWLZTRJ.js → chunk-L7NOG547.js} +1 -1
  59. package/dist/{chunk-FBO5WS3D.js → chunk-NOVA7KZ2.js} +3 -1
  60. package/dist/{chunk-A2M6FGUF.js → chunk-QD73WATQ.js} +3 -3
  61. package/dist/{chunk-FVTFSYKB.js → chunk-QJPYJVL3.js} +1 -1
  62. package/dist/{chunk-CDBTCEKE.js → chunk-QV266EGS.js} +3 -3
  63. package/dist/{chunk-BS5XR4J7.js → chunk-R3OZ5ISU.js} +3 -3
  64. package/dist/{chunk-XJ6CXTSB.js → chunk-R6LBGKWQ.js} +7 -7
  65. package/dist/{chunk-WRK6RAA5.js → chunk-RE25RJ5A.js} +4 -4
  66. package/dist/{chunk-ZQREURP6.js → chunk-SDNTRS76.js} +1 -1
  67. package/dist/{chunk-DH4INZW3.js → chunk-SKPXQRKN.js} +1 -1
  68. package/dist/{chunk-SLVXQOYU.js → chunk-TY6IJY6I.js} +1 -1
  69. package/dist/{chunk-43TFQOAT.js → chunk-U5RIXR7I.js} +1 -1
  70. package/dist/{chunk-AXECWTTZ.js → chunk-UKMLSQXA.js} +2 -2
  71. package/dist/{chunk-SRFA5BOO.js → chunk-VDI645ZX.js} +1 -1
  72. package/dist/{chunk-JZSWA3VT.js → chunk-VERXHIQF.js} +1 -1
  73. package/dist/{chunk-6MRPTYYH.js → chunk-VMQU7YEJ.js} +1 -1
  74. package/dist/{chunk-R4MBUCPQ.js → chunk-XEVOPOKT.js} +1 -1
  75. package/dist/{chunk-O5RQ7RYJ.js → chunk-XO3JR3OP.js} +2 -2
  76. package/dist/{chunk-32WWVRXN.js → chunk-XUTSZYYJ.js} +1 -1
  77. package/dist/{chunk-4XFBO3GW.js → chunk-XZWUOCJZ.js} +1 -1
  78. package/dist/{chunk-DSCGKZO5.js → chunk-Y6SCMXR6.js} +2 -2
  79. package/dist/{chunk-HBBQO77U.js → chunk-Z4JVEL7R.js} +1 -1
  80. package/dist/src/index.js +10 -10
  81. package/package.json +1 -1
  82. package/dist/chunk-IIENZE2J.js +0 -15
  83. /package/dist/{chunk-VZADMT7R.js → chunk-MC5WUOJJ.js} +0 -0
@@ -12,7 +12,7 @@ import {
12
12
  shortenHome,
13
13
  unregisterPluginLocation,
14
14
  vscodeSettingsTargets
15
- } from "../chunk-RPHXG4HI.js";
15
+ } from "../chunk-F4TMY6XI.js";
16
16
  import {
17
17
  OPENCODE_PLUGIN_SIBLING,
18
18
  OPENCODE_PLUGIN_SIBLING_CONTENTS,
@@ -22,40 +22,41 @@ import {
22
22
  openCodePluginDir,
23
23
  openCodePluginFile,
24
24
  removeOpenCodeMcpServer
25
- } from "../chunk-43TFQOAT.js";
25
+ } from "../chunk-U5RIXR7I.js";
26
26
  import {
27
27
  isClaudeMcpSnapshot,
28
28
  removeClaudeMcpServers,
29
29
  removePusharySettings,
30
30
  restoreClaudeMcpServer
31
- } from "../chunk-HHODMHTH.js";
31
+ } from "../chunk-ATKGKAP6.js";
32
32
  import {
33
33
  hookOwnerOf,
34
34
  isHookTakeoverReceipt,
35
35
  restoreHookTakeover,
36
36
  restoreMcpServer
37
- } from "../chunk-BS5XR4J7.js";
38
- import "../chunk-4XFBO3GW.js";
39
- import "../chunk-FVTFSYKB.js";
37
+ } from "../chunk-R3OZ5ISU.js";
38
+ import "../chunk-XZWUOCJZ.js";
39
+ import "../chunk-QJPYJVL3.js";
40
40
  import {
41
41
  pusharyHookExecutable
42
- } from "../chunk-A2M6FGUF.js";
42
+ } from "../chunk-QD73WATQ.js";
43
43
  import {
44
44
  disableDaemonService
45
- } from "../chunk-7N3D4GN7.js";
45
+ } from "../chunk-I7LKI4WO.js";
46
46
  import {
47
47
  removeGeminiSettings
48
- } from "../chunk-CDBTCEKE.js";
48
+ } from "../chunk-QV266EGS.js";
49
49
  import "../chunk-GOPIMNVC.js";
50
50
  import "../chunk-3AJIK5AO.js";
51
51
  import "../chunk-XHKBHWLX.js";
52
52
  import {
53
53
  execNpm
54
54
  } from "../chunk-L4ZCFMWW.js";
55
- import "../chunk-HBBQO77U.js";
56
- import "../chunk-32WWVRXN.js";
57
- import "../chunk-C7BFOC35.js";
55
+ import "../chunk-Z4JVEL7R.js";
56
+ import "../chunk-XUTSZYYJ.js";
57
+ import "../chunk-E47WV7BJ.js";
58
58
  import {
59
+ bridgeAgentKey,
59
60
  claudeJson,
60
61
  claudeMcpReceipt,
61
62
  claudeSettings,
@@ -75,12 +76,13 @@ import {
75
76
  hookTakeoverReceipt,
76
77
  isProtectedByScope,
77
78
  pusharyDir,
79
+ readCodexMcpAuth,
78
80
  removeCodexHookTrust,
79
81
  removeCodexHooks,
80
82
  restoreCodexHookTrust,
81
83
  vscodePluginDir,
82
84
  vscodePluginMcp
83
- } from "../chunk-FBO5WS3D.js";
85
+ } from "../chunk-NOVA7KZ2.js";
84
86
  import {
85
87
  exitOnHelpFlag
86
88
  } from "../chunk-GOQHN2UH.js";
@@ -91,17 +93,18 @@ import {
91
93
  import "../chunk-DINDL2CF.js";
92
94
  import {
93
95
  removeClaudeAlias
94
- } from "../chunk-6MRPTYYH.js";
96
+ } from "../chunk-VMQU7YEJ.js";
95
97
  import "../chunk-7QLSKOSU.js";
96
98
  import {
97
99
  EXIT
98
100
  } from "../chunk-KZERVKTD.js";
99
- import "../chunk-KAWLZTRJ.js";
101
+ import "../chunk-L7NOG547.js";
100
102
  import "../chunk-2UMNXADU.js";
101
103
  import {
102
104
  CURSOR_GATE_EVENTS,
103
- HOOK_LOCATOR_BINARY
104
- } from "../chunk-VZADMT7R.js";
105
+ HOOK_LOCATOR_BINARY,
106
+ isValidApiKey
107
+ } from "../chunk-MC5WUOJJ.js";
105
108
 
106
109
  // bin/pushary-clean.ts
107
110
  import { existsSync, readFileSync, copyFileSync, readdirSync } from "fs";
@@ -121,10 +124,24 @@ var APP_OWNED_ENTRIES = [
121
124
  // Shared: AgentInstaller.vscodePlugin writes .pushary/plugins/vscode, and so
122
125
  // does the CLI. Not attributable, so it is kept whenever the app is installed
123
126
  // rather than removed and left registered against a path that is gone.
124
- "plugins"
127
+ "plugins",
128
+ "bridge-auth"
125
129
  ];
126
130
  var isAppOwned = (name) => APP_OWNED_ENTRIES.includes(name);
127
131
 
132
+ // src/shared-mcp-key.ts
133
+ var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
134
+ var pusharyKey = (value) => typeof value === "string" && isValidApiKey(value.trim()) ? value.trim() : null;
135
+ var bearerKey = (authorization) => typeof authorization === "string" && authorization.startsWith("Bearer ") ? pusharyKey(authorization.slice("Bearer ".length)) : null;
136
+ var mcpServerBearer = (mcpServers) => bearerKey(asRecord(asRecord(asRecord(mcpServers)?.pushary)?.headers)?.Authorization);
137
+ var appAgentKey = (bridgeAgentKey2) => pusharyKey(asRecord(bridgeAgentKey2)?.key);
138
+ var setupReceiptKey = (claudeMcpReceipt2) => bearerKey(asRecord(asRecord(asRecord(claudeMcpReceipt2)?.installedPushary)?.headers)?.Authorization);
139
+ var macAppKeepsMcpEntry = (entryKey, keys) => {
140
+ if (!entryKey) return true;
141
+ if (keys.appKey) return entryKey === keys.appKey;
142
+ return entryKey !== keys.setupKey;
143
+ };
144
+
128
145
  // bin/pushary-clean.ts
129
146
  exitOnHelpFlag("clean");
130
147
  var dim = (s) => `\x1B[2m${s}\x1B[0m`;
@@ -154,6 +171,10 @@ var removalScope = (keepMcpServer) => ({
154
171
  keepAppWiring: true,
155
172
  keepMcpServer
156
173
  });
174
+ var codexMcpKey = (config) => {
175
+ const auth = readCodexMcpAuth(config);
176
+ return auth?.method === "embedded" ? pusharyKey(auth.key) : null;
177
+ };
157
178
  var readJson = (path) => {
158
179
  try {
159
180
  return JSON.parse(readFileSync(path, "utf-8"));
@@ -355,7 +376,15 @@ var main = async () => {
355
376
  console.log(` ${dim("The Mac app is installed, so its wiring and the state it owns are left alone.")}`);
356
377
  console.log();
357
378
  }
379
+ const restoredByTakeover = new Set(
380
+ ["claude_code", "codex", "gemini_cli"].filter((agent) => existsSync(hookTakeoverReceipt(agent)))
381
+ );
358
382
  if (keepShared) restoreTakeoverReceipts();
383
+ const sharedMcpKeys = {
384
+ appKey: appAgentKey(readJson(bridgeAgentKey())),
385
+ setupKey: setupReceiptKey(readJson(CLAUDE_MCP_RECEIPT))
386
+ };
387
+ const macAppKeeps = (agent, entryKey) => keepShared && (restoredByTakeover.has(agent) || macAppKeepsMcpEntry(entryKey, sharedMcpKeys));
359
388
  if (keepCliRuntime) {
360
389
  console.log(` ${yellow(bold("Clean stopped before changing provider configuration."))}`);
361
390
  console.log(` ${dim("Fix the hooks file or receipt above, then re-run")} npx @pushary/agent-hooks@latest clean`);
@@ -370,22 +399,24 @@ var main = async () => {
370
399
  process.exit(EXIT.FAILED);
371
400
  }
372
401
  console.log(` ${check} Background service ${dim(did("uninstalled"))}`);
373
- cleanSettingsFile(CLAUDE_SETTINGS, "Claude Code settings", scope);
374
- cleanSettingsFile(CLAUDE_SETTINGS_LOCAL, "Claude Code settings.local", scope);
375
- const claudeJson2 = keepShared ? null : readJson(CLAUDE_JSON);
376
- if (keepShared) {
402
+ const claudeJson2 = readJson(CLAUDE_JSON);
403
+ const keepClaudeMcp = macAppKeeps("claude_code", mcpServerBearer(claudeJson2?.mcpServers));
404
+ const claudeHasPusharyEntry = () => Boolean(claudeJson2?.mcpServers?.pushary);
405
+ const claudeHadPusharyEntry = claudeHasPusharyEntry();
406
+ if (keepClaudeMcp) {
377
407
  console.log(` ${skip} Claude Code MCP servers ${dim("(kept: the Mac app uses it)")}`);
378
408
  } else if (claudeJson2) {
379
409
  const rawReceipt = readJson(CLAUDE_MCP_RECEIPT);
380
410
  const receipt = isClaudeMcpSnapshot(rawReceipt) ? rawReceipt : null;
381
411
  if (existsSync(CLAUDE_MCP_RECEIPT) && !receipt) {
382
- incompleteClean = true;
412
+ if (!keepShared) incompleteClean = true;
383
413
  console.log(` ${skip} Claude Code MCP servers ${dim("(setup receipt is unreadable; left unchanged)")}`);
384
414
  } else if (receipt && restoreClaudeMcpServer(claudeJson2, receipt) || !receipt && removeClaudeMcpServers(claudeJson2)) {
385
415
  writeJson(CLAUDE_JSON, claudeJson2);
386
416
  console.log(` ${check} Claude Code MCP servers ${dim(receipt ? "(previous entry restored)" : "(removed from ~/.claude.json)")}`);
417
+ if (keepShared && receipt) guardedRemove(CLAUDE_MCP_RECEIPT, { force: true });
387
418
  } else {
388
- if (receipt) incompleteClean = true;
419
+ if (receipt && !keepShared) incompleteClean = true;
389
420
  console.log(` ${skip} Claude Code MCP servers ${dim(receipt ? "(changed after setup; left unchanged)" : "(no pushary entries)")}`);
390
421
  }
391
422
  } else if (existsSync(CLAUDE_MCP_RECEIPT)) {
@@ -394,6 +425,9 @@ var main = async () => {
394
425
  } else {
395
426
  console.log(` ${skip} Claude Code MCP servers ${dim("(not found)")}`);
396
427
  }
428
+ const claudeScope = removalScope(keepShared && !(claudeHadPusharyEntry && !claudeHasPusharyEntry()));
429
+ cleanSettingsFile(CLAUDE_SETTINGS, "Claude Code settings", claudeScope);
430
+ cleanSettingsFile(CLAUDE_SETTINGS_LOCAL, "Claude Code settings.local", claudeScope);
397
431
  const cursorData = keepShared ? null : readJson(CURSOR_MCP);
398
432
  if (keepShared) {
399
433
  console.log(` ${skip} Cursor MCP config ${dim("(kept: the Mac app uses it)")}`);
@@ -469,7 +503,8 @@ var main = async () => {
469
503
  const trustRemoved = hookOwnerOf(codexHooksData) === "app" ? false : removeCodexHookTrust(parsed, codexHooksJson2, codexPositions);
470
504
  const hadPushary = config.includes("pushary");
471
505
  if (hadPushary || trustRemoved) {
472
- if (!keepShared) {
506
+ const macAppKeepsCodexMcp = macAppKeeps("codex", codexMcpKey(parsed));
507
+ if (!macAppKeepsCodexMcp) {
473
508
  const mcpServers = parsed.mcp_servers ?? {};
474
509
  delete mcpServers.pushary;
475
510
  if (Object.keys(mcpServers).length === 0) delete parsed.mcp_servers;
@@ -482,6 +517,9 @@ var main = async () => {
482
517
  guardedWrite(codexConfig, stringifyTOML(parsed));
483
518
  const what = trustRemoved ? "cleaned, hook trust removed" : "cleaned";
484
519
  console.log(` ${check} Codex config ${dim(did(what))}`);
520
+ if (macAppKeepsCodexMcp && parsed.mcp_servers?.pushary) {
521
+ console.log(` ${skip} Codex MCP server ${dim("(kept: the Mac app uses it)")}`);
522
+ }
485
523
  } else {
486
524
  console.log(` ${skip} Codex config ${dim("(no pushary entries)")}`);
487
525
  }
@@ -518,7 +556,7 @@ var main = async () => {
518
556
  const geminiSettingsPath = geminiSettings();
519
557
  const geminiSettings2 = readJson(geminiSettingsPath);
520
558
  if (geminiSettings2) {
521
- if (removeGeminiSettings(geminiSettings2, scope)) {
559
+ if (removeGeminiSettings(geminiSettings2, removalScope(macAppKeeps("gemini_cli", mcpServerBearer(geminiSettings2.mcpServers))))) {
522
560
  writeJson(geminiSettingsPath, geminiSettings2);
523
561
  console.log(` ${check} Gemini CLI settings ${dim(did("cleaned"))}`);
524
562
  } else {
@@ -1,42 +1,46 @@
1
1
  #!/usr/bin/env node
2
- import "../chunk-HKQ6CD32.js";
2
+ import "../chunk-54W7ELDQ.js";
3
3
  import {
4
4
  LiveTranscriptRelay,
5
5
  liveSessionSleep,
6
6
  postLiveSession,
7
7
  postLiveSessionUntilAccepted,
8
8
  startLiveSessionHeartbeat
9
- } from "../chunk-KNIVXEW4.js";
9
+ } from "../chunk-FRXZMCVA.js";
10
10
  import {
11
11
  SESSION_IDLE_TIMEOUT_MS,
12
12
  describeIdleWindow,
13
13
  idleDeadlinePassed,
14
14
  startProcessOwnership,
15
15
  withSpawnProcessOwnership
16
- } from "../chunk-DSCGKZO5.js";
17
- import "../chunk-DH4INZW3.js";
16
+ } from "../chunk-Y6SCMXR6.js";
17
+ import "../chunk-SKPXQRKN.js";
18
18
  import "../chunk-EQRS3SGM.js";
19
19
  import {
20
20
  transcriptsEnabled
21
- } from "../chunk-JZSWA3VT.js";
21
+ } from "../chunk-VERXHIQF.js";
22
22
  import {
23
23
  spawnClaude
24
24
  } from "../chunk-XHKBHWLX.js";
25
25
  import {
26
26
  resolveBinary
27
27
  } from "../chunk-L4ZCFMWW.js";
28
+ import {
29
+ isDecisionStopped,
30
+ withdrawQuestion
31
+ } from "../chunk-XS33QBJA.js";
28
32
  import {
29
33
  getMachineId
30
- } from "../chunk-C7BFOC35.js";
31
- import "../chunk-FBO5WS3D.js";
32
- import "../chunk-6MRPTYYH.js";
34
+ } from "../chunk-E47WV7BJ.js";
35
+ import "../chunk-NOVA7KZ2.js";
36
+ import "../chunk-VMQU7YEJ.js";
33
37
  import {
34
38
  callMcpTool
35
39
  } from "../chunk-EYRGBYZG.js";
36
40
  import "../chunk-SAF6HGAA.js";
37
41
  import "../chunk-7QLSKOSU.js";
38
42
  import "../chunk-KZERVKTD.js";
39
- import "../chunk-KAWLZTRJ.js";
43
+ import "../chunk-L7NOG547.js";
40
44
  import {
41
45
  getApiKey,
42
46
  getBaseUrl
@@ -44,7 +48,7 @@ import {
44
48
  import {
45
49
  parseAgentQuestion,
46
50
  parseAgentQuestionAnswers
47
- } from "../chunk-VZADMT7R.js";
51
+ } from "../chunk-MC5WUOJJ.js";
48
52
 
49
53
  // bin/pushary-codex-bridge.ts
50
54
  import { existsSync } from "fs";
@@ -57,6 +61,7 @@ var MAX_RPC_LINE = 1024 * 1024;
57
61
  var STDERR_TAIL_LIMIT = 2e3;
58
62
  var FAILURE_MESSAGE_MAX = 240;
59
63
  var MAX_PENDING_RPC = 8;
64
+ var QUESTION_UNAVAILABLE = "Question unavailable";
60
65
  var LOCAL_QUESTION_UNAVAILABLE = "Pushary handed this question to the current client, but this Codex bridge has no local question UI. Continue in an interactive Codex session, or choose a Pushary mode that permits remote questions.";
61
66
  var MAX_TRANSCRIPT_TEXT = 32 * 1024;
62
67
  var MAX_MESSAGE_BUFFERS = 16;
@@ -261,8 +266,20 @@ var answerCodexQuestions = async (options, params, signal) => {
261
266
  }, Math.min(1e4, deadline - Date.now()));
262
267
  correlationId = string(result.correlationId);
263
268
  while (!result.answered) {
264
- if (result.status === "terminal" || result.status === "notified" || result.suppressed || result.mode === "terminal_only" || result.mode === "notify_only") throw new Error(LOCAL_QUESTION_UNAVAILABLE);
265
- if (!correlationId || result.handoffAction === "stop" || result.noDevices || result.status && result.status !== "pending") throw new Error("Question unavailable");
269
+ if (result.status === "terminal" || result.status === "notified" || result.suppressed || result.mode === "terminal_only" || result.mode === "notify_only") {
270
+ if (correlationId) {
271
+ const withdrawn = await withdrawQuestion(options.apiKey, correlationId, {
272
+ cancelQuestion: (_key, id2, abort2) => call("cancel_question", { correlationId: id2 }, 3e3, abort2),
273
+ waitForAnswer: (_key, id2, timeoutMs, abort2) => call("wait_for_answer", { correlationId: id2, timeoutMs }, 2e3, abort2)
274
+ });
275
+ result = { ...withdrawn };
276
+ settled = withdrawn.answered || withdrawn.status === "withdrawn" || isDecisionStopped(withdrawn);
277
+ if (withdrawn.answered) break;
278
+ if (isDecisionStopped(withdrawn)) throw new Error(QUESTION_UNAVAILABLE);
279
+ }
280
+ throw new Error(LOCAL_QUESTION_UNAVAILABLE);
281
+ }
282
+ if (!correlationId || result.handoffAction === "stop" || result.noDevices || result.status && result.status !== "pending") throw new Error(QUESTION_UNAVAILABLE);
266
283
  const remaining = deadline - Date.now();
267
284
  if (remaining <= 0) throw new Error("Question expired");
268
285
  result = await call("wait_for_answer", { correlationId, timeoutMs: Math.min(25e3, remaining) }, Math.min(27e3, remaining));
@@ -1,31 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  defersToNativeMode
4
- } from "../chunk-SRFA5BOO.js";
4
+ } from "../chunk-VDI645ZX.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "../chunk-32WFHA77.js";
8
+ } from "../chunk-5GKNAQTG.js";
9
9
  import {
10
10
  readHookInput
11
- } from "../chunk-R4MBUCPQ.js";
11
+ } from "../chunk-XEVOPOKT.js";
12
12
  import {
13
13
  denyReasonFrom,
14
14
  isDeferAnswer
15
15
  } from "../chunk-YHG74UFF.js";
16
- import "../chunk-XKIB2FQY.js";
17
- import "../chunk-WZ63WTAZ.js";
18
- import "../chunk-BS5XR4J7.js";
19
- import "../chunk-4XFBO3GW.js";
20
- import "../chunk-FVTFSYKB.js";
21
- import "../chunk-A2M6FGUF.js";
22
- import "../chunk-7N3D4GN7.js";
23
- import "../chunk-CDBTCEKE.js";
16
+ import "../chunk-3YFJGKJQ.js";
17
+ import "../chunk-EMGGUO2Q.js";
18
+ import "../chunk-R3OZ5ISU.js";
19
+ import "../chunk-XZWUOCJZ.js";
20
+ import "../chunk-QJPYJVL3.js";
21
+ import "../chunk-QD73WATQ.js";
22
+ import "../chunk-I7LKI4WO.js";
23
+ import "../chunk-QV266EGS.js";
24
24
  import "../chunk-GOPIMNVC.js";
25
25
  import "../chunk-3AJIK5AO.js";
26
- import "../chunk-DH4INZW3.js";
26
+ import "../chunk-SKPXQRKN.js";
27
27
  import "../chunk-EQRS3SGM.js";
28
- import "../chunk-JZSWA3VT.js";
28
+ import "../chunk-VERXHIQF.js";
29
29
  import "../chunk-XHKBHWLX.js";
30
30
  import "../chunk-L4ZCFMWW.js";
31
31
  import {
@@ -52,15 +52,7 @@ import {
52
52
  toCodexWire,
53
53
  toPolicyLookup,
54
54
  toPolicyLookups
55
- } from "../chunk-ZJ6QXXBC.js";
56
- import {
57
- DECISION_STOP_REASON,
58
- askUser,
59
- isDecisionStopped,
60
- isLocalQuestionHandoff,
61
- sendNotification,
62
- waitForQuestion
63
- } from "../chunk-XS33QBJA.js";
55
+ } from "../chunk-HUGIKB5O.js";
64
56
  import {
65
57
  UNNAMED_ACTION,
66
58
  deriveActionBody,
@@ -69,22 +61,30 @@ import {
69
61
  describeToolCall,
70
62
  scopePathFor,
71
63
  sessionIdentityOf
72
- } from "../chunk-HBBQO77U.js";
73
- import "../chunk-32WWVRXN.js";
64
+ } from "../chunk-Z4JVEL7R.js";
65
+ import "../chunk-XUTSZYYJ.js";
66
+ import {
67
+ DECISION_STOP_REASON,
68
+ askUser,
69
+ isDecisionStopped,
70
+ isLocalQuestionHandoff,
71
+ sendNotification,
72
+ waitForQuestion
73
+ } from "../chunk-XS33QBJA.js";
74
74
  import {
75
75
  getMachineId
76
- } from "../chunk-C7BFOC35.js";
76
+ } from "../chunk-E47WV7BJ.js";
77
77
  import {
78
78
  canonicalJson
79
- } from "../chunk-FBO5WS3D.js";
79
+ } from "../chunk-NOVA7KZ2.js";
80
80
  import "../chunk-GMXKITVA.js";
81
81
  import "../chunk-DINDL2CF.js";
82
- import "../chunk-6MRPTYYH.js";
82
+ import "../chunk-VMQU7YEJ.js";
83
83
  import "../chunk-EYRGBYZG.js";
84
84
  import "../chunk-SAF6HGAA.js";
85
85
  import "../chunk-7QLSKOSU.js";
86
86
  import "../chunk-KZERVKTD.js";
87
- import "../chunk-KAWLZTRJ.js";
87
+ import "../chunk-L7NOG547.js";
88
88
  import {
89
89
  getApiKey
90
90
  } from "../chunk-2UMNXADU.js";
@@ -95,7 +95,7 @@ import {
95
95
  hookWaitClamped,
96
96
  hookWaitDeadline,
97
97
  resolveGate
98
- } from "../chunk-VZADMT7R.js";
98
+ } from "../chunk-MC5WUOJJ.js";
99
99
 
100
100
  // bin/pushary-codex-hook.ts
101
101
  import { basename } from "path";
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  reportEvent
4
- } from "../chunk-ZJ6QXXBC.js";
4
+ } from "../chunk-HUGIKB5O.js";
5
+ import "../chunk-Z4JVEL7R.js";
6
+ import "../chunk-XUTSZYYJ.js";
5
7
  import {
6
8
  askUser,
7
9
  isDecisionStopped,
8
10
  waitForAnswer
9
11
  } from "../chunk-XS33QBJA.js";
10
- import "../chunk-HBBQO77U.js";
11
- import "../chunk-32WWVRXN.js";
12
12
  import {
13
13
  getMachineId
14
- } from "../chunk-C7BFOC35.js";
15
- import "../chunk-FBO5WS3D.js";
14
+ } from "../chunk-E47WV7BJ.js";
15
+ import "../chunk-NOVA7KZ2.js";
16
16
  import "../chunk-EYRGBYZG.js";
17
17
  import "../chunk-SAF6HGAA.js";
18
18
  import "../chunk-7QLSKOSU.js";
19
19
  import "../chunk-KZERVKTD.js";
20
- import "../chunk-KAWLZTRJ.js";
20
+ import "../chunk-L7NOG547.js";
21
21
  import {
22
22
  getApiKey
23
23
  } from "../chunk-2UMNXADU.js";
24
- import "../chunk-VZADMT7R.js";
24
+ import "../chunk-MC5WUOJJ.js";
25
25
 
26
26
  // bin/pushary-codex.ts
27
27
  import { basename } from "path";
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  printKeyCheck
4
- } from "../chunk-ZQREURP6.js";
4
+ } from "../chunk-SDNTRS76.js";
5
5
  import {
6
6
  connectDevice,
7
7
  connectExistingApp,
8
8
  printConnectInstructions
9
- } from "../chunk-O5RQ7RYJ.js";
9
+ } from "../chunk-XO3JR3OP.js";
10
10
  import "../chunk-3EGEA4KH.js";
11
11
  import {
12
12
  checkApiKey
13
- } from "../chunk-6II5RBAS.js";
13
+ } from "../chunk-BQL7UDIB.js";
14
14
  import "../chunk-QCGNGEGE.js";
15
15
  import {
16
16
  createIo
@@ -25,7 +25,7 @@ import {
25
25
  import "../chunk-DINDL2CF.js";
26
26
  import {
27
27
  readKeySource
28
- } from "../chunk-6MRPTYYH.js";
28
+ } from "../chunk-VMQU7YEJ.js";
29
29
  import "../chunk-EYRGBYZG.js";
30
30
  import "../chunk-SAF6HGAA.js";
31
31
  import {
@@ -34,9 +34,9 @@ import {
34
34
  import {
35
35
  EXIT
36
36
  } from "../chunk-KZERVKTD.js";
37
- import "../chunk-KAWLZTRJ.js";
37
+ import "../chunk-L7NOG547.js";
38
38
  import "../chunk-2UMNXADU.js";
39
- import "../chunk-VZADMT7R.js";
39
+ import "../chunk-MC5WUOJJ.js";
40
40
 
41
41
  // bin/pushary-connect.ts
42
42
  exitOnHelpFlag("connect");
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  coworkOutput,
4
4
  parseCoworkOptions
5
- } from "../chunk-AXECWTTZ.js";
5
+ } from "../chunk-UKMLSQXA.js";
6
6
  import {
7
7
  canOpenBrowser,
8
8
  openInBrowser
9
9
  } from "../chunk-PUZZELE6.js";
10
- import "../chunk-4XFBO3GW.js";
10
+ import "../chunk-XZWUOCJZ.js";
11
11
  import {
12
12
  exitOnHelpFlag
13
13
  } from "../chunk-GOQHN2UH.js";
@@ -22,7 +22,7 @@ import {
22
22
  } from "../chunk-KZERVKTD.js";
23
23
  import {
24
24
  CLAUDE_CONNECTOR_GUIDE
25
- } from "../chunk-VZADMT7R.js";
25
+ } from "../chunk-MC5WUOJJ.js";
26
26
 
27
27
  // bin/pushary-cowork.ts
28
28
  exitOnHelpFlag("cowork");
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  inspectConfiguredManagedProviders
4
- } from "../chunk-XJ6CXTSB.js";
5
- import "../chunk-OIZVYUED.js";
4
+ } from "../chunk-R6LBGKWQ.js";
5
+ import "../chunk-4DUEIUUO.js";
6
6
  import {
7
7
  HEARTBEAT_INTERVAL_MS,
8
8
  sendHeartbeat
9
- } from "../chunk-WRK6RAA5.js";
10
- import "../chunk-HHODMHTH.js";
9
+ } from "../chunk-RE25RJ5A.js";
10
+ import "../chunk-ATKGKAP6.js";
11
11
  import {
12
12
  detectProviderLiveCapabilities,
13
13
  hasSpawnProvider,
14
14
  resolveControlPolicy
15
- } from "../chunk-HKQ6CD32.js";
15
+ } from "../chunk-54W7ELDQ.js";
16
16
  import {
17
17
  SESSION_REAP_SILENCE_MS,
18
18
  describeIdleWindow,
@@ -20,15 +20,15 @@ import {
20
20
  listProcessProofs,
21
21
  ownsLiveProcess,
22
22
  silentSpawnedProofs
23
- } from "../chunk-DSCGKZO5.js";
23
+ } from "../chunk-Y6SCMXR6.js";
24
24
  import {
25
25
  startRegisteredTranscripts
26
- } from "../chunk-XKIB2FQY.js";
27
- import "../chunk-WZ63WTAZ.js";
28
- import "../chunk-BS5XR4J7.js";
29
- import "../chunk-4XFBO3GW.js";
30
- import "../chunk-FVTFSYKB.js";
31
- import "../chunk-A2M6FGUF.js";
26
+ } from "../chunk-3YFJGKJQ.js";
27
+ import "../chunk-EMGGUO2Q.js";
28
+ import "../chunk-R3OZ5ISU.js";
29
+ import "../chunk-XZWUOCJZ.js";
30
+ import "../chunk-QJPYJVL3.js";
31
+ import "../chunk-QD73WATQ.js";
32
32
  import {
33
33
  DAEMON_LEASE_RENEW_INTERVAL_MS,
34
34
  acquireDaemonLease,
@@ -45,24 +45,24 @@ import {
45
45
  requestDaemonHandoff,
46
46
  stopDaemonRunning,
47
47
  writeDaemonNeedsLogin
48
- } from "../chunk-7N3D4GN7.js";
49
- import "../chunk-CDBTCEKE.js";
48
+ } from "../chunk-I7LKI4WO.js";
49
+ import "../chunk-QV266EGS.js";
50
50
  import "../chunk-GOPIMNVC.js";
51
51
  import "../chunk-3AJIK5AO.js";
52
- import "../chunk-DH4INZW3.js";
52
+ import "../chunk-SKPXQRKN.js";
53
53
  import "../chunk-EQRS3SGM.js";
54
- import "../chunk-JZSWA3VT.js";
54
+ import "../chunk-VERXHIQF.js";
55
55
  import {
56
56
  spawnClaude
57
57
  } from "../chunk-XHKBHWLX.js";
58
58
  import {
59
59
  resolveBinary
60
60
  } from "../chunk-L4ZCFMWW.js";
61
- import "../chunk-32WWVRXN.js";
61
+ import "../chunk-XUTSZYYJ.js";
62
62
  import {
63
63
  getMachineId
64
- } from "../chunk-C7BFOC35.js";
65
- import "../chunk-FBO5WS3D.js";
64
+ } from "../chunk-E47WV7BJ.js";
65
+ import "../chunk-NOVA7KZ2.js";
66
66
  import {
67
67
  writeHuman
68
68
  } from "../chunk-QCGNGEGE.js";
@@ -74,17 +74,17 @@ import "../chunk-GMXKITVA.js";
74
74
  import "../chunk-DINDL2CF.js";
75
75
  import {
76
76
  readControlMode
77
- } from "../chunk-6MRPTYYH.js";
77
+ } from "../chunk-VMQU7YEJ.js";
78
78
  import "../chunk-7QLSKOSU.js";
79
79
  import {
80
80
  EXIT
81
81
  } from "../chunk-KZERVKTD.js";
82
- import "../chunk-KAWLZTRJ.js";
82
+ import "../chunk-L7NOG547.js";
83
83
  import {
84
84
  getApiKey,
85
85
  getBaseUrl
86
86
  } from "../chunk-2UMNXADU.js";
87
- import "../chunk-VZADMT7R.js";
87
+ import "../chunk-MC5WUOJJ.js";
88
88
 
89
89
  // src/spawn-daemon.ts
90
90
  import { execFileSync, spawn } from "child_process";
@@ -8,19 +8,19 @@ import {
8
8
  openCodePluginDir,
9
9
  openCodePluginFile,
10
10
  removeOpenCodeMcpServer
11
- } from "../chunk-43TFQOAT.js";
11
+ } from "../chunk-U5RIXR7I.js";
12
12
  import {
13
13
  isClaudeMcpSnapshot,
14
14
  removeClaudeMcpServers,
15
15
  removePusharySettings,
16
16
  restoreClaudeMcpServer
17
- } from "../chunk-HHODMHTH.js";
17
+ } from "../chunk-ATKGKAP6.js";
18
18
  import {
19
19
  removeGeminiSettings
20
- } from "../chunk-CDBTCEKE.js";
20
+ } from "../chunk-QV266EGS.js";
21
21
  import "../chunk-3AJIK5AO.js";
22
22
  import "../chunk-L4ZCFMWW.js";
23
- import "../chunk-32WWVRXN.js";
23
+ import "../chunk-XUTSZYYJ.js";
24
24
  import {
25
25
  claudeJson,
26
26
  claudeMcpReceipt,
@@ -34,7 +34,7 @@ import {
34
34
  geminiSettings,
35
35
  removeCodexHooks,
36
36
  removeCodexSettings
37
- } from "../chunk-FBO5WS3D.js";
37
+ } from "../chunk-NOVA7KZ2.js";
38
38
  import {
39
39
  exitOnHelpFlag
40
40
  } from "../chunk-GOQHN2UH.js";
@@ -43,7 +43,7 @@ import "../chunk-DINDL2CF.js";
43
43
  import "../chunk-KZERVKTD.js";
44
44
  import {
45
45
  DISCONNECTABLE_AGENTS
46
- } from "../chunk-VZADMT7R.js";
46
+ } from "../chunk-MC5WUOJJ.js";
47
47
 
48
48
  // bin/pushary-disconnect.ts
49
49
  import { readdirSync, readFileSync, rmSync, writeFileSync } from "fs";