@phnx-labs/agents-cli 1.23.28 → 1.23.30
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 +10 -0
- package/README.md +33 -82
- package/dist/bootstrap.js +0 -17
- package/dist/cli/command-registry.js +0 -2
- package/dist/commands/cloud.js +0 -58
- package/dist/commands/config.js +0 -4
- package/dist/commands/daemon-index.js +1 -1
- package/dist/commands/daemon.js +14 -63
- package/dist/commands/doctor.js +0 -12
- package/dist/commands/events.js +1 -1
- package/dist/commands/feed.d.ts +1 -3
- package/dist/commands/feed.js +1 -6
- package/dist/commands/fleet-capture.js +2 -4
- package/dist/commands/focus.d.ts +0 -1
- package/dist/commands/focus.js +2 -4
- package/dist/commands/inspect.d.ts +1 -19
- package/dist/commands/inspect.js +8 -474
- package/dist/commands/mine.js +1 -1
- package/dist/commands/prune.js +2 -64
- package/dist/commands/ps-roster.d.ts +0 -4
- package/dist/commands/ps-roster.js +2 -30
- package/dist/commands/ps.js +1 -4
- package/dist/commands/repo.d.ts +1 -1
- package/dist/commands/repo.js +4 -4
- package/dist/commands/sessions-browser.d.ts +0 -2
- package/dist/commands/sessions-browser.js +2 -32
- package/dist/commands/sessions-optimize.js +3 -4
- package/dist/commands/setup-mine.js +0 -1
- package/dist/commands/ssh.js +8 -9
- package/dist/commands/sync.js +1 -1
- package/dist/commands/update.js +2 -2
- package/dist/commands/watchdog.js +3 -4
- package/dist/lib/accounting/rotate.d.ts +0 -2
- package/dist/lib/accounting/rotate.js +1 -4
- package/dist/lib/agent-spec/agents.d.ts +0 -1
- package/dist/lib/agent-spec/agents.js +0 -8
- package/dist/lib/answer-router.d.ts +1 -1
- package/dist/lib/answer-router.js +9 -10
- package/dist/lib/auth-health.d.ts +0 -1
- package/dist/lib/auth-health.js +0 -3
- package/dist/lib/cli-entry.d.ts +0 -1
- package/dist/lib/cli-entry.js +0 -36
- package/dist/lib/cloud/types.d.ts +0 -2
- package/dist/lib/config-keys.d.ts +1 -1
- package/dist/lib/config-keys.js +1 -4
- package/dist/lib/daemon/daemon.d.ts +0 -4
- package/dist/lib/daemon/daemon.js +6 -202
- package/dist/lib/daemon/heartbeat-service.d.ts +1 -1
- package/dist/lib/daemon/heartbeat-service.js +1 -8
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +1 -11
- package/dist/lib/device-config.d.ts +0 -2
- package/dist/lib/device-config.js +4 -22
- package/dist/lib/devices/config-migration.js +1 -3
- package/dist/lib/exec.d.ts +2 -5
- package/dist/lib/exec.js +18 -18
- package/dist/lib/factory/snapshot.d.ts +0 -5
- package/dist/lib/factory/snapshot.js +1 -28
- package/dist/lib/feed/events.d.ts +1 -11
- package/dist/lib/feed/events.js +0 -20
- package/dist/lib/feed/feed.d.ts +1 -3
- package/dist/lib/feed/feed.js +18 -1
- package/dist/lib/feed-outcome.d.ts +0 -2
- package/dist/lib/feed-outcome.js +0 -5
- package/dist/lib/fleet/capture.d.ts +0 -1
- package/dist/lib/fleet/capture.js +0 -3
- package/dist/lib/fleet/manifest.js +0 -6
- package/dist/lib/fleet/types.d.ts +0 -1
- package/dist/lib/harness/adapter.d.ts +0 -7
- package/dist/lib/harness/adapters/claude.js +0 -18
- package/dist/lib/harness/adapters/codex.js +0 -10
- package/dist/lib/harness/adapters/cursor.js +0 -11
- package/dist/lib/harness/adapters/kimi.js +0 -3
- package/dist/lib/harness/adapters/muse.js +0 -11
- package/dist/lib/harness/index.d.ts +1 -1
- package/dist/lib/harness/index.js +0 -2
- package/dist/lib/hosts/passthrough.js +2 -10
- package/dist/lib/hosts/ready.d.ts +0 -4
- package/dist/lib/hosts/ready.js +0 -9
- package/dist/lib/hosts/reconcile.d.ts +0 -1
- package/dist/lib/hosts/reconcile.js +0 -8
- package/dist/lib/installations/migrate.d.ts +0 -2
- package/dist/lib/installations/migrate.js +0 -145
- package/dist/lib/loop.js +1 -2
- package/dist/lib/menubar/snapshot.d.ts +0 -1
- package/dist/lib/menubar/snapshot.js +1 -4
- package/dist/lib/placement.d.ts +1 -2
- package/dist/lib/placement.js +4 -24
- package/dist/lib/profiles.d.ts +0 -1
- package/dist/lib/profiles.js +0 -6
- package/dist/lib/session/active.d.ts +4 -3
- package/dist/lib/session/active.js +3 -4
- package/dist/lib/session/db.d.ts +7 -5
- package/dist/lib/session/db.js +11 -14
- package/dist/lib/session/discover.d.ts +3 -2
- package/dist/lib/session/discover.js +12 -129
- package/dist/lib/session/live-metadata.js +0 -2
- package/dist/lib/session/presentation.d.ts +0 -1
- package/dist/lib/session/presentation.js +3 -8
- package/dist/lib/session/selection.d.ts +0 -2
- package/dist/lib/session/selection.js +2 -12
- package/dist/lib/session/session-cache.d.ts +2 -1
- package/dist/lib/session/session-cache.js +1 -0
- package/dist/lib/session/title.d.ts +10 -0
- package/dist/lib/session/title.js +9 -0
- package/dist/lib/staleness/detectors/commands.d.ts +1 -1
- package/dist/lib/staleness/detectors/hooks.d.ts +1 -1
- package/dist/lib/staleness/detectors/mcp.d.ts +1 -1
- package/dist/lib/staleness/detectors/permissions.d.ts +1 -1
- package/dist/lib/staleness/detectors/plugins.d.ts +1 -1
- package/dist/lib/staleness/detectors/rules.d.ts +1 -1
- package/dist/lib/staleness/detectors/skills.d.ts +1 -1
- package/dist/lib/staleness/detectors/subagents.d.ts +1 -1
- package/dist/lib/staleness/detectors/workflows.d.ts +1 -1
- package/dist/lib/staleness/writers/commands.d.ts +1 -1
- package/dist/lib/staleness/writers/hooks.d.ts +1 -1
- package/dist/lib/staleness/writers/mcp.d.ts +1 -1
- package/dist/lib/staleness/writers/permissions.d.ts +1 -1
- package/dist/lib/staleness/writers/plugins.d.ts +1 -1
- package/dist/lib/staleness/writers/rules.d.ts +1 -1
- package/dist/lib/staleness/writers/skills.d.ts +1 -1
- package/dist/lib/staleness/writers/subagents.d.ts +1 -1
- package/dist/lib/staleness/writers/workflows.d.ts +1 -1
- package/dist/lib/startup/command-registry.js +5 -2
- package/dist/lib/state.d.ts +0 -3
- package/dist/lib/state.js +2 -25
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/watchdog/runner.d.ts +0 -2
- package/dist/lib/watchdog/runner.js +0 -2
- package/package.json +2 -2
- package/scripts/postinstall.js +2 -2
- package/dist/commands/routines.d.ts +0 -14
- package/dist/commands/routines.js +0 -2149
- package/dist/commands/routines.test-fixture.d.ts +0 -52
- package/dist/commands/routines.test-fixture.js +0 -254
- package/dist/lib/catchup.d.ts +0 -19
- package/dist/lib/catchup.js +0 -83
- package/dist/lib/daemon/catchup-service.d.ts +0 -18
- package/dist/lib/daemon/catchup-service.js +0 -21
- package/dist/lib/daemon/runner.d.ts +0 -91
- package/dist/lib/daemon/runner.js +0 -1927
- package/dist/lib/harness/adapters/droid.d.ts +0 -2
- package/dist/lib/harness/adapters/droid.js +0 -14
- package/dist/lib/overdue.d.ts +0 -9
- package/dist/lib/overdue.js +0 -74
- package/dist/lib/routine-activation.d.ts +0 -13
- package/dist/lib/routine-activation.js +0 -117
- package/dist/lib/routine-context.d.ts +0 -59
- package/dist/lib/routine-context.js +0 -181
- package/dist/lib/routine-notify-owner.d.ts +0 -4
- package/dist/lib/routine-notify-owner.js +0 -49
- package/dist/lib/routine-notify.d.ts +0 -17
- package/dist/lib/routine-notify.js +0 -138
- package/dist/lib/routine-process-cleanup.d.ts +0 -9
- package/dist/lib/routine-process-cleanup.js +0 -81
- package/dist/lib/routine-readiness.d.ts +0 -31
- package/dist/lib/routine-readiness.js +0 -256
- package/dist/lib/routines-format.d.ts +0 -7
- package/dist/lib/routines-format.js +0 -127
- package/dist/lib/routines-placement.d.ts +0 -16
- package/dist/lib/routines-placement.js +0 -60
- package/dist/lib/routines-project.d.ts +0 -49
- package/dist/lib/routines-project.js +0 -306
- package/dist/lib/sandbox.d.ts +0 -15
- package/dist/lib/sandbox.js +0 -309
- package/dist/lib/scheduler.d.ts +0 -23
- package/dist/lib/scheduler.js +0 -106
- package/dist/lib/scheduling/routines.d.ts +0 -264
- package/dist/lib/scheduling/routines.js +0 -1292
- package/dist/lib/triggers/webhook.d.ts +0 -26
- package/dist/lib/triggers/webhook.js +0 -181
|
@@ -30,7 +30,7 @@ export { machineForSessionFile } from './origin-machine.js';
|
|
|
30
30
|
import { mapBounded } from '../concurrency.js';
|
|
31
31
|
import { getDB, getScanStampByPath, getScanStampsForPaths, getParserStatesForPaths, getDirLedgerForPaths, recordDirScans, recordScans, seedLabelsFromNames, syncTopics, upsertSessionsBatch, querySessions, countSessions, ftsSearch, getSessionById, tryClaimScan, releaseScan, scanInProgressByLivePid, cacheLinearProject, CONTENT_INDEX_VERSION, } from './db.js';
|
|
32
32
|
import { buildRunNameMap } from './run-names.js';
|
|
33
|
-
import { resolveSessionName } from './title.js';
|
|
33
|
+
import { claudeRecapFromLine, resolveSessionName } from './title.js';
|
|
34
34
|
import { resolveLinearApiKey } from '../linear-cache.js';
|
|
35
35
|
import { ToolCallCollector, collectClaudeToolCalls, collectCodexToolCalls, } from '@phnx-labs/sessions-cli/reader';
|
|
36
36
|
import { purgeMissingToolCallsInDirectory } from './tool-store.js';
|
|
@@ -131,8 +131,7 @@ export async function findLocalSessionTranscripts(selector, agent) {
|
|
|
131
131
|
if (agent && agent !== harness)
|
|
132
132
|
continue;
|
|
133
133
|
const subdir = harness === 'claude' ? 'projects' : 'sessions';
|
|
134
|
-
const
|
|
135
|
-
for (const root of roots) {
|
|
134
|
+
for (const root of getAgentSessionDirs(harness, subdir)) {
|
|
136
135
|
for (const file of walkForFilesWithStat(root, '.jsonl', Number.MAX_SAFE_INTEGER)) {
|
|
137
136
|
const name = path.basename(file.path, '.jsonl');
|
|
138
137
|
const id = harness === 'claude' ? name : name.match(/([0-9a-f]{8}-[0-9a-f-]{27})$/i)?.[1];
|
|
@@ -201,7 +200,6 @@ export async function scanSessionsIncremental(options) {
|
|
|
201
200
|
};
|
|
202
201
|
try {
|
|
203
202
|
await scanAgentsBounded(agents, agent => dispatchAgentScan(agent, track('dotfiles')));
|
|
204
|
-
await scanAgentsBounded(agents, agent => scanRoutineArchivesIncremental(agent, track('routines')));
|
|
205
203
|
seedLabelsFromNames(buildRunNameMap());
|
|
206
204
|
}
|
|
207
205
|
finally {
|
|
@@ -386,7 +384,6 @@ function buildQueryOptions(options, agents, opts) {
|
|
|
386
384
|
limit: opts.includeLimit && !options?.unbounded ? (options?.limit ?? 50) : undefined,
|
|
387
385
|
excludeTeamOrigin: options?.excludeTeamOrigin,
|
|
388
386
|
onlyTeamOrigin: options?.onlyTeamOrigin,
|
|
389
|
-
origin: options?.origin,
|
|
390
387
|
sortBy: options?.sortBy,
|
|
391
388
|
skipExistenceCheck: options?.skipExistenceCheck,
|
|
392
389
|
skill: options?.skill,
|
|
@@ -428,13 +425,11 @@ export function looksLikeSessionId(query) {
|
|
|
428
425
|
export function resolveSessionById(sessions, idQuery) {
|
|
429
426
|
const query = idQuery.toLowerCase();
|
|
430
427
|
const exact = sessions.filter(s => s.id.toLowerCase() === query ||
|
|
431
|
-
s.shortId.toLowerCase() === query
|
|
432
|
-
s.routineRunId?.toLowerCase() === query);
|
|
428
|
+
s.shortId.toLowerCase() === query);
|
|
433
429
|
if (exact.length > 0)
|
|
434
430
|
return exact;
|
|
435
431
|
return sessions.filter(s => s.id.toLowerCase().startsWith(query) ||
|
|
436
|
-
s.shortId.toLowerCase().startsWith(query)
|
|
437
|
-
s.routineRunId?.toLowerCase().startsWith(query));
|
|
432
|
+
s.shortId.toLowerCase().startsWith(query));
|
|
438
433
|
}
|
|
439
434
|
export function searchContentIndex(sessions, query) {
|
|
440
435
|
if (!query.trim())
|
|
@@ -625,131 +620,11 @@ export function getSessionRoots() {
|
|
|
625
620
|
const out = [];
|
|
626
621
|
for (const { agent, subdir } of SESSION_ROOT_SPECS) {
|
|
627
622
|
const dirs = getAgentSessionDirs(agent, subdir);
|
|
628
|
-
dirs.push(...getRoutineArchiveSessionDirs(agent, subdir));
|
|
629
623
|
if (dirs.length > 0)
|
|
630
624
|
out.push({ agent, dirs });
|
|
631
625
|
}
|
|
632
626
|
return out;
|
|
633
627
|
}
|
|
634
|
-
function getRoutineArchiveSessionDirs(agent, subdir) {
|
|
635
|
-
const runsDir = getRunsDir();
|
|
636
|
-
if (!fs.existsSync(runsDir))
|
|
637
|
-
return [];
|
|
638
|
-
const dirs = [];
|
|
639
|
-
let jobDirs;
|
|
640
|
-
try {
|
|
641
|
-
jobDirs = fs.readdirSync(runsDir, { withFileTypes: true });
|
|
642
|
-
}
|
|
643
|
-
catch {
|
|
644
|
-
return dirs;
|
|
645
|
-
}
|
|
646
|
-
for (const jobDir of jobDirs) {
|
|
647
|
-
if (!jobDir.isDirectory())
|
|
648
|
-
continue;
|
|
649
|
-
const jobRunsDir = path.join(runsDir, jobDir.name);
|
|
650
|
-
let runDirs;
|
|
651
|
-
try {
|
|
652
|
-
runDirs = fs.readdirSync(jobRunsDir, { withFileTypes: true });
|
|
653
|
-
}
|
|
654
|
-
catch {
|
|
655
|
-
continue;
|
|
656
|
-
}
|
|
657
|
-
for (const runDir of runDirs) {
|
|
658
|
-
if (!runDir.isDirectory())
|
|
659
|
-
continue;
|
|
660
|
-
const dir = path.join(jobRunsDir, runDir.name, 'sessions', agent, subdir);
|
|
661
|
-
if (fs.existsSync(dir))
|
|
662
|
-
dirs.push(dir);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
return dirs;
|
|
666
|
-
}
|
|
667
|
-
function routineArchiveInfo(filePath) {
|
|
668
|
-
const rel = path.relative(getRunsDir(), filePath);
|
|
669
|
-
if (rel.startsWith('..') || path.isAbsolute(rel))
|
|
670
|
-
return null;
|
|
671
|
-
const parts = rel.split(path.sep);
|
|
672
|
-
if (parts.length < 6 || parts[2] !== 'sessions')
|
|
673
|
-
return null;
|
|
674
|
-
return { jobName: parts[0], runId: parts[1] };
|
|
675
|
-
}
|
|
676
|
-
function decorateRoutineSession(meta, info) {
|
|
677
|
-
return {
|
|
678
|
-
...meta,
|
|
679
|
-
origin: 'routine',
|
|
680
|
-
routineName: info.jobName,
|
|
681
|
-
routineRunId: info.runId,
|
|
682
|
-
project: info.jobName,
|
|
683
|
-
label: info.jobName,
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
async function readRoutineArchiveMeta(agent, filePath) {
|
|
687
|
-
const info = routineArchiveInfo(filePath);
|
|
688
|
-
if (!info)
|
|
689
|
-
return null;
|
|
690
|
-
if (agent === 'claude') {
|
|
691
|
-
const sessionId = path.basename(filePath).replace(/\.jsonl$/, '');
|
|
692
|
-
const stat = safeStatSync(filePath);
|
|
693
|
-
if (!stat)
|
|
694
|
-
return null;
|
|
695
|
-
const scanStamp = { fileMtimeMs: Math.floor(stat.mtimeMs), fileSize: stat.size };
|
|
696
|
-
const result = await readClaudeMeta(filePath, sessionId, scanStamp, undefined);
|
|
697
|
-
return result ? { ...result, meta: decorateRoutineSession(result.meta, info) } : null;
|
|
698
|
-
}
|
|
699
|
-
if (agent === 'codex') {
|
|
700
|
-
const result = await readCodexMeta(filePath);
|
|
701
|
-
return result ? { ...result, meta: decorateRoutineSession(result.meta, info) } : null;
|
|
702
|
-
}
|
|
703
|
-
if (agent === 'cursor') {
|
|
704
|
-
const currentVersion = await getCurrentAgentVersion('cursor');
|
|
705
|
-
const result = readCursorMeta(filePath, currentVersion);
|
|
706
|
-
return result ? { ...result, meta: decorateRoutineSession(result.meta, info) } : null;
|
|
707
|
-
}
|
|
708
|
-
return null;
|
|
709
|
-
}
|
|
710
|
-
async function scanRoutineArchivesIncremental(agent, onProgress) {
|
|
711
|
-
const subdir = sessionRootSubdir(agent);
|
|
712
|
-
if (!subdir)
|
|
713
|
-
return;
|
|
714
|
-
const ext = '.jsonl';
|
|
715
|
-
const prestat = [];
|
|
716
|
-
for (const sessionsDir of getRoutineArchiveSessionDirs(agent, subdir)) {
|
|
717
|
-
for (const f of walkForFilesWithStat(sessionsDir, ext, 100_000)) {
|
|
718
|
-
prestat.push({ filePath: f.path, fileMtimeMs: f.mtimeMs, fileSize: f.size });
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
const changed = filterChangedEntries(prestat);
|
|
722
|
-
if (changed.length === 0)
|
|
723
|
-
return;
|
|
724
|
-
onProgress?.({ agent, parsed: 0, total: changed.length });
|
|
725
|
-
const entries = [];
|
|
726
|
-
const touched = [];
|
|
727
|
-
let parsed = 0;
|
|
728
|
-
for (const { filePath, scan } of changed) {
|
|
729
|
-
try {
|
|
730
|
-
const result = await readRoutineArchiveMeta(agent, filePath);
|
|
731
|
-
if (result)
|
|
732
|
-
entries.push({
|
|
733
|
-
meta: result.meta,
|
|
734
|
-
content: result.content,
|
|
735
|
-
assistantContent: result.assistantContent,
|
|
736
|
-
scan,
|
|
737
|
-
events: result.events,
|
|
738
|
-
toolCalls: result.toolCalls,
|
|
739
|
-
toolIndexMode: result.toolIndexMode,
|
|
740
|
-
});
|
|
741
|
-
else
|
|
742
|
-
touched.push({ filePath, scan });
|
|
743
|
-
}
|
|
744
|
-
catch {
|
|
745
|
-
touched.push({ filePath, scan });
|
|
746
|
-
}
|
|
747
|
-
parsed++;
|
|
748
|
-
onProgress?.({ agent, parsed, total: changed.length });
|
|
749
|
-
}
|
|
750
|
-
upsertSessionsBatch(entries);
|
|
751
|
-
recordScans(touched);
|
|
752
|
-
}
|
|
753
628
|
let cachedClaudeAccountIndex;
|
|
754
629
|
function claudeAccountIndex(refresh = false) {
|
|
755
630
|
if (refresh || !cachedClaudeAccountIndex)
|
|
@@ -2253,6 +2128,7 @@ export function initClaudeParseState() {
|
|
|
2253
2128
|
firstUserMessage: undefined,
|
|
2254
2129
|
customTitle: undefined,
|
|
2255
2130
|
aiTitle: undefined,
|
|
2131
|
+
recap: undefined,
|
|
2256
2132
|
entrypoint: undefined,
|
|
2257
2133
|
messageCount: 0,
|
|
2258
2134
|
toolCallCount: 0,
|
|
@@ -2408,6 +2284,11 @@ export function applyClaudeLine(state, parsed) {
|
|
|
2408
2284
|
state.aiTitle = t;
|
|
2409
2285
|
return;
|
|
2410
2286
|
}
|
|
2287
|
+
const recap = claudeRecapFromLine(parsed);
|
|
2288
|
+
if (recap) {
|
|
2289
|
+
state.recap = recap;
|
|
2290
|
+
return;
|
|
2291
|
+
}
|
|
2411
2292
|
if (parsed.type === 'user') {
|
|
2412
2293
|
const text = extractClaudeUserText(parsed);
|
|
2413
2294
|
if (text) {
|
|
@@ -2569,6 +2450,7 @@ export function serializeClaudeParserState(state, offset, jsonlDroppingOversized
|
|
|
2569
2450
|
firstUserMessage: state.firstUserMessage,
|
|
2570
2451
|
customTitle: state.customTitle,
|
|
2571
2452
|
aiTitle: state.aiTitle,
|
|
2453
|
+
recap: state.recap,
|
|
2572
2454
|
plan: state.plan,
|
|
2573
2455
|
lastTsMs: state.lastTsMs,
|
|
2574
2456
|
messageCount: state.messageCount,
|
|
@@ -2618,6 +2500,7 @@ export function hydrateClaudeParseState(prior) {
|
|
|
2618
2500
|
firstUserMessage: prior.firstUserMessage,
|
|
2619
2501
|
customTitle: prior.customTitle,
|
|
2620
2502
|
aiTitle: prior.aiTitle,
|
|
2503
|
+
recap: prior.recap,
|
|
2621
2504
|
entrypoint: prior.entrypoint,
|
|
2622
2505
|
messageCount: prior.messageCount,
|
|
2623
2506
|
toolCallCount: prior.toolCallCount ?? 0,
|
|
@@ -31,8 +31,6 @@ export function activeSessionToSessionMeta(active, self, nowMs) {
|
|
|
31
31
|
prNumber: active.pr?.number,
|
|
32
32
|
worktreeSlug: active.worktree?.slug,
|
|
33
33
|
gitBranch: active.worktree?.branch,
|
|
34
|
-
origin: active.origin,
|
|
35
|
-
routineName: active.routineName,
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
36
|
export function liveSessionMetas(active, self, nowMs) {
|
|
@@ -39,7 +39,6 @@ export declare function teamBadge(session: SessionMeta): {
|
|
|
39
39
|
plain: string;
|
|
40
40
|
width: number;
|
|
41
41
|
};
|
|
42
|
-
export declare function originTag(session: SessionMeta): string;
|
|
43
42
|
export declare function timeCell(age: SessionAgeParts, topicSlack: number): {
|
|
44
43
|
plain: string;
|
|
45
44
|
text: string;
|
|
@@ -370,11 +370,6 @@ export function teamBadge(session) {
|
|
|
370
370
|
const plain = `team:${truncate(team, TEAM_BADGE_MAX)} `;
|
|
371
371
|
return { plain, width: stringWidth(plain) };
|
|
372
372
|
}
|
|
373
|
-
export function originTag(session) {
|
|
374
|
-
if (session.origin !== 'routine')
|
|
375
|
-
return '';
|
|
376
|
-
return `[routine${session.routineName ? ` · ${session.routineName}` : ''}] `;
|
|
377
|
-
}
|
|
378
373
|
const MIN_TOPIC_W = 16;
|
|
379
374
|
export function timeCell(age, topicSlack) {
|
|
380
375
|
const lastOnly = { plain: age.last, text: chalk.gray(age.last), extraW: 0 };
|
|
@@ -391,7 +386,7 @@ export function flatSessionRow(session, live, showTicket = false, cols = {}, boo
|
|
|
391
386
|
const agentColor = colorAgent(shown);
|
|
392
387
|
const age = sessionAgeParts(session.timestamp, session.lastActivity);
|
|
393
388
|
const project = session.project || '-';
|
|
394
|
-
const tag =
|
|
389
|
+
const tag = teamTag(session);
|
|
395
390
|
const label = session.label;
|
|
396
391
|
const { glyph, preview } = liveGlyphAndPreview(live);
|
|
397
392
|
const restingTodo = !live ? formatTodoCompact(session.todos) : '';
|
|
@@ -443,7 +438,7 @@ function treeSessionRow(session, live) {
|
|
|
443
438
|
const shown = sessionDisplayAgent(session);
|
|
444
439
|
const agentColor = colorAgent(shown);
|
|
445
440
|
const age = sessionAgeParts(session.timestamp, session.lastActivity);
|
|
446
|
-
const tag =
|
|
441
|
+
const tag = teamTag(session);
|
|
447
442
|
const label = session.label;
|
|
448
443
|
const { glyph, preview } = liveGlyphAndPreview(live);
|
|
449
444
|
const restingTodo = !live ? formatTodoCompact(session.todos) : '';
|
|
@@ -612,7 +607,7 @@ export function formatPickerLabel(s, query, cols = {}, ssh, host = '', bookmarke
|
|
|
612
607
|
const sshW = sshPlain ? stringWidth(sshPlain) : 0;
|
|
613
608
|
const team = teamBadge(s);
|
|
614
609
|
const teamSeg = team.plain ? chalk.green(team.plain) : '';
|
|
615
|
-
const tag =
|
|
610
|
+
const tag = teamTag(s);
|
|
616
611
|
const label = s.label;
|
|
617
612
|
const topic = tag ? `${tag}${s.topic ?? ''}` : s.topic;
|
|
618
613
|
const versionStr = s.version || '-';
|
|
@@ -10,7 +10,6 @@ interface SessionFilterOptions {
|
|
|
10
10
|
all?: boolean;
|
|
11
11
|
teams?: boolean;
|
|
12
12
|
inTeam?: string;
|
|
13
|
-
routine?: boolean | string;
|
|
14
13
|
since?: string;
|
|
15
14
|
until?: string;
|
|
16
15
|
}
|
|
@@ -29,7 +28,6 @@ export declare function parseAgentFilter(agentName?: string): AgentFilter;
|
|
|
29
28
|
export type SessionSearchScope = {
|
|
30
29
|
agent?: string;
|
|
31
30
|
project?: string;
|
|
32
|
-
routine?: boolean | string;
|
|
33
31
|
};
|
|
34
32
|
interface SessionQueryResolution {
|
|
35
33
|
matches: SessionMeta[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { SESSION_AGENTS, isAgentTmuxAlias,
|
|
2
|
+
import { SESSION_AGENTS, isAgentTmuxAlias, safeTeamText } from '@phnx-labs/sessions-cli/reader';
|
|
3
3
|
import { shortIdFromName } from './active.js';
|
|
4
4
|
import { machineId } from './sync/config.js';
|
|
5
5
|
import { loadLocalActiveSessions, readActiveSessionsCache } from './session-cache.js';
|
|
@@ -238,21 +238,11 @@ export function applyScopeFilters(sessions, scope) {
|
|
|
238
238
|
return true;
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
|
-
if (scope.routine) {
|
|
242
|
-
filtered = filtered.filter((session) => session.origin === 'routine');
|
|
243
|
-
if (typeof scope.routine === 'string') {
|
|
244
|
-
const names = [...new Set(filtered.map((session) => session.routineName).filter((name) => !!name))];
|
|
245
|
-
const selected = resolveRoutineName(scope.routine, names);
|
|
246
|
-
filtered = selected
|
|
247
|
-
? filtered.filter((session) => session.routineName === selected)
|
|
248
|
-
: [];
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
241
|
return filtered;
|
|
252
242
|
}
|
|
253
243
|
function scopedContentIndex(sessions, query, scope) {
|
|
254
244
|
const hits = searchContentIndex(sessions, query);
|
|
255
|
-
if (!scope || (!scope.agent && !scope.project
|
|
245
|
+
if (!scope || (!scope.agent && !scope.project))
|
|
256
246
|
return hits;
|
|
257
247
|
const kept = new Map();
|
|
258
248
|
for (const [id, session] of hits) {
|
|
@@ -27,6 +27,7 @@ interface ImmutableSessionFields {
|
|
|
27
27
|
startedAtMs?: number;
|
|
28
28
|
version?: string;
|
|
29
29
|
pr?: ActiveSession['pr'];
|
|
30
|
+
prs?: ActiveSession['prs'];
|
|
30
31
|
worktree?: ActiveSession['worktree'];
|
|
31
32
|
ticket?: ActiveSession['ticket'];
|
|
32
33
|
createdTickets?: string[];
|
|
@@ -37,7 +38,7 @@ interface ImmutableSessionFields {
|
|
|
37
38
|
kind?: string;
|
|
38
39
|
context?: ActiveSession['context'];
|
|
39
40
|
}
|
|
40
|
-
export declare const IMMUTABLE_FIELD_KEYS: readonly ["topic", "firstUserMessage", "label", "name", "cwd", "project", "attachments", "startedAtMs", "version", "pr", "worktree", "ticket", "createdTickets", "spawnedTeam", "sessionFile", "owner", "assignedTask", "kind", "context"];
|
|
41
|
+
export declare const IMMUTABLE_FIELD_KEYS: readonly ["topic", "firstUserMessage", "label", "name", "cwd", "project", "attachments", "startedAtMs", "version", "pr", "prs", "worktree", "ticket", "createdTickets", "spawnedTeam", "sessionFile", "owner", "assignedTask", "kind", "context"];
|
|
41
42
|
export declare const LIVE_STATUS_KEYS: readonly ["status", "activity", "model", "failures", "activityHistogram", "userTurns", "subagents", "pending", "effort", "fast", "preview", "tokPerSec", "awaitingReason", "question", "todos", "tail", "lastActivityMs", "lastEventMs", "quietSinceMs", "hostLink", "presence", "pidAlive", "tmuxClients", "windowHeartbeatMs", "provenance", "rateLimited", "plan"];
|
|
42
43
|
export declare const ACTIVE_SESSIONS_READER_IDLE_WINDOW_MS = 45000;
|
|
43
44
|
export declare function setActiveSessionsSnapshotPathForTest(p: string | null): string | null;
|
|
@@ -26,6 +26,16 @@ export declare function sessionHeadline<T extends {
|
|
|
26
26
|
generatedTitle?: string | null;
|
|
27
27
|
topic?: string | null;
|
|
28
28
|
}>(row: CarriesTitleRung<T>): string | undefined;
|
|
29
|
+
export interface SessionRecap {
|
|
30
|
+
text: string;
|
|
31
|
+
at: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function claudeRecapFromLine(parsed: {
|
|
34
|
+
type?: unknown;
|
|
35
|
+
subtype?: unknown;
|
|
36
|
+
content?: unknown;
|
|
37
|
+
timestamp?: unknown;
|
|
38
|
+
}): SessionRecap | undefined;
|
|
29
39
|
export interface LiveSessionName {
|
|
30
40
|
name: string;
|
|
31
41
|
source?: string;
|
|
@@ -71,6 +71,15 @@ export function sanitizeGeneratedTitle(raw) {
|
|
|
71
71
|
export function sessionHeadline(row) {
|
|
72
72
|
return row.label || row.generatedTitle || row.topic || undefined;
|
|
73
73
|
}
|
|
74
|
+
const CLAUDE_RECAP_HINT_RE = /\s*\(disable recaps in \/config\)\s*$/i;
|
|
75
|
+
export function claudeRecapFromLine(parsed) {
|
|
76
|
+
if (parsed.type !== 'system' || parsed.subtype !== 'away_summary')
|
|
77
|
+
return undefined;
|
|
78
|
+
if (typeof parsed.content !== 'string' || typeof parsed.timestamp !== 'string')
|
|
79
|
+
return undefined;
|
|
80
|
+
const text = parsed.content.replace(CLAUDE_RECAP_HINT_RE, '').trim();
|
|
81
|
+
return text ? { text, at: parsed.timestamp } : undefined;
|
|
82
|
+
}
|
|
74
83
|
function nonEmpty(s) {
|
|
75
84
|
return s?.trim() || undefined;
|
|
76
85
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const commandsDetectors: Partial<Record<"
|
|
2
|
+
export declare const commandsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const hooksDetectors: Partial<Record<"
|
|
2
|
+
export declare const hooksDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const mcpDetectors: Partial<Record<"
|
|
2
|
+
export declare const mcpDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const permissionsDetectors: Partial<Record<"
|
|
2
|
+
export declare const permissionsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const pluginsDetectors: Partial<Record<"
|
|
2
|
+
export declare const pluginsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const rulesDetectors: Partial<Record<"
|
|
2
|
+
export declare const rulesDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
2
|
export declare function skillDirsMatch(src: string, dest: string): boolean;
|
|
3
|
-
export declare const skillsDetectors: Partial<Record<"
|
|
3
|
+
export declare const skillsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const subagentsDetectors: Partial<Record<"
|
|
2
|
+
export declare const subagentsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceDetector } from './types.js';
|
|
2
|
-
export declare const workflowsDetectors: Partial<Record<"
|
|
2
|
+
export declare const workflowsDetectors: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceDetector>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const commandsWriters: Partial<Record<"
|
|
2
|
+
export declare const commandsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const hooksWriters: Partial<Record<"
|
|
2
|
+
export declare const hooksWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const mcpWriters: Partial<Record<"
|
|
2
|
+
export declare const mcpWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const permissionsWriters: Partial<Record<"
|
|
2
|
+
export declare const permissionsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const pluginsWriters: Partial<Record<"
|
|
2
|
+
export declare const pluginsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -2,4 +2,4 @@ import type { ResourceWriter } from './types.js';
|
|
|
2
2
|
export interface RulesSelection {
|
|
3
3
|
preset: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const rulesWriters: Partial<Record<"
|
|
5
|
+
export declare const rulesWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<RulesSelection>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const skillsWriters: Partial<Record<"
|
|
2
|
+
export declare const skillsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const subagentsWriters: Partial<Record<"
|
|
2
|
+
export declare const subagentsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ResourceWriter } from './types.js';
|
|
2
|
-
export declare const workflowsWriters: Partial<Record<"
|
|
2
|
+
export declare const workflowsWriters: Partial<Record<"codex" | "antigravity" | "cursor" | "claude" | "opencode" | "openclaw" | "copilot" | "amp" | "goose" | "grok" | "kimi" | "droid" | "hermes" | "muse" | "warp", ResourceWriter<string[]>>>;
|
|
@@ -2,7 +2,7 @@ const LOADED_COMMAND_NAMES = [
|
|
|
2
2
|
'accounts', 'auth', 'view', 'inspect', 'commands', 'hooks', 'skills', 'rules', 'memory',
|
|
3
3
|
'permissions', 'mcp', 'clis', 'subagents', 'plugins', 'workflows', 'add', 'use',
|
|
4
4
|
'remove', 'rm', 'purge', 'update', 'prune', 'import',
|
|
5
|
-
'
|
|
5
|
+
'projects', 'run', '_callback', 'open', 'fork', 'config',
|
|
6
6
|
'models', 'doctor',
|
|
7
7
|
'harness', 'harnesses', 'menubar', 'sync',
|
|
8
8
|
'refresh-rules', 'factory', 'insights', 'trace',
|
|
@@ -12,13 +12,16 @@ const LOADED_COMMAND_NAMES = [
|
|
|
12
12
|
'daemon', 'recordings',
|
|
13
13
|
];
|
|
14
14
|
const INLINE_COMMAND_NAMES = [
|
|
15
|
-
'perms', 'exec', '
|
|
15
|
+
'perms', 'exec', 'check', 'resources', 'hq', '_internal',
|
|
16
16
|
];
|
|
17
17
|
export const KNOWN_TOP_LEVEL_COMMANDS = new Set([
|
|
18
18
|
...LOADED_COMMAND_NAMES,
|
|
19
19
|
...INLINE_COMMAND_NAMES,
|
|
20
20
|
]);
|
|
21
21
|
export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
|
|
22
|
+
'routines',
|
|
23
|
+
'jobs',
|
|
24
|
+
'cron',
|
|
22
25
|
'webhook',
|
|
23
26
|
'org',
|
|
24
27
|
'serve',
|
package/dist/lib/state.d.ts
CHANGED
|
@@ -54,11 +54,8 @@ export declare function getUserPromptcutsPath(): string;
|
|
|
54
54
|
export declare function getHomeDir(): string;
|
|
55
55
|
export declare function getHistoryDir(): string;
|
|
56
56
|
export declare function getCacheDir(): string;
|
|
57
|
-
export declare function getRoutinesDir(): string;
|
|
58
57
|
export declare function getProjectsDir(): string;
|
|
59
58
|
export declare function getDaemonConfigDir(): string;
|
|
60
|
-
export declare function getSystemRoutinesDir(): string;
|
|
61
|
-
export declare function getProjectRoutinesDir(cwd?: string): string | null;
|
|
62
59
|
export declare function getRunsDir(): string;
|
|
63
60
|
export declare function getMailboxRootDir(): string;
|
|
64
61
|
export declare function getFeedDir(): string;
|
package/dist/lib/state.js
CHANGED
|
@@ -31,13 +31,11 @@ const SYSTEM_PERMISSIONS_DIR = path.join(SYSTEM_AGENTS_DIR, 'permissions');
|
|
|
31
31
|
const SYSTEM_SUBAGENTS_DIR = path.join(SYSTEM_AGENTS_DIR, 'subagents');
|
|
32
32
|
const SYSTEM_WORKFLOWS_DIR = path.join(SYSTEM_AGENTS_DIR, 'workflows');
|
|
33
33
|
const SYSTEM_PLUGINS_DIR = path.join(SYSTEM_AGENTS_DIR, 'plugins');
|
|
34
|
-
const SYSTEM_ROUTINES_DIR = path.join(SYSTEM_AGENTS_DIR, 'routines');
|
|
35
34
|
const SYSTEM_PROMPTCUTS_FILE = path.join(SYSTEM_AGENTS_DIR, 'hooks', 'promptcuts.yaml');
|
|
36
35
|
const SYSTEM_MCP_CONFIG_FILE = path.join(SYSTEM_AGENTS_DIR, 'mcp.json');
|
|
37
36
|
const SYSTEM_INSTRUCTIONS_FILE = path.join(SYSTEM_AGENTS_DIR, 'instructions.md');
|
|
38
37
|
const HISTORY_DIR = path.join(USER_AGENTS_DIR, '.history');
|
|
39
38
|
const CACHE_DIR = path.join(USER_AGENTS_DIR, '.cache');
|
|
40
|
-
const ROUTINES_DIR = path.join(USER_AGENTS_DIR, 'routines');
|
|
41
39
|
const TEAMS_DIR = path.join(USER_AGENTS_DIR, 'teams');
|
|
42
40
|
const PROJECTS_DIR = path.join(USER_AGENTS_DIR, 'projects');
|
|
43
41
|
const DAEMON_CONFIG_DIR = path.join(USER_AGENTS_DIR, 'daemon');
|
|
@@ -255,16 +253,8 @@ export function getUserPromptcutsPath() { return USER_PROMPTCUTS_FILE; }
|
|
|
255
253
|
export function getHomeDir() { return HOME; }
|
|
256
254
|
export function getHistoryDir() { return HISTORY_DIR; }
|
|
257
255
|
export function getCacheDir() { return CACHE_DIR; }
|
|
258
|
-
export function getRoutinesDir() { return process.env.AGENTS_ROUTINES_DIR ?? ROUTINES_DIR; }
|
|
259
256
|
export function getProjectsDir() { return process.env.AGENTS_PROJECTS_DIR ?? PROJECTS_DIR; }
|
|
260
257
|
export function getDaemonConfigDir() { return process.env.AGENTS_DAEMON_CONFIG_DIR ?? DAEMON_CONFIG_DIR; }
|
|
261
|
-
export function getSystemRoutinesDir() { return process.env.AGENTS_SYSTEM_ROUTINES_DIR ?? SYSTEM_ROUTINES_DIR; }
|
|
262
|
-
export function getProjectRoutinesDir(cwd = process.cwd()) {
|
|
263
|
-
const projectAgentsDir = getProjectAgentsDir(cwd);
|
|
264
|
-
if (!projectAgentsDir)
|
|
265
|
-
return null;
|
|
266
|
-
return path.join(projectAgentsDir, 'routines');
|
|
267
|
-
}
|
|
268
258
|
export function getRunsDir() { return RUNS_DIR; }
|
|
269
259
|
export function getMailboxRootDir() { return MAILBOX_DIR; }
|
|
270
260
|
export function getFeedDir() { return FEED_DIR; }
|
|
@@ -376,8 +366,6 @@ export function ensureAgentsDir() {
|
|
|
376
366
|
fs.mkdirSync(CACHE_DIR, opts);
|
|
377
367
|
if (!fs.existsSync(PACKAGES_DIR))
|
|
378
368
|
fs.mkdirSync(PACKAGES_DIR, opts);
|
|
379
|
-
if (!fs.existsSync(ROUTINES_DIR))
|
|
380
|
-
fs.mkdirSync(ROUTINES_DIR, opts);
|
|
381
369
|
if (!fs.existsSync(RUNS_DIR))
|
|
382
370
|
fs.mkdirSync(RUNS_DIR, opts);
|
|
383
371
|
if (!fs.existsSync(VERSIONS_DIR))
|
|
@@ -514,7 +502,6 @@ const BESPOKE_DEVICE_KEYS = [
|
|
|
514
502
|
'agents',
|
|
515
503
|
'isolatedAgents',
|
|
516
504
|
'versions',
|
|
517
|
-
'deviceRoutines',
|
|
518
505
|
'deviceConfig',
|
|
519
506
|
'deviceBrowser',
|
|
520
507
|
'deviceFleet',
|
|
@@ -536,6 +523,7 @@ const BESPOKE_DEVICE_KEY_SET = new Set([
|
|
|
536
523
|
const BESPOKE_DEVICE_DOC_KEYS = new Set([
|
|
537
524
|
'agents',
|
|
538
525
|
'isolatedAgents',
|
|
526
|
+
// A device doc written before routines were removed may still carry `routines:`; skip it rather than merge it into meta.
|
|
539
527
|
'routines',
|
|
540
528
|
'config',
|
|
541
529
|
'browser',
|
|
@@ -621,14 +609,13 @@ function serializeCentral(central) {
|
|
|
621
609
|
return healMetaHeader(stringifyDoc(doc));
|
|
622
610
|
}
|
|
623
611
|
export function writeMetaUnlocked(meta) {
|
|
624
|
-
const writesDeviceRoutines = Object.prototype.hasOwnProperty.call(meta, 'deviceRoutines');
|
|
625
612
|
const writesDeviceConfig = Object.prototype.hasOwnProperty.call(meta, 'deviceConfig');
|
|
626
613
|
const writesDeviceBrowser = Object.prototype.hasOwnProperty.call(meta, 'deviceBrowser');
|
|
627
614
|
const writesDeviceFleet = Object.prototype.hasOwnProperty.call(meta, 'deviceFleet');
|
|
628
615
|
const writesDeviceHosts = Object.prototype.hasOwnProperty.call(meta, 'deviceHosts');
|
|
629
616
|
const writesDeviceAccounts = Object.prototype.hasOwnProperty.call(meta, 'deviceAccounts');
|
|
630
617
|
const writesProjectRoot = Object.prototype.hasOwnProperty.call(meta, 'projectRoot');
|
|
631
|
-
const { agents, isolatedAgents, versions,
|
|
618
|
+
const { agents, isolatedAgents, versions, deviceConfig, deviceBrowser, deviceFleet, deviceHosts, deviceAccounts, projectRoot, ...central } = meta;
|
|
632
619
|
const hasAgents = !!agents && Object.keys(agents).length > 0;
|
|
633
620
|
const hasIsolatedAgents = !!isolatedAgents && Object.keys(isolatedAgents).length > 0;
|
|
634
621
|
const pinsPath = getDevicePinsPath();
|
|
@@ -657,10 +644,6 @@ export function writeMetaUnlocked(meta) {
|
|
|
657
644
|
}
|
|
658
645
|
delete doc.agents;
|
|
659
646
|
delete doc.isolatedAgents;
|
|
660
|
-
if (Array.isArray(deviceRoutines))
|
|
661
|
-
doc.routines = deviceRoutines;
|
|
662
|
-
else if (writesDeviceRoutines)
|
|
663
|
-
delete doc.routines;
|
|
664
647
|
const hasDeviceConfig = !!deviceConfig && Object.keys(deviceConfig).length > 0;
|
|
665
648
|
if (hasDeviceConfig)
|
|
666
649
|
doc.config = deviceConfig;
|
|
@@ -834,12 +817,6 @@ function overlayMachineLocal(meta) {
|
|
|
834
817
|
if (native || bindings || homes || pendingConnects || slots)
|
|
835
818
|
meta.deviceAccounts = { ...(native ? { native } : {}), ...(bindings ? { bindings } : {}), ...(homes ? { homes } : {}), ...(pendingConnects ? { pendingConnects } : {}), ...(slots ? { slots } : {}) };
|
|
836
819
|
}
|
|
837
|
-
if (Object.prototype.hasOwnProperty.call(dm, 'routines')) {
|
|
838
|
-
if (!Array.isArray(dm.routines) || dm.routines.some((name) => typeof name !== 'string')) {
|
|
839
|
-
throw new Error(`Device config corrupted at ${devicePath}: routines must be a string list.`);
|
|
840
|
-
}
|
|
841
|
-
meta.deviceRoutines = dm.routines;
|
|
842
|
-
}
|
|
843
820
|
for (const [k, v] of Object.entries(dm)) {
|
|
844
821
|
if (BESPOKE_DEVICE_DOC_KEYS.has(k))
|
|
845
822
|
continue;
|