pushary 1.9.23 → 1.9.24

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 (105) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/data/cursor-plugin/.cursor-plugin/plugin.json +1 -1
  3. package/data/cursor-plugin/CHANGELOG.md +4 -0
  4. package/data/cursor-plugin/scripts/pushary-gate.mjs +4 -2
  5. package/data/cursor-plugin/scripts/pushary-gate.test.mjs +14 -1
  6. package/dist/bin/pushary-bell-hook.js +25 -25
  7. package/dist/bin/pushary-bell.js +9 -9
  8. package/dist/bin/pushary-claude.js +27 -26
  9. package/dist/bin/pushary-clean.js +41 -93
  10. package/dist/bin/pushary-codex-bridge.js +17 -17
  11. package/dist/bin/pushary-codex-hook.js +30 -30
  12. package/dist/bin/pushary-codex.js +12 -12
  13. package/dist/bin/pushary-connect.js +24 -24
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +31 -31
  16. package/dist/bin/pushary-disconnect.js +24 -24
  17. package/dist/bin/pushary-doctor.js +33 -33
  18. package/dist/bin/pushary-elicitation-hook.js +25 -25
  19. package/dist/bin/pushary-gemini-bridge.js +13 -13
  20. package/dist/bin/pushary-gemini-hook.js +27 -27
  21. package/dist/bin/pushary-hook.js +29 -29
  22. package/dist/bin/pushary-login.js +16 -16
  23. package/dist/bin/pushary-logout.js +77 -26
  24. package/dist/bin/pushary-mcp.js +9 -9
  25. package/dist/bin/pushary-mode.js +12 -12
  26. package/dist/bin/pushary-notification-hook.js +24 -24
  27. package/dist/bin/pushary-opencode-hook.js +26 -26
  28. package/dist/bin/pushary-permission-denied-hook.js +29 -29
  29. package/dist/bin/pushary-permission-hook.js +28 -28
  30. package/dist/bin/pushary-post-hook.js +24 -24
  31. package/dist/bin/pushary-prompt-hook.js +24 -24
  32. package/dist/bin/pushary-session-end-hook.js +24 -24
  33. package/dist/bin/pushary-session-start-hook.js +28 -28
  34. package/dist/bin/pushary-setup.js +41 -38
  35. package/dist/bin/pushary-stats.js +5 -5
  36. package/dist/bin/pushary-status.js +26 -26
  37. package/dist/bin/pushary-stop-hook.js +24 -24
  38. package/dist/bin/pushary-stopfailure-hook.js +24 -24
  39. package/dist/bin/pushary-suggestions.js +12 -12
  40. package/dist/bin/pushary-transcript-register.js +17 -17
  41. package/dist/bin/pushary-transcripts.js +7 -7
  42. package/dist/bin/pushary-upgrade.js +30 -30
  43. package/dist/bin/pushary-wait.js +12 -12
  44. package/dist/bin/pushary.js +6 -6
  45. package/dist/{chunk-FIYCICHC.js → chunk-264EOGIK.js} +2 -2
  46. package/dist/{chunk-XBETSM5T.js → chunk-2E6AWHV7.js} +3 -3
  47. package/dist/{chunk-YZPFJCFE.js → chunk-2F6UQ3YD.js} +1 -1
  48. package/dist/{chunk-6GHZAS7S.js → chunk-2JTJZ7VI.js} +4 -4
  49. package/dist/{chunk-CJTQNUUT.js → chunk-35U2QHH2.js} +2 -2
  50. package/dist/{chunk-QFNY4KUQ.js → chunk-3WRJU7KN.js} +1 -1
  51. package/dist/{chunk-HXZG5WHU.js → chunk-7JHYWFY6.js} +2 -2
  52. package/dist/{chunk-NHBPW6C4.js → chunk-7Z2DLAEE.js} +2 -2
  53. package/dist/{chunk-FBV2KS3Z.js → chunk-CLVU24OZ.js} +2 -2
  54. package/dist/{chunk-SLBO7PHS.js → chunk-CYGIJXAP.js} +2 -2
  55. package/dist/{chunk-M7DCI44L.js → chunk-E4B7TXVS.js} +1 -1
  56. package/dist/{chunk-S2R2U5W5.js → chunk-EE357RIP.js} +4 -4
  57. package/dist/{chunk-I46QTKYI.js → chunk-EKPAV33G.js} +5 -5
  58. package/dist/{chunk-SWQLZQE3.js → chunk-G6GFNKF7.js} +14 -13
  59. package/dist/{chunk-GN6BJXC7.js → chunk-GBD6G4TA.js} +1 -1
  60. package/dist/{chunk-OH647UT3.js → chunk-GM2IFDVF.js} +24 -1
  61. package/dist/{chunk-6HT2TUZD.js → chunk-GXQVOKHJ.js} +2 -2
  62. package/dist/{chunk-Z4UDB7EC.js → chunk-H2RD5EMR.js} +3 -3
  63. package/dist/{chunk-SSWK2WYX.js → chunk-HBR6ZZHN.js} +5 -5
  64. package/dist/{chunk-2AUKCSLQ.js → chunk-HLXGEOX3.js} +4 -4
  65. package/dist/{chunk-ISAKLEKE.js → chunk-IO5ZDIHY.js} +7 -7
  66. package/dist/{chunk-EDN4F6GX.js → chunk-IS737HST.js} +1 -1
  67. package/dist/{chunk-M6R3SZZS.js → chunk-JDWOK6PE.js} +1 -1
  68. package/dist/{chunk-GYP6DLA4.js → chunk-KT5BH6GC.js} +8 -8
  69. package/dist/{chunk-7J2AX5T6.js → chunk-KX776UXN.js} +2 -2
  70. package/dist/chunk-L5MCJNSI.js +166 -0
  71. package/dist/{chunk-RHIKMNWJ.js → chunk-LHFK5F3T.js} +2 -2
  72. package/dist/{chunk-K2EYK5RL.js → chunk-LOERK6N3.js} +4 -4
  73. package/dist/{chunk-R5C3QCVT.js → chunk-NJK4MGXL.js} +1 -1
  74. package/dist/{chunk-QIODXPTP.js → chunk-NQICO3ES.js} +4 -4
  75. package/dist/{chunk-ZGYO6OQE.js → chunk-O3RRQTTV.js} +5 -5
  76. package/dist/{chunk-PFB7P4F3.js → chunk-OLWKCDK4.js} +6 -6
  77. package/dist/{chunk-A5U62Q6K.js → chunk-OSOCONIE.js} +5 -5
  78. package/dist/{chunk-OQPEHKH2.js → chunk-OY6NJWDD.js} +1 -1
  79. package/dist/{chunk-NSCETODW.js → chunk-P447F2RB.js} +1 -1
  80. package/dist/{chunk-RN5NRRHX.js → chunk-Q7IEFI7V.js} +2 -2
  81. package/dist/{chunk-LEQRIJ4H.js → chunk-QDKNLNCA.js} +3 -3
  82. package/dist/{chunk-KJA6IGOZ.js → chunk-RFK2WN6S.js} +1 -1
  83. package/dist/{chunk-N4DMADJM.js → chunk-RIBIEQHU.js} +1 -1
  84. package/dist/{chunk-E2LGKG75.js → chunk-RK7TDMQT.js} +3 -3
  85. package/dist/{chunk-DKBPNHAI.js → chunk-SBQCRQIP.js} +4 -4
  86. package/dist/{chunk-AXSHPFU3.js → chunk-SH2KK2ED.js} +3 -3
  87. package/dist/{chunk-OH6OGEOY.js → chunk-T5KM7J75.js} +4 -4
  88. package/dist/{chunk-73HGV4R6.js → chunk-T6TJA4RF.js} +2 -2
  89. package/dist/{chunk-AQ3TSQA2.js → chunk-U23XTMBF.js} +21 -8
  90. package/dist/{chunk-BY5EKA6W.js → chunk-URCSJZNU.js} +3 -3
  91. package/dist/{chunk-7RGEJOQS.js → chunk-VFIZFKZY.js} +3 -3
  92. package/dist/{chunk-AFP3HZVK.js → chunk-VICG46JC.js} +1 -1
  93. package/dist/{chunk-AV5VX7OK.js → chunk-W5NHIA4Y.js} +8 -8
  94. package/dist/{chunk-JCEUDLGW.js → chunk-WYLA6J43.js} +1 -1
  95. package/dist/{chunk-YXHVMZPR.js → chunk-XA2RGGNR.js} +4 -4
  96. package/dist/{chunk-USUI4P63.js → chunk-XQROISQB.js} +2 -2
  97. package/dist/{chunk-JNKHCGHR.js → chunk-Z5L4NQHC.js} +1 -1
  98. package/dist/{chunk-4GKQDFH6.js → chunk-ZVON5PCF.js} +5 -5
  99. package/dist/{global-upgrade-SKY7A3SI.js → global-upgrade-DZGLAARJ.js} +6 -6
  100. package/dist/{paths-XUUEK7OU.js → paths-JATF66FP.js} +2 -2
  101. package/dist/{reapply-WQDP26EA.js → reapply-7TDCFXNF.js} +20 -20
  102. package/dist/src/index.js +19 -19
  103. package/dist/{upgrade-lock-AYW3TB7X.js → upgrade-lock-LPIDFQEH.js} +3 -3
  104. package/package.json +1 -1
  105. package/dist/chunk-OYIN77HO.js +0 -72
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODEX_HOOK_STATUS
3
- } from "./chunk-RHIKMNWJ.js";
3
+ } from "./chunk-LHFK5F3T.js";
4
4
  import {
5
5
  NPX_LATEST_COMMAND
6
- } from "./chunk-LEQRIJ4H.js";
6
+ } from "./chunk-QDKNLNCA.js";
7
7
 
8
8
  // src/setup/codex-trust.ts
9
9
  var CODEX_TRUST_TELEMETRY = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-QIODXPTP.js";
3
+ } from "./chunk-NQICO3ES.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-OH647UT3.js";
16
+ } from "./chunk-GM2IFDVF.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -6,12 +6,12 @@ import {
6
6
  permissionDeniedAction,
7
7
  releaseThrottle,
8
8
  reportEvent
9
- } from "./chunk-GYP6DLA4.js";
9
+ } from "./chunk-KT5BH6GC.js";
10
10
  import {
11
11
  machineDecisionFor,
12
12
  shouldDeferToNativeMode,
13
13
  wireVerdictFor
14
- } from "./chunk-OH647UT3.js";
14
+ } from "./chunk-GM2IFDVF.js";
15
15
 
16
16
  // src/machine-decision-audit.ts
17
17
  import { basename } from "path";
@@ -4,10 +4,10 @@ import {
4
4
  keyPrefix,
5
5
  readConfigFileKey,
6
6
  readMacAppKeyPrefix
7
- } from "./chunk-AQ3TSQA2.js";
7
+ } from "./chunk-U23XTMBF.js";
8
8
  import {
9
9
  NPX_LATEST_COMMAND
10
- } from "./chunk-LEQRIJ4H.js";
10
+ } from "./chunk-QDKNLNCA.js";
11
11
 
12
12
  // src/key-signed-out.ts
13
13
  var VERDICT_BY_CHECK = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-GYP6DLA4.js";
3
+ } from "./chunk-KT5BH6GC.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -2,25 +2,25 @@ import {
2
2
  SIGNED_OUT_ON_MAC_MESSAGE,
3
3
  describeSignedOutKey,
4
4
  readSignedOutDiagnosis
5
- } from "./chunk-SLBO7PHS.js";
5
+ } from "./chunk-CYGIJXAP.js";
6
6
  import {
7
7
  createIo
8
8
  } from "./chunk-FO3MDD26.js";
9
9
  import {
10
10
  readKeySource
11
- } from "./chunk-AQ3TSQA2.js";
11
+ } from "./chunk-U23XTMBF.js";
12
12
  import {
13
13
  absoluteUrl,
14
14
  checkApiKey,
15
15
  describeKeyCheck,
16
16
  keyCheckFromResponse
17
- } from "./chunk-Z4UDB7EC.js";
17
+ } from "./chunk-H2RD5EMR.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
21
21
  import {
22
22
  getBaseUrl
23
- } from "./chunk-OQPEHKH2.js";
23
+ } from "./chunk-OY6NJWDD.js";
24
24
 
25
25
  // src/cli/report-key.ts
26
26
  var { dim, yellow } = createIo();
@@ -4,7 +4,7 @@ import {
4
4
  forkFinishWithUpgradeLock,
5
5
  installWithUpgradeLock,
6
6
  releaseAutoUpdateLock
7
- } from "./chunk-JCEUDLGW.js";
7
+ } from "./chunk-WYLA6J43.js";
8
8
  import {
9
9
  describeAutoUpdateCheck,
10
10
  globalInstallLocation,
@@ -14,7 +14,7 @@ import {
14
14
  readAutoUpdateState,
15
15
  updateAutoUpdateState,
16
16
  upgradeEntryFor
17
- } from "./chunk-USUI4P63.js";
17
+ } from "./chunk-XQROISQB.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -27,10 +27,10 @@ import {
27
27
  npmErrorMessage,
28
28
  readGlobalCliInstallAt,
29
29
  readGlobalPrefix
30
- } from "./chunk-QIODXPTP.js";
30
+ } from "./chunk-NQICO3ES.js";
31
31
  import {
32
32
  NPX_LATEST_COMMAND
33
- } from "./chunk-LEQRIJ4H.js";
33
+ } from "./chunk-QDKNLNCA.js";
34
34
  import {
35
35
  commandsPackage,
36
36
  globalUpgradeEntry,
@@ -39,7 +39,7 @@ import {
39
39
  isSameMajorVersion,
40
40
  ownPackageRoot,
41
41
  packageVersionAt
42
- } from "./chunk-OH647UT3.js";
42
+ } from "./chunk-GM2IFDVF.js";
43
43
 
44
44
  // src/global-upgrade.ts
45
45
  import { existsSync } from "fs";
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  defersToNativeMode,
3
3
  reportMachineDenial
4
- } from "./chunk-FBV2KS3Z.js";
4
+ } from "./chunk-CLVU24OZ.js";
5
5
  import {
6
6
  isGatingMoment,
7
7
  recordKeylessMoment
8
- } from "./chunk-GN6BJXC7.js";
8
+ } from "./chunk-GBD6G4TA.js";
9
9
  import {
10
10
  announceSubscriptionRequired,
11
11
  isDeferAnswer,
12
12
  oncePerSession
13
- } from "./chunk-M7DCI44L.js";
13
+ } from "./chunk-E4B7TXVS.js";
14
14
  import {
15
15
  activeHookSource,
16
16
  activeIdentity
17
- } from "./chunk-K2EYK5RL.js";
17
+ } from "./chunk-LOERK6N3.js";
18
18
  import {
19
19
  DEFAULT_SESSION,
20
20
  UNNAMED_ACTION,
@@ -39,7 +39,7 @@ import {
39
39
  reportEvent,
40
40
  scopePathFor,
41
41
  settleQuestionsForToolUse
42
- } from "./chunk-GYP6DLA4.js";
42
+ } from "./chunk-KT5BH6GC.js";
43
43
  import {
44
44
  askUser,
45
45
  cancelQuestion,
@@ -51,20 +51,20 @@ import {
51
51
  sendNotification,
52
52
  waitForQuestion,
53
53
  waitsForThePhone
54
- } from "./chunk-4GKQDFH6.js";
54
+ } from "./chunk-ZVON5PCF.js";
55
55
  import {
56
56
  SubscriptionRequiredError
57
- } from "./chunk-E2LGKG75.js";
57
+ } from "./chunk-RK7TDMQT.js";
58
58
  import {
59
59
  getMachineId
60
- } from "./chunk-EDN4F6GX.js";
60
+ } from "./chunk-IS737HST.js";
61
61
  import {
62
62
  getApiKey,
63
63
  getBaseUrl
64
- } from "./chunk-OQPEHKH2.js";
64
+ } from "./chunk-OY6NJWDD.js";
65
65
  import {
66
66
  NPX_LATEST_COMMAND
67
- } from "./chunk-LEQRIJ4H.js";
67
+ } from "./chunk-QDKNLNCA.js";
68
68
  import {
69
69
  AGENT_QUESTION_STRATEGY,
70
70
  DECISION_STOP_REASON,
@@ -104,8 +104,9 @@ import {
104
104
  parseAgentQuestionAnswers,
105
105
  parseAgentQuestions,
106
106
  questionHandedToTheTerminal,
107
- resolveGate
108
- } from "./chunk-OH647UT3.js";
107
+ resolveGate,
108
+ timeoutActionWithoutLocalPrompt
109
+ } from "./chunk-GM2IFDVF.js";
109
110
 
110
111
  // src/claude-permission-rules.ts
111
112
  import { readFileSync, statSync } from "fs";
@@ -345,7 +346,7 @@ var dispatchModeHandler = async (apiKey, input, toolPolicy, machineId, trainingC
345
346
  const runHandler = () => {
346
347
  switch (ownPrompt ? toolPolicy.mode : approvalModeWithoutLocalPrompt(toolPolicy.mode)) {
347
348
  case "push_only":
348
- return handlePushOnly(apiKey, description, projectName, toolPolicy.timeoutSeconds, toolPolicy.timeoutAction, sessionId, machineId, input.tool_name, toolTarget, decision, signals);
349
+ return handlePushOnly(apiKey, description, projectName, toolPolicy.timeoutSeconds, ownPrompt ? toolPolicy.timeoutAction : timeoutActionWithoutLocalPrompt(toolPolicy), sessionId, machineId, input.tool_name, toolTarget, decision, signals);
349
350
  case "terminal_only":
350
351
  return Promise.resolve(handleTerminalOnly());
351
352
  case "push_first":
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-OH647UT3.js";
3
+ } from "./chunk-GM2IFDVF.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -913,6 +913,8 @@ var approvalModeWithoutLocalPrompt = (mode) => {
913
913
  return mode;
914
914
  }
915
915
  };
916
+ var TIMEOUT_ACTION_THAT_REFUSES = "deny";
917
+ var timeoutActionWithoutLocalPrompt = ({ mode, timeoutAction }) => mode !== "push_only" && timeoutAction === "approve" ? TIMEOUT_ACTION_THAT_REFUSES : timeoutAction;
916
918
  var MAX_AGENT_QUESTIONS = 4;
917
919
  var parseAgentQuestion = (raw) => {
918
920
  const q = raw;
@@ -1908,7 +1910,27 @@ var mcpToolNameNeedsAPerson = (toolName) => {
1908
1910
  const phrase = words.join(" ");
1909
1911
  return words.some(mcpToolWordNeedsAPerson) || classifyDecisionRisk(phrase, phrase) !== "standard";
1910
1912
  };
1911
- var allowsSessionToolGrant = (toolName) => SESSION_TOOL_GRANT_TOOLS.has(toolName) || parseMcpToolName(toolName) !== void 0 && !isPusharyOwnTool(toolName.toLowerCase()) && !mcpToolNameNeedsAPerson(toolName);
1913
+ var MCP_TOOL_VERBS_THAT_ONLY_READ = /* @__PURE__ */ new Set([
1914
+ "get",
1915
+ "list",
1916
+ "search",
1917
+ "read",
1918
+ "fetch",
1919
+ "find",
1920
+ "view",
1921
+ "show",
1922
+ "describe",
1923
+ "lookup",
1924
+ "retrieve",
1925
+ "inspect",
1926
+ "browse",
1927
+ "count"
1928
+ ]);
1929
+ var mcpToolLeadsWithAReadVerb = (toolName) => {
1930
+ const tool = parseMcpToolName(toolName)?.tool;
1931
+ return tool !== void 0 && MCP_TOOL_VERBS_THAT_ONLY_READ.has(wordsOfMcpToolName(tool)[0] ?? "");
1932
+ };
1933
+ var allowsSessionToolGrant = (toolName) => SESSION_TOOL_GRANT_TOOLS.has(toolName) || mcpToolLeadsWithAReadVerb(toolName) && !isPusharyOwnTool(toolName.toLowerCase()) && !mcpToolNameNeedsAPerson(toolName);
1912
1934
  var isSessionToolGrant = (policy) => Boolean(policy.sessionId) && allowsSessionToolGrant(policy.tool) && isAutoApprove(policy);
1913
1935
  var API_KEY_PREFIX_SHAPE = "pk_[a-f0-9]+";
1914
1936
  var API_KEY_PREFIX_PATTERN = new RegExp(`^${API_KEY_PREFIX_SHAPE}$`);
@@ -3200,6 +3222,7 @@ export {
3200
3222
  normalizeKeyScope,
3201
3223
  isApprovalMode,
3202
3224
  approvalModeWithoutLocalPrompt,
3225
+ timeoutActionWithoutLocalPrompt,
3203
3226
  parseAgentQuestion,
3204
3227
  parseAgentQuestions,
3205
3228
  parseAgentQuestionAnswers,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-OQPEHKH2.js";
3
+ } from "./chunk-OY6NJWDD.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-OH647UT3.js";
6
+ } from "./chunk-GM2IFDVF.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-XBETSM5T.js";
3
+ } from "./chunk-2E6AWHV7.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-OQPEHKH2.js";
12
+ } from "./chunk-OY6NJWDD.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-OH647UT3.js";
16
+ } from "./chunk-GM2IFDVF.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;
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-XHKBHWLX.js";
5
5
  import {
6
6
  readControlMode
7
- } from "./chunk-AQ3TSQA2.js";
7
+ } from "./chunk-U23XTMBF.js";
8
8
  import {
9
9
  getMachineId
10
- } from "./chunk-EDN4F6GX.js";
10
+ } from "./chunk-IS737HST.js";
11
11
  import {
12
12
  pusharyDir,
13
13
  resolveGlobalBinary
14
- } from "./chunk-QIODXPTP.js";
14
+ } from "./chunk-NQICO3ES.js";
15
15
  import {
16
16
  readJsonSafe,
17
17
  writeFileAtomic,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-AQFEP65J.js";
21
21
  import {
22
22
  getApiKey
23
- } from "./chunk-OQPEHKH2.js";
23
+ } from "./chunk-OY6NJWDD.js";
24
24
  import {
25
25
  CLI_PACKAGE_NAMES,
26
26
  cmdShimTarget,
@@ -28,7 +28,7 @@ import {
28
28
  globalPackageFolder,
29
29
  globalRootFor,
30
30
  isRecord
31
- } from "./chunk-OH647UT3.js";
31
+ } from "./chunk-GM2IFDVF.js";
32
32
 
33
33
  // src/daemon-lifecycle.ts
34
34
  import { dirname, join, win32 as win32Path } from "path";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-K2EYK5RL.js";
4
+ } from "./chunk-LOERK6N3.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-A5U62Q6K.js";
7
+ } from "./chunk-OSOCONIE.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-QIODXPTP.js";
11
+ } from "./chunk-NQICO3ES.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-OH647UT3.js";
14
+ } from "./chunk-GM2IFDVF.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-RHIKMNWJ.js";
3
+ } from "./chunk-LHFK5F3T.js";
4
4
  import {
5
5
  detectClaudeVersion
6
6
  } from "./chunk-RIVNNBEK.js";
@@ -12,12 +12,12 @@ import {
12
12
  openCodeHookArgv,
13
13
  openCodePluginDir,
14
14
  openCodeWired
15
- } from "./chunk-ZGYO6OQE.js";
15
+ } from "./chunk-O3RRQTTV.js";
16
16
  import {
17
17
  addClaudeMcpServer,
18
18
  addPusharyHooks,
19
19
  addPusharyToolPermissions
20
- } from "./chunk-K2EYK5RL.js";
20
+ } from "./chunk-LOERK6N3.js";
21
21
  import {
22
22
  claudeUnprovenHolds,
23
23
  claudeWired,
@@ -25,7 +25,7 @@ import {
25
25
  codexWired,
26
26
  geminiWired,
27
27
  planHooks
28
- } from "./chunk-A5U62Q6K.js";
28
+ } from "./chunk-OSOCONIE.js";
29
29
  import {
30
30
  CLAUDE_HOOK_BINARY,
31
31
  CLAUDE_HOOK_EVENTS,
@@ -36,7 +36,7 @@ import {
36
36
  needsReregistration,
37
37
  registrationSignatures,
38
38
  supportedClaudeEvents
39
- } from "./chunk-7RGEJOQS.js";
39
+ } from "./chunk-VFIZFKZY.js";
40
40
  import {
41
41
  formatVersion
42
42
  } from "./chunk-6ICPEJY5.js";
@@ -59,7 +59,7 @@ import {
59
59
  registrationHolderOf,
60
60
  resolveGlobalBinary,
61
61
  vscodePluginMcp
62
- } from "./chunk-QIODXPTP.js";
62
+ } from "./chunk-NQICO3ES.js";
63
63
  import {
64
64
  readJsonSafe,
65
65
  writeFileAtomic,
@@ -67,7 +67,7 @@ import {
67
67
  } from "./chunk-AQFEP65J.js";
68
68
  import {
69
69
  isRecord
70
- } from "./chunk-OH647UT3.js";
70
+ } from "./chunk-GM2IFDVF.js";
71
71
 
72
72
  // src/reapply.ts
73
73
  import { dirname, join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-QIODXPTP.js";
3
+ } from "./chunk-NQICO3ES.js";
4
4
  import {
5
5
  writeFileAtomic
6
6
  } from "./chunk-AQFEP65J.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-AQ3TSQA2.js";
3
+ } from "./chunk-U23XTMBF.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -2,7 +2,7 @@ import {
2
2
  IDLE_PROMPT_NOTIFICATION,
3
3
  NOTIFICATION_PUSH_TYPES,
4
4
  POSTTOOLUSE_MIRROR_ONLY_TOOLS
5
- } from "./chunk-KJA6IGOZ.js";
5
+ } from "./chunk-RFK2WN6S.js";
6
6
  import {
7
7
  cancelQuestion,
8
8
  clientErrorKindOf,
@@ -10,26 +10,26 @@ import {
10
10
  reportClientError,
11
11
  sendNotification,
12
12
  waitForAnswer
13
- } from "./chunk-4GKQDFH6.js";
13
+ } from "./chunk-ZVON5PCF.js";
14
14
  import {
15
15
  withRetry
16
- } from "./chunk-E2LGKG75.js";
16
+ } from "./chunk-RK7TDMQT.js";
17
17
  import {
18
18
  getMachineId
19
- } from "./chunk-EDN4F6GX.js";
19
+ } from "./chunk-IS737HST.js";
20
20
  import {
21
21
  reportedInstallSource
22
- } from "./chunk-6HT2TUZD.js";
22
+ } from "./chunk-GXQVOKHJ.js";
23
23
  import {
24
24
  canonicalJson
25
- } from "./chunk-QIODXPTP.js";
25
+ } from "./chunk-NQICO3ES.js";
26
26
  import {
27
27
  writeFileAtomic
28
28
  } from "./chunk-AQFEP65J.js";
29
29
  import {
30
30
  getApiKey,
31
31
  getBaseUrl
32
- } from "./chunk-OQPEHKH2.js";
32
+ } from "./chunk-OY6NJWDD.js";
33
33
  import {
34
34
  ACTION_BODY_MAX,
35
35
  AGENT_LABELS_BY_TYPE,
@@ -60,7 +60,7 @@ import {
60
60
  resolvePolicy,
61
61
  toToolLookup,
62
62
  truncateLine
63
- } from "./chunk-OH647UT3.js";
63
+ } from "./chunk-GM2IFDVF.js";
64
64
 
65
65
  // ../hook-mapping/src/describe.ts
66
66
  import { isAbsolute, relative, resolve } from "path";
@@ -10,10 +10,10 @@ import {
10
10
  resolvePackageVersionFromBinary,
11
11
  resolvePathBinary,
12
12
  resolvePathBinaryAsync
13
- } from "./chunk-QIODXPTP.js";
13
+ } from "./chunk-NQICO3ES.js";
14
14
  import {
15
15
  MANAGED_PROVIDERS
16
- } from "./chunk-OH647UT3.js";
16
+ } from "./chunk-GM2IFDVF.js";
17
17
 
18
18
  // src/setup/codex-install.ts
19
19
  var NATIVE_BINARY_MIN_BYTES = 20 * 1024 * 1024;
@@ -0,0 +1,166 @@
1
+ import {
2
+ APPROVAL_SETTINGS_PATH
3
+ } from "./chunk-EE357RIP.js";
4
+ import {
5
+ readMacAppAgentKey
6
+ } from "./chunk-2JTJZ7VI.js";
7
+ import {
8
+ findExportedKeyLines,
9
+ isAdoptedMacAppKey,
10
+ isCliCreatedKey,
11
+ keyPrefix,
12
+ readCliCreatedKeyPrefix,
13
+ readConfigFileKey,
14
+ readKeySource,
15
+ readMacAppKeyPrefix
16
+ } from "./chunk-U23XTMBF.js";
17
+ import {
18
+ absoluteUrl
19
+ } from "./chunk-H2RD5EMR.js";
20
+ import {
21
+ isValidApiKey
22
+ } from "./chunk-GM2IFDVF.js";
23
+
24
+ // src/key-revocation.ts
25
+ var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";
26
+ var DEVICE_KEY_PATH = "/api/agent/device-key";
27
+ var FULL_ACCESS_ONLY_STATUS = 403;
28
+ var REVOKE_TIMEOUT_MS = 1e4;
29
+ var readRevokedCount = async (response) => {
30
+ try {
31
+ const body = await response.json();
32
+ const revoked = typeof body === "object" && body !== null && "revoked" in body ? body.revoked : void 0;
33
+ return typeof revoked === "number" && Number.isInteger(revoked) && revoked >= 0 ? revoked : null;
34
+ } catch {
35
+ return null;
36
+ }
37
+ };
38
+ var revokeAgentKey = async (apiKey, baseUrl, fetchImpl) => {
39
+ const response = await fetchImpl(`${baseUrl}${DEVICE_KEY_PATH}`, {
40
+ method: "DELETE",
41
+ headers: { Authorization: `Bearer ${apiKey}` },
42
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
43
+ });
44
+ if (!response.ok) return { kind: "refused", status: response.status };
45
+ const revoked = await readRevokedCount(response);
46
+ if (revoked === null) return { kind: "unconfirmed", status: response.status };
47
+ return revoked > 0 ? { kind: "revoked" } : { kind: "not_accepted" };
48
+ };
49
+ var revokeOwnKey = async (apiKey, baseUrl, fetchImpl = fetch) => {
50
+ try {
51
+ const response = await fetchImpl(`${baseUrl}${SELF_REVOKE_PATH}`, {
52
+ method: "POST",
53
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
54
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
55
+ });
56
+ if (response.status === 401) return { kind: "not_accepted" };
57
+ if (response.status === FULL_ACCESS_ONLY_STATUS) return await revokeAgentKey(apiKey, baseUrl, fetchImpl);
58
+ if (!response.ok) return { kind: "refused", status: response.status };
59
+ return { kind: "revoked" };
60
+ } catch (err) {
61
+ return { kind: "unreachable", detail: err instanceof Error ? err.message : "network error" };
62
+ }
63
+ };
64
+ var REVOKE_DETAIL = {
65
+ revoked: "Revoked the key on pushary.com.",
66
+ not_accepted: "pushary.com had already stopped accepting the key.",
67
+ refused: "pushary.com refused to revoke the key",
68
+ unconfirmed: "pushary.com did not confirm the key was revoked",
69
+ unreachable: "Could not reach pushary.com to revoke the key"
70
+ };
71
+ var describeRevokeAttempt = (attempt) => {
72
+ if (attempt.kind === "refused" || attempt.kind === "unconfirmed") return `${REVOKE_DETAIL[attempt.kind]} (HTTP ${attempt.status}).`;
73
+ if (attempt.kind === "unreachable") return `${REVOKE_DETAIL.unreachable}: ${attempt.detail}`;
74
+ return REVOKE_DETAIL[attempt.kind];
75
+ };
76
+ var keyNoLongerAccepted = (attempt) => attempt.kind === "revoked" || attempt.kind === "not_accepted";
77
+ var keyValidityOf = (check) => {
78
+ switch (check.kind) {
79
+ case "ok":
80
+ case "locked":
81
+ return "valid";
82
+ case "rejected":
83
+ case "malformed":
84
+ return "invalid";
85
+ case "unreachable":
86
+ return "unknown";
87
+ }
88
+ };
89
+
90
+ // src/cli/held-key-revocation.ts
91
+ var readCliHeldKeys = (profiles) => {
92
+ const source = readKeySource();
93
+ return {
94
+ configKey: readConfigFileKey(),
95
+ profileKeys: findExportedKeyLines(profiles).map((line) => line.key),
96
+ envKey: source.kind === "env" ? source.key : null,
97
+ macAppKey: readMacAppAgentKey(),
98
+ macAppKeyPrefix: readMacAppKeyPrefix(),
99
+ cliCreatedKeyPrefix: readCliCreatedKeyPrefix()
100
+ };
101
+ };
102
+ var isMacAppCurrentOrAdoptedKey = (key, keys) => key === keys.macAppKey || isAdoptedMacAppKey(key, keys.macAppKeyPrefix);
103
+ var revocationOfStoredKey = (key, keys) => {
104
+ if (isMacAppCurrentOrAdoptedKey(key, keys)) return { kind: "mac_app_key", keyPrefix: keyPrefix(key) };
105
+ if (!isCliCreatedKey(key, keys.cliCreatedKeyPrefix)) return { kind: "no_creation_record", keyPrefix: keyPrefix(key) };
106
+ return { kind: "revoke", key };
107
+ };
108
+ var validKeys = (keys) => [...new Set(keys)].filter((key) => key !== null && isValidApiKey(key));
109
+ var environmentOnlyKey = (keys, stored) => validKeys([keys.envKey]).filter((key) => !stored.includes(key)).map((key) => ({ kind: "environment_only", keyPrefix: keyPrefix(key) }));
110
+ var planCliKeyRevocations = (keys) => {
111
+ const stored = validKeys([keys.configKey, ...keys.profileKeys]);
112
+ return [...stored.map((key) => revocationOfStoredKey(key, keys)), ...environmentOnlyKey(keys, stored)];
113
+ };
114
+ var keysToRevoke = (revocations) => revocations.flatMap((revocation) => revocation.kind === "revoke" ? [revocation.key] : []);
115
+ var sparedKeys = (revocations) => revocations.flatMap((revocation) => revocation.kind === "revoke" ? [] : [revocation]);
116
+ var runRevocation = async (revocation, run) => {
117
+ if (revocation.kind !== "revoke") return revocation;
118
+ if (run.dryRun) return { kind: "would_revoke", keyPrefix: keyPrefix(revocation.key) };
119
+ return { kind: "attempted", keyPrefix: keyPrefix(revocation.key), attempt: await revokeOwnKey(revocation.key, run.baseUrl) };
120
+ };
121
+ var revokeCliKeys = async (revocations, run) => {
122
+ const outcomes = [];
123
+ for (const revocation of revocations) outcomes.push(await runRevocation(revocation, run));
124
+ return outcomes;
125
+ };
126
+ var SPARED_KEY_WHY = {
127
+ mac_app_key: "It is the Pushary Mac app's key, and the app may still be using it.",
128
+ no_creation_record: "This CLI has no record of creating it, so it may be in use by the Mac app or on another machine."
129
+ };
130
+ var localRemovalOf = (dryRun) => dryRun ? "would be removed here" : "removed here";
131
+ var settingsUrlOf = (baseUrl) => absoluteUrl(baseUrl, APPROVAL_SETTINGS_PATH);
132
+ var revokeYourselfHint = (reason, baseUrl) => reason === "no_creation_record" ? `Revoke it at ${settingsUrlOf(baseUrl)} if nothing else uses it.` : null;
133
+ var describeCliKeyRevocation = (outcome, run) => {
134
+ const label = `API key ${outcome.keyPrefix}`;
135
+ switch (outcome.kind) {
136
+ case "would_revoke":
137
+ return { tone: "skipped", line: `${label} (would revoke it on pushary.com)`, next: null };
138
+ case "mac_app_key":
139
+ case "no_creation_record":
140
+ return {
141
+ tone: "skipped",
142
+ line: `${label}: ${localRemovalOf(run.dryRun)}, not revoked. ${SPARED_KEY_WHY[outcome.kind]}`,
143
+ next: revokeYourselfHint(outcome.kind, run.baseUrl)
144
+ };
145
+ case "environment_only":
146
+ return { tone: "skipped", line: `${label} in PUSHARY_API_KEY (left alone: Pushary did not write it)`, next: null };
147
+ case "attempted":
148
+ return keyNoLongerAccepted(outcome.attempt) ? { tone: "done", line: `${label}: ${describeRevokeAttempt(outcome.attempt)}`, next: null } : {
149
+ tone: "warning",
150
+ line: `${label}: ${describeRevokeAttempt(outcome.attempt)}`,
151
+ next: `It may still be valid. Revoke it at ${settingsUrlOf(run.baseUrl)}`
152
+ };
153
+ }
154
+ };
155
+
156
+ export {
157
+ revokeOwnKey,
158
+ keyNoLongerAccepted,
159
+ keyValidityOf,
160
+ readCliHeldKeys,
161
+ planCliKeyRevocations,
162
+ keysToRevoke,
163
+ sparedKeys,
164
+ revokeCliKeys,
165
+ describeCliKeyRevocation
166
+ };