@pushary/agent-hooks 1.9.57 → 1.9.59

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 (119) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{api-RQAY3A5V.js → api-UVJGNZIF.js} +10 -10
  3. package/dist/bin/pushary-bell-hook.js +27 -27
  4. package/dist/bin/pushary-bell.js +10 -10
  5. package/dist/bin/pushary-claude.js +26 -26
  6. package/dist/bin/pushary-clean.js +49 -46
  7. package/dist/bin/pushary-codex-bridge.js +21 -21
  8. package/dist/bin/pushary-codex-hook.js +32 -32
  9. package/dist/bin/pushary-codex-session.js +10 -8
  10. package/dist/bin/pushary-codex.js +14 -14
  11. package/dist/bin/pushary-connect.js +27 -26
  12. package/dist/bin/pushary-cowork.js +5 -5
  13. package/dist/bin/pushary-daemon.js +37 -37
  14. package/dist/bin/pushary-disconnect.js +26 -26
  15. package/dist/bin/pushary-doctor.js +41 -39
  16. package/dist/bin/pushary-elicitation-hook.js +27 -27
  17. package/dist/bin/pushary-gemini-bridge.js +15 -15
  18. package/dist/bin/pushary-gemini-hook.js +29 -29
  19. package/dist/bin/pushary-hook.js +31 -31
  20. package/dist/bin/pushary-login.js +13 -13
  21. package/dist/bin/pushary-logout.js +26 -26
  22. package/dist/bin/pushary-mcp.js +11 -11
  23. package/dist/bin/pushary-mode.js +13 -13
  24. package/dist/bin/pushary-notification-hook.js +26 -26
  25. package/dist/bin/pushary-opencode-hook.js +28 -28
  26. package/dist/bin/pushary-permission-denied-hook.js +31 -31
  27. package/dist/bin/pushary-permission-hook.js +30 -30
  28. package/dist/bin/pushary-post-hook.js +26 -26
  29. package/dist/bin/pushary-prompt-hook.js +26 -26
  30. package/dist/bin/pushary-session-end-hook.js +26 -26
  31. package/dist/bin/pushary-session-start-hook.js +33 -33
  32. package/dist/bin/pushary-setup.js +65 -268
  33. package/dist/bin/pushary-stats.js +5 -5
  34. package/dist/bin/pushary-status.js +32 -30
  35. package/dist/bin/pushary-stop-hook.js +26 -26
  36. package/dist/bin/pushary-stopfailure-hook.js +26 -26
  37. package/dist/bin/pushary-suggestions.js +13 -13
  38. package/dist/bin/pushary-transcript-register.js +18 -18
  39. package/dist/bin/pushary-transcripts.js +7 -7
  40. package/dist/bin/pushary-upgrade.js +107 -58
  41. package/dist/bin/pushary-wait.js +13 -13
  42. package/dist/bin/pushary.js +7 -7
  43. package/dist/chunk-2FVP7WRP.js +378 -0
  44. package/dist/{chunk-W6363YYZ.js → chunk-2WMZDKPM.js} +8 -8
  45. package/dist/{chunk-N3NSWWNU.js → chunk-3N2ZTHZZ.js} +1 -1
  46. package/dist/{chunk-JCMSISCC.js → chunk-3NROUNIS.js} +2 -2
  47. package/dist/{chunk-7RZO6VWD.js → chunk-3RKIJM26.js} +2 -2
  48. package/dist/{chunk-Z7Q36I4K.js → chunk-4QF2YLYK.js} +11 -7
  49. package/dist/{chunk-LVDC3RUE.js → chunk-4XXZUFWN.js} +1 -1
  50. package/dist/{chunk-BAJ3A3BU.js → chunk-5BNXJTOZ.js} +5 -2
  51. package/dist/{chunk-A54W5A74.js → chunk-5EFNBL6V.js} +3 -3
  52. package/dist/{chunk-4YTFYILS.js → chunk-5JWCWALO.js} +9 -9
  53. package/dist/{chunk-3IBUZQKM.js → chunk-5O6D4J2K.js} +2 -2
  54. package/dist/{chunk-DDQRYX2L.js → chunk-5PP4455M.js} +3 -3
  55. package/dist/{chunk-NQDEMRAS.js → chunk-6ONSTCDJ.js} +5 -5
  56. package/dist/{chunk-ECJJKDP7.js → chunk-75UYYIFJ.js} +1 -1
  57. package/dist/{chunk-GZL3KEPC.js → chunk-762CDAJJ.js} +140 -136
  58. package/dist/{chunk-YKYVDHIY.js → chunk-AS4Z6KS4.js} +1 -1
  59. package/dist/{chunk-4YNNAF53.js → chunk-AY32RSUC.js} +2 -2
  60. package/dist/{chunk-I43PY5G3.js → chunk-BKVX53QR.js} +1 -1
  61. package/dist/{chunk-5SFM6XB4.js → chunk-BMPZ5HVJ.js} +2 -2
  62. package/dist/{chunk-7OQ4AJC7.js → chunk-BRUHVTFB.js} +2 -7
  63. package/dist/{chunk-OZSP4RIQ.js → chunk-CPRA7IEK.js} +174 -41
  64. package/dist/{chunk-C3IWX6KU.js → chunk-D6CXQIXO.js} +1 -1
  65. package/dist/{chunk-T45PAPOG.js → chunk-DK35M4TH.js} +5 -5
  66. package/dist/{chunk-K45CFSYV.js → chunk-DS7X36Z3.js} +4 -4
  67. package/dist/{chunk-IBSRULIY.js → chunk-EBQTWH5O.js} +10 -10
  68. package/dist/{chunk-OLNBYAPI.js → chunk-EHCIQA5D.js} +4 -4
  69. package/dist/{chunk-2NIRYGTK.js → chunk-IBXHVYN2.js} +2 -2
  70. package/dist/{chunk-HCIB4YNB.js → chunk-JAKBCKEB.js} +3 -3
  71. package/dist/{chunk-PZDMZ7LM.js → chunk-JBCMXSBO.js} +5 -5
  72. package/dist/{chunk-IRZ5FVWG.js → chunk-KAJDKYUM.js} +3 -3
  73. package/dist/{chunk-AN6TVB2H.js → chunk-KHDD74MK.js} +5 -5
  74. package/dist/{chunk-ZZB4J6CX.js → chunk-KQHY6L3X.js} +4 -4
  75. package/dist/{chunk-UPFFO4F6.js → chunk-KQWN7C5C.js} +4 -4
  76. package/dist/{chunk-D2EETYAL.js → chunk-KW3DED2A.js} +14 -369
  77. package/dist/{chunk-TWLWDIFB.js → chunk-KZCYHWDF.js} +4 -2
  78. package/dist/{chunk-RFAF3TOX.js → chunk-L3NVHPBU.js} +94 -15
  79. package/dist/{chunk-LVZYIUSR.js → chunk-LAEW5QQD.js} +1 -1
  80. package/dist/{chunk-SQ5G6A6K.js → chunk-M46WDK64.js} +1 -1
  81. package/dist/{chunk-LVWXRXT7.js → chunk-M6MOQBR5.js} +1 -1
  82. package/dist/{chunk-FBKVCODG.js → chunk-MA37WNVS.js} +3 -3
  83. package/dist/{chunk-XTZHUIGJ.js → chunk-MMLIQDTG.js} +1 -1
  84. package/dist/{chunk-CB565EVO.js → chunk-MSU3VKGJ.js} +2 -2
  85. package/dist/{chunk-ZU6L34DQ.js → chunk-MYU5D5VH.js} +4 -4
  86. package/dist/{chunk-WXZN5CS3.js → chunk-OZIXBN3O.js} +2 -2
  87. package/dist/{chunk-JSQOHMNJ.js → chunk-PVANKDWM.js} +1 -1
  88. package/dist/{chunk-JYXIARGW.js → chunk-RAMQBSVZ.js} +1 -1
  89. package/dist/{chunk-S5LX25XE.js → chunk-RQDP2SJY.js} +1 -1
  90. package/dist/{chunk-DS6OR5OS.js → chunk-SIU6OWA6.js} +6 -6
  91. package/dist/{chunk-QLDTBZBP.js → chunk-T65RIQK2.js} +6 -6
  92. package/dist/{chunk-2PJENKRJ.js → chunk-TCH5UCPR.js} +77 -30
  93. package/dist/{chunk-QQYUWTYS.js → chunk-TDOKDCFH.js} +3 -3
  94. package/dist/chunk-UFJS4RR7.js +266 -0
  95. package/dist/{chunk-AEXACKDR.js → chunk-US3IT6ZC.js} +3 -3
  96. package/dist/{chunk-4QD7VE4E.js → chunk-UTJ5465F.js} +2 -2
  97. package/dist/{chunk-M7NX25ZA.js → chunk-UVZK5LIK.js} +1 -1
  98. package/dist/{chunk-IUOUNRLH.js → chunk-V3PDUDPB.js} +2 -2
  99. package/dist/{chunk-K5SDLOFS.js → chunk-VAJHDTJX.js} +11 -11
  100. package/dist/{chunk-QTCFEKLJ.js → chunk-W47WL6JY.js} +1 -1
  101. package/dist/{chunk-6QM54CSJ.js → chunk-WW24SG27.js} +5 -5
  102. package/dist/{chunk-3TJLPABQ.js → chunk-WWAVHLGS.js} +3 -3
  103. package/dist/{chunk-CUEUANIU.js → chunk-X4ES7QBT.js} +5 -5
  104. package/dist/{chunk-XXNT4FGA.js → chunk-XGP5VSQG.js} +1 -1
  105. package/dist/{chunk-LW7IWGSV.js → chunk-YQVKG5MC.js} +5 -5
  106. package/dist/{codex-app-cards-switch-SVGTZ2UN.js → codex-app-cards-switch-N77RWKCO.js} +21 -19
  107. package/dist/{codex-desktop-launch-SH7OUEEC.js → codex-desktop-launch-KIX7OMTL.js} +3 -1
  108. package/dist/{codex-session-launch-IQ57OL3N.js → codex-session-launch-XV7SIIWP.js} +18 -18
  109. package/dist/{config-SYLUYZQE.js → config-HH4DYYNX.js} +3 -3
  110. package/dist/global-upgrade-YWIVJIUR.js +34 -0
  111. package/dist/{identity-6KRUO2YO.js → identity-4J7Y2MW3.js} +4 -4
  112. package/dist/{live-capabilities-RKUHAWT6.js → live-capabilities-LHZBCI5U.js} +4 -4
  113. package/dist/{paths-MUPQZNLG.js → paths-ES3V7BWQ.js} +5 -3
  114. package/dist/{reapply-YZXZCWCI.js → reapply-KA5SIYWX.js} +26 -26
  115. package/dist/src/index.js +21 -21
  116. package/dist/{upgrade-lock-JXP27UKI.js → upgrade-lock-TJPKU5HL.js} +4 -6
  117. package/dist/{usage-OUV76AIY.js → usage-7ALXBJVJ.js} +3 -3
  118. package/package.json +1 -1
  119. package/dist/global-upgrade-SRCWQE7N.js +0 -26
@@ -2,10 +2,10 @@ import {
2
2
  IDLE_PROMPT_NOTIFICATION,
3
3
  NOTIFICATION_PUSH_TYPES,
4
4
  POSTTOOLUSE_MIRROR_ONLY_TOOLS
5
- } from "./chunk-QTCFEKLJ.js";
5
+ } from "./chunk-W47WL6JY.js";
6
6
  import {
7
7
  repoKeyFor
8
- } from "./chunk-XXNT4FGA.js";
8
+ } from "./chunk-XGP5VSQG.js";
9
9
  import {
10
10
  cancelQuestion,
11
11
  clientErrorKindOf,
@@ -13,26 +13,26 @@ import {
13
13
  reportClientError,
14
14
  sendNotification,
15
15
  waitForAnswer
16
- } from "./chunk-6QM54CSJ.js";
16
+ } from "./chunk-WW24SG27.js";
17
17
  import {
18
18
  withRetry
19
- } from "./chunk-A54W5A74.js";
19
+ } from "./chunk-5EFNBL6V.js";
20
20
  import {
21
21
  getMachineId
22
- } from "./chunk-SQ5G6A6K.js";
22
+ } from "./chunk-M46WDK64.js";
23
23
  import {
24
24
  reportedInstallSource
25
- } from "./chunk-7RZO6VWD.js";
25
+ } from "./chunk-3RKIJM26.js";
26
26
  import {
27
27
  canonicalJson
28
- } from "./chunk-TWLWDIFB.js";
28
+ } from "./chunk-KZCYHWDF.js";
29
29
  import {
30
30
  writeFileAtomic
31
31
  } from "./chunk-QENTGE75.js";
32
32
  import {
33
33
  getApiKey,
34
34
  getBaseUrl
35
- } from "./chunk-LVDC3RUE.js";
35
+ } from "./chunk-4XXZUFWN.js";
36
36
  import {
37
37
  ACTION_BODY_MAX,
38
38
  AGENTS,
@@ -66,7 +66,7 @@ import {
66
66
  toToolLookup,
67
67
  truncateLine,
68
68
  unansweredRefusalReason
69
- } from "./chunk-GZL3KEPC.js";
69
+ } from "./chunk-762CDAJJ.js";
70
70
 
71
71
  // ../hook-mapping/src/describe.ts
72
72
  import { isAbsolute, relative, resolve } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-TWLWDIFB.js";
3
+ } from "./chunk-KZCYHWDF.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-GZL3KEPC.js";
16
+ } from "./chunk-762CDAJJ.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  realpath
3
- } from "./chunk-LVWXRXT7.js";
3
+ } from "./chunk-M6MOQBR5.js";
4
4
  import {
5
5
  findNativeClaudeInstall
6
6
  } from "./chunk-VUFHYMSP.js";
@@ -13,10 +13,10 @@ import {
13
13
  resolvePackageVersionFromBinary,
14
14
  resolvePathBinary,
15
15
  resolvePathBinaryAsync
16
- } from "./chunk-AEXACKDR.js";
16
+ } from "./chunk-US3IT6ZC.js";
17
17
  import {
18
18
  MANAGED_PROVIDERS
19
- } from "./chunk-GZL3KEPC.js";
19
+ } from "./chunk-762CDAJJ.js";
20
20
 
21
21
  // src/live-capabilities.ts
22
22
  import { homedir } from "os";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  MCP_BRIDGE_BINARY
3
- } from "./chunk-JCMSISCC.js";
3
+ } from "./chunk-3NROUNIS.js";
4
4
  import {
5
5
  KEY_FILE_MODE
6
- } from "./chunk-IRZ5FVWG.js";
6
+ } from "./chunk-KAJDKYUM.js";
7
7
  import {
8
8
  NpmInstallError,
9
9
  NpmMissingError,
10
10
  NpmPermissionError
11
- } from "./chunk-AEXACKDR.js";
11
+ } from "./chunk-US3IT6ZC.js";
12
12
  import {
13
13
  readJsonSafe,
14
14
  writeFileAtomic,
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-QENTGE75.js";
17
17
  import {
18
18
  NPX_LATEST_COMMAND
19
- } from "./chunk-5SFM6XB4.js";
19
+ } from "./chunk-BMPZ5HVJ.js";
20
20
  import {
21
21
  readSetupAgentFailures
22
- } from "./chunk-GZL3KEPC.js";
22
+ } from "./chunk-762CDAJJ.js";
23
23
 
24
24
  // src/instruction-file.ts
25
25
  import { accessSync, constants, existsSync, readFileSync, statSync, writeFileSync, mkdirSync, rmSync } from "fs";
@@ -10,7 +10,7 @@ import {
10
10
  isSetupConnectMode,
11
11
  isValidApiKey,
12
12
  normalizeAgentId
13
- } from "./chunk-GZL3KEPC.js";
13
+ } from "./chunk-762CDAJJ.js";
14
14
 
15
15
  // src/setup/options.ts
16
16
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -1,3 +1,132 @@
1
+ // ../contracts/src/json-record.ts
2
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3
+
4
+ // ../contracts/src/agent-questions.ts
5
+ var MAX_AGENT_QUESTIONS = 4;
6
+ var MIN_AGENT_QUESTION_OPTIONS = 2;
7
+ var MAX_AGENT_QUESTION_OPTIONS = 4;
8
+ var AGENT_QUESTION_HEADER_MAX = 40;
9
+ var AGENT_QUESTION_OPTION_MAX = 100;
10
+ var AGENT_QUESTION_DESCRIPTION_MAX = 500;
11
+ var agentQuestionOptionIn = (raw) => {
12
+ if (!isRecord(raw) || typeof raw.label !== "string" || raw.label.length === 0) return [];
13
+ return [{
14
+ label: raw.label,
15
+ ...typeof raw.description === "string" ? { description: raw.description } : {}
16
+ }];
17
+ };
18
+ var agentQuestionFieldsIn = (raw) => {
19
+ if (!isRecord(raw) || typeof raw.question !== "string") return void 0;
20
+ return {
21
+ question: raw.question,
22
+ ...typeof raw.header === "string" ? { header: raw.header } : {},
23
+ multiSelect: raw.multiSelect === true,
24
+ ...typeof raw.allowOther === "boolean" ? { allowOther: raw.allowOther } : {},
25
+ options: Array.isArray(raw.options) ? raw.options.flatMap(agentQuestionOptionIn) : []
26
+ };
27
+ };
28
+ var parseAgentQuestion = (raw) => {
29
+ const question = agentQuestionFieldsIn(raw);
30
+ return question && question.options.length >= MIN_AGENT_QUESTION_OPTIONS ? question : void 0;
31
+ };
32
+ var parseAgentQuestions = (toolInput) => {
33
+ const questions = toolInput.questions;
34
+ if (!Array.isArray(questions) || questions.length === 0) return void 0;
35
+ if (questions.length > MAX_AGENT_QUESTIONS) return void 0;
36
+ const parsed = [];
37
+ for (const raw of questions) {
38
+ const one = parseAgentQuestion(raw);
39
+ if (!one || parsed.some((question) => question.question === one.question)) return void 0;
40
+ parsed.push(one);
41
+ }
42
+ return parsed;
43
+ };
44
+ var isTypedAnswerQuestion = (question) => question.options.length === 0;
45
+ var typingCanAnswer = (question) => question.multiSelect === false && question.allowOther !== false;
46
+ var optionCountCanBeAnswered = (question, optionCount) => optionCount === 0 ? typingCanAnswer(question) : optionCount >= MIN_AGENT_QUESTION_OPTIONS && optionCount <= MAX_AGENT_QUESTION_OPTIONS;
47
+ var isAgentQuestionSet = (value) => {
48
+ if (!Array.isArray(value) || value.length === 0 || value.length > 4) return false;
49
+ const questions = /* @__PURE__ */ new Set();
50
+ for (const item of value) {
51
+ if (!isRecord(item)) return false;
52
+ const question = item;
53
+ 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) || !optionCountCanBeAnswered(question, question.options.length)) return false;
54
+ const labels = /* @__PURE__ */ new Set();
55
+ for (const option of question.options) {
56
+ if (!option || typeof option !== "object" || Array.isArray(option)) return false;
57
+ const record3 = option;
58
+ const label = record3.label;
59
+ if (typeof label !== "string" || label.length === 0 || labels.has(label) || record3.description !== void 0 && typeof record3.description !== "string") return false;
60
+ labels.add(label);
61
+ }
62
+ questions.add(question.question);
63
+ }
64
+ return true;
65
+ };
66
+ var parseAgentQuestionAnswers = (questions, value) => {
67
+ let parsed;
68
+ try {
69
+ parsed = JSON.parse(value);
70
+ } catch {
71
+ return null;
72
+ }
73
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
74
+ const answers = parsed;
75
+ if (Object.keys(answers).length !== questions.length) return null;
76
+ for (const question of questions) {
77
+ const answer = answers[question.question];
78
+ if (typeof answer !== "string" || answer.trim().length === 0) return null;
79
+ const labels = new Set(question.options.map((option) => option.label));
80
+ if (!question.multiSelect) {
81
+ if (question.allowOther === false && !labels.has(answer)) return null;
82
+ continue;
83
+ }
84
+ try {
85
+ const selected = JSON.parse(answer);
86
+ if (!Array.isArray(selected)) {
87
+ if (question.allowOther === false) return null;
88
+ continue;
89
+ }
90
+ if (selected.length === 0 || new Set(selected).size !== selected.length || !selected.every((label) => typeof label === "string" && labels.has(label))) return null;
91
+ } catch {
92
+ if (question.allowOther === false) return null;
93
+ }
94
+ }
95
+ return answers;
96
+ };
97
+
98
+ // ../contracts/src/codex-question.ts
99
+ var CODEX_QUESTION_TOOL = "request_user_input";
100
+ var CODEX_ASYNC_QUESTION_TOOL = "request_user_input_async";
101
+ var CODEX_QUESTION_TOOLS = [CODEX_QUESTION_TOOL, CODEX_ASYNC_QUESTION_TOOL];
102
+ var CODEX_QUESTION_TOOL_NAMES = new Set(CODEX_QUESTION_TOOLS);
103
+ var isCodexQuestionTool = (toolName) => typeof toolName === "string" && CODEX_QUESTION_TOOL_NAMES.has(toolName);
104
+ var noOptionsWhenAbsent = (options) => options ?? [];
105
+ var optionsNamedByLabel = (options) => Array.isArray(options) ? options.map((label) => ({ label })) : options;
106
+ var offersOnlyItsOptions = (raw, options) => raw.isOther === false && Array.isArray(options) && options.length > 0;
107
+ var codexQuestionFields = (raw, toolName) => {
108
+ if (!isRecord(raw) || raw.isSecret === true) return void 0;
109
+ const options = noOptionsWhenAbsent(raw.options);
110
+ if (toolName === CODEX_ASYNC_QUESTION_TOOL) {
111
+ return { question: raw.title, options: optionsNamedByLabel(options), multiSelect: false };
112
+ }
113
+ return { ...raw, options, multiSelect: raw.multiSelect ?? false, ...offersOnlyItsOptions(raw, options) ? { allowOther: false } : {} };
114
+ };
115
+ var agentQuestionsOf = (questions) => questions.flatMap((question) => agentQuestionFieldsIn(question) ?? []);
116
+ var parseCodexQuestions = (toolName, toolInput) => {
117
+ const raw = Array.isArray(toolInput.questions) ? toolInput.questions : [];
118
+ const questions = raw.map((question) => codexQuestionFields(question, toolName));
119
+ return isAgentQuestionSet(questions) ? agentQuestionsOf(questions) : void 0;
120
+ };
121
+ var CODEX_QUESTION_ANSWERED_IN_PUSHARY = "The user already answered this question in Pushary, so it was not shown again";
122
+ var CODEX_QUESTION_CONTINUE = "Continue with this answer and do not ask it again";
123
+ var quotedAnswerPair = ([question, answer]) => `${JSON.stringify(question)}: ${JSON.stringify(answer)}`;
124
+ var codexQuestionAnswerReason = (answers) => {
125
+ const pairs = Object.entries(answers);
126
+ const answered = pairs.length === 1 ? `Their answer: ${JSON.stringify(pairs[0]?.[1] ?? "")}` : `Their answers: ${pairs.map(quotedAnswerPair).join("; ")}`;
127
+ return `${CODEX_QUESTION_ANSWERED_IN_PUSHARY}. ${answered}. ${CODEX_QUESTION_CONTINUE}`;
128
+ };
129
+
1
130
  // ../contracts/src/claude-connector.ts
2
131
  var CLAUDE_CONNECTOR_URL = "https://pushary.com/api/mcp/mcp";
3
132
  var CLAUDE_CONNECTOR_GUIDE = "https://pushary.com/docs/agents/guides/claude-desktop";
@@ -310,9 +439,6 @@ var normalizeAgentId = (value, accepted) => {
310
439
  return accepted.find((candidate) => names.includes(candidate)) ?? null;
311
440
  };
312
441
 
313
- // ../contracts/src/json-record.ts
314
- var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
315
-
316
442
  // ../contracts/src/grok.ts
317
443
  var GROK_FIELD_ALIASES = {
318
444
  sessionId: "session_id",
@@ -2884,115 +3010,6 @@ var TIMEOUT_ACTION_THAT_REFUSES = "deny";
2884
3010
  var timeoutActionWithoutLocalPrompt = ({ mode, timeoutAction }) => mode !== "push_only" && timeoutAction === "approve" ? TIMEOUT_ACTION_THAT_REFUSES : timeoutAction;
2885
3011
  var TIMEOUT_ACTIONS = ["approve", "deny", "escalate", "wait"];
2886
3012
  var isTimeoutAction = (value) => typeof value === "string" && TIMEOUT_ACTIONS.includes(value);
2887
- var MAX_AGENT_QUESTIONS = 4;
2888
- var MIN_AGENT_QUESTION_OPTIONS = 2;
2889
- var MAX_AGENT_QUESTION_OPTIONS = 4;
2890
- var AGENT_QUESTION_HEADER_MAX = 40;
2891
- var AGENT_QUESTION_OPTION_MAX = 100;
2892
- var AGENT_QUESTION_DESCRIPTION_MAX = 500;
2893
- var agentQuestionOptionIn = (raw) => {
2894
- if (!isRecord(raw) || typeof raw.label !== "string" || raw.label.length === 0) return [];
2895
- return [{
2896
- label: raw.label,
2897
- ...typeof raw.description === "string" ? { description: raw.description } : {}
2898
- }];
2899
- };
2900
- var agentQuestionFieldsIn = (raw) => {
2901
- if (!isRecord(raw) || typeof raw.question !== "string") return void 0;
2902
- return {
2903
- question: raw.question,
2904
- ...typeof raw.header === "string" ? { header: raw.header } : {},
2905
- multiSelect: raw.multiSelect === true,
2906
- ...typeof raw.allowOther === "boolean" ? { allowOther: raw.allowOther } : {},
2907
- options: Array.isArray(raw.options) ? raw.options.flatMap(agentQuestionOptionIn) : []
2908
- };
2909
- };
2910
- var parseAgentQuestion = (raw) => {
2911
- const question = agentQuestionFieldsIn(raw);
2912
- return question && question.options.length >= MIN_AGENT_QUESTION_OPTIONS ? question : void 0;
2913
- };
2914
- var parseAgentQuestions = (toolInput) => {
2915
- const questions = toolInput.questions;
2916
- if (!Array.isArray(questions) || questions.length === 0) return void 0;
2917
- if (questions.length > MAX_AGENT_QUESTIONS) return void 0;
2918
- const parsed = [];
2919
- for (const raw of questions) {
2920
- const one = parseAgentQuestion(raw);
2921
- if (!one || parsed.some((question) => question.question === one.question)) return void 0;
2922
- parsed.push(one);
2923
- }
2924
- return parsed;
2925
- };
2926
- var isTypedAnswerQuestion = (question) => question.options.length === 0;
2927
- var typingCanAnswer = (question) => question.multiSelect === false && question.allowOther !== false;
2928
- var optionCountCanBeAnswered = (question, optionCount) => optionCount === 0 ? typingCanAnswer(question) : optionCount >= MIN_AGENT_QUESTION_OPTIONS && optionCount <= MAX_AGENT_QUESTION_OPTIONS;
2929
- var isAgentQuestionSet = (value) => {
2930
- if (!Array.isArray(value) || value.length === 0 || value.length > 4) return false;
2931
- const questions = /* @__PURE__ */ new Set();
2932
- for (const item of value) {
2933
- if (!isRecord(item)) return false;
2934
- const question = item;
2935
- 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) || !optionCountCanBeAnswered(question, question.options.length)) return false;
2936
- const labels = /* @__PURE__ */ new Set();
2937
- for (const option of question.options) {
2938
- if (!option || typeof option !== "object" || Array.isArray(option)) return false;
2939
- const record3 = option;
2940
- const label = record3.label;
2941
- if (typeof label !== "string" || label.length === 0 || labels.has(label) || record3.description !== void 0 && typeof record3.description !== "string") return false;
2942
- labels.add(label);
2943
- }
2944
- questions.add(question.question);
2945
- }
2946
- return true;
2947
- };
2948
- var parseAgentQuestionAnswers = (questions, value) => {
2949
- let parsed;
2950
- try {
2951
- parsed = JSON.parse(value);
2952
- } catch {
2953
- return null;
2954
- }
2955
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
2956
- const answers = parsed;
2957
- if (Object.keys(answers).length !== questions.length) return null;
2958
- for (const question of questions) {
2959
- const answer = answers[question.question];
2960
- if (typeof answer !== "string" || answer.trim().length === 0) return null;
2961
- const labels = new Set(question.options.map((option) => option.label));
2962
- if (!question.multiSelect) {
2963
- if (question.allowOther === false && !labels.has(answer)) return null;
2964
- continue;
2965
- }
2966
- try {
2967
- const selected = JSON.parse(answer);
2968
- if (!Array.isArray(selected)) {
2969
- if (question.allowOther === false) return null;
2970
- continue;
2971
- }
2972
- if (selected.length === 0 || new Set(selected).size !== selected.length || !selected.every((label) => typeof label === "string" && labels.has(label))) return null;
2973
- } catch {
2974
- if (question.allowOther === false) return null;
2975
- }
2976
- }
2977
- return answers;
2978
- };
2979
- var noOptionsWhenAbsent = (options) => options ?? [];
2980
- var optionsNamedByLabel = (options) => Array.isArray(options) ? options.map((label) => ({ label })) : options;
2981
- var offersOnlyItsOptions = (raw, options) => raw.isOther === false && Array.isArray(options) && options.length > 0;
2982
- var codexQuestionFields = (raw, toolName) => {
2983
- if (!isRecord(raw) || raw.isSecret === true) return void 0;
2984
- const options = noOptionsWhenAbsent(raw.options);
2985
- if (toolName === CODEX_ASYNC_QUESTION_TOOL) {
2986
- return { question: raw.title, options: optionsNamedByLabel(options), multiSelect: false };
2987
- }
2988
- return { ...raw, options, multiSelect: raw.multiSelect ?? false, ...offersOnlyItsOptions(raw, options) ? { allowOther: false } : {} };
2989
- };
2990
- var agentQuestionsOf = (questions) => questions.flatMap((question) => agentQuestionFieldsIn(question) ?? []);
2991
- var parseCodexQuestions = (toolName, toolInput) => {
2992
- const raw = Array.isArray(toolInput.questions) ? toolInput.questions : [];
2993
- const questions = raw.map((question) => codexQuestionFields(question, toolName));
2994
- return isAgentQuestionSet(questions) ? agentQuestionsOf(questions) : void 0;
2995
- };
2996
3013
  var typedTextAsAnswers = (questions, text2) => {
2997
3014
  const [only, ...others] = questions;
2998
3015
  if (!only || others.length > 0 || !isTypedAnswerQuestion(only)) return null;
@@ -3004,14 +3021,6 @@ var isLoneTypedAnswerQuestion = (questions) => questions.length === 1 && questio
3004
3021
  var questionsShownAsASet = (questions) => isLoneTypedAnswerQuestion(questions) ? void 0 : questions;
3005
3022
  var agentQuestionContext = (header, project) => header ? `${header}: your agent is asking in ${project}` : `Your agent is asking in ${project}`;
3006
3023
  var answersToQuestionsAsAsked = (questions, answer) => questionsShownAsASet(questions) ? parseAgentQuestionAnswers(questions, answer) : typedTextAsAnswers(questions, answer);
3007
- var CODEX_QUESTION_ANSWERED_IN_PUSHARY = "The user already answered this question in Pushary, so it was not shown again";
3008
- var CODEX_QUESTION_CONTINUE = "Continue with this answer and do not ask it again";
3009
- var quotedAnswerPair = ([question, answer]) => `${JSON.stringify(question)}: ${JSON.stringify(answer)}`;
3010
- var codexQuestionAnswerReason = (answers) => {
3011
- const pairs = Object.entries(answers);
3012
- const answered = pairs.length === 1 ? `Their answer: ${JSON.stringify(pairs[0]?.[1] ?? "")}` : `Their answers: ${pairs.map(quotedAnswerPair).join("; ")}`;
3013
- return `${CODEX_QUESTION_ANSWERED_IN_PUSHARY}. ${answered}. ${CODEX_QUESTION_CONTINUE}`;
3014
- };
3015
3024
  var INSTALL_SOURCES = [
3016
3025
  /** `npx pushary@latest ...`, the documented one-liner. */
3017
3026
  "npx",
@@ -5644,11 +5653,6 @@ var AGENT_QUESTION_STRATEGY = {
5644
5653
  };
5645
5654
  var UPDATED_INPUT_QUESTION_SOURCES = /* @__PURE__ */ new Set(["claude", "qoder", "codebuddy", "droid"]);
5646
5655
  var GROK_NATIVE_DIALOG_TOOLS = /* @__PURE__ */ new Set(["ask_user_question", "exit_plan_mode"]);
5647
- var CODEX_QUESTION_TOOL = "request_user_input";
5648
- var CODEX_ASYNC_QUESTION_TOOL = "request_user_input_async";
5649
- var CODEX_QUESTION_TOOLS = [CODEX_QUESTION_TOOL, CODEX_ASYNC_QUESTION_TOOL];
5650
- var CODEX_QUESTION_TOOL_NAMES = new Set(CODEX_QUESTION_TOOLS);
5651
- var isCodexQuestionTool = (toolName) => typeof toolName === "string" && CODEX_QUESTION_TOOL_NAMES.has(toolName);
5652
5656
  var isCodexQuestionCall = (source, event, toolName) => source === "codex" && event === "PreToolUse" && isCodexQuestionTool(toolName);
5653
5657
  var codexQuestionGoesToPushary = (verdict) => verdict.kind === "gate" && !approvalWaitsAtTheAgentsPrompt(verdict.policy.mode);
5654
5658
  function agentQuestionStrategy(source, event, toolName) {
@@ -6179,6 +6183,17 @@ var hookActivationResult = (report) => {
6179
6183
  };
6180
6184
 
6181
6185
  export {
6186
+ isRecord,
6187
+ AGENT_QUESTION_HEADER_MAX,
6188
+ AGENT_QUESTION_OPTION_MAX,
6189
+ AGENT_QUESTION_DESCRIPTION_MAX,
6190
+ parseAgentQuestions,
6191
+ isTypedAnswerQuestion,
6192
+ parseAgentQuestionAnswers,
6193
+ CODEX_QUESTION_TOOLS,
6194
+ isCodexQuestionTool,
6195
+ parseCodexQuestions,
6196
+ codexQuestionAnswerReason,
6182
6197
  CLAUDE_CONNECTOR_URL,
6183
6198
  CLAUDE_CONNECTOR_GUIDE,
6184
6199
  COWORK_CONNECTOR_LIMIT,
@@ -6193,7 +6208,6 @@ export {
6193
6208
  MANAGED_PROVIDERS,
6194
6209
  DISCONNECT_AGENT_IDS,
6195
6210
  normalizeAgentId,
6196
- isRecord,
6197
6211
  GROK_UNREADABLE_CALL,
6198
6212
  isGrokHookPayload,
6199
6213
  isGrokSessionEndStop,
@@ -6254,18 +6268,10 @@ export {
6254
6268
  approvalModeWithoutLocalPrompt,
6255
6269
  timeoutActionWithoutLocalPrompt,
6256
6270
  isTimeoutAction,
6257
- AGENT_QUESTION_HEADER_MAX,
6258
- AGENT_QUESTION_OPTION_MAX,
6259
- AGENT_QUESTION_DESCRIPTION_MAX,
6260
- parseAgentQuestions,
6261
- isTypedAnswerQuestion,
6262
- parseAgentQuestionAnswers,
6263
- parseCodexQuestions,
6264
6271
  plainAskOf,
6265
6272
  questionsShownAsASet,
6266
6273
  agentQuestionContext,
6267
6274
  answersToQuestionsAsAsked,
6268
- codexQuestionAnswerReason,
6269
6275
  normalizeInstallSource,
6270
6276
  HOOK_BUDGETS,
6271
6277
  HOOK_HOLD_BUDGET_ENV,
@@ -6309,8 +6315,6 @@ export {
6309
6315
  shouldDeferToNativeMode,
6310
6316
  AGENT_QUESTION_TOOL,
6311
6317
  AGENT_QUESTION_STRATEGY,
6312
- CODEX_QUESTION_TOOLS,
6313
- isCodexQuestionTool,
6314
6318
  codexQuestionGoesToPushary,
6315
6319
  agentQuestionStrategy,
6316
6320
  questionHandedToTheTerminal,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-TWLWDIFB.js";
3
+ } from "./chunk-KZCYHWDF.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -4,10 +4,10 @@ import {
4
4
  keyPrefix,
5
5
  readConfigFileKey,
6
6
  readMacAppKeyPrefix
7
- } from "./chunk-IRZ5FVWG.js";
7
+ } from "./chunk-KAJDKYUM.js";
8
8
  import {
9
9
  NPX_LATEST_COMMAND
10
- } from "./chunk-5SFM6XB4.js";
10
+ } from "./chunk-BMPZ5HVJ.js";
11
11
 
12
12
  // src/key-signed-out.ts
13
13
  var VERDICT_BY_CHECK = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-GZL3KEPC.js";
4
+ } from "./chunk-762CDAJJ.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -2,7 +2,7 @@ import {
2
2
  DISCONNECT_AGENT_IDS,
3
3
  SETUP_AGENT_CHOICES,
4
4
  isApprovalMode
5
- } from "./chunk-GZL3KEPC.js";
5
+ } from "./chunk-762CDAJJ.js";
6
6
 
7
7
  // src/cli/mode-request.ts
8
8
  var parseDuration = (value) => {
@@ -41,7 +41,7 @@ var COMMAND_LIST = [
41
41
  module: "pushary-codex-session",
42
42
  summary: "Experimental Codex extras that ordinary setup does not turn on",
43
43
  detail: [
44
- "Use --app-cards on|off|status so the Codex app also asks Pushary before it uses an app on this Mac.",
44
+ "Use --app-cards on|off|status so the Codex app also asks Pushary before it uses an app on this Mac, or before its browser opens a site, downloads or uploads.",
45
45
  "Use --desktop [app path] to do the same for one launch. Quit Codex first; a running app is not attached.",
46
46
  "Use --cwd <directory> to start a managed Codex terminal session in a project."
47
47
  ],
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  autoUpdateLock
3
- } from "./chunk-TWLWDIFB.js";
3
+ } from "./chunk-KZCYHWDF.js";
4
4
  import {
5
5
  installPackageGlobally,
6
6
  npmErrorMessage
7
- } from "./chunk-AEXACKDR.js";
7
+ } from "./chunk-US3IT6ZC.js";
8
8
  import {
9
9
  writeJsonAtomic
10
10
  } from "./chunk-QENTGE75.js";
@@ -159,10 +159,6 @@ var forkFinishWithUpgradeLock = (request) => new Promise((resolve, reject) => {
159
159
  resolve({ code, signal });
160
160
  });
161
161
  });
162
- var finishWithUpgradeLock = async (request) => {
163
- const exit = await forkFinishWithUpgradeLock(request);
164
- if (exit.code !== 0) throw new Error(`Upgrade finish exited with ${exit.signal ?? exit.code}`);
165
- };
166
162
  var installWithUpgradeLock = (request, lockPath = autoUpdateLock(), runNpm) => {
167
163
  const path = canonicalLockPath(lockPath);
168
164
  if (!heldLocks.has(path)) throw new Error("Cannot install an upgrade without its lock");
@@ -176,6 +172,5 @@ export {
176
172
  ownsUpgradeLock,
177
173
  releaseAutoUpdateLock,
178
174
  forkFinishWithUpgradeLock,
179
- finishWithUpgradeLock,
180
175
  installWithUpgradeLock
181
176
  };