@pushary/agent-hooks 1.9.73 → 1.9.76

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 (127) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{api-JVWXPKEW.js → api-YDCHRRA4.js} +10 -10
  3. package/dist/bin/pushary-bell-hook.js +27 -25
  4. package/dist/bin/pushary-bell.js +14 -14
  5. package/dist/bin/pushary-claude.js +55 -82
  6. package/dist/bin/pushary-clean.js +37 -37
  7. package/dist/bin/pushary-codex-bridge.js +24 -24
  8. package/dist/bin/pushary-codex-hook.js +36 -34
  9. package/dist/bin/pushary-codex-session.js +8 -8
  10. package/dist/bin/pushary-codex.js +15 -15
  11. package/dist/bin/pushary-connect.js +26 -26
  12. package/dist/bin/pushary-cowork.js +5 -5
  13. package/dist/bin/pushary-daemon.js +1293 -63
  14. package/dist/bin/pushary-disconnect.js +31 -31
  15. package/dist/bin/pushary-display-hook.d.ts +1 -0
  16. package/dist/bin/pushary-display-hook.js +58 -0
  17. package/dist/bin/pushary-doctor.js +50 -50
  18. package/dist/bin/pushary-elicitation-hook.js +29 -27
  19. package/dist/bin/pushary-gemini-bridge.js +16 -16
  20. package/dist/bin/pushary-gemini-hook.js +31 -29
  21. package/dist/bin/pushary-hook.js +31 -29
  22. package/dist/bin/pushary-login.js +20 -20
  23. package/dist/bin/pushary-logout.js +30 -30
  24. package/dist/bin/pushary-mcp.js +14 -14
  25. package/dist/bin/pushary-mode.js +18 -18
  26. package/dist/bin/pushary-notification-hook.js +26 -24
  27. package/dist/bin/pushary-opencode-hook.js +30 -28
  28. package/dist/bin/pushary-permission-denied-hook.js +31 -29
  29. package/dist/bin/pushary-permission-hook.js +31 -29
  30. package/dist/bin/pushary-post-hook.js +32 -29
  31. package/dist/bin/pushary-prompt-hook.js +32 -29
  32. package/dist/bin/pushary-session-end-hook.js +28 -26
  33. package/dist/bin/pushary-session-start-hook.js +36 -34
  34. package/dist/bin/pushary-setup.js +66 -282
  35. package/dist/bin/pushary-stats.js +6 -6
  36. package/dist/bin/pushary-status.js +31 -31
  37. package/dist/bin/pushary-stop-hook.js +32 -26
  38. package/dist/bin/pushary-stopfailure-hook.js +26 -24
  39. package/dist/bin/pushary-suggestions.js +18 -18
  40. package/dist/bin/pushary-transcript-register.js +18 -16
  41. package/dist/bin/pushary-transcripts.js +20 -20
  42. package/dist/bin/pushary-upgrade.js +45 -45
  43. package/dist/bin/pushary-wait.js +18 -18
  44. package/dist/bin/pushary.js +7 -7
  45. package/dist/{chunk-F3WI32HG.js → chunk-2BK2EQOB.js} +7 -7
  46. package/dist/{chunk-ZBZBYUNZ.js → chunk-2QFYEB3P.js} +5 -5
  47. package/dist/{chunk-UIF7HWHX.js → chunk-3YU6NIIL.js} +4 -4
  48. package/dist/{chunk-L2FQBHIR.js → chunk-47TIRGS5.js} +2 -2
  49. package/dist/{chunk-AXZ67XVN.js → chunk-4LX5QUFV.js} +1 -1
  50. package/dist/{chunk-YZ6DMGZZ.js → chunk-57MQNSM5.js} +1 -1
  51. package/dist/{chunk-BLX6KRK5.js → chunk-5FV472Q2.js} +1 -1
  52. package/dist/{chunk-VBSPP4QY.js → chunk-5KPMDLXB.js} +3 -3
  53. package/dist/{chunk-S63VIM7E.js → chunk-5M5F4IWR.js} +2 -2
  54. package/dist/{chunk-7FROPPIH.js → chunk-5NW7VM35.js} +2 -2
  55. package/dist/{chunk-EITOMPFB.js → chunk-74ONBRPF.js} +4 -4
  56. package/dist/{chunk-7S46LCKD.js → chunk-7KYQ24FI.js} +3 -2
  57. package/dist/{chunk-NGNBX3YH.js → chunk-7LLC4R66.js} +4 -4
  58. package/dist/{chunk-AC5TVOAH.js → chunk-7SFP6Y5U.js} +373 -93
  59. package/dist/{chunk-CMYFV3VC.js → chunk-7ZOWQBHQ.js} +5 -5
  60. package/dist/{chunk-2QB7HJVJ.js → chunk-B2PFCS72.js} +2 -2
  61. package/dist/{chunk-UUCRWEEU.js → chunk-BUR2LYQI.js} +2 -2
  62. package/dist/{chunk-W47XZJSH.js → chunk-C2AR7QXU.js} +2 -2
  63. package/dist/{chunk-FK3JSDH5.js → chunk-CHIOUBPB.js} +13 -13
  64. package/dist/{chunk-TTGBS5JB.js → chunk-CMNB4IZO.js} +3 -3
  65. package/dist/{chunk-4UIR25GA.js → chunk-CUD6SYDG.js} +1 -1
  66. package/dist/{chunk-WJJVCDEU.js → chunk-DB3NOEDW.js} +6 -6
  67. package/dist/{chunk-PGJMSREY.js → chunk-DZF2M3LM.js} +8 -8
  68. package/dist/{chunk-2NG3ANMT.js → chunk-E2VJ7B7D.js} +9 -9
  69. package/dist/{chunk-S7VMHSJW.js → chunk-E7U4YM4A.js} +5 -5
  70. package/dist/{chunk-XKQ7CQGG.js → chunk-F7R7M5MG.js} +1 -1
  71. package/dist/{chunk-FAKEKFCI.js → chunk-FAGQAR6I.js} +5 -3
  72. package/dist/{chunk-3JJI5O5N.js → chunk-GII565PB.js} +1 -1
  73. package/dist/{chunk-WXV7J3DG.js → chunk-GJVV2EUC.js} +3 -3
  74. package/dist/{chunk-Z7AIYWZ2.js → chunk-IRLHN5UP.js} +236 -20
  75. package/dist/{chunk-NJSW2REO.js → chunk-IRN6JLSM.js} +4 -4
  76. package/dist/{chunk-JC7XUZST.js → chunk-ITLWEGLE.js} +31 -5
  77. package/dist/{chunk-7M4AA7QF.js → chunk-JNV5LOZH.js} +4 -4
  78. package/dist/{chunk-IN3MPEFA.js → chunk-JZ5KV2FK.js} +5 -5
  79. package/dist/{chunk-QAWWTRDD.js → chunk-KGWLDNNT.js} +4 -4
  80. package/dist/{chunk-O4EAMVSC.js → chunk-KWGOKO4E.js} +5 -5
  81. package/dist/{chunk-KDQLKND5.js → chunk-M5VJ3HXB.js} +6 -6
  82. package/dist/{chunk-R5PZPROX.js → chunk-M7JFGDGP.js} +1 -1
  83. package/dist/{chunk-N4VRSFRZ.js → chunk-MAWC4PJV.js} +5 -5
  84. package/dist/chunk-MHUKYYYR.js +239 -0
  85. package/dist/{chunk-56GK65Z6.js → chunk-MMVIKXCP.js} +3 -3
  86. package/dist/{chunk-CGWUVEOB.js → chunk-MTRZQR2R.js} +3 -3
  87. package/dist/{chunk-JYOR57ZW.js → chunk-NFUV25JZ.js} +3 -3
  88. package/dist/{chunk-EUHTC7K5.js → chunk-NJTAUEW6.js} +1 -1
  89. package/dist/{chunk-2JFEMKDG.js → chunk-NQA56AMZ.js} +6 -6
  90. package/dist/{chunk-AJWGZJFS.js → chunk-NVLKH5FS.js} +131 -28
  91. package/dist/{chunk-2HFC4W6J.js → chunk-PPD64MZW.js} +4 -3
  92. package/dist/{chunk-3RAWW5DH.js → chunk-QUGP76DQ.js} +6 -6
  93. package/dist/{chunk-PPKIL4EL.js → chunk-R3HXGHRQ.js} +1 -1
  94. package/dist/{chunk-3QBKMSOZ.js → chunk-S7C5NY4R.js} +1 -1
  95. package/dist/{chunk-EUEGCEA7.js → chunk-SWRNJ3BP.js} +3 -3
  96. package/dist/{chunk-RZVWEDIS.js → chunk-T2EJ3H6Y.js} +3 -3
  97. package/dist/{chunk-DT6VCMXS.js → chunk-TFYFQM5C.js} +2 -2
  98. package/dist/{chunk-GBR6E7AY.js → chunk-UEY4SHY2.js} +1 -1
  99. package/dist/{chunk-TFDMJHAB.js → chunk-UMBVIFP5.js} +1 -1
  100. package/dist/{chunk-TQ2L3ECX.js → chunk-USMUW3LI.js} +2 -2
  101. package/dist/{chunk-VJUDBZGC.js → chunk-USZJJWZL.js} +2 -2
  102. package/dist/{chunk-4LAD5A2Q.js → chunk-VELPOV2F.js} +4 -4
  103. package/dist/{chunk-JNTYPMVU.js → chunk-VZSSL6US.js} +10 -10
  104. package/dist/{chunk-KSLBS3II.js → chunk-W5AUTVVL.js} +6 -5
  105. package/dist/{chunk-OJ3ZD5VX.js → chunk-WK2L3XVQ.js} +1 -1
  106. package/dist/{chunk-PM2MHBMF.js → chunk-WLHHDDVA.js} +9 -4
  107. package/dist/{chunk-U3EBM73X.js → chunk-WRCM4XGY.js} +2 -2
  108. package/dist/{chunk-SQ5XCMPB.js → chunk-XJ5DYPTM.js} +4 -4
  109. package/dist/{chunk-PNXNWZ5P.js → chunk-XLGD5LDG.js} +3 -3
  110. package/dist/{chunk-7RX5TOU3.js → chunk-Y2CYSVWU.js} +6 -6
  111. package/dist/{chunk-AVHL2ZTS.js → chunk-Y4OBAK4I.js} +459 -172
  112. package/dist/{chunk-JWBZUTYF.js → chunk-YDPGBBV7.js} +5 -5
  113. package/dist/{chunk-FB262EOM.js → chunk-YLB4AGZJ.js} +1 -1
  114. package/dist/{chunk-QMPM3CAN.js → chunk-ZY25SNFQ.js} +1 -1
  115. package/dist/{codex-app-cards-switch-M7VH7AZH.js → codex-app-cards-switch-3OUTABVU.js} +11 -11
  116. package/dist/{codex-desktop-launch-6DASTBBA.js → codex-desktop-launch-JH3E2CIA.js} +1 -1
  117. package/dist/{codex-session-launch-2XSMFA4K.js → codex-session-launch-GR363OQN.js} +18 -18
  118. package/dist/{config-7QQOIFTW.js → config-R43UFHX7.js} +3 -3
  119. package/dist/{global-upgrade-XAKX26AN.js → global-upgrade-73GP4MZM.js} +10 -10
  120. package/dist/{identity-7AS5MBNM.js → identity-CA7CZGDL.js} +4 -4
  121. package/dist/{live-capabilities-DV4F7MIB.js → live-capabilities-RCGMQIIZ.js} +5 -5
  122. package/dist/{paths-GSMXYKT5.js → paths-H7VNNB46.js} +3 -3
  123. package/dist/{reapply-MR7UWBXR.js → reapply-3UIA3CUO.js} +27 -27
  124. package/dist/src/index.js +32 -30
  125. package/dist/{upgrade-lock-6OTHLCBZ.js → upgrade-lock-ZTLX5PDF.js} +4 -4
  126. package/dist/{usage-H53PO3VQ.js → usage-C53NVWC2.js} +3 -3
  127. package/package.json +4 -2
@@ -0,0 +1,239 @@
1
+ // ../contracts/src/billing.ts
2
+ var PARTNER_SELF_SERVE_PLANS = ["partner_launch", "partner_growth", "partner_scale"];
3
+ var PARTNER_PLAN_TYPES = ["partner", ...PARTNER_SELF_SERVE_PLANS];
4
+ var PLAN_TYPES = ["free", "agent", "agent_pro", "team", "partner", "starter", "growth", "pro", "enterprise", ...PARTNER_SELF_SERVE_PLANS];
5
+ var PAID_PLAN_TYPES = ["agent", "agent_pro", "team", "partner", "starter", "growth", "pro", ...PARTNER_SELF_SERVE_PLANS];
6
+ var SESSION_HISTORY_RETENTION_DAYS = { standard: 14, pro: 30 };
7
+ var PLAN_CONFIGS = {
8
+ free: {
9
+ name: "Free",
10
+ price: 0,
11
+ priceId: null,
12
+ limits: {
13
+ subscribers: 100,
14
+ notifications: 500,
15
+ sites: 1,
16
+ members: 1,
17
+ campaigns: 25,
18
+ dataRetentionDays: 7,
19
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.standard
20
+ },
21
+ features: {
22
+ abTesting: false,
23
+ apiAccess: false,
24
+ prioritySupport: false
25
+ }
26
+ },
27
+ agent: {
28
+ name: "Agent",
29
+ price: 9.99,
30
+ priceId: null,
31
+ limits: {
32
+ subscribers: 3,
33
+ notifications: 5e3,
34
+ sites: 1,
35
+ members: 1,
36
+ campaigns: 0,
37
+ dataRetentionDays: 30,
38
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.standard
39
+ },
40
+ features: {
41
+ abTesting: false,
42
+ apiAccess: true,
43
+ prioritySupport: false
44
+ }
45
+ },
46
+ agent_pro: {
47
+ name: "Agent Pro",
48
+ price: 19.99,
49
+ priceId: null,
50
+ limits: {
51
+ subscribers: 5,
52
+ notifications: Infinity,
53
+ sites: 1,
54
+ members: 5,
55
+ campaigns: 0,
56
+ dataRetentionDays: 90,
57
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
58
+ },
59
+ features: {
60
+ abTesting: false,
61
+ apiAccess: true,
62
+ prioritySupport: true
63
+ }
64
+ },
65
+ team: {
66
+ name: "Team",
67
+ price: 59.99,
68
+ priceId: null,
69
+ limits: {
70
+ subscribers: 25,
71
+ notifications: Infinity,
72
+ sites: 1,
73
+ members: 10,
74
+ campaigns: 0,
75
+ dataRetentionDays: 365,
76
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
77
+ },
78
+ features: {
79
+ abTesting: false,
80
+ apiAccess: true,
81
+ prioritySupport: true
82
+ }
83
+ },
84
+ partner: {
85
+ name: "Partner",
86
+ price: 99,
87
+ priceId: null,
88
+ limits: {
89
+ subscribers: 25e3,
90
+ notifications: 1e5,
91
+ sites: 1,
92
+ members: 10,
93
+ campaigns: 0,
94
+ dataRetentionDays: 365,
95
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
96
+ },
97
+ features: {
98
+ abTesting: false,
99
+ apiAccess: true,
100
+ prioritySupport: true
101
+ }
102
+ },
103
+ partner_launch: {
104
+ name: "Partner Launch",
105
+ price: 99,
106
+ priceId: null,
107
+ limits: {
108
+ subscribers: 5e3,
109
+ // Closed until request admission and fan-out accounting ship. Never sell
110
+ // human requests against the legacy notification-delivery counter.
111
+ notifications: 0,
112
+ humanDecisionRequests: 25e3,
113
+ sites: 1,
114
+ members: 3,
115
+ campaigns: 0,
116
+ dataRetentionDays: 90,
117
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
118
+ },
119
+ features: { abTesting: false, apiAccess: true, prioritySupport: false }
120
+ },
121
+ partner_growth: {
122
+ name: "Partner Growth",
123
+ price: 299,
124
+ priceId: null,
125
+ limits: {
126
+ subscribers: 25e3,
127
+ // Closed until request admission and fan-out accounting ship. Never sell
128
+ // human requests against the legacy notification-delivery counter.
129
+ notifications: 0,
130
+ humanDecisionRequests: 1e5,
131
+ sites: 1,
132
+ members: 10,
133
+ campaigns: 0,
134
+ dataRetentionDays: 365,
135
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
136
+ },
137
+ features: { abTesting: false, apiAccess: true, prioritySupport: true }
138
+ },
139
+ partner_scale: {
140
+ name: "Partner Scale",
141
+ price: 799,
142
+ priceId: null,
143
+ limits: {
144
+ subscribers: 1e5,
145
+ // Closed until request admission and fan-out accounting ship. Never sell
146
+ // human requests against the legacy notification-delivery counter.
147
+ notifications: 0,
148
+ humanDecisionRequests: 5e5,
149
+ sites: 1,
150
+ members: 25,
151
+ campaigns: 0,
152
+ dataRetentionDays: 730,
153
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
154
+ },
155
+ features: { abTesting: false, apiAccess: true, prioritySupport: true }
156
+ },
157
+ starter: {
158
+ name: "Starter",
159
+ price: 29,
160
+ priceId: null,
161
+ limits: {
162
+ subscribers: 5e3,
163
+ notifications: 25e3,
164
+ sites: 3,
165
+ members: 5,
166
+ campaigns: 250,
167
+ dataRetentionDays: 30,
168
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.standard
169
+ },
170
+ features: {
171
+ abTesting: true,
172
+ apiAccess: true,
173
+ prioritySupport: false
174
+ }
175
+ },
176
+ growth: {
177
+ name: "Growth",
178
+ price: 99,
179
+ priceId: null,
180
+ limits: {
181
+ subscribers: 25e3,
182
+ notifications: 1e5,
183
+ sites: 10,
184
+ members: 15,
185
+ campaigns: Infinity,
186
+ dataRetentionDays: 90,
187
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.standard
188
+ },
189
+ features: {
190
+ abTesting: true,
191
+ apiAccess: true,
192
+ prioritySupport: true
193
+ }
194
+ },
195
+ pro: {
196
+ name: "Pro",
197
+ price: 149,
198
+ priceId: null,
199
+ limits: {
200
+ subscribers: 1e5,
201
+ notifications: 5e5,
202
+ sites: 25,
203
+ members: 50,
204
+ campaigns: Infinity,
205
+ dataRetentionDays: 180,
206
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.standard
207
+ },
208
+ features: {
209
+ abTesting: true,
210
+ apiAccess: true,
211
+ prioritySupport: true
212
+ }
213
+ },
214
+ enterprise: {
215
+ name: "Enterprise",
216
+ price: -1,
217
+ priceId: null,
218
+ limits: {
219
+ subscribers: Infinity,
220
+ notifications: Infinity,
221
+ sites: Infinity,
222
+ members: Infinity,
223
+ campaigns: Infinity,
224
+ dataRetentionDays: Infinity,
225
+ sessionHistoryRetentionDays: SESSION_HISTORY_RETENTION_DAYS.pro
226
+ },
227
+ features: {
228
+ abTesting: true,
229
+ apiAccess: true,
230
+ prioritySupport: true
231
+ }
232
+ }
233
+ };
234
+
235
+ export {
236
+ PLAN_TYPES,
237
+ SESSION_HISTORY_RETENTION_DAYS,
238
+ PLAN_CONFIGS
239
+ };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-7S46LCKD.js";
3
+ } from "./chunk-7KYQ24FI.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
7
- } from "./chunk-RZVWEDIS.js";
7
+ } from "./chunk-T2EJ3H6Y.js";
8
8
  import {
9
9
  DECLINED_AGENTS_FILE,
10
10
  DISCONNECT_AGENT_IDS,
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-AVHL2ZTS.js";
16
+ } from "./chunk-Y4OBAK4I.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
  SETUP_FLAGS
3
- } from "./chunk-2HFC4W6J.js";
3
+ } from "./chunk-PPD64MZW.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-NMUI3ZWG.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-PPY5N2E6.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-PPKIL4EL.js";
12
+ } from "./chunk-R3HXGHRQ.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-AVHL2ZTS.js";
20
+ } from "./chunk-Y4OBAK4I.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  findNativeClaudeInstall
3
- } from "./chunk-TFDMJHAB.js";
3
+ } from "./chunk-UMBVIFP5.js";
4
4
  import {
5
5
  parseVersion
6
- } from "./chunk-RZVWEDIS.js";
6
+ } from "./chunk-T2EJ3H6Y.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-AVHL2ZTS.js";
9
+ } from "./chunk-Y4OBAK4I.js";
10
10
 
11
11
  // src/setup/agent-probe.ts
12
12
  import { execSync } from "child_process";
@@ -2,7 +2,7 @@ import {
2
2
  isApprovalMode,
3
3
  isRecord,
4
4
  isTimeoutAction
5
- } from "./chunk-AVHL2ZTS.js";
5
+ } from "./chunk-Y4OBAK4I.js";
6
6
 
7
7
  // src/cli/settings-response.ts
8
8
  var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  announceSubscriptionRequired,
3
3
  isDeferAnswer
4
- } from "./chunk-AXZ67XVN.js";
4
+ } from "./chunk-4LX5QUFV.js";
5
5
  import {
6
6
  AUTO_DECISION_WINDOW_MS,
7
7
  DEFAULT_SESSION,
@@ -10,19 +10,19 @@ import {
10
10
  permissionDeniedAction,
11
11
  releaseThrottle,
12
12
  reportEvent
13
- } from "./chunk-AJWGZJFS.js";
13
+ } from "./chunk-NVLKH5FS.js";
14
14
  import {
15
15
  askUser,
16
16
  isDecisionStopped,
17
17
  isQuestionLimitRefusal,
18
18
  waitForQuestion
19
- } from "./chunk-CMYFV3VC.js";
19
+ } from "./chunk-7ZOWQBHQ.js";
20
20
  import {
21
21
  SubscriptionRequiredError
22
- } from "./chunk-7M4AA7QF.js";
22
+ } from "./chunk-JNV5LOZH.js";
23
23
  import {
24
24
  getMachineId
25
- } from "./chunk-UUCRWEEU.js";
25
+ } from "./chunk-BUR2LYQI.js";
26
26
  import {
27
27
  ASK_CONTEXT_MAX,
28
28
  agentQuestionContext,
@@ -34,7 +34,7 @@ import {
34
34
  questionsShownAsASet,
35
35
  shouldDeferToNativeMode,
36
36
  wireVerdictFor
37
- } from "./chunk-AVHL2ZTS.js";
37
+ } from "./chunk-Y4OBAK4I.js";
38
38
 
39
39
  // src/machine-decision-audit.ts
40
40
  import { basename } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  repoKeyFor
3
- } from "./chunk-QMPM3CAN.js";
3
+ } from "./chunk-ZY25SNFQ.js";
4
4
  import {
5
5
  cancelQuestion,
6
6
  clientErrorKindOf,
@@ -8,32 +8,33 @@ import {
8
8
  reportClientError,
9
9
  sendNotification,
10
10
  waitForAnswer
11
- } from "./chunk-CMYFV3VC.js";
11
+ } from "./chunk-7ZOWQBHQ.js";
12
12
  import {
13
13
  withRetry
14
- } from "./chunk-7M4AA7QF.js";
14
+ } from "./chunk-JNV5LOZH.js";
15
15
  import {
16
16
  getMachineId
17
- } from "./chunk-UUCRWEEU.js";
17
+ } from "./chunk-BUR2LYQI.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-7FROPPIH.js";
20
+ } from "./chunk-5NW7VM35.js";
21
21
  import {
22
22
  IDLE_PROMPT_NOTIFICATION,
23
23
  NOTIFICATION_PUSH_TYPES,
24
24
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
25
25
  canonicalJson,
26
26
  claudeConfigDir
27
- } from "./chunk-7S46LCKD.js";
27
+ } from "./chunk-7KYQ24FI.js";
28
28
  import {
29
29
  compareVersion,
30
30
  parseVersion,
31
- writeFileAtomic
32
- } from "./chunk-RZVWEDIS.js";
31
+ writeFileAtomic,
32
+ writeJsonAtomicDurable
33
+ } from "./chunk-T2EJ3H6Y.js";
33
34
  import {
34
35
  getApiKey,
35
36
  getBaseUrl
36
- } from "./chunk-R5PZPROX.js";
37
+ } from "./chunk-M7JFGDGP.js";
37
38
  import {
38
39
  ACTION_BODY_MAX,
39
40
  AGENTS,
@@ -41,6 +42,7 @@ import {
41
42
  BLANK_TASK_INPUT_TOOL,
42
43
  BLOCKED_ACTION_GRANT_TTL_SECONDS,
43
44
  CODEX_SHELL_COMMAND_FLAGS,
45
+ COMMAND_RECOVERY,
44
46
  DECISION_LINE_MAX,
45
47
  FILE_TARGET_TOOLS,
46
48
  GATE_MAX_TOOL_INPUTS,
@@ -60,6 +62,7 @@ import {
60
62
  isRecord,
61
63
  isTokenCount,
62
64
  modeStateFromResponse,
65
+ nativeRecord,
63
66
  parseMcpToolName,
64
67
  pendingCommandEvents,
65
68
  pendingCommandInstruction,
@@ -72,7 +75,7 @@ import {
72
75
  toToolLookup,
73
76
  truncateLine,
74
77
  unansweredRefusalReason
75
- } from "./chunk-AVHL2ZTS.js";
78
+ } from "./chunk-Y4OBAK4I.js";
76
79
 
77
80
  // ../hook-mapping/src/describe.ts
78
81
  import { isAbsolute, relative, resolve } from "path";
@@ -850,7 +853,7 @@ var transcriptUsageRequest = (hook) => {
850
853
  import { join } from "path";
851
854
  import { homedir, tmpdir } from "os";
852
855
  import { createHash } from "crypto";
853
- import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, renameSync, unlinkSync, rmSync, statSync } from "fs";
856
+ import { openSync, closeSync, fsyncSync, lstatSync, existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, unlinkSync, rmSync, statSync } from "fs";
854
857
  var PENDING_DIR = join(tmpdir(), "pushary-pending");
855
858
  var commandRoot = () => process.env.PUSHARY_COMMAND_DIR?.trim() || join(homedir(), ".pushary", "run", "commands");
856
859
  var DEFAULT_SESSION = "_no_session";
@@ -866,16 +869,23 @@ var legacyCommandFile = (sessionId, namespace = "") => join(commandDirFor(sessio
866
869
  var commandFile = (sessionId, id, namespace = "") => join(commandDirFor(sessionId, namespace), `${createHash("sha256").update(id).digest("hex")}.json`);
867
870
  var readCommandFile = (file) => {
868
871
  try {
872
+ if (!lstatSync(file).isFile()) return null;
869
873
  const value = JSON.parse(readFileSync(file, "utf-8"));
870
- if (typeof value.id !== "string" || typeof value.text !== "string" || typeof value.expiresAtMs !== "number") return null;
871
- if (value.expiresAtMs <= Date.now()) {
874
+ if (!nativeRecord(value) || typeof value.id !== "string" || typeof value.text !== "string" || typeof value.expiresAtMs !== "number" || !Number.isFinite(value.expiresAtMs)) return null;
875
+ if (value.expiresAtMs + COMMAND_RECOVERY.receiptRetentionMs <= Date.now()) {
872
876
  unlinkSync(file);
877
+ rmSync(`${file}.emission`, { force: true });
873
878
  return null;
874
879
  }
875
880
  return {
876
- ...value,
881
+ id: value.id,
882
+ text: value.text,
883
+ expiresAtMs: value.expiresAtMs,
884
+ ...value.attempted === true ? { attempted: true } : {},
885
+ ...typeof value.attemptedAtMs === "number" ? { attemptedAtMs: value.attemptedAtMs } : {},
886
+ ...typeof value.sessionId === "string" ? { sessionId: value.sessionId } : {},
877
887
  delivered: value.delivered === true,
878
- ...value.failed === true ? { failed: true } : {}
888
+ ...value.failed === true || !value.delivered && !value.attempted && value.expiresAtMs <= Date.now() ? { failed: true } : {}
879
889
  };
880
890
  } catch {
881
891
  return null;
@@ -921,7 +931,7 @@ var pruneExpiredCommandStore = () => {
921
931
  };
922
932
  var readPendingCommand = (sessionId, namespace = "") => {
923
933
  const commands = pruneExpiredCommands(commandDirFor(sessionId, namespace));
924
- return commands.find((command) => !command.delivered && !command.failed) ?? commands[0] ?? null;
934
+ return commands.find((command) => !command.delivered && !command.failed && !command.attempted) ?? commands[0] ?? null;
925
935
  };
926
936
  var savePendingCommand = (sessionId, command, namespace = "") => {
927
937
  const dir = commandDirFor(sessionId, namespace);
@@ -929,7 +939,21 @@ var savePendingCommand = (sessionId, command, namespace = "") => {
929
939
  mkdirSync(dir, { recursive: true, mode: 448 });
930
940
  pruneExpiredCommandStore();
931
941
  if (readPendingCommandById(sessionId, command.id, namespace)) return false;
932
- writeFileSync(commandFile(sessionId, command.id, namespace), JSON.stringify(command), { encoding: "utf-8", mode: 384, flag: "wx" });
942
+ writeFileSync(commandFile(sessionId, command.id, namespace), JSON.stringify({ ...command, sessionId }), { encoding: "utf-8", mode: 384, flag: "wx" });
943
+ const descriptor = openSync(commandFile(sessionId, command.id, namespace), "r");
944
+ try {
945
+ fsyncSync(descriptor);
946
+ } finally {
947
+ closeSync(descriptor);
948
+ }
949
+ if (process.platform !== "win32") {
950
+ const directory = openSync(dir, "r");
951
+ try {
952
+ fsyncSync(directory);
953
+ } finally {
954
+ closeSync(directory);
955
+ }
956
+ }
933
957
  return true;
934
958
  } catch {
935
959
  return false;
@@ -940,19 +964,36 @@ var updatePendingCommand = (sessionId, id, update, namespace = "") => {
940
964
  if (!command) return false;
941
965
  const currentFile = commandFile(sessionId, id, namespace);
942
966
  const file = existsSync(currentFile) ? currentFile : legacyCommandFile(sessionId, namespace);
943
- const temporary = `${file}.${process.pid}.tmp`;
944
967
  try {
945
- writeFileSync(temporary, JSON.stringify({ ...command, ...update, text: "" }), { encoding: "utf-8", mode: 384 });
946
- renameSync(temporary, file);
968
+ writeJsonAtomicDurable(file, { ...command, ...update, text: "" }, 384);
947
969
  return true;
948
970
  } catch {
971
+ return false;
972
+ }
973
+ };
974
+ var markPendingCommandAttempted = (sessionId, id, namespace = "") => {
975
+ const command = readPendingCommandById(sessionId, id, namespace);
976
+ if (!command || command.attempted || command.delivered || command.failed) return false;
977
+ try {
978
+ const descriptor = openSync(`${commandFile(sessionId, id, namespace)}.emission`, "wx", 384);
949
979
  try {
950
- unlinkSync(temporary);
951
- } catch {
980
+ fsyncSync(descriptor);
981
+ } finally {
982
+ closeSync(descriptor);
952
983
  }
984
+ return updatePendingCommand(sessionId, id, { attempted: true, attemptedAtMs: Date.now() }, namespace);
985
+ } catch {
953
986
  return false;
954
987
  }
955
988
  };
989
+ var pendingCommandReceipts = (namespace) => {
990
+ const root = join(commandRoot(), createHash("sha256").update(namespace).digest("hex").slice(0, 16));
991
+ try {
992
+ return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).flatMap((entry) => pruneExpiredCommands(join(root, entry.name)).filter((command) => command.delivered || command.failed || command.attempted && Date.now() - (command.attemptedAtMs ?? 0) >= COMMAND_RECOVERY.emissionRecoveryGraceMs).map((command) => ({ sessionId: command.sessionId ?? entry.name, command })));
993
+ } catch {
994
+ return [];
995
+ }
996
+ };
956
997
  var markPendingCommandDelivered = (sessionId, id, namespace = "") => updatePendingCommand(sessionId, id, { delivered: true, failed: void 0 }, namespace);
957
998
  var markPendingCommandFailed = (sessionId, id, namespace = "") => updatePendingCommand(sessionId, id, { delivered: false, failed: true }, namespace);
958
999
  var removePendingCommand = (sessionId, id, namespace = "") => {
@@ -961,6 +1002,10 @@ var removePendingCommand = (sessionId, id, namespace = "") => {
961
1002
  unlinkSync(commandFile(sessionId, id, namespace));
962
1003
  } catch {
963
1004
  }
1005
+ try {
1006
+ rmSync(`${commandFile(sessionId, id, namespace)}.emission`, { force: true });
1007
+ } catch {
1008
+ }
964
1009
  try {
965
1010
  if (readCommandFile(legacyCommandFile(sessionId, namespace))?.id === id) {
966
1011
  unlinkSync(legacyCommandFile(sessionId, namespace));
@@ -1017,6 +1062,48 @@ var removePendingSession = (sessionId) => {
1017
1062
  }
1018
1063
  };
1019
1064
 
1065
+ // src/hook-command-delivery.ts
1066
+ import { AsyncLocalStorage } from "async_hooks";
1067
+ var delivery = new AsyncLocalStorage();
1068
+ var stageHookCommand = (command) => {
1069
+ const staged = delivery.getStore();
1070
+ if (!staged) return false;
1071
+ staged.push(command);
1072
+ return true;
1073
+ };
1074
+ var writeOutput = (output) => new Promise((resolve3, reject) => {
1075
+ process.stdout.write(output, (error) => error ? reject(error) : resolve3());
1076
+ });
1077
+ var emitHookOutput = async (render, write = writeOutput) => {
1078
+ const staged = [];
1079
+ const output = await delivery.run(staged, render);
1080
+ if (!output) return;
1081
+ for (const command of staged) {
1082
+ if (!markPendingCommandAttempted(
1083
+ command.sessionId,
1084
+ command.commandId,
1085
+ command.namespace
1086
+ )) {
1087
+ throw new Error("Could not persist instruction delivery intent");
1088
+ }
1089
+ }
1090
+ await write(output);
1091
+ for (const command of staged) {
1092
+ if (!markPendingCommandDelivered(
1093
+ command.sessionId,
1094
+ command.commandId,
1095
+ command.namespace
1096
+ ))
1097
+ continue;
1098
+ if (await command.acknowledge())
1099
+ removePendingCommand(
1100
+ command.sessionId,
1101
+ command.commandId,
1102
+ command.namespace
1103
+ );
1104
+ }
1105
+ };
1106
+
1020
1107
  // src/policy.ts
1021
1108
  import { createHash as createHash2 } from "crypto";
1022
1109
  import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
@@ -1161,7 +1248,7 @@ var fetchModeState = async (apiKey, sessionId, reuseWithinMs = 0, signal) => {
1161
1248
  var fetchModeOverride = async (apiKey) => (await fetchModeState(apiKey)).mode;
1162
1249
 
1163
1250
  // src/usage.ts
1164
- import { closeSync, mkdirSync as mkdirSync2, openSync, readFileSync as readFileSync3, readSync, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
1251
+ import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2, readFileSync as readFileSync3, readSync, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
1165
1252
  import { createHash as createHash3 } from "crypto";
1166
1253
  import { join as join3 } from "path";
1167
1254
  import { tmpdir as tmpdir3 } from "os";
@@ -1197,7 +1284,7 @@ var readState = (path) => {
1197
1284
  return emptyState();
1198
1285
  };
1199
1286
  var readRange = (path, start, end) => {
1200
- const fd = openSync(path, "r");
1287
+ const fd = openSync2(path, "r");
1201
1288
  try {
1202
1289
  const chunks = [];
1203
1290
  let position = start;
@@ -1211,7 +1298,7 @@ var readRange = (path, start, end) => {
1211
1298
  }
1212
1299
  return Buffer.concat(chunks);
1213
1300
  } finally {
1214
- closeSync(fd);
1301
+ closeSync2(fd);
1215
1302
  }
1216
1303
  };
1217
1304
  var applyLine = (state, line) => {
@@ -1915,6 +2002,13 @@ var reportEvent = async (event, options = {}) => {
1915
2002
  const result = await res.json();
1916
2003
  const withoutPending = () => ({ ...result, pendingCommand: void 0, pendingCommandId: void 0 });
1917
2004
  if (storedCommand) {
2005
+ if (storedCommand.attempted && !storedCommand.delivered && Date.now() - (storedCommand.attemptedAtMs ?? 0) < COMMAND_RECOVERY.emissionRecoveryGraceMs) return withoutPending();
2006
+ if (!storedCommand.delivered && !storedCommand.failed && !storedCommand.attempted && stageHookCommand({
2007
+ sessionId: sessionKey,
2008
+ commandId: storedCommand.id,
2009
+ namespace: receiptNamespace,
2010
+ acknowledge: () => acknowledgePendingCommand(apiKey, baseUrl, storedCommand.id, event.sessionId, machineId, ACK_RESERVE_MS)
2011
+ })) return { ...withoutPending(), pendingCommand: storedCommand.text, pendingCommandId: storedCommand.id };
1918
2012
  const failed = storedCommand.failed === true;
1919
2013
  const acknowledged = await acknowledgePendingCommand(
1920
2014
  apiKey,
@@ -1923,11 +2017,11 @@ var reportEvent = async (event, options = {}) => {
1923
2017
  event.sessionId,
1924
2018
  machineId,
1925
2019
  ackTimeoutMs(options.timeoutMs ?? 1e4),
1926
- failed ? "failed" : "delivered",
2020
+ failed ? "failed" : storedCommand.attempted && !storedCommand.delivered ? "uncertain" : "delivered",
1927
2021
  options.signal
1928
2022
  );
1929
2023
  if (!acknowledged) return withoutPending();
1930
- if (storedCommand.delivered || failed) {
2024
+ if (storedCommand.delivered || storedCommand.attempted || failed) {
1931
2025
  removePendingCommand(sessionKey, storedCommand.id, receiptNamespace);
1932
2026
  return withoutPending();
1933
2027
  }
@@ -1942,6 +2036,13 @@ var reportEvent = async (event, options = {}) => {
1942
2036
  delivered: false
1943
2037
  }, receiptNamespace);
1944
2038
  if (!saved) return withoutPending();
2039
+ const commandId = result.pendingCommandId;
2040
+ if (stageHookCommand({
2041
+ sessionId: sessionKey,
2042
+ commandId,
2043
+ namespace: receiptNamespace,
2044
+ acknowledge: () => acknowledgePendingCommand(apiKey, baseUrl, commandId, event.sessionId, machineId, ACK_RESERVE_MS)
2045
+ })) return result;
1945
2046
  const acknowledged = await acknowledgePendingCommand(
1946
2047
  apiKey,
1947
2048
  baseUrl,
@@ -2303,14 +2404,16 @@ export {
2303
2404
  isCodexGuardianRolloutHead,
2304
2405
  scanCodexGuardianReviews,
2305
2406
  codexReviewerDenialsSince,
2306
- phoneDrivenEnv,
2307
2407
  DEFAULT_SESSION,
2308
2408
  readPendingCommandById,
2309
2409
  readPendingCommand,
2310
2410
  savePendingCommand,
2411
+ pendingCommandReceipts,
2311
2412
  markPendingCommandDelivered,
2312
2413
  markPendingCommandFailed,
2313
2414
  removePendingCommand,
2415
+ emitHookOutput,
2416
+ phoneDrivenEnv,
2314
2417
  claimThrottle,
2315
2418
  releaseThrottle,
2316
2419
  policyRequestFor,