pushary 1.9.141 → 1.9.143

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 (132) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{api-JWLCKSWR.js → api-2YC2KSIM.js} +15 -11
  3. package/dist/bin/pushary-audit.js +3 -3
  4. package/dist/bin/pushary-bell-hook.js +28 -28
  5. package/dist/bin/pushary-bell.js +10 -10
  6. package/dist/bin/pushary-claude.js +43 -32
  7. package/dist/bin/pushary-clean.js +35 -35
  8. package/dist/bin/pushary-codex-bridge.js +23 -23
  9. package/dist/bin/pushary-codex-hook.js +35 -35
  10. package/dist/bin/pushary-codex-session.js +8 -8
  11. package/dist/bin/pushary-codex.js +16 -16
  12. package/dist/bin/pushary-connect.js +29 -29
  13. package/dist/bin/pushary-cowork.js +5 -5
  14. package/dist/bin/pushary-daemon.js +43 -43
  15. package/dist/bin/pushary-disconnect.js +28 -28
  16. package/dist/bin/pushary-doctor.js +43 -43
  17. package/dist/bin/pushary-elicitation-hook.js +28 -28
  18. package/dist/bin/pushary-gemini-bridge.js +17 -17
  19. package/dist/bin/pushary-gemini-hook.js +32 -32
  20. package/dist/bin/pushary-hook.js +35 -35
  21. package/dist/bin/pushary-login.js +21 -21
  22. package/dist/bin/pushary-logout.js +27 -27
  23. package/dist/bin/pushary-mcp.js +12 -12
  24. package/dist/bin/pushary-mode.js +15 -15
  25. package/dist/bin/pushary-notification-hook.js +27 -27
  26. package/dist/bin/pushary-opencode-hook.js +31 -31
  27. package/dist/bin/pushary-permission-denied-hook.js +35 -35
  28. package/dist/bin/pushary-permission-hook.js +35 -35
  29. package/dist/bin/pushary-post-hook.js +28 -28
  30. package/dist/bin/pushary-prompt-hook.js +27 -27
  31. package/dist/bin/pushary-session-end-hook.js +27 -27
  32. package/dist/bin/pushary-session-start-hook.js +36 -36
  33. package/dist/bin/pushary-setup.js +50 -50
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +33 -33
  36. package/dist/bin/pushary-stop-hook.js +27 -27
  37. package/dist/bin/pushary-stopfailure-hook.js +27 -27
  38. package/dist/bin/pushary-suggestions.js +15 -15
  39. package/dist/bin/pushary-transcript-register.js +17 -17
  40. package/dist/bin/pushary-transcripts.js +25 -25
  41. package/dist/bin/pushary-upgrade.js +41 -41
  42. package/dist/bin/pushary-wait.js +15 -15
  43. package/dist/bin/pushary.js +7 -7
  44. package/dist/{chunk-KAYK66B3.js → chunk-22CXL7YI.js} +3 -3
  45. package/dist/{chunk-PY2JHBNC.js → chunk-3VOUWGFF.js} +4 -4
  46. package/dist/{chunk-5DMGHDOT.js → chunk-3WZMIDGX.js} +5 -5
  47. package/dist/{chunk-F335PCA4.js → chunk-42DRRA6N.js} +1 -1
  48. package/dist/{chunk-UJ2WT54H.js → chunk-44Z6MQZ2.js} +3 -3
  49. package/dist/{chunk-PDES33BK.js → chunk-4EBJ4PTZ.js} +1 -1
  50. package/dist/{chunk-ACG7RC7N.js → chunk-4JTZZXB3.js} +3 -3
  51. package/dist/{chunk-3YV26XPH.js → chunk-4OX4SJGA.js} +3 -3
  52. package/dist/{chunk-MW6MPOQZ.js → chunk-4YH326C5.js} +6 -6
  53. package/dist/{chunk-XYRPLFMD.js → chunk-4Z7YVVKQ.js} +1 -1
  54. package/dist/{chunk-CAUSBRTJ.js → chunk-53KLGXFL.js} +1 -1
  55. package/dist/{chunk-LCYHJQGQ.js → chunk-5RSM5DRT.js} +5 -5
  56. package/dist/{chunk-HEXX52SX.js → chunk-5TZYAMGW.js} +1 -1
  57. package/dist/{chunk-4JR6PPIY.js → chunk-6JLANX5L.js} +4 -4
  58. package/dist/{chunk-BFXIQGWS.js → chunk-7QWH257P.js} +1 -1
  59. package/dist/{chunk-NDAJSNIZ.js → chunk-7VMVMC4H.js} +1 -1
  60. package/dist/{chunk-RQCKUCWK.js → chunk-B4VIT5N3.js} +1 -1
  61. package/dist/{chunk-OR47JOLE.js → chunk-BHKODM4L.js} +2 -2
  62. package/dist/{chunk-A6KNDKO5.js → chunk-C5LIS3XM.js} +20 -2
  63. package/dist/{chunk-3RBUCAO7.js → chunk-CNURORKI.js} +46 -11
  64. package/dist/{chunk-GA72NGS7.js → chunk-DDJHPMBJ.js} +1 -1
  65. package/dist/{chunk-FOPV3VQD.js → chunk-DOXH5BV4.js} +4 -4
  66. package/dist/{chunk-I72H3AWD.js → chunk-DU4KCXC2.js} +3 -3
  67. package/dist/{chunk-62V26PAL.js → chunk-DZLLKJJT.js} +3 -3
  68. package/dist/{chunk-3MMOB5TM.js → chunk-EGUT2MWV.js} +3 -3
  69. package/dist/{chunk-JBQFVXDK.js → chunk-EMODTMHE.js} +1 -1
  70. package/dist/{chunk-D35XQMWO.js → chunk-FS47XZCE.js} +2 -2
  71. package/dist/{chunk-UOKA4ENY.js → chunk-FYB6HBHQ.js} +2 -2
  72. package/dist/{chunk-O2CW5IFD.js → chunk-G3G7DWR3.js} +11 -11
  73. package/dist/{chunk-I547BHSE.js → chunk-G7G2ZPT4.js} +4 -4
  74. package/dist/{chunk-Q6EK2GDR.js → chunk-H33CFJOF.js} +4 -4
  75. package/dist/{chunk-QVXNSVBS.js → chunk-HIIXYZYV.js} +3 -3
  76. package/dist/{chunk-7TKF7IFS.js → chunk-HLWS6ADK.js} +2 -2
  77. package/dist/{chunk-PD5LSNEK.js → chunk-I6HXZIER.js} +2 -2
  78. package/dist/{chunk-GGXAZTSW.js → chunk-IG7NGXBS.js} +2 -2
  79. package/dist/{chunk-3PALTBFX.js → chunk-K7MVCPH5.js} +4 -4
  80. package/dist/{chunk-TIX4DZ2J.js → chunk-KP6FVUCC.js} +3 -3
  81. package/dist/{chunk-IR7J5WY4.js → chunk-KRSZFHNS.js} +3 -3
  82. package/dist/{chunk-VTT3WV4C.js → chunk-LS6BU5RM.js} +1 -1
  83. package/dist/{chunk-3MFJDZ2L.js → chunk-LTPKSJWY.js} +10 -10
  84. package/dist/{chunk-24BLJAQN.js → chunk-LUVSHGLH.js} +1 -1
  85. package/dist/{chunk-4ZTPPMLM.js → chunk-LWQLM3AO.js} +4 -4
  86. package/dist/{chunk-ALJL6GDD.js → chunk-MH5BRZOQ.js} +1 -1
  87. package/dist/{chunk-VR6VWNLQ.js → chunk-MLOYBLO4.js} +4 -4
  88. package/dist/{chunk-NFXWQDZ6.js → chunk-MMS7R3VO.js} +2 -2
  89. package/dist/{chunk-CUJ2MGG5.js → chunk-MOYEHNFP.js} +2 -2
  90. package/dist/{chunk-YKL7VBKJ.js → chunk-MQF6MQMR.js} +5 -5
  91. package/dist/{chunk-4Y2LO2WB.js → chunk-NOTW7GOC.js} +2 -2
  92. package/dist/{chunk-Q4XW5FWF.js → chunk-NQF652IG.js} +2 -2
  93. package/dist/{chunk-PHSPXFAY.js → chunk-NZHRH4RR.js} +5 -5
  94. package/dist/{chunk-C4VTURGH.js → chunk-P5QXH5QI.js} +1 -1
  95. package/dist/{chunk-XYFKYZCQ.js → chunk-PYSDCPZ3.js} +6 -6
  96. package/dist/{chunk-CWCJFCAY.js → chunk-QESEICW4.js} +1 -1
  97. package/dist/{chunk-FKKS4ZC5.js → chunk-QFZNPZRO.js} +3 -3
  98. package/dist/{chunk-ME2ZKG6Y.js → chunk-QGJK3NAR.js} +12 -12
  99. package/dist/{chunk-MQJEDVTH.js → chunk-QLGLUUOP.js} +1 -1
  100. package/dist/{chunk-J3NMHMG7.js → chunk-QQHUUPPW.js} +2 -2
  101. package/dist/{chunk-UQ352C7S.js → chunk-R27HXRSK.js} +3 -3
  102. package/dist/{chunk-BKWDG5QV.js → chunk-R7FSMUHG.js} +1 -1
  103. package/dist/{chunk-RO36S2KY.js → chunk-SMF4TBPU.js} +5 -5
  104. package/dist/{chunk-4KHBN7LI.js → chunk-SYZF5SDG.js} +5 -5
  105. package/dist/{chunk-AIZ5KC2N.js → chunk-TKFNIDZK.js} +2 -2
  106. package/dist/{chunk-XBPBYSNM.js → chunk-UIZE4YMU.js} +2 -2
  107. package/dist/{chunk-ARIJUXCG.js → chunk-UJETZZG5.js} +8 -8
  108. package/dist/{chunk-GX46NBAE.js → chunk-USNGPJXF.js} +8 -8
  109. package/dist/{chunk-EADQYNLU.js → chunk-V53QYJNY.js} +15 -6
  110. package/dist/{chunk-CL3OIICA.js → chunk-V7CS72Q5.js} +6 -6
  111. package/dist/{chunk-ZE56WMFL.js → chunk-WSKBXADV.js} +4 -4
  112. package/dist/{chunk-7EYUDJQ6.js → chunk-X2MC2CF3.js} +16 -16
  113. package/dist/{chunk-VBYWBGIJ.js → chunk-XWYCFODT.js} +3 -3
  114. package/dist/{chunk-6DAXKHVX.js → chunk-YCU7Y77H.js} +1 -1
  115. package/dist/{chunk-CVGVWUNE.js → chunk-ZDOTNMGL.js} +5 -5
  116. package/dist/{chunk-PNKFGNJF.js → chunk-ZF4CPOO7.js} +6 -6
  117. package/dist/{chunk-QNEF5JII.js → chunk-ZKKZEVNI.js} +2 -2
  118. package/dist/{chunk-J2ELAXGI.js → chunk-ZVJIJPQY.js} +1 -1
  119. package/dist/{codex-app-cards-switch-NRAMENRL.js → codex-app-cards-switch-EGUHSLTG.js} +11 -11
  120. package/dist/{codex-card-routing-D7ARIQKL.js → codex-card-routing-I6YOJBTT.js} +2 -2
  121. package/dist/{codex-desktop-launch-2X4UEMRL.js → codex-desktop-launch-6UN5CWCX.js} +1 -1
  122. package/dist/{codex-session-launch-FY5QIZSI.js → codex-session-launch-7R3HNIDJ.js} +20 -20
  123. package/dist/{config-NDOIVL6S.js → config-2CHOLFNB.js} +3 -3
  124. package/dist/{global-upgrade-MS3WGHEP.js → global-upgrade-CCVIYELF.js} +9 -9
  125. package/dist/{identity-VXA3TZ7U.js → identity-7QA3EDOM.js} +4 -4
  126. package/dist/{live-capabilities-2LCBHUWN.js → live-capabilities-SDMX6CPZ.js} +4 -4
  127. package/dist/{paths-HOCSWOBY.js → paths-ZC6XY73Q.js} +3 -3
  128. package/dist/{reapply-VYMO3QM6.js → reapply-W6AIK5PH.js} +29 -29
  129. package/dist/src/index.js +34 -34
  130. package/dist/{upgrade-lock-XH5AQIOD.js → upgrade-lock-BRVUBSLD.js} +4 -4
  131. package/dist/{usage-EVX6CH5H.js → usage-GWUTCS5A.js} +3 -3
  132. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  addGeminiMcpServer,
3
3
  removeGeminiMcpServer
4
- } from "./chunk-PY2JHBNC.js";
4
+ } from "./chunk-3VOUWGFF.js";
5
5
  import {
6
6
  CLAUDE_CODE_AGENT
7
- } from "./chunk-ME2ZKG6Y.js";
7
+ } from "./chunk-QGJK3NAR.js";
8
8
  import {
9
9
  compatibleToolLookup
10
- } from "./chunk-BFXIQGWS.js";
10
+ } from "./chunk-7QWH257P.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-GGXAZTSW.js";
22
+ } from "./chunk-IG7NGXBS.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-A6KNDKO5.js";
33
+ } from "./chunk-C5LIS3XM.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-A6KNDKO5.js";
3
+ } from "./chunk-C5LIS3XM.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  pusharyHookExecutable
3
- } from "./chunk-PY2JHBNC.js";
3
+ } from "./chunk-3VOUWGFF.js";
4
4
  import {
5
5
  bridgeResolvesToApp,
6
6
  cursorUserHooks,
7
7
  executableFileName,
8
8
  isBridgeLocator,
9
9
  liveBridgeProbe
10
- } from "./chunk-GGXAZTSW.js";
10
+ } from "./chunk-IG7NGXBS.js";
11
11
  import {
12
12
  atLeast,
13
13
  parseVersion
14
- } from "./chunk-FKKS4ZC5.js";
14
+ } from "./chunk-QFZNPZRO.js";
15
15
  import {
16
16
  CURSOR_GATE_COVERAGE,
17
17
  CURSOR_GATE_SCRIPT,
@@ -21,7 +21,7 @@ import {
21
21
  isCursorHookPayload,
22
22
  isRecord,
23
23
  toolsCoveredByGateEntry
24
- } from "./chunk-A6KNDKO5.js";
24
+ } from "./chunk-C5LIS3XM.js";
25
25
 
26
26
  // src/cursor-gate-registration.ts
27
27
  import { dirname, isAbsolute, join, resolve } from "path";
@@ -25,7 +25,7 @@ import {
25
25
  reportableSessionId,
26
26
  toToolLookup,
27
27
  truncateLine
28
- } from "./chunk-A6KNDKO5.js";
28
+ } from "./chunk-C5LIS3XM.js";
29
29
 
30
30
  // ../hook-mapping/src/commit-receipt.ts
31
31
  var COMMIT_OUTPUT_MAX_LENGTH = 65536;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTranscriptPreference
3
- } from "./chunk-QVXNSVBS.js";
3
+ } from "./chunk-HIIXYZYV.js";
4
4
 
5
5
  // src/transcript-setting.ts
6
6
  var transcriptEnvironmentPreference = () => {
@@ -7,7 +7,7 @@ import {
7
7
  recordSealerFor,
8
8
  uploadTranscriptRecords,
9
9
  wrapSessionKey
10
- } from "./chunk-KAYK66B3.js";
10
+ } from "./chunk-22CXL7YI.js";
11
11
 
12
12
  // src/live-session.ts
13
13
  var LIVE_TRANSCRIPT_LIMITS = { queuedRecords: 100, recordCharacters: 32 * 1024 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-PDES33BK.js";
3
+ } from "./chunk-4EBJ4PTZ.js";
4
4
  import {
5
5
  normalizeInstallSource
6
- } from "./chunk-A6KNDKO5.js";
6
+ } from "./chunk-C5LIS3XM.js";
7
7
 
8
8
  // src/install-source.ts
9
9
  import { readFileSync } from "fs";
@@ -8709,6 +8709,7 @@ var ANSWER_SOURCES = [
8709
8709
  "inbox",
8710
8710
  "slack",
8711
8711
  "mac_app",
8712
+ "voice_call",
8712
8713
  // Nobody. A decision opened on a workspace's sandbox site is settled by the
8713
8714
  // simulator instead of being delivered, and the ledger has to say so: a
8714
8715
  // sandbox row that looked like a human answer would be indistinguishable
@@ -8795,6 +8796,7 @@ var CAPABILITY_PATTERNS = {
8795
8796
  "Bash(mkfs:*)"
8796
8797
  ]
8797
8798
  };
8799
+ var MAX_PUSH_WINDOW_SECONDS = 300;
8798
8800
  var DECISION_EPISODE_SCHEMA_VERSION = 1;
8799
8801
  var DECISION_FEATURE_EXTRACTOR = `pushary-hooks/schema-${DECISION_EPISODE_SCHEMA_VERSION}`;
8800
8802
  var DECISION_ORIGIN = {
@@ -9424,7 +9426,10 @@ var gateVerdictUnderOneArrowReading = (rawInput) => {
9424
9426
  scopePath: scopeReason && "path" in scopeVerdict ? widenablePath(scopeVerdict.path) : void 0
9425
9427
  };
9426
9428
  };
9427
- var resolveGate = (rawInput) => underEachArrowReading(() => gateVerdictUnderOneArrowReading(rawInput)).reduce(strictestGateVerdictOf);
9429
+ var resolveGate = (rawInput) => {
9430
+ const verdict = underEachArrowReading(() => gateVerdictUnderOneArrowReading(rawInput)).reduce(strictestGateVerdictOf);
9431
+ return verdict.kind === "gate" ? { ...verdict, policy: withApprovalRouteWait(rawInput, verdict.policy) } : verdict;
9432
+ };
9428
9433
  var noModeOverrideIsActive = (input) => (input.modeState.mode ?? input.config.modeOverride ?? null) === null;
9429
9434
  var editAsksAtTheAgentsPrompt = (input, verdict) => verdict.kind === "gate" && !verdict.scopeReason && noModeOverrideIsActive(input) && !aChosenRuleGoverns(input) && verdict.policy.mode === "push_first" && FILE_EDIT_TOOLS.has(input.toolName);
9430
9435
  var claudePromptsBeforeAnEdit = (permissionMode) => permissionMode === "default";
@@ -9534,7 +9539,11 @@ var agentRulesAllowEveryInput = (rules, toolName, toolInputs, cwd) => rules.allo
9534
9539
  return allowRulesGrant(rules.allow, toolName, args) && !anyRuleRestrictsReading(rules.ask, toolName, reading) && !anyRuleRestrictsReading(rules.deny, toolName, reading) && !inputNeedsAPerson(toolName, toolInput);
9535
9540
  });
9536
9541
  var isDefaultRule = (policy) => policy.origin === "builtin" || policy.tool === WILDCARD_TOOL_PATTERN;
9537
- var isApprovalRoutePattern = (value) => typeof value === "object" && value !== null && typeof value.toolPattern === "string" && ["string", "undefined"].includes(typeof value.repoKey) && ["boolean", "undefined"].includes(typeof value.answeredBySomeoneElse);
9542
+ var isValidRouteWait = (value) => {
9543
+ if (!("minimumPushWaitSeconds" in value) || value.minimumPushWaitSeconds === void 0) return true;
9544
+ return typeof value.minimumPushWaitSeconds === "number" && Number.isInteger(value.minimumPushWaitSeconds) && value.minimumPushWaitSeconds >= 0 && value.minimumPushWaitSeconds <= MAX_PUSH_WINDOW_SECONDS;
9545
+ };
9546
+ var isApprovalRoutePattern = (value) => typeof value === "object" && value !== null && typeof value.toolPattern === "string" && ["string", "undefined"].includes(typeof value.repoKey) && ["boolean", "undefined"].includes(typeof value.answeredBySomeoneElse) && isValidRouteWait(value);
9538
9547
  var approvalRoutesOf = (config) => {
9539
9548
  const routes = config.approvalRoutes ?? [];
9540
9549
  return Array.isArray(routes) && routes.every(isApprovalRoutePattern) ? routes : null;
@@ -9701,6 +9710,15 @@ var routesMatchedUnderOneArrowReading = (input) => {
9701
9710
  if (routes === null) return [];
9702
9711
  return withExtraReadings(input).toolInputs.flatMap((toolInput) => routeDeliveredFor(input, routes, toolInput) ?? []);
9703
9712
  };
9713
+ var withApprovalRouteWait = (input, policy) => {
9714
+ if (verdictForPolicy(policy) !== "requires_human" || policy.timeoutAction === "approve") return policy;
9715
+ const routes = underEachArrowReading(() => routesMatchedUnderOneArrowReading(input)).flat();
9716
+ const minimum = Math.max(0, ...routes.map((route) => route.minimumPushWaitSeconds ?? 0));
9717
+ if (minimum === 0) return policy;
9718
+ if (policy.mode === "push_first") return { ...policy, pushFirstSeconds: Math.max(policy.pushFirstSeconds, minimum) };
9719
+ if (policy.mode === "push_only" && policy.timeoutAction !== "wait") return { ...policy, timeoutSeconds: Math.max(policy.timeoutSeconds, minimum) };
9720
+ return policy;
9721
+ };
9704
9722
  var matchedRouteOf = (input) => {
9705
9723
  const route = firstRouteHeldForSomeoneElseOrFirstOf(underEachArrowReading(() => routesMatchedUnderOneArrowReading(input)).flat());
9706
9724
  if (route === void 0) return void 0;
@@ -3,24 +3,26 @@ import {
3
3
  isDisabledByEnv
4
4
  } from "./chunk-POFBE6ZY.js";
5
5
  import {
6
+ McpHttpError,
6
7
  McpToolError,
7
8
  SubscriptionRequiredError,
8
- callMcpTool
9
- } from "./chunk-EADQYNLU.js";
9
+ callMcpTool,
10
+ isRetryable
11
+ } from "./chunk-V53QYJNY.js";
10
12
  import {
11
13
  installNetworkDefaults,
12
14
  isNetworkFailure
13
- } from "./chunk-3YV26XPH.js";
15
+ } from "./chunk-4OX4SJGA.js";
14
16
  import {
15
17
  fetchAsCredential
16
- } from "./chunk-6DAXKHVX.js";
18
+ } from "./chunk-YCU7Y77H.js";
17
19
  import {
18
20
  clientReportClaims
19
- } from "./chunk-GGXAZTSW.js";
21
+ } from "./chunk-IG7NGXBS.js";
20
22
  import {
21
23
  getApiKey,
22
24
  getBaseUrl
23
- } from "./chunk-PDES33BK.js";
25
+ } from "./chunk-4EBJ4PTZ.js";
24
26
  import {
25
27
  ASK_AGENT_NAME_MAX,
26
28
  CLIENT_REPORT_PATH,
@@ -29,7 +31,7 @@ import {
29
31
  TOOL_FAILURE_CODES,
30
32
  degradedLine,
31
33
  truncateLine
32
- } from "./chunk-A6KNDKO5.js";
34
+ } from "./chunk-C5LIS3XM.js";
33
35
 
34
36
  // src/api.ts
35
37
  import { randomUUID } from "crypto";
@@ -239,6 +241,31 @@ var nextLongPollMs = (deadlineMs, nowMs) => {
239
241
  return hold >= MIN_LONG_POLL_MS ? hold : null;
240
242
  };
241
243
  var ABANDONED_WAIT = { answered: false, status: "abandoned" };
244
+ var PASSING_CLIENT_ERRORS = /* @__PURE__ */ new Set([408, 429]);
245
+ var FIRST_SERVER_ERROR = 500;
246
+ var MAX_WAIT_RETRY_PAUSE_MS = 15e3;
247
+ var isPassingHttpStatus = (status) => status >= FIRST_SERVER_ERROR || PASSING_CLIENT_ERRORS.has(status);
248
+ var DROPPED_CONNECTION_CODES = /* @__PURE__ */ new Set(["UND_ERR_SOCKET", "UND_ERR_CLOSED", "ECONNRESET", "EPIPE"]);
249
+ var DROPPED_RESPONSE_MESSAGE = "terminated";
250
+ var causeCodeOf = (error) => {
251
+ const { cause } = error;
252
+ return typeof cause === "object" && cause !== null && "code" in cause && typeof cause.code === "string" ? cause.code : null;
253
+ };
254
+ var isDroppedConnection = (error) => {
255
+ if (!(error instanceof Error)) return false;
256
+ const code = causeCodeOf(error);
257
+ return error.message === DROPPED_RESPONSE_MESSAGE || code !== null && DROPPED_CONNECTION_CODES.has(code);
258
+ };
259
+ var isTransientWaitFailure = (error) => {
260
+ if (error instanceof McpHttpError) return isPassingHttpStatus(error.status);
261
+ if (error instanceof SubscriptionRequiredError || error instanceof McpToolError) return false;
262
+ return isRetryable(error) || isDroppedConnection(error);
263
+ };
264
+ var waitRetryPauseMs = (failures, pollInterval) => Math.min(pollInterval * 2 ** Math.max(0, failures - 1), MAX_WAIT_RETRY_PAUSE_MS);
265
+ var withdrawAfterAFailedPoll = async (apiKey, correlationId) => {
266
+ const late = await withdrawQuestion(apiKey, correlationId);
267
+ return late.answered ? late : STOPPED;
268
+ };
242
269
  var sleepUnlessAborted = (ms, signal) => new Promise((resolve) => {
243
270
  const wake = () => {
244
271
  clearTimeout(timer);
@@ -250,6 +277,8 @@ var sleepUnlessAborted = (ms, signal) => new Promise((resolve) => {
250
277
  });
251
278
  var boundedBy = (timeoutMs, signal) => signal ? AbortSignal.any([AbortSignal.timeout(timeoutMs), signal]) : AbortSignal.timeout(timeoutMs);
252
279
  var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3, signal) => {
280
+ let failures = 0;
281
+ let waitedThroughAnOutage = false;
253
282
  while (Date.now() < deadlineMs) {
254
283
  if (signal?.aborted) return ABANDONED_WAIT;
255
284
  const hold = nextLongPollMs(deadlineMs, Date.now());
@@ -260,17 +289,21 @@ var pollForAnswer = async (apiKey, correlationId, deadlineMs, pollInterval = 2e3
260
289
  let answer;
261
290
  try {
262
291
  answer = await waitForAnswer(apiKey, correlationId, hold, boundedBy(Math.max(1, deadlineMs - Date.now()), signal));
263
- } catch {
292
+ } catch (error) {
264
293
  if (signal?.aborted) return ABANDONED_WAIT;
265
- const late = await withdrawQuestion(apiKey, correlationId);
266
- return late.answered ? late : STOPPED;
294
+ if (!isTransientWaitFailure(error)) return withdrawAfterAFailedPoll(apiKey, correlationId);
295
+ failures += 1;
296
+ waitedThroughAnOutage = true;
297
+ await sleepUnlessAborted(Math.min(waitRetryPauseMs(failures, pollInterval), Math.max(0, deadlineMs - Date.now())), signal);
298
+ continue;
267
299
  }
300
+ failures = 0;
268
301
  if (isDecisionStopped(answer) || answer.answered) return answer;
269
302
  if (answer.status === "expired") return STOPPED;
270
303
  await sleepUnlessAborted(Math.min(pollInterval, Math.max(0, deadlineMs - Date.now())), signal);
271
304
  }
272
305
  if (signal?.aborted) return ABANDONED_WAIT;
273
- return withdrawQuestion(apiKey, correlationId);
306
+ return waitedThroughAnOutage ? withdrawAfterAFailedPoll(apiKey, correlationId) : withdrawQuestion(apiKey, correlationId);
274
307
  };
275
308
  var cancelQuestion = async (apiKey, correlationId, signal, baseUrl) => {
276
309
  return callMcpTool(apiKey, "cancel_question", { correlationId }, { signal, timeoutMs: 4e3, maxRetries: 1, baseUrl });
@@ -345,6 +378,8 @@ export {
345
378
  WAIT_RESPONSE_GRACE_MS,
346
379
  nextLongPollMs,
347
380
  ABANDONED_WAIT,
381
+ isTransientWaitFailure,
382
+ waitRetryPauseMs,
348
383
  pollForAnswer,
349
384
  cancelQuestion,
350
385
  withdrawQuestion,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  RETRY_ACK,
6
6
  refusedReceiptMessage
7
- } from "./chunk-J2ELAXGI.js";
7
+ } from "./chunk-ZVJIJPQY.js";
8
8
 
9
9
  // src/command-receipts.ts
10
10
  import { randomUUID } from "crypto";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-LCYHJQGQ.js";
4
+ } from "./chunk-5RSM5DRT.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-PY2JHBNC.js";
7
+ } from "./chunk-3VOUWGFF.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-GGXAZTSW.js";
11
+ } from "./chunk-IG7NGXBS.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-A6KNDKO5.js";
14
+ } from "./chunk-C5LIS3XM.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -4,15 +4,15 @@ import {
4
4
  claimThrottle,
5
5
  releaseThrottle,
6
6
  reportEvent
7
- } from "./chunk-ME2ZKG6Y.js";
7
+ } from "./chunk-QGJK3NAR.js";
8
8
  import {
9
9
  deriveToolTarget,
10
10
  permissionDeniedAction
11
- } from "./chunk-BFXIQGWS.js";
11
+ } from "./chunk-7QWH257P.js";
12
12
  import {
13
13
  machineDecisionFor,
14
14
  wireVerdictFor
15
- } from "./chunk-A6KNDKO5.js";
15
+ } from "./chunk-C5LIS3XM.js";
16
16
 
17
17
  // src/machine-decision-audit.ts
18
18
  import { basename } from "path";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  pusharyFetch
3
- } from "./chunk-3YV26XPH.js";
3
+ } from "./chunk-4OX4SJGA.js";
4
4
  import {
5
5
  NetworkError
6
6
  } from "./chunk-YU2EUD7O.js";
7
7
  import {
8
8
  getBaseUrl
9
- } from "./chunk-PDES33BK.js";
9
+ } from "./chunk-4EBJ4PTZ.js";
10
10
  import {
11
11
  EXIT
12
12
  } from "./chunk-BG4HHB7E.js";
13
13
  import {
14
14
  isValidApiKey,
15
15
  normalizeKeyScope
16
- } from "./chunk-A6KNDKO5.js";
16
+ } from "./chunk-C5LIS3XM.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;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  parseSseMessages
3
- } from "./chunk-EADQYNLU.js";
3
+ } from "./chunk-V53QYJNY.js";
4
4
  import {
5
5
  fetchAsCredential
6
- } from "./chunk-6DAXKHVX.js";
6
+ } from "./chunk-YCU7Y77H.js";
7
7
  import {
8
8
  NPX_LATEST_COMMAND
9
- } from "./chunk-BKWDG5QV.js";
9
+ } from "./chunk-R7FSMUHG.js";
10
10
 
11
11
  // src/mcp-stdio-bridge.ts
12
12
  var MCP_BRIDGE_BINARY = "pushary-mcp";
@@ -2,7 +2,7 @@ import {
2
2
  localRepoKey,
3
3
  normalizeRepoRemote,
4
4
  parseGitBranch
5
- } from "./chunk-A6KNDKO5.js";
5
+ } from "./chunk-C5LIS3XM.js";
6
6
 
7
7
  // src/repo.ts
8
8
  import { existsSync, readFileSync, statSync } from "fs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  claudeConfigDir
3
- } from "./chunk-GGXAZTSW.js";
3
+ } from "./chunk-IG7NGXBS.js";
4
4
  import {
5
5
  claudePermissionRulesFromSettings
6
- } from "./chunk-A6KNDKO5.js";
6
+ } from "./chunk-C5LIS3XM.js";
7
7
 
8
8
  // src/claude-permission-rules.ts
9
9
  import { readFileSync, statSync } from "fs";
@@ -9,13 +9,13 @@ import {
9
9
  installedCodexApp,
10
10
  readCodexAppRuntime,
11
11
  shellQuoted
12
- } from "./chunk-UJ2WT54H.js";
12
+ } from "./chunk-44Z6MQZ2.js";
13
13
  import {
14
14
  writeHuman
15
15
  } from "./chunk-QCGNGEGE.js";
16
16
  import {
17
17
  xml
18
- } from "./chunk-PNKFGNJF.js";
18
+ } from "./chunk-ZF4CPOO7.js";
19
19
  import {
20
20
  writeFileAtomic
21
21
  } from "./chunk-TODDEIYG.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ensureCodexTrustsPusharyHooks
3
- } from "./chunk-7TKF7IFS.js";
3
+ } from "./chunk-HLWS6ADK.js";
4
4
  import {
5
5
  hermesReceiptPaths,
6
6
  hermesSetupPredatesThePluginFolder,
7
7
  installHermesPlugin,
8
8
  refreshHermesPluginFiles,
9
9
  shippedHermesPlugin
10
- } from "./chunk-TIX4DZ2J.js";
10
+ } from "./chunk-KP6FVUCC.js";
11
11
  import {
12
12
  fxIgnoresInstructionsFile,
13
13
  fxInstructionsBody,
@@ -16,7 +16,7 @@ import {
16
16
  macAppFxBridge,
17
17
  refreshClineKey,
18
18
  switchFxHttpEntryToBridge
19
- } from "./chunk-CVGVWUNE.js";
19
+ } from "./chunk-ZDOTNMGL.js";
20
20
  import {
21
21
  OPENCODE_HOOK_BINARY,
22
22
  agentHookOwner,
@@ -28,16 +28,16 @@ import {
28
28
  openCodePluginDir,
29
29
  openCodeWired,
30
30
  withOpenCodeAskRules
31
- } from "./chunk-4KHBN7LI.js";
31
+ } from "./chunk-SYZF5SDG.js";
32
32
  import {
33
33
  detectClaudeVersion
34
- } from "./chunk-XBPBYSNM.js";
34
+ } from "./chunk-UIZE4YMU.js";
35
35
  import {
36
36
  addCompatibleHooks,
37
37
  compatibleConfigFile,
38
38
  compatibleInstructionsFile,
39
39
  hasCompatibleHooks
40
- } from "./chunk-LCYHJQGQ.js";
40
+ } from "./chunk-5RSM5DRT.js";
41
41
  import {
42
42
  GEMINI_HOOK_BINARY,
43
43
  addGeminiHooks,
@@ -49,10 +49,10 @@ import {
49
49
  geminiWired,
50
50
  hasGeminiHooks,
51
51
  planHooks
52
- } from "./chunk-PY2JHBNC.js";
52
+ } from "./chunk-3VOUWGFF.js";
53
53
  import {
54
54
  KEY_FILE_MODE
55
- } from "./chunk-QVXNSVBS.js";
55
+ } from "./chunk-HIIXYZYV.js";
56
56
  import {
57
57
  CLAUDE_HOOK_BINARY,
58
58
  CLAUDE_HOOK_EVENTS,
@@ -99,13 +99,13 @@ import {
99
99
  renderAgentInstructions,
100
100
  supportedClaudeEvents,
101
101
  vscodePluginMcp
102
- } from "./chunk-GGXAZTSW.js";
102
+ } from "./chunk-IG7NGXBS.js";
103
103
  import {
104
104
  formatVersion,
105
105
  hookCommandsUseBareNames,
106
106
  resolveGlobalBinDir,
107
107
  resolveGlobalBinary
108
- } from "./chunk-FKKS4ZC5.js";
108
+ } from "./chunk-QFZNPZRO.js";
109
109
  import {
110
110
  readJsonSafe,
111
111
  writeFileAtomic,
@@ -115,7 +115,7 @@ import {
115
115
  HOOK_COMPATIBLE_PROFILES,
116
116
  isCompatibleAgentType,
117
117
  isRecord
118
- } from "./chunk-A6KNDKO5.js";
118
+ } from "./chunk-C5LIS3XM.js";
119
119
 
120
120
  // src/reapply.ts
121
121
  import { dirname, join } from "path";
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-4KHBN7LI.js";
3
+ } from "./chunk-SYZF5SDG.js";
4
4
  import {
5
5
  nativeClaudeInstallPath
6
6
  } from "./chunk-CYTPQDQY.js";
7
7
  import {
8
8
  grokHome
9
- } from "./chunk-LCYHJQGQ.js";
9
+ } from "./chunk-5RSM5DRT.js";
10
10
  import {
11
11
  claudeConfigDir,
12
12
  clineDataDirectory,
13
13
  codexHomeFrom
14
- } from "./chunk-GGXAZTSW.js";
14
+ } from "./chunk-IG7NGXBS.js";
15
15
  import {
16
16
  HOOK_COMPATIBLE_PROFILES
17
- } from "./chunk-A6KNDKO5.js";
17
+ } from "./chunk-C5LIS3XM.js";
18
18
 
19
19
  // src/vscode-config.ts
20
20
  import { homedir } from "os";
@@ -13,16 +13,16 @@ import {
13
13
  } from "./chunk-G66WIAST.js";
14
14
  import {
15
15
  keyPrefix
16
- } from "./chunk-QVXNSVBS.js";
16
+ } from "./chunk-HIIXYZYV.js";
17
17
  import {
18
18
  getBaseUrl
19
- } from "./chunk-PDES33BK.js";
19
+ } from "./chunk-4EBJ4PTZ.js";
20
20
  import {
21
21
  NPX_LATEST_COMMAND
22
- } from "./chunk-BKWDG5QV.js";
22
+ } from "./chunk-R7FSMUHG.js";
23
23
  import {
24
24
  isValidApiKey
25
- } from "./chunk-A6KNDKO5.js";
25
+ } from "./chunk-C5LIS3XM.js";
26
26
 
27
27
  // src/cli/login-ui.ts
28
28
  import { hostname } from "os";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveInstallSourceFor
3
- } from "./chunk-OR47JOLE.js";
3
+ } from "./chunk-BHKODM4L.js";
4
4
  import {
5
5
  configFilePath
6
- } from "./chunk-PDES33BK.js";
6
+ } from "./chunk-4EBJ4PTZ.js";
7
7
  import {
8
8
  backupFile,
9
9
  readJsonSafe,
@@ -14,7 +14,7 @@ import {
14
14
  API_KEY_PREFIX_PATTERN,
15
15
  isRecord,
16
16
  isValidApiKey
17
- } from "./chunk-A6KNDKO5.js";
17
+ } from "./chunk-C5LIS3XM.js";
18
18
 
19
19
  // src/shell-alias.ts
20
20
  import { homedir } from "os";
@@ -7,10 +7,10 @@ import {
7
7
  codexHome,
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand
10
- } from "./chunk-GGXAZTSW.js";
10
+ } from "./chunk-IG7NGXBS.js";
11
11
  import {
12
12
  resolvePathBinary
13
- } from "./chunk-FKKS4ZC5.js";
13
+ } from "./chunk-QFZNPZRO.js";
14
14
  import {
15
15
  getPackageVersion
16
16
  } from "./chunk-WIIMW5YO.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  configFilePath
3
- } from "./chunk-PDES33BK.js";
3
+ } from "./chunk-4EBJ4PTZ.js";
4
4
  import {
5
5
  readJsonSafe,
6
6
  writeJsonAtomic
7
7
  } from "./chunk-TODDEIYG.js";
8
8
  import {
9
9
  readSetupOutcomeProperties
10
- } from "./chunk-A6KNDKO5.js";
10
+ } from "./chunk-C5LIS3XM.js";
11
11
 
12
12
  // src/setup/failure-record.ts
13
13
  import { dirname, join } from "path";
@@ -3,7 +3,7 @@ import {
3
3
  formatVersion,
4
4
  quoteIfNeeded,
5
5
  shellDoubleQuoted
6
- } from "./chunk-FKKS4ZC5.js";
6
+ } from "./chunk-QFZNPZRO.js";
7
7
  import {
8
8
  writeFileAtomic
9
9
  } from "./chunk-TODDEIYG.js";
@@ -20,7 +20,7 @@ import {
20
20
  PRETOOLUSE_GATED_TOOLS,
21
21
  PUSHARY_TOOL_PREFIX,
22
22
  withHookHoldBudget
23
- } from "./chunk-A6KNDKO5.js";
23
+ } from "./chunk-C5LIS3XM.js";
24
24
 
25
25
  // src/setup/paths.ts
26
26
  import { createHash as createHash2 } from "crypto";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  macAppBridgeAvailable
3
- } from "./chunk-4KHBN7LI.js";
3
+ } from "./chunk-SYZF5SDG.js";
4
4
  import {
5
5
  keyPrefix
6
- } from "./chunk-QVXNSVBS.js";
6
+ } from "./chunk-HIIXYZYV.js";
7
7
  import {
8
8
  bridgeAgentKey
9
- } from "./chunk-GGXAZTSW.js";
9
+ } from "./chunk-IG7NGXBS.js";
10
10
  import {
11
11
  readJsonSafe
12
12
  } from "./chunk-TODDEIYG.js";
13
13
  import {
14
14
  isRecord,
15
15
  isValidApiKey
16
- } from "./chunk-A6KNDKO5.js";
16
+ } from "./chunk-C5LIS3XM.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;