@pushary/agent-hooks 0.89.12 → 0.90.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.
- package/CHANGELOG.md +77 -0
- package/README.md +1 -0
- package/data/SKILL.md +1 -1
- package/data/cursor-plugin/skills/pushary/SKILL.md +1 -1
- package/data/vscode-plugin/skills/pushary/SKILL.md +1 -1
- package/dist/bin/pushary-bell-hook.js +4 -4
- package/dist/bin/pushary-bell.js +8 -8
- package/dist/bin/pushary-claude.js +194 -38
- package/dist/bin/pushary-clean.js +15 -32
- package/dist/bin/pushary-codex-bridge.js +37 -12
- package/dist/bin/pushary-codex-hook.js +45 -12
- package/dist/bin/pushary-codex.js +7 -7
- package/dist/bin/pushary-connect.js +11 -10
- package/dist/bin/pushary-daemon.js +186 -62
- package/dist/bin/pushary-disconnect.js +8 -8
- package/dist/bin/pushary-doctor.js +108 -25
- package/dist/bin/pushary-elicitation-hook.js +4 -4
- package/dist/bin/pushary-gemini-bridge.js +33 -11
- package/dist/bin/pushary-gemini-hook.js +21 -10
- package/dist/bin/pushary-hook.js +13 -13
- package/dist/bin/pushary-login.js +18 -7
- package/dist/bin/pushary-logout.js +6 -6
- package/dist/bin/pushary-mode.js +28 -21
- package/dist/bin/pushary-notification-hook.js +7 -7
- package/dist/bin/pushary-opencode-hook.js +8 -8
- package/dist/bin/pushary-permission-denied-hook.js +11 -11
- package/dist/bin/pushary-permission-hook.js +11 -11
- package/dist/bin/pushary-post-hook.js +14 -8
- package/dist/bin/pushary-prompt-hook.js +7 -7
- package/dist/bin/pushary-session-end-hook.js +7 -7
- package/dist/bin/pushary-session-start-hook.js +7 -7
- package/dist/bin/pushary-setup.js +168 -45
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +11 -10
- package/dist/bin/pushary-stop-hook.js +14 -8
- package/dist/bin/pushary-stopfailure-hook.js +7 -7
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-transcripts.d.ts +1 -0
- package/dist/bin/pushary-transcripts.js +79 -0
- package/dist/bin/pushary-upgrade.js +15 -15
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +3 -2
- package/dist/{chunk-KVHP5ZME.js → chunk-2LAHXHBR.js} +1 -1
- package/dist/{chunk-RLQWNEPM.js → chunk-43GMYSS4.js} +15 -0
- package/dist/{chunk-5NDB3YOE.js → chunk-54ELC7D7.js} +1 -1
- package/dist/{chunk-VPLQFXCH.js → chunk-5NAZ7SFS.js} +1 -1
- package/dist/chunk-7FE2KABY.js +156 -0
- package/dist/{chunk-DHR4F2CR.js → chunk-7TPQEWUZ.js} +1 -1
- package/dist/{chunk-Y4WVZIEI.js → chunk-AJYV3VGU.js} +1 -1
- package/dist/{chunk-QFJZHVVL.js → chunk-AZPIQG4G.js} +35 -1
- package/dist/{chunk-OCMOTJTW.js → chunk-B7UZHEBL.js} +29 -22
- package/dist/{chunk-7HYJPOGG.js → chunk-BQBEH6TV.js} +5 -5
- package/dist/{chunk-OTPJ4FUR.js → chunk-BVBEURWJ.js} +1 -1
- package/dist/{chunk-7DK3ZH3N.js → chunk-CELX75MW.js} +1 -1
- package/dist/{chunk-6VXNA5JB.js → chunk-CNPAT3HL.js} +3 -2
- package/dist/{chunk-327YMKP5.js → chunk-DYP6SMOR.js} +1 -1
- package/dist/chunk-DZDI62LY.js +145 -0
- package/dist/{chunk-VF3RTVWY.js → chunk-EZIEXHYM.js} +15 -7
- package/dist/{chunk-PS7DQ2SU.js → chunk-F2ICEWZL.js} +101 -19
- package/dist/{chunk-3XSP5SML.js → chunk-FQL5E6NG.js} +2 -2
- package/dist/{chunk-JHJHCMAF.js → chunk-FXEVRLHC.js} +20 -2
- package/dist/{chunk-6V7ZDH3A.js → chunk-GL3FFM7A.js} +7 -4
- package/dist/{chunk-NBRM3FMD.js → chunk-H2QZRQR2.js} +1 -1
- package/dist/{chunk-GKPURU7P.js → chunk-I463AEG3.js} +1 -1
- package/dist/{chunk-XREW7RQ3.js → chunk-JW4KO5AF.js} +1 -1
- package/dist/{chunk-OVEGEQSB.js → chunk-KUZWXPUS.js} +3 -2
- package/dist/{chunk-JVZX5YRJ.js → chunk-L4E2BIJ2.js} +80 -7
- package/dist/{chunk-RNKPLUWC.js → chunk-OSALSIUF.js} +1 -1
- package/dist/{chunk-MFNQ5IMW.js → chunk-PYA4FLKI.js} +32 -21
- package/dist/chunk-QCGNGEGE.js +15 -0
- package/dist/chunk-S6LYP7QA.js +127 -0
- package/dist/{chunk-OADGBOP7.js → chunk-TDZFPMSZ.js} +70 -11
- package/dist/{chunk-JJV5Q4KG.js → chunk-UZNKVRLE.js} +1 -1
- package/dist/{chunk-FCUUVHTS.js → chunk-VHWCVD42.js} +1 -1
- package/dist/{chunk-3MCEES6Z.js → chunk-VNMKIJZB.js} +15 -2
- package/dist/{chunk-6GU55AQQ.js → chunk-Y6BWPERV.js} +90 -7
- package/dist/chunk-YKLCWWEI.js +76 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +11 -11
- package/package.json +3 -2
- package/dist/chunk-NESKLV6R.js +0 -72
- package/dist/chunk-WDVQ6O4C.js +0 -84
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
HERMES_CONFIG_SCRIPT,
|
|
4
|
+
createGuards,
|
|
4
5
|
resolveHermesPython,
|
|
5
6
|
runHermesPythonScript
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-AZPIQG4G.js";
|
|
7
8
|
import {
|
|
8
9
|
removeInstructionBlock,
|
|
9
10
|
shortenHome,
|
|
10
11
|
unregisterPluginLocation,
|
|
11
12
|
vscodeSettingsTargets
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-FQL5E6NG.js";
|
|
13
14
|
import {
|
|
14
15
|
pusharyHookExecutable
|
|
15
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-DZDI62LY.js";
|
|
16
17
|
import {
|
|
17
18
|
OPENCODE_PLUGIN_SIBLING,
|
|
18
19
|
OPENCODE_PLUGIN_SIBLING_CONTENTS,
|
|
@@ -22,25 +23,25 @@ import {
|
|
|
22
23
|
openCodePluginDir,
|
|
23
24
|
openCodePluginFile,
|
|
24
25
|
removeOpenCodeMcpServer
|
|
25
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-CELX75MW.js";
|
|
26
27
|
import {
|
|
27
28
|
isClaudeMcpSnapshot,
|
|
28
29
|
removeClaudeMcpServers,
|
|
29
30
|
removeGeminiSettings,
|
|
30
31
|
removePusharySettings,
|
|
31
32
|
restoreClaudeMcpServer
|
|
32
|
-
} from "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
-
import "../chunk-
|
|
33
|
+
} from "../chunk-GL3FFM7A.js";
|
|
34
|
+
import "../chunk-2LAHXHBR.js";
|
|
35
|
+
import "../chunk-EZIEXHYM.js";
|
|
35
36
|
import {
|
|
36
37
|
disableDaemonService
|
|
37
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-F2ICEWZL.js";
|
|
38
39
|
import "../chunk-XHKBHWLX.js";
|
|
39
40
|
import {
|
|
40
41
|
execNpm
|
|
41
42
|
} from "../chunk-L4ZCFMWW.js";
|
|
42
|
-
import "../chunk-
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-L4E2BIJ2.js";
|
|
44
|
+
import "../chunk-54ELC7D7.js";
|
|
44
45
|
import {
|
|
45
46
|
claudeJson,
|
|
46
47
|
claudeMcpReceipt,
|
|
@@ -63,14 +64,14 @@ import {
|
|
|
63
64
|
removeCodexHookTrust,
|
|
64
65
|
removeCodexHooks,
|
|
65
66
|
vscodePluginDir
|
|
66
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-KUZWXPUS.js";
|
|
67
68
|
import {
|
|
68
69
|
rejectUnknownFlags
|
|
69
70
|
} from "../chunk-GMXKITVA.js";
|
|
70
71
|
import {
|
|
71
72
|
exitOnHelpFlag
|
|
72
|
-
} from "../chunk-
|
|
73
|
-
import "../chunk-
|
|
73
|
+
} from "../chunk-BVBEURWJ.js";
|
|
74
|
+
import "../chunk-43GMYSS4.js";
|
|
74
75
|
import "../chunk-DINDL2CF.js";
|
|
75
76
|
import {
|
|
76
77
|
removeClaudeAlias
|
|
@@ -84,7 +85,7 @@ import "../chunk-2UMNXADU.js";
|
|
|
84
85
|
import {
|
|
85
86
|
CURSOR_GATE_EVENTS,
|
|
86
87
|
HOOK_LOCATOR_BINARY
|
|
87
|
-
} from "../chunk-
|
|
88
|
+
} from "../chunk-VNMKIJZB.js";
|
|
88
89
|
|
|
89
90
|
// bin/pushary-clean.ts
|
|
90
91
|
import { existsSync, readFileSync, copyFileSync, readdirSync } from "fs";
|
|
@@ -93,24 +94,6 @@ import { homedir, tmpdir } from "os";
|
|
|
93
94
|
import { confirm } from "@inquirer/prompts";
|
|
94
95
|
import { parse as parseTOML, stringify as stringifyTOML } from "smol-toml";
|
|
95
96
|
|
|
96
|
-
// src/cli/dry-run.ts
|
|
97
|
-
import { execSync } from "child_process";
|
|
98
|
-
import { rmSync, writeFileSync } from "fs";
|
|
99
|
-
var createGuards = (isDryRun, note) => ({
|
|
100
|
-
write: (path, contents) => {
|
|
101
|
-
if (isDryRun()) return note("rewrite", path);
|
|
102
|
-
writeFileSync(path, contents, "utf-8");
|
|
103
|
-
},
|
|
104
|
-
remove: (path, options = {}) => {
|
|
105
|
-
if (isDryRun()) return note("remove ", path);
|
|
106
|
-
rmSync(path, { recursive: true, force: options.force ?? false });
|
|
107
|
-
},
|
|
108
|
-
exec: (command, options, describe) => {
|
|
109
|
-
if (isDryRun()) return note("run ", describe);
|
|
110
|
-
execSync(command, options);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
|
|
114
97
|
// src/app-owned-paths.ts
|
|
115
98
|
var APP_OWNED_ENTRIES = [
|
|
116
99
|
// PusharyPaths.bin: bridgeStub, bridgeCache
|
|
@@ -6,16 +6,19 @@ import {
|
|
|
6
6
|
postLiveSession,
|
|
7
7
|
postLiveSessionUntilAccepted,
|
|
8
8
|
startLiveSessionHeartbeat
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-CNPAT3HL.js";
|
|
10
|
+
import "../chunk-7FE2KABY.js";
|
|
11
11
|
import "../chunk-QZCFVWA7.js";
|
|
12
12
|
import {
|
|
13
13
|
transcriptsEnabled
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-UZNKVRLE.js";
|
|
15
15
|
import {
|
|
16
|
+
SESSION_IDLE_TIMEOUT_MS,
|
|
17
|
+
describeIdleWindow,
|
|
18
|
+
idleDeadlinePassed,
|
|
16
19
|
startProcessOwnership,
|
|
17
20
|
withSpawnProcessOwnership
|
|
18
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-Y6BWPERV.js";
|
|
19
22
|
import {
|
|
20
23
|
spawnClaude
|
|
21
24
|
} from "../chunk-XHKBHWLX.js";
|
|
@@ -24,17 +27,17 @@ import {
|
|
|
24
27
|
} from "../chunk-L4ZCFMWW.js";
|
|
25
28
|
import {
|
|
26
29
|
getMachineId
|
|
27
|
-
} from "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
+
} from "../chunk-54ELC7D7.js";
|
|
31
|
+
import "../chunk-KUZWXPUS.js";
|
|
32
|
+
import "../chunk-OSALSIUF.js";
|
|
30
33
|
import "../chunk-BC3VCZ3E.js";
|
|
31
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-JW4KO5AF.js";
|
|
32
35
|
import "../chunk-4LL6LG5X.js";
|
|
33
36
|
import {
|
|
34
37
|
getApiKey,
|
|
35
38
|
getBaseUrl
|
|
36
39
|
} from "../chunk-2UMNXADU.js";
|
|
37
|
-
import "../chunk-
|
|
40
|
+
import "../chunk-VNMKIJZB.js";
|
|
38
41
|
|
|
39
42
|
// bin/pushary-codex-bridge.ts
|
|
40
43
|
import { existsSync } from "fs";
|
|
@@ -187,15 +190,21 @@ var rpcTurnId = (result) => {
|
|
|
187
190
|
};
|
|
188
191
|
var runCodexBridge = async (options) => {
|
|
189
192
|
const timeoutMs = options.requestTimeoutMs ?? 1e4;
|
|
193
|
+
const now = options.now ?? Date.now;
|
|
194
|
+
const idleTimeoutMs = options.idleTimeoutMs ?? SESSION_IDLE_TIMEOUT_MS;
|
|
190
195
|
const rpc = new JsonRpcClient(options.appServer, options.cwd, timeoutMs);
|
|
191
196
|
let threadId = options.resumeThreadId ?? null;
|
|
192
197
|
let activeTurnId = null;
|
|
198
|
+
let lastCompletedTurnId = null;
|
|
199
|
+
let idleSince = now();
|
|
200
|
+
let idledOut = false;
|
|
193
201
|
let relay = null;
|
|
194
202
|
let linked = false;
|
|
195
203
|
let stopHeartbeat = () => {
|
|
196
204
|
};
|
|
197
205
|
let ownership = null;
|
|
198
206
|
const messages = /* @__PURE__ */ new Map();
|
|
207
|
+
const idleDeadlineReached = () => activeTurnId === null && idleDeadlinePassed(idleSince, now(), idleTimeoutMs);
|
|
199
208
|
const reportBody = (event, action) => ({
|
|
200
209
|
event,
|
|
201
210
|
action,
|
|
@@ -213,7 +222,9 @@ var runCodexBridge = async (options) => {
|
|
|
213
222
|
const params = message.params ?? {};
|
|
214
223
|
if (message.method === "turn/started") activeTurnId = string(object(params.turn)?.id);
|
|
215
224
|
if (message.method === "turn/completed") {
|
|
225
|
+
lastCompletedTurnId = string(object(params.turn)?.id) ?? activeTurnId;
|
|
216
226
|
activeTurnId = null;
|
|
227
|
+
idleSince = now();
|
|
217
228
|
void report("stop", "Turn completed").catch(() => {
|
|
218
229
|
});
|
|
219
230
|
}
|
|
@@ -253,7 +264,12 @@ var runCodexBridge = async (options) => {
|
|
|
253
264
|
reportBody("session_start", options.resumeThreadId ? "Session resumed" : "Session started")
|
|
254
265
|
);
|
|
255
266
|
linked = true;
|
|
256
|
-
stopHeartbeat = startLiveSessionHeartbeat(
|
|
267
|
+
stopHeartbeat = startLiveSessionHeartbeat(
|
|
268
|
+
options,
|
|
269
|
+
reportBody("heartbeat", "Session online"),
|
|
270
|
+
void 0,
|
|
271
|
+
() => ownership?.touch()
|
|
272
|
+
);
|
|
257
273
|
const startTurn = async (text, commandId) => {
|
|
258
274
|
relay?.add({ type: "user", uuid: commandId, message: { role: "user", content: text } });
|
|
259
275
|
const result = activeTurnId ? await rpc.request("turn/steer", {
|
|
@@ -268,11 +284,16 @@ var runCodexBridge = async (options) => {
|
|
|
268
284
|
model: options.model ?? null,
|
|
269
285
|
clientUserMessageId: commandId
|
|
270
286
|
});
|
|
271
|
-
|
|
287
|
+
const startedTurnId = rpcTurnId(result);
|
|
288
|
+
if (startedTurnId && startedTurnId !== lastCompletedTurnId) activeTurnId = startedTurnId;
|
|
272
289
|
};
|
|
273
290
|
if (options.prompt) await startTurn(options.prompt, `spawn-${options.spawnId}`);
|
|
274
291
|
let pendingAck = null;
|
|
275
292
|
while (!options.signal.aborted && !rpc.isClosed) {
|
|
293
|
+
if (idleDeadlineReached()) {
|
|
294
|
+
idledOut = true;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
276
297
|
try {
|
|
277
298
|
if (pendingAck) {
|
|
278
299
|
const acknowledged = await postLiveSession(options, "/api/agent/command/ack", pendingAck);
|
|
@@ -292,6 +313,7 @@ var runCodexBridge = async (options) => {
|
|
|
292
313
|
const commandId = string(command?.id);
|
|
293
314
|
const text = string(command?.text);
|
|
294
315
|
if (commandId && text) {
|
|
316
|
+
idleSince = now();
|
|
295
317
|
try {
|
|
296
318
|
await startTurn(text, commandId);
|
|
297
319
|
pendingAck = {
|
|
@@ -321,7 +343,10 @@ var runCodexBridge = async (options) => {
|
|
|
321
343
|
await rpc.request("turn/interrupt", { threadId, turnId: activeTurnId }).catch(() => null);
|
|
322
344
|
}
|
|
323
345
|
await relay?.flush();
|
|
324
|
-
await report(
|
|
346
|
+
await report(
|
|
347
|
+
"session_closed",
|
|
348
|
+
idledOut ? `Session ended after ${describeIdleWindow(idleTimeoutMs)} idle` : "Session stopped"
|
|
349
|
+
).catch(() => null);
|
|
325
350
|
return "stopped";
|
|
326
351
|
} catch (error) {
|
|
327
352
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
defersToNativeMode
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-I463AEG3.js";
|
|
5
5
|
import {
|
|
6
6
|
isGatingMoment,
|
|
7
7
|
recordKeylessMoment
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-VHWCVD42.js";
|
|
9
9
|
import {
|
|
10
10
|
readHookInput
|
|
11
11
|
} from "../chunk-6CUUA7HO.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
toCodexWire,
|
|
35
35
|
toPolicyLookup,
|
|
36
36
|
toPolicyLookups
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-TDZFPMSZ.js";
|
|
38
38
|
import {
|
|
39
39
|
DEFAULT_SESSION,
|
|
40
40
|
askUser,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
pollForAnswer,
|
|
43
43
|
savePendingQuestion,
|
|
44
44
|
sendNotification
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-FXEVRLHC.js";
|
|
46
46
|
import {
|
|
47
47
|
UNNAMED_ACTION,
|
|
48
48
|
deriveActionBody,
|
|
@@ -50,18 +50,18 @@ import {
|
|
|
50
50
|
deriveToolTarget,
|
|
51
51
|
describeToolCall,
|
|
52
52
|
scopePathFor
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-L4E2BIJ2.js";
|
|
54
54
|
import {
|
|
55
55
|
getMachineId
|
|
56
|
-
} from "../chunk-
|
|
56
|
+
} from "../chunk-54ELC7D7.js";
|
|
57
57
|
import {
|
|
58
58
|
canonicalJson
|
|
59
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-KUZWXPUS.js";
|
|
60
60
|
import "../chunk-BSZYIAZL.js";
|
|
61
61
|
import "../chunk-SAF6HGAA.js";
|
|
62
62
|
import "../chunk-7QLSKOSU.js";
|
|
63
63
|
import "../chunk-KZERVKTD.js";
|
|
64
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-JW4KO5AF.js";
|
|
65
65
|
import "../chunk-4LL6LG5X.js";
|
|
66
66
|
import {
|
|
67
67
|
getApiKey
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
hookWaitClamped,
|
|
74
74
|
hookWaitDeadline,
|
|
75
75
|
resolveGate
|
|
76
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-VNMKIJZB.js";
|
|
77
77
|
|
|
78
78
|
// bin/pushary-codex-hook.ts
|
|
79
79
|
import { basename } from "path";
|
|
@@ -250,7 +250,10 @@ var fromRecordedDecision = (decision) => {
|
|
|
250
250
|
if (decision.kind === "denied") return codexDeny(decision.reason);
|
|
251
251
|
return codexPass();
|
|
252
252
|
};
|
|
253
|
+
var PUSHARY_OWN_TOOL_PREFIX = "mcp__pushary__";
|
|
254
|
+
var isPusharyOwnTool = (toolName) => typeof toolName === "string" && toolName.startsWith(PUSHARY_OWN_TOOL_PREFIX);
|
|
253
255
|
var decidePermissionRequest = async (input) => {
|
|
256
|
+
if (isPusharyOwnTool(input.tool_name)) return codexPass();
|
|
254
257
|
const recorded = consumeCodexCallDecision(callKeyFor(input));
|
|
255
258
|
if (recorded) return fromRecordedDecision(recorded);
|
|
256
259
|
try {
|
|
@@ -278,7 +281,7 @@ var decidePermissionRequest = async (input) => {
|
|
|
278
281
|
if (answer.value === "yes") return codexAllow();
|
|
279
282
|
return codexDeny(denyReasonFrom(answer.value, answer.note));
|
|
280
283
|
}
|
|
281
|
-
savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId);
|
|
284
|
+
savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
|
|
282
285
|
if (toolPolicy.mode === "push_first") return codexPass();
|
|
283
286
|
if (clampCut) return codexPass();
|
|
284
287
|
return permissionTimeoutDecision(toolPolicy.timeoutAction);
|
|
@@ -293,7 +296,33 @@ var recordPreToolUse = (key, outcome) => {
|
|
|
293
296
|
);
|
|
294
297
|
return outcome;
|
|
295
298
|
};
|
|
299
|
+
var permissionRequestNeverFires = (permissionMode) => permissionMode === "bypassPermissions";
|
|
300
|
+
var decidePushFirstBeforeTheTool = async (apiKey, input, lookup, pushFirstSeconds, callKey) => {
|
|
301
|
+
let pushed;
|
|
302
|
+
try {
|
|
303
|
+
pushed = await pushQuestion(apiKey, input, lookup, pushFirstSeconds, "push_first");
|
|
304
|
+
} catch {
|
|
305
|
+
return recordPreToolUse(callKey, codexPass());
|
|
306
|
+
}
|
|
307
|
+
const { answer, correlationId, suppressed, noDevices } = pushed;
|
|
308
|
+
if (suppressed || noDevices) {
|
|
309
|
+
await cancelQuestion(apiKey, correlationId).catch(() => {
|
|
310
|
+
});
|
|
311
|
+
return recordPreToolUse(callKey, codexPass());
|
|
312
|
+
}
|
|
313
|
+
if (answer.answered) {
|
|
314
|
+
if (isDeferAnswer(answer.value)) return recordPreToolUse(callKey, codexPass());
|
|
315
|
+
if (answer.value === "yes") {
|
|
316
|
+
recordCodexCallDecision(callKey, { kind: "approved" });
|
|
317
|
+
return codexPass();
|
|
318
|
+
}
|
|
319
|
+
return recordPreToolUse(callKey, codexDeny(denyReasonFrom(answer.value, answer.note)));
|
|
320
|
+
}
|
|
321
|
+
savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
|
|
322
|
+
return recordPreToolUse(callKey, codexPass());
|
|
323
|
+
};
|
|
296
324
|
var decidePreToolUse = async (input) => {
|
|
325
|
+
if (isPusharyOwnTool(input.tool_name)) return codexPass();
|
|
297
326
|
let apiKey;
|
|
298
327
|
try {
|
|
299
328
|
apiKey = getApiKey();
|
|
@@ -342,7 +371,7 @@ var decidePreToolUse = async (input) => {
|
|
|
342
371
|
}
|
|
343
372
|
return recordPreToolUse(callKey, codexDeny(denyReasonFrom(answer.value, answer.note)));
|
|
344
373
|
}
|
|
345
|
-
savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId);
|
|
374
|
+
savePendingQuestion(input.session_id || DEFAULT_SESSION, correlationId, input.tool_use_id);
|
|
346
375
|
if (clampCut) return recordPreToolUse(callKey, codexPass());
|
|
347
376
|
return recordPreToolUse(callKey, preToolUseTimeoutDecision(toolPolicy.timeoutAction));
|
|
348
377
|
}
|
|
@@ -351,6 +380,9 @@ var decidePreToolUse = async (input) => {
|
|
|
351
380
|
recordCodexCallDecision(callKey, { kind: "handled" });
|
|
352
381
|
return codexPass();
|
|
353
382
|
}
|
|
383
|
+
if (toolPolicy.mode === "push_first" && permissionRequestNeverFires(input.permission_mode)) {
|
|
384
|
+
return decidePushFirstBeforeTheTool(apiKey, input, lookup, toolPolicy.pushFirstSeconds, callKey);
|
|
385
|
+
}
|
|
354
386
|
return codexPass();
|
|
355
387
|
} catch {
|
|
356
388
|
return codexPass();
|
|
@@ -398,7 +430,8 @@ var main = async () => {
|
|
|
398
430
|
tool_input: lookup.input,
|
|
399
431
|
tool_result: asToolResult(input.tool_response),
|
|
400
432
|
cwd: input.cwd,
|
|
401
|
-
session_id: input.session_id
|
|
433
|
+
session_id: input.session_id,
|
|
434
|
+
tool_use_id: input.tool_use_id
|
|
402
435
|
}, CODEX_AGENT));
|
|
403
436
|
break;
|
|
404
437
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reportEvent
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-TDZFPMSZ.js";
|
|
5
5
|
import {
|
|
6
6
|
askUser,
|
|
7
7
|
waitForAnswer
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-FXEVRLHC.js";
|
|
9
|
+
import "../chunk-L4E2BIJ2.js";
|
|
10
10
|
import {
|
|
11
11
|
getMachineId
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-54ELC7D7.js";
|
|
13
|
+
import "../chunk-KUZWXPUS.js";
|
|
14
14
|
import "../chunk-BSZYIAZL.js";
|
|
15
15
|
import "../chunk-SAF6HGAA.js";
|
|
16
16
|
import "../chunk-7QLSKOSU.js";
|
|
17
17
|
import "../chunk-KZERVKTD.js";
|
|
18
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-JW4KO5AF.js";
|
|
19
19
|
import "../chunk-4LL6LG5X.js";
|
|
20
20
|
import {
|
|
21
21
|
getApiKey
|
|
22
22
|
} from "../chunk-2UMNXADU.js";
|
|
23
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-VNMKIJZB.js";
|
|
24
24
|
|
|
25
25
|
// bin/pushary-codex.ts
|
|
26
26
|
import { basename } from "path";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
printKeyCheck
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-DYP6SMOR.js";
|
|
5
5
|
import {
|
|
6
|
-
confirmAppConnection,
|
|
7
6
|
connectDevice,
|
|
7
|
+
connectExistingApp,
|
|
8
8
|
printConnectInstructions
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-PYA4FLKI.js";
|
|
10
10
|
import "../chunk-3EGEA4KH.js";
|
|
11
11
|
import {
|
|
12
12
|
checkApiKey
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-AJYV3VGU.js";
|
|
14
|
+
import "../chunk-QCGNGEGE.js";
|
|
14
15
|
import {
|
|
15
16
|
createIo
|
|
16
17
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -19,12 +20,12 @@ import {
|
|
|
19
20
|
} from "../chunk-GMXKITVA.js";
|
|
20
21
|
import {
|
|
21
22
|
exitOnHelpFlag
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-BVBEURWJ.js";
|
|
24
|
+
import "../chunk-43GMYSS4.js";
|
|
24
25
|
import "../chunk-DINDL2CF.js";
|
|
25
26
|
import {
|
|
26
27
|
readKeySource
|
|
27
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-OSALSIUF.js";
|
|
28
29
|
import "../chunk-BC3VCZ3E.js";
|
|
29
30
|
import "../chunk-BSZYIAZL.js";
|
|
30
31
|
import "../chunk-SAF6HGAA.js";
|
|
@@ -34,10 +35,10 @@ import {
|
|
|
34
35
|
import {
|
|
35
36
|
EXIT
|
|
36
37
|
} from "../chunk-KZERVKTD.js";
|
|
37
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-JW4KO5AF.js";
|
|
38
39
|
import "../chunk-4LL6LG5X.js";
|
|
39
40
|
import "../chunk-2UMNXADU.js";
|
|
40
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-VNMKIJZB.js";
|
|
41
42
|
|
|
42
43
|
// bin/pushary-connect.ts
|
|
43
44
|
exitOnHelpFlag("connect");
|
|
@@ -79,7 +80,7 @@ var main = async () => {
|
|
|
79
80
|
if (keyCheck.kind !== "unreachable") process.exit(report.exitCode);
|
|
80
81
|
console.log();
|
|
81
82
|
}
|
|
82
|
-
const result = options.mode === "app" ? await
|
|
83
|
+
const result = options.mode === "app" ? await connectExistingApp(source.key) : process.stdout.isTTY ? await connectDevice(source.key, { showCapabilities: true }) : await printConnectInstructions(source.key);
|
|
83
84
|
console.log();
|
|
84
85
|
if (result.reachesYou) {
|
|
85
86
|
console.log(` ${dim("Your phone can receive approvals. Try")} ${cyan("pushary doctor --roundtrip")} ${dim("to answer one.")}`);
|