pushary 1.9.267 → 1.9.268

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 (145) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{api-L2Z47RNK.js → api-2PD4GLZO.js} +12 -11
  3. package/dist/bin/pushary-audit.js +3 -3
  4. package/dist/bin/pushary-bell-hook.js +28 -29
  5. package/dist/bin/pushary-bell.js +11 -12
  6. package/dist/bin/pushary-calls.js +14 -15
  7. package/dist/bin/pushary-claude.js +25 -26
  8. package/dist/bin/pushary-clean.js +39 -40
  9. package/dist/bin/pushary-codex-bridge.js +22 -23
  10. package/dist/bin/pushary-codex-hook.js +34 -35
  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 +35 -36
  14. package/dist/bin/pushary-cowork.js +5 -5
  15. package/dist/bin/pushary-daemon.js +46 -47
  16. package/dist/bin/pushary-disconnect.js +30 -31
  17. package/dist/bin/pushary-display-hook.js +18 -0
  18. package/dist/bin/pushary-doctor.js +50 -51
  19. package/dist/bin/pushary-elicitation-hook.js +27 -28
  20. package/dist/bin/pushary-gemini-bridge.js +17 -18
  21. package/dist/bin/pushary-gemini-hook.js +31 -32
  22. package/dist/bin/pushary-hook.js +35 -36
  23. package/dist/bin/pushary-login.js +101 -25
  24. package/dist/bin/pushary-logout.js +31 -32
  25. package/dist/bin/pushary-mcp.js +12 -12
  26. package/dist/bin/pushary-mode.js +15 -16
  27. package/dist/bin/pushary-notification-hook.js +27 -28
  28. package/dist/bin/pushary-opencode-bridge.js +21 -22
  29. package/dist/bin/pushary-opencode-hook.js +32 -33
  30. package/dist/bin/pushary-permission-denied-hook.js +34 -35
  31. package/dist/bin/pushary-permission-hook.js +35 -36
  32. package/dist/bin/pushary-post-hook.js +28 -29
  33. package/dist/bin/pushary-prompt-hook.js +27 -28
  34. package/dist/bin/pushary-session-end-hook.js +27 -28
  35. package/dist/bin/pushary-session-start-hook.js +39 -40
  36. package/dist/bin/pushary-sessions.js +12 -12
  37. package/dist/bin/pushary-setup.js +65 -73
  38. package/dist/bin/pushary-stats.js +5 -5
  39. package/dist/bin/pushary-status.js +36 -37
  40. package/dist/bin/pushary-stop-hook.js +27 -28
  41. package/dist/bin/pushary-stopfailure-hook.js +27 -28
  42. package/dist/bin/pushary-suggestions.js +15 -16
  43. package/dist/bin/pushary-transcript-register.js +16 -17
  44. package/dist/bin/pushary-transcripts.js +25 -26
  45. package/dist/bin/pushary-upgrade.js +47 -48
  46. package/dist/bin/pushary-wait.js +16 -17
  47. package/dist/bin/pushary.js +7 -7
  48. package/dist/{chunk-OEKXK3YR.js → chunk-26K5VC53.js} +1 -1
  49. package/dist/{chunk-OTCNXBIY.js → chunk-2EHLFIVK.js} +4 -4
  50. package/dist/{chunk-XUN2NSYF.js → chunk-2FI62SKT.js} +1 -1
  51. package/dist/{chunk-Y2CO2RMJ.js → chunk-47NWTV5K.js} +45 -13
  52. package/dist/{chunk-SLWLFMMB.js → chunk-4LRWEHQT.js} +65 -6
  53. package/dist/{chunk-RQ5DKUF4.js → chunk-4ZSC56SL.js} +1 -1
  54. package/dist/{chunk-KCQP7ZDP.js → chunk-5LE7C6Q2.js} +2 -2
  55. package/dist/{chunk-TFI7UZ4N.js → chunk-5WSFZXR6.js} +2 -2
  56. package/dist/{chunk-BO5TJWAN.js → chunk-AOCTHK4E.js} +3 -3
  57. package/dist/{chunk-573LGFOV.js → chunk-AQP5SMAF.js} +2 -2
  58. package/dist/{chunk-4R7RMJIP.js → chunk-AQPA4YIB.js} +1 -1
  59. package/dist/{chunk-J26QBILB.js → chunk-AT3C3Z3M.js} +7 -7
  60. package/dist/{chunk-275RFVSO.js → chunk-AXVLRYIK.js} +1 -1
  61. package/dist/{chunk-KK57NC2O.js → chunk-BQ23UZJY.js} +5 -5
  62. package/dist/{chunk-UVRUK52J.js → chunk-CIO6FAIU.js} +1 -1
  63. package/dist/{chunk-KPH6GX74.js → chunk-DC35GPRY.js} +8 -8
  64. package/dist/{chunk-EVT7LZ7E.js → chunk-DJYBACUW.js} +1 -1
  65. package/dist/{chunk-GXHOOPOY.js → chunk-DPOLLK6I.js} +3 -3
  66. package/dist/{chunk-7KAMTVC2.js → chunk-DVAXZOTR.js} +1 -1
  67. package/dist/{chunk-XPLUSOU5.js → chunk-EKU4KLON.js} +1 -1
  68. package/dist/{chunk-MQO4F37H.js → chunk-ERE3R6SS.js} +4 -4
  69. package/dist/{chunk-ZJLVASQZ.js → chunk-FF2LDPB2.js} +4 -4
  70. package/dist/{chunk-HZG7IUDL.js → chunk-FFWESSEY.js} +4 -4
  71. package/dist/{chunk-EVX63B2G.js → chunk-FHCXJ2HZ.js} +5 -5
  72. package/dist/{chunk-PDANBIJA.js → chunk-FK4BFIFR.js} +5 -5
  73. package/dist/{chunk-WH5M67RN.js → chunk-GCDVD242.js} +6 -6
  74. package/dist/{chunk-WNMTWBV4.js → chunk-GEBRKBLB.js} +5 -5
  75. package/dist/{chunk-S44D2HDB.js → chunk-GMQ73QWC.js} +16 -16
  76. package/dist/{chunk-I2EZVCOY.js → chunk-GP5UGODT.js} +5 -5
  77. package/dist/{chunk-GF75PDAQ.js → chunk-GPEGT2EP.js} +1 -1
  78. package/dist/{chunk-4YOLB6H7.js → chunk-GYLIVREZ.js} +18 -0
  79. package/dist/{chunk-JSPW2FFO.js → chunk-HEAJBTIG.js} +1 -1
  80. package/dist/{chunk-WAVZTVYL.js → chunk-HPLG5D6Y.js} +5 -5
  81. package/dist/{chunk-A2YOC25E.js → chunk-HSX5EVPH.js} +2 -2
  82. package/dist/{chunk-KQ5S2ZUP.js → chunk-IEQDAZDB.js} +2 -2
  83. package/dist/{chunk-QW7LM6BG.js → chunk-IQBJD5ZB.js} +4 -4
  84. package/dist/{chunk-YJ2T5AKE.js → chunk-IR342JX3.js} +6 -6
  85. package/dist/{chunk-TXPDNOKT.js → chunk-JQCF2IYA.js} +1 -1
  86. package/dist/{chunk-IRS2FE32.js → chunk-JSE7T4JL.js} +1 -1
  87. package/dist/{chunk-NDOHMHU7.js → chunk-JXWWWVGR.js} +10 -10
  88. package/dist/{chunk-WUKZEENF.js → chunk-KQZQ55CO.js} +4 -4
  89. package/dist/{chunk-MGFCPJHQ.js → chunk-KVCWPOF6.js} +8 -5
  90. package/dist/{chunk-6QFYQYLV.js → chunk-L6CWEU5C.js} +2 -2
  91. package/dist/{chunk-JYKM47DL.js → chunk-LF5OEQNP.js} +2 -2
  92. package/dist/{chunk-QTWLOFBV.js → chunk-LYBX463S.js} +2 -2
  93. package/dist/{chunk-VSOUII7B.js → chunk-M2ETE6JQ.js} +1 -1
  94. package/dist/{chunk-XHKGTKM6.js → chunk-N6ARPVSQ.js} +86 -79
  95. package/dist/{chunk-BWPDGMKS.js → chunk-NA5EQTCV.js} +1 -1
  96. package/dist/{chunk-UX7YU7EM.js → chunk-NAVHNIM4.js} +1 -1
  97. package/dist/{chunk-AXIIY75S.js → chunk-NOWWUX5V.js} +3 -3
  98. package/dist/{chunk-OF7LT6JD.js → chunk-NRTSHLZQ.js} +6 -6
  99. package/dist/{chunk-3DY5G7JW.js → chunk-NYP2NRV3.js} +1 -1
  100. package/dist/{chunk-RB4QNUFM.js → chunk-O2X6KT7P.js} +4 -4
  101. package/dist/{chunk-DW7YF5GB.js → chunk-P6AKOYLZ.js} +4 -4
  102. package/dist/{chunk-LXH5JLD7.js → chunk-QJHOS33W.js} +5 -5
  103. package/dist/{chunk-MDG6IDIJ.js → chunk-S2DKGGEL.js} +5 -5
  104. package/dist/{chunk-OOSDN4AF.js → chunk-S4AQUVX3.js} +3 -3
  105. package/dist/{chunk-NBU7Y6JX.js → chunk-S55XHTYZ.js} +1 -1
  106. package/dist/{chunk-HWIXP7UY.js → chunk-SYCNMJ3Z.js} +1 -1
  107. package/dist/{chunk-FSTX5SRV.js → chunk-SYEUQH6Z.js} +3 -3
  108. package/dist/{chunk-SSQWDL6Q.js → chunk-TEFLCQO4.js} +1 -1
  109. package/dist/{chunk-MY3ZY6B2.js → chunk-TKMOPFZS.js} +3 -3
  110. package/dist/{chunk-IV7POIBI.js → chunk-TOELRIWR.js} +59 -13
  111. package/dist/{chunk-XF3R4ZPV.js → chunk-TZO67S4V.js} +10 -10
  112. package/dist/{chunk-V6673KO7.js → chunk-U2OB44U5.js} +5 -5
  113. package/dist/{chunk-KPQ7QKS4.js → chunk-UNF23P35.js} +1 -1
  114. package/dist/{chunk-7YCRU3HC.js → chunk-UQB4MAA6.js} +3 -3
  115. package/dist/{chunk-WX6YWZFM.js → chunk-UVO56TVL.js} +7 -7
  116. package/dist/{chunk-2IXNXTLA.js → chunk-V2UGSM45.js} +6 -6
  117. package/dist/{chunk-U6X2XWRP.js → chunk-WCEP3U7C.js} +1 -1
  118. package/dist/{chunk-4TRRDGM5.js → chunk-WHFXXV2A.js} +25 -2
  119. package/dist/{chunk-FF7JYSH5.js → chunk-WYYZ2UFX.js} +2 -2
  120. package/dist/{chunk-7SSL355C.js → chunk-WZM7Y5HM.js} +1 -1
  121. package/dist/{chunk-YFJ4ANFO.js → chunk-X5R55HMM.js} +6 -6
  122. package/dist/{chunk-CSI5V5NO.js → chunk-XIEYX4TJ.js} +1 -1
  123. package/dist/{chunk-LOSHKUR2.js → chunk-XPS36L6H.js} +3 -3
  124. package/dist/{chunk-TDDX5PAP.js → chunk-XUJBTEUC.js} +4 -4
  125. package/dist/{chunk-5K6MB557.js → chunk-YBAU5TAV.js} +2 -2
  126. package/dist/{chunk-KBQBO3KA.js → chunk-YGCU6KMO.js} +3 -3
  127. package/dist/{chunk-FV2YDUH5.js → chunk-YZRUE46K.js} +1 -1
  128. package/dist/{chunk-2C7L3B3T.js → chunk-Z5KP6GBC.js} +4 -4
  129. package/dist/{chunk-LB474DMC.js → chunk-ZYQHIMZU.js} +5 -5
  130. package/dist/{codex-app-cards-switch-MZBLPDC5.js → codex-app-cards-switch-TSHQTVOY.js} +11 -12
  131. package/dist/{codex-card-routing-QMXQ3RRX.js → codex-card-routing-EZFQRLL5.js} +2 -2
  132. package/dist/{codex-desktop-launch-7H4COE7H.js → codex-desktop-launch-RBW6N6HI.js} +3 -3
  133. package/dist/{codex-session-launch-ZSY7FTS3.js → codex-session-launch-TERIKZPR.js} +21 -20
  134. package/dist/{config-PPMFPV2E.js → config-2AGEPXWU.js} +3 -3
  135. package/dist/{global-upgrade-RFXS76KH.js → global-upgrade-67DCWAOQ.js} +9 -9
  136. package/dist/{identity-SLRS7XIR.js → identity-QETOMF2L.js} +4 -4
  137. package/dist/{live-capabilities-4G46QNGE.js → live-capabilities-5UIO6P52.js} +4 -4
  138. package/dist/{paths-55IJMRJW.js → paths-IRWDFERG.js} +3 -3
  139. package/dist/reapply-BBNONPII.js +81 -0
  140. package/dist/src/index.js +33 -34
  141. package/dist/{upgrade-lock-UGPXSPSU.js → upgrade-lock-LICESK4W.js} +4 -4
  142. package/dist/{usage-YC6BB7BX.js → usage-CNCT5BGJ.js} +3 -3
  143. package/package.json +1 -1
  144. package/dist/chunk-B3FN4XL2.js +0 -44
  145. package/dist/reapply-HA6RLYRS.js +0 -76
@@ -29,7 +29,7 @@ import {
29
29
  toolResultErrorText,
30
30
  transcriptTokensIn,
31
31
  transcriptUsageRequest
32
- } from "./chunk-FV2YDUH5.js";
32
+ } from "./chunk-YZRUE46K.js";
33
33
  import {
34
34
  askUser,
35
35
  cancelQuestionSettledAtComputer,
@@ -41,41 +41,42 @@ import {
41
41
  isThePersonsStop,
42
42
  reportClientError,
43
43
  sendNotification,
44
+ telemetryOptedOut,
44
45
  waitForAnswer,
45
46
  waitForOpenQuestion,
46
47
  waitForQuestion,
47
48
  writeDegraded
48
- } from "./chunk-SLWLFMMB.js";
49
+ } from "./chunk-4LRWEHQT.js";
49
50
  import {
50
51
  RETRY_ACK,
51
52
  readCommandAck,
52
53
  refusedReceiptMessage
53
- } from "./chunk-3DY5G7JW.js";
54
+ } from "./chunk-NYP2NRV3.js";
54
55
  import {
55
56
  SubscriptionRequiredError,
56
57
  isRetryable,
57
58
  withRetry
58
- } from "./chunk-LB474DMC.js";
59
+ } from "./chunk-ZYQHIMZU.js";
59
60
  import {
60
61
  fetchAsCredential
61
- } from "./chunk-HWIXP7UY.js";
62
+ } from "./chunk-SYCNMJ3Z.js";
62
63
  import {
63
64
  branchFor,
64
65
  projectNameFor,
65
66
  repoKeyFor
66
- } from "./chunk-NBU7Y6JX.js";
67
+ } from "./chunk-S55XHTYZ.js";
67
68
  import {
68
69
  getMachineId
69
- } from "./chunk-RQ5DKUF4.js";
70
+ } from "./chunk-4ZSC56SL.js";
70
71
  import {
71
72
  reportedInstallSource
72
- } from "./chunk-B3FN4XL2.js";
73
+ } from "./chunk-47NWTV5K.js";
73
74
  import {
74
75
  IDLE_PROMPT_NOTIFICATION,
75
76
  NOTIFICATION_PUSH_TYPES,
76
77
  POSTTOOLUSE_MIRROR_ONLY_TOOLS,
77
78
  claudeConfigDir
78
- } from "./chunk-4TRRDGM5.js";
79
+ } from "./chunk-WHFXXV2A.js";
79
80
  import {
80
81
  compareVersion,
81
82
  parseVersion
@@ -84,7 +85,7 @@ import {
84
85
  getApiKey,
85
86
  getBaseUrl,
86
87
  isMalformedApiKeyError
87
- } from "./chunk-KCQP7ZDP.js";
88
+ } from "./chunk-5LE7C6Q2.js";
88
89
  import {
89
90
  writeFileAtomic,
90
91
  writeJsonAtomicDurable
@@ -151,9 +152,10 @@ import {
151
152
  refusesWhenUnanswered,
152
153
  resolveAutoResolveOrigin,
153
154
  resolvePolicy,
155
+ responseRejectsCredential,
154
156
  unansweredRefusalReason,
155
157
  waitsForThePhone
156
- } from "./chunk-4YOLB6H7.js";
158
+ } from "./chunk-GYLIVREZ.js";
157
159
 
158
160
  // src/pending.ts
159
161
  import { join } from "path";
@@ -459,17 +461,61 @@ var emitHookOutput = async (render, write = writeOutput) => {
459
461
  }
460
462
  };
461
463
 
462
- // src/telemetry-opt-out.ts
463
- var TELEMETRY_OPT_OUT_VARIABLES = ["DO_NOT_TRACK", "PUSHARY_TELEMETRY_DISABLED"];
464
- var OPT_IN_SPELLINGS = ["", "0", "false"];
465
- var variableOptsOut = (value) => value !== void 0 && !OPT_IN_SPELLINGS.includes(value.trim().toLowerCase());
466
- var telemetryOptedOut = (env) => TELEMETRY_OPT_OUT_VARIABLES.some((name) => variableOptsOut(env[name]));
464
+ // src/session-notice.ts
465
+ import { existsSync as existsSync2, writeFileSync as writeFileSync2 } from "fs";
466
+ import { tmpdir as tmpdir2 } from "os";
467
+ import { join as join2 } from "path";
468
+ var SUBSCRIPTION_REQUIRED_NOTICE_KIND = "subscription-required";
469
+ var MALFORMED_API_KEY_NOTICE_KIND = "malformed-key";
470
+ var REJECTED_API_KEY_NOTICE_KIND = "rejected-key";
471
+ var REJECTED_API_KEY_NOTICE = "[pushary] Pushary rejected this key. Approvals are off until you run `npx pushary login`.";
472
+ var oncePerSession = (kind, sessionId) => {
473
+ try {
474
+ const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
475
+ const marker = join2(tmpdir2(), `pushary-${kind}-${key}`);
476
+ if (existsSync2(marker)) return false;
477
+ writeFileSync2(marker, "1", "utf-8");
478
+ return true;
479
+ } catch {
480
+ return false;
481
+ }
482
+ };
483
+ var subscriptionRequiredNotice = (upgradeUrl) => `[pushary] Your Pushary workspace has no active subscription, so approvals stay with your agent. Subscribe: ${upgradeUrl}`;
484
+ var announceSubscriptionRequired = (upgradeUrl, sessionId) => {
485
+ try {
486
+ if (!oncePerSession(SUBSCRIPTION_REQUIRED_NOTICE_KIND, sessionId)) return;
487
+ process.stderr.write(`${subscriptionRequiredNotice(upgradeUrl)}
488
+ `);
489
+ } catch {
490
+ return;
491
+ }
492
+ };
493
+ var malformedApiKeyNotice = (message) => `[pushary] Not connected, so your agent runs untouched. ${message}`;
494
+ var announceMalformedApiKey = (keyError, sessionId) => {
495
+ if (!isMalformedApiKeyError(keyError)) return;
496
+ try {
497
+ if (!oncePerSession(MALFORMED_API_KEY_NOTICE_KIND, sessionId)) return;
498
+ process.stderr.write(`${malformedApiKeyNotice(keyError.message)}
499
+ `);
500
+ } catch {
501
+ return;
502
+ }
503
+ };
504
+ var announceRejectedApiKey = (sessionId) => {
505
+ try {
506
+ if (!oncePerSession(REJECTED_API_KEY_NOTICE_KIND, sessionId)) return;
507
+ process.stderr.write(`${REJECTED_API_KEY_NOTICE}
508
+ `);
509
+ } catch {
510
+ return;
511
+ }
512
+ };
467
513
 
468
514
  // src/policy.ts
469
515
  import { createHash as createHash2 } from "crypto";
470
- import { existsSync as existsSync2, lstatSync as lstatSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync2, utimesSync, writeFileSync as writeFileSync2 } from "fs";
471
- import { join as join2 } from "path";
472
- import { tmpdir as tmpdir2 } from "os";
516
+ import { existsSync as existsSync3, lstatSync as lstatSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, unlinkSync as unlinkSync2, utimesSync, writeFileSync as writeFileSync3 } from "fs";
517
+ import { join as join3 } from "path";
518
+ import { tmpdir as tmpdir3 } from "os";
473
519
  var MS_PER_SECOND = 1e3;
474
520
  var CACHE_TTL_MS = POLICY_CACHE_TTL_SECONDS * MS_PER_SECOND;
475
521
  var STALE_CACHE_MAX_MS = 12 * 60 * 60 * 1e3;
@@ -482,7 +528,7 @@ var POLICY_CACHE_PREFIX = `pushary-policy-${POLICY_CACHE_FORMAT}-`;
482
528
  var policyCacheFile = (apiKey, agent, repoAware = false, sessionId) => {
483
529
  const parts = [apiKey, agent, repoAware ? "repoAware" : void 0, "sessionToolAware", sessionId ? `session:${sessionId}` : void 0].filter(Boolean);
484
530
  const hash = createHash2("sha256").update(parts.join(":")).digest("hex").slice(0, 12);
485
- return join2(tmpdir2(), `${POLICY_CACHE_PREFIX}${hash}.json`);
531
+ return join3(tmpdir3(), `${POLICY_CACHE_PREFIX}${hash}.json`);
486
532
  };
487
533
  var modePolicyStampOf = (stampOrVersion) => typeof stampOrVersion === "string" ? { policyVersion: stampOrVersion } : stampOrVersion ?? null;
488
534
  var isPolicyReuseKey = (value) => typeof value === "string" && value.length > 0;
@@ -507,7 +553,7 @@ var isInsideItsReuseWindow = (cached, now) => {
507
553
  };
508
554
  var isReusableWhileItsKeyHolds = (cached, check) => theModeNamesTheKeyOf(cached, check.stamp) && wasCachedByThisClient(cached, check.clientVersion) && isInsideItsReuseWindow(cached, check.now) && wasCachedForSession(cached, check.sessionId) && wasCachedAtVersion(cached, check.stamp?.policyVersion);
509
555
  var isPolicyCacheName = (name) => name.startsWith(POLICY_CACHE_PREFIX) && name.endsWith(".json");
510
- var policyCachePruneStamp = () => join2(tmpdir2(), `pushary-policy-prune-${POLICY_CACHE_FORMAT}-${process.getuid?.() ?? "user"}.stamp`);
556
+ var policyCachePruneStamp = () => join3(tmpdir3(), `pushary-policy-prune-${POLICY_CACHE_FORMAT}-${process.getuid?.() ?? "user"}.stamp`);
511
557
  var POLICY_CACHE_PRUNE_INTERVAL_MS = 60 * 60 * 1e3;
512
558
  var prunedWithinTheInterval = (stampedAtMs, now) => {
513
559
  const elapsed = now - stampedAtMs;
@@ -522,7 +568,7 @@ var claimPolicyCachePrune = (now) => {
522
568
  return true;
523
569
  } catch {
524
570
  try {
525
- writeFileSync2(stamp, "", { flag: "wx", mode: 384 });
571
+ writeFileSync3(stamp, "", { flag: "wx", mode: 384 });
526
572
  return true;
527
573
  } catch {
528
574
  return false;
@@ -532,9 +578,9 @@ var claimPolicyCachePrune = (now) => {
532
578
  var removePolicyCachesTooOldToServe = (now) => {
533
579
  if (!claimPolicyCachePrune(now)) return;
534
580
  try {
535
- for (const name of readdirSync2(tmpdir2())) {
581
+ for (const name of readdirSync2(tmpdir3())) {
536
582
  if (!isPolicyCacheName(name)) continue;
537
- const path = join2(tmpdir2(), name);
583
+ const path = join3(tmpdir3(), name);
538
584
  try {
539
585
  if (now - lstatSync2(path).mtimeMs >= STALE_CACHE_MAX_MS) unlinkSync2(path);
540
586
  } catch {
@@ -545,7 +591,7 @@ var removePolicyCachesTooOldToServe = (now) => {
545
591
  };
546
592
  var writePolicyCache = (path, entry) => {
547
593
  try {
548
- writeFileSync2(path, JSON.stringify(entry), { encoding: "utf-8", mode: 384 });
594
+ writeFileSync3(path, JSON.stringify(entry), { encoding: "utf-8", mode: 384 });
549
595
  } catch {
550
596
  }
551
597
  };
@@ -581,10 +627,10 @@ var readPolicy = async (apiKey, modeStamp, agent, repoAware = false, sessionId,
581
627
  const clientVersion = getPackageVersion();
582
628
  const path = policyCacheFile(apiKey, agent, repoAware, sessionId);
583
629
  const sharedPath = policyCacheFile(apiKey, agent, repoAware);
584
- const firstForThisSession = path !== sharedPath && !existsSync2(path);
630
+ const firstForThisSession = path !== sharedPath && !existsSync3(path);
585
631
  const readPath = firstForThisSession ? sharedPath : path;
586
632
  let staleCache = null;
587
- if (existsSync2(readPath)) {
633
+ if (existsSync3(readPath)) {
588
634
  try {
589
635
  const cached = JSON.parse(readFileSync2(readPath, "utf-8"));
590
636
  if (!isCachedPolicyRead(cached)) throw new Error("Corrupted cache");
@@ -680,13 +726,13 @@ var readCachedPolicy = (apiKey, agent, repoAware = false) => readCachedPolicyCop
680
726
  var MODE_GRACE_MS = 60 * 1e3;
681
727
  var modeStateCacheFile = (apiKey) => {
682
728
  const hash = createHash2("sha256").update(`mode:${apiKey}`).digest("hex").slice(0, 12);
683
- return join2(tmpdir2(), `pushary-mode-${hash}.json`);
729
+ return join3(tmpdir3(), `pushary-mode-${hash}.json`);
684
730
  };
685
731
  var wasFetchedForSession = (cached, sessionId) => (cached.sessionId ?? null) === (sessionId ?? null);
686
732
  var readLastGoodMode = (apiKey) => {
687
733
  try {
688
734
  const path = modeStateCacheFile(apiKey);
689
- if (!existsSync2(path)) return null;
735
+ if (!existsSync3(path)) return null;
690
736
  const parsed = JSON.parse(readFileSync2(path, "utf-8"));
691
737
  if (!parsed || typeof parsed.at !== "number" || !parsed.state) return null;
692
738
  return parsed;
@@ -697,7 +743,7 @@ var readLastGoodMode = (apiKey) => {
697
743
  var writeLastGoodMode = (apiKey, state, sessionId) => {
698
744
  try {
699
745
  const cached = { state, at: Date.now(), ...sessionId ? { sessionId } : {} };
700
- writeFileSync2(modeStateCacheFile(apiKey), JSON.stringify(cached), { encoding: "utf-8", mode: 384 });
746
+ writeFileSync3(modeStateCacheFile(apiKey), JSON.stringify(cached), { encoding: "utf-8", mode: 384 });
701
747
  } catch {
702
748
  }
703
749
  };
@@ -746,6 +792,7 @@ var readModeState = async (apiKey, sessionId, reuseWithinMs, signal) => {
746
792
  });
747
793
  if (!response.ok) {
748
794
  void reportClientError({ kind: "http_status", code: `mode_http_${response.status}` });
795
+ if (responseRejectsCredential(response.status, response.headers)) announceRejectedApiKey(sessionId);
749
796
  return unansweredModeRead(degradedFallback(apiKey, sessionId, response.status === 401 || response.status === 403));
750
797
  }
751
798
  const body = await response.json();
@@ -766,10 +813,10 @@ var fetchLiveModeState = (apiKey, sessionId, signal) => readModeState(apiKey, se
766
813
  var fetchModeOverride = async (apiKey) => (await fetchModeState(apiKey)).mode;
767
814
 
768
815
  // src/usage.ts
769
- import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2, readFileSync as readFileSync3, readSync, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
816
+ import { closeSync as closeSync2, mkdirSync as mkdirSync2, openSync as openSync2, readFileSync as readFileSync3, readSync, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
770
817
  import { createHash as createHash3 } from "crypto";
771
- import { join as join3 } from "path";
772
- import { tmpdir as tmpdir3 } from "os";
818
+ import { join as join4 } from "path";
819
+ import { tmpdir as tmpdir4 } from "os";
773
820
  var READ_CHUNK_BYTES = 1024 * 1024;
774
821
  var priceTable = () => {
775
822
  const raw = process.env.PUSHARY_MODEL_PRICING?.trim();
@@ -782,8 +829,8 @@ var priceTable = () => {
782
829
  return DEFAULT_MODEL_PRICES;
783
830
  };
784
831
  var estimateCostUsd = (usage, model) => estimateMessageCostUsd(usage, model, priceTable());
785
- var stateDir = () => process.env.PUSHARY_USAGE_DIR?.trim() || join3(tmpdir3(), "pushary-usage");
786
- var stateFile = (sessionId) => join3(stateDir(), sessionId.replace(/[^a-zA-Z0-9_-]/g, "_"));
832
+ var stateDir = () => process.env.PUSHARY_USAGE_DIR?.trim() || join4(tmpdir4(), "pushary-usage");
833
+ var stateFile = (sessionId) => join4(stateDir(), sessionId.replace(/[^a-zA-Z0-9_-]/g, "_"));
787
834
  var emptyState = () => ({ offset: 0, tokensIn: 0, tokensOut: 0, costUsd: 0, recentIds: [] });
788
835
  var readState = (path) => {
789
836
  try {
@@ -885,7 +932,7 @@ var readNewUsage = (transcriptPath, sessionId) => {
885
932
  }
886
933
  }
887
934
  mkdirSync2(stateDir(), { recursive: true });
888
- writeFileSync3(path, JSON.stringify(state), "utf-8");
935
+ writeFileSync4(path, JSON.stringify(state), "utf-8");
889
936
  if (state.tokensIn === 0 && state.tokensOut === 0) return null;
890
937
  return {
891
938
  // Identical cursor-range reports share an identity across transport retries.
@@ -913,45 +960,6 @@ var readNewUsage = (transcriptPath, sessionId) => {
913
960
  // src/answer.ts
914
961
  var isDeferAnswer = (value) => value === "defer";
915
962
 
916
- // src/session-notice.ts
917
- import { existsSync as existsSync3, writeFileSync as writeFileSync4 } from "fs";
918
- import { tmpdir as tmpdir4 } from "os";
919
- import { join as join4 } from "path";
920
- var SUBSCRIPTION_REQUIRED_NOTICE_KIND = "subscription-required";
921
- var MALFORMED_API_KEY_NOTICE_KIND = "malformed-key";
922
- var oncePerSession = (kind, sessionId) => {
923
- try {
924
- const key = (sessionId || DEFAULT_SESSION).replace(/[^a-zA-Z0-9_-]/g, "");
925
- const marker = join4(tmpdir4(), `pushary-${kind}-${key}`);
926
- if (existsSync3(marker)) return false;
927
- writeFileSync4(marker, "1", "utf-8");
928
- return true;
929
- } catch {
930
- return false;
931
- }
932
- };
933
- var subscriptionRequiredNotice = (upgradeUrl) => `[pushary] Your Pushary workspace has no active subscription, so approvals stay with your agent. Subscribe: ${upgradeUrl}`;
934
- var announceSubscriptionRequired = (upgradeUrl, sessionId) => {
935
- try {
936
- if (!oncePerSession(SUBSCRIPTION_REQUIRED_NOTICE_KIND, sessionId)) return;
937
- process.stderr.write(`${subscriptionRequiredNotice(upgradeUrl)}
938
- `);
939
- } catch {
940
- return;
941
- }
942
- };
943
- var malformedApiKeyNotice = (message) => `[pushary] Not connected, so your agent runs untouched. ${message}`;
944
- var announceMalformedApiKey = (keyError, sessionId) => {
945
- if (!isMalformedApiKeyError(keyError)) return;
946
- try {
947
- if (!oncePerSession(MALFORMED_API_KEY_NOTICE_KIND, sessionId)) return;
948
- process.stderr.write(`${malformedApiKeyNotice(keyError.message)}
949
- `);
950
- } catch {
951
- return;
952
- }
953
- };
954
-
955
963
  // src/agent-question-ask.ts
956
964
  var ONLY_QUESTION = { index: 0, total: 1 };
957
965
  var STOPPED = { kind: "stopped" };
@@ -2559,7 +2567,9 @@ export {
2559
2567
  phoneDrivenEnv,
2560
2568
  claimThrottle,
2561
2569
  releaseThrottle,
2562
- telemetryOptedOut,
2570
+ oncePerSession,
2571
+ announceSubscriptionRequired,
2572
+ announceMalformedApiKey,
2563
2573
  policyRequestFor,
2564
2574
  getPolicy,
2565
2575
  getPolicyForStandingDenies,
@@ -2570,9 +2580,6 @@ export {
2570
2580
  fetchModeOverride,
2571
2581
  readLastUserPrompt,
2572
2582
  isDeferAnswer,
2573
- oncePerSession,
2574
- announceSubscriptionRequired,
2575
- announceMalformedApiKey,
2576
2583
  outcomeOfFailedAsk,
2577
2584
  storedWaitDeadline,
2578
2585
  askAgentQuestionWhileOpen,
@@ -9,7 +9,7 @@ import {
9
9
  isSetupConnectMode,
10
10
  isValidApiKey,
11
11
  normalizeAgentId
12
- } from "./chunk-4YOLB6H7.js";
12
+ } from "./chunk-GYLIVREZ.js";
13
13
 
14
14
  // src/setup/options.ts
15
15
  var AGENT_CHOICES = SETUP_AGENT_CHOICES;
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-BG4HHB7E.js";
8
8
  import {
9
9
  redactSecretsFromContent
10
- } from "./chunk-4YOLB6H7.js";
10
+ } from "./chunk-GYLIVREZ.js";
11
11
 
12
12
  // src/cli/json.ts
13
13
  var buildEnvelope = (command, version, data, errors = []) => ({
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-OOSDN4AF.js";
3
+ } from "./chunk-S4AQUVX3.js";
4
4
  import {
5
5
  getBaseUrl
6
- } from "./chunk-KCQP7ZDP.js";
6
+ } from "./chunk-5LE7C6Q2.js";
7
7
  import {
8
8
  NetworkError
9
9
  } from "./chunk-CINBAX5G.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-4YOLB6H7.js";
16
+ } from "./chunk-GYLIVREZ.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;
@@ -14,7 +14,7 @@ import {
14
14
  reachVerdict,
15
15
  reachesYou,
16
16
  verifyDelivery
17
- } from "./chunk-2IXNXTLA.js";
17
+ } from "./chunk-V2UGSM45.js";
18
18
  import {
19
19
  describeRevokeAttempt,
20
20
  keyNoLongerAccepted,
@@ -29,20 +29,20 @@ import {
29
29
  isCI,
30
30
  terminalColumns,
31
31
  useColor
32
- } from "./chunk-SSQWDL6Q.js";
32
+ } from "./chunk-TEFLCQO4.js";
33
33
  import {
34
34
  checkApiKey
35
- } from "./chunk-AXIIY75S.js";
35
+ } from "./chunk-NOWWUX5V.js";
36
36
  import {
37
37
  reportedInstallSource
38
- } from "./chunk-B3FN4XL2.js";
38
+ } from "./chunk-47NWTV5K.js";
39
39
  import {
40
40
  NPX_LATEST_COMMAND
41
- } from "./chunk-7SSL355C.js";
41
+ } from "./chunk-WZM7Y5HM.js";
42
42
  import {
43
43
  NO_PAIRING_COMPUTER,
44
44
  PAIR_TTL_SECONDS
45
- } from "./chunk-4YOLB6H7.js";
45
+ } from "./chunk-GYLIVREZ.js";
46
46
 
47
47
  // src/onboarding.ts
48
48
  import qrcodeTerminal from "qrcode-terminal";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isFinalCommandAckRefusal
3
- } from "./chunk-4YOLB6H7.js";
3
+ } from "./chunk-GYLIVREZ.js";
4
4
 
5
5
  // src/command-ack-outcome.ts
6
6
  var SETTLED_ACK = { outcome: "settled" };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-LB474DMC.js";
3
+ } from "./chunk-ZYQHIMZU.js";
4
4
  import {
5
5
  fetchAsCredential
6
- } from "./chunk-HWIXP7UY.js";
6
+ } from "./chunk-SYCNMJ3Z.js";
7
7
  import {
8
8
  malformedApiKeyMessage
9
- } from "./chunk-KCQP7ZDP.js";
9
+ } from "./chunk-5LE7C6Q2.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-7SSL355C.js";
12
+ } from "./chunk-WZM7Y5HM.js";
13
13
 
14
14
  // src/mcp-stdio-bridge.ts
15
15
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-WX6YWZFM.js";
3
+ } from "./chunk-UVO56TVL.js";
4
4
  import {
5
5
  keyPrefix
6
- } from "./chunk-Y2CO2RMJ.js";
6
+ } from "./chunk-47NWTV5K.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-4TRRDGM5.js";
9
+ } from "./chunk-WHFXXV2A.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-PM2NRK6Y.js";
13
13
  import {
14
14
  isRecord,
15
15
  isValidApiKey
16
- } from "./chunk-4YOLB6H7.js";
16
+ } from "./chunk-GYLIVREZ.js";
17
17
 
18
18
  // src/shared-mcp-key.ts
19
19
  var asRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  UNSET_IGNORED_SHELL_VALUE_STEP
3
- } from "./chunk-MQO4F37H.js";
3
+ } from "./chunk-ERE3R6SS.js";
4
4
  import {
5
5
  notificationAnswerStep
6
- } from "./chunk-2IXNXTLA.js";
6
+ } from "./chunk-V2UGSM45.js";
7
7
  import {
8
8
  matchMacAccountStep,
9
9
  retryAgentCommand
10
- } from "./chunk-FSTX5SRV.js";
10
+ } from "./chunk-SYEUQH6Z.js";
11
11
  import {
12
12
  NPX_LATEST_COMMAND,
13
13
  npmExecSetupCommandFor
14
- } from "./chunk-7SSL355C.js";
14
+ } from "./chunk-WZM7Y5HM.js";
15
15
  import {
16
16
  EXIT
17
17
  } from "./chunk-BG4HHB7E.js";
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  compatibleProfileFor,
23
23
  isCompatibleAgentType
24
- } from "./chunk-4YOLB6H7.js";
24
+ } from "./chunk-GYLIVREZ.js";
25
25
 
26
26
  // src/setup/closing.ts
27
27
  var ACTIVITY_URL = "pushary.com/dashboard/agent/activity";
@@ -18,18 +18,18 @@ import {
18
18
  settingSnapshot,
19
19
  writeHermesSetting,
20
20
  writeSetupReceipt
21
- } from "./chunk-TDDX5PAP.js";
21
+ } from "./chunk-XUJBTEUC.js";
22
22
  import {
23
23
  OPENCLAW_MIN_VERSION,
24
24
  OPENCLAW_PLUGIN_ID,
25
25
  OPENCLAW_PLUGIN_PACKAGE
26
- } from "./chunk-7YCRU3HC.js";
26
+ } from "./chunk-UQB4MAA6.js";
27
27
  import {
28
28
  retryAgentCommand
29
- } from "./chunk-FSTX5SRV.js";
29
+ } from "./chunk-SYEUQH6Z.js";
30
30
  import {
31
31
  configFilePath
32
- } from "./chunk-KCQP7ZDP.js";
32
+ } from "./chunk-5LE7C6Q2.js";
33
33
  import {
34
34
  readJsonSafe,
35
35
  writeJsonAtomic
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  readSetupOutcomeProperties,
39
39
  redactSecretsFromContent
40
- } from "./chunk-4YOLB6H7.js";
40
+ } from "./chunk-GYLIVREZ.js";
41
41
 
42
42
  // src/hermes/shell-gate.ts
43
43
  var readHermesShellGate = async (launcher) => {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  readExistingMachineId
3
- } from "./chunk-RQ5DKUF4.js";
3
+ } from "./chunk-4ZSC56SL.js";
4
4
  import {
5
5
  getBaseUrl
6
- } from "./chunk-KCQP7ZDP.js";
6
+ } from "./chunk-5LE7C6Q2.js";
7
7
  import {
8
8
  NetworkError
9
9
  } from "./chunk-CINBAX5G.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  clientContextHeaders,
15
15
  redactSecretsFromContent
16
- } from "./chunk-4YOLB6H7.js";
16
+ } from "./chunk-GYLIVREZ.js";
17
17
 
18
18
  // src/cli/net.ts
19
19
  import { createRequire } from "module";
@@ -2,7 +2,7 @@ import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote,
4
4
  parseGitBranch
5
- } from "./chunk-4YOLB6H7.js";
5
+ } from "./chunk-GYLIVREZ.js";
6
6
 
7
7
  // src/repo.ts
8
8
  import { existsSync, readFileSync, statSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  MCP_CREDENTIAL_REJECTION_BODY,
6
6
  isRecord,
7
7
  responseRejectsCredential
8
- } from "./chunk-4YOLB6H7.js";
8
+ } from "./chunk-GYLIVREZ.js";
9
9
 
10
10
  // src/credential-rejection.ts
11
11
  import { createHash, randomUUID } from "crypto";
@@ -4,16 +4,16 @@ import {
4
4
  NpmMissingError,
5
5
  NpmPermissionError,
6
6
  NpmReleaseAgeError
7
- } from "./chunk-QW7LM6BG.js";
7
+ } from "./chunk-IQBJD5ZB.js";
8
8
  import {
9
9
  writeFileAtomic
10
10
  } from "./chunk-PM2NRK6Y.js";
11
11
  import {
12
12
  NPX_LATEST_COMMAND
13
- } from "./chunk-7SSL355C.js";
13
+ } from "./chunk-WZM7Y5HM.js";
14
14
  import {
15
15
  readSetupAgentFailures
16
- } from "./chunk-4YOLB6H7.js";
16
+ } from "./chunk-GYLIVREZ.js";
17
17
 
18
18
  // src/setup/config-write.ts
19
19
  var AgentConfigWriteError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecretsFromContent
3
- } from "./chunk-4YOLB6H7.js";
3
+ } from "./chunk-GYLIVREZ.js";
4
4
 
5
5
  // src/cli/terminal-row.ts
6
6
  var visibleLength = (text) => text.replace(/\x1b\[[0-9;]*m/g, "").length;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-BWPDGMKS.js";
3
+ } from "./chunk-NA5EQTCV.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-BZIBNSQE.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-CINBAX5G.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-7SSL355C.js";
12
+ } from "./chunk-WZM7Y5HM.js";
13
13
  import {
14
14
  CLAUDE_CONNECTOR_GUIDE,
15
15
  CLAUDE_CONNECTOR_STEPS,
@@ -17,7 +17,7 @@ import {
17
17
  CLAUDE_CONNECTOR_URL,
18
18
  COWORK_CONNECTOR_LIMIT,
19
19
  COWORK_STANDING_INSTRUCTIONS
20
- } from "./chunk-4YOLB6H7.js";
20
+ } from "./chunk-GYLIVREZ.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";