@phnx-labs/agents-cli 1.20.85 → 1.20.87
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.
- package/CHANGELOG.md +168 -0
- package/dist/bin/agents +0 -0
- package/dist/commands/events.d.ts +16 -0
- package/dist/commands/events.js +44 -5
- package/dist/commands/models.js +1 -1
- package/dist/commands/sessions-browser.d.ts +18 -0
- package/dist/commands/sessions-browser.js +126 -24
- package/dist/commands/sessions-picker.d.ts +21 -8
- package/dist/commands/sessions-picker.js +88 -11
- package/dist/commands/sessions.d.ts +19 -0
- package/dist/commands/sessions.js +147 -18
- package/dist/commands/ssh.js +59 -1
- package/dist/commands/teams-picker.d.ts +2 -0
- package/dist/commands/teams-picker.js +2 -1
- package/dist/commands/teams.d.ts +4 -1
- package/dist/commands/teams.js +106 -70
- package/dist/commands/view.js +14 -3
- package/dist/index.js +31 -1
- package/dist/lib/claude-account-token.d.ts +12 -0
- package/dist/lib/claude-account-token.js +63 -0
- package/dist/lib/devices/registry.d.ts +25 -0
- package/dist/lib/devices/registry.js +82 -1
- package/dist/lib/events.d.ts +8 -1
- package/dist/lib/events.js +13 -0
- package/dist/lib/exec.js +10 -1
- package/dist/lib/format.d.ts +7 -0
- package/dist/lib/format.js +11 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/Resources/AppIcon.icns +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/_CodeSignature/CodeResources +2 -2
- package/dist/lib/models.d.ts +21 -0
- package/dist/lib/models.js +133 -4
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/Resources/AppIcon.icns +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +2 -2
- package/dist/lib/session/db.d.ts +21 -0
- package/dist/lib/session/db.js +45 -4
- package/dist/lib/session/parse.d.ts +11 -0
- package/dist/lib/session/parse.js +24 -7
- package/dist/lib/session/remote-list.d.ts +7 -0
- package/dist/lib/session/remote-list.js +8 -4
- package/dist/lib/session/state.d.ts +6 -5
- package/dist/lib/session/state.js +84 -11
- package/dist/lib/session/team-filter.d.ts +22 -3
- package/dist/lib/session/team-filter.js +106 -17
- package/dist/lib/session/types.d.ts +8 -0
- package/dist/lib/signin-badge.d.ts +17 -0
- package/dist/lib/signin-badge.js +19 -0
- package/dist/lib/state.d.ts +2 -0
- package/dist/lib/state.js +2 -0
- package/dist/lib/usage.js +1 -60
- package/package.json +1 -1
package/dist/lib/state.d.ts
CHANGED
|
@@ -181,6 +181,8 @@ export declare function getTeamsRegistryPath(): string;
|
|
|
181
181
|
export declare function getDevicesRegistryPath(): string;
|
|
182
182
|
/** Path to the device ignore-list — tailscale node names the user dismissed, so auto-discovery never re-suggests them. Per-machine, same dir as the registry. */
|
|
183
183
|
export declare function getDevicesIgnoredPath(): string;
|
|
184
|
+
/** Path to the device auto-launch preference file — which registered devices are eligible/preferred for Factory's auto-host selection. Per-machine, same dir as the registry. */
|
|
185
|
+
export declare function getDevicesAutoLaunchPath(): string;
|
|
184
186
|
/** Dir of "pending device" sentinels (~/.agents/.cache/state/devices-pending/) — one empty-ish file per newly-discovered, not-yet-approved tailnet node. Written by the daemon probe, read by the menu-bar helper (mirrors the attention sentinel dir). */
|
|
185
187
|
export declare function getDevicesPendingDir(): string;
|
|
186
188
|
/** Path to cloud dispatch cache (~/.agents/.cache/cloud/). */
|
package/dist/lib/state.js
CHANGED
|
@@ -402,6 +402,8 @@ function getDevicesDir() {
|
|
|
402
402
|
export function getDevicesRegistryPath() { return path.join(getDevicesDir(), 'registry.json'); }
|
|
403
403
|
/** Path to the device ignore-list — tailscale node names the user dismissed, so auto-discovery never re-suggests them. Per-machine, same dir as the registry. */
|
|
404
404
|
export function getDevicesIgnoredPath() { return path.join(getDevicesDir(), 'ignored.json'); }
|
|
405
|
+
/** Path to the device auto-launch preference file — which registered devices are eligible/preferred for Factory's auto-host selection. Per-machine, same dir as the registry. */
|
|
406
|
+
export function getDevicesAutoLaunchPath() { return path.join(getDevicesDir(), 'auto-launch.json'); }
|
|
405
407
|
/** Dir of "pending device" sentinels (~/.agents/.cache/state/devices-pending/) — one empty-ish file per newly-discovered, not-yet-approved tailnet node. Written by the daemon probe, read by the menu-bar helper (mirrors the attention sentinel dir). */
|
|
406
408
|
export function getDevicesPendingDir() { return path.join(RUNTIME_STATE_DIR, 'devices-pending'); }
|
|
407
409
|
/** Path to cloud dispatch cache (~/.agents/.cache/cloud/). */
|
package/dist/lib/usage.js
CHANGED
|
@@ -18,7 +18,7 @@ import chalk from 'chalk';
|
|
|
18
18
|
import { decodeJwtPayload, decryptDroidAuthPayload } from './agents.js';
|
|
19
19
|
import { walkForFiles } from './fs-walk.js';
|
|
20
20
|
import { getKeychainToken, setKeychainToken, deleteKeychainToken, isKeychainBackendOverridden, } from './secrets/index.js';
|
|
21
|
-
import {
|
|
21
|
+
import { resolveClaudeSetupToken } from './claude-account-token.js';
|
|
22
22
|
import { getCacheDir } from './state.js';
|
|
23
23
|
const execFileAsync = promisify(execFile);
|
|
24
24
|
const CLAUDE_USAGE_URL = 'https://api.anthropic.com/api/oauth/usage';
|
|
@@ -999,65 +999,6 @@ function deleteCachedClaudeOauth(service) {
|
|
|
999
999
|
/* best-effort — cache is an optimization */
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Reserved FILE-BASED secrets bundle holding long-lived, non-rotating Claude
|
|
1004
|
-
* setup-tokens. Usage/probe reads authenticate with these instead of Claude
|
|
1005
|
-
* Code's ACL-bound login item, so they never pop Touch ID. Keyed strictly
|
|
1006
|
-
* per-account (`CLAUDE_CODE_OAUTH_TOKEN_<slug>` from the account email) — never a
|
|
1007
|
-
* bare key, so one account's token can't be misapplied to another in a
|
|
1008
|
-
* multi-account fleet.
|
|
1009
|
-
*/
|
|
1010
|
-
const AUTH_BUNDLE = 'auth';
|
|
1011
|
-
/** The per-account key an email maps to inside the `auth` bundle. */
|
|
1012
|
-
function claudeAccountTokenKey(account) {
|
|
1013
|
-
const slug = account
|
|
1014
|
-
.trim()
|
|
1015
|
-
.toUpperCase()
|
|
1016
|
-
.replace(/@/g, '_AT_')
|
|
1017
|
-
.replace(/\./g, '_DOT_')
|
|
1018
|
-
.replace(/[^A-Z0-9_]/g, '_');
|
|
1019
|
-
return `CLAUDE_CODE_OAUTH_TOKEN_${slug}`;
|
|
1020
|
-
}
|
|
1021
|
-
/** Signed-in account email for a version home, from `.claude.json` (no keychain). */
|
|
1022
|
-
function readClaudeAccountEmail(home) {
|
|
1023
|
-
const base = home ?? os.homedir();
|
|
1024
|
-
for (const p of [path.join(base, '.claude', '.claude.json'), path.join(base, '.claude.json')]) {
|
|
1025
|
-
try {
|
|
1026
|
-
const email = JSON.parse(fs.readFileSync(p, 'utf-8')).oauthAccount?.emailAddress;
|
|
1027
|
-
if (typeof email === 'string' && email.trim().length > 0)
|
|
1028
|
-
return email.trim();
|
|
1029
|
-
}
|
|
1030
|
-
catch {
|
|
1031
|
-
// Missing/unreadable at this location — try the next.
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
return null;
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
* Resolve a long-lived `claude setup-token` for the account signed into `home`
|
|
1038
|
-
* from the reserved FILE-BASED `auth` bundle. Returns the token or null. Reads
|
|
1039
|
-
* ONLY when the bundle is file-backed (never keychain), so this path itself can
|
|
1040
|
-
* never trigger a Touch ID prompt — that is the entire point: usage/probe reads
|
|
1041
|
-
* authenticate with the shareable setup-token, not the ACL-bound login item.
|
|
1042
|
-
*/
|
|
1043
|
-
function resolveClaudeSetupToken(home) {
|
|
1044
|
-
try {
|
|
1045
|
-
// Require a known account (email) up front: without it we cannot key a
|
|
1046
|
-
// per-account token, and we must NOT fall back to a bare shared key that
|
|
1047
|
-
// would misapply one account's setup-token to another.
|
|
1048
|
-
const email = readClaudeAccountEmail(home);
|
|
1049
|
-
if (!email)
|
|
1050
|
-
return null;
|
|
1051
|
-
if (!bundleExists(AUTH_BUNDLE) || bundleBackend(AUTH_BUNDLE) !== 'file')
|
|
1052
|
-
return null;
|
|
1053
|
-
const { env } = readAndResolveBundleEnv(AUTH_BUNDLE, { caller: 'usage', agentOnly: true });
|
|
1054
|
-
const v = (env[claudeAccountTokenKey(email)] ?? '').trim();
|
|
1055
|
-
return v.length > 0 ? v : null;
|
|
1056
|
-
}
|
|
1057
|
-
catch {
|
|
1058
|
-
return null;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
1002
|
/**
|
|
1062
1003
|
* Load a version home's Claude OAuth credential from the two stores Claude Code
|
|
1063
1004
|
* uses, tried in order:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.87",
|
|
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",
|