@pushary/agent-hooks 1.3.1 → 1.4.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/dist/bin/pushary-bell-hook.js +18 -18
  4. package/dist/bin/pushary-bell.js +8 -8
  5. package/dist/bin/pushary-claude.js +18 -18
  6. package/dist/bin/pushary-clean.js +490 -95
  7. package/dist/bin/pushary-codex-bridge.js +10 -10
  8. package/dist/bin/pushary-codex-hook.js +28 -26
  9. package/dist/bin/pushary-codex.js +6 -6
  10. package/dist/bin/pushary-connect.js +8 -8
  11. package/dist/bin/pushary-cowork.js +5 -5
  12. package/dist/bin/pushary-daemon.js +24 -24
  13. package/dist/bin/pushary-disconnect.js +12 -12
  14. package/dist/bin/pushary-doctor.js +75 -26
  15. package/dist/bin/pushary-elicitation-hook.js +17 -17
  16. package/dist/bin/pushary-gemini-bridge.js +9 -9
  17. package/dist/bin/pushary-gemini-hook.js +19 -19
  18. package/dist/bin/pushary-hook.js +27 -27
  19. package/dist/bin/pushary-login.js +9 -9
  20. package/dist/bin/pushary-logout.js +6 -6
  21. package/dist/bin/pushary-mode.js +5 -5
  22. package/dist/bin/pushary-notification-hook.js +20 -20
  23. package/dist/bin/pushary-opencode-hook.js +19 -19
  24. package/dist/bin/pushary-permission-denied-hook.js +24 -24
  25. package/dist/bin/pushary-permission-hook.js +25 -25
  26. package/dist/bin/pushary-post-hook.js +20 -20
  27. package/dist/bin/pushary-prompt-hook.js +20 -20
  28. package/dist/bin/pushary-session-end-hook.js +20 -20
  29. package/dist/bin/pushary-session-start-hook.js +22 -22
  30. package/dist/bin/pushary-setup.js +38 -59
  31. package/dist/bin/pushary-stats.js +4 -4
  32. package/dist/bin/pushary-status.js +12 -12
  33. package/dist/bin/pushary-stop-hook.js +20 -20
  34. package/dist/bin/pushary-stopfailure-hook.js +20 -20
  35. package/dist/bin/pushary-suggestions.js +2 -2
  36. package/dist/bin/pushary-transcript-register.js +16 -16
  37. package/dist/bin/pushary-transcripts.js +6 -6
  38. package/dist/bin/pushary-upgrade.js +16 -16
  39. package/dist/bin/pushary-wait.js +5 -5
  40. package/dist/bin/pushary.js +1 -1
  41. package/dist/{chunk-RERJ2ZDV.js → chunk-2GMI6JH6.js} +5 -5
  42. package/dist/{chunk-AFOTOA24.js → chunk-37VLIYLI.js} +35 -4
  43. package/dist/{chunk-6HH4IH4K.js → chunk-3BPB2HYZ.js} +3 -3
  44. package/dist/{chunk-465UENKO.js → chunk-3T52B2OF.js} +1 -1
  45. package/dist/{chunk-PEV6ULSM.js → chunk-3UA6FPRC.js} +3 -3
  46. package/dist/{chunk-QDYJQLXT.js → chunk-43JKGLZZ.js} +2 -2
  47. package/dist/{chunk-CKLWJ6EL.js → chunk-4FN6VV56.js} +33 -7
  48. package/dist/{chunk-HCTSTMDD.js → chunk-ALFT7H5B.js} +3 -3
  49. package/dist/{chunk-35RPUNYU.js → chunk-BZBUPZC6.js} +1 -1
  50. package/dist/{chunk-CDSL3LLO.js → chunk-CRNAXFQ6.js} +1 -1
  51. package/dist/{chunk-NDSOOJDX.js → chunk-D7ERHWYB.js} +1 -1
  52. package/dist/{chunk-KHGIM2BN.js → chunk-ED5TA2FJ.js} +3 -3
  53. package/dist/{chunk-LZQVAEWP.js → chunk-FAH3D74E.js} +2 -1
  54. package/dist/{chunk-5UWDYOZX.js → chunk-FVKFDTN6.js} +81 -8
  55. package/dist/{chunk-I2OLM3DM.js → chunk-GOFDGTEI.js} +62 -12
  56. package/dist/{chunk-JZA2JOGO.js → chunk-HK3IXIQJ.js} +1 -1
  57. package/dist/{chunk-LWT34GSY.js → chunk-HQLAZWJJ.js} +7 -7
  58. package/dist/{chunk-5XKMOZO6.js → chunk-I6HRQOMT.js} +4 -4
  59. package/dist/{chunk-EAGMQMRM.js → chunk-JOVWYVSR.js} +1 -1
  60. package/dist/{chunk-5WLH2ENB.js → chunk-K6I5M2ME.js} +1 -1
  61. package/dist/{chunk-REIZ5GXG.js → chunk-KEMEBTCJ.js} +4 -4
  62. package/dist/{chunk-PHXU4NOP.js → chunk-KI36MAT6.js} +2 -2
  63. package/dist/{chunk-WOBHHXW5.js → chunk-LNGYW6G4.js} +5 -4
  64. package/dist/{chunk-AFKOWCMQ.js → chunk-LUT2EZLG.js} +1 -1
  65. package/dist/{chunk-KLZJEMSE.js → chunk-LYXX5NSB.js} +1 -1
  66. package/dist/{chunk-YXWM4TNX.js → chunk-MN3XOVRK.js} +1 -1
  67. package/dist/{chunk-XOUQUZ43.js → chunk-PHHGHHOW.js} +1 -1
  68. package/dist/{chunk-TW7KA27C.js → chunk-QBS6LGEK.js} +1 -1
  69. package/dist/{chunk-FGNABUPN.js → chunk-R3AMKNIW.js} +1 -1
  70. package/dist/{chunk-TGG4FWWB.js → chunk-S3EP4B35.js} +2 -2
  71. package/dist/{chunk-34NNTYK6.js → chunk-SAF6NNXY.js} +1 -1
  72. package/dist/{chunk-R5CU7ED6.js → chunk-SKXLIVFM.js} +1 -1
  73. package/dist/{chunk-OMP3KDDU.js → chunk-SWFF5U2N.js} +1 -1
  74. package/dist/{chunk-QOCWB4Q6.js → chunk-TF4IOINR.js} +3 -3
  75. package/dist/{chunk-5SALHATY.js → chunk-TI3ZWXZG.js} +11 -2
  76. package/dist/{chunk-P232YODQ.js → chunk-TNS3YLFE.js} +6 -6
  77. package/dist/{chunk-GOQHN2UH.js → chunk-TWWLVOPB.js} +1 -1
  78. package/dist/{chunk-XVE52YFZ.js → chunk-VYUDGQM7.js} +1 -1
  79. package/dist/{chunk-XP2KRTZD.js → chunk-WEO5JCB4.js} +1 -1
  80. package/dist/{chunk-SGZE2JBF.js → chunk-WIOXWUUH.js} +3 -3
  81. package/dist/{reapply-ADFRVH5N.js → reapply-BAWDJTG7.js} +8 -8
  82. package/dist/src/index.d.ts +19 -16
  83. package/dist/src/index.js +12 -12
  84. package/package.json +1 -1
@@ -1,22 +1,24 @@
1
1
  import {
2
+ activeHookSource,
2
3
  activeIdentity
3
- } from "./chunk-LWT34GSY.js";
4
+ } from "./chunk-HQLAZWJJ.js";
4
5
  import {
5
6
  blockedActionFingerprint,
6
7
  defersToNativeMode,
7
8
  forgetBlockedActionHint,
8
9
  hasBlockedActionHint,
9
10
  recordBlockedActionHint
10
- } from "./chunk-HCTSTMDD.js";
11
+ } from "./chunk-ALFT7H5B.js";
11
12
  import {
12
13
  isGatingMoment,
13
14
  recordKeylessMoment
14
- } from "./chunk-OMP3KDDU.js";
15
+ } from "./chunk-SWFF5U2N.js";
15
16
  import {
16
17
  denyReasonFrom,
17
18
  isDeferAnswer
18
19
  } from "./chunk-YHG74UFF.js";
19
20
  import {
21
+ AUTO_DECISION_WINDOW_MS,
20
22
  DEFAULT_SESSION,
21
23
  UNNAMED_ACTION,
22
24
  deriveAction,
@@ -34,7 +36,7 @@ import {
34
36
  scopePathFor,
35
37
  settleQuestionsForToolUse,
36
38
  throttlePass
37
- } from "./chunk-WOBHHXW5.js";
39
+ } from "./chunk-LNGYW6G4.js";
38
40
  import {
39
41
  DECISION_STOP_REASON,
40
42
  askUser,
@@ -49,18 +51,22 @@ import {
49
51
  } from "./chunk-LGXUGYUH.js";
50
52
  import {
51
53
  getMachineId
52
- } from "./chunk-465UENKO.js";
54
+ } from "./chunk-3T52B2OF.js";
53
55
  import {
54
56
  getApiKey,
55
57
  getBaseUrl
56
58
  } from "./chunk-2UMNXADU.js";
57
59
  import {
60
+ AGENT_QUESTION_STRATEGY,
58
61
  GATE_BLOCK_REASON_MAX_LENGTH,
59
62
  GATE_WIRE,
63
+ agentQuestionStrategy,
60
64
  buildDecisionEpisodeFeatures,
61
65
  claudePermissionDeniedOutput,
62
66
  claudePermissionRequestOutput,
63
67
  claudePreToolUseOutput,
68
+ claudePromptsBeforeAnEdit,
69
+ editAsksAtTheAgentsPrompt,
64
70
  effectiveWaitSeconds,
65
71
  hookHoldWindowMs,
66
72
  hookWaitClamped,
@@ -69,11 +75,13 @@ import {
69
75
  isBlockedActionRequest,
70
76
  isPermissionRequestOwnedByPreToolUse,
71
77
  isPusharyOwnTool,
78
+ machineDecisionFor,
72
79
  parseAgentQuestionAnswers,
73
80
  parseAgentQuestions,
74
81
  resolveGate,
75
- stoppedOutput
76
- } from "./chunk-5UWDYOZX.js";
82
+ stoppedOutput,
83
+ wireVerdictFor
84
+ } from "./chunk-FVKFDTN6.js";
77
85
 
78
86
  // src/decision-episode.ts
79
87
  var EPISODE_PATH = "/api/agent/decision-episode";
@@ -103,12 +111,38 @@ import { tmpdir } from "os";
103
111
  import { existsSync, writeFileSync } from "fs";
104
112
  var START_MS = Date.now();
105
113
  var ACTIVE_AGENT = activeIdentity(process.argv);
114
+ var ACTIVE_SOURCE = activeHookSource(process.argv);
106
115
  var agentNameIn = (projectName) => `${ACTIVE_AGENT.label} - ${projectName}`;
107
116
  var allow = (reason) => claudePreToolUseOutput("allow", reason);
108
117
  var deny = (reason) => claudePreToolUseOutput("deny", reason);
109
118
  var allowWithInput = (updatedInput) => claudePreToolUseOutput("allow", void 0, updatedInput);
110
119
  var ask = (reason) => claudePreToolUseOutput("ask", reason);
111
120
  var halted = (reason) => stoppedOutput(deny(reason), reason);
121
+ var reportMachineDecision = async (input, verdict) => {
122
+ const decision = machineDecisionFor(wireVerdictFor(verdict, 0));
123
+ if (!decision) return;
124
+ const sessionKey = input.session_id || DEFAULT_SESSION;
125
+ const toolTarget = deriveToolTarget(input.tool_name, input.tool_input);
126
+ const throttleKey = `machinedecision:${sessionKey}:${input.tool_name}:${decision.origin}:${toolTarget ?? ""}`;
127
+ if (!throttlePass(throttleKey, AUTO_DECISION_WINDOW_MS)) return;
128
+ await reportEvent(
129
+ {
130
+ event: "permission_denied",
131
+ occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
132
+ toolUseId: input.tool_use_id,
133
+ agentType: ACTIVE_AGENT.type,
134
+ agentName: agentNameIn(basename(input.cwd ?? process.cwd())),
135
+ action: permissionDeniedAction(input.tool_name),
136
+ sessionId: input.session_id,
137
+ decisionSource: "policy_auto",
138
+ decisionOrigin: decision.origin,
139
+ decisionOutcome: decision.outcome,
140
+ toolName: input.tool_name,
141
+ toolTarget
142
+ },
143
+ { maxAttempts: 1, timeoutMs: 800 }
144
+ ).catch(() => void 0);
145
+ };
112
146
  var storedWaitDeadline = (result, requestedDeadline) => {
113
147
  const stored = result.waitEndsAt ? Date.parse(result.waitEndsAt) : Number.NaN;
114
148
  return Number.isFinite(stored) ? Math.min(stored, requestedDeadline) : requestedDeadline;
@@ -519,11 +553,19 @@ var handlePreToolUse = async (input, canonical) => {
519
553
  try {
520
554
  const modeState = await fetchModeState(apiKey, input.session_id);
521
555
  const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
522
- const verdict = resolveGate(claudeGateInput(modeState, policy, input, canonical));
523
- if (verdict.kind === "kill") return halted(verdict.reason);
524
- if (verdict.kind === "deny") return deny(verdict.reason);
556
+ const gateInput = claudeGateInput(modeState, policy, input, canonical);
557
+ const verdict = resolveGate(gateInput);
558
+ if (verdict.kind === "kill") {
559
+ await reportMachineDecision(input, verdict);
560
+ return halted(verdict.reason);
561
+ }
562
+ if (verdict.kind === "deny") {
563
+ await reportMachineDecision(input, verdict);
564
+ return deny(verdict.reason);
565
+ }
525
566
  if (canonical === null) return deny(unreadableReason);
526
567
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return deny(batchScopeReason);
568
+ if (agentQuestionStrategy(ACTIVE_SOURCE, "PreToolUse", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
527
569
  if (input.tool_name === "AskUserQuestion") {
528
570
  return handleAskUserQuestion(apiKey, input, modeState);
529
571
  }
@@ -534,6 +576,7 @@ var handlePreToolUse = async (input, canonical) => {
534
576
  if (!(verdict.kind === "gate" && verdict.scopeReason) && shouldDeferToNativeMode(input.permission_mode, input.tool_name)) {
535
577
  return void 0;
536
578
  }
579
+ if (claudePromptsBeforeAnEdit(input.permission_mode) && editAsksAtTheAgentsPrompt(gateInput, verdict)) return handleTerminalOnly();
537
580
  switch (verdict.kind) {
538
581
  case "allow":
539
582
  return allow();
@@ -574,9 +617,16 @@ var handlePermissionRequest = async (input, canonical) => {
574
617
  const modeState = await fetchModeState(apiKey, input.session_id);
575
618
  const policy = await getPolicy(apiKey, modeState.policyVersion, ACTIVE_AGENT.type, true, input.session_id);
576
619
  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);
620
+ if (verdict.kind === "kill") {
621
+ await reportMachineDecision(input, verdict);
622
+ return permReqHalted(verdict.reason);
623
+ }
624
+ if (verdict.kind === "deny") {
625
+ await reportMachineDecision(input, verdict);
626
+ return permReqDeny(verdict.reason);
627
+ }
579
628
  if (canonical === null) return permReqDeny(unreadableReason);
629
+ if (agentQuestionStrategy(ACTIVE_SOURCE, "PermissionRequest", input.tool_name) === AGENT_QUESTION_STRATEGY.native) return void 0;
580
630
  if (verdict.kind === "gate" && verdict.scopeReason && (canonical?.toolInputs.length ?? 0) > 1) return permReqDeny(batchScopeReason);
581
631
  if (!(verdict.kind === "gate" && verdict.scopeReason) && isPermissionRequestOwnedByPreToolUse(input.tool_name, input.permission_mode, shouldDeferToNativeMode)) return void 0;
582
632
  switch (verdict.kind) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-5UWDYOZX.js";
4
+ } from "./chunk-FVKFDTN6.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -3,28 +3,28 @@ import {
3
3
  addPusharyToolPermissions,
4
4
  isPusharyHook,
5
5
  removeClaudeMcpServers
6
- } from "./chunk-SGZE2JBF.js";
6
+ } from "./chunk-WIOXWUUH.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  addGeminiMcpServer,
10
10
  removeGeminiMcpServer
11
- } from "./chunk-KHGIM2BN.js";
11
+ } from "./chunk-ED5TA2FJ.js";
12
12
  import {
13
13
  CLAUDE_CODE_AGENT,
14
14
  parseApplyPatchFiles
15
- } from "./chunk-WOBHHXW5.js";
15
+ } from "./chunk-LNGYW6G4.js";
16
16
  import {
17
17
  guardBinary,
18
18
  holdBudgetOf,
19
19
  registerHookEntry
20
- } from "./chunk-34NNTYK6.js";
20
+ } from "./chunk-SAF6NNXY.js";
21
21
  import {
22
22
  PHONE_ANSWERED_TOOLS,
23
23
  hookCompatibleProfile,
24
24
  hookCompatibleProfileBySource,
25
25
  toToolLookup,
26
26
  withHookHoldBudget
27
- } from "./chunk-5UWDYOZX.js";
27
+ } from "./chunk-FVKFDTN6.js";
28
28
 
29
29
  // src/compatible-config.ts
30
30
  import { homedir } from "os";
@@ -50,14 +50,14 @@ var namedSource = (argv) => {
50
50
  const inline = argv.find((argument) => argument.startsWith(`${SOURCE_FLAG}=`));
51
51
  if (inline) return inline.slice(SOURCE_FLAG.length + 1);
52
52
  const index = argv.indexOf(SOURCE_FLAG);
53
- return index === -1 ? void 0 : argv[index + 1];
53
+ return index === -1 ? void 0 : argv[index + 1] ?? "";
54
54
  };
55
55
  var activeHookSource = (argv) => {
56
56
  const named = namedAgent(argv);
57
57
  if (named !== void 0) return hookCompatibleProfile(named)?.source ?? null;
58
58
  const source = namedSource(argv);
59
59
  if (source === void 0) return "claude";
60
- return hookCompatibleProfileBySource(source)?.source ?? "claude";
60
+ return source === "claude" ? "claude" : hookCompatibleProfileBySource(source)?.source ?? null;
61
61
  };
62
62
  var PATCH_INPUT_KEYS = ["command", "patch", "input"];
63
63
  var patchedFiles = (toolInput) => [...new Set(PATCH_INPUT_KEYS.flatMap((key) => parseApplyPatchFiles(toolInput[key])))];
@@ -2,24 +2,24 @@ import {
2
2
  detectProviderLiveCapabilities,
3
3
  hasSpawnProvider,
4
4
  resolveControlPolicy
5
- } from "./chunk-PHXU4NOP.js";
5
+ } from "./chunk-KI36MAT6.js";
6
6
  import {
7
7
  daemonHasRemoteProof,
8
8
  daemonServiceManagerAvailable,
9
9
  hasDaemonServiceDefinition,
10
10
  readDaemonNeedsLogin,
11
11
  readDaemonStatus
12
- } from "./chunk-6HH4IH4K.js";
12
+ } from "./chunk-3BPB2HYZ.js";
13
13
  import {
14
14
  getMachineId
15
- } from "./chunk-465UENKO.js";
15
+ } from "./chunk-3T52B2OF.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-5SALHATY.js";
22
+ } from "./chunk-TI3ZWXZG.js";
23
23
  import {
24
24
  getBaseUrl
25
25
  } from "./chunk-2UMNXADU.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-34NNTYK6.js";
3
+ } from "./chunk-SAF6NNXY.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2UMNXADU.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-5UWDYOZX.js";
6
+ } from "./chunk-FVKFDTN6.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AGENT_CHOICES
3
- } from "./chunk-FGNABUPN.js";
3
+ } from "./chunk-R3AMKNIW.js";
4
4
  import {
5
5
  isBridgeLocator
6
- } from "./chunk-KLZJEMSE.js";
6
+ } from "./chunk-LYXX5NSB.js";
7
7
  import {
8
8
  pusharyHookExecutable
9
- } from "./chunk-QOCWB4Q6.js";
9
+ } from "./chunk-TF4IOINR.js";
10
10
  import {
11
11
  BELL_HOOK_BINARY
12
- } from "./chunk-EAGMQMRM.js";
12
+ } from "./chunk-JOVWYVSR.js";
13
13
 
14
14
  // src/setup/hook-ownership.ts
15
15
  var commandsIn = (value) => {
@@ -2,10 +2,10 @@ import {
2
2
  resolveBinary,
3
3
  resolveGlobalPackageVersion,
4
4
  resolvePackageVersionFromBinary
5
- } from "./chunk-34NNTYK6.js";
5
+ } from "./chunk-SAF6NNXY.js";
6
6
  import {
7
7
  MANAGED_PROVIDERS
8
- } from "./chunk-5UWDYOZX.js";
8
+ } from "./chunk-FVKFDTN6.js";
9
9
 
10
10
  // src/live-capabilities.ts
11
11
  var CLAUDE_BRIDGE_CAPABILITY = "claude-bridge";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NOTIFICATION_PUSH_TYPES,
3
3
  POSTTOOLUSE_MIRROR_ONLY_TOOLS
4
- } from "./chunk-XP2KRTZD.js";
4
+ } from "./chunk-WEO5JCB4.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-465UENKO.js";
13
+ } from "./chunk-3T52B2OF.js";
14
14
  import {
15
15
  withRetry
16
16
  } from "./chunk-EYRGBYZG.js";
17
17
  import {
18
18
  reportedInstallSource
19
- } from "./chunk-5WLH2ENB.js";
19
+ } from "./chunk-K6I5M2ME.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-5UWDYOZX.js";
47
+ } from "./chunk-FVKFDTN6.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,6 +1,6 @@
1
1
  import {
2
2
  parseVersion
3
- } from "./chunk-KHGIM2BN.js";
3
+ } from "./chunk-ED5TA2FJ.js";
4
4
 
5
5
  // src/setup/agent-probe.ts
6
6
  import { execSync } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HOOK_LOCATOR_BINARY
3
- } from "./chunk-5UWDYOZX.js";
3
+ } from "./chunk-FVKFDTN6.js";
4
4
 
5
5
  // src/diagnostics/bridge.ts
6
6
  import { execFileSync } from "child_process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-5SALHATY.js";
3
+ } from "./chunk-TI3ZWXZG.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-34NNTYK6.js";
3
+ } from "./chunk-SAF6NNXY.js";
4
4
  import {
5
5
  readJsonSafe
6
6
  } from "./chunk-T7E75EKA.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-5UWDYOZX.js";
16
+ } from "./chunk-FVKFDTN6.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;
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  COMPATIBLE_AGENT_TYPES,
9
9
  isValidApiKey
10
- } from "./chunk-5UWDYOZX.js";
10
+ } from "./chunk-FVKFDTN6.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"];
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-EYRGBYZG.js";
16
16
  import {
17
17
  reportedInstallSource
18
- } from "./chunk-5WLH2ENB.js";
18
+ } from "./chunk-K6I5M2ME.js";
19
19
  import {
20
20
  isAnswerSource
21
- } from "./chunk-5UWDYOZX.js";
21
+ } from "./chunk-FVKFDTN6.js";
22
22
 
23
23
  // src/reach.ts
24
24
  var reachVerdict = (channels) => {
@@ -2,7 +2,7 @@ import {
2
2
  HOOK_BUDGETS,
3
3
  HOOK_LOCATOR_BINARY,
4
4
  withHookHoldBudget
5
- } from "./chunk-5UWDYOZX.js";
5
+ } from "./chunk-FVKFDTN6.js";
6
6
 
7
7
  // src/npm.ts
8
8
  import { execFileSync, execSync } from "child_process";
@@ -3,7 +3,7 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-CDSL3LLO.js";
6
+ } from "./chunk-CRNAXFQ6.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-5UWDYOZX.js";
3
+ } from "./chunk-FVKFDTN6.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -2,17 +2,17 @@ import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  GEMINI_HOOK_EVENTS,
4
4
  hasGeminiHooks
5
- } from "./chunk-KHGIM2BN.js";
5
+ } from "./chunk-ED5TA2FJ.js";
6
6
  import {
7
7
  CODEX_HOOK_EVENTS,
8
8
  hasCodexHooks,
9
9
  holdBudgetOf
10
- } from "./chunk-34NNTYK6.js";
10
+ } from "./chunk-SAF6NNXY.js";
11
11
  import {
12
12
  CURSOR_GATE_EVENTS,
13
13
  HOOK_LOCATOR_BINARY,
14
14
  hookCommandHoldBudget
15
- } from "./chunk-5UWDYOZX.js";
15
+ } from "./chunk-FVKFDTN6.js";
16
16
 
17
17
  // src/diagnostics/wiring.ts
18
18
  var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-5WLH2ENB.js";
3
+ } from "./chunk-K6I5M2ME.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 `# ${line.trim()} # removed by pushary logout`;
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,
@@ -6,16 +6,16 @@ import {
6
6
  } from "./chunk-SGZJ5LYH.js";
7
7
  import {
8
8
  hookOwnerOf
9
- } from "./chunk-REIZ5GXG.js";
9
+ } from "./chunk-KEMEBTCJ.js";
10
10
  import {
11
11
  ensureDaemonRunning
12
- } from "./chunk-6HH4IH4K.js";
12
+ } from "./chunk-3BPB2HYZ.js";
13
13
  import {
14
14
  buildTranscriptRecords,
15
15
  decodePublicKey,
16
16
  generateSessionKey,
17
17
  wrapSessionKey
18
- } from "./chunk-CDSL3LLO.js";
18
+ } from "./chunk-CRNAXFQ6.js";
19
19
  import {
20
20
  fetchTranscriptRecipients,
21
21
  uploadTranscriptRecords
@@ -23,14 +23,14 @@ import {
23
23
  import {
24
24
  transcriptEnvironmentPreference,
25
25
  transcriptsEnabled
26
- } from "./chunk-YXWM4TNX.js";
26
+ } from "./chunk-MN3XOVRK.js";
27
27
  import {
28
28
  codexHome,
29
29
  pusharyDir
30
- } from "./chunk-34NNTYK6.js";
30
+ } from "./chunk-SAF6NNXY.js";
31
31
  import {
32
32
  readTranscriptPreference
33
- } from "./chunk-5SALHATY.js";
33
+ } from "./chunk-TI3ZWXZG.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-T7E75EKA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderCommandHelp
3
- } from "./chunk-LZQVAEWP.js";
3
+ } from "./chunk-FAH3D74E.js";
4
4
  import {
5
5
  getPackageVersion
6
6
  } from "./chunk-DINDL2CF.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_BUDGETS,
3
3
  OPENCODE_APPROVAL_EVENT
4
- } from "./chunk-5UWDYOZX.js";
4
+ } from "./chunk-FVKFDTN6.js";
5
5
 
6
6
  // src/opencode-plugin.ts
7
7
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRETOOLUSE_GATED_TOOLS
3
- } from "./chunk-5UWDYOZX.js";
3
+ } from "./chunk-FVKFDTN6.js";
4
4
 
5
5
  // src/claude-tools.ts
6
6
  var POSTTOOLUSE_MIRROR_ONLY_TOOLS = ["TodoWrite", "Task", "WebFetch", "WebSearch"];
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CLAUDE_HOOK_EVENTS,
3
3
  supportedClaudeEvents
4
- } from "./chunk-KHGIM2BN.js";
4
+ } from "./chunk-ED5TA2FJ.js";
5
5
  import {
6
6
  guardBinary,
7
7
  holdBudgetOf,
8
8
  isProtectedByScope,
9
9
  registerHookEntry
10
- } from "./chunk-34NNTYK6.js";
10
+ } from "./chunk-SAF6NNXY.js";
11
11
  import {
12
12
  HOOK_LOCATOR_BINARY,
13
13
  withHookHoldBudget
14
- } from "./chunk-5UWDYOZX.js";
14
+ } from "./chunk-FVKFDTN6.js";
15
15
 
16
16
  // src/claude-config.ts
17
17
  import { join } from "path";
@@ -8,15 +8,15 @@ import {
8
8
  reapplyGeminiSettings,
9
9
  reapplyVsCodePlugin,
10
10
  repairCodexHolds
11
- } from "./chunk-RERJ2ZDV.js";
12
- import "./chunk-AFKOWCMQ.js";
13
- import "./chunk-SGZE2JBF.js";
14
- import "./chunk-QOCWB4Q6.js";
15
- import "./chunk-KHGIM2BN.js";
16
- import "./chunk-XP2KRTZD.js";
17
- import "./chunk-34NNTYK6.js";
11
+ } from "./chunk-2GMI6JH6.js";
12
+ import "./chunk-LUT2EZLG.js";
13
+ import "./chunk-WIOXWUUH.js";
14
+ import "./chunk-TF4IOINR.js";
15
+ import "./chunk-ED5TA2FJ.js";
16
+ import "./chunk-WEO5JCB4.js";
17
+ import "./chunk-SAF6NNXY.js";
18
18
  import "./chunk-T7E75EKA.js";
19
- import "./chunk-5UWDYOZX.js";
19
+ import "./chunk-FVKFDTN6.js";
20
20
  export {
21
21
  inspectConfiguredManagedProviders,
22
22
  reapplyAllAgents,