pushary 1.9.43 → 1.9.44

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 (106) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +1 -0
  3. package/dist/bin/pushary-bell-hook.js +27 -26
  4. package/dist/bin/pushary-bell.js +11 -11
  5. package/dist/bin/pushary-claude.js +30 -28
  6. package/dist/bin/pushary-clean.js +39 -38
  7. package/dist/bin/pushary-codex-bridge.js +38 -28
  8. package/dist/bin/pushary-codex-hook.js +35 -33
  9. package/dist/bin/pushary-codex-session.d.ts +1 -0
  10. package/dist/bin/pushary-codex-session.js +253 -0
  11. package/dist/bin/pushary-codex.js +13 -12
  12. package/dist/bin/pushary-connect.js +28 -27
  13. package/dist/bin/pushary-cowork.js +6 -6
  14. package/dist/bin/pushary-daemon.js +48 -47
  15. package/dist/bin/pushary-disconnect.js +27 -26
  16. package/dist/bin/pushary-doctor.js +85 -82
  17. package/dist/bin/pushary-elicitation-hook.js +27 -26
  18. package/dist/bin/pushary-gemini-bridge.js +22 -22
  19. package/dist/bin/pushary-gemini-hook.js +32 -30
  20. package/dist/bin/pushary-hook.js +33 -32
  21. package/dist/bin/pushary-login.js +16 -16
  22. package/dist/bin/pushary-logout.js +28 -27
  23. package/dist/bin/pushary-mcp.js +9 -9
  24. package/dist/bin/pushary-mode.js +14 -14
  25. package/dist/bin/pushary-notification-hook.js +26 -25
  26. package/dist/bin/pushary-opencode-hook.js +31 -29
  27. package/dist/bin/pushary-permission-denied-hook.js +31 -30
  28. package/dist/bin/pushary-permission-hook.js +30 -29
  29. package/dist/bin/pushary-post-hook.js +26 -25
  30. package/dist/bin/pushary-prompt-hook.js +26 -25
  31. package/dist/bin/pushary-session-end-hook.js +26 -25
  32. package/dist/bin/pushary-session-start-hook.js +31 -30
  33. package/dist/bin/pushary-setup.js +165 -112
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +35 -34
  36. package/dist/bin/pushary-stop-hook.js +26 -25
  37. package/dist/bin/pushary-stopfailure-hook.js +26 -25
  38. package/dist/bin/pushary-suggestions.js +14 -14
  39. package/dist/bin/pushary-transcript-register.js +18 -18
  40. package/dist/bin/pushary-transcripts.js +7 -7
  41. package/dist/bin/pushary-upgrade.js +41 -40
  42. package/dist/bin/pushary-wait.js +14 -14
  43. package/dist/bin/pushary.js +7 -6
  44. package/dist/{chunk-ZJXEQV3A.js → chunk-2NVXFWQY.js} +1 -1
  45. package/dist/{chunk-H64CU2VB.js → chunk-3IRC3XFG.js} +2 -2
  46. package/dist/{chunk-JB4JCGRW.js → chunk-42CVAOC5.js} +2 -2
  47. package/dist/{chunk-S3OWTQ6Z.js → chunk-4JHEZ2PV.js} +12 -5
  48. package/dist/{chunk-LE2YVPAT.js → chunk-4WBAHVBK.js} +11 -11
  49. package/dist/{chunk-53KLSE2F.js → chunk-53UZN7JW.js} +3 -3
  50. package/dist/{chunk-4T2TGP4T.js → chunk-5ZSBQHCM.js} +12 -173
  51. package/dist/{chunk-Q7CUTGT4.js → chunk-6EV3B5CD.js} +1 -1
  52. package/dist/{chunk-MSUMSXTI.js → chunk-75M7NFFC.js} +1 -1
  53. package/dist/{chunk-VIVLJK3T.js → chunk-7UM4NCUI.js} +2 -2
  54. package/dist/{chunk-F5ALKPNS.js → chunk-ALY7ZBNB.js} +1 -1
  55. package/dist/{chunk-YRE6GUFZ.js → chunk-BKK3JCTD.js} +80 -164
  56. package/dist/{chunk-O7ADPLBF.js → chunk-CAJCCQ7N.js} +1 -1
  57. package/dist/{chunk-AVT7GPOF.js → chunk-CESLE4UN.js} +10 -10
  58. package/dist/{chunk-Y4VZYKSW.js → chunk-CEZTYTBN.js} +13 -11
  59. package/dist/{chunk-CIERFMQT.js → chunk-DD6IBKEJ.js} +4 -4
  60. package/dist/{chunk-TH74SUVV.js → chunk-E76QCZIA.js} +2 -2
  61. package/dist/{chunk-ENGASUEL.js → chunk-FI2F5KZJ.js} +4 -4
  62. package/dist/{chunk-V5SUKRRI.js → chunk-FKDZU6YX.js} +4 -4
  63. package/dist/{chunk-EA5NWDK7.js → chunk-FYNMFSIZ.js} +29 -0
  64. package/dist/{chunk-JJWG7CBT.js → chunk-GBCR2FH2.js} +3 -3
  65. package/dist/chunk-GOEIW2VH.js +266 -0
  66. package/dist/{chunk-Y3N3SYBX.js → chunk-GRAPJKDK.js} +1 -1
  67. package/dist/{chunk-ZORCUL3Z.js → chunk-HV4TEKNP.js} +4 -4
  68. package/dist/{chunk-A64UCGX3.js → chunk-IWHDNMM3.js} +5 -5
  69. package/dist/{chunk-RXXKFM22.js → chunk-JNU3LV47.js} +355 -138
  70. package/dist/{chunk-C6QBNBL4.js → chunk-KILK6SWZ.js} +7 -7
  71. package/dist/{chunk-SATOTPXW.js → chunk-KYLY6UMN.js} +1 -1
  72. package/dist/{chunk-NV2LARV4.js → chunk-L2ZM7LXN.js} +2 -2
  73. package/dist/{chunk-F7SZ2RCK.js → chunk-LEHBWBCG.js} +4 -4
  74. package/dist/{chunk-LAAOHBLO.js → chunk-M2L7625S.js} +2 -2
  75. package/dist/{chunk-HC4DQXAT.js → chunk-MIBCRQWK.js} +2 -2
  76. package/dist/{chunk-J6MVBWF2.js → chunk-MRQJCIFO.js} +1 -1
  77. package/dist/{chunk-XLHFWG2E.js → chunk-OR6KJOHE.js} +2 -2
  78. package/dist/{chunk-55FB6OSG.js → chunk-OSMNLNPF.js} +1 -1
  79. package/dist/{chunk-GTOBOC6M.js → chunk-OWQOMGBF.js} +1 -1
  80. package/dist/{chunk-S4QT3YFG.js → chunk-OZ7MLVDM.js} +15 -15
  81. package/dist/{chunk-LWW7SBK3.js → chunk-PGHN5D4N.js} +2 -2
  82. package/dist/{chunk-IDVKJICN.js → chunk-PQAFH4DF.js} +3 -11
  83. package/dist/{chunk-VGPEXMYM.js → chunk-RGBTKOCC.js} +42 -7
  84. package/dist/{chunk-H6V5S52A.js → chunk-S2ALW446.js} +3 -3
  85. package/dist/{chunk-IMD5FN6Y.js → chunk-SI2NC6UU.js} +3 -3
  86. package/dist/chunk-SVCT5D7K.js +196 -0
  87. package/dist/{chunk-JW4S4O4W.js → chunk-SWDPCDLT.js} +4 -4
  88. package/dist/{chunk-LDCRV6HG.js → chunk-T3KMJI4W.js} +2 -1
  89. package/dist/{chunk-PIZ65U3D.js → chunk-T4CKP47U.js} +5 -5
  90. package/dist/{chunk-C3RVRTHS.js → chunk-TJZUQRMH.js} +3 -3
  91. package/dist/{chunk-C54VJJ37.js → chunk-TKTS3SIM.js} +3 -3
  92. package/dist/{chunk-LOUZNXTJ.js → chunk-TWATOPHK.js} +2 -2
  93. package/dist/{chunk-FPJHS6PA.js → chunk-UC4PNLMK.js} +6 -6
  94. package/dist/{chunk-JE6GG3OV.js → chunk-UJXLVH66.js} +1 -1
  95. package/dist/{chunk-45W43U2Q.js → chunk-UY5E2UUW.js} +5 -5
  96. package/dist/{chunk-O4SYJVAF.js → chunk-UZVF6MP2.js} +5 -5
  97. package/dist/{chunk-SCYAXV7U.js → chunk-W2TA4EVZ.js} +5 -5
  98. package/dist/{chunk-VQL62ECJ.js → chunk-WBD7HZEZ.js} +1 -1
  99. package/dist/{chunk-W3BO56VE.js → chunk-WMO2XVG4.js} +1 -1
  100. package/dist/{chunk-NKBAEGT7.js → chunk-XPQDBTW4.js} +1 -1
  101. package/dist/{global-upgrade-FFWOHOJ4.js → global-upgrade-QSSDYZCZ.js} +6 -6
  102. package/dist/{paths-Y2WPCM5Y.js → paths-55DDFLY4.js} +2 -2
  103. package/dist/{reapply-N3MV3CKD.js → reapply-MEU66ALO.js} +23 -22
  104. package/dist/src/index.js +20 -19
  105. package/dist/{upgrade-lock-ZXXNRH2P.js → upgrade-lock-YLXAU4AD.js} +3 -3
  106. package/package.json +5 -2
@@ -4,19 +4,19 @@ import {
4
4
  outcomeOfFailedAsk,
5
5
  reportMachineDenial,
6
6
  storedWaitDeadline
7
- } from "./chunk-FPJHS6PA.js";
7
+ } from "./chunk-UC4PNLMK.js";
8
8
  import {
9
9
  isGatingMoment,
10
10
  recordKeylessMoment
11
- } from "./chunk-Y3N3SYBX.js";
11
+ } from "./chunk-GRAPJKDK.js";
12
12
  import {
13
13
  isDeferAnswer,
14
14
  oncePerSession
15
- } from "./chunk-ZJXEQV3A.js";
15
+ } from "./chunk-2NVXFWQY.js";
16
16
  import {
17
17
  activeHookSource,
18
18
  activeIdentity
19
- } from "./chunk-V5SUKRRI.js";
19
+ } from "./chunk-FKDZU6YX.js";
20
20
  import {
21
21
  DEFAULT_SESSION,
22
22
  UNNAMED_ACTION,
@@ -37,11 +37,10 @@ import {
37
37
  readLastPrompt,
38
38
  readLastUserPrompt,
39
39
  recordBlockedActionHint,
40
- repoKeyFor,
41
40
  reportEvent,
42
41
  scopePathFor,
43
42
  settleQuestionsForToolUse
44
- } from "./chunk-YRE6GUFZ.js";
43
+ } from "./chunk-BKK3JCTD.js";
45
44
  import {
46
45
  askUser,
47
46
  cancelQuestion,
@@ -54,17 +53,20 @@ import {
54
53
  sendNotification,
55
54
  waitForQuestion,
56
55
  waitsForThePhone
57
- } from "./chunk-4T2TGP4T.js";
56
+ } from "./chunk-5ZSBQHCM.js";
57
+ import {
58
+ repoKeyFor
59
+ } from "./chunk-GOEIW2VH.js";
58
60
  import {
59
61
  getMachineId
60
- } from "./chunk-W3BO56VE.js";
62
+ } from "./chunk-WMO2XVG4.js";
61
63
  import {
62
64
  getApiKey,
63
65
  getBaseUrl
64
- } from "./chunk-GTOBOC6M.js";
66
+ } from "./chunk-OWQOMGBF.js";
65
67
  import {
66
68
  NPX_LATEST_COMMAND
67
- } from "./chunk-LDCRV6HG.js";
69
+ } from "./chunk-T3KMJI4W.js";
68
70
  import {
69
71
  AGENT_QUESTION_STRATEGY,
70
72
  AGENT_QUESTION_TOOL,
@@ -109,7 +111,7 @@ import {
109
111
  resolveGate,
110
112
  timeoutActionWithoutLocalPrompt,
111
113
  unansweredRefusalReason
112
- } from "./chunk-RXXKFM22.js";
114
+ } from "./chunk-JNU3LV47.js";
113
115
 
114
116
  // src/claude-permission-rules.ts
115
117
  import { readFileSync, statSync } from "fs";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  registerTranscript
3
- } from "./chunk-S4QT3YFG.js";
3
+ } from "./chunk-OZ7MLVDM.js";
4
4
  import {
5
5
  namedEvent
6
- } from "./chunk-V5SUKRRI.js";
6
+ } from "./chunk-FKDZU6YX.js";
7
7
  import {
8
8
  writeDegraded
9
- } from "./chunk-4T2TGP4T.js";
9
+ } from "./chunk-GOEIW2VH.js";
10
10
  import {
11
11
  claudeShapedHookInput,
12
12
  hookCompatibleProfileBySource,
13
13
  isGrokHookPayload,
14
14
  isGrokSessionEndStop
15
- } from "./chunk-RXXKFM22.js";
15
+ } from "./chunk-JNU3LV47.js";
16
16
 
17
17
  // src/tool-hook-input.ts
18
18
  var OPTIONAL_TEXT_FIELDS = ["hook_event_name", "session_id", "cwd", "transcript_path", "tool_use_id", "permission_mode"];
@@ -8,10 +8,10 @@ import {
8
8
  codexHooksJsonIn,
9
9
  isPusharyCodexCommand,
10
10
  resolvePathBinary
11
- } from "./chunk-S3OWTQ6Z.js";
11
+ } from "./chunk-4JHEZ2PV.js";
12
12
  import {
13
13
  getPackageVersion
14
- } from "./chunk-RXXKFM22.js";
14
+ } from "./chunk-JNU3LV47.js";
15
15
 
16
16
  // src/codex-app-server.ts
17
17
  import { existsSync, realpathSync } from "fs";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  compatibleConfigFile,
3
3
  hasCompatibleHooks
4
- } from "./chunk-V5SUKRRI.js";
4
+ } from "./chunk-FKDZU6YX.js";
5
5
  import {
6
6
  pusharyHookExecutable
7
- } from "./chunk-PIZ65U3D.js";
7
+ } from "./chunk-T4CKP47U.js";
8
8
  import {
9
9
  isProtectedByScope,
10
10
  registerHookEntry
11
- } from "./chunk-S3OWTQ6Z.js";
11
+ } from "./chunk-4JHEZ2PV.js";
12
12
  import {
13
13
  isRecord
14
- } from "./chunk-RXXKFM22.js";
14
+ } from "./chunk-JNU3LV47.js";
15
15
 
16
16
  // src/cursor-config.ts
17
17
  var hookCommandOf = (entry) => {
@@ -3,18 +3,18 @@ import {
3
3
  addGeminiMcpServer,
4
4
  removeGeminiMcpServer,
5
5
  supportedClaudeEvents
6
- } from "./chunk-IMD5FN6Y.js";
6
+ } from "./chunk-SI2NC6UU.js";
7
7
  import {
8
8
  CLAUDE_CODE_AGENT,
9
9
  compatibleToolLookup
10
- } from "./chunk-YRE6GUFZ.js";
10
+ } from "./chunk-BKK3JCTD.js";
11
11
  import {
12
12
  guardBinary,
13
13
  guardBinaryRefusing,
14
14
  holdBudgetOf,
15
15
  isProtectedByScope,
16
16
  registerHookEntry
17
- } from "./chunk-S3OWTQ6Z.js";
17
+ } from "./chunk-4JHEZ2PV.js";
18
18
  import {
19
19
  HOOK_LOCATOR_BINARY,
20
20
  PHONE_ANSWERED_TOOLS,
@@ -25,7 +25,7 @@ import {
25
25
  pusharyMissingReason,
26
26
  refusalOutput,
27
27
  withHookHoldBudget
28
- } from "./chunk-RXXKFM22.js";
28
+ } from "./chunk-JNU3LV47.js";
29
29
 
30
30
  // src/claude-config.ts
31
31
  import { join } from "path";
@@ -1,3 +1,14 @@
1
+ import {
2
+ readJsonSafe,
3
+ writeJsonAtomic
4
+ } from "./chunk-AQFEP65J.js";
5
+ import {
6
+ configFilePath
7
+ } from "./chunk-OWQOMGBF.js";
8
+ import {
9
+ readSetupOutcomeProperties
10
+ } from "./chunk-JNU3LV47.js";
11
+
1
12
  // src/hooks-spec.ts
2
13
  var CURSOR_GATE_SCRIPT = "pushary-gate.mjs";
3
14
 
@@ -39,7 +50,25 @@ var versionManagerOf = (execPath) => {
39
50
  };
40
51
  var describeVersionManagerPin = (execPath, manager) => `The background service is pinned to ${execPath}, which ${manager} manages. Switching Node versions strands it; run pushary daemon install afterwards.`;
41
52
 
53
+ // src/setup/failure-record.ts
54
+ import { dirname, join } from "path";
55
+ var failurePath = () => join(dirname(configFilePath()), "last-setup-failure.json");
56
+ var saveSetupFailure = (body, path = failurePath()) => {
57
+ const properties = readSetupOutcomeProperties(body);
58
+ if (properties.exitCode === null || properties.exitCode === 0) return;
59
+ writeJsonAtomic(path, { ...properties, recordedAt: (/* @__PURE__ */ new Date()).toISOString() }, 384);
60
+ };
61
+ var readSetupFailure = (path = failurePath()) => {
62
+ const result = readJsonSafe(path);
63
+ if (result.kind !== "ok" || typeof result.value !== "object" || result.value === null || Array.isArray(result.value)) return null;
64
+ const body = result.value;
65
+ if (!("recordedAt" in body) || typeof body.recordedAt !== "string" || body.recordedAt.length > 30 || !Number.isFinite(Date.parse(body.recordedAt))) return null;
66
+ return { ...readSetupOutcomeProperties({ ...body }), recordedAt: body.recordedAt };
67
+ };
68
+
42
69
  export {
70
+ saveSetupFailure,
71
+ readSetupFailure,
43
72
  CURSOR_GATE_SCRIPT,
44
73
  readServiceExecPath,
45
74
  versionManagerOf,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SETUP_FLAGS
3
- } from "./chunk-Q7CUTGT4.js";
3
+ } from "./chunk-6EV3B5CD.js";
4
4
  import {
5
5
  parseFlags
6
6
  } from "./chunk-GMXKITVA.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-7QLSKOSU.js";
10
10
  import {
11
11
  NPX_LATEST_COMMAND
12
- } from "./chunk-LDCRV6HG.js";
12
+ } from "./chunk-T3KMJI4W.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-RXXKFM22.js";
20
+ } from "./chunk-JNU3LV47.js";
21
21
 
22
22
  // src/cli/cowork.ts
23
23
  import { readFileSync } from "fs";
@@ -0,0 +1,266 @@
1
+ import {
2
+ CLIENT_REPORT_DISABLE_ENV,
3
+ isDisabledByEnv
4
+ } from "./chunk-POFBE6ZY.js";
5
+ import {
6
+ isNetworkFailure
7
+ } from "./chunk-S2ALW446.js";
8
+ import {
9
+ clientReportClaims
10
+ } from "./chunk-4JHEZ2PV.js";
11
+ import {
12
+ getApiKey,
13
+ getBaseUrl
14
+ } from "./chunk-OWQOMGBF.js";
15
+ import {
16
+ CLIENT_REPORT_PATH,
17
+ degradedLine,
18
+ localRepoKey,
19
+ normalizeRepoRemote
20
+ } from "./chunk-JNU3LV47.js";
21
+
22
+ // src/client-report-claim.ts
23
+ import { createHash } from "crypto";
24
+ import { closeSync, mkdirSync, openSync, readdirSync, unlinkSync } from "fs";
25
+ import { join } from "path";
26
+ var CLIENT_REPORT_WINDOW_MS = 6e4;
27
+ var CLAIM_DIRECTORY_MODE = 448;
28
+ var CLAIM_FILE_MODE = 384;
29
+ var CLAIM_KEY_HASH_LENGTH = 16;
30
+ var CLAIM_FILE_PATTERN = /^[0-9a-f]{16}-(\d+)$/;
31
+ var EXCLUSIVE_CREATE = "wx";
32
+ var ALREADY_EXISTS = "EEXIST";
33
+ var WINDOWS_KEPT_BEHIND = 1;
34
+ var reportWindowOf = (now) => Math.floor(now / CLIENT_REPORT_WINDOW_MS);
35
+ var claimFileName = (key, window) => `${createHash("sha256").update(key).digest("hex").slice(0, CLAIM_KEY_HASH_LENGTH)}-${window}`;
36
+ var errorCodeOf = (error) => typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : null;
37
+ var claimWindowOf = (fileName) => {
38
+ const match = CLAIM_FILE_PATTERN.exec(fileName);
39
+ return match ? Number(match[1]) : null;
40
+ };
41
+ var isStaleClaim = (fileName, window) => {
42
+ const claimedWindow = claimWindowOf(fileName);
43
+ return claimedWindow !== null && claimedWindow < window - WINDOWS_KEPT_BEHIND;
44
+ };
45
+ var removeQuietly = (filePath) => {
46
+ try {
47
+ unlinkSync(filePath);
48
+ } catch {
49
+ return;
50
+ }
51
+ };
52
+ var removeStaleClaims = (claimsDir, window) => {
53
+ try {
54
+ for (const fileName of readdirSync(claimsDir)) {
55
+ if (isStaleClaim(fileName, window)) removeQuietly(join(claimsDir, fileName));
56
+ }
57
+ } catch {
58
+ return;
59
+ }
60
+ };
61
+ var claimReportWindow = (claimsDir, key, now) => {
62
+ const window = reportWindowOf(now);
63
+ try {
64
+ mkdirSync(claimsDir, { recursive: true, mode: CLAIM_DIRECTORY_MODE });
65
+ closeSync(openSync(join(claimsDir, claimFileName(key, window)), EXCLUSIVE_CREATE, CLAIM_FILE_MODE));
66
+ } catch (error) {
67
+ return errorCodeOf(error) === ALREADY_EXISTS ? "already_claimed" : "unavailable";
68
+ }
69
+ removeStaleClaims(claimsDir, window);
70
+ return "claimed";
71
+ };
72
+
73
+ // src/client-report.ts
74
+ var CLIENT_REPORT_TIMEOUT_MS = 1e3;
75
+ var readApiKey = () => {
76
+ try {
77
+ return getApiKey();
78
+ } catch {
79
+ return null;
80
+ }
81
+ };
82
+ var defaultDeps = () => ({
83
+ disabled: () => isDisabledByEnv(process.env, CLIENT_REPORT_DISABLE_ENV),
84
+ fetchImpl: fetch,
85
+ apiKey: readApiKey,
86
+ baseUrl: getBaseUrl,
87
+ now: Date.now,
88
+ claimsDir: clientReportClaims()
89
+ });
90
+ var reportKey = (event) => `${event.kind}:${event.code}`;
91
+ var createClientErrorReporter = (deps) => {
92
+ const windowClaimedInProcess = /* @__PURE__ */ new Map();
93
+ const claimInProcess = (key, now) => {
94
+ if (windowClaimedInProcess.get(key) === reportWindowOf(now)) return false;
95
+ windowClaimedInProcess.set(key, reportWindowOf(now));
96
+ return true;
97
+ };
98
+ const claimReport = (key, now) => {
99
+ const claim = claimReportWindow(deps.claimsDir, key, now);
100
+ return claim === "unavailable" ? claimInProcess(key, now) : claim === "claimed";
101
+ };
102
+ return async (event) => {
103
+ try {
104
+ if (deps.disabled()) return;
105
+ const apiKey = deps.apiKey();
106
+ const now = deps.now();
107
+ if (!apiKey || !claimReport(reportKey(event), now)) return;
108
+ await deps.fetchImpl(`${deps.baseUrl()}${CLIENT_REPORT_PATH}`, {
109
+ method: "POST",
110
+ headers: { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json" },
111
+ body: JSON.stringify({ ...event, occurredAt: new Date(now).toISOString() }),
112
+ signal: AbortSignal.timeout(CLIENT_REPORT_TIMEOUT_MS)
113
+ });
114
+ } catch {
115
+ return;
116
+ }
117
+ };
118
+ };
119
+ var processReporter = null;
120
+ var inFlightReports = /* @__PURE__ */ new Set();
121
+ var reportClientError = (event) => {
122
+ processReporter ??= createClientErrorReporter(defaultDeps());
123
+ const report = processReporter(event);
124
+ inFlightReports.add(report);
125
+ void report.finally(() => inFlightReports.delete(report));
126
+ return report;
127
+ };
128
+ var exitAfterClientReports = async (code) => {
129
+ await Promise.all(inFlightReports);
130
+ return process.exit(code);
131
+ };
132
+ var clientErrorKindOf = (error) => isNetworkFailure(error) ? "network" : "unexpected";
133
+ var writeDegraded = (subsystem, report) => {
134
+ process.stderr.write(`${degradedLine(subsystem, report)}
135
+ `);
136
+ void reportClientError({ kind: "degraded", code: `${subsystem}:${report.reason}` });
137
+ };
138
+
139
+ // src/repo.ts
140
+ import { existsSync, readFileSync, statSync } from "fs";
141
+ import { basename, dirname, isAbsolute, join as join2, resolve } from "path";
142
+ var MAX_PARENT_WALK = 64;
143
+ var GIT_FILE_PREFIX = "gitdir:";
144
+ var findGitDir = (startDir) => {
145
+ let current = resolve(startDir);
146
+ for (let depth = 0; depth < MAX_PARENT_WALK; depth += 1) {
147
+ const candidate = join2(current, ".git");
148
+ try {
149
+ if (existsSync(candidate)) {
150
+ if (statSync(candidate).isDirectory()) return candidate;
151
+ const pointer = readFileSync(candidate, "utf-8").trim();
152
+ if (pointer.startsWith(GIT_FILE_PREFIX)) {
153
+ const target = pointer.slice(GIT_FILE_PREFIX.length).trim();
154
+ return isAbsolute(target) ? target : resolve(current, target);
155
+ }
156
+ }
157
+ } catch {
158
+ }
159
+ const parent = dirname(current);
160
+ if (parent === current) return void 0;
161
+ current = parent;
162
+ }
163
+ return void 0;
164
+ };
165
+ var configPathFor = (gitDir) => {
166
+ const index = gitDir.replace(/\\/g, "/").indexOf("/worktrees/");
167
+ return index === -1 ? join2(gitDir, "config") : join2(gitDir.slice(0, index), "config");
168
+ };
169
+ var ORIGIN_SECTION = /^\[remote "origin"\]/;
170
+ var SECTION_HEADER = /^\[/;
171
+ var URL_LINE = /^url\s*=\s*(.+)$/;
172
+ var readOriginRemote = (gitDir) => {
173
+ try {
174
+ const configPath = configPathFor(gitDir);
175
+ if (!existsSync(configPath)) return void 0;
176
+ let inOrigin = false;
177
+ for (const rawLine of readFileSync(configPath, "utf-8").split("\n")) {
178
+ const line = rawLine.trim();
179
+ if (SECTION_HEADER.test(line)) {
180
+ inOrigin = ORIGIN_SECTION.test(line);
181
+ continue;
182
+ }
183
+ if (!inOrigin) continue;
184
+ const url = URL_LINE.exec(line);
185
+ if (url) return url[1]?.trim();
186
+ }
187
+ } catch {
188
+ }
189
+ return void 0;
190
+ };
191
+ var deriveRepoKey = (cwd) => {
192
+ const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
193
+ try {
194
+ const gitDir = findGitDir(dir);
195
+ if (gitDir) {
196
+ const remote = readOriginRemote(gitDir);
197
+ const normalized = remote ? normalizeRepoRemote(remote) : void 0;
198
+ if (normalized) return normalized;
199
+ const root = gitDir.endsWith(".git") ? dirname(gitDir) : dir;
200
+ return localRepoKey(basename(root));
201
+ }
202
+ return localRepoKey(basename(resolve(dir)));
203
+ } catch {
204
+ return void 0;
205
+ }
206
+ };
207
+ var repoKeyCache = /* @__PURE__ */ new Map();
208
+ var REPO_KEY_ENV = "PUSHARY_REPO_KEY";
209
+ var repoKeyFor = (cwd) => {
210
+ const override = process.env[REPO_KEY_ENV];
211
+ if (typeof override === "string") {
212
+ const trimmed = override.trim();
213
+ if (trimmed.toLowerCase() === "off") return void 0;
214
+ if (trimmed.length > 0) return trimmed.toLowerCase();
215
+ }
216
+ const dir = cwd && cwd.length > 0 ? cwd : process.cwd();
217
+ if (repoKeyCache.has(dir)) return repoKeyCache.get(dir);
218
+ const derived = deriveRepoKey(dir);
219
+ repoKeyCache.set(dir, derived);
220
+ return derived;
221
+ };
222
+
223
+ // src/validate.ts
224
+ var isPolicyConfig = (data) => {
225
+ if (!data || typeof data !== "object") return false;
226
+ const d = data;
227
+ return (d.resolvedAgent === void 0 || typeof d.resolvedAgent === "string") && Array.isArray(d.policies) && typeof d.defaultTimeoutSeconds === "number" && typeof d.defaultTimeoutAction === "string";
228
+ };
229
+ var isAskUserResponse = (data) => {
230
+ if (!data || typeof data !== "object") return false;
231
+ const d = data;
232
+ return typeof d.correlationId === "string" && typeof d.status === "string" && (d.answered === void 0 || typeof d.answered === "boolean") && (d.value === void 0 || typeof d.value === "string") && (d.note === void 0 || typeof d.note === "string") && (d.waitEndsAt === void 0 || typeof d.waitEndsAt === "string");
233
+ };
234
+ var isWaitForAnswerResponse = (data) => {
235
+ if (!data || typeof data !== "object") return false;
236
+ const d = data;
237
+ return typeof d.answered === "boolean";
238
+ };
239
+ var GATE_REPLY_KINDS = ["kill", "allow", "deny", "ask", "no_opinion"];
240
+ var isSettlementOutputs = (value) => {
241
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
242
+ const outputs = value;
243
+ return (outputs.approve === void 0 || typeof outputs.approve === "string") && (outputs.deny === void 0 || typeof outputs.deny === "string");
244
+ };
245
+ var isGateReply = (data) => {
246
+ if (!data || typeof data !== "object") return false;
247
+ const d = data;
248
+ return GATE_REPLY_KINDS.includes(d.kind) && (d.output === void 0 || typeof d.output === "string") && (d.correlationId === void 0 || typeof d.correlationId === "string") && (d.deadlineSeconds === void 0 || typeof d.deadlineSeconds === "number") && (d.noDevices === void 0 || typeof d.noDevices === "boolean") && (d.suppressed === void 0 || typeof d.suppressed === "boolean") && (d.settlementOutputs === void 0 || isSettlementOutputs(d.settlementOutputs));
249
+ };
250
+ var isBlockedActionClaim = (data) => {
251
+ if (!data || typeof data !== "object") return false;
252
+ return typeof data.granted === "boolean";
253
+ };
254
+
255
+ export {
256
+ reportClientError,
257
+ exitAfterClientReports,
258
+ clientErrorKindOf,
259
+ writeDegraded,
260
+ isPolicyConfig,
261
+ isAskUserResponse,
262
+ isWaitForAnswerResponse,
263
+ isGateReply,
264
+ isBlockedActionClaim,
265
+ repoKeyFor
266
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-RXXKFM22.js";
3
+ } from "./chunk-JNU3LV47.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  openCodeConfigDirFrom
3
- } from "./chunk-O4SYJVAF.js";
3
+ } from "./chunk-UZVF6MP2.js";
4
4
  import {
5
5
  grokHome
6
- } from "./chunk-V5SUKRRI.js";
6
+ } from "./chunk-FKDZU6YX.js";
7
7
  import {
8
8
  codexHomeFrom,
9
9
  resolvePathBinary
10
- } from "./chunk-S3OWTQ6Z.js";
10
+ } from "./chunk-4JHEZ2PV.js";
11
11
  import {
12
12
  HOOK_COMPATIBLE_PROFILES
13
- } from "./chunk-RXXKFM22.js";
13
+ } from "./chunk-JNU3LV47.js";
14
14
 
15
15
  // src/hermes-config.ts
16
16
  import { execFileSync } from "child_process";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  APPROVAL_SETTINGS_PATH
3
- } from "./chunk-JW4S4O4W.js";
3
+ } from "./chunk-SWDPCDLT.js";
4
4
  import {
5
5
  readMacAppAgentKey
6
- } from "./chunk-F7SZ2RCK.js";
6
+ } from "./chunk-LEHBWBCG.js";
7
7
  import {
8
8
  findExportedKeyLines,
9
9
  isAdoptedMacAppKey,
@@ -13,13 +13,13 @@ import {
13
13
  readConfigFileKey,
14
14
  readKeySource,
15
15
  readMacAppKeyPrefix
16
- } from "./chunk-C3RVRTHS.js";
16
+ } from "./chunk-TJZUQRMH.js";
17
17
  import {
18
18
  absoluteUrl
19
- } from "./chunk-C54VJJ37.js";
19
+ } from "./chunk-TKTS3SIM.js";
20
20
  import {
21
21
  isValidApiKey
22
- } from "./chunk-RXXKFM22.js";
22
+ } from "./chunk-JNU3LV47.js";
23
23
 
24
24
  // src/key-revocation.ts
25
25
  var SELF_REVOKE_PATH = "/api/v1/server/keys/self/revoke";