@phnx-labs/agents-cli 1.23.18 → 1.23.20

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 (78) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/README.md +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/commands/cloud.js +1 -1
  5. package/dist/commands/config.js +1 -1
  6. package/dist/commands/detach.js +5 -1
  7. package/dist/commands/doctor.js +11 -7
  8. package/dist/commands/exec.d.ts +0 -17
  9. package/dist/commands/exec.js +17 -51
  10. package/dist/commands/focus.d.ts +10 -2
  11. package/dist/commands/focus.js +80 -19
  12. package/dist/commands/projects-todo.js +10 -5
  13. package/dist/commands/ps.d.ts +8 -2
  14. package/dist/commands/ps.js +175 -92
  15. package/dist/commands/sessions-picker.d.ts +0 -7
  16. package/dist/commands/sessions-picker.js +5 -299
  17. package/dist/commands/sessions-stop.js +2 -2
  18. package/dist/lib/account-registry.d.ts +3 -0
  19. package/dist/lib/account-registry.js +40 -0
  20. package/dist/lib/accounting/account-pool-collect.d.ts +2 -2
  21. package/dist/lib/accounting/account-pool-collect.js +4 -4
  22. package/dist/lib/accounting/account-pool.d.ts +1 -1
  23. package/dist/lib/accounting/account-pool.js +3 -1
  24. package/dist/lib/accounting/usage-sync.d.ts +1 -0
  25. package/dist/lib/accounting/usage-sync.js +20 -3
  26. package/dist/lib/accounting/usage.d.ts +4 -1
  27. package/dist/lib/accounting/usage.js +38 -6
  28. package/dist/lib/agent-spec/agents.js +12 -11
  29. package/dist/lib/cloud/store.d.ts +5 -1
  30. package/dist/lib/cloud/store.js +10 -3
  31. package/dist/lib/config-keys.d.ts +1 -1
  32. package/dist/lib/config-keys.js +1 -0
  33. package/dist/lib/daemon/account-state-daemon-service.js +9 -2
  34. package/dist/lib/daemon/self-update-service.js +1 -1
  35. package/dist/lib/device-config.d.ts +2 -1
  36. package/dist/lib/device-config.js +21 -11
  37. package/dist/lib/devices/health.d.ts +6 -0
  38. package/dist/lib/devices/health.js +11 -4
  39. package/dist/lib/feed/watch.js +2 -1
  40. package/dist/lib/fleet/apply.d.ts +1 -1
  41. package/dist/lib/fleet/apply.js +5 -2
  42. package/dist/lib/fleet-shared-state.d.ts +2 -0
  43. package/dist/lib/fleet-shared-state.js +3 -1
  44. package/dist/lib/github/project-prs.js +14 -1
  45. package/dist/lib/helper-versions.js +1 -1
  46. package/dist/lib/installations/versions.js +4 -3
  47. package/dist/lib/project-root.d.ts +1 -0
  48. package/dist/lib/project-root.js +11 -3
  49. package/dist/lib/projects.js +2 -2
  50. package/dist/lib/quick-todo.d.ts +5 -1
  51. package/dist/lib/quick-todo.js +14 -1
  52. package/dist/lib/remote-agents-json.js +4 -2
  53. package/dist/lib/self-update.d.ts +1 -1
  54. package/dist/lib/self-update.js +59 -2
  55. package/dist/lib/session/db.js +1 -1
  56. package/dist/lib/session/glance-files.d.ts +21 -0
  57. package/dist/lib/session/glance-files.js +123 -0
  58. package/dist/lib/session/presentation.d.ts +3 -0
  59. package/dist/lib/session/preview-digest.d.ts +13 -0
  60. package/dist/lib/session/preview-digest.js +328 -0
  61. package/dist/lib/session/recovery.d.ts +1 -1
  62. package/dist/lib/session/recovery.js +1 -1
  63. package/dist/lib/session/remote/remote-list.d.ts +3 -2
  64. package/dist/lib/session/remote/remote-list.js +12 -6
  65. package/dist/lib/session/remote/watch.d.ts +2 -0
  66. package/dist/lib/session/remote/watch.js +86 -5
  67. package/dist/lib/smart-launch.js +6 -1
  68. package/dist/lib/teams/placement-probe.d.ts +2 -0
  69. package/dist/lib/teams/placement-probe.js +8 -3
  70. package/dist/lib/terminal/engine.d.ts +2 -0
  71. package/dist/lib/terminal/engine.js +5 -3
  72. package/dist/lib/terminal/index.d.ts +1 -1
  73. package/dist/lib/terminal/index.js +1 -1
  74. package/dist/lib/terminal/run-surface.d.ts +1 -0
  75. package/dist/lib/terminal/run-surface.js +9 -0
  76. package/package.json +1 -1
  77. package/dist/lib/onepassword.d.ts +0 -57
  78. package/dist/lib/onepassword.js +0 -140
@@ -1,12 +1,14 @@
1
1
  import type { Backend, EngineContext, LaunchRequest, LaunchResult, LaunchSpec } from './types.js';
2
2
  import { type Packing } from './policy.js';
3
3
  import { type HostResolver } from './transport.js';
4
+ import { type SpawnAck } from './backends/vscodium-agent.js';
4
5
  export declare function specsForRequest(req: LaunchRequest, nonce?: string): LaunchSpec[];
5
6
  export interface OpenOptions {
6
7
  resolveHost?: HostResolver;
7
8
  ctx?: EngineContext;
8
9
  ackTimeoutMs?: number;
9
10
  }
11
+ export declare function ackFailure(ack: SpawnAck | undefined, req: LaunchRequest, timeoutMs: number): string | undefined;
10
12
  export declare function openSurface(req: LaunchRequest, opts?: OpenOptions): Promise<LaunchResult>;
11
13
  export interface SurfaceItem {
12
14
  cwd: string;
@@ -31,9 +31,11 @@ function ackReader(nonce) {
31
31
  }
32
32
  };
33
33
  }
34
- function ackFailure(ack, req, timeoutMs) {
35
- if (!ack)
36
- return `VSCodium didn't confirm a tab within ${Math.round(timeoutMs / 1000)}s`;
34
+ export function ackFailure(ack, req, timeoutMs) {
35
+ if (!ack) {
36
+ return `VSCodium did not confirm the tab within ${Math.round(timeoutMs / 1000)}s; ` +
37
+ `if VSCodium is asking "Allow 'Agents' extension to open this URI?", approve it and try again`;
38
+ }
37
39
  if (!ackLandedIn(ack, req.project)) {
38
40
  const where = ack.workspaceName ?? (ack.windowFolders.join(', ') || 'an unknown window');
39
41
  const why = ack.reason ? ` (${ack.reason})` : '';
@@ -10,5 +10,5 @@ export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSp
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';
13
- export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
13
+ export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, liveHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
14
14
  export type { OpenRunSurfaceParams, OpenRunSurfaceResult } from './run-surface.js';
@@ -9,4 +9,4 @@ export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSp
9
9
  export { resolveInjectTarget, resolveInjectTargetForSession, } from './resolve.js';
10
10
  export { iLoginShell } from './shell.js';
11
11
  export { shellQuote } from './quote.js';
12
- export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
12
+ export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, liveHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
@@ -9,6 +9,7 @@ export declare function parseTerminalFlag(value: unknown): {
9
9
  export declare function stripTerminalFlag(argv: string[], consumedValue?: string): string[];
10
10
  export declare function buildRunCommand(argv: string[]): string[];
11
11
  export declare function toHostSamples(sessions: ActiveSession[]): Promise<SessionHostSample[]>;
12
+ export declare function liveHostSamples(): Promise<SessionHostSample[]>;
12
13
  export interface OpenRunSurfaceParams {
13
14
  argv: string[];
14
15
  forced?: Backend;
@@ -76,6 +76,15 @@ export async function toHostSamples(sessions) {
76
76
  }
77
77
  return samples;
78
78
  }
79
+ export async function liveHostSamples() {
80
+ try {
81
+ const { getActiveSessions } = await import('../session/active.js');
82
+ return await toHostSamples(await getActiveSessions());
83
+ }
84
+ catch {
85
+ return [];
86
+ }
87
+ }
79
88
  export async function openRunInTerminal(params) {
80
89
  const choice = params.forced
81
90
  ? { backend: params.forced, source: 'forced' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.23.18",
3
+ "version": "1.23.20",
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,57 +0,0 @@
1
- interface OpItemSummary {
2
- id: string;
3
- title: string;
4
- category: string;
5
- vault: {
6
- id: string;
7
- name: string;
8
- };
9
- }
10
- export interface OpField {
11
- id: string;
12
- label: string;
13
- type: string;
14
- value?: string;
15
- purpose?: string;
16
- }
17
- export interface OpItem extends OpItemSummary {
18
- fields: OpField[];
19
- }
20
- interface ImportableSecret {
21
- envKey: string;
22
- itemTitle: string;
23
- fieldLabel: string;
24
- value: string;
25
- description?: string;
26
- }
27
- interface SkippedField {
28
- itemTitle: string;
29
- fieldLabel: string;
30
- reason: string;
31
- }
32
- export declare function getItem(itemId: string, vaultName: string): OpItem;
33
- export declare function toEnvKey(title: string): string;
34
- export declare function slugify(name: string): string;
35
- export declare function itemToSecret(item: OpItem): {
36
- secret: ImportableSecret;
37
- } | {
38
- skipped: SkippedField;
39
- };
40
- export declare function extractSecrets(items: OpItemSummary[], vaultName: string): {
41
- secrets: ImportableSecret[];
42
- skipped: SkippedField[];
43
- };
44
- interface PasswordItemTemplate {
45
- title: string;
46
- category: 'PASSWORD';
47
- tags: string[];
48
- fields: Array<{
49
- id: string;
50
- type: 'CONCEALED';
51
- purpose: 'PASSWORD';
52
- label: string;
53
- value: string;
54
- }>;
55
- }
56
- export declare function buildPasswordItemTemplate(title: string, value: string): PasswordItemTemplate;
57
- export {};
@@ -1,140 +0,0 @@
1
- import { spawnSync } from 'child_process';
2
- function runOp(args, input) {
3
- const result = spawnSync('op', args, {
4
- stdio: [input !== undefined ? 'pipe' : 'ignore', 'pipe', 'pipe'],
5
- encoding: 'utf-8',
6
- maxBuffer: 10 * 1024 * 1024,
7
- input,
8
- });
9
- if (result.error) {
10
- if (result.error.code === 'ENOENT') {
11
- return { ok: false, error: '1Password CLI not found. Install: brew install 1password-cli' };
12
- }
13
- return { ok: false, error: result.error.message };
14
- }
15
- if (result.status !== 0) {
16
- const stderr = result.stderr?.trim() || '';
17
- if (stderr.includes('not signed in') || stderr.includes('sign in') || stderr.includes('no active session')) {
18
- return { ok: false, error: 'Not signed in to 1Password. Run: op signin' };
19
- }
20
- return { ok: false, error: stderr || `op exited with code ${result.status}` };
21
- }
22
- return { ok: true, stdout: result.stdout };
23
- }
24
- export function getItem(itemId, vaultName) {
25
- const result = runOp(['item', 'get', itemId, '--vault', vaultName, '--format=json', '--reveal']);
26
- if (!result.ok)
27
- throw new Error(result.error);
28
- return JSON.parse(result.stdout);
29
- }
30
- export function toEnvKey(title) {
31
- return title
32
- .toUpperCase()
33
- .replace(/[^A-Z0-9]+/g, '_')
34
- .replace(/^_+|_+$/g, '')
35
- .replace(/^(\d)/, '_$1');
36
- }
37
- export function slugify(name) {
38
- return name
39
- .toLowerCase()
40
- .replace(/[^a-z0-9]+/g, '-')
41
- .replace(/^-+|-+$/g, '');
42
- }
43
- const IMPORTABLE_FIELD_TYPES = new Set([
44
- 'CONCEALED', 'concealed',
45
- 'STRING', 'string', 'text', 'TEXT',
46
- 'URL', 'url',
47
- ]);
48
- const SKIP_FIELD_LABELS = new Set(['username', 'notesPlain', 'notes']);
49
- const NOTES_FIELD_LABELS = new Set(['notesplain', 'notes']);
50
- function pickBestField(fields) {
51
- const dominated = fields.filter((f) => IMPORTABLE_FIELD_TYPES.has(f.type) &&
52
- f.value &&
53
- !SKIP_FIELD_LABELS.has(f.label?.toLowerCase() || ''));
54
- if (dominated.length === 0)
55
- return null;
56
- const concealed = dominated.find((f) => f.type.toLowerCase() === 'concealed');
57
- if (concealed)
58
- return concealed;
59
- const secretLabels = ['credential', 'password', 'secret', 'key', 'token', 'api_key', 'apikey'];
60
- const labeled = dominated.find((f) => secretLabels.includes(f.label?.toLowerCase() || ''));
61
- if (labeled)
62
- return labeled;
63
- return dominated[0];
64
- }
65
- /**
66
- * The item's notes, if any — a NOTES-purpose field (1Password's `notesPlain`)
67
- * or a field labelled notes/notesPlain, whichever carries a non-empty value.
68
- * Returns undefined when the item has no notes. This is descriptive metadata
69
- * only; it is deliberately independent of value selection and is never picked
70
- * as the secret value (see SKIP_FIELD_LABELS / pickBestField).
71
- */
72
- function pickNotes(fields) {
73
- const notes = fields.find((f) => f.value != null &&
74
- f.value.trim() !== '' &&
75
- (f.purpose?.toUpperCase() === 'NOTES' ||
76
- NOTES_FIELD_LABELS.has(f.label?.toLowerCase() || '')));
77
- const value = notes?.value?.trim();
78
- return value ? value : undefined;
79
- }
80
- export function itemToSecret(item) {
81
- const field = pickBestField(item.fields || []);
82
- if (!field) {
83
- return { skipped: { itemTitle: item.title, fieldLabel: '*', reason: 'no importable fields' } };
84
- }
85
- if (field.value.includes('\n')) {
86
- return {
87
- skipped: {
88
- itemTitle: item.title,
89
- fieldLabel: field.label,
90
- reason: 'contains newlines (keychain limitation)',
91
- },
92
- };
93
- }
94
- const secret = {
95
- envKey: toEnvKey(item.title),
96
- itemTitle: item.title,
97
- fieldLabel: field.label,
98
- value: field.value,
99
- };
100
- const description = pickNotes(item.fields || []);
101
- if (description)
102
- secret.description = description;
103
- return { secret };
104
- }
105
- export function extractSecrets(items, vaultName) {
106
- const secrets = [];
107
- const skipped = [];
108
- for (const summary of items) {
109
- let item;
110
- try {
111
- item = getItem(summary.id, vaultName);
112
- }
113
- catch (err) {
114
- skipped.push({
115
- itemTitle: summary.title,
116
- fieldLabel: '*',
117
- reason: err.message,
118
- });
119
- continue;
120
- }
121
- const result = itemToSecret(item);
122
- if ('skipped' in result) {
123
- skipped.push(result.skipped);
124
- }
125
- else {
126
- secrets.push(result.secret);
127
- }
128
- }
129
- return { secrets, skipped };
130
- }
131
- export function buildPasswordItemTemplate(title, value) {
132
- return {
133
- title,
134
- category: 'PASSWORD',
135
- tags: ['agents-cli'],
136
- fields: [
137
- { id: 'password', type: 'CONCEALED', purpose: 'PASSWORD', label: 'password', value },
138
- ],
139
- };
140
- }