@pushary/agent-hooks 0.89.8 → 0.89.10

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 (67) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/bin/pushary-bell-hook.js +4 -4
  3. package/dist/bin/pushary-bell.js +7 -7
  4. package/dist/bin/pushary-claude.js +64 -33
  5. package/dist/bin/pushary-clean.js +53 -46
  6. package/dist/bin/pushary-codex-bridge.js +8 -8
  7. package/dist/bin/pushary-codex-hook.js +12 -8
  8. package/dist/bin/pushary-codex.js +7 -7
  9. package/dist/bin/pushary-connect.js +6 -6
  10. package/dist/bin/pushary-daemon.js +57 -22
  11. package/dist/bin/pushary-disconnect.js +34 -9
  12. package/dist/bin/pushary-doctor.js +43 -22
  13. package/dist/bin/pushary-elicitation-hook.js +4 -4
  14. package/dist/bin/pushary-gemini-bridge.js +7 -7
  15. package/dist/bin/pushary-gemini-hook.js +8 -8
  16. package/dist/bin/pushary-hook.js +11 -10
  17. package/dist/bin/pushary-login.js +4 -4
  18. package/dist/bin/pushary-logout.js +4 -4
  19. package/dist/bin/pushary-mode.js +3 -3
  20. package/dist/bin/pushary-notification-hook.js +7 -7
  21. package/dist/bin/pushary-opencode-hook.js +8 -8
  22. package/dist/bin/pushary-permission-denied-hook.js +11 -10
  23. package/dist/bin/pushary-permission-hook.js +11 -10
  24. package/dist/bin/pushary-post-hook.js +7 -7
  25. package/dist/bin/pushary-prompt-hook.js +7 -7
  26. package/dist/bin/pushary-session-end-hook.js +7 -7
  27. package/dist/bin/pushary-session-start-hook.js +7 -7
  28. package/dist/bin/pushary-setup.js +66 -55
  29. package/dist/bin/pushary-stats.js +2 -2
  30. package/dist/bin/pushary-status.js +8 -8
  31. package/dist/bin/pushary-stop-hook.js +7 -7
  32. package/dist/bin/pushary-stopfailure-hook.js +7 -7
  33. package/dist/bin/pushary-upgrade.js +25 -17
  34. package/dist/bin/pushary-wait.js +3 -3
  35. package/dist/{chunk-SS72Z7FV.js → chunk-253WC6O5.js} +1 -1
  36. package/dist/{chunk-T3LRWZKI.js → chunk-2LPEZYMC.js} +1 -1
  37. package/dist/{chunk-O5B7EK5U.js → chunk-34GN3IPX.js} +1 -1
  38. package/dist/{chunk-V6N4Q223.js → chunk-3CUDMTL4.js} +1 -1
  39. package/dist/{chunk-VZKXBFUA.js → chunk-3HFK3UXM.js} +1 -1
  40. package/dist/{chunk-R2AGKCXL.js → chunk-3SQYKLBW.js} +52 -22
  41. package/dist/{chunk-ATBKJNWS.js → chunk-6EKQZA6R.js} +5 -1
  42. package/dist/{chunk-NKHEHEUM.js → chunk-6XUABEX2.js} +1 -1
  43. package/dist/{chunk-I5L6SK5V.js → chunk-BLODMQKJ.js} +1 -1
  44. package/dist/{chunk-DKDDLF5P.js → chunk-DKWM5T3P.js} +1 -1
  45. package/dist/{chunk-BAE45YLP.js → chunk-FZ73G2RO.js} +3 -3
  46. package/dist/{chunk-EJT2ER6G.js → chunk-GSSFSVAQ.js} +15 -21
  47. package/dist/{chunk-4XZCDSNG.js → chunk-GTZLL7F4.js} +5 -5
  48. package/dist/{chunk-PMHTCDEO.js → chunk-IUN6VOKV.js} +1 -1
  49. package/dist/{chunk-OFRNZWC4.js → chunk-IUWRVTQK.js} +1 -1
  50. package/dist/{chunk-J2JZJZKB.js → chunk-KVE5RCQL.js} +1 -1
  51. package/dist/{chunk-A4O5ROZK.js → chunk-MZGWKIUZ.js} +2 -2
  52. package/dist/chunk-NCVIWGVA.js +18 -0
  53. package/dist/{chunk-C623LWJR.js → chunk-OLAGKKSR.js} +1 -1
  54. package/dist/{chunk-EA3E74P2.js → chunk-PZRWFWSR.js} +6 -6
  55. package/dist/{chunk-VA7VUNRD.js → chunk-Q223OM5J.js} +58 -8
  56. package/dist/{chunk-GMI5QZLG.js → chunk-QA72MKIT.js} +5 -1
  57. package/dist/{chunk-AIGDBRIJ.js → chunk-SYUIXXQW.js} +1 -1
  58. package/dist/{chunk-TF247BET.js → chunk-TEZ2FZD6.js} +1 -1
  59. package/dist/{chunk-KOPUTJQC.js → chunk-TG3T3M4K.js} +1 -1
  60. package/dist/{chunk-FX5QSMPY.js → chunk-TRVIRETT.js} +1 -1
  61. package/dist/{chunk-ZL7HEF2T.js → chunk-TY5HVMXT.js} +32 -1
  62. package/dist/chunk-UDBJHQMG.js +240 -0
  63. package/dist/{chunk-GKAKAOKC.js → chunk-UXHMWF4H.js} +64 -11
  64. package/dist/{chunk-PZA7G4CN.js → chunk-X4ZUUFKV.js} +1 -0
  65. package/dist/{chunk-L4C2JXJS.js → chunk-X6RXX2NF.js} +5 -0
  66. package/dist/src/index.js +11 -10
  67. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  printKeyCheck
4
- } from "../chunk-SS72Z7FV.js";
4
+ } from "../chunk-253WC6O5.js";
5
5
  import {
6
6
  confirmAppConnection,
7
7
  connectDevice,
8
8
  printConnectInstructions
9
- } from "../chunk-T3LRWZKI.js";
9
+ } from "../chunk-2LPEZYMC.js";
10
10
  import "../chunk-3EGEA4KH.js";
11
11
  import {
12
12
  checkApiKey
13
- } from "../chunk-I5L6SK5V.js";
13
+ } from "../chunk-BLODMQKJ.js";
14
14
  import {
15
15
  createIo
16
16
  } from "../chunk-5RUIFDTP.js";
17
17
  import {
18
18
  readKeySource
19
- } from "../chunk-V6N4Q223.js";
19
+ } from "../chunk-3CUDMTL4.js";
20
20
  import {
21
21
  parseFlags
22
22
  } from "../chunk-GMXKITVA.js";
@@ -28,7 +28,7 @@ import "../chunk-BC3VCZ3E.js";
28
28
  import "../chunk-DINDL2CF.js";
29
29
  import "../chunk-BSZYIAZL.js";
30
30
  import "../chunk-SAF6HGAA.js";
31
- import "../chunk-OFRNZWC4.js";
31
+ import "../chunk-IUWRVTQK.js";
32
32
  import {
33
33
  UsageError
34
34
  } from "../chunk-7QLSKOSU.js";
@@ -37,7 +37,7 @@ import {
37
37
  } from "../chunk-KZERVKTD.js";
38
38
  import "../chunk-XX2V4QS5.js";
39
39
  import "../chunk-2UMNXADU.js";
40
- import "../chunk-L4C2JXJS.js";
40
+ import "../chunk-X6RXX2NF.js";
41
41
 
42
42
  // bin/pushary-connect.ts
43
43
  exitOnHelpFlag("connect");
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  inspectConfiguredManagedProviders
4
- } from "../chunk-EA3E74P2.js";
5
- import "../chunk-J2JZJZKB.js";
4
+ } from "../chunk-PZRWFWSR.js";
5
+ import "../chunk-KVE5RCQL.js";
6
+ import "../chunk-FZ73G2RO.js";
6
7
  import {
7
8
  HEARTBEAT_INTERVAL_MS,
8
9
  sendHeartbeat
9
- } from "../chunk-ZL7HEF2T.js";
10
- import "../chunk-BAE45YLP.js";
11
- import "../chunk-VA7VUNRD.js";
12
- import "../chunk-ATBKJNWS.js";
13
- import "../chunk-AIGDBRIJ.js";
10
+ } from "../chunk-TY5HVMXT.js";
11
+ import "../chunk-Q223OM5J.js";
12
+ import "../chunk-6EKQZA6R.js";
13
+ import "../chunk-SYUIXXQW.js";
14
14
  import {
15
15
  DAEMON_LEASE_RENEW_INTERVAL_MS,
16
16
  acquireDaemonLease,
@@ -23,36 +23,36 @@ import {
23
23
  replaceDaemonService,
24
24
  requestDaemonHandoff,
25
25
  stopDaemonRunning
26
- } from "../chunk-R2AGKCXL.js";
26
+ } from "../chunk-3SQYKLBW.js";
27
27
  import {
28
28
  detectProviderLiveCapabilities,
29
29
  hasSpawnProvider,
30
30
  resolveControlPolicy
31
- } from "../chunk-NKHEHEUM.js";
31
+ } from "../chunk-6XUABEX2.js";
32
32
  import {
33
33
  findLiveProcessBySpawnId,
34
34
  ownsLiveProcess
35
- } from "../chunk-TF247BET.js";
35
+ } from "../chunk-TEZ2FZD6.js";
36
36
  import {
37
37
  spawnClaude
38
38
  } from "../chunk-XHKBHWLX.js";
39
39
  import {
40
40
  resolveBinary
41
- } from "../chunk-PZA7G4CN.js";
41
+ } from "../chunk-X4ZUUFKV.js";
42
42
  import {
43
43
  getMachineId
44
- } from "../chunk-DKDDLF5P.js";
45
- import "../chunk-GMI5QZLG.js";
44
+ } from "../chunk-DKWM5T3P.js";
45
+ import "../chunk-QA72MKIT.js";
46
46
  import {
47
47
  readControlMode
48
- } from "../chunk-V6N4Q223.js";
48
+ } from "../chunk-3CUDMTL4.js";
49
49
  import {
50
50
  exitOnHelpFlag
51
51
  } from "../chunk-LURY4WNF.js";
52
52
  import "../chunk-3XTFX4CL.js";
53
53
  import "../chunk-BC3VCZ3E.js";
54
54
  import "../chunk-DINDL2CF.js";
55
- import "../chunk-OFRNZWC4.js";
55
+ import "../chunk-IUWRVTQK.js";
56
56
  import {
57
57
  EXIT
58
58
  } from "../chunk-KZERVKTD.js";
@@ -61,7 +61,7 @@ import {
61
61
  getApiKey,
62
62
  getBaseUrl
63
63
  } from "../chunk-2UMNXADU.js";
64
- import "../chunk-L4C2JXJS.js";
64
+ import "../chunk-X6RXX2NF.js";
65
65
 
66
66
  // src/spawn-daemon.ts
67
67
  import { execFileSync, spawn } from "child_process";
@@ -116,8 +116,15 @@ var STOP_PROTOCOL_VERSION = 2;
116
116
  var MAX_SPAWNS_PER_WINDOW = 5;
117
117
  var SPAWN_WINDOW_MS = 6e4;
118
118
  var VERSION_CHECK_INTERVAL_MS = 2e3;
119
+ var CONTROL_PROBE_INTERVAL_MS = 6e4;
119
120
  var MAX_TRACKED_PROCESSES = 100;
120
121
  var MAX_COMPLETED_STOPS = 20;
122
+ var controlProbeDue = (lastProbeAt, at = Date.now()) => lastProbeAt === 0 || at - lastProbeAt >= CONTROL_PROBE_INTERVAL_MS;
123
+ var parseControlProbe = (value) => {
124
+ if (typeof value !== "object" || value === null) return null;
125
+ const id = value.id;
126
+ return typeof id === "string" && id.length > 0 && id.length <= 128 ? id : null;
127
+ };
121
128
  var daemonSignals = (platform = process.platform) => platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
122
129
  var parseSpawnClaim = (value) => {
123
130
  if (typeof value !== "object" || value === null) return null;
@@ -294,6 +301,7 @@ var runSpawnDaemon = async () => {
294
301
  let stopped = false;
295
302
  let idleTicks = 0;
296
303
  let errorStreak = 0;
304
+ let lastControlProbeAt = 0;
297
305
  const spawnTimestamps = [];
298
306
  const launchedProcesses = /* @__PURE__ */ new Map();
299
307
  const completedStops = /* @__PURE__ */ new Map();
@@ -432,18 +440,41 @@ var runSpawnDaemon = async () => {
432
440
  });
433
441
  }
434
442
  };
443
+ const acknowledgeControlProbe = async (probeId) => {
444
+ const response = await fetch(`${baseUrl}${DRAIN_PATH}`, {
445
+ method: "POST",
446
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
447
+ body: JSON.stringify({ machineId, controlProbeAck: probeId }),
448
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
449
+ }).catch(() => null);
450
+ return response?.ok === true;
451
+ };
435
452
  const drain = async (signal) => {
453
+ const controlProbe = controlProbeDue(lastControlProbeAt);
454
+ if (controlProbe) lastControlProbeAt = Date.now();
436
455
  const res = await fetch(`${baseUrl}${DRAIN_PATH}`, {
437
456
  method: "POST",
438
457
  headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
439
- body: JSON.stringify({ machineId, spawnProtocol: SPAWN_PROTOCOL_VERSION, stopProtocol: STOP_PROTOCOL_VERSION }),
458
+ body: JSON.stringify({
459
+ machineId,
460
+ spawnProtocol: SPAWN_PROTOCOL_VERSION,
461
+ stopProtocol: STOP_PROTOCOL_VERSION,
462
+ controlProbe
463
+ }),
440
464
  signal
441
465
  });
442
466
  if (!res.ok) throw new DrainError(res.status);
443
467
  const data = await res.json();
444
468
  const response = typeof data === "object" && data !== null ? data : {};
445
469
  await Promise.all(parseStopRequests(response.stops).map(runStop));
446
- return parseSpawnClaim(response.spawn);
470
+ const controlProbeId = parseControlProbe(response.controlProbe);
471
+ return {
472
+ request: parseSpawnClaim(response.spawn),
473
+ controlProbeId,
474
+ // Released servers ignore the request field and omit the response field.
475
+ // Their successful authenticated drain remains the strongest proof they expose.
476
+ legacyControlProof: controlProbe && !Object.hasOwn(response, "controlProbe")
477
+ };
447
478
  };
448
479
  const acknowledge = async (body) => {
449
480
  if (!body) return;
@@ -507,18 +538,22 @@ var runSpawnDaemon = async () => {
507
538
  inflight = controller;
508
539
  const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
509
540
  try {
510
- const req = await drain(controller.signal);
541
+ const drained = await drain(controller.signal);
511
542
  if (!daemonLease.isOwner()) {
512
543
  finish();
513
544
  return;
514
545
  }
515
546
  errorStreak = 0;
516
- if (req) {
547
+ if (drained.request) {
517
548
  idleTicks = 0;
518
- await launchClaim(req);
549
+ await launchClaim(drained.request);
519
550
  } else {
520
551
  idleTicks++;
521
552
  }
553
+ const controlProved = drained.legacyControlProof || drained.controlProbeId !== null && await acknowledgeControlProbe(drained.controlProbeId);
554
+ if (controlProved) {
555
+ daemonLease.recordSuccessfulControl();
556
+ }
522
557
  } catch (err) {
523
558
  if (isAuthFailure(err)) {
524
559
  const status = err.status;
@@ -582,7 +617,7 @@ var runSpawnDaemon = async () => {
582
617
  stderr(hasSpawnProvider(providerCapabilities) ? `[pushary] daemon online \u2014 this machine (${machineId}) can now be sent a new session from your phone. Ctrl-C to stop.
583
618
  ` : `[pushary] daemon online \u2014 no supported Claude, Codex, or Gemini CLI was found, so phone-start is unavailable. Ctrl-C to stop.
584
619
  `);
585
- timer = setTimeout(tick, FAST_POLL_MS);
620
+ timer = setTimeout(tick, 0);
586
621
  const signals = daemonSignals();
587
622
  await new Promise((resolve) => {
588
623
  const onSignal = () => finish();
@@ -8,17 +8,20 @@ import {
8
8
  openCodePluginDir,
9
9
  openCodePluginFile,
10
10
  removeOpenCodeMcpServer
11
- } from "../chunk-O5B7EK5U.js";
11
+ } from "../chunk-34GN3IPX.js";
12
12
  import {
13
+ isClaudeMcpSnapshot,
13
14
  removeClaudeMcpServers,
14
15
  removeGeminiSettings,
15
- removePusharySettings
16
- } from "../chunk-VA7VUNRD.js";
17
- import "../chunk-ATBKJNWS.js";
18
- import "../chunk-AIGDBRIJ.js";
19
- import "../chunk-PZA7G4CN.js";
16
+ removePusharySettings,
17
+ restoreClaudeMcpServer
18
+ } from "../chunk-Q223OM5J.js";
19
+ import "../chunk-6EKQZA6R.js";
20
+ import "../chunk-SYUIXXQW.js";
21
+ import "../chunk-X4ZUUFKV.js";
20
22
  import {
21
23
  claudeJson,
24
+ claudeMcpReceipt,
22
25
  claudeSettings,
23
26
  claudeSettingsLocal,
24
27
  codexConfigToml,
@@ -29,14 +32,14 @@ import {
29
32
  geminiSettings,
30
33
  removeCodexHooks,
31
34
  removeCodexSettings
32
- } from "../chunk-GMI5QZLG.js";
35
+ } from "../chunk-QA72MKIT.js";
33
36
  import {
34
37
  exitOnHelpFlag
35
38
  } from "../chunk-LURY4WNF.js";
36
39
  import "../chunk-3XTFX4CL.js";
37
40
  import "../chunk-DINDL2CF.js";
38
41
  import "../chunk-KZERVKTD.js";
39
- import "../chunk-L4C2JXJS.js";
42
+ import "../chunk-X6RXX2NF.js";
40
43
 
41
44
  // bin/pushary-disconnect.ts
42
45
  import { readdirSync, readFileSync, rmSync, writeFileSync } from "fs";
@@ -115,12 +118,24 @@ var disconnectRemovals = (agent) => {
115
118
  var disconnectAgent = (agent, io) => {
116
119
  const changed = [];
117
120
  const untouched = [];
121
+ const claudeReceiptPath = claudeMcpReceipt();
122
+ const rawClaudeReceipt = agent === "claude" ? io.read(claudeReceiptPath) : null;
123
+ let claudeReceipt = null;
124
+ if (rawClaudeReceipt !== null) {
125
+ try {
126
+ const parsed = JSON.parse(rawClaudeReceipt);
127
+ if (isClaudeMcpSnapshot(parsed)) claudeReceipt = parsed;
128
+ } catch {
129
+ }
130
+ }
131
+ let restoredClaudeReceipt = false;
118
132
  for (const edit of disconnectPlan(agent)) {
119
133
  const raw = io.read(edit.path);
120
134
  if (raw === null) continue;
121
135
  try {
122
136
  const config = edit.format === "toml" ? io.parseToml(raw) : JSON.parse(raw);
123
- if (!edit.remove(config)) {
137
+ const changedConfig = agent === "claude" && edit.path === claudeJson() && rawClaudeReceipt !== null ? claudeReceipt !== null && restoreClaudeMcpServer(config, claudeReceipt) : edit.remove(config);
138
+ if (!changedConfig) {
124
139
  untouched.push(edit.path);
125
140
  continue;
126
141
  }
@@ -130,6 +145,9 @@ var disconnectAgent = (agent, io) => {
130
145
  `
131
146
  );
132
147
  changed.push(edit.path);
148
+ if (agent === "claude" && edit.path === claudeJson() && claudeReceipt) {
149
+ restoredClaudeReceipt = true;
150
+ }
133
151
  } catch {
134
152
  untouched.push(edit.path);
135
153
  }
@@ -155,6 +173,13 @@ var disconnectAgent = (agent, io) => {
155
173
  untouched.push(removal.path);
156
174
  }
157
175
  }
176
+ if (restoredClaudeReceipt && io.remove) {
177
+ try {
178
+ io.remove(claudeReceiptPath);
179
+ } catch {
180
+ untouched.push(claudeReceiptPath);
181
+ }
182
+ }
158
183
  return { agent, changed, untouched };
159
184
  };
160
185
 
@@ -7,7 +7,10 @@ import {
7
7
  codexWired,
8
8
  geminiWired,
9
9
  pusharyHookExecutable
10
- } from "../chunk-BAE45YLP.js";
10
+ } from "../chunk-FZ73G2RO.js";
11
+ import {
12
+ readMachineReadiness
13
+ } from "../chunk-TY5HVMXT.js";
11
14
  import {
12
15
  agentProbes,
13
16
  detectAgent,
@@ -16,41 +19,42 @@ import {
16
19
  isDetected,
17
20
  isPluginRegistered,
18
21
  vscodeSettingsTargets
19
- } from "../chunk-A4O5ROZK.js";
22
+ } from "../chunk-MZGWKIUZ.js";
20
23
  import {
21
24
  OPENCODE_PLUGIN_PLACEHOLDER,
22
25
  openCodePluginDir,
23
26
  openCodePluginFile,
24
27
  openCodeWired
25
- } from "../chunk-O5B7EK5U.js";
28
+ } from "../chunk-34GN3IPX.js";
26
29
  import {
27
30
  GEMINI_HOOK_BINARY,
28
31
  hasGeminiHooks,
29
32
  missingGeminiHookEvents
30
- } from "../chunk-VA7VUNRD.js";
31
- import "../chunk-ATBKJNWS.js";
32
- import "../chunk-AIGDBRIJ.js";
33
+ } from "../chunk-Q223OM5J.js";
34
+ import "../chunk-6EKQZA6R.js";
35
+ import "../chunk-SYUIXXQW.js";
33
36
  import {
37
+ daemonHasRemoteProof,
34
38
  daemonServiceManagerAvailable,
35
39
  hasDaemonServiceDefinition,
36
40
  readDaemonStatus
37
- } from "../chunk-R2AGKCXL.js";
41
+ } from "../chunk-3SQYKLBW.js";
38
42
  import {
39
43
  detectProviderLiveCapabilities,
40
44
  hasSpawnProvider,
41
45
  resolveControlPolicy
42
- } from "../chunk-NKHEHEUM.js";
46
+ } from "../chunk-6XUABEX2.js";
43
47
  import "../chunk-XHKBHWLX.js";
44
48
  import {
45
49
  execNpm
46
- } from "../chunk-PZA7G4CN.js";
50
+ } from "../chunk-X4ZUUFKV.js";
47
51
  import {
48
52
  readLedgerSummary
49
- } from "../chunk-VZKXBFUA.js";
50
- import "../chunk-KOPUTJQC.js";
53
+ } from "../chunk-3HFK3UXM.js";
54
+ import "../chunk-TG3T3M4K.js";
51
55
  import {
52
56
  getMachineId
53
- } from "../chunk-DKDDLF5P.js";
57
+ } from "../chunk-DKWM5T3P.js";
54
58
  import {
55
59
  claudeJson,
56
60
  claudeSettings,
@@ -70,19 +74,19 @@ import {
70
74
  readCodexMcpAuth,
71
75
  untrustedCodexHookEvents,
72
76
  vscodePluginDir
73
- } from "../chunk-GMI5QZLG.js";
77
+ } from "../chunk-QA72MKIT.js";
74
78
  import {
75
79
  describeReach,
76
80
  describeRoundTrip,
77
81
  fetchChannels,
78
82
  reachVerdict,
79
83
  verifyRoundTrip
80
- } from "../chunk-T3LRWZKI.js";
84
+ } from "../chunk-2LPEZYMC.js";
81
85
  import "../chunk-3EGEA4KH.js";
82
86
  import {
83
87
  checkApiKey,
84
88
  describeKeyCheck
85
- } from "../chunk-I5L6SK5V.js";
89
+ } from "../chunk-BLODMQKJ.js";
86
90
  import {
87
91
  createIo
88
92
  } from "../chunk-5RUIFDTP.js";
@@ -90,7 +94,7 @@ import {
90
94
  keyPrefix,
91
95
  readControlMode,
92
96
  readKeySource
93
- } from "../chunk-V6N4Q223.js";
97
+ } from "../chunk-3CUDMTL4.js";
94
98
  import {
95
99
  parseFlags
96
100
  } from "../chunk-GMXKITVA.js";
@@ -107,7 +111,7 @@ import {
107
111
  sendMcpRequest
108
112
  } from "../chunk-BSZYIAZL.js";
109
113
  import "../chunk-SAF6HGAA.js";
110
- import "../chunk-OFRNZWC4.js";
114
+ import "../chunk-IUWRVTQK.js";
111
115
  import {
112
116
  UsageError
113
117
  } from "../chunk-7QLSKOSU.js";
@@ -121,7 +125,7 @@ import {
121
125
  import {
122
126
  CURSOR_GATE_EVENTS,
123
127
  HOOK_LOCATOR_BINARY
124
- } from "../chunk-L4C2JXJS.js";
128
+ } from "../chunk-X6RXX2NF.js";
125
129
 
126
130
  // bin/pushary-doctor.ts
127
131
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -558,7 +562,8 @@ var main = async () => {
558
562
  ...codexInPlay ? ["codex"] : [],
559
563
  ...geminiInPlay ? ["gemini"] : []
560
564
  ];
561
- const controlSupported = hasSpawnProvider(detectProviderLiveCapabilities(configuredManagedProviders));
565
+ const controlCapabilities = detectProviderLiveCapabilities(configuredManagedProviders);
566
+ const controlSupported = hasSpawnProvider(controlCapabilities);
562
567
  const controlMode = readControlMode();
563
568
  const daemon = readDaemonStatus();
564
569
  const serviceDefined = hasDaemonServiceDefinition();
@@ -571,8 +576,8 @@ var main = async () => {
571
576
  });
572
577
  const controlRequired = controlPolicy === "enabled";
573
578
  const controlUnsupported = controlMode === "on" && controlPolicy !== "enabled";
574
- const daemonOk = controlUnsupported ? false : controlPolicy === "disabled" ? daemon.kind === "absent" && !serviceDefined : controlPolicy === "enabled" ? daemon.kind === "running" : controlPolicy === "legacy" ? false : daemon.kind === "absent" && !serviceDefined;
575
- const daemonFailure = daemonOk ? null : controlUnsupported ? "control is required but no usable provider/service-manager pair is available" : controlPolicy === "disabled" ? `control is disabled but ${serviceDefined ? "the service definition remains" : `local state is ${daemon.kind}`}` : controlPolicy === "legacy" ? "a legacy service exists without a usable provider/service-manager pair" : `local state is ${daemon.kind}`;
579
+ const daemonOk = controlUnsupported ? false : controlPolicy === "disabled" ? daemon.kind === "absent" && !serviceDefined : controlPolicy === "enabled" ? daemonHasRemoteProof(daemon) : controlPolicy === "legacy" ? false : daemon.kind === "absent" && !serviceDefined;
580
+ const daemonFailure = daemonOk ? null : controlUnsupported ? "control is required but no usable provider/service-manager pair is available" : controlPolicy === "enabled" && daemon.kind === "running" ? "the daemon has not completed an authenticated heartbeat and control poll" : controlPolicy === "disabled" ? `control is disabled but ${serviceDefined ? "the service definition remains" : `local state is ${daemon.kind}`}` : controlPolicy === "legacy" ? "a legacy service exists without a usable provider/service-manager pair" : `local state is ${daemon.kind}`;
576
581
  const daemonDetail = daemonFailure ? controlUnsupported ? `${daemonFailure}; re-run setup with \`--control off\`, or restore both requirements` : controlPolicy === "disabled" ? `${daemonFailure}; re-run setup with \`--control off\`` : controlPolicy === "legacy" ? `${daemonFailure}; run setup with \`--control off\`, or restore both requirements` : `${daemonFailure}; run \`pushary daemon install\` to install or repair the background service` : controlPolicy === "disabled" ? "disabled by setup" : controlPolicy === "preserve-absent" ? "legacy absence preserved" : !controlRequired && daemon.kind === "absent" ? "managed control is unsupported on this provider or operating-system session" : null;
577
582
  check(
578
583
  daemonOk,
@@ -584,9 +589,25 @@ var main = async () => {
584
589
  `daemon ${daemon.daemonVersion ?? "none"}`,
585
590
  `installed ${daemon.installedVersion}`,
586
591
  `machine ${daemon.machineId ?? "none"}`,
587
- `heartbeat ${daemon.lastSuccessfulHeartbeatAt ?? "none yet"}`
592
+ `heartbeat ${daemon.lastSuccessfulHeartbeatAt ?? "none yet"}`,
593
+ `control ${daemon.lastSuccessfulControlAt ?? "none yet"}`
588
594
  ].filter((value) => value !== null).join(" \xB7 ")
589
595
  );
596
+ if (controlPolicy === "enabled" && apiKey && daemon.machineId) {
597
+ const serverProof = await readMachineReadiness(apiKey, ["spawn", ...controlCapabilities], {
598
+ machineId: daemon.machineId
599
+ });
600
+ if (serverProof.kind === "unsupported") {
601
+ console.log(` ${warn} Remote-control server proof unavailable ${dim(`(${serverProof.detail})`)}`);
602
+ } else {
603
+ check(
604
+ serverProof.kind === "ready",
605
+ "Remote-control server proof",
606
+ serverProof.kind === "ready" ? "heartbeat \xB7 capabilities \xB7 control queue" : serverProof.detail,
607
+ serverProof.kind === "failed" ? "unreachable" : void 0
608
+ );
609
+ }
610
+ }
590
611
  const cursorPluginDir2 = cursorPluginDir();
591
612
  if (existsSync(cursorPluginDir2)) {
592
613
  checking("Cursor");
@@ -11,11 +11,11 @@ import {
11
11
  cancelQuestion,
12
12
  pollForAnswer,
13
13
  savePendingQuestion
14
- } from "../chunk-GKAKAOKC.js";
14
+ } from "../chunk-UXHMWF4H.js";
15
15
  import {
16
16
  getMachineId
17
- } from "../chunk-DKDDLF5P.js";
18
- import "../chunk-GMI5QZLG.js";
17
+ } from "../chunk-DKWM5T3P.js";
18
+ import "../chunk-QA72MKIT.js";
19
19
  import "../chunk-BSZYIAZL.js";
20
20
  import "../chunk-SAF6HGAA.js";
21
21
  import "../chunk-7QLSKOSU.js";
@@ -34,7 +34,7 @@ import {
34
34
  planElicitationAsk,
35
35
  readElicitationFields,
36
36
  renderElicitationOutput
37
- } from "../chunk-L4C2JXJS.js";
37
+ } from "../chunk-X6RXX2NF.js";
38
38
 
39
39
  // bin/pushary-elicitation-hook.ts
40
40
  import { basename } from "path";
@@ -5,28 +5,28 @@ import {
5
5
  postLiveSession,
6
6
  postLiveSessionUntilAccepted,
7
7
  startLiveSessionHeartbeat
8
- } from "../chunk-C623LWJR.js";
9
- import "../chunk-PMHTCDEO.js";
8
+ } from "../chunk-OLAGKKSR.js";
9
+ import "../chunk-IUN6VOKV.js";
10
10
  import {
11
11
  startProcessOwnership,
12
12
  withSpawnProcessOwnership
13
- } from "../chunk-TF247BET.js";
13
+ } from "../chunk-TEZ2FZD6.js";
14
14
  import {
15
15
  spawnClaude
16
16
  } from "../chunk-XHKBHWLX.js";
17
17
  import {
18
18
  resolveBinary
19
- } from "../chunk-PZA7G4CN.js";
19
+ } from "../chunk-X4ZUUFKV.js";
20
20
  import {
21
21
  getMachineId
22
- } from "../chunk-DKDDLF5P.js";
23
- import "../chunk-GMI5QZLG.js";
22
+ } from "../chunk-DKWM5T3P.js";
23
+ import "../chunk-QA72MKIT.js";
24
24
  import "../chunk-XX2V4QS5.js";
25
25
  import {
26
26
  getApiKey,
27
27
  getBaseUrl
28
28
  } from "../chunk-2UMNXADU.js";
29
- import "../chunk-L4C2JXJS.js";
29
+ import "../chunk-X6RXX2NF.js";
30
30
 
31
31
  // bin/pushary-gemini-bridge.ts
32
32
  import { existsSync } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  isGatingMoment,
4
4
  recordKeylessMoment
5
- } from "../chunk-VZKXBFUA.js";
5
+ } from "../chunk-3HFK3UXM.js";
6
6
  import {
7
7
  readHookInput
8
8
  } from "../chunk-6CUUA7HO.js";
@@ -21,7 +21,7 @@ import {
21
21
  readLastUserPrompt,
22
22
  repoKeyFor,
23
23
  reportEvent
24
- } from "../chunk-4XZCDSNG.js";
24
+ } from "../chunk-GTZLL7F4.js";
25
25
  import {
26
26
  DEFAULT_SESSION,
27
27
  askUser,
@@ -29,21 +29,21 @@ import {
29
29
  savePendingQuestion,
30
30
  sendNotification,
31
31
  waitForAnswer
32
- } from "../chunk-GKAKAOKC.js";
32
+ } from "../chunk-UXHMWF4H.js";
33
33
  import {
34
34
  deriveActionBody,
35
35
  deriveBlocker,
36
36
  deriveToolTarget,
37
37
  describeToolCall,
38
38
  scopePathFor
39
- } from "../chunk-KOPUTJQC.js";
39
+ } from "../chunk-TG3T3M4K.js";
40
40
  import {
41
41
  getMachineId
42
- } from "../chunk-DKDDLF5P.js";
43
- import "../chunk-GMI5QZLG.js";
42
+ } from "../chunk-DKWM5T3P.js";
43
+ import "../chunk-QA72MKIT.js";
44
44
  import "../chunk-BSZYIAZL.js";
45
45
  import "../chunk-SAF6HGAA.js";
46
- import "../chunk-OFRNZWC4.js";
46
+ import "../chunk-IUWRVTQK.js";
47
47
  import "../chunk-7QLSKOSU.js";
48
48
  import "../chunk-KZERVKTD.js";
49
49
  import "../chunk-XX2V4QS5.js";
@@ -58,7 +58,7 @@ import {
58
58
  hookWaitClamped,
59
59
  hookWaitDeadline,
60
60
  resolveGate
61
- } from "../chunk-L4C2JXJS.js";
61
+ } from "../chunk-X6RXX2NF.js";
62
62
 
63
63
  // bin/pushary-gemini-hook.ts
64
64
  import { basename } from "path";
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePreToolUse
4
- } from "../chunk-EJT2ER6G.js";
5
- import "../chunk-ATBKJNWS.js";
6
- import "../chunk-VZKXBFUA.js";
4
+ } from "../chunk-GSSFSVAQ.js";
5
+ import "../chunk-6EKQZA6R.js";
6
+ import "../chunk-NCVIWGVA.js";
7
+ import "../chunk-3HFK3UXM.js";
7
8
  import {
8
9
  readHookInput
9
10
  } from "../chunk-6CUUA7HO.js";
10
11
  import "../chunk-YHG74UFF.js";
11
- import "../chunk-4XZCDSNG.js";
12
- import "../chunk-GKAKAOKC.js";
13
- import "../chunk-KOPUTJQC.js";
14
- import "../chunk-DKDDLF5P.js";
15
- import "../chunk-GMI5QZLG.js";
12
+ import "../chunk-GTZLL7F4.js";
13
+ import "../chunk-UXHMWF4H.js";
14
+ import "../chunk-TG3T3M4K.js";
15
+ import "../chunk-DKWM5T3P.js";
16
+ import "../chunk-QA72MKIT.js";
16
17
  import {
17
18
  exitOnHelpFlag
18
19
  } from "../chunk-LURY4WNF.js";
@@ -20,12 +21,12 @@ import "../chunk-3XTFX4CL.js";
20
21
  import "../chunk-DINDL2CF.js";
21
22
  import "../chunk-BSZYIAZL.js";
22
23
  import "../chunk-SAF6HGAA.js";
23
- import "../chunk-OFRNZWC4.js";
24
+ import "../chunk-IUWRVTQK.js";
24
25
  import "../chunk-7QLSKOSU.js";
25
26
  import "../chunk-KZERVKTD.js";
26
27
  import "../chunk-XX2V4QS5.js";
27
28
  import "../chunk-2UMNXADU.js";
28
- import "../chunk-L4C2JXJS.js";
29
+ import "../chunk-X6RXX2NF.js";
29
30
 
30
31
  // bin/pushary-hook.ts
31
32
  exitOnHelpFlag("hook");
@@ -6,14 +6,14 @@ import "../chunk-3EGEA4KH.js";
6
6
  import {
7
7
  checkApiKey,
8
8
  describeKeyCheck
9
- } from "../chunk-I5L6SK5V.js";
9
+ } from "../chunk-BLODMQKJ.js";
10
10
  import {
11
11
  createIo
12
12
  } from "../chunk-5RUIFDTP.js";
13
13
  import {
14
14
  readKeySource,
15
15
  writeKey
16
- } from "../chunk-V6N4Q223.js";
16
+ } from "../chunk-3CUDMTL4.js";
17
17
  import {
18
18
  parseFlags
19
19
  } from "../chunk-GMXKITVA.js";
@@ -26,7 +26,7 @@ import {
26
26
  getPackageVersion
27
27
  } from "../chunk-DINDL2CF.js";
28
28
  import "../chunk-SAF6HGAA.js";
29
- import "../chunk-OFRNZWC4.js";
29
+ import "../chunk-IUWRVTQK.js";
30
30
  import {
31
31
  UsageError
32
32
  } from "../chunk-7QLSKOSU.js";
@@ -37,7 +37,7 @@ import "../chunk-XX2V4QS5.js";
37
37
  import "../chunk-2UMNXADU.js";
38
38
  import {
39
39
  isValidApiKey
40
- } from "../chunk-L4C2JXJS.js";
40
+ } from "../chunk-X6RXX2NF.js";
41
41
 
42
42
  // bin/pushary-login.ts
43
43
  exitOnHelpFlag("login");