@phnx-labs/agents-cli 1.22.84 → 1.22.85
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 +57 -0
- package/README.md +80 -53
- package/dist/bootstrap.d.ts +7 -6
- package/dist/bootstrap.js +20 -27
- package/dist/cli/command-registry.js +5 -1
- package/dist/commands/accounts.d.ts +6 -13
- package/dist/commands/accounts.js +330 -143
- package/dist/commands/apply.js +1 -1
- package/dist/commands/auth-mint.d.ts +7 -3
- package/dist/commands/auth-mint.js +21 -9
- package/dist/commands/auth.js +2 -3
- package/dist/commands/browser.js +10 -10
- package/dist/commands/daemon.d.ts +7 -3
- package/dist/commands/daemon.js +40 -25
- package/dist/commands/doctor.js +28 -2
- package/dist/commands/exec.js +87 -39
- package/dist/commands/fleet-capture.js +21 -2
- package/dist/commands/harness-wizard.js +2 -2
- package/dist/commands/lease.js +7 -12
- package/dist/commands/profiles.d.ts +2 -2
- package/dist/commands/profiles.js +20 -13
- package/dist/commands/repo.js +3 -3
- package/dist/commands/run-account-picker.d.ts +3 -3
- package/dist/commands/run-account-picker.js +29 -30
- package/dist/commands/secrets-passthrough.d.ts +20 -0
- package/dist/commands/secrets-passthrough.js +43 -0
- package/dist/commands/setup-accounts.d.ts +3 -2
- package/dist/commands/setup-accounts.js +4 -4
- package/dist/commands/setup-secrets.d.ts +16 -21
- package/dist/commands/setup-secrets.js +43 -224
- package/dist/commands/ssh.js +2 -2
- package/dist/commands/sync.js +1 -1
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.js +43 -40
- package/dist/commands/versions.d.ts +11 -11
- package/dist/commands/versions.js +131 -83
- package/dist/commands/view.d.ts +1 -9
- package/dist/commands/view.js +41 -55
- package/dist/commands/webhook.js +5 -5
- package/dist/commands/workflows.js +2 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -42
- package/dist/lib/account-capabilities.d.ts +1 -1
- package/dist/lib/account-capabilities.js +1 -1
- package/dist/lib/account-catalog.d.ts +121 -6
- package/dist/lib/account-catalog.js +421 -7
- package/dist/lib/account-registry.d.ts +8 -30
- package/dist/lib/account-registry.js +36 -79
- package/dist/lib/account-schema.d.ts +1 -1
- package/dist/lib/account-schema.js +1 -1
- package/dist/lib/accounting/account-pool-collect.js +16 -4
- package/dist/lib/accounting/rotate.d.ts +20 -7
- package/dist/lib/accounting/rotate.js +89 -13
- package/dist/lib/accounting/usage.js +11 -16
- package/dist/lib/accounts/add.d.ts +138 -0
- package/dist/lib/accounts/add.js +651 -0
- package/dist/lib/accounts/migrate.d.ts +117 -0
- package/dist/lib/accounts/migrate.js +536 -0
- package/dist/lib/accounts/slots.d.ts +13 -0
- package/dist/lib/accounts/slots.js +100 -0
- package/dist/lib/agent-spec/agents.d.ts +16 -0
- package/dist/lib/agent-spec/agents.js +32 -4
- package/dist/lib/app-bundle-install.js +5 -4
- package/dist/lib/auth-health.d.ts +3 -0
- package/dist/lib/auth-health.js +11 -0
- package/dist/lib/auth-mint.d.ts +52 -16
- package/dist/lib/auth-mint.js +117 -39
- package/dist/lib/browser/chrome.d.ts +1 -1
- package/dist/lib/browser/chrome.js +5 -5
- package/dist/lib/byok-usage.js +3 -3
- package/dist/lib/claude-account-token.d.ts +47 -3
- package/dist/lib/claude-account-token.js +172 -50
- package/dist/lib/cloud/antigravity.js +4 -4
- package/dist/lib/cloud/cursor.js +4 -4
- package/dist/lib/crabbox/cli.d.ts +1 -1
- package/dist/lib/crabbox/cli.js +6 -6
- package/dist/lib/crabbox/runtimes.d.ts +3 -3
- package/dist/lib/crabbox/runtimes.js +5 -5
- package/dist/lib/daemon/account-state-daemon-service.d.ts +37 -1
- package/dist/lib/daemon/account-state-daemon-service.js +199 -3
- package/dist/lib/daemon/auth-sync-service.js +28 -1
- package/dist/lib/daemon/daemon.d.ts +6 -16
- package/dist/lib/daemon/daemon.js +52 -97
- package/dist/lib/daemon/daemon.test-fixture.d.ts +7 -9
- package/dist/lib/daemon/daemon.test-fixture.js +22 -40
- package/dist/lib/daemon/harness-update-service.d.ts +1 -1
- package/dist/lib/daemon/harness-update-service.js +1 -1
- package/dist/lib/daemon/runner.d.ts +15 -3
- package/dist/lib/daemon/runner.js +49 -24
- package/dist/lib/daemon-health.d.ts +1 -2
- package/dist/lib/daemon-health.js +7 -6
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +1 -11
- package/dist/lib/daemon-webhooks.d.ts +8 -7
- package/dist/lib/daemon-webhooks.js +10 -9
- package/dist/lib/device-config.js +1 -1
- package/dist/lib/devices/doctor-findings.d.ts +1 -1
- package/dist/lib/devices/harness-inventory.d.ts +39 -0
- package/dist/lib/devices/harness-inventory.js +126 -4
- package/dist/lib/doctor-diff.js +2 -1
- package/dist/lib/exec-account-home.d.ts +38 -0
- package/dist/lib/exec-account-home.js +164 -0
- package/dist/lib/exec.d.ts +30 -0
- package/dist/lib/exec.js +101 -31
- package/dist/lib/fleet/apply.d.ts +2 -2
- package/dist/lib/fleet/apply.js +4 -4
- package/dist/lib/fleet/auth-sync.js +4 -3
- package/dist/lib/fleet-shared-repo-sync.js +6 -9
- package/dist/lib/harness/adapter.d.ts +7 -7
- package/dist/lib/harness/adapter.js +10 -6
- package/dist/lib/harness/adapters/grok.js +8 -3
- package/dist/lib/harness/adapters/muse.js +1 -1
- package/dist/lib/harness/adapters/opencode.js +12 -3
- package/dist/lib/harness-auth-capabilities.d.ts +61 -0
- package/dist/lib/harness-auth-capabilities.js +52 -0
- package/dist/lib/helper-versions.d.ts +6 -4
- package/dist/lib/helper-versions.js +5 -4
- package/dist/lib/hosts/credential-transport.d.ts +10 -0
- package/dist/lib/hosts/credential-transport.js +37 -0
- package/dist/lib/hosts/dispatch.d.ts +7 -0
- package/dist/lib/hosts/dispatch.js +13 -6
- package/dist/lib/identity/client.d.ts +3 -3
- package/dist/lib/identity/client.js +3 -3
- package/dist/lib/installations/index.d.ts +1 -1
- package/dist/lib/installations/index.js +1 -1
- package/dist/lib/installations/migrate.js +9 -0
- package/dist/lib/installations/resolve.js +1 -1
- package/dist/lib/installations/shims.d.ts +15 -0
- package/dist/lib/installations/shims.js +69 -0
- package/dist/lib/installations/store.d.ts +43 -0
- package/dist/lib/installations/store.js +75 -7
- package/dist/lib/installations/versions.js +1 -1
- package/dist/lib/menubar/install-menubar.d.ts +3 -3
- package/dist/lib/menubar/install-menubar.js +3 -3
- package/dist/lib/native-accounts.d.ts +35 -0
- package/dist/lib/native-accounts.js +41 -0
- package/dist/lib/net-close.d.ts +11 -0
- package/dist/lib/net-close.js +25 -0
- package/dist/lib/openclaw-keychain.js +27 -1
- package/dist/lib/profiles.js +22 -9
- package/dist/lib/project-resources.js +1 -1
- package/dist/lib/reserved-stores.d.ts +53 -0
- package/dist/lib/reserved-stores.js +120 -0
- package/dist/lib/secrets-client.d.ts +191 -0
- package/dist/lib/secrets-client.js +710 -0
- package/dist/lib/secrets-policy.d.ts +222 -0
- package/dist/lib/secrets-policy.js +483 -0
- package/dist/lib/secrets-types.d.ts +188 -0
- package/dist/lib/secrets-types.js +24 -0
- package/dist/lib/service-manifest.js +3 -4
- package/dist/lib/session/db.d.ts +18 -0
- package/dist/lib/session/db.js +47 -14
- package/dist/lib/session/sync/config.js +2 -2
- package/dist/lib/sha256-asset.d.ts +11 -16
- package/dist/lib/sha256-asset.js +11 -16
- package/dist/lib/share/config.js +14 -5
- package/dist/lib/signin-badge.d.ts +26 -0
- package/dist/lib/signin-badge.js +42 -0
- package/dist/lib/staleness/detectors/workflows.js +3 -105
- package/dist/lib/staleness/writers/workflows.js +2 -1
- package/dist/lib/state.d.ts +7 -4
- package/dist/lib/state.js +18 -7
- package/dist/lib/sync-umbrella.js +2 -2
- package/dist/lib/teams/agents.js +1 -1
- package/dist/lib/types.d.ts +74 -33
- package/dist/lib/view-types.d.ts +6 -3
- package/dist/lib/workflows-registry.d.ts +71 -0
- package/dist/lib/workflows-registry.js +280 -0
- package/dist/lib/workflows.d.ts +21 -21
- package/dist/lib/workflows.js +12 -327
- package/package.json +2 -3
- package/scripts/postinstall.js +4 -29
- package/dist/commands/secrets-import.d.ts +0 -18
- package/dist/commands/secrets-import.js +0 -74
- package/dist/commands/secrets-migrate.d.ts +0 -25
- package/dist/commands/secrets-migrate.js +0 -334
- package/dist/commands/secrets-rotate-passphrase.d.ts +0 -17
- package/dist/commands/secrets-rotate-passphrase.js +0 -96
- package/dist/commands/secrets-sync.d.ts +0 -11
- package/dist/commands/secrets-sync.js +0 -153
- package/dist/commands/secrets-vault.d.ts +0 -10
- package/dist/commands/secrets-vault.js +0 -130
- package/dist/commands/secrets.d.ts +0 -212
- package/dist/commands/secrets.js +0 -3030
- package/dist/lib/accounts/connect.d.ts +0 -176
- package/dist/lib/accounts/connect.js +0 -453
- package/dist/lib/daemon/keychain-reap-service.d.ts +0 -17
- package/dist/lib/daemon/keychain-reap-service.js +0 -32
- package/dist/lib/daemon/secrets-broker-service.d.ts +0 -21
- package/dist/lib/daemon/secrets-broker-service.js +0 -51
- package/dist/lib/secrets/agent.d.ts +0 -358
- package/dist/lib/secrets/agent.js +0 -1291
- package/dist/lib/secrets/audit.d.ts +0 -46
- package/dist/lib/secrets/audit.js +0 -101
- package/dist/lib/secrets/bundles.d.ts +0 -290
- package/dist/lib/secrets/bundles.js +0 -1547
- package/dist/lib/secrets/download-keychain.d.ts +0 -47
- package/dist/lib/secrets/download-keychain.js +0 -70
- package/dist/lib/secrets/drivers/rush.d.ts +0 -14
- package/dist/lib/secrets/drivers/rush.js +0 -90
- package/dist/lib/secrets/fallback.d.ts +0 -48
- package/dist/lib/secrets/fallback.js +0 -48
- package/dist/lib/secrets/filestore.d.ts +0 -222
- package/dist/lib/secrets/filestore.js +0 -1099
- package/dist/lib/secrets/headless.d.ts +0 -43
- package/dist/lib/secrets/headless.js +0 -56
- package/dist/lib/secrets/icloud-import.d.ts +0 -79
- package/dist/lib/secrets/icloud-import.js +0 -206
- package/dist/lib/secrets/index.d.ts +0 -451
- package/dist/lib/secrets/index.js +0 -1568
- package/dist/lib/secrets/install-helper.d.ts +0 -72
- package/dist/lib/secrets/install-helper.js +0 -245
- package/dist/lib/secrets/lease.d.ts +0 -25
- package/dist/lib/secrets/lease.js +0 -44
- package/dist/lib/secrets/linux.d.ts +0 -77
- package/dist/lib/secrets/linux.js +0 -393
- package/dist/lib/secrets/list-filter.d.ts +0 -109
- package/dist/lib/secrets/list-filter.js +0 -261
- package/dist/lib/secrets/mcp.d.ts +0 -93
- package/dist/lib/secrets/mcp.js +0 -211
- package/dist/lib/secrets/profiles.d.ts +0 -10
- package/dist/lib/secrets/profiles.js +0 -13
- package/dist/lib/secrets/push.d.ts +0 -133
- package/dist/lib/secrets/push.js +0 -273
- package/dist/lib/secrets/rc-hygiene.d.ts +0 -63
- package/dist/lib/secrets/rc-hygiene.js +0 -143
- package/dist/lib/secrets/read-backoff.d.ts +0 -27
- package/dist/lib/secrets/read-backoff.js +0 -64
- package/dist/lib/secrets/reaper.d.ts +0 -90
- package/dist/lib/secrets/reaper.js +0 -243
- package/dist/lib/secrets/remote.d.ts +0 -152
- package/dist/lib/secrets/remote.js +0 -344
- package/dist/lib/secrets/reserved-sync.d.ts +0 -66
- package/dist/lib/secrets/reserved-sync.js +0 -147
- package/dist/lib/secrets/scope.d.ts +0 -26
- package/dist/lib/secrets/scope.js +0 -29
- package/dist/lib/secrets/session-store.d.ts +0 -107
- package/dist/lib/secrets/session-store.js +0 -342
- package/dist/lib/secrets/sync-backend.d.ts +0 -48
- package/dist/lib/secrets/sync-backend.js +0 -13
- package/dist/lib/secrets/sync-commands.d.ts +0 -21
- package/dist/lib/secrets/sync-commands.js +0 -21
- package/dist/lib/secrets/sync.d.ts +0 -48
- package/dist/lib/secrets/sync.js +0 -237
- package/dist/lib/secrets/unlock-hints.d.ts +0 -27
- package/dist/lib/secrets/unlock-hints.js +0 -36
- package/dist/lib/secrets/usage-db.d.ts +0 -46
- package/dist/lib/secrets/usage-db.js +0 -96
- package/dist/lib/secrets/vault-age-helper.d.ts +0 -1
- package/dist/lib/secrets/vault-age-helper.js +0 -34
- package/dist/lib/secrets/vault.d.ts +0 -49
- package/dist/lib/secrets/vault.js +0 -399
- package/dist/lib/secrets/windows.d.ts +0 -81
- package/dist/lib/secrets/windows.js +0 -556
- package/scripts/install-helper.js +0 -97
- /package/dist/lib/{secrets/sync-passphrase.d.ts → sync-passphrase.d.ts} +0 -0
- /package/dist/lib/{secrets/sync-passphrase.js → sync-passphrase.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,28 +2,27 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* CLI entry point for agents-cli.
|
|
4
4
|
*
|
|
5
|
-
* Slim shell (RUSH-2335):
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* broker read). The full CLI loads via `await import('./bootstrap.js')` once
|
|
10
|
-
* none of the fast paths match.
|
|
5
|
+
* Slim shell (RUSH-2335): no static imports at all, so the argv fast paths
|
|
6
|
+
* below can answer without evaluating the commander + self-update +
|
|
7
|
+
* command-registry graph. The full CLI loads via `await import('./bootstrap.js')`
|
|
8
|
+
* once none of the fast paths match.
|
|
11
9
|
*
|
|
12
10
|
* Fast paths (must stay above the bootstrap import — ESM does not hoist dynamic
|
|
13
11
|
* `import()`, but any static import here would still evaluate first):
|
|
14
|
-
* - `
|
|
15
|
-
* - `__secrets-get` / `__secrets-ping` / `__secrets-lock` (SYNC_* tokens)
|
|
12
|
+
* - `__launch-lease`
|
|
16
13
|
* - `__shim`
|
|
14
|
+
* - `__gh`
|
|
17
15
|
* - `__claude-statusline`
|
|
18
16
|
* - `__usage-ingest` / `__usage-export`
|
|
17
|
+
* - `__harness-update-run`
|
|
19
18
|
* - `__daemon-run`
|
|
20
19
|
*
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* The synchronous secrets-broker fast paths (`__secrets-get` / `__secrets-ping`
|
|
21
|
+
* / `__secrets-lock`) and `__vault-age-helper` moved out of this CLI entirely
|
|
22
|
+
* with the standalone `secrets` engine (PHNX-3989) — agents-cli now talks to
|
|
23
|
+
* it only through the bounded process client (`lib/secrets-client.ts`), never
|
|
24
|
+
* through a hidden subcommand of its own.
|
|
25
25
|
*/
|
|
26
|
-
import { SYNC_GET_CMD, SYNC_PING_CMD, SYNC_LOCK_CMD } from './lib/secrets/sync-commands.js';
|
|
27
26
|
// Force exit on Ctrl+C when no interactive prompt is handling it — UNLESS a
|
|
28
27
|
// guarded harness auto-update pass is mutating this process transactionally
|
|
29
28
|
// (PHNX-3940). A hard exit mid-swap can leave an installation whose directory
|
|
@@ -42,35 +41,6 @@ process.on('SIGINT', () => {
|
|
|
42
41
|
// Ignore SIGPIPE — prevents exit code 13 crashes in piped environments
|
|
43
42
|
// (e.g. `agents sessions | head`, or when stdout is captured by another process).
|
|
44
43
|
process.on('SIGPIPE', () => { });
|
|
45
|
-
if (process.argv[2] === '__vault-age-helper') {
|
|
46
|
-
const { runVaultAgeHelperCli } = await import('./lib/secrets/vault-age-helper.js');
|
|
47
|
-
await runVaultAgeHelperCli();
|
|
48
|
-
process.exit(process.exitCode ?? 0);
|
|
49
|
-
}
|
|
50
|
-
// Synchronous secrets-broker clients (src/lib/secrets/agent.ts). These are the
|
|
51
|
-
// hot read path: `readAndResolveBundleEnv` is synchronous all the way down, so
|
|
52
|
-
// it can't await a socket round-trip — it spawns one of these and reads the
|
|
53
|
-
// exit code (0 = hit/alive, 3 = miss/down).
|
|
54
|
-
//
|
|
55
|
-
// Intercepted HERE, before bootstrap, for the same reason as __daemon-run and
|
|
56
|
-
// __vault-age-helper. Everything in bootstrap runs `checkForUpdates()` and
|
|
57
|
-
// `spawnDetachedSync()` on every non-help invocation — so registering these as
|
|
58
|
-
// ordinary hidden subcommands would fire an update check and fork a detached
|
|
59
|
-
// background sync on *every cache hit*, which is both a fork storm on the hot
|
|
60
|
-
// path and a source of stdout writes that could corrupt the JSON payload. Keep
|
|
61
|
-
// them above the line; agent.test.ts asserts this ordering so the block can't
|
|
62
|
-
// drift into bootstrap.
|
|
63
|
-
if (process.argv[2] === SYNC_GET_CMD ||
|
|
64
|
-
process.argv[2] === SYNC_PING_CMD ||
|
|
65
|
-
process.argv[2] === SYNC_LOCK_CMD) {
|
|
66
|
-
const { runAgentGetSync, runAgentPingSync, runAgentLockSync } = await import('./lib/secrets/agent.js');
|
|
67
|
-
const name = process.argv[3] ?? '';
|
|
68
|
-
const harness = process.argv[4] ?? 'cli';
|
|
69
|
-
const code = process.argv[2] === SYNC_GET_CMD ? await runAgentGetSync(name, harness)
|
|
70
|
-
: process.argv[2] === SYNC_PING_CMD ? await runAgentPingSync()
|
|
71
|
-
: await runAgentLockSync(name);
|
|
72
|
-
process.exit(code);
|
|
73
|
-
}
|
|
74
44
|
// Launch-lease delegate: every generated native shim/alias calls
|
|
75
45
|
// `agents __launch-lease <agent> <label> <pid>` right before its final `exec`
|
|
76
46
|
// (PHNX-3940) — on the hot launch path of every managed agent, so it must skip
|
|
@@ -164,3 +134,4 @@ if (process.argv[2] === '__daemon-run') {
|
|
|
164
134
|
// Full CLI: commander tree, update checks, migrations, parse. Static imports
|
|
165
135
|
// inside bootstrap.js evaluate only when we reach this line.
|
|
166
136
|
await import('./bootstrap.js');
|
|
137
|
+
export {};
|
|
@@ -39,7 +39,7 @@ export declare function nativeAccountNamingRefusal(agent: AgentId): string | nul
|
|
|
39
39
|
/** Fail loud on the native name/attach path for an unsupported harness. */
|
|
40
40
|
export declare function assertNativeAccountNameable(agent: AgentId): void;
|
|
41
41
|
/**
|
|
42
|
-
* The single identity key used at `accounts
|
|
42
|
+
* The single identity key used at `accounts add`, exec validation,
|
|
43
43
|
* view, and inventory. Prefer the harness's stable `accountKey`. For an
|
|
44
44
|
* email-only (`conditional`) harness, email is a presence gate — the stored
|
|
45
45
|
* key is still `accountKey` (e.g. `muse:email=user@x.com`), never the bare
|
|
@@ -79,7 +79,7 @@ export function assertNativeAccountNameable(agent) {
|
|
|
79
79
|
throw new Error(reason);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* The single identity key used at `accounts
|
|
82
|
+
* The single identity key used at `accounts add`, exec validation,
|
|
83
83
|
* view, and inventory. Prefer the harness's stable `accountKey`. For an
|
|
84
84
|
* email-only (`conditional`) harness, email is a presence gate — the stored
|
|
85
85
|
* key is still `accountKey` (e.g. `muse:email=user@x.com`), never the bare
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type AccountInfo } from './agents.js';
|
|
2
|
+
import { type CredentialAccount } from './account-registry.js';
|
|
2
3
|
import type { AgentId, Meta } from './types.js';
|
|
4
|
+
import { type AuthVerdict } from './auth-health.js';
|
|
5
|
+
import { applyUsageHonesty, type QuotaSummary } from './devices/harness-inventory.js';
|
|
6
|
+
import { type AccountProvisioning, type AccountVerdict } from './signin-badge.js';
|
|
7
|
+
export { applyUsageHonesty };
|
|
3
8
|
/**
|
|
4
9
|
* Strict "is this home actually connected?" — a live CREDENTIAL in that exact
|
|
5
10
|
* version home, not just a metadata identity claim (PHNX-3940). A `.claude.json`
|
|
@@ -39,9 +44,9 @@ export interface AccountHome {
|
|
|
39
44
|
/**
|
|
40
45
|
* A live credential state, derived from the homes rather than the registry:
|
|
41
46
|
* - `connected` — at least one home for this identity is signed in.
|
|
42
|
-
* - `reconnect-needed` — the account is registered
|
|
43
|
-
*
|
|
44
|
-
*
|
|
47
|
+
* - `reconnect-needed` — the account is registered but no home currently
|
|
48
|
+
* holds a live credential; the label alone is not a connection.
|
|
49
|
+
* `agents accounts login <harness>#<name>` re-authenticates it.
|
|
45
50
|
*/
|
|
46
51
|
export type AccountConnectionState = 'connected' | 'reconnect-needed';
|
|
47
52
|
/** Account-first row for a native (harness-owned OAuth) identity. */
|
|
@@ -67,8 +72,21 @@ export interface NativeAccountCatalogRow {
|
|
|
67
72
|
/** Whether the harness's configured default account points at this identity. */
|
|
68
73
|
isDefault: boolean;
|
|
69
74
|
state: AccountConnectionState;
|
|
75
|
+
identityLabel: string;
|
|
76
|
+
provisioning: AccountProvisioning;
|
|
77
|
+
verdict: AccountVerdict;
|
|
78
|
+
checkedAt: string | null;
|
|
79
|
+
devices: AccountDeviceVerdict[];
|
|
80
|
+
usage: QuotaSummary | null;
|
|
81
|
+
fix: string | null;
|
|
70
82
|
}
|
|
71
|
-
|
|
83
|
+
export interface AccountDeviceVerdict {
|
|
84
|
+
device: string;
|
|
85
|
+
authMode: 'native' | 'durable' | 'per-device';
|
|
86
|
+
verdict: Exclude<AccountVerdict, 'per-device'>;
|
|
87
|
+
checkedAt?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Account-first row for a durable provider (API-key / token) account. */
|
|
72
90
|
export interface ProviderAccountCatalogRow {
|
|
73
91
|
kind: 'provider';
|
|
74
92
|
name: string;
|
|
@@ -76,11 +94,58 @@ export interface ProviderAccountCatalogRow {
|
|
|
76
94
|
provider: string;
|
|
77
95
|
auth: string;
|
|
78
96
|
baseUrl?: string;
|
|
97
|
+
/** Harnesses this credential can authenticate. Empty = listed under Other accounts. */
|
|
98
|
+
harnesses: AgentId[];
|
|
99
|
+
/** Harnesses whose configured default points at this account. */
|
|
100
|
+
defaultFor: AgentId[];
|
|
101
|
+
identityLabel: string;
|
|
102
|
+
verdict: Extract<AccountVerdict, 'ready' | 'missing'>;
|
|
103
|
+
fix: string | null;
|
|
79
104
|
}
|
|
80
105
|
export type AccountCatalogRow = NativeAccountCatalogRow | ProviderAccountCatalogRow;
|
|
81
106
|
export interface AccountCatalog {
|
|
82
107
|
native: NativeAccountCatalogRow[];
|
|
83
108
|
provider: ProviderAccountCatalogRow[];
|
|
109
|
+
/**
|
|
110
|
+
* Set when the standalone `secrets` CLI could not be reached to read the
|
|
111
|
+
* provider (durable-credential) accounts — missing, unreachable, or timed out
|
|
112
|
+
* on this box. The native rows (harness OAuth logins, read from config files,
|
|
113
|
+
* not `secrets`) still render; only the provider section is unavailable. A
|
|
114
|
+
* read-only surface (`agents view`, `agents accounts`) surfaces this as one
|
|
115
|
+
* clear line and renders the rest rather than hanging or crashing (PHNX-3989).
|
|
116
|
+
*/
|
|
117
|
+
secretsUnavailable?: {
|
|
118
|
+
code: string;
|
|
119
|
+
message: string;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* One account in the public JSON v2 projection (`accounts list --json`, `view --json`).
|
|
124
|
+
* A provider credential that authenticates several harnesses is one entry per
|
|
125
|
+
* harness (same `id`, each with its own `harness`); an orphan is `harness: null`.
|
|
126
|
+
*/
|
|
127
|
+
export interface AccountListEntryJson {
|
|
128
|
+
kind: 'native' | 'provider';
|
|
129
|
+
id: string;
|
|
130
|
+
/** Null for a provider credential no harness authenticates. */
|
|
131
|
+
harness: AgentId | null;
|
|
132
|
+
name: string | null;
|
|
133
|
+
identityLabel: string;
|
|
134
|
+
isDefault: boolean;
|
|
135
|
+
provisioning: AccountProvisioning;
|
|
136
|
+
verdict: AccountVerdict;
|
|
137
|
+
checkedAt: string | null;
|
|
138
|
+
devices: Array<{
|
|
139
|
+
device: string;
|
|
140
|
+
authMode: AccountDeviceVerdict['authMode'];
|
|
141
|
+
verdict: AccountDeviceVerdict['verdict'];
|
|
142
|
+
}>;
|
|
143
|
+
usage: QuotaSummary | null;
|
|
144
|
+
fix: string | null;
|
|
145
|
+
}
|
|
146
|
+
export interface AccountListJson {
|
|
147
|
+
version: 2;
|
|
148
|
+
accounts: AccountListEntryJson[];
|
|
84
149
|
}
|
|
85
150
|
/** One installed home probed for its native identity — the raw input to the fold. */
|
|
86
151
|
export interface NativeHomeRow {
|
|
@@ -105,10 +170,60 @@ type CatalogMeta = Pick<Meta, 'accounts' | 'deviceAccounts'>;
|
|
|
105
170
|
* silently dropped from the list nor shown as connected.
|
|
106
171
|
*/
|
|
107
172
|
export declare function buildNativeCatalog(rows: NativeHomeRow[], meta: CatalogMeta, globalDefault?: (agent: AgentId) => string | null): NativeAccountCatalogRow[];
|
|
173
|
+
export declare function toProviderRow(account: CredentialAccount, meta: Pick<Meta, 'accounts'>): ProviderAccountCatalogRow;
|
|
108
174
|
/**
|
|
109
175
|
* Wire the real collectors to the pure builder. This is the canonical
|
|
110
176
|
* account-first read model `view.ts` renders: native identities (account +
|
|
111
|
-
* connection first, release/home secondary) plus
|
|
177
|
+
* connection first, release/home secondary) plus durable provider credentials.
|
|
112
178
|
*/
|
|
113
179
|
export declare function loadAccountCatalog(): Promise<AccountCatalog>;
|
|
114
|
-
|
|
180
|
+
/**
|
|
181
|
+
* The one clear line a read-only surface prints when the provider section could
|
|
182
|
+
* not be read (PHNX-3989) — so a missing/broken standalone is stated plainly
|
|
183
|
+
* while the native rows and the rest of the output still render. Null when the
|
|
184
|
+
* catalog is complete. Printed to stderr by the command so it never corrupts
|
|
185
|
+
* `--json` stdout.
|
|
186
|
+
*/
|
|
187
|
+
export declare function secretsUnavailableNote(catalog: Pick<AccountCatalog, 'secretsUnavailable'>): string | null;
|
|
188
|
+
export declare function accountListJson(native: NativeAccountCatalogRow[], providers?: ProviderAccountCatalogRow[], harness?: AgentId): AccountListJson;
|
|
189
|
+
/** Shared text renderer used by both `accounts list` and account-first `view`. */
|
|
190
|
+
export declare function renderAccountRows(rows: NativeAccountCatalogRow[], opts: {
|
|
191
|
+
heading?: boolean;
|
|
192
|
+
footer?: boolean;
|
|
193
|
+
harnessHeadings?: boolean;
|
|
194
|
+
providers?: ProviderAccountCatalogRow[];
|
|
195
|
+
/** When set, emit only this harness's group — never a sibling or empty group. */
|
|
196
|
+
harness?: AgentId;
|
|
197
|
+
/**
|
|
198
|
+
* Device name treated as "this box" in WHERE when it is the only reporter.
|
|
199
|
+
* The command layer passes `machineId()`; this renderer never resolves it.
|
|
200
|
+
*/
|
|
201
|
+
localDevice: string;
|
|
202
|
+
}): string;
|
|
203
|
+
export declare function readSharedAccountVerdicts(userAgentsDir?: string): Map<string, AccountDeviceVerdict[]>;
|
|
204
|
+
/**
|
|
205
|
+
* Devices whose daemon-state file exists but carries no account verdicts —
|
|
206
|
+
* typically an older release that has not started publishing the T3 envelope.
|
|
207
|
+
* The fleet matrix lists them in a coverage note rather than as blank columns.
|
|
208
|
+
*/
|
|
209
|
+
export declare function listDevicesWithoutAccountVerdicts(userAgentsDir?: string): string[];
|
|
210
|
+
/** The T1 slot store's per-account observation of the local verdict. */
|
|
211
|
+
export interface LocalSlotObservation {
|
|
212
|
+
authMode: AccountDeviceVerdict['authMode'];
|
|
213
|
+
verdict: AuthVerdict;
|
|
214
|
+
checkedAt?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Merge the two writers of the same local truth — the T1 slot store and the
|
|
218
|
+
* daemon's auth-health cache — by NEWEST observation. A naive `??` chain lets
|
|
219
|
+
* an older slot `live` permanently mask a newer daemon `revoked`, so a revoked
|
|
220
|
+
* account would keep rendering LIVE on its own device. Pure.
|
|
221
|
+
*/
|
|
222
|
+
export declare function resolveLocalAccountObservation(slot: LocalSlotObservation | undefined, cached: {
|
|
223
|
+
verdict: AuthVerdict;
|
|
224
|
+
checkedAt: number;
|
|
225
|
+
} | undefined, signedIn: boolean): {
|
|
226
|
+
verdict: AccountDeviceVerdict['verdict'];
|
|
227
|
+
authMode?: AccountDeviceVerdict['authMode'];
|
|
228
|
+
checkedAt?: string;
|
|
229
|
+
};
|