@pushary/agent-hooks 1.3.0 → 1.4.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 +24 -0
- package/README.md +1 -1
- package/data/SKILL.md +3 -3
- package/data/cursor-plugin/skills/pushary/SKILL.md +2 -2
- package/data/vscode-plugin/skills/pushary/SKILL.md +2 -2
- package/dist/bin/pushary-bell-hook.js +20 -20
- package/dist/bin/pushary-bell.js +9 -9
- package/dist/bin/pushary-claude.js +20 -20
- package/dist/bin/pushary-clean.js +472 -94
- package/dist/bin/pushary-codex-bridge.js +11 -11
- package/dist/bin/pushary-codex-hook.js +30 -28
- package/dist/bin/pushary-codex.js +7 -7
- package/dist/bin/pushary-connect.js +9 -9
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +26 -26
- package/dist/bin/pushary-disconnect.js +13 -13
- package/dist/bin/pushary-doctor.js +86 -24
- package/dist/bin/pushary-elicitation-hook.js +19 -19
- package/dist/bin/pushary-gemini-bridge.js +10 -10
- package/dist/bin/pushary-gemini-hook.js +21 -21
- package/dist/bin/pushary-hook.js +34 -44
- package/dist/bin/pushary-login.js +10 -10
- package/dist/bin/pushary-logout.js +7 -7
- package/dist/bin/pushary-mode.js +5 -5
- package/dist/bin/pushary-notification-hook.js +22 -22
- package/dist/bin/pushary-opencode-hook.js +21 -21
- package/dist/bin/pushary-permission-denied-hook.js +26 -26
- package/dist/bin/pushary-permission-hook.js +32 -31
- package/dist/bin/pushary-post-hook.js +22 -22
- package/dist/bin/pushary-prompt-hook.js +22 -22
- package/dist/bin/pushary-session-end-hook.js +22 -22
- package/dist/bin/pushary-session-start-hook.js +24 -24
- package/dist/bin/pushary-setup.js +39 -60
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +13 -13
- package/dist/bin/pushary-stop-hook.js +22 -22
- package/dist/bin/pushary-stopfailure-hook.js +22 -22
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +8 -8
- package/dist/bin/pushary-upgrade.js +17 -17
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +1 -1
- package/dist/{chunk-3AIFWTVB.js → chunk-2TOTCUJC.js} +2 -2
- package/dist/{chunk-X3KIGNIP.js → chunk-43Z3RLS5.js} +83 -24
- package/dist/{chunk-YF4JDCU4.js → chunk-5F5QQMCA.js} +1 -1
- package/dist/{chunk-ZHL62DRA.js → chunk-5IBVIMWT.js} +3 -3
- package/dist/{chunk-BYGEZI7B.js → chunk-5MSBI6NP.js} +1 -1
- package/dist/{chunk-WPJS3OZH.js → chunk-7IEB2GV4.js} +100 -9
- package/dist/{chunk-2PLEJ7SY.js → chunk-7PQZYCEP.js} +1 -1
- package/dist/{chunk-OE6U2AXM.js → chunk-A7XIL2WD.js} +3 -3
- package/dist/{chunk-A2URMNFM.js → chunk-BYAXXBNO.js} +1 -1
- package/dist/{chunk-DON24PNT.js → chunk-D4TNSUDY.js} +1 -1
- package/dist/{chunk-EU6JH7KU.js → chunk-ESLLVHDY.js} +8 -8
- package/dist/{chunk-LZQVAEWP.js → chunk-FAH3D74E.js} +2 -1
- package/dist/{chunk-MU275U5A.js → chunk-GIXLZFEY.js} +2 -2
- package/dist/{chunk-4V24U44H.js → chunk-GLPWCQ6V.js} +2 -2
- package/dist/{chunk-BL4SQNO6.js → chunk-GS5EI2YL.js} +1 -1
- package/dist/{chunk-EKQAKSGI.js → chunk-H25UB3CG.js} +1 -1
- package/dist/{chunk-BNDHXPTQ.js → chunk-HGN6VZTY.js} +20 -13
- package/dist/{chunk-WXXDHGTZ.js → chunk-IF46POXX.js} +5 -4
- package/dist/{chunk-A5ZWYQFV.js → chunk-JCWCTBYH.js} +4 -4
- package/dist/{chunk-IAEVVUXO.js → chunk-KZIXHLPQ.js} +1 -1
- package/dist/{chunk-FGVNU7XD.js → chunk-NBCTKC4Z.js} +34 -3
- package/dist/{chunk-XBO42HKH.js → chunk-NYHNLMQO.js} +12 -3
- package/dist/{chunk-K4TAUYUJ.js → chunk-O5L2OJBB.js} +3 -3
- package/dist/{chunk-DVO4SZMJ.js → chunk-O6RN46OS.js} +3 -3
- package/dist/{chunk-POAFXBNH.js → chunk-P4JVVJ2D.js} +1 -1
- package/dist/{chunk-E7WBNGJS.js → chunk-Q4UAMWXK.js} +1 -1
- package/dist/{chunk-KS4P6F3R.js → chunk-RGZY77CD.js} +4 -4
- package/dist/{chunk-K7UIAE7I.js → chunk-RQM5SMMR.js} +2 -2
- package/dist/{chunk-UVXNYYHG.js → chunk-S3CLZSV3.js} +6 -6
- package/dist/{chunk-B3S4SF3D.js → chunk-S3EUZZJB.js} +1 -1
- package/dist/{chunk-XBJW4MV5.js → chunk-SGZ3IAWF.js} +1 -1
- package/dist/{chunk-YKLCWWEI.js → chunk-SGZJ5LYH.js} +1 -1
- package/dist/{chunk-4LL6LG5X.js → chunk-T7E75EKA.js} +4 -3
- package/dist/{chunk-GOQHN2UH.js → chunk-TWWLVOPB.js} +1 -1
- package/dist/{chunk-RVDHN2TJ.js → chunk-U4FB623J.js} +2 -2
- package/dist/{chunk-RHLUJE4H.js → chunk-UCGQEAKZ.js} +1 -1
- package/dist/{chunk-KPNGPRYU.js → chunk-UIN3RD2U.js} +4 -4
- package/dist/{chunk-XEXOHUJ6.js → chunk-UTYTPDWN.js} +4 -4
- package/dist/{chunk-EJZCV5G4.js → chunk-VENQSVKA.js} +1 -1
- package/dist/{chunk-EYMMU5HC.js → chunk-XJWMPQ6X.js} +1 -1
- package/dist/{chunk-JYEGOYQC.js → chunk-YYRZPEMA.js} +1 -1
- package/dist/{chunk-N43EQPJK.js → chunk-ZIGGEKZW.js} +41 -7
- package/dist/{reapply-FUCAKR6Z.js → reapply-B3S2LRMT.js} +9 -9
- package/dist/src/index.d.ts +20 -17
- package/dist/src/index.js +13 -13
- package/package.json +1 -1
- /package/dist/{chunk-KBITFQST.js → chunk-P32LPT2L.js} +0 -0
|
@@ -2,24 +2,24 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GLPWCQ6V.js";
|
|
6
6
|
import {
|
|
7
7
|
daemonHasRemoteProof,
|
|
8
8
|
daemonServiceManagerAvailable,
|
|
9
9
|
hasDaemonServiceDefinition,
|
|
10
10
|
readDaemonNeedsLogin,
|
|
11
11
|
readDaemonStatus
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RGZY77CD.js";
|
|
13
13
|
import {
|
|
14
14
|
getMachineId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RQM5SMMR.js";
|
|
16
16
|
import {
|
|
17
17
|
getPackageVersion
|
|
18
18
|
} from "./chunk-DINDL2CF.js";
|
|
19
19
|
import {
|
|
20
20
|
readControlMode,
|
|
21
21
|
readKeySource
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NYHNLMQO.js";
|
|
23
23
|
import {
|
|
24
24
|
getBaseUrl
|
|
25
25
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_CHOICES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5MSBI6NP.js";
|
|
4
4
|
import {
|
|
5
5
|
isBridgeLocator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YYRZPEMA.js";
|
|
7
7
|
import {
|
|
8
8
|
pusharyHookExecutable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O6RN46OS.js";
|
|
10
10
|
import {
|
|
11
11
|
BELL_HOOK_BINARY
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7PQZYCEP.js";
|
|
13
13
|
|
|
14
14
|
// src/setup/hook-ownership.ts
|
|
15
15
|
var commandsIn = (value) => {
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ESLLVHDY.js";
|
|
4
|
+
import {
|
|
5
|
+
degradedLine
|
|
6
|
+
} from "./chunk-7IEB2GV4.js";
|
|
7
|
+
|
|
8
|
+
// src/tool-hook-input.ts
|
|
9
|
+
var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
|
|
10
|
+
function isInputRecord(value) {
|
|
11
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
function isToolHookInput(value) {
|
|
14
|
+
if (!isInputRecord(value)) return false;
|
|
15
|
+
if (typeof value.tool_name !== "string" || value.tool_name.length === 0) return false;
|
|
16
|
+
if (!isInputRecord(value.tool_input)) return false;
|
|
17
|
+
for (const field of OPTIONAL_TEXT_FIELDS) {
|
|
18
|
+
if (value[field] !== void 0 && typeof value[field] !== "string") return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
function parseToolHookInput(value) {
|
|
23
|
+
if (!isInputRecord(value)) return null;
|
|
24
|
+
const input = { ...value, tool_input: value.tool_input === void 0 ? {} : value.tool_input };
|
|
25
|
+
return isToolHookInput(input) ? input : null;
|
|
26
|
+
}
|
|
4
27
|
|
|
5
28
|
// src/admission.ts
|
|
6
29
|
import { readFileSync } from "fs";
|
|
@@ -38,9 +61,14 @@ var matches = (rule, source, event) => {
|
|
|
38
61
|
return (ruleSource === "*" || ruleSource === source) && (ruleEvent === "*" || ruleEvent === event);
|
|
39
62
|
};
|
|
40
63
|
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
41
|
-
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) => {
|
|
64
|
+
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => {
|
|
42
65
|
if (source === null) {
|
|
43
|
-
process.stderr.write("
|
|
66
|
+
process.stderr.write(`${degradedLine("hook", {
|
|
67
|
+
reason: "unknown_agent",
|
|
68
|
+
fallback: "stood aside, so nothing is gated or reported for this call",
|
|
69
|
+
event: fallbackEvent
|
|
70
|
+
})}
|
|
71
|
+
`);
|
|
44
72
|
return null;
|
|
45
73
|
}
|
|
46
74
|
let raw = "";
|
|
@@ -53,17 +81,23 @@ var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) =>
|
|
|
53
81
|
return null;
|
|
54
82
|
}
|
|
55
83
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
56
|
-
const
|
|
84
|
+
const input = parseInput ? parseInput(parsed) : parsed;
|
|
85
|
+
if (input === null) return null;
|
|
86
|
+
const event = eventNameOf(input) ?? fallbackEvent;
|
|
57
87
|
if (!isAdmitted(readAdmissionRules(), source, event)) return null;
|
|
58
|
-
if (stdin === process.stdin) registerTranscript(source,
|
|
59
|
-
return
|
|
88
|
+
if (stdin === process.stdin) registerTranscript(source, input);
|
|
89
|
+
return input;
|
|
60
90
|
};
|
|
61
91
|
var eventNameOf = (input) => {
|
|
62
92
|
if (!("hook_event_name" in input)) return void 0;
|
|
63
93
|
const name = input.hook_event_name;
|
|
64
94
|
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
65
95
|
};
|
|
96
|
+
function readToolHookInput(source, event, stdin = process.stdin) {
|
|
97
|
+
return readHookInput(source, event, stdin, parseToolHookInput);
|
|
98
|
+
}
|
|
66
99
|
|
|
67
100
|
export {
|
|
68
|
-
readHookInput
|
|
101
|
+
readHookInput,
|
|
102
|
+
readToolHookInput
|
|
69
103
|
};
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
reapplyGeminiSettings,
|
|
9
9
|
reapplyVsCodePlugin,
|
|
10
10
|
repairCodexHolds
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-S3CLZSV3.js";
|
|
12
|
+
import "./chunk-SGZ3IAWF.js";
|
|
13
|
+
import "./chunk-5IBVIMWT.js";
|
|
14
|
+
import "./chunk-O6RN46OS.js";
|
|
15
|
+
import "./chunk-A7XIL2WD.js";
|
|
16
|
+
import "./chunk-KZIXHLPQ.js";
|
|
17
|
+
import "./chunk-UCGQEAKZ.js";
|
|
18
|
+
import "./chunk-T7E75EKA.js";
|
|
19
|
+
import "./chunk-7IEB2GV4.js";
|
|
20
20
|
export {
|
|
21
21
|
inspectConfiguredManagedProviders,
|
|
22
22
|
reapplyAllAgents,
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CanonicalGateInputs, ReceiptMeta } from '@pushary/hook-mapping';
|
|
2
|
+
import { ClaudePreToolUseOutput, MachineDecisionOrigin, SettledOutcome, AgentQuestion, PolicyConfig, ApprovalMode, ModeState } from '@pushary/contracts';
|
|
2
3
|
export { ApprovalMode, ModeState, PolicyConfig, ToolPolicy, resolvePolicy } from '@pushary/contracts';
|
|
3
|
-
import { ReceiptMeta } from '@pushary/hook-mapping';
|
|
4
4
|
|
|
5
|
-
interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
interface ToolHookInput {
|
|
6
|
+
readonly hook_event_name?: string;
|
|
7
|
+
readonly tool_name: string;
|
|
8
|
+
readonly tool_input: Record<string, unknown>;
|
|
9
|
+
readonly session_id?: string;
|
|
10
|
+
readonly cwd?: string;
|
|
11
|
+
readonly transcript_path?: string;
|
|
12
|
+
readonly tool_use_id?: string;
|
|
13
|
+
readonly permission_mode?: string;
|
|
13
14
|
}
|
|
14
|
-
type HookOutput = ClaudePreToolUseOutput;
|
|
15
|
-
declare const handlePreToolUse: (input: ToolInput) => Promise<HookOutput | undefined>;
|
|
16
|
-
|
|
17
|
-
declare const getPolicy: (apiKey: string, expectedVersion?: string | null, agent?: string, repoAware?: boolean, sessionId?: string) => Promise<PolicyConfig>;
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
declare const
|
|
16
|
+
type HookOutput = ClaudePreToolUseOutput;
|
|
17
|
+
declare const handlePreToolUse: (input: ToolHookInput, canonical?: CanonicalGateInputs | null) => Promise<HookOutput | undefined>;
|
|
21
18
|
|
|
22
19
|
interface UsageReport {
|
|
23
20
|
readonly eventId: string;
|
|
@@ -47,7 +44,8 @@ interface AgentEvent {
|
|
|
47
44
|
error?: string;
|
|
48
45
|
taskTitle?: string;
|
|
49
46
|
decisionSource?: DecisionSource;
|
|
50
|
-
decisionOrigin?:
|
|
47
|
+
decisionOrigin?: MachineDecisionOrigin;
|
|
48
|
+
decisionOutcome?: SettledOutcome;
|
|
51
49
|
toolName?: string;
|
|
52
50
|
toolTarget?: string;
|
|
53
51
|
agents?: readonly string[];
|
|
@@ -191,6 +189,11 @@ declare const cancelQuestion: (apiKey: string, correlationId: string, signal?: A
|
|
|
191
189
|
handoffAction?: string;
|
|
192
190
|
}>;
|
|
193
191
|
|
|
192
|
+
declare const getPolicy: (apiKey: string, expectedVersion?: string | null, agent?: string, repoAware?: boolean, sessionId?: string) => Promise<PolicyConfig>;
|
|
193
|
+
|
|
194
|
+
declare const fetchModeState: (apiKey: string, sessionId?: string, reuseWithinMs?: number, signal?: AbortSignal) => Promise<ModeState>;
|
|
195
|
+
declare const fetchModeOverride: (apiKey: string) => Promise<ApprovalMode | null>;
|
|
196
|
+
|
|
194
197
|
declare const getApiKey: () => string;
|
|
195
198
|
declare const getBaseUrl: () => string;
|
|
196
199
|
|
package/dist/src/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-43Z3RLS5.js";
|
|
4
|
+
import "../chunk-HGN6VZTY.js";
|
|
5
|
+
import "../chunk-5IBVIMWT.js";
|
|
6
|
+
import "../chunk-JCWCTBYH.js";
|
|
7
|
+
import "../chunk-5F5QQMCA.js";
|
|
8
8
|
import "../chunk-YHG74UFF.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-A7XIL2WD.js";
|
|
10
10
|
import {
|
|
11
11
|
fetchAccountPublicKey
|
|
12
12
|
} from "../chunk-EQRS3SGM.js";
|
|
@@ -18,28 +18,28 @@ import {
|
|
|
18
18
|
handlePostToolUse,
|
|
19
19
|
handleStop,
|
|
20
20
|
reportEvent
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-IF46POXX.js";
|
|
22
|
+
import "../chunk-KZIXHLPQ.js";
|
|
23
23
|
import {
|
|
24
24
|
askUser,
|
|
25
25
|
cancelQuestion,
|
|
26
26
|
waitForAnswer
|
|
27
27
|
} from "../chunk-LGXUGYUH.js";
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-RQM5SMMR.js";
|
|
29
|
+
import "../chunk-UCGQEAKZ.js";
|
|
30
30
|
import "../chunk-EYRGBYZG.js";
|
|
31
31
|
import "../chunk-SAF6HGAA.js";
|
|
32
32
|
import "../chunk-7QLSKOSU.js";
|
|
33
33
|
import "../chunk-KZERVKTD.js";
|
|
34
|
-
import "../chunk-
|
|
35
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-P4JVVJ2D.js";
|
|
35
|
+
import "../chunk-T7E75EKA.js";
|
|
36
36
|
import {
|
|
37
37
|
getApiKey,
|
|
38
38
|
getBaseUrl
|
|
39
39
|
} from "../chunk-2UMNXADU.js";
|
|
40
40
|
import {
|
|
41
41
|
resolvePolicy
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-7IEB2GV4.js";
|
|
43
43
|
export {
|
|
44
44
|
askUser,
|
|
45
45
|
cancelQuestion,
|
package/package.json
CHANGED
|
File without changes
|