@phnx-labs/agents-cli 1.23.28 → 1.23.29

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 (164) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +33 -82
  3. package/dist/bootstrap.js +0 -17
  4. package/dist/cli/command-registry.js +0 -2
  5. package/dist/commands/cloud.js +0 -58
  6. package/dist/commands/config.js +0 -4
  7. package/dist/commands/daemon-index.js +1 -1
  8. package/dist/commands/daemon.js +14 -63
  9. package/dist/commands/doctor.js +0 -12
  10. package/dist/commands/events.js +1 -1
  11. package/dist/commands/feed.d.ts +1 -3
  12. package/dist/commands/feed.js +1 -6
  13. package/dist/commands/fleet-capture.js +2 -4
  14. package/dist/commands/focus.d.ts +0 -1
  15. package/dist/commands/focus.js +2 -4
  16. package/dist/commands/inspect.d.ts +1 -19
  17. package/dist/commands/inspect.js +8 -474
  18. package/dist/commands/mine.js +1 -1
  19. package/dist/commands/prune.js +2 -64
  20. package/dist/commands/ps-roster.d.ts +0 -4
  21. package/dist/commands/ps-roster.js +2 -30
  22. package/dist/commands/ps.js +1 -4
  23. package/dist/commands/repo.d.ts +1 -1
  24. package/dist/commands/repo.js +4 -4
  25. package/dist/commands/sessions-browser.d.ts +0 -2
  26. package/dist/commands/sessions-browser.js +2 -32
  27. package/dist/commands/sessions-optimize.js +3 -4
  28. package/dist/commands/setup-mine.js +0 -1
  29. package/dist/commands/ssh.js +8 -9
  30. package/dist/commands/sync.js +1 -1
  31. package/dist/commands/update.js +2 -2
  32. package/dist/commands/watchdog.js +3 -4
  33. package/dist/lib/accounting/rotate.d.ts +0 -2
  34. package/dist/lib/accounting/rotate.js +1 -4
  35. package/dist/lib/agent-spec/agents.d.ts +0 -1
  36. package/dist/lib/agent-spec/agents.js +0 -8
  37. package/dist/lib/auth-health.d.ts +0 -1
  38. package/dist/lib/auth-health.js +0 -3
  39. package/dist/lib/cli-entry.d.ts +0 -1
  40. package/dist/lib/cli-entry.js +0 -36
  41. package/dist/lib/cloud/types.d.ts +0 -2
  42. package/dist/lib/config-keys.d.ts +1 -1
  43. package/dist/lib/config-keys.js +1 -4
  44. package/dist/lib/daemon/daemon.d.ts +0 -4
  45. package/dist/lib/daemon/daemon.js +6 -202
  46. package/dist/lib/daemon/heartbeat-service.d.ts +1 -1
  47. package/dist/lib/daemon/heartbeat-service.js +1 -8
  48. package/dist/lib/daemon-services.d.ts +1 -1
  49. package/dist/lib/daemon-services.js +1 -11
  50. package/dist/lib/device-config.d.ts +0 -2
  51. package/dist/lib/device-config.js +4 -22
  52. package/dist/lib/devices/config-migration.js +1 -3
  53. package/dist/lib/exec.d.ts +2 -5
  54. package/dist/lib/exec.js +18 -18
  55. package/dist/lib/factory/snapshot.d.ts +0 -5
  56. package/dist/lib/factory/snapshot.js +1 -28
  57. package/dist/lib/feed/events.d.ts +1 -11
  58. package/dist/lib/feed/events.js +0 -20
  59. package/dist/lib/feed/feed.d.ts +0 -2
  60. package/dist/lib/feed-outcome.d.ts +0 -2
  61. package/dist/lib/feed-outcome.js +0 -5
  62. package/dist/lib/fleet/capture.d.ts +0 -1
  63. package/dist/lib/fleet/capture.js +0 -3
  64. package/dist/lib/fleet/manifest.js +0 -6
  65. package/dist/lib/fleet/types.d.ts +0 -1
  66. package/dist/lib/harness/adapter.d.ts +0 -7
  67. package/dist/lib/harness/adapters/claude.js +0 -18
  68. package/dist/lib/harness/adapters/codex.js +0 -10
  69. package/dist/lib/harness/adapters/cursor.js +0 -11
  70. package/dist/lib/harness/adapters/kimi.js +0 -3
  71. package/dist/lib/harness/adapters/muse.js +0 -11
  72. package/dist/lib/harness/index.d.ts +1 -1
  73. package/dist/lib/harness/index.js +0 -2
  74. package/dist/lib/hosts/passthrough.js +2 -10
  75. package/dist/lib/hosts/ready.d.ts +0 -4
  76. package/dist/lib/hosts/ready.js +0 -9
  77. package/dist/lib/hosts/reconcile.d.ts +0 -1
  78. package/dist/lib/hosts/reconcile.js +0 -8
  79. package/dist/lib/installations/migrate.d.ts +0 -2
  80. package/dist/lib/installations/migrate.js +0 -145
  81. package/dist/lib/loop.js +1 -2
  82. package/dist/lib/menubar/snapshot.d.ts +0 -1
  83. package/dist/lib/menubar/snapshot.js +1 -4
  84. package/dist/lib/placement.d.ts +1 -2
  85. package/dist/lib/placement.js +4 -24
  86. package/dist/lib/profiles.d.ts +0 -1
  87. package/dist/lib/profiles.js +0 -6
  88. package/dist/lib/session/active.d.ts +1 -3
  89. package/dist/lib/session/active.js +0 -4
  90. package/dist/lib/session/db.d.ts +0 -1
  91. package/dist/lib/session/db.js +4 -8
  92. package/dist/lib/session/discover.d.ts +0 -1
  93. package/dist/lib/session/discover.js +3 -128
  94. package/dist/lib/session/live-metadata.js +0 -2
  95. package/dist/lib/session/presentation.d.ts +0 -1
  96. package/dist/lib/session/presentation.js +3 -8
  97. package/dist/lib/session/selection.d.ts +0 -2
  98. package/dist/lib/session/selection.js +2 -12
  99. package/dist/lib/staleness/detectors/commands.d.ts +1 -1
  100. package/dist/lib/staleness/detectors/hooks.d.ts +1 -1
  101. package/dist/lib/staleness/detectors/mcp.d.ts +1 -1
  102. package/dist/lib/staleness/detectors/permissions.d.ts +1 -1
  103. package/dist/lib/staleness/detectors/plugins.d.ts +1 -1
  104. package/dist/lib/staleness/detectors/rules.d.ts +1 -1
  105. package/dist/lib/staleness/detectors/skills.d.ts +1 -1
  106. package/dist/lib/staleness/detectors/subagents.d.ts +1 -1
  107. package/dist/lib/staleness/detectors/workflows.d.ts +1 -1
  108. package/dist/lib/staleness/writers/commands.d.ts +1 -1
  109. package/dist/lib/staleness/writers/hooks.d.ts +1 -1
  110. package/dist/lib/staleness/writers/mcp.d.ts +1 -1
  111. package/dist/lib/staleness/writers/permissions.d.ts +1 -1
  112. package/dist/lib/staleness/writers/plugins.d.ts +1 -1
  113. package/dist/lib/staleness/writers/rules.d.ts +1 -1
  114. package/dist/lib/staleness/writers/skills.d.ts +1 -1
  115. package/dist/lib/staleness/writers/subagents.d.ts +1 -1
  116. package/dist/lib/staleness/writers/workflows.d.ts +1 -1
  117. package/dist/lib/startup/command-registry.js +5 -2
  118. package/dist/lib/state.d.ts +0 -3
  119. package/dist/lib/state.js +2 -25
  120. package/dist/lib/types.d.ts +0 -1
  121. package/dist/lib/watchdog/runner.d.ts +0 -2
  122. package/dist/lib/watchdog/runner.js +0 -2
  123. package/package.json +1 -1
  124. package/scripts/postinstall.js +2 -2
  125. package/dist/commands/routines.d.ts +0 -14
  126. package/dist/commands/routines.js +0 -2149
  127. package/dist/commands/routines.test-fixture.d.ts +0 -52
  128. package/dist/commands/routines.test-fixture.js +0 -254
  129. package/dist/lib/catchup.d.ts +0 -19
  130. package/dist/lib/catchup.js +0 -83
  131. package/dist/lib/daemon/catchup-service.d.ts +0 -18
  132. package/dist/lib/daemon/catchup-service.js +0 -21
  133. package/dist/lib/daemon/runner.d.ts +0 -91
  134. package/dist/lib/daemon/runner.js +0 -1927
  135. package/dist/lib/harness/adapters/droid.d.ts +0 -2
  136. package/dist/lib/harness/adapters/droid.js +0 -14
  137. package/dist/lib/overdue.d.ts +0 -9
  138. package/dist/lib/overdue.js +0 -74
  139. package/dist/lib/routine-activation.d.ts +0 -13
  140. package/dist/lib/routine-activation.js +0 -117
  141. package/dist/lib/routine-context.d.ts +0 -59
  142. package/dist/lib/routine-context.js +0 -181
  143. package/dist/lib/routine-notify-owner.d.ts +0 -4
  144. package/dist/lib/routine-notify-owner.js +0 -49
  145. package/dist/lib/routine-notify.d.ts +0 -17
  146. package/dist/lib/routine-notify.js +0 -138
  147. package/dist/lib/routine-process-cleanup.d.ts +0 -9
  148. package/dist/lib/routine-process-cleanup.js +0 -81
  149. package/dist/lib/routine-readiness.d.ts +0 -31
  150. package/dist/lib/routine-readiness.js +0 -256
  151. package/dist/lib/routines-format.d.ts +0 -7
  152. package/dist/lib/routines-format.js +0 -127
  153. package/dist/lib/routines-placement.d.ts +0 -16
  154. package/dist/lib/routines-placement.js +0 -60
  155. package/dist/lib/routines-project.d.ts +0 -49
  156. package/dist/lib/routines-project.js +0 -306
  157. package/dist/lib/sandbox.d.ts +0 -15
  158. package/dist/lib/sandbox.js +0 -309
  159. package/dist/lib/scheduler.d.ts +0 -23
  160. package/dist/lib/scheduler.js +0 -106
  161. package/dist/lib/scheduling/routines.d.ts +0 -264
  162. package/dist/lib/scheduling/routines.js +0 -1292
  163. package/dist/lib/triggers/webhook.d.ts +0 -26
  164. package/dist/lib/triggers/webhook.js +0 -181
@@ -1,6 +1,5 @@
1
1
  import { execFileSync } from 'child_process';
2
2
  import * as fs from 'fs';
3
- import * as os from 'os';
4
3
  import * as path from 'path';
5
4
  export const BUN_VIRTUAL_ROOT = /[/\\]\$bunfs[/\\]root[/\\]/;
6
5
  function resolveBunStandaloneEntry(entry, execPath) {
@@ -33,41 +32,6 @@ export function getAgentsBinPath(argv1 = process.argv[1], execPath = process.exe
33
32
  return 'agents';
34
33
  }
35
34
  }
36
- export function getAgentsBinDir() {
37
- const bin = getAgentsBinPath();
38
- const base = path.basename(bin);
39
- if (base === 'agents' || base === 'agents.exe' || base === 'agents.cmd') {
40
- return path.dirname(bin);
41
- }
42
- const realBin = (() => {
43
- try {
44
- return fs.realpathSync(bin);
45
- }
46
- catch {
47
- return bin;
48
- }
49
- })();
50
- const home = os.homedir();
51
- const candidates = [
52
- path.join(home, '.local', 'bin'),
53
- '/usr/local/bin',
54
- '/opt/homebrew/bin',
55
- path.join(home, '.npm-global', 'bin'),
56
- path.join(home, '.bun', 'bin'),
57
- path.dirname(process.execPath),
58
- ];
59
- for (const dir of candidates) {
60
- for (const name of ['agents', 'agents.exe', 'agents.cmd']) {
61
- const launcher = path.join(dir, name);
62
- try {
63
- if (fs.realpathSync(launcher) === realBin)
64
- return dir;
65
- }
66
- catch { }
67
- }
68
- }
69
- return path.dirname(bin);
70
- }
71
35
  export function isNodeScriptEntry(agentsBin) {
72
36
  let resolved = agentsBin;
73
37
  try {
@@ -1,4 +1,3 @@
1
- import type { JobTrigger } from '../scheduling/routines.js';
2
1
  export type CloudProviderId = 'rush' | 'codex' | 'factory' | 'antigravity' | 'cursor' | 'host';
3
2
  export type CloudTaskStatus = 'queued' | 'allocating' | 'running' | 'idle' | 'input_required' | 'completed' | 'failed' | 'cancelled';
4
3
  type StatusNormalizingProvider = 'rush' | 'codex' | 'antigravity' | 'cursor';
@@ -73,7 +72,6 @@ export declare const MAX_IMAGES_PER_DISPATCH = 5;
73
72
  export interface DispatchOptions {
74
73
  prompt: string;
75
74
  agent?: string;
76
- trigger?: JobTrigger;
77
75
  repo?: string;
78
76
  repos?: string[];
79
77
  branch?: string;
@@ -53,7 +53,7 @@ export interface ParsedMenubarConfigKey {
53
53
  property: string;
54
54
  }
55
55
  export type ParsedConfigKey = ParsedRunConfigKey | ParsedInteractiveConfigKey | ParsedAutoConfigKey | ParsedBrowserConfigKey | ParsedProjectConfigKey | ParsedDeviceConfigKey | ParsedSummarizerConfigKey | ParsedUpdatesConfigKey | ParsedMenubarConfigKey | ParsedLeadConfigKey;
56
- export type DeviceConfigProperty = 'role' | 'max-agents' | 'scheduler' | 'daemon' | 'watchdog' | 'tmux' | 'browser.remote-control' | 'browser.task-idle-minutes' | 'notes' | 'browser.profile' | 'browser.viewer' | 'formFactor';
56
+ export type DeviceConfigProperty = 'role' | 'max-agents' | 'daemon' | 'watchdog' | 'tmux' | 'browser.remote-control' | 'browser.task-idle-minutes' | 'notes' | 'browser.profile' | 'browser.viewer' | 'formFactor';
57
57
  export declare function formatAgentVersion(agent: AgentId, version: string): string;
58
58
  export declare function parseConfigKey(key: string): ParsedConfigKey;
59
59
  export declare function formatConfigKey(parsed: ParsedConfigKey): string;
@@ -53,7 +53,6 @@ const DEVICE_CONFIG_PROPERTIES = [
53
53
  'browser.viewer',
54
54
  'role',
55
55
  'max-agents',
56
- 'scheduler',
57
56
  'daemon',
58
57
  'watchdog',
59
58
  'tmux',
@@ -138,7 +137,7 @@ export function parseConfigKey(key) {
138
137
  }
139
138
  return { scope: 'updates', agent: agentPart, property: 'auto' };
140
139
  }
141
- const deviceMatch = raw.match(/^devices\.(.+)\.(role|max-agents|scheduler|daemon|watchdog|tmux|notes|formFactor|browser\.remote-control|browser\.task-idle-minutes|browser\.profile|browser\.viewer|computer\.host)$/);
140
+ const deviceMatch = raw.match(/^devices\.(.+)\.(role|max-agents|daemon|watchdog|tmux|notes|formFactor|browser\.remote-control|browser\.task-idle-minutes|browser\.profile|browser\.viewer|computer\.host)$/);
142
141
  if (deviceMatch) {
143
142
  return {
144
143
  scope: 'device',
@@ -226,8 +225,6 @@ export function devicePropertyToConfigName(property) {
226
225
  return 'role';
227
226
  case 'max-agents':
228
227
  return 'agents.max-concurrent';
229
- case 'scheduler':
230
- return 'scheduler.enabled';
231
228
  case 'daemon':
232
229
  return 'daemon.enabled';
233
230
  case 'watchdog':
@@ -11,8 +11,6 @@ export { isolatedHomeSuffix };
11
11
  export declare function daemonServiceLabel(): string;
12
12
  export declare function daemonSystemdUnitName(): string;
13
13
  export declare const DAEMON_AUTOSTART_FAILURE_LIMIT = 5;
14
- type SchedulerGateTransition = 'reload' | 'stop' | 'boot' | 'none';
15
- export declare function schedulerGateTransition(running: boolean, enabled: boolean): SchedulerGateTransition;
16
14
  export declare function singleShot(fn: () => Promise<void>): () => Promise<void>;
17
15
  export declare function getDaemonLogPath(): string;
18
16
  export declare function readDaemonPid(daemonDir?: string): number | null;
@@ -98,7 +96,6 @@ interface DaemonStopResult {
98
96
  escalated: boolean;
99
97
  released: string[];
100
98
  surviving: string[];
101
- detachedChildren: number[];
102
99
  }
103
100
  export declare function findSurvivingStateDirDaemons(exclude: Set<number>): number[];
104
101
  export declare function stopDaemon(): DaemonStopResult;
@@ -106,7 +103,6 @@ export declare function getDaemonStatus(): {
106
103
  state: 'running' | 'stopped';
107
104
  running: boolean;
108
105
  pid: number | null;
109
- jobCount: number;
110
106
  logPath: string;
111
107
  binaryPath: string | null;
112
108
  heartbeat: DaemonHeartbeat | null;
@@ -6,22 +6,13 @@ import * as os from 'os';
6
6
  import { getDaemonDir } from '../state.js';
7
7
  import { isolatedHomeSuffix, namespacedServiceLabel, serviceManifestHomeEnv, serviceManagerRegistrationAllowed } from '../service-manifest.js';
8
8
  import { isAlive, killTree, backgroundSpawnOptions, waitForExit } from '../platform/index.js';
9
- import { listJobs as listAllJobs } from '../scheduling/routines.js';
10
- import { syncAllProjectRoutines } from '../routines-project.js';
11
- import { JobScheduler } from '../scheduler.js';
12
- import { executeJobDetached, listLiveRoutineChildren } from './runner.js';
13
- import { detectOverdueJobs, notifyOverdue } from '../overdue.js';
14
- import { runCatchup } from '../catchup.js';
15
- import { notifyRoutineStart, notifyRoutineFinish, notifyRoutineStartFailed } from '../routine-notify.js';
16
- import { notifyOwnerRoutineFinish, notifyOwnerRoutineStartFailed } from '../routine-notify-owner.js';
17
- import { describeOwnerResult } from '../owner-notify.js';
18
9
  import { redactSecrets } from '../redact.js';
19
10
  import { getAgentsBinPath, getCliLaunch, BUN_VIRTUAL_ROOT } from '../cli-entry.js';
20
11
  import { localBinDir } from '../platform/posixpath.js';
21
- import { isSchedulerEnabled, assertSchedulerEnabled, isDaemonEnabled } from '../device-config.js';
12
+ import { isDaemonEnabled } from '../device-config.js';
22
13
  import { recordSubsystemOk, recordSubsystemError, recordSubsystemErrorReason, readSubsystemHealth, readRecentDaemonRestarts, SUBSYSTEM_DAEMON_START } from '../daemon-health.js';
23
14
  import { ServiceSupervisor } from './supervisor.js';
24
- import { emit, emitAsync, emitRoutineEnd } from '../feed/events.js';
15
+ import { emitAsync } from '../feed/events.js';
25
16
  import { readDaemonServicesConfig, readDaemonLogLevel, drainDaemonServiceRestartQueue } from '../daemon-services.js';
26
17
  import { sleepSync } from '../fs-atomic.js';
27
18
  import { DaemonVitals, installSpanLog, levelEnabled, topSpansSinceReport } from './diagnostics.js';
@@ -54,11 +45,6 @@ const WEDGE_THRESHOLD_TICKS = 3;
54
45
  const DAEMON_HEARTBEAT_TICK_MS = 60_000;
55
46
  const DAEMON_THROTTLE_SECONDS = 30;
56
47
  export const DAEMON_AUTOSTART_FAILURE_LIMIT = 5;
57
- export function schedulerGateTransition(running, enabled) {
58
- if (running)
59
- return enabled ? 'reload' : 'stop';
60
- return enabled ? 'boot' : 'none';
61
- }
62
48
  // Latch before the first await and never retry after rejection: daemon shutdown is single-shot.
63
49
  export function singleShot(fn) {
64
50
  let ran = false;
@@ -515,7 +501,7 @@ export function warnEphemeralDaemonRoot(resolveBin = getAgentsBinPath) {
515
501
  if (!ephemeralRoot)
516
502
  return null;
517
503
  const message = `Daemon launched from ${ephemeralRoot} (${bin}); if that directory is removed, ` +
518
- `every routine will fail with ENOENT on its module imports. Run the daemon from the ` +
504
+ `every daemon service will fail with ENOENT on its module imports. Run the daemon from the ` +
519
505
  `globally installed binary instead (npm i -g @phnx-labs/agents-cli), then restart it.`;
520
506
  log('WARN', message);
521
507
  return message;
@@ -540,12 +526,11 @@ export function assertTestDaemonHome(daemonDir = getDaemonDir(), testHome = proc
540
526
  }
541
527
  export async function runDaemon() {
542
528
  assertTestDaemonHome();
543
- const [{ SessionIndexService }, { SessionSummarizerService }, { SessionTitleService }, { AccountUsageService, AccountAuthService }, { CatchupService }, { WatchdogService }, { DeviceProbeService }, { SelfHealService }, { SelfUpdateService }, { HarnessUpdateService }, { AuthSyncService }, { UsageSyncService }, { StateDirCheckService }, { SessionStateService }, { FeedStreamService }, { AttentionNotifyService }, { RecordingsService }, { HeartbeatService }, { TmuxReapService },] = await Promise.all([
529
+ const [{ SessionIndexService }, { SessionSummarizerService }, { SessionTitleService }, { AccountUsageService, AccountAuthService }, { WatchdogService }, { DeviceProbeService }, { SelfHealService }, { SelfUpdateService }, { HarnessUpdateService }, { AuthSyncService }, { UsageSyncService }, { StateDirCheckService }, { SessionStateService }, { FeedStreamService }, { AttentionNotifyService }, { RecordingsService }, { HeartbeatService }, { TmuxReapService },] = await Promise.all([
544
530
  import('./session-index-service.js'),
545
531
  import('./session-summarizer-service.js'),
546
532
  import('./session-title-service.js'),
547
533
  import('./account-state-daemon-service.js'),
548
- import('./catchup-service.js'),
549
534
  import('./watchdog-service.js'),
550
535
  import('./device-probe-service.js'),
551
536
  import('./self-heal-service.js'),
@@ -652,16 +637,6 @@ export async function runDaemon() {
652
637
  supervisor.register(new AccountAuthService());
653
638
  else
654
639
  log('INFO', 'Account-auth service disabled');
655
- let scheduler = null;
656
- if (isEnabled('catchup')) {
657
- supervisor.register(new CatchupService({
658
- isSchedulerBooted: () => scheduler !== null,
659
- runPass: (signal) => catchupPass(signal),
660
- }));
661
- }
662
- else {
663
- log('INFO', 'Catch-up recovery service disabled');
664
- }
665
640
  if (isEnabled('session-index'))
666
641
  supervisor.register(new SessionIndexService());
667
642
  else
@@ -716,142 +691,10 @@ export async function runDaemon() {
716
691
  log('INFO', 'Tmux reap service disabled');
717
692
  await supervisor.startAll({ log });
718
693
  activeServiceSupervisor = supervisor;
719
- const schedulerEnabledAtBoot = isSchedulerEnabled() && isEnabled('scheduler');
720
- if (!schedulerEnabledAtBoot) {
721
- try {
722
- assertSchedulerEnabled();
723
- }
724
- catch (err) {
725
- log('WARN', err.message);
726
- }
727
- if (!isEnabled('scheduler'))
728
- log('INFO', 'Scheduler service disabled; no routines will fire');
729
- }
730
- const triggerJob = async (config, ctx) => {
731
- const jobLabel = config.command
732
- ? 'command'
733
- : config.workflow
734
- ? `workflow: ${config.workflow}`
735
- : `agent: ${config.agent}`;
736
- log('INFO', `Triggering job '${config.name}' (${jobLabel})`);
737
- emit('routine.start', {
738
- module: 'routine',
739
- name: config.name,
740
- kind: config.command ? 'command' : config.workflow ? 'workflow' : 'agent',
741
- ...(config.agent ? { agent: config.agent } : {}),
742
- ...(config.workflow ? { workflow: config.workflow } : {}),
743
- });
744
- try {
745
- notifyRoutineStart(config);
746
- }
747
- catch { }
748
- try {
749
- const meta = await executeJobDetached(config, {
750
- onFinish: (final) => {
751
- emitRoutineEnd(final);
752
- try {
753
- notifyRoutineFinish(final);
754
- }
755
- catch { }
756
- void notifyOwnerRoutineFinish(final)
757
- .then((r) => {
758
- if (r && r.suppressed === null && r.delivered.length + r.queued.length === 0)
759
- log('WARN', `Owner failure-notify for '${config.name}' reached no channel: ${describeOwnerResult(r)}`);
760
- })
761
- .catch((err) => log('WARN', `Owner failure-notify for '${config.name}' failed: ${err.message}`));
762
- },
763
- }, { kind: 'schedule', scheduledFor: ctx?.scheduledFor });
764
- log('INFO', `Job '${config.name}' spawned (run: ${meta.runId}, PID: ${meta.pid})`);
765
- }
766
- catch (err) {
767
- const message = err.message;
768
- log('ERROR', `Job '${config.name}' failed to spawn: ${message}`);
769
- emitRoutineEnd({
770
- jobName: config.name,
771
- status: 'failed',
772
- detail: redactSecrets(message).slice(0, 500),
773
- });
774
- try {
775
- notifyRoutineStartFailed(config, message);
776
- }
777
- catch { }
778
- void notifyOwnerRoutineStartFailed(config, message, ctx?.scheduledFor)
779
- .then((r) => {
780
- if (r.suppressed === null && r.delivered.length + r.queued.length === 0)
781
- log('WARN', `Owner start-failure notify for '${config.name}' reached no channel: ${describeOwnerResult(r)}`);
782
- })
783
- .catch((err) => log('WARN', `Owner start-failure notify for '${config.name}' failed: ${err.message}`));
784
- }
785
- };
786
- function bootScheduler() {
787
- scheduler = new JobScheduler(triggerJob);
788
- scheduler.loadAll();
789
- const scheduled = scheduler.listScheduled();
790
- log('INFO', `Loaded ${scheduled.length} jobs`);
791
- for (const job of scheduled) {
792
- log('INFO', ` ${job.name} -> next: ${job.nextRun?.toISOString() || 'unknown'}`);
793
- }
794
- if (supervisor.isRegistered('catchup'))
795
- supervisor.runNow('catchup');
796
- }
797
- function stopScheduler() {
798
- scheduler?.stopAll();
799
- scheduler = null;
800
- }
801
- try {
802
- const result = syncAllProjectRoutines();
803
- const n = result.projects.reduce((acc, p) => acc + p.synced.length, 0);
804
- if (n > 0)
805
- log('INFO', `Project routines sync: ${n} job(s) from ${result.projects.length} project(s)`);
806
- }
807
- catch (err) {
808
- log('WARN', `Project routines sync failed: ${err.message}`);
809
- }
810
- if (schedulerEnabledAtBoot)
811
- bootScheduler();
812
- async function catchupPass(signal) {
813
- try {
814
- const overdue = detectOverdueJobs();
815
- if (overdue.length === 0)
816
- return;
817
- log('WARN', `${overdue.length} routine(s) missed their fire:`);
818
- for (const job of overdue) {
819
- const last = job.lastRanAt ? job.lastRanAt.toISOString() : 'never';
820
- log('WARN', ` ${job.name} -- expected ${job.expectedAt.toISOString()}, last ran ${last}`);
821
- }
822
- if (signal?.aborted)
823
- return;
824
- notifyOverdue(overdue);
825
- const outcomes = await runCatchup({ overdue });
826
- for (const o of outcomes) {
827
- switch (o.result) {
828
- case 'ran':
829
- log('INFO', `Caught up '${o.name}' (run: ${o.runId})`);
830
- break;
831
- case 'recorded':
832
- log('INFO', `Recorded missed fire for '${o.name}' (catchup disabled)`);
833
- break;
834
- case 'claimed-elsewhere':
835
- log('INFO', `Missed fire for '${o.name}' already claimed by another catchup`);
836
- break;
837
- case 'error':
838
- log('ERROR', `Catchup for '${o.name}' failed: ${o.error}`);
839
- break;
840
- default: {
841
- const unhandled = o.result;
842
- log('ERROR', `Catchup for '${o.name}' returned an unhandled result: ${String(unhandled)}`);
843
- }
844
- }
845
- }
846
- }
847
- catch (err) {
848
- log('ERROR', `Catchup pass failed: ${err.message}`);
849
- }
850
- }
851
694
  // Clear the start-failure streak only after every startup subsystem is live.
852
695
  recordSubsystemOk(SUBSYSTEM_DAEMON_START);
853
696
  const handleReload = () => {
854
- log('INFO', 'Reloading jobs (SIGHUP)');
697
+ log('INFO', 'Reloading services (SIGHUP)');
855
698
  applyConfiguredLogLevel();
856
699
  const reloadedConfig = readDaemonServicesConfig();
857
700
  const reloadedEnabled = (id) => reloadedConfig.services[id] !== false;
@@ -859,9 +702,6 @@ export async function runDaemon() {
859
702
  const was = servicesConfig.services[id] !== false;
860
703
  const now = reloadedEnabled(id);
861
704
  if (was !== now) {
862
- if (id === 'scheduler') {
863
- continue;
864
- }
865
705
  if (supervisor.isRegistered(id)) {
866
706
  const action = supervisor.awaitIdle(id).then(() => now ? supervisor.start(id) : supervisor.stop(id));
867
707
  void action
@@ -884,31 +724,6 @@ export async function runDaemon() {
884
724
  log('WARN', `Restart requested for '${id}' but it is not supervisor-managed on this daemon — restart the daemon instead`);
885
725
  }
886
726
  }
887
- try {
888
- const result = syncAllProjectRoutines();
889
- const n = result.projects.reduce((acc, p) => acc + p.synced.length, 0);
890
- if (n > 0 || result.missing.length > 0) {
891
- log('INFO', `Project routines sync: ${n} updated, ${result.missing.length} missing roots`);
892
- }
893
- }
894
- catch (err) {
895
- log('WARN', `Project routines sync failed: ${err.message}`);
896
- }
897
- const schedulerEnabledNow = isSchedulerEnabled() && reloadedEnabled('scheduler');
898
- const transition = schedulerGateTransition(scheduler !== null, schedulerEnabledNow);
899
- if (transition === 'boot') {
900
- log('INFO', 'scheduler.enabled is now on — booting the scheduler');
901
- bootScheduler();
902
- }
903
- else if (transition === 'stop') {
904
- log('WARN', 'scheduler.enabled is now off — stopping the scheduler; no routines will fire on this device');
905
- stopScheduler();
906
- }
907
- else if (transition === 'reload') {
908
- scheduler.reloadAll();
909
- const reloaded = scheduler.listScheduled();
910
- log('INFO', `Reloaded ${reloaded.length} jobs`);
911
- }
912
727
  };
913
728
  // Cleanup removes lifetime, pid, heartbeat, and registry state only when each still belongs to this instance.
914
729
  const handleShutdown = singleShot(async () => {
@@ -917,7 +732,6 @@ export async function runDaemon() {
917
732
  vitals.stop();
918
733
  await supervisor.stopAll();
919
734
  activeServiceSupervisor = null;
920
- stopScheduler();
921
735
  try {
922
736
  if (fs.readFileSync(lifetimePath, 'utf-8') === lifetimeToken)
923
737
  fs.unlinkSync(lifetimePath);
@@ -1015,7 +829,7 @@ export function generateSystemdUnit(agentsBin = getAgentsBinPath()) {
1015
829
  const execStart = [launch.command, ...launch.args].map(systemdExecArg).join(' ');
1016
830
  const { HOME: home, AGENTS_REAL_HOME: realHome } = serviceManifestHomeEnv();
1017
831
  return `[Unit]
1018
- Description=Agents Daemon - Scheduled Job Runner
832
+ Description=Agents Daemon
1019
833
  After=network.target
1020
834
  StartLimitIntervalSec=0
1021
835
 
@@ -1352,7 +1166,6 @@ export function stopDaemon() {
1352
1166
  escalated: false,
1353
1167
  released: [],
1354
1168
  surviving: [`daemon lifecycle lock remained held for ${STOP_LOCK_WAIT_MS}ms`],
1355
- detachedChildren: listLiveRoutineChildren(),
1356
1169
  };
1357
1170
  }
1358
1171
  try {
@@ -1389,7 +1202,6 @@ function stopDaemonLocked() {
1389
1202
  escalated: false,
1390
1203
  released,
1391
1204
  surviving: [`daemon pid ${unverifiedPid} is live but its __daemon-run identity could not be verified`],
1392
- detachedChildren: listLiveRoutineChildren(),
1393
1205
  };
1394
1206
  }
1395
1207
  const pid = resolveLiveDaemonPid(true);
@@ -1512,24 +1324,17 @@ function stopDaemonLocked() {
1512
1324
  else
1513
1325
  released.push(`${artifact.label} (reclaimed)`);
1514
1326
  }
1515
- const detachedChildren = listLiveRoutineChildren();
1516
1327
  return {
1517
1328
  ok: surviving.length === 0,
1518
1329
  stoppedPid: pid,
1519
1330
  escalated,
1520
1331
  released,
1521
1332
  surviving,
1522
- detachedChildren,
1523
1333
  };
1524
1334
  }
1525
1335
  export function getDaemonStatus() {
1526
1336
  const running = isDaemonRunning();
1527
1337
  const pid = readDaemonPid();
1528
- let jobCount = 0;
1529
- try {
1530
- jobCount = listAllJobs().filter((j) => j.enabled).length;
1531
- }
1532
- catch { }
1533
1338
  let binaryPath = null;
1534
1339
  try {
1535
1340
  binaryPath = getAgentsBinPath();
@@ -1541,7 +1346,6 @@ export function getDaemonStatus() {
1541
1346
  state: running ? 'running' : 'stopped',
1542
1347
  running,
1543
1348
  pid,
1544
- jobCount,
1545
1349
  logPath: getDaemonLogPath(),
1546
1350
  binaryPath,
1547
1351
  heartbeat: readHeartbeat(),
@@ -8,5 +8,5 @@ export declare class HeartbeatService extends BasePeriodicService {
8
8
  constructor(publishHeartbeat: () => void);
9
9
  protected onStart(_ctx: DaemonContext): Promise<void>;
10
10
  protected onStop(): Promise<void>;
11
- protected onTick(ctx: DaemonContext): Promise<void>;
11
+ protected onTick(_ctx: DaemonContext): Promise<void>;
12
12
  }
@@ -1,5 +1,3 @@
1
- import { reapExitedRunningJobs } from './runner.js';
2
- import { reapTerminalRoutineProcesses } from '../routine-process-cleanup.js';
3
1
  import { BasePeriodicService } from './service.js';
4
2
  const HEARTBEAT_TICK_MS = 60_000;
5
3
  const HEARTBEAT_DEADLINE_MS = 30_000;
@@ -14,12 +12,7 @@ export class HeartbeatService extends BasePeriodicService {
14
12
  }
15
13
  async onStart(_ctx) { }
16
14
  async onStop() { }
17
- async onTick(ctx) {
15
+ async onTick(_ctx) {
18
16
  this.publishHeartbeat();
19
- await reapExitedRunningJobs();
20
- const reaped = await reapTerminalRoutineProcesses();
21
- if (reaped.length > 0) {
22
- ctx.log('WARN', `Reaped ${reaped.length} terminal routine process group(s): ${reaped.join(', ')}`);
23
- }
24
17
  }
25
18
  }
@@ -1,5 +1,5 @@
1
1
  import { type LogLevel } from './daemon/diagnostics.js';
2
- export type DaemonServiceId = 'scheduler' | 'catchup' | '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' | 'recordings' | 'harness-update';
2
+ export type DaemonServiceId = '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' | 'recordings' | 'harness-update';
3
3
  interface DaemonServiceDef {
4
4
  id: DaemonServiceId;
5
5
  title: string;
@@ -5,16 +5,6 @@ import { getDaemonConfigDir } from './state.js';
5
5
  import { atomicWriteFileSync } from './fs-atomic.js';
6
6
  import { LOG_LEVELS, parseLogLevel } from './daemon/diagnostics.js';
7
7
  export const DAEMON_SERVICES = [
8
- {
9
- id: 'scheduler',
10
- title: 'Routine scheduler',
11
- description: 'Fires cron-scheduled routines and catches up missed fires.',
12
- },
13
- {
14
- id: 'catchup',
15
- title: 'Catch-up recovery',
16
- 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.',
17
- },
18
8
  {
19
9
  id: 'self-heal',
20
10
  title: 'Self-heal registry',
@@ -53,7 +43,7 @@ export const DAEMON_SERVICES = [
53
43
  {
54
44
  id: 'daemon-heartbeat',
55
45
  title: 'Daemon heartbeat',
56
- description: 'Publishes daemon liveness and reconciles routine process state.',
46
+ description: 'Publishes daemon liveness.',
57
47
  },
58
48
  {
59
49
  id: 'tmux-reap',
@@ -61,8 +61,6 @@ export declare function setAutoLaunchEnabled(name: string, enabled: boolean): vo
61
61
  export declare function isAutoLaunchPreferred(name: string): boolean;
62
62
  export declare function setAutoLaunchPreferred(name: string, preferred: boolean): void;
63
63
  export declare function loadAutoLaunchPreferences(roster?: string[]): Record<string, AutoLaunchPreference>;
64
- export declare function isSchedulerEnabled(): boolean;
65
- export declare function assertSchedulerEnabled(): void;
66
64
  export declare function isTmuxEnabled(): boolean;
67
65
  export declare function isDaemonEnabled(): boolean;
68
66
  export declare function assertDaemonEnabled(): void;
@@ -156,15 +156,6 @@ export const CONFIG_KEYS = [
156
156
  'AGI EXT auto-launch counts device-wide running agents; teams placement counts the team’s own roster on the device.',
157
157
  validate: (v) => (v >= 1 ? null : 'agents.max-concurrent must be >= 1.'),
158
158
  },
159
- {
160
- name: 'scheduler.enabled',
161
- yamlKey: 'schedulerEnabled',
162
- scope: 'device',
163
- visibility: 'machine',
164
- type: 'bool',
165
- defaultValue: true,
166
- description: 'Whether the routines scheduler (daemon) may fire on this device.',
167
- },
168
159
  {
169
160
  name: 'daemon.enabled',
170
161
  yamlKey: 'daemonEnabled',
@@ -172,9 +163,9 @@ export const CONFIG_KEYS = [
172
163
  visibility: 'machine',
173
164
  type: 'bool',
174
165
  defaultValue: true,
175
- description: 'Whether the daemon may run on this device at all (browser IPC, watchdog, and the ' +
176
- 'routines scheduler). Disabling is the top-level kill switch: nothing auto-starts the daemon while it ' +
177
- 'is set, including `routines add`/`routines start`/`routines catchup`/`routines webhook`. ' +
166
+ description: 'Whether the daemon may run on this device at all (watchdog, session/usage sync, and the ' +
167
+ 'other daemon services). Disabling is the top-level kill switch: nothing auto-starts the daemon while it ' +
168
+ 'is set, including `feed watch`, `watchdog`, and `recordings`. ' +
178
169
  '`agents daemon start` still starts it explicitly.',
179
170
  },
180
171
  {
@@ -1017,7 +1008,7 @@ function unsetInFleetDefaults(spec) {
1017
1008
  const devicesEmpty = fleet.devices == null || fleet.devices === 'all'
1018
1009
  ? false
1019
1010
  : Object.keys(fleet.devices).length === 0;
1020
- if (devicesEmpty && !fleet.defaults && !fleet.secrets && !fleet.routines) {
1011
+ if (devicesEmpty && !fleet.defaults && !fleet.secrets) {
1021
1012
  const { fleet: _, ...rest } = m;
1022
1013
  void _;
1023
1014
  return rest;
@@ -1188,15 +1179,6 @@ export function loadAutoLaunchPreferences(roster) {
1188
1179
  }
1189
1180
  return out;
1190
1181
  }
1191
- export function isSchedulerEnabled() {
1192
- return getConfigValue('scheduler.enabled').value !== false;
1193
- }
1194
- export function assertSchedulerEnabled() {
1195
- if (isSchedulerEnabled())
1196
- return;
1197
- throw new Error(`The routines scheduler is disabled on this device (scheduler.enabled=false in ~/.agents/devices/${machineId()}/agents.yaml). ` +
1198
- `Re-enable with: agents devices config ${machineId()} scheduler.enabled on`);
1199
- }
1200
1182
  export function isTmuxEnabled() {
1201
1183
  return getConfigValue('tmux.enabled').value === true;
1202
1184
  }
@@ -201,7 +201,6 @@ export function migrateDeviceConfigStores() {
201
201
  const fleetIsEmpty = Object.keys(nextDevices).length === 0 &&
202
202
  !fleet.defaults &&
203
203
  !fleet.secrets &&
204
- !fleet.routines &&
205
204
  !fleet.discovery &&
206
205
  !(fleet.ignored && fleet.ignored.length > 0);
207
206
  if (fleetIsEmpty) {
@@ -269,8 +268,7 @@ export function migrateDeviceConfigStores() {
269
268
  ((fleet.devices === undefined ||
270
269
  (fleet.devices !== 'all' && Object.keys(fleet.devices).length === 0)) &&
271
270
  !fleet.defaults &&
272
- !fleet.secrets &&
273
- !fleet.routines);
271
+ !fleet.secrets);
274
272
  if (fleetEmpty) {
275
273
  const { fleet: _drop, ...rest } = m;
276
274
  void _drop;
@@ -2,6 +2,7 @@ import type { AgentId, Mode, RunStrategy } from './types.js';
2
2
  import { type EventPayload } from './feed/events.js';
3
3
  import { type UsernsStatus } from './linux-userns.js';
4
4
  export type ExecMode = Mode;
5
+ export declare function parseTimeout(timeout: string): number | null;
5
6
  export declare function normalizeMode(input: string | null | undefined): Mode;
6
7
  export declare function headlessPlanStallCommand(args: {
7
8
  prompt: string | undefined;
@@ -22,7 +23,7 @@ export declare function resolveMode(agent: AgentId, requested: Mode): Mode;
22
23
  * one-line stderr warning, mirroring the graceful plan→edit degrade antigravity
23
24
  * get for having no plan flag at all. Interactive runs are never
24
25
  * downgraded. This is the single source of truth shared by buildExecCommand
25
- * (agents run / teams) and the routine runner.
26
+ * (agents run / teams).
26
27
  */
27
28
  export declare function resolveHeadlessMode(agent: AgentId, requested: Mode, interactive: boolean, warningContext?: string, warningState?: ModeWarningState): Mode;
28
29
  export interface ModeWarningState {
@@ -215,10 +216,6 @@ export declare function detectAuthFailure(text: string): boolean;
215
216
  * callers pass their agent so unrelated stream formats cannot match by accident.
216
217
  */
217
218
  export declare function detectAuthFailureEvent(logText: string, agent: AgentId): boolean;
218
- export declare function authFailureReason(text: string): string | null;
219
- export declare function isAuthFailureFromLog(logText: string, agent: AgentId, opts: {
220
- processFailed: boolean;
221
- }): boolean;
222
219
  export interface FallbackEntry {
223
220
  agent: AgentId;
224
221
  version?: string;