@pushary/agent-hooks 1.4.1 → 1.4.2
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 +9 -0
- package/dist/bin/pushary-bell-hook.js +18 -18
- package/dist/bin/pushary-bell.js +6 -6
- package/dist/bin/pushary-claude.js +18 -18
- package/dist/bin/pushary-clean.js +24 -20
- package/dist/bin/pushary-codex-bridge.js +10 -10
- package/dist/bin/pushary-codex-hook.js +31 -26
- package/dist/bin/pushary-codex.js +6 -6
- package/dist/bin/pushary-connect.js +6 -6
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +22 -22
- package/dist/bin/pushary-disconnect.js +10 -10
- package/dist/bin/pushary-doctor.js +20 -20
- package/dist/bin/pushary-elicitation-hook.js +17 -17
- package/dist/bin/pushary-gemini-bridge.js +9 -9
- package/dist/bin/pushary-gemini-hook.js +19 -19
- package/dist/bin/pushary-hook.js +23 -23
- package/dist/bin/pushary-login.js +7 -7
- package/dist/bin/pushary-logout.js +4 -4
- package/dist/bin/pushary-mode.js +3 -3
- package/dist/bin/pushary-notification-hook.js +20 -20
- package/dist/bin/pushary-opencode-hook.js +19 -19
- package/dist/bin/pushary-permission-denied-hook.js +24 -24
- package/dist/bin/pushary-permission-hook.js +23 -23
- package/dist/bin/pushary-post-hook.js +20 -20
- package/dist/bin/pushary-prompt-hook.js +20 -20
- package/dist/bin/pushary-session-end-hook.js +20 -20
- package/dist/bin/pushary-session-start-hook.js +22 -22
- package/dist/bin/pushary-setup.js +53 -32
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +10 -10
- package/dist/bin/pushary-stop-hook.js +20 -20
- package/dist/bin/pushary-stopfailure-hook.js +20 -20
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +4 -4
- package/dist/bin/pushary-upgrade.js +14 -14
- package/dist/bin/pushary-wait.js +3 -3
- package/dist/{chunk-BZBUPZC6.js → chunk-25RTLTQD.js} +1 -1
- package/dist/{chunk-SKXLIVFM.js → chunk-2V2IKOGJ.js} +1 -1
- package/dist/{chunk-MN3XOVRK.js → chunk-4BROEAKH.js} +1 -1
- package/dist/{chunk-KEMEBTCJ.js → chunk-4ZDKSDVW.js} +4 -4
- package/dist/{chunk-43JKGLZZ.js → chunk-55KW4FLG.js} +2 -2
- package/dist/{chunk-2GMI6JH6.js → chunk-ACYIZ3KH.js} +5 -5
- package/dist/{chunk-3BPB2HYZ.js → chunk-BZ4GDOJX.js} +3 -3
- package/dist/{chunk-R3AMKNIW.js → chunk-DY4ILT6L.js} +1 -1
- package/dist/{chunk-VYUDGQM7.js → chunk-F4UWL4NY.js} +1 -1
- package/dist/{chunk-TI3ZWXZG.js → chunk-FU2DFEAZ.js} +1 -1
- package/dist/{chunk-LNGYW6G4.js → chunk-G653QPTR.js} +17 -13
- package/dist/{chunk-CRNAXFQ6.js → chunk-GZ7E6VOB.js} +1 -1
- package/dist/{chunk-WIOXWUUH.js → chunk-II7PUMPB.js} +3 -3
- package/dist/{chunk-4FN6VV56.js → chunk-JVTOML54.js} +2 -2
- package/dist/{chunk-SWFF5U2N.js → chunk-LEAAERSQ.js} +1 -1
- package/dist/{chunk-ED5TA2FJ.js → chunk-LPYCPFBZ.js} +3 -3
- package/dist/{chunk-HK3IXIQJ.js → chunk-M5CTUFF3.js} +1 -1
- package/dist/{chunk-3UA6FPRC.js → chunk-MUVTZNJW.js} +3 -3
- package/dist/{chunk-JOVWYVSR.js → chunk-MW6ZPC6R.js} +1 -1
- package/dist/{chunk-3T52B2OF.js → chunk-NHTAHAIS.js} +1 -1
- package/dist/{chunk-D7ERHWYB.js → chunk-NOWZUGZW.js} +1 -1
- package/dist/{chunk-QBS6LGEK.js → chunk-NY6XQ6CA.js} +1 -1
- package/dist/{chunk-LUT2EZLG.js → chunk-PC6DU5C4.js} +1 -1
- package/dist/{chunk-FVKFDTN6.js → chunk-SOUZBGYJ.js} +4 -0
- package/dist/{chunk-ALFT7H5B.js → chunk-SUWRZYQG.js} +56 -5
- package/dist/{chunk-S3EP4B35.js → chunk-T5SZ4PML.js} +24 -10
- package/dist/{chunk-SAF6NNXY.js → chunk-TRLFZKVG.js} +1 -1
- package/dist/{chunk-KI36MAT6.js → chunk-TYEO6T5J.js} +2 -2
- package/dist/{chunk-TNS3YLFE.js → chunk-UJBZIKSY.js} +6 -6
- package/dist/{chunk-K6I5M2ME.js → chunk-UM5J3J4V.js} +1 -1
- package/dist/{chunk-HQLAZWJJ.js → chunk-VIOL2DJS.js} +5 -5
- package/dist/{chunk-PHHGHHOW.js → chunk-VOMOZ4D5.js} +1 -1
- package/dist/{chunk-I6HRQOMT.js → chunk-VW66JEGU.js} +4 -4
- package/dist/{chunk-TF4IOINR.js → chunk-WPVHRUDT.js} +3 -3
- package/dist/{chunk-GOFDGTEI.js → chunk-XDP3UYH5.js} +16 -43
- package/dist/{chunk-37VLIYLI.js → chunk-Y3MM6PYN.js} +1 -1
- package/dist/{chunk-WEO5JCB4.js → chunk-YXP3WPAI.js} +1 -1
- package/dist/{chunk-LYXX5NSB.js → chunk-ZVY25BMK.js} +1 -1
- package/dist/{reapply-BAWDJTG7.js → reapply-J527BCJG.js} +8 -8
- package/dist/src/index.js +12 -12
- package/package.json +1 -1
|
@@ -3,28 +3,28 @@ import {
|
|
|
3
3
|
addPusharyToolPermissions,
|
|
4
4
|
isPusharyHook,
|
|
5
5
|
removeClaudeMcpServers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-II7PUMPB.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_HOOK_EVENTS,
|
|
9
9
|
addGeminiMcpServer,
|
|
10
10
|
removeGeminiMcpServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LPYCPFBZ.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CODE_AGENT,
|
|
14
14
|
parseApplyPatchFiles
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G653QPTR.js";
|
|
16
16
|
import {
|
|
17
17
|
guardBinary,
|
|
18
18
|
holdBudgetOf,
|
|
19
19
|
registerHookEntry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TRLFZKVG.js";
|
|
21
21
|
import {
|
|
22
22
|
PHONE_ANSWERED_TOOLS,
|
|
23
23
|
hookCompatibleProfile,
|
|
24
24
|
hookCompatibleProfileBySource,
|
|
25
25
|
toToolLookup,
|
|
26
26
|
withHookHoldBudget
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SOUZBGYJ.js";
|
|
28
28
|
|
|
29
29
|
// src/compatible-config.ts
|
|
30
30
|
import { homedir } from "os";
|
|
@@ -2,24 +2,24 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TYEO6T5J.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-BZ4GDOJX.js";
|
|
13
13
|
import {
|
|
14
14
|
getMachineId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NHTAHAIS.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-FU2DFEAZ.js";
|
|
23
23
|
import {
|
|
24
24
|
getBaseUrl
|
|
25
25
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LPYCPFBZ.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TRLFZKVG.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SOUZBGYJ.js";
|
|
16
16
|
|
|
17
17
|
// src/diagnostics/wiring.ts
|
|
18
18
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeHookSource,
|
|
3
3
|
activeIdentity
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VIOL2DJS.js";
|
|
5
5
|
import {
|
|
6
6
|
blockedActionFingerprint,
|
|
7
7
|
defersToNativeMode,
|
|
8
8
|
forgetBlockedActionHint,
|
|
9
9
|
hasBlockedActionHint,
|
|
10
|
-
recordBlockedActionHint
|
|
11
|
-
|
|
10
|
+
recordBlockedActionHint,
|
|
11
|
+
reportMachineDenial
|
|
12
|
+
} from "./chunk-SUWRZYQG.js";
|
|
12
13
|
import {
|
|
13
14
|
isGatingMoment,
|
|
14
15
|
recordKeylessMoment
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LEAAERSQ.js";
|
|
16
17
|
import {
|
|
17
18
|
denyReasonFrom,
|
|
18
19
|
isDeferAnswer
|
|
19
20
|
} from "./chunk-YHG74UFF.js";
|
|
20
21
|
import {
|
|
21
|
-
AUTO_DECISION_WINDOW_MS,
|
|
22
22
|
DEFAULT_SESSION,
|
|
23
23
|
UNNAMED_ACTION,
|
|
24
|
+
claimThrottle,
|
|
24
25
|
deriveAction,
|
|
25
26
|
deriveActionBody,
|
|
26
27
|
deriveBlocker,
|
|
@@ -34,9 +35,8 @@ import {
|
|
|
34
35
|
repoKeyFor,
|
|
35
36
|
reportEvent,
|
|
36
37
|
scopePathFor,
|
|
37
|
-
settleQuestionsForToolUse
|
|
38
|
-
|
|
39
|
-
} from "./chunk-LNGYW6G4.js";
|
|
38
|
+
settleQuestionsForToolUse
|
|
39
|
+
} from "./chunk-G653QPTR.js";
|
|
40
40
|
import {
|
|
41
41
|
DECISION_STOP_REASON,
|
|
42
42
|
askUser,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "./chunk-LGXUGYUH.js";
|
|
52
52
|
import {
|
|
53
53
|
getMachineId
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-NHTAHAIS.js";
|
|
55
55
|
import {
|
|
56
56
|
getApiKey,
|
|
57
57
|
getBaseUrl
|
|
@@ -75,13 +75,11 @@ import {
|
|
|
75
75
|
isBlockedActionRequest,
|
|
76
76
|
isPermissionRequestOwnedByPreToolUse,
|
|
77
77
|
isPusharyOwnTool,
|
|
78
|
-
machineDecisionFor,
|
|
79
78
|
parseAgentQuestionAnswers,
|
|
80
79
|
parseAgentQuestions,
|
|
81
80
|
resolveGate,
|
|
82
|
-
stoppedOutput
|
|
83
|
-
|
|
84
|
-
} from "./chunk-FVKFDTN6.js";
|
|
81
|
+
stoppedOutput
|
|
82
|
+
} from "./chunk-SOUZBGYJ.js";
|
|
85
83
|
|
|
86
84
|
// src/decision-episode.ts
|
|
87
85
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -118,31 +116,6 @@ var deny = (reason) => claudePreToolUseOutput("deny", reason);
|
|
|
118
116
|
var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
|
|
119
117
|
var ask = (reason) => claudePreToolUseOutput("ask", reason);
|
|
120
118
|
var halted = (reason) => stoppedOutput(deny(reason), reason);
|
|
121
|
-
var reportMachineDecision = async (input, verdict) => {
|
|
122
|
-
const decision = machineDecisionFor(wireVerdictFor(verdict, 0));
|
|
123
|
-
if (!decision) return;
|
|
124
|
-
const sessionKey = input.session_id || DEFAULT_SESSION;
|
|
125
|
-
const toolTarget = deriveToolTarget(input.tool_name, input.tool_input);
|
|
126
|
-
const throttleKey = `machinedecision:${sessionKey}:${input.tool_name}:${decision.origin}:${toolTarget ?? ""}`;
|
|
127
|
-
if (!throttlePass(throttleKey, AUTO_DECISION_WINDOW_MS)) return;
|
|
128
|
-
await reportEvent(
|
|
129
|
-
{
|
|
130
|
-
event: "permission_denied",
|
|
131
|
-
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
132
|
-
toolUseId: input.tool_use_id,
|
|
133
|
-
agentType: ACTIVE_AGENT.type,
|
|
134
|
-
agentName: agentNameIn(basename(input.cwd ?? process.cwd())),
|
|
135
|
-
action: permissionDeniedAction(input.tool_name),
|
|
136
|
-
sessionId: input.session_id,
|
|
137
|
-
decisionSource: "policy_auto",
|
|
138
|
-
decisionOrigin: decision.origin,
|
|
139
|
-
decisionOutcome: decision.outcome,
|
|
140
|
-
toolName: input.tool_name,
|
|
141
|
-
toolTarget
|
|
142
|
-
},
|
|
143
|
-
{ maxAttempts: 1, timeoutMs: 800 }
|
|
144
|
-
).catch(() => void 0);
|
|
145
|
-
};
|
|
146
119
|
var storedWaitDeadline = (result, requestedDeadline) => {
|
|
147
120
|
const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
|
|
148
121
|
return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
|
|
@@ -556,11 +529,11 @@ var handlePreToolUse = async (input, canonical) => {
|
|
|
556
529
|
const gateInput = claudeGateInput(modeState, policy, input, canonical);
|
|
557
530
|
const verdict = resolveGate(gateInput);
|
|
558
531
|
if (verdict.kind === "kill") {
|
|
559
|
-
await
|
|
532
|
+
await reportMachineDenial(input, verdict, ACTIVE_AGENT);
|
|
560
533
|
return halted(verdict.reason);
|
|
561
534
|
}
|
|
562
535
|
if (verdict.kind === "deny") {
|
|
563
|
-
await
|
|
536
|
+
await reportMachineDenial(input, verdict, ACTIVE_AGENT);
|
|
564
537
|
return deny(verdict.reason);
|
|
565
538
|
}
|
|
566
539
|
if (canonical === null) return deny(unreadableReason);
|
|
@@ -618,11 +591,11 @@ var handlePermissionRequest = async (input, canonical) => {
|
|
|
618
591
|
const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
|
|
619
592
|
const verdict = resolveGate(claudeGateInput(modeState, policy, input, canonical));
|
|
620
593
|
if (verdict.kind === "kill") {
|
|
621
|
-
await
|
|
594
|
+
await reportMachineDenial(input, verdict, ACTIVE_AGENT);
|
|
622
595
|
return permReqHalted(verdict.reason);
|
|
623
596
|
}
|
|
624
597
|
if (verdict.kind === "deny") {
|
|
625
|
-
await
|
|
598
|
+
await reportMachineDenial(input, verdict, ACTIVE_AGENT);
|
|
626
599
|
return permReqDeny(verdict.reason);
|
|
627
600
|
}
|
|
628
601
|
if (canonical === null) return permReqDeny(unreadableReason);
|
|
@@ -662,7 +635,7 @@ var PERMISSION_DENIED_NOTICE_WINDOW_MS = 5 * 60 * 1e3;
|
|
|
662
635
|
var blockedActionHoldEndsAt = (holdBudgetSeconds) => START_MS + hookHoldWindowMs("claude", holdBudgetSeconds);
|
|
663
636
|
var notifyPermissionDenied = async (apiKey, input) => {
|
|
664
637
|
const sessionKey = input.session_id || DEFAULT_SESSION;
|
|
665
|
-
if (
|
|
638
|
+
if (claimThrottle(`permdenied:${sessionKey}:${input.tool_name}`, PERMISSION_DENIED_NOTICE_WINDOW_MS) !== "passed") return;
|
|
666
639
|
const mode = await fetchModeState(apiKey, input.session_id).catch(() => null);
|
|
667
640
|
if (mode?.kill || mode?.mode === "terminal_only") return;
|
|
668
641
|
const projectName = basename(input.cwd ?? process.cwd());
|
|
@@ -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-
|
|
11
|
+
} from "./chunk-ACYIZ3KH.js";
|
|
12
|
+
import "./chunk-PC6DU5C4.js";
|
|
13
|
+
import "./chunk-II7PUMPB.js";
|
|
14
|
+
import "./chunk-WPVHRUDT.js";
|
|
15
|
+
import "./chunk-LPYCPFBZ.js";
|
|
16
|
+
import "./chunk-YXP3WPAI.js";
|
|
17
|
+
import "./chunk-TRLFZKVG.js";
|
|
18
18
|
import "./chunk-T7E75EKA.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-SOUZBGYJ.js";
|
|
20
20
|
export {
|
|
21
21
|
inspectConfiguredManagedProviders,
|
|
22
22
|
reapplyAllAgents,
|
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-XDP3UYH5.js";
|
|
4
|
+
import "../chunk-VIOL2DJS.js";
|
|
5
|
+
import "../chunk-II7PUMPB.js";
|
|
6
|
+
import "../chunk-SUWRZYQG.js";
|
|
7
|
+
import "../chunk-LEAAERSQ.js";
|
|
8
8
|
import "../chunk-YHG74UFF.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-LPYCPFBZ.js";
|
|
10
10
|
import {
|
|
11
11
|
fetchAccountPublicKey
|
|
12
12
|
} from "../chunk-EQRS3SGM.js";
|
|
@@ -18,20 +18,20 @@ import {
|
|
|
18
18
|
handlePostToolUse,
|
|
19
19
|
handleStop,
|
|
20
20
|
reportEvent
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-G653QPTR.js";
|
|
22
|
+
import "../chunk-YXP3WPAI.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-NHTAHAIS.js";
|
|
29
|
+
import "../chunk-TRLFZKVG.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-
|
|
34
|
+
import "../chunk-UM5J3J4V.js";
|
|
35
35
|
import "../chunk-T7E75EKA.js";
|
|
36
36
|
import {
|
|
37
37
|
getApiKey,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
} from "../chunk-2UMNXADU.js";
|
|
40
40
|
import {
|
|
41
41
|
resolvePolicy
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-SOUZBGYJ.js";
|
|
43
43
|
export {
|
|
44
44
|
askUser,
|
|
45
45
|
cancelQuestion,
|