@pushary/agent-hooks 1.9.147 → 1.9.149

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 (138) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/data/openclaw-plugin/package.json +8 -2
  3. package/dist/{api-2KDVLXHT.js → api-H7H75ARS.js} +11 -11
  4. package/dist/bin/pushary-audit.js +3 -3
  5. package/dist/bin/pushary-bell-hook.js +29 -30
  6. package/dist/bin/pushary-bell.js +10 -10
  7. package/dist/bin/pushary-claude.js +28 -29
  8. package/dist/bin/pushary-clean.js +36 -36
  9. package/dist/bin/pushary-codex-bridge.js +24 -24
  10. package/dist/bin/pushary-codex-hook.js +36 -37
  11. package/dist/bin/pushary-codex-session.js +8 -8
  12. package/dist/bin/pushary-codex.js +16 -16
  13. package/dist/bin/pushary-connect.js +32 -32
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +45 -46
  16. package/dist/bin/pushary-disconnect.js +28 -28
  17. package/dist/bin/pushary-doctor.js +44 -44
  18. package/dist/bin/pushary-elicitation-hook.js +29 -30
  19. package/dist/bin/pushary-gemini-bridge.js +18 -18
  20. package/dist/bin/pushary-gemini-hook.js +33 -34
  21. package/dist/bin/pushary-hook.js +36 -37
  22. package/dist/bin/pushary-login.js +21 -21
  23. package/dist/bin/pushary-logout.js +27 -27
  24. package/dist/bin/pushary-mcp.js +12 -12
  25. package/dist/bin/pushary-mode.js +15 -15
  26. package/dist/bin/pushary-notification-hook.js +28 -29
  27. package/dist/bin/pushary-opencode-hook.js +32 -33
  28. package/dist/bin/pushary-permission-denied-hook.js +36 -37
  29. package/dist/bin/pushary-permission-hook.js +36 -37
  30. package/dist/bin/pushary-post-hook.js +29 -30
  31. package/dist/bin/pushary-prompt-hook.js +28 -29
  32. package/dist/bin/pushary-session-end-hook.js +28 -29
  33. package/dist/bin/pushary-session-start-hook.js +38 -39
  34. package/dist/bin/pushary-setup.js +58 -74
  35. package/dist/bin/pushary-stats.js +5 -5
  36. package/dist/bin/pushary-status.js +33 -33
  37. package/dist/bin/pushary-stop-hook.js +28 -29
  38. package/dist/bin/pushary-stopfailure-hook.js +28 -29
  39. package/dist/bin/pushary-suggestions.js +15 -15
  40. package/dist/bin/pushary-transcript-register.js +19 -20
  41. package/dist/bin/pushary-transcripts.js +35 -36
  42. package/dist/bin/pushary-upgrade.js +42 -42
  43. package/dist/bin/pushary-wait.js +15 -15
  44. package/dist/bin/pushary.js +7 -7
  45. package/dist/{chunk-I72UU75H.js → chunk-26TXJ35O.js} +16 -16
  46. package/dist/{chunk-NAGF5ZJ2.js → chunk-2CVRVHUQ.js} +8 -8
  47. package/dist/{chunk-EV54ZQ5J.js → chunk-2VPRLAKF.js} +4 -4
  48. package/dist/{chunk-XMSDA5WA.js → chunk-352FIVVH.js} +41 -1
  49. package/dist/{chunk-57GVGSOQ.js → chunk-35IODIBL.js} +17 -2
  50. package/dist/{chunk-MI7GHNTO.js → chunk-3AAQJ75F.js} +5 -5
  51. package/dist/{chunk-RZGR4G5G.js → chunk-3OPXQK4D.js} +5 -5
  52. package/dist/{chunk-5II3USXS.js → chunk-3T7RA7WJ.js} +2 -2
  53. package/dist/{chunk-KH27X5CW.js → chunk-3WD3BEPB.js} +2 -2
  54. package/dist/{chunk-BU2J4P7P.js → chunk-43NHQUCY.js} +24 -3
  55. package/dist/{chunk-UGPNLU4O.js → chunk-4L2IYNLC.js} +1 -1
  56. package/dist/{chunk-A5MSVNFS.js → chunk-5HAA7C4X.js} +68 -186
  57. package/dist/{chunk-6EPTMB7L.js → chunk-5IG3VPHT.js} +4 -4
  58. package/dist/{chunk-T3TVMMXJ.js → chunk-6HO36P3A.js} +1 -1
  59. package/dist/{chunk-4P3ML7HP.js → chunk-6RYJ3XCD.js} +5 -5
  60. package/dist/{chunk-WLKW2TF7.js → chunk-6YX3VB5P.js} +6 -6
  61. package/dist/{chunk-GGCUXNZN.js → chunk-A3URJPYH.js} +1 -1
  62. package/dist/{chunk-CSNG5NQR.js → chunk-ABTQG6XU.js} +1 -1
  63. package/dist/{chunk-GJV5RVUU.js → chunk-AQ7L2E2U.js} +2 -2
  64. package/dist/{chunk-Q6POCQOV.js → chunk-BP5HLKR6.js} +12 -12
  65. package/dist/{chunk-3TTXOU6G.js → chunk-CABBLJD5.js} +3 -3
  66. package/dist/{chunk-NMUEUDTT.js → chunk-CAHULQIO.js} +1 -1
  67. package/dist/{chunk-GPAMD5JG.js → chunk-CBIS7IYQ.js} +5 -5
  68. package/dist/{chunk-2G54YLN3.js → chunk-CDQOARIF.js} +3 -3
  69. package/dist/{chunk-ISM6XF3V.js → chunk-CIRTRWHM.js} +4 -4
  70. package/dist/{chunk-TZ7CBPCD.js → chunk-CMTDMZPV.js} +2 -2
  71. package/dist/{chunk-XQOBM3E6.js → chunk-CU5SYUMK.js} +3 -6
  72. package/dist/{chunk-7WDEJTNX.js → chunk-D3QT4S7U.js} +4 -4
  73. package/dist/{chunk-FKGWP4MF.js → chunk-DHCJDYBT.js} +6 -6
  74. package/dist/{chunk-RZJHCHEA.js → chunk-DLPI45DF.js} +6 -6
  75. package/dist/{chunk-T274HRSR.js → chunk-ENRL4WFD.js} +4 -4
  76. package/dist/{chunk-KFL7OWLI.js → chunk-F6ESGEWU.js} +2 -2
  77. package/dist/{chunk-BYVLAPCF.js → chunk-FQLS37AX.js} +1 -1
  78. package/dist/{chunk-6YVGY2ZX.js → chunk-H6FFNTSR.js} +6 -6
  79. package/dist/{chunk-BHGSNYG5.js → chunk-HEOBF5H6.js} +3 -3
  80. package/dist/{chunk-OSYULPJO.js → chunk-JSZ6LKX5.js} +11 -11
  81. package/dist/{chunk-2RAIG6NF.js → chunk-JUEQUYAT.js} +2 -2
  82. package/dist/{chunk-QGKFDSEO.js → chunk-KP6ERYOA.js} +8 -8
  83. package/dist/{chunk-L2M6D2N4.js → chunk-KWJJYZ3T.js} +4 -4
  84. package/dist/{chunk-FWCECQTY.js → chunk-KXNAB76Z.js} +16 -5
  85. package/dist/{chunk-YOVJOHM5.js → chunk-LC53HRZ6.js} +1 -1
  86. package/dist/{chunk-KDJIDRJS.js → chunk-M7HJZ7HO.js} +3 -3
  87. package/dist/{chunk-7P32YU2M.js → chunk-MT4GBXLM.js} +5 -5
  88. package/dist/{chunk-2QY2BD4T.js → chunk-MUSINFEU.js} +5 -5
  89. package/dist/{chunk-526XSNMS.js → chunk-MUTMXSQZ.js} +131 -5
  90. package/dist/{chunk-2YNAQ5TX.js → chunk-NHZV2H63.js} +1 -1
  91. package/dist/{chunk-5K65H6OO.js → chunk-NLED3JGR.js} +1 -1
  92. package/dist/{chunk-UR55VBLY.js → chunk-NRPQUU3D.js} +2 -2
  93. package/dist/{chunk-6JBX55K4.js → chunk-O5ARO3JM.js} +2 -2
  94. package/dist/{chunk-S4HS6VTI.js → chunk-OJUW7QW2.js} +2 -4
  95. package/dist/{chunk-7TVSWGAV.js → chunk-PH3MVQCQ.js} +17 -9
  96. package/dist/{chunk-FMAIUTVU.js → chunk-PUTX5BBE.js} +7 -4
  97. package/dist/{chunk-2I6A34GJ.js → chunk-PVBDITRS.js} +5 -5
  98. package/dist/{chunk-FHBJJOMF.js → chunk-Q7GZKNMH.js} +1 -1
  99. package/dist/{chunk-72S6PF2I.js → chunk-QSZYHL7Z.js} +2 -2
  100. package/dist/{chunk-L6BTSIKF.js → chunk-QTQRQZIU.js} +4 -4
  101. package/dist/{chunk-OXDKZYBO.js → chunk-R2JRRCZK.js} +1 -1
  102. package/dist/{chunk-2EETRVCZ.js → chunk-RMBY7JGO.js} +1 -1
  103. package/dist/{chunk-P6W2V2AP.js → chunk-RWTH5RYA.js} +2 -2
  104. package/dist/{chunk-T2CR5REM.js → chunk-RYDDLS62.js} +3 -3
  105. package/dist/{chunk-ISOP4ENY.js → chunk-S3MEI2D2.js} +5 -5
  106. package/dist/{chunk-BEDAQAEN.js → chunk-T3CMGGNW.js} +1 -1
  107. package/dist/{chunk-Q767Y4LY.js → chunk-T4PX3DRF.js} +1 -1
  108. package/dist/{chunk-JDIKCM2N.js → chunk-TXXAQRX4.js} +3 -1
  109. package/dist/{chunk-LO52V6WG.js → chunk-UAHBSOO4.js} +2 -2
  110. package/dist/{chunk-37ZBJB2Q.js → chunk-UJUGFLVF.js} +5 -5
  111. package/dist/{chunk-3NMX4725.js → chunk-VPADWVYD.js} +1 -1
  112. package/dist/{chunk-Q3JW44JV.js → chunk-WQEJCDMR.js} +2 -2
  113. package/dist/{chunk-D7ZWJYXB.js → chunk-WQJ5NJ35.js} +1 -1
  114. package/dist/{chunk-WNV3X2VU.js → chunk-X4OEGFOG.js} +3 -3
  115. package/dist/{chunk-YICO6HEW.js → chunk-X4OQ5UMH.js} +5 -5
  116. package/dist/{chunk-KXMIDDUN.js → chunk-XSBW6TUH.js} +2 -2
  117. package/dist/{chunk-GIWI5IHB.js → chunk-XZGQZDFP.js} +6 -6
  118. package/dist/{chunk-7XIJD7NL.js → chunk-YTD7RV6F.js} +3 -3
  119. package/dist/{chunk-ZKAQWXGO.js → chunk-YWSIN7IH.js} +1 -1
  120. package/dist/{chunk-MYJJNLT2.js → chunk-ZCB5SCYM.js} +2 -2
  121. package/dist/{chunk-6C5QRJIH.js → chunk-ZIPPDZ5B.js} +5 -5
  122. package/dist/{chunk-ANLR5G2W.js → chunk-ZOATPL53.js} +4 -4
  123. package/dist/{chunk-ELRZO6A7.js → chunk-ZX2O66NS.js} +3 -3
  124. package/dist/{codex-app-cards-switch-GN65VEKM.js → codex-app-cards-switch-BCM547E6.js} +11 -11
  125. package/dist/{codex-card-routing-JTS75442.js → codex-card-routing-222EKZJR.js} +2 -2
  126. package/dist/{codex-desktop-launch-AQ2HSOQJ.js → codex-desktop-launch-6AFOLMZ7.js} +1 -1
  127. package/dist/{codex-session-launch-QYZZGVSQ.js → codex-session-launch-73EQE6IL.js} +21 -21
  128. package/dist/{config-5ATI6KPI.js → config-GWNPGS47.js} +3 -3
  129. package/dist/{global-upgrade-K4HWVUMI.js → global-upgrade-VRF6OSSU.js} +9 -9
  130. package/dist/{identity-V2GZCPJV.js → identity-PQIM7R2N.js} +4 -4
  131. package/dist/{live-capabilities-PD62FO4K.js → live-capabilities-G3LMKZUB.js} +4 -4
  132. package/dist/{paths-WPJEIHUE.js → paths-TFGIP5PU.js} +3 -3
  133. package/dist/{reapply-ZEWMGDXT.js → reapply-3IRAI6JF.js} +30 -30
  134. package/dist/src/index.js +35 -36
  135. package/dist/{upgrade-lock-7OR6V323.js → upgrade-lock-2G7ANYYO.js} +6 -4
  136. package/dist/{usage-GWZ3UGZG.js → usage-K3EGYCSU.js} +3 -3
  137. package/package.json +1 -1
  138. package/dist/chunk-VAE5JBR5.js +0 -46
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  autoUpdateLock
3
- } from "./chunk-GJV5RVUU.js";
3
+ } from "./chunk-AQ7L2E2U.js";
4
4
  import {
5
5
  installPackageGlobally,
6
6
  npmErrorMessage,
7
+ npmExitedBeforeInstalling,
7
8
  npmExitedOnPermissionDenied
8
- } from "./chunk-BU2J4P7P.js";
9
+ } from "./chunk-43NHQUCY.js";
9
10
  import {
10
11
  writeJsonAtomic
11
12
  } from "./chunk-TODDEIYG.js";
@@ -13,7 +14,7 @@ import {
13
14
  // src/upgrade-lock.ts
14
15
  import { fork } from "child_process";
15
16
  import { createHash } from "crypto";
16
- import { existsSync, mkdirSync, readFileSync, realpathSync, unlinkSync } from "fs";
17
+ import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, unlinkSync } from "fs";
17
18
  import { createServer, Server } from "net";
18
19
  import { basename, dirname, join } from "path";
19
20
  var LOCK_HOST = "127.0.0.1";
@@ -26,6 +27,15 @@ var HANDOFF_TIMEOUT_MS = 1e4;
26
27
  var FINISH_TIMEOUT_MS = 5 * 60 * 1e3;
27
28
  var KERNEL_LOCK_FORMAT = "kernel-v1";
28
29
  var heldLocks = /* @__PURE__ */ new Map();
30
+ var PENDING_INSTALL_STALE_AFTER_MS = 15 * 6e4;
31
+ var lockRecordAgeMs = (path, nowMs) => {
32
+ try {
33
+ return nowMs - statSync(path).mtimeMs;
34
+ } catch {
35
+ return null;
36
+ }
37
+ };
38
+ var pendingInstallWasAbandoned = (holderPid, ageMs, isAlive) => holderPid !== void 0 && ageMs !== null && ageMs > PENDING_INSTALL_STALE_AFTER_MS && !isAlive(holderPid);
29
39
  var canonicalLockPath = (path) => {
30
40
  mkdirSync(dirname(path), { recursive: true });
31
41
  return join(realpathSync(dirname(path)), basename(path));
@@ -98,7 +108,7 @@ var claimUpgradeLock = async (request = {}) => {
98
108
  listener.listen({ host: LOCK_HOST, port: lockPort(path), exclusive: true }, resolve);
99
109
  });
100
110
  const record = readLockRecord(path);
101
- if (record.installationPending) {
111
+ if (record.installationPending && !pendingInstallWasAbandoned(record.pid, lockRecordAgeMs(path, (request.now ?? Date.now)()), request.isAlive ?? isProcessAlive)) {
102
112
  server.close();
103
113
  return { kind: "unavailable", reason: `An earlier installation did not finish safely. Stop its npm processes (or restart the computer), then remove ${path} and retry the upgrade.` };
104
114
  }
@@ -170,13 +180,14 @@ var installWithUpgradeLock = (request, lockPath = autoUpdateLock(), runNpm) => {
170
180
  try {
171
181
  installPackageGlobally(request, runNpm);
172
182
  } catch (error) {
173
- if (npmExitedOnPermissionDenied(error, process.platform)) writeSettledLockRecord(path);
183
+ if (npmExitedOnPermissionDenied(error, process.platform) || npmExitedBeforeInstalling(error)) writeSettledLockRecord(path);
174
184
  throw error;
175
185
  }
176
186
  writeSettledLockRecord(path);
177
187
  };
178
188
 
179
189
  export {
190
+ PENDING_INSTALL_STALE_AFTER_MS,
180
191
  claimUpgradeLock,
181
192
  ownsUpgradeLock,
182
193
  releaseAutoUpdateLock,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  computerOsOfPlatform,
3
3
  isComputerAgent
4
- } from "./chunk-6JBX55K4.js";
4
+ } from "./chunk-O5ARO3JM.js";
5
5
 
6
6
  // src/setup/phone-check.ts
7
7
  var planPhoneCheck = (context) => {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-2QY2BD4T.js";
3
+ } from "./chunk-MUSINFEU.js";
4
4
  import {
5
5
  fetchAsCredential
6
- } from "./chunk-UGPNLU4O.js";
6
+ } from "./chunk-4L2IYNLC.js";
7
7
  import {
8
8
  NPX_LATEST_COMMAND
9
- } from "./chunk-JDIKCM2N.js";
9
+ } from "./chunk-TXXAQRX4.js";
10
10
 
11
11
  // src/mcp-stdio-bridge.ts
12
12
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -5,13 +5,13 @@ import {
5
5
  } from "./chunk-OYIN77HO.js";
6
6
  import {
7
7
  readMacAppAgentKey
8
- } from "./chunk-6EPTMB7L.js";
8
+ } from "./chunk-5IG3VPHT.js";
9
9
  import {
10
10
  API_KEYS_PATH
11
- } from "./chunk-LO52V6WG.js";
11
+ } from "./chunk-UAHBSOO4.js";
12
12
  import {
13
13
  absoluteUrl
14
- } from "./chunk-3TTXOU6G.js";
14
+ } from "./chunk-CABBLJD5.js";
15
15
  import {
16
16
  findExportedKeyLines,
17
17
  isAdoptedMacAppKey,
@@ -21,10 +21,10 @@ import {
21
21
  readConfigFileKey,
22
22
  readKeySource,
23
23
  readMacAppKeyPrefix
24
- } from "./chunk-XQOBM3E6.js";
24
+ } from "./chunk-CU5SYUMK.js";
25
25
  import {
26
26
  isValidApiKey
27
- } from "./chunk-6JBX55K4.js";
27
+ } from "./chunk-O5ARO3JM.js";
28
28
 
29
29
  // src/cli/held-key-revocation.ts
30
30
  var readCliHeldKeys = (profiles) => {
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  keyCheckFromResponse
3
- } from "./chunk-3TTXOU6G.js";
3
+ } from "./chunk-CABBLJD5.js";
4
4
  import {
5
5
  installNetworkDefaults
6
- } from "./chunk-2G54YLN3.js";
6
+ } from "./chunk-CDQOARIF.js";
7
7
  import {
8
8
  fetchAsCredential
9
- } from "./chunk-UGPNLU4O.js";
9
+ } from "./chunk-4L2IYNLC.js";
10
10
  import {
11
11
  getBaseUrl
12
- } from "./chunk-3NMX4725.js";
12
+ } from "./chunk-VPADWVYD.js";
13
13
  import {
14
14
  isRecord,
15
15
  isToolErrorResult,
16
16
  toolFailureCodeOfResult
17
- } from "./chunk-6JBX55K4.js";
17
+ } from "./chunk-O5ARO3JM.js";
18
18
 
19
19
  // src/retry.ts
20
20
  var isRetryable = (err) => {
@@ -1,17 +1,133 @@
1
1
  import {
2
- external_exports
3
- } from "./chunk-XMSDA5WA.js";
2
+ external_exports,
3
+ readOwnerOnlyJson
4
+ } from "./chunk-352FIVVH.js";
4
5
  import {
5
6
  fetchAsCredential
6
- } from "./chunk-UGPNLU4O.js";
7
+ } from "./chunk-4L2IYNLC.js";
7
8
  import {
8
9
  getBaseUrl
9
- } from "./chunk-3NMX4725.js";
10
+ } from "./chunk-VPADWVYD.js";
11
+ import {
12
+ writeJsonAtomicDurable
13
+ } from "./chunk-TODDEIYG.js";
10
14
  import {
11
15
  compressTranscriptRecord,
12
16
  redactSecretsFromContent,
13
17
  transcriptRecordPlaintext
14
- } from "./chunk-6JBX55K4.js";
18
+ } from "./chunk-O5ARO3JM.js";
19
+
20
+ // src/transcript-recipient-pin.ts
21
+ import { createHash } from "crypto";
22
+ import { mkdirSync, rmSync } from "fs";
23
+ import { homedir } from "os";
24
+ import { dirname, join } from "path";
25
+ var recipientPinFile = () => process.env.PUSHARY_RECIPIENT_PIN_FILE?.trim() || join(homedir(), ".pushary", "recipients.json");
26
+ var asPin = (offer) => ({
27
+ phonePublicKey: offer.phonePublicKey,
28
+ providerKeyId: offer.provider?.keyId ?? null,
29
+ providerPublicKey: offer.provider?.publicKey ?? null
30
+ });
31
+ var pinnedRecipientsSchema = external_exports.object({
32
+ phonePublicKey: external_exports.string().min(1).max(256),
33
+ providerKeyId: external_exports.string().min(1).max(256).nullable().default(null),
34
+ providerPublicKey: external_exports.string().min(1).max(256).nullable().default(null)
35
+ });
36
+ var loadPin = (path = recipientPinFile()) => {
37
+ try {
38
+ return pinnedRecipientsSchema.parse(readOwnerOnlyJson(path, 16384));
39
+ } catch (error) {
40
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return null;
41
+ throw new Error("Existing history trust could not be read. Nothing was replaced.");
42
+ }
43
+ };
44
+ var savePin = (pin, path = recipientPinFile()) => {
45
+ try {
46
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
47
+ writeJsonAtomicDurable(path, pin, 384);
48
+ return true;
49
+ } catch {
50
+ return false;
51
+ }
52
+ };
53
+ var clearPin = () => {
54
+ try {
55
+ rmSync(recipientPinFile(), { force: true });
56
+ } catch {
57
+ }
58
+ };
59
+ var verifyRecipients = (offer, pinned) => {
60
+ if (!pinned) return { kind: "first-use", pin: asPin(offer) };
61
+ const next = asPin(offer);
62
+ const changed = [];
63
+ if (next.phonePublicKey !== pinned.phonePublicKey) changed.push("the phone key this machine seals to");
64
+ if (next.providerKeyId !== pinned.providerKeyId) changed.push("the compliance recovery key id");
65
+ if (next.providerPublicKey !== pinned.providerPublicKey) changed.push("the compliance recovery key");
66
+ return changed.length === 0 ? { kind: "match" } : { kind: "changed", changed };
67
+ };
68
+ var fingerprint = (publicKey) => createHash("sha256").update(publicKey).digest("hex");
69
+ var changedRecipientsMessage = (verdict, offer) => [
70
+ "[pushary] Transcript sync stopped: the keys this machine seals transcripts to have changed.",
71
+ ...verdict.changed.map((what) => `[pushary] changed: ${what}`),
72
+ `[pushary] now offered: phone ${fingerprint(offer.phonePublicKey)}${offer.provider ? `, recovery ${offer.provider.keyId.slice(0, 8)}` : ", no recovery key"}`,
73
+ "[pushary] If you reinstalled the app or rotated a key, this is expected. Compare the",
74
+ "[pushary] fingerprint above with the one in the app under Settings, then run:",
75
+ "[pushary] pushary transcripts trust --fingerprint <fingerprint-from-phone-settings>",
76
+ "[pushary] Until then nothing is uploaded, so no turn is sealed to a key you have not seen."
77
+ ].join("\n");
78
+
79
+ // src/transcript-phone-trust.ts
80
+ import { createHash as createHash2 } from "crypto";
81
+ import { mkdirSync as mkdirSync2 } from "fs";
82
+ import { dirname as dirname2, join as join2 } from "path";
83
+ var approvedPhoneSchema = external_exports.object({ version: external_exports.literal(1), sourcePinHash: external_exports.string().regex(/^[a-f0-9]{64}$/), phonePublicKey: external_exports.string().min(1).max(256) });
84
+ var pinHash = (pin) => createHash2("sha256").update(JSON.stringify(pin)).digest("hex");
85
+ var approvalFile = (path, pin, publicKey) => join2(`${path}.trusted-phones`, `${pinHash(pin)}-${fingerprint(publicKey)}.json`);
86
+ var sameRecoveryRecipient = (offer, pin) => (offer.provider?.keyId ?? null) === pin.providerKeyId && (offer.provider?.publicKey ?? null) === pin.providerPublicKey;
87
+ var canonicalPublicKey = (key) => {
88
+ const bytes = Buffer.from(key, "base64");
89
+ return bytes.length === 32 && bytes.toString("base64") === key;
90
+ };
91
+ var phoneWasApproved = (offer, pin, path) => {
92
+ try {
93
+ const approval = approvedPhoneSchema.parse(readOwnerOnlyJson(approvalFile(path, pin, offer.phonePublicKey), 16384));
94
+ if (approval.sourcePinHash !== pinHash(pin) || approval.phonePublicKey !== offer.phonePublicKey) throw new Error("Mismatched approval");
95
+ return true;
96
+ } catch (error) {
97
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
98
+ throw new Error("Saved phone verification could not be read. Nothing was replaced.");
99
+ }
100
+ };
101
+ var verifyTrustedRecipients = (offer, path = recipientPinFile()) => {
102
+ const pin = loadPin(path);
103
+ const verdict = verifyRecipients(offer, pin);
104
+ if (verdict.kind !== "changed" || !pin || !sameRecoveryRecipient(offer, pin)) return verdict;
105
+ return phoneWasApproved(offer, pin, path) ? { kind: "match" } : verdict;
106
+ };
107
+ var verifyAnchoredRecipients = (offer, path = recipientPinFile(), anchorPath) => {
108
+ const verdict = verifyTrustedRecipients(offer, path);
109
+ if (verdict.kind !== "first-use" || anchorPath === void 0 || loadPin(anchorPath) === null) return verdict;
110
+ const anchored = verifyTrustedRecipients(offer, anchorPath);
111
+ return anchored.kind === "match" ? verdict : anchored;
112
+ };
113
+ var assertVerifiedPhone = (offer, pin, expectedFingerprint) => {
114
+ if (!canonicalPublicKey(offer.phonePublicKey) || fingerprint(offer.phonePublicKey) !== expectedFingerprint.trim().toLowerCase()) {
115
+ throw new Error("The fingerprint does not match this phone. Nothing was changed.");
116
+ }
117
+ if (!pin) throw new Error("No existing history trust was found. Nothing was changed.");
118
+ if (!sameRecoveryRecipient(offer, pin)) throw new Error("The recovery recipient also changed. Phone verification cannot approve that change.");
119
+ };
120
+ var trustPhoneRecipient = (request) => {
121
+ const { offer, pinFile } = request;
122
+ const pin = loadPin(pinFile);
123
+ assertVerifiedPhone(offer, pin, request.expectedFingerprint);
124
+ if (!pin) throw new Error("No existing history trust was found.");
125
+ if (verifyTrustedRecipients(offer, pinFile).kind === "match") return "already_trusted";
126
+ const path = approvalFile(pinFile, pin, offer.phonePublicKey);
127
+ mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
128
+ writeJsonAtomicDurable(path, { version: 1, sourcePinHash: pinHash(pin), phonePublicKey: offer.phonePublicKey }, 384);
129
+ return "trusted";
130
+ };
15
131
 
16
132
  // src/transcript-api.ts
17
133
  var providerRecipientSchema = external_exports.object({
@@ -274,6 +390,16 @@ var buildTranscriptRecords = (lines, sessionKey, seen = /* @__PURE__ */ new Set(
274
390
  };
275
391
 
276
392
  export {
393
+ recipientPinFile,
394
+ loadPin,
395
+ savePin,
396
+ clearPin,
397
+ fingerprint,
398
+ changedRecipientsMessage,
399
+ verifyTrustedRecipients,
400
+ verifyAnchoredRecipients,
401
+ assertVerifiedPhone,
402
+ trustPhoneRecipient,
277
403
  decodePublicKey,
278
404
  generateSessionKey,
279
405
  wrapSessionKey,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-BG4HHB7E.js";
8
8
  import {
9
9
  redactSecretsFromContent
10
- } from "./chunk-6JBX55K4.js";
10
+ } from "./chunk-O5ARO3JM.js";
11
11
 
12
12
  // src/cli/json.ts
13
13
  var writeStdoutFully = (text) => new Promise((resolve, reject) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SESSION
3
- } from "./chunk-Q6POCQOV.js";
3
+ } from "./chunk-BP5HLKR6.js";
4
4
 
5
5
  // src/answer.ts
6
6
  var isDeferAnswer = (value) => value === "defer";
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-CYTPQDQY.js";
4
4
  import {
5
5
  parseVersion
6
- } from "./chunk-BU2J4P7P.js";
6
+ } from "./chunk-43NHQUCY.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-6JBX55K4.js";
9
+ } from "./chunk-O5ARO3JM.js";
10
10
 
11
11
  // src/setup/agent-probe.ts
12
12
  import { execSync } from "child_process";
@@ -3731,10 +3731,10 @@ var SETUP_AGENT_FAILURE_KINDS = [
3731
3731
  "app-account-mismatch"
3732
3732
  ];
3733
3733
  var isSetupAgentFailureKind = (value) => typeof value === "string" && SETUP_AGENT_FAILURE_KINDS.includes(value);
3734
- var SETUP_AGENT_FAILURE_CODES = ["npm-missing", "npm-global-prefix-denied", "npm-file-in-use", "npm-install-failed", "config-write-failed"];
3734
+ var SETUP_AGENT_FAILURE_CODES = ["npm-missing", "npm-global-prefix-denied", "npm-file-in-use", "npm-release-age", "npm-install-failed", "config-write-failed"];
3735
3735
  var SETUP_AGENT_FAILURE_STAGES = ["runtime-install", "config-read", "config-write", "hook-validation", "account-check", "unknown"];
3736
3736
  var isSetupAgentFailureStage = (value) => typeof value === "string" && SETUP_AGENT_FAILURE_STAGES.includes(value);
3737
- var SETUP_AGENT_FAILURE_REMEDIES = ["retry-agent", "install-node", "fix-npm-prefix", "close-node-programs", "match-mac-account"];
3737
+ var SETUP_AGENT_FAILURE_REMEDIES = ["retry-agent", "install-node", "fix-npm-prefix", "close-node-programs", "use-npm-policy", "match-mac-account"];
3738
3738
  var isSetupAgentFailureCode = (value) => typeof value === "string" && SETUP_AGENT_FAILURE_CODES.includes(value);
3739
3739
  var isSetupAgentFailureRemedy = (value) => typeof value === "string" && SETUP_AGENT_FAILURE_REMEDIES.includes(value);
3740
3740
  var isSetupAgentFailure = (value) => {
@@ -1,10 +1,8 @@
1
1
  import {
2
+ external_exports,
2
3
  readOwnerOnlyJson,
3
4
  transcriptReadPositionSchema
4
- } from "./chunk-VAE5JBR5.js";
5
- import {
6
- external_exports
7
- } from "./chunk-XMSDA5WA.js";
5
+ } from "./chunk-352FIVVH.js";
8
6
 
9
7
  // src/native-transcript-account.ts
10
8
  import { createHash } from "crypto";
@@ -1,19 +1,20 @@
1
1
  import {
2
2
  notificationAnswerStep
3
- } from "./chunk-WLKW2TF7.js";
3
+ } from "./chunk-6YX3VB5P.js";
4
4
  import {
5
5
  canChangeApprovalSettings
6
- } from "./chunk-LO52V6WG.js";
6
+ } from "./chunk-UAHBSOO4.js";
7
7
  import {
8
8
  matchMacAccountStep,
9
9
  retryAgentCommand
10
- } from "./chunk-FMAIUTVU.js";
10
+ } from "./chunk-PUTX5BBE.js";
11
11
  import {
12
12
  EXIT
13
13
  } from "./chunk-BG4HHB7E.js";
14
14
  import {
15
- NPX_LATEST_COMMAND
16
- } from "./chunk-JDIKCM2N.js";
15
+ NPX_LATEST_COMMAND,
16
+ npmExecSetupCommandFor
17
+ } from "./chunk-TXXAQRX4.js";
17
18
 
18
19
  // src/setup/closing.ts
19
20
  var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
@@ -23,7 +24,7 @@ var sendAnotherTestLines = (appPlatforms) => {
23
24
  const step = notificationAnswerStep(appPlatforms);
24
25
  return step === null ? [CHECK_THE_NOTIFICATION_OPENED, SEND_ANOTHER_TEST] : [SEND_ANOTHER_TEST, step];
25
26
  };
26
- var TRANSCRIPT_SYNC_NOTICE = `Transcripts sync redacted and encrypted. Your phone can decrypt them; authorized Pushary compliance admins can recover them for documented legal obligations. Turn off: ${NPX_LATEST_COMMAND} transcripts off`;
27
+ var TRANSCRIPT_SYNC_NOTICE = `Transcripts sync redacted and encrypted. Your phone can decrypt them. Pushary can open a session only for a documented legal request, and every opening is logged. Turn off: ${NPX_LATEST_COMMAND} transcripts off`;
27
28
  var PAIR_PHONE_APP_HINT = `${NPX_LATEST_COMMAND} pair pair the Pushary app on your phone`;
28
29
  var ALLOW_NOTIFICATIONS_HINT = `${NPX_LATEST_COMMAND} doctor --roundtrip after you allow notifications in the Pushary app`;
29
30
  var unreachedPhoneHint = (facts) => facts.phoneAwaitsNotifications === true ? ALLOW_NOTIFICATIONS_HINT : PAIR_PHONE_APP_HINT;
@@ -159,7 +160,11 @@ var describeClosing = (facts) => {
159
160
  return {
160
161
  ok: false,
161
162
  headline: "Setup failed.",
162
- next: ["Nothing was configured. Run pushary doctor to see why."],
163
+ next: [
164
+ "No agent was set up. Your key is saved.",
165
+ ...reachable ? ["Push works."] : [],
166
+ `Fix the problem above, then run setup again. To check this computer, run ${NPX_LATEST_COMMAND} doctor.`
167
+ ],
163
168
  exitCode: EXIT.FAILED,
164
169
  reason: "configured-nothing"
165
170
  };
@@ -262,8 +267,10 @@ var RETRY_AGENT_LABEL = "Retry just this agent:";
262
267
  var INSTALL_NODE_STEP = "Install the current Node.js LTS, which includes npm, then run setup again.";
263
268
  var NPM_PREFIX_STEP = "npm can't install globally here. Use nvm, or run: npm config set prefix ~/.npm-global, then run setup again.";
264
269
  var NPM_FILE_IN_USE_STEP = "Close other terminals or editors that use Node, then run setup again.";
265
- var nextStepFor = (failure) => {
270
+ var nextStepFor = (failure, releaseAgeRefusedAgents) => {
266
271
  switch (failure.remedy) {
272
+ case "use-npm-policy":
273
+ return { kind: "use-npm-policy", instruction: `Your npm only installs releases older than its min-release-age. Run this instead: ${npmExecSetupCommandFor(process.platform, releaseAgeRefusedAgents)}` };
267
274
  case "install-node":
268
275
  return { kind: "install-node", instruction: INSTALL_NODE_STEP };
269
276
  case "fix-npm-prefix":
@@ -278,8 +285,9 @@ var nextStepFor = (failure) => {
278
285
  };
279
286
  var describeAgentFailures = (failures, agentName) => failures.map((failure) => ({
280
287
  summary: `${agentName(failure.agent)}: ${failure.detail}`,
281
- next: nextStepFor(failure)
288
+ next: nextStepFor(failure, agentsRefusedForReleaseAge(failures))
282
289
  }));
290
+ var agentsRefusedForReleaseAge = (failures) => failures.filter((failure) => failure.remedy === "use-npm-policy").map((failure) => failure.agent);
283
291
  var agentFailureFollowUps = (failures) => [
284
292
  ...failures.some((failure) => failure.remedy === "install-node") ? ["install-node"] : [],
285
293
  ...failures.some((failure) => failure.remedy === "fix-npm-prefix") ? ["fix-npm-prefix"] : [],
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  NpmInstallError,
3
3
  NpmMissingError,
4
- NpmPermissionError
5
- } from "./chunk-BU2J4P7P.js";
4
+ NpmPermissionError,
5
+ NpmReleaseAgeError
6
+ } from "./chunk-43NHQUCY.js";
6
7
  import {
7
8
  writeFileAtomic
8
9
  } from "./chunk-TODDEIYG.js";
9
10
  import {
10
11
  NPX_LATEST_COMMAND
11
- } from "./chunk-JDIKCM2N.js";
12
+ } from "./chunk-TXXAQRX4.js";
12
13
  import {
13
14
  readSetupAgentFailures
14
- } from "./chunk-6JBX55K4.js";
15
+ } from "./chunk-O5ARO3JM.js";
15
16
 
16
17
  // src/setup/config-write.ts
17
18
  var AgentConfigWriteError = class extends Error {
@@ -62,11 +63,13 @@ var NPM_PERMISSION_REMEDIES = {
62
63
  "file-in-use": "close-node-programs"
63
64
  };
64
65
  var remedyForError = (error) => {
66
+ if (error instanceof NpmReleaseAgeError) return "use-npm-policy";
65
67
  if (error instanceof NpmMissingError) return "install-node";
66
68
  if (error instanceof NpmPermissionError) return NPM_PERMISSION_REMEDIES[error.kind];
67
69
  return "retry-agent";
68
70
  };
69
71
  var setupFailureDiagnostic = (error) => {
72
+ if (error instanceof NpmReleaseAgeError) return { stage: "runtime-install", diagnosticCode: "npm-release-age" };
70
73
  if (error instanceof AgentConfigError) return { stage: "config-read" };
71
74
  if (error instanceof AgentConfigWriteError) return { stage: "config-write", diagnosticCode: "config-write-failed" };
72
75
  if (error instanceof NpmMissingError) return { stage: "runtime-install", diagnosticCode: "npm-missing" };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  addGeminiMcpServer,
3
3
  removeGeminiMcpServer
4
- } from "./chunk-L6BTSIKF.js";
4
+ } from "./chunk-QTQRQZIU.js";
5
5
  import {
6
6
  CLAUDE_CODE_AGENT
7
- } from "./chunk-Q6POCQOV.js";
7
+ } from "./chunk-BP5HLKR6.js";
8
8
  import {
9
9
  compatibleToolLookup
10
- } from "./chunk-D7ZWJYXB.js";
10
+ } from "./chunk-WQJ5NJ35.js";
11
11
  import {
12
12
  CLAUDE_HOOK_EVENTS,
13
13
  PUSHARY_MCP_URL,
@@ -19,7 +19,7 @@ import {
19
19
  isPusharyHook,
20
20
  registerHookEntry,
21
21
  removeClaudeMcpServers
22
- } from "./chunk-GJV5RVUU.js";
22
+ } from "./chunk-AQ7L2E2U.js";
23
23
  import {
24
24
  HOOK_COMPATIBLE_PROFILES,
25
25
  PHONE_ANSWERED_TOOLS,
@@ -30,7 +30,7 @@ import {
30
30
  pusharyMissingReason,
31
31
  refusalOutput,
32
32
  withHookHoldBudget
33
- } from "./chunk-6JBX55K4.js";
33
+ } from "./chunk-O5ARO3JM.js";
34
34
 
35
35
  // src/config-document.ts
36
36
  import { parse, stringify } from "smol-toml";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-6JBX55K4.js";
3
+ } from "./chunk-O5ARO3JM.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  callDecisionStore,
3
3
  identifyingToolInput
4
- } from "./chunk-Q6POCQOV.js";
4
+ } from "./chunk-BP5HLKR6.js";
5
5
  import {
6
6
  canonicalJson
7
- } from "./chunk-GJV5RVUU.js";
7
+ } from "./chunk-AQ7L2E2U.js";
8
8
 
9
9
  // src/phone-approval.ts
10
10
  import { createHash } from "crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AGENT_CHOICES
3
- } from "./chunk-NMUEUDTT.js";
3
+ } from "./chunk-CAHULQIO.js";
4
4
  import {
5
5
  BELL_HOOK_BINARY
6
- } from "./chunk-OXDKZYBO.js";
6
+ } from "./chunk-R2JRRCZK.js";
7
7
  import {
8
8
  CLAUDE_HOOK_EVENTS,
9
9
  CODEX_HOOK_EVENTS,
@@ -16,13 +16,13 @@ import {
16
16
  isBridgeLocator,
17
17
  isProtectedByScope,
18
18
  registerHookEntry
19
- } from "./chunk-GJV5RVUU.js";
19
+ } from "./chunk-AQ7L2E2U.js";
20
20
  import {
21
21
  CURSOR_GATE_EVENTS,
22
22
  HOOK_BUDGETS,
23
23
  HOOK_LOCATOR_BINARY,
24
24
  hookCommandHoldBudget
25
- } from "./chunk-6JBX55K4.js";
25
+ } from "./chunk-O5ARO3JM.js";
26
26
 
27
27
  // src/gemini-config.ts
28
28
  var GEMINI_HOOK_BINARY = "pushary-gemini-hook";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  guardBinary
3
- } from "./chunk-GJV5RVUU.js";
3
+ } from "./chunk-AQ7L2E2U.js";
4
4
 
5
5
  // src/bell/install.ts
6
6
  import { join } from "path";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HOOK_HOLD_BUDGET_ENV,
3
3
  hookHoldBudgetProof
4
- } from "./chunk-6JBX55K4.js";
4
+ } from "./chunk-O5ARO3JM.js";
5
5
 
6
6
  // src/hold-budget.ts
7
7
  var takeHookHoldBudget = (args = process.argv.slice(2), env = process.env) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pusharyDir
3
- } from "./chunk-GJV5RVUU.js";
3
+ } from "./chunk-AQ7L2E2U.js";
4
4
  import {
5
5
  readRegularJsonFile,
6
6
  writeFileAtomic
@@ -13,7 +13,7 @@ import {
13
13
  serializeDeclinedAgents,
14
14
  withDeclinedAgent,
15
15
  withoutDeclinedAgent
16
- } from "./chunk-6JBX55K4.js";
16
+ } from "./chunk-O5ARO3JM.js";
17
17
 
18
18
  // src/declined-agents-file.ts
19
19
  import { join } from "path";
@@ -5,13 +5,13 @@ import {
5
5
  OPENCLAW_ENVIRONMENT_KEYS,
6
6
  openClawEnvironmentOf,
7
7
  openClawPathsFrom
8
- } from "./chunk-GJV5RVUU.js";
8
+ } from "./chunk-AQ7L2E2U.js";
9
9
  import {
10
10
  resolvePathBinary
11
- } from "./chunk-BU2J4P7P.js";
11
+ } from "./chunk-43NHQUCY.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-6JBX55K4.js";
14
+ } from "./chunk-O5ARO3JM.js";
15
15
 
16
16
  // src/openclaw/wiring-state.ts
17
17
  var OPENCLAW_PLUGIN_ID = "pushary";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  openClawLauncherCandidates
3
- } from "./chunk-T2CR5REM.js";
3
+ } from "./chunk-RYDDLS62.js";
4
4
  import {
5
5
  openCodeConfigDirFrom
6
- } from "./chunk-MI7GHNTO.js";
6
+ } from "./chunk-3AAQJ75F.js";
7
7
  import {
8
8
  nativeClaudeInstallPath
9
9
  } from "./chunk-CYTPQDQY.js";
10
10
  import {
11
11
  grokHome
12
- } from "./chunk-2I6A34GJ.js";
12
+ } from "./chunk-PVBDITRS.js";
13
13
  import {
14
14
  claudeConfigDir,
15
15
  clineDataDirectory,
16
16
  codexHomeFrom,
17
17
  openClawEnvironmentOf,
18
18
  openClawPathsFrom
19
- } from "./chunk-GJV5RVUU.js";
19
+ } from "./chunk-AQ7L2E2U.js";
20
20
  import {
21
21
  HOOK_COMPATIBLE_PROFILES
22
- } from "./chunk-6JBX55K4.js";
22
+ } from "./chunk-O5ARO3JM.js";
23
23
 
24
24
  // src/vscode-config.ts
25
25
  import { homedir } from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-XQOBM3E6.js";
3
+ } from "./chunk-CU5SYUMK.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {