@phnx-labs/agents-cli 1.22.121 → 1.22.123

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 (247) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/README.md +53 -53
  3. package/dist/bootstrap.js +22 -17
  4. package/dist/cli/command-registry.d.ts +0 -1
  5. package/dist/cli/command-registry.js +2 -12
  6. package/dist/commands/auth.js +13 -4
  7. package/dist/commands/browser.js +3 -4
  8. package/dist/commands/cloud-transcripts.d.ts +7 -0
  9. package/dist/commands/cloud-transcripts.js +100 -0
  10. package/dist/commands/cloud.js +5 -0
  11. package/dist/commands/computer.d.ts +0 -12
  12. package/dist/commands/computer.js +14 -124
  13. package/dist/commands/config.js +5 -4
  14. package/dist/commands/daemon-index.d.ts +2 -0
  15. package/dist/commands/daemon-index.js +44 -0
  16. package/dist/commands/daemon.js +13 -8
  17. package/dist/commands/doctor.js +3 -4
  18. package/dist/commands/exec.d.ts +5 -0
  19. package/dist/commands/exec.js +35 -7
  20. package/dist/commands/feed-watch.js +12 -0
  21. package/dist/commands/feed.d.ts +1 -1
  22. package/dist/commands/feed.js +7 -4
  23. package/dist/commands/insights.js +3 -1
  24. package/dist/commands/inspect.js +1 -1
  25. package/dist/commands/logs.js +2 -1
  26. package/dist/commands/mailboxes.js +1 -1
  27. package/dist/commands/models.js +1 -1
  28. package/dist/commands/projects.js +3 -3
  29. package/dist/commands/prune.js +6 -28
  30. package/dist/commands/ps-roster.d.ts +0 -1
  31. package/dist/commands/ps-roster.js +2 -21
  32. package/dist/commands/ps.js +13 -1
  33. package/dist/commands/recordings.d.ts +2 -0
  34. package/dist/commands/recordings.js +117 -0
  35. package/dist/commands/routines.js +1 -1
  36. package/dist/commands/secrets-passthrough.js +3 -3
  37. package/dist/commands/send.js +33 -20
  38. package/dist/commands/sessions-backfill.d.ts +1 -0
  39. package/dist/commands/sessions-backfill.js +48 -13
  40. package/dist/commands/sessions-migrate.d.ts +1 -1
  41. package/dist/commands/sessions-migrate.js +11 -10
  42. package/dist/commands/sessions-optimize.d.ts +1 -0
  43. package/dist/commands/sessions-optimize.js +7 -4
  44. package/dist/commands/sessions-resume.js +8 -1
  45. package/dist/commands/sessions-stats.d.ts +2 -0
  46. package/dist/commands/sessions-stats.js +24 -7
  47. package/dist/commands/sessions.d.ts +5 -11
  48. package/dist/commands/sessions.js +8 -236
  49. package/dist/commands/setup-computer.js +1 -2
  50. package/dist/commands/setup-mine.js +0 -1
  51. package/dist/commands/setup.js +1 -1
  52. package/dist/commands/sync.js +101 -1
  53. package/dist/commands/teams.js +2 -2
  54. package/dist/commands/testdata/feed-hub.js +11 -0
  55. package/dist/commands/trash.d.ts +0 -1
  56. package/dist/commands/trash.js +74 -10
  57. package/dist/lib/accounting/usage-sync.js +7 -0
  58. package/dist/lib/agent-modes.d.ts +1 -1
  59. package/dist/lib/agent-modes.js +11 -5
  60. package/dist/lib/auth-mint.d.ts +4 -0
  61. package/dist/lib/auth-mint.js +6 -4
  62. package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
  63. package/dist/lib/browser/native-history.test-fixture.js +43 -0
  64. package/dist/lib/browser/paths.d.ts +5 -0
  65. package/dist/lib/browser/paths.js +7 -1
  66. package/dist/lib/browser/sessions-list.d.ts +28 -1
  67. package/dist/lib/browser/sessions-list.js +137 -25
  68. package/dist/lib/channels/providers/rush.d.ts +2 -1
  69. package/dist/lib/channels/providers/rush.js +2 -2
  70. package/dist/lib/channels/providers/session.d.ts +1 -0
  71. package/dist/lib/channels/providers/session.js +23 -12
  72. package/dist/lib/channels/registry.d.ts +9 -2
  73. package/dist/lib/channels/send.d.ts +5 -10
  74. package/dist/lib/channels/send.js +88 -50
  75. package/dist/lib/cloud/rush.d.ts +6 -0
  76. package/dist/lib/cloud/rush.js +18 -3
  77. package/dist/lib/computer-client.d.ts +19 -0
  78. package/dist/lib/computer-client.js +104 -0
  79. package/dist/lib/config-keys.d.ts +5 -1
  80. package/dist/lib/config-keys.js +14 -11
  81. package/dist/lib/daemon/auth-sync-service.js +13 -0
  82. package/dist/lib/daemon/daemon.js +20 -23
  83. package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
  84. package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
  85. package/dist/lib/daemon-services.d.ts +2 -1
  86. package/dist/lib/daemon-services.js +17 -10
  87. package/dist/lib/daemon-webhooks.d.ts +1 -1
  88. package/dist/lib/daemon-webhooks.js +1 -1
  89. package/dist/lib/device-config.d.ts +4 -1
  90. package/dist/lib/device-config.js +58 -8
  91. package/dist/lib/devices/doctor-findings.d.ts +2 -3
  92. package/dist/lib/devices/doctor-findings.js +10 -19
  93. package/dist/lib/event-provenance.d.ts +1 -0
  94. package/dist/lib/event-provenance.js +2 -0
  95. package/dist/lib/exec.d.ts +1 -0
  96. package/dist/lib/exec.js +20 -15
  97. package/dist/lib/feed/pr-status.d.ts +5 -1
  98. package/dist/lib/feed/pr-status.js +44 -3
  99. package/dist/lib/feed/tool-activity.js +9 -6
  100. package/dist/lib/feed/tools.d.ts +4 -1
  101. package/dist/lib/feed/tools.js +8 -11
  102. package/dist/lib/feed-broadcast.d.ts +5 -3
  103. package/dist/lib/feed-broadcast.js +47 -36
  104. package/dist/lib/fleet-shared-state.d.ts +5 -0
  105. package/dist/lib/fleet-shared-state.js +8 -0
  106. package/dist/lib/github/project-prs.d.ts +4 -1
  107. package/dist/lib/github/project-prs.js +20 -7
  108. package/dist/lib/help.d.ts +1 -0
  109. package/dist/lib/help.js +8 -0
  110. package/dist/lib/helper-versions.js +1 -1
  111. package/dist/lib/hosts/passthrough.js +5 -9
  112. package/dist/lib/hosts/remote-cmd.d.ts +2 -7
  113. package/dist/lib/hosts/remote-cmd.js +14 -22
  114. package/dist/lib/hosts/routing-flag.d.ts +22 -0
  115. package/dist/lib/hosts/routing-flag.js +127 -14
  116. package/dist/lib/identity/index.d.ts +22 -0
  117. package/dist/lib/identity/index.js +3 -0
  118. package/dist/lib/installations/migrate.d.ts +7 -0
  119. package/dist/lib/installations/migrate.js +99 -88
  120. package/dist/lib/installations/versions.js +2 -2
  121. package/dist/lib/launch-identity.d.ts +6 -1
  122. package/dist/lib/launch-identity.js +12 -2
  123. package/dist/lib/menubar/install-menubar.d.ts +1 -0
  124. package/dist/lib/menubar/install-menubar.js +8 -5
  125. package/dist/lib/menubar/snapshot.js +2 -3
  126. package/dist/lib/notify.d.ts +7 -14
  127. package/dist/lib/notify.js +29 -75
  128. package/dist/lib/owner-message.d.ts +4 -6
  129. package/dist/lib/owner-message.js +12 -11
  130. package/dist/lib/owner-notify-tokens.d.ts +49 -0
  131. package/dist/lib/owner-notify-tokens.js +214 -0
  132. package/dist/lib/owner-notify.d.ts +75 -0
  133. package/dist/lib/owner-notify.js +144 -0
  134. package/dist/lib/plugins/plugins.d.ts +7 -1
  135. package/dist/lib/plugins/plugins.js +26 -5
  136. package/dist/lib/pr-land-detach.js +2 -2
  137. package/dist/lib/recordings/config.d.ts +11 -0
  138. package/dist/lib/recordings/config.js +54 -0
  139. package/dist/lib/recordings/identity.d.ts +12 -0
  140. package/dist/lib/recordings/identity.js +57 -0
  141. package/dist/lib/recordings/ledger.d.ts +16 -0
  142. package/dist/lib/recordings/ledger.js +141 -0
  143. package/dist/lib/recordings/model.d.ts +29 -0
  144. package/dist/lib/recordings/model.js +28 -0
  145. package/dist/lib/recordings/pipeline.d.ts +44 -0
  146. package/dist/lib/recordings/pipeline.js +272 -0
  147. package/dist/lib/recordings/process.d.ts +17 -0
  148. package/dist/lib/recordings/process.js +94 -0
  149. package/dist/lib/recordings/service.d.ts +15 -0
  150. package/dist/lib/recordings/service.js +45 -0
  151. package/dist/lib/recordings/settle.d.ts +21 -0
  152. package/dist/lib/recordings/settle.js +92 -0
  153. package/dist/lib/recordings/transcode.d.ts +13 -0
  154. package/dist/lib/recordings/transcode.js +44 -0
  155. package/dist/lib/refresh.js +4 -1
  156. package/dist/lib/reminders.d.ts +0 -1
  157. package/dist/lib/reminders.js +1 -1
  158. package/dist/lib/reserved-stores.d.ts +3 -0
  159. package/dist/lib/reserved-stores.js +13 -0
  160. package/dist/lib/routine-notify-owner.d.ts +3 -23
  161. package/dist/lib/routine-notify-owner.js +26 -107
  162. package/dist/lib/rush-api.d.ts +1 -0
  163. package/dist/lib/rush-api.js +1 -0
  164. package/dist/lib/scheduling/routines.d.ts +1 -1
  165. package/dist/lib/scheduling/routines.js +1 -1
  166. package/dist/lib/session/active.d.ts +18 -2
  167. package/dist/lib/session/active.js +47 -37
  168. package/dist/lib/session/cloud.js +18 -45
  169. package/dist/lib/session/db.d.ts +3 -1
  170. package/dist/lib/session/db.js +64 -32
  171. package/dist/lib/session/glance-files.d.ts +4 -3
  172. package/dist/lib/session/glance-files.js +31 -0
  173. package/dist/lib/session/inject-target.js +12 -2
  174. package/dist/lib/session/pid-registry.d.ts +2 -0
  175. package/dist/lib/session/pid-registry.js +6 -2
  176. package/dist/lib/session/presentation.d.ts +21 -0
  177. package/dist/lib/session/presentation.js +198 -0
  178. package/dist/lib/session/projection.js +9 -2
  179. package/dist/lib/sqlite.d.ts +3 -1
  180. package/dist/lib/sqlite.js +7 -3
  181. package/dist/lib/staleness/index.js +12 -0
  182. package/dist/lib/staleness/types.d.ts +5 -0
  183. package/dist/lib/standalone-tools.js +1 -1
  184. package/dist/lib/startup/command-registry.js +10 -5
  185. package/dist/lib/state.d.ts +2 -5
  186. package/dist/lib/state.js +3 -11
  187. package/dist/lib/sync-delete.d.ts +21 -0
  188. package/dist/lib/sync-delete.js +113 -0
  189. package/dist/lib/terminal/inject.js +1 -1
  190. package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
  191. package/dist/lib/testdata/owner-notify-api.js +102 -0
  192. package/dist/lib/trash.d.ts +14 -0
  193. package/dist/lib/trash.js +75 -0
  194. package/dist/lib/types.d.ts +0 -34
  195. package/package.json +1 -3
  196. package/dist/commands/feedback.d.ts +0 -2
  197. package/dist/commands/feedback.js +0 -68
  198. package/dist/commands/humans.d.ts +0 -2
  199. package/dist/commands/humans.js +0 -83
  200. package/dist/commands/modes.d.ts +0 -2
  201. package/dist/commands/modes.js +0 -134
  202. package/dist/commands/monitors.d.ts +0 -2
  203. package/dist/commands/monitors.js +0 -1070
  204. package/dist/commands/reminders.d.ts +0 -2
  205. package/dist/commands/reminders.js +0 -49
  206. package/dist/lib/channels/owner-forward.d.ts +0 -25
  207. package/dist/lib/channels/owner-forward.js +0 -78
  208. package/dist/lib/channels/owner-sink.d.ts +0 -10
  209. package/dist/lib/channels/owner-sink.js +0 -26
  210. package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
  211. package/dist/lib/daemon/monitor-engine-service.js +0 -25
  212. package/dist/lib/humans.d.ts +0 -12
  213. package/dist/lib/humans.js +0 -64
  214. package/dist/lib/monitors/config.d.ts +0 -77
  215. package/dist/lib/monitors/config.js +0 -405
  216. package/dist/lib/monitors/dispatch.d.ts +0 -10
  217. package/dist/lib/monitors/dispatch.js +0 -72
  218. package/dist/lib/monitors/engine.d.ts +0 -45
  219. package/dist/lib/monitors/engine.js +0 -243
  220. package/dist/lib/monitors/fingerprint.d.ts +0 -3
  221. package/dist/lib/monitors/fingerprint.js +0 -43
  222. package/dist/lib/monitors/pid-watch.d.ts +0 -4
  223. package/dist/lib/monitors/pid-watch.js +0 -14
  224. package/dist/lib/monitors/remote.d.ts +0 -31
  225. package/dist/lib/monitors/remote.js +0 -63
  226. package/dist/lib/monitors/sources/command.d.ts +0 -4
  227. package/dist/lib/monitors/sources/command.js +0 -20
  228. package/dist/lib/monitors/sources/device.d.ts +0 -3
  229. package/dist/lib/monitors/sources/device.js +0 -31
  230. package/dist/lib/monitors/sources/failure.d.ts +0 -5
  231. package/dist/lib/monitors/sources/failure.js +0 -25
  232. package/dist/lib/monitors/sources/file.d.ts +0 -4
  233. package/dist/lib/monitors/sources/file.js +0 -46
  234. package/dist/lib/monitors/sources/http.d.ts +0 -3
  235. package/dist/lib/monitors/sources/http.js +0 -25
  236. package/dist/lib/monitors/sources/index.d.ts +0 -5
  237. package/dist/lib/monitors/sources/index.js +0 -22
  238. package/dist/lib/monitors/sources/poll.d.ts +0 -1
  239. package/dist/lib/monitors/sources/poll.js +0 -1
  240. package/dist/lib/monitors/sources/types.d.ts +0 -9
  241. package/dist/lib/monitors/sources/webhook.d.ts +0 -3
  242. package/dist/lib/monitors/sources/webhook.js +0 -3
  243. package/dist/lib/monitors/sources/ws.d.ts +0 -4
  244. package/dist/lib/monitors/sources/ws.js +0 -35
  245. package/dist/lib/monitors/state.d.ts +0 -51
  246. package/dist/lib/monitors/state.js +0 -221
  247. /package/dist/{lib/monitors/sources/types.js → commands/testdata/feed-hub.d.ts} +0 -0
@@ -14,6 +14,7 @@ import { detectOverdueJobs, notifyOverdue } from '../overdue.js';
14
14
  import { runCatchup } from '../catchup.js';
15
15
  import { notifyRoutineStart, notifyRoutineFinish, notifyRoutineStartFailed } from '../routine-notify.js';
16
16
  import { notifyOwnerRoutineFinish, notifyOwnerRoutineStartFailed } from '../routine-notify-owner.js';
17
+ import { describeOwnerResult } from '../owner-notify.js';
17
18
  import { redactSecrets } from '../redact.js';
18
19
  import { getAgentsBinPath, getCliLaunch, BUN_VIRTUAL_ROOT } from '../cli-entry.js';
19
20
  import { localBinDir } from '../platform/posixpath.js';
@@ -503,11 +504,10 @@ export function assertTestDaemonHome(daemonDir = getDaemonDir(), testHome = proc
503
504
  }
504
505
  export async function runDaemon() {
505
506
  assertTestDaemonHome();
506
- const [{ SessionIndexService }, { SessionSummarizerService }, { SessionTitleService }, { MonitorEngineService }, { AccountUsageService, AccountAuthService }, { CatchupService }, { WatchdogService }, { DeviceProbeService }, { SelfHealService }, { SelfUpdateService }, { HarnessUpdateService }, { AuthSyncService }, { UsageSyncService }, { StateDirCheckService }, { SessionStateService }, { FeedStreamService }, { AttentionNotifyService }, { WebhookReceiverService }, { HeartbeatService }, { TmuxReapService },] = await Promise.all([
507
+ const [{ SessionIndexService }, { SessionSummarizerService }, { SessionTitleService }, { AccountUsageService, AccountAuthService }, { CatchupService }, { WatchdogService }, { DeviceProbeService }, { SelfHealService }, { SelfUpdateService }, { HarnessUpdateService }, { AuthSyncService }, { UsageSyncService }, { StateDirCheckService }, { SessionStateService }, { FeedStreamService }, { AttentionNotifyService }, { OwnerDeviceDeliveryService }, { RecordingsService }, { WebhookReceiverService }, { HeartbeatService }, { TmuxReapService },] = await Promise.all([
507
508
  import('./session-index-service.js'),
508
509
  import('./session-summarizer-service.js'),
509
510
  import('./session-title-service.js'),
510
- import('./monitor-engine-service.js'),
511
511
  import('./account-state-daemon-service.js'),
512
512
  import('./catchup-service.js'),
513
513
  import('./watchdog-service.js'),
@@ -521,6 +521,8 @@ export async function runDaemon() {
521
521
  import('./session-state-service.js'),
522
522
  import('./feed-stream-service.js'),
523
523
  import('./attention-notify-service.js'),
524
+ import('./owner-device-delivery-service.js'),
525
+ import('../recordings/service.js'),
524
526
  import('./webhook-receiver-service.js'),
525
527
  import('./heartbeat-service.js'),
526
528
  import('./tmux-reap-service.js'),
@@ -597,11 +599,9 @@ export async function runDaemon() {
597
599
  supervisor.register(new FeedStreamService(), { enabled: isEnabled('feed-stream') });
598
600
  if (!isEnabled('feed-stream'))
599
601
  log('INFO', 'Shared feed stream service disabled');
600
- const monitorEngineSvc = new MonitorEngineService();
601
- if (isEnabled('monitors'))
602
- supervisor.register(monitorEngineSvc);
603
- else
604
- log('INFO', 'Monitor engine disabled');
602
+ supervisor.register(new RecordingsService(), { enabled: isEnabled('recordings') });
603
+ if (!isEnabled('recordings'))
604
+ log('INFO', 'CleanShot recordings service disabled');
605
605
  if (isEnabled('account-state'))
606
606
  supervisor.register(new AccountUsageService());
607
607
  else
@@ -632,6 +632,12 @@ export async function runDaemon() {
632
632
  supervisor.register(new AttentionNotifyService());
633
633
  else
634
634
  log('INFO', 'Attention-notify service disabled');
635
+ if (process.platform === 'darwin') {
636
+ if (isEnabled('owner-device-delivery'))
637
+ supervisor.register(new OwnerDeviceDeliveryService());
638
+ else
639
+ log('INFO', 'Owner device-delivery service disabled');
640
+ }
635
641
  if (isEnabled('session-title'))
636
642
  supervisor.register(new SessionTitleService());
637
643
  else
@@ -717,10 +723,10 @@ export async function runDaemon() {
717
723
  catch { }
718
724
  void notifyOwnerRoutineFinish(final)
719
725
  .then((r) => {
720
- if (r.attempts.length && !r.delivered)
721
- log('WARN', `Owner failure-notify for '${config.name}' reached no channel (tried: ${r.attempts.map((a) => a.channel).join(', ')})`);
726
+ if (r && r.suppressed === null && r.delivered.length + r.queued.length === 0)
727
+ log('WARN', `Owner failure-notify for '${config.name}' reached no channel: ${describeOwnerResult(r)}`);
722
728
  })
723
- .catch(() => { });
729
+ .catch((err) => log('WARN', `Owner failure-notify for '${config.name}' failed: ${err.message}`));
724
730
  },
725
731
  }, { kind: 'schedule', scheduledFor: ctx?.scheduledFor });
726
732
  log('INFO', `Job '${config.name}' spawned (run: ${meta.runId}, PID: ${meta.pid})`);
@@ -737,12 +743,12 @@ export async function runDaemon() {
737
743
  notifyRoutineStartFailed(config, message);
738
744
  }
739
745
  catch { }
740
- void notifyOwnerRoutineStartFailed(config, message)
746
+ void notifyOwnerRoutineStartFailed(config, message, ctx?.scheduledFor)
741
747
  .then((r) => {
742
- if (r.attempts.length && !r.delivered)
743
- log('WARN', `Owner start-failure notify for '${config.name}' reached no channel (tried: ${r.attempts.map((a) => a.channel).join(', ')})`);
748
+ if (r.suppressed === null && r.delivered.length + r.queued.length === 0)
749
+ log('WARN', `Owner start-failure notify for '${config.name}' reached no channel: ${describeOwnerResult(r)}`);
744
750
  })
745
- .catch(() => { });
751
+ .catch((err) => log('WARN', `Owner start-failure notify for '${config.name}' failed: ${err.message}`));
746
752
  }
747
753
  };
748
754
  function bootScheduler() {
@@ -870,15 +876,6 @@ export async function runDaemon() {
870
876
  const reloaded = scheduler.listScheduled();
871
877
  log('INFO', `Reloaded ${reloaded.length} jobs`);
872
878
  }
873
- const liveMonitorEngine = monitorEngineSvc.getEngine();
874
- if (liveMonitorEngine && reloadedEnabled('monitors')) {
875
- try {
876
- liveMonitorEngine.reload();
877
- }
878
- catch (err) {
879
- log('ERROR', `Monitor engine reload failed: ${err.message}`);
880
- }
881
- }
882
879
  };
883
880
  // Cleanup removes lifetime, pid, heartbeat, and registry state only when each still belongs to this instance.
884
881
  const handleShutdown = singleShot(async () => {
@@ -0,0 +1,10 @@
1
+ import type { DaemonServiceId } from '../daemon-services.js';
2
+ import { BasePeriodicService, type DaemonContext } from './service.js';
3
+ export declare class OwnerDeviceDeliveryService extends BasePeriodicService {
4
+ readonly id: DaemonServiceId;
5
+ readonly intervalMs = 15000;
6
+ readonly deadlineMs = 60000;
7
+ protected onStart(_ctx: DaemonContext): Promise<void>;
8
+ protected onStop(): Promise<void>;
9
+ protected onTick(ctx: DaemonContext): Promise<void>;
10
+ }
@@ -0,0 +1,28 @@
1
+ import { sendImessage } from '../channels/providers/rush.js';
2
+ import { claimDeviceDeliveries, reportDeviceDelivery, resolveOwnerCredential, selfDeviceName, } from '../owner-notify.js';
3
+ import { BasePeriodicService } from './service.js';
4
+ const OWNER_DEVICE_DELIVERY_TICK_MS = 15_000;
5
+ const OWNER_DEVICE_DELIVERY_DEADLINE_MS = 60_000;
6
+ export class OwnerDeviceDeliveryService extends BasePeriodicService {
7
+ id = 'owner-device-delivery';
8
+ intervalMs = OWNER_DEVICE_DELIVERY_TICK_MS;
9
+ deadlineMs = OWNER_DEVICE_DELIVERY_DEADLINE_MS;
10
+ async onStart(_ctx) { }
11
+ async onStop() { }
12
+ async onTick(ctx) {
13
+ if (!resolveOwnerCredential())
14
+ return;
15
+ const deliveries = await claimDeviceDeliveries(selfDeviceName());
16
+ for (const delivery of deliveries) {
17
+ const sent = await sendImessage(delivery.body, { target: delivery.address });
18
+ if (!sent.ok)
19
+ ctx.log('WARN', `owner-device-delivery: ${delivery.id} to ${delivery.address}: ${sent.error}`);
20
+ try {
21
+ await reportDeviceDelivery(delivery.id, sent.ok ? { ok: true } : { ok: false, error: sent.error ?? 'iMessage send failed' });
22
+ }
23
+ catch (err) {
24
+ ctx.log('WARN', `owner-device-delivery: ${delivery.id} ${sent.ok ? 'sent' : 'failed'} but the result was not recorded: ${err.message}`);
25
+ }
26
+ }
27
+ }
28
+ }
@@ -1,8 +1,9 @@
1
- export type DaemonServiceId = 'scheduler' | 'catchup' | 'monitors' | 'webhook-receiver' | 'self-heal' | 'self-update' | 'account-state' | 'account-auth' | 'watchdog' | 'device-probe' | 'state-dir-check' | 'session-index' | 'session-title' | 'auth-sync' | 'usage-sync' | 'daemon-heartbeat' | 'tmux-reap' | 'session-state' | 'feed-stream' | 'session-summarizer' | 'attention-notify' | 'harness-update';
1
+ export type DaemonServiceId = 'scheduler' | 'catchup' | 'webhook-receiver' | 'self-heal' | 'self-update' | 'account-state' | 'account-auth' | 'watchdog' | 'device-probe' | 'state-dir-check' | 'session-index' | 'session-title' | 'auth-sync' | 'usage-sync' | 'daemon-heartbeat' | 'tmux-reap' | 'session-state' | 'feed-stream' | 'session-summarizer' | 'attention-notify' | 'owner-device-delivery' | 'recordings' | 'harness-update';
2
2
  interface DaemonServiceDef {
3
3
  id: DaemonServiceId;
4
4
  title: string;
5
5
  description: string;
6
+ defaultEnabled?: boolean;
6
7
  }
7
8
  export declare const DAEMON_SERVICES: DaemonServiceDef[];
8
9
  export declare const DAEMON_SERVICE_IDS: DaemonServiceId[];
@@ -14,11 +14,6 @@ export const DAEMON_SERVICES = [
14
14
  title: 'Catch-up recovery',
15
15
  description: 'Supervised pass that re-runs routines whose scheduled fire this device missed (sleep, wedge, or suspend). No-ops while the scheduler gate is off.',
16
16
  },
17
- {
18
- id: 'monitors',
19
- title: 'Monitor engine',
20
- description: 'Watches event sources and triggers monitor-driven routines.',
21
- },
22
17
  {
23
18
  id: 'webhook-receiver',
24
19
  title: 'Webhook receiver',
@@ -94,6 +89,17 @@ export const DAEMON_SERVICES = [
94
89
  title: 'Attention desktop banners',
95
90
  description: 'Posts one actionable desktop banner per new attention item (question / permission / plan review / stall) so the macOS helper can answer it through agents feed answer (PHNX-4004).',
96
91
  },
92
+ {
93
+ id: 'owner-device-delivery',
94
+ title: 'Owner iMessage delivery',
95
+ description: 'macOS only: every 15 s, claims the iMessage notifications your account queued for a device and sends them through Messages, then reports each result. Idle without a Phoenix session or device token (PHNX-4267).',
96
+ },
97
+ {
98
+ id: 'recordings',
99
+ title: 'CleanShot recording publisher',
100
+ description: 'Publishes settled CleanShot videos as organization-only artifacts. Off until enabled by `agents recordings watch`.',
101
+ defaultEnabled: false,
102
+ },
97
103
  {
98
104
  id: 'session-title',
99
105
  title: 'Session titles',
@@ -118,8 +124,8 @@ export const DAEMON_SERVICES = [
118
124
  export const DAEMON_SERVICE_IDS = DAEMON_SERVICES.map((s) => s.id);
119
125
  function defaultServicesConfig() {
120
126
  const services = {};
121
- for (const id of DAEMON_SERVICE_IDS)
122
- services[id] = true;
127
+ for (const service of DAEMON_SERVICES)
128
+ services[service.id] = service.defaultEnabled !== false;
123
129
  return { services };
124
130
  }
125
131
  export function getDaemonServicesConfigPath() {
@@ -156,8 +162,9 @@ export function writeDaemonServicesConfig(cfg) {
156
162
  catch {
157
163
  }
158
164
  const services = {};
159
- for (const id of DAEMON_SERVICE_IDS)
160
- services[id] = cfg.services[id] ?? true;
165
+ for (const service of DAEMON_SERVICES) {
166
+ services[service.id] = cfg.services[service.id] ?? service.defaultEnabled !== false;
167
+ }
161
168
  const out = yaml.stringify({ ...preserved, services }, { sortMapEntries: false });
162
169
  atomicWriteFileSync(filePath, out, 'utf-8');
163
170
  }
@@ -172,7 +179,7 @@ export function setDaemonServiceEnabled(id, enabled) {
172
179
  }
173
180
  export function listDaemonServiceStates() {
174
181
  const cfg = readDaemonServicesConfig();
175
- return DAEMON_SERVICES.map((s) => ({ ...s, enabled: cfg.services[s.id] !== false }));
182
+ return DAEMON_SERVICES.map((s) => ({ ...s, enabled: cfg.services[s.id] }));
176
183
  }
177
184
  function getDaemonServiceActionsPath() {
178
185
  return path.join(getDaemonConfigDir(), 'service-actions.json');
@@ -37,7 +37,7 @@ type Logger = (level: string, message: string) => void;
37
37
  * `server.listen()` surfaces EADDRINUSE as an `'error'` event, so a `try/catch`
38
38
  * around the start call never sees it and the event reaches the process-level
39
39
  * `uncaughtException` handler (`index.ts`), which exits 1 for the supervisor to
40
- * restart — a crash loop that would take the scheduler, monitors, browser IPC,
40
+ * restart — a crash loop that would take the scheduler, browser IPC,
41
41
  * and self-heal down with it. `waitForListening` is what turns that into one
42
42
  * skipped receiver.
43
43
  */
@@ -109,7 +109,7 @@ function reconcileFunnel(publicPort, localPort, log) {
109
109
  * `server.listen()` surfaces EADDRINUSE as an `'error'` event, so a `try/catch`
110
110
  * around the start call never sees it and the event reaches the process-level
111
111
  * `uncaughtException` handler (`index.ts`), which exits 1 for the supervisor to
112
- * restart — a crash loop that would take the scheduler, monitors, browser IPC,
112
+ * restart — a crash loop that would take the scheduler, browser IPC,
113
113
  * and self-heal down with it. `waitForListening` is what turns that into one
114
114
  * skipped receiver.
115
115
  */
@@ -8,6 +8,7 @@ interface ConfigKeySpecBase {
8
8
  description: string;
9
9
  defaultValue?: unknown;
10
10
  validate?: (value: unknown) => string | null;
11
+ normalize?: (value: unknown) => unknown;
11
12
  }
12
13
  export type ConfigKeySpec = (ConfigKeySpecBase & {
13
14
  scope: 'user';
@@ -28,7 +29,9 @@ interface ConfigTarget {
28
29
  }
29
30
  declare const DEVICE_ROLES: readonly ["worker", "personal", "desktop"];
30
31
  declare const AUTO_POOL_MODES: readonly ["workers", "all"];
31
- export declare const MENUBAR_TABS: readonly ["home", "sessions", "inbox", "projects"];
32
+ export declare const MENUBAR_TABS: readonly ["home", "goals", "projects", "sessions", "inbox"];
33
+ export declare const MENUBAR_HOME_GOALS: readonly ["company", "week", "myWeek", "myDay"];
34
+ export declare function resolveMenubarTabOrder(stored: readonly string[]): string[];
32
35
  export declare const CONFIG_KEYS: readonly ConfigKeySpec[];
33
36
  export declare function configKeySpec(name: string): ConfigKeySpec;
34
37
  export declare function assertValidValue(spec: ConfigKeySpec, value: unknown): void;
@@ -14,7 +14,18 @@ const SSH_AUTH_METHODS = ['key', 'password'];
14
14
  const DEVICE_ROLES = ['worker', 'personal', 'desktop'];
15
15
  const AUTO_POOL_MODES = ['workers', 'all'];
16
16
  const DEVICE_FORM_FACTORS = ['laptop', 'desktop', 'server', 'unknown'];
17
- export const MENUBAR_TABS = ['home', 'sessions', 'inbox', 'projects'];
17
+ export const MENUBAR_TABS = ['home', 'goals', 'projects', 'sessions', 'inbox'];
18
+ const MENUBAR_TABS_ADDED_LATER = ['goals'];
19
+ export const MENUBAR_HOME_GOALS = ['company', 'week', 'myWeek', 'myDay'];
20
+ export function resolveMenubarTabOrder(stored) {
21
+ const known = MENUBAR_TABS;
22
+ const tabs = [];
23
+ for (const id of stored) {
24
+ if (known.includes(id) && !tabs.includes(id))
25
+ tabs.push(id);
26
+ }
27
+ return [...tabs, ...known.filter((t) => !tabs.includes(t))];
28
+ }
18
29
  function oneOf(name, allowed) {
19
30
  return (v) => (allowed.includes(v) ? null : `${name} must be one of ${allowed.join(' | ')}.`);
20
31
  }
@@ -91,7 +102,7 @@ export const CONFIG_KEYS = [
91
102
  scope: 'device',
92
103
  visibility: 'machine',
93
104
  type: 'string',
94
- description: "Which browser THIS machine shows YOU a page in (an .html artifact, `agents feedback`, a login " +
105
+ description: "Which browser THIS machine shows YOU a page in (an .html artifact, a login " +
95
106
  "dashboard): a profile name, or `os` for the OS default handler. Unset follows browser.profile. " +
96
107
  "Distinct from browser.profile, which is the profile agents DRIVE — see RUSH-2709 for why " +
97
108
  "collapsing the two was a mistake. Set it to `os` to keep the OS default handler.",
@@ -172,7 +183,7 @@ export const CONFIG_KEYS = [
172
183
  defaultValue: true,
173
184
  description: 'Whether the daemon may run on this device at all (browser IPC, watchdog, and the ' +
174
185
  'routines scheduler). Disabling is the top-level kill switch: nothing auto-starts the daemon while it ' +
175
- 'is set, including `routines add`/`routines start`/`routines catchup`/`monitors add`/webhook triggers. ' +
186
+ 'is set, including `routines add`/`routines start`/`routines catchup`/webhook triggers. ' +
176
187
  '`agents daemon start` still starts it explicitly.',
177
188
  },
178
189
  {
@@ -539,12 +550,20 @@ export const CONFIG_KEYS = [
539
550
  type: 'string-list',
540
551
  defaultValue: [...MENUBAR_TABS],
541
552
  description: `AGI Menu: the order of the tab bar — every one of ${MENUBAR_TABS.join(', ')} exactly once. ` +
542
- 'Settings is always last and is not listed. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
553
+ 'Settings is always last and is not listed. An order saved before Goals existed may omit goals; ' +
554
+ 'it reads back with goals appended. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
543
555
  validate: (v) => {
544
556
  const tabs = v;
545
- const ok = tabs.length === MENUBAR_TABS.length && MENUBAR_TABS.every((t) => tabs.includes(t));
546
- return ok ? null : `menubar.menu.tabOrder must list each of ${MENUBAR_TABS.join(', ')} exactly once.`;
557
+ const required = MENUBAR_TABS.filter((t) => !MENUBAR_TABS_ADDED_LATER.includes(t));
558
+ const ok = new Set(tabs).size === tabs.length
559
+ && tabs.every((t) => MENUBAR_TABS.includes(t))
560
+ && required.every((t) => tabs.includes(t));
561
+ return ok
562
+ ? null
563
+ : `menubar.menu.tabOrder must list each of ${MENUBAR_TABS.join(', ')} exactly once ` +
564
+ `(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and is appended).`;
547
565
  },
566
+ normalize: (v) => (Array.isArray(v) ? resolveMenubarTabOrder(v.map(String)) : v),
548
567
  },
549
568
  {
550
569
  name: 'menubar.menu.hiddenTabs',
@@ -594,6 +613,31 @@ export const CONFIG_KEYS = [
594
613
  'conventional-commit type in the title), or day (Today, Yesterday, Earlier this week).',
595
614
  validate: oneOf('menubar.menu.prGroupMerged', ['none', 'type', 'day']),
596
615
  },
616
+ {
617
+ name: 'menubar.menu.homeGoals',
618
+ yamlKey: 'menubarMenuHomeGoals',
619
+ scope: 'user',
620
+ type: 'string-list',
621
+ defaultValue: ['company'],
622
+ description: `AGI Menu: the goal levels shown on Home, in order — any of ${MENUBAR_HOME_GOALS.join(', ')} ` +
623
+ '(company quarter goal, company week goal, your week goal, your day goal). Empty shows none.',
624
+ validate: (v) => {
625
+ const levels = v;
626
+ const bad = levels.find((l) => !MENUBAR_HOME_GOALS.includes(l));
627
+ if (bad !== undefined)
628
+ return `menubar.menu.homeGoals: "${bad}" is not one of ${MENUBAR_HOME_GOALS.join(', ')}.`;
629
+ const dup = levels.find((l, i) => levels.indexOf(l) !== i);
630
+ return dup === undefined ? null : `menubar.menu.homeGoals lists "${dup}" twice.`;
631
+ },
632
+ },
633
+ {
634
+ name: 'menubar.statusbar.goalCountdown',
635
+ yamlKey: 'menubarStatusbarGoalCountdown',
636
+ scope: 'user',
637
+ type: 'bool',
638
+ defaultValue: false,
639
+ description: 'AGI Menu: show the countdown to the next goal deadline beside the menu-bar icon.',
640
+ },
597
641
  ];
598
642
  function dynamicAgentAutoUpdateSpec(name) {
599
643
  const match = name.match(/^updates\.(.+)\.auto$/);
@@ -745,7 +789,9 @@ export function getConfigValue(name, opts) {
745
789
  const spec = configKeySpec(name);
746
790
  if (spec.scope === 'user') {
747
791
  const value = readMeta({ migrate: false }).config?.[spec.yamlKey];
748
- return { spec, value, source: value !== undefined ? 'user' : 'default' };
792
+ if (value === undefined)
793
+ return { spec, value, source: 'default' };
794
+ return { spec, value: spec.normalize ? spec.normalize(value) : value, source: 'user' };
749
795
  }
750
796
  ensureDeviceConfigMigrated();
751
797
  if (opts?.fleet) {
@@ -766,7 +812,9 @@ export async function getConfigValueAsync(name, opts) {
766
812
  const spec = configKeySpec(name);
767
813
  if (spec.scope === 'user') {
768
814
  const value = readMeta({ migrate: false }).config?.[spec.yamlKey];
769
- return { spec, value, source: value !== undefined ? 'user' : 'default' };
815
+ if (value === undefined)
816
+ return { spec, value, source: 'default' };
817
+ return { spec, value: spec.normalize ? spec.normalize(value) : value, source: 'user' };
770
818
  }
771
819
  ensureDeviceConfigMigrated();
772
820
  if (opts?.fleet) {
@@ -855,6 +903,8 @@ export function setConfigValue(name, value, opts) {
855
903
  ensureDeviceConfigMigrated();
856
904
  const spec = configKeySpec(name);
857
905
  assertValidValue(spec, value);
906
+ if (spec.normalize)
907
+ value = spec.normalize(value);
858
908
  if (spec.scope === 'user') {
859
909
  if (opts?.fleet) {
860
910
  throw new Error(`Config key '${spec.name}' is user-scope (already fleet-wide) — --fleet does not apply.`);
@@ -3,14 +3,13 @@ import type { DuplicateVersionHook } from '../hooks/install.js';
3
3
  import type { AgentsBinaryShadow } from '../binary-shadow.js';
4
4
  import type { LeakedDaemon } from '../daemon/leaked-daemons.js';
5
5
  import type { RcSecretFinding } from '../secrets-types.js';
6
- import type { OwnerSinkStatus } from '../channels/owner-sink.js';
7
6
  import { type WindowsSshEnrollmentAudit } from './windows-ssh-enrollment.js';
8
7
  import type { SyncStatusRow, OrphanRow } from '../drift.js';
9
8
  import type { FetchStatusMarker } from '../auto-pull.js';
10
9
  import { type VersionResourceReport } from '../doctor-diff.js';
11
10
  import type { FleetDivergence, FleetHookRuntimeState, FleetVersionSignIn } from './fleet-divergence.js';
12
11
  export type FindingSeverity = 'critical' | 'warning';
13
- export declare const ALL_FINDING_KINDS: readonly ["logged-out", "logout-unprovable", "missing-hook", "missing-plugin", "unwired-hook", "hook-runtime-broken", "hook-runtime-visibility-unavailable", "cli-missing", "missing-resource", "content-drift", "never-synced", "stale", "repo-behind", "repo-drift", "fleet-resource-gap", "host-cli-missing", "host-cli-invalid", "version-skew", "orphan", "duplicate-hook", "duplicate-hook-drift", "rc-secret-export", "env-secret-export", "auth-bundle-wrong-backend", "exec-policy", "ssh-key-enrollment", "stale-cli", "binary-shadow", "owner-sink-unreachable", "leaked-daemon"];
12
+ export declare const ALL_FINDING_KINDS: readonly ["logged-out", "logout-unprovable", "missing-hook", "missing-plugin", "unwired-hook", "hook-runtime-broken", "hook-runtime-visibility-unavailable", "cli-missing", "missing-resource", "content-drift", "never-synced", "stale", "repo-behind", "repo-drift", "fleet-resource-gap", "host-cli-missing", "host-cli-invalid", "version-skew", "orphan", "duplicate-hook", "duplicate-hook-drift", "rc-secret-export", "env-secret-export", "auth-bundle-wrong-backend", "exec-policy", "ssh-key-enrollment", "stale-cli", "binary-shadow", "owner-not-signed-in", "leaked-daemon"];
14
13
  export declare const FINDING_SEVERITY: Record<FindingKind, FindingSeverity>;
15
14
  export type FindingKind = typeof ALL_FINDING_KINDS[number];
16
15
  export interface DoctorFinding {
@@ -53,7 +52,7 @@ export interface LocalFindingInputs {
53
52
  };
54
53
  windowsSshEnrollment?: WindowsSshEnrollmentAudit | null;
55
54
  isolatedVersions?: string[];
56
- ownerSink?: OwnerSinkStatus;
55
+ ownerSignedIn?: boolean;
57
56
  binaryShadows?: AgentsBinaryShadow[];
58
57
  leakedDaemons?: LeakedDaemon[];
59
58
  }
@@ -20,8 +20,8 @@
20
20
  * unwired-hook (a hook on disk that settings.json never fires) ·
21
21
  * hook-runtime-broken (a wired hook's generated shim wrapper is
22
22
  * missing or unusable) · cli-missing · ssh-key-enrollment ·
23
- * owner-sink-unreachable (the feed/notify owner lane
24
- * cannot reach the owner from this box).
23
+ * owner-not-signed-in (no Phoenix session or worker device
24
+ * token, so this box cannot reach the owner).
25
25
  * WARNING — logout-unprovable (hedged) · missing-resource · content-drift ·
26
26
  * never-synced · stale · repo-behind · repo-drift · version-skew ·
27
27
  * fleet-resource-gap · hook-runtime-visibility-unavailable · orphan · duplicate-hook ·
@@ -97,7 +97,7 @@ export const ALL_FINDING_KINDS = [
97
97
  'ssh-key-enrollment',
98
98
  'stale-cli',
99
99
  'binary-shadow',
100
- 'owner-sink-unreachable',
100
+ 'owner-not-signed-in',
101
101
  'leaked-daemon',
102
102
  ];
103
103
  export const FINDING_SEVERITY = {
@@ -107,7 +107,7 @@ export const FINDING_SEVERITY = {
107
107
  'unwired-hook': 'critical',
108
108
  'hook-runtime-broken': 'critical',
109
109
  'cli-missing': 'critical',
110
- 'owner-sink-unreachable': 'critical',
110
+ 'owner-not-signed-in': 'critical',
111
111
  'logout-unprovable': 'warning',
112
112
  'hook-runtime-visibility-unavailable': 'warning',
113
113
  'missing-resource': 'warning',
@@ -216,8 +216,8 @@ export function remediationFor(finding) {
216
216
  return 'remove or repoint the shadowing agents install(s)';
217
217
  case 'leaked-daemon':
218
218
  return 'kill <pid>';
219
- case 'owner-sink-unreachable':
220
- return 'check the channel transport: iMessage needs macOS, Slack needs SLACK_BOT_TOKEN in env or the webhooks bundle';
219
+ case 'owner-not-signed-in':
220
+ return 'agents auth login';
221
221
  }
222
222
  }
223
223
  function finding(f) {
@@ -241,19 +241,10 @@ export function buildLocalFindings(input) {
241
241
  message: `${agentName(agent)} binary not found`,
242
242
  }));
243
243
  }
244
- const sink = input.ownerSink;
245
- if (sink?.configured && !sink.reachable) {
246
- const chan = sink.channel ?? 'owner';
247
- const why = sink.reason === 'imessage-not-macos'
248
- ? 'iMessage requires macOS (peer-forward delivers from a macOS peer)'
249
- : sink.reason === 'slack-no-token'
250
- ? 'no SLACK_BOT_TOKEN — set it in env or the webhooks secrets bundle'
251
- : sink.reason === 'channel-unsupported'
252
- ? `${chan} transport removed (Rush daemon)`
253
- : 'transport unreachable';
244
+ if (input.ownerSignedIn === false) {
254
245
  out.push(finding({
255
- severity: FINDING_SEVERITY['owner-sink-unreachable'], kind: 'owner-sink-unreachable', device,
256
- message: `${chan} → owner unreachable: ${why}`,
246
+ severity: FINDING_SEVERITY['owner-not-signed-in'], kind: 'owner-not-signed-in', device,
247
+ message: 'cannot reach the owner: no Phoenix session or worker device token',
257
248
  }));
258
249
  }
259
250
  for (const report of input.reports) {
@@ -706,7 +697,7 @@ function subjectLabel(f) {
706
697
  return f.version ? `${f.agent} @${f.version}` : f.agent;
707
698
  }
708
699
  function critLabel(f) {
709
- if (f.kind === 'owner-sink-unreachable')
700
+ if (f.kind === 'owner-not-signed-in')
710
701
  return { left: 'owner', account: '', message: f.message };
711
702
  return {
712
703
  left: subjectLabel(f),
@@ -12,6 +12,7 @@ interface EventProvenance {
12
12
  parentSessionId?: string;
13
13
  parentLaunchId?: string;
14
14
  originTerminalId?: string;
15
+ originDevice?: string;
15
16
  }
16
17
  export declare function stampProvenance(env?: NodeJS.ProcessEnv): EventProvenance;
17
18
  export declare function resetEventProvenanceForTest(): void;
@@ -39,6 +39,8 @@ export function stampProvenance(env = process.env) {
39
39
  provenance.parentLaunchId = env.AGENTS_PARENT_LAUNCH_ID;
40
40
  if (env.AGENTS_ORIGIN_TERMINAL_ID)
41
41
  provenance.originTerminalId = env.AGENTS_ORIGIN_TERMINAL_ID;
42
+ if (env.AGENTS_ORIGIN_DEVICE)
43
+ provenance.originDevice = env.AGENTS_ORIGIN_DEVICE;
42
44
  return provenance;
43
45
  }
44
46
  export function resetEventProvenanceForTest() {
@@ -102,6 +102,7 @@ export declare function inferredInteractiveWithoutTty(options: Pick<ExecOptions,
102
102
  export declare function shouldTapStdout(interactive: boolean, piped: boolean, capsActive: boolean, captureTail?: boolean): boolean;
103
103
  export declare function parseExecEnv(entries: string[]): Record<string, string> | undefined;
104
104
  export declare function resolveLaunchId(envLaunchId: string | undefined): string;
105
+ export declare function inheritsHarnessMode(options: ExecOptions): boolean;
105
106
  export declare function buildExecEnv(options: ExecOptions): NodeJS.ProcessEnv;
106
107
  export declare function ensureVendorHomeDir(agent: AgentId, versionHome: string): string | null;
107
108
  interface AgentCommandTemplate {
package/dist/lib/exec.js CHANGED
@@ -12,7 +12,7 @@ import { isTierToken, resolveTier } from './model-tiers.js';
12
12
  import { emit, createTimer, redactPrompt, redactArgs } from './feed/events.js';
13
13
  import { sanitizeProcessEnv } from './secrets-client.js';
14
14
  import { resolveActor, actorEnv } from './actor.js';
15
- import { launchIdentityEnv, LAUNCH_IDENTITY_KEYS } from './launch-identity.js';
15
+ import { launchIdentityEnv, launchOrigin, LAUNCH_IDENTITY_KEYS } from './launch-identity.js';
16
16
  import { expandLocalHome } from './project-root.js';
17
17
  import { getShimsDir, getHistoryDir, getUserAgentsDir, getRuntimeStateDir } from './state.js';
18
18
  import { readCodexConfiguredModel } from './installations/shims.js';
@@ -221,6 +221,9 @@ export function resolveLaunchId(envLaunchId) {
221
221
  const inbound = envLaunchId?.trim();
222
222
  return inbound ? inbound : randomUUID();
223
223
  }
224
+ export function inheritsHarnessMode(options) {
225
+ return options.modeWasImplicit === true && implicitModeFor(options.agent) === 'plan';
226
+ }
224
227
  // Child runs shed parent session/mailbox/account/exec-home identity; lineage is reintroduced only through explicit parent fields.
225
228
  export function buildExecEnv(options) {
226
229
  const result = { ...sanitizeProcessEnv(process.env) };
@@ -258,7 +261,12 @@ export function buildExecEnv(options) {
258
261
  result.AGENTS_RUNTIME = resolveInteractive(options) ? 'terminal' : 'headless';
259
262
  // Bind the standalone secrets client to the same store agents-cli resolved.
260
263
  result.SECRETS_HOME = result.SECRETS_HOME ?? getUserAgentsDir();
261
- result.AGENTS_RUN_MODE = resolveHeadlessMode(options.agent, normalizeMode(options.mode), resolveInteractive(options), options.modeWarningContext, options.modeWarningState);
264
+ if (inheritsHarnessMode(options)) {
265
+ delete result.AGENTS_RUN_MODE;
266
+ }
267
+ else {
268
+ result.AGENTS_RUN_MODE = resolveHeadlessMode(options.agent, normalizeMode(options.mode), resolveInteractive(options), options.modeWarningContext, options.modeWarningState);
269
+ }
262
270
  result.AGENTS_HISTORY_DIR = getHistoryDir();
263
271
  if (options.agent) {
264
272
  const runVersion = options.version ?? resolveVersion(options.agent, options.cwd || process.cwd());
@@ -567,7 +575,7 @@ export function buildExecCommand(options) {
567
575
  }
568
576
  }
569
577
  }
570
- const resolvedMode = resolveHeadlessMode(options.agent, normalizeMode(options.mode), interactive, options.modeWarningContext, options.modeWarningState);
578
+ const resolvedMode = resolveHeadlessMode(options.agent, normalizeMode(options.mode), interactive, options.modeWarningContext, inheritsHarnessMode(options) ? { quiet: true } : options.modeWarningState);
571
579
  const modeFlags = template.modeFlags[resolvedMode];
572
580
  if (!modeFlags) {
573
581
  throw new Error(`Internal error: ${options.agent} declares '${resolvedMode}' in capabilities.modes but has no entry in AGENT_COMMANDS.modeFlags.${resolvedMode}.`);
@@ -583,24 +591,18 @@ export function buildExecCommand(options) {
583
591
  if (preModeArgs) {
584
592
  cmd.push(...preModeArgs);
585
593
  }
586
- const modeArgsOverride = launchAdapter.execModeArgs?.(launchArgsCtx);
587
- if (modeArgsOverride !== undefined) {
588
- cmd.push(...modeArgsOverride);
589
- }
590
- else if (resumeSpec && 'subcommand' in resumeSpec) {
591
- if (resolvedMode === 'skip') {
592
- cmd.push('--dangerously-bypass-approvals-and-sandbox');
594
+ if (!inheritsHarnessMode(options)) {
595
+ const modeArgsOverride = launchAdapter.execModeArgs?.(launchArgsCtx);
596
+ if (modeArgsOverride !== undefined) {
597
+ cmd.push(...modeArgsOverride);
593
598
  }
594
- else if (interactive) {
595
- cmd.push(...modeFlags);
599
+ else if (resumeSpec && 'subcommand' in resumeSpec && resolvedMode === 'skip') {
600
+ cmd.push('--dangerously-bypass-approvals-and-sandbox');
596
601
  }
597
602
  else {
598
603
  cmd.push(...modeFlags);
599
604
  }
600
605
  }
601
- else {
602
- cmd.push(...modeFlags);
603
- }
604
606
  if (!interactive && template.printFlags) {
605
607
  cmd.push(...template.printFlags);
606
608
  }
@@ -736,6 +738,7 @@ async function execShimPassthroughLeased(agent, rawArgs, cwd, pinnedVersion) {
736
738
  initiatedBy: resolveActor().kind,
737
739
  launchId,
738
740
  terminalId: launchIdentityEnv().AGENT_TERMINAL_ID,
741
+ originTerminal: launchOrigin(),
739
742
  startedAtMs: Date.now(),
740
743
  });
741
744
  if (passthroughSessionId) {
@@ -953,6 +956,7 @@ async function runInTmux(options, executable, args) {
953
956
  initiatedBy: resolveActor().kind,
954
957
  launchId: options.env?.AGENT_LAUNCH_ID,
955
958
  terminalId: launchIdentityEnv().AGENT_TERMINAL_ID,
959
+ originTerminal: launchOrigin(),
956
960
  tmuxPane: pane,
957
961
  startedAtMs: Date.now(),
958
962
  });
@@ -1253,6 +1257,7 @@ async function spawnAgentLeased(options) {
1253
1257
  initiatedBy: resolveActor().kind,
1254
1258
  launchId,
1255
1259
  terminalId: launchIdentityEnv().AGENT_TERMINAL_ID,
1260
+ originTerminal: launchOrigin(),
1256
1261
  tmuxPane: process.env.TMUX_PANE,
1257
1262
  startedAtMs: Date.now(),
1258
1263
  });
@@ -1,9 +1,12 @@
1
1
  import type { ActiveSession } from '../session/active.js';
2
2
  import type { DetectedPr } from '@phnx-labs/sessions-cli/reader';
3
+ import type { PrCheckItem, SessionPr } from '../session/active.js';
3
4
  import type { GhExec } from '../github/pr-mergeable.js';
4
5
  import type { PullRequestAttentionSignal } from './attention.js';
5
6
  export declare const PR_STATUS_TTL_MS = 45000;
7
+ export declare const MAX_PR_CHECK_ITEMS = 30;
6
8
  export interface PullRequestStatus extends PullRequestAttentionSignal {
9
+ headRefOid?: string;
7
10
  statusCheckRollup?: unknown[];
8
11
  }
9
12
  export declare const PR_STATUS_DEFAULT_TIMEOUT_MS = 15000;
@@ -15,6 +18,7 @@ export declare function readPullRequestStatus(session: ActiveSession, options?:
15
18
  }): Promise<PullRequestStatus | undefined>;
16
19
  export declare function resetPullRequestStatusCache(): void;
17
20
  export declare function checksVerdict(rollup?: unknown[]): DetectedPr['checks'];
21
+ export declare function checkItemsFrom(rollup?: unknown[]): PrCheckItem[] | undefined;
18
22
  export declare function withPullRequestStatus<T extends {
19
- pr?: DetectedPr;
23
+ pr?: SessionPr;
20
24
  }>(row: T, status?: PullRequestStatus): T;