@pushary/agent-hooks 1.9.60 → 1.9.62
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 +11 -0
- package/README.md +6 -0
- package/dist/{api-ASQA5PZM.js → api-7HLZRIUV.js} +15 -12
- package/dist/bin/pushary-bell-hook.js +28 -27
- package/dist/bin/pushary-bell.js +11 -10
- package/dist/bin/pushary-claude.js +34 -26
- package/dist/bin/pushary-clean.js +36 -34
- package/dist/bin/pushary-codex-bridge.js +22 -21
- package/dist/bin/pushary-codex-hook.js +49 -35
- package/dist/bin/pushary-codex-session.js +9 -8
- package/dist/bin/pushary-codex.js +15 -14
- package/dist/bin/pushary-connect.js +28 -27
- package/dist/bin/pushary-cowork.js +6 -5
- package/dist/bin/pushary-daemon.js +38 -37
- package/dist/bin/pushary-disconnect.js +27 -26
- package/dist/bin/pushary-doctor.js +41 -40
- package/dist/bin/pushary-elicitation-hook.js +30 -27
- package/dist/bin/pushary-gemini-bridge.js +16 -15
- package/dist/bin/pushary-gemini-hook.js +38 -29
- package/dist/bin/pushary-hook.js +33 -31
- package/dist/bin/pushary-login.js +15 -14
- package/dist/bin/pushary-logout.js +28 -27
- package/dist/bin/pushary-mcp.js +12 -11
- package/dist/bin/pushary-mode.js +15 -14
- package/dist/bin/pushary-notification-hook.js +27 -26
- package/dist/bin/pushary-opencode-hook.js +40 -30
- package/dist/bin/pushary-permission-denied-hook.js +32 -31
- package/dist/bin/pushary-permission-hook.js +31 -30
- package/dist/bin/pushary-post-hook.js +27 -26
- package/dist/bin/pushary-prompt-hook.js +27 -26
- package/dist/bin/pushary-session-end-hook.js +27 -26
- package/dist/bin/pushary-session-start-hook.js +34 -33
- package/dist/bin/pushary-setup.js +4195 -93
- package/dist/bin/pushary-stats.js +6 -5
- package/dist/bin/pushary-status.js +32 -31
- package/dist/bin/pushary-stop-hook.js +27 -26
- package/dist/bin/pushary-stopfailure-hook.js +27 -26
- package/dist/bin/pushary-suggestions.js +15 -14
- package/dist/bin/pushary-transcript-register.js +19 -18
- package/dist/bin/pushary-transcripts.js +8 -7
- package/dist/bin/pushary-upgrade.js +43 -37
- package/dist/bin/pushary-wait.js +15 -14
- package/dist/bin/pushary.js +8 -7
- package/dist/{chunk-RPPXQNIA.js → chunk-3IFCXMC6.js} +1 -1
- package/dist/{chunk-WXPVVXBU.js → chunk-3LBB7GVF.js} +4 -4
- package/dist/{chunk-WFSGCFXQ.js → chunk-3YGUWPNZ.js} +2 -6
- package/dist/{chunk-SVQWHV65.js → chunk-44FNEAXK.js} +1 -1
- package/dist/{chunk-YPD3MTFU.js → chunk-4K6YZPZ3.js} +1 -1
- package/dist/{chunk-PUHP4IBA.js → chunk-557ZE5EX.js} +4 -4
- package/dist/{chunk-HC3FHDKB.js → chunk-5R23J52J.js} +6 -6
- package/dist/{chunk-625DZLT5.js → chunk-67Q3Q5IO.js} +8 -6
- package/dist/{chunk-QGSHV3WO.js → chunk-6HIYOY6I.js} +77 -18
- package/dist/{chunk-L3AFVFGQ.js → chunk-6JAWNRDR.js} +2 -2
- package/dist/{chunk-6MJWYYAS.js → chunk-6YSEOXP5.js} +47 -3
- package/dist/{chunk-VIJIG5YL.js → chunk-7E2ZN7XA.js} +2 -2
- package/dist/{chunk-QLMOU57V.js → chunk-7EHZXZB2.js} +33 -20
- package/dist/{chunk-2AELPDMT.js → chunk-7ETELRQX.js} +1 -1
- package/dist/{chunk-7BHI3PZN.js → chunk-7GU4PXE5.js} +1 -1
- package/dist/{chunk-CDQHQAS7.js → chunk-7NJ4TDUH.js} +5 -5
- package/dist/{chunk-X3YKQJCZ.js → chunk-7NXB7OVX.js} +1 -1
- package/dist/{chunk-XEJOPVCG.js → chunk-A4CZPUQ6.js} +1 -1
- package/dist/{chunk-YGE6ML3O.js → chunk-AFV3FQNG.js} +4 -4
- package/dist/{chunk-V57XLKZL.js → chunk-BIUSODLS.js} +2 -2
- package/dist/{chunk-2QREHU4O.js → chunk-CFIQ3252.js} +3 -3
- package/dist/{chunk-BG4Y64FW.js → chunk-DFKEJARZ.js} +1 -1
- package/dist/{chunk-S54C6TQC.js → chunk-EA6574W2.js} +5 -5
- package/dist/{chunk-FDWMG6NY.js → chunk-EO6CL4PD.js} +2 -2
- package/dist/{chunk-SEILUNWB.js → chunk-ESXGCZDA.js} +26 -3
- package/dist/{chunk-CEQ2AZH4.js → chunk-EUNSJKJJ.js} +8 -8
- package/dist/{chunk-56JCQQLS.js → chunk-EVZDYG7L.js} +2 -2
- package/dist/{chunk-4MUFZU2G.js → chunk-F35YILEN.js} +1 -1
- package/dist/{chunk-ERK24P76.js → chunk-FG5HMJ7C.js} +1 -1
- package/dist/{chunk-NKLNU577.js → chunk-FX7KDF47.js} +3 -3
- package/dist/{chunk-AXJLJJ3M.js → chunk-FXECTHAG.js} +73 -2
- package/dist/chunk-FYS27SUS.js +216 -0
- package/dist/{chunk-O6IUZGWV.js → chunk-G3ZDCYMU.js} +1 -1
- package/dist/{chunk-ELLJPP6O.js → chunk-GFAG72LR.js} +2 -2
- package/dist/{chunk-ATKN4BJT.js → chunk-GV43RXR2.js} +1 -1
- package/dist/{chunk-4MWRR5IT.js → chunk-HSRNWCXJ.js} +3 -3
- package/dist/{chunk-IF26ZGZ7.js → chunk-LCNN7UOE.js} +3 -3
- package/dist/{chunk-WXZHQ3TT.js → chunk-LILS32LF.js} +5 -5
- package/dist/{chunk-33OOEVPG.js → chunk-LL2KHEJH.js} +1 -1
- package/dist/{chunk-W2IVTHIG.js → chunk-LWR5VKNC.js} +18 -10
- package/dist/{chunk-QUBIEZXC.js → chunk-M7MEVILL.js} +3 -3
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-XV6S5PWW.js → chunk-MURJ4WAL.js} +1 -1
- package/dist/{chunk-FUZ5VYWD.js → chunk-MYEALNW6.js} +1 -1
- package/dist/{chunk-ADR3KHOC.js → chunk-NAZRRXZM.js} +2 -2
- package/dist/{chunk-ZGOJLNKS.js → chunk-NZLQ6GMX.js} +4 -4
- package/dist/{chunk-K4MBKXAE.js → chunk-OZRT64BB.js} +1 -1
- package/dist/{chunk-Y5VKZNFN.js → chunk-PSCXEH42.js} +2 -2
- package/dist/{chunk-METMK3L4.js → chunk-Q4WTIKM6.js} +3 -3
- package/dist/{chunk-U7NR4JVD.js → chunk-QIPW7OVB.js} +4 -4
- package/dist/{chunk-USE5IEEW.js → chunk-R3CLBNST.js} +1 -1
- package/dist/{chunk-7WFRY6OL.js → chunk-RFCEVROB.js} +2 -2
- package/dist/{chunk-EZHY65QA.js → chunk-RSNN2TPE.js} +13 -8
- package/dist/{chunk-DJ7EZIQA.js → chunk-RU37NSZH.js} +3 -3
- package/dist/{chunk-J4KQL7YZ.js → chunk-SDOWT67G.js} +5 -5
- package/dist/{chunk-4PZXI7WU.js → chunk-SJCPIYWJ.js} +2 -2
- package/dist/{chunk-MUNL23WE.js → chunk-SJJYXMJP.js} +6 -6
- package/dist/{chunk-6LOQE4J4.js → chunk-TMHE5CVX.js} +3 -3
- package/dist/{chunk-GAMVAORR.js → chunk-UUAVYIWJ.js} +1 -1
- package/dist/{chunk-Y5V4PA2Z.js → chunk-UWCPY4RY.js} +2 -2
- package/dist/{chunk-5RU35K57.js → chunk-VF3IL56Q.js} +2 -2
- package/dist/{chunk-WN3RACVD.js → chunk-W3CBFLIX.js} +3 -3
- package/dist/{chunk-RLVJ6TVL.js → chunk-W6MYFAOK.js} +26 -18
- package/dist/{chunk-CSOROFJY.js → chunk-YQK72JGV.js} +5 -5
- package/dist/{chunk-7JXJJNQ5.js → chunk-ZEDGKCCM.js} +1 -1
- package/dist/{chunk-SOCJ2N3E.js → chunk-ZJFJUAHS.js} +6 -6
- package/dist/{codex-app-cards-switch-ZO76D2NY.js → codex-app-cards-switch-IIL7IPP6.js} +12 -11
- package/dist/{codex-desktop-launch-MJT5E3O3.js → codex-desktop-launch-XCLMYVBD.js} +2 -1
- package/dist/{codex-session-launch-PTFCVIC7.js → codex-session-launch-UMVALJ3A.js} +19 -18
- package/dist/{config-SXV6XNVU.js → config-5N3GUJD5.js} +4 -3
- package/dist/{global-upgrade-ETDP32LO.js → global-upgrade-5F4CSXED.js} +10 -9
- package/dist/{identity-OOLIOSMR.js → identity-7ULYW4RL.js} +5 -4
- package/dist/{live-capabilities-2XIFA7YO.js → live-capabilities-QTSFXA6T.js} +5 -4
- package/dist/{paths-IIOQZESZ.js → paths-HEMK2ALW.js} +4 -3
- package/dist/{reapply-KFAJSKOQ.js → reapply-AMFKVYZV.js} +27 -26
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +22 -21
- package/dist/{upgrade-lock-T6ILR644.js → upgrade-lock-IAZC5644.js} +5 -4
- package/dist/usage-NEFDYSRT.js +11 -0
- package/package.json +1 -1
- package/dist/chunk-6MC2XXFD.js +0 -126
- package/dist/usage-6TN7FVWS.js +0 -10
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerTranscript
|
|
3
|
+
} from "./chunk-EUNSJKJJ.js";
|
|
4
|
+
import {
|
|
5
|
+
namedEvent
|
|
6
|
+
} from "./chunk-557ZE5EX.js";
|
|
7
|
+
import {
|
|
8
|
+
isBridgeLocator,
|
|
9
|
+
liveBridgeProbe,
|
|
10
|
+
pusharyHookExecutable,
|
|
11
|
+
resolveBridgeStub
|
|
12
|
+
} from "./chunk-7NJ4TDUH.js";
|
|
13
|
+
import {
|
|
14
|
+
atLeast,
|
|
15
|
+
parseVersion
|
|
16
|
+
} from "./chunk-6ICPEJY5.js";
|
|
17
|
+
import {
|
|
18
|
+
writeDegraded
|
|
19
|
+
} from "./chunk-RSNN2TPE.js";
|
|
20
|
+
import {
|
|
21
|
+
cursorUserHooks
|
|
22
|
+
} from "./chunk-6YSEOXP5.js";
|
|
23
|
+
import {
|
|
24
|
+
CURSOR_GATE_COVERAGE,
|
|
25
|
+
CURSOR_GATE_SCRIPT,
|
|
26
|
+
HOOK_VERSION_PATTERN,
|
|
27
|
+
NO_CURSOR_GATE,
|
|
28
|
+
claudeShapedHookInput,
|
|
29
|
+
cursorGateOwnsToolCall,
|
|
30
|
+
hookCompatibleProfileBySource,
|
|
31
|
+
isCursorHookPayload,
|
|
32
|
+
isGrokHookPayload,
|
|
33
|
+
isGrokSessionEndStop,
|
|
34
|
+
isRecord,
|
|
35
|
+
toolsCoveredByGateEntry
|
|
36
|
+
} from "./chunk-FXECTHAG.js";
|
|
37
|
+
|
|
38
|
+
// src/tool-hook-input.ts
|
|
39
|
+
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode", "cursor_version"];
|
|
40
|
+
function isInputRecord(value) {
|
|
41
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
42
|
+
}
|
|
43
|
+
function isToolHookInput(value) {
|
|
44
|
+
if (!isInputRecord(value)) return false;
|
|
45
|
+
if (typeof value.tool_name !== "string" || value.tool_name.length === 0) return false;
|
|
46
|
+
if (!isInputRecord(value.tool_input)) return false;
|
|
47
|
+
for (const field of OPTIONAL_TEXT_FIELDS) {
|
|
48
|
+
if (value[field] !== void 0 && typeof value[field] !== "string") return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function parseToolHookInput(value) {
|
|
53
|
+
if (!isInputRecord(value)) return null;
|
|
54
|
+
const input = { ...value, tool_input: value.tool_input === void 0 ? {} : value.tool_input };
|
|
55
|
+
return isToolHookInput(input) ? input : null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/admission.ts
|
|
59
|
+
import { readFileSync } from "fs";
|
|
60
|
+
import { homedir } from "os";
|
|
61
|
+
import { join as join2 } from "path";
|
|
62
|
+
|
|
63
|
+
// src/cursor-gate-registration.ts
|
|
64
|
+
import { dirname, isAbsolute, join, resolve } from "path";
|
|
65
|
+
var FIRST_PLUGIN_VERSION_HANDLING = {
|
|
66
|
+
beforeShellExecution: [0, 1, 0],
|
|
67
|
+
beforeMCPExecution: [0, 2, 1],
|
|
68
|
+
preToolUse: [0, 2, 2]
|
|
69
|
+
};
|
|
70
|
+
var COMMAND_HOOK_TYPE = "command";
|
|
71
|
+
var PLUGIN_MANIFEST = join(".cursor-plugin", "plugin.json");
|
|
72
|
+
var NO_SPOTLIGHT = () => [];
|
|
73
|
+
var executableName = (executable) => executable.split(/[/\\]/).pop() ?? "";
|
|
74
|
+
var isCursorGateScript = (executable) => executableName(executable) === CURSOR_GATE_SCRIPT;
|
|
75
|
+
var fromHooksDirectory = (path, environment) => isAbsolute(path) ? path : resolve(dirname(environment.hooksFile), path);
|
|
76
|
+
var pluginManifestBeside = (script) => join(dirname(dirname(script)), PLUGIN_MANIFEST);
|
|
77
|
+
var versionIn = (manifest) => {
|
|
78
|
+
try {
|
|
79
|
+
const parsed = JSON.parse(manifest);
|
|
80
|
+
return isRecord(parsed) && typeof parsed.version === "string" && HOOK_VERSION_PATTERN.test(parsed.version) ? parseVersion(parsed.version) : null;
|
|
81
|
+
} catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var pluginVersionOf = (script, probe) => {
|
|
86
|
+
const manifest = probe.readFile(pluginManifestBeside(script));
|
|
87
|
+
return manifest === null ? null : versionIn(manifest);
|
|
88
|
+
};
|
|
89
|
+
var gateScriptHandles = (script, event, probe) => {
|
|
90
|
+
if (!probe.exists(script)) return false;
|
|
91
|
+
const version = pluginVersionOf(script, probe);
|
|
92
|
+
return version !== null && atLeast(version, FIRST_PLUGIN_VERSION_HANDLING[event]);
|
|
93
|
+
};
|
|
94
|
+
var appBundleResolves = (locator, probe) => resolveBridgeStub(locator, { ...probe, mdfind: NO_SPOTLIGHT }).kind === "bundle";
|
|
95
|
+
var isLiveCursorGateCommand = (command, event, environment) => {
|
|
96
|
+
const executable = pusharyHookExecutable(command);
|
|
97
|
+
if (executable === null) return false;
|
|
98
|
+
const target = fromHooksDirectory(executable, environment);
|
|
99
|
+
if (isCursorGateScript(executable)) return gateScriptHandles(target, event, environment.probe);
|
|
100
|
+
return isBridgeLocator(executable) && appBundleResolves(target, environment.probe);
|
|
101
|
+
};
|
|
102
|
+
var isCommandHook = (entry) => entry.type === void 0 || entry.type === COMMAND_HOOK_TYPE;
|
|
103
|
+
var entriesOn = (hooks, event) => {
|
|
104
|
+
const entries = Object.hasOwn(hooks, event) ? hooks[event] : void 0;
|
|
105
|
+
return Array.isArray(entries) ? entries.filter(isRecord) : [];
|
|
106
|
+
};
|
|
107
|
+
var runsALiveGate = (entry, event, isLiveGate) => isCommandHook(entry) && typeof entry.command === "string" && isLiveGate(entry.command, event);
|
|
108
|
+
var toolsCoveredOn = (hooks, coverage, isLiveGate) => entriesOn(hooks, coverage.event).filter((entry) => runsALiveGate(entry, coverage.event, isLiveGate)).flatMap((entry) => toolsCoveredByGateEntry(coverage, entry.matcher) ?? []);
|
|
109
|
+
var cursorGateRegistrationOf = (document, isLiveGate) => {
|
|
110
|
+
if (!isRecord(document) || !isRecord(document.hooks)) return NO_CURSOR_GATE;
|
|
111
|
+
const hooks = document.hooks;
|
|
112
|
+
return CURSOR_GATE_COVERAGE.flatMap((coverage) => toolsCoveredOn(hooks, coverage, isLiveGate));
|
|
113
|
+
};
|
|
114
|
+
var userCursorGateEnvironment = () => ({ hooksFile: cursorUserHooks(), probe: liveBridgeProbe() });
|
|
115
|
+
var readCursorGateRegistration = (environment = userCursorGateEnvironment()) => {
|
|
116
|
+
try {
|
|
117
|
+
const raw = environment.probe.readFile(environment.hooksFile);
|
|
118
|
+
if (raw === null) return NO_CURSOR_GATE;
|
|
119
|
+
return cursorGateRegistrationOf(JSON.parse(raw), (command, event) => isLiveCursorGateCommand(command, event, environment));
|
|
120
|
+
} catch {
|
|
121
|
+
return NO_CURSOR_GATE;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var cursorGateOwnsClaudeCall = (payload, readRegistration) => isCursorHookPayload(payload) && cursorGateOwnsToolCall(readRegistration(), payload.tool_name);
|
|
125
|
+
|
|
126
|
+
// src/admission.ts
|
|
127
|
+
var NO_RULES = { version: 1, disabled: [] };
|
|
128
|
+
var SUPPORTED_VERSION = 1;
|
|
129
|
+
var parseAdmissionRules = (raw) => {
|
|
130
|
+
if (!raw) return NO_RULES;
|
|
131
|
+
try {
|
|
132
|
+
const parsed = JSON.parse(raw);
|
|
133
|
+
if (parsed.version !== SUPPORTED_VERSION) return NO_RULES;
|
|
134
|
+
if (!Array.isArray(parsed.disabled)) return NO_RULES;
|
|
135
|
+
return {
|
|
136
|
+
version: SUPPORTED_VERSION,
|
|
137
|
+
disabled: parsed.disabled.filter((rule) => typeof rule === "string")
|
|
138
|
+
};
|
|
139
|
+
} catch {
|
|
140
|
+
return NO_RULES;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var admissionRulesFile = () => process.env.PUSHARY_ADMISSION_FILE?.trim() || join2(homedir(), ".pushary", "admission-rules.json");
|
|
144
|
+
var readAdmissionRules = () => {
|
|
145
|
+
try {
|
|
146
|
+
return parseAdmissionRules(readFileSync(admissionRulesFile(), "utf-8"));
|
|
147
|
+
} catch {
|
|
148
|
+
return NO_RULES;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var matches = (rule, source, event) => {
|
|
152
|
+
const colon = rule.indexOf(":");
|
|
153
|
+
if (colon <= 0 || colon === rule.length - 1) return false;
|
|
154
|
+
const ruleSource = rule.slice(0, colon);
|
|
155
|
+
const ruleEvent = rule.slice(colon + 1);
|
|
156
|
+
return (ruleSource === "*" || ruleSource === source) && (ruleEvent === "*" || ruleEvent === event);
|
|
157
|
+
};
|
|
158
|
+
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
159
|
+
var UNREADABLE = { kind: "unreadable" };
|
|
160
|
+
var UNKNOWN_AGENT = { kind: "unknown_agent" };
|
|
161
|
+
var GATED_BY_CURSOR = { kind: "gated_by_cursor" };
|
|
162
|
+
var readHookInputOutcome = async (source, fallbackEvent = "", stdin = process.stdin, parseInput, { cursorGateOwnsCall } = {}) => {
|
|
163
|
+
if (source === null) {
|
|
164
|
+
writeDegraded("hook", {
|
|
165
|
+
reason: "unknown_agent",
|
|
166
|
+
fallback: "stood aside, so nothing is gated or reported for this call",
|
|
167
|
+
event: fallbackEvent
|
|
168
|
+
});
|
|
169
|
+
return UNKNOWN_AGENT;
|
|
170
|
+
}
|
|
171
|
+
let raw = "";
|
|
172
|
+
for await (const chunk of stdin) raw += chunk;
|
|
173
|
+
if (!raw.trim()) return UNREADABLE;
|
|
174
|
+
let parsed;
|
|
175
|
+
try {
|
|
176
|
+
parsed = JSON.parse(raw);
|
|
177
|
+
} catch {
|
|
178
|
+
return UNREADABLE;
|
|
179
|
+
}
|
|
180
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return UNREADABLE;
|
|
181
|
+
if (source !== "grok" && process.env.GROK_SESSION_ID && isGrokHookPayload(parsed)) return UNREADABLE;
|
|
182
|
+
if (cursorGateOwnsCall?.(parsed)) return GATED_BY_CURSOR;
|
|
183
|
+
const shaped = inClaudeShape(source, namedEvent(process.argv) ?? fallbackEvent, parsed);
|
|
184
|
+
if (source === "grok" && isGrokSessionEndStop(shaped.hook_event_name, shaped.reason)) return UNREADABLE;
|
|
185
|
+
const input = parseInput ? parseInput(shaped) : shaped;
|
|
186
|
+
if (input === null) return UNREADABLE;
|
|
187
|
+
const event = eventNameOf(input) ?? fallbackEvent;
|
|
188
|
+
if (!isAdmitted(readAdmissionRules(), source, event)) return { kind: "not_admitted", input };
|
|
189
|
+
if (stdin === process.stdin) registerTranscript(source, input);
|
|
190
|
+
return { kind: "admitted", input };
|
|
191
|
+
};
|
|
192
|
+
var admittedInput = (read) => read.kind === "admitted" ? read.input : null;
|
|
193
|
+
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => admittedInput(await readHookInputOutcome(source, fallbackEvent, stdin, parseInput));
|
|
194
|
+
var inClaudeShape = (source, event, parsed) => {
|
|
195
|
+
const profile = hookCompatibleProfileBySource(source);
|
|
196
|
+
return profile ? claudeShapedHookInput(profile.payload, event, parsed) : parsed;
|
|
197
|
+
};
|
|
198
|
+
var eventNameOf = (input) => {
|
|
199
|
+
if (!("hook_event_name" in input)) return void 0;
|
|
200
|
+
const name = input.hook_event_name;
|
|
201
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
202
|
+
};
|
|
203
|
+
function readToolHookInput(source, event, stdin = process.stdin) {
|
|
204
|
+
return readHookInput(source, event, stdin, parseToolHookInput);
|
|
205
|
+
}
|
|
206
|
+
var isClaudePreToolUse = (source, event) => source === "claude" && event === "PreToolUse";
|
|
207
|
+
var screenFor = (source, event, readCursorGate) => isClaudePreToolUse(source, event) ? { cursorGateOwnsCall: (payload) => cursorGateOwnsClaudeCall(payload, readCursorGate) } : {};
|
|
208
|
+
function readToolHookCall(source, event, stdin = process.stdin, { readCursorGate = readCursorGateRegistration } = {}) {
|
|
209
|
+
return readHookInputOutcome(source, event, stdin, parseToolHookInput, screenFor(source, event, readCursorGate));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export {
|
|
213
|
+
readHookInput,
|
|
214
|
+
readToolHookInput,
|
|
215
|
+
readToolHookCall
|
|
216
|
+
};
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
decodePublicKey,
|
|
4
4
|
generateSessionKey,
|
|
5
5
|
wrapSessionKey
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7ETELRQX.js";
|
|
7
7
|
import {
|
|
8
8
|
fetchTranscriptRecipients,
|
|
9
9
|
uploadTranscriptRecords
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UUAVYIWJ.js";
|
|
11
11
|
|
|
12
12
|
// src/live-session.ts
|
|
13
13
|
var MAX_TRANSCRIPT_QUEUE = 100;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readExistingMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G3ZDCYMU.js";
|
|
4
4
|
import {
|
|
5
5
|
NetworkError
|
|
6
6
|
} from "./chunk-PPY5N2E6.js";
|
|
7
7
|
import {
|
|
8
8
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DFKEJARZ.js";
|
|
10
10
|
import {
|
|
11
11
|
getPackageVersion
|
|
12
12
|
} from "./chunk-QTOLNRET.js";
|
|
13
13
|
import {
|
|
14
14
|
clientContextHeaders,
|
|
15
15
|
redactSecretsFromContent
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FXECTHAG.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/net.ts
|
|
19
19
|
import { createRequire } from "module";
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
NOTIFICATION_MATCHED_TYPES,
|
|
7
7
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LL2KHEJH.js";
|
|
9
9
|
import {
|
|
10
10
|
isProtectedByScope,
|
|
11
11
|
registerHookEntry
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6YSEOXP5.js";
|
|
13
13
|
import {
|
|
14
14
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
15
15
|
HOOK_BUDGETS,
|
|
16
16
|
HOOK_LOCATOR_BINARY
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FXECTHAG.js";
|
|
18
18
|
|
|
19
19
|
// src/gemini-config.ts
|
|
20
20
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MCP_BRIDGE_BINARY
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EO6CL4PD.js";
|
|
4
4
|
import {
|
|
5
5
|
KEY_FILE_MODE
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W3CBFLIX.js";
|
|
7
7
|
import {
|
|
8
8
|
NpmInstallError,
|
|
9
9
|
NpmMissingError,
|
|
10
10
|
NpmPermissionError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CFIQ3252.js";
|
|
12
12
|
import {
|
|
13
13
|
readJsonSafe,
|
|
14
14
|
writeFileAtomic,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-QENTGE75.js";
|
|
17
17
|
import {
|
|
18
18
|
NPX_LATEST_COMMAND
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FG5HMJ7C.js";
|
|
20
20
|
import {
|
|
21
21
|
readSetupAgentFailures
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-FXECTHAG.js";
|
|
23
23
|
|
|
24
24
|
// src/instruction-file.ts
|
|
25
25
|
import { accessSync, constants, existsSync, readFileSync, statSync, writeFileSync, mkdirSync, rmSync } from "fs";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
IDLE_PROMPT_NOTIFICATION,
|
|
3
3
|
NOTIFICATION_PUSH_TYPES,
|
|
4
4
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LL2KHEJH.js";
|
|
6
6
|
import {
|
|
7
7
|
repoKeyFor
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4K6YZPZ3.js";
|
|
9
9
|
import {
|
|
10
10
|
cancelQuestion,
|
|
11
11
|
clientErrorKindOf,
|
|
@@ -13,26 +13,26 @@ import {
|
|
|
13
13
|
reportClientError,
|
|
14
14
|
sendNotification,
|
|
15
15
|
waitForAnswer
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RSNN2TPE.js";
|
|
17
17
|
import {
|
|
18
18
|
withRetry
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ESXGCZDA.js";
|
|
20
20
|
import {
|
|
21
21
|
getMachineId
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G3ZDCYMU.js";
|
|
23
23
|
import {
|
|
24
24
|
reportedInstallSource
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-PSCXEH42.js";
|
|
26
26
|
import {
|
|
27
27
|
canonicalJson
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6YSEOXP5.js";
|
|
29
29
|
import {
|
|
30
30
|
writeFileAtomic
|
|
31
31
|
} from "./chunk-QENTGE75.js";
|
|
32
32
|
import {
|
|
33
33
|
getApiKey,
|
|
34
34
|
getBaseUrl
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-DFKEJARZ.js";
|
|
36
36
|
import {
|
|
37
37
|
ACTION_BODY_MAX,
|
|
38
38
|
AGENTS,
|
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
modeStateFromResponse,
|
|
59
59
|
parseMcpToolName,
|
|
60
60
|
pendingCommandEvents,
|
|
61
|
+
questionLimitHandBack,
|
|
61
62
|
redactSecrets,
|
|
62
63
|
redactSecretsDeep,
|
|
63
64
|
reportableSessionId,
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
toToolLookup,
|
|
67
68
|
truncateLine,
|
|
68
69
|
unansweredRefusalReason
|
|
69
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-FXECTHAG.js";
|
|
70
71
|
|
|
71
72
|
// ../hook-mapping/src/describe.ts
|
|
72
73
|
import { isAbsolute, relative, resolve } from "path";
|
|
@@ -224,6 +225,7 @@ var parseApplyPatchFiles = (command) => [...new Set(parseApplyPatchOps(command).
|
|
|
224
225
|
var patchDeletesFiles = (toolName, toolInput) => toolName === "apply_patch" && parseApplyPatchOps(toolInput.command).some((entry) => entry.op === "delete");
|
|
225
226
|
var OPENCODE_TOOL_NAMES = {
|
|
226
227
|
bash: "Bash",
|
|
228
|
+
shell: "Bash",
|
|
227
229
|
// A shell command reaching outside the worktree asks a second time under its
|
|
228
230
|
// own key. It is still the same command, and still Bash.
|
|
229
231
|
external_directory: "Bash",
|
|
@@ -236,7 +238,8 @@ var OPENCODE_TOOL_NAMES = {
|
|
|
236
238
|
grep: "Grep",
|
|
237
239
|
webfetch: "WebFetch",
|
|
238
240
|
websearch: "WebSearch",
|
|
239
|
-
task: "Task"
|
|
241
|
+
task: "Task",
|
|
242
|
+
subagent: "Task"
|
|
240
243
|
};
|
|
241
244
|
var PATCH_ARG_KEYS = ["command", "patch", "input"];
|
|
242
245
|
var patchedFilesIn = (input) => [...new Set(PATCH_ARG_KEYS.flatMap((key) => parseApplyPatchFiles(input[key])))];
|
|
@@ -1346,6 +1349,10 @@ var toPolicyLookups = (toolName, toolInput, cwd) => {
|
|
|
1346
1349
|
inputs: files.map((file) => ({ file_path: cwd ? resolve2(cwd, file) : file }))
|
|
1347
1350
|
};
|
|
1348
1351
|
};
|
|
1352
|
+
var codexQuestionLimitDecision = (facts) => {
|
|
1353
|
+
const handBack = questionLimitHandBack(facts);
|
|
1354
|
+
return handBack.kind === "refuse" ? codexDeny(handBack.reason) : codexPass();
|
|
1355
|
+
};
|
|
1349
1356
|
var permissionTimeoutDecision = (timeoutAction, paused) => {
|
|
1350
1357
|
if (timeoutAction === "approve") return codexAllow();
|
|
1351
1358
|
if (timeoutAction === "deny") return codexDeny(unansweredRefusalReason(paused));
|
|
@@ -2234,6 +2241,7 @@ export {
|
|
|
2234
2241
|
describeApplyPatch,
|
|
2235
2242
|
toPolicyLookup,
|
|
2236
2243
|
toPolicyLookups,
|
|
2244
|
+
codexQuestionLimitDecision,
|
|
2237
2245
|
permissionTimeoutDecision,
|
|
2238
2246
|
userScope,
|
|
2239
2247
|
codexCallKey,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
notificationAnswerStep
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RU37NSZH.js";
|
|
4
4
|
import {
|
|
5
5
|
matchMacAccountStep,
|
|
6
6
|
retryAgentCommand
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LILS32LF.js";
|
|
8
8
|
import {
|
|
9
9
|
EXIT
|
|
10
10
|
} from "./chunk-KZERVKTD.js";
|
|
11
11
|
import {
|
|
12
12
|
NPX_LATEST_COMMAND
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FG5HMJ7C.js";
|
|
14
14
|
|
|
15
15
|
// src/setup/closing.ts
|
|
16
16
|
var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
keyPrefix,
|
|
5
5
|
readConfigFileKey,
|
|
6
6
|
readMacAppKeyPrefix
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-W3CBFLIX.js";
|
|
8
8
|
import {
|
|
9
9
|
NPX_LATEST_COMMAND
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FG5HMJ7C.js";
|
|
11
11
|
|
|
12
12
|
// src/key-signed-out.ts
|
|
13
13
|
var VERDICT_BY_CHECK = {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
reachVerdict,
|
|
8
8
|
reachesYou,
|
|
9
9
|
verifyDelivery
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RU37NSZH.js";
|
|
11
11
|
import {
|
|
12
12
|
generateKeypair,
|
|
13
13
|
openSealedKey,
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
} from "./chunk-FO3MDD26.js";
|
|
25
25
|
import {
|
|
26
26
|
reportedInstallSource
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-PSCXEH42.js";
|
|
28
28
|
import {
|
|
29
29
|
NPX_LATEST_COMMAND
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FG5HMJ7C.js";
|
|
31
31
|
import {
|
|
32
32
|
NO_PAIRING_COMPUTER,
|
|
33
33
|
PAIR_TTL_SECONDS
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FXECTHAG.js";
|
|
35
35
|
|
|
36
36
|
// src/onboarding.ts
|
|
37
37
|
import qrcodeTerminal from "qrcode-terminal";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyFetch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-HSRNWCXJ.js";
|
|
4
4
|
import {
|
|
5
5
|
NetworkError
|
|
6
6
|
} from "./chunk-PPY5N2E6.js";
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from "./chunk-KZERVKTD.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DFKEJARZ.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey,
|
|
15
15
|
normalizeKeyScope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FXECTHAG.js";
|
|
17
17
|
|
|
18
18
|
// src/session.ts
|
|
19
19
|
var samePusharyAccount = (left, right) => left.kind === "ok" && right.kind === "ok" && left.identity.workspaceId !== "" && left.identity.workspaceId === right.identity.workspaceId && left.identity.siteId === right.identity.siteId;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
macAppBridgeAvailable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6HIYOY6I.js";
|
|
4
4
|
import {
|
|
5
5
|
keyPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-W3CBFLIX.js";
|
|
7
7
|
import {
|
|
8
8
|
bridgeAgentKey
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6YSEOXP5.js";
|
|
10
10
|
import {
|
|
11
11
|
readJsonSafe
|
|
12
12
|
} from "./chunk-QENTGE75.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FXECTHAG.js";
|
|
16
16
|
|
|
17
17
|
// src/shared-mcp-key.ts
|
|
18
18
|
var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6YSEOXP5.js";
|
|
4
4
|
import {
|
|
5
5
|
readJsonSafe
|
|
6
6
|
} from "./chunk-QENTGE75.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FXECTHAG.js";
|
|
10
10
|
|
|
11
11
|
// src/process-ownership.ts
|
|
12
12
|
import { createHash, randomUUID } from "crypto";
|