@phnx-labs/agents-cli 1.22.43 → 1.22.45
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 +85 -0
- package/README.md +14 -12
- package/dist/bootstrap.js +3 -6
- package/dist/cli/command-registry.d.ts +0 -7
- package/dist/cli/command-registry.js +1 -21
- package/dist/commands/accounts.d.ts +1 -9
- package/dist/commands/accounts.js +12 -90
- package/dist/commands/apply.d.ts +7 -10
- package/dist/commands/apply.js +15 -35
- package/dist/commands/artifacts.js +4 -5
- package/dist/commands/audit.d.ts +6 -6
- package/dist/commands/audit.js +12 -12
- package/dist/commands/beta.d.ts +7 -1
- package/dist/commands/beta.js +16 -9
- package/dist/commands/commands.js +1 -1
- package/dist/commands/doctor.js +1 -4
- package/dist/commands/events.d.ts +2 -2
- package/dist/commands/events.js +6 -5
- package/dist/commands/exec.d.ts +1 -1
- package/dist/commands/exec.js +8 -4
- package/dist/commands/factory.d.ts +1 -1
- package/dist/commands/fleet-capture.d.ts +1 -1
- package/dist/commands/fleet-capture.js +4 -5
- package/dist/commands/harness.js +1 -49
- package/dist/commands/hooks.js +1 -1
- package/dist/commands/insights.d.ts +1 -1
- package/dist/commands/insights.js +85 -156
- package/dist/commands/menubar.js +58 -1
- package/dist/commands/output.js +2 -2
- package/dist/commands/prune.js +5 -4
- package/dist/commands/routines.test-fixture.d.ts +86 -0
- package/dist/commands/routines.test-fixture.js +345 -0
- package/dist/commands/sessions.test-fixture.d.ts +24 -0
- package/dist/commands/sessions.test-fixture.js +224 -0
- package/dist/commands/setup.js +5 -1
- package/dist/commands/share.d.ts +9 -10
- package/dist/commands/share.js +68 -50
- package/dist/commands/skills.js +1 -1
- package/dist/commands/ssh.js +15 -62
- package/dist/commands/subagents.js +1 -1
- package/dist/commands/view.js +5 -2
- package/dist/lib/analytics/mix-commands.d.ts +6 -28
- package/dist/lib/analytics/mix-commands.js +14 -40
- package/dist/lib/audit/log.d.ts +2 -2
- package/dist/lib/audit/log.js +2 -2
- package/dist/lib/beta.js +1 -1
- package/dist/lib/browser/domain-skills.d.ts +26 -6
- package/dist/lib/browser/domain-skills.js +81 -43
- package/dist/lib/daemon/daemon.js +11 -0
- package/dist/lib/daemon/daemon.test-fixture.d.ts +24 -0
- package/dist/lib/daemon/daemon.test-fixture.js +71 -0
- package/dist/lib/daemon-ticks.d.ts +38 -1
- package/dist/lib/daemon-ticks.js +52 -5
- package/dist/lib/device-config.js +1 -2
- package/dist/lib/devices/discovery-policy.d.ts +3 -3
- package/dist/lib/devices/discovery-policy.js +3 -3
- package/dist/lib/devices/fleet.d.ts +4 -8
- package/dist/lib/devices/fleet.js +3 -15
- package/dist/lib/devices/health-report.js +3 -3
- package/dist/lib/devices/pool.d.ts +0 -6
- package/dist/lib/devices/pool.js +0 -6
- package/dist/lib/devices/registry.d.ts +0 -15
- package/dist/lib/devices/registry.js +0 -9
- package/dist/lib/devices/stats-cache.d.ts +12 -0
- package/dist/lib/devices/stats-cache.js +24 -5
- package/dist/lib/fleet/capture.d.ts +1 -1
- package/dist/lib/fleet/manifest.js +1 -1
- package/dist/lib/fleet/remote-login.d.ts +2 -2
- package/dist/lib/fleet/remote-login.js +3 -4
- package/dist/lib/hosts/dispatch.d.ts +2 -0
- package/dist/lib/hosts/dispatch.js +8 -1
- package/dist/lib/hosts/passthrough.js +0 -1
- package/dist/lib/hosts/providers/devices.js +1 -13
- package/dist/lib/hosts/ready.d.ts +12 -3
- package/dist/lib/hosts/ready.js +27 -12
- package/dist/lib/hosts/registry.d.ts +4 -5
- package/dist/lib/hosts/registry.js +3 -7
- package/dist/lib/installations/versions.js +21 -2
- package/dist/lib/menubar/install-menubar.d.ts +109 -0
- package/dist/lib/menubar/install-menubar.js +199 -4
- package/dist/lib/remote-agents-json.js +1 -7
- package/dist/lib/routines-placement.d.ts +1 -1
- package/dist/lib/routines-placement.js +1 -1
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +0 -2
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +1 -13
- package/dist/lib/session/active.d.ts +4 -16
- package/dist/lib/session/active.js +2 -6
- package/dist/lib/session/db.d.ts +13 -98
- package/dist/lib/session/db.js +4 -11
- package/dist/lib/session/discover.d.ts +5 -81
- package/dist/lib/session/discover.js +5 -5
- package/dist/lib/session/remote/remote-bundle.d.ts +12 -0
- package/dist/lib/session/remote/remote-bundle.js +61 -0
- package/dist/lib/session/remote/remote-list.d.ts +148 -0
- package/dist/lib/session/remote/remote-list.js +607 -0
- package/dist/lib/session/remote/remote.d.ts +132 -0
- package/dist/lib/session/remote/remote.js +314 -0
- package/dist/lib/session/remote/watch.d.ts +101 -0
- package/dist/lib/session/remote/watch.js +241 -0
- package/dist/lib/session/remote-bundle.d.ts +1 -12
- package/dist/lib/session/remote-bundle.js +3 -61
- package/dist/lib/session/remote-list.d.ts +1 -148
- package/dist/lib/session/remote-list.js +3 -607
- package/dist/lib/session/remote.d.ts +1 -132
- package/dist/lib/session/remote.js +3 -314
- package/dist/lib/session/watch.d.ts +1 -101
- package/dist/lib/session/watch.js +3 -242
- package/dist/lib/share/config.d.ts +12 -2
- package/dist/lib/share/config.js +47 -11
- package/dist/lib/share/delete.js +1 -1
- package/dist/lib/share/publish.js +1 -1
- package/dist/lib/share/worker-template.js +2 -2
- package/dist/lib/smart-launch.d.ts +4 -4
- package/dist/lib/smart-launch.js +8 -18
- package/dist/lib/staleness/index.d.ts +3 -1
- package/dist/lib/staleness/index.js +21 -1
- package/dist/lib/staleness/types.d.ts +11 -0
- package/dist/lib/staleness/writers/commands.js +13 -4
- package/dist/lib/staleness/writers/hooks.js +3 -1
- package/dist/lib/staleness/writers/mcp.d.ts +0 -7
- package/dist/lib/staleness/writers/mcp.js +16 -1
- package/dist/lib/staleness/writers/rules.js +1 -1
- package/dist/lib/staleness/writers/skills.js +3 -1
- package/dist/lib/staleness/writers/subagents.d.ts +0 -9
- package/dist/lib/staleness/writers/subagents.js +18 -1
- package/dist/lib/staleness/writers/types.d.ts +10 -0
- package/dist/lib/startup/command-registry.d.ts +8 -1
- package/dist/lib/startup/command-registry.js +21 -6
- package/dist/lib/startup/root-command.d.ts +18 -1
- package/dist/lib/startup/root-command.js +18 -1
- package/dist/lib/state.js +7 -0
- package/dist/lib/teams/placement-probe.js +27 -12
- package/dist/lib/teams/scheduler.d.ts +3 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/view-types.d.ts +3 -0
- package/package.json +2 -3
- package/dist/bin/agents +0 -0
- package/dist/commands/auth.d.ts +0 -9
- package/dist/commands/auth.js +0 -108
- package/dist/commands/org.d.ts +0 -6
- package/dist/commands/org.js +0 -175
- package/dist/commands/serve.d.ts +0 -10
- package/dist/commands/serve.js +0 -68
- package/dist/commands/trends.d.ts +0 -10
- package/dist/commands/trends.js +0 -12
- package/dist/lib/entitlement.d.ts +0 -31
- package/dist/lib/entitlement.js +0 -137
- package/dist/lib/prix-account.d.ts +0 -158
- package/dist/lib/prix-account.js +0 -214
- package/dist/lib/secrets/Agents CLI.app/Contents/Resources/AppIcon.icns +0 -0
- package/dist/lib/serve/control.d.ts +0 -95
- package/dist/lib/serve/control.js +0 -260
- package/dist/lib/serve/data.d.ts +0 -81
- package/dist/lib/serve/data.js +0 -91
- package/dist/lib/serve/page.d.ts +0 -7
- package/dist/lib/serve/page.js +0 -140
- package/dist/lib/serve/server.d.ts +0 -80
- package/dist/lib/serve/server.js +0 -145
- package/dist/lib/serve/stream.d.ts +0 -43
- package/dist/lib/serve/stream.js +0 -116
- package/dist/lib/serve/token.d.ts +0 -35
- package/dist/lib/serve/token.js +0 -85
package/dist/lib/serve/token.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bearer-token store for the authenticated `agents serve --control` server.
|
|
3
|
-
*
|
|
4
|
-
* Only the SHA-256 *hash* of each token is written to disk — the raw token is
|
|
5
|
-
* shown once at creation (like an API key) and never persisted, so a leaked
|
|
6
|
-
* store file cannot be replayed. This is the anchor-side credential the iOS
|
|
7
|
-
* cockpit presents on every request; `agents devices pair-ios` (Phase 3) mints
|
|
8
|
-
* additional per-device tokens through {@link addControlToken}.
|
|
9
|
-
*
|
|
10
|
-
* Store path: `<cache>/serve/control-tokens.json` — under `.cache/`, which is
|
|
11
|
-
* gitignored, so no credential material lands in a version-controlled repo.
|
|
12
|
-
*/
|
|
13
|
-
import fs from 'fs';
|
|
14
|
-
import path from 'path';
|
|
15
|
-
import { createHash, randomBytes, timingSafeEqual } from 'crypto';
|
|
16
|
-
import { getCacheDir } from '../state.js';
|
|
17
|
-
function storePath() {
|
|
18
|
-
return path.join(getCacheDir(), 'serve', 'control-tokens.json');
|
|
19
|
-
}
|
|
20
|
-
function readStore() {
|
|
21
|
-
try {
|
|
22
|
-
const raw = fs.readFileSync(storePath(), 'utf-8');
|
|
23
|
-
const parsed = JSON.parse(raw);
|
|
24
|
-
if (parsed && Array.isArray(parsed.tokens))
|
|
25
|
-
return parsed;
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
// Missing/corrupt store → start empty; a fresh token gets minted below.
|
|
29
|
-
}
|
|
30
|
-
return { tokens: [] };
|
|
31
|
-
}
|
|
32
|
-
function writeStore(store) {
|
|
33
|
-
const p = storePath();
|
|
34
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
35
|
-
// 0600: readable only by the owner — it holds token hashes. `mode` on
|
|
36
|
-
// writeFileSync is honored only at *creation*, so chmod every write to
|
|
37
|
-
// self-heal if the perms were ever widened externally (this is a credential
|
|
38
|
-
// file, even if only hashes).
|
|
39
|
-
fs.writeFileSync(p, JSON.stringify(store, null, 2), { mode: 0o600 });
|
|
40
|
-
fs.chmodSync(p, 0o600);
|
|
41
|
-
}
|
|
42
|
-
function sha256(s) {
|
|
43
|
-
return createHash('sha256').update(s).digest('hex');
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Mint a new control token, persist its hash, and return the raw token ONCE.
|
|
47
|
-
* The caller must surface it to the operator immediately — it cannot be
|
|
48
|
-
* recovered later.
|
|
49
|
-
*/
|
|
50
|
-
export function addControlToken(label) {
|
|
51
|
-
const store = readStore();
|
|
52
|
-
const id = randomBytes(4).toString('hex');
|
|
53
|
-
const token = randomBytes(32).toString('hex');
|
|
54
|
-
store.tokens.push({ id, hash: sha256(token), label, createdAt: new Date().toISOString() });
|
|
55
|
-
writeStore(store);
|
|
56
|
-
return { id, token };
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Ensure at least one token exists. Returns the raw token only when it had to
|
|
60
|
-
* mint one (first `--control` boot); otherwise `{ created: false }` and the
|
|
61
|
-
* existing tokens stand.
|
|
62
|
-
*/
|
|
63
|
-
export function ensureControlToken(label = 'default') {
|
|
64
|
-
const store = readStore();
|
|
65
|
-
if (store.tokens.length > 0)
|
|
66
|
-
return { created: false };
|
|
67
|
-
const { id, token } = addControlToken(label);
|
|
68
|
-
return { created: true, id, token };
|
|
69
|
-
}
|
|
70
|
-
/** True when `presented` matches a stored token hash (constant-time compare). */
|
|
71
|
-
export function verifyControlToken(presented) {
|
|
72
|
-
if (!presented)
|
|
73
|
-
return false;
|
|
74
|
-
const want = Buffer.from(sha256(presented), 'hex');
|
|
75
|
-
for (const rec of readStore().tokens) {
|
|
76
|
-
const have = Buffer.from(rec.hash, 'hex');
|
|
77
|
-
if (have.length === want.length && timingSafeEqual(have, want))
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
/** List issued tokens (hashes only — safe to display). */
|
|
83
|
-
export function listControlTokens() {
|
|
84
|
-
return readStore().tokens;
|
|
85
|
-
}
|