@phnx-labs/agents-cli 1.23.18 → 1.23.19

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 (71) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/dist/bootstrap.js +1 -1
  3. package/dist/commands/cloud.js +1 -1
  4. package/dist/commands/config.js +1 -1
  5. package/dist/commands/detach.js +5 -1
  6. package/dist/commands/doctor.js +11 -7
  7. package/dist/commands/exec.d.ts +0 -17
  8. package/dist/commands/exec.js +16 -50
  9. package/dist/commands/focus.d.ts +10 -2
  10. package/dist/commands/focus.js +80 -19
  11. package/dist/commands/projects-todo.js +10 -5
  12. package/dist/commands/ps.d.ts +8 -2
  13. package/dist/commands/ps.js +175 -92
  14. package/dist/commands/sessions-picker.d.ts +0 -7
  15. package/dist/commands/sessions-picker.js +5 -299
  16. package/dist/commands/sessions-stop.js +2 -2
  17. package/dist/lib/account-registry.d.ts +3 -0
  18. package/dist/lib/account-registry.js +40 -0
  19. package/dist/lib/accounting/usage-sync.d.ts +1 -0
  20. package/dist/lib/accounting/usage-sync.js +20 -3
  21. package/dist/lib/accounting/usage.d.ts +4 -1
  22. package/dist/lib/accounting/usage.js +38 -6
  23. package/dist/lib/agent-spec/agents.js +12 -11
  24. package/dist/lib/cloud/store.d.ts +5 -1
  25. package/dist/lib/cloud/store.js +10 -3
  26. package/dist/lib/config-keys.d.ts +1 -1
  27. package/dist/lib/config-keys.js +1 -0
  28. package/dist/lib/daemon/account-state-daemon-service.js +9 -2
  29. package/dist/lib/daemon/self-update-service.js +1 -1
  30. package/dist/lib/device-config.d.ts +2 -1
  31. package/dist/lib/device-config.js +21 -11
  32. package/dist/lib/devices/health.d.ts +6 -0
  33. package/dist/lib/devices/health.js +11 -4
  34. package/dist/lib/feed/watch.js +2 -1
  35. package/dist/lib/fleet/apply.d.ts +1 -1
  36. package/dist/lib/fleet/apply.js +5 -2
  37. package/dist/lib/fleet-shared-state.d.ts +2 -0
  38. package/dist/lib/fleet-shared-state.js +3 -1
  39. package/dist/lib/github/project-prs.js +14 -1
  40. package/dist/lib/helper-versions.js +1 -1
  41. package/dist/lib/installations/versions.js +4 -3
  42. package/dist/lib/project-root.d.ts +1 -0
  43. package/dist/lib/project-root.js +11 -3
  44. package/dist/lib/projects.js +2 -2
  45. package/dist/lib/quick-todo.d.ts +5 -1
  46. package/dist/lib/quick-todo.js +14 -1
  47. package/dist/lib/remote-agents-json.js +4 -2
  48. package/dist/lib/self-update.d.ts +1 -1
  49. package/dist/lib/self-update.js +59 -2
  50. package/dist/lib/session/db.js +1 -1
  51. package/dist/lib/session/glance-files.d.ts +21 -0
  52. package/dist/lib/session/glance-files.js +123 -0
  53. package/dist/lib/session/presentation.d.ts +3 -0
  54. package/dist/lib/session/preview-digest.d.ts +13 -0
  55. package/dist/lib/session/preview-digest.js +328 -0
  56. package/dist/lib/session/remote/remote-list.d.ts +3 -2
  57. package/dist/lib/session/remote/remote-list.js +12 -6
  58. package/dist/lib/session/remote/watch.d.ts +2 -0
  59. package/dist/lib/session/remote/watch.js +86 -5
  60. package/dist/lib/smart-launch.js +6 -1
  61. package/dist/lib/teams/placement-probe.d.ts +2 -0
  62. package/dist/lib/teams/placement-probe.js +8 -3
  63. package/dist/lib/terminal/engine.d.ts +2 -0
  64. package/dist/lib/terminal/engine.js +5 -3
  65. package/dist/lib/terminal/index.d.ts +1 -1
  66. package/dist/lib/terminal/index.js +1 -1
  67. package/dist/lib/terminal/run-surface.d.ts +1 -0
  68. package/dist/lib/terminal/run-surface.js +9 -0
  69. package/package.json +1 -1
  70. package/dist/lib/onepassword.d.ts +0 -57
  71. package/dist/lib/onepassword.js +0 -140
@@ -16,6 +16,7 @@ import { registeredNativeAccountForEmail, parseNativeIdentityKey } from '../nati
16
16
  import { resolveVersion, getVersionHomePath, getBinaryPath } from '../installations/versions.js';
17
17
  import { supports } from '../capabilities.js';
18
18
  import { MCP_TARGETS } from '../mcp-registry.js';
19
+ import { HARNESS_AUTH } from '../harness-auth-capabilities.js';
19
20
  import { VERSION_RE } from './primitives.js';
20
21
  const execFileAsync = promisify(execFile);
21
22
  const HOME = os.homedir();
@@ -937,14 +938,14 @@ export function isAccountSlotDir(dir) {
937
938
  const resolved = path.resolve(dir);
938
939
  return resolved === root || resolved.startsWith(root + path.sep);
939
940
  }
940
- function resolveAccountCredentialPath(base, ...segments) {
941
+ function resolveAccountCredentialPath(agent, base, ...segments) {
941
942
  const perVersion = path.join(base, ...segments);
942
943
  try {
943
944
  if (fs.existsSync(perVersion))
944
945
  return perVersion;
945
946
  }
946
947
  catch { }
947
- if (isAccountSlotDir(base))
948
+ if (isAccountSlotDir(base) || HARNESS_AUTH[agent].slotEnv)
948
949
  return null;
949
950
  const active = path.join(process.env.AGENTS_REAL_HOME || os.homedir(), ...segments);
950
951
  if (active !== perVersion) {
@@ -995,8 +996,8 @@ export function credentialPresence(agentId, versionHome) {
995
996
  return { perVersion, active, knownLocation };
996
997
  }
997
998
  export function decryptDroidAuthPayload(base) {
998
- const filePath = resolveAccountCredentialPath(base, '.factory', 'auth.v2.file');
999
- const keyPath = resolveAccountCredentialPath(base, '.factory', 'auth.v2.key');
999
+ const filePath = resolveAccountCredentialPath('droid', base, '.factory', 'auth.v2.file');
1000
+ const keyPath = resolveAccountCredentialPath('droid', base, '.factory', 'auth.v2.key');
1000
1001
  if (!filePath || !keyPath)
1001
1002
  return null;
1002
1003
  return decryptDroidAuthFile(filePath, keyPath);
@@ -1423,7 +1424,7 @@ export async function getAccountInfo(agentId, home) {
1423
1424
  };
1424
1425
  }
1425
1426
  case 'cursor': {
1426
- const cfgPath = resolveAccountCredentialPath(base, '.cursor', 'cli-config.json');
1427
+ const cfgPath = resolveAccountCredentialPath('cursor', base, '.cursor', 'cli-config.json');
1427
1428
  if (!cfgPath)
1428
1429
  return { ...empty, lastActive };
1429
1430
  try {
@@ -1433,7 +1434,7 @@ export async function getAccountInfo(agentId, home) {
1433
1434
  const accountId = normalizeIdentityPart(authInfo?.authId ?? authInfo?.userId);
1434
1435
  if (!email && !accountId)
1435
1436
  return { ...empty, lastActive };
1436
- const authPath = resolveAccountCredentialPath(base, '.cursor', 'auth.json');
1437
+ const authPath = resolveAccountCredentialPath('cursor', base, '.cursor', 'auth.json');
1437
1438
  let hasToken = false;
1438
1439
  if (authPath) {
1439
1440
  try {
@@ -1451,7 +1452,7 @@ export async function getAccountInfo(agentId, home) {
1451
1452
  return { ...empty, lastActive };
1452
1453
  }
1453
1454
  case 'grok': {
1454
- const authPath = resolveAccountCredentialPath(base, '.grok', 'auth.json');
1455
+ const authPath = resolveAccountCredentialPath('grok', base, '.grok', 'auth.json');
1455
1456
  if (!authPath)
1456
1457
  return { ...empty, lastActive };
1457
1458
  try {
@@ -1473,7 +1474,7 @@ export async function getAccountInfo(agentId, home) {
1473
1474
  return { ...empty, lastActive };
1474
1475
  }
1475
1476
  case 'antigravity': {
1476
- const tokenPath = resolveAccountCredentialPath(base, '.gemini', 'antigravity-cli', 'antigravity-oauth-token');
1477
+ const tokenPath = resolveAccountCredentialPath('antigravity', base, '.gemini', 'antigravity-cli', 'antigravity-oauth-token');
1477
1478
  if (tokenPath) {
1478
1479
  const data = JSON.parse(await fs.promises.readFile(tokenPath, 'utf-8'));
1479
1480
  if (typeof data?.token?.refresh_token === 'string' && data.token.refresh_token) {
@@ -1488,7 +1489,7 @@ export async function getAccountInfo(agentId, home) {
1488
1489
  return { ...empty, lastActive };
1489
1490
  }
1490
1491
  case 'kimi': {
1491
- const credPath = resolveAccountCredentialPath(base, '.kimi-code', 'credentials', 'kimi-code.json');
1492
+ const credPath = resolveAccountCredentialPath('kimi', base, '.kimi-code', 'credentials', 'kimi-code.json');
1492
1493
  if (!credPath)
1493
1494
  return { ...empty, lastActive };
1494
1495
  const data = JSON.parse(await fs.promises.readFile(credPath, 'utf-8'));
@@ -1516,7 +1517,7 @@ export async function getAccountInfo(agentId, home) {
1516
1517
  };
1517
1518
  }
1518
1519
  // An unreadable encrypted payload still counts conservatively when its auth file exists.
1519
- const authPath = resolveAccountCredentialPath(base, '.factory', 'auth.v2.file');
1520
+ const authPath = resolveAccountCredentialPath('droid', base, '.factory', 'auth.v2.file');
1520
1521
  if (!authPath)
1521
1522
  return { ...empty, lastActive };
1522
1523
  return { ...empty, signedIn: true, lastActive };
@@ -1541,7 +1542,7 @@ export async function getAccountInfo(agentId, home) {
1541
1542
  const accountKey = buildIdentityKey(agentId, [['auth', 'env']]);
1542
1543
  return { ...empty, signedIn: true, accountId: 'env', accountKey, lastActive };
1543
1544
  }
1544
- const authPath = resolveAccountCredentialPath(base, '.config', 'muse', 'auth.json');
1545
+ const authPath = resolveAccountCredentialPath('muse', base, '.config', 'muse', 'auth.json');
1545
1546
  if (!authPath)
1546
1547
  return { ...empty, lastActive };
1547
1548
  const data = JSON.parse(await fs.promises.readFile(authPath, 'utf-8'));
@@ -8,4 +8,8 @@ export declare function listTasks(filter?: {
8
8
  status?: CloudTaskStatus;
9
9
  limit?: number;
10
10
  }): CloudTask[];
11
- export declare function listActiveTasks(): CloudTask[];
11
+ export declare const CLOUD_TASK_STALE_MS: number;
12
+ export declare function listActiveTasks(opts?: {
13
+ includeStale?: boolean;
14
+ nowMs?: number;
15
+ }): CloudTask[];
@@ -90,9 +90,16 @@ export function listTasks(filter) {
90
90
  return rows.map(rowToTask);
91
91
  }
92
92
  const TERMINAL_STATUSES = ['completed', 'failed', 'cancelled'];
93
- export function listActiveTasks() {
94
- const placeholders = TERMINAL_STATUSES.map(() => '?').join(', ');
95
- const rows = db().prepare(`SELECT * FROM tasks WHERE status NOT IN (${placeholders}) ORDER BY created_at DESC`).all(...TERMINAL_STATUSES);
93
+ const WORKING_STATUSES = ['queued', 'allocating', 'running'];
94
+ export const CLOUD_TASK_STALE_MS = 24 * 60 * 60 * 1000;
95
+ export function listActiveTasks(opts = {}) {
96
+ const terminal = TERMINAL_STATUSES.map(() => '?').join(', ');
97
+ if (opts.includeStale) {
98
+ return db().prepare(`SELECT * FROM tasks WHERE status NOT IN (${terminal}) ORDER BY created_at DESC`).all(...TERMINAL_STATUSES).map(rowToTask);
99
+ }
100
+ const working = WORKING_STATUSES.map(() => '?').join(', ');
101
+ const cutoff = new Date((opts.nowMs ?? Date.now()) - CLOUD_TASK_STALE_MS).toISOString();
102
+ const rows = db().prepare(`SELECT * FROM tasks WHERE status NOT IN (${terminal}) AND (status NOT IN (${working}) OR updated_at >= ?) ORDER BY created_at DESC`).all(...TERMINAL_STATUSES, ...WORKING_STATUSES, cutoff);
96
103
  return rows.map(rowToTask);
97
104
  }
98
105
  function rowToTask(row) {
@@ -1,7 +1,7 @@
1
1
  import type { AgentId } from './types.js';
2
2
  import { type ModelTier } from './model-tiers.js';
3
3
  export type ConfigScope = 'run' | 'interactive' | 'auto' | 'browser' | 'project' | 'device' | 'summarizer' | 'updates' | 'menubar';
4
- export declare const MENUBAR_MENU_PROPERTIES: readonly ["defaultProject", "workingRowsShown", "showPreviews", "projectPriorityFilter", "hideCompletedMilestones", "bannerWhenNeedsYou", "includeOtherDeviceRequests", "groupBy", "thenBy", "projectScope", "projectSort", "ticketSort", "showPullRequests", "sessionUpdates", "showBrowserSessions", "showComputerSessions", "deviceSort", "headlessAgent", "headlessFallbackAgent", "headlessPlacement", "pinnedProjects", "tabOrder", "hiddenTabs", "groupTicketsByMilestone", "ticketGroup", "prGroupOpen", "prGroupMerged", "homeGoals", "homeSections", "sessionFilter", "artifactApps", "githubHidden", "githubDrafts", "githubBots"];
4
+ export declare const MENUBAR_MENU_PROPERTIES: readonly ["defaultProject", "todoProject", "workingRowsShown", "showPreviews", "projectPriorityFilter", "hideCompletedMilestones", "bannerWhenNeedsYou", "includeOtherDeviceRequests", "groupBy", "thenBy", "projectScope", "projectSort", "ticketSort", "showPullRequests", "sessionUpdates", "showBrowserSessions", "showComputerSessions", "deviceSort", "headlessAgent", "headlessFallbackAgent", "headlessPlacement", "pinnedProjects", "tabOrder", "hiddenTabs", "groupTicketsByMilestone", "ticketGroup", "prGroupOpen", "prGroupMerged", "homeGoals", "homeSections", "sessionFilter", "artifactApps", "githubHidden", "githubDrafts", "githubBots"];
5
5
  export declare const MENUBAR_STATUSBAR_PROPERTIES: readonly ["goalCountdown"];
6
6
  export type MenubarSection = 'menu' | 'statusbar';
7
7
  export declare const MENUBAR_CONFIG_KEYS: readonly string[];
@@ -3,6 +3,7 @@ import { MODEL_TIERS } from './model-tiers.js';
3
3
  import { VERSION_RE } from './run-defaults.js';
4
4
  export const MENUBAR_MENU_PROPERTIES = [
5
5
  'defaultProject',
6
+ 'todoProject',
6
7
  'workingRowsShown',
7
8
  'showPreviews',
8
9
  'projectPriorityFilter',
@@ -2,7 +2,7 @@ import * as fsp from 'node:fs/promises';
2
2
  import * as path from 'node:path';
3
3
  import { BasePeriodicService } from './service.js';
4
4
  import { runUsageRefreshTick, refreshLocalFleetAuthState } from '../daemon-ticks.js';
5
- import { getDaemonDir } from '../state.js';
5
+ import { getDaemonDir, readMeta } from '../state.js';
6
6
  import { getCliLaunch } from '../cli-entry.js';
7
7
  import { execFileBounded } from '../exec-bounded.js';
8
8
  import { fleetSharedStatePath, FLEET_SHARED_STATE_VERSION } from '../fleet-shared-state.js';
@@ -10,6 +10,7 @@ import { withFileLockAsync } from '../fs-atomic.js';
10
10
  import { machineId } from '../machine-id.js';
11
11
  import { getConfigValueAsync, isHeadedDeviceRole } from '../device-config.js';
12
12
  import { harnessWorkerIsPerDevice } from '../harness-auth-capabilities.js';
13
+ import { peerAccountRow, PEER_ACCOUNT_ROW_LIMIT } from '../account-registry.js';
13
14
  export const USAGE_STATE_TICK_MS = 60_000;
14
15
  export const AUTH_STATE_TICK_MS = 3 * 60_000;
15
16
  const REFRESH_DEADLINE_MS = 2 * 60_000;
@@ -92,6 +93,12 @@ export async function publishAccountDaemonStateRows(rows, userAgentsDir) {
92
93
  : row.health.verdict === 'error' ? 'unverified' : row.health.verdict,
93
94
  checkedAt: new Date(row.health.checkedAt).toISOString(),
94
95
  }));
96
+ const native = headed
97
+ ? Object.values(readMeta().accounts?.native ?? {})
98
+ .filter((account) => account.scope === 'version' && account.provisioning === 'per-device')
99
+ .slice(0, PEER_ACCOUNT_ROW_LIMIT)
100
+ .map(peerAccountRow)
101
+ : undefined;
95
102
  await withFileLockAsync(file, async () => {
96
103
  const raw = await fsp.readFile(file, 'utf-8');
97
104
  let current = {};
@@ -109,7 +116,7 @@ export async function publishAccountDaemonStateRows(rows, userAgentsDir) {
109
116
  ...current,
110
117
  version: FLEET_SHARED_STATE_VERSION,
111
118
  device,
112
- accounts: { rows: accountRows },
119
+ accounts: { rows: accountRows, ...(native?.length ? { native } : {}) },
113
120
  };
114
121
  const serialized = `${JSON.stringify(next, null, 2)}\n`;
115
122
  if (serialized === raw)
@@ -34,7 +34,7 @@ export async function installAndVerifyDefault(metadata, packageRoot, signal) {
34
34
  try {
35
35
  await sweepStaleInstallStaging(packageRoot);
36
36
  if (detectPackageManager(packageRoot) === 'bun') {
37
- await installPackageWithBun(tarball, signal);
37
+ await installPackageWithBun(tarball, deriveGlobalPrefix(packageRoot), signal);
38
38
  }
39
39
  else {
40
40
  await installPackageIntoPrefix(tarball, deriveGlobalPrefix(packageRoot), signal);
@@ -29,7 +29,8 @@ interface ConfigTarget {
29
29
  }
30
30
  declare const DEVICE_ROLES: readonly ["worker", "personal", "desktop"];
31
31
  declare const AUTO_POOL_MODES: readonly ["workers", "all"];
32
- export declare const MENUBAR_TABS: readonly ["home", "goals", "secrets", "projects", "linear", "github", "sessions", "inbox"];
32
+ export declare const MENUBAR_TABS: readonly ["home", "goals", "secrets", "linear", "github", "sessions", "inbox"];
33
+ export declare const MENUBAR_RETIRED_TABS: readonly string[];
33
34
  export declare const MENUBAR_HOME_GOALS: readonly ["company", "week", "myWeek", "myDay"];
34
35
  export declare const MENUBAR_HOME_SECTIONS: readonly ["company", "cycle", "today", "needs", "prs", "issues", "sessions", "artifacts", "todos"];
35
36
  export declare const MENUBAR_ARTIFACT_KINDS: readonly ["image", "html", "markdown"];
@@ -13,19 +13,20 @@ const SSH_AUTH_METHODS = ['key', 'password'];
13
13
  const DEVICE_ROLES = ['worker', 'personal', 'desktop'];
14
14
  const AUTO_POOL_MODES = ['workers', 'all'];
15
15
  const DEVICE_FORM_FACTORS = ['laptop', 'desktop', 'server', 'unknown'];
16
- export const MENUBAR_TABS = ['home', 'goals', 'secrets', 'projects', 'linear', 'github', 'sessions', 'inbox'];
16
+ export const MENUBAR_TABS = ['home', 'goals', 'secrets', 'linear', 'github', 'sessions', 'inbox'];
17
+ export const MENUBAR_RETIRED_TABS = ['projects'];
18
+ const MENUBAR_STORABLE_TABS = [...MENUBAR_TABS, ...MENUBAR_RETIRED_TABS];
17
19
  const MENUBAR_TABS_ADDED_LATER = ['goals', 'secrets', 'linear', 'github'];
18
20
  export const MENUBAR_HOME_GOALS = ['company', 'week', 'myWeek', 'myDay'];
19
21
  export const MENUBAR_HOME_SECTIONS = ['company', 'cycle', 'today', 'needs', 'prs', 'issues', 'sessions', 'artifacts', 'todos'];
20
22
  export const MENUBAR_ARTIFACT_KINDS = ['image', 'html', 'markdown'];
21
23
  export function resolveMenubarTabOrder(stored) {
22
- const known = MENUBAR_TABS;
23
24
  const tabs = [];
24
25
  for (const id of stored) {
25
- if (known.includes(id) && !tabs.includes(id))
26
+ if (MENUBAR_STORABLE_TABS.includes(id) && !tabs.includes(id))
26
27
  tabs.push(id);
27
28
  }
28
- return [...tabs, ...known.filter((t) => !tabs.includes(t))];
29
+ return [...tabs, ...MENUBAR_TABS.filter((t) => !tabs.includes(t))];
29
30
  }
30
31
  function oneOf(name, allowed) {
31
32
  return (v) => (allowed.includes(v) ? null : `${name} must be one of ${allowed.join(' | ')}.`);
@@ -341,6 +342,14 @@ export const CONFIG_KEYS = [
341
342
  type: 'string',
342
343
  description: 'AGI Menu: the project name the menu opens focused on. Unset = no default project.',
343
344
  },
345
+ {
346
+ name: 'menubar.menu.todoProject',
347
+ yamlKey: 'menubarMenuTodoProject',
348
+ scope: 'user',
349
+ type: 'string',
350
+ description: 'AGI Menu: the project whose open Linear issues the menu lists as to-dos and files new to-dos into ' +
351
+ '(`agents projects todo list|add --project <name>`). Unset = the default quick to-do list.',
352
+ },
344
353
  {
345
354
  name: 'menubar.menu.workingRowsShown',
346
355
  yamlKey: 'menubarMenuWorkingRowsShown',
@@ -549,17 +558,18 @@ export const CONFIG_KEYS = [
549
558
  defaultValue: [...MENUBAR_TABS],
550
559
  description: `AGI Menu: the order of the tab bar — every one of ${MENUBAR_TABS.join(', ')} exactly once. ` +
551
560
  'Settings is always last and is not listed. An order saved before Goals, Secrets, Linear or GitHub existed may omit them; ' +
552
- 'they read back appended. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
561
+ `they read back appended. The retired ${MENUBAR_RETIRED_TABS.join(', ')} tab is still accepted and kept where it was stored, ` +
562
+ 'for menus that predate its removal. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
553
563
  validate: (v) => {
554
564
  const tabs = v;
555
565
  const required = MENUBAR_TABS.filter((t) => !MENUBAR_TABS_ADDED_LATER.includes(t));
556
566
  const ok = new Set(tabs).size === tabs.length
557
- && tabs.every((t) => MENUBAR_TABS.includes(t))
567
+ && tabs.every((t) => MENUBAR_STORABLE_TABS.includes(t))
558
568
  && required.every((t) => tabs.includes(t));
559
569
  return ok
560
570
  ? null
561
571
  : `menubar.menu.tabOrder must list each of ${MENUBAR_TABS.join(', ')} exactly once ` +
562
- `(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and are appended).`;
572
+ `(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and are appended; the retired ${MENUBAR_RETIRED_TABS.join(', ')} may be listed).`;
563
573
  },
564
574
  normalize: (v) => (Array.isArray(v) ? resolveMenubarTabOrder(v.map(String)) : v),
565
575
  },
@@ -591,12 +601,12 @@ export const CONFIG_KEYS = [
591
601
  'Settings cannot be hidden. Hiding Inbox loses nothing: its requests still show on Home. Secrets is hidden unless this list is set without it.',
592
602
  validate: (v) => {
593
603
  const tabs = v;
594
- const bad = tabs.find((t) => !MENUBAR_TABS.includes(t));
604
+ const bad = tabs.find((t) => !MENUBAR_STORABLE_TABS.includes(t));
595
605
  if (bad !== undefined)
596
606
  return `menubar.menu.hiddenTabs: "${bad}" is not one of ${MENUBAR_TABS.join(', ')}.`;
597
607
  if (new Set(tabs).size !== tabs.length)
598
608
  return 'menubar.menu.hiddenTabs lists a tab twice.';
599
- if (tabs.length === MENUBAR_TABS.length)
609
+ if (MENUBAR_TABS.every((t) => tabs.includes(t)))
600
610
  return 'menubar.menu.hiddenTabs cannot hide every tab.';
601
611
  return null;
602
612
  },
@@ -623,8 +633,8 @@ export const CONFIG_KEYS = [
623
633
  yamlKey: 'menubarMenuGithubDrafts',
624
634
  scope: 'user',
625
635
  type: 'bool',
626
- defaultValue: false,
627
- description: 'AGI Menu: show draft pull requests on the GitHub tab (default off).',
636
+ defaultValue: true,
637
+ description: 'AGI Menu: show draft pull requests on the GitHub tab (default on).',
628
638
  },
629
639
  {
630
640
  name: 'menubar.menu.githubBots',
@@ -55,6 +55,12 @@ interface FleetCapacity {
55
55
  export declare function fleetCapacity(statsList: Iterable<DeviceStats>): FleetCapacity;
56
56
  export type Headroom = 'idle' | 'light' | 'busy' | 'loaded' | 'unknown';
57
57
  export declare function headroom(stats: DeviceStats | undefined): Headroom;
58
+ export declare function buildProbeInvocation(device: DeviceProfile, askpassShimPath: string): {
59
+ args: string[];
60
+ env: Record<string, string>;
61
+ isWin: boolean;
62
+ budgetMs: number;
63
+ };
58
64
  export declare function probeDeviceStats(device: DeviceProfile, opts?: {
59
65
  timeoutMs?: number;
60
66
  now?: number;
@@ -1,5 +1,6 @@
1
1
  import { execFile } from 'child_process';
2
2
  import { buildSshInvocation, writeAskpassShim } from './connect.js';
3
+ import { resolveDeviceProfile } from './resolve-profile.js';
3
4
  export const PROBE_TIMEOUT_MS = 2_500;
4
5
  export const RELAYED_PROBE_TIMEOUT_MS = 8_000;
5
6
  // Only measured relayed peers receive the wider budget; unknown/manual peers are not assumed relayed.
@@ -171,16 +172,22 @@ export function headroom(stats) {
171
172
  return 'busy';
172
173
  return 'loaded';
173
174
  }
175
+ export function buildProbeInvocation(device, askpassShimPath) {
176
+ const resolved = resolveDeviceProfile(device);
177
+ const isWin = resolved.shell === 'powershell';
178
+ const { args, env } = buildSshInvocation(resolved, [isWin ? WIN_PROBE_SNIPPET : PROBE_SNIPPET], askpassShimPath, {}, { agentOnly: true });
179
+ return { args, env, isWin, budgetMs: probeBudgetMs(resolved) };
180
+ }
174
181
  // Stats probes are agentOnly so listing devices never opens credential UI; a timeout means slow, not conclusively unreachable.
175
182
  export function probeDeviceStats(device, opts = {}) {
176
183
  const host = device.name;
177
184
  const fetchedAt = opts.now ?? Date.now();
178
- const isWin = device.shell === 'powershell';
179
185
  let args;
180
186
  let env;
187
+ let isWin;
188
+ let budgetMs;
181
189
  try {
182
- const shim = writeAskpassShim();
183
- ({ args, env } = buildSshInvocation(device, [isWin ? WIN_PROBE_SNIPPET : PROBE_SNIPPET], shim, {}, { agentOnly: true }));
190
+ ({ args, env, isWin, budgetMs } = buildProbeInvocation(device, writeAskpassShim()));
184
191
  }
185
192
  catch {
186
193
  return Promise.resolve({ host, reachable: false, fetchedAt });
@@ -189,7 +196,7 @@ export function probeDeviceStats(device, opts = {}) {
189
196
  execFile('ssh', args, {
190
197
  encoding: 'utf-8',
191
198
  env: { ...process.env, ...env },
192
- timeout: opts.timeoutMs ?? probeBudgetMs(device),
199
+ timeout: opts.timeoutMs ?? budgetMs,
193
200
  }, (err, stdout) => {
194
201
  if (err || !stdout) {
195
202
  const timedOut = Boolean(err && err.killed);
@@ -3,6 +3,7 @@ import { span, spanSync } from '../daemon/diagnostics.js';
3
3
  import * as fs from 'node:fs';
4
4
  import * as path from 'node:path';
5
5
  import { loadDevices, isDialableDevice } from '../devices/registry.js';
6
+ import { resolveDeviceProfile } from '../devices/resolve-profile.js';
6
7
  import { machineId, normalizeHost } from '../machine-id.js';
7
8
  import { shellQuote } from '../ssh-exec.js';
8
9
  import { buildWindowsAgentsCommand, remoteShellFor } from '../hosts/remote-cmd.js';
@@ -361,7 +362,7 @@ export async function watchFleetFeed(options) {
361
362
  return;
362
363
  }
363
364
  const self = machineId();
364
- const peers = Object.values(devices).filter((device) => isDialableDevice(device) && normalizeHost(device.name) !== self && ['windows', 'linux', 'macos'].includes(device.platform));
365
+ const peers = Object.values(devices).map(resolveDeviceProfile).filter((device) => isDialableDevice(device) && normalizeHost(device.name) !== self && ['windows', 'linux', 'macos'].includes(device.platform));
365
366
  const tasks = peers.map((device) => {
366
367
  const scope = normalizeHost(device.name);
367
368
  return streamFromPeer({
@@ -68,7 +68,7 @@ interface ProbeOptions {
68
68
  withVersions?: boolean;
69
69
  withSecrets?: boolean;
70
70
  }
71
- export declare function probeDevice(device: DeviceProfile, opts?: ProbeOptions): DeviceProbe;
71
+ export declare function probeDevice(rawDevice: DeviceProfile, opts?: ProbeOptions): DeviceProbe;
72
72
  export declare function parseRemoteBundles(stdout: string): Record<string, string>;
73
73
  export interface ApplyStep {
74
74
  kind: FleetAction['kind'];
@@ -2,6 +2,7 @@ import * as os from 'os';
2
2
  import { pushBundleToHost } from '../secrets-client.js';
3
3
  import { AUTH_STORE_ALIAS, inspectReservedAuthBundle, isReservedBundleName } from '../secrets-policy.js';
4
4
  import { deviceIdentityArgs, sshTargetFor } from '../devices/connect.js';
5
+ import { resolveDeviceProfile } from '../devices/resolve-profile.js';
5
6
  import { readyProbe, bootstrapAgentsCli } from '../hosts/ready.js';
6
7
  import { buildRemoteAgentsInvocation } from '../hosts/remote-cmd.js';
7
8
  import { sshExec } from '../ssh-exec.js';
@@ -200,7 +201,8 @@ function osHint(platform) {
200
201
  function remoteEnv(platform) {
201
202
  return platform === 'windows' ? undefined : { PATH: '$HOME/.agents/.cache/shims:$HOME/.local/bin:$PATH' };
202
203
  }
203
- export function probeDevice(device, opts) {
204
+ export function probeDevice(rawDevice, opts) {
205
+ const device = resolveDeviceProfile(rawDevice);
204
206
  let target;
205
207
  try {
206
208
  target = sshTargetFor(device);
@@ -276,7 +278,8 @@ export function parseRemoteBundles(stdout) {
276
278
  return {};
277
279
  }
278
280
  }
279
- async function reconcileDevice(row, device, ctx) {
281
+ async function reconcileDevice(row, rawDevice, ctx) {
282
+ const device = resolveDeviceProfile(rawDevice);
280
283
  if (!row.probe.reachable) {
281
284
  return { device: row.device, ok: false, steps: [], note: row.probe.note ?? 'unreachable' };
282
285
  }
@@ -1,4 +1,5 @@
1
1
  import type { CachedUsageSnapshot } from './accounting/usage.js';
2
+ import type { NativeAccountRecord } from './types.js';
2
3
  export declare const FLEET_SHARED_STATE_VERSION = 1;
3
4
  export declare const FLEET_SHARED_STATE_FILE = "daemon-state.json";
4
5
  export type SharedAuthStatus = 'ready' | 'missing' | 'invalid';
@@ -40,6 +41,7 @@ export interface FleetSharedDeviceState {
40
41
  };
41
42
  accounts?: {
42
43
  rows: unknown[];
44
+ native?: NativeAccountRecord[];
43
45
  };
44
46
  ownerNotify?: {
45
47
  signedIn: boolean;
@@ -34,7 +34,9 @@ export function parseFleetSharedDeviceStateEnvelope(parsed, owner) {
34
34
  throw new Error('unrecognized session mirror');
35
35
  }
36
36
  const accounts = parsed.accounts;
37
- if (accounts !== undefined && (!isRecord(accounts) || !Array.isArray(accounts.rows))) {
37
+ if (accounts !== undefined
38
+ && (!isRecord(accounts) || !Array.isArray(accounts.rows)
39
+ || (accounts.native !== undefined && !Array.isArray(accounts.native)))) {
38
40
  throw new Error('unrecognized account verdict rows');
39
41
  }
40
42
  const ownerNotify = parsed.ownerNotify;
@@ -270,6 +270,16 @@ export async function listRecentlyMerged(repo, sinceMs, gh = ghExec) {
270
270
  }));
271
271
  return { merged, truncated };
272
272
  }
273
+ async function readMergeState(slug, number, gh, errors) {
274
+ try {
275
+ const { mergeable, mergeableState } = await fetchOnePr(slug, number, gh, '60s');
276
+ return { mergeable, mergeableState };
277
+ }
278
+ catch (err) {
279
+ errors.record(err);
280
+ return {};
281
+ }
282
+ }
273
283
  async function readMergedDetail(slug, number, gh, details, errors) {
274
284
  const hit = details.get(slug, number);
275
285
  if (hit)
@@ -454,7 +464,10 @@ export async function buildProjectPrs(def, opts = {}, gh = ghExec, peers = [], c
454
464
  : null;
455
465
  merged = merged.slice(0, MERGED_LIMIT);
456
466
  const [openCi, recentlyMerged] = await Promise.all([
457
- mapBounded(pullRequests, 8, (pr) => readCi(ci, pr.headSha)),
467
+ mapBounded(pullRequests, 8, async (pr) => {
468
+ const [prCi, mergeState] = await Promise.all([readCi(ci, pr.headSha), readMergeState(slug, pr.number, gh, errors)]);
469
+ return { ...prCi, ...mergeState };
470
+ }),
458
471
  mapBounded(merged, 8, async (m) => {
459
472
  const [detail, mergeCi] = await Promise.all([
460
473
  readMergedDetail(slug, m.pr.number, gh, details, errors),
@@ -1,5 +1,5 @@
1
1
  export const HELPER_RELEASES = {
2
- menubar: { tagPrefix: 'menubar', floor: '1.15.21' },
2
+ menubar: { tagPrefix: 'menubar', floor: '1.18.0' },
3
3
  };
4
4
  export function helperTag(helper, version) {
5
5
  const release = HELPER_RELEASES[helper];
@@ -1401,7 +1401,7 @@ export async function getInstalledVersion(agent, version) {
1401
1401
  }
1402
1402
  }
1403
1403
  export function isMissingBinarySignature(output) {
1404
- return /\bENOENT\b|no such file|cannot find|command not found|is not recognized|native binary not installed|postinstall did not run|optional dependency was not downloaded/i.test(output);
1404
+ return /\bENOENT\b|no such file|cannot find|command not found|is not recognized|native binary not installed|postinstall did not run|optional dependency was not downloaded|missing optional dependency/i.test(output);
1405
1405
  }
1406
1406
  export function probeSpawnSpec(binary, isWin) {
1407
1407
  if (isWin)
@@ -1429,8 +1429,9 @@ export async function verifyBinaryLaunches(posixBinary, home) {
1429
1429
  catch (err) {
1430
1430
  const blob = `${err?.code ?? ''} ${err?.stdout ?? ''} ${err?.stderr ?? ''} ${err?.message ?? ''}`;
1431
1431
  if (err?.code === 'ENOENT' || isMissingBinarySignature(blob)) {
1432
- const detail = String(err?.stderr || err?.message || '')
1433
- .split('\n').map((s) => s.trim()).filter(Boolean)[0];
1432
+ const lines = String(err?.stderr || err?.message || '')
1433
+ .split('\n').map((s) => s.trim()).filter(Boolean);
1434
+ const detail = lines.find((line) => isMissingBinarySignature(line)) ?? lines[0];
1434
1435
  return { ok: false, detail: detail || 'native binary missing (ENOENT)' };
1435
1436
  }
1436
1437
  return { ok: true };
@@ -2,6 +2,7 @@ export declare function toHomeRelative(abs: string): string;
2
2
  export declare function expandLocalHome(p: string): string;
3
3
  export declare function toRemotePortable(p: string): string;
4
4
  export declare function homeRemainder(p: string): string | null;
5
+ export declare function localizeHome(p: string, home?: string): string;
5
6
  export declare function localProjectFolder(cwd: string | undefined, home?: string): string | undefined;
6
7
  export declare function deriveMirroredCwd(localCwd: string): string | undefined;
7
8
  export declare function remoteCdPrefix(remoteCwd?: string, opts?: {
@@ -40,13 +40,21 @@ export function homeRemainder(p) {
40
40
  return p.slice(6);
41
41
  return null;
42
42
  }
43
- const FOREIGN_HOME_RE = /^\/(?:home|Users)\/[^/]+(?=\/|$)/;
43
+ const FOREIGN_HOME_RE = /^\/(?:home|Users)\/([^/]+)(?=\/|$)/;
44
44
  const WORKTREE_RE = /\/\.agents\/worktrees\/[^/]+(?:\/.*)?$/;
45
+ export function localizeHome(p, home = HOME) {
46
+ if (p === home || p.startsWith(home + '/'))
47
+ return p;
48
+ const foreign = p.match(FOREIGN_HOME_RE);
49
+ const user = path.basename(home);
50
+ if (!foreign || foreign[1] !== user || user === 'Shared')
51
+ return p;
52
+ return home + p.slice(foreign[0].length);
53
+ }
45
54
  export function localProjectFolder(cwd, home = HOME) {
46
55
  if (!cwd)
47
56
  return undefined;
48
- const local = cwd.startsWith(home + '/') || cwd === home ? cwd : cwd.replace(FOREIGN_HOME_RE, home);
49
- const folder = local.replace(WORKTREE_RE, '');
57
+ const folder = localizeHome(cwd, home).replace(WORKTREE_RE, '');
50
58
  return folder !== home && fs.existsSync(folder) ? folder : undefined;
51
59
  }
52
60
  export function deriveMirroredCwd(localCwd) {
@@ -3,7 +3,7 @@ import * as path from 'path';
3
3
  import * as yaml from 'yaml';
4
4
  import { getProjectsDir } from './state.js';
5
5
  import { safeJoin } from './paths.js';
6
- import { toHomeRelative, expandLocalHome } from './project-root.js';
6
+ import { toHomeRelative, expandLocalHome, localizeHome } from './project-root.js';
7
7
  import { resolveProjectKey } from './project-key.js';
8
8
  import { atomicWriteFileSync } from './fs-atomic.js';
9
9
  export function isSafeProjectName(name) {
@@ -308,7 +308,7 @@ function isUnder(child, parent) {
308
308
  export function projectNameForCwd(cwd, defs) {
309
309
  if (!cwd)
310
310
  return undefined;
311
- const abs = path.resolve(expandLocalHome(cwd));
311
+ const abs = path.resolve(localizeHome(expandLocalHome(cwd)));
312
312
  let best;
313
313
  let bestLen = -1;
314
314
  let weakBest;
@@ -68,7 +68,11 @@ export interface AddOptions {
68
68
  }
69
69
  export declare function addRefusal(title: string, opts: AddOptions): string | null;
70
70
  export declare function addQuickTodo(text: string, opts: AddOptions, linear?: LinearExec): Promise<TodoResult>;
71
- export declare function listQuickTodos(now: Date, linear?: LinearExec): Promise<{
71
+ export interface ListOptions {
72
+ project?: string;
73
+ defs?: readonly ProjectDef[];
74
+ }
75
+ export declare function listQuickTodos(now: Date, opts?: ListOptions, linear?: LinearExec): Promise<{
72
76
  todos: QuickTodo[];
73
77
  total: number;
74
78
  }>;
@@ -172,7 +172,20 @@ export async function addQuickTodo(text, opts, linear = linearExec) {
172
172
  return { ok: true, todo, message: `Created ${id}; reading it back failed: ${linearFailure(err)}` };
173
173
  }
174
174
  }
175
- export async function listQuickTodos(now, linear = linearExec) {
175
+ export async function listQuickTodos(now, opts = {}, linear = linearExec) {
176
+ if (opts.project) {
177
+ const project = linearProjectFor(opts.project, opts.defs ?? []);
178
+ const parsed = JSON.parse((await linear(['tasks', '--project', project, '--status', 'open', '--all', '--json'])).stdout);
179
+ const all = (parsed.issues ?? []).map(toQuickTodo);
180
+ all.sort((a, b) => {
181
+ if ((a.due === null) !== (b.due === null))
182
+ return a.due !== null ? -1 : 1;
183
+ if (a.due !== null && a.due !== b.due)
184
+ return a.due < b.due ? -1 : 1;
185
+ return b.createdAt.localeCompare(a.createdAt);
186
+ });
187
+ return { todos: all.slice(0, TODO_LIST_LIMIT), total: all.length };
188
+ }
176
189
  const parsed = JSON.parse((await linear(['tasks', '--assignee', 'me', '--status', 'open', '--cycle', 'all', '--all', '--json'])).stdout);
177
190
  const today = localDay(now);
178
191
  const due = (t) => t.due !== null && t.due <= today;
@@ -3,6 +3,7 @@ import { setMaxListeners } from 'node:events';
3
3
  import chalk from 'chalk';
4
4
  import { SSH_OPTS, controlOpts, assertValidSshTarget, shellQuote, REMOTE_STDOUT_MAX_BYTES, RemoteUtf8Accumulator, } from './ssh-exec.js';
5
5
  import { deviceIdentityArgs, sshTargetFor } from './devices/connect.js';
6
+ import { resolveDeviceProfile } from './devices/resolve-profile.js';
6
7
  import { resolveExplicitTargets } from './devices/resolve-target.js';
7
8
  import { loadDevices, isDialableDevice } from './devices/registry.js';
8
9
  import { remoteShellFor, buildWindowsAgentsCommand, buildWindowsToolCommand, stripClixml } from './hosts/remote-cmd.js';
@@ -86,14 +87,15 @@ export async function gatherRemoteAgentsJson(options, deps = {}) {
86
87
  continue;
87
88
  if (normalizeHost(device.name) === self)
88
89
  continue;
89
- if (!['windows', 'linux', 'macos'].includes(device.platform))
90
+ const platform = resolveDeviceProfile(device).platform;
91
+ if (!['windows', 'linux', 'macos'].includes(platform))
90
92
  continue;
91
93
  try {
92
94
  targets.push({
93
95
  target: sshTargetFor(device),
94
96
  machine: normalizeHost(device.name),
95
97
  name: device.name,
96
- os: device.platform,
98
+ os: platform,
97
99
  extraSshArgs: deviceIdentityArgs(device),
98
100
  });
99
101
  }
@@ -35,7 +35,7 @@ export declare function sweepStaleInstallStaging(packageRoot: string): Promise<s
35
35
  export declare function installPackageIntoPrefix(spec: string, prefix: string, signal?: AbortSignal): Promise<void>;
36
36
  export declare const INSTALL_SETTLE_MS = 60000;
37
37
  export declare function installLooksSettled(packageRoot: string, settleMs?: number, now?: number): boolean;
38
- export declare function installPackageWithBun(spec: string, signal?: AbortSignal): Promise<void>;
38
+ export declare function installPackageWithBun(spec: string, globalDir: string, signal?: AbortSignal): Promise<void>;
39
39
  export declare function verifyTarballIntegrity(tarball: Buffer, integrity: string): void;
40
40
  export declare function downloadVerifiedTarball(tarballUrl: string, integrity: string, timeoutMs?: number, signal?: AbortSignal): Promise<string>;
41
41
  export declare function readInstalledVersion(packageRoot: string): Promise<string>;