pushary 1.9.60 → 1.9.62

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 (125) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +6 -0
  3. package/dist/{api-ASQA5PZM.js → api-7HLZRIUV.js} +15 -12
  4. package/dist/bin/pushary-bell-hook.js +28 -27
  5. package/dist/bin/pushary-bell.js +11 -10
  6. package/dist/bin/pushary-claude.js +34 -26
  7. package/dist/bin/pushary-clean.js +36 -34
  8. package/dist/bin/pushary-codex-bridge.js +22 -21
  9. package/dist/bin/pushary-codex-hook.js +49 -35
  10. package/dist/bin/pushary-codex-session.js +9 -8
  11. package/dist/bin/pushary-codex.js +15 -14
  12. package/dist/bin/pushary-connect.js +28 -27
  13. package/dist/bin/pushary-cowork.js +6 -5
  14. package/dist/bin/pushary-daemon.js +38 -37
  15. package/dist/bin/pushary-disconnect.js +27 -26
  16. package/dist/bin/pushary-doctor.js +41 -40
  17. package/dist/bin/pushary-elicitation-hook.js +30 -27
  18. package/dist/bin/pushary-gemini-bridge.js +16 -15
  19. package/dist/bin/pushary-gemini-hook.js +38 -29
  20. package/dist/bin/pushary-hook.js +33 -31
  21. package/dist/bin/pushary-login.js +15 -14
  22. package/dist/bin/pushary-logout.js +28 -27
  23. package/dist/bin/pushary-mcp.js +12 -11
  24. package/dist/bin/pushary-mode.js +15 -14
  25. package/dist/bin/pushary-notification-hook.js +27 -26
  26. package/dist/bin/pushary-opencode-hook.js +40 -30
  27. package/dist/bin/pushary-permission-denied-hook.js +32 -31
  28. package/dist/bin/pushary-permission-hook.js +31 -30
  29. package/dist/bin/pushary-post-hook.js +27 -26
  30. package/dist/bin/pushary-prompt-hook.js +27 -26
  31. package/dist/bin/pushary-session-end-hook.js +27 -26
  32. package/dist/bin/pushary-session-start-hook.js +34 -33
  33. package/dist/bin/pushary-setup.js +4195 -93
  34. package/dist/bin/pushary-stats.js +6 -5
  35. package/dist/bin/pushary-status.js +32 -31
  36. package/dist/bin/pushary-stop-hook.js +27 -26
  37. package/dist/bin/pushary-stopfailure-hook.js +27 -26
  38. package/dist/bin/pushary-suggestions.js +15 -14
  39. package/dist/bin/pushary-transcript-register.js +19 -18
  40. package/dist/bin/pushary-transcripts.js +8 -7
  41. package/dist/bin/pushary-upgrade.js +43 -37
  42. package/dist/bin/pushary-wait.js +15 -14
  43. package/dist/bin/pushary.js +8 -7
  44. package/dist/{chunk-RPPXQNIA.js → chunk-3IFCXMC6.js} +1 -1
  45. package/dist/{chunk-WXPVVXBU.js → chunk-3LBB7GVF.js} +4 -4
  46. package/dist/{chunk-WFSGCFXQ.js → chunk-3YGUWPNZ.js} +2 -6
  47. package/dist/{chunk-SVQWHV65.js → chunk-44FNEAXK.js} +1 -1
  48. package/dist/{chunk-YPD3MTFU.js → chunk-4K6YZPZ3.js} +1 -1
  49. package/dist/{chunk-PUHP4IBA.js → chunk-557ZE5EX.js} +4 -4
  50. package/dist/{chunk-HC3FHDKB.js → chunk-5R23J52J.js} +6 -6
  51. package/dist/{chunk-625DZLT5.js → chunk-67Q3Q5IO.js} +8 -6
  52. package/dist/{chunk-QGSHV3WO.js → chunk-6HIYOY6I.js} +77 -18
  53. package/dist/{chunk-L3AFVFGQ.js → chunk-6JAWNRDR.js} +2 -2
  54. package/dist/{chunk-6MJWYYAS.js → chunk-6YSEOXP5.js} +47 -3
  55. package/dist/{chunk-VIJIG5YL.js → chunk-7E2ZN7XA.js} +2 -2
  56. package/dist/{chunk-QLMOU57V.js → chunk-7EHZXZB2.js} +33 -20
  57. package/dist/{chunk-2AELPDMT.js → chunk-7ETELRQX.js} +1 -1
  58. package/dist/{chunk-7BHI3PZN.js → chunk-7GU4PXE5.js} +1 -1
  59. package/dist/{chunk-CDQHQAS7.js → chunk-7NJ4TDUH.js} +5 -5
  60. package/dist/{chunk-X3YKQJCZ.js → chunk-7NXB7OVX.js} +1 -1
  61. package/dist/{chunk-XEJOPVCG.js → chunk-A4CZPUQ6.js} +1 -1
  62. package/dist/{chunk-YGE6ML3O.js → chunk-AFV3FQNG.js} +4 -4
  63. package/dist/{chunk-V57XLKZL.js → chunk-BIUSODLS.js} +2 -2
  64. package/dist/{chunk-2QREHU4O.js → chunk-CFIQ3252.js} +3 -3
  65. package/dist/{chunk-BG4Y64FW.js → chunk-DFKEJARZ.js} +1 -1
  66. package/dist/{chunk-S54C6TQC.js → chunk-EA6574W2.js} +5 -5
  67. package/dist/{chunk-FDWMG6NY.js → chunk-EO6CL4PD.js} +2 -2
  68. package/dist/{chunk-SEILUNWB.js → chunk-ESXGCZDA.js} +26 -3
  69. package/dist/{chunk-CEQ2AZH4.js → chunk-EUNSJKJJ.js} +8 -8
  70. package/dist/{chunk-56JCQQLS.js → chunk-EVZDYG7L.js} +2 -2
  71. package/dist/{chunk-4MUFZU2G.js → chunk-F35YILEN.js} +1 -1
  72. package/dist/{chunk-ERK24P76.js → chunk-FG5HMJ7C.js} +1 -1
  73. package/dist/{chunk-NKLNU577.js → chunk-FX7KDF47.js} +3 -3
  74. package/dist/{chunk-AXJLJJ3M.js → chunk-FXECTHAG.js} +73 -2
  75. package/dist/chunk-FYS27SUS.js +216 -0
  76. package/dist/{chunk-O6IUZGWV.js → chunk-G3ZDCYMU.js} +1 -1
  77. package/dist/{chunk-ELLJPP6O.js → chunk-GFAG72LR.js} +2 -2
  78. package/dist/{chunk-ATKN4BJT.js → chunk-GV43RXR2.js} +1 -1
  79. package/dist/{chunk-4MWRR5IT.js → chunk-HSRNWCXJ.js} +3 -3
  80. package/dist/{chunk-IF26ZGZ7.js → chunk-LCNN7UOE.js} +3 -3
  81. package/dist/{chunk-WXZHQ3TT.js → chunk-LILS32LF.js} +5 -5
  82. package/dist/{chunk-33OOEVPG.js → chunk-LL2KHEJH.js} +1 -1
  83. package/dist/{chunk-W2IVTHIG.js → chunk-LWR5VKNC.js} +18 -10
  84. package/dist/{chunk-QUBIEZXC.js → chunk-M7MEVILL.js} +3 -3
  85. package/dist/chunk-MLKGABMK.js +9 -0
  86. package/dist/{chunk-XV6S5PWW.js → chunk-MURJ4WAL.js} +1 -1
  87. package/dist/{chunk-FUZ5VYWD.js → chunk-MYEALNW6.js} +1 -1
  88. package/dist/{chunk-ADR3KHOC.js → chunk-NAZRRXZM.js} +2 -2
  89. package/dist/{chunk-ZGOJLNKS.js → chunk-NZLQ6GMX.js} +4 -4
  90. package/dist/{chunk-K4MBKXAE.js → chunk-OZRT64BB.js} +1 -1
  91. package/dist/{chunk-Y5VKZNFN.js → chunk-PSCXEH42.js} +2 -2
  92. package/dist/{chunk-METMK3L4.js → chunk-Q4WTIKM6.js} +3 -3
  93. package/dist/{chunk-U7NR4JVD.js → chunk-QIPW7OVB.js} +4 -4
  94. package/dist/{chunk-USE5IEEW.js → chunk-R3CLBNST.js} +1 -1
  95. package/dist/{chunk-7WFRY6OL.js → chunk-RFCEVROB.js} +2 -2
  96. package/dist/{chunk-EZHY65QA.js → chunk-RSNN2TPE.js} +13 -8
  97. package/dist/{chunk-DJ7EZIQA.js → chunk-RU37NSZH.js} +3 -3
  98. package/dist/{chunk-J4KQL7YZ.js → chunk-SDOWT67G.js} +5 -5
  99. package/dist/{chunk-4PZXI7WU.js → chunk-SJCPIYWJ.js} +2 -2
  100. package/dist/{chunk-MUNL23WE.js → chunk-SJJYXMJP.js} +6 -6
  101. package/dist/{chunk-6LOQE4J4.js → chunk-TMHE5CVX.js} +3 -3
  102. package/dist/{chunk-GAMVAORR.js → chunk-UUAVYIWJ.js} +1 -1
  103. package/dist/{chunk-Y5V4PA2Z.js → chunk-UWCPY4RY.js} +2 -2
  104. package/dist/{chunk-5RU35K57.js → chunk-VF3IL56Q.js} +2 -2
  105. package/dist/{chunk-WN3RACVD.js → chunk-W3CBFLIX.js} +3 -3
  106. package/dist/{chunk-RLVJ6TVL.js → chunk-W6MYFAOK.js} +26 -18
  107. package/dist/{chunk-CSOROFJY.js → chunk-YQK72JGV.js} +5 -5
  108. package/dist/{chunk-7JXJJNQ5.js → chunk-ZEDGKCCM.js} +1 -1
  109. package/dist/{chunk-SOCJ2N3E.js → chunk-ZJFJUAHS.js} +6 -6
  110. package/dist/{codex-app-cards-switch-ZO76D2NY.js → codex-app-cards-switch-IIL7IPP6.js} +12 -11
  111. package/dist/{codex-desktop-launch-MJT5E3O3.js → codex-desktop-launch-XCLMYVBD.js} +2 -1
  112. package/dist/{codex-session-launch-PTFCVIC7.js → codex-session-launch-UMVALJ3A.js} +19 -18
  113. package/dist/{config-SXV6XNVU.js → config-5N3GUJD5.js} +4 -3
  114. package/dist/{global-upgrade-ETDP32LO.js → global-upgrade-5F4CSXED.js} +10 -9
  115. package/dist/{identity-OOLIOSMR.js → identity-7ULYW4RL.js} +5 -4
  116. package/dist/{live-capabilities-2XIFA7YO.js → live-capabilities-QTSFXA6T.js} +5 -4
  117. package/dist/{paths-IIOQZESZ.js → paths-HEMK2ALW.js} +4 -3
  118. package/dist/{reapply-KFAJSKOQ.js → reapply-AMFKVYZV.js} +27 -26
  119. package/dist/src/index.d.ts +1 -0
  120. package/dist/src/index.js +22 -21
  121. package/dist/{upgrade-lock-T6ILR644.js → upgrade-lock-IAZC5644.js} +5 -4
  122. package/dist/usage-NEFDYSRT.js +11 -0
  123. package/package.json +1 -1
  124. package/dist/chunk-6MC2XXFD.js +0 -126
  125. package/dist/usage-6TN7FVWS.js +0 -10
@@ -2,29 +2,29 @@
2
2
  import {
3
3
  waitResponse,
4
4
  waitWindowResponse
5
- } from "../chunk-X3YKQJCZ.js";
5
+ } from "../chunk-7NXB7OVX.js";
6
6
  import {
7
7
  describeWaitLadder
8
8
  } from "../chunk-CVWG2N3Y.js";
9
9
  import {
10
10
  exitOnFailedSettingsRequest
11
- } from "../chunk-YGE6ML3O.js";
12
- import "../chunk-ADR3KHOC.js";
11
+ } from "../chunk-AFV3FQNG.js";
12
+ import "../chunk-NAZRRXZM.js";
13
13
  import {
14
14
  createIo
15
15
  } from "../chunk-FO3MDD26.js";
16
16
  import {
17
17
  exitOnHelpFlag
18
- } from "../chunk-K4MBKXAE.js";
18
+ } from "../chunk-OZRT64BB.js";
19
19
  import {
20
20
  parseFlags
21
21
  } from "../chunk-NMUI3ZWG.js";
22
- import "../chunk-WN3RACVD.js";
23
- import "../chunk-METMK3L4.js";
22
+ import "../chunk-W3CBFLIX.js";
23
+ import "../chunk-Q4WTIKM6.js";
24
24
  import {
25
25
  pusharyFetch
26
- } from "../chunk-4MWRR5IT.js";
27
- import "../chunk-O6IUZGWV.js";
26
+ } from "../chunk-HSRNWCXJ.js";
27
+ import "../chunk-G3ZDCYMU.js";
28
28
  import {
29
29
  UsageError,
30
30
  exitCodeFor
@@ -32,17 +32,18 @@ import {
32
32
  import {
33
33
  EXIT
34
34
  } from "../chunk-KZERVKTD.js";
35
- import "../chunk-Y5VKZNFN.js";
36
- import "../chunk-6MJWYYAS.js";
37
- import "../chunk-2QREHU4O.js";
35
+ import "../chunk-PSCXEH42.js";
36
+ import "../chunk-6YSEOXP5.js";
37
+ import "../chunk-CFIQ3252.js";
38
38
  import "../chunk-QENTGE75.js";
39
39
  import {
40
40
  getApiKey,
41
41
  getBaseUrl
42
- } from "../chunk-BG4Y64FW.js";
43
- import "../chunk-ERK24P76.js";
42
+ } from "../chunk-DFKEJARZ.js";
43
+ import "../chunk-FG5HMJ7C.js";
44
44
  import "../chunk-QTOLNRET.js";
45
- import "../chunk-AXJLJJ3M.js";
45
+ import "../chunk-FXECTHAG.js";
46
+ import "../chunk-MLKGABMK.js";
46
47
 
47
48
  // bin/pushary-wait.ts
48
49
  exitOnHelpFlag("wait");
@@ -1,25 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  installNetworkDefaults
4
- } from "../chunk-4MWRR5IT.js";
5
- import "../chunk-O6IUZGWV.js";
4
+ } from "../chunk-HSRNWCXJ.js";
5
+ import "../chunk-G3ZDCYMU.js";
6
6
  import "../chunk-PPY5N2E6.js";
7
7
  import {
8
8
  EXIT
9
9
  } from "../chunk-KZERVKTD.js";
10
- import "../chunk-6MJWYYAS.js";
11
- import "../chunk-2QREHU4O.js";
10
+ import "../chunk-6YSEOXP5.js";
11
+ import "../chunk-CFIQ3252.js";
12
12
  import "../chunk-QENTGE75.js";
13
- import "../chunk-BG4Y64FW.js";
13
+ import "../chunk-DFKEJARZ.js";
14
14
  import {
15
15
  LISTED_COMMANDS,
16
16
  renderHelp,
17
17
  resolveCommandName
18
- } from "../chunk-ERK24P76.js";
18
+ } from "../chunk-FG5HMJ7C.js";
19
19
  import {
20
20
  getPackageVersion
21
21
  } from "../chunk-QTOLNRET.js";
22
- import "../chunk-AXJLJJ3M.js";
22
+ import "../chunk-FXECTHAG.js";
23
+ import "../chunk-MLKGABMK.js";
23
24
 
24
25
  // src/cli/runtime.ts
25
26
  var supportsRuntime = (version) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-W2IVTHIG.js";
3
+ } from "./chunk-LWR5VKNC.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-PUHP4IBA.js";
4
+ } from "./chunk-557ZE5EX.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-CDQHQAS7.js";
7
+ } from "./chunk-7NJ4TDUH.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-6MJWYYAS.js";
11
+ } from "./chunk-6YSEOXP5.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-AXJLJJ3M.js";
14
+ } from "./chunk-FXECTHAG.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -4,13 +4,10 @@ import {
4
4
  } from "./chunk-QENTGE75.js";
5
5
  import {
6
6
  configFilePath
7
- } from "./chunk-BG4Y64FW.js";
7
+ } from "./chunk-DFKEJARZ.js";
8
8
  import {
9
9
  readSetupOutcomeProperties
10
- } from "./chunk-AXJLJJ3M.js";
11
-
12
- // src/hooks-spec.ts
13
- var CURSOR_GATE_SCRIPT = "pushary-gate.mjs";
10
+ } from "./chunk-FXECTHAG.js";
14
11
 
15
12
  // src/diagnostics/service-runtime.ts
16
13
  var unescapeXml = (value) => value.replaceAll("&quot;", '"').replaceAll("&apos;", "'").replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&");
@@ -69,7 +66,6 @@ var readSetupFailure = (path = failurePath()) => {
69
66
  export {
70
67
  saveSetupFailure,
71
68
  readSetupFailure,
72
- CURSOR_GATE_SCRIPT,
73
69
  readServiceExecPath,
74
70
  versionManagerOf,
75
71
  describeVersionManagerPin
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-AXJLJJ3M.js";
3
+ } from "./chunk-FXECTHAG.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote
4
- } from "./chunk-AXJLJJ3M.js";
4
+ } from "./chunk-FXECTHAG.js";
5
5
 
6
6
  // src/repo.ts
7
7
  import { existsSync, readFileSync, statSync } from "fs";
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-IF26ZGZ7.js";
6
+ } from "./chunk-LCNN7UOE.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  compatibleToolLookup
10
- } from "./chunk-W2IVTHIG.js";
10
+ } from "./chunk-LWR5VKNC.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-6MJWYYAS.js";
17
+ } from "./chunk-6YSEOXP5.js";
18
18
  import {
19
19
  HOOK_COMPATIBLE_PROFILES,
20
20
  HOOK_LOCATOR_BINARY,
@@ -26,7 +26,7 @@ import {
26
26
  pusharyMissingReason,
27
27
  refusalOutput,
28
28
  withHookHoldBudget
29
- } from "./chunk-AXJLJJ3M.js";
29
+ } from "./chunk-FXECTHAG.js";
30
30
 
31
31
  // src/claude-config.ts
32
32
  import { join } from "path";
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-WN3RACVD.js";
7
+ } from "./chunk-W3CBFLIX.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-O6IUZGWV.js";
10
+ } from "./chunk-G3ZDCYMU.js";
11
11
  import {
12
12
  pusharyDir
13
- } from "./chunk-6MJWYYAS.js";
13
+ } from "./chunk-6YSEOXP5.js";
14
14
  import {
15
15
  resolveGlobalBinary
16
- } from "./chunk-2QREHU4O.js";
16
+ } from "./chunk-CFIQ3252.js";
17
17
  import {
18
18
  readJsonSafe,
19
19
  writeFileAtomic,
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-QENTGE75.js";
23
23
  import {
24
24
  getApiKey
25
- } from "./chunk-BG4Y64FW.js";
25
+ } from "./chunk-DFKEJARZ.js";
26
26
  import {
27
27
  CLI_PACKAGE_NAMES,
28
28
  cmdShimTarget,
@@ -32,7 +32,7 @@ import {
32
32
  } from "./chunk-QTOLNRET.js";
33
33
  import {
34
34
  isRecord
35
- } from "./chunk-AXJLJJ3M.js";
35
+ } from "./chunk-FXECTHAG.js";
36
36
 
37
37
  // src/daemon-lifecycle.ts
38
38
  import { dirname, join, win32 as win32Path } from "path";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  announceSubscriptionRequired,
3
3
  isDeferAnswer
4
- } from "./chunk-RPPXQNIA.js";
4
+ } from "./chunk-3IFCXMC6.js";
5
5
  import {
6
6
  AUTO_DECISION_WINDOW_MS,
7
7
  DEFAULT_SESSION,
@@ -10,18 +10,19 @@ import {
10
10
  permissionDeniedAction,
11
11
  releaseThrottle,
12
12
  reportEvent
13
- } from "./chunk-W2IVTHIG.js";
13
+ } from "./chunk-LWR5VKNC.js";
14
14
  import {
15
15
  askUser,
16
16
  isDecisionStopped,
17
+ isQuestionLimitRefusal,
17
18
  waitForQuestion
18
- } from "./chunk-EZHY65QA.js";
19
+ } from "./chunk-RSNN2TPE.js";
19
20
  import {
20
21
  SubscriptionRequiredError
21
- } from "./chunk-SEILUNWB.js";
22
+ } from "./chunk-ESXGCZDA.js";
22
23
  import {
23
24
  getMachineId
24
- } from "./chunk-O6IUZGWV.js";
25
+ } from "./chunk-G3ZDCYMU.js";
25
26
  import {
26
27
  ASK_CONTEXT_MAX,
27
28
  agentQuestionContext,
@@ -33,7 +34,7 @@ import {
33
34
  questionsShownAsASet,
34
35
  shouldDeferToNativeMode,
35
36
  wireVerdictFor
36
- } from "./chunk-AXJLJJ3M.js";
37
+ } from "./chunk-FXECTHAG.js";
37
38
 
38
39
  // src/machine-decision-audit.ts
39
40
  import { basename } from "path";
@@ -103,6 +104,7 @@ var cardOf = (question) => {
103
104
  };
104
105
  };
105
106
  var outcomeOfFailedAsk = (error, sessionId, failure) => {
107
+ if (isQuestionLimitRefusal(error)) return void 0;
106
108
  if (!(error instanceof SubscriptionRequiredError)) return failure;
107
109
  announceSubscriptionRequired(error.upgradeUrl, sessionId);
108
110
  return void 0;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  compatibleConfigFile
3
- } from "./chunk-PUHP4IBA.js";
3
+ } from "./chunk-557ZE5EX.js";
4
4
  import {
5
5
  hookOwnerOf,
6
6
  hookOwnerOfCommands,
7
7
  liveBridgeProbe,
8
8
  resolveBridgeStub
9
- } from "./chunk-CDQHQAS7.js";
9
+ } from "./chunk-7NJ4TDUH.js";
10
10
  import {
11
11
  AGENT_CHOICES
12
- } from "./chunk-XV6S5PWW.js";
12
+ } from "./chunk-MURJ4WAL.js";
13
13
  import {
14
14
  claudeSettings,
15
15
  codexHooksJson,
@@ -18,7 +18,7 @@ import {
18
18
  guardedArgv,
19
19
  pusharyDir,
20
20
  vscodePluginDir
21
- } from "./chunk-6MJWYYAS.js";
21
+ } from "./chunk-6YSEOXP5.js";
22
22
  import {
23
23
  readJsonSafe
24
24
  } from "./chunk-QENTGE75.js";
@@ -29,7 +29,7 @@ import {
29
29
  OPENCODE_APPROVAL_EVENT,
30
30
  hookCompatibleProfile,
31
31
  isRecord
32
- } from "./chunk-AXJLJJ3M.js";
32
+ } from "./chunk-FXECTHAG.js";
33
33
 
34
34
  // src/opencode-plugin.ts
35
35
  var OPENCODE_PLUGIN_MARKER = "pushary-opencode-plugin w1";
@@ -141,18 +141,21 @@ const tell = (payload) => {
141
141
  // tools: bash asks with { command }, write and edit both ask under "edit" with
142
142
  // { filepath, diff }, webfetch with { url }, and a shell command reaching outside
143
143
  // the worktree asks a second time under "external_directory".
144
- const inputFrom = (permission, metadata) => {
144
+ const inputFrom = (permission, metadata, resources) => {
145
145
  const meta = metadata && typeof metadata === "object" ? metadata : {}
146
+ if (permission === "read" && resources?.length === 1) return { file_path: resources[0] }
146
147
  const command = text(meta.command)
147
148
  if (command) return { command }
148
- const filepath = text(meta.filepath) ?? text(meta.file_path)
149
+ const preview = Array.isArray(meta.files) && meta.files.length === 1 ? meta.files[0] : undefined
150
+ const filepath = text(preview?.file) ?? text(meta.filepath) ?? text(meta.file_path) ?? text(meta.path)
149
151
  // The diff rides along, because it is what the person is actually approving.
150
152
  // OpenCode computes it before raising the permission and hands it over; without
151
153
  // it the phone shows a filename and nothing to judge.
152
- if (filepath) return { file_path: filepath, ...(text(meta.diff) ? { diff: meta.diff } : {}) }
154
+ const diff = text(preview?.patch) ?? text(meta.diff)
155
+ if (filepath) return { file_path: filepath, ...(diff ? { diff } : {}) }
153
156
  const url = text(meta.url)
154
157
  if (url) return { url }
155
- return { permission }
158
+ return { permission, ...(resources?.length ? { resources } : {}) }
156
159
  }
157
160
 
158
161
  // Two spellings of one request: the runtime publishes PermissionV1.Request
@@ -166,10 +169,11 @@ const askedFrom = (properties) => {
166
169
  return {
167
170
  id,
168
171
  sessionID,
169
- permission: text(properties.permission) ?? text(properties.type) ?? "unknown",
172
+ permission: text(properties.action) ?? text(properties.permission) ?? text(properties.type) ?? "unknown",
170
173
  metadata: properties.metadata,
171
- title: text(properties.title),
172
- callID: text(properties.callID) ?? text(properties.tool && properties.tool.callID),
174
+ resources: Array.isArray(properties.resources) ? properties.resources.filter((item) => typeof item === "string") : undefined,
175
+ title: text(properties.title) ?? text(properties.message),
176
+ callID: text(properties.source && properties.source.id) ?? text(properties.callID) ?? text(properties.tool && properties.tool.callID),
173
177
  }
174
178
  }
175
179
 
@@ -178,7 +182,7 @@ const repliedID = (properties) => {
178
182
  return text(properties.requestID) ?? text(properties.permissionID) ?? text(properties.id)
179
183
  }
180
184
 
181
- export const PusharyPlugin = async ({ client, directory, worktree }) => {
185
+ const PusharyPlugin = async ({ client, directory, worktree, replyPermission }) => {
182
186
  const cwd = directory || worktree || process.cwd()
183
187
  // OpenCode raises a permission under a coarse key \u2014 "edit" covers both write and
184
188
  // edit \u2014 and names the actual tool only on tool.execute.before. Keeping the
@@ -195,6 +199,12 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
195
199
  // /session/{id}/permissions/{permissionID}, v2 exposes permission.reply against
196
200
  // /permission/{requestID}/reply. Both routes are live in the server today.
197
201
  const respond = async (asked, allow) => {
202
+ if (replyPermission) {
203
+ try {
204
+ await replyPermission({ sessionID: asked.sessionID, requestID: asked.id, decision: allow ? "once" : "reject" })
205
+ } catch {}
206
+ return
207
+ }
198
208
  const legacy = client && typeof client.postSessionIdPermissionsPermissionId === "function"
199
209
  ? () => client.postSessionIdPermissionsPermissionId({
200
210
  path: { id: asked.sessionID, permissionID: asked.id },
@@ -224,11 +234,17 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
224
234
  }
225
235
 
226
236
  const gate = async (asked) => {
237
+ if (asked.permission === "external_directory") return
238
+ if (replyPermission && !["shell", "read", "edit", "webfetch"].includes(asked.permission)) return
239
+ if (Array.isArray(asked.metadata?.files) && asked.metadata.files.length > 1) return
240
+ if (["read", "edit"].includes(asked.permission) && asked.resources?.length > 1) return
241
+ const tool = tools.get(asked.callID)
242
+ if (["shell", "bash"].includes(tool?.name) && text(tool.input?.workdir) && tool.input.workdir !== cwd) return
227
243
  const reply = await run({
228
244
  ...base(asked.sessionID),
229
245
  hook_event_name: "${OPENCODE_APPROVAL_EVENT}",
230
- tool_name: tools.get(asked.callID) ?? asked.permission,
231
- tool_input: inputFrom(asked.permission, asked.metadata),
246
+ tool_name: tool?.name ?? asked.permission,
247
+ tool_input: inputFrom(asked.permission, { ...tool?.input, ...asked.metadata }, asked.resources),
232
248
  permission_id: asked.id,
233
249
  permission_type: asked.permission,
234
250
  title: asked.title,
@@ -256,7 +272,7 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
256
272
 
257
273
  return {
258
274
  "tool.execute.before": async (input) => {
259
- remember(tools, input && input.callID, input && input.tool)
275
+ remember(tools, input && input.callID, { name: input?.tool, input: input?.args })
260
276
  },
261
277
 
262
278
  "tool.execute.after": async (input, output) => {
@@ -267,7 +283,7 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
267
283
  hook_event_name: "tool.execute.after",
268
284
  tool_name: text(input && input.tool) ?? "unknown",
269
285
  tool_input: input && input.args && typeof input.args === "object" ? input.args : {},
270
- tool_result: { title: text(output && output.title), output: text(output && output.output) },
286
+ tool_result: output?.error ? { error: output.error } : { title: text(output && output.title), output: text(output && output.output) },
271
287
  })
272
288
  },
273
289
 
@@ -290,7 +306,7 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
290
306
  const properties = event && event.properties
291
307
  if (${OPENCODE_APPROVAL_EVENTS_PLACEHOLDER}.includes(type)) {
292
308
  const asked = askedFrom(properties)
293
- if (asked) void gate(asked)
309
+ if (asked && !waiting.has(asked.id)) void gate(asked)
294
310
  return
295
311
  }
296
312
  if (type === ${JSON.stringify(OPENCODE_REPLIED_EVENT)}) {
@@ -316,6 +332,49 @@ export const PusharyPlugin = async ({ client, directory, worktree }) => {
316
332
  },
317
333
  }
318
334
  }
335
+
336
+ export default {
337
+ id: "pushary",
338
+ server: PusharyPlugin,
339
+ async setup(ctx) {
340
+ const hooks = await PusharyPlugin({
341
+ directory: ctx.location.directory,
342
+ replyPermission: (request) => ctx.permission.reply(request),
343
+ })
344
+ await ctx.tool.hook("execute.before", (event) => hooks["tool.execute.before"]({
345
+ callID: event.id, tool: event.tool, sessionID: event.sessionID, args: event.input,
346
+ }))
347
+ await ctx.tool.hook("execute.after", (event) => hooks["tool.execute.after"]({
348
+ callID: event.id, tool: event.tool, sessionID: event.sessionID, args: event.input,
349
+ }, { output: event.status === "completed" && Array.isArray(event.result.content)
350
+ ? event.result.content.filter((part) => part.type === "text").map((part) => part.text).join("\\n")
351
+ : undefined, error: event.status === "error" ? event.error.message : undefined }))
352
+ await ctx.session.hook("prompt", (event) => hooks["chat.message"]({ sessionID: event.sessionID }, {
353
+ parts: [{ type: "text", text: event.prompt.text }],
354
+ }))
355
+ const controller = new AbortController()
356
+ const consume = async () => {
357
+ try {
358
+ for await (const event of ctx.event.subscribe({ signal: controller.signal })) {
359
+ if (controller.signal.aborted) break
360
+ if (event.location && (event.location.directory !== ctx.location.directory || event.location.workspaceID !== ctx.location.workspaceID)) continue
361
+ const type = event.type === "session.execution.succeeded" ? "session.idle" : event.type
362
+ await hooks.event({ event: { type, properties: event.data } })
363
+ }
364
+ } catch {
365
+ if (!controller.signal.aborted) console.error("Pushary event subscription stopped; native prompts remain available.")
366
+ } finally {
367
+ await hooks.dispose()
368
+ }
369
+ }
370
+ const events = consume()
371
+ return async () => {
372
+ controller.abort()
373
+ await hooks.dispose()
374
+ await events
375
+ }
376
+ },
377
+ }
319
378
  `;
320
379
  var openCodePluginModule = () => ({
321
380
  marker: OPENCODE_PLUGIN_MARKER,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-6MJWYYAS.js";
3
+ } from "./chunk-6YSEOXP5.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-AXJLJJ3M.js";
16
+ } from "./chunk-FXECTHAG.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  quoteIfNeeded,
3
3
  shellDoubleQuoted
4
- } from "./chunk-2QREHU4O.js";
4
+ } from "./chunk-CFIQ3252.js";
5
5
  import {
6
6
  CODEX_QUESTION_TOOLS,
7
7
  HOOK_BUDGETS,
8
8
  HOOK_LOCATOR_BINARY,
9
9
  withHookHoldBudget
10
- } from "./chunk-AXJLJJ3M.js";
10
+ } from "./chunk-FXECTHAG.js";
11
11
 
12
12
  // src/setup/paths.ts
13
13
  import { createHash as createHash2 } from "crypto";
@@ -201,18 +201,59 @@ var ensureRecord = (target, key) => {
201
201
  return created;
202
202
  };
203
203
  var CODEX_MCP_URL = "https://pushary.com/api/mcp/mcp";
204
- var addCodexMcpServer = (config, apiKey) => {
204
+ var CODEX_HTTP_ONLY_FIELDS = ["url", "http_headers", "env_http_headers", "http_headers_helper", "bearer_token", "bearer_token_env_var", "auth", "oauth", "oauth_resource"];
205
+ var NATIVE_MCP_TRANSPORT_FIELDS = [...CODEX_HTTP_ONLY_FIELDS, "args", "env", "env_vars", "cwd"];
206
+ var OLD_CLI_HTTP_FIELDS = /* @__PURE__ */ new Set(["url", "http_headers"]);
207
+ var nativeCodexMcpCommand = () => join2(homedir2(), ".pushary", "bin", "pushary-mcp");
208
+ var isNativeCodexMcpEntry = (entry, command) => {
209
+ const server = asRecord2(entry);
210
+ return server?.command === command && NATIVE_MCP_TRANSPORT_FIELDS.every((field) => !(field in server));
211
+ };
212
+ var carriesOnlyAnAuthorizationHeader = (headers) => {
213
+ const record = asRecord2(headers);
214
+ return record !== void 0 && Object.keys(record).length === 1 && typeof record.Authorization === "string";
215
+ };
216
+ var isOldCliMixedCodexMcpEntry = (entry, command) => {
217
+ const server = asRecord2(entry);
218
+ return server?.command === command && server.url === CODEX_MCP_URL && carriesOnlyAnAuthorizationHeader(server.http_headers) && NATIVE_MCP_TRANSPORT_FIELDS.every((field) => OLD_CLI_HTTP_FIELDS.has(field) || !(field in server));
219
+ };
220
+ var codexMcpMixesCommandWithHttp = (entry) => {
221
+ const server = asRecord2(entry);
222
+ return server !== void 0 && "command" in server && CODEX_HTTP_ONLY_FIELDS.some((field) => field in server);
223
+ };
224
+ var CODEX_RESTART_AFTER_TRANSPORT_CHANGE = "Fully quit and reopen Codex to load the updated Pushary configuration.";
225
+ var codexMcpStartsCommand = (config) => {
226
+ const pushary = asRecord2(asRecord2(config.mcp_servers)?.pushary);
227
+ return pushary !== void 0 && "command" in pushary && pushary.enabled !== false;
228
+ };
229
+ var addCodexMcpServer = (config, apiKey, nativeOwnership = "preserve") => {
230
+ const existing = asRecord2(asRecord2(config.mcp_servers)?.pushary);
231
+ if (existing !== void 0 && "command" in existing) {
232
+ const command = nativeCodexMcpCommand();
233
+ if (!isOldCliMixedCodexMcpEntry(existing, command) && !isNativeCodexMcpEntry(existing, command)) {
234
+ throw new Error("Pushary MCP has an unrecognized or mixed transport. Its configuration was left unchanged.");
235
+ }
236
+ if (nativeOwnership === "preserve") {
237
+ for (const field of OLD_CLI_HTTP_FIELDS) delete existing[field];
238
+ return "kept-native";
239
+ }
240
+ }
205
241
  const servers = ensureRecord(config, "mcp_servers");
206
242
  const pushary = ensureRecord(servers, "pushary");
243
+ delete pushary.command;
207
244
  pushary.url = CODEX_MCP_URL;
208
245
  ensureRecord(pushary, "http_headers").Authorization = `Bearer ${apiKey}`;
209
246
  pushary.default_tools_approval_mode = "approve";
210
247
  delete pushary.bearer_token_env_var;
211
248
  delete pushary.tools;
249
+ return "wrote-key";
212
250
  };
213
251
  var readCodexMcpAuth = (config) => {
214
252
  const pushary = asRecord2(asRecord2(config.mcp_servers)?.pushary);
215
253
  if (!pushary) return void 0;
254
+ if ("command" in pushary) {
255
+ return isNativeCodexMcpEntry(pushary, nativeCodexMcpCommand()) ? { method: "native" } : void 0;
256
+ }
216
257
  const authorization = asRecord2(pushary.http_headers)?.Authorization;
217
258
  if (typeof authorization === "string" && authorization.startsWith("Bearer ")) {
218
259
  return { method: "embedded", key: authorization.slice("Bearer ".length).trim() };
@@ -517,6 +558,9 @@ export {
517
558
  codexSkillDir,
518
559
  CODEX_HOOK_EVENTS,
519
560
  CODEX_REQUIRED_APPROVAL_EVENTS,
561
+ codexMcpMixesCommandWithHttp,
562
+ CODEX_RESTART_AFTER_TRANSPORT_CHANGE,
563
+ codexMcpStartsCommand,
520
564
  addCodexMcpServer,
521
565
  readCodexMcpAuth,
522
566
  isPusharyCodexCommand,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  autoUpdateLock
3
- } from "./chunk-6MJWYYAS.js";
3
+ } from "./chunk-6YSEOXP5.js";
4
4
  import {
5
5
  installPackageGlobally,
6
6
  npmErrorMessage
7
- } from "./chunk-2QREHU4O.js";
7
+ } from "./chunk-CFIQ3252.js";
8
8
  import {
9
9
  writeJsonAtomic
10
10
  } from "./chunk-QENTGE75.js";