@pushary/agent-hooks 1.9.36 → 1.9.37

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 (101) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/bin/pushary-bell-hook.js +25 -25
  3. package/dist/bin/pushary-bell.js +9 -9
  4. package/dist/bin/pushary-claude.js +24 -24
  5. package/dist/bin/pushary-clean.js +29 -29
  6. package/dist/bin/pushary-codex-bridge.js +17 -17
  7. package/dist/bin/pushary-codex-hook.js +65 -41
  8. package/dist/bin/pushary-codex.js +12 -12
  9. package/dist/bin/pushary-connect.js +24 -24
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +32 -32
  12. package/dist/bin/pushary-disconnect.js +24 -24
  13. package/dist/bin/pushary-doctor.js +33 -33
  14. package/dist/bin/pushary-elicitation-hook.js +25 -25
  15. package/dist/bin/pushary-gemini-bridge.js +13 -13
  16. package/dist/bin/pushary-gemini-hook.js +27 -27
  17. package/dist/bin/pushary-hook.js +29 -29
  18. package/dist/bin/pushary-login.js +12 -12
  19. package/dist/bin/pushary-logout.js +24 -24
  20. package/dist/bin/pushary-mcp.js +9 -9
  21. package/dist/bin/pushary-mode.js +12 -12
  22. package/dist/bin/pushary-notification-hook.js +24 -24
  23. package/dist/bin/pushary-opencode-hook.js +26 -26
  24. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  25. package/dist/bin/pushary-permission-hook.js +28 -28
  26. package/dist/bin/pushary-post-hook.js +24 -24
  27. package/dist/bin/pushary-prompt-hook.js +24 -24
  28. package/dist/bin/pushary-session-end-hook.js +24 -24
  29. package/dist/bin/pushary-session-start-hook.js +28 -28
  30. package/dist/bin/pushary-setup.js +35 -35
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +26 -26
  33. package/dist/bin/pushary-stop-hook.js +24 -24
  34. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  35. package/dist/bin/pushary-suggestions.js +12 -12
  36. package/dist/bin/pushary-transcript-register.js +17 -17
  37. package/dist/bin/pushary-transcripts.js +7 -7
  38. package/dist/bin/pushary-upgrade.js +30 -30
  39. package/dist/bin/pushary-wait.js +12 -12
  40. package/dist/bin/pushary.js +6 -6
  41. package/dist/{chunk-2DZBIELP.js → chunk-235LKHLW.js} +166 -67
  42. package/dist/{chunk-RYXSY3RH.js → chunk-2WZJHJAB.js} +5 -5
  43. package/dist/{chunk-GTEF64CJ.js → chunk-3Y73MQPF.js} +1 -1
  44. package/dist/{chunk-JAA7YJJZ.js → chunk-4OQHT5IJ.js} +4 -4
  45. package/dist/{chunk-ULDOQF4Q.js → chunk-6SYU5LVK.js} +3 -3
  46. package/dist/{chunk-DC6KHRVH.js → chunk-6VUVVVVN.js} +1 -1
  47. package/dist/{chunk-PRKH662J.js → chunk-AZXPJLKC.js} +1 -1
  48. package/dist/{chunk-CHNSFTD5.js → chunk-B7SE22M7.js} +2 -2
  49. package/dist/{chunk-ML42WKI7.js → chunk-DG5QHKJA.js} +3 -3
  50. package/dist/{chunk-GNESC5EF.js → chunk-DYALNCS6.js} +3 -3
  51. package/dist/{chunk-4E4PZQFE.js → chunk-EK6PRPCY.js} +4 -4
  52. package/dist/{chunk-Y5FCB66K.js → chunk-F3J6JFR2.js} +5 -5
  53. package/dist/{chunk-MBBPLF5T.js → chunk-FFRH7KZP.js} +2 -2
  54. package/dist/{chunk-TRNSODJ6.js → chunk-GKTVIN4F.js} +1 -1
  55. package/dist/{chunk-YRAPCLOB.js → chunk-GQSJVYKN.js} +6 -6
  56. package/dist/{chunk-VRALPR4B.js → chunk-GSP7CC52.js} +4 -4
  57. package/dist/{chunk-5S2P2CK6.js → chunk-GUHM2UQO.js} +2 -2
  58. package/dist/{chunk-FBKGGIFB.js → chunk-HA22GGDG.js} +5 -5
  59. package/dist/{chunk-CHWJ7ZXI.js → chunk-HJF57K2U.js} +5 -5
  60. package/dist/{chunk-J36W6ARB.js → chunk-HK2RPWAD.js} +1 -1
  61. package/dist/{chunk-QPUTCMAK.js → chunk-HQR6DYVG.js} +1 -1
  62. package/dist/{chunk-55XIK7YS.js → chunk-ISNGKZG4.js} +1 -1
  63. package/dist/{chunk-ETGGQWBR.js → chunk-JLQV3XLV.js} +4 -4
  64. package/dist/{chunk-EH635XAR.js → chunk-JMLJHKJN.js} +2 -2
  65. package/dist/{chunk-SHLLDMPM.js → chunk-KHLYOIPY.js} +4 -4
  66. package/dist/{chunk-RNRCOOQZ.js → chunk-KZ3XE3JG.js} +34 -109
  67. package/dist/{chunk-H3MOTS2C.js → chunk-MAGB6VW6.js} +1 -1
  68. package/dist/{chunk-42FTY5II.js → chunk-N5WEEYV6.js} +3 -3
  69. package/dist/{chunk-7GQILLZD.js → chunk-NDQXKLGE.js} +5 -5
  70. package/dist/{chunk-NE5OPCD5.js → chunk-NPE44CX4.js} +4 -4
  71. package/dist/{chunk-CRZ4CP7C.js → chunk-NWSWP3KY.js} +3 -3
  72. package/dist/{chunk-UDHT3W7I.js → chunk-OSLC7G3D.js} +2 -2
  73. package/dist/{chunk-HCKBZYBW.js → chunk-PDDJKGIW.js} +2 -2
  74. package/dist/chunk-PDRKQSC6.js +184 -0
  75. package/dist/{chunk-X4BPD5RD.js → chunk-PYWLW7PC.js} +1 -1
  76. package/dist/{chunk-4NMDFPK7.js → chunk-Q3TCLMYC.js} +5 -5
  77. package/dist/{chunk-EQXMVKKD.js → chunk-Q52PBCN7.js} +1 -1
  78. package/dist/{chunk-U2PUHT4W.js → chunk-QUKATQ66.js} +1 -1
  79. package/dist/{chunk-K5X25GUV.js → chunk-RFIHLLRH.js} +9 -6
  80. package/dist/{chunk-5ML6E3L7.js → chunk-SNI4FGOV.js} +1 -1
  81. package/dist/{chunk-556JCOMK.js → chunk-SNUNAIKK.js} +4 -4
  82. package/dist/{chunk-CRZKFEEO.js → chunk-T2NKNQPM.js} +2 -2
  83. package/dist/{chunk-F5W7B7YT.js → chunk-UEIL72RN.js} +1 -1
  84. package/dist/{chunk-KCUTE3EB.js → chunk-UK3WY3LE.js} +2 -2
  85. package/dist/{chunk-QHL3Y6D2.js → chunk-UKCGR5T2.js} +2 -2
  86. package/dist/{chunk-L25KSDIB.js → chunk-V7Q7DQXL.js} +8 -8
  87. package/dist/{chunk-EGTVN6YV.js → chunk-VA36Q6BD.js} +1 -1
  88. package/dist/{chunk-JWURAYXK.js → chunk-VMIDUNOT.js} +2 -2
  89. package/dist/{chunk-6LKIK7V2.js → chunk-W73URGML.js} +8 -8
  90. package/dist/{chunk-LL256PHP.js → chunk-WXA3CFZR.js} +1 -1
  91. package/dist/{chunk-26AEFJSK.js → chunk-YNJ372JU.js} +2 -2
  92. package/dist/{chunk-BS64ZHTB.js → chunk-Z5ORWTY3.js} +3 -3
  93. package/dist/{chunk-7MOFAAZ3.js → chunk-ZMR3DSMH.js} +4 -4
  94. package/dist/{chunk-IPYCRJGM.js → chunk-ZQD6GVS7.js} +7 -7
  95. package/dist/{global-upgrade-EF6RZBPU.js → global-upgrade-R57HCUTC.js} +6 -6
  96. package/dist/{paths-F645XTFZ.js → paths-G2AYNZCD.js} +2 -2
  97. package/dist/{reapply-HJOTWJAN.js → reapply-FHCOPXEN.js} +20 -20
  98. package/dist/src/index.js +19 -19
  99. package/dist/{upgrade-lock-APUN7YKQ.js → upgrade-lock-3I7AF7E3.js} +3 -3
  100. package/package.json +1 -1
  101. package/dist/chunk-MNXHKEXB.js +0 -71
@@ -1562,41 +1562,33 @@ var DOTNET_DOWNLOAD = /\.Download(?:String|Data|File)(?:Async|TaskAsync)?\s*\(/i
1562
1562
  var SCRIPTBLOCK_FROM_TEXT = /\[(?:System\.Management\.Automation\.)?ScriptBlock\]::Create\s*\(/i;
1563
1563
  var POWERSHELL_HOSTS = /* @__PURE__ */ new Set(["powershell", "pwsh", "powershell_ise"]);
1564
1564
  var WINDOWS_POWERSHELL_HOST = "powershell";
1565
- var POWERSHELL_HOST_COMMAND_SWITCHES = /* @__PURE__ */ new Set(["-c", "-command", "--command", "/c", "/command"]);
1566
- var POWERSHELL_HOST_SWITCHES_THAT_HIDE_THE_COMMAND = /* @__PURE__ */ new Set([
1567
- "-f",
1568
- "-file",
1569
- "/f",
1570
- "/file",
1571
- "-e",
1572
- "-ec",
1573
- "-enc",
1574
- "-encodedcommand",
1575
- "/encodedcommand"
1576
- ]);
1577
- var POWERSHELL_HOST_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Set([
1578
- "-executionpolicy",
1579
- "-ep",
1580
- "-ex",
1581
- "-windowstyle",
1582
- "-w",
1583
- "-workingdirectory",
1584
- "-wd",
1585
- "-configurationname",
1586
- "-config",
1587
- "-inputformat",
1588
- "-inf",
1589
- "-if",
1590
- "-outputformat",
1591
- "-of",
1592
- "-o",
1593
- "-version",
1594
- "-v",
1595
- "-settingsfile",
1596
- "-custompipename",
1597
- "-psconsolefile"
1565
+ var POWERSHELL_HOST_COMMAND_PARAMETER = "command";
1566
+ var POWERSHELL_HOST_COMMAND_WITH_ARGS_PARAMETERS = /* @__PURE__ */ new Set(["commandwithargs", "cwa"]);
1567
+ var POWERSHELL_HOST_FILE_PARAMETER = "file";
1568
+ var POWERSHELL_HOST_ENCODED_PARAMETER = "encodedcommand";
1569
+ var POWERSHELL_HOST_ENCODED_ALIAS = "ec";
1570
+ var POWERSHELL_HOST_OPTIONS_WITH_A_VALUE = /* @__PURE__ */ new Map([
1571
+ ["executionpolicy", "ex"],
1572
+ ["ep", "ep"],
1573
+ ["windowstyle", "w"],
1574
+ ["workingdirectory", "wo"],
1575
+ ["wd", "wd"],
1576
+ ["configurationname", "config"],
1577
+ ["configurationfile", "configurationfile"],
1578
+ ["custompipename", "cus"],
1579
+ ["inputformat", "inp"],
1580
+ ["if", "if"],
1581
+ ["outputformat", "o"],
1582
+ ["of", "of"],
1583
+ ["version", "v"],
1584
+ ["settingsfile", "settings"],
1585
+ ["psconsolefile", "ps"],
1586
+ ["token", "to"],
1587
+ ["encodedarguments", "encodeda"],
1588
+ ["ea", "ea"]
1598
1589
  ]);
1599
- var POWERSHELL_HOST_SWITCH = /^[-/]/;
1590
+ var POWERSHELL_HOST_SWITCH = /^[-/–—―]/;
1591
+ var POWERSHELL_HOST_SWITCH_PREFIX = /^([-–—―])\1?|^\//;
1600
1592
  var POWERSHELL_FILE_RUNNERS = /* @__PURE__ */ new Set(["start-process", "invoke-item", "msiexec"]);
1601
1593
  var WINDOWS_SWITCH = /^[-/–—―]/;
1602
1594
  var CMD_PROGRAM = "cmd";
@@ -1752,23 +1744,33 @@ var runsADownloadedFile = (stages, judge) => {
1752
1744
  });
1753
1745
  };
1754
1746
  var invokedExpressionsOf = (command) => command.cmdlet === INVOKE_EXPRESSION ? positionalTextsOf(command) : [];
1755
- var positionalHostCommandOf = (texts) => {
1756
- let index = 0;
1757
- while (index < texts.length && POWERSHELL_HOST_SWITCH.test(texts[index] ?? "")) {
1758
- index += POWERSHELL_HOST_OPTIONS_WITH_A_VALUE.has((texts[index] ?? "").toLowerCase()) ? 2 : 1;
1747
+ var hostOptionTakesValue = (option) => {
1748
+ for (const [name, shortest] of POWERSHELL_HOST_OPTIONS_WITH_A_VALUE) {
1749
+ if (option.length >= shortest.length && name.startsWith(option)) return true;
1759
1750
  }
1760
- return index < texts.length ? texts.slice(index).join(" ") : void 0;
1751
+ return false;
1761
1752
  };
1762
1753
  var hostedPowerShellScriptOf = (command) => {
1763
- if (!POWERSHELL_HOSTS.has(command.name)) return void 0;
1754
+ if (!POWERSHELL_HOSTS.has(command.name)) return { kind: "none" };
1764
1755
  const texts = command.args.map((arg) => arg.text);
1765
- const lowered = texts.map((text) => text.toLowerCase());
1766
- const commandSwitch = lowered.findIndex((text) => POWERSHELL_HOST_COMMAND_SWITCHES.has(text));
1767
- if (commandSwitch !== -1) return texts.slice(commandSwitch + 1).join(" ");
1768
- if (command.name !== WINDOWS_POWERSHELL_HOST || lowered.some((text) => POWERSHELL_HOST_SWITCHES_THAT_HIDE_THE_COMMAND.has(text))) {
1769
- return void 0;
1756
+ for (let index = 0; index < texts.length; index += 1) {
1757
+ const text = (texts[index] ?? "").trim();
1758
+ if (!text) continue;
1759
+ if (!POWERSHELL_HOST_SWITCH.test(text)) {
1760
+ return command.name === WINDOWS_POWERSHELL_HOST ? { kind: "script", script: texts.slice(index).join(" ") } : { kind: "none" };
1761
+ }
1762
+ const option = text.toLowerCase().replace(POWERSHELL_HOST_SWITCH_PREFIX, "");
1763
+ if (option && (POWERSHELL_HOST_ENCODED_PARAMETER.startsWith(option) || option === POWERSHELL_HOST_ENCODED_ALIAS)) {
1764
+ return { kind: "incomplete", reason: "encoded_command" };
1765
+ }
1766
+ if (option && POWERSHELL_HOST_COMMAND_PARAMETER.startsWith(option)) {
1767
+ return { kind: "script", script: texts.slice(index + 1).join(" ") };
1768
+ }
1769
+ if (POWERSHELL_HOST_COMMAND_WITH_ARGS_PARAMETERS.has(option)) return { kind: "script", script: texts[index + 1] ?? "" };
1770
+ if (option && POWERSHELL_HOST_FILE_PARAMETER.startsWith(option)) return { kind: "none" };
1771
+ if (hostOptionTakesValue(option)) index += 1;
1770
1772
  }
1771
- return positionalHostCommandOf(texts);
1773
+ return { kind: "none" };
1772
1774
  };
1773
1775
  var cmdScriptOf = (command) => {
1774
1776
  if (command.name !== CMD_PROGRAM) return void 0;
@@ -1818,38 +1820,51 @@ var scriptsInsideTheStage = (stage) => {
1818
1820
  const groups = [...stage.words, ...stage.redirectTargets].flatMap((word) => word.nested);
1819
1821
  const command = powerShellCommandOf(stage);
1820
1822
  if (command === null) return { ...NO_SCRIPTS_INSIDE, powerShell: groups };
1823
+ const hosted = hostedPowerShellScriptOf(command);
1824
+ if (hosted.kind === "incomplete") return hosted;
1821
1825
  const cmd = presentOnly(cmdScriptOf(command));
1822
1826
  return {
1823
- powerShell: [...groups, ...invokedExpressionsOf(command), ...presentOnly(hostedPowerShellScriptOf(command)), ...cmd.flatMap(cmdPiecesOf)],
1827
+ powerShell: [...groups, ...invokedExpressionsOf(command), ...hosted.kind === "script" ? [hosted.script] : [], ...cmd.flatMap(cmdPiecesOf)],
1824
1828
  cmd,
1825
1829
  posix: presentOnly(wslCommandWordsOf(command))
1826
1830
  };
1827
1831
  };
1828
1832
  var powerShellReadingAt = (command, depth) => {
1829
1833
  const statements = powerShellStatementsOf(command);
1830
- if (statements === null) return null;
1831
- const inside = depth >= MAX_NESTED_SCRIPT_DEPTH ? [] : statements.flatMap((statement) => statement.stages).map(scriptsInsideTheStage);
1832
- const nested = inside.flatMap((scripts) => scripts.powerShell).map((script) => ({ script, reading: powerShellReadingAt(script, depth + 1) }));
1833
- const readings = nested.flatMap(({ reading }) => reading === null ? [] : [reading]);
1834
+ if (statements === null) return { kind: "incomplete", reason: "syntax" };
1835
+ const inside = [];
1836
+ for (const stage of statements.flatMap((statement) => statement.stages)) {
1837
+ const scripts = scriptsInsideTheStage(stage);
1838
+ if ("kind" in scripts) return scripts;
1839
+ inside.push(scripts);
1840
+ }
1841
+ const nested = inside.flatMap((scripts) => scripts.powerShell);
1842
+ if (nested.length > 0 && depth >= MAX_NESTED_SCRIPT_DEPTH) return { kind: "incomplete", reason: "nesting_limit" };
1843
+ const readings = [];
1844
+ for (const script of nested) {
1845
+ const analysis = powerShellReadingAt(script, depth + 1);
1846
+ if (analysis.kind === "incomplete") return analysis;
1847
+ readings.push(analysis.reading);
1848
+ }
1834
1849
  return {
1835
- statements: [...statements, ...readings.flatMap((reading) => reading.statements)],
1836
- cmdScripts: [...inside.flatMap((scripts) => scripts.cmd), ...readings.flatMap((reading) => reading.cmdScripts)],
1837
- posixCommands: [...inside.flatMap((scripts) => scripts.posix), ...readings.flatMap((reading) => reading.posixCommands)],
1838
- unreadScripts: [
1839
- ...nested.flatMap(({ script, reading }) => reading === null ? [script] : []),
1840
- ...readings.flatMap((reading) => reading.unreadScripts)
1841
- ]
1850
+ kind: "complete",
1851
+ reading: {
1852
+ statements: [...statements, ...readings.flatMap((reading) => reading.statements)],
1853
+ cmdScripts: [...inside.flatMap((scripts) => scripts.cmd), ...readings.flatMap((reading) => reading.cmdScripts)],
1854
+ posixCommands: [...inside.flatMap((scripts) => scripts.posix), ...readings.flatMap((reading) => reading.posixCommands)]
1855
+ }
1842
1856
  };
1843
1857
  };
1844
1858
  var stagesOfTheReading = (reading) => reading.statements.flatMap((statement) => statement.stages);
1845
- var powerShellReadingIsDestructive = (reading, judge) => stagesOfTheReading(reading).some((stage) => stageIsDestructive(stage, judge)) || reading.cmdScripts.some(cmdScriptRemovesRecursively) || reading.unreadScripts.some((script) => judge.namesADestructiveAction(script));
1859
+ var powerShellReadingIsDestructive = (reading, judge) => stagesOfTheReading(reading).some((stage) => stageIsDestructive(stage, judge)) || reading.cmdScripts.some(cmdScriptRemovesRecursively);
1846
1860
  var powerShellCommandIsDestructive = (command, judge) => {
1847
- const reading = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
1848
- return reading === null ? judge.namesADestructiveAction(command) : powerShellReadingIsDestructive(reading, judge);
1861
+ const analysis = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
1862
+ return analysis.kind === "incomplete" || powerShellReadingIsDestructive(analysis.reading, judge);
1849
1863
  };
1850
1864
  var powerShellCommandHasAVisibleConsequence = (command, judge) => {
1851
- const reading = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
1852
- if (reading === null) return judge.namesADestructiveAction(command);
1865
+ const analysis = powerShellReadingAt(command, TOP_LEVEL_SCRIPT);
1866
+ if (analysis.kind === "incomplete") return true;
1867
+ const { reading } = analysis;
1853
1868
  const stages = stagesOfTheReading(reading);
1854
1869
  return powerShellReadingIsDestructive(reading, judge) || stages.some((stage) => stageHasAVisibleConsequence(stage, judge)) || reading.statements.some(listsRecursivelyIntoARemoval) || runsFetchedPowerShellCode(stages, judge) || runsADownloadedFile(stages, judge) || reading.posixCommands.some((words) => judge.commandShowsAConsequence(words));
1855
1870
  };
@@ -2514,6 +2529,16 @@ var KEY_SCOPES = ["full_access", "agent", "connector", "bound"];
2514
2529
  var normalizeKeyScope = (value) => typeof value === "string" && KEY_SCOPES.includes(value) ? value : null;
2515
2530
  var APPROVAL_MODES = ["push_only", "terminal_only", "push_first", "notify_only"];
2516
2531
  var isApprovalMode = (value) => typeof value === "string" && APPROVAL_MODES.includes(value);
2532
+ var approvalWaitsAtTheAgentsPrompt = (mode) => {
2533
+ switch (mode) {
2534
+ case "push_first":
2535
+ case "push_only":
2536
+ return false;
2537
+ case "notify_only":
2538
+ case "terminal_only":
2539
+ return true;
2540
+ }
2541
+ };
2517
2542
  var approvalModeWithoutLocalPrompt = (mode) => {
2518
2543
  switch (mode) {
2519
2544
  case "push_first":
@@ -2560,6 +2585,25 @@ var parseAgentQuestions = (toolInput) => {
2560
2585
  }
2561
2586
  return parsed;
2562
2587
  };
2588
+ var isAgentQuestionSet = (value) => {
2589
+ if (!Array.isArray(value) || value.length === 0 || value.length > 4) return false;
2590
+ const questions = /* @__PURE__ */ new Set();
2591
+ for (const item of value) {
2592
+ if (!item || typeof item !== "object" || Array.isArray(item)) return false;
2593
+ const question = item;
2594
+ if (typeof question.question !== "string" || question.question.length === 0 || questions.has(question.question) || question.header !== void 0 && typeof question.header !== "string" || typeof question.multiSelect !== "boolean" || question.allowOther !== void 0 && typeof question.allowOther !== "boolean" || !Array.isArray(question.options) || question.options.length < 2 || question.options.length > 4) return false;
2595
+ const labels = /* @__PURE__ */ new Set();
2596
+ for (const option of question.options) {
2597
+ if (!option || typeof option !== "object" || Array.isArray(option)) return false;
2598
+ const record = option;
2599
+ const label = record.label;
2600
+ if (typeof label !== "string" || label.length === 0 || labels.has(label) || record.description !== void 0 && typeof record.description !== "string") return false;
2601
+ labels.add(label);
2602
+ }
2603
+ questions.add(question.question);
2604
+ }
2605
+ return true;
2606
+ };
2563
2607
  var parseAgentQuestionAnswers = (questions, value) => {
2564
2608
  let parsed;
2565
2609
  try {
@@ -2591,6 +2635,29 @@ var parseAgentQuestionAnswers = (questions, value) => {
2591
2635
  }
2592
2636
  return answers;
2593
2637
  };
2638
+ var isQuestionRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
2639
+ var codexAsyncQuestionFields = (raw) => {
2640
+ if (!isQuestionRecord(raw)) return void 0;
2641
+ const labels = Array.isArray(raw.options) ? raw.options : [];
2642
+ return { question: raw.title, options: labels.map((label) => ({ label })) };
2643
+ };
2644
+ var codexBlockingQuestionFields = (raw) => isQuestionRecord(raw) && raw.isOther === false ? { ...raw, allowOther: false } : raw;
2645
+ var asksForASecret = (questions) => questions.some((question) => isQuestionRecord(question) && question.isSecret === true);
2646
+ var parseCodexQuestions = (toolName, toolInput) => {
2647
+ const raw = Array.isArray(toolInput.questions) ? toolInput.questions : [];
2648
+ if (asksForASecret(raw)) return void 0;
2649
+ const questions = raw.map(toolName === CODEX_ASYNC_QUESTION_TOOL ? codexAsyncQuestionFields : codexBlockingQuestionFields);
2650
+ const parsed = parseAgentQuestions({ questions });
2651
+ return parsed && isAgentQuestionSet(parsed) ? parsed : void 0;
2652
+ };
2653
+ var CODEX_QUESTION_ANSWERED_IN_PUSHARY = "The user already answered this question in Pushary, so it was not shown again";
2654
+ var CODEX_QUESTION_CONTINUE = "Continue with this answer and do not ask it again";
2655
+ var quotedAnswerPair = ([question, answer]) => `${JSON.stringify(question)}: ${JSON.stringify(answer)}`;
2656
+ var codexQuestionAnswerReason = (answers) => {
2657
+ const pairs = Object.entries(answers);
2658
+ const answered = pairs.length === 1 ? `Their answer: ${JSON.stringify(pairs[0]?.[1] ?? "")}` : `Their answers: ${pairs.map(quotedAnswerPair).join("; ")}`;
2659
+ return `${CODEX_QUESTION_ANSWERED_IN_PUSHARY}. ${answered}. ${CODEX_QUESTION_CONTINUE}`;
2660
+ };
2594
2661
  var INSTALL_SOURCES = [
2595
2662
  /** `npx pushary@latest ...`, the documented one-liner. */
2596
2663
  "npx",
@@ -5224,19 +5291,32 @@ var shouldDeferToNativeMode = (permissionMode, toolName, options = {}) => {
5224
5291
  return false;
5225
5292
  };
5226
5293
  var AGENT_QUESTION_TOOL = "AskUserQuestion";
5227
- var AGENT_QUESTION_STRATEGY = { native: "native_dialog", updatedInput: "updated_input", none: "not_a_question" };
5294
+ var AGENT_QUESTION_STRATEGY = {
5295
+ native: "native_dialog",
5296
+ updatedInput: "updated_input",
5297
+ answeredInRefusal: "answered_in_refusal",
5298
+ none: "not_a_question"
5299
+ };
5228
5300
  var UPDATED_INPUT_QUESTION_SOURCES = /* @__PURE__ */ new Set(["claude", "qoder", "codebuddy", "droid"]);
5229
5301
  var GROK_NATIVE_DIALOG_TOOLS = /* @__PURE__ */ new Set(["ask_user_question", "exit_plan_mode"]);
5302
+ var CODEX_QUESTION_TOOL = "request_user_input";
5303
+ var CODEX_ASYNC_QUESTION_TOOL = "request_user_input_async";
5304
+ var CODEX_QUESTION_TOOLS = [CODEX_QUESTION_TOOL, CODEX_ASYNC_QUESTION_TOOL];
5305
+ var CODEX_QUESTION_TOOL_NAMES = new Set(CODEX_QUESTION_TOOLS);
5306
+ var isCodexQuestionTool = (toolName) => typeof toolName === "string" && CODEX_QUESTION_TOOL_NAMES.has(toolName);
5307
+ var isCodexQuestionCall = (source, event, toolName) => source === "codex" && event === "PreToolUse" && isCodexQuestionTool(toolName);
5308
+ var codexQuestionGoesToPushary = (verdict) => verdict.kind === "gate" && !approvalWaitsAtTheAgentsPrompt(verdict.policy.mode);
5230
5309
  function agentQuestionStrategy(source, event, toolName) {
5231
5310
  if (source === "grok" && GROK_NATIVE_DIALOG_TOOLS.has(toolName)) return AGENT_QUESTION_STRATEGY.native;
5311
+ if (isCodexQuestionCall(source, event, toolName)) return AGENT_QUESTION_STRATEGY.answeredInRefusal;
5232
5312
  if (toolName !== AGENT_QUESTION_TOOL) return AGENT_QUESTION_STRATEGY.none;
5233
5313
  if (source !== null && event === "PreToolUse" && UPDATED_INPUT_QUESTION_SOURCES.has(source)) return AGENT_QUESTION_STRATEGY.updatedInput;
5234
5314
  return AGENT_QUESTION_STRATEGY.native;
5235
5315
  }
5236
- var questionHandedToTheTerminal = (toolName, modeState) => toolName === AGENT_QUESTION_TOOL && modeState.askHandoff === true;
5316
+ var questionHandedToTheTerminal = (toolName, modeState) => (toolName === AGENT_QUESTION_TOOL || isCodexQuestionTool(toolName)) && modeState.askHandoff === true;
5237
5317
  var EXIT_PLAN_MODE_TOOL = "ExitPlanMode";
5238
5318
  var ASKED_IN_EVERY_MODE_TOOLS = [AGENT_QUESTION_TOOL, EXIT_PLAN_MODE_TOOL];
5239
- var ASKED_IN_EVERY_MODE = new Set(ASKED_IN_EVERY_MODE_TOOLS);
5319
+ var ASKED_IN_EVERY_MODE = /* @__PURE__ */ new Set([...ASKED_IN_EVERY_MODE_TOOLS, ...CODEX_QUESTION_TOOLS]);
5240
5320
  var isAskedInEveryMode = (toolName) => ASKED_IN_EVERY_MODE.has(toolName);
5241
5321
  var NATIVE_BLOCK_EVENTS = /* @__PURE__ */ new Set(["PermissionDenied"]);
5242
5322
  var isNativeBlockEvent = (event) => typeof event === "string" && NATIVE_BLOCK_EVENTS.has(event);
@@ -5351,7 +5431,20 @@ var editsAFileThatNeedsAPerson = ({ toolName, toolInputs }) => toolInputs.some((
5351
5431
  const path = extractPolicyArg(toolName, toolInput);
5352
5432
  return path !== void 0 && fileEditNeedsAPerson(toolName, path);
5353
5433
  });
5434
+ var runsADestructiveCommand = ({ toolName, toolInputs }) => SHELL_DIALECT_BY_TOOL.has(toolName) && toolInputs.some((toolInput) => {
5435
+ const command = extractPolicyArg(toolName, toolInput);
5436
+ return command !== void 0 && classifyDecisionRisk(toolName, command) === "destructive";
5437
+ });
5438
+ var codexCallIsDestructive = (input, call) => call.deletesFiles || runsADestructiveCommand(input);
5354
5439
  var codexCallNeedsAPerson = (input, verdict, call) => onlyCodexPreToolUseCanAsk(verdict, call.permissionMode) || verdict.kind === "gate" && (aChosenRuleGoverns(input) || call.deletesFiles || runsACommandThatNeedsAPerson(input) || editsAFileThatNeedsAPerson(input));
5440
+ var CODEX_PRE_TOOL_USE_PASSES = { kind: "pass" };
5441
+ var codexPreToolUseDelivery = (input, verdict, call) => {
5442
+ if (verdict.kind !== "gate" || !codexCallNeedsAPerson(input, verdict, call)) return CODEX_PRE_TOOL_USE_PASSES;
5443
+ const noPromptOfItsOwn = codexHasNoPromptOfItsOwn(scopeBreachReasonOf(verdict), call.permissionMode);
5444
+ const mode = noPromptOfItsOwn ? approvalModeWithoutLocalPrompt(verdict.policy.mode) : verdict.policy.mode;
5445
+ if (mode === "push_first" && !codexCallIsDestructive(input, call)) return CODEX_PRE_TOOL_USE_PASSES;
5446
+ return { kind: "ask", policy: { ...verdict.policy, mode }, agentPromptFollows: !noPromptOfItsOwn };
5447
+ };
5355
5448
  var MAX_AGENT_PERMISSION_RULES_PER_KIND = 256;
5356
5449
  var MAX_AGENT_PERMISSION_RULE_LENGTH = 512;
5357
5450
  var isAgentPermissionRule = (value) => typeof value === "string" && value.length > 0 && value.length <= MAX_AGENT_PERMISSION_RULE_LENGTH;
@@ -5949,6 +6042,8 @@ export {
5949
6042
  parseAgentQuestion,
5950
6043
  parseAgentQuestions,
5951
6044
  parseAgentQuestionAnswers,
6045
+ parseCodexQuestions,
6046
+ codexQuestionAnswerReason,
5952
6047
  normalizeInstallSource,
5953
6048
  HOOK_BUDGETS,
5954
6049
  HOOK_HOLD_BUDGET_ENV,
@@ -5988,7 +6083,11 @@ export {
5988
6083
  KILL_REASON,
5989
6084
  isPusharyOwnTool,
5990
6085
  shouldDeferToNativeMode,
6086
+ AGENT_QUESTION_TOOL,
5991
6087
  AGENT_QUESTION_STRATEGY,
6088
+ CODEX_QUESTION_TOOLS,
6089
+ isCodexQuestionTool,
6090
+ codexQuestionGoesToPushary,
5992
6091
  agentQuestionStrategy,
5993
6092
  questionHandedToTheTerminal,
5994
6093
  CODEX_RESCUE_TOOL_NAME,
@@ -6009,7 +6108,7 @@ export {
6009
6108
  HAND_BACK_WITHOUT_A_PROMPT,
6010
6109
  codexDeferredPreToolUse,
6011
6110
  scopeBreachReasonOf,
6012
- codexCallNeedsAPerson,
6111
+ codexPreToolUseDelivery,
6013
6112
  claudePermissionRulesFromSettings,
6014
6113
  claudeConsultsItsAllowlist,
6015
6114
  agentRulesAllowEveryInput,
@@ -4,7 +4,7 @@ import {
4
4
  forkFinishWithUpgradeLock,
5
5
  installWithUpgradeLock,
6
6
  releaseAutoUpdateLock
7
- } from "./chunk-55XIK7YS.js";
7
+ } from "./chunk-ISNGKZG4.js";
8
8
  import {
9
9
  describeAutoUpdateCheck,
10
10
  globalInstallLocation,
@@ -14,7 +14,7 @@ import {
14
14
  readAutoUpdateState,
15
15
  updateAutoUpdateState,
16
16
  upgradeEntryFor
17
- } from "./chunk-HCKBZYBW.js";
17
+ } from "./chunk-PDDJKGIW.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -27,10 +27,10 @@ import {
27
27
  npmErrorMessage,
28
28
  readGlobalCliInstallAt,
29
29
  readGlobalPrefix
30
- } from "./chunk-K5X25GUV.js";
30
+ } from "./chunk-RFIHLLRH.js";
31
31
  import {
32
32
  NPX_LATEST_COMMAND
33
- } from "./chunk-LL256PHP.js";
33
+ } from "./chunk-WXA3CFZR.js";
34
34
  import {
35
35
  commandsPackage,
36
36
  globalUpgradeEntry,
@@ -39,7 +39,7 @@ import {
39
39
  isSameMajorVersion,
40
40
  ownPackageRoot,
41
41
  packageVersionAt
42
- } from "./chunk-2DZBIELP.js";
42
+ } from "./chunk-235LKHLW.js";
43
43
 
44
44
  // src/global-upgrade.ts
45
45
  import { existsSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-2DZBIELP.js";
4
+ } from "./chunk-235LKHLW.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-SHLLDMPM.js";
4
+ } from "./chunk-KHLYOIPY.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-4NMDFPK7.js";
7
+ } from "./chunk-Q3TCLMYC.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-K5X25GUV.js";
11
+ } from "./chunk-RFIHLLRH.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-2DZBIELP.js";
14
+ } from "./chunk-235LKHLW.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -5,16 +5,16 @@ import {
5
5
  import {
6
6
  NOTIFICATION_MATCHED_TYPES,
7
7
  POSTTOOLUSE_MIRRORED_TOOLS
8
- } from "./chunk-U2PUHT4W.js";
8
+ } from "./chunk-QUKATQ66.js";
9
9
  import {
10
10
  isProtectedByScope,
11
11
  registerHookEntry
12
- } from "./chunk-K5X25GUV.js";
12
+ } from "./chunk-RFIHLLRH.js";
13
13
  import {
14
14
  CLAUDE_PRETOOLUSE_MATCHER,
15
15
  HOOK_BUDGETS,
16
16
  HOOK_LOCATOR_BINARY
17
- } from "./chunk-2DZBIELP.js";
17
+ } from "./chunk-235LKHLW.js";
18
18
 
19
19
  // src/gemini-config.ts
20
20
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-6LKIK7V2.js";
3
+ } from "./chunk-W73URGML.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NPX_LATEST_COMMAND
3
- } from "./chunk-LL256PHP.js";
3
+ } from "./chunk-WXA3CFZR.js";
4
4
 
5
5
  // src/config.ts
6
6
  import { readFileSync } from "fs";
@@ -8,10 +8,10 @@ import {
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand,
10
10
  resolvePathBinary
11
- } from "./chunk-K5X25GUV.js";
11
+ } from "./chunk-RFIHLLRH.js";
12
12
  import {
13
13
  getPackageVersion
14
- } from "./chunk-2DZBIELP.js";
14
+ } from "./chunk-235LKHLW.js";
15
15
 
16
16
  // src/codex-app-server.ts
17
17
  import { existsSync, realpathSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-EQXMVKKD.js";
3
+ } from "./chunk-Q52PBCN7.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-7QLSKOSU.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-LL256PHP.js";
12
+ } from "./chunk-WXA3CFZR.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-2DZBIELP.js";
20
+ } from "./chunk-235LKHLW.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-CRZ4CP7C.js";
3
+ } from "./chunk-NWSWP3KY.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-7QLSKOSU.js";
@@ -9,11 +9,11 @@ import {
9
9
  } from "./chunk-KZERVKTD.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-PRKH662J.js";
12
+ } from "./chunk-AZXPJLKC.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-2DZBIELP.js";
16
+ } from "./chunk-235LKHLW.js";
17
17
 
18
18
  // src/session.ts
19
19
  var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
@@ -2,25 +2,25 @@ import {
2
2
  SIGNED_OUT_ON_MAC_MESSAGE,
3
3
  describeSignedOutKey,
4
4
  readSignedOutDiagnosis
5
- } from "./chunk-JWURAYXK.js";
5
+ } from "./chunk-VMIDUNOT.js";
6
6
  import {
7
7
  createIo
8
8
  } from "./chunk-FO3MDD26.js";
9
9
  import {
10
10
  readKeySource
11
- } from "./chunk-42FTY5II.js";
11
+ } from "./chunk-N5WEEYV6.js";
12
12
  import {
13
13
  absoluteUrl,
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-GNESC5EF.js";
17
+ } from "./chunk-DYALNCS6.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-PRKH662J.js";
23
+ } from "./chunk-AZXPJLKC.js";
24
24
 
25
25
  // src/cli/report-key.ts
26
26
  var { dim, yellow } = createIo();
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-42FTY5II.js";
7
+ } from "./chunk-N5WEEYV6.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-EGTVN6YV.js";
10
+ } from "./chunk-VA36Q6BD.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-K5X25GUV.js";
14
+ } from "./chunk-RFIHLLRH.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-AQFEP65J.js";
21
21
  import {
22
22
  getApiKey
23
- } from "./chunk-PRKH662J.js";
23
+ } from "./chunk-AZXPJLKC.js";
24
24
  import {
25
25
  CLI_PACKAGE_NAMES,
26
26
  cmdShimTarget,
@@ -28,7 +28,7 @@ import {
28
28
  globalPackageFolder,
29
29
  globalRootFor,
30
30
  isRecord
31
- } from "./chunk-2DZBIELP.js";
31
+ } from "./chunk-235LKHLW.js";
32
32
 
33
33
  // src/daemon-lifecycle.ts
34
34
  import { dirname, join, win32 as win32Path } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-CHNSFTD5.js";
3
+ } from "./chunk-B7SE22M7.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-LL256PHP.js";
6
+ } from "./chunk-WXA3CFZR.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3EGEA4KH.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-PRKH662J.js";
12
+ } from "./chunk-AZXPJLKC.js";
13
13
 
14
14
  // src/cli/login-ui.ts
15
15
  import { hostname } from "os";
@@ -3,27 +3,27 @@ import {
3
3
  expectedLaunchCapabilities,
4
4
  hasSpawnProvider,
5
5
  resolveControlPolicy
6
- } from "./chunk-26AEFJSK.js";
6
+ } from "./chunk-YNJ372JU.js";
7
7
  import {
8
8
  daemonHasRemoteProof,
9
9
  daemonServiceManagerAvailable,
10
10
  hasDaemonServiceDefinition,
11
11
  readDaemonNeedsLogin,
12
12
  readDaemonStatus
13
- } from "./chunk-Y5FCB66K.js";
13
+ } from "./chunk-F3J6JFR2.js";
14
14
  import {
15
15
  readControlMode,
16
16
  readKeySource
17
- } from "./chunk-42FTY5II.js";
17
+ } from "./chunk-N5WEEYV6.js";
18
18
  import {
19
19
  getMachineId
20
- } from "./chunk-EGTVN6YV.js";
20
+ } from "./chunk-VA36Q6BD.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-PRKH662J.js";
23
+ } from "./chunk-AZXPJLKC.js";
24
24
  import {
25
25
  getPackageVersion
26
- } from "./chunk-2DZBIELP.js";
26
+ } from "./chunk-235LKHLW.js";
27
27
 
28
28
  // src/machines.ts
29
29
  import { hostname } from "os";