@phnx-labs/agents-cli 1.22.121 → 1.22.123
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 +316 -0
- package/README.md +53 -53
- package/dist/bootstrap.js +22 -17
- package/dist/cli/command-registry.d.ts +0 -1
- package/dist/cli/command-registry.js +2 -12
- package/dist/commands/auth.js +13 -4
- package/dist/commands/browser.js +3 -4
- package/dist/commands/cloud-transcripts.d.ts +7 -0
- package/dist/commands/cloud-transcripts.js +100 -0
- package/dist/commands/cloud.js +5 -0
- package/dist/commands/computer.d.ts +0 -12
- package/dist/commands/computer.js +14 -124
- package/dist/commands/config.js +5 -4
- package/dist/commands/daemon-index.d.ts +2 -0
- package/dist/commands/daemon-index.js +44 -0
- package/dist/commands/daemon.js +13 -8
- package/dist/commands/doctor.js +3 -4
- package/dist/commands/exec.d.ts +5 -0
- package/dist/commands/exec.js +35 -7
- package/dist/commands/feed-watch.js +12 -0
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +7 -4
- package/dist/commands/insights.js +3 -1
- package/dist/commands/inspect.js +1 -1
- package/dist/commands/logs.js +2 -1
- package/dist/commands/mailboxes.js +1 -1
- package/dist/commands/models.js +1 -1
- package/dist/commands/projects.js +3 -3
- package/dist/commands/prune.js +6 -28
- package/dist/commands/ps-roster.d.ts +0 -1
- package/dist/commands/ps-roster.js +2 -21
- package/dist/commands/ps.js +13 -1
- package/dist/commands/recordings.d.ts +2 -0
- package/dist/commands/recordings.js +117 -0
- package/dist/commands/routines.js +1 -1
- package/dist/commands/secrets-passthrough.js +3 -3
- package/dist/commands/send.js +33 -20
- package/dist/commands/sessions-backfill.d.ts +1 -0
- package/dist/commands/sessions-backfill.js +48 -13
- package/dist/commands/sessions-migrate.d.ts +1 -1
- package/dist/commands/sessions-migrate.js +11 -10
- package/dist/commands/sessions-optimize.d.ts +1 -0
- package/dist/commands/sessions-optimize.js +7 -4
- package/dist/commands/sessions-resume.js +8 -1
- package/dist/commands/sessions-stats.d.ts +2 -0
- package/dist/commands/sessions-stats.js +24 -7
- package/dist/commands/sessions.d.ts +5 -11
- package/dist/commands/sessions.js +8 -236
- package/dist/commands/setup-computer.js +1 -2
- package/dist/commands/setup-mine.js +0 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/sync.js +101 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/testdata/feed-hub.js +11 -0
- package/dist/commands/trash.d.ts +0 -1
- package/dist/commands/trash.js +74 -10
- package/dist/lib/accounting/usage-sync.js +7 -0
- package/dist/lib/agent-modes.d.ts +1 -1
- package/dist/lib/agent-modes.js +11 -5
- package/dist/lib/auth-mint.d.ts +4 -0
- package/dist/lib/auth-mint.js +6 -4
- package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
- package/dist/lib/browser/native-history.test-fixture.js +43 -0
- package/dist/lib/browser/paths.d.ts +5 -0
- package/dist/lib/browser/paths.js +7 -1
- package/dist/lib/browser/sessions-list.d.ts +28 -1
- package/dist/lib/browser/sessions-list.js +137 -25
- package/dist/lib/channels/providers/rush.d.ts +2 -1
- package/dist/lib/channels/providers/rush.js +2 -2
- package/dist/lib/channels/providers/session.d.ts +1 -0
- package/dist/lib/channels/providers/session.js +23 -12
- package/dist/lib/channels/registry.d.ts +9 -2
- package/dist/lib/channels/send.d.ts +5 -10
- package/dist/lib/channels/send.js +88 -50
- package/dist/lib/cloud/rush.d.ts +6 -0
- package/dist/lib/cloud/rush.js +18 -3
- package/dist/lib/computer-client.d.ts +19 -0
- package/dist/lib/computer-client.js +104 -0
- package/dist/lib/config-keys.d.ts +5 -1
- package/dist/lib/config-keys.js +14 -11
- package/dist/lib/daemon/auth-sync-service.js +13 -0
- package/dist/lib/daemon/daemon.js +20 -23
- package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
- package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
- package/dist/lib/daemon-services.d.ts +2 -1
- package/dist/lib/daemon-services.js +17 -10
- package/dist/lib/daemon-webhooks.d.ts +1 -1
- package/dist/lib/daemon-webhooks.js +1 -1
- package/dist/lib/device-config.d.ts +4 -1
- package/dist/lib/device-config.js +58 -8
- package/dist/lib/devices/doctor-findings.d.ts +2 -3
- package/dist/lib/devices/doctor-findings.js +10 -19
- package/dist/lib/event-provenance.d.ts +1 -0
- package/dist/lib/event-provenance.js +2 -0
- package/dist/lib/exec.d.ts +1 -0
- package/dist/lib/exec.js +20 -15
- package/dist/lib/feed/pr-status.d.ts +5 -1
- package/dist/lib/feed/pr-status.js +44 -3
- package/dist/lib/feed/tool-activity.js +9 -6
- package/dist/lib/feed/tools.d.ts +4 -1
- package/dist/lib/feed/tools.js +8 -11
- package/dist/lib/feed-broadcast.d.ts +5 -3
- package/dist/lib/feed-broadcast.js +47 -36
- package/dist/lib/fleet-shared-state.d.ts +5 -0
- package/dist/lib/fleet-shared-state.js +8 -0
- package/dist/lib/github/project-prs.d.ts +4 -1
- package/dist/lib/github/project-prs.js +20 -7
- package/dist/lib/help.d.ts +1 -0
- package/dist/lib/help.js +8 -0
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/passthrough.js +5 -9
- package/dist/lib/hosts/remote-cmd.d.ts +2 -7
- package/dist/lib/hosts/remote-cmd.js +14 -22
- package/dist/lib/hosts/routing-flag.d.ts +22 -0
- package/dist/lib/hosts/routing-flag.js +127 -14
- package/dist/lib/identity/index.d.ts +22 -0
- package/dist/lib/identity/index.js +3 -0
- package/dist/lib/installations/migrate.d.ts +7 -0
- package/dist/lib/installations/migrate.js +99 -88
- package/dist/lib/installations/versions.js +2 -2
- package/dist/lib/launch-identity.d.ts +6 -1
- package/dist/lib/launch-identity.js +12 -2
- package/dist/lib/menubar/install-menubar.d.ts +1 -0
- package/dist/lib/menubar/install-menubar.js +8 -5
- package/dist/lib/menubar/snapshot.js +2 -3
- package/dist/lib/notify.d.ts +7 -14
- package/dist/lib/notify.js +29 -75
- package/dist/lib/owner-message.d.ts +4 -6
- package/dist/lib/owner-message.js +12 -11
- package/dist/lib/owner-notify-tokens.d.ts +49 -0
- package/dist/lib/owner-notify-tokens.js +214 -0
- package/dist/lib/owner-notify.d.ts +75 -0
- package/dist/lib/owner-notify.js +144 -0
- package/dist/lib/plugins/plugins.d.ts +7 -1
- package/dist/lib/plugins/plugins.js +26 -5
- package/dist/lib/pr-land-detach.js +2 -2
- package/dist/lib/recordings/config.d.ts +11 -0
- package/dist/lib/recordings/config.js +54 -0
- package/dist/lib/recordings/identity.d.ts +12 -0
- package/dist/lib/recordings/identity.js +57 -0
- package/dist/lib/recordings/ledger.d.ts +16 -0
- package/dist/lib/recordings/ledger.js +141 -0
- package/dist/lib/recordings/model.d.ts +29 -0
- package/dist/lib/recordings/model.js +28 -0
- package/dist/lib/recordings/pipeline.d.ts +44 -0
- package/dist/lib/recordings/pipeline.js +272 -0
- package/dist/lib/recordings/process.d.ts +17 -0
- package/dist/lib/recordings/process.js +94 -0
- package/dist/lib/recordings/service.d.ts +15 -0
- package/dist/lib/recordings/service.js +45 -0
- package/dist/lib/recordings/settle.d.ts +21 -0
- package/dist/lib/recordings/settle.js +92 -0
- package/dist/lib/recordings/transcode.d.ts +13 -0
- package/dist/lib/recordings/transcode.js +44 -0
- package/dist/lib/refresh.js +4 -1
- package/dist/lib/reminders.d.ts +0 -1
- package/dist/lib/reminders.js +1 -1
- package/dist/lib/reserved-stores.d.ts +3 -0
- package/dist/lib/reserved-stores.js +13 -0
- package/dist/lib/routine-notify-owner.d.ts +3 -23
- package/dist/lib/routine-notify-owner.js +26 -107
- package/dist/lib/rush-api.d.ts +1 -0
- package/dist/lib/rush-api.js +1 -0
- package/dist/lib/scheduling/routines.d.ts +1 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/session/active.d.ts +18 -2
- package/dist/lib/session/active.js +47 -37
- package/dist/lib/session/cloud.js +18 -45
- package/dist/lib/session/db.d.ts +3 -1
- package/dist/lib/session/db.js +64 -32
- package/dist/lib/session/glance-files.d.ts +4 -3
- package/dist/lib/session/glance-files.js +31 -0
- package/dist/lib/session/inject-target.js +12 -2
- package/dist/lib/session/pid-registry.d.ts +2 -0
- package/dist/lib/session/pid-registry.js +6 -2
- package/dist/lib/session/presentation.d.ts +21 -0
- package/dist/lib/session/presentation.js +198 -0
- package/dist/lib/session/projection.js +9 -2
- package/dist/lib/sqlite.d.ts +3 -1
- package/dist/lib/sqlite.js +7 -3
- package/dist/lib/staleness/index.js +12 -0
- package/dist/lib/staleness/types.d.ts +5 -0
- package/dist/lib/standalone-tools.js +1 -1
- package/dist/lib/startup/command-registry.js +10 -5
- package/dist/lib/state.d.ts +2 -5
- package/dist/lib/state.js +3 -11
- package/dist/lib/sync-delete.d.ts +21 -0
- package/dist/lib/sync-delete.js +113 -0
- package/dist/lib/terminal/inject.js +1 -1
- package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
- package/dist/lib/testdata/owner-notify-api.js +102 -0
- package/dist/lib/trash.d.ts +14 -0
- package/dist/lib/trash.js +75 -0
- package/dist/lib/types.d.ts +0 -34
- package/package.json +1 -3
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -68
- package/dist/commands/humans.d.ts +0 -2
- package/dist/commands/humans.js +0 -83
- package/dist/commands/modes.d.ts +0 -2
- package/dist/commands/modes.js +0 -134
- package/dist/commands/monitors.d.ts +0 -2
- package/dist/commands/monitors.js +0 -1070
- package/dist/commands/reminders.d.ts +0 -2
- package/dist/commands/reminders.js +0 -49
- package/dist/lib/channels/owner-forward.d.ts +0 -25
- package/dist/lib/channels/owner-forward.js +0 -78
- package/dist/lib/channels/owner-sink.d.ts +0 -10
- package/dist/lib/channels/owner-sink.js +0 -26
- package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
- package/dist/lib/daemon/monitor-engine-service.js +0 -25
- package/dist/lib/humans.d.ts +0 -12
- package/dist/lib/humans.js +0 -64
- package/dist/lib/monitors/config.d.ts +0 -77
- package/dist/lib/monitors/config.js +0 -405
- package/dist/lib/monitors/dispatch.d.ts +0 -10
- package/dist/lib/monitors/dispatch.js +0 -72
- package/dist/lib/monitors/engine.d.ts +0 -45
- package/dist/lib/monitors/engine.js +0 -243
- package/dist/lib/monitors/fingerprint.d.ts +0 -3
- package/dist/lib/monitors/fingerprint.js +0 -43
- package/dist/lib/monitors/pid-watch.d.ts +0 -4
- package/dist/lib/monitors/pid-watch.js +0 -14
- package/dist/lib/monitors/remote.d.ts +0 -31
- package/dist/lib/monitors/remote.js +0 -63
- package/dist/lib/monitors/sources/command.d.ts +0 -4
- package/dist/lib/monitors/sources/command.js +0 -20
- package/dist/lib/monitors/sources/device.d.ts +0 -3
- package/dist/lib/monitors/sources/device.js +0 -31
- package/dist/lib/monitors/sources/failure.d.ts +0 -5
- package/dist/lib/monitors/sources/failure.js +0 -25
- package/dist/lib/monitors/sources/file.d.ts +0 -4
- package/dist/lib/monitors/sources/file.js +0 -46
- package/dist/lib/monitors/sources/http.d.ts +0 -3
- package/dist/lib/monitors/sources/http.js +0 -25
- package/dist/lib/monitors/sources/index.d.ts +0 -5
- package/dist/lib/monitors/sources/index.js +0 -22
- package/dist/lib/monitors/sources/poll.d.ts +0 -1
- package/dist/lib/monitors/sources/poll.js +0 -1
- package/dist/lib/monitors/sources/types.d.ts +0 -9
- package/dist/lib/monitors/sources/webhook.d.ts +0 -3
- package/dist/lib/monitors/sources/webhook.js +0 -3
- package/dist/lib/monitors/sources/ws.d.ts +0 -4
- package/dist/lib/monitors/sources/ws.js +0 -35
- package/dist/lib/monitors/state.d.ts +0 -51
- package/dist/lib/monitors/state.js +0 -221
- /package/dist/{lib/monitors/sources/types.js → commands/testdata/feed-hub.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Command } from 'commander';
|
|
2
2
|
import { type ProjectDef } from '../lib/projects.js';
|
|
3
|
-
import type { SessionAgentId, SessionEvent, SessionMeta
|
|
3
|
+
import type { SessionAgentId, SessionEvent, SessionMeta } from '@phnx-labs/sessions-cli/reader';
|
|
4
4
|
import { type ActiveSession } from '../lib/session/active.js';
|
|
5
5
|
export { activeSessionProjectKey, backfillActiveRowsFromIndex, backfillActiveRowsFromMeta, isRunningLiveSession, serializeActiveSessionsForJson, serializeSessionsJson, type BackfillMeta } from '../lib/session/active.js';
|
|
6
6
|
import { loadLocalActiveSessions } from '../lib/session/session-cache.js';
|
|
@@ -8,6 +8,8 @@ import { gatherRemoteList, runOnPeer } from '../lib/session/remote-list.js';
|
|
|
8
8
|
import { type RemoteAgentsJsonParseResult } from '../lib/remote-agents-json.js';
|
|
9
9
|
import { type RunMeta } from '../lib/scheduling/routines.js';
|
|
10
10
|
import { type PickedSession, type SessionPreviewDigest } from './sessions-picker.js';
|
|
11
|
+
import { type TranscriptRenderOptions } from '../lib/session/presentation.js';
|
|
12
|
+
export { buildFilterOptions, renderSession, renderSessionLog, renderSessionLogJson, resolveViewMode, type TranscriptRenderOptions, } from '../lib/session/presentation.js';
|
|
11
13
|
import { type ComputerRunRow } from '../lib/computer/sessions-list.js';
|
|
12
14
|
import { type ToolSearchEnvelope, type ToolProgramCountEnvelope } from '../lib/session/tool-index.js';
|
|
13
15
|
interface SessionFilterOptions {
|
|
@@ -22,7 +24,7 @@ interface SessionFilterOptions {
|
|
|
22
24
|
since?: string;
|
|
23
25
|
until?: string;
|
|
24
26
|
}
|
|
25
|
-
interface SessionsOptions extends SessionFilterOptions {
|
|
27
|
+
interface SessionsOptions extends SessionFilterOptions, TranscriptRenderOptions {
|
|
26
28
|
unmanaged?: boolean;
|
|
27
29
|
query?: string[];
|
|
28
30
|
resolve?: string;
|
|
@@ -30,13 +32,6 @@ interface SessionsOptions extends SessionFilterOptions {
|
|
|
30
32
|
resolveLaunchId?: string;
|
|
31
33
|
limit?: string;
|
|
32
34
|
sort?: string;
|
|
33
|
-
json?: boolean;
|
|
34
|
-
markdown?: boolean;
|
|
35
|
-
redact?: boolean;
|
|
36
|
-
include?: string;
|
|
37
|
-
exclude?: string;
|
|
38
|
-
first?: string;
|
|
39
|
-
last?: string;
|
|
40
35
|
artifacts?: boolean;
|
|
41
36
|
artifact?: string;
|
|
42
37
|
active?: boolean;
|
|
@@ -180,8 +175,7 @@ export declare function buildOverviewGroups(pool: SessionMeta[], perProjectCap:
|
|
|
180
175
|
groups: OverviewGroup[];
|
|
181
176
|
projectCount: number;
|
|
182
177
|
};
|
|
183
|
-
export declare function
|
|
184
|
-
export declare function renderSessionLogJson(session: SessionMeta): Promise<void>;
|
|
178
|
+
export declare function printSessionTable(sessions: SessionMeta[], hiddenCount?: number, tree?: boolean, liveIndex?: Map<string, ActiveSession>): void;
|
|
185
179
|
export interface SshOriginTag {
|
|
186
180
|
device?: string;
|
|
187
181
|
}
|
|
@@ -22,21 +22,18 @@ import { loadLocalActiveSessions, readActiveSessionsCache, } from '../lib/sessio
|
|
|
22
22
|
import { gatherRemoteList, gatherRemoteToolProgramCounts, gatherRemoteToolSearch, runOnPeer } from '../lib/session/remote-list.js';
|
|
23
23
|
import { gatherRemoteAgentsJson } from '../lib/remote-agents-json.js';
|
|
24
24
|
import { stringWidth, truncateToWidth, padToWidth, terminalWidth } from '../lib/session/width.js';
|
|
25
|
-
import { inferSessionState } from '@phnx-labs/sessions-cli/reader';
|
|
26
25
|
import { discoverSessions, queryIndexedSessions, countSessionsInScope, resolveSessionById, isCompleteSessionId, looksLikeSessionId, searchContentIndex, getSessionRoots, scopeToManaged } from '../lib/session/discover.js';
|
|
27
|
-
import { findSessionsById, querySessions,
|
|
26
|
+
import { findSessionsById, querySessions, readSessionTimelineAny } from '../lib/session/db.js';
|
|
28
27
|
import { foldTimeline, emptyTimelineState, projectTimeline, projectSessionFiles } from '@phnx-labs/sessions-cli/reader';
|
|
29
28
|
import { readSessionTail } from '@phnx-labs/sessions-cli/reader';
|
|
30
29
|
import { liveSessionMetas, fleetExecutionMachineById, reconcileLiveMetaMachine } from '../lib/session/live-metadata.js';
|
|
31
30
|
import { sessionHeadline } from '../lib/session/title.js';
|
|
32
31
|
import { filterTeamSessions, shouldShowTeamSessions, safeTeamText, groupSessionsByTeam, NO_TEAM_GROUP_KEY, } from '@phnx-labs/sessions-cli/reader';
|
|
33
|
-
import { parseSession } from '@phnx-labs/sessions-cli/reader';
|
|
34
32
|
import { runRemoteSessions, buildForwardedArgs, ensureWholeIndex } from '../lib/session/remote.js';
|
|
35
33
|
import { formatRelativeTime, sessionAgeParts } from '../lib/session/relative-time.js';
|
|
36
|
-
import {
|
|
34
|
+
import { linkPath, linkUrl, shortenModel, formatTokenCount } from '@phnx-labs/sessions-cli/reader';
|
|
37
35
|
import { linearIssueUrl } from '@phnx-labs/sessions-cli/reader';
|
|
38
36
|
import { sessionOwnerDevice, RESUME_PINNED_ENV } from '../lib/session/resume-owner.js';
|
|
39
|
-
import { renderMarkdown } from '../lib/markdown.js';
|
|
40
37
|
import { AGENTS, colorAgent, resolveAgentName } from '../lib/agents.js';
|
|
41
38
|
import { getShimsDir } from '../lib/state.js';
|
|
42
39
|
import { listJobs, listJobsWithRuns, listRuns, getRunDir } from '../lib/scheduling/routines.js';
|
|
@@ -50,7 +47,9 @@ import { sessionAgentSupportsResume, sessionRecoveryRunArgs } from '../lib/sessi
|
|
|
50
47
|
import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
51
48
|
import { sessionPicker, buildPreview, loadSessionPreviewDigest, transcriptOnPeerOf, formatTodoCompact, } from './sessions-picker.js';
|
|
52
49
|
import { setHelpSections } from '../lib/help.js';
|
|
53
|
-
import { cleanPreview, gatherActiveSessions, indexActiveBySessionId, isAwaitingUser, liveGlyphAndPreview, liveStatusWord, remoteHostsToDial, requestedLiveStatuses, resolveRoutineName, runLiveRoster, shouldIncludeLocal,
|
|
50
|
+
import { cleanPreview, gatherActiveSessions, indexActiveBySessionId, isAwaitingUser, liveGlyphAndPreview, liveStatusWord, remoteHostsToDial, requestedLiveStatuses, resolveRoutineName, runLiveRoster, shouldIncludeLocal, statusColor, } from './ps-roster.js';
|
|
51
|
+
import { buildFilterOptions, hasAnyFilter, metaSignals, renderSession, resolveViewMode, signalBadges, } from '../lib/session/presentation.js';
|
|
52
|
+
export { buildFilterOptions, renderSession, renderSessionLog, renderSessionLogJson, resolveViewMode, } from '../lib/session/presentation.js';
|
|
54
53
|
import { registerSessionsTailCommand } from './sessions-tail.js';
|
|
55
54
|
import { registerSessionsResumeCommand } from './sessions-resume.js';
|
|
56
55
|
import { registerSessionsForkCommand } from './fork.js';
|
|
@@ -1199,7 +1198,8 @@ async function sessionsAction(query, options, limitSource) {
|
|
|
1199
1198
|
return;
|
|
1200
1199
|
}
|
|
1201
1200
|
if (options.cloud) {
|
|
1202
|
-
await
|
|
1201
|
+
const { runCloudTranscripts } = await import('./cloud-transcripts.js');
|
|
1202
|
+
await runCloudTranscripts(query, options);
|
|
1203
1203
|
return;
|
|
1204
1204
|
}
|
|
1205
1205
|
if (isBareBrowserListing(options, query)) {
|
|
@@ -1575,13 +1575,6 @@ function originTag(session) {
|
|
|
1575
1575
|
return '';
|
|
1576
1576
|
return `[routine${session.routineName ? ` · ${session.routineName}` : ''}] `;
|
|
1577
1577
|
}
|
|
1578
|
-
function metaSignals(s) {
|
|
1579
|
-
return {
|
|
1580
|
-
pr: s.prUrl ? { url: s.prUrl, number: s.prNumber } : undefined,
|
|
1581
|
-
worktree: s.worktreeSlug ? { path: s.cwd ?? '', slug: s.worktreeSlug } : undefined,
|
|
1582
|
-
ticket: s.ticketId ? { id: s.ticketId } : undefined,
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
1578
|
const MIN_TOPIC_W = 16;
|
|
1586
1579
|
function timeCell(age, topicSlack) {
|
|
1587
1580
|
const lastOnly = { plain: age.last, text: chalk.gray(age.last), extraW: 0 };
|
|
@@ -1741,7 +1734,7 @@ function printSessionOverview(pool, hiddenCount, liveIndex, opts) {
|
|
|
1741
1734
|
if (opts.hiddenUnmanaged)
|
|
1742
1735
|
console.log(chalk.gray(formatUnmanagedHiddenFooter(opts.hiddenUnmanaged)));
|
|
1743
1736
|
}
|
|
1744
|
-
function printSessionTable(sessions, hiddenCount = 0, tree = false, liveIndex) {
|
|
1737
|
+
export function printSessionTable(sessions, hiddenCount = 0, tree = false, liveIndex) {
|
|
1745
1738
|
if (tree) {
|
|
1746
1739
|
const byDir = new Map();
|
|
1747
1740
|
for (const s of sessions) {
|
|
@@ -1868,158 +1861,6 @@ function printTeamsView(pool, liveIndex, hiddenUnmanaged = 0) {
|
|
|
1868
1861
|
if (hiddenUnmanaged > 0)
|
|
1869
1862
|
console.log(chalk.gray(formatUnmanagedHiddenFooter(hiddenUnmanaged)));
|
|
1870
1863
|
}
|
|
1871
|
-
function buildFilterOptions(options) {
|
|
1872
|
-
const opts = {};
|
|
1873
|
-
if (options.include)
|
|
1874
|
-
opts.include = parseRoleList(options.include, '--include');
|
|
1875
|
-
if (options.exclude)
|
|
1876
|
-
opts.exclude = parseRoleList(options.exclude, '--exclude');
|
|
1877
|
-
if (opts.include && opts.exclude) {
|
|
1878
|
-
throw new Error('--include and --exclude are mutually exclusive');
|
|
1879
|
-
}
|
|
1880
|
-
const parseCount = (raw, flag) => {
|
|
1881
|
-
const n = Number(raw);
|
|
1882
|
-
if (!Number.isFinite(n) || !Number.isInteger(n) || n <= 0) {
|
|
1883
|
-
throw new Error(`${flag} expects a positive integer, got "${raw}"`);
|
|
1884
|
-
}
|
|
1885
|
-
return n;
|
|
1886
|
-
};
|
|
1887
|
-
if (options.first !== undefined)
|
|
1888
|
-
opts.first = parseCount(options.first, '--first');
|
|
1889
|
-
if (options.last !== undefined)
|
|
1890
|
-
opts.last = parseCount(options.last, '--last');
|
|
1891
|
-
if (opts.first !== undefined && opts.last !== undefined) {
|
|
1892
|
-
throw new Error('--first and --last are mutually exclusive');
|
|
1893
|
-
}
|
|
1894
|
-
return opts;
|
|
1895
|
-
}
|
|
1896
|
-
function hasAnyFilter(opts) {
|
|
1897
|
-
return !!(opts.include?.length || opts.exclude?.length || opts.first !== undefined || opts.last !== undefined);
|
|
1898
|
-
}
|
|
1899
|
-
function resolveViewMode(options, filters) {
|
|
1900
|
-
if (options.markdown)
|
|
1901
|
-
return 'markdown';
|
|
1902
|
-
if (options.json)
|
|
1903
|
-
return 'json';
|
|
1904
|
-
if (hasAnyFilter(filters))
|
|
1905
|
-
return 'markdown';
|
|
1906
|
-
return 'summary';
|
|
1907
|
-
}
|
|
1908
|
-
export async function renderSessionLog(session, mode = 'summary') {
|
|
1909
|
-
await renderSession(session, mode, {});
|
|
1910
|
-
}
|
|
1911
|
-
export async function renderSessionLogJson(session) {
|
|
1912
|
-
await renderSession(session, 'json', {});
|
|
1913
|
-
}
|
|
1914
|
-
function renderArchivedSession(session, mode, options = {}) {
|
|
1915
|
-
const redact = (text) => options.redact !== false ? redactSecrets(text) : text;
|
|
1916
|
-
const content = redact((readSessionContent(session.id) ?? '').trim());
|
|
1917
|
-
const digestRaw = readArchivedSessionPreview(session.id);
|
|
1918
|
-
const digest = digestRaw
|
|
1919
|
-
? { ...digestRaw, lastAssistant: redact(digestRaw.lastAssistant ?? '') }
|
|
1920
|
-
: undefined;
|
|
1921
|
-
if (mode === 'json') {
|
|
1922
|
-
console.log(JSON.stringify({
|
|
1923
|
-
session: {
|
|
1924
|
-
...session,
|
|
1925
|
-
topic: session.topic != null ? redact(session.topic) : session.topic,
|
|
1926
|
-
label: session.label != null ? redact(session.label) : session.label,
|
|
1927
|
-
plan: session.plan != null ? redact(session.plan) : session.plan,
|
|
1928
|
-
archived: true,
|
|
1929
|
-
},
|
|
1930
|
-
archived: true,
|
|
1931
|
-
userContent: content,
|
|
1932
|
-
preview: digest ?? null,
|
|
1933
|
-
}, null, 2));
|
|
1934
|
-
return;
|
|
1935
|
-
}
|
|
1936
|
-
const shown = sessionDisplayAgent(session);
|
|
1937
|
-
const agentColor = colorAgent(shown);
|
|
1938
|
-
const absTime = formatAbsoluteTime(session.timestamp);
|
|
1939
|
-
const title = sessionHeadline(session);
|
|
1940
|
-
console.log('');
|
|
1941
|
-
if (title)
|
|
1942
|
-
console.log(chalk.bold.white(title));
|
|
1943
|
-
console.log(agentColor(shown) +
|
|
1944
|
-
(session.version ? chalk.yellow(` ${session.version}`) : '') +
|
|
1945
|
-
(session.project ? chalk.cyan(` ${session.project}`) : '') +
|
|
1946
|
-
chalk.gray(` ${absTime} (${formatRelativeTime(session.timestamp)})`) +
|
|
1947
|
-
(session.account ? chalk.gray(` · ${session.account}`) : ''));
|
|
1948
|
-
console.log(chalk.yellow('archived — transcript file removed; user turns served from the local DB'));
|
|
1949
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1950
|
-
console.log(chalk.cyan('User:'));
|
|
1951
|
-
console.log(content);
|
|
1952
|
-
if (digest?.lastAssistant?.trim()) {
|
|
1953
|
-
console.log('');
|
|
1954
|
-
console.log(chalk.magenta('Last assistant:'));
|
|
1955
|
-
console.log(digest.lastAssistant.trim());
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
async function renderSession(session, mode, filters, options = {}) {
|
|
1959
|
-
const { hydrateSessionTranscript, findLocalSessionTranscripts } = await import('../lib/session/discover.js');
|
|
1960
|
-
session = await hydrateSessionTranscript(session);
|
|
1961
|
-
const realPath = session.filePath.split('#')[0];
|
|
1962
|
-
if (!fs.existsSync(realPath)) {
|
|
1963
|
-
const archivedContent = readSessionContent(session.id);
|
|
1964
|
-
if (archivedContent && archivedContent.trim() !== '') {
|
|
1965
|
-
renderArchivedSession(session, mode, options);
|
|
1966
|
-
return;
|
|
1967
|
-
}
|
|
1968
|
-
process.exitCode = 1;
|
|
1969
|
-
console.log(chalk.yellow('Session transcript is unavailable after checking its recorded home and the session index.'));
|
|
1970
|
-
console.log(chalk.gray(`Path: ${session.filePath}`));
|
|
1971
|
-
if (session.version)
|
|
1972
|
-
console.log(chalk.gray(`Version: ${sessionDisplayAgent(session)} ${session.version}`));
|
|
1973
|
-
if (session.project)
|
|
1974
|
-
console.log(chalk.gray(`Project: ${session.project}`));
|
|
1975
|
-
if (session.account)
|
|
1976
|
-
console.log(chalk.gray(`Account: ${session.account}`));
|
|
1977
|
-
console.log(chalk.gray(`Time: ${session.timestamp}`));
|
|
1978
|
-
return;
|
|
1979
|
-
}
|
|
1980
|
-
const spinner = ora(`Parsing ${sessionDisplayAgent(session)} session...`).start();
|
|
1981
|
-
const parsedEvents = parseSession(session.filePath, session.agent);
|
|
1982
|
-
spinner.stop();
|
|
1983
|
-
let events = filterEvents(parsedEvents, filters);
|
|
1984
|
-
const shown = sessionDisplayAgent(session);
|
|
1985
|
-
const agentColor = colorAgent(shown);
|
|
1986
|
-
console.log('');
|
|
1987
|
-
if (mode === 'summary') {
|
|
1988
|
-
const stats = computeSummaryStats(events);
|
|
1989
|
-
const modelStr = stats.models.length > 0 ? chalk.yellow(` ${stats.models.join(', ')}`) : '';
|
|
1990
|
-
const branchStr = session.gitBranch ? chalk.gray(` (${session.gitBranch})`) : '';
|
|
1991
|
-
const absTime = formatAbsoluteTime(session.timestamp);
|
|
1992
|
-
const title = sessionHeadline(session);
|
|
1993
|
-
if (title) {
|
|
1994
|
-
const badges = signalBadges(metaSignals(session));
|
|
1995
|
-
console.log(chalk.bold.white(title) + (badges ? ' ' + badges : ''));
|
|
1996
|
-
}
|
|
1997
|
-
console.log(agentColor(shown) +
|
|
1998
|
-
(session.version ? chalk.yellow(` ${session.version}`) : '') +
|
|
1999
|
-
modelStr +
|
|
2000
|
-
(session.project ? chalk.cyan(` ${session.project}`) + branchStr : branchStr) +
|
|
2001
|
-
chalk.gray(` ${absTime} (${formatRelativeTime(session.timestamp)})`) +
|
|
2002
|
-
(session.account ? chalk.gray(` · ${session.account}`) : ''));
|
|
2003
|
-
const statsLine = renderSummaryHeader(stats);
|
|
2004
|
-
if (statsLine)
|
|
2005
|
-
console.log(chalk.gray(statsLine));
|
|
2006
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
2007
|
-
process.stdout.write(renderSummary(events, session.cwd));
|
|
2008
|
-
return;
|
|
2009
|
-
}
|
|
2010
|
-
if (mode === 'markdown') {
|
|
2011
|
-
console.log(agentColor(shown) +
|
|
2012
|
-
(session.version ? chalk.yellow(` ${session.version}`) : '') +
|
|
2013
|
-
(session.project ? chalk.cyan(` ${session.project}`) : '') +
|
|
2014
|
-
chalk.gray(` ${formatRelativeTime(session.timestamp)}`) +
|
|
2015
|
-
(session.account ? chalk.gray(` (${session.account})`) : ''));
|
|
2016
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
2017
|
-
process.stdout.write(renderMarkdown(renderConversationMarkdown(events, { redact: options.redact !== false })));
|
|
2018
|
-
return;
|
|
2019
|
-
}
|
|
2020
|
-
const todos = inferSessionState(parsedEvents, { cwd: session.cwd }).todos;
|
|
2021
|
-
process.stdout.write(renderJson(events, todos ? { ...session, todos } : session, { redact: options.redact !== false }));
|
|
2022
|
-
}
|
|
2023
1864
|
function renderTopicCell(label, topic, query, visibleWidth, paddedWidth) {
|
|
2024
1865
|
const lbl = (label ?? '').trim();
|
|
2025
1866
|
const tpc = (topic ?? '').trim();
|
|
@@ -2346,66 +2187,6 @@ export function buildResumeCommand(session) {
|
|
|
2346
2187
|
return null;
|
|
2347
2188
|
}
|
|
2348
2189
|
}
|
|
2349
|
-
async function runCloudSessions(query, options) {
|
|
2350
|
-
const { discoverCloudSessions, ensureCloudSessionCached } = await import('../lib/session/cloud.js');
|
|
2351
|
-
let filterOpts;
|
|
2352
|
-
try {
|
|
2353
|
-
filterOpts = buildFilterOptions(options);
|
|
2354
|
-
}
|
|
2355
|
-
catch (err) {
|
|
2356
|
-
console.error(chalk.red(err.message));
|
|
2357
|
-
process.exit(1);
|
|
2358
|
-
}
|
|
2359
|
-
const mode = resolveViewMode(options, filterOpts);
|
|
2360
|
-
const spinner = options.json ? null : interruptibleSpinner('Loading cloud sessions...').start();
|
|
2361
|
-
let sessions;
|
|
2362
|
-
try {
|
|
2363
|
-
sessions = await discoverCloudSessions({ limit: parseInt(options.limit || '50', 10) });
|
|
2364
|
-
}
|
|
2365
|
-
catch (err) {
|
|
2366
|
-
spinner?.stop();
|
|
2367
|
-
console.error(chalk.red(`Failed to list cloud sessions: ${err?.message || err}`));
|
|
2368
|
-
process.exit(1);
|
|
2369
|
-
}
|
|
2370
|
-
spinner?.stop();
|
|
2371
|
-
if (!query) {
|
|
2372
|
-
if (options.json) {
|
|
2373
|
-
process.stdout.write(JSON.stringify(sessions, null, 2) + '\n');
|
|
2374
|
-
return;
|
|
2375
|
-
}
|
|
2376
|
-
if (sessions.length === 0) {
|
|
2377
|
-
console.log(chalk.gray('No cloud sessions captured yet.'));
|
|
2378
|
-
return;
|
|
2379
|
-
}
|
|
2380
|
-
printSessionTable(sessions);
|
|
2381
|
-
return;
|
|
2382
|
-
}
|
|
2383
|
-
const matches = sessions.filter((s) => s.id === query || s.shortId === query || s.id.startsWith(query));
|
|
2384
|
-
if (matches.length === 0) {
|
|
2385
|
-
console.error(chalk.red(`No cloud session matching: ${query}`));
|
|
2386
|
-
process.exit(1);
|
|
2387
|
-
}
|
|
2388
|
-
if (matches.length > 1) {
|
|
2389
|
-
console.error(chalk.red(`Multiple cloud sessions match "${query}":`));
|
|
2390
|
-
for (const m of matches.slice(0, 10)) {
|
|
2391
|
-
console.error(chalk.cyan(` ${m.shortId} ${m.id}`));
|
|
2392
|
-
}
|
|
2393
|
-
process.exit(1);
|
|
2394
|
-
}
|
|
2395
|
-
const meta = matches[0];
|
|
2396
|
-
const cachedSpinner = options.json ? null : interruptibleSpinner('Fetching session...').start();
|
|
2397
|
-
let cachedPath;
|
|
2398
|
-
try {
|
|
2399
|
-
cachedPath = await ensureCloudSessionCached(meta.id);
|
|
2400
|
-
}
|
|
2401
|
-
catch (err) {
|
|
2402
|
-
cachedSpinner?.stop();
|
|
2403
|
-
console.error(chalk.red(`Failed to fetch session: ${err?.message || err}`));
|
|
2404
|
-
process.exit(1);
|
|
2405
|
-
}
|
|
2406
|
-
cachedSpinner?.stop();
|
|
2407
|
-
await renderSession({ ...meta, filePath: cachedPath }, mode, filterOpts, options);
|
|
2408
|
-
}
|
|
2409
2190
|
export function resolveSessionAgentName(name) {
|
|
2410
2191
|
const normalized = name.toLowerCase();
|
|
2411
2192
|
if (SESSION_AGENTS.includes(normalized)) {
|
|
@@ -3510,12 +3291,3 @@ function sessionDistance(session, historyEntry) {
|
|
|
3510
3291
|
return Number.MAX_SAFE_INTEGER;
|
|
3511
3292
|
return Math.abs(sessionTime - historyEntry.timestampMs);
|
|
3512
3293
|
}
|
|
3513
|
-
function formatAbsoluteTime(isoTimestamp) {
|
|
3514
|
-
const d = new Date(isoTimestamp);
|
|
3515
|
-
if (isNaN(d.getTime()))
|
|
3516
|
-
return isoTimestamp;
|
|
3517
|
-
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
3518
|
-
const hh = String(d.getHours()).padStart(2, '0');
|
|
3519
|
-
const mm = String(d.getMinutes()).padStart(2, '0');
|
|
3520
|
-
return `${months[d.getMonth()]} ${d.getDate()} ${hh}:${mm}`;
|
|
3521
|
-
}
|
|
@@ -2,8 +2,7 @@ import { openSetupTerminal } from './setup-terminal.js';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import { installComputerHelperMacLocal, activateComputerHelperMacLocal, probeComputerTrust, } from '
|
|
6
|
-
import { resolveComputerBin, ComputerClientError } from '../lib/computer-client.js';
|
|
5
|
+
import { installComputerHelperMacLocal, activateComputerHelperMacLocal, probeComputerTrust, resolveComputerBin, ComputerClientError, } from '../lib/computer-client.js';
|
|
7
6
|
import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
8
7
|
import { installSetupTool } from '../lib/setup-tool-install.js';
|
|
9
8
|
import { refreshToolSetup } from '../lib/setup-tool-status.js';
|
|
@@ -10,7 +10,6 @@ const DISABLEABLE_FEATURES = [
|
|
|
10
10
|
{ name: 'computer', hint: 'drive native desktop apps' },
|
|
11
11
|
{ name: 'secrets', hint: 'keychain-backed env bundles' },
|
|
12
12
|
{ name: 'routines', hint: 'run agents on a cron schedule' },
|
|
13
|
-
{ name: 'monitors', hint: 'event-triggered watchers' },
|
|
14
13
|
];
|
|
15
14
|
async function runMineWizard() {
|
|
16
15
|
if (!isInteractiveTerminal()) {
|
package/dist/commands/setup.js
CHANGED
|
@@ -27,7 +27,7 @@ import { registerBetaCommands } from './beta.js';
|
|
|
27
27
|
import { addUrlSchemeSubcommands } from './open.js';
|
|
28
28
|
import { runPreferencesStep } from './setup-preferences.js';
|
|
29
29
|
import { browserInstalled } from '../lib/browser-client.js';
|
|
30
|
-
import { probeComputerTrust } from '
|
|
30
|
+
import { probeComputerTrust } from '../lib/computer-client.js';
|
|
31
31
|
import { loadDevices } from '../lib/devices/registry.js';
|
|
32
32
|
import { getConfigValue } from '../lib/device-config.js';
|
|
33
33
|
import { setupSecretsPrefsPath } from './setup-secrets.js';
|
package/dist/commands/sync.js
CHANGED
|
@@ -17,6 +17,8 @@ import { addHostOption } from '../lib/hosts/option.js';
|
|
|
17
17
|
import { syncRepoGit, adoptUserRepoIfNeeded, recordUserRepoRemote, resolveUserRepoRemoteUrl } from '../lib/git.js';
|
|
18
18
|
import { getSystemAgentsDir, getUserAgentsDir, getEnabledExtraRepos } from '../lib/state.js';
|
|
19
19
|
import { registerStatusCommand } from './status.js';
|
|
20
|
+
import { setHelpSections } from '../lib/help.js';
|
|
21
|
+
import { pruneRepoRemovals } from '../lib/sync-delete.js';
|
|
20
22
|
function emitJson(payload) {
|
|
21
23
|
console.log(JSON.stringify(payload));
|
|
22
24
|
}
|
|
@@ -129,10 +131,32 @@ export function registerSyncCommand(program) {
|
|
|
129
131
|
.option('--cloud', 'Umbrella: fetch all remote state but skip the local reconcile', false)
|
|
130
132
|
.option('--local', "Umbrella: reconcile resources into installed agents only (no fetch)", false)
|
|
131
133
|
.option('--prune-clis', 'Umbrella: also purge stale/legacy agents-cli installs (npx-cache, pre-1.22.30, unsafe helper) when a fixed peer exists. DESTRUCTIVE and off by default — the purge never runs on a routine sync.', false)
|
|
134
|
+
.option('--delete', 'Also remove what a repo deleted: trash plugins, commands and skills that came from that repo and no longer exist in it. Needs a repo (agents sync <repo> --delete); resources from other repos or installed by hand are kept', false)
|
|
132
135
|
.action(async (agentSpec, repo, opts) => {
|
|
133
136
|
await runSync(agentSpec, repo, opts);
|
|
134
137
|
});
|
|
135
138
|
addSelectorOptions(cmd);
|
|
139
|
+
setHelpSections(cmd, {
|
|
140
|
+
examples: `
|
|
141
|
+
# Make this machine current (fetch repos, reconcile every installed agent)
|
|
142
|
+
agents sync
|
|
143
|
+
|
|
144
|
+
# Sync one agent, without prompts
|
|
145
|
+
agents sync claude --yes
|
|
146
|
+
|
|
147
|
+
# Only the system repo's resources, into every installed Claude
|
|
148
|
+
agents sync claude@all system
|
|
149
|
+
|
|
150
|
+
# Preview, then remove what the user repo deleted (plugins, commands, skills)
|
|
151
|
+
agents sync claude user --delete --dry-run
|
|
152
|
+
agents sync claude user --delete --yes
|
|
153
|
+
`,
|
|
154
|
+
notes: `
|
|
155
|
+
- --delete covers plugins, commands and skills (hooks, MCP, subagents, rules and workflows are left alone). It only removes one whose recorded source is in the named repo and is gone from it. Anything from another repo, or with no recorded source (installed by hand), is kept and counted as "kept".
|
|
156
|
+
- Removed items go to ~/.agents/.history/trash/, so they can be restored.
|
|
157
|
+
- Without --delete, sync behaves as before: run --delete to clear what a repo removed after a skipped or partial sync.
|
|
158
|
+
`,
|
|
159
|
+
});
|
|
136
160
|
registerStatusCommand(cmd);
|
|
137
161
|
}
|
|
138
162
|
function resolveRepoGitTarget(repo) {
|
|
@@ -427,6 +451,53 @@ async function runUmbrella(opts, quiet, outLog, errLog, json = false) {
|
|
|
427
451
|
process.exitCode = 1;
|
|
428
452
|
}
|
|
429
453
|
}
|
|
454
|
+
function allInstalledTargets() {
|
|
455
|
+
return MANAGED_AGENT_IDS.flatMap((agent) => listInstalledVersions(agent).map((version) => ({ agent, version })));
|
|
456
|
+
}
|
|
457
|
+
function runDeletePass(repo, targets, cwd, dryRun, json, outLog, errLog) {
|
|
458
|
+
const reports = [];
|
|
459
|
+
try {
|
|
460
|
+
for (const { agent, version } of targets)
|
|
461
|
+
reports.push(pruneRepoRemovals({ agent, version, repo, cwd, dryRun }));
|
|
462
|
+
}
|
|
463
|
+
catch (err) {
|
|
464
|
+
if (json)
|
|
465
|
+
emitJson({ ok: false, mode: 'delete', repo, dryRun, error: err.message });
|
|
466
|
+
errLog(chalk.red(`sync --delete: ${err.message}`));
|
|
467
|
+
process.exitCode = 1;
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
if (json) {
|
|
471
|
+
emitJson({ ok: true, mode: 'delete', repo, dryRun, versions: reports });
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
const verb = dryRun ? 'Would remove' : 'Removed';
|
|
475
|
+
let any = false;
|
|
476
|
+
for (const r of reports) {
|
|
477
|
+
const items = [
|
|
478
|
+
...r.removed.plugins.map((n) => `plugin ${n}`),
|
|
479
|
+
...r.removed.commands.map((n) => `command ${n}`),
|
|
480
|
+
...r.removed.skills.map((n) => `skill ${n}`),
|
|
481
|
+
];
|
|
482
|
+
if (items.length > 0) {
|
|
483
|
+
any = true;
|
|
484
|
+
outLog(chalk.yellow(`${verb} from ${agentLabel(r.agent)}@${r.version} (deleted from ${repo}): ${items.join(', ')}`));
|
|
485
|
+
}
|
|
486
|
+
const kept = [];
|
|
487
|
+
if (r.kept.notFromRepo.length > 0)
|
|
488
|
+
kept.push(`${r.kept.notFromRepo.length} not from ${repo}`);
|
|
489
|
+
if (r.kept.stillProvided.length > 0)
|
|
490
|
+
kept.push(`${r.kept.stillProvided.length} still provided by another repo (${r.kept.stillProvided.join(', ')})`);
|
|
491
|
+
if (items.length > 0 || r.kept.stillProvided.length > 0) {
|
|
492
|
+
outLog(chalk.gray(` kept: ${kept.join(', ') || 'nothing else'}`));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (!any)
|
|
496
|
+
outLog(chalk.gray(`Nothing deleted from ${repo} is still installed (${targets.length} version(s) checked).`));
|
|
497
|
+
else if (!dryRun)
|
|
498
|
+
outLog(chalk.gray(' Trashed under ~/.agents/.history/trash/ (recoverable).'));
|
|
499
|
+
return true;
|
|
500
|
+
}
|
|
430
501
|
async function runSync(agentSpec, repoArg, opts) {
|
|
431
502
|
const json = !!opts.json;
|
|
432
503
|
const quiet = !!opts.quiet || json;
|
|
@@ -438,6 +509,20 @@ async function runSync(agentSpec, repoArg, opts) {
|
|
|
438
509
|
if (json)
|
|
439
510
|
emitJson({ ok: false, ...payload });
|
|
440
511
|
};
|
|
512
|
+
const repoOnlySpec = agentSpec && !opts.agent && !repoArg && listRepoNames().includes(agentSpec) ? agentSpec : undefined;
|
|
513
|
+
const deleteRepo = opts.delete ? (opts.repo || repoArg || repoOnlySpec) : undefined;
|
|
514
|
+
if (opts.delete && !deleteRepo) {
|
|
515
|
+
const error = '--delete needs a repo: it only removes what that repo deleted.';
|
|
516
|
+
const hint = 'Name one: agents sync <repo> --delete, agents sync <agent> <repo> --delete, or --repo <repo> --delete (repos: ' + listRepoNames().join(', ') + ')';
|
|
517
|
+
failJson({ mode: 'delete', error, hint });
|
|
518
|
+
if (!json) {
|
|
519
|
+
console.error(chalk.red(error));
|
|
520
|
+
console.error(chalk.gray(hint));
|
|
521
|
+
}
|
|
522
|
+
process.exitCode = 1;
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const deleteCwd = opts.cwd || process.cwd();
|
|
441
526
|
let agentId;
|
|
442
527
|
let version;
|
|
443
528
|
let selector;
|
|
@@ -445,7 +530,11 @@ async function runSync(agentSpec, repoArg, opts) {
|
|
|
445
530
|
if (!quiet && !json) {
|
|
446
531
|
console.error(chalk.yellow(`Warning: 'agents sync ${agentSpec}' is deprecated. Use: agents repo sync ${agentSpec}`));
|
|
447
532
|
}
|
|
448
|
-
|
|
533
|
+
if (!(deleteRepo && opts.dryRun))
|
|
534
|
+
await runRepoGitSync(agentSpec, quiet, outLog, errLog, json);
|
|
535
|
+
if (deleteRepo && process.exitCode !== 1) {
|
|
536
|
+
runDeletePass(deleteRepo, allInstalledTargets(), deleteCwd, !!opts.dryRun, json, outLog, errLog);
|
|
537
|
+
}
|
|
449
538
|
return;
|
|
450
539
|
}
|
|
451
540
|
if (agentSpec) {
|
|
@@ -504,7 +593,14 @@ async function runSync(agentSpec, repoArg, opts) {
|
|
|
504
593
|
version = opts.agentVersion;
|
|
505
594
|
}
|
|
506
595
|
if (!agentId) {
|
|
596
|
+
if (deleteRepo && opts.dryRun) {
|
|
597
|
+
runDeletePass(deleteRepo, allInstalledTargets(), deleteCwd, true, json, outLog, errLog);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
507
600
|
await runUmbrella(opts, quiet, outLog, errLog, json);
|
|
601
|
+
if (deleteRepo && process.exitCode !== 1) {
|
|
602
|
+
runDeletePass(deleteRepo, allInstalledTargets(), deleteCwd, false, json, outLog, errLog);
|
|
603
|
+
}
|
|
508
604
|
return;
|
|
509
605
|
}
|
|
510
606
|
const projectDir = opts.projectDir;
|
|
@@ -562,6 +658,8 @@ async function runSync(agentSpec, repoArg, opts) {
|
|
|
562
658
|
const scopeLabel = repoScope ? chalk.gray(` (repo: ${repoScope})`) : '';
|
|
563
659
|
if (!json)
|
|
564
660
|
outLog(chalk.cyan(`Syncing ${installed.length} ${agentLabel(agentId)} version(s)${scopeLabel}.`));
|
|
661
|
+
if (deleteRepo && !runDeletePass(deleteRepo, installed.map((v) => ({ agent: agentId, version: v })), cwd, !!opts.dryRun, json, outLog, errLog))
|
|
662
|
+
return;
|
|
565
663
|
if (opts.dryRun) {
|
|
566
664
|
if (!quiet && !json) {
|
|
567
665
|
console.log(chalk.cyan(`Dry run — would sync ${agentLabel(agentId)} (${installed.length} version(s))${scopeLabel}:`));
|
|
@@ -680,6 +778,8 @@ async function runSync(agentSpec, repoArg, opts) {
|
|
|
680
778
|
process.exitCode = 1;
|
|
681
779
|
return;
|
|
682
780
|
}
|
|
781
|
+
if (deleteRepo && !runDeletePass(deleteRepo, [{ agent: agentId, version }], cwd, !!opts.dryRun, json, outLog, errLog))
|
|
782
|
+
return;
|
|
683
783
|
if (opts.launch) {
|
|
684
784
|
runLaunchMode(agentId, version, cwd, quiet, json);
|
|
685
785
|
return;
|
package/dist/commands/teams.js
CHANGED
|
@@ -30,7 +30,7 @@ import { machineId } from '../lib/session/sync/config.js';
|
|
|
30
30
|
import { isVersionInstalled, resolveVersionAlias, resolveVersionAliasLoose } from '../lib/installations/versions.js';
|
|
31
31
|
import { AGENTS, warnAgentDeprecated } from '../lib/agents.js';
|
|
32
32
|
import { discoverSessions, parseTimeFilter, resolveSessionById } from '../lib/session/discover.js';
|
|
33
|
-
import { renderSessionLog } from '
|
|
33
|
+
import { renderSessionLog } from '../lib/session/presentation.js';
|
|
34
34
|
import { buildPreview as buildSessionPreview } from './sessions-picker.js';
|
|
35
35
|
import { parseExecEnv } from '../lib/exec.js';
|
|
36
36
|
import { checkRunAccountReadiness } from '../lib/accounting/rotate.js';
|
|
@@ -1268,7 +1268,7 @@ export function registerTeamsCommands(program) {
|
|
|
1268
1268
|
.alias('a')
|
|
1269
1269
|
.description("Add a teammate to work on a task. Runs in background; returns immediately. Use 'status' to check in.")
|
|
1270
1270
|
.option('-n, --name <name>', 'Friendly name for this teammate (e.g. alice). Required if using --after. Unique within team.')
|
|
1271
|
-
.option('-m, --mode <mode>', `Permissions: plan (read-only) | edit (can write files) | auto (more autonomous than edit, mechanism per-harness — see 'agents
|
|
1271
|
+
.option('-m, --mode <mode>', `Permissions: plan (read-only) | edit (can write files) | auto (more autonomous than edit, mechanism per-harness — see 'agents run --help') | skip (bypass all permission prompts). 'full' accepted as alias for skip. Teammates run headless: plan works headless on claude/codex/cursor/droid/opencode; kimi/grok/antigravity have no headless plan mode and auto-downgrade a plan request to auto.`, 'edit')
|
|
1272
1272
|
.option('-e, --effort <effort>', `Reasoning intensity: ${VALID_EFFORTS.join('|')}`, 'medium')
|
|
1273
1273
|
.option('--model <model>', 'Cost tier (cheap|default|best|ultra) or a concrete id (e.g. claude-opus-4-8); tiers resolve per harness+version to a supported model')
|
|
1274
1274
|
.option('--env <key=value>', 'Set an environment variable for this teammate (repeatable for multiple vars)', (val, prev) => [...prev, val], [])
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FeedHub } from '../../lib/feed/hub.js';
|
|
2
|
+
import { FeedHubServer } from '../../lib/feed/hub-server.js';
|
|
3
|
+
import { watchFleetFeed, watchLocalFeed } from '../../lib/feed/watch.js';
|
|
4
|
+
import { machineId } from '../../lib/machine-id.js';
|
|
5
|
+
const local = new FeedHub({
|
|
6
|
+
watch: ({ signal, emit }) => watchLocalFeed({ scope: machineId(), signal, emit, sessions: { heartbeatMs: 200 } }),
|
|
7
|
+
});
|
|
8
|
+
const server = new FeedHubServer(new FeedHub({ watch: watchFleetFeed }), undefined, local);
|
|
9
|
+
await server.start();
|
|
10
|
+
process.stdout.write('ready\n');
|
|
11
|
+
process.once('SIGTERM', () => { void server.stop().then(() => process.exit(0)); });
|
package/dist/commands/trash.d.ts
CHANGED