@pushary/agent-hooks 1.7.1 → 1.7.3
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 +21 -0
- package/data/cursor-plugin/CHANGELOG.md +1 -0
- package/data/cursor-plugin/scripts/pushary-gate.mjs +3 -3
- package/data/cursor-plugin/scripts/pushary-gate.test.mjs +23 -1
- package/data/vscode-plugin/CHANGELOG.md +1 -0
- package/data/vscode-plugin/scripts/pushary-gate.mjs +3 -3
- package/dist/bin/pushary-bell-hook.js +23 -23
- package/dist/bin/pushary-bell.js +10 -10
- package/dist/bin/pushary-claude.js +48 -37
- package/dist/bin/pushary-clean.js +107 -60
- package/dist/bin/pushary-codex-bridge.js +18 -17
- package/dist/bin/pushary-codex-hook.js +53 -39
- package/dist/bin/pushary-codex.js +14 -12
- package/dist/bin/pushary-connect.js +16 -16
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +27 -27
- package/dist/bin/pushary-disconnect.js +19 -17
- package/dist/bin/pushary-doctor.js +63 -35
- package/dist/bin/pushary-elicitation-hook.js +35 -26
- package/dist/bin/pushary-gemini-bridge.js +12 -12
- package/dist/bin/pushary-gemini-hook.js +47 -32
- package/dist/bin/pushary-hook.js +34 -32
- package/dist/bin/pushary-login.js +16 -16
- package/dist/bin/pushary-logout.js +8 -8
- package/dist/bin/pushary-mcp.js +9 -8
- package/dist/bin/pushary-mode.js +10 -10
- package/dist/bin/pushary-notification-hook.js +29 -27
- package/dist/bin/pushary-opencode-hook.js +46 -32
- package/dist/bin/pushary-permission-denied-hook.js +34 -32
- package/dist/bin/pushary-permission-hook.js +33 -31
- package/dist/bin/pushary-post-hook.js +29 -27
- package/dist/bin/pushary-prompt-hook.js +29 -27
- package/dist/bin/pushary-session-end-hook.js +29 -27
- package/dist/bin/pushary-session-start-hook.js +33 -31
- package/dist/bin/pushary-setup.js +69 -56
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +19 -19
- package/dist/bin/pushary-stop-hook.js +29 -27
- package/dist/bin/pushary-stopfailure-hook.js +29 -27
- package/dist/bin/pushary-suggestions.js +5 -5
- package/dist/bin/pushary-transcript-register.js +19 -19
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +20 -20
- package/dist/bin/pushary-wait.js +10 -10
- package/dist/bin/pushary.js +6 -6
- package/dist/{chunk-MWVCDP64.js → chunk-3EUBQARL.js} +1 -1
- package/dist/{chunk-3QORH5EJ.js → chunk-5GB22QYL.js} +6 -4
- package/dist/chunk-5OP5MQI7.js +45 -0
- package/dist/{chunk-6PV2JQ64.js → chunk-5S2VBSJI.js} +2 -2
- package/dist/{chunk-UPKP67TA.js → chunk-62CVUUNU.js} +2 -2
- package/dist/{chunk-42XR73I2.js → chunk-62VT3BPH.js} +35 -35
- package/dist/chunk-6JQFIHZC.js +99 -0
- package/dist/{chunk-2FU43B5Q.js → chunk-7OA34PNW.js} +2 -2
- package/dist/{chunk-7GI6QC3M.js → chunk-7RUJKCR4.js} +2 -2
- package/dist/{chunk-H6JV44TE.js → chunk-AWVNAYGD.js} +1 -1
- package/dist/{chunk-XMN37YJH.js → chunk-BGBLLHZ4.js} +1 -1
- package/dist/{chunk-VCMFKZON.js → chunk-BIH2Y2HP.js} +2 -2
- package/dist/{chunk-YZKS3ME3.js → chunk-D6OODZCM.js} +2 -2
- package/dist/{chunk-JTQDP4ZL.js → chunk-DUQO4C4I.js} +3 -3
- package/dist/{chunk-3QE3BHBW.js → chunk-EADXTSHE.js} +2 -2
- package/dist/{chunk-43SSQCWO.js → chunk-EEEJ2JIL.js} +3 -3
- package/dist/{chunk-4C4NRDIC.js → chunk-EUGNVLMG.js} +1 -1
- package/dist/{chunk-WSC53O7I.js → chunk-G3OMOTJ4.js} +3 -3
- package/dist/{chunk-XFNVG3OV.js → chunk-G4GLCLKK.js} +44 -9
- package/dist/{chunk-62TEPRWQ.js → chunk-G62JL2NT.js} +1 -1
- package/dist/{chunk-QPR33SHS.js → chunk-G6RRVJOG.js} +6 -6
- package/dist/{chunk-Y6GKOZBT.js → chunk-IPSRMLCJ.js} +1 -1
- package/dist/{chunk-MCNS4725.js → chunk-IRZG3HEU.js} +1 -1
- package/dist/{chunk-55RO62FV.js → chunk-IWJKSIB4.js} +1 -1
- package/dist/{chunk-NID4UZDN.js → chunk-KEL5MXRL.js} +1 -1
- package/dist/{chunk-BYVB3RX3.js → chunk-KJXUIPS4.js} +2 -2
- package/dist/{chunk-SNWNA3MQ.js → chunk-LHC45YUC.js} +1 -1
- package/dist/{chunk-XPTCPU6V.js → chunk-LPNJLKBQ.js} +1 -1
- package/dist/{chunk-WZWXBTRF.js → chunk-MIXWMA73.js} +3 -3
- package/dist/{chunk-454KMJHF.js → chunk-MZBRL5H5.js} +34 -1
- package/dist/{chunk-KSNAAMU5.js → chunk-N5MZH5A6.js} +4 -4
- package/dist/chunk-N6IOSZOE.js +185 -0
- package/dist/{chunk-XPMOCJHN.js → chunk-NOI3XTCY.js} +1 -1
- package/dist/{chunk-NAAZCNKI.js → chunk-O3JDWNLU.js} +351 -37
- package/dist/{chunk-7GYGVQBU.js → chunk-OTNOANMX.js} +8 -8
- package/dist/{chunk-P5CBNSYL.js → chunk-OVC5QXN5.js} +1 -1
- package/dist/{chunk-O5JD7UI5.js → chunk-P2VIBGXA.js} +3 -3
- package/dist/{chunk-3T35OE7C.js → chunk-PRNFSORD.js} +4 -4
- package/dist/{chunk-OAL44FM2.js → chunk-R6OYCUNK.js} +1 -1
- package/dist/{chunk-6SJQ442W.js → chunk-RLW3JWDY.js} +2 -2
- package/dist/{chunk-SVEMF2VO.js → chunk-TCVMK6GI.js} +4 -4
- package/dist/{chunk-O5PRIYFZ.js → chunk-U4TMAANR.js} +3 -0
- package/dist/{chunk-WM3U2RUK.js → chunk-U6RVDUJ5.js} +75 -232
- package/dist/{chunk-KBLIVEFJ.js → chunk-UOQRM7JQ.js} +5 -5
- package/dist/{chunk-NQFGVAT6.js → chunk-VE7TXLR4.js} +19 -2
- package/dist/{chunk-IGBDOZUO.js → chunk-VKVSRCBO.js} +1 -1
- package/dist/{chunk-ZEMSCGDD.js → chunk-VYPJHGG6.js} +8 -3
- package/dist/{chunk-YQN7S57T.js → chunk-WGMW7OXW.js} +6 -6
- package/dist/{chunk-OTZHT34O.js → chunk-WPX67AKT.js} +1 -1
- package/dist/{chunk-XDASEYRS.js → chunk-WTJM7PSL.js} +3 -3
- package/dist/{chunk-Q7QRR6YL.js → chunk-Y4ZH64UK.js} +2 -2
- package/dist/{chunk-ZIIYTQHC.js → chunk-YC27PROF.js} +12 -4
- package/dist/{chunk-AHWJHLG5.js → chunk-YPUBA2FL.js} +7 -5
- package/dist/{chunk-EIZW73P5.js → chunk-YYCTF4Q5.js} +1 -1
- package/dist/{chunk-AAGLDXH4.js → chunk-ZKJ34T2F.js} +5 -5
- package/dist/{reapply-66GQIBXN.js → reapply-PH5T4BGR.js} +9 -9
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +22 -20
- package/package.json +2 -1
- package/dist/chunk-JMBG47WV.js +0 -336
- package/dist/chunk-YHG74UFF.js +0 -12
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readExistingMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OVC5QXN5.js";
|
|
4
4
|
import {
|
|
5
5
|
NetworkError
|
|
6
6
|
} from "./chunk-7QLSKOSU.js";
|
|
7
7
|
import {
|
|
8
8
|
getBaseUrl
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-R6OYCUNK.js";
|
|
10
10
|
import {
|
|
11
11
|
clientContextHeaders,
|
|
12
12
|
getPackageVersion
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G4GLCLKK.js";
|
|
14
14
|
|
|
15
15
|
// src/cli/net.ts
|
|
16
16
|
import { createRequire } from "module";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETUP_FLAGS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BGBLLHZ4.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-G4GLCLKK.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/cowork.ts
|
|
20
20
|
import { readFileSync } from "fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pusharyFetch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DUQO4C4I.js";
|
|
4
4
|
import {
|
|
5
5
|
NetworkError
|
|
6
6
|
} from "./chunk-7QLSKOSU.js";
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
} from "./chunk-KZERVKTD.js";
|
|
10
10
|
import {
|
|
11
11
|
getBaseUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-R6OYCUNK.js";
|
|
13
13
|
import {
|
|
14
14
|
isValidApiKey,
|
|
15
15
|
normalizeKeyScope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-G4GLCLKK.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;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CLAUDE_HOOK_EVENTS,
|
|
3
3
|
supportedClaudeEvents
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MIXWMA73.js";
|
|
5
5
|
import {
|
|
6
6
|
guardBinary,
|
|
7
7
|
holdBudgetOf,
|
|
8
8
|
isProtectedByScope,
|
|
9
9
|
registerHookEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MZBRL5H5.js";
|
|
11
11
|
import {
|
|
12
12
|
HOOK_LOCATOR_BINARY,
|
|
13
13
|
withHookHoldBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-G4GLCLKK.js";
|
|
15
15
|
|
|
16
16
|
// src/claude-config.ts
|
|
17
17
|
import { join } from "path";
|
|
@@ -455,9 +455,42 @@ var compatibleTargetFiles = (profile) => {
|
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
// ../contracts/src/redaction.ts
|
|
458
|
-
var
|
|
458
|
+
var CREDENTIAL_NAME = String.raw`(?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)["']?`;
|
|
459
|
+
var CREDENTIAL_KEY = String.raw`${CREDENTIAL_NAME}\s*[=:]\s*`;
|
|
460
|
+
var DISPLAYED_CREDENTIAL_KEY = String.raw`${CREDENTIAL_NAME}(?:[ \t]*:[ \t]*|[ \t]+=[ \t]*|=)`;
|
|
461
|
+
var SHELL_INERT_UNIT = String.raw`(?:[A-Za-z0-9_\-./+=:@%^!#]|\\[^\s'"])`;
|
|
462
|
+
var SHELL_INERT_SINGLE_QUOTED_UNIT = String.raw`[A-Za-z0-9_\-./+=:@%^!#\\]`;
|
|
463
|
+
var SHELL_INERT_URL_PASSWORD_UNIT = String.raw`(?:[A-Za-z0-9_\-.+=:%^!#]|\\[^\s'"@/])`;
|
|
464
|
+
var PEM_LINE_BREAK = String.raw`(?:\r?\n|(?:\\r)?\\n)`;
|
|
465
|
+
var credentialAssignmentRule = (key, doubleQuoted, singleQuoted, bare) => ({
|
|
466
|
+
pattern: new RegExp(String.raw`(${key})(?:(")${doubleQuoted}|(')${singleQuoted}|(["']?)${bare})`, "gi"),
|
|
467
|
+
replacement: "$1$2$3$4[redacted]$2$3"
|
|
468
|
+
});
|
|
469
|
+
var DISPLAYED_SECRET_SHAPES = {
|
|
470
|
+
privateKeyBody: String.raw`${PEM_LINE_BREAK}?(?:(?:Proc-Type|DEK-Info): [A-Za-z0-9,-]+${PEM_LINE_BREAK})*(?:[A-Za-z0-9+/=\r\n]|\\[rn])*?`,
|
|
471
|
+
urlPassword: `${SHELL_INERT_URL_PASSWORD_UNIT}+`,
|
|
472
|
+
authorizationValue: `${SHELL_INERT_UNIT}+`,
|
|
473
|
+
credentialAssignment: credentialAssignmentRule(
|
|
474
|
+
DISPLAYED_CREDENTIAL_KEY,
|
|
475
|
+
`${SHELL_INERT_UNIT}*"`,
|
|
476
|
+
`${SHELL_INERT_SINGLE_QUOTED_UNIT}*'`,
|
|
477
|
+
`${SHELL_INERT_UNIT}+`
|
|
478
|
+
)
|
|
479
|
+
};
|
|
480
|
+
var CUT_OFF_SECRET_SHAPES = {
|
|
481
|
+
privateKeyBody: String.raw`[\s\S]*?`,
|
|
482
|
+
urlPassword: String.raw`[^\s@/]+`,
|
|
483
|
+
authorizationValue: String.raw`\S+`,
|
|
484
|
+
credentialAssignment: credentialAssignmentRule(
|
|
485
|
+
CREDENTIAL_KEY,
|
|
486
|
+
String.raw`(?:\\[\s\S]|[^"\\])*(?:"|\\?$)`,
|
|
487
|
+
"[^']*(?:'|$)",
|
|
488
|
+
String.raw`\S+`
|
|
489
|
+
)
|
|
490
|
+
};
|
|
491
|
+
var secretRedactionRules = (shapes) => [
|
|
459
492
|
{ pattern: /\bpk_[A-Za-z0-9_]+\.[A-Za-z0-9_]+/g, replacement: "[redacted]" },
|
|
460
|
-
{ pattern:
|
|
493
|
+
{ pattern: new RegExp(String.raw`-----BEGIN[A-Z0-9 ]*PRIVATE KEY-----${shapes.privateKeyBody}-----END[A-Z0-9 ]*PRIVATE KEY-----`, "g"), replacement: "[redacted key]" },
|
|
461
494
|
{ pattern: /\bsk-[A-Za-z0-9_-]{16,}\b/g, replacement: "[redacted]" },
|
|
462
495
|
{ pattern: /\b[spr]k_(?:live|test)_[A-Za-z0-9]{8,}\b/g, replacement: "[redacted]" },
|
|
463
496
|
{ pattern: /\bwhsec_[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
@@ -470,16 +503,17 @@ var SECRET_REDACTION_RULES = [
|
|
|
470
503
|
{ pattern: /\bnpm_[A-Za-z0-9]{36}\b/g, replacement: "[redacted]" },
|
|
471
504
|
{ pattern: /\bxai-[A-Za-z0-9]{16,}\b/g, replacement: "[redacted]" },
|
|
472
505
|
{ pattern: /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, replacement: "[redacted]" },
|
|
473
|
-
{ pattern:
|
|
506
|
+
{ pattern: new RegExp(String.raw`\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)${shapes.urlPassword}@`, "gi"), replacement: "$1[redacted]@" },
|
|
474
507
|
{ pattern: /\bbearer\s+[A-Za-z0-9._~+/=-]+/gi, replacement: "bearer [redacted]" },
|
|
475
|
-
{ pattern:
|
|
476
|
-
|
|
477
|
-
pattern: /((?:secret|token|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)["']?\s*[=:]\s*)(?:(")(?:\\[\s\S]|[^"\\])*(?:"|\\?$)|(')[^']*(?:'|$)|\S+)/gi,
|
|
478
|
-
replacement: "$1$2$3[redacted]$2$3"
|
|
479
|
-
}
|
|
508
|
+
{ pattern: new RegExp(String.raw`\bauthorization:\s*${shapes.authorizationValue}`, "gi"), replacement: "authorization: [redacted]" },
|
|
509
|
+
shapes.credentialAssignment
|
|
480
510
|
];
|
|
511
|
+
var SECRET_REDACTION_RULES = secretRedactionRules(DISPLAYED_SECRET_SHAPES);
|
|
512
|
+
var CUT_OFF_TEXT_REDACTION_RULES = secretRedactionRules(CUT_OFF_SECRET_SHAPES);
|
|
481
513
|
var HIGH_ENTROPY_RULE = { pattern: /[A-Za-z0-9+/]{40,}={0,2}/g, replacement: "[redacted]" };
|
|
482
|
-
var
|
|
514
|
+
var applyRedactionRules = (rules, text) => rules.reduce((acc, rule) => acc.replace(rule.pattern, rule.replacement), text);
|
|
515
|
+
var redactSecrets = (text) => applyRedactionRules(SECRET_REDACTION_RULES, text);
|
|
516
|
+
var redactSecretsFromContent = (text) => applyRedactionRules(CUT_OFF_TEXT_REDACTION_RULES, text);
|
|
483
517
|
var redactSecretsDeep = (text) => redactSecrets(text).replace(HIGH_ENTROPY_RULE.pattern, HIGH_ENTROPY_RULE.replacement);
|
|
484
518
|
|
|
485
519
|
// ../contracts/src/degraded.ts
|
|
@@ -2584,6 +2618,7 @@ export {
|
|
|
2584
2618
|
hookCompatibleProfileBySource,
|
|
2585
2619
|
compatibleTargetFiles,
|
|
2586
2620
|
redactSecrets,
|
|
2621
|
+
redactSecretsFromContent,
|
|
2587
2622
|
redactSecretsDeep,
|
|
2588
2623
|
degradedLine,
|
|
2589
2624
|
hookWritePath,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IPSRMLCJ.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureCodexTrustsPusharyHooks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RLW3JWDY.js";
|
|
7
7
|
import {
|
|
8
8
|
addClaudeMcpServer,
|
|
9
9
|
addPusharyHooks,
|
|
10
10
|
addPusharyToolPermissions
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G3OMOTJ4.js";
|
|
12
12
|
import {
|
|
13
13
|
claudeUnprovenHolds,
|
|
14
14
|
claudeWired,
|
|
15
15
|
codexUnprovenHolds,
|
|
16
16
|
codexWired,
|
|
17
17
|
geminiWired
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WTJM7PSL.js";
|
|
19
19
|
import {
|
|
20
20
|
CLAUDE_HOOK_BINARY,
|
|
21
21
|
CLAUDE_HOOK_EVENTS,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
needsReregistration,
|
|
28
28
|
registrationSignatures,
|
|
29
29
|
supportedClaudeEvents
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MIXWMA73.js";
|
|
31
31
|
import {
|
|
32
32
|
CODEX_HOOK_BINARY,
|
|
33
33
|
addCodexHookTrust,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
registrationHolderOf,
|
|
48
48
|
resolveGlobalBinary,
|
|
49
49
|
vscodePluginMcp
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-MZBRL5H5.js";
|
|
51
51
|
import {
|
|
52
52
|
readJsonSafe,
|
|
53
53
|
writeFileAtomic,
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-POFBE6ZY.js";
|
|
4
4
|
import {
|
|
5
5
|
autoUpdateState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MZBRL5H5.js";
|
|
7
7
|
import {
|
|
8
8
|
readJsonSafe,
|
|
9
9
|
writeJsonAtomic
|
|
10
10
|
} from "./chunk-T7E75EKA.js";
|
|
11
11
|
import {
|
|
12
12
|
ownPackageRoot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G4GLCLKK.js";
|
|
14
14
|
|
|
15
15
|
// src/auto-update.ts
|
|
16
16
|
import { spawn } from "child_process";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NOTIFICATION_MATCHED_TYPES,
|
|
3
3
|
POSTTOOLUSE_MIRRORED_TOOLS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EUGNVLMG.js";
|
|
5
5
|
import {
|
|
6
6
|
isProtectedByScope,
|
|
7
7
|
registerHookEntry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MZBRL5H5.js";
|
|
9
9
|
import {
|
|
10
10
|
CLAUDE_PRETOOLUSE_MATCHER,
|
|
11
11
|
HOOK_BUDGETS,
|
|
12
12
|
HOOK_LOCATOR_BINARY
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G4GLCLKK.js";
|
|
14
14
|
|
|
15
15
|
// src/gemini-config.ts
|
|
16
16
|
var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
HOOK_LOCATOR_BINARY,
|
|
4
4
|
isReleaseVersion,
|
|
5
5
|
withHookHoldBudget
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G4GLCLKK.js";
|
|
7
7
|
|
|
8
8
|
// src/npm.ts
|
|
9
9
|
import { execFileSync, execSync } from "child_process";
|
|
@@ -56,6 +56,32 @@ var resolvePathBinary = (name, platform = process.platform) => {
|
|
|
56
56
|
return void 0;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
var NPM_MISSING_MESSAGE = "npm is not on PATH, and the hooks run from a global npm install.";
|
|
60
|
+
var NPM_LOOKUP = process.platform === "win32" ? "where npm" : "command -v npm";
|
|
61
|
+
var npmIsOnPath = () => {
|
|
62
|
+
try {
|
|
63
|
+
execSync(NPM_LOOKUP, { env: cleanNpmEnv(), stdio: "ignore", timeout: 5e3 });
|
|
64
|
+
return true;
|
|
65
|
+
} catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var GLOBAL_LIST_TIMEOUT_MS = 3e4;
|
|
70
|
+
var globalPackageState = (name) => {
|
|
71
|
+
try {
|
|
72
|
+
const listing = JSON.parse(execNpm("list -g --depth=0 --json --no-workspaces", { timeout: GLOBAL_LIST_TIMEOUT_MS }).toString());
|
|
73
|
+
const dependencies = typeof listing === "object" && listing !== null && "dependencies" in listing ? listing.dependencies : void 0;
|
|
74
|
+
return typeof dependencies === "object" && dependencies !== null && name in dependencies ? "installed" : "absent";
|
|
75
|
+
} catch {
|
|
76
|
+
return "unknown";
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var NpmMissingError = class extends Error {
|
|
80
|
+
constructor() {
|
|
81
|
+
super(NPM_MISSING_MESSAGE);
|
|
82
|
+
this.name = "NpmMissingError";
|
|
83
|
+
}
|
|
84
|
+
};
|
|
59
85
|
var resolveBinary = (name) => resolveGlobalBinary(name) ?? resolvePathBinary(name);
|
|
60
86
|
var resolvePackageVersionFromBinary = (binary, packageName) => {
|
|
61
87
|
try {
|
|
@@ -176,6 +202,7 @@ var installGlobally = (options) => {
|
|
|
176
202
|
return installState.then((result) => result === "installed" ? "cached" : result);
|
|
177
203
|
}
|
|
178
204
|
const started = (async () => {
|
|
205
|
+
if (!npmIsOnPath()) throw new NpmMissingError();
|
|
179
206
|
const pinned = process.env.PUSHARY_PIN_GLOBAL_VERSION !== "0";
|
|
180
207
|
if (pinned && !needsGlobalInstall(
|
|
181
208
|
options.version,
|
|
@@ -625,6 +652,7 @@ var autoUpdateLock = () => join3(pusharyDir(), "auto-update.lock");
|
|
|
625
652
|
var autoUpdateLog = () => join3(pusharyDir(), "logs", "auto-update.log");
|
|
626
653
|
var clientReportClaims = () => join3(pusharyDir(), "client-reports");
|
|
627
654
|
var claudeRegistrationReceipt = () => join3(pusharyDir(), "setup", "claude-registration.json");
|
|
655
|
+
var hermesConfig = () => join3(homedir2(), ".hermes", "config.yaml");
|
|
628
656
|
var hermesConfigReceipt = () => join3(pusharyDir(), "setup", "hermes-config.json");
|
|
629
657
|
var fxQuestionRuleReceipt = () => join3(pusharyDir(), "setup", "fx-question-rule.json");
|
|
630
658
|
var hookTakeoverReceipt = (agent) => join3(pusharyDir(), "setup", `hook-takeover-${agent}.json`);
|
|
@@ -642,11 +670,15 @@ export {
|
|
|
642
670
|
registeredCommands,
|
|
643
671
|
namesOurBinary,
|
|
644
672
|
registrationHolderOf,
|
|
673
|
+
AGENT_HOOKS_PACKAGE,
|
|
645
674
|
LATEST_TAG,
|
|
646
675
|
npmErrorMessage,
|
|
647
676
|
execNpm,
|
|
648
677
|
resolveGlobalBinary,
|
|
649
678
|
resolvePathBinary,
|
|
679
|
+
npmIsOnPath,
|
|
680
|
+
globalPackageState,
|
|
681
|
+
NpmMissingError,
|
|
650
682
|
resolveBinary,
|
|
651
683
|
resolvePackageVersionFromBinary,
|
|
652
684
|
resolveGlobalPackageVersion,
|
|
@@ -704,6 +736,7 @@ export {
|
|
|
704
736
|
autoUpdateLog,
|
|
705
737
|
clientReportClaims,
|
|
706
738
|
claudeRegistrationReceipt,
|
|
739
|
+
hermesConfig,
|
|
707
740
|
hermesConfigReceipt,
|
|
708
741
|
fxQuestionRuleReceipt,
|
|
709
742
|
hookTakeoverReceipt,
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-POFBE6ZY.js";
|
|
5
5
|
import {
|
|
6
6
|
isNetworkFailure
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DUQO4C4I.js";
|
|
8
8
|
import {
|
|
9
9
|
clientReportClaims
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MZBRL5H5.js";
|
|
11
11
|
import {
|
|
12
12
|
getApiKey,
|
|
13
13
|
getBaseUrl
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-R6OYCUNK.js";
|
|
15
15
|
import {
|
|
16
16
|
CLIENT_REPORT_PATH,
|
|
17
17
|
degradedLine
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-G4GLCLKK.js";
|
|
19
19
|
|
|
20
20
|
// src/client-report-claim.ts
|
|
21
21
|
import { createHash } from "crypto";
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// src/pending.ts
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { homedir, tmpdir } from "os";
|
|
4
|
+
import { createHash } from "crypto";
|
|
5
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, renameSync, unlinkSync, rmSync, statSync } from "fs";
|
|
6
|
+
var PENDING_DIR = join(tmpdir(), "pushary-pending");
|
|
7
|
+
var commandRoot = () => process.env.PUSHARY_COMMAND_DIR?.trim() || join(homedir(), ".pushary", "run", "commands");
|
|
8
|
+
var DEFAULT_SESSION = "_no_session";
|
|
9
|
+
var GRACE_MS = 10 * 60 * 1e3;
|
|
10
|
+
var sanitize = (sessionId) => sessionId.replace(/[^A-Za-z0-9_-]/g, "_").slice(0, 128) || DEFAULT_SESSION;
|
|
11
|
+
var dirFor = (sessionId) => join(PENDING_DIR, sanitize(sessionId));
|
|
12
|
+
var commandDirFor = (sessionId, namespace = "") => join(
|
|
13
|
+
commandRoot(),
|
|
14
|
+
createHash("sha256").update(namespace).digest("hex").slice(0, 16),
|
|
15
|
+
sanitize(sessionId)
|
|
16
|
+
);
|
|
17
|
+
var legacyCommandFile = (sessionId, namespace = "") => join(commandDirFor(sessionId, namespace), "command.json");
|
|
18
|
+
var commandFile = (sessionId, id, namespace = "") => join(commandDirFor(sessionId, namespace), `${createHash("sha256").update(id).digest("hex")}.json`);
|
|
19
|
+
var readCommandFile = (file) => {
|
|
20
|
+
try {
|
|
21
|
+
const value = JSON.parse(readFileSync(file, "utf-8"));
|
|
22
|
+
if (typeof value.id !== "string" || typeof value.text !== "string" || typeof value.expiresAtMs !== "number") return null;
|
|
23
|
+
if (value.expiresAtMs <= Date.now()) {
|
|
24
|
+
unlinkSync(file);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...value,
|
|
29
|
+
delivered: value.delivered === true,
|
|
30
|
+
...value.failed === true ? { failed: true } : {}
|
|
31
|
+
};
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var readPendingCommandById = (sessionId, id, namespace = "") => {
|
|
37
|
+
const current = readCommandFile(commandFile(sessionId, id, namespace));
|
|
38
|
+
if (current?.id === id) return current;
|
|
39
|
+
const legacy = readCommandFile(legacyCommandFile(sessionId, namespace));
|
|
40
|
+
return legacy?.id === id ? legacy : null;
|
|
41
|
+
};
|
|
42
|
+
var pruneExpiredCommands = (dir) => {
|
|
43
|
+
let files;
|
|
44
|
+
try {
|
|
45
|
+
files = readdirSync(dir).filter((file) => file.endsWith(".json"));
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return files.flatMap((file) => {
|
|
50
|
+
const command = readCommandFile(join(dir, file));
|
|
51
|
+
return command ? [command] : [];
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var pruneExpiredCommandStore = () => {
|
|
55
|
+
let namespaces;
|
|
56
|
+
try {
|
|
57
|
+
namespaces = readdirSync(commandRoot(), { withFileTypes: true });
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
for (const namespace of namespaces.filter((entry) => entry.isDirectory())) {
|
|
62
|
+
const namespaceDir = join(commandRoot(), namespace.name);
|
|
63
|
+
let sessions;
|
|
64
|
+
try {
|
|
65
|
+
sessions = readdirSync(namespaceDir, { withFileTypes: true });
|
|
66
|
+
} catch {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
for (const session of sessions.filter((entry) => entry.isDirectory())) {
|
|
70
|
+
pruneExpiredCommands(join(namespaceDir, session.name));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var readPendingCommand = (sessionId, namespace = "") => {
|
|
75
|
+
const commands = pruneExpiredCommands(commandDirFor(sessionId, namespace));
|
|
76
|
+
return commands.find((command) => !command.delivered && !command.failed) ?? commands[0] ?? null;
|
|
77
|
+
};
|
|
78
|
+
var savePendingCommand = (sessionId, command, namespace = "") => {
|
|
79
|
+
const dir = commandDirFor(sessionId, namespace);
|
|
80
|
+
try {
|
|
81
|
+
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
82
|
+
pruneExpiredCommandStore();
|
|
83
|
+
if (readPendingCommandById(sessionId, command.id, namespace)) return false;
|
|
84
|
+
writeFileSync(commandFile(sessionId, command.id, namespace), JSON.stringify(command), { encoding: "utf-8", mode: 384, flag: "wx" });
|
|
85
|
+
return true;
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var updatePendingCommand = (sessionId, id, update, namespace = "") => {
|
|
91
|
+
const command = readPendingCommandById(sessionId, id, namespace);
|
|
92
|
+
if (!command) return false;
|
|
93
|
+
const currentFile = commandFile(sessionId, id, namespace);
|
|
94
|
+
const file = existsSync(currentFile) ? currentFile : legacyCommandFile(sessionId, namespace);
|
|
95
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
96
|
+
try {
|
|
97
|
+
writeFileSync(temporary, JSON.stringify({ ...command, ...update, text: "" }), { encoding: "utf-8", mode: 384 });
|
|
98
|
+
renameSync(temporary, file);
|
|
99
|
+
return true;
|
|
100
|
+
} catch {
|
|
101
|
+
try {
|
|
102
|
+
unlinkSync(temporary);
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var markPendingCommandDelivered = (sessionId, id, namespace = "") => updatePendingCommand(sessionId, id, { delivered: true, failed: void 0 }, namespace);
|
|
109
|
+
var markPendingCommandFailed = (sessionId, id, namespace = "") => updatePendingCommand(sessionId, id, { delivered: false, failed: true }, namespace);
|
|
110
|
+
var removePendingCommand = (sessionId, id, namespace = "") => {
|
|
111
|
+
if (!readPendingCommandById(sessionId, id, namespace)) return;
|
|
112
|
+
try {
|
|
113
|
+
unlinkSync(commandFile(sessionId, id, namespace));
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
if (readCommandFile(legacyCommandFile(sessionId, namespace))?.id === id) {
|
|
118
|
+
unlinkSync(legacyCommandFile(sessionId, namespace));
|
|
119
|
+
}
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var isDefaultSession = (sessionId) => sanitize(sessionId) === DEFAULT_SESSION;
|
|
124
|
+
var listPendingQuestionsForToolUse = (sessionId, toolUseId) => {
|
|
125
|
+
if (!toolUseId) return [];
|
|
126
|
+
const dir = dirFor(sessionId);
|
|
127
|
+
let files;
|
|
128
|
+
try {
|
|
129
|
+
files = readdirSync(dir);
|
|
130
|
+
} catch {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
return files.filter((name) => {
|
|
134
|
+
try {
|
|
135
|
+
return readFileSync(join(dir, name), "utf-8") === toolUseId;
|
|
136
|
+
} catch {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
var listPendingQuestions = (sessionId) => {
|
|
142
|
+
const dir = dirFor(sessionId);
|
|
143
|
+
let files;
|
|
144
|
+
try {
|
|
145
|
+
files = readdirSync(dir);
|
|
146
|
+
} catch {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
if (!isDefaultSession(sessionId)) return files;
|
|
150
|
+
const cutoff = Date.now() - GRACE_MS;
|
|
151
|
+
return files.filter((name) => {
|
|
152
|
+
try {
|
|
153
|
+
return statSync(join(dir, name)).mtimeMs < cutoff;
|
|
154
|
+
} catch {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
var removePendingQuestion = (sessionId, correlationId) => {
|
|
160
|
+
try {
|
|
161
|
+
unlinkSync(join(dirFor(sessionId), correlationId));
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var removePendingSession = (sessionId) => {
|
|
166
|
+
try {
|
|
167
|
+
rmSync(dirFor(sessionId), { recursive: true, force: true });
|
|
168
|
+
} catch {
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
DEFAULT_SESSION,
|
|
174
|
+
readPendingCommandById,
|
|
175
|
+
readPendingCommand,
|
|
176
|
+
savePendingCommand,
|
|
177
|
+
markPendingCommandDelivered,
|
|
178
|
+
markPendingCommandFailed,
|
|
179
|
+
removePendingCommand,
|
|
180
|
+
isDefaultSession,
|
|
181
|
+
listPendingQuestionsForToolUse,
|
|
182
|
+
listPendingQuestions,
|
|
183
|
+
removePendingQuestion,
|
|
184
|
+
removePendingSession
|
|
185
|
+
};
|