@phnx-labs/agents-cli 1.20.77 → 1.20.78
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 +102 -0
- package/README.md +2 -0
- package/dist/bin/agents +0 -0
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/doctor.js +143 -9
- package/dist/commands/exec.js +29 -3
- package/dist/commands/repo.js +8 -0
- package/dist/commands/routines.js +4 -2
- package/dist/commands/secrets.js +8 -2
- package/dist/commands/sessions-browser.d.ts +45 -3
- package/dist/commands/sessions-browser.js +118 -12
- package/dist/commands/sessions-export.d.ts +3 -0
- package/dist/commands/sessions-export.js +13 -10
- package/dist/commands/sessions-picker.d.ts +15 -1
- package/dist/commands/sessions-picker.js +58 -4
- package/dist/commands/sessions.d.ts +95 -1
- package/dist/commands/sessions.js +224 -26
- package/dist/commands/ssh.js +9 -1
- package/dist/index.js +3 -5
- package/dist/lib/agents.d.ts +0 -21
- package/dist/lib/agents.js +0 -37
- package/dist/lib/auto-pull.d.ts +16 -8
- package/dist/lib/auto-pull.js +23 -28
- package/dist/lib/daemon.d.ts +9 -41
- package/dist/lib/daemon.js +16 -117
- package/dist/lib/devices/fleet-divergence.d.ts +101 -0
- package/dist/lib/devices/fleet-divergence.js +188 -0
- package/dist/lib/devices/fleet-inventory.d.ts +19 -0
- package/dist/lib/devices/fleet-inventory.js +57 -0
- package/dist/lib/devices/health-report.d.ts +10 -2
- package/dist/lib/devices/health-report.js +32 -1
- package/dist/lib/git.d.ts +13 -0
- package/dist/lib/git.js +102 -4
- package/dist/lib/hosts/remote-cmd.js +2 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/Info.plist +2 -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 +15 -2
- package/dist/lib/runner.js +29 -26
- package/dist/lib/sandbox.js +0 -16
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +2 -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 +13 -1
- package/dist/lib/secrets/agent.d.ts +2 -0
- package/dist/lib/secrets/agent.js +26 -14
- package/dist/lib/secrets/bundles.d.ts +1 -1
- package/dist/lib/secrets/bundles.js +16 -8
- package/dist/lib/secrets/scope.d.ts +26 -0
- package/dist/lib/secrets/scope.js +29 -0
- package/dist/lib/secrets/session-store.d.ts +10 -0
- package/dist/lib/secrets/session-store.js +64 -11
- package/dist/lib/session/active.d.ts +7 -0
- package/dist/lib/session/active.js +38 -3
- package/dist/lib/session/db.d.ts +37 -0
- package/dist/lib/session/db.js +112 -4
- package/dist/lib/session/digest.js +126 -21
- package/dist/lib/session/discover.d.ts +15 -2
- package/dist/lib/session/discover.js +19 -11
- package/dist/lib/session/origin-machine.d.ts +18 -0
- package/dist/lib/session/origin-machine.js +34 -0
- package/dist/lib/session/state.d.ts +1 -0
- package/dist/lib/session/state.js +1 -1
- package/dist/lib/session/sync/config.js +2 -2
- package/dist/lib/smart-launch.d.ts +86 -0
- package/dist/lib/smart-launch.js +172 -0
- package/package.json +1 -1
- package/dist/lib/secrets/account-token.d.ts +0 -20
- package/dist/lib/secrets/account-token.js +0 -64
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Per-account Claude setup-token resolution.
|
|
2
|
-
//
|
|
3
|
-
// A headless/unattended Claude run should authenticate with the account's
|
|
4
|
-
// long-lived `claude setup-token` (exported as a per-account
|
|
5
|
-
// `CLAUDE_CODE_OAUTH_TOKEN_<slug>` env var), NOT the interactive OAuth session.
|
|
6
|
-
// Claude Code's interactive session uses single-use ROTATING refresh tokens: when
|
|
7
|
-
// one machine refreshes, the server invalidates the old refresh token globally, so
|
|
8
|
-
// every other machine on that account 401s and gets logged out (Claude Code
|
|
9
|
-
// #25609 / #56339). The 1-year setup-token sits earlier in the auth precedence
|
|
10
|
-
// (`CLAUDE_CODE_OAUTH_TOKEN`, before subscription login) and does not participate
|
|
11
|
-
// in that rotation — so per-account setup-tokens keep the fleet signed in.
|
|
12
|
-
//
|
|
13
|
-
// The per-account env key encodes the account email. The convention (verified
|
|
14
|
-
// against live bundles, e.g. `muqsit@getrush.ai` →
|
|
15
|
-
// `CLAUDE_CODE_OAUTH_TOKEN_MUQSIT_AT_GETRUSH_DOT_AI`): upper-case, `@`→`_AT_`,
|
|
16
|
-
// `.`→`_DOT_`, any other non-alphanumeric → `_`.
|
|
17
|
-
import fs from 'node:fs';
|
|
18
|
-
import path from 'node:path';
|
|
19
|
-
/** The `CLAUDE_CODE_OAUTH_TOKEN_<slug>` env key for a given account email/id. */
|
|
20
|
-
export function accountTokenKey(account) {
|
|
21
|
-
const slug = account
|
|
22
|
-
.trim()
|
|
23
|
-
.toUpperCase()
|
|
24
|
-
.replace(/@/g, '_AT_')
|
|
25
|
-
.replace(/\./g, '_DOT_')
|
|
26
|
-
.replace(/[^A-Z0-9_]/g, '_');
|
|
27
|
-
return `CLAUDE_CODE_OAUTH_TOKEN_${slug}`;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Read the signed-in account email for a Claude version home from
|
|
31
|
-
* `oauthAccount.emailAddress`. Sync, no keychain, no network. Tries both stores
|
|
32
|
-
* the canonical resolver uses (agents.ts getAccountInfo): the shim-set
|
|
33
|
-
* `CLAUDE_CONFIG_DIR` location `<home>/.claude/.claude.json` first, then the
|
|
34
|
-
* home-level `<home>/.claude.json` (an account signed in via the IDE / direct
|
|
35
|
-
* binary without the shim writes there). Returns null when neither has a usable
|
|
36
|
-
* email.
|
|
37
|
-
*/
|
|
38
|
-
export function readClaudeAccountEmail(home) {
|
|
39
|
-
for (const p of [path.join(home, '.claude', '.claude.json'), path.join(home, '.claude.json')]) {
|
|
40
|
-
try {
|
|
41
|
-
const email = JSON.parse(fs.readFileSync(p, 'utf-8')).oauthAccount?.emailAddress;
|
|
42
|
-
if (typeof email === 'string' && email.trim().length > 0)
|
|
43
|
-
return email.trim();
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
// Missing/unreadable/malformed at this location — try the next.
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Resolve the per-account setup-token for the account pinned to `home`, looking
|
|
53
|
-
* it up in the provided env (the daemon injects the `claude` bundle's
|
|
54
|
-
* `CLAUDE_CODE_OAUTH_TOKEN_*` keys). Returns null when the home has no known
|
|
55
|
-
* account, or no matching per-account token is present — callers then leave the
|
|
56
|
-
* existing ambient/interactive credential untouched (a safe no-op).
|
|
57
|
-
*/
|
|
58
|
-
export function resolveAccountSetupToken(env, home) {
|
|
59
|
-
const email = readClaudeAccountEmail(home);
|
|
60
|
-
if (!email)
|
|
61
|
-
return null;
|
|
62
|
-
const token = env[accountTokenKey(email)];
|
|
63
|
-
return typeof token === 'string' && token.trim().length > 0 ? token.trim() : null;
|
|
64
|
-
}
|