@phnx-labs/agents-cli 1.23.39 → 1.23.40

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 (84) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -20
  3. package/dist/cli/command-registry.js +0 -2
  4. package/dist/commands/config.js +0 -4
  5. package/dist/commands/daemon.js +5 -5
  6. package/dist/commands/events.js +1 -1
  7. package/dist/commands/lead.js +4 -3
  8. package/dist/commands/setup.d.ts +1 -1
  9. package/dist/commands/setup.js +1 -9
  10. package/dist/commands/ssh.js +4 -5
  11. package/dist/lib/accounting/usage.d.ts +1 -1
  12. package/dist/lib/answer-router.d.ts +1 -1
  13. package/dist/lib/answer-router.js +16 -6
  14. package/dist/lib/channels/providers/session.js +13 -0
  15. package/dist/lib/channels/registry.d.ts +1 -1
  16. package/dist/lib/config-keys.d.ts +1 -1
  17. package/dist/lib/config-keys.js +1 -4
  18. package/dist/lib/daemon/daemon.js +1 -6
  19. package/dist/lib/daemon-services.d.ts +1 -1
  20. package/dist/lib/daemon-services.js +0 -5
  21. package/dist/lib/device-config.js +2 -11
  22. package/dist/lib/feed/answer.js +25 -1
  23. package/dist/lib/feed/attention.d.ts +8 -0
  24. package/dist/lib/feed/attention.js +39 -0
  25. package/dist/lib/feed/tab-delivery.d.ts +27 -0
  26. package/dist/lib/feed/tab-delivery.js +102 -0
  27. package/dist/lib/feed/watch.d.ts +3 -0
  28. package/dist/lib/feed/watch.js +63 -13
  29. package/dist/lib/hosts/passthrough.js +0 -1
  30. package/dist/lib/installations/migrate.d.ts +0 -1
  31. package/dist/lib/installations/migrate.js +0 -17
  32. package/dist/lib/lead/drafts.d.ts +11 -0
  33. package/dist/lib/lead/drafts.js +34 -0
  34. package/dist/lib/lead/host.d.ts +5 -0
  35. package/dist/lib/lead/host.js +52 -1
  36. package/dist/lib/lead/paths.js +1 -1
  37. package/dist/lib/lead/tools.d.ts +1 -0
  38. package/dist/lib/lead/tools.js +22 -0
  39. package/dist/lib/menubar/snapshot.d.ts +0 -6
  40. package/dist/lib/menubar/snapshot.js +0 -18
  41. package/dist/lib/session/active.d.ts +2 -1
  42. package/dist/lib/session/active.js +10 -6
  43. package/dist/lib/session/hook-sessions.d.ts +10 -0
  44. package/dist/lib/session/hook-sessions.js +22 -10
  45. package/dist/lib/session/inject-target.d.ts +1 -0
  46. package/dist/lib/session/inject-target.js +2 -1
  47. package/dist/lib/session/pid-registry.d.ts +1 -0
  48. package/dist/lib/session/remote/watch.d.ts +1 -0
  49. package/dist/lib/startup/command-registry.js +2 -1
  50. package/dist/lib/state.js +0 -1
  51. package/dist/lib/terminal/index.d.ts +1 -1
  52. package/dist/lib/terminal/index.js +1 -1
  53. package/dist/lib/terminal/inject.d.ts +0 -15
  54. package/dist/lib/terminal/inject.js +2 -16
  55. package/dist/lib/terminal/resolve.d.ts +2 -1
  56. package/dist/lib/terminal/resolve.js +13 -18
  57. package/dist/lib/types.d.ts +0 -3
  58. package/package.json +1 -1
  59. package/dist/commands/setup-watchdog.d.ts +0 -3
  60. package/dist/commands/setup-watchdog.js +0 -49
  61. package/dist/commands/watchdog.d.ts +0 -4
  62. package/dist/commands/watchdog.js +0 -361
  63. package/dist/lib/daemon/watchdog-service.d.ts +0 -10
  64. package/dist/lib/daemon/watchdog-service.js +0 -27
  65. package/dist/lib/session/presence.d.ts +0 -47
  66. package/dist/lib/session/presence.js +0 -100
  67. package/dist/lib/watchdog/history.d.ts +0 -20
  68. package/dist/lib/watchdog/history.js +0 -43
  69. package/dist/lib/watchdog/log.d.ts +0 -33
  70. package/dist/lib/watchdog/log.js +0 -117
  71. package/dist/lib/watchdog/read.d.ts +0 -8
  72. package/dist/lib/watchdog/read.js +0 -93
  73. package/dist/lib/watchdog/rotate.d.ts +0 -55
  74. package/dist/lib/watchdog/rotate.js +0 -220
  75. package/dist/lib/watchdog/runner.d.ts +0 -100
  76. package/dist/lib/watchdog/runner.js +0 -727
  77. package/dist/lib/watchdog/service.d.ts +0 -15
  78. package/dist/lib/watchdog/service.js +0 -36
  79. package/dist/lib/watchdog/watchdog-agent.d.ts +0 -8
  80. package/dist/lib/watchdog/watchdog-agent.js +0 -32
  81. package/dist/lib/watchdog/watchdog.d.ts +0 -43
  82. package/dist/lib/watchdog/watchdog.js +0 -116
  83. package/dist/lib/watchdog/watchdogTail.d.ts +0 -6
  84. package/dist/lib/watchdog/watchdogTail.js +0 -116
@@ -1,6 +1,4 @@
1
1
  import { getMenubarUpdateStatus } from './install-menubar.js';
2
- import * as fs from 'fs';
3
- import * as path from 'path';
4
2
  import { httpsUrl } from '../actor.js';
5
3
  import { cachedViewer, emailDigest } from '../github/viewer.js';
6
4
  import { readSession } from '../identity/client.js';
@@ -14,7 +12,6 @@ import { loadDevices } from '../devices/registry.js';
14
12
  import { machineId } from '../machine-id.js';
15
13
  import { querySessions } from '../session/db.js';
16
14
  import { readActiveSessionsCache } from '../session/session-cache.js';
17
- import { getRuntimeStateDir } from '../state.js';
18
15
  import { getCliVersion } from '../version.js';
19
16
  export function resolveMenubarMe(session, viewer) {
20
17
  const sessionEmail = session?.email?.trim() || null;
@@ -107,14 +104,6 @@ export function projectDeviceStats(row) {
107
104
  specsObservedAt: row.specsFetchedAt ? new Date(row.specsFetchedAt).toISOString() : null,
108
105
  };
109
106
  }
110
- export function readLastWatchdogTick(stateDir = path.join(getRuntimeStateDir(), 'watchdog')) {
111
- try {
112
- return JSON.parse(fs.readFileSync(path.join(stateDir, 'last-tick.json'), 'utf-8'));
113
- }
114
- catch {
115
- return null;
116
- }
117
- }
118
107
  export async function computeMenubarSnapshot() {
119
108
  migrateMenubarPreferencesFromUserDefaults();
120
109
  const viewerRead = cachedViewer();
@@ -142,12 +131,5 @@ export async function computeMenubarSnapshot() {
142
131
  me: resolveMenubarMe(readSession(), viewer),
143
132
  menuPreferences: buildMenuPreferences(),
144
133
  menuListPreferences: buildMenuListPreferences(),
145
- watchdog: {
146
- enabled: getConfigValue('watchdog.enabled').value === true,
147
- lastTick: (() => {
148
- const tick = readLastWatchdogTick();
149
- return tick ? { didNudge: tick.didNudge, counts: tick.counts } : null;
150
- })(),
151
- },
152
134
  };
153
135
  }
@@ -1,6 +1,6 @@
1
1
  import type { CloudTaskStatus } from '../cloud/types.js';
2
2
  import { type PidSessionEntry } from './pid-registry.js';
3
- import { type DoneVerdict, type HookSessionIndex } from './hook-sessions.js';
3
+ import { type DoneVerdict, type TurnVerdict, type HookSessionIndex } from './hook-sessions.js';
4
4
  import { type SessionRecap } from './title.js';
5
5
  import type { TouchedPr, TouchedTicket } from './touched.js';
6
6
  import { type UserPromptKind } from '@phnx-labs/sessions-cli/reader';
@@ -173,6 +173,7 @@ export interface ActiveSession {
173
173
  summaryChecklist?: import('@phnx-labs/sessions-cli/reader').SessionChecklistItem[];
174
174
  summaryState?: import('@phnx-labs/sessions-cli/reader').SummaryState;
175
175
  doneVerdict?: DoneVerdict;
176
+ turnVerdict?: TurnVerdict;
176
177
  }
177
178
  export declare function activeStatusFromCloudStatus(status: CloudTaskStatus): ActiveStatus;
178
179
  interface ActiveQueryOptions {
@@ -13,7 +13,7 @@ import { listNativeAccounts } from '../account-registry.js';
13
13
  import { parseNativeIdentityKey } from '../native-accounts.js';
14
14
  import { readLivePidSessionEntry as readPidSessionEntry, listPidSessionEntries, prunePidSessionRegistry, readStateSessionRecord, sessionIdFromLivePid, } from './pid-registry.js';
15
15
  import { readSessionActorRecord, writeSessionAliasRecord } from './actor-sidecar.js';
16
- import { loadHookSessionIndex, resolveHookSessionRecord, readDoneVerdict } from './hook-sessions.js';
16
+ import { loadHookSessionIndex, resolveHookSessionRecord, readSessionVerdicts } from './hook-sessions.js';
17
17
  import { extractClaudeUserText, getAgentSessionDirs, readClaudeLiveNames } from './discover.js';
18
18
  import { buildRunNameMap } from './run-names.js';
19
19
  import { cleanDisplayTitle, isPlaceholderSessionName, resolveSessionName, startedAsFromUserTurn } from './title.js';
@@ -1555,13 +1555,17 @@ export function derivePhase(status) {
1555
1555
  }
1556
1556
  export function foldDoneVerdict(rows) {
1557
1557
  for (const s of rows) {
1558
- const verdict = s.pid && s.sessionId && s.pidAlive !== false
1559
- ? readDoneVerdict(s.pid, s.sessionId, s.processStartedAtMs ?? readPidSessionEntry(s.pid)?.startedAtMs)
1560
- : undefined;
1561
- if (verdict)
1562
- s.doneVerdict = verdict;
1558
+ const { done, turn } = s.pid && s.sessionId && s.pidAlive !== false
1559
+ ? readSessionVerdicts(s.pid, s.sessionId, s.processStartedAtMs ?? readPidSessionEntry(s.pid)?.startedAtMs)
1560
+ : {};
1561
+ if (done)
1562
+ s.doneVerdict = done;
1563
1563
  else
1564
1564
  delete s.doneVerdict;
1565
+ if (turn)
1566
+ s.turnVerdict = turn;
1567
+ else
1568
+ delete s.turnVerdict;
1565
1569
  }
1566
1570
  }
1567
1571
  export function foldPhase(rows) {
@@ -10,11 +10,21 @@ export interface DoneVerdict {
10
10
  gaps: string[];
11
11
  at: string;
12
12
  }
13
+ export interface TurnVerdict {
14
+ kind: 'asks' | 'waiting' | 'not_done' | 'done' | 'unjudged';
15
+ quote: string;
16
+ choices: string[];
17
+ atMs: number;
18
+ }
13
19
  export interface HookSessionIndex {
14
20
  byLaunchId: Map<string, HookSessionRecord>;
15
21
  byTerminalId: Map<string, HookSessionRecord>;
16
22
  byPid: Map<number, HookSessionRecord>;
17
23
  }
24
+ export declare function readSessionVerdicts(pid: number, sessionId: string, processStartedAtMs?: number): {
25
+ done?: DoneVerdict;
26
+ turn?: TurnVerdict;
27
+ };
18
28
  export declare function readDoneVerdict(pid: number, sessionId: string, processStartedAtMs?: number): DoneVerdict | undefined;
19
29
  export declare function captureLaunchBinding(pid: number | undefined, launchId: string): PidSessionEntry | undefined;
20
30
  export declare function recordCompletedLaunch(binding: PidSessionEntry | undefined): void;
@@ -7,22 +7,34 @@ import path from 'path';
7
7
  import { getTerminalsDir } from '../state.js';
8
8
  import { listPidSessionEntries, parseSessionRecord, pidSessionEntryMatchesLiveProcess, readLivePidSessionEntry, readPidSessionEntry, readStateSessionRecord, RECORD_SKEW_MS, stateSessionRecordPath, } from './pid-registry.js';
9
9
  const VERDICT_STATES = new Set(['done', 'open', 'unchecked']);
10
+ const TURN_KINDS = new Set(['asks', 'waiting', 'not_done', 'done', 'unjudged']);
10
11
  function hookSessionsDir() {
11
12
  return path.join(getTerminalsDir(), 'sessions');
12
13
  }
13
- export function readDoneVerdict(pid, sessionId, processStartedAtMs) {
14
+ export function readSessionVerdicts(pid, sessionId, processStartedAtMs) {
14
15
  const rec = readStateSessionRecord(pid, processStartedAtMs);
15
16
  if (!rec || rec.pid !== pid || rec.session_id !== sessionId)
16
- return undefined;
17
+ return {};
18
+ const current = (at) => typeof at === 'number' && Number.isFinite(at) && (processStartedAtMs === undefined || at >= processStartedAtMs - RECORD_SKEW_MS);
19
+ const out = {};
17
20
  const v = rec.verdict;
18
- if (!v || typeof v !== 'object' || typeof v.state !== 'string' || !VERDICT_STATES.has(v.state))
19
- return undefined;
20
- if (typeof v.at !== 'number' || !Number.isFinite(v.at))
21
- return undefined;
22
- if (processStartedAtMs !== undefined && v.at < processStartedAtMs - RECORD_SKEW_MS)
23
- return undefined;
24
- const gaps = Array.isArray(v.gaps) ? v.gaps.filter((g) => typeof g === 'string' && g.length > 0) : [];
25
- return { state: v.state, gaps, at: new Date(v.at).toISOString() };
21
+ if (v && typeof v === 'object' && typeof v.state === 'string' && VERDICT_STATES.has(v.state) && current(v.at)) {
22
+ const gaps = Array.isArray(v.gaps) ? v.gaps.filter((g) => typeof g === 'string' && g.length > 0) : [];
23
+ out.done = { state: v.state, gaps, at: new Date(v.at).toISOString() };
24
+ }
25
+ const t = rec.turnVerdict;
26
+ if (t && typeof t === 'object' && typeof t.kind === 'string' && TURN_KINDS.has(t.kind) && current(t.at)) {
27
+ out.turn = {
28
+ kind: t.kind,
29
+ quote: typeof t.quote === 'string' ? t.quote : '',
30
+ choices: Array.isArray(t.choices) ? t.choices.filter((c) => typeof c === 'string' && c.trim().length > 0) : [],
31
+ atMs: t.at,
32
+ };
33
+ }
34
+ return out;
35
+ }
36
+ export function readDoneVerdict(pid, sessionId, processStartedAtMs) {
37
+ return readSessionVerdicts(pid, sessionId, processStartedAtMs).done;
26
38
  }
27
39
  function keepNewest(map, key, rec) {
28
40
  const prev = map.get(key);
@@ -3,6 +3,7 @@ import { type InjectTarget } from '../terminal/index.js';
3
3
  export declare function matchInjectSelector(session: ActiveSession, token: string): boolean;
4
4
  export declare function resolveLiveInjectTarget(selector: string): Promise<{
5
5
  target: InjectTarget | null;
6
+ session?: ActiveSession;
6
7
  reason?: string;
7
8
  hint?: string;
8
9
  }>;
@@ -34,9 +34,10 @@ export async function resolveLiveInjectTarget(selector) {
34
34
  if (!resolution.addressable) {
35
35
  return {
36
36
  target: null,
37
+ session: match,
37
38
  reason: `Session "${selector}": ${resolution.reason}`,
38
39
  hint: resolution.hint,
39
40
  };
40
41
  }
41
- return { target: resolution.target };
42
+ return { target: resolution.target, session: match };
42
43
  }
@@ -27,6 +27,7 @@ export interface SessionStartRecord {
27
27
  cwd?: string;
28
28
  ts?: number;
29
29
  verdict?: unknown;
30
+ turnVerdict?: unknown;
30
31
  }
31
32
  export declare const RECORD_SKEW_MS = 5000;
32
33
  export declare function parseSessionRecord<T extends SessionStartRecord = SessionStartRecord>(raw: string): T | undefined;
@@ -59,6 +59,7 @@ export interface SessionWatchRow extends Omit<ActiveSession, 'viewingIn' | 'cont
59
59
  branch?: string;
60
60
  rowKey: string;
61
61
  sourceDevice: string;
62
+ delivery?: import('../../feed/tab-delivery.js').TabDelivery;
62
63
  confirmedProject: string | null;
63
64
  previous: boolean;
64
65
  resumable: boolean;
@@ -6,7 +6,7 @@ const LOADED_COMMAND_NAMES = [
6
6
  'models', 'doctor',
7
7
  'harness', 'harnesses', 'menubar', 'sync',
8
8
  'refresh-rules', 'factory', 'insights', 'trace',
9
- 'watchdog', 'events',
9
+ 'events',
10
10
  'ssh', 'devices', 'fleet', 'repos', 'repo', 'setup', 'uninstall', 'upgrade',
11
11
  'teams', 'cloud', 'ps', 'send', 'feed', 'lead',
12
12
  'daemon', 'recordings',
@@ -54,6 +54,7 @@ export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
54
54
  'perf',
55
55
  'list',
56
56
  'humans',
57
+ 'watchdog',
57
58
  'reminders',
58
59
  'modes',
59
60
  'feedback',
package/dist/lib/state.js CHANGED
@@ -478,7 +478,6 @@ const CENTRAL_META_KEYS = [
478
478
  'accounts',
479
479
  'run',
480
480
  'model',
481
- 'watchdog',
482
481
  'lease',
483
482
  'secrets',
484
483
  'budget',
@@ -6,7 +6,7 @@ export { makeVscodiumAgentBackend, spawnUri, EDITOR_VARIANTS, type EditorVariant
6
6
  export { planLayouts, type Packing } from './policy.js';
7
7
  export { specsForRequest, describeLaunch, buildRequests, openSurface, openSurfaces, type OpenOptions, type OpenManyOptions, type BuildRequestsOptions, type SurfaceItem, } from './engine.js';
8
8
  export { runLocal, runRemote, runSpec, remoteCommand, type HostResolver, type RunResult } from './transport.js';
9
- export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSpecs, itermInjectScript, ghosttyInjectScript, appleScriptInjectSpec, vscodiumInjectUri, vscodiumInjectSpec, type InjectTarget, type InjectBackend, type InjectOptions, type InjectResult, } from './inject.js';
9
+ export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSpecs, itermInjectScript, ghosttyInjectScript, appleScriptInjectSpec, type InjectTarget, type InjectBackend, type InjectOptions, type InjectResult, } from './inject.js';
10
10
  export { resolveInjectTarget, resolveInjectTargetForSession, type InjectResolution, type InjectRail, type ResolveOptions, } from './resolve.js';
11
11
  export { iLoginShell } from './shell.js';
12
12
  export { shellQuote } from './quote.js';
@@ -5,7 +5,7 @@ export { makeVscodiumAgentBackend, spawnUri, EDITOR_VARIANTS } from './backends/
5
5
  export { planLayouts } from './policy.js';
6
6
  export { specsForRequest, describeLaunch, buildRequests, openSurface, openSurfaces, } from './engine.js';
7
7
  export { runLocal, runRemote, runSpec, remoteCommand } from './transport.js';
8
- export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSpecs, itermInjectScript, ghosttyInjectScript, appleScriptInjectSpec, vscodiumInjectUri, vscodiumInjectSpec, } from './inject.js';
8
+ export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSpecs, itermInjectScript, ghosttyInjectScript, appleScriptInjectSpec, } from './inject.js';
9
9
  export { resolveInjectTarget, resolveInjectTargetForSession, } from './resolve.js';
10
10
  export { iLoginShell } from './shell.js';
11
11
  export { shellQuote } from './quote.js';
@@ -7,11 +7,6 @@ export type InjectTarget = {
7
7
  } | {
8
8
  backend: 'iterm';
9
9
  session?: string;
10
- } | {
11
- backend: 'vscodium';
12
- terminalId: string;
13
- cli: string;
14
- scheme: string;
15
10
  } | {
16
11
  backend: 'ghostty';
17
12
  window?: string;
@@ -63,14 +58,4 @@ export declare function ghosttyInjectScript(text: string, opts: {
63
58
  export declare function appleScriptInjectSpec(target: Extract<InjectTarget, {
64
59
  backend: 'iterm' | 'ghostty';
65
60
  }>, text: string, enter: boolean, combined?: boolean): LaunchSpec;
66
- export declare function vscodiumInjectUri(scheme: string, terminalId: string, text: string, opts: {
67
- enter: boolean;
68
- combined: boolean;
69
- }): string;
70
- export declare function vscodiumInjectSpec(target: Extract<InjectTarget, {
71
- backend: 'vscodium';
72
- }>, text: string, opts: {
73
- enter: boolean;
74
- combined: boolean;
75
- }): LaunchSpec;
76
61
  export declare function injectIntoTerminal(target: InjectTarget, text: string, opts?: InjectOptions): Promise<InjectResult>;
@@ -2,9 +2,6 @@ import { appleScriptStr } from './quote.js';
2
2
  import { runSpec } from './transport.js';
3
3
  import { itermBackend, ghosttyBackend } from './backends/index.js';
4
4
  import { currentContext } from './types.js';
5
- function backendConfirmsDelivery(backend) {
6
- return backend !== 'vscodium';
7
- }
8
5
  const CR = '\r';
9
6
  export const BRACKETED_PASTE_START = '\u001b[200~';
10
7
  export const BRACKETED_PASTE_END = '\u001b[201~';
@@ -66,15 +63,6 @@ export function appleScriptInjectSpec(target, text, enter, combined = false) {
66
63
  : ghosttyInjectScript(text, { window: target.window, enter });
67
64
  return { argv: ['osascript', '-e', script] };
68
65
  }
69
- const EXTENSION_AUTHORITY = 'swarmify.swarm-ext';
70
- export function vscodiumInjectUri(scheme, terminalId, text, opts) {
71
- const payload = { terminalId, text, enter: opts.enter, combined: opts.combined };
72
- const p = Buffer.from(JSON.stringify(payload), 'utf8').toString('base64url');
73
- return `${scheme}://${EXTENSION_AUTHORITY}/inject?p=${p}`;
74
- }
75
- export function vscodiumInjectSpec(target, text, opts) {
76
- return { argv: [target.cli, '--open-url', vscodiumInjectUri(target.scheme, target.terminalId, text, opts)] };
77
- }
78
66
  export async function injectIntoTerminal(target, text, opts = {}) {
79
67
  const enter = opts.enter !== false;
80
68
  const combined = opts.combined === true;
@@ -87,15 +75,13 @@ export async function injectIntoTerminal(target, text, opts = {}) {
87
75
  const payload = opts.paste === true ? `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}` : text;
88
76
  const specs = target.backend === 'tmux'
89
77
  ? tmuxInjectSpecs(target, payload, { enter, combined, socket: opts.socket })
90
- : target.backend === 'vscodium'
91
- ? [vscodiumInjectSpec(target, payload, { enter, combined })]
92
- : [appleScriptInjectSpec(target, payload, enter, combined)];
78
+ : [appleScriptInjectSpec(target, payload, enter, combined)];
93
79
  const writes = target.backend === 'tmux'
94
80
  ? specs.length
95
81
  : target.backend === 'ghostty'
96
82
  ? enter ? 2 : 1
97
83
  : enter && !combined ? 2 : 1;
98
- const confirmed = backendConfirmsDelivery(target.backend);
84
+ const confirmed = true;
99
85
  if (opts.dryRun)
100
86
  return { ok: true, confirmed, backend: target.backend, writes, started: 0, specs };
101
87
  if (target.backend === 'iterm' || target.backend === 'ghostty') {
@@ -1,6 +1,6 @@
1
1
  import type { ActiveSession } from '../session/active.js';
2
2
  import type { InjectTarget } from './inject.js';
3
- export type InjectRail = 'tmux' | 'iterm' | 'vscodium' | 'ghostty';
3
+ export type InjectRail = 'tmux' | 'iterm' | 'ghostty';
4
4
  export type InjectResolution = {
5
5
  addressable: true;
6
6
  rail: InjectRail;
@@ -14,6 +14,7 @@ export type InjectResolution = {
14
14
  export interface ResolveOptions {
15
15
  allowGhosttyFocus?: boolean;
16
16
  }
17
+ export declare function typedByEditorTab(session: Pick<ActiveSession, 'host' | 'sessionId' | 'context'>): boolean;
17
18
  export declare function addressabilityRecoveryHint(session: ActiveSession, fallbackId?: string): string;
18
19
  export declare function resolveInjectTargetForSession(session: ActiveSession, opts?: ResolveOptions): InjectResolution;
19
20
  export declare function resolveInjectTarget(sessionId: string, opts?: ResolveOptions): Promise<InjectResolution>;
@@ -1,10 +1,11 @@
1
1
  import { getActiveSessions } from '../session/active.js';
2
2
  import { machineId } from '../machine-id.js';
3
- const IDE_INJECT_VARIANTS = {
4
- codium: { cli: 'codium', scheme: 'vscodium' },
5
- cursor: { cli: 'cursor', scheme: 'cursor' },
6
- code: { cli: 'code', scheme: 'vscode' },
7
- };
3
+ const IDE_HOSTS = new Set(['codium', 'cursor', 'code']);
4
+ export function typedByEditorTab(session) {
5
+ if (!session.sessionId || session.context === 'headless' || session.context === 'teams')
6
+ return false;
7
+ return !session.host || IDE_HOSTS.has(session.host);
8
+ }
8
9
  export function addressabilityRecoveryHint(session, fallbackId) {
9
10
  const sid = session.sessionId;
10
11
  const resumeId = sid ?? fallbackId;
@@ -16,7 +17,7 @@ export function addressabilityRecoveryHint(session, fallbackId) {
16
17
  if (session.host === 'ghostty') {
17
18
  return `Ghostty has no per-split addressing. ${interactive ? `Enable tmux wrapping with \`${tmuxCmd}\` and re-launch, or ` : ''}use \`${resumeCmd}\` to continue this session.`;
18
19
  }
19
- if (session.host && session.host in IDE_INJECT_VARIANTS && !sid) {
20
+ if (session.host && IDE_HOSTS.has(session.host) && !sid) {
20
21
  return `This IDE terminal has not registered a session id yet. Wait a moment and retry, or use \`${resumeCmd}\` to continue.`;
21
22
  }
22
23
  if (session.host) {
@@ -40,19 +41,13 @@ export function resolveInjectTargetForSession(session, opts = {}) {
40
41
  target: { backend: 'iterm', session: prov.reply.session },
41
42
  };
42
43
  }
43
- const variant = session.host ? IDE_INJECT_VARIANTS[session.host] : undefined;
44
- if (variant) {
45
- if (!session.sessionId) {
46
- return {
47
- addressable: false,
48
- reason: `IDE terminal (${session.host}) has no session id to address`,
49
- hint: addressabilityRecoveryHint(session),
50
- };
51
- }
44
+ if (session.host && IDE_HOSTS.has(session.host)) {
52
45
  return {
53
- addressable: true,
54
- rail: 'vscodium',
55
- target: { backend: 'vscodium', terminalId: session.sessionId, cli: variant.cli, scheme: variant.scheme },
46
+ addressable: false,
47
+ reason: session.sessionId
48
+ ? `IDE terminal (${session.host}): the AGI EXT window that binds the session types into it`
49
+ : `IDE terminal (${session.host}) has no session id to address`,
50
+ hint: addressabilityRecoveryHint(session),
56
51
  };
57
52
  }
58
53
  if (session.host === 'ghostty') {
@@ -439,9 +439,6 @@ export interface Meta {
439
439
  model?: {
440
440
  tiers?: Record<string, Partial<Record<'cheap' | 'default' | 'best' | 'ultra', string>>>;
441
441
  };
442
- watchdog?: {
443
- rotate?: 'on' | 'off';
444
- };
445
442
  lease?: {
446
443
  secretsBundle?: string;
447
444
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.39",
3
+ "version": "1.23.40",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function runWatchdogSetupWizard(): Promise<void>;
3
- export declare function registerSetupWatchdogCommand(setup: Command): void;
@@ -1,49 +0,0 @@
1
- import chalk from 'chalk';
2
- import { spawnSync } from 'node:child_process';
3
- import { getCliLaunch } from '../lib/cli-entry.js';
4
- import { loadDevices } from '../lib/devices/registry.js';
5
- import { machineId, normalizeHost } from '../lib/machine-id.js';
6
- import { getConfigValue, setConfigValue } from '../lib/device-config.js';
7
- import { isPromptCancelled, requireInteractiveSelection } from './utils.js';
8
- export async function runWatchdogSetupWizard() {
9
- const registry = await loadDevices();
10
- const devices = [...new Set([...Object.keys(registry), machineId()].map(normalizeHost))].sort();
11
- const enabled = new Set(devices.filter((device) => getConfigValue('watchdog.enabled', { device }).value === true));
12
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
13
- requireInteractiveSelection('watchdog devices', ['agents watchdog enable', 'agents watchdog enable --device <device>']);
14
- }
15
- try {
16
- const { checkbox } = await import('@inquirer/prompts');
17
- const selected = await checkbox({
18
- message: 'Devices where the watchdog should run:',
19
- choices: devices.map((device) => ({ name: device, value: device, checked: enabled.has(device) })),
20
- });
21
- const selectedSet = new Set(selected);
22
- for (const device of devices) {
23
- const on = selectedSet.has(device);
24
- if (device === normalizeHost(machineId())) {
25
- setConfigValue('watchdog.enabled', on);
26
- continue;
27
- }
28
- const launch = getCliLaunch(['watchdog', on ? 'enable' : 'disable', '--device', device]);
29
- const result = spawnSync(launch.command, launch.args, { stdio: 'inherit', env: process.env });
30
- if ((result.status ?? 1) !== 0)
31
- throw new Error(`Could not configure watchdog on ${device}`);
32
- }
33
- console.log(chalk.green(selected.length === 0
34
- ? 'Watchdog disabled on every registered device'
35
- : `Watchdog enabled on: ${selected.join(', ')}`));
36
- }
37
- catch (error) {
38
- if (isPromptCancelled(error)) {
39
- console.log(chalk.gray('Cancelled'));
40
- return;
41
- }
42
- throw error;
43
- }
44
- }
45
- export function registerSetupWatchdogCommand(setup) {
46
- setup.command('watchdog')
47
- .description('Choose the devices where the daemon watchdog pass runs.')
48
- .action(runWatchdogSetupWizard);
49
- }
@@ -1,4 +0,0 @@
1
- import type { Command } from 'commander';
2
- import { type WatchdogTickResult } from '../lib/watchdog/runner.js';
3
- export declare function formatWatchdogTickLines(result: WatchdogTickResult, willInject: boolean, verbose?: boolean): string[];
4
- export declare function registerWatchdogCommand(program: Command): void;