@pushary/agent-hooks 1.9.35 → 1.9.37
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/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +25 -25
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +24 -24
- package/dist/bin/pushary-clean.js +52 -45
- package/dist/bin/pushary-codex-bridge.js +17 -17
- package/dist/bin/pushary-codex-hook.js +65 -41
- package/dist/bin/pushary-codex.js +12 -12
- package/dist/bin/pushary-connect.js +24 -24
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +32 -32
- package/dist/bin/pushary-disconnect.js +31 -28
- package/dist/bin/pushary-doctor.js +35 -34
- package/dist/bin/pushary-elicitation-hook.js +25 -25
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +27 -27
- package/dist/bin/pushary-hook.js +34 -30
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +24 -24
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +12 -12
- package/dist/bin/pushary-notification-hook.js +24 -24
- package/dist/bin/pushary-opencode-hook.js +26 -26
- package/dist/bin/pushary-permission-denied-hook.js +29 -29
- package/dist/bin/pushary-permission-hook.js +28 -28
- package/dist/bin/pushary-post-hook.js +24 -24
- package/dist/bin/pushary-prompt-hook.js +24 -24
- package/dist/bin/pushary-session-end-hook.js +24 -24
- package/dist/bin/pushary-session-start-hook.js +28 -28
- package/dist/bin/pushary-setup.js +65 -56
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +26 -26
- package/dist/bin/pushary-stop-hook.js +24 -24
- package/dist/bin/pushary-stopfailure-hook.js +24 -24
- package/dist/bin/pushary-suggestions.js +12 -12
- package/dist/bin/pushary-transcript-register.js +17 -17
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +30 -30
- package/dist/bin/pushary-wait.js +12 -12
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-7FQL5NWJ.js → chunk-235LKHLW.js} +301 -90
- package/dist/{chunk-LOYSI2CZ.js → chunk-2WZJHJAB.js} +5 -5
- package/dist/{chunk-YABMIGR3.js → chunk-3Y73MQPF.js} +1 -1
- package/dist/{chunk-GC3SUMYD.js → chunk-4OQHT5IJ.js} +4 -4
- package/dist/{chunk-QJ3ENGBT.js → chunk-6SYU5LVK.js} +3 -3
- package/dist/{chunk-NKAMF2YJ.js → chunk-6VUVVVVN.js} +1 -1
- package/dist/{chunk-3LS3GFJW.js → chunk-AZXPJLKC.js} +1 -1
- package/dist/{chunk-A455TSHF.js → chunk-B7SE22M7.js} +2 -2
- package/dist/{chunk-XLXG6MA5.js → chunk-DG5QHKJA.js} +3 -3
- package/dist/{chunk-7IVV4LLF.js → chunk-DYALNCS6.js} +3 -3
- package/dist/{chunk-PEEJP4HN.js → chunk-EK6PRPCY.js} +4 -4
- package/dist/{chunk-FPYBX36E.js → chunk-F3J6JFR2.js} +5 -5
- package/dist/{chunk-Z6HDYK2A.js → chunk-FFRH7KZP.js} +2 -2
- package/dist/{chunk-V4ZIG66K.js → chunk-GKTVIN4F.js} +1 -1
- package/dist/{chunk-YRDNKY77.js → chunk-GQSJVYKN.js} +6 -6
- package/dist/{chunk-EGTRIM74.js → chunk-GSP7CC52.js} +4 -4
- package/dist/{chunk-NMQLY4PE.js → chunk-GUHM2UQO.js} +2 -2
- package/dist/{chunk-OZMGO4WF.js → chunk-HA22GGDG.js} +5 -5
- package/dist/{chunk-WFPXKCN4.js → chunk-HJF57K2U.js} +5 -5
- package/dist/{chunk-VTAC5FBZ.js → chunk-HK2RPWAD.js} +1 -1
- package/dist/{chunk-SMSX4TCC.js → chunk-HQR6DYVG.js} +1 -1
- package/dist/{chunk-FQQSW7MD.js → chunk-ISNGKZG4.js} +1 -1
- package/dist/{chunk-EJWSE7S7.js → chunk-JLQV3XLV.js} +4 -4
- package/dist/{chunk-A5FFSXZE.js → chunk-JMLJHKJN.js} +2 -2
- package/dist/{chunk-7S7H7V5V.js → chunk-KHLYOIPY.js} +97 -40
- package/dist/{chunk-HVUBWLER.js → chunk-KZ3XE3JG.js} +34 -109
- package/dist/{chunk-CK3W7Q5S.js → chunk-MAGB6VW6.js} +1 -1
- package/dist/{chunk-DCBSD22V.js → chunk-N5WEEYV6.js} +3 -3
- package/dist/{chunk-U7CN5HG2.js → chunk-NDQXKLGE.js} +5 -5
- package/dist/{chunk-IRU7DKJW.js → chunk-NPE44CX4.js} +7 -3
- package/dist/{chunk-22YSHBTI.js → chunk-NWSWP3KY.js} +3 -3
- package/dist/{chunk-HQKYWUBF.js → chunk-OSLC7G3D.js} +2 -2
- package/dist/{chunk-7UGGCTTW.js → chunk-PDDJKGIW.js} +2 -2
- package/dist/chunk-PDRKQSC6.js +184 -0
- package/dist/{chunk-4PIAOJAW.js → chunk-PYWLW7PC.js} +1 -1
- package/dist/{chunk-6OGDGQTT.js → chunk-Q3TCLMYC.js} +5 -5
- package/dist/{chunk-57FFQR46.js → chunk-Q52PBCN7.js} +1 -1
- package/dist/{chunk-DQKEGNTI.js → chunk-QUKATQ66.js} +1 -1
- package/dist/{chunk-UPRNSD2T.js → chunk-RFIHLLRH.js} +9 -6
- package/dist/{chunk-36ZCFJUI.js → chunk-SNI4FGOV.js} +1 -1
- package/dist/{chunk-43H2FUNN.js → chunk-SNUNAIKK.js} +4 -4
- package/dist/{chunk-WMB3OCI4.js → chunk-T2NKNQPM.js} +2 -2
- package/dist/{chunk-WPSI4246.js → chunk-UEIL72RN.js} +1 -1
- package/dist/{chunk-UDECNZYI.js → chunk-UK3WY3LE.js} +2 -2
- package/dist/{chunk-E2OZZZKP.js → chunk-UKCGR5T2.js} +2 -2
- package/dist/{chunk-CPYOJRDN.js → chunk-V7Q7DQXL.js} +8 -8
- package/dist/{chunk-ULJFIF5N.js → chunk-VA36Q6BD.js} +1 -1
- package/dist/{chunk-FDNMQEU6.js → chunk-VMIDUNOT.js} +2 -2
- package/dist/{chunk-SMRMWDFE.js → chunk-W73URGML.js} +43 -17
- package/dist/{chunk-45OXG3VR.js → chunk-WXA3CFZR.js} +1 -1
- package/dist/{chunk-4TFD3WAA.js → chunk-YNJ372JU.js} +2 -2
- package/dist/{chunk-H52HBSOD.js → chunk-Z5ORWTY3.js} +3 -3
- package/dist/{chunk-B5RLJ6QD.js → chunk-ZMR3DSMH.js} +9 -5
- package/dist/{chunk-HJNCVY5F.js → chunk-ZQD6GVS7.js} +7 -7
- package/dist/{global-upgrade-IZCB4WIE.js → global-upgrade-R57HCUTC.js} +6 -6
- package/dist/{paths-4WAA57P5.js → paths-G2AYNZCD.js} +2 -2
- package/dist/{reapply-GJ73ZHDD.js → reapply-FHCOPXEN.js} +20 -20
- package/dist/src/index.js +19 -19
- package/dist/{upgrade-lock-J5PIKSYV.js → upgrade-lock-3I7AF7E3.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-FYQG2UTK.js +0 -71
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
announceSubscriptionRequired,
|
|
3
|
+
isDeferAnswer
|
|
4
|
+
} from "./chunk-6VUVVVVN.js";
|
|
5
|
+
import {
|
|
6
|
+
AUTO_DECISION_WINDOW_MS,
|
|
7
|
+
DEFAULT_SESSION,
|
|
8
|
+
claimThrottle,
|
|
9
|
+
deriveToolTarget,
|
|
10
|
+
permissionDeniedAction,
|
|
11
|
+
releaseThrottle,
|
|
12
|
+
reportEvent
|
|
13
|
+
} from "./chunk-W73URGML.js";
|
|
14
|
+
import {
|
|
15
|
+
askUser,
|
|
16
|
+
isDecisionStopped,
|
|
17
|
+
waitForQuestion
|
|
18
|
+
} from "./chunk-HA22GGDG.js";
|
|
19
|
+
import {
|
|
20
|
+
SubscriptionRequiredError
|
|
21
|
+
} from "./chunk-Z5ORWTY3.js";
|
|
22
|
+
import {
|
|
23
|
+
getMachineId
|
|
24
|
+
} from "./chunk-VA36Q6BD.js";
|
|
25
|
+
import {
|
|
26
|
+
machineDecisionFor,
|
|
27
|
+
parseAgentQuestionAnswers,
|
|
28
|
+
shouldDeferToNativeMode,
|
|
29
|
+
wireVerdictFor
|
|
30
|
+
} from "./chunk-235LKHLW.js";
|
|
31
|
+
|
|
32
|
+
// src/machine-decision-audit.ts
|
|
33
|
+
import { basename } from "path";
|
|
34
|
+
var reportMachineDenial = async (input, verdict, agent) => {
|
|
35
|
+
const decision = machineDecisionFor(wireVerdictFor(verdict, 0));
|
|
36
|
+
if (!decision) return;
|
|
37
|
+
const sessionKey = input.session_id || DEFAULT_SESSION;
|
|
38
|
+
const toolTarget = deriveToolTarget(input.tool_name, input.tool_input);
|
|
39
|
+
const throttleKey = `machinedecision:${agent.type}:${sessionKey}:${input.tool_name}:${decision.origin}:${toolTarget ?? ""}`;
|
|
40
|
+
const throttle = claimThrottle(throttleKey, AUTO_DECISION_WINDOW_MS);
|
|
41
|
+
if (throttle === "throttled") return;
|
|
42
|
+
if (throttle === "unavailable") {
|
|
43
|
+
console.error("[Pushary] Could not access the audit throttle; reporting this denial without deduplication.");
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const response = await reportEvent({
|
|
47
|
+
event: "permission_denied",
|
|
48
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
49
|
+
toolUseId: input.tool_use_id,
|
|
50
|
+
agentType: agent.type,
|
|
51
|
+
agentName: `${agent.label} - ${basename(input.cwd ?? process.cwd())}`,
|
|
52
|
+
action: permissionDeniedAction(input.tool_name),
|
|
53
|
+
sessionId: input.session_id,
|
|
54
|
+
decisionSource: "policy_auto",
|
|
55
|
+
decisionOrigin: decision.origin,
|
|
56
|
+
decisionOutcome: decision.outcome,
|
|
57
|
+
toolName: input.tool_name,
|
|
58
|
+
toolTarget
|
|
59
|
+
}, { maxAttempts: 1, timeoutMs: 800, requireOk: true, skipDrain: true });
|
|
60
|
+
if (response?.ok !== true) throw new Error("Audit delivery was not acknowledged");
|
|
61
|
+
} catch {
|
|
62
|
+
console.error("[Pushary] Could not record the machine denial. The action remains blocked; its audit delivery will be retried on the next matching denial.");
|
|
63
|
+
if (throttle === "passed") {
|
|
64
|
+
try {
|
|
65
|
+
releaseThrottle(throttleKey);
|
|
66
|
+
} catch {
|
|
67
|
+
console.error("[Pushary] Could not reset the failed audit throttle.");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/native-defer.ts
|
|
74
|
+
var nativeDeferOptions = () => {
|
|
75
|
+
const respect = process.env.PUSHARY_RESPECT_PERMISSION_MODE;
|
|
76
|
+
const bypass = process.env.PUSHARY_DEFER_BYPASS;
|
|
77
|
+
return {
|
|
78
|
+
respectPermissionMode: !(respect === "0" || respect === "false"),
|
|
79
|
+
deferBypass: bypass === "1" || bypass === "true"
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
var defersToNativeMode = (permissionMode, toolName) => shouldDeferToNativeMode(permissionMode, toolName, nativeDeferOptions());
|
|
83
|
+
|
|
84
|
+
// src/agent-question-ask.ts
|
|
85
|
+
var STOPPED = { kind: "stopped" };
|
|
86
|
+
var UNAVAILABLE = { kind: "unavailable" };
|
|
87
|
+
var UNANSWERED = { kind: "unanswered" };
|
|
88
|
+
var answeredWith = (answers) => ({ kind: "answered", answers });
|
|
89
|
+
var failedAskOutcome = (error, sessionId) => outcomeOfFailedAsk(error, sessionId, UNAVAILABLE) ?? UNANSWERED;
|
|
90
|
+
var withLabels = (question) => ({
|
|
91
|
+
...question,
|
|
92
|
+
labels: question.options.map((option) => option.label)
|
|
93
|
+
});
|
|
94
|
+
var withoutLabels = ({ labels: _, ...question }) => question;
|
|
95
|
+
var outcomeOfFailedAsk = (error, sessionId, failure) => {
|
|
96
|
+
if (!(error instanceof SubscriptionRequiredError)) return failure;
|
|
97
|
+
announceSubscriptionRequired(error.upgradeUrl, sessionId);
|
|
98
|
+
return void 0;
|
|
99
|
+
};
|
|
100
|
+
var storedWaitDeadline = (result, requestedDeadline) => {
|
|
101
|
+
const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
|
|
102
|
+
return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
|
|
103
|
+
};
|
|
104
|
+
var questionContext = (question, index, total, project) => {
|
|
105
|
+
const subject = question.header ? `${question.header}: your agent is asking in ${project}` : `Your agent is asking in ${project}`;
|
|
106
|
+
return total > 1 ? `${subject} (${index + 1} of ${total})` : subject;
|
|
107
|
+
};
|
|
108
|
+
var legacyAnswerMap = (question, value) => JSON.stringify({ [question.question]: question.multiSelect ? JSON.stringify([value]) : value });
|
|
109
|
+
var askAsOneCard = async (apiKey, call, only, labelled) => {
|
|
110
|
+
let result;
|
|
111
|
+
try {
|
|
112
|
+
result = await askUser(apiKey, {
|
|
113
|
+
question: only.question,
|
|
114
|
+
type: "select",
|
|
115
|
+
options: [...only.labels],
|
|
116
|
+
questions: labelled.map(withoutLabels),
|
|
117
|
+
context: questionContext(only, 0, 1, call.projectName),
|
|
118
|
+
agentName: call.agentName,
|
|
119
|
+
sessionId: call.sessionId,
|
|
120
|
+
machineId: getMachineId(),
|
|
121
|
+
toolName: call.toolName,
|
|
122
|
+
toolUseId: call.toolUseId,
|
|
123
|
+
waitEndsAt: new Date(call.deadline).toISOString()
|
|
124
|
+
});
|
|
125
|
+
} catch (error) {
|
|
126
|
+
return failedAskOutcome(error, call.sessionId);
|
|
127
|
+
}
|
|
128
|
+
if (isDecisionStopped(result)) return STOPPED;
|
|
129
|
+
const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline));
|
|
130
|
+
if (isDecisionStopped(answer)) return STOPPED;
|
|
131
|
+
const values = answer.answered && answer.value ? parseAgentQuestionAnswers(labelled, answer.value) : null;
|
|
132
|
+
if (!values || isDeferAnswer(answer.value)) {
|
|
133
|
+
return UNANSWERED;
|
|
134
|
+
}
|
|
135
|
+
return answeredWith(values);
|
|
136
|
+
};
|
|
137
|
+
var askQuestionByQuestion = async (apiKey, call, labelled) => {
|
|
138
|
+
const answers = {};
|
|
139
|
+
for (const [index, question] of labelled.entries()) {
|
|
140
|
+
let result;
|
|
141
|
+
try {
|
|
142
|
+
result = await askUser(apiKey, {
|
|
143
|
+
question: question.question,
|
|
144
|
+
type: "select",
|
|
145
|
+
options: [...question.labels],
|
|
146
|
+
questions: [withoutLabels(question)],
|
|
147
|
+
context: questionContext(question, index, labelled.length, call.projectName),
|
|
148
|
+
agentName: call.agentName,
|
|
149
|
+
sessionId: call.sessionId,
|
|
150
|
+
machineId: getMachineId(),
|
|
151
|
+
toolName: call.toolName,
|
|
152
|
+
toolUseId: call.toolUseId ? `${call.toolUseId}#q${index}` : void 0,
|
|
153
|
+
waitEndsAt: new Date(call.deadline).toISOString()
|
|
154
|
+
});
|
|
155
|
+
} catch (error) {
|
|
156
|
+
return failedAskOutcome(error, call.sessionId);
|
|
157
|
+
}
|
|
158
|
+
if (isDecisionStopped(result)) return STOPPED;
|
|
159
|
+
const answer = await waitForQuestion(apiKey, result, storedWaitDeadline(result, call.deadline));
|
|
160
|
+
if (isDecisionStopped(answer)) return STOPPED;
|
|
161
|
+
const legacyValue = answer.answered ? answer.value?.trim() : void 0;
|
|
162
|
+
const values = legacyValue ? parseAgentQuestionAnswers([question], legacyValue) ?? parseAgentQuestionAnswers([question], legacyAnswerMap(question, legacyValue)) : null;
|
|
163
|
+
const value = values?.[question.question];
|
|
164
|
+
if (!value || isDeferAnswer(answer.value)) {
|
|
165
|
+
return UNANSWERED;
|
|
166
|
+
}
|
|
167
|
+
answers[question.question] = value;
|
|
168
|
+
}
|
|
169
|
+
return answeredWith(answers);
|
|
170
|
+
};
|
|
171
|
+
var askAgentQuestions = (apiKey, call, questions) => {
|
|
172
|
+
const labelled = questions.map(withLabels);
|
|
173
|
+
const [only, ...rest] = labelled;
|
|
174
|
+
if (!only) return Promise.resolve(UNANSWERED);
|
|
175
|
+
return rest.length === 0 ? askAsOneCard(apiKey, call, only, labelled) : askQuestionByQuestion(apiKey, call, labelled);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
reportMachineDenial,
|
|
180
|
+
defersToNativeMode,
|
|
181
|
+
outcomeOfFailedAsk,
|
|
182
|
+
storedWaitDeadline,
|
|
183
|
+
askAgentQuestions
|
|
184
|
+
};
|
|
@@ -2,23 +2,23 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6SYU5LVK.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_CHOICES
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q52PBCN7.js";
|
|
9
9
|
import {
|
|
10
10
|
BELL_HOOK_BINARY
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SNI4FGOV.js";
|
|
12
12
|
import {
|
|
13
13
|
CODEX_HOOK_EVENTS,
|
|
14
14
|
hasCodexHooks,
|
|
15
15
|
holdBudgetOf
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RFIHLLRH.js";
|
|
17
17
|
import {
|
|
18
18
|
CURSOR_GATE_EVENTS,
|
|
19
19
|
HOOK_LOCATOR_BINARY,
|
|
20
20
|
hookCommandHoldBudget
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-235LKHLW.js";
|
|
22
22
|
|
|
23
23
|
// src/diagnostics/bridge.ts
|
|
24
24
|
import { execFileSync } from "child_process";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLI_PACKAGE_NAMES,
|
|
3
|
+
CODEX_QUESTION_TOOLS,
|
|
3
4
|
HOOK_BUDGETS,
|
|
4
5
|
HOOK_LOCATOR_BINARY,
|
|
5
6
|
OWNERSHIP_PROBE_COMMAND,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
isReleaseVersion,
|
|
14
15
|
ownPackageName,
|
|
15
16
|
withHookHoldBudget
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-235LKHLW.js";
|
|
17
18
|
|
|
18
19
|
// src/setup/paths.ts
|
|
19
20
|
import { homedir as homedir2 } from "os";
|
|
@@ -395,9 +396,9 @@ var installGlobally = (options) => {
|
|
|
395
396
|
}
|
|
396
397
|
const started = (async () => {
|
|
397
398
|
if (!npmIsOnPath()) throw new NpmMissingError();
|
|
398
|
-
const { withUpgradeLock } = await import("./global-upgrade-
|
|
399
|
-
const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-
|
|
400
|
-
const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-
|
|
399
|
+
const { withUpgradeLock } = await import("./global-upgrade-R57HCUTC.js");
|
|
400
|
+
const { installWithUpgradeLock, ownsUpgradeLock } = await import("./upgrade-lock-3I7AF7E3.js");
|
|
401
|
+
const { autoUpdateLock: autoUpdateLock2 } = await import("./paths-G2AYNZCD.js");
|
|
401
402
|
let result = "skipped";
|
|
402
403
|
const install = async () => {
|
|
403
404
|
const platform = process.platform;
|
|
@@ -525,10 +526,12 @@ var codexHooksJsonIn = (home) => join2(home, "hooks.json");
|
|
|
525
526
|
var codexHooksJson = () => codexHooksJsonIn(codexHome());
|
|
526
527
|
var codexAgentsMd = () => join2(codexHome(), "AGENTS.md");
|
|
527
528
|
var codexSkillDir = () => join2(codexHome(), "skills", "pushary");
|
|
529
|
+
var CODEX_TOOL_CALL_MATCHER = "Bash|apply_patch|mcp__.*";
|
|
530
|
+
var CODEX_PRE_TOOL_USE_MATCHER = [CODEX_TOOL_CALL_MATCHER, ...CODEX_QUESTION_TOOLS].join("|");
|
|
528
531
|
var CODEX_HOOK_EVENTS = [
|
|
529
532
|
{ event: "PermissionRequest", delivery: "approval", timeout: HOOK_BUDGETS.codex.budgetSeconds, statusMessage: "Waiting for your phone" },
|
|
530
|
-
{ event: "PreToolUse", matcher:
|
|
531
|
-
{ event: "PostToolUse", matcher:
|
|
533
|
+
{ event: "PreToolUse", matcher: CODEX_PRE_TOOL_USE_MATCHER, delivery: "approval", timeout: HOOK_BUDGETS.codex.budgetSeconds, statusMessage: "Checking Pushary policy" },
|
|
534
|
+
{ event: "PostToolUse", matcher: CODEX_TOOL_CALL_MATCHER, delivery: "telemetry", timeout: 10 },
|
|
532
535
|
{ event: "UserPromptSubmit", delivery: "telemetry", timeout: 10 },
|
|
533
536
|
{ event: "Stop", delivery: "rescue", timeout: HOOK_BUDGETS.codex.budgetSeconds, holds: true },
|
|
534
537
|
// `clear` alongside startup and resume, matching what we already do on Claude
|
|
@@ -14,19 +14,19 @@ import {
|
|
|
14
14
|
} from "./chunk-FO3MDD26.js";
|
|
15
15
|
import {
|
|
16
16
|
callMcpTool
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Z5ORWTY3.js";
|
|
18
18
|
import {
|
|
19
19
|
reportedInstallSource
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GUHM2UQO.js";
|
|
21
21
|
import {
|
|
22
22
|
NPX_LATEST_COMMAND
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WXA3CFZR.js";
|
|
24
24
|
import {
|
|
25
25
|
NO_PAIRING_COMPUTER,
|
|
26
26
|
PAIR_TTL_SECONDS,
|
|
27
27
|
classifyConfirmResponse,
|
|
28
28
|
isAnswerSource
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-235LKHLW.js";
|
|
30
30
|
|
|
31
31
|
// src/reach.ts
|
|
32
32
|
var reachVerdict = (channels) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RFIHLLRH.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe,
|
|
6
6
|
writeFileAtomic
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
serializeDeclinedAgents,
|
|
14
14
|
withDeclinedAgent,
|
|
15
15
|
withoutDeclinedAgent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-235LKHLW.js";
|
|
17
17
|
|
|
18
18
|
// src/declined-agents-file.ts
|
|
19
19
|
import { join } from "path";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RFIHLLRH.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe
|
|
6
6
|
} from "./chunk-AQFEP65J.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-235LKHLW.js";
|
|
10
10
|
|
|
11
11
|
// src/process-ownership.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -6,38 +6,38 @@ import {
|
|
|
6
6
|
} from "./chunk-DWQYCOPI.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureDaemonRunning
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F3J6JFR2.js";
|
|
10
10
|
import {
|
|
11
11
|
buildTranscriptRecords,
|
|
12
12
|
decodePublicKey,
|
|
13
13
|
generateSessionKey,
|
|
14
14
|
wrapSessionKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MAGB6VW6.js";
|
|
16
16
|
import {
|
|
17
17
|
fetchTranscriptRecipients,
|
|
18
18
|
uploadTranscriptRecords
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PYWLW7PC.js";
|
|
20
20
|
import {
|
|
21
21
|
transcriptEnvironmentPreference,
|
|
22
22
|
transcriptsEnabled
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HQR6DYVG.js";
|
|
24
24
|
import {
|
|
25
25
|
hookOwnerOf
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-Q3TCLMYC.js";
|
|
27
27
|
import {
|
|
28
28
|
readTranscriptPreference
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-N5WEEYV6.js";
|
|
30
30
|
import {
|
|
31
31
|
codexHome,
|
|
32
32
|
pusharyDir
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RFIHLLRH.js";
|
|
34
34
|
import {
|
|
35
35
|
writeJsonAtomic
|
|
36
36
|
} from "./chunk-AQFEP65J.js";
|
|
37
37
|
import {
|
|
38
38
|
getApiKey,
|
|
39
39
|
getBaseUrl
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-AZXPJLKC.js";
|
|
41
41
|
|
|
42
42
|
// src/transcript-registration.ts
|
|
43
43
|
import { createHash } from "crypto";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-N5WEEYV6.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WXA3CFZR.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
IDLE_PROMPT_NOTIFICATION,
|
|
3
3
|
NOTIFICATION_PUSH_TYPES,
|
|
4
4
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QUKATQ66.js";
|
|
6
6
|
import {
|
|
7
7
|
cancelQuestion,
|
|
8
8
|
clientErrorKindOf,
|
|
@@ -10,28 +10,29 @@ import {
|
|
|
10
10
|
reportClientError,
|
|
11
11
|
sendNotification,
|
|
12
12
|
waitForAnswer
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HA22GGDG.js";
|
|
14
14
|
import {
|
|
15
15
|
withRetry
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Z5ORWTY3.js";
|
|
17
17
|
import {
|
|
18
18
|
getMachineId
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VA36Q6BD.js";
|
|
20
20
|
import {
|
|
21
21
|
reportedInstallSource
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-GUHM2UQO.js";
|
|
23
23
|
import {
|
|
24
24
|
canonicalJson
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RFIHLLRH.js";
|
|
26
26
|
import {
|
|
27
27
|
writeFileAtomic
|
|
28
28
|
} from "./chunk-AQFEP65J.js";
|
|
29
29
|
import {
|
|
30
30
|
getApiKey,
|
|
31
31
|
getBaseUrl
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-AZXPJLKC.js";
|
|
33
33
|
import {
|
|
34
34
|
ACTION_BODY_MAX,
|
|
35
|
+
AGENTS,
|
|
35
36
|
AGENT_LABELS_BY_TYPE,
|
|
36
37
|
BLANK_TASK_INPUT_TOOL,
|
|
37
38
|
BLOCKED_ACTION_GRANT_TTL_SECONDS,
|
|
@@ -63,7 +64,7 @@ import {
|
|
|
63
64
|
toToolLookup,
|
|
64
65
|
truncateLine,
|
|
65
66
|
unansweredRefusalReason
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-235LKHLW.js";
|
|
67
68
|
|
|
68
69
|
// ../hook-mapping/src/describe.ts
|
|
69
70
|
import { isAbsolute, relative, resolve } from "path";
|
|
@@ -72,8 +73,8 @@ var hookPrefixes = {
|
|
|
72
73
|
PowerShell: (input) => `powershell: ${input.command ?? "(no command)"}`,
|
|
73
74
|
Monitor: (input) => `monitor: ${input.command ?? "(no command)"}`,
|
|
74
75
|
Write: (input) => `write file: ${input.file_path ?? "(unknown path)"}`,
|
|
75
|
-
Edit: (input) => `edit file: ${input
|
|
76
|
-
MultiEdit: (input) => `edit file: ${input
|
|
76
|
+
Edit: (input) => `edit file: ${editTarget(input) ?? "(unknown path)"}`,
|
|
77
|
+
MultiEdit: (input) => `edit file: ${editTarget(input) ?? "(unknown path)"}`,
|
|
77
78
|
Read: (input) => `read file: ${input.file_path ?? "(unknown path)"}`,
|
|
78
79
|
// Without an entry here the fallback stringifies the whole tool input, and for
|
|
79
80
|
// ExitPlanMode that input IS the plan: the action line became a truncated dump of
|
|
@@ -104,13 +105,18 @@ var describeTodoProgress = (todos) => {
|
|
|
104
105
|
if (label) return `${label.trim()} (${done}/${total} done)`;
|
|
105
106
|
return `${done}/${total} tasks done`;
|
|
106
107
|
};
|
|
108
|
+
var editTarget = (input) => {
|
|
109
|
+
if (typeof input.file_path === "string") return input.file_path;
|
|
110
|
+
if (!Array.isArray(input.file_paths) || !input.file_paths.every((path) => typeof path === "string")) return void 0;
|
|
111
|
+
return input.file_paths.join(", ");
|
|
112
|
+
};
|
|
107
113
|
var eventPrefixes = {
|
|
108
114
|
Bash: (input) => `ran: ${String(input.command ?? "")}`,
|
|
109
115
|
PowerShell: (input) => `ran: ${String(input.command ?? "")}`,
|
|
110
116
|
Monitor: (input) => `ran: ${String(input.command ?? "")}`,
|
|
111
117
|
Write: (input) => `wrote: ${input.file_path ?? "unknown"}`,
|
|
112
|
-
Edit: (input) => `edited: ${input
|
|
113
|
-
MultiEdit: (input) => `edited: ${input
|
|
118
|
+
Edit: (input) => `edited: ${editTarget(input) ?? "unknown"}`,
|
|
119
|
+
MultiEdit: (input) => `edited: ${editTarget(input) ?? "unknown"}`,
|
|
114
120
|
Read: (input) => `read: ${input.file_path ?? "unknown"}`,
|
|
115
121
|
TodoWrite: (input) => describeTodoProgress(input.todos),
|
|
116
122
|
Task: (input) => `ran subagent: ${describeTaskCall(input)}`,
|
|
@@ -233,11 +239,25 @@ var OPENCODE_TOOL_NAMES = {
|
|
|
233
239
|
var PATCH_ARG_KEYS = ["command", "patch", "input"];
|
|
234
240
|
var patchedFilesIn = (input) => [...new Set(PATCH_ARG_KEYS.flatMap((key) => parseApplyPatchFiles(input[key])))];
|
|
235
241
|
var lookupsForInput = (profile, toolName, input, absolute) => {
|
|
236
|
-
const
|
|
242
|
+
const gateInput = profile.source === "grok" && toolName === "apply_patch" ? { patch: input.patch, diff: input.patch } : input;
|
|
243
|
+
const lookup = toToolLookup(profile, toolName, gateInput, absolute);
|
|
237
244
|
if (!lookup.unreadable) return [lookup];
|
|
238
|
-
const files = patchedFilesIn(
|
|
245
|
+
const files = patchedFilesIn(gateInput);
|
|
239
246
|
if (files.length === 0) return [lookup];
|
|
240
|
-
return files.slice(0, GATE_MAX_TOOL_INPUTS + 1).map((file) => toToolLookup(profile, toolName, { ...
|
|
247
|
+
return files.slice(0, GATE_MAX_TOOL_INPUTS + 1).map((file) => toToolLookup(profile, toolName, { ...gateInput, file_path: absolute(file) }, absolute));
|
|
248
|
+
};
|
|
249
|
+
var compatibleToolLookup = (profile, toolName, input, cwd) => {
|
|
250
|
+
const absolute = (path) => cwd && !isAbsolute(path) ? resolve(cwd, path) : path;
|
|
251
|
+
const lookups = lookupsForInput(profile, toolName, input, absolute);
|
|
252
|
+
const first = lookups[0];
|
|
253
|
+
if (!first) return { tool: canonicalToolName(profile, toolName), input, unreadable: true };
|
|
254
|
+
if (lookups.length === 1) return first;
|
|
255
|
+
const { file_path, ...content } = first.input;
|
|
256
|
+
return {
|
|
257
|
+
tool: first.tool,
|
|
258
|
+
input: { ...content, file_paths: lookups.map((lookup) => lookup.input.file_path) },
|
|
259
|
+
unreadable: lookups.length > GATE_MAX_TOOL_INPUTS || lookups.some((lookup) => lookup.unreadable)
|
|
260
|
+
};
|
|
241
261
|
};
|
|
242
262
|
var compatibleGateInputs = (profile, toolName, toolInputs, cwd) => {
|
|
243
263
|
const absolute = (path) => cwd && !isAbsolute(path) ? resolve(cwd, path) : path;
|
|
@@ -377,6 +397,10 @@ var deriveReceiptMeta = (toolName, toolInput, toolResult, cwd) => {
|
|
|
377
397
|
...toolInput,
|
|
378
398
|
file_path: toolInput.file_path ?? toolInput.absolute_path ?? toolInput.path
|
|
379
399
|
};
|
|
400
|
+
if (canonicalTool === "Edit" && Array.isArray(canonicalInput.file_paths)) {
|
|
401
|
+
const patch = firstString(canonicalInput.diff, canonicalInput.command, canonicalInput.patch, canonicalInput.input);
|
|
402
|
+
if (patch) return { kind: "edit", target: redactSecrets(patch).slice(0, RECEIPT_TARGET_MAX_LENGTH), ok };
|
|
403
|
+
}
|
|
380
404
|
if (FILE_TARGET_TOOLS.has(canonicalTool)) {
|
|
381
405
|
const filePath = canonicalInput.file_path;
|
|
382
406
|
if (typeof filePath !== "string" || !filePath) return void 0;
|
|
@@ -462,7 +486,8 @@ var AGENT_IDENTITIES = {
|
|
|
462
486
|
qoder: { type: "qoder", label: AGENT_LABELS_BY_TYPE.qoder },
|
|
463
487
|
droid: { type: "droid", label: AGENT_LABELS_BY_TYPE.droid },
|
|
464
488
|
devin: { type: "devin", label: AGENT_LABELS_BY_TYPE.devin },
|
|
465
|
-
antigravity: { type: "antigravity_cli", label: AGENT_LABELS_BY_TYPE.antigravity_cli }
|
|
489
|
+
antigravity: { type: "antigravity_cli", label: AGENT_LABELS_BY_TYPE.antigravity_cli },
|
|
490
|
+
grok: { type: "grok", label: AGENTS.grok.label }
|
|
466
491
|
};
|
|
467
492
|
var TEAMMATE_IDLE_ACTION = "A teammate went idle";
|
|
468
493
|
var CLAUDE_MEANINGS = {
|
|
@@ -495,6 +520,7 @@ var MEANING_BY_HOOK = {
|
|
|
495
520
|
droid: compatibleMeanings("droid"),
|
|
496
521
|
devin: compatibleMeanings("devin"),
|
|
497
522
|
antigravity: compatibleMeanings("antigravity_cli"),
|
|
523
|
+
grok: { ...compatibleMeanings("grok"), PostToolUseFailure: { kind: "tool", event: "tool_complete" }, StopCancelled: { kind: "stop_failure", event: "turn_error" } },
|
|
498
524
|
codex: {
|
|
499
525
|
PostToolUse: { kind: "tool", event: "tool_complete" },
|
|
500
526
|
UserPromptSubmit: { kind: "prompt", event: "user_prompt" },
|
|
@@ -2254,9 +2280,9 @@ export {
|
|
|
2254
2280
|
UNNAMED_ACTION,
|
|
2255
2281
|
describeToolCall,
|
|
2256
2282
|
deriveToolTarget,
|
|
2257
|
-
parseApplyPatchFiles,
|
|
2258
2283
|
patchDeletesFiles,
|
|
2259
2284
|
OPENCODE_TOOL_NAMES,
|
|
2285
|
+
compatibleToolLookup,
|
|
2260
2286
|
canonicalGateInputs,
|
|
2261
2287
|
scopePathFor,
|
|
2262
2288
|
deriveActionBody,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
resolvePackageVersionFromBinary,
|
|
11
11
|
resolvePathBinary,
|
|
12
12
|
resolvePathBinaryAsync
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RFIHLLRH.js";
|
|
14
14
|
import {
|
|
15
15
|
MANAGED_PROVIDERS
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-235LKHLW.js";
|
|
17
17
|
|
|
18
18
|
// src/setup/codex-install.ts
|
|
19
19
|
var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
keyCheckFromResponse
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DYALNCS6.js";
|
|
4
4
|
import {
|
|
5
5
|
installNetworkDefaults
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NWSWP3KY.js";
|
|
7
7
|
import {
|
|
8
8
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AZXPJLKC.js";
|
|
10
10
|
|
|
11
11
|
// src/retry.ts
|
|
12
12
|
var isRetryable = (err) => {
|