@phnx-labs/agents-cli 1.18.0 → 1.18.2
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 +20 -1
- package/dist/commands/doctor.js +19 -5
- package/dist/commands/exec.js +9 -4
- package/dist/index.js +30 -0
- package/dist/lib/hooks.js +21 -3
- package/dist/lib/migrate.js +35 -12
- package/dist/lib/shims.d.ts +3 -1
- package/dist/lib/shims.js +81 -7
- package/dist/lib/staleness/checkers/commands.d.ts +7 -0
- package/dist/lib/staleness/checkers/commands.js +27 -0
- package/dist/lib/staleness/checkers/hooks.d.ts +13 -0
- package/dist/lib/staleness/checkers/hooks.js +63 -0
- package/dist/lib/staleness/checkers/mcp.d.ts +12 -0
- package/dist/lib/staleness/checkers/mcp.js +38 -0
- package/dist/lib/staleness/checkers/permissions.d.ts +17 -0
- package/dist/lib/staleness/checkers/permissions.js +73 -0
- package/dist/lib/staleness/checkers/plugins.d.ts +11 -0
- package/dist/lib/staleness/checkers/plugins.js +39 -0
- package/dist/lib/staleness/checkers/rules.d.ts +19 -0
- package/dist/lib/staleness/checkers/rules.js +86 -0
- package/dist/lib/staleness/checkers/skills.d.ts +7 -0
- package/dist/lib/staleness/checkers/skills.js +34 -0
- package/dist/lib/staleness/checkers/subagents.d.ts +12 -0
- package/dist/lib/staleness/checkers/subagents.js +39 -0
- package/dist/lib/staleness/checkers/types.d.ts +44 -0
- package/dist/lib/staleness/checkers/types.js +20 -0
- package/dist/lib/staleness/checkers/workflows.d.ts +10 -0
- package/dist/lib/staleness/checkers/workflows.js +37 -0
- package/dist/lib/staleness/fingerprint.d.ts +38 -0
- package/dist/lib/staleness/fingerprint.js +154 -0
- package/dist/lib/staleness/index.d.ts +26 -0
- package/dist/lib/staleness/index.js +122 -0
- package/dist/lib/staleness/layers.d.ts +37 -0
- package/dist/lib/staleness/layers.js +100 -0
- package/dist/lib/staleness/types.d.ts +56 -0
- package/dist/lib/staleness/types.js +6 -0
- package/dist/lib/state.d.ts +2 -0
- package/dist/lib/state.js +2 -0
- package/dist/lib/teams/agents.d.ts +11 -20
- package/dist/lib/teams/agents.js +55 -202
- package/dist/lib/teams/index.d.ts +3 -2
- package/dist/lib/teams/index.js +2 -2
- package/dist/lib/teams/persistence.d.ts +0 -38
- package/dist/lib/teams/persistence.js +7 -329
- package/dist/lib/teams/registry.js +7 -5
- package/dist/lib/versions.js +34 -12
- package/package.json +1 -1
- package/dist/lib/sync-manifest.d.ts +0 -81
- package/dist/lib/sync-manifest.js +0 -450
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staleness library entrypoint. Aggregates per-resource checkers into the
|
|
3
|
+
* two operations the rest of the codebase needs:
|
|
4
|
+
*
|
|
5
|
+
* - `buildManifest(agent, version, cwd)` — snapshot current state.
|
|
6
|
+
* - `isStale(manifest, agent, version, cwd)` — true when any tracked
|
|
7
|
+
* resource has drifted from its stored fingerprint.
|
|
8
|
+
*
|
|
9
|
+
* `loadManifest` / `saveManifest` round-trip the on-disk JSON. The format
|
|
10
|
+
* version stays at 1; new optional fields (workflows, plugins) on old files
|
|
11
|
+
* read as empty maps which forces a single re-sync.
|
|
12
|
+
*/
|
|
13
|
+
import * as fs from 'fs';
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
import { getVersionsDir } from '../state.js';
|
|
16
|
+
import { commandsChecker } from './checkers/commands.js';
|
|
17
|
+
import { skillsChecker } from './checkers/skills.js';
|
|
18
|
+
import { hooksChecker } from './checkers/hooks.js';
|
|
19
|
+
import { mcpChecker } from './checkers/mcp.js';
|
|
20
|
+
import { subagentsChecker } from './checkers/subagents.js';
|
|
21
|
+
import { workflowsChecker } from './checkers/workflows.js';
|
|
22
|
+
import { pluginsChecker } from './checkers/plugins.js';
|
|
23
|
+
import { buildPermissions, isPermissionsStale } from './checkers/permissions.js';
|
|
24
|
+
import { buildRules, isRulesStale } from './checkers/rules.js';
|
|
25
|
+
import { MANIFEST_VERSION, } from './types.js';
|
|
26
|
+
import { nameSetDiffers } from './fingerprint.js';
|
|
27
|
+
export { MANIFEST_VERSION } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Standard checkers — uniform contract. Rules and permissions have extra
|
|
30
|
+
* context (agent/version, preset env) so they're wired explicitly below.
|
|
31
|
+
*/
|
|
32
|
+
const STANDARD_CHECKERS = [
|
|
33
|
+
{ checker: commandsChecker, field: 'commands' },
|
|
34
|
+
{ checker: skillsChecker, field: 'skills' },
|
|
35
|
+
{ checker: hooksChecker, field: 'hooks' },
|
|
36
|
+
{ checker: mcpChecker, field: 'mcp' },
|
|
37
|
+
{ checker: subagentsChecker, field: 'subagents' },
|
|
38
|
+
{ checker: workflowsChecker, field: 'workflows' },
|
|
39
|
+
{ checker: pluginsChecker, field: 'plugins' },
|
|
40
|
+
];
|
|
41
|
+
// ─── Public API ──────────────────────────────────────────────────────────────
|
|
42
|
+
function manifestPath(agent, version) {
|
|
43
|
+
return path.join(getVersionsDir(), agent, version, 'home', '.sync-manifest.json');
|
|
44
|
+
}
|
|
45
|
+
export function loadManifest(agent, version) {
|
|
46
|
+
const p = manifestPath(agent, version);
|
|
47
|
+
try {
|
|
48
|
+
const raw = JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
49
|
+
if (raw.v !== MANIFEST_VERSION)
|
|
50
|
+
return null;
|
|
51
|
+
return raw;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function saveManifest(agent, version, manifest) {
|
|
58
|
+
const p = manifestPath(agent, version);
|
|
59
|
+
const tmp = p + '.tmp';
|
|
60
|
+
try {
|
|
61
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
62
|
+
fs.writeFileSync(tmp, JSON.stringify(manifest, null, 2));
|
|
63
|
+
fs.renameSync(tmp, p);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
try {
|
|
67
|
+
fs.unlinkSync(tmp);
|
|
68
|
+
}
|
|
69
|
+
catch { /* ignore */ }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function buildManifest(agent, version, cwd) {
|
|
73
|
+
const manifest = {
|
|
74
|
+
v: MANIFEST_VERSION,
|
|
75
|
+
syncedAt: new Date().toISOString(),
|
|
76
|
+
commands: {},
|
|
77
|
+
skills: {},
|
|
78
|
+
hooks: {},
|
|
79
|
+
rules: { files: {} },
|
|
80
|
+
mcp: {},
|
|
81
|
+
permissions: { groups: {}, permissionPreset: null },
|
|
82
|
+
subagents: {},
|
|
83
|
+
workflows: {},
|
|
84
|
+
plugins: {},
|
|
85
|
+
};
|
|
86
|
+
for (const { checker, field } of STANDARD_CHECKERS) {
|
|
87
|
+
const target = manifest[field];
|
|
88
|
+
for (const name of checker.listNames(cwd)) {
|
|
89
|
+
const entry = checker.build(name, cwd);
|
|
90
|
+
if (entry !== null)
|
|
91
|
+
target[name] = entry;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
manifest.rules = buildRules(agent, version, cwd);
|
|
95
|
+
manifest.permissions = buildPermissions();
|
|
96
|
+
return manifest;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* True when any tracked resource has drifted from the stored manifest.
|
|
100
|
+
* Walks every resource type in turn and returns true at the first miss —
|
|
101
|
+
* sync detection should be cheap when nothing changed.
|
|
102
|
+
*/
|
|
103
|
+
export function isStale(manifest, agent, version, cwd) {
|
|
104
|
+
for (const { checker, field } of STANDARD_CHECKERS) {
|
|
105
|
+
const storedMap = (manifest[field] ?? {});
|
|
106
|
+
const currentNames = checker.listNames(cwd);
|
|
107
|
+
if (nameSetDiffers(Object.keys(storedMap), currentNames))
|
|
108
|
+
return true;
|
|
109
|
+
for (const name of currentNames) {
|
|
110
|
+
const entry = storedMap[name];
|
|
111
|
+
if (entry === undefined)
|
|
112
|
+
return true;
|
|
113
|
+
if (!checker.isFresh(name, entry, cwd))
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (isPermissionsStale(manifest.permissions))
|
|
118
|
+
return true;
|
|
119
|
+
if (isRulesStale(manifest.rules, agent, version, cwd))
|
|
120
|
+
return true;
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer resolution for resources. Encapsulates which DotAgents repos a given
|
|
3
|
+
* resource type reads from and in what precedence. Centralized so every
|
|
4
|
+
* checker, plus the sync writer, agrees on the same set.
|
|
5
|
+
*
|
|
6
|
+
* Resolution model:
|
|
7
|
+
* - "first-wins" (commands, skills, mcp, subagents, workflows, plugins):
|
|
8
|
+
* project > user > system > extras. Same-named entries shadow.
|
|
9
|
+
* - "first-wins, no project" (hooks): security exclusion — see
|
|
10
|
+
* `src/lib/versions.ts:1832-1836` for the rationale. User > system > extras.
|
|
11
|
+
* - "merged" (permissions): every layer contributes; first-wins on name.
|
|
12
|
+
* - "composed" (rules): preset + subrules resolved per-name across layers.
|
|
13
|
+
*/
|
|
14
|
+
/** Layer of provenance for a single resource entry. */
|
|
15
|
+
export type LayerScope = 'project' | 'user' | 'system' | 'extra';
|
|
16
|
+
export interface Layer {
|
|
17
|
+
scope: LayerScope;
|
|
18
|
+
/** Absolute path of the repo root (e.g. `~/.agents`). */
|
|
19
|
+
base: string;
|
|
20
|
+
/** Set only when scope === 'extra'. */
|
|
21
|
+
alias?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function clearLayerCache(): void;
|
|
24
|
+
/** All layers a "first-wins with project" resource consults, in precedence order. */
|
|
25
|
+
export declare function firstWinsLayers(cwd: string): Layer[];
|
|
26
|
+
/** Hooks-only: layers excluding project (security exclusion). */
|
|
27
|
+
export declare function hookLayers(): Layer[];
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a single resource by name. Returns the first matching layer's
|
|
30
|
+
* absolute path plus the layer scope, or null when no layer has it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveByName(layers: Layer[], relative: string, predicate: (full: string) => boolean): {
|
|
33
|
+
path: string;
|
|
34
|
+
layer: Layer;
|
|
35
|
+
} | null;
|
|
36
|
+
/** Convenience: list names found by reading a relative subdir across all given layers. */
|
|
37
|
+
export declare function listAcrossLayers(layers: Layer[], relative: string, filter: (name: string, fullPath: string) => boolean): string[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer resolution for resources. Encapsulates which DotAgents repos a given
|
|
3
|
+
* resource type reads from and in what precedence. Centralized so every
|
|
4
|
+
* checker, plus the sync writer, agrees on the same set.
|
|
5
|
+
*
|
|
6
|
+
* Resolution model:
|
|
7
|
+
* - "first-wins" (commands, skills, mcp, subagents, workflows, plugins):
|
|
8
|
+
* project > user > system > extras. Same-named entries shadow.
|
|
9
|
+
* - "first-wins, no project" (hooks): security exclusion — see
|
|
10
|
+
* `src/lib/versions.ts:1832-1836` for the rationale. User > system > extras.
|
|
11
|
+
* - "merged" (permissions): every layer contributes; first-wins on name.
|
|
12
|
+
* - "composed" (rules): preset + subrules resolved per-name across layers.
|
|
13
|
+
*/
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
import * as fs from 'fs';
|
|
16
|
+
import { getProjectAgentsDir, getUserAgentsDir, getAgentsDir, getEnabledExtraRepos, } from '../state.js';
|
|
17
|
+
// ─── Per-process memoization ─────────────────────────────────────────────────
|
|
18
|
+
//
|
|
19
|
+
// `firstWinsLayers(cwd)` and `hookLayers()` get called from every checker for
|
|
20
|
+
// every resource — easily 50+ times per `isStale` call. Each call invokes
|
|
21
|
+
// `getProjectAgentsDir(cwd)` (walks up the filesystem) and `getEnabledExtraRepos()`
|
|
22
|
+
// (reads agents.yaml). Memoizing at process scope eliminates the redundancy.
|
|
23
|
+
//
|
|
24
|
+
// Safety: in a CLI invocation, neither cwd nor the user/system base dirs
|
|
25
|
+
// change mid-process, so the cache is always correct. Tests that exercise
|
|
26
|
+
// different HOMEs/cwds run in separate subprocesses (per `_harness.ts`), so
|
|
27
|
+
// the module's process-scope cache resets between scenarios.
|
|
28
|
+
//
|
|
29
|
+
// `clearLayerCache()` is exposed for tests or long-running daemons that need
|
|
30
|
+
// to force re-discovery.
|
|
31
|
+
const firstWinsCache = new Map();
|
|
32
|
+
let hookLayersCache = null;
|
|
33
|
+
export function clearLayerCache() {
|
|
34
|
+
firstWinsCache.clear();
|
|
35
|
+
hookLayersCache = null;
|
|
36
|
+
}
|
|
37
|
+
/** All layers a "first-wins with project" resource consults, in precedence order. */
|
|
38
|
+
export function firstWinsLayers(cwd) {
|
|
39
|
+
const cached = firstWinsCache.get(cwd);
|
|
40
|
+
if (cached)
|
|
41
|
+
return cached;
|
|
42
|
+
const layers = [];
|
|
43
|
+
const project = getProjectAgentsDir(cwd);
|
|
44
|
+
if (project)
|
|
45
|
+
layers.push({ scope: 'project', base: project });
|
|
46
|
+
layers.push({ scope: 'user', base: getUserAgentsDir() });
|
|
47
|
+
layers.push({ scope: 'system', base: getAgentsDir() });
|
|
48
|
+
for (const extra of getEnabledExtraRepos()) {
|
|
49
|
+
layers.push({ scope: 'extra', base: extra.dir, alias: extra.alias });
|
|
50
|
+
}
|
|
51
|
+
firstWinsCache.set(cwd, layers);
|
|
52
|
+
return layers;
|
|
53
|
+
}
|
|
54
|
+
/** Hooks-only: layers excluding project (security exclusion). */
|
|
55
|
+
export function hookLayers() {
|
|
56
|
+
if (hookLayersCache)
|
|
57
|
+
return hookLayersCache;
|
|
58
|
+
const layers = [];
|
|
59
|
+
layers.push({ scope: 'user', base: getUserAgentsDir() });
|
|
60
|
+
layers.push({ scope: 'system', base: getAgentsDir() });
|
|
61
|
+
for (const extra of getEnabledExtraRepos()) {
|
|
62
|
+
layers.push({ scope: 'extra', base: extra.dir, alias: extra.alias });
|
|
63
|
+
}
|
|
64
|
+
hookLayersCache = layers;
|
|
65
|
+
return layers;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a single resource by name. Returns the first matching layer's
|
|
69
|
+
* absolute path plus the layer scope, or null when no layer has it.
|
|
70
|
+
*/
|
|
71
|
+
export function resolveByName(layers, relative, predicate) {
|
|
72
|
+
for (const layer of layers) {
|
|
73
|
+
const full = path.join(layer.base, relative);
|
|
74
|
+
if (predicate(full))
|
|
75
|
+
return { path: full, layer };
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
/** Convenience: list names found by reading a relative subdir across all given layers. */
|
|
80
|
+
export function listAcrossLayers(layers, relative, filter) {
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
for (const layer of layers) {
|
|
83
|
+
const dir = path.join(layer.base, relative);
|
|
84
|
+
let entries;
|
|
85
|
+
try {
|
|
86
|
+
entries = fs.readdirSync(dir);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
for (const name of entries) {
|
|
92
|
+
if (name.startsWith('.'))
|
|
93
|
+
continue;
|
|
94
|
+
if (!filter(name, path.join(dir, name)))
|
|
95
|
+
continue;
|
|
96
|
+
seen.add(name);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return Array.from(seen);
|
|
100
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the staleness library. The on-disk manifest shape stays
|
|
3
|
+
* at `v: 1` for backward compatibility — see `src/lib/sync-manifest.ts` for
|
|
4
|
+
* the loader/saver that consumes these.
|
|
5
|
+
*/
|
|
6
|
+
import type { Fingerprint } from './fingerprint.js';
|
|
7
|
+
export declare const MANIFEST_VERSION: 1;
|
|
8
|
+
/** A single-file resource (commands, hooks, MCP server YAML, permission groups). */
|
|
9
|
+
export interface FileEntry {
|
|
10
|
+
source: Fingerprint;
|
|
11
|
+
}
|
|
12
|
+
/** A directory resource (skills, subagents, workflows). */
|
|
13
|
+
export interface DirEntry {
|
|
14
|
+
/** Winning source dir, absolute. */
|
|
15
|
+
dirPath: string;
|
|
16
|
+
/** All files inside the dir, sorted by absolute path. */
|
|
17
|
+
files: Fingerprint[];
|
|
18
|
+
}
|
|
19
|
+
/** Rules section — fingerprints of every source file (rules.yaml + active subrules). */
|
|
20
|
+
export interface RulesEntry {
|
|
21
|
+
files: Record<string, FileEntry>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Permissions section — merged across layers (every group across every scope
|
|
25
|
+
* contributes; same name first-wins user > system). Plus the active preset
|
|
26
|
+
* env value, since preset selection changes which groups are applied.
|
|
27
|
+
*/
|
|
28
|
+
export interface PermEntry {
|
|
29
|
+
groups: Record<string, FileEntry>;
|
|
30
|
+
permissionPreset: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Plugin entry. Plugins have a complex layout (`.claude-plugin/plugin.json`
|
|
34
|
+
* plus optional `skills/`, `commands/`, ...). We fingerprint the entire
|
|
35
|
+
* plugin root, same shape as a DirEntry.
|
|
36
|
+
*/
|
|
37
|
+
export type PluginEntry = DirEntry;
|
|
38
|
+
/**
|
|
39
|
+
* Full manifest. `workflows` and `plugins` are optional so older v1 files
|
|
40
|
+
* stay loadable; missing fields are treated as empty maps — name-set diff
|
|
41
|
+
* then triggers a single re-sync that fills them in.
|
|
42
|
+
*/
|
|
43
|
+
export interface SyncManifest {
|
|
44
|
+
v: typeof MANIFEST_VERSION;
|
|
45
|
+
syncedAt: string;
|
|
46
|
+
commands: Record<string, FileEntry>;
|
|
47
|
+
skills: Record<string, DirEntry>;
|
|
48
|
+
hooks: Record<string, FileEntry>;
|
|
49
|
+
rules: RulesEntry;
|
|
50
|
+
mcp: Record<string, FileEntry>;
|
|
51
|
+
permissions: PermEntry;
|
|
52
|
+
subagents: Record<string, DirEntry>;
|
|
53
|
+
workflows?: Record<string, DirEntry>;
|
|
54
|
+
plugins?: Record<string, PluginEntry>;
|
|
55
|
+
}
|
|
56
|
+
export type ResourceType = 'commands' | 'skills' | 'hooks' | 'mcp' | 'rules' | 'subagents' | 'workflows' | 'plugins' | 'permissions';
|
package/dist/lib/state.d.ts
CHANGED
|
@@ -125,6 +125,8 @@ export declare function getSessionsDbPath(): string;
|
|
|
125
125
|
export declare function getTeamsDir(): string;
|
|
126
126
|
/** Path to teams execution history (~/.agents/.history/teams/agents/). */
|
|
127
127
|
export declare function getTeamsAgentsDir(): string;
|
|
128
|
+
/** Path to the team registry — list of named teams with timestamps. Durable runtime, per-machine. */
|
|
129
|
+
export declare function getTeamsRegistryPath(): string;
|
|
128
130
|
/** Path to cloud dispatch cache (~/.agents/.cache/cloud/). */
|
|
129
131
|
export declare function getCloudDir(): string;
|
|
130
132
|
/** Path to terminal session metadata (~/.agents/.cache/terminals/). */
|
package/dist/lib/state.js
CHANGED
|
@@ -282,6 +282,8 @@ export function getSessionsDbPath() { return SESSIONS_DB_PATH; }
|
|
|
282
282
|
export function getTeamsDir() { return TEAMS_DIR; }
|
|
283
283
|
/** Path to teams execution history (~/.agents/.history/teams/agents/). */
|
|
284
284
|
export function getTeamsAgentsDir() { return TEAMS_AGENTS_DIR; }
|
|
285
|
+
/** Path to the team registry — list of named teams with timestamps. Durable runtime, per-machine. */
|
|
286
|
+
export function getTeamsRegistryPath() { return path.join(HISTORY_DIR, 'teams', 'registry.json'); }
|
|
285
287
|
/** Path to cloud dispatch cache (~/.agents/.cache/cloud/). */
|
|
286
288
|
export function getCloudDir() { return CLOUD_DIR; }
|
|
287
289
|
/** Path to terminal session metadata (~/.agents/.cache/terminals/). */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type AgentConfig } from './persistence.js';
|
|
2
1
|
import { AgentType } from './parsers.js';
|
|
3
2
|
/**
|
|
4
3
|
* Compute the Lowest Common Ancestor (LCA) of multiple file paths.
|
|
@@ -31,20 +30,10 @@ export type { AgentType } from './parsers.js';
|
|
|
31
30
|
* Returns null on any error so callers can skip the guard rather than crash.
|
|
32
31
|
*/
|
|
33
32
|
export declare function captureProcessStartTime(pid: number): string | null;
|
|
34
|
-
export declare const AGENT_COMMANDS: Record<AgentType, string[]>;
|
|
35
33
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
export declare function applyEditMode(agentType: AgentType, cmd: string[]): string[];
|
|
40
|
-
/**
|
|
41
|
-
* Rewrite a plan-mode command into full mode (writes + approval gates
|
|
42
|
-
* bypassed). Pure function — exported for tests.
|
|
43
|
-
*/
|
|
44
|
-
export declare function applyFullMode(agentType: AgentType, cmd: string[]): string[];
|
|
45
|
-
/**
|
|
46
|
-
* Reasoning-intensity knob wired into buildReasoningFlags.
|
|
47
|
-
* Does not select a model; use --model separately to pin a specific model per teammate.
|
|
34
|
+
* Reasoning-intensity knob. Passed through to `agents run --effort`, which
|
|
35
|
+
* translates it into per-agent reasoning flags (claude --effort, codex
|
|
36
|
+
* model_reasoning_effort override). Mode (plan/edit/full) is a separate knob.
|
|
48
37
|
*/
|
|
49
38
|
export type EffortLevel = 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto';
|
|
50
39
|
declare const VALID_MODES: readonly ["plan", "edit", "full"];
|
|
@@ -165,16 +154,13 @@ export declare class AgentManager {
|
|
|
165
154
|
private filterByCwd;
|
|
166
155
|
private cleanupAgeDays;
|
|
167
156
|
private defaultMode;
|
|
168
|
-
private agentConfigs;
|
|
169
|
-
private constructorAgentConfigs;
|
|
170
157
|
private initPromise;
|
|
171
158
|
private cloudDispatcher;
|
|
172
159
|
private constructorAgentsDir;
|
|
173
|
-
constructor(maxAgents?: number, agentsDir?: string | null, defaultMode?: Mode | null, filterByCwd?: string | null, cleanupAgeDays?: number
|
|
160
|
+
constructor(maxAgents?: number, agentsDir?: string | null, defaultMode?: Mode | null, filterByCwd?: string | null, cleanupAgeDays?: number);
|
|
174
161
|
private initialize;
|
|
175
162
|
private doInitialize;
|
|
176
163
|
getDefaultMode(): Mode;
|
|
177
|
-
setModelOverrides(agentConfigs: Record<AgentType, AgentConfig>): void;
|
|
178
164
|
/**
|
|
179
165
|
* Register the callback used to dispatch cloud-backed teammates when their
|
|
180
166
|
* --after deps resolve. Called once at CLI startup by `agents teams`.
|
|
@@ -206,9 +192,14 @@ export declare class AgentManager {
|
|
|
206
192
|
* (returns empty list).
|
|
207
193
|
*/
|
|
208
194
|
startReady(taskName: string): Promise<AgentProcess[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Build the argv to spawn for a teammate. Delegates to `agents run` so the
|
|
197
|
+
* agent's CLI flags, version routing, mode handling (plan/edit/full), model
|
|
198
|
+
* injection, and reasoning-intensity flags are owned by a single canonical
|
|
199
|
+
* exec path (src/lib/exec.ts). The team runner just supplies prompt + mode
|
|
200
|
+
* and reads stream-json events off stdout.
|
|
201
|
+
*/
|
|
209
202
|
private buildCommand;
|
|
210
|
-
private applyEditMode;
|
|
211
|
-
private applyFullMode;
|
|
212
203
|
get(agentId: string): Promise<AgentProcess | null>;
|
|
213
204
|
/**
|
|
214
205
|
* Resolve a teammate reference to a single agent_id within a team.
|