@pushary/agent-hooks 1.3.1 → 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 +17 -0
- package/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +18 -18
- package/dist/bin/pushary-bell.js +8 -8
- package/dist/bin/pushary-claude.js +18 -18
- package/dist/bin/pushary-clean.js +470 -92
- package/dist/bin/pushary-codex-bridge.js +10 -10
- package/dist/bin/pushary-codex-hook.js +28 -26
- package/dist/bin/pushary-codex.js +6 -6
- package/dist/bin/pushary-connect.js +8 -8
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +24 -24
- package/dist/bin/pushary-disconnect.js +12 -12
- package/dist/bin/pushary-doctor.js +75 -26
- 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 +27 -27
- package/dist/bin/pushary-login.js +9 -9
- package/dist/bin/pushary-logout.js +6 -6
- package/dist/bin/pushary-mode.js +5 -5
- 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 +25 -25
- 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 +38 -59
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +12 -12
- package/dist/bin/pushary-stop-hook.js +20 -20
- package/dist/bin/pushary-stopfailure-hook.js +20 -20
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-transcript-register.js +16 -16
- package/dist/bin/pushary-transcripts.js +6 -6
- package/dist/bin/pushary-upgrade.js +16 -16
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +1 -1
- package/dist/{chunk-QDYJQLXT.js → chunk-2TOTCUJC.js} +2 -2
- package/dist/{chunk-I2OLM3DM.js → chunk-43Z3RLS5.js} +62 -12
- package/dist/{chunk-OMP3KDDU.js → chunk-5F5QQMCA.js} +1 -1
- package/dist/{chunk-SGZE2JBF.js → chunk-5IBVIMWT.js} +3 -3
- package/dist/{chunk-FGNABUPN.js → chunk-5MSBI6NP.js} +1 -1
- package/dist/{chunk-5UWDYOZX.js → chunk-7IEB2GV4.js} +80 -8
- package/dist/{chunk-EAGMQMRM.js → chunk-7PQZYCEP.js} +1 -1
- package/dist/{chunk-KHGIM2BN.js → chunk-A7XIL2WD.js} +3 -3
- package/dist/{chunk-YXWM4TNX.js → chunk-BYAXXBNO.js} +1 -1
- package/dist/{chunk-TW7KA27C.js → chunk-D4TNSUDY.js} +1 -1
- package/dist/{chunk-P232YODQ.js → chunk-ESLLVHDY.js} +6 -6
- package/dist/{chunk-LZQVAEWP.js → chunk-FAH3D74E.js} +2 -1
- package/dist/{chunk-XOUQUZ43.js → chunk-GIXLZFEY.js} +1 -1
- package/dist/{chunk-PHXU4NOP.js → chunk-GLPWCQ6V.js} +2 -2
- package/dist/{chunk-NDSOOJDX.js → chunk-GS5EI2YL.js} +1 -1
- package/dist/{chunk-R5CU7ED6.js → chunk-H25UB3CG.js} +1 -1
- package/dist/{chunk-LWT34GSY.js → chunk-HGN6VZTY.js} +7 -7
- package/dist/{chunk-WOBHHXW5.js → chunk-IF46POXX.js} +5 -4
- package/dist/{chunk-HCTSTMDD.js → chunk-JCWCTBYH.js} +3 -3
- package/dist/{chunk-XP2KRTZD.js → chunk-KZIXHLPQ.js} +1 -1
- package/dist/{chunk-AFOTOA24.js → chunk-NBCTKC4Z.js} +34 -3
- package/dist/{chunk-5SALHATY.js → chunk-NYHNLMQO.js} +11 -2
- package/dist/{chunk-PEV6ULSM.js → chunk-O5L2OJBB.js} +3 -3
- package/dist/{chunk-QOCWB4Q6.js → chunk-O6RN46OS.js} +3 -3
- package/dist/{chunk-5WLH2ENB.js → chunk-P4JVVJ2D.js} +1 -1
- package/dist/{chunk-XVE52YFZ.js → chunk-Q4UAMWXK.js} +1 -1
- package/dist/{chunk-6HH4IH4K.js → chunk-RGZY77CD.js} +3 -3
- package/dist/{chunk-465UENKO.js → chunk-RQM5SMMR.js} +1 -1
- package/dist/{chunk-RERJ2ZDV.js → chunk-S3CLZSV3.js} +5 -5
- package/dist/{chunk-CDSL3LLO.js → chunk-S3EUZZJB.js} +1 -1
- package/dist/{chunk-AFKOWCMQ.js → chunk-SGZ3IAWF.js} +1 -1
- package/dist/{chunk-GOQHN2UH.js → chunk-TWWLVOPB.js} +1 -1
- package/dist/{chunk-TGG4FWWB.js → chunk-U4FB623J.js} +2 -2
- package/dist/{chunk-34NNTYK6.js → chunk-UCGQEAKZ.js} +1 -1
- package/dist/{chunk-5XKMOZO6.js → chunk-UIN3RD2U.js} +4 -4
- package/dist/{chunk-REIZ5GXG.js → chunk-UTYTPDWN.js} +4 -4
- package/dist/{chunk-35RPUNYU.js → chunk-VENQSVKA.js} +1 -1
- package/dist/{chunk-JZA2JOGO.js → chunk-XJWMPQ6X.js} +1 -1
- package/dist/{chunk-KLZJEMSE.js → chunk-YYRZPEMA.js} +1 -1
- package/dist/{chunk-CKLWJ6EL.js → chunk-ZIGGEKZW.js} +33 -7
- package/dist/{reapply-ADFRVH5N.js → reapply-B3S2LRMT.js} +8 -8
- package/dist/src/index.d.ts +19 -16
- package/dist/src/index.js +12 -12
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_PUSH_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRROR_ONLY_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KZIXHLPQ.js";
|
|
5
5
|
import {
|
|
6
6
|
cancelQuestion,
|
|
7
7
|
isPolicyConfig,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-LGXUGYUH.js";
|
|
11
11
|
import {
|
|
12
12
|
getMachineId
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RQM5SMMR.js";
|
|
14
14
|
import {
|
|
15
15
|
withRetry
|
|
16
16
|
} from "./chunk-EYRGBYZG.js";
|
|
17
17
|
import {
|
|
18
18
|
reportedInstallSource
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-P4JVVJ2D.js";
|
|
20
20
|
import {
|
|
21
21
|
getApiKey,
|
|
22
22
|
getBaseUrl
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveAutoResolveOrigin,
|
|
45
45
|
resolvePolicy,
|
|
46
46
|
toToolLookup
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-7IEB2GV4.js";
|
|
48
48
|
|
|
49
49
|
// src/policy.ts
|
|
50
50
|
import { createHash } from "crypto";
|
|
@@ -2004,6 +2004,7 @@ export {
|
|
|
2004
2004
|
preToolUseTimeoutDecision,
|
|
2005
2005
|
readLastPrompt,
|
|
2006
2006
|
CLAUDE_CODE_AGENT,
|
|
2007
|
+
AUTO_DECISION_WINDOW_MS,
|
|
2007
2008
|
reportEvent,
|
|
2008
2009
|
settleQuestionsForToolUse,
|
|
2009
2010
|
handlePostToolUse,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalGateInputs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IF46POXX.js";
|
|
4
4
|
import {
|
|
5
5
|
canonicalJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UCGQEAKZ.js";
|
|
7
7
|
import {
|
|
8
8
|
writeFileAtomic
|
|
9
9
|
} from "./chunk-T7E75EKA.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-7IEB2GV4.js";
|
|
15
15
|
|
|
16
16
|
// src/native-defer.ts
|
|
17
17
|
var nativeDeferOptions = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolvePathBinary
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UCGQEAKZ.js";
|
|
4
4
|
|
|
5
5
|
// src/hermes-config.ts
|
|
6
6
|
import { execFileSync } from "child_process";
|
|
@@ -233,8 +233,35 @@ var runHermesPythonScript = (python, script, ...args) => {
|
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
// src/cli
|
|
236
|
+
// src/skills-cli.ts
|
|
237
237
|
import { execSync } from "child_process";
|
|
238
|
+
var PUSHARY_SKILL_SOURCE = "Pushary/pushary-skill";
|
|
239
|
+
var PUSHARY_SKILL_NAME = "pushary";
|
|
240
|
+
var installSkillViaSkillsCli = (agent) => {
|
|
241
|
+
try {
|
|
242
|
+
execSync(`npx -y skills@latest add ${PUSHARY_SKILL_SOURCE}@${PUSHARY_SKILL_NAME} -y -g --agent ${agent}`, {
|
|
243
|
+
stdio: "pipe",
|
|
244
|
+
timeout: 9e4
|
|
245
|
+
});
|
|
246
|
+
return true;
|
|
247
|
+
} catch {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var installAgentSkill = async (request, effects) => {
|
|
252
|
+
if (request.skillsCliInUse) {
|
|
253
|
+
const startedAt = effects.now();
|
|
254
|
+
if (effects.runSkillsCli(request.agent)) {
|
|
255
|
+
const modifiedAt = effects.skillModifiedAt(request.agentSkillDir);
|
|
256
|
+
if (modifiedAt !== null && modifiedAt >= startedAt) return "skills-cli";
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
await effects.writePackagedSkill(request.agentSkillDir);
|
|
260
|
+
return "packaged-copy";
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// src/cli/dry-run.ts
|
|
264
|
+
import { execSync as execSync2 } from "child_process";
|
|
238
265
|
import { rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
239
266
|
var createGuards = (isDryRun, note) => ({
|
|
240
267
|
write: (path, contents) => {
|
|
@@ -247,7 +274,7 @@ var createGuards = (isDryRun, note) => ({
|
|
|
247
274
|
},
|
|
248
275
|
exec: (command, options, describe) => {
|
|
249
276
|
if (isDryRun()) return note("run ", describe);
|
|
250
|
-
|
|
277
|
+
execSync2(command, options);
|
|
251
278
|
}
|
|
252
279
|
});
|
|
253
280
|
var describeService = (effects) => {
|
|
@@ -271,6 +298,10 @@ export {
|
|
|
271
298
|
HERMES_CONFIG_SCRIPT,
|
|
272
299
|
resolveHermesPython,
|
|
273
300
|
runHermesPythonScript,
|
|
301
|
+
PUSHARY_SKILL_SOURCE,
|
|
302
|
+
PUSHARY_SKILL_NAME,
|
|
303
|
+
installSkillViaSkillsCli,
|
|
304
|
+
installAgentSkill,
|
|
274
305
|
createGuards,
|
|
275
306
|
describeSetupSideEffects
|
|
276
307
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveInstallSourceFor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P4JVVJ2D.js";
|
|
4
4
|
import {
|
|
5
5
|
backupFile,
|
|
6
6
|
readJsonSafe,
|
|
@@ -102,6 +102,13 @@ var OUR_EXPORT = /^[ \t]*export[ \t]+PUSHARY_API_KEY=(['"]?)(pk_[a-f0-9]+\.[a-f0
|
|
|
102
102
|
var MENTIONS_KEY = /PUSHARY_API_KEY/;
|
|
103
103
|
var isComment = (line) => line.trimStart().startsWith("#");
|
|
104
104
|
var exportLine = (apiKey) => `export PUSHARY_API_KEY='${apiKey}'`;
|
|
105
|
+
var LOGOUT_MARK = "# removed by pushary logout";
|
|
106
|
+
var disabledExportLine = (line) => `# ${line.trim()} ${LOGOUT_MARK}`;
|
|
107
|
+
var isDisabledExport = (line) => {
|
|
108
|
+
const trimmed = line.trim();
|
|
109
|
+
if (!isComment(trimmed) || !trimmed.endsWith(LOGOUT_MARK)) return false;
|
|
110
|
+
return OUR_EXPORT.test(trimmed.slice(1, -LOGOUT_MARK.length).trim());
|
|
111
|
+
};
|
|
105
112
|
var keyPrefix = (key) => key.split(".")[0] ?? key;
|
|
106
113
|
var rcResult = (kind, over = {}) => ({
|
|
107
114
|
kind,
|
|
@@ -233,7 +240,7 @@ var clearKey = (options = {}) => {
|
|
|
233
240
|
const next = lines.map((line) => {
|
|
234
241
|
if (!OUR_EXPORT.test(line)) return line;
|
|
235
242
|
rcLinesDisabled += 1;
|
|
236
|
-
return
|
|
243
|
+
return disabledExportLine(line);
|
|
237
244
|
});
|
|
238
245
|
if (rcLinesDisabled > 0) writeFileSync2(real, next.join("\n"));
|
|
239
246
|
} catch {
|
|
@@ -283,11 +290,13 @@ var readKeySource = () => {
|
|
|
283
290
|
};
|
|
284
291
|
|
|
285
292
|
export {
|
|
293
|
+
CANDIDATE_RCS,
|
|
286
294
|
resolveShellRc,
|
|
287
295
|
installClaudeAlias,
|
|
288
296
|
removeClaudeAlias,
|
|
289
297
|
KEY_FILE_MODE,
|
|
290
298
|
exportLine,
|
|
299
|
+
isDisabledExport,
|
|
291
300
|
keyPrefix,
|
|
292
301
|
writeKey,
|
|
293
302
|
clearKey,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openCodeConfigDirFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q4UAMWXK.js";
|
|
4
4
|
import {
|
|
5
5
|
codexHomeFrom
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UCGQEAKZ.js";
|
|
7
7
|
import {
|
|
8
8
|
HOOK_COMPATIBLE_PROFILES
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7IEB2GV4.js";
|
|
10
10
|
|
|
11
11
|
// src/vscode-config.ts
|
|
12
12
|
import { homedir } from "os";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
GEMINI_HOOK_EVENTS,
|
|
4
4
|
hasGeminiHooks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-A7XIL2WD.js";
|
|
6
6
|
import {
|
|
7
7
|
CODEX_HOOK_EVENTS,
|
|
8
8
|
hasCodexHooks,
|
|
9
9
|
holdBudgetOf
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UCGQEAKZ.js";
|
|
11
11
|
import {
|
|
12
12
|
CURSOR_GATE_EVENTS,
|
|
13
13
|
HOOK_LOCATOR_BINARY,
|
|
14
14
|
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7IEB2GV4.js";
|
|
16
16
|
|
|
17
17
|
// src/diagnostics/wiring.ts
|
|
18
18
|
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -4,17 +4,17 @@ import {
|
|
|
4
4
|
} from "./chunk-XHKBHWLX.js";
|
|
5
5
|
import {
|
|
6
6
|
getMachineId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RQM5SMMR.js";
|
|
8
8
|
import {
|
|
9
9
|
pusharyDir,
|
|
10
10
|
resolveGlobalBinary
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UCGQEAKZ.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-NYHNLMQO.js";
|
|
18
18
|
import {
|
|
19
19
|
readJsonSafe,
|
|
20
20
|
writeFileAtomic,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SGZ3IAWF.js";
|
|
4
4
|
import {
|
|
5
5
|
addClaudeMcpServer,
|
|
6
6
|
addPusharyHooks,
|
|
7
7
|
addPusharyToolPermissions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5IBVIMWT.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-O6RN46OS.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-A7XIL2WD.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-UCGQEAKZ.js";
|
|
48
48
|
import {
|
|
49
49
|
readJsonSafe,
|
|
50
50
|
writeFileAtomic,
|
|
@@ -15,10 +15,10 @@ import {
|
|
|
15
15
|
} from "./chunk-EYRGBYZG.js";
|
|
16
16
|
import {
|
|
17
17
|
reportedInstallSource
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-P4JVVJ2D.js";
|
|
19
19
|
import {
|
|
20
20
|
isAnswerSource
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7IEB2GV4.js";
|
|
22
22
|
|
|
23
23
|
// src/reach.ts
|
|
24
24
|
var reachVerdict = (channels) => {
|
|
@@ -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,9 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTranscript
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ESLLVHDY.js";
|
|
4
4
|
import {
|
|
5
5
|
degradedLine
|
|
6
|
-
} from "./chunk-
|
|
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
|
+
}
|
|
7
27
|
|
|
8
28
|
// src/admission.ts
|
|
9
29
|
import { readFileSync } from "fs";
|
|
@@ -41,7 +61,7 @@ var matches = (rule, source, event) => {
|
|
|
41
61
|
return (ruleSource === "*" || ruleSource === source) && (ruleEvent === "*" || ruleEvent === event);
|
|
42
62
|
};
|
|
43
63
|
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
44
|
-
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) => {
|
|
64
|
+
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin, parseInput) => {
|
|
45
65
|
if (source === null) {
|
|
46
66
|
process.stderr.write(`${degradedLine("hook", {
|
|
47
67
|
reason: "unknown_agent",
|
|
@@ -61,17 +81,23 @@ var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) =>
|
|
|
61
81
|
return null;
|
|
62
82
|
}
|
|
63
83
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
64
|
-
const
|
|
84
|
+
const input = parseInput ? parseInput(parsed) : parsed;
|
|
85
|
+
if (input === null) return null;
|
|
86
|
+
const event = eventNameOf(input) ?? fallbackEvent;
|
|
65
87
|
if (!isAdmitted(readAdmissionRules(), source, event)) return null;
|
|
66
|
-
if (stdin === process.stdin) registerTranscript(source,
|
|
67
|
-
return
|
|
88
|
+
if (stdin === process.stdin) registerTranscript(source, input);
|
|
89
|
+
return input;
|
|
68
90
|
};
|
|
69
91
|
var eventNameOf = (input) => {
|
|
70
92
|
if (!("hook_event_name" in input)) return void 0;
|
|
71
93
|
const name = input.hook_event_name;
|
|
72
94
|
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
73
95
|
};
|
|
96
|
+
function readToolHookInput(source, event, stdin = process.stdin) {
|
|
97
|
+
return readHookInput(source, event, stdin, parseToolHookInput);
|
|
98
|
+
}
|
|
74
99
|
|
|
75
100
|
export {
|
|
76
|
-
readHookInput
|
|
101
|
+
readHookInput,
|
|
102
|
+
readToolHookInput
|
|
77
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-
|
|
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
18
|
import "./chunk-T7E75EKA.js";
|
|
19
|
-
import "./chunk-
|
|
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
1
|
import { CanonicalGateInputs, ReceiptMeta } from '@pushary/hook-mapping';
|
|
2
|
-
import { ClaudePreToolUseOutput,
|
|
2
|
+
import { ClaudePreToolUseOutput, MachineDecisionOrigin, SettledOutcome, AgentQuestion, PolicyConfig, ApprovalMode, ModeState } from '@pushary/contracts';
|
|
3
3
|
export { ApprovalMode, ModeState, PolicyConfig, ToolPolicy, resolvePolicy } from '@pushary/contracts';
|
|
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, canonical?: CanonicalGateInputs | null) => 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,20 +18,20 @@ 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-
|
|
34
|
+
import "../chunk-P4JVVJ2D.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-7IEB2GV4.js";
|
|
43
43
|
export {
|
|
44
44
|
askUser,
|
|
45
45
|
cancelQuestion,
|