@pushary/agent-hooks 0.99.0 → 1.1.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 +14 -0
- package/data/SKILL.md +250 -49
- package/data/cursor-plugin/scripts/pushary-gate.mjs +24 -0
- package/data/cursor-plugin/skills/pushary/SKILL.md +250 -49
- package/data/vscode-plugin/scripts/pushary-gate.mjs +24 -0
- package/data/vscode-plugin/skills/pushary/SKILL.md +250 -49
- package/dist/bin/pushary-bell-hook.js +18 -18
- package/dist/bin/pushary-bell.js +6 -6
- package/dist/bin/pushary-claude.js +22 -24
- package/dist/bin/pushary-clean.js +60 -18
- package/dist/bin/pushary-codex-bridge.js +10 -10
- package/dist/bin/pushary-codex-hook.js +33 -35
- package/dist/bin/pushary-codex.js +6 -7
- 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 +48 -7
- package/dist/bin/pushary-doctor.js +88 -19
- 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 +25 -27
- package/dist/bin/pushary-hook.js +61 -33
- 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 +26 -21
- package/dist/bin/pushary-opencode-hook.js +27 -29
- package/dist/bin/pushary-permission-denied-hook.js +24 -23
- package/dist/bin/pushary-permission-hook.js +32 -24
- package/dist/bin/pushary-post-hook.js +30 -22
- package/dist/bin/pushary-prompt-hook.js +26 -21
- package/dist/bin/pushary-session-end-hook.js +26 -21
- package/dist/bin/pushary-session-start-hook.js +30 -25
- package/dist/bin/pushary-setup.js +145 -37
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +10 -10
- package/dist/bin/pushary-stop-hook.js +27 -22
- package/dist/bin/pushary-stopfailure-hook.js +26 -21
- 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-ID5FDKDZ.js → chunk-2MOQUNFL.js} +1 -1
- package/dist/{chunk-CRFLU455.js → chunk-6JUCFMSF.js} +3 -3
- package/dist/{chunk-QS55LDX4.js → chunk-6T4OINZB.js} +16 -16
- package/dist/{chunk-6C6MS57P.js → chunk-76ZCJZBK.js} +1 -1
- package/dist/{chunk-JXELRCU5.js → chunk-AH5OO2YZ.js} +3 -3
- package/dist/{chunk-XPPXOKIG.js → chunk-BBUZD7MU.js} +1 -1
- package/dist/{chunk-T3JZZUAR.js → chunk-DKTFZCLQ.js} +30 -29
- package/dist/{chunk-RALVI7OF.js → chunk-DZYIAMKR.js} +9 -6
- package/dist/{chunk-GCD3SQSV.js → chunk-E3WQMDCE.js} +1 -1
- package/dist/{chunk-JBJBVERL.js → chunk-EWQZISYV.js} +1 -1
- package/dist/{chunk-LWKPMSBB.js → chunk-EZ3GX3NS.js} +5 -5
- package/dist/{chunk-5KLAETSU.js → chunk-FO4HHPMO.js} +1 -1
- package/dist/{chunk-6KLCP7VF.js → chunk-IH7YUPFN.js} +3 -3
- package/dist/{chunk-OPR2BPD4.js → chunk-INBTKFT6.js} +1 -1
- package/dist/{chunk-K4XFCEVI.js → chunk-IPDBFJ2M.js} +1 -1
- package/dist/{chunk-6IFUXNFX.js → chunk-ISELLVBP.js} +1 -1
- package/dist/{chunk-562UJ2DA.js → chunk-J7PJALS2.js} +1 -1
- package/dist/{chunk-O3LZQEQP.js → chunk-LQ3BHPPZ.js} +1 -1
- package/dist/{chunk-3RVCQDC4.js → chunk-LUYYB6V2.js} +1 -1
- package/dist/{chunk-V262ATS5.js → chunk-MR2PWE62.js} +17 -3
- package/dist/{chunk-WGV3VY7O.js → chunk-MZUXTN7X.js} +2 -2
- package/dist/{chunk-LBNAGGLV.js → chunk-OYYQHJAO.js} +3 -2
- package/dist/{chunk-4C4XFAGJ.js → chunk-PHJOSAXW.js} +2 -2
- package/dist/{chunk-SI7GYBQP.js → chunk-PQG6NTPT.js} +1 -1
- package/dist/{chunk-3ZAEUPM4.js → chunk-PUDQJ772.js} +1 -1
- package/dist/{chunk-NSFNEDCT.js → chunk-PWIMJP4U.js} +6 -6
- package/dist/{chunk-JL33EDN7.js → chunk-QACXZYDA.js} +4 -4
- package/dist/{chunk-CP34FI4B.js → chunk-RZTH4MIY.js} +2 -2
- package/dist/{chunk-HB2KB7QL.js → chunk-S2BNTXP6.js} +1 -1
- package/dist/{chunk-EXHXR2X5.js → chunk-SA6UB3GD.js} +1 -1
- package/dist/{chunk-IRLTW6KF.js → chunk-SLEWDZOA.js} +1 -1
- package/dist/chunk-SM54HHVY.js +224 -0
- package/dist/{chunk-4PBCNVI3.js → chunk-UP7NZXJU.js} +1 -1
- package/dist/{chunk-XOOWC62T.js → chunk-VACFOGF3.js} +1 -1
- package/dist/{chunk-OUAE3GKO.js → chunk-VQYARC2K.js} +279 -1
- package/dist/{chunk-64WARXGV.js → chunk-WTT24AUA.js} +698 -43
- package/dist/{chunk-K6BASBQJ.js → chunk-XIHKSZHL.js} +1 -1
- package/dist/{chunk-PD6JY33P.js → chunk-YM4G6CFN.js} +4 -3
- package/dist/{reapply-HQ264ZTR.js → reapply-STSGYPF2.js} +8 -8
- package/dist/src/index.js +12 -10
- package/package.json +1 -1
- package/dist/chunk-A76GNRIK.js +0 -608
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
} from "../chunk-YKLCWWEI.js";
|
|
7
7
|
import {
|
|
8
8
|
transcriptsEnabled
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-2MOQUNFL.js";
|
|
10
10
|
import {
|
|
11
11
|
exitOnHelpFlag
|
|
12
12
|
} from "../chunk-GOQHN2UH.js";
|
|
13
13
|
import "../chunk-LZQVAEWP.js";
|
|
14
14
|
import "../chunk-DINDL2CF.js";
|
|
15
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-UP7NZXJU.js";
|
|
16
16
|
import "../chunk-KZERVKTD.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-E3WQMDCE.js";
|
|
18
18
|
import "../chunk-4LL6LG5X.js";
|
|
19
19
|
import "../chunk-2UMNXADU.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-VQYARC2K.js";
|
|
21
21
|
|
|
22
22
|
// bin/pushary-transcripts.ts
|
|
23
23
|
exitOnHelpFlag("transcripts");
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reapplyAllAgents
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-EZ3GX3NS.js";
|
|
5
|
+
import "../chunk-IPDBFJ2M.js";
|
|
6
6
|
import {
|
|
7
7
|
waitForMachineReadiness
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-QACXZYDA.js";
|
|
9
|
+
import "../chunk-6T4OINZB.js";
|
|
10
10
|
import {
|
|
11
11
|
detectProviderLiveCapabilities,
|
|
12
12
|
hasSpawnProvider,
|
|
13
13
|
resolveControlPolicy
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-MZUXTN7X.js";
|
|
15
|
+
import "../chunk-AH5OO2YZ.js";
|
|
16
16
|
import {
|
|
17
17
|
daemonHasRemoteProof,
|
|
18
18
|
daemonServiceManagerAvailable,
|
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
replaceDaemonService,
|
|
24
24
|
stopDaemonService,
|
|
25
25
|
waitForDaemonRemoteProof
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-6JUCFMSF.js";
|
|
27
|
+
import "../chunk-YM4G6CFN.js";
|
|
28
28
|
import {
|
|
29
29
|
needsShell
|
|
30
30
|
} from "../chunk-XHKBHWLX.js";
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-INBTKFT6.js";
|
|
32
|
+
import "../chunk-J7PJALS2.js";
|
|
33
33
|
import {
|
|
34
34
|
claudeJson,
|
|
35
35
|
codexConfigToml,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
npmErrorMessage,
|
|
40
40
|
resolveGlobalBinary,
|
|
41
41
|
vscodePluginDir
|
|
42
|
-
} from "../chunk-
|
|
42
|
+
} from "../chunk-EWQZISYV.js";
|
|
43
43
|
import {
|
|
44
44
|
exitOnHelpFlag
|
|
45
45
|
} from "../chunk-GOQHN2UH.js";
|
|
@@ -49,14 +49,14 @@ import {
|
|
|
49
49
|
} from "../chunk-DINDL2CF.js";
|
|
50
50
|
import {
|
|
51
51
|
readControlMode
|
|
52
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-UP7NZXJU.js";
|
|
53
53
|
import "../chunk-KZERVKTD.js";
|
|
54
|
-
import "../chunk-
|
|
54
|
+
import "../chunk-E3WQMDCE.js";
|
|
55
55
|
import "../chunk-4LL6LG5X.js";
|
|
56
56
|
import {
|
|
57
57
|
getApiKey
|
|
58
58
|
} from "../chunk-2UMNXADU.js";
|
|
59
|
-
import "../chunk-
|
|
59
|
+
import "../chunk-VQYARC2K.js";
|
|
60
60
|
|
|
61
61
|
// bin/pushary-upgrade.ts
|
|
62
62
|
import { existsSync } from "fs";
|
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-CVWG2N3Y.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnFailedResponse
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-76ZCJZBK.js";
|
|
8
|
+
import "../chunk-LUYYB6V2.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getApiKey,
|
|
29
29
|
getBaseUrl
|
|
30
30
|
} from "../chunk-2UMNXADU.js";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-VQYARC2K.js";
|
|
32
32
|
|
|
33
33
|
// bin/pushary-wait.ts
|
|
34
34
|
exitOnHelpFlag("wait");
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
getMachineId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-J7PJALS2.js";
|
|
8
8
|
import {
|
|
9
9
|
pusharyDir,
|
|
10
10
|
resolveGlobalBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EWQZISYV.js";
|
|
12
12
|
import {
|
|
13
13
|
getPackageVersion
|
|
14
14
|
} from "./chunk-DINDL2CF.js";
|
|
15
15
|
import {
|
|
16
16
|
readControlMode
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UP7NZXJU.js";
|
|
18
18
|
import {
|
|
19
19
|
readJsonSafe,
|
|
20
20
|
writeFileAtomic,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
supportedClaudeEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YM4G6CFN.js";
|
|
5
5
|
import {
|
|
6
6
|
guardBinary,
|
|
7
7
|
holdBudgetOf,
|
|
8
8
|
isProtectedByScope,
|
|
9
9
|
registerHookEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EWQZISYV.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_LOCATOR_BINARY,
|
|
13
13
|
withHookHoldBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VQYARC2K.js";
|
|
15
15
|
|
|
16
16
|
// src/claude-config.ts
|
|
17
17
|
import { join } from "path";
|
|
@@ -113,6 +113,16 @@ var removeClaudeMcpServers = (config) => {
|
|
|
113
113
|
}
|
|
114
114
|
return changed;
|
|
115
115
|
};
|
|
116
|
+
var removePusharyToolPermissions = (settings) => {
|
|
117
|
+
const permissions = asRecord(settings.permissions);
|
|
118
|
+
if (!permissions || !Array.isArray(permissions.allow)) return false;
|
|
119
|
+
const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
|
|
120
|
+
if (filtered.length === permissions.allow.length) return false;
|
|
121
|
+
if (filtered.length === 0) delete permissions.allow;
|
|
122
|
+
else permissions.allow = filtered;
|
|
123
|
+
if (Object.keys(permissions).length === 0) delete settings.permissions;
|
|
124
|
+
return true;
|
|
125
|
+
};
|
|
116
126
|
var addPusharyToolPermissions = (settings) => {
|
|
117
127
|
const permissions = ensureRecord(settings, "permissions");
|
|
118
128
|
const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
|
|
@@ -151,19 +161,7 @@ var entry = (definition, resolve) => ({
|
|
|
151
161
|
});
|
|
152
162
|
var removePusharySettings = (settings, scope) => {
|
|
153
163
|
let changed = scope?.keepMcpServer === true ? false : removeClaudeMcpServers(settings);
|
|
154
|
-
|
|
155
|
-
if (permissions && Array.isArray(permissions.allow)) {
|
|
156
|
-
const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
|
|
157
|
-
if (filtered.length !== permissions.allow.length) {
|
|
158
|
-
if (filtered.length === 0) {
|
|
159
|
-
delete permissions.allow;
|
|
160
|
-
} else {
|
|
161
|
-
permissions.allow = filtered;
|
|
162
|
-
}
|
|
163
|
-
if (Object.keys(permissions).length === 0) delete settings.permissions;
|
|
164
|
-
changed = true;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
164
|
+
if (scope?.keepMcpServer !== true && removePusharyToolPermissions(settings)) changed = true;
|
|
167
165
|
const hooks = asRecord(settings.hooks);
|
|
168
166
|
if (hooks) {
|
|
169
167
|
for (const { event: key } of CLAUDE_HOOK_EVENTS) {
|
|
@@ -185,12 +183,14 @@ var removePusharySettings = (settings, scope) => {
|
|
|
185
183
|
};
|
|
186
184
|
|
|
187
185
|
export {
|
|
186
|
+
isPusharyHook,
|
|
188
187
|
addClaudeMcpServer,
|
|
189
188
|
isClaudeMcpSnapshot,
|
|
190
189
|
captureClaudeMcpServer,
|
|
191
190
|
updateClaudeMcpSnapshot,
|
|
192
191
|
restoreClaudeMcpServer,
|
|
193
192
|
removeClaudeMcpServers,
|
|
193
|
+
removePusharyToolPermissions,
|
|
194
194
|
addPusharyToolPermissions,
|
|
195
195
|
addPusharyHooks,
|
|
196
196
|
removePusharySettings
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YM4G6CFN.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EWQZISYV.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-VQYARC2K.js";
|
|
16
16
|
|
|
17
17
|
// src/diagnostics/wiring.ts
|
|
18
18
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
activeIdentity
|
|
3
|
+
} from "./chunk-SM54HHVY.js";
|
|
1
4
|
import {
|
|
2
5
|
blockedActionFingerprint,
|
|
3
6
|
defersToNativeMode,
|
|
4
7
|
forgetBlockedActionHint,
|
|
5
8
|
hasBlockedActionHint,
|
|
6
9
|
recordBlockedActionHint
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IH7YUPFN.js";
|
|
8
11
|
import {
|
|
9
12
|
isGatingMoment,
|
|
10
13
|
recordKeylessMoment
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VACFOGF3.js";
|
|
12
15
|
import {
|
|
13
16
|
denyReasonFrom,
|
|
14
17
|
isDeferAnswer
|
|
15
18
|
} from "./chunk-YHG74UFF.js";
|
|
16
19
|
import {
|
|
17
|
-
CLAUDE_CODE_AGENT,
|
|
18
20
|
DEFAULT_SESSION,
|
|
21
|
+
UNNAMED_ACTION,
|
|
22
|
+
deriveAction,
|
|
23
|
+
deriveActionBody,
|
|
24
|
+
deriveBlocker,
|
|
25
|
+
deriveToolTarget,
|
|
26
|
+
describeToolCall,
|
|
19
27
|
fetchModeState,
|
|
20
28
|
getPolicy,
|
|
29
|
+
permissionDeniedAction,
|
|
21
30
|
readLastPrompt,
|
|
22
31
|
readLastUserPrompt,
|
|
23
32
|
repoKeyFor,
|
|
24
33
|
reportEvent,
|
|
34
|
+
scopePathFor,
|
|
25
35
|
settleQuestionsForToolUse,
|
|
26
36
|
throttlePass
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import {
|
|
29
|
-
UNNAMED_ACTION,
|
|
30
|
-
deriveAction,
|
|
31
|
-
deriveActionBody,
|
|
32
|
-
deriveBlocker,
|
|
33
|
-
deriveToolTarget,
|
|
34
|
-
describeToolCall,
|
|
35
|
-
permissionDeniedAction,
|
|
36
|
-
scopePathFor
|
|
37
|
-
} from "./chunk-A76GNRIK.js";
|
|
37
|
+
} from "./chunk-WTT24AUA.js";
|
|
38
38
|
import {
|
|
39
39
|
DECISION_STOP_REASON,
|
|
40
40
|
askUser,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
} from "./chunk-LGXUGYUH.js";
|
|
50
50
|
import {
|
|
51
51
|
getMachineId
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-J7PJALS2.js";
|
|
53
53
|
import {
|
|
54
54
|
getApiKey,
|
|
55
55
|
getBaseUrl
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
parseAgentQuestions,
|
|
74
74
|
resolveGate,
|
|
75
75
|
stoppedOutput
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-VQYARC2K.js";
|
|
77
77
|
|
|
78
78
|
// src/decision-episode.ts
|
|
79
79
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -102,6 +102,8 @@ import { basename, join } from "path";
|
|
|
102
102
|
import { tmpdir } from "os";
|
|
103
103
|
import { existsSync, writeFileSync } from "fs";
|
|
104
104
|
var START_MS = Date.now();
|
|
105
|
+
var ACTIVE_AGENT = activeIdentity(process.argv);
|
|
106
|
+
var agentNameIn = (projectName) => `${ACTIVE_AGENT.label} - ${projectName}`;
|
|
105
107
|
var allow = (reason) => claudePreToolUseOutput("allow", reason);
|
|
106
108
|
var deny = (reason) => claudePreToolUseOutput("deny", reason);
|
|
107
109
|
var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
|
|
@@ -122,7 +124,7 @@ var handlePushOnly = async (apiKey, description, projectName, timeoutSeconds, ti
|
|
|
122
124
|
question: `Allow ${description || UNNAMED_ACTION}?`,
|
|
123
125
|
type: "confirm",
|
|
124
126
|
context: `Agent wants to run this in ${projectName}`,
|
|
125
|
-
agentName:
|
|
127
|
+
agentName: agentNameIn(projectName),
|
|
126
128
|
sessionId,
|
|
127
129
|
machineId,
|
|
128
130
|
toolName,
|
|
@@ -167,7 +169,7 @@ var handlePushFirst = async (apiKey, description, projectName, pushFirstSeconds,
|
|
|
167
169
|
question: `Allow ${description || UNNAMED_ACTION}?`,
|
|
168
170
|
type: "confirm",
|
|
169
171
|
context: `Agent wants to run this in ${projectName}`,
|
|
170
|
-
agentName:
|
|
172
|
+
agentName: agentNameIn(projectName),
|
|
171
173
|
sessionId,
|
|
172
174
|
machineId,
|
|
173
175
|
toolName,
|
|
@@ -195,7 +197,7 @@ var handleNotifyOnly = async (apiKey, description, projectName, sessionId, machi
|
|
|
195
197
|
await sendNotification(apiKey, {
|
|
196
198
|
title: "Agent needs approval",
|
|
197
199
|
body: description,
|
|
198
|
-
agentName:
|
|
200
|
+
agentName: agentNameIn(projectName),
|
|
199
201
|
sessionId,
|
|
200
202
|
machineId
|
|
201
203
|
});
|
|
@@ -203,7 +205,6 @@ var handleNotifyOnly = async (apiKey, description, projectName, sessionId, machi
|
|
|
203
205
|
}
|
|
204
206
|
return ask();
|
|
205
207
|
};
|
|
206
|
-
var CLAUDE_AGENT_TYPE = "claude_code";
|
|
207
208
|
var emitDecisionEpisode = (apiKey, input, toolPolicy, machineId, toolTarget, decision, result) => {
|
|
208
209
|
const verdict = result?.hookSpecificOutput?.permissionDecision;
|
|
209
210
|
const outcome = verdict === "allow" ? "approve" : verdict === "deny" ? "deny" : null;
|
|
@@ -215,7 +216,7 @@ var emitDecisionEpisode = (apiKey, input, toolPolicy, machineId, toolTarget, dec
|
|
|
215
216
|
commandOrPath,
|
|
216
217
|
intent: decision.intent,
|
|
217
218
|
toolTarget,
|
|
218
|
-
agentType:
|
|
219
|
+
agentType: ACTIVE_AGENT.type,
|
|
219
220
|
matchedPattern: toolPolicy.tool,
|
|
220
221
|
policyMode: toolPolicy.mode,
|
|
221
222
|
timeoutSeconds: toolPolicy.timeoutSeconds,
|
|
@@ -327,7 +328,7 @@ var askAsOneCard = async (apiKey, input, parsed, projectName, deadline) => {
|
|
|
327
328
|
options: [...only.labels],
|
|
328
329
|
questions: parsed.map(withoutLabels),
|
|
329
330
|
context: questionContext(only, 0, 1, projectName),
|
|
330
|
-
agentName:
|
|
331
|
+
agentName: agentNameIn(projectName),
|
|
331
332
|
sessionId: input.session_id,
|
|
332
333
|
machineId: getMachineId(),
|
|
333
334
|
toolName: "AskUserQuestion",
|
|
@@ -357,7 +358,7 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
|
|
|
357
358
|
options: [...question.labels],
|
|
358
359
|
questions: [withoutLabels(question)],
|
|
359
360
|
context: questionContext(question, index, parsed.length, projectName),
|
|
360
|
-
agentName:
|
|
361
|
+
agentName: agentNameIn(projectName),
|
|
361
362
|
sessionId: input.session_id,
|
|
362
363
|
machineId: getMachineId(),
|
|
363
364
|
toolName: "AskUserQuestion",
|
|
@@ -409,7 +410,7 @@ var handleExitPlanMode = async (apiKey, input) => {
|
|
|
409
410
|
type: "select",
|
|
410
411
|
options: [PLAN_APPROVE, PLAN_KEEP_PLANNING],
|
|
411
412
|
context: `Your agent finished planning in ${projectName} and is waiting to start.`,
|
|
412
|
-
agentName:
|
|
413
|
+
agentName: agentNameIn(projectName),
|
|
413
414
|
sessionId: input.session_id,
|
|
414
415
|
machineId: getMachineId(),
|
|
415
416
|
toolName: "ExitPlanMode",
|
|
@@ -511,7 +512,7 @@ var handlePreToolUse = async (input) => {
|
|
|
511
512
|
}
|
|
512
513
|
try {
|
|
513
514
|
const modeState = await fetchModeState(apiKey, input.session_id);
|
|
514
|
-
const policy = await getPolicy(apiKey, modeState.policyVersion,
|
|
515
|
+
const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
|
|
515
516
|
const verdict = resolveGate(claudeGateInput(modeState, policy, input));
|
|
516
517
|
if (verdict.kind === "kill") return halted(verdict.reason);
|
|
517
518
|
if (verdict.kind === "deny") return deny(verdict.reason);
|
|
@@ -563,7 +564,7 @@ var handlePermissionRequest = async (input) => {
|
|
|
563
564
|
}
|
|
564
565
|
try {
|
|
565
566
|
const modeState = await fetchModeState(apiKey, input.session_id);
|
|
566
|
-
const policy = await getPolicy(apiKey, modeState.policyVersion,
|
|
567
|
+
const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
|
|
567
568
|
const verdict = resolveGate(claudeGateInput(modeState, policy, input));
|
|
568
569
|
switch (verdict.kind) {
|
|
569
570
|
case "kill":
|
|
@@ -588,8 +589,8 @@ var reportPermissionDenied = (input) => reportEvent({
|
|
|
588
589
|
event: "permission_denied",
|
|
589
590
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
590
591
|
toolUseId: input.tool_use_id,
|
|
591
|
-
agentType:
|
|
592
|
-
agentName:
|
|
592
|
+
agentType: ACTIVE_AGENT.type,
|
|
593
|
+
agentName: agentNameIn(basename(input.cwd ?? process.cwd())),
|
|
593
594
|
action: permissionDeniedAction(input.tool_name),
|
|
594
595
|
sessionId: input.session_id
|
|
595
596
|
// Side report, not a command carrier. Without timeoutMs this takes the phone's
|
|
@@ -609,7 +610,7 @@ var notifyPermissionDenied = async (apiKey, input) => {
|
|
|
609
610
|
await sendNotification(apiKey, {
|
|
610
611
|
title: `Auto mode blocked ${input.tool_name}`,
|
|
611
612
|
body: `Your agent was denied ${input.tool_name} in ${projectName}.`,
|
|
612
|
-
agentName:
|
|
613
|
+
agentName: agentNameIn(projectName),
|
|
613
614
|
sessionId: input.session_id
|
|
614
615
|
}, 4e3).catch(() => void 0);
|
|
615
616
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_CHOICES
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OYYQHJAO.js";
|
|
4
4
|
import {
|
|
5
5
|
isBridgeLocator
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SLEWDZOA.js";
|
|
7
7
|
import {
|
|
8
8
|
pusharyHookExecutable
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AH5OO2YZ.js";
|
|
10
10
|
import {
|
|
11
11
|
BELL_HOOK_BINARY
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SA6UB3GD.js";
|
|
13
13
|
|
|
14
14
|
// src/setup/hook-ownership.ts
|
|
15
15
|
var commandsIn = (value) => {
|
|
@@ -100,8 +100,11 @@ var restoreHookTakeover = (document, receipt) => {
|
|
|
100
100
|
document.hooks = hooks;
|
|
101
101
|
return JSON.stringify(document) !== before;
|
|
102
102
|
};
|
|
103
|
-
var hookOwnerOf = (document, appAvailable = true) => {
|
|
104
|
-
const hooks =
|
|
103
|
+
var hookOwnerOf = (document, appAvailable = true, hooksKeyPath = ["hooks"]) => {
|
|
104
|
+
const hooks = hooksKeyPath.reduce(
|
|
105
|
+
(node, key) => node && typeof node === "object" ? node[key] : void 0,
|
|
106
|
+
document
|
|
107
|
+
);
|
|
105
108
|
const executables = commandsIn(hooks).map(pusharyHookExecutable).filter((executable) => executable !== null);
|
|
106
109
|
if (appAvailable && executables.some(isBridgeLocator)) return "app";
|
|
107
110
|
if (executables.some((executable) => !isBridgeLocator(executable))) return "cli";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IPDBFJ2M.js";
|
|
4
4
|
import {
|
|
5
5
|
addClaudeMcpServer,
|
|
6
6
|
addPusharyHooks,
|
|
7
7
|
addPusharyToolPermissions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6T4OINZB.js";
|
|
9
9
|
import {
|
|
10
10
|
claudeUnprovenHolds,
|
|
11
11
|
claudeWired,
|
|
12
12
|
codexUnprovenHolds,
|
|
13
13
|
codexWired,
|
|
14
14
|
geminiWired
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AH5OO2YZ.js";
|
|
16
16
|
import {
|
|
17
17
|
CLAUDE_HOOK_BINARY,
|
|
18
18
|
CLAUDE_HOOK_EVENTS,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
needsReregistration,
|
|
25
25
|
registrationSignatures,
|
|
26
26
|
supportedClaudeEvents
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-YM4G6CFN.js";
|
|
28
28
|
import {
|
|
29
29
|
CODEX_HOOK_BINARY,
|
|
30
30
|
addCodexHookTrust,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
registrationHolderOf,
|
|
45
45
|
resolveGlobalBinary,
|
|
46
46
|
vscodePluginMcp
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-EWQZISYV.js";
|
|
48
48
|
import {
|
|
49
49
|
readJsonSafe,
|
|
50
50
|
writeFileAtomic,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalGateInputs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTT24AUA.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EWQZISYV.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
9
|
} from "./chunk-4LL6LG5X.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
BLOCKED_ACTION_GRANT_TTL_SECONDS,
|
|
12
12
|
blockedActionIdentity,
|
|
13
13
|
shouldDeferToNativeMode
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VQYARC2K.js";
|
|
15
15
|
|
|
16
16
|
// src/native-defer.ts
|
|
17
17
|
var nativeDeferOptions = () => {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey,
|
|
15
15
|
normalizeKeyScope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VQYARC2K.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;
|