@phnx-labs/agents-cli 1.20.87 → 1.20.89
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 +323 -0
- package/README.md +12 -4
- package/dist/bin/agents +0 -0
- package/dist/commands/commands.js +7 -7
- package/dist/commands/doctor.d.ts +0 -19
- package/dist/commands/doctor.js +219 -305
- package/dist/commands/exec.js +7 -19
- package/dist/commands/factory.js +26 -2
- package/dist/commands/funnel.js +16 -1
- package/dist/commands/inspect.js +3 -5
- package/dist/commands/menubar.js +117 -34
- package/dist/commands/routines.js +25 -3
- package/dist/commands/secrets-rotate-passphrase.d.ts +17 -0
- package/dist/commands/secrets-rotate-passphrase.js +96 -0
- package/dist/commands/secrets.js +2 -0
- package/dist/commands/sessions.d.ts +7 -1
- package/dist/commands/sessions.js +40 -12
- package/dist/commands/ssh.js +3 -3
- package/dist/commands/usage.d.ts +3 -2
- package/dist/commands/usage.js +2 -9
- package/dist/commands/webhook.js +7 -2
- package/dist/lib/agents.d.ts +31 -1
- package/dist/lib/agents.js +55 -0
- package/dist/lib/command-skills.d.ts +10 -0
- package/dist/lib/command-skills.js +14 -0
- package/dist/lib/commands.js +28 -2
- package/dist/lib/daemon.d.ts +29 -0
- package/dist/lib/daemon.js +75 -6
- package/dist/lib/devices/doctor-findings.d.ts +167 -0
- package/dist/lib/devices/doctor-findings.js +893 -0
- package/dist/lib/devices/fleet-divergence.d.ts +22 -0
- package/dist/lib/devices/fleet-divergence.js +34 -10
- package/dist/lib/devices/fleet-inventory.d.ts +17 -6
- package/dist/lib/devices/fleet-inventory.js +56 -8
- package/dist/lib/events.d.ts +1 -1
- package/dist/lib/exec.d.ts +14 -3
- package/dist/lib/exec.js +41 -8
- package/dist/lib/factory/snapshot.d.ts +78 -0
- package/dist/lib/factory/snapshot.js +209 -0
- package/dist/lib/fs-atomic.d.ts +14 -1
- package/dist/lib/fs-atomic.js +35 -3
- package/dist/lib/funnel.d.ts +1 -0
- package/dist/lib/funnel.js +8 -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/menubar/install-menubar.d.ts +53 -2
- package/dist/lib/menubar/install-menubar.js +183 -28
- package/dist/lib/platform/process.d.ts +2 -0
- package/dist/lib/platform/process.js +5 -3
- package/dist/lib/project-resources.js +34 -20
- package/dist/lib/resources.d.ts +8 -0
- package/dist/lib/resources.js +34 -1
- package/dist/lib/routines-placement.d.ts +2 -1
- package/dist/lib/routines-placement.js +8 -4
- package/dist/lib/routines.d.ts +57 -1
- package/dist/lib/routines.js +74 -1
- package/dist/lib/runner.d.ts +16 -1
- package/dist/lib/runner.js +58 -16
- package/dist/lib/sandbox.d.ts +2 -0
- package/dist/lib/sandbox.js +38 -0
- 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/bundles.js +9 -34
- package/dist/lib/secrets/filestore.d.ts +152 -34
- package/dist/lib/secrets/filestore.js +676 -123
- package/dist/lib/secrets/rc-hygiene.d.ts +0 -6
- package/dist/lib/secrets/rc-hygiene.js +0 -24
- package/dist/lib/session/active.d.ts +6 -6
- package/dist/lib/session/active.js +6 -6
- package/dist/lib/session/discover.d.ts +5 -0
- package/dist/lib/session/discover.js +137 -1
- package/dist/lib/session/parse.d.ts +2 -0
- package/dist/lib/session/parse.js +76 -37
- package/dist/lib/session/remote-active.d.ts +4 -1
- package/dist/lib/session/remote-active.js +8 -2
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/types.d.ts +1 -1
- package/dist/lib/session/types.js +1 -1
- package/dist/lib/session/viewing-in.d.ts +31 -0
- package/dist/lib/session/viewing-in.js +47 -0
- package/dist/lib/staleness/detectors/commands.js +14 -5
- package/dist/lib/staleness/types.d.ts +2 -0
- package/dist/lib/staleness/writers/commands.js +13 -7
- package/dist/lib/state.d.ts +17 -0
- package/dist/lib/state.js +30 -2
- package/dist/lib/triggers/handlers.d.ts +95 -0
- package/dist/lib/triggers/handlers.js +384 -0
- package/dist/lib/triggers/webhook.d.ts +10 -2
- package/dist/lib/triggers/webhook.js +65 -11
- package/dist/lib/usage.d.ts +72 -1
- package/dist/lib/usage.js +21 -27
- package/dist/lib/versions.js +30 -13
- package/package.json +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { AgentId } from '../types.js';
|
|
2
|
+
import type { DuplicateVersionHook } from '../hooks.js';
|
|
3
|
+
import type { RcSecretFinding } from '../secrets/rc-hygiene.js';
|
|
4
|
+
import type { SyncStatusRow, OrphanRow } from '../drift.js';
|
|
5
|
+
import type { FetchStatusMarker } from '../auto-pull.js';
|
|
6
|
+
import type { VersionResourceReport } from '../doctor-diff.js';
|
|
7
|
+
import type { FleetDivergence, FleetVersionSignIn } from './fleet-divergence.js';
|
|
8
|
+
export type FindingSeverity = 'critical' | 'warning';
|
|
9
|
+
/** A machine-stable class for a finding — drives {@link remediationFor} and lets
|
|
10
|
+
* the JSON consumer group by kind. */
|
|
11
|
+
export declare const ALL_FINDING_KINDS: readonly ["logged-out", "logout-unprovable", "missing-hook", "missing-plugin", "unwired-hook", "cli-missing", "missing-resource", "content-drift", "never-synced", "stale", "repo-behind", "repo-drift", "fleet-resource-gap", "host-cli-missing", "host-cli-invalid", "version-skew", "orphan", "duplicate-hook", "duplicate-hook-drift", "rc-secret-export", "exec-policy", "stale-cli"];
|
|
12
|
+
/** A machine-stable class for a finding. Derived from the runtime list above so
|
|
13
|
+
* the rubric test can enumerate every kind. */
|
|
14
|
+
export type FindingKind = typeof ALL_FINDING_KINDS[number];
|
|
15
|
+
/** One prioritized finding, attributed to a device (and, when relevant, an agent
|
|
16
|
+
* version + account). `remediation` is the exact command/hint to fix it. */
|
|
17
|
+
export interface DoctorFinding {
|
|
18
|
+
severity: FindingSeverity;
|
|
19
|
+
kind: FindingKind;
|
|
20
|
+
/** The device this finding is about. */
|
|
21
|
+
device: string;
|
|
22
|
+
/** Agent id, when the finding is about a specific agent (else undefined). */
|
|
23
|
+
agent?: AgentId;
|
|
24
|
+
/** Version id, when about a specific installed version. Absent on a finding
|
|
25
|
+
* collapsed across versions — read {@link DoctorFinding.versions} instead. */
|
|
26
|
+
version?: string;
|
|
27
|
+
/** Set only on a finding collapsed across several versions of one agent (the
|
|
28
|
+
* same problem on each). The row renders `<agent> (N versions)` and the
|
|
29
|
+
* remediation widens to the agent-wide sweep. */
|
|
30
|
+
versions?: string[];
|
|
31
|
+
/** Human account label (email/org/opaque id), when known. */
|
|
32
|
+
account?: string | null;
|
|
33
|
+
/** One-line plain-English description of the problem. */
|
|
34
|
+
message: string;
|
|
35
|
+
/** Exact remediation command / hint. */
|
|
36
|
+
remediation: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The exact remediation for a finding. Login fixes are harness-native
|
|
40
|
+
* (`loginHint`); a per-version login is offered ONLY for agents that isolate the
|
|
41
|
+
* credential per home (`agents run <agent>@<version>` then log in) — for
|
|
42
|
+
* gemini/antigravity/droid/cursor the login is shared, so we say so instead of
|
|
43
|
+
* faking a per-version fix. Every other kind maps to its canonical command.
|
|
44
|
+
*/
|
|
45
|
+
export declare function remediationFor(finding: DoctorFinding): string;
|
|
46
|
+
export interface LocalFindingInputs {
|
|
47
|
+
device: string;
|
|
48
|
+
syncRows: SyncStatusRow[];
|
|
49
|
+
orphanRows: OrphanRow[];
|
|
50
|
+
repoBehind: FetchStatusMarker[];
|
|
51
|
+
/** Per-version resource reports (one per installed version) — the source of the
|
|
52
|
+
* missing-hook / missing-plugin / missing-resource / content-drift / unwired
|
|
53
|
+
* criticals+warnings. */
|
|
54
|
+
reports: VersionResourceReport[];
|
|
55
|
+
/** Per-version sign-in per agent id. */
|
|
56
|
+
signIn: Record<string, FleetVersionSignIn[]>;
|
|
57
|
+
/** Managed agents (installed versions) whose binary won't resolve. */
|
|
58
|
+
cliMissing?: AgentId[];
|
|
59
|
+
/** Host CLIs declared in a DotAgents repo's `cli/`: their install state on this
|
|
60
|
+
* box, plus any manifest the loader could not parse. Host-global (installed to
|
|
61
|
+
* PATH, never synced into a version home), so they are a machine-level
|
|
62
|
+
* finding, not a per-version one. */
|
|
63
|
+
hostClis?: {
|
|
64
|
+
statuses: Array<{
|
|
65
|
+
name: string;
|
|
66
|
+
installed: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
errors: Array<{
|
|
69
|
+
file: string;
|
|
70
|
+
reason: string;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
/** Hooks materialized into several version homes at once — identical copies are
|
|
74
|
+
* installation noise, differing ones are drift a stale gate can act on. */
|
|
75
|
+
duplicateHooks?: DuplicateVersionHook[];
|
|
76
|
+
/** Credential-shaped exports found in the user's shell rc files (RUSH-1968). */
|
|
77
|
+
rcSecrets?: RcSecretFinding[];
|
|
78
|
+
/** The effective PowerShell execution policy and the platform it was read on.
|
|
79
|
+
* Only `win32` yields a finding — the `agents.ps1` launcher is Windows-only. */
|
|
80
|
+
execPolicy?: {
|
|
81
|
+
platform: NodeJS.Platform;
|
|
82
|
+
policy: string | null;
|
|
83
|
+
};
|
|
84
|
+
/** `<agent>@<version>` keys whose home is an isolated copy. Their findings are
|
|
85
|
+
* never collapsed across versions: the agent-wide `agents doctor <agent> --fix`
|
|
86
|
+
* sweep deliberately skips isolated copies, so a collapsed row would print a
|
|
87
|
+
* remediation that does not fix them. */
|
|
88
|
+
isolatedVersions?: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Fold this machine's signals into findings. Missing hooks/plugins and unwired
|
|
92
|
+
* hooks are CRITICAL; provable logouts are CRITICAL and unprovable ones WARNING;
|
|
93
|
+
* everything else (other missing kinds, drift, stale/never-synced, repo-behind,
|
|
94
|
+
* orphans) is a WARNING. Pure.
|
|
95
|
+
*/
|
|
96
|
+
export declare function buildLocalFindings(input: LocalFindingInputs): DoctorFinding[];
|
|
97
|
+
/**
|
|
98
|
+
* Fold findings that say the SAME thing about several versions of one agent into
|
|
99
|
+
* a single row carrying `versions`, and widen its remediation to the agent-wide
|
|
100
|
+
* sweep (`agents doctor claude --fix` heals every non-isolated version in one
|
|
101
|
+
* go). Five identical `plugin 'code' — mirror missing` rows, one per installed
|
|
102
|
+
* claude, is the same fact five times.
|
|
103
|
+
*
|
|
104
|
+
* Three things never merge, because for each of them the widened remediation
|
|
105
|
+
* would be wrong:
|
|
106
|
+
* - **Isolated copies** — the agent-wide sweep deliberately skips them
|
|
107
|
+
* (`runFix`), so a folded row would print a command that leaves one broken.
|
|
108
|
+
* - **Findings with no agent** (repo-behind, rc-secret-export, …) — their
|
|
109
|
+
* `version` field is an alias, not a version.
|
|
110
|
+
* - **Logouts** ({@link NEVER_COLLAPSED}) — a login is inherently per-version:
|
|
111
|
+
* the fix is `agents run <agent>@<version> -- login`, and there is no `@all`
|
|
112
|
+
* equivalent. Dropping `version` would fall back to the bare native hint,
|
|
113
|
+
* which the shim resolves to the DEFAULT version — logging into the wrong one
|
|
114
|
+
* and leaving the finding to reappear.
|
|
115
|
+
*
|
|
116
|
+
* Pure; input order is kept.
|
|
117
|
+
*/
|
|
118
|
+
export declare function collapseAcrossVersions(findings: DoctorFinding[], isolated: Set<string>): DoctorFinding[];
|
|
119
|
+
/**
|
|
120
|
+
* Map a device's per-version sign-in into logout findings: a PROVABLE logout is
|
|
121
|
+
* CRITICAL, an unprovable one is a hedged WARNING ("could not verify sign-in"),
|
|
122
|
+
* and a signed-in version yields nothing.
|
|
123
|
+
*
|
|
124
|
+
* An agent with no inspectable identity never appears at all — not even as the
|
|
125
|
+
* hedged warning: agents-cli knows no credential file for it, so "logged out" is
|
|
126
|
+
* unknowable and silence beats a false claim. Membership is
|
|
127
|
+
* `supportsAccountInspection` (`lib/agents.ts`) and is deliberately NOT listed
|
|
128
|
+
* here — agents move between the sets, and a copy of the list in prose becomes a
|
|
129
|
+
* lie the next time one does. Note the caller also requires
|
|
130
|
+
* `CredentialPresence.knownLocation`: the inspection set and the credential-path
|
|
131
|
+
* map move independently, so being inspectable is not on its own enough to call a
|
|
132
|
+
* logout provable. Pure.
|
|
133
|
+
*/
|
|
134
|
+
export declare function signInToFindings(device: string, signIn: Record<string, FleetVersionSignIn[]>): DoctorFinding[];
|
|
135
|
+
/**
|
|
136
|
+
* Map cross-device divergence (from {@link compareFleetInventories}) into
|
|
137
|
+
* warnings: an agent version present elsewhere but absent on a device is a
|
|
138
|
+
* version-skew warning; a diverged config repo is a repo-drift warning; a
|
|
139
|
+
* missing resource is a missing-resource warning. Baseline = the local machine.
|
|
140
|
+
* Only the *lagging* box is attributed (a `*-missing-local` finding is the
|
|
141
|
+
* baseline's gap). Pure.
|
|
142
|
+
*/
|
|
143
|
+
export declare function fleetDivergenceToFindings(divergences: FleetDivergence[], baseline: string): DoctorFinding[];
|
|
144
|
+
export interface RenderOptions {
|
|
145
|
+
/** Fleet mode (`--devices`): render the `─── by computer ───` header + one
|
|
146
|
+
* block per device. Single-machine mode collapses to one `▸ <machine>` block
|
|
147
|
+
* with no fleet header. */
|
|
148
|
+
fleet: boolean;
|
|
149
|
+
/** The baseline (local) machine name — tagged `· this machine`. */
|
|
150
|
+
baseline?: string;
|
|
151
|
+
/** Header line context: device count (fleet) or the local version string. */
|
|
152
|
+
header?: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Render the two-part hybrid layout from a flat findings list. Pure — returns the
|
|
156
|
+
* lines so the exact output is snapshot-tested. Criticals across ALL devices go
|
|
157
|
+
* to the top section, worst-first; the per-computer section lists each device's
|
|
158
|
+
* warnings + a `✗ N critical (above)` marker, worst device first.
|
|
159
|
+
*/
|
|
160
|
+
export declare function renderFindings(findings: DoctorFinding[], accounts: Record<string, Record<string, FleetVersionSignIn[]>>, opts: RenderOptions): string[];
|
|
161
|
+
/**
|
|
162
|
+
* The compact accounts/versions line for one device: every installed version and
|
|
163
|
+
* its account, grouped by agent — green ✓ signed in, red ✗ provably logged out,
|
|
164
|
+
* gray ? unknown (see {@link badge}). e.g.
|
|
165
|
+
* `claude 2.1.170 ✓muqsit@gmail(Max) 2.1.999 ✓team(Team) · codex ✗ · grok ✓`
|
|
166
|
+
*/
|
|
167
|
+
export declare function renderAccountsLine(signIn: Record<string, FleetVersionSignIn[]>): string;
|