@pushary/agent-hooks 1.9.61 → 1.9.63
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 +14 -0
- package/README.md +1 -1
- package/dist/{api-LW3PJQYY.js → api-UHUUAONF.js} +14 -12
- package/dist/bin/pushary-bell-hook.js +27 -27
- package/dist/bin/pushary-bell.js +12 -12
- package/dist/bin/pushary-claude.js +35 -28
- package/dist/bin/pushary-clean.js +35 -34
- package/dist/bin/pushary-codex-bridge.js +21 -21
- package/dist/bin/pushary-codex-hook.js +51 -38
- package/dist/bin/pushary-codex-session.js +8 -8
- package/dist/bin/pushary-codex.js +14 -14
- package/dist/bin/pushary-connect.js +27 -27
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +39 -38
- package/dist/bin/pushary-disconnect.js +30 -29
- package/dist/bin/pushary-doctor.js +46 -44
- package/dist/bin/pushary-elicitation-hook.js +30 -28
- package/dist/bin/pushary-gemini-bridge.js +15 -15
- package/dist/bin/pushary-gemini-hook.js +38 -30
- package/dist/bin/pushary-hook.js +32 -31
- package/dist/bin/pushary-login.js +27 -15
- package/dist/bin/pushary-logout.js +28 -28
- package/dist/bin/pushary-mcp.js +11 -11
- package/dist/bin/pushary-mode.js +14 -14
- package/dist/bin/pushary-notification-hook.js +26 -26
- package/dist/bin/pushary-opencode-hook.js +40 -31
- package/dist/bin/pushary-permission-denied-hook.js +31 -31
- package/dist/bin/pushary-permission-hook.js +30 -30
- package/dist/bin/pushary-post-hook.js +26 -26
- package/dist/bin/pushary-prompt-hook.js +26 -26
- package/dist/bin/pushary-session-end-hook.js +26 -26
- package/dist/bin/pushary-session-start-hook.js +34 -33
- package/dist/bin/pushary-setup.js +115 -4205
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +32 -32
- package/dist/bin/pushary-stop-hook.js +26 -26
- package/dist/bin/pushary-stopfailure-hook.js +26 -26
- package/dist/bin/pushary-suggestions.js +14 -14
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +62 -9
- package/dist/bin/pushary-upgrade.js +43 -41
- package/dist/bin/pushary-wait.js +14 -14
- package/dist/bin/pushary.js +7 -7
- package/dist/{chunk-ORX5BTV4.js → chunk-2MZ6ROWZ.js} +8 -6
- package/dist/{chunk-7BHI3PZN.js → chunk-3GVV7XVT.js} +1 -1
- package/dist/{chunk-GKFO5JLN.js → chunk-3QLFB2EY.js} +4 -4
- package/dist/{chunk-LBHJJEKT.js → chunk-4WFAP6QN.js} +10 -10
- package/dist/{chunk-PITQ5ZIQ.js → chunk-5JK3DQGZ.js} +2 -2
- package/dist/{chunk-CJ5TCFD4.js → chunk-5LOP4AVD.js} +3 -3
- package/dist/{chunk-ERK24P76.js → chunk-6Z2VR3BA.js} +4 -2
- package/dist/{chunk-K4MBKXAE.js → chunk-75ODMNOM.js} +1 -1
- package/dist/{chunk-YPD3MTFU.js → chunk-7GRQGXF4.js} +1 -1
- package/dist/{chunk-AXJLJJ3M.js → chunk-7NCLUA65.js} +99 -6
- package/dist/{chunk-YDR4BQ7R.js → chunk-AB3VAQ25.js} +3 -3
- package/dist/{chunk-2AELPDMT.js → chunk-BCVCUDFI.js} +16 -5
- package/dist/{chunk-RGSW36XH.js → chunk-BQFL2ECS.js} +3 -3
- package/dist/{chunk-BG4Y64FW.js → chunk-BUQU3OPX.js} +1 -1
- package/dist/{chunk-SHJVFW22.js → chunk-CLABCSZC.js} +4 -4
- package/dist/{chunk-4VRTSDGP.js → chunk-DMNLFWGY.js} +7 -108
- package/dist/{chunk-7MCCXE5Y.js → chunk-EHHTQURL.js} +5 -5
- package/dist/{chunk-XAO6EYGM.js → chunk-ELAK46NR.js} +26 -3
- package/dist/{chunk-JGQV4MDQ.js → chunk-EQ26IKZM.js} +6 -6
- package/dist/{chunk-VX2MJ4X7.js → chunk-FAF5AW3P.js} +9 -9
- package/dist/{chunk-XEJOPVCG.js → chunk-FEAGK25K.js} +1 -1
- package/dist/{chunk-GZCSWDAS.js → chunk-GNUARBRZ.js} +4 -4
- package/dist/{chunk-64S5PQBQ.js → chunk-GZS72NCF.js} +4 -4
- package/dist/{chunk-WFSGCFXQ.js → chunk-HAIXS4OX.js} +2 -6
- package/dist/{chunk-G36T5LAP.js → chunk-HOIO66DU.js} +3 -3
- package/dist/{chunk-ADR3KHOC.js → chunk-HZ72EMJE.js} +2 -2
- package/dist/{chunk-WN3RACVD.js → chunk-IOH2T3CB.js} +17 -3
- package/dist/chunk-KEPESIIR.js +4117 -0
- package/dist/{chunk-ZEWIMY63.js → chunk-KL76XWZ7.js} +1 -1
- package/dist/{chunk-IFPOHFDJ.js → chunk-KLZZI5TU.js} +1 -1
- package/dist/{chunk-ATKN4BJT.js → chunk-KUCL7ETL.js} +1 -1
- package/dist/{chunk-SFAP4AJY.js → chunk-L5CDGXPO.js} +3 -3
- package/dist/{chunk-GDKQUB52.js → chunk-LGZ545TA.js} +5 -5
- package/dist/{chunk-ZGU3NXL2.js → chunk-LTT54NOU.js} +8 -8
- package/dist/{chunk-MWLTTLPK.js → chunk-MK4USZYQ.js} +2 -2
- package/dist/{chunk-NKLNU577.js → chunk-MRCVYYPW.js} +3 -3
- package/dist/{chunk-7JXJJNQ5.js → chunk-OJEIS5L2.js} +1 -1
- package/dist/{chunk-ELLJPP6O.js → chunk-OP5IBEV7.js} +7 -3
- package/dist/{chunk-BQ2VV7LY.js → chunk-OU3BYBJ3.js} +2 -2
- package/dist/{chunk-6T5Z64KS.js → chunk-OW6VBXXI.js} +15 -15
- package/dist/{chunk-USE5IEEW.js → chunk-OY6Z4IKB.js} +1 -1
- package/dist/{chunk-O65F2IIN.js → chunk-P6RF4RQN.js} +6 -6
- package/dist/{chunk-4N5E4JNF.js → chunk-PIQ4HHA2.js} +5 -5
- package/dist/{chunk-7HDGH3Z2.js → chunk-PJ34FOIV.js} +4 -4
- package/dist/{chunk-DQLCFGHK.js → chunk-PXAOEFJZ.js} +17 -11
- package/dist/{chunk-P3VQH65N.js → chunk-QC2W42DE.js} +33 -20
- package/dist/{chunk-X3YKQJCZ.js → chunk-RAJ3QEIL.js} +1 -1
- package/dist/chunk-S2Z6VWHH.js +112 -0
- package/dist/{chunk-FUZ5VYWD.js → chunk-SARPHHTT.js} +1 -1
- package/dist/{chunk-BJTSKOH3.js → chunk-SKUSGWFK.js} +5 -5
- package/dist/{chunk-Y6Z7DA5Y.js → chunk-T3GHXR6N.js} +5 -5
- package/dist/{chunk-EUIPTDLX.js → chunk-T6XQNOZV.js} +22 -15
- package/dist/{chunk-RJHX66EY.js → chunk-TBKHQWIH.js} +16 -11
- package/dist/{chunk-CICLXLQN.js → chunk-TMGJAFSD.js} +4 -4
- package/dist/{chunk-Y5VKZNFN.js → chunk-V5W3CK7F.js} +2 -2
- package/dist/{chunk-GAMVAORR.js → chunk-V7N5NOZV.js} +4 -2
- package/dist/{chunk-33OOEVPG.js → chunk-VC3HFFMQ.js} +1 -1
- package/dist/{chunk-KPNZ7JUL.js → chunk-VDBXSUXP.js} +6 -6
- package/dist/{chunk-7BAO42UV.js → chunk-VFJSVPNL.js} +3 -3
- package/dist/{chunk-HUI4OE43.js → chunk-VHZAJ6IB.js} +3 -3
- package/dist/{chunk-QER5R7Z6.js → chunk-VN7XH6TU.js} +2 -2
- package/dist/{chunk-UADSXJZ4.js → chunk-WUOOZE5S.js} +2 -2
- package/dist/{chunk-LN7DE5LY.js → chunk-XBTWG2VL.js} +4 -4
- package/dist/{chunk-XV6S5PWW.js → chunk-XE5N352V.js} +1 -1
- package/dist/{chunk-SVQWHV65.js → chunk-XO3KAH7K.js} +1 -1
- package/dist/{chunk-BUZIEL7Y.js → chunk-YK6GR4GU.js} +2 -2
- package/dist/chunk-YMZOM6BD.js +216 -0
- package/dist/{codex-app-cards-switch-BD7LCI2I.js → codex-app-cards-switch-LXMAIOFB.js} +11 -11
- package/dist/{codex-desktop-launch-V5CASSBB.js → codex-desktop-launch-VE5RLFUU.js} +1 -1
- package/dist/{codex-session-launch-5PKFKUFD.js → codex-session-launch-XZZWXCPK.js} +18 -18
- package/dist/{config-AEKH7HGC.js → config-PPX25AV5.js} +3 -3
- package/dist/{global-upgrade-IUXJJDWF.js → global-upgrade-NRMHNLNU.js} +9 -9
- package/dist/{identity-YJIV2XTY.js → identity-ZFQR7JNW.js} +4 -4
- package/dist/{live-capabilities-QYFW5QAW.js → live-capabilities-SJRYRKNB.js} +4 -4
- package/dist/{paths-A5GAR5PL.js → paths-7VTVOQXJ.js} +3 -3
- package/dist/{reapply-BKJGICRJ.js → reapply-WOANOIRZ.js} +27 -26
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +21 -21
- package/dist/{upgrade-lock-DDB7WEWC.js → upgrade-lock-VAYJZVTB.js} +4 -4
- package/dist/{usage-HBDNFZ3O.js → usage-C4DIYUR6.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-6FJ6CK32.js +0 -126
package/dist/chunk-6FJ6CK32.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
registerTranscript
|
|
3
|
-
} from "./chunk-EUIPTDLX.js";
|
|
4
|
-
import {
|
|
5
|
-
namedEvent
|
|
6
|
-
} from "./chunk-GKFO5JLN.js";
|
|
7
|
-
import {
|
|
8
|
-
writeDegraded
|
|
9
|
-
} from "./chunk-RJHX66EY.js";
|
|
10
|
-
import {
|
|
11
|
-
claudeShapedHookInput,
|
|
12
|
-
hookCompatibleProfileBySource,
|
|
13
|
-
isGrokHookPayload,
|
|
14
|
-
isGrokSessionEndStop
|
|
15
|
-
} from "./chunk-AXJLJJ3M.js";
|
|
16
|
-
|
|
17
|
-
// src/tool-hook-input.ts
|
|
18
|
-
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
19
|
-
function isInputRecord(value) {
|
|
20
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21
|
-
}
|
|
22
|
-
function isToolHookInput(value) {
|
|
23
|
-
if (!isInputRecord(value)) return false;
|
|
24
|
-
if (typeof value.tool_name !== "string" || value.tool_name.length === 0) return false;
|
|
25
|
-
if (!isInputRecord(value.tool_input)) return false;
|
|
26
|
-
for (const field of OPTIONAL_TEXT_FIELDS) {
|
|
27
|
-
if (value[field] !== void 0 && typeof value[field] !== "string") return false;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
function parseToolHookInput(value) {
|
|
32
|
-
if (!isInputRecord(value)) return null;
|
|
33
|
-
const input = { ...value, tool_input: value.tool_input === void 0 ? {} : value.tool_input };
|
|
34
|
-
return isToolHookInput(input) ? input : null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/admission.ts
|
|
38
|
-
import { readFileSync } from "fs";
|
|
39
|
-
import { homedir } from "os";
|
|
40
|
-
import { join } from "path";
|
|
41
|
-
var NO_RULES = { version: 1, disabled: [] };
|
|
42
|
-
var SUPPORTED_VERSION = 1;
|
|
43
|
-
var parseAdmissionRules = (raw) => {
|
|
44
|
-
if (!raw) return NO_RULES;
|
|
45
|
-
try {
|
|
46
|
-
const parsed = JSON.parse(raw);
|
|
47
|
-
if (parsed.version !== SUPPORTED_VERSION) return NO_RULES;
|
|
48
|
-
if (!Array.isArray(parsed.disabled)) return NO_RULES;
|
|
49
|
-
return {
|
|
50
|
-
version: SUPPORTED_VERSION,
|
|
51
|
-
disabled: parsed.disabled.filter((rule) => typeof rule === "string")
|
|
52
|
-
};
|
|
53
|
-
} catch {
|
|
54
|
-
return NO_RULES;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var admissionRulesFile = () => process.env.PUSHARY_ADMISSION_FILE?.trim() || join(homedir(), ".pushary", "admission-rules.json");
|
|
58
|
-
var readAdmissionRules = () => {
|
|
59
|
-
try {
|
|
60
|
-
return parseAdmissionRules(readFileSync(admissionRulesFile(), "utf-8"));
|
|
61
|
-
} catch {
|
|
62
|
-
return NO_RULES;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var matches = (rule, source, event) => {
|
|
66
|
-
const colon = rule.indexOf(":");
|
|
67
|
-
if (colon <= 0 || colon === rule.length - 1) return false;
|
|
68
|
-
const ruleSource = rule.slice(0, colon);
|
|
69
|
-
const ruleEvent = rule.slice(colon + 1);
|
|
70
|
-
return (ruleSource === "*" || ruleSource === source) && (ruleEvent === "*" || ruleEvent === event);
|
|
71
|
-
};
|
|
72
|
-
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
73
|
-
var UNREADABLE = { kind: "unreadable" };
|
|
74
|
-
var UNKNOWN_AGENT = { kind: "unknown_agent" };
|
|
75
|
-
var readHookInputOutcome = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => {
|
|
76
|
-
if (source === null) {
|
|
77
|
-
writeDegraded("hook", {
|
|
78
|
-
reason: "unknown_agent",
|
|
79
|
-
fallback: "stood aside, so nothing is gated or reported for this call",
|
|
80
|
-
event: fallbackEvent
|
|
81
|
-
});
|
|
82
|
-
return UNKNOWN_AGENT;
|
|
83
|
-
}
|
|
84
|
-
let raw = "";
|
|
85
|
-
for await (const chunk of stdin) raw += chunk;
|
|
86
|
-
if (!raw.trim()) return UNREADABLE;
|
|
87
|
-
let parsed;
|
|
88
|
-
try {
|
|
89
|
-
parsed = JSON.parse(raw);
|
|
90
|
-
} catch {
|
|
91
|
-
return UNREADABLE;
|
|
92
|
-
}
|
|
93
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return UNREADABLE;
|
|
94
|
-
if (source !== "grok" && process.env.GROK_SESSION_ID && isGrokHookPayload(parsed)) return UNREADABLE;
|
|
95
|
-
const shaped = inClaudeShape(source, namedEvent(process.argv) ?? fallbackEvent, parsed);
|
|
96
|
-
if (source === "grok" && isGrokSessionEndStop(shaped.hook_event_name, shaped.reason)) return UNREADABLE;
|
|
97
|
-
const input = parseInput ? parseInput(shaped) : shaped;
|
|
98
|
-
if (input === null) return UNREADABLE;
|
|
99
|
-
const event = eventNameOf(input) ?? fallbackEvent;
|
|
100
|
-
if (!isAdmitted(readAdmissionRules(), source, event)) return { kind: "not_admitted", input };
|
|
101
|
-
if (stdin === process.stdin) registerTranscript(source, input);
|
|
102
|
-
return { kind: "admitted", input };
|
|
103
|
-
};
|
|
104
|
-
var admittedInput = (read) => read.kind === "admitted" ? read.input : null;
|
|
105
|
-
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => admittedInput(await readHookInputOutcome(source, fallbackEvent, stdin, parseInput));
|
|
106
|
-
var inClaudeShape = (source, event, parsed) => {
|
|
107
|
-
const profile = hookCompatibleProfileBySource(source);
|
|
108
|
-
return profile ? claudeShapedHookInput(profile.payload, event, parsed) : parsed;
|
|
109
|
-
};
|
|
110
|
-
var eventNameOf = (input) => {
|
|
111
|
-
if (!("hook_event_name" in input)) return void 0;
|
|
112
|
-
const name = input.hook_event_name;
|
|
113
|
-
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
114
|
-
};
|
|
115
|
-
function readToolHookInput(source, event, stdin = process.stdin) {
|
|
116
|
-
return readHookInput(source, event, stdin, parseToolHookInput);
|
|
117
|
-
}
|
|
118
|
-
function readToolHookCall(source, event, stdin = process.stdin) {
|
|
119
|
-
return readHookInputOutcome(source, event, stdin, parseToolHookInput);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export {
|
|
123
|
-
readHookInput,
|
|
124
|
-
readToolHookInput,
|
|
125
|
-
readToolHookCall
|
|
126
|
-
};
|