@phnx-labs/agents-cli 1.22.45 → 1.22.47
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 +303 -0
- package/LICENSE +102 -182
- package/README.md +54 -17
- package/dist/cli/command-registry.d.ts +2 -1
- package/dist/cli/command-registry.js +6 -2
- package/dist/commands/accounts.js +56 -12
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +229 -0
- package/dist/commands/browser-sessions-picker.js +9 -7
- package/dist/commands/browser.js +266 -15
- package/dist/commands/config.js +26 -4
- package/dist/commands/cost.d.ts +1 -1
- package/dist/commands/detach.d.ts +13 -0
- package/dist/commands/detach.js +11 -8
- package/dist/commands/exec.js +55 -38
- package/dist/commands/feed-watch.d.ts +2 -0
- package/dist/commands/feed-watch.js +28 -0
- package/dist/commands/feed.js +27 -0
- package/dist/commands/feedback.js +3 -19
- package/dist/commands/insights.d.ts +1 -1
- package/dist/commands/insights.js +2 -2
- package/dist/commands/lease.js +3 -3
- package/dist/commands/routines.js +1 -1
- package/dist/commands/sessions-picker-factory.d.ts +2 -1
- package/dist/commands/sessions-picker-factory.js +1 -1
- package/dist/commands/sessions-stop.d.ts +24 -0
- package/dist/commands/sessions-stop.js +66 -0
- package/dist/commands/sessions-trace.d.ts +82 -0
- package/dist/commands/sessions-trace.js +387 -0
- package/dist/commands/sessions.js +4 -0
- package/dist/commands/ssh.d.ts +15 -0
- package/dist/commands/ssh.js +194 -16
- package/dist/commands/teams.js +34 -2
- package/dist/commands/view.d.ts +2 -0
- package/dist/commands/view.js +19 -32
- package/dist/commands/watchdog.js +9 -14
- package/dist/lib/account-capabilities.d.ts +4 -0
- package/dist/lib/account-capabilities.js +13 -9
- package/dist/lib/account-registry.d.ts +2 -0
- package/dist/lib/account-registry.js +30 -2
- package/dist/lib/accounting/rotate.d.ts +9 -0
- package/dist/lib/accounting/rotate.js +12 -2
- package/dist/lib/accounting/usage.d.ts +92 -6
- package/dist/lib/accounting/usage.js +329 -75
- package/dist/lib/agent-modes.js +29 -1
- package/dist/lib/agent-spec/agents.d.ts +4 -3
- package/dist/lib/agent-spec/agents.js +20 -7
- package/dist/lib/analytics/mix-commands.d.ts +1 -1
- package/dist/lib/analytics/mix-commands.js +2 -2
- package/dist/lib/auth-health.d.ts +13 -3
- package/dist/lib/auth-health.js +50 -8
- package/dist/lib/browser/devices.d.ts +19 -0
- package/dist/lib/browser/devices.js +23 -0
- package/dist/lib/browser/ipc.d.ts +1 -1
- package/dist/lib/browser/ipc.js +33 -7
- package/dist/lib/browser/profiles.d.ts +106 -1
- package/dist/lib/browser/profiles.js +300 -17
- package/dist/lib/browser/remote-control.d.ts +26 -2
- package/dist/lib/browser/remote-control.js +33 -3
- package/dist/lib/browser/runtime-state.d.ts +9 -0
- package/dist/lib/browser/runtime-state.js +24 -8
- package/dist/lib/browser/service.d.ts +37 -0
- package/dist/lib/browser/service.js +78 -20
- package/dist/lib/browser/sessions-list.d.ts +1 -3
- package/dist/lib/browser/sessions-list.js +3 -16
- package/dist/lib/browser/types.d.ts +12 -1
- package/dist/lib/cli-resources.js +17 -15
- package/dist/lib/codex-policy.d.ts +11 -1
- package/dist/lib/codex-policy.js +20 -5
- package/dist/lib/config-keys.d.ts +4 -3
- package/dist/lib/config-keys.js +17 -7
- package/dist/lib/daemon/runner.js +15 -2
- package/dist/lib/daemon-ticks.js +2 -2
- package/dist/lib/device-config.d.ts +25 -8
- package/dist/lib/device-config.js +90 -17
- package/dist/lib/devices/config-migration.d.ts +7 -0
- package/dist/lib/devices/config-migration.js +67 -3
- package/dist/lib/devices/harness-inventory.js +20 -3
- package/dist/lib/devices/health.d.ts +27 -2
- package/dist/lib/devices/health.js +39 -9
- package/dist/lib/devices/interactive-host.d.ts +15 -0
- package/dist/lib/devices/interactive-host.js +53 -0
- package/dist/lib/devices/registry.d.ts +61 -4
- package/dist/lib/devices/registry.js +94 -38
- package/dist/lib/devices/stats-cache.d.ts +6 -0
- package/dist/lib/devices/stats-cache.js +10 -2
- package/dist/lib/exec.d.ts +25 -3
- package/dist/lib/exec.js +75 -22
- package/dist/lib/feed/answer.d.ts +29 -0
- package/dist/lib/feed/answer.js +145 -0
- package/dist/lib/feed/attention.d.ts +83 -0
- package/dist/lib/feed/attention.js +0 -0
- package/dist/lib/feed/feed.d.ts +109 -0
- package/dist/lib/feed/feed.js +154 -3
- package/dist/lib/feed/pr-status.d.ts +14 -0
- package/dist/lib/feed/pr-status.js +47 -0
- package/dist/lib/feed/watch.d.ts +59 -0
- package/dist/lib/feed/watch.js +180 -0
- package/dist/lib/fleet/capture.js +6 -0
- package/dist/lib/fleet/remote-login.js +8 -3
- package/dist/lib/fleet/types.d.ts +17 -0
- package/dist/lib/harness/adapter.d.ts +11 -0
- package/dist/lib/harness/adapters/claude.js +38 -24
- package/dist/lib/harness/adapters/codex.js +2 -4
- package/dist/lib/hooks/cache.js +8 -0
- package/dist/lib/hooks/match.d.ts +3 -0
- package/dist/lib/hooks/match.js +25 -0
- package/dist/lib/hosts/passthrough.js +16 -0
- package/dist/lib/hosts/registry.js +7 -0
- package/dist/lib/identity/client.d.ts +53 -0
- package/dist/lib/identity/client.js +106 -0
- package/dist/lib/identity/index.d.ts +115 -0
- package/dist/lib/identity/index.js +82 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
- package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
- package/dist/lib/menubar/install-menubar.d.ts +13 -0
- package/dist/lib/menubar/install-menubar.js +26 -2
- package/dist/lib/open-url.d.ts +60 -2
- package/dist/lib/open-url.js +167 -12
- package/dist/lib/probe.d.ts +8 -0
- package/dist/lib/probe.js +105 -0
- package/dist/lib/refresh-coordinator.d.ts +1 -1
- package/dist/lib/refresh-coordinator.js +1 -1
- 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/session/active.d.ts +67 -0
- package/dist/lib/session/active.js +69 -1
- package/dist/lib/session/db.js +4 -2
- package/dist/lib/session/discover.d.ts +2 -0
- package/dist/lib/session/discover.js +12 -6
- package/dist/lib/session/prompt.d.ts +35 -0
- package/dist/lib/session/prompt.js +56 -0
- package/dist/lib/session/remote/watch.d.ts +1 -1
- package/dist/lib/session/remote/watch.js +6 -1
- package/dist/lib/session/render.js +7 -3
- package/dist/lib/session/session-cache.js +5 -1
- package/dist/lib/session/trajectory-compare.d.ts +47 -0
- package/dist/lib/session/trajectory-compare.js +116 -0
- package/dist/lib/session/trajectory-html.d.ts +15 -0
- package/dist/lib/session/trajectory-html.js +750 -0
- package/dist/lib/session/trajectory-lineage.d.ts +92 -0
- package/dist/lib/session/trajectory-lineage.js +195 -0
- package/dist/lib/session/trajectory-text.d.ts +37 -0
- package/dist/lib/session/trajectory-text.js +277 -0
- package/dist/lib/session/trajectory.d.ts +102 -0
- package/dist/lib/session/trajectory.js +335 -0
- package/dist/lib/startup/command-registry.d.ts +5 -2
- package/dist/lib/startup/command-registry.js +8 -5
- package/dist/lib/state.d.ts +1 -1
- package/dist/lib/state.js +4 -2
- package/dist/lib/teams/agents.js +9 -0
- package/dist/lib/terminal/inject.d.ts +19 -0
- package/dist/lib/terminal/inject.js +19 -9
- package/dist/lib/tmux/session.d.ts +46 -13
- package/dist/lib/tmux/session.js +173 -27
- package/dist/lib/types.d.ts +16 -0
- package/dist/lib/usage-backoff.d.ts +2 -1
- package/dist/lib/usage-backoff.js +60 -19
- package/dist/lib/usage-refresh.d.ts +17 -3
- package/dist/lib/usage-refresh.js +57 -11
- package/dist/lib/view-types.d.ts +2 -2
- package/dist/lib/watchdog/log.d.ts +1 -1
- package/dist/lib/watchdog/log.js +1 -1
- package/dist/lib/watchdog/runner.d.ts +36 -45
- package/dist/lib/watchdog/runner.js +150 -119
- package/dist/lib/watchdog/service.d.ts +0 -1
- package/dist/lib/watchdog/service.js +0 -1
- package/dist/lib/watchdog/watchdog-agent.d.ts +38 -0
- package/dist/lib/watchdog/watchdog-agent.js +59 -0
- package/dist/lib/watchdog/watchdog.d.ts +11 -2
- package/dist/lib/watchdog/watchdog.js +37 -104
- package/package.json +2 -2
- package/dist/commands/usage.d.ts +0 -27
- package/dist/commands/usage.js +0 -96
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff two {@link SessionTrajectory} models for `agents sessions trace <a> <b>` —
|
|
3
|
+
* the second selector turns the single-session trajectory into a **compare**.
|
|
4
|
+
*
|
|
5
|
+
* Aligns the two sessions' TOOL steps (thinking steps carry no comparable
|
|
6
|
+
* identity) with the `diff` package's `diffArrays` (already a dependency,
|
|
7
|
+
* `lib/diff-text.ts`), comparator-keyed on tool name, in order — cheap,
|
|
8
|
+
* deterministic, and matches how a human reads "where did these two runs
|
|
9
|
+
* diverge": the first point their tool sequence stops lining up.
|
|
10
|
+
*
|
|
11
|
+
* Pure and framework-free, exactly like `trajectory.ts`: takes two already-built
|
|
12
|
+
* `SessionTrajectory` models (never re-parses a transcript) and returns a plain
|
|
13
|
+
* diff object the HTML/text/JSON renderers project.
|
|
14
|
+
*/
|
|
15
|
+
import { diffArrays } from 'diff';
|
|
16
|
+
const DEFAULT_MAX_DIFF_STEPS = 1000;
|
|
17
|
+
/**
|
|
18
|
+
* Turn `diffArrays`' run-length change objects into a per-step edit script.
|
|
19
|
+
*
|
|
20
|
+
* `diffArrays(a, b, { comparator })` (Myers' diff under the hood) returns
|
|
21
|
+
* consecutive-run chunks, not individual elements, and — per its own docs —
|
|
22
|
+
* an unchanged chunk's `value` is drawn from `b`, not `a`. Neither shape is
|
|
23
|
+
* what a divergence marker needs (a stepA/stepB PAIR per matched step, with
|
|
24
|
+
* both sides' own ordinals/timestamps), so this walks two cursors over the
|
|
25
|
+
* original arrays in lockstep with the run lengths `diffArrays` reports,
|
|
26
|
+
* recovering the exact `a[i]`/`b[j]` pairing for every `same` step.
|
|
27
|
+
*/
|
|
28
|
+
function computeEditScript(a, b) {
|
|
29
|
+
const changes = diffArrays(a, b, { comparator: (x, y) => x.tool === y.tool });
|
|
30
|
+
const ops = [];
|
|
31
|
+
let i = 0;
|
|
32
|
+
let j = 0;
|
|
33
|
+
for (const change of changes) {
|
|
34
|
+
const count = change.count ?? change.value.length;
|
|
35
|
+
if (change.removed) {
|
|
36
|
+
for (let k = 0; k < count; k++)
|
|
37
|
+
ops.push({ type: 'remove', stepA: a[i++] });
|
|
38
|
+
}
|
|
39
|
+
else if (change.added) {
|
|
40
|
+
for (let k = 0; k < count; k++)
|
|
41
|
+
ops.push({ type: 'add', stepB: b[j++] });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
for (let k = 0; k < count; k++)
|
|
45
|
+
ops.push({ type: 'same', stepA: a[i++], stepB: b[j++] });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return ops;
|
|
49
|
+
}
|
|
50
|
+
function describeDivergence(op) {
|
|
51
|
+
if (op.type === 'remove')
|
|
52
|
+
return `${op.stepA.tool ?? op.stepA.kind} — only in the first session`;
|
|
53
|
+
if (op.type === 'add')
|
|
54
|
+
return `${op.stepB.tool ?? op.stepB.kind} — only in the second session`;
|
|
55
|
+
return '';
|
|
56
|
+
}
|
|
57
|
+
function summarize(t) {
|
|
58
|
+
return {
|
|
59
|
+
session: t.session,
|
|
60
|
+
toolCount: t.stats.toolCount,
|
|
61
|
+
errorCount: t.errorCount,
|
|
62
|
+
spanMs: t.spanMs,
|
|
63
|
+
outputTokens: t.stats.outputTokens,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Diff two trajectories: align their tool-step sequences, find the first
|
|
68
|
+
* divergence, and collect the steps each session ran that the other never
|
|
69
|
+
* did. Never mutates either input.
|
|
70
|
+
*/
|
|
71
|
+
export function diffTrajectories(a, b, options = {}) {
|
|
72
|
+
const maxDiffSteps = options.maxDiffSteps ?? DEFAULT_MAX_DIFF_STEPS;
|
|
73
|
+
const allToolStepsA = a.steps.filter((s) => s.kind === 'tool');
|
|
74
|
+
const allToolStepsB = b.steps.filter((s) => s.kind === 'tool');
|
|
75
|
+
const toolStepsA = allToolStepsA.slice(0, maxDiffSteps);
|
|
76
|
+
const toolStepsB = allToolStepsB.slice(0, maxDiffSteps);
|
|
77
|
+
const truncatedA = allToolStepsA.length - toolStepsA.length;
|
|
78
|
+
const truncatedB = allToolStepsB.length - toolStepsB.length;
|
|
79
|
+
const ops = computeEditScript(toolStepsA, toolStepsB);
|
|
80
|
+
const added = [];
|
|
81
|
+
const removed = [];
|
|
82
|
+
let divergence;
|
|
83
|
+
let lastSameA;
|
|
84
|
+
let lastSameB;
|
|
85
|
+
for (const op of ops) {
|
|
86
|
+
if (op.type === 'same') {
|
|
87
|
+
lastSameA = op.stepA;
|
|
88
|
+
lastSameB = op.stepB;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (op.type === 'remove')
|
|
92
|
+
removed.push(op.stepA);
|
|
93
|
+
else
|
|
94
|
+
added.push(op.stepB);
|
|
95
|
+
if (!divergence) {
|
|
96
|
+
divergence = {
|
|
97
|
+
afterOrdinalA: lastSameA?.ordinal ?? 0,
|
|
98
|
+
afterOrdinalB: lastSameB?.ordinal ?? 0,
|
|
99
|
+
startMsA: op.type === 'remove' ? op.stepA.startMs : (lastSameA?.startMs ?? 0),
|
|
100
|
+
startMsB: op.type === 'add' ? op.stepB.startMs : (lastSameB?.startMs ?? 0),
|
|
101
|
+
detail: describeDivergence(op),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
a,
|
|
107
|
+
b,
|
|
108
|
+
divergence,
|
|
109
|
+
added,
|
|
110
|
+
removed,
|
|
111
|
+
summaryA: summarize(a),
|
|
112
|
+
summaryB: summarize(b),
|
|
113
|
+
truncatedA,
|
|
114
|
+
truncatedB,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SessionTrajectory } from './trajectory.js';
|
|
2
|
+
import type { TrajectoryComparison } from './trajectory-compare.js';
|
|
3
|
+
import type { SessionLineage } from './trajectory-lineage.js';
|
|
4
|
+
/** Render one session's trajectory as a self-contained HTML page. */
|
|
5
|
+
export declare function renderTrajectoryHtml(model: SessionTrajectory): string;
|
|
6
|
+
/** Render a two-session {@link TrajectoryComparison} as a self-contained HTML page. */
|
|
7
|
+
export declare function renderTrajectoryCompareHtml(cmp: TrajectoryComparison): string;
|
|
8
|
+
/**
|
|
9
|
+
* Render a {@link SessionLineage} as ONE self-contained HTML page: the inline-SVG
|
|
10
|
+
* delegation graph (orchestrator on top, the sessions it spawned below, edges
|
|
11
|
+
* auto-discovered from the team records) plus a per-node summary card revealed
|
|
12
|
+
* by clicking a node. Same shell, redaction, and no-CDN rule as the other two
|
|
13
|
+
* layouts; local paths (`filePath`/`cwd`) are deliberately never rendered.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderLineageHtml(lineage: SessionLineage): string;
|