pushary 1.8.0

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 (186) hide show
  1. package/CHANGELOG.md +1943 -0
  2. package/LICENSE +21 -0
  3. package/README.md +330 -0
  4. package/data/SKILL.md +591 -0
  5. package/data/cowork/SKILL.md +77 -0
  6. package/data/cursor-plugin/.cursor-plugin/plugin.json +25 -0
  7. package/data/cursor-plugin/CHANGELOG.md +70 -0
  8. package/data/cursor-plugin/CONTRIBUTING.md +40 -0
  9. package/data/cursor-plugin/LICENSE +21 -0
  10. package/data/cursor-plugin/README.md +113 -0
  11. package/data/cursor-plugin/SECURITY.md +33 -0
  12. package/data/cursor-plugin/assets/logo.png +0 -0
  13. package/data/cursor-plugin/commands/notify-when-done.md +14 -0
  14. package/data/cursor-plugin/commands/pushary-test.md +13 -0
  15. package/data/cursor-plugin/hooks/hooks.json +75 -0
  16. package/data/cursor-plugin/mcp.json +11 -0
  17. package/data/cursor-plugin/rules/pushary.mdc +40 -0
  18. package/data/cursor-plugin/scripts/pushary-gate.mjs +724 -0
  19. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +137 -0
  20. package/data/cursor-plugin/scripts/redaction.mjs +51 -0
  21. package/data/cursor-plugin/skills/pushary/SKILL.md +584 -0
  22. package/data/vscode-plugin/.claude-plugin/plugin.json +28 -0
  23. package/data/vscode-plugin/.mcp.json +11 -0
  24. package/data/vscode-plugin/CHANGELOG.md +49 -0
  25. package/data/vscode-plugin/CONTRIBUTING.md +40 -0
  26. package/data/vscode-plugin/LICENSE +21 -0
  27. package/data/vscode-plugin/README.md +128 -0
  28. package/data/vscode-plugin/SECURITY.md +56 -0
  29. package/data/vscode-plugin/assets/logo.png +0 -0
  30. package/data/vscode-plugin/commands/notify-when-done.md +14 -0
  31. package/data/vscode-plugin/commands/pushary-test.md +13 -0
  32. package/data/vscode-plugin/hooks/hooks.json +60 -0
  33. package/data/vscode-plugin/scripts/pushary-gate.mjs +762 -0
  34. package/data/vscode-plugin/scripts/redaction.mjs +51 -0
  35. package/data/vscode-plugin/skills/pushary/SKILL.md +584 -0
  36. package/dist/bin/pushary-bell-hook.d.ts +1 -0
  37. package/dist/bin/pushary-bell-hook.js +46 -0
  38. package/dist/bin/pushary-bell.d.ts +1 -0
  39. package/dist/bin/pushary-bell.js +146 -0
  40. package/dist/bin/pushary-claude.d.ts +1 -0
  41. package/dist/bin/pushary-claude.js +1916 -0
  42. package/dist/bin/pushary-clean.d.ts +1 -0
  43. package/dist/bin/pushary-clean.js +1300 -0
  44. package/dist/bin/pushary-codex-bridge.d.ts +1 -0
  45. package/dist/bin/pushary-codex-bridge.js +599 -0
  46. package/dist/bin/pushary-codex-hook.d.ts +1 -0
  47. package/dist/bin/pushary-codex-hook.js +886 -0
  48. package/dist/bin/pushary-codex.d.ts +1 -0
  49. package/dist/bin/pushary-codex.js +125 -0
  50. package/dist/bin/pushary-connect.d.ts +1 -0
  51. package/dist/bin/pushary-connect.js +100 -0
  52. package/dist/bin/pushary-cowork.d.ts +1 -0
  53. package/dist/bin/pushary-cowork.js +36 -0
  54. package/dist/bin/pushary-daemon-supervisor.d.ts +1 -0
  55. package/dist/bin/pushary-daemon-supervisor.js +27 -0
  56. package/dist/bin/pushary-daemon.d.ts +1 -0
  57. package/dist/bin/pushary-daemon.js +878 -0
  58. package/dist/bin/pushary-disconnect.d.ts +1 -0
  59. package/dist/bin/pushary-disconnect.js +264 -0
  60. package/dist/bin/pushary-doctor.d.ts +1 -0
  61. package/dist/bin/pushary-doctor.js +1433 -0
  62. package/dist/bin/pushary-elicitation-hook.d.ts +1 -0
  63. package/dist/bin/pushary-elicitation-hook.js +149 -0
  64. package/dist/bin/pushary-gemini-bridge.d.ts +1 -0
  65. package/dist/bin/pushary-gemini-bridge.js +339 -0
  66. package/dist/bin/pushary-gemini-hook.d.ts +1 -0
  67. package/dist/bin/pushary-gemini-hook.js +381 -0
  68. package/dist/bin/pushary-hook.d.ts +1 -0
  69. package/dist/bin/pushary-hook.js +95 -0
  70. package/dist/bin/pushary-login.d.ts +1 -0
  71. package/dist/bin/pushary-login.js +198 -0
  72. package/dist/bin/pushary-logout.d.ts +1 -0
  73. package/dist/bin/pushary-logout.js +147 -0
  74. package/dist/bin/pushary-mcp.d.ts +1 -0
  75. package/dist/bin/pushary-mcp.js +114 -0
  76. package/dist/bin/pushary-mode.d.ts +1 -0
  77. package/dist/bin/pushary-mode.js +130 -0
  78. package/dist/bin/pushary-notification-hook.d.ts +1 -0
  79. package/dist/bin/pushary-notification-hook.js +56 -0
  80. package/dist/bin/pushary-opencode-hook.d.ts +1 -0
  81. package/dist/bin/pushary-opencode-hook.js +338 -0
  82. package/dist/bin/pushary-permission-denied-hook.d.ts +1 -0
  83. package/dist/bin/pushary-permission-denied-hook.js +60 -0
  84. package/dist/bin/pushary-permission-hook.d.ts +1 -0
  85. package/dist/bin/pushary-permission-hook.js +65 -0
  86. package/dist/bin/pushary-post-hook.d.ts +1 -0
  87. package/dist/bin/pushary-post-hook.js +70 -0
  88. package/dist/bin/pushary-prompt-hook.d.ts +1 -0
  89. package/dist/bin/pushary-prompt-hook.js +61 -0
  90. package/dist/bin/pushary-session-end-hook.d.ts +1 -0
  91. package/dist/bin/pushary-session-end-hook.js +59 -0
  92. package/dist/bin/pushary-session-start-hook.d.ts +1 -0
  93. package/dist/bin/pushary-session-start-hook.js +72 -0
  94. package/dist/bin/pushary-setup.d.ts +1 -0
  95. package/dist/bin/pushary-setup.js +2660 -0
  96. package/dist/bin/pushary-stats.d.ts +1 -0
  97. package/dist/bin/pushary-stats.js +44 -0
  98. package/dist/bin/pushary-status.d.ts +1 -0
  99. package/dist/bin/pushary-status.js +262 -0
  100. package/dist/bin/pushary-stop-hook.d.ts +1 -0
  101. package/dist/bin/pushary-stop-hook.js +63 -0
  102. package/dist/bin/pushary-stopfailure-hook.d.ts +1 -0
  103. package/dist/bin/pushary-stopfailure-hook.js +56 -0
  104. package/dist/bin/pushary-suggestions.d.ts +1 -0
  105. package/dist/bin/pushary-suggestions.js +100 -0
  106. package/dist/bin/pushary-transcript-register.d.ts +1 -0
  107. package/dist/bin/pushary-transcript-register.js +40 -0
  108. package/dist/bin/pushary-transcripts.d.ts +1 -0
  109. package/dist/bin/pushary-transcripts.js +77 -0
  110. package/dist/bin/pushary-upgrade.d.ts +1 -0
  111. package/dist/bin/pushary-upgrade.js +599 -0
  112. package/dist/bin/pushary-wait.d.ts +1 -0
  113. package/dist/bin/pushary-wait.js +122 -0
  114. package/dist/bin/pushary.d.ts +1 -0
  115. package/dist/bin/pushary.js +74 -0
  116. package/dist/chunk-2ABTSGFT.js +173 -0
  117. package/dist/chunk-2OY3ZZ5N.js +124 -0
  118. package/dist/chunk-3EGEA4KH.js +44 -0
  119. package/dist/chunk-3EVPNIBE.js +185 -0
  120. package/dist/chunk-5OP5MQI7.js +45 -0
  121. package/dist/chunk-6J2JC2RT.js +149 -0
  122. package/dist/chunk-7QLSKOSU.js +19 -0
  123. package/dist/chunk-7Z7Q4GGS.js +88 -0
  124. package/dist/chunk-A2A2YTMG.js +835 -0
  125. package/dist/chunk-AHV4LNB5.js +377 -0
  126. package/dist/chunk-AXPCESYO.js +197 -0
  127. package/dist/chunk-C2WCPBF7.js +86 -0
  128. package/dist/chunk-CJVVKOSR.js +73 -0
  129. package/dist/chunk-CULUZTWQ.js +2117 -0
  130. package/dist/chunk-CVQYGMSR.js +142 -0
  131. package/dist/chunk-CVWG2N3Y.js +16 -0
  132. package/dist/chunk-D2FX3EPW.js +15 -0
  133. package/dist/chunk-DB3ONZB4.js +44 -0
  134. package/dist/chunk-DE4Y6TCC.js +160 -0
  135. package/dist/chunk-E4FJTUH4.js +249 -0
  136. package/dist/chunk-EPCXUP3P.js +41 -0
  137. package/dist/chunk-EX3GAPA4.js +44 -0
  138. package/dist/chunk-EYK3GSRH.js +143 -0
  139. package/dist/chunk-GMXKITVA.js +70 -0
  140. package/dist/chunk-GPEGOGRJ.js +49 -0
  141. package/dist/chunk-GU3EJCVV.js +43 -0
  142. package/dist/chunk-HQ6G3B5R.js +59 -0
  143. package/dist/chunk-HZVVNGEW.js +22 -0
  144. package/dist/chunk-IPVKH2ST.js +231 -0
  145. package/dist/chunk-J5TIV3J6.js +238 -0
  146. package/dist/chunk-JU6W3XAU.js +64 -0
  147. package/dist/chunk-JYG4B33G.js +227 -0
  148. package/dist/chunk-JZTHGAPA.js +503 -0
  149. package/dist/chunk-KGDWDSNL.js +102 -0
  150. package/dist/chunk-KVQBWI5T.js +99 -0
  151. package/dist/chunk-KZERVKTD.js +16 -0
  152. package/dist/chunk-LXQ5FBBD.js +47 -0
  153. package/dist/chunk-M5ICYGHT.js +138 -0
  154. package/dist/chunk-M5JDZ45W.js +943 -0
  155. package/dist/chunk-MDEPU45E.js +1226 -0
  156. package/dist/chunk-MPWXGONV.js +157 -0
  157. package/dist/chunk-N6IOSZOE.js +185 -0
  158. package/dist/chunk-NGDD6TXY.js +192 -0
  159. package/dist/chunk-NQTHFF4W.js +2830 -0
  160. package/dist/chunk-OKXS7WDZ.js +68 -0
  161. package/dist/chunk-OLQRRFBX.js +21 -0
  162. package/dist/chunk-P7WQEVWA.js +307 -0
  163. package/dist/chunk-POFBE6ZY.js +12 -0
  164. package/dist/chunk-PQ4K74WL.js +30 -0
  165. package/dist/chunk-PUZZELE6.js +37 -0
  166. package/dist/chunk-Q7E4I6UA.js +767 -0
  167. package/dist/chunk-QCGNGEGE.js +15 -0
  168. package/dist/chunk-R7437YI3.js +151 -0
  169. package/dist/chunk-RHR6NARM.js +305 -0
  170. package/dist/chunk-SAXBC4AZ.js +60 -0
  171. package/dist/chunk-SGZJ5LYH.js +76 -0
  172. package/dist/chunk-SIFVFP6T.js +70 -0
  173. package/dist/chunk-SLFABHW3.js +150 -0
  174. package/dist/chunk-T7E75EKA.js +67 -0
  175. package/dist/chunk-TY4JT7W3.js +38 -0
  176. package/dist/chunk-U4TMAANR.js +111 -0
  177. package/dist/chunk-UI36QSBI.js +177 -0
  178. package/dist/chunk-VQKRG3AC.js +339 -0
  179. package/dist/chunk-WE2J62NC.js +1131 -0
  180. package/dist/chunk-XHKBHWLX.js +14 -0
  181. package/dist/chunk-ZSZSSJCV.js +275 -0
  182. package/dist/chunk-ZVSKMPBZ.js +135 -0
  183. package/dist/reapply-CW3MA66V.js +34 -0
  184. package/dist/src/index.d.ts +204 -0
  185. package/dist/src/index.js +64 -0
  186. package/package.json +108 -0
@@ -0,0 +1,338 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ isGatingMoment,
4
+ recordKeylessMoment
5
+ } from "../chunk-JU6W3XAU.js";
6
+ import {
7
+ readHookInput
8
+ } from "../chunk-KGDWDSNL.js";
9
+ import {
10
+ announceSubscriptionRequired,
11
+ denyReasonFrom,
12
+ isDeferAnswer
13
+ } from "../chunk-5OP5MQI7.js";
14
+ import "../chunk-JZTHGAPA.js";
15
+ import "../chunk-SGZJ5LYH.js";
16
+ import "../chunk-EYK3GSRH.js";
17
+ import "../chunk-ZVSKMPBZ.js";
18
+ import "../chunk-C2WCPBF7.js";
19
+ import "../chunk-6J2JC2RT.js";
20
+ import "../chunk-WE2J62NC.js";
21
+ import "../chunk-3EVPNIBE.js";
22
+ import "../chunk-OKXS7WDZ.js";
23
+ import "../chunk-MPWXGONV.js";
24
+ import "../chunk-SAXBC4AZ.js";
25
+ import "../chunk-OLQRRFBX.js";
26
+ import "../chunk-XHKBHWLX.js";
27
+ import {
28
+ HOOK_FALLBACK_MAX,
29
+ OPENCODE_TOOL_NAMES,
30
+ UNNAMED_ACTION,
31
+ deriveActionBody,
32
+ deriveBlocker,
33
+ deriveToolTarget,
34
+ describeToolCall,
35
+ fetchModeState,
36
+ getPolicy,
37
+ handlePostToolUse,
38
+ handleStop,
39
+ handleUserPrompt,
40
+ policyRequestFor,
41
+ readLastPrompt,
42
+ repoKeyFor,
43
+ scopePathFor
44
+ } from "../chunk-CULUZTWQ.js";
45
+ import {
46
+ DEFAULT_SESSION
47
+ } from "../chunk-N6IOSZOE.js";
48
+ import "../chunk-EPCXUP3P.js";
49
+ import {
50
+ DECISION_STOP_REASON,
51
+ UNVERIFIABLE_APPROVAL_REASON,
52
+ askUser,
53
+ cancelQuestion,
54
+ isDecisionStopped,
55
+ isLocalQuestionHandoff,
56
+ sendNotification,
57
+ unavailableQuestionUnlessSubscriptionRequired,
58
+ waitForQuestion
59
+ } from "../chunk-NGDD6TXY.js";
60
+ import {
61
+ exitAfterClientReports
62
+ } from "../chunk-CVQYGMSR.js";
63
+ import "../chunk-POFBE6ZY.js";
64
+ import "../chunk-GMXKITVA.js";
65
+ import "../chunk-P7WQEVWA.js";
66
+ import {
67
+ SubscriptionRequiredError
68
+ } from "../chunk-M5ICYGHT.js";
69
+ import "../chunk-2ABTSGFT.js";
70
+ import "../chunk-2OY3ZZ5N.js";
71
+ import {
72
+ getMachineId
73
+ } from "../chunk-LXQ5FBBD.js";
74
+ import "../chunk-7QLSKOSU.js";
75
+ import {
76
+ EXIT
77
+ } from "../chunk-KZERVKTD.js";
78
+ import "../chunk-DB3ONZB4.js";
79
+ import "../chunk-A2A2YTMG.js";
80
+ import "../chunk-T7E75EKA.js";
81
+ import {
82
+ getApiKey
83
+ } from "../chunk-GPEGOGRJ.js";
84
+ import "../chunk-E4FJTUH4.js";
85
+ import {
86
+ KILL_REASON,
87
+ OPENCODE_APPROVAL_EVENT,
88
+ effectiveWaitSeconds,
89
+ gateOutputFor,
90
+ hookWaitClamped,
91
+ hookWaitDeadline,
92
+ redactSecrets,
93
+ resolveGate
94
+ } from "../chunk-NQTHFF4W.js";
95
+
96
+ // bin/pushary-opencode-hook.ts
97
+ import { basename } from "path";
98
+
99
+ // src/opencode-adapter.ts
100
+ var OPENCODE_AGENT = { type: "opencode", label: "OpenCode" };
101
+ var toOpenCodePolicyLookup = (toolName, toolInput) => ({
102
+ tool: OPENCODE_TOOL_NAMES[toolName] ?? toolName,
103
+ input: toolInput
104
+ });
105
+ var openCodeAllow = () => ({ kind: "allow" });
106
+ var openCodeDeny = (reason) => ({ kind: "deny", reason });
107
+ var openCodePass = () => ({ kind: "pass" });
108
+ var openCodeTimeoutDecision = (timeoutAction, denyReason = "No response within timeout") => {
109
+ if (timeoutAction === "approve") return openCodeAllow();
110
+ if (timeoutAction === "deny") return openCodeDeny(denyReason);
111
+ return openCodePass();
112
+ };
113
+ var toOpenCodeWire = (decision) => {
114
+ if (decision.kind === "pass") return null;
115
+ const output = gateOutputFor(
116
+ "opencode",
117
+ OPENCODE_APPROVAL_EVENT,
118
+ decision.kind,
119
+ decision.kind === "deny" ? decision.reason : void 0
120
+ );
121
+ return output ?? null;
122
+ };
123
+
124
+ // bin/pushary-opencode-hook.ts
125
+ var START_MS = Date.now();
126
+ var outstanding;
127
+ var agentNameFor = (input) => `${OPENCODE_AGENT.label} - ${basename(input.cwd ?? process.cwd())}`;
128
+ var describeFor = (input, lookup) => {
129
+ if (lookup.tool) return describeToolCall(lookup.tool, lookup.input, "hook");
130
+ return redactSecrets(input.title ?? "").trim().slice(0, HOOK_FALLBACK_MAX) || UNNAMED_ACTION;
131
+ };
132
+ var pushQuestion = async (apiKey, input, lookup, waitSeconds, mode, pollInterval = 2e3) => {
133
+ const projectName = basename(input.cwd ?? process.cwd());
134
+ const description = describeFor(input, lookup);
135
+ const result = await askUser(apiKey, {
136
+ question: `Allow ${description}?`,
137
+ type: "confirm",
138
+ context: `Agent wants to run this in ${projectName}`,
139
+ agentName: agentNameFor(input),
140
+ sessionId: input.session_id,
141
+ machineId: getMachineId(),
142
+ toolName: lookup.tool,
143
+ toolTarget: deriveToolTarget(lookup.tool, lookup.input),
144
+ intent: readLastPrompt(input.session_id || DEFAULT_SESSION),
145
+ action: description,
146
+ blocker: deriveBlocker(mode),
147
+ actionBody: deriveActionBody(lookup.tool, lookup.input),
148
+ repoKey: repoKeyFor(input.cwd)
149
+ }).catch(unavailableQuestionUnlessSubscriptionRequired);
150
+ outstanding = { apiKey, correlationId: result.correlationId };
151
+ const now = Date.now();
152
+ const deadline = hookWaitDeadline(START_MS, waitSeconds, "opencode", now);
153
+ const clampCut = hookWaitClamped(START_MS, waitSeconds, "opencode", now);
154
+ const answer = await waitForQuestion(apiKey, result, deadline, pollInterval);
155
+ outstanding = void 0;
156
+ return { answer, localHandoff: !answer.answered && isLocalQuestionHandoff(result), clampCut };
157
+ };
158
+ var notifyApprovalNeeded = async (apiKey, input, lookup) => {
159
+ try {
160
+ await sendNotification(apiKey, {
161
+ title: "Agent needs approval",
162
+ body: describeFor(input, lookup),
163
+ agentName: agentNameFor(input),
164
+ sessionId: input.session_id,
165
+ machineId: getMachineId()
166
+ });
167
+ } catch {
168
+ }
169
+ };
170
+ var openCodeStepsAside = (error, input) => {
171
+ announceSubscriptionRequired(error.upgradeUrl, input.session_id);
172
+ return openCodePass();
173
+ };
174
+ var handlePushOnly = async (apiKey, input, lookup, timeoutSeconds, timeoutAction) => {
175
+ let pushed;
176
+ try {
177
+ pushed = await pushQuestion(
178
+ apiKey,
179
+ input,
180
+ lookup,
181
+ effectiveWaitSeconds(timeoutAction, timeoutSeconds, "opencode"),
182
+ "push_only"
183
+ );
184
+ } catch (error) {
185
+ if (error instanceof SubscriptionRequiredError) return openCodeStepsAside(error, input);
186
+ return openCodeDeny(UNVERIFIABLE_APPROVAL_REASON);
187
+ }
188
+ const { answer, localHandoff, clampCut } = pushed;
189
+ if (isDecisionStopped(answer)) return openCodeDeny(DECISION_STOP_REASON);
190
+ if (localHandoff) return openCodePass();
191
+ if (answer.answered) {
192
+ if (isDeferAnswer(answer.value)) return openCodePass();
193
+ return answer.value === "yes" ? openCodeAllow() : openCodeDeny(denyReasonFrom(answer.value, answer.note));
194
+ }
195
+ if (clampCut) return openCodePass();
196
+ return openCodeTimeoutDecision(timeoutAction);
197
+ };
198
+ var handlePushFirst = async (apiKey, input, lookup, pushFirstSeconds) => {
199
+ let pushed;
200
+ try {
201
+ pushed = await pushQuestion(apiKey, input, lookup, pushFirstSeconds, "push_first", 1500);
202
+ } catch (error) {
203
+ if (error instanceof SubscriptionRequiredError) return openCodeStepsAside(error, input);
204
+ return openCodePass();
205
+ }
206
+ const { answer, localHandoff } = pushed;
207
+ if (isDecisionStopped(answer)) return openCodeDeny(DECISION_STOP_REASON);
208
+ if (localHandoff) return openCodePass();
209
+ if (answer.answered) {
210
+ if (isDeferAnswer(answer.value)) return openCodePass();
211
+ return answer.value === "yes" ? openCodeAllow() : openCodeDeny(denyReasonFrom(answer.value, answer.note));
212
+ }
213
+ return openCodePass();
214
+ };
215
+ var decidePermission = async (input) => {
216
+ let apiKey;
217
+ try {
218
+ apiKey = getApiKey();
219
+ } catch {
220
+ try {
221
+ const lookup = toOpenCodePolicyLookup(input.tool_name ?? "", input.tool_input ?? {});
222
+ if (isGatingMoment(lookup.tool, lookup.input)) {
223
+ recordKeylessMoment({
224
+ ts: Date.now(),
225
+ tool: lookup.tool,
226
+ project: basename(input.cwd ?? process.cwd()),
227
+ sessionId: input.session_id
228
+ });
229
+ }
230
+ } catch {
231
+ }
232
+ return openCodePass();
233
+ }
234
+ try {
235
+ const modeState = await fetchModeState(apiKey, input.session_id);
236
+ const policyRequest = policyRequestFor(OPENCODE_AGENT.type);
237
+ const lookup = toOpenCodePolicyLookup(input.tool_name ?? "", input.tool_input ?? {});
238
+ const config = await getPolicy(
239
+ apiKey,
240
+ modeState.policyVersion,
241
+ policyRequest.agent,
242
+ policyRequest.repoAware,
243
+ input.session_id
244
+ );
245
+ const scopePath = modeState.scope ? scopePathFor(lookup.tool, lookup.input, input.cwd) : void 0;
246
+ const verdict = resolveGate({
247
+ modeState,
248
+ config,
249
+ toolName: lookup.tool,
250
+ toolInputs: [lookup.input],
251
+ scopePaths: scopePath ? [scopePath] : [],
252
+ cwd: input.cwd,
253
+ repoKey: repoKeyFor(input.cwd),
254
+ sessionId: input.session_id
255
+ });
256
+ if (verdict.kind === "kill") return openCodeDeny(KILL_REASON);
257
+ if (verdict.kind === "allow") return openCodeAllow();
258
+ if (verdict.kind === "deny") return openCodeDeny(verdict.reason);
259
+ if (verdict.kind === "defer") return openCodePass();
260
+ const toolPolicy = verdict.policy;
261
+ switch (toolPolicy.mode) {
262
+ case "push_only":
263
+ return handlePushOnly(apiKey, input, lookup, toolPolicy.timeoutSeconds, toolPolicy.timeoutAction);
264
+ case "terminal_only":
265
+ return openCodePass();
266
+ case "push_first":
267
+ return handlePushFirst(apiKey, input, lookup, toolPolicy.pushFirstSeconds);
268
+ case "notify_only":
269
+ await notifyApprovalNeeded(apiKey, input, lookup);
270
+ return openCodePass();
271
+ default:
272
+ return handlePushFirst(apiKey, input, lookup, toolPolicy.pushFirstSeconds);
273
+ }
274
+ } catch {
275
+ return openCodePass();
276
+ }
277
+ };
278
+ var withdrawn = false;
279
+ var emit = (wire) => {
280
+ if (!wire || withdrawn) return;
281
+ try {
282
+ process.stdout.write(JSON.stringify(wire));
283
+ } catch {
284
+ }
285
+ };
286
+ var withdrawAndExit = () => {
287
+ withdrawn = true;
288
+ const pending = outstanding;
289
+ outstanding = void 0;
290
+ if (!pending) {
291
+ process.exit(0);
292
+ }
293
+ cancelQuestion(pending.apiKey, pending.correlationId).catch(() => {
294
+ }).finally(() => process.exit(0));
295
+ setTimeout(() => process.exit(0), 3e3).unref();
296
+ };
297
+ var main = async () => {
298
+ process.on("SIGTERM", withdrawAndExit);
299
+ const input = await readHookInput("opencode");
300
+ if (!input) {
301
+ return exitAfterClientReports(EXIT.OK);
302
+ }
303
+ try {
304
+ switch (input.hook_event_name) {
305
+ case OPENCODE_APPROVAL_EVENT:
306
+ emit(toOpenCodeWire(await decidePermission(input)));
307
+ break;
308
+ case "tool.execute.after": {
309
+ const lookup = toOpenCodePolicyLookup(input.tool_name ?? "", input.tool_input ?? {});
310
+ await handlePostToolUse({
311
+ tool_name: lookup.tool,
312
+ tool_input: lookup.input,
313
+ tool_result: input.tool_result,
314
+ cwd: input.cwd,
315
+ session_id: input.session_id
316
+ }, OPENCODE_AGENT);
317
+ break;
318
+ }
319
+ case "chat.message":
320
+ await handleUserPrompt({
321
+ prompt: input.prompt,
322
+ cwd: input.cwd,
323
+ session_id: input.session_id
324
+ }, OPENCODE_AGENT);
325
+ break;
326
+ case "session.idle":
327
+ await handleStop({
328
+ cwd: input.cwd,
329
+ session_id: input.session_id
330
+ }, OPENCODE_AGENT);
331
+ break;
332
+ default:
333
+ break;
334
+ }
335
+ } catch {
336
+ }
337
+ };
338
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ handlePermissionDenied
4
+ } from "../chunk-Q7E4I6UA.js";
5
+ import "../chunk-J5TIV3J6.js";
6
+ import "../chunk-AXPCESYO.js";
7
+ import {
8
+ takeHookHoldBudget
9
+ } from "../chunk-D2FX3EPW.js";
10
+ import "../chunk-CJVVKOSR.js";
11
+ import "../chunk-JU6W3XAU.js";
12
+ import {
13
+ readHookInput
14
+ } from "../chunk-KGDWDSNL.js";
15
+ import "../chunk-5OP5MQI7.js";
16
+ import "../chunk-JZTHGAPA.js";
17
+ import "../chunk-SGZJ5LYH.js";
18
+ import "../chunk-EYK3GSRH.js";
19
+ import "../chunk-ZVSKMPBZ.js";
20
+ import "../chunk-C2WCPBF7.js";
21
+ import "../chunk-6J2JC2RT.js";
22
+ import "../chunk-WE2J62NC.js";
23
+ import "../chunk-3EVPNIBE.js";
24
+ import "../chunk-OKXS7WDZ.js";
25
+ import "../chunk-MPWXGONV.js";
26
+ import "../chunk-SAXBC4AZ.js";
27
+ import "../chunk-OLQRRFBX.js";
28
+ import "../chunk-XHKBHWLX.js";
29
+ import "../chunk-CULUZTWQ.js";
30
+ import "../chunk-N6IOSZOE.js";
31
+ import "../chunk-EPCXUP3P.js";
32
+ import "../chunk-NGDD6TXY.js";
33
+ import "../chunk-CVQYGMSR.js";
34
+ import "../chunk-POFBE6ZY.js";
35
+ import "../chunk-GMXKITVA.js";
36
+ import "../chunk-P7WQEVWA.js";
37
+ import "../chunk-M5ICYGHT.js";
38
+ import "../chunk-2ABTSGFT.js";
39
+ import "../chunk-2OY3ZZ5N.js";
40
+ import "../chunk-LXQ5FBBD.js";
41
+ import "../chunk-7QLSKOSU.js";
42
+ import "../chunk-KZERVKTD.js";
43
+ import "../chunk-DB3ONZB4.js";
44
+ import "../chunk-A2A2YTMG.js";
45
+ import "../chunk-T7E75EKA.js";
46
+ import "../chunk-GPEGOGRJ.js";
47
+ import "../chunk-E4FJTUH4.js";
48
+ import "../chunk-NQTHFF4W.js";
49
+
50
+ // bin/pushary-permission-denied-hook.ts
51
+ var main = async () => {
52
+ const input = await readHookInput("claude", "PermissionDenied");
53
+ if (!input) return;
54
+ try {
55
+ const output = await handlePermissionDenied(input, takeHookHoldBudget());
56
+ if (output) process.stdout.write(JSON.stringify(output));
57
+ } catch {
58
+ }
59
+ };
60
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ handlePermissionRequest
4
+ } from "../chunk-Q7E4I6UA.js";
5
+ import {
6
+ activeHookSource,
7
+ normalizeToolCall,
8
+ profileFromArgv
9
+ } from "../chunk-J5TIV3J6.js";
10
+ import "../chunk-AXPCESYO.js";
11
+ import "../chunk-CJVVKOSR.js";
12
+ import "../chunk-JU6W3XAU.js";
13
+ import {
14
+ readToolHookInput
15
+ } from "../chunk-KGDWDSNL.js";
16
+ import "../chunk-5OP5MQI7.js";
17
+ import "../chunk-JZTHGAPA.js";
18
+ import "../chunk-SGZJ5LYH.js";
19
+ import "../chunk-EYK3GSRH.js";
20
+ import "../chunk-ZVSKMPBZ.js";
21
+ import "../chunk-C2WCPBF7.js";
22
+ import "../chunk-6J2JC2RT.js";
23
+ import "../chunk-WE2J62NC.js";
24
+ import "../chunk-3EVPNIBE.js";
25
+ import "../chunk-OKXS7WDZ.js";
26
+ import "../chunk-MPWXGONV.js";
27
+ import "../chunk-SAXBC4AZ.js";
28
+ import "../chunk-OLQRRFBX.js";
29
+ import "../chunk-XHKBHWLX.js";
30
+ import {
31
+ canonicalGateInputs
32
+ } from "../chunk-CULUZTWQ.js";
33
+ import "../chunk-N6IOSZOE.js";
34
+ import "../chunk-EPCXUP3P.js";
35
+ import "../chunk-NGDD6TXY.js";
36
+ import "../chunk-CVQYGMSR.js";
37
+ import "../chunk-POFBE6ZY.js";
38
+ import "../chunk-GMXKITVA.js";
39
+ import "../chunk-P7WQEVWA.js";
40
+ import "../chunk-M5ICYGHT.js";
41
+ import "../chunk-2ABTSGFT.js";
42
+ import "../chunk-2OY3ZZ5N.js";
43
+ import "../chunk-LXQ5FBBD.js";
44
+ import "../chunk-7QLSKOSU.js";
45
+ import "../chunk-KZERVKTD.js";
46
+ import "../chunk-DB3ONZB4.js";
47
+ import "../chunk-A2A2YTMG.js";
48
+ import "../chunk-T7E75EKA.js";
49
+ import "../chunk-GPEGOGRJ.js";
50
+ import "../chunk-E4FJTUH4.js";
51
+ import "../chunk-NQTHFF4W.js";
52
+
53
+ // bin/pushary-permission-hook.ts
54
+ var profile = profileFromArgv(process.argv);
55
+ var main = async () => {
56
+ const input = await readToolHookInput(activeHookSource(process.argv), "PermissionRequest");
57
+ if (!input) return;
58
+ try {
59
+ const canonical = profile ? canonicalGateInputs(profile.source, input.tool_name, [input.tool_input ?? {}], input.cwd) : void 0;
60
+ const output = await handlePermissionRequest(normalizeToolCall(profile, input), canonical);
61
+ if (output) process.stdout.write(JSON.stringify(output));
62
+ } catch {
63
+ }
64
+ };
65
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ activeHookSource,
4
+ activeIdentity,
5
+ normalizeToolCall,
6
+ profileFromArgv
7
+ } from "../chunk-J5TIV3J6.js";
8
+ import "../chunk-AXPCESYO.js";
9
+ import {
10
+ readHookInput
11
+ } from "../chunk-KGDWDSNL.js";
12
+ import "../chunk-JZTHGAPA.js";
13
+ import "../chunk-SGZJ5LYH.js";
14
+ import "../chunk-EYK3GSRH.js";
15
+ import "../chunk-ZVSKMPBZ.js";
16
+ import "../chunk-C2WCPBF7.js";
17
+ import "../chunk-6J2JC2RT.js";
18
+ import "../chunk-WE2J62NC.js";
19
+ import "../chunk-3EVPNIBE.js";
20
+ import "../chunk-OKXS7WDZ.js";
21
+ import "../chunk-MPWXGONV.js";
22
+ import "../chunk-SAXBC4AZ.js";
23
+ import "../chunk-OLQRRFBX.js";
24
+ import "../chunk-XHKBHWLX.js";
25
+ import {
26
+ handleCompaction,
27
+ handlePostToolUse,
28
+ isCompactionEvent
29
+ } from "../chunk-CULUZTWQ.js";
30
+ import "../chunk-N6IOSZOE.js";
31
+ import "../chunk-EPCXUP3P.js";
32
+ import "../chunk-NGDD6TXY.js";
33
+ import "../chunk-CVQYGMSR.js";
34
+ import "../chunk-POFBE6ZY.js";
35
+ import "../chunk-GMXKITVA.js";
36
+ import "../chunk-P7WQEVWA.js";
37
+ import "../chunk-M5ICYGHT.js";
38
+ import "../chunk-2ABTSGFT.js";
39
+ import "../chunk-2OY3ZZ5N.js";
40
+ import "../chunk-LXQ5FBBD.js";
41
+ import "../chunk-7QLSKOSU.js";
42
+ import "../chunk-KZERVKTD.js";
43
+ import "../chunk-DB3ONZB4.js";
44
+ import "../chunk-A2A2YTMG.js";
45
+ import "../chunk-T7E75EKA.js";
46
+ import "../chunk-GPEGOGRJ.js";
47
+ import "../chunk-E4FJTUH4.js";
48
+ import "../chunk-NQTHFF4W.js";
49
+
50
+ // bin/pushary-post-hook.ts
51
+ var profile = profileFromArgv(process.argv);
52
+ var AGENT = activeIdentity(process.argv);
53
+ var main = async () => {
54
+ const input = await readHookInput(activeHookSource(process.argv), "PostToolUse");
55
+ if (!input) return;
56
+ try {
57
+ if (isCompactionEvent(input.hook_event_name)) {
58
+ await handleCompaction(input, AGENT);
59
+ return;
60
+ }
61
+ const additionalContext = await handlePostToolUse(normalizeToolCall(profile, input), AGENT);
62
+ if (additionalContext) {
63
+ process.stdout.write(JSON.stringify({
64
+ hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext }
65
+ }));
66
+ }
67
+ } catch {
68
+ }
69
+ };
70
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ activeHookSource,
4
+ activeIdentity
5
+ } from "../chunk-J5TIV3J6.js";
6
+ import "../chunk-AXPCESYO.js";
7
+ import {
8
+ readHookInput
9
+ } from "../chunk-KGDWDSNL.js";
10
+ import "../chunk-JZTHGAPA.js";
11
+ import "../chunk-SGZJ5LYH.js";
12
+ import "../chunk-EYK3GSRH.js";
13
+ import "../chunk-ZVSKMPBZ.js";
14
+ import "../chunk-C2WCPBF7.js";
15
+ import "../chunk-6J2JC2RT.js";
16
+ import "../chunk-WE2J62NC.js";
17
+ import "../chunk-3EVPNIBE.js";
18
+ import "../chunk-OKXS7WDZ.js";
19
+ import "../chunk-MPWXGONV.js";
20
+ import "../chunk-SAXBC4AZ.js";
21
+ import "../chunk-OLQRRFBX.js";
22
+ import "../chunk-XHKBHWLX.js";
23
+ import {
24
+ handleUserPrompt
25
+ } from "../chunk-CULUZTWQ.js";
26
+ import "../chunk-N6IOSZOE.js";
27
+ import "../chunk-EPCXUP3P.js";
28
+ import "../chunk-NGDD6TXY.js";
29
+ import "../chunk-CVQYGMSR.js";
30
+ import "../chunk-POFBE6ZY.js";
31
+ import "../chunk-GMXKITVA.js";
32
+ import "../chunk-P7WQEVWA.js";
33
+ import "../chunk-M5ICYGHT.js";
34
+ import "../chunk-2ABTSGFT.js";
35
+ import "../chunk-2OY3ZZ5N.js";
36
+ import "../chunk-LXQ5FBBD.js";
37
+ import "../chunk-7QLSKOSU.js";
38
+ import "../chunk-KZERVKTD.js";
39
+ import "../chunk-DB3ONZB4.js";
40
+ import "../chunk-A2A2YTMG.js";
41
+ import "../chunk-T7E75EKA.js";
42
+ import "../chunk-GPEGOGRJ.js";
43
+ import "../chunk-E4FJTUH4.js";
44
+ import "../chunk-NQTHFF4W.js";
45
+
46
+ // bin/pushary-prompt-hook.ts
47
+ var AGENT = activeIdentity(process.argv);
48
+ var main = async () => {
49
+ const input = await readHookInput(activeHookSource(process.argv), "UserPromptSubmit");
50
+ if (!input) return;
51
+ try {
52
+ const additionalContext = await handleUserPrompt(input, AGENT);
53
+ if (additionalContext) {
54
+ process.stdout.write(JSON.stringify({
55
+ hookSpecificOutput: { hookEventName: "UserPromptSubmit", additionalContext }
56
+ }));
57
+ }
58
+ } catch {
59
+ }
60
+ };
61
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ WRAPPER_ACTIVE_ENV
4
+ } from "../chunk-PQ4K74WL.js";
5
+ import {
6
+ activeHookSource,
7
+ activeIdentity
8
+ } from "../chunk-J5TIV3J6.js";
9
+ import "../chunk-AXPCESYO.js";
10
+ import {
11
+ readHookInput
12
+ } from "../chunk-KGDWDSNL.js";
13
+ import "../chunk-JZTHGAPA.js";
14
+ import "../chunk-SGZJ5LYH.js";
15
+ import "../chunk-EYK3GSRH.js";
16
+ import "../chunk-ZVSKMPBZ.js";
17
+ import "../chunk-C2WCPBF7.js";
18
+ import "../chunk-6J2JC2RT.js";
19
+ import "../chunk-WE2J62NC.js";
20
+ import "../chunk-3EVPNIBE.js";
21
+ import "../chunk-OKXS7WDZ.js";
22
+ import "../chunk-MPWXGONV.js";
23
+ import "../chunk-SAXBC4AZ.js";
24
+ import "../chunk-OLQRRFBX.js";
25
+ import "../chunk-XHKBHWLX.js";
26
+ import {
27
+ handleSessionEnd
28
+ } from "../chunk-CULUZTWQ.js";
29
+ import "../chunk-N6IOSZOE.js";
30
+ import "../chunk-EPCXUP3P.js";
31
+ import "../chunk-NGDD6TXY.js";
32
+ import "../chunk-CVQYGMSR.js";
33
+ import "../chunk-POFBE6ZY.js";
34
+ import "../chunk-GMXKITVA.js";
35
+ import "../chunk-P7WQEVWA.js";
36
+ import "../chunk-M5ICYGHT.js";
37
+ import "../chunk-2ABTSGFT.js";
38
+ import "../chunk-2OY3ZZ5N.js";
39
+ import "../chunk-LXQ5FBBD.js";
40
+ import "../chunk-7QLSKOSU.js";
41
+ import "../chunk-KZERVKTD.js";
42
+ import "../chunk-DB3ONZB4.js";
43
+ import "../chunk-A2A2YTMG.js";
44
+ import "../chunk-T7E75EKA.js";
45
+ import "../chunk-GPEGOGRJ.js";
46
+ import "../chunk-E4FJTUH4.js";
47
+ import "../chunk-NQTHFF4W.js";
48
+
49
+ // bin/pushary-session-end-hook.ts
50
+ var AGENT = activeIdentity(process.argv);
51
+ var main = async () => {
52
+ const input = await readHookInput(activeHookSource(process.argv), "SessionEnd");
53
+ if (!input) return;
54
+ try {
55
+ await handleSessionEnd(input, AGENT, { reportClosed: process.env[WRAPPER_ACTIVE_ENV] !== "1" });
56
+ } catch {
57
+ }
58
+ };
59
+ main();
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node