@pushary/agent-hooks 1.9.8 → 1.9.10

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 (104) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/bin/pushary-bell-hook.js +22 -23
  3. package/dist/bin/pushary-bell.js +13 -13
  4. package/dist/bin/pushary-claude.js +26 -27
  5. package/dist/bin/pushary-clean.js +124 -51
  6. package/dist/bin/pushary-codex-bridge.js +20 -20
  7. package/dist/bin/pushary-codex-hook.js +34 -35
  8. package/dist/bin/pushary-codex.js +13 -13
  9. package/dist/bin/pushary-connect.js +41 -18
  10. package/dist/bin/pushary-cowork.js +5 -5
  11. package/dist/bin/pushary-daemon.js +35 -37
  12. package/dist/bin/pushary-disconnect.js +29 -32
  13. package/dist/bin/pushary-doctor.js +101 -78
  14. package/dist/bin/pushary-elicitation-hook.js +25 -26
  15. package/dist/bin/pushary-gemini-bridge.js +13 -13
  16. package/dist/bin/pushary-gemini-hook.js +29 -30
  17. package/dist/bin/pushary-hook.js +36 -37
  18. package/dist/bin/pushary-login.js +12 -12
  19. package/dist/bin/pushary-logout.js +18 -78
  20. package/dist/bin/pushary-mcp.js +9 -9
  21. package/dist/bin/pushary-mode.js +12 -12
  22. package/dist/bin/pushary-notification-hook.js +29 -30
  23. package/dist/bin/pushary-opencode-hook.js +28 -29
  24. package/dist/bin/pushary-permission-denied-hook.js +30 -31
  25. package/dist/bin/pushary-permission-hook.js +33 -34
  26. package/dist/bin/pushary-post-hook.js +30 -31
  27. package/dist/bin/pushary-prompt-hook.js +29 -30
  28. package/dist/bin/pushary-session-end-hook.js +29 -30
  29. package/dist/bin/pushary-session-start-hook.js +33 -35
  30. package/dist/bin/pushary-setup.js +147 -116
  31. package/dist/bin/pushary-stats.js +5 -5
  32. package/dist/bin/pushary-status.js +48 -18
  33. package/dist/bin/pushary-stop-hook.js +29 -30
  34. package/dist/bin/pushary-stopfailure-hook.js +29 -30
  35. package/dist/bin/pushary-suggestions.js +12 -12
  36. package/dist/bin/pushary-transcript-register.js +18 -19
  37. package/dist/bin/pushary-transcripts.js +7 -7
  38. package/dist/bin/pushary-upgrade.js +38 -44
  39. package/dist/bin/pushary-wait.js +12 -12
  40. package/dist/bin/pushary.js +6 -6
  41. package/dist/{chunk-CKV3UPMU.js → chunk-2HFSKYLN.js} +2 -2
  42. package/dist/{chunk-ZN3C6GBG.js → chunk-2HXG2QDI.js} +4 -4
  43. package/dist/{chunk-5QUPKDI5.js → chunk-2M52CFVO.js} +1 -1
  44. package/dist/{chunk-KF3UZLYI.js → chunk-2S34OPHS.js} +1 -1
  45. package/dist/{chunk-2A53H4S6.js → chunk-5MQYA3YL.js} +22 -21
  46. package/dist/{chunk-I5IJRMNV.js → chunk-5RGA636G.js} +21 -9
  47. package/dist/{chunk-IAD2RT4L.js → chunk-6KNC6KLL.js} +4 -4
  48. package/dist/{chunk-KHNFLYJO.js → chunk-7HGR5GNY.js} +4 -4
  49. package/dist/{chunk-BEJRK4DF.js → chunk-AKPHYSEL.js} +5 -4
  50. package/dist/{chunk-ZBK6E2OR.js → chunk-APP43AW7.js} +1 -1
  51. package/dist/chunk-BOSXFI7L.js +52 -0
  52. package/dist/{chunk-WS4H76EP.js → chunk-BTFUSQFB.js} +2 -2
  53. package/dist/{chunk-B64KHETR.js → chunk-BVPPYR7B.js} +3 -3
  54. package/dist/{chunk-TCWKTUAE.js → chunk-BVSIM4EF.js} +2 -2
  55. package/dist/{chunk-BXET3ALR.js → chunk-C6QTMWJZ.js} +2 -2
  56. package/dist/{chunk-IHO3YQAN.js → chunk-CJYM4ZHV.js} +2 -2
  57. package/dist/{chunk-6TE27XZR.js → chunk-DAOQT4WK.js} +2 -2
  58. package/dist/{chunk-V5HPPF3E.js → chunk-DL6QHS7V.js} +1 -1
  59. package/dist/{chunk-DPGSLWOS.js → chunk-DWO4RLYK.js} +10 -10
  60. package/dist/{chunk-GU3EJCVV.js → chunk-EA5NWDK7.js} +4 -0
  61. package/dist/{chunk-I6MJXLMY.js → chunk-EVC765EO.js} +2 -2
  62. package/dist/{chunk-WG3K4TCH.js → chunk-GQYX24UC.js} +1 -1
  63. package/dist/{chunk-N4QSPI3B.js → chunk-GTZ4HIHU.js} +15 -13
  64. package/dist/{chunk-DUZVXBBU.js → chunk-H4F5O3RE.js} +1 -1
  65. package/dist/{chunk-MKTJEXZ3.js → chunk-I3W7GJ5R.js} +3 -3
  66. package/dist/{chunk-ZSTSEBG7.js → chunk-IIVZZMSO.js} +1 -1
  67. package/dist/{chunk-KRCR2CRQ.js → chunk-LDQGURCF.js} +11 -11
  68. package/dist/{chunk-2WXF3QJR.js → chunk-LXA236ZQ.js} +2 -2
  69. package/dist/{chunk-CD47ZFFZ.js → chunk-MD4SVNT6.js} +1 -1
  70. package/dist/{chunk-CLOSJ4ES.js → chunk-MISUKJGW.js} +1 -1
  71. package/dist/{chunk-DKMD6AWR.js → chunk-NQ67AF3V.js} +4 -4
  72. package/dist/{chunk-HRULIYDU.js → chunk-OL2Z7WI4.js} +2 -2
  73. package/dist/{chunk-MXHTGVFZ.js → chunk-PNC5ZQFS.js} +16 -20
  74. package/dist/{chunk-3I6IVOZV.js → chunk-PR2VDVCP.js} +3 -3
  75. package/dist/{chunk-FQ2GORVG.js → chunk-Q3UMWSE4.js} +2 -2
  76. package/dist/{chunk-MFF3ONG5.js → chunk-QAGWWDXQ.js} +78 -8
  77. package/dist/{chunk-M6BZZFVQ.js → chunk-QGRENWJL.js} +1 -1
  78. package/dist/{chunk-LKLVTG3V.js → chunk-RPQLZLKC.js} +5 -5
  79. package/dist/{chunk-KFF7G225.js → chunk-S2DAKKQQ.js} +3 -3
  80. package/dist/chunk-SB2GN6OP.js +71 -0
  81. package/dist/{chunk-2QGYMY7A.js → chunk-SIHYBIEN.js} +142 -4
  82. package/dist/{chunk-ZW3XZLJC.js → chunk-SJDMULE7.js} +5 -5
  83. package/dist/{chunk-IHFDPV7C.js → chunk-SMVMLWCD.js} +1 -1
  84. package/dist/{chunk-QOLITCIP.js → chunk-T6ZN4TEF.js} +1 -1
  85. package/dist/{chunk-7DVNSQWF.js → chunk-TCXL5FQQ.js} +2 -2
  86. package/dist/{chunk-7PT35RY2.js → chunk-U5FP5JIS.js} +2 -2
  87. package/dist/{chunk-ZBHUHJG6.js → chunk-UJZ7AGSC.js} +6 -4
  88. package/dist/{chunk-TCQ43LSG.js → chunk-UM5WXBKN.js} +3 -3
  89. package/dist/{chunk-2QTO5YIT.js → chunk-XKMGHVXW.js} +6 -6
  90. package/dist/{chunk-LWOO567I.js → chunk-XXLCYKVS.js} +3 -3
  91. package/dist/{chunk-MGRFDGWU.js → chunk-Y7JM47CI.js} +2 -2
  92. package/dist/{chunk-NWDG3MSW.js → chunk-YUQHUGTH.js} +1 -1
  93. package/dist/{chunk-WWOHTTVP.js → chunk-Z2Q2VH43.js} +2 -2
  94. package/dist/{chunk-DL7XWKYV.js → chunk-ZGADIZDS.js} +2 -2
  95. package/dist/{chunk-2VZAALEJ.js → chunk-ZSGJYSF2.js} +8 -8
  96. package/dist/{global-upgrade-I56HNM23.js → global-upgrade-PUM44JUH.js} +6 -6
  97. package/dist/{paths-AGY43CXS.js → paths-U2MJGNBT.js} +2 -2
  98. package/dist/{reapply-IA5XUKWW.js → reapply-PRKV4EO7.js} +22 -24
  99. package/dist/src/index.js +19 -19
  100. package/dist/{upgrade-lock-B34TAUKV.js → upgrade-lock-QZSVLEM7.js} +3 -3
  101. package/package.json +1 -1
  102. package/dist/chunk-3Z3A37WD.js +0 -77
  103. package/dist/chunk-OP7IHC2I.js +0 -24
  104. package/dist/chunk-YIG2R3BJ.js +0 -145
@@ -1,21 +1,21 @@
1
- import {
2
- activeHookSource,
3
- activeIdentity
4
- } from "./chunk-KHNFLYJO.js";
5
1
  import {
6
2
  defersToNativeMode,
7
3
  reportMachineDenial
8
- } from "./chunk-IHO3YQAN.js";
4
+ } from "./chunk-CJYM4ZHV.js";
9
5
  import {
10
6
  isGatingMoment,
11
7
  recordKeylessMoment
12
- } from "./chunk-ZSTSEBG7.js";
8
+ } from "./chunk-IIVZZMSO.js";
13
9
  import {
14
10
  announceSubscriptionRequired,
15
11
  denyReasonFrom,
16
12
  isDeferAnswer,
17
13
  oncePerSession
18
14
  } from "./chunk-5OP5MQI7.js";
15
+ import {
16
+ activeHookSource,
17
+ activeIdentity
18
+ } from "./chunk-7HGR5GNY.js";
19
19
  import {
20
20
  UNNAMED_ACTION,
21
21
  approvalAwaitingRetry,
@@ -39,7 +39,7 @@ import {
39
39
  reportEvent,
40
40
  scopePathFor,
41
41
  settleQuestionsForToolUse
42
- } from "./chunk-KRCR2CRQ.js";
42
+ } from "./chunk-LDQGURCF.js";
43
43
  import {
44
44
  DEFAULT_SESSION
45
45
  } from "./chunk-N6IOSZOE.js";
@@ -53,25 +53,26 @@ import {
53
53
  requestGate,
54
54
  sendNotification,
55
55
  waitForQuestion
56
- } from "./chunk-2VZAALEJ.js";
56
+ } from "./chunk-ZSGJYSF2.js";
57
57
  import {
58
58
  SubscriptionRequiredError
59
- } from "./chunk-MKTJEXZ3.js";
59
+ } from "./chunk-I3W7GJ5R.js";
60
60
  import {
61
61
  getMachineId
62
- } from "./chunk-DUZVXBBU.js";
62
+ } from "./chunk-H4F5O3RE.js";
63
63
  import {
64
64
  getApiKey,
65
65
  getBaseUrl
66
- } from "./chunk-5QUPKDI5.js";
66
+ } from "./chunk-2M52CFVO.js";
67
67
  import {
68
68
  NPX_LATEST_COMMAND
69
- } from "./chunk-7DVNSQWF.js";
69
+ } from "./chunk-TCXL5FQQ.js";
70
70
  import {
71
71
  AGENT_QUESTION_STRATEGY,
72
72
  DECISION_STOP_REASON,
73
73
  GATE_BLOCK_REASON_MAX_LENGTH,
74
74
  GATE_WIRE,
75
+ PLAN_DECLINED_REASON,
75
76
  UNVERIFIABLE_APPROVAL_REASON,
76
77
  WITHDRAWN_APPROVAL_REASON,
77
78
  agentQuestionStrategy,
@@ -83,9 +84,9 @@ import {
83
84
  claudePermissionRequestOutput,
84
85
  claudePermissionRulesFromSettings,
85
86
  claudePreToolUseOutput,
86
- claudePromptsBeforeAnEdit,
87
+ claudeStoppedPermissionRequestOutput,
87
88
  claudeStoppedPreToolUseOutput,
88
- editAsksAtTheAgentsPrompt,
89
+ editGoesToTheAgentsPrompt,
89
90
  effectiveWaitSeconds,
90
91
  hookHoldWindowMs,
91
92
  hookWaitClamped,
@@ -96,9 +97,9 @@ import {
96
97
  isPusharyOwnTool,
97
98
  parseAgentQuestionAnswers,
98
99
  parseAgentQuestions,
99
- resolveGate,
100
- stoppedOutput
101
- } from "./chunk-I5IJRMNV.js";
100
+ questionHandedToTheTerminal,
101
+ resolveGate
102
+ } from "./chunk-5RGA636G.js";
102
103
 
103
104
  // src/claude-permission-rules.ts
104
105
  import { readFileSync, statSync } from "fs";
@@ -450,7 +451,7 @@ var askQuestionByQuestion = async (apiKey, input, parsed, projectName, deadline)
450
451
  return answers;
451
452
  };
452
453
  var handleAskUserQuestion = async (apiKey, input, modeState) => {
453
- if (modeState.askHandoff) return void 0;
454
+ if (questionHandedToTheTerminal(input.tool_name, modeState)) return void 0;
454
455
  const parsed = parseQuestions(input.tool_input ?? {});
455
456
  if (!parsed) return void 0;
456
457
  const projectName = basename(input.cwd ?? process.cwd());
@@ -496,7 +497,7 @@ var handleExitPlanMode = async (apiKey, input) => {
496
497
  return void 0;
497
498
  }
498
499
  if (value === PLAN_APPROVE) return allow();
499
- return deny("Plan declined from the phone. Ask what to change before coding.");
500
+ return deny(PLAN_DECLINED_REASON);
500
501
  };
501
502
  var handleKeyless = (input) => {
502
503
  try {
@@ -617,7 +618,7 @@ var handlePreToolUse = async (input, canonical) => {
617
618
  return void 0;
618
619
  }
619
620
  if (claudeAllowlistOwnsCall(gateInput, verdict, input.permission_mode, claudePermissionRulesFor(input))) return void 0;
620
- if (claudePromptsBeforeAnEdit(input.permission_mode) && editAsksAtTheAgentsPrompt(gateInput, verdict)) return handleTerminalOnly();
621
+ if (editGoesToTheAgentsPrompt({ source: ACTIVE_SOURCE, event: "PreToolUse", permissionMode: input.permission_mode }, gateInput, verdict)) return handleTerminalOnly();
621
622
  switch (verdict.kind) {
622
623
  case "allow":
623
624
  return allow();
@@ -637,7 +638,7 @@ var handlePreToolUse = async (input, canonical) => {
637
638
  };
638
639
  var permReqAllow = (updatedInput) => claudePermissionRequestOutput("allow", void 0, updatedInput);
639
640
  var permReqDeny = (message) => claudePermissionRequestOutput("deny", message);
640
- var permReqHalted = (reason) => stoppedOutput(permReqDeny(reason), reason);
641
+ var permReqHalted = (reason) => claudeStoppedPermissionRequestOutput(reason);
641
642
  var toPermissionRequestOutput = (hookOutput) => {
642
643
  if (!hookOutput) return void 0;
643
644
  const d = hookOutput.hookSpecificOutput;
@@ -2186,7 +2186,9 @@ function agentQuestionStrategy(source, event, toolName) {
2186
2186
  if (source !== null && event === "PreToolUse" && UPDATED_INPUT_QUESTION_SOURCES.has(source)) return AGENT_QUESTION_STRATEGY.updatedInput;
2187
2187
  return AGENT_QUESTION_STRATEGY.native;
2188
2188
  }
2189
- var ASKED_IN_EVERY_MODE_TOOLS = [AGENT_QUESTION_TOOL, "ExitPlanMode"];
2189
+ var questionHandedToTheTerminal = (toolName, modeState) => toolName === AGENT_QUESTION_TOOL && modeState.askHandoff === true;
2190
+ var EXIT_PLAN_MODE_TOOL = "ExitPlanMode";
2191
+ var ASKED_IN_EVERY_MODE_TOOLS = [AGENT_QUESTION_TOOL, EXIT_PLAN_MODE_TOOL];
2190
2192
  var ASKED_IN_EVERY_MODE = new Set(ASKED_IN_EVERY_MODE_TOOLS);
2191
2193
  var isAskedInEveryMode = (toolName) => ASKED_IN_EVERY_MODE.has(toolName);
2192
2194
  var NATIVE_BLOCK_EVENTS = /* @__PURE__ */ new Set(["PermissionDenied"]);
@@ -2267,6 +2269,12 @@ var resolveGate = (input) => {
2267
2269
  };
2268
2270
  var editAsksAtTheAgentsPrompt = (input, verdict) => verdict.kind === "gate" && !verdict.scopeReason && (input.modeState.mode ?? input.config.modeOverride ?? null) === null && !aChosenRuleGoverns(input) && verdict.policy.mode === "push_first" && ACCEPT_EDITS_DEFER_TOOLS.has(input.toolName);
2269
2271
  var claudePromptsBeforeAnEdit = (permissionMode) => permissionMode === "default";
2272
+ var runsTheClaudeHook = (source) => source === null || source === "claude" || hookCompatibleProfileBySource(source) !== void 0;
2273
+ var agentPromptsBeforeAnEdit = ({ source, event, permissionMode }) => {
2274
+ if (source === "codex") return event === "PermissionRequest";
2275
+ return event === "PreToolUse" && runsTheClaudeHook(source) && claudePromptsBeforeAnEdit(permissionMode);
2276
+ };
2277
+ var editGoesToTheAgentsPrompt = (call, input, verdict) => agentPromptsBeforeAnEdit(call) && editAsksAtTheAgentsPrompt(input, verdict);
2270
2278
  var MAX_AGENT_PERMISSION_RULES_PER_KIND = 256;
2271
2279
  var MAX_AGENT_PERMISSION_RULE_LENGTH = 512;
2272
2280
  var isAgentPermissionRule = (value) => typeof value === "string" && value.length > 0 && value.length <= MAX_AGENT_PERMISSION_RULE_LENGTH;
@@ -2437,6 +2445,7 @@ var claudePermissionRequestOutput = (decision, reason, updatedInput) => ({
2437
2445
  decision: decision === "allow" ? { behavior: "allow", ...updatedInput ? { updatedInput } : {} } : { behavior: "deny", ...reason ? { message: reason } : {} }
2438
2446
  }
2439
2447
  });
2448
+ var DENIED_FROM_PUSHARY_REASON = "Denied from Pushary";
2440
2449
  var gateOutputFor = (source, event, decision, reason) => {
2441
2450
  let output;
2442
2451
  if (source === "claude" || source === "vscode") {
@@ -2452,7 +2461,7 @@ var gateOutputFor = (source, event, decision, reason) => {
2452
2461
  output = {
2453
2462
  hookSpecificOutput: {
2454
2463
  hookEventName: "PermissionRequest",
2455
- decision: decision === "allow" ? { behavior: "allow" } : { behavior: "deny", message: reason ?? "Denied from Pushary" }
2464
+ decision: decision === "allow" ? { behavior: "allow" } : { behavior: "deny", message: reason ?? DENIED_FROM_PUSHARY_REASON }
2456
2465
  }
2457
2466
  };
2458
2467
  } else if (event === "PreToolUse" && decision === "deny") {
@@ -2460,19 +2469,19 @@ var gateOutputFor = (source, event, decision, reason) => {
2460
2469
  hookSpecificOutput: {
2461
2470
  hookEventName: "PreToolUse",
2462
2471
  permissionDecision: "deny",
2463
- permissionDecisionReason: reason ?? "Denied from Pushary"
2472
+ permissionDecisionReason: reason ?? DENIED_FROM_PUSHARY_REASON
2464
2473
  }
2465
2474
  };
2466
2475
  }
2467
2476
  } else if (source === "gemini" && event === "BeforeTool" && decision !== "ask") {
2468
- output = decision === "allow" ? { decision: "allow" } : { decision: "deny", reason: reason ?? "Denied from Pushary" };
2477
+ output = decision === "allow" ? { decision: "allow" } : { decision: "deny", reason: reason ?? DENIED_FROM_PUSHARY_REASON };
2469
2478
  } else if (source === "opencode" && event === OPENCODE_APPROVAL_EVENT) {
2470
- output = decision === "deny" ? { status: "deny", reason: reason ?? "Denied from Pushary" } : { status: decision };
2479
+ output = decision === "deny" ? { status: "deny", reason: reason ?? DENIED_FROM_PUSHARY_REASON } : { status: decision };
2471
2480
  } else if (source === "cursor" && CURSOR_GATE_EVENTS.includes(event)) {
2472
2481
  output = decision === "allow" ? { permission: "allow" } : decision === "ask" && event !== "preToolUse" ? { permission: "ask" } : {
2473
2482
  permission: "deny",
2474
2483
  user_message: "Command denied via Pushary.",
2475
- agent_message: reason ?? "Denied from Pushary"
2484
+ agent_message: reason ?? DENIED_FROM_PUSHARY_REASON
2476
2485
  };
2477
2486
  } else {
2478
2487
  const profile = hookCompatibleProfileBySource(source);
@@ -2500,7 +2509,9 @@ var renderElicitationOutput = (event, action, content) => ELICITATION_EVENTS.inc
2500
2509
  var UNVERIFIABLE_APPROVAL_REASON = "Pushary could not create a verifiable approval. Retry the action.";
2501
2510
  var DECISION_STOP_REASON = "Approval was cancelled or became unavailable. Retry only after resolving it.";
2502
2511
  var WITHDRAWN_APPROVAL_REASON = "The phone question was withdrawn. Approve in the current client.";
2512
+ var PLAN_DECLINED_REASON = "Plan declined from the phone. Ask what to change before coding.";
2503
2513
  var claudeStoppedPreToolUseOutput = (reason) => stoppedOutput(claudePreToolUseOutput("deny", reason), reason);
2514
+ var claudeStoppedPermissionRequestOutput = (reason) => stoppedOutput(claudePermissionRequestOutput("deny", reason), reason);
2504
2515
  var ELICITATION_ANSWERABLE_MODE = "form";
2505
2516
  var ELICITATION_MIN_OPTIONS = 2;
2506
2517
  var ELICITATION_MAX_MULTI_QUESTIONS = 4;
@@ -2866,6 +2877,7 @@ export {
2866
2877
  shouldDeferToNativeMode,
2867
2878
  AGENT_QUESTION_STRATEGY,
2868
2879
  agentQuestionStrategy,
2880
+ questionHandedToTheTerminal,
2869
2881
  CODEX_RESCUE_TOOL_NAME,
2870
2882
  isBlockedActionRequest,
2871
2883
  BLOCKED_ACTION_GRANT_TTL_SECONDS,
@@ -2874,8 +2886,7 @@ export {
2874
2886
  isPermissionRequestOwnedByPreToolUse,
2875
2887
  CLAUDE_PRETOOLUSE_MATCHER,
2876
2888
  resolveGate,
2877
- editAsksAtTheAgentsPrompt,
2878
- claudePromptsBeforeAnEdit,
2889
+ editGoesToTheAgentsPrompt,
2879
2890
  claudePermissionRulesFromSettings,
2880
2891
  claudeConsultsItsAllowlist,
2881
2892
  agentRulesAllowEveryInput,
@@ -2888,7 +2899,6 @@ export {
2888
2899
  machineDecisionFor,
2889
2900
  claudePermissionDeniedOutput,
2890
2901
  codexStopRescueOutput,
2891
- stoppedOutput,
2892
2902
  claudePreToolUseOutput,
2893
2903
  PENDING_COMMAND_PREFIX,
2894
2904
  pendingCommandEvents,
@@ -2898,7 +2908,9 @@ export {
2898
2908
  UNVERIFIABLE_APPROVAL_REASON,
2899
2909
  DECISION_STOP_REASON,
2900
2910
  WITHDRAWN_APPROVAL_REASON,
2911
+ PLAN_DECLINED_REASON,
2901
2912
  claudeStoppedPreToolUseOutput,
2913
+ claudeStoppedPermissionRequestOutput,
2902
2914
  ELICITATION_ANSWERABLE_MODE,
2903
2915
  readElicitationFields,
2904
2916
  planElicitationAsk,
@@ -14,19 +14,19 @@ import {
14
14
  } from "./chunk-U4TMAANR.js";
15
15
  import {
16
16
  callMcpTool
17
- } from "./chunk-MKTJEXZ3.js";
17
+ } from "./chunk-I3W7GJ5R.js";
18
18
  import {
19
19
  reportedInstallSource
20
- } from "./chunk-FQ2GORVG.js";
20
+ } from "./chunk-Q3UMWSE4.js";
21
21
  import {
22
22
  NPX_LATEST_COMMAND
23
- } from "./chunk-7DVNSQWF.js";
23
+ } from "./chunk-TCXL5FQQ.js";
24
24
  import {
25
25
  NO_PAIRING_COMPUTER,
26
26
  PAIR_TTL_SECONDS,
27
27
  classifyConfirmResponse,
28
28
  isAnswerSource
29
- } from "./chunk-I5IJRMNV.js";
29
+ } from "./chunk-5RGA636G.js";
30
30
 
31
31
  // src/reach.ts
32
32
  var reachVerdict = (channels) => {
@@ -3,17 +3,17 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-3I6IVOZV.js";
6
+ } from "./chunk-PR2VDVCP.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  parseApplyPatchFiles
10
- } from "./chunk-KRCR2CRQ.js";
10
+ } from "./chunk-LDQGURCF.js";
11
11
  import {
12
12
  guardBinary,
13
13
  holdBudgetOf,
14
14
  isProtectedByScope,
15
15
  registerHookEntry
16
- } from "./chunk-ZBHUHJG6.js";
16
+ } from "./chunk-UJZ7AGSC.js";
17
17
  import {
18
18
  HOOK_LOCATOR_BINARY,
19
19
  PHONE_ANSWERED_TOOLS,
@@ -21,7 +21,7 @@ import {
21
21
  hookCompatibleProfileBySource,
22
22
  toToolLookup,
23
23
  withHookHoldBudget
24
- } from "./chunk-I5IJRMNV.js";
24
+ } from "./chunk-5RGA636G.js";
25
25
 
26
26
  // src/claude-config.ts
27
27
  import { join } from "path";
@@ -2,25 +2,25 @@ import {
2
2
  SIGNED_OUT_ON_MAC_MESSAGE,
3
3
  describeSignedOutKey,
4
4
  readSignedOutDiagnosis
5
- } from "./chunk-2WXF3QJR.js";
5
+ } from "./chunk-LXA236ZQ.js";
6
6
  import {
7
7
  createIo
8
8
  } from "./chunk-U4TMAANR.js";
9
9
  import {
10
10
  readKeySource
11
- } from "./chunk-N4QSPI3B.js";
11
+ } from "./chunk-GTZ4HIHU.js";
12
12
  import {
13
13
  absoluteUrl,
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-LWOO567I.js";
17
+ } from "./chunk-XXLCYKVS.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-5QUPKDI5.js";
23
+ } from "./chunk-2M52CFVO.js";
24
24
 
25
25
  // src/cli/report-key.ts
26
26
  var { dim, yellow } = createIo();
@@ -90,5 +90,6 @@ var exitOnFailedSettingsRequest = async (response, settings) => {
90
90
 
91
91
  export {
92
92
  printKeyCheck,
93
+ APPROVAL_SETTINGS_PATH,
93
94
  exitOnFailedSettingsRequest
94
95
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-I5IJRMNV.js";
3
+ } from "./chunk-5RGA636G.js";
4
4
 
5
5
  // src/crypto.ts
6
6
  import nacl from "tweetnacl";
@@ -0,0 +1,52 @@
1
+ import {
2
+ macAppBridgeAvailable
3
+ } from "./chunk-QAGWWDXQ.js";
4
+ import {
5
+ keyPrefix
6
+ } from "./chunk-GTZ4HIHU.js";
7
+ import {
8
+ bridgeAgentKey
9
+ } from "./chunk-UJZ7AGSC.js";
10
+ import {
11
+ readJsonSafe
12
+ } from "./chunk-T7E75EKA.js";
13
+ import {
14
+ isValidApiKey
15
+ } from "./chunk-5RGA636G.js";
16
+
17
+ // src/shared-mcp-key.ts
18
+ var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
19
+ var pusharyKey = (value) => typeof value === "string" && isValidApiKey(value.trim()) ? value.trim() : null;
20
+ var bearerKey = (authorization) => typeof authorization === "string" && authorization.startsWith("Bearer ") ? pusharyKey(authorization.slice("Bearer ".length)) : null;
21
+ var mcpServerBearer = (mcpServers) => bearerKey(asRecord(asRecord(asRecord(mcpServers)?.pushary)?.headers)?.Authorization);
22
+ var appAgentKey = (bridgeAgentKey2) => pusharyKey(asRecord(bridgeAgentKey2)?.key);
23
+ var setupReceiptKey = (claudeMcpReceipt) => bearerKey(asRecord(asRecord(asRecord(claudeMcpReceipt)?.installedPushary)?.headers)?.Authorization);
24
+ var macAppKeepsMcpEntry = (entryKey, keys) => {
25
+ if (!entryKey) return true;
26
+ if (keys.appKey) return entryKey === keys.appKey;
27
+ return entryKey !== keys.setupKey;
28
+ };
29
+
30
+ // src/mac-app-key.ts
31
+ var NOT_CONNECTED = { kind: "not_connected" };
32
+ var CONNECTED_THROUGH_MAC_APP = "This computer is connected through the Pushary Mac app";
33
+ var PAIR_FROM_MAC_APP = "Pair a phone from the Pushary Mac app: Settings > Phone > Pair.";
34
+ var readMacAppAgentKey = () => {
35
+ const stored = readJsonSafe(bridgeAgentKey());
36
+ return stored.kind === "ok" ? appAgentKey(stored.value) : null;
37
+ };
38
+ var macAppConnectionOf = (appKey, appInstalled) => appKey !== null && appInstalled() ? { kind: "connected", keyPrefix: keyPrefix(appKey) } : NOT_CONNECTED;
39
+ var readMacAppConnection = () => macAppConnectionOf(readMacAppAgentKey(), macAppBridgeAvailable);
40
+ var readMacAppConnectionWhenKeyless = (cliKey) => cliKey ? NOT_CONNECTED : readMacAppConnection();
41
+
42
+ export {
43
+ pusharyKey,
44
+ mcpServerBearer,
45
+ setupReceiptKey,
46
+ macAppKeepsMcpEntry,
47
+ CONNECTED_THROUGH_MAC_APP,
48
+ PAIR_FROM_MAC_APP,
49
+ readMacAppAgentKey,
50
+ readMacAppConnection,
51
+ readMacAppConnectionWhenKeyless
52
+ };
@@ -3,11 +3,11 @@ import {
3
3
  decodePublicKey,
4
4
  generateSessionKey,
5
5
  wrapSessionKey
6
- } from "./chunk-ZBK6E2OR.js";
6
+ } from "./chunk-APP43AW7.js";
7
7
  import {
8
8
  fetchTranscriptRecipients,
9
9
  uploadTranscriptRecords
10
- } from "./chunk-CLOSJ4ES.js";
10
+ } from "./chunk-MISUKJGW.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var MAX_TRANSCRIPT_QUEUE = 100;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-DL7XWKYV.js";
3
+ } from "./chunk-ZGADIZDS.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-7QLSKOSU.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-7DVNSQWF.js";
12
+ } from "./chunk-TCXL5FQQ.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-I5IJRMNV.js";
20
+ } from "./chunk-5RGA636G.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-2QGYMY7A.js";
3
+ } from "./chunk-SIHYBIEN.js";
4
4
  import {
5
5
  isProtectedByScope,
6
6
  registerHookEntry
7
- } from "./chunk-ZBHUHJG6.js";
7
+ } from "./chunk-UJZ7AGSC.js";
8
8
 
9
9
  // src/cursor-config.ts
10
10
  var hookCommandOf = (entry) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-ZBHUHJG6.js";
3
+ } from "./chunk-UJZ7AGSC.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeFileAtomic
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-I5IJRMNV.js";
16
+ } from "./chunk-5RGA636G.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -5,7 +5,7 @@ import {
5
5
  permissionDeniedAction,
6
6
  releaseThrottle,
7
7
  reportEvent
8
- } from "./chunk-KRCR2CRQ.js";
8
+ } from "./chunk-LDQGURCF.js";
9
9
  import {
10
10
  DEFAULT_SESSION
11
11
  } from "./chunk-N6IOSZOE.js";
@@ -13,7 +13,7 @@ import {
13
13
  machineDecisionFor,
14
14
  shouldDeferToNativeMode,
15
15
  wireVerdictFor
16
- } from "./chunk-I5IJRMNV.js";
16
+ } from "./chunk-5RGA636G.js";
17
17
 
18
18
  // src/machine-decision-audit.ts
19
19
  import { basename } from "path";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-MGRFDGWU.js";
3
+ } from "./chunk-Y7JM47CI.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-7DVNSQWF.js";
6
+ } from "./chunk-TCXL5FQQ.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {
@@ -2,7 +2,7 @@ import {
2
2
  autoUpdateLock,
3
3
  installPackageGlobally,
4
4
  npmErrorMessage
5
- } from "./chunk-ZBHUHJG6.js";
5
+ } from "./chunk-UJZ7AGSC.js";
6
6
  import {
7
7
  writeJsonAtomic
8
8
  } from "./chunk-T7E75EKA.js";
@@ -4,40 +4,40 @@ import {
4
4
  savePin,
5
5
  verifyRecipients
6
6
  } from "./chunk-SGZJ5LYH.js";
7
- import {
8
- hookOwnerOf
9
- } from "./chunk-YIG2R3BJ.js";
10
7
  import {
11
8
  ensureDaemonRunning
12
- } from "./chunk-LKLVTG3V.js";
9
+ } from "./chunk-RPQLZLKC.js";
13
10
  import {
14
11
  buildTranscriptRecords,
15
12
  decodePublicKey,
16
13
  generateSessionKey,
17
14
  wrapSessionKey
18
- } from "./chunk-ZBK6E2OR.js";
15
+ } from "./chunk-APP43AW7.js";
19
16
  import {
20
17
  fetchTranscriptRecipients,
21
18
  uploadTranscriptRecords
22
- } from "./chunk-CLOSJ4ES.js";
19
+ } from "./chunk-MISUKJGW.js";
23
20
  import {
24
21
  transcriptEnvironmentPreference,
25
22
  transcriptsEnabled
26
- } from "./chunk-M6BZZFVQ.js";
23
+ } from "./chunk-QGRENWJL.js";
24
+ import {
25
+ hookOwnerOf
26
+ } from "./chunk-SIHYBIEN.js";
27
27
  import {
28
28
  readTranscriptPreference
29
- } from "./chunk-N4QSPI3B.js";
29
+ } from "./chunk-GTZ4HIHU.js";
30
30
  import {
31
31
  codexHome,
32
32
  pusharyDir
33
- } from "./chunk-ZBHUHJG6.js";
33
+ } from "./chunk-UJZ7AGSC.js";
34
34
  import {
35
35
  writeJsonAtomic
36
36
  } from "./chunk-T7E75EKA.js";
37
37
  import {
38
38
  getApiKey,
39
39
  getBaseUrl
40
- } from "./chunk-5QUPKDI5.js";
40
+ } from "./chunk-2M52CFVO.js";
41
41
 
42
42
  // src/transcript-registration.ts
43
43
  import { createHash } from "crypto";
@@ -1,3 +1,6 @@
1
+ // src/hooks-spec.ts
2
+ var CURSOR_GATE_SCRIPT = "pushary-gate.mjs";
3
+
1
4
  // src/diagnostics/service-runtime.ts
2
5
  var unescapeXml = (value) => value.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
3
6
  var unquoteSystemd = (value) => value.replaceAll('\\"', '"').replaceAll("\\\\", "\\").replaceAll("%%", "%");
@@ -37,6 +40,7 @@ var versionManagerOf = (execPath) => {
37
40
  var describeVersionManagerPin = (execPath, manager) => `The background service is pinned to ${execPath}, which ${manager} manages. Switching Node versions strands it; run pushary daemon install afterwards.`;
38
41
 
39
42
  export {
43
+ CURSOR_GATE_SCRIPT,
40
44
  readServiceExecPath,
41
45
  versionManagerOf,
42
46
  describeVersionManagerPin
@@ -10,10 +10,10 @@ import {
10
10
  resolvePackageVersionFromBinary,
11
11
  resolvePathBinary,
12
12
  resolvePathBinaryAsync
13
- } from "./chunk-ZBHUHJG6.js";
13
+ } from "./chunk-UJZ7AGSC.js";
14
14
  import {
15
15
  MANAGED_PROVIDERS
16
- } from "./chunk-I5IJRMNV.js";
16
+ } from "./chunk-5RGA636G.js";
17
17
 
18
18
  // src/setup/codex-install.ts
19
19
  var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-ZBHUHJG6.js";
3
+ } from "./chunk-UJZ7AGSC.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-FQ2GORVG.js";
3
+ } from "./chunk-Q3UMWSE4.js";
4
4
  import {
5
5
  backupFile,
6
6
  readJsonSafe,
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-T7E75EKA.js";
10
10
  import {
11
11
  configFilePath
12
- } from "./chunk-5QUPKDI5.js";
12
+ } from "./chunk-2M52CFVO.js";
13
13
 
14
14
  // src/shell-alias.ts
15
15
  import { homedir } from "os";
@@ -322,19 +322,20 @@ var shellProfileCandidates = () => {
322
322
  const fallbacks = FALLBACK_RCS.map((name) => join2(homedir2(), name));
323
323
  return resolved ? [resolved.path, ...fallbacks.filter((path) => path !== resolved.path)] : fallbacks;
324
324
  };
325
- var findExportedKeyLine = (profiles = shellProfileCandidates()) => {
326
- for (const path of profiles) {
327
- let contents;
328
- try {
329
- contents = readFileSync2(path, "utf8");
330
- } catch {
331
- continue;
332
- }
333
- const found = findKeyExport(contents);
334
- if (found) return { path, ...found };
325
+ var readProfileOrNull = (path) => {
326
+ try {
327
+ return readFileSync2(path, "utf8");
328
+ } catch {
329
+ return null;
335
330
  }
336
- return null;
337
331
  };
332
+ var exportedKeyLineIn = (path) => {
333
+ const contents = readProfileOrNull(path);
334
+ const found = contents === null ? null : findKeyExport(contents);
335
+ return found ? [{ path, ...found }] : [];
336
+ };
337
+ var findExportedKeyLines = (profiles = shellProfileCandidates()) => profiles.flatMap(exportedKeyLineIn);
338
+ var findExportedKeyLine = (profiles = shellProfileCandidates()) => findExportedKeyLines(profiles)[0] ?? null;
338
339
 
339
340
  export {
340
341
  CANDIDATE_RCS,
@@ -354,5 +355,6 @@ export {
354
355
  readKeySource,
355
356
  readMacAppKeyPrefix,
356
357
  recordMacAppKeyPrefix,
358
+ findExportedKeyLines,
357
359
  findExportedKeyLine
358
360
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-ZBHUHJG6.js";
3
+ } from "./chunk-UJZ7AGSC.js";
4
4
  import {
5
5
  writeFileAtomic
6
6
  } from "./chunk-T7E75EKA.js";