@pushary/agent-hooks 1.3.0 → 1.3.1
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 +7 -0
- 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 +7 -7
- package/dist/bin/pushary-claude.js +20 -20
- package/dist/bin/pushary-clean.js +21 -21
- package/dist/bin/pushary-codex-bridge.js +11 -11
- package/dist/bin/pushary-codex-hook.js +24 -24
- package/dist/bin/pushary-codex.js +7 -7
- package/dist/bin/pushary-connect.js +7 -7
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +24 -24
- package/dist/bin/pushary-disconnect.js +11 -11
- package/dist/bin/pushary-doctor.js +35 -22
- 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 +30 -40
- package/dist/bin/pushary-login.js +8 -8
- package/dist/bin/pushary-logout.js +5 -5
- package/dist/bin/pushary-mode.js +3 -3
- 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 +30 -29
- 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 +27 -27
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +11 -11
- package/dist/bin/pushary-stop-hook.js +22 -22
- package/dist/bin/pushary-stopfailure-hook.js +22 -22
- package/dist/bin/pushary-transcript-register.js +18 -18
- package/dist/bin/pushary-transcripts.js +6 -6
- package/dist/bin/pushary-upgrade.js +15 -15
- package/dist/bin/pushary-wait.js +3 -3
- package/dist/{chunk-RHLUJE4H.js → chunk-34NNTYK6.js} +1 -1
- package/dist/{chunk-EJZCV5G4.js → chunk-35RPUNYU.js} +1 -1
- package/dist/{chunk-K7UIAE7I.js → chunk-465UENKO.js} +2 -2
- package/dist/{chunk-XBO42HKH.js → chunk-5SALHATY.js} +2 -2
- package/dist/{chunk-WPJS3OZH.js → chunk-5UWDYOZX.js} +20 -1
- package/dist/{chunk-POAFXBNH.js → chunk-5WLH2ENB.js} +1 -1
- package/dist/{chunk-KPNGPRYU.js → chunk-5XKMOZO6.js} +4 -4
- package/dist/{chunk-KS4P6F3R.js → chunk-6HH4IH4K.js} +4 -4
- package/dist/{chunk-XBJW4MV5.js → chunk-AFKOWCMQ.js} +1 -1
- package/dist/{chunk-FGVNU7XD.js → chunk-AFOTOA24.js} +1 -1
- package/dist/{chunk-B3S4SF3D.js → chunk-CDSL3LLO.js} +1 -1
- package/dist/{chunk-N43EQPJK.js → chunk-CKLWJ6EL.js} +10 -2
- package/dist/{chunk-2PLEJ7SY.js → chunk-EAGMQMRM.js} +1 -1
- package/dist/{chunk-BYGEZI7B.js → chunk-FGNABUPN.js} +1 -1
- package/dist/{chunk-A5ZWYQFV.js → chunk-HCTSTMDD.js} +4 -4
- package/dist/{chunk-X3KIGNIP.js → chunk-I2OLM3DM.js} +30 -21
- package/dist/{chunk-EYMMU5HC.js → chunk-JZA2JOGO.js} +1 -1
- package/dist/{chunk-OE6U2AXM.js → chunk-KHGIM2BN.js} +3 -3
- package/dist/{chunk-JYEGOYQC.js → chunk-KLZJEMSE.js} +1 -1
- package/dist/{chunk-BNDHXPTQ.js → chunk-LWT34GSY.js} +20 -13
- package/dist/{chunk-BL4SQNO6.js → chunk-NDSOOJDX.js} +1 -1
- package/dist/{chunk-YF4JDCU4.js → chunk-OMP3KDDU.js} +1 -1
- package/dist/{chunk-EU6JH7KU.js → chunk-P232YODQ.js} +8 -8
- package/dist/{chunk-K4TAUYUJ.js → chunk-PEV6ULSM.js} +3 -3
- package/dist/{chunk-4V24U44H.js → chunk-PHXU4NOP.js} +2 -2
- package/dist/{chunk-3AIFWTVB.js → chunk-QDYJQLXT.js} +2 -2
- package/dist/{chunk-DVO4SZMJ.js → chunk-QOCWB4Q6.js} +3 -3
- package/dist/{chunk-EKQAKSGI.js → chunk-R5CU7ED6.js} +1 -1
- package/dist/{chunk-XEXOHUJ6.js → chunk-REIZ5GXG.js} +4 -4
- package/dist/{chunk-UVXNYYHG.js → chunk-RERJ2ZDV.js} +6 -6
- package/dist/{chunk-ZHL62DRA.js → chunk-SGZE2JBF.js} +3 -3
- package/dist/{chunk-YKLCWWEI.js → chunk-SGZJ5LYH.js} +1 -1
- package/dist/{chunk-4LL6LG5X.js → chunk-T7E75EKA.js} +4 -3
- package/dist/{chunk-RVDHN2TJ.js → chunk-TGG4FWWB.js} +2 -2
- package/dist/{chunk-DON24PNT.js → chunk-TW7KA27C.js} +1 -1
- package/dist/{chunk-WXXDHGTZ.js → chunk-WOBHHXW5.js} +4 -4
- package/dist/{chunk-MU275U5A.js → chunk-XOUQUZ43.js} +2 -2
- package/dist/{chunk-IAEVVUXO.js → chunk-XP2KRTZD.js} +1 -1
- package/dist/{chunk-E7WBNGJS.js → chunk-XVE52YFZ.js} +1 -1
- package/dist/{chunk-A2URMNFM.js → chunk-YXWM4TNX.js} +1 -1
- package/dist/{reapply-FUCAKR6Z.js → reapply-ADFRVH5N.js} +9 -9
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +13 -13
- package/package.json +1 -1
- /package/dist/{chunk-KBITFQST.js → chunk-P32LPT2L.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5WLH2ENB.js";
|
|
4
4
|
import {
|
|
5
5
|
backupFile,
|
|
6
6
|
readJsonSafe,
|
|
7
7
|
writeFileAtomic,
|
|
8
8
|
writeJsonAtomic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T7E75EKA.js";
|
|
10
10
|
import {
|
|
11
11
|
configFilePath
|
|
12
12
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -154,6 +154,7 @@ var AGENTS = {
|
|
|
154
154
|
...defaults,
|
|
155
155
|
label: "Qwen Code",
|
|
156
156
|
hookSource: "qwen",
|
|
157
|
+
bridged: true,
|
|
157
158
|
policyAgent: "qwen_code",
|
|
158
159
|
repoAware: true,
|
|
159
160
|
disconnectable: true,
|
|
@@ -166,6 +167,7 @@ var AGENTS = {
|
|
|
166
167
|
...defaults,
|
|
167
168
|
label: "CodeBuddy",
|
|
168
169
|
hookSource: "codebuddy",
|
|
170
|
+
bridged: true,
|
|
169
171
|
policyAgent: "codebuddy",
|
|
170
172
|
repoAware: true,
|
|
171
173
|
disconnectable: true,
|
|
@@ -178,6 +180,7 @@ var AGENTS = {
|
|
|
178
180
|
...defaults,
|
|
179
181
|
label: "Qoder",
|
|
180
182
|
hookSource: "qoder",
|
|
183
|
+
bridged: true,
|
|
181
184
|
policyAgent: "qoder",
|
|
182
185
|
repoAware: true,
|
|
183
186
|
disconnectable: true,
|
|
@@ -191,6 +194,7 @@ var AGENTS = {
|
|
|
191
194
|
...defaults,
|
|
192
195
|
label: "Droid",
|
|
193
196
|
hookSource: "droid",
|
|
197
|
+
bridged: true,
|
|
194
198
|
policyAgent: "droid",
|
|
195
199
|
repoAware: true,
|
|
196
200
|
disconnectable: true,
|
|
@@ -204,6 +208,7 @@ var AGENTS = {
|
|
|
204
208
|
...defaults,
|
|
205
209
|
label: "Devin CLI",
|
|
206
210
|
hookSource: "devin",
|
|
211
|
+
bridged: true,
|
|
207
212
|
policyAgent: "devin",
|
|
208
213
|
repoAware: true,
|
|
209
214
|
disconnectable: true,
|
|
@@ -436,6 +441,18 @@ var compatibleTargetFiles = (profile) => {
|
|
|
436
441
|
return [...seen.values()];
|
|
437
442
|
};
|
|
438
443
|
|
|
444
|
+
// ../contracts/src/degraded.ts
|
|
445
|
+
var DEGRADED_PREFIX = "[degraded]";
|
|
446
|
+
var degradedPayload = (subsystem, report) => ({
|
|
447
|
+
subsystem,
|
|
448
|
+
reason: report.reason,
|
|
449
|
+
fallback: report.fallback,
|
|
450
|
+
...report.siteId ? { siteId: report.siteId } : {},
|
|
451
|
+
...report.sessionId ? { sessionId: report.sessionId } : {},
|
|
452
|
+
...report.event ? { event: report.event } : {}
|
|
453
|
+
});
|
|
454
|
+
var degradedLine = (subsystem, report) => `${DEGRADED_PREFIX} ${JSON.stringify(degradedPayload(subsystem, report))}`;
|
|
455
|
+
|
|
439
456
|
// ../contracts/src/index.ts
|
|
440
457
|
var KEY_SCOPES = ["full_access", "agent", "connector", "bound"];
|
|
441
458
|
var normalizeKeyScope = (value) => typeof value === "string" && KEY_SCOPES.includes(value) ? value : null;
|
|
@@ -718,6 +735,7 @@ var shellCommandSegments = (command) => {
|
|
|
718
735
|
index += 1;
|
|
719
736
|
continue;
|
|
720
737
|
}
|
|
738
|
+
if (quote === SHELL_DOUBLE_QUOTE && (char === "`" || char === SHELL_SUBSTITUTION_SIGIL && next === SHELL_GROUP_OPEN)) return null;
|
|
721
739
|
if (char === quote) quote = null;
|
|
722
740
|
current += char;
|
|
723
741
|
continue;
|
|
@@ -1066,7 +1084,7 @@ var verdictForPolicy = (policy) => {
|
|
|
1066
1084
|
if (isAutoApprove(policy)) return "allow";
|
|
1067
1085
|
return "requires_human";
|
|
1068
1086
|
};
|
|
1069
|
-
var policyIntent = (policy) => policy
|
|
1087
|
+
var policyIntent = (policy) => isAutoApprove(policy) ? PATTERN_INTENT.grant : PATTERN_INTENT.restrict;
|
|
1070
1088
|
var selectGoverningRule = (policies, toolName, args, repoKey, sessionId) => {
|
|
1071
1089
|
let best;
|
|
1072
1090
|
let bestWeight = 0;
|
|
@@ -1999,6 +2017,7 @@ export {
|
|
|
1999
2017
|
hookCompatibleProfile,
|
|
2000
2018
|
hookCompatibleProfileBySource,
|
|
2001
2019
|
compatibleTargetFiles,
|
|
2020
|
+
degradedLine,
|
|
2002
2021
|
hookWritePath,
|
|
2003
2022
|
isHookActivationReport,
|
|
2004
2023
|
hookActivationResult,
|
|
@@ -2,24 +2,24 @@ import {
|
|
|
2
2
|
detectProviderLiveCapabilities,
|
|
3
3
|
hasSpawnProvider,
|
|
4
4
|
resolveControlPolicy
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PHXU4NOP.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-6HH4IH4K.js";
|
|
13
13
|
import {
|
|
14
14
|
getMachineId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-465UENKO.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-5SALHATY.js";
|
|
23
23
|
import {
|
|
24
24
|
getBaseUrl
|
|
25
25
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -4,23 +4,23 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
getMachineId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-465UENKO.js";
|
|
8
8
|
import {
|
|
9
9
|
pusharyDir,
|
|
10
10
|
resolveGlobalBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-34NNTYK6.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-5SALHATY.js";
|
|
18
18
|
import {
|
|
19
19
|
readJsonSafe,
|
|
20
20
|
writeFileAtomic,
|
|
21
21
|
writeJsonAtomic,
|
|
22
22
|
writeJsonAtomicDurable
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-T7E75EKA.js";
|
|
24
24
|
import {
|
|
25
25
|
getApiKey
|
|
26
26
|
} from "./chunk-2UMNXADU.js";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P232YODQ.js";
|
|
4
|
+
import {
|
|
5
|
+
degradedLine
|
|
6
|
+
} from "./chunk-5UWDYOZX.js";
|
|
4
7
|
|
|
5
8
|
// src/admission.ts
|
|
6
9
|
import { readFileSync } from "fs";
|
|
@@ -40,7 +43,12 @@ var matches = (rule, source, event) => {
|
|
|
40
43
|
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
41
44
|
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) => {
|
|
42
45
|
if (source === null) {
|
|
43
|
-
process.stderr.write("
|
|
46
|
+
process.stderr.write(`${degradedLine("hook", {
|
|
47
|
+
reason: "unknown_agent",
|
|
48
|
+
fallback: "stood aside, so nothing is gated or reported for this call",
|
|
49
|
+
event: fallbackEvent
|
|
50
|
+
})}
|
|
51
|
+
`);
|
|
44
52
|
return null;
|
|
45
53
|
}
|
|
46
54
|
let raw = "";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
COMPATIBLE_AGENT_TYPES,
|
|
9
9
|
isValidApiKey
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5UWDYOZX.js";
|
|
11
11
|
|
|
12
12
|
// src/setup/options.ts
|
|
13
13
|
var AGENT_CHOICES = ["claude_code", "codex", "gemini_cli", "hermes", "cursor", "vscode", "opencode", ...COMPATIBLE_AGENT_TYPES, "custom"];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalGateInputs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WOBHHXW5.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-34NNTYK6.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-T7E75EKA.js";
|
|
10
10
|
import {
|
|
11
11
|
BLOCKED_ACTION_GRANT_TTL_SECONDS,
|
|
12
12
|
blockedActionIdentity,
|
|
13
13
|
shouldDeferToNativeMode
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5UWDYOZX.js";
|
|
15
15
|
|
|
16
16
|
// src/native-defer.ts
|
|
17
17
|
var nativeDeferOptions = () => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeIdentity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LWT34GSY.js";
|
|
4
4
|
import {
|
|
5
5
|
blockedActionFingerprint,
|
|
6
6
|
defersToNativeMode,
|
|
7
7
|
forgetBlockedActionHint,
|
|
8
8
|
hasBlockedActionHint,
|
|
9
9
|
recordBlockedActionHint
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HCTSTMDD.js";
|
|
11
11
|
import {
|
|
12
12
|
isGatingMoment,
|
|
13
13
|
recordKeylessMoment
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OMP3KDDU.js";
|
|
15
15
|
import {
|
|
16
16
|
denyReasonFrom,
|
|
17
17
|
isDeferAnswer
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
scopePathFor,
|
|
35
35
|
settleQuestionsForToolUse,
|
|
36
36
|
throttlePass
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-WOBHHXW5.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-465UENKO.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-5UWDYOZX.js";
|
|
77
77
|
|
|
78
78
|
// src/decision-episode.ts
|
|
79
79
|
var EPISODE_PATH = "/api/agent/decision-episode";
|
|
@@ -450,19 +450,25 @@ var handleKeyless = (input) => {
|
|
|
450
450
|
}
|
|
451
451
|
return void 0;
|
|
452
452
|
};
|
|
453
|
-
var claudeGateInput = (modeState, config, input) => {
|
|
454
|
-
const
|
|
453
|
+
var claudeGateInput = (modeState, config, input, canonical) => {
|
|
454
|
+
const toolName = canonical?.toolName ?? input.tool_name;
|
|
455
|
+
const toolInputs = canonical?.toolInputs ?? [input.tool_input ?? {}];
|
|
455
456
|
return {
|
|
456
457
|
modeState,
|
|
457
458
|
config,
|
|
458
|
-
toolName
|
|
459
|
-
toolInputs
|
|
460
|
-
scopePaths:
|
|
459
|
+
toolName,
|
|
460
|
+
toolInputs,
|
|
461
|
+
scopePaths: modeState.scope ? toolInputs.flatMap((args) => {
|
|
462
|
+
const path = scopePathFor(toolName, args, input.cwd);
|
|
463
|
+
return path ? [path] : [];
|
|
464
|
+
}) : [],
|
|
461
465
|
cwd: input.cwd,
|
|
462
466
|
repoKey: repoKeyFor(input.cwd),
|
|
463
467
|
sessionId: input.session_id
|
|
464
468
|
};
|
|
465
469
|
};
|
|
470
|
+
var unreadableReason = "Pushary could not read every target of this call. Use a supported command or a single-file edit.";
|
|
471
|
+
var batchScopeReason = "This patch exceeds the agreed scope. Split it into single-file edits so each additional path can be approved.";
|
|
466
472
|
var BLOCKED_ACTION_GATE_TIMEOUT_MS = 15e3;
|
|
467
473
|
var BLOCKED_ACTION_CLAIM_TIMEOUT_MS = 4e3;
|
|
468
474
|
var BLOCKED_ACTION_ALLOW_REASON = "Approved from Pushary after auto mode blocked it";
|
|
@@ -502,7 +508,7 @@ var claimedBlockedActionRetry = async (apiKey, input) => {
|
|
|
502
508
|
return false;
|
|
503
509
|
}
|
|
504
510
|
};
|
|
505
|
-
var handlePreToolUse = async (input) => {
|
|
511
|
+
var handlePreToolUse = async (input, canonical) => {
|
|
506
512
|
if (isPusharyOwnTool(input.tool_name)) return void 0;
|
|
507
513
|
let apiKey;
|
|
508
514
|
try {
|
|
@@ -513,9 +519,11 @@ var handlePreToolUse = async (input) => {
|
|
|
513
519
|
try {
|
|
514
520
|
const modeState = await fetchModeState(apiKey, input.session_id);
|
|
515
521
|
const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
|
|
516
|
-
const verdict = resolveGate(claudeGateInput(modeState, policy, input));
|
|
522
|
+
const verdict = resolveGate(claudeGateInput(modeState, policy, input, canonical));
|
|
517
523
|
if (verdict.kind === "kill") return halted(verdict.reason);
|
|
518
524
|
if (verdict.kind === "deny") return deny(verdict.reason);
|
|
525
|
+
if (canonical === null) return deny(unreadableReason);
|
|
526
|
+
if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return deny(batchScopeReason);
|
|
519
527
|
if (input.tool_name === "AskUserQuestion") {
|
|
520
528
|
return handleAskUserQuestion(apiKey, input, modeState);
|
|
521
529
|
}
|
|
@@ -523,7 +531,7 @@ var handlePreToolUse = async (input) => {
|
|
|
523
531
|
return handleExitPlanMode(apiKey, input);
|
|
524
532
|
}
|
|
525
533
|
if (await claimedBlockedActionRetry(apiKey, input)) return allow(BLOCKED_ACTION_ALLOW_REASON);
|
|
526
|
-
if (shouldDeferToNativeMode(input.permission_mode, input.tool_name)) {
|
|
534
|
+
if (!(verdict.kind === "gate" && verdict.scopeReason) && shouldDeferToNativeMode(input.permission_mode, input.tool_name)) {
|
|
527
535
|
return void 0;
|
|
528
536
|
}
|
|
529
537
|
switch (verdict.kind) {
|
|
@@ -553,8 +561,8 @@ var toPermissionRequestOutput = (hookOutput) => {
|
|
|
553
561
|
if (d.permissionDecision === "deny") return permReqDeny(d.permissionDecisionReason);
|
|
554
562
|
return void 0;
|
|
555
563
|
};
|
|
556
|
-
var handlePermissionRequest = async (input) => {
|
|
557
|
-
if (isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode)) return void 0;
|
|
564
|
+
var handlePermissionRequest = async (input, canonical) => {
|
|
565
|
+
if (canonical === void 0 && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode)) return void 0;
|
|
558
566
|
if (isPusharyOwnTool(input.tool_name)) return void 0;
|
|
559
567
|
let apiKey;
|
|
560
568
|
try {
|
|
@@ -565,14 +573,15 @@ var handlePermissionRequest = async (input) => {
|
|
|
565
573
|
try {
|
|
566
574
|
const modeState = await fetchModeState(apiKey, input.session_id);
|
|
567
575
|
const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
|
|
568
|
-
const verdict = resolveGate(claudeGateInput(modeState, policy, input));
|
|
576
|
+
const verdict = resolveGate(claudeGateInput(modeState, policy, input, canonical));
|
|
577
|
+
if (verdict.kind === "kill") return permReqHalted(verdict.reason);
|
|
578
|
+
if (verdict.kind === "deny") return permReqDeny(verdict.reason);
|
|
579
|
+
if (canonical === null) return permReqDeny(unreadableReason);
|
|
580
|
+
if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return permReqDeny(batchScopeReason);
|
|
581
|
+
if (!(verdict.kind === "gate" && verdict.scopeReason) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode)) return void 0;
|
|
569
582
|
switch (verdict.kind) {
|
|
570
|
-
case "kill":
|
|
571
|
-
return permReqHalted(verdict.reason);
|
|
572
583
|
case "allow":
|
|
573
584
|
return permReqAllow();
|
|
574
|
-
case "deny":
|
|
575
|
-
return permReqDeny(verdict.reason);
|
|
576
585
|
// No opinion, so Claude Code's own dialog shows.
|
|
577
586
|
case "defer":
|
|
578
587
|
return void 0;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_MATCHED_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XP2KRTZD.js";
|
|
5
5
|
import {
|
|
6
6
|
isProtectedByScope,
|
|
7
7
|
registerHookEntry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-34NNTYK6.js";
|
|
9
9
|
import {
|
|
10
10
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
11
11
|
HOOK_BUDGETS,
|
|
12
12
|
HOOK_LOCATOR_BINARY
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5UWDYOZX.js";
|
|
14
14
|
|
|
15
15
|
// src/gemini-config.ts
|
|
16
16
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -3,36 +3,40 @@ import {
|
|
|
3
3
|
addPusharyToolPermissions,
|
|
4
4
|
isPusharyHook,
|
|
5
5
|
removeClaudeMcpServers
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SGZE2JBF.js";
|
|
7
7
|
import {
|
|
8
8
|
CLAUDE_HOOK_EVENTS,
|
|
9
9
|
addGeminiMcpServer,
|
|
10
10
|
removeGeminiMcpServer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KHGIM2BN.js";
|
|
12
12
|
import {
|
|
13
13
|
CLAUDE_CODE_AGENT,
|
|
14
14
|
parseApplyPatchFiles
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WOBHHXW5.js";
|
|
16
16
|
import {
|
|
17
17
|
guardBinary,
|
|
18
18
|
holdBudgetOf,
|
|
19
19
|
registerHookEntry
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-34NNTYK6.js";
|
|
21
21
|
import {
|
|
22
22
|
PHONE_ANSWERED_TOOLS,
|
|
23
23
|
hookCompatibleProfile,
|
|
24
|
+
hookCompatibleProfileBySource,
|
|
24
25
|
toToolLookup,
|
|
25
26
|
withHookHoldBudget
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-5UWDYOZX.js";
|
|
27
28
|
|
|
28
29
|
// src/compatible-config.ts
|
|
29
30
|
import { homedir } from "os";
|
|
30
31
|
import { isAbsolute, join, resolve } from "path";
|
|
31
32
|
var AGENT_FLAG = "--agent";
|
|
33
|
+
var SOURCE_FLAG = "--source";
|
|
32
34
|
var agentArgument = (profile) => `${AGENT_FLAG}=${profile.agentType}`;
|
|
33
35
|
var profileFromArgv = (argv) => {
|
|
34
36
|
const named = namedAgent(argv);
|
|
35
|
-
|
|
37
|
+
if (named !== void 0) return hookCompatibleProfile(named);
|
|
38
|
+
const source = namedSource(argv);
|
|
39
|
+
return source === void 0 ? void 0 : hookCompatibleProfileBySource(source);
|
|
36
40
|
};
|
|
37
41
|
var activeIdentity = (argv) => {
|
|
38
42
|
const profile = profileFromArgv(argv);
|
|
@@ -42,10 +46,18 @@ var namedAgent = (argv) => {
|
|
|
42
46
|
const prefix = `${AGENT_FLAG}=`;
|
|
43
47
|
return argv.find((argument) => argument.startsWith(prefix))?.slice(prefix.length);
|
|
44
48
|
};
|
|
49
|
+
var namedSource = (argv) => {
|
|
50
|
+
const inline = argv.find((argument) => argument.startsWith(`${SOURCE_FLAG}=`));
|
|
51
|
+
if (inline) return inline.slice(SOURCE_FLAG.length + 1);
|
|
52
|
+
const index = argv.indexOf(SOURCE_FLAG);
|
|
53
|
+
return index === -1 ? void 0 : argv[index + 1];
|
|
54
|
+
};
|
|
45
55
|
var activeHookSource = (argv) => {
|
|
46
56
|
const named = namedAgent(argv);
|
|
47
|
-
if (named
|
|
48
|
-
|
|
57
|
+
if (named !== void 0) return hookCompatibleProfile(named)?.source ?? null;
|
|
58
|
+
const source = namedSource(argv);
|
|
59
|
+
if (source === void 0) return "claude";
|
|
60
|
+
return hookCompatibleProfileBySource(source)?.source ?? "claude";
|
|
49
61
|
};
|
|
50
62
|
var PATCH_INPUT_KEYS = ["command", "patch", "input"];
|
|
51
63
|
var patchedFiles = (toolInput) => [...new Set(PATCH_INPUT_KEYS.flatMap((key) => parseApplyPatchFiles(toolInput[key])))];
|
|
@@ -62,10 +74,6 @@ var normalizeToolCall = (profile, input) => {
|
|
|
62
74
|
const lookup = lookupFor(profile, input);
|
|
63
75
|
return { ...input, tool_name: lookup.tool, tool_input: lookup.input };
|
|
64
76
|
};
|
|
65
|
-
var unreadableTool = (profile, input) => {
|
|
66
|
-
if (!profile || !input.tool_name) return void 0;
|
|
67
|
-
return lookupFor(profile, input).unreadable ? input.tool_name : void 0;
|
|
68
|
-
};
|
|
69
77
|
var underHome = (segments, home = homedir()) => join(home, ...segments);
|
|
70
78
|
var compatibleConfigFile = (profile, home) => underHome(profile.configFile, home);
|
|
71
79
|
var compatibleMcpFile = (profile, home) => profile.mcp ? underHome(profile.mcp.file, home) : null;
|
|
@@ -215,7 +223,6 @@ export {
|
|
|
215
223
|
activeIdentity,
|
|
216
224
|
activeHookSource,
|
|
217
225
|
normalizeToolCall,
|
|
218
|
-
unreadableTool,
|
|
219
226
|
compatibleConfigFile,
|
|
220
227
|
compatibleMcpFile,
|
|
221
228
|
compatibleInstructionsFile,
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
loadPin,
|
|
4
4
|
savePin,
|
|
5
5
|
verifyRecipients
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SGZJ5LYH.js";
|
|
7
7
|
import {
|
|
8
8
|
hookOwnerOf
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-REIZ5GXG.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureDaemonRunning
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6HH4IH4K.js";
|
|
13
13
|
import {
|
|
14
14
|
buildTranscriptRecords,
|
|
15
15
|
decodePublicKey,
|
|
16
16
|
generateSessionKey,
|
|
17
17
|
wrapSessionKey
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CDSL3LLO.js";
|
|
19
19
|
import {
|
|
20
20
|
fetchTranscriptRecipients,
|
|
21
21
|
uploadTranscriptRecords
|
|
@@ -23,17 +23,17 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
transcriptEnvironmentPreference,
|
|
25
25
|
transcriptsEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YXWM4TNX.js";
|
|
27
27
|
import {
|
|
28
28
|
codexHome,
|
|
29
29
|
pusharyDir
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-34NNTYK6.js";
|
|
31
31
|
import {
|
|
32
32
|
readTranscriptPreference
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-5SALHATY.js";
|
|
34
34
|
import {
|
|
35
35
|
writeJsonAtomic
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-T7E75EKA.js";
|
|
37
37
|
import {
|
|
38
38
|
getApiKey,
|
|
39
39
|
getBaseUrl
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XVE52YFZ.js";
|
|
4
4
|
import {
|
|
5
5
|
codexHomeFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-34NNTYK6.js";
|
|
7
7
|
import {
|
|
8
8
|
HOOK_COMPATIBLE_PROFILES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5UWDYOZX.js";
|
|
10
10
|
|
|
11
11
|
// src/vscode-config.ts
|
|
12
12
|
import { homedir } from "os";
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
resolveBinary,
|
|
3
3
|
resolveGlobalPackageVersion,
|
|
4
4
|
resolvePackageVersionFromBinary
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-34NNTYK6.js";
|
|
6
6
|
import {
|
|
7
7
|
MANAGED_PROVIDERS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5UWDYOZX.js";
|
|
9
9
|
|
|
10
10
|
// src/live-capabilities.ts
|
|
11
11
|
var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FGNABUPN.js";
|
|
4
4
|
import {
|
|
5
5
|
parseFlags
|
|
6
6
|
} from "./chunk-GMXKITVA.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
CLAUDE_CONNECTOR_URL,
|
|
15
15
|
COWORK_CONNECTOR_LIMIT,
|
|
16
16
|
COWORK_STANDING_INSTRUCTIONS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5UWDYOZX.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/cowork.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KHGIM2BN.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-34NNTYK6.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5UWDYOZX.js";
|
|
16
16
|
|
|
17
17
|
// src/diagnostics/wiring.ts
|
|
18
18
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|