@pushary/agent-hooks 1.9.166 → 1.9.168
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.
- package/CHANGELOG.md +12 -0
- package/dist/{api-D4SZ2E5J.js → api-2NP643KP.js} +15 -11
- package/dist/bin/pushary-audit.js +3 -3
- package/dist/bin/pushary-bell-hook.js +28 -28
- package/dist/bin/pushary-bell.js +11 -11
- package/dist/bin/pushary-calls.js +15 -15
- package/dist/bin/pushary-claude.js +27 -27
- package/dist/bin/pushary-clean.js +38 -38
- package/dist/bin/pushary-codex-bridge.js +23 -23
- package/dist/bin/pushary-codex-hook.js +36 -36
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +16 -16
- package/dist/bin/pushary-connect.js +34 -34
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +45 -45
- package/dist/bin/pushary-disconnect.js +29 -29
- package/dist/bin/pushary-display-hook.js +10 -4
- package/dist/bin/pushary-doctor.js +46 -46
- package/dist/bin/pushary-elicitation-hook.js +28 -28
- package/dist/bin/pushary-gemini-bridge.js +17 -17
- package/dist/bin/pushary-gemini-hook.js +32 -32
- package/dist/bin/pushary-hook.js +36 -36
- package/dist/bin/pushary-login.js +22 -22
- package/dist/bin/pushary-logout.js +29 -29
- package/dist/bin/pushary-mcp.js +12 -12
- package/dist/bin/pushary-mode.js +16 -16
- package/dist/bin/pushary-notification-hook.js +27 -27
- package/dist/bin/pushary-opencode-hook.js +135 -40
- package/dist/bin/pushary-permission-denied-hook.js +36 -36
- package/dist/bin/pushary-permission-hook.js +36 -36
- package/dist/bin/pushary-post-hook.js +28 -28
- package/dist/bin/pushary-prompt-hook.js +27 -27
- package/dist/bin/pushary-session-end-hook.js +27 -27
- package/dist/bin/pushary-session-start-hook.js +38 -38
- package/dist/bin/pushary-setup.js +54 -54
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +35 -35
- package/dist/bin/pushary-stop-hook.js +27 -27
- package/dist/bin/pushary-stopfailure-hook.js +27 -27
- package/dist/bin/pushary-suggestions.js +16 -16
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +25 -25
- package/dist/bin/pushary-upgrade.js +43 -43
- package/dist/bin/pushary-wait.js +16 -16
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-L2NGVERQ.js → chunk-2SMEEXDR.js} +1 -1
- package/dist/{chunk-C2PGBMTH.js → chunk-2TRYSF64.js} +1 -1
- package/dist/{chunk-NYCN3CCK.js → chunk-3M4ZOSR3.js} +1 -1
- package/dist/{chunk-OPN6FWMG.js → chunk-4HLSCBES.js} +1 -1
- package/dist/{chunk-LFS3PX7S.js → chunk-5N7MRVM3.js} +4 -4
- package/dist/{chunk-ILGAR7DW.js → chunk-5Q2UDUR6.js} +2 -2
- package/dist/{chunk-IEENAYGT.js → chunk-66VZIS6R.js} +1 -1
- package/dist/{chunk-JLGZGITL.js → chunk-6B2YKVX3.js} +2 -2
- package/dist/{chunk-X7IIWYAG.js → chunk-6IZVL42W.js} +1 -1
- package/dist/{chunk-ILBNQX44.js → chunk-6PDBRLIH.js} +5 -5
- package/dist/{chunk-U6NNLBWJ.js → chunk-752NWYBD.js} +5 -5
- package/dist/{chunk-7YUKURRZ.js → chunk-7AENNOGX.js} +1 -1
- package/dist/{chunk-2KZZZ4JK.js → chunk-7DEAVAAS.js} +3 -3
- package/dist/{chunk-LDEZYH7Y.js → chunk-7GMTA5NR.js} +10 -10
- package/dist/{chunk-NUHIGW7H.js → chunk-AIUFZQAA.js} +1 -1
- package/dist/{chunk-2J3IIFS3.js → chunk-AO4CKFQA.js} +2 -2
- package/dist/{chunk-7WHUMPWM.js → chunk-AVIQZSCU.js} +1 -1
- package/dist/{chunk-A4IK6JTC.js → chunk-BIEJHRZG.js} +6 -5
- package/dist/{chunk-R23ZNBJU.js → chunk-CCQZGWSR.js} +6 -6
- package/dist/{chunk-X6YYQZW7.js → chunk-CFZUESTS.js} +8 -4
- package/dist/{chunk-ANMVHKNK.js → chunk-CRTNHB6F.js} +3 -3
- package/dist/{chunk-7HXO72HS.js → chunk-DXUPOVJP.js} +1 -1
- package/dist/{chunk-KYBVLSMT.js → chunk-DYZ26IPH.js} +3 -3
- package/dist/{chunk-LJSRMA5C.js → chunk-EDCDODWA.js} +5 -5
- package/dist/{chunk-ZB5O3LKY.js → chunk-EGPOBJZG.js} +1 -1
- package/dist/{chunk-VDNKX5OF.js → chunk-F7N6LYGG.js} +5 -5
- package/dist/{chunk-I4BIOADS.js → chunk-FAORXDJ4.js} +4 -4
- package/dist/{chunk-SIZBYHXW.js → chunk-FUK2DC53.js} +4 -4
- package/dist/{chunk-635I27L4.js → chunk-GV3ZGKMK.js} +3 -3
- package/dist/{chunk-UM4RAZPH.js → chunk-GVIKF73A.js} +1 -1
- package/dist/{chunk-6OBGKICP.js → chunk-HFI6SU27.js} +3 -3
- package/dist/{chunk-OJRX6UVD.js → chunk-HV7KTGWF.js} +7 -7
- package/dist/{chunk-YQ67XWMM.js → chunk-IWWKO4MP.js} +4 -4
- package/dist/{chunk-MTB52RSH.js → chunk-K24RAOIO.js} +2 -2
- package/dist/{chunk-L54D5IIR.js → chunk-KEC67NZF.js} +5 -5
- package/dist/{chunk-67CGCPI4.js → chunk-KX4Q4CKZ.js} +2 -2
- package/dist/{chunk-ZEPOIQ4H.js → chunk-L77OIGRB.js} +22 -6
- package/dist/{chunk-YLR6QHCH.js → chunk-LDUK7D2I.js} +6 -6
- package/dist/{chunk-BFMILGSX.js → chunk-LEDGOYZV.js} +3 -3
- package/dist/{chunk-NEGPZ3DO.js → chunk-LGQUJFVZ.js} +2 -2
- package/dist/{chunk-WIVLMIJ6.js → chunk-LL4TMEDG.js} +4 -4
- package/dist/{chunk-WTUQEQ54.js → chunk-LOUSA3NO.js} +6 -6
- package/dist/{chunk-Y3QV3VYX.js → chunk-LVF5IBS6.js} +1 -1
- package/dist/{chunk-2FLJZICI.js → chunk-LZU7ZDY7.js} +2 -2
- package/dist/{chunk-EANTIGY7.js → chunk-MK7T7MNB.js} +1 -1
- package/dist/{chunk-IGBKHRCZ.js → chunk-MOQUKAVU.js} +1 -1
- package/dist/{chunk-RN4Z5BQJ.js → chunk-MRTJ54MC.js} +3 -3
- package/dist/{chunk-ZPFENH7C.js → chunk-NOHOCNY6.js} +4 -4
- package/dist/{chunk-I2FH4E6H.js → chunk-NRXFFCNG.js} +2 -2
- package/dist/{chunk-D3KD7K3N.js → chunk-OBUKF3WP.js} +4 -4
- package/dist/{chunk-JAE5ULC6.js → chunk-OI5OOFUY.js} +5 -5
- package/dist/{chunk-MYN6FNBS.js → chunk-ORTEANZH.js} +3 -3
- package/dist/{chunk-7PMCRTPW.js → chunk-OU7PO32D.js} +3 -3
- package/dist/{chunk-QV5HMBT4.js → chunk-PG5N3FL5.js} +12 -12
- package/dist/{chunk-DFGHHYS5.js → chunk-QCQADUHN.js} +4 -4
- package/dist/{chunk-YORHQJ5M.js → chunk-QMVUDNQR.js} +4 -4
- package/dist/{chunk-6ZGXNEBA.js → chunk-RY5EPLCY.js} +5 -5
- package/dist/{chunk-L4HJSUP7.js → chunk-SD5K34T2.js} +1 -1
- package/dist/{chunk-YENSTBQI.js → chunk-SSKNRWWS.js} +1 -1
- package/dist/{chunk-3CLLJJJ2.js → chunk-TGIWLQOV.js} +5 -5
- package/dist/{chunk-7TQXWAOZ.js → chunk-TTTMOX73.js} +1 -1
- package/dist/{chunk-3I5IFXHF.js → chunk-UCND4JHN.js} +101 -23
- package/dist/{chunk-6QLOTNO2.js → chunk-UCW24KPU.js} +2 -2
- package/dist/{chunk-TBDSTEO3.js → chunk-UN36O6U6.js} +3 -3
- package/dist/{chunk-RZRBXDGN.js → chunk-VWVYDYCV.js} +25 -9
- package/dist/{chunk-NN2RZ2UB.js → chunk-VY22KT5X.js} +3 -3
- package/dist/{chunk-TVXGBUOL.js → chunk-W4NCWOVL.js} +1 -1
- package/dist/{chunk-BOJWXETW.js → chunk-WDLBF3PM.js} +1 -1
- package/dist/{chunk-X4YQCI5T.js → chunk-WI2WYKSE.js} +1 -1
- package/dist/{chunk-JARCCL3M.js → chunk-WIOC6L6Y.js} +2 -2
- package/dist/{chunk-7JO3NNIQ.js → chunk-WK6TE6U7.js} +2 -2
- package/dist/{chunk-XRAUQWLP.js → chunk-WTUURSCO.js} +6 -6
- package/dist/{chunk-MN2FFBYE.js → chunk-X7RPRBZE.js} +2 -2
- package/dist/{chunk-5I34FSSW.js → chunk-X7RR2ZQH.js} +6 -6
- package/dist/{chunk-GNCFKXQS.js → chunk-XGNOM3XC.js} +2 -2
- package/dist/{chunk-NCZ7MLNW.js → chunk-XWLSZNXW.js} +9 -9
- package/dist/{chunk-NXTAXFQS.js → chunk-ZKMXHG5G.js} +8 -8
- package/dist/{chunk-ITGM5QW4.js → chunk-ZXRBGLTI.js} +6 -6
- package/dist/{chunk-3GWMSKFY.js → chunk-ZXZEETHT.js} +23 -20
- package/dist/{chunk-7X7ZTLIN.js → chunk-ZYH4KTY5.js} +15 -13
- package/dist/{codex-app-cards-switch-BOIE5IZL.js → codex-app-cards-switch-C6OKN3RA.js} +11 -11
- package/dist/{codex-card-routing-B2ZI4WRI.js → codex-card-routing-QGOX4RNI.js} +2 -2
- package/dist/{codex-desktop-launch-LBL2LPS7.js → codex-desktop-launch-5ISZYYGG.js} +1 -1
- package/dist/{codex-session-launch-7WVCWASC.js → codex-session-launch-JWT76ONU.js} +20 -20
- package/dist/{config-S53I5YNR.js → config-PWEPWMNF.js} +3 -3
- package/dist/{global-upgrade-ND726NHJ.js → global-upgrade-ZAPGSH66.js} +9 -9
- package/dist/{identity-3G66JTAR.js → identity-O57FDCPL.js} +4 -4
- package/dist/{live-capabilities-76C2DKTY.js → live-capabilities-FVRWXQAC.js} +4 -4
- package/dist/{paths-O3CZR2BV.js → paths-LCARWI3S.js} +3 -3
- package/dist/{reapply-TEATBGFG.js → reapply-T5JXYBH2.js} +31 -31
- package/dist/src/index.js +35 -35
- package/dist/{upgrade-lock-PDCUHFRW.js → upgrade-lock-3P3VK6KQ.js} +4 -4
- package/dist/{usage-DFCL7TQU.js → usage-BKT5P2P3.js} +3 -3
- package/package.json +1 -1
|
@@ -3,24 +3,24 @@ import {
|
|
|
3
3
|
expectedLaunchCapabilities,
|
|
4
4
|
hasSpawnProvider,
|
|
5
5
|
resolveControlPolicy
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LEDGOYZV.js";
|
|
7
7
|
import {
|
|
8
8
|
daemonHasRemoteProof,
|
|
9
9
|
daemonServiceManagerAvailable,
|
|
10
10
|
hasDaemonServiceDefinition,
|
|
11
11
|
readDaemonNeedsLogin,
|
|
12
12
|
readDaemonStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LDUK7D2I.js";
|
|
14
14
|
import {
|
|
15
15
|
getMachineId
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MOQUKAVU.js";
|
|
17
17
|
import {
|
|
18
18
|
readControlMode,
|
|
19
19
|
readKeySource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DYZ26IPH.js";
|
|
21
21
|
import {
|
|
22
22
|
getBaseUrl
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LVF5IBS6.js";
|
|
24
24
|
import {
|
|
25
25
|
getPackageVersion
|
|
26
26
|
} from "./chunk-UQTQ6HPO.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
uploadTranscriptRecords,
|
|
11
11
|
verifyAnchoredRecipients,
|
|
12
12
|
wrapSessionKey
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7DEAVAAS.js";
|
|
14
14
|
|
|
15
15
|
// src/live-session.ts
|
|
16
16
|
var LIVE_TRANSCRIPT_LIMITS = { queuedRecords: 100, recordCharacters: 32 * 1024 };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cursorGateOwnsClaudeCall,
|
|
3
3
|
readCursorGateRegistration
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IWWKO4MP.js";
|
|
5
5
|
import {
|
|
6
6
|
registerTranscript
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7GMTA5NR.js";
|
|
8
8
|
import {
|
|
9
9
|
namedEvent
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WTUURSCO.js";
|
|
11
11
|
import {
|
|
12
12
|
writeDegraded
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VWVYDYCV.js";
|
|
14
14
|
import {
|
|
15
15
|
claudeShapedHookInput,
|
|
16
16
|
hookCompatibleProfileBySource,
|
|
17
17
|
isGrokHookPayload,
|
|
18
18
|
isGrokSessionEndStop
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-L77OIGRB.js";
|
|
20
20
|
|
|
21
21
|
// src/tool-hook-input.ts
|
|
22
22
|
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode", "cursor_version"];
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
HOOK_BUDGETS,
|
|
4
4
|
KILL_REASON,
|
|
5
5
|
OPENCODE_APPROVAL_EVENT
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L77OIGRB.js";
|
|
7
7
|
|
|
8
8
|
// src/opencode-plugin.ts
|
|
9
9
|
var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
|
|
@@ -39,6 +39,14 @@ var OPENCODE_SERVICE_REVERIFY_MS = 2e3;
|
|
|
39
39
|
var OPENCODE_SETTLED_ELSEWHERE_STATUSES = [404, 409];
|
|
40
40
|
var OPENCODE_CLI_BRIDGES_QUESTIONS = true;
|
|
41
41
|
var OPENCODE_SERVICE_REQUEST_TIMEOUT_MS = 5e3;
|
|
42
|
+
var OPENCODE_WITHDRAW_ON_STDIN_END = "withdraw_on_stdin_end";
|
|
43
|
+
var OPENCODE_CAPABILITIES_EVENT = "pushary.capabilities";
|
|
44
|
+
var OPENCODE_HOOK_CAPABILITIES = { capabilities: [OPENCODE_WITHDRAW_ON_STDIN_END] };
|
|
45
|
+
var OPENCODE_CAPABILITY_PROBE_TIMEOUT_MS = 5e3;
|
|
46
|
+
var OPENCODE_QUESTION_WITHDRAW_TIMEOUT_MS = 5e3;
|
|
47
|
+
var OPENCODE_QUESTION_ASK_IN_FLIGHT_GRACE_MS = 6e4;
|
|
48
|
+
var OPENCODE_HOOK_EXIT_MARGIN_MS = 2e3;
|
|
49
|
+
var OPENCODE_QUESTION_WITHDRAW_GRACE_MS = OPENCODE_QUESTION_ASK_IN_FLIGHT_GRACE_MS + OPENCODE_QUESTION_WITHDRAW_TIMEOUT_MS + 2 * OPENCODE_HOOK_EXIT_MARGIN_MS;
|
|
42
50
|
var approvalTimeoutMs = () => (HOOK_BUDGETS.opencode.budgetSeconds - HOOK_BUDGETS.opencode.guardSeconds) * 1e3;
|
|
43
51
|
var openCodePluginSource = (bridgesQuestions) => `// Pushary for OpenCode. Generated by @pushary/agent-hooks \u2014 do not edit.
|
|
44
52
|
// ${OPENCODE_PLUGIN_MARKER}
|
|
@@ -60,7 +68,7 @@ var openCodePluginSource = (bridgesQuestions) => `// Pushary for OpenCode. Gener
|
|
|
60
68
|
// worst this file may do to somebody is nothing at all.
|
|
61
69
|
|
|
62
70
|
import { spawn } from "node:child_process"
|
|
63
|
-
import { readdir, readFile } from "node:fs/promises"
|
|
71
|
+
import { readdir, readFile, stat } from "node:fs/promises"
|
|
64
72
|
import { homedir } from "node:os"
|
|
65
73
|
import { isAbsolute, join, relative, resolve, sep } from "node:path"
|
|
66
74
|
|
|
@@ -76,6 +84,10 @@ const GLOBAL_FORM_OWNER = ${JSON.stringify(OPENCODE_GLOBAL_FORM_OWNER)}
|
|
|
76
84
|
const QUESTION_ANSWERED = ${JSON.stringify(OPENCODE_QUESTION_ANSWERED)}
|
|
77
85
|
const QUESTION_CANCELLED = ${JSON.stringify(OPENCODE_QUESTION_CANCELLED)}
|
|
78
86
|
const SERVICE_REQUEST_TIMEOUT_MS = ${OPENCODE_SERVICE_REQUEST_TIMEOUT_MS}
|
|
87
|
+
const WITHDRAW_ON_STDIN_END = ${JSON.stringify(OPENCODE_WITHDRAW_ON_STDIN_END)}
|
|
88
|
+
const CAPABILITIES_EVENT = ${JSON.stringify(OPENCODE_CAPABILITIES_EVENT)}
|
|
89
|
+
const CAPABILITY_PROBE_TIMEOUT_MS = ${OPENCODE_CAPABILITY_PROBE_TIMEOUT_MS}
|
|
90
|
+
const QUESTION_WITHDRAW_GRACE_MS = ${OPENCODE_QUESTION_WITHDRAW_GRACE_MS}
|
|
79
91
|
const SERVICE_REGISTRATION = /^service.*\\.json$/
|
|
80
92
|
const SERVICE_USER = "opencode"
|
|
81
93
|
const SERVICE_PROTOCOL = "http:"
|
|
@@ -116,22 +128,36 @@ const remember = (map, key, value) => {
|
|
|
116
128
|
map.set(key, value)
|
|
117
129
|
}
|
|
118
130
|
|
|
119
|
-
const
|
|
131
|
+
const withdrawsOverStdin = (payload) => payload[WITHDRAW_ON_STDIN_END] === true
|
|
132
|
+
|
|
133
|
+
const replyIn = (out) => {
|
|
134
|
+
const body = out.trim()
|
|
135
|
+
if (!body) return null
|
|
136
|
+
try {
|
|
137
|
+
return JSON.parse(body)
|
|
138
|
+
} catch {
|
|
139
|
+
return null
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const exitedCleanly = (code, signal) => code === 0 && !signal
|
|
144
|
+
|
|
145
|
+
const runHook = (payload, timeoutMs, onSpawn) =>
|
|
120
146
|
new Promise((resolve) => {
|
|
121
147
|
let settled = false
|
|
122
148
|
let timer
|
|
123
|
-
const finish = (
|
|
149
|
+
const finish = (reply, cleanExit) => {
|
|
124
150
|
if (settled) return
|
|
125
151
|
settled = true
|
|
126
152
|
clearTimeout(timer)
|
|
127
|
-
resolve(
|
|
153
|
+
resolve({ reply, cleanExit })
|
|
128
154
|
}
|
|
129
155
|
|
|
130
156
|
let child
|
|
131
157
|
try {
|
|
132
158
|
child = spawn(COMMAND[0], COMMAND.slice(1), { stdio: ["pipe", "pipe", "ignore"] })
|
|
133
159
|
} catch {
|
|
134
|
-
return finish(null)
|
|
160
|
+
return finish(null, false)
|
|
135
161
|
}
|
|
136
162
|
if (onSpawn) onSpawn(child)
|
|
137
163
|
|
|
@@ -140,7 +166,7 @@ const run = (payload, timeoutMs, onSpawn) =>
|
|
|
140
166
|
try {
|
|
141
167
|
child.kill("SIGKILL")
|
|
142
168
|
} catch {}
|
|
143
|
-
finish(null)
|
|
169
|
+
finish(null, false)
|
|
144
170
|
}, timeoutMs)
|
|
145
171
|
if (typeof timer.unref === "function") timer.unref()
|
|
146
172
|
}
|
|
@@ -149,25 +175,55 @@ const run = (payload, timeoutMs, onSpawn) =>
|
|
|
149
175
|
child.stdout.on("data", (chunk) => {
|
|
150
176
|
if (out.length < MAX_REPLY_BYTES) out += chunk
|
|
151
177
|
})
|
|
152
|
-
child.on("error", () => finish(null))
|
|
153
|
-
child.on("close", () =>
|
|
154
|
-
const body = out.trim()
|
|
155
|
-
if (!body) return finish(null)
|
|
156
|
-
try {
|
|
157
|
-
finish(JSON.parse(body))
|
|
158
|
-
} catch {
|
|
159
|
-
finish(null)
|
|
160
|
-
}
|
|
161
|
-
})
|
|
178
|
+
child.on("error", () => finish(null, false))
|
|
179
|
+
child.on("close", (code, signal) => finish(replyIn(out), exitedCleanly(code, signal)))
|
|
162
180
|
|
|
163
181
|
try {
|
|
164
182
|
child.stdin.on("error", () => {})
|
|
165
|
-
child.stdin.
|
|
183
|
+
if (withdrawsOverStdin(payload)) child.stdin.write(JSON.stringify(payload) + "\\n")
|
|
184
|
+
else child.stdin.end(JSON.stringify(payload))
|
|
166
185
|
} catch {
|
|
167
|
-
finish(null)
|
|
186
|
+
finish(null, false)
|
|
168
187
|
}
|
|
169
188
|
})
|
|
170
189
|
|
|
190
|
+
const run = (payload, timeoutMs, onSpawn) => runHook(payload, timeoutMs, onSpawn).then((ended) => ended.reply)
|
|
191
|
+
|
|
192
|
+
const commandSignature = async () => {
|
|
193
|
+
const parts = []
|
|
194
|
+
for (const entry of COMMAND.filter((part) => isAbsolute(part))) {
|
|
195
|
+
try {
|
|
196
|
+
const info = await stat(entry)
|
|
197
|
+
parts.push([entry, info.ino, info.size, info.mtimeMs, info.ctimeMs].join(":"))
|
|
198
|
+
} catch {}
|
|
199
|
+
}
|
|
200
|
+
return parts.join("|")
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const reportsHeldStdin = (reply) =>
|
|
204
|
+
Boolean(reply) && typeof reply === "object" && Array.isArray(reply.capabilities) && reply.capabilities.includes(WITHDRAW_ON_STDIN_END)
|
|
205
|
+
|
|
206
|
+
const probeCapabilities = async () => {
|
|
207
|
+
const ended = await runHook({ hook_event_name: CAPABILITIES_EVENT }, CAPABILITY_PROBE_TIMEOUT_MS)
|
|
208
|
+
return { holds: ended.cleanExit && reportsHeldStdin(ended.reply), conclusive: ended.cleanExit }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let knownCapabilities
|
|
212
|
+
let capabilityCheck
|
|
213
|
+
|
|
214
|
+
const checkHookCapabilities = async () => {
|
|
215
|
+
const signature = await commandSignature()
|
|
216
|
+
if (signature && knownCapabilities && knownCapabilities.signature === signature) return knownCapabilities.holds
|
|
217
|
+
const answer = await probeCapabilities()
|
|
218
|
+
knownCapabilities = signature && answer.conclusive ? { signature, holds: answer.holds } : undefined
|
|
219
|
+
return answer.holds
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const hookWithdrawsOverStdin = () => {
|
|
223
|
+
if (!capabilityCheck) capabilityCheck = checkHookCapabilities().finally(() => { capabilityCheck = undefined })
|
|
224
|
+
return capabilityCheck
|
|
225
|
+
}
|
|
226
|
+
|
|
171
227
|
// Telemetry is fire and forget: the agent has already acted and is only being
|
|
172
228
|
// observed, so nothing here may hold up the next turn.
|
|
173
229
|
const tell = (payload) => {
|
|
@@ -646,7 +702,10 @@ const PusharyPlugin = async ({ client, directory, worktree, replyPermission, ses
|
|
|
646
702
|
}
|
|
647
703
|
pending.channel = channel
|
|
648
704
|
keepRechecking()
|
|
649
|
-
|
|
705
|
+
pending.holdsStdin = await hookWithdrawsOverStdin()
|
|
706
|
+
if (questions.get(form.id) !== pending) return
|
|
707
|
+
const asked = { ...formPayload(form), hook_event_name: QUESTION_EVENT, ...(pending.holdsStdin ? { [WITHDRAW_ON_STDIN_END]: true } : {}) }
|
|
708
|
+
const reply = await run(asked, undefined, (child) => {
|
|
650
709
|
pending.child = child
|
|
651
710
|
})
|
|
652
711
|
if (questions.get(form.id) !== pending) return
|
|
@@ -656,14 +715,28 @@ const PusharyPlugin = async ({ client, directory, worktree, replyPermission, ses
|
|
|
656
715
|
forgetQuestion(form.id, pending)
|
|
657
716
|
}
|
|
658
717
|
|
|
718
|
+
const signalQuestionHook = (child) => {
|
|
719
|
+
try {
|
|
720
|
+
child.kill("SIGTERM")
|
|
721
|
+
} catch {}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
const endQuestionHook = (child) => {
|
|
725
|
+
try {
|
|
726
|
+
child.stdin.end()
|
|
727
|
+
} catch {}
|
|
728
|
+
const fallback = setTimeout(() => signalQuestionHook(child), QUESTION_WITHDRAW_GRACE_MS)
|
|
729
|
+
if (typeof fallback.unref === "function") fallback.unref()
|
|
730
|
+
child.once("close", () => clearTimeout(fallback))
|
|
731
|
+
}
|
|
732
|
+
|
|
659
733
|
const withdrawQuestion = (id) => {
|
|
660
734
|
const pending = id ? questions.get(id) : undefined
|
|
661
735
|
if (!pending) return
|
|
662
736
|
forgetQuestion(id, pending)
|
|
663
737
|
if (!pending.child) return
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
} catch {}
|
|
738
|
+
if (pending.holdsStdin) endQuestionHook(pending.child)
|
|
739
|
+
else signalQuestionHook(pending.child)
|
|
667
740
|
}
|
|
668
741
|
|
|
669
742
|
const withdrawSessionQuestions = (sessionID) => {
|
|
@@ -878,6 +951,11 @@ export {
|
|
|
878
951
|
OPENCODE_QUESTION_CANCELLED,
|
|
879
952
|
OPENCODE_QUESTION_UNDELIVERED_EVENT,
|
|
880
953
|
OPENCODE_QUESTION_UNREACHABLE_EVENT,
|
|
954
|
+
OPENCODE_CAPABILITIES_EVENT,
|
|
955
|
+
OPENCODE_HOOK_CAPABILITIES,
|
|
956
|
+
OPENCODE_QUESTION_WITHDRAW_TIMEOUT_MS,
|
|
957
|
+
OPENCODE_QUESTION_ASK_IN_FLIGHT_GRACE_MS,
|
|
958
|
+
OPENCODE_HOOK_EXIT_MARGIN_MS,
|
|
881
959
|
openCodePluginModule,
|
|
882
960
|
renderOpenCodePlugin,
|
|
883
961
|
openCodePluginArgv,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X7RPRBZE.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe
|
|
6
6
|
} from "./chunk-TODDEIYG.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L77OIGRB.js";
|
|
10
10
|
|
|
11
11
|
// src/process-ownership.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -536,8 +536,8 @@ var loadedOnce = (load) => {
|
|
|
536
536
|
};
|
|
537
537
|
|
|
538
538
|
// src/codex-desktop-proxy.ts
|
|
539
|
-
var loadThePhone = () => import("./api-
|
|
540
|
-
var loadTheCardRouting = () => import("./codex-card-routing-
|
|
539
|
+
var loadThePhone = () => import("./api-2NP643KP.js");
|
|
540
|
+
var loadTheCardRouting = () => import("./codex-card-routing-QGOX4RNI.js");
|
|
541
541
|
var theFirstCardLoadsAgain = () => {
|
|
542
542
|
};
|
|
543
543
|
var ASKS_WITHOUT_ROUTING = {};
|
|
@@ -1097,7 +1097,7 @@ var codexDesktopCommand = async (args, entry, readAccount) => {
|
|
|
1097
1097
|
return runCodexDesktopProxy(engine2, args.slice(3), readAccount, { watchesForCards: layoutIsKnown });
|
|
1098
1098
|
}
|
|
1099
1099
|
if (args[0] === APP_CARDS_FLAG) {
|
|
1100
|
-
const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-
|
|
1100
|
+
const { codexAppCardsCommandOnThisMac } = await import("./codex-app-cards-switch-C6OKN3RA.js");
|
|
1101
1101
|
return codexAppCardsCommandOnThisMac(args.slice(1), entry, readAccount);
|
|
1102
1102
|
}
|
|
1103
1103
|
if (args.length > 2) throw new Error("Usage: pushary codex --desktop [path/to/Codex.app]");
|
|
@@ -8,21 +8,21 @@ import {
|
|
|
8
8
|
SubscriptionRequiredError,
|
|
9
9
|
callMcpTool,
|
|
10
10
|
isRetryable
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6PDBRLIH.js";
|
|
12
12
|
import {
|
|
13
13
|
fetchAsCredential
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SSKNRWWS.js";
|
|
15
15
|
import {
|
|
16
16
|
installNetworkDefaults,
|
|
17
17
|
isNetworkFailure
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VY22KT5X.js";
|
|
19
19
|
import {
|
|
20
20
|
clientReportClaims
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-X7RPRBZE.js";
|
|
22
22
|
import {
|
|
23
23
|
getApiKey,
|
|
24
24
|
getBaseUrl
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-LVF5IBS6.js";
|
|
26
26
|
import {
|
|
27
27
|
ASK_AGENT_NAME_MAX,
|
|
28
28
|
CLIENT_REPORT_PATH,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
degradedLine,
|
|
33
33
|
isDecisionStoppedReply,
|
|
34
34
|
truncateLine
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-L77OIGRB.js";
|
|
36
36
|
|
|
37
37
|
// src/api.ts
|
|
38
38
|
import { randomUUID } from "crypto";
|
|
@@ -348,8 +348,9 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
|
|
|
348
348
|
if (signal?.aborted) return ABANDONED_WAIT;
|
|
349
349
|
return waitedThroughAnOutage ? withdrawAfterAFailedPoll(apiKey, correlationId) : withdrawQuestion(apiKey, correlationId);
|
|
350
350
|
};
|
|
351
|
+
var CANCEL_QUESTION_TIMEOUT_MS = 4e3;
|
|
351
352
|
var cancelQuestion = async (apiKey, correlationId, signal, baseUrl) => {
|
|
352
|
-
return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs:
|
|
353
|
+
return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: CANCEL_QUESTION_TIMEOUT_MS, maxRetries: 1, baseUrl });
|
|
353
354
|
};
|
|
354
355
|
var withdrawQuestion = async (apiKey, correlationId, transport = { cancelQuestion, waitForAnswer }) => {
|
|
355
356
|
try {
|
|
@@ -374,10 +375,23 @@ var answerThatWonTheCancel = async (apiKey, correlationId) => {
|
|
|
374
375
|
const late = await waitForAnswer(apiKey, correlationId, OPEN_QUESTION_LATE_ANSWER_HOLD_MS, AbortSignal.timeout(2e3));
|
|
375
376
|
return late.answered ? late : OPEN_QUESTION_CLOSED;
|
|
376
377
|
};
|
|
378
|
+
var OPEN_QUESTION_WITHDRAWAL_FAILED = "open_question_withdrawal_failed";
|
|
379
|
+
var reportFailedQuestionWithdrawal = (event) => writeDegraded("questions", {
|
|
380
|
+
reason: OPEN_QUESTION_WITHDRAWAL_FAILED,
|
|
381
|
+
fallback: "the question stays on the phone until it is answered, cancelled or expires",
|
|
382
|
+
...event ? { event } : {}
|
|
383
|
+
});
|
|
377
384
|
var withdrawOpenQuestion = async (apiKey, correlationId) => {
|
|
385
|
+
let cancelled;
|
|
386
|
+
try {
|
|
387
|
+
cancelled = await cancelQuestion(apiKey, correlationId, AbortSignal.timeout(4e3));
|
|
388
|
+
} catch {
|
|
389
|
+
reportFailedQuestionWithdrawal();
|
|
390
|
+
return OPEN_QUESTION_CLOSED;
|
|
391
|
+
}
|
|
392
|
+
if (cancelled.cancelled === true) return OPEN_QUESTION_CLOSED;
|
|
378
393
|
try {
|
|
379
|
-
|
|
380
|
-
return cancelled.cancelled === true ? OPEN_QUESTION_CLOSED : await answerThatWonTheCancel(apiKey, correlationId);
|
|
394
|
+
return await answerThatWonTheCancel(apiKey, correlationId);
|
|
381
395
|
} catch {
|
|
382
396
|
return OPEN_QUESTION_CLOSED;
|
|
383
397
|
}
|
|
@@ -460,9 +474,11 @@ export {
|
|
|
460
474
|
waitRetryPauseMs,
|
|
461
475
|
sleepUnlessAborted,
|
|
462
476
|
pollForAnswer,
|
|
477
|
+
CANCEL_QUESTION_TIMEOUT_MS,
|
|
463
478
|
cancelQuestion,
|
|
464
479
|
withdrawQuestion,
|
|
465
480
|
waitForQuestion,
|
|
481
|
+
reportFailedQuestionWithdrawal,
|
|
466
482
|
waitForOpenQuestion,
|
|
467
483
|
sendNotification,
|
|
468
484
|
requestGate,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readExistingMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MOQUKAVU.js";
|
|
4
4
|
import {
|
|
5
5
|
getBaseUrl
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LVF5IBS6.js";
|
|
7
7
|
import {
|
|
8
8
|
NetworkError
|
|
9
9
|
} from "./chunk-YU2EUD7O.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
clientContextHeaders,
|
|
15
15
|
redactSecretsFromContent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L77OIGRB.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/net.ts
|
|
19
19
|
import { createRequire } from "module";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X7RPRBZE.js";
|
|
4
4
|
import {
|
|
5
5
|
readRegularJsonFile,
|
|
6
6
|
writeFileAtomic
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeDeclinedAgents,
|
|
14
14
|
withDeclinedAgent,
|
|
15
15
|
withoutDeclinedAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L77OIGRB.js";
|
|
17
17
|
|
|
18
18
|
// src/declined-agents-file.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DYZ26IPH.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WDLBF3PM.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addGeminiMcpServer,
|
|
3
3
|
removeGeminiMcpServer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OBUKF3WP.js";
|
|
5
5
|
import {
|
|
6
6
|
CLAUDE_CODE_AGENT
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PG5N3FL5.js";
|
|
8
8
|
import {
|
|
9
9
|
compatibleToolLookup
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CFZUESTS.js";
|
|
11
11
|
import {
|
|
12
12
|
CLAUDE_HOOK_EVENTS,
|
|
13
13
|
PUSHARY_MCP_URL,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isPusharyHook,
|
|
20
20
|
registerHookEntry,
|
|
21
21
|
removeClaudeMcpServers
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-X7RPRBZE.js";
|
|
23
23
|
import {
|
|
24
24
|
HOOK_COMPATIBLE_PROFILES,
|
|
25
25
|
PHONE_ANSWERED_TOOLS,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
pusharyMissingReason,
|
|
31
31
|
refusalOutput,
|
|
32
32
|
withHookHoldBudget
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-L77OIGRB.js";
|
|
34
34
|
|
|
35
35
|
// src/config-document.ts
|
|
36
36
|
import { parse, stringify } from "smol-toml";
|
|
@@ -193,7 +193,7 @@ var AGENT_ENFORCEMENT = {
|
|
|
193
193
|
whenHookIsMissing: HOOK_FAILURE.refusedOnPosix,
|
|
194
194
|
whenHookCrashes: HOOK_FAILURE.agentsOwnApproval,
|
|
195
195
|
gatedTools: [".*"],
|
|
196
|
-
notGated: "
|
|
196
|
+
notGated: "Every call reaches the hook, but the read-only tools (grep, list_dir, glob, read_file, todo_write, search_tool) only honour the kill switch and a deny rule, as Claude Code's reads do. Grok fails open if it kills the hook or cannot start it, the missing-binary guard does not refuse on Windows, and Grok's own permission checks still apply after a phone approval. Its question and plan dialogs stay in Grok."
|
|
197
197
|
},
|
|
198
198
|
claude_chat: NO_HOOK,
|
|
199
199
|
claude_cowork: NO_HOOK,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
formatVersion,
|
|
4
4
|
quoteIfNeeded,
|
|
5
5
|
shellDoubleQuoted
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NOHOCNY6.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
9
|
} from "./chunk-TODDEIYG.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
PUSHARY_HOSTS,
|
|
23
23
|
PUSHARY_TOOL_PREFIX,
|
|
24
24
|
withHookHoldBudget
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-L77OIGRB.js";
|
|
26
26
|
|
|
27
27
|
// src/setup/paths.ts
|
|
28
28
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -10,17 +10,17 @@ import {
|
|
|
10
10
|
openCodePluginArgv,
|
|
11
11
|
openCodePluginModule,
|
|
12
12
|
renderOpenCodePlugin
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UCND4JHN.js";
|
|
14
14
|
import {
|
|
15
15
|
compatibleConfigFile
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WTUURSCO.js";
|
|
17
17
|
import {
|
|
18
18
|
hookOwnerOf,
|
|
19
19
|
hookOwnerOfCommands
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OBUKF3WP.js";
|
|
21
21
|
import {
|
|
22
22
|
AGENT_CHOICES
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-AIUFZQAA.js";
|
|
24
24
|
import {
|
|
25
25
|
OPENCODE_INSTRUCTIONS_LABEL,
|
|
26
26
|
bridgeStub,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveBridgeStub,
|
|
35
35
|
vscodePluginDir,
|
|
36
36
|
windowsNodeLauncherFor
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-X7RPRBZE.js";
|
|
38
38
|
import {
|
|
39
39
|
readJsonSafe
|
|
40
40
|
} from "./chunk-TODDEIYG.js";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
OPENCODE_APPROVAL_EVENT,
|
|
45
45
|
hookCompatibleProfile,
|
|
46
46
|
isRecord
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-L77OIGRB.js";
|
|
48
48
|
|
|
49
49
|
// src/opencode-config.ts
|
|
50
50
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
claudeConfigDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X7RPRBZE.js";
|
|
4
4
|
import {
|
|
5
5
|
claudePermissionRulesFromSettings
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L77OIGRB.js";
|
|
7
7
|
|
|
8
8
|
// src/claude-permission-rules.ts
|
|
9
9
|
import { readFileSync, statSync } from "fs";
|