@phnx-labs/agents-cli 1.18.1 → 1.18.3

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/commands/doctor.js +19 -5
  3. package/dist/commands/exec.js +9 -4
  4. package/dist/commands/plugins.js +58 -14
  5. package/dist/commands/view.js +16 -7
  6. package/dist/index.js +30 -0
  7. package/dist/lib/hooks.js +21 -3
  8. package/dist/lib/migrate.js +35 -12
  9. package/dist/lib/plugin-marketplace.d.ts +93 -0
  10. package/dist/lib/plugin-marketplace.js +239 -0
  11. package/dist/lib/plugins.d.ts +25 -13
  12. package/dist/lib/plugins.js +350 -566
  13. package/dist/lib/shims.d.ts +3 -1
  14. package/dist/lib/shims.js +81 -7
  15. package/dist/lib/staleness/checkers/commands.d.ts +7 -0
  16. package/dist/lib/staleness/checkers/commands.js +27 -0
  17. package/dist/lib/staleness/checkers/hooks.d.ts +13 -0
  18. package/dist/lib/staleness/checkers/hooks.js +63 -0
  19. package/dist/lib/staleness/checkers/mcp.d.ts +12 -0
  20. package/dist/lib/staleness/checkers/mcp.js +38 -0
  21. package/dist/lib/staleness/checkers/permissions.d.ts +17 -0
  22. package/dist/lib/staleness/checkers/permissions.js +73 -0
  23. package/dist/lib/staleness/checkers/plugins.d.ts +11 -0
  24. package/dist/lib/staleness/checkers/plugins.js +39 -0
  25. package/dist/lib/staleness/checkers/rules.d.ts +19 -0
  26. package/dist/lib/staleness/checkers/rules.js +86 -0
  27. package/dist/lib/staleness/checkers/skills.d.ts +7 -0
  28. package/dist/lib/staleness/checkers/skills.js +34 -0
  29. package/dist/lib/staleness/checkers/subagents.d.ts +12 -0
  30. package/dist/lib/staleness/checkers/subagents.js +39 -0
  31. package/dist/lib/staleness/checkers/types.d.ts +44 -0
  32. package/dist/lib/staleness/checkers/types.js +20 -0
  33. package/dist/lib/staleness/checkers/workflows.d.ts +10 -0
  34. package/dist/lib/staleness/checkers/workflows.js +37 -0
  35. package/dist/lib/staleness/fingerprint.d.ts +38 -0
  36. package/dist/lib/staleness/fingerprint.js +154 -0
  37. package/dist/lib/staleness/index.d.ts +26 -0
  38. package/dist/lib/staleness/index.js +122 -0
  39. package/dist/lib/staleness/layers.d.ts +37 -0
  40. package/dist/lib/staleness/layers.js +100 -0
  41. package/dist/lib/staleness/types.d.ts +56 -0
  42. package/dist/lib/staleness/types.js +6 -0
  43. package/dist/lib/state.d.ts +2 -0
  44. package/dist/lib/state.js +2 -0
  45. package/dist/lib/teams/agents.d.ts +11 -20
  46. package/dist/lib/teams/agents.js +55 -202
  47. package/dist/lib/teams/index.d.ts +3 -2
  48. package/dist/lib/teams/index.js +2 -2
  49. package/dist/lib/teams/persistence.d.ts +0 -38
  50. package/dist/lib/teams/persistence.js +7 -329
  51. package/dist/lib/teams/registry.js +7 -5
  52. package/dist/lib/types.d.ts +6 -0
  53. package/dist/lib/versions.js +34 -12
  54. package/package.json +1 -1
  55. package/dist/lib/sync-manifest.d.ts +0 -81
  56. package/dist/lib/sync-manifest.js +0 -450
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
- * Rewrite a plan-mode command into edit mode (writes inside cwd allowed,
37
- * approval prompts may still appear). Pure function exported for tests.
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, agentConfigs?: Record<AgentType, AgentConfig> | null);
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.
@@ -16,9 +16,9 @@ import { randomUUID } from 'crypto';
16
16
  import { resolveAgentsDir } from './persistence.js';
17
17
  import { normalizeEvents } from './parsers.js';
18
18
  import { debug } from './debug.js';
19
- import { buildReasoningFlags } from '../models.js';
20
19
  import { setGeminiAutoUpdateDisabled, updateGeminiSettings } from '../gemini-settings.js';
21
20
  import { getAgentsDir as getSystemAgentsDir } from '../state.js';
21
+ import { AGENTS } from '../agents.js';
22
22
  let lastMemoryWarnAt = 0;
23
23
  // On macOS, os.freemem() returns only the truly-free pool and ignores the
24
24
  // large inactive+purgeable cache the kernel will reclaim under pressure, so
@@ -170,103 +170,8 @@ export function captureProcessStartTime(pid) {
170
170
  return null;
171
171
  }
172
172
  }
173
- // Base commands for plan mode (read-only). applyEditMode / applyFullMode
174
- // rewrite these for write-capable modes. Each agent's read-only flag MUST be
175
- // here so a plan-mode teammate truly cannot write — even if the teammate
176
- // prompt tries to ignore the instruction. See agents.test.ts for the contract.
177
- export const AGENT_COMMANDS = {
178
- codex: ['codex', 'exec', '--sandbox', 'read-only', '{prompt}', '--json'],
179
- cursor: ['cursor-agent', '-p', '--output-format', 'stream-json', '{prompt}'],
180
- gemini: ['gemini', '{prompt}', '--output-format', 'stream-json', '--approval-mode', 'plan'],
181
- claude: ['claude', '-p', '--verbose', '{prompt}', '--output-format', 'stream-json', '--permission-mode', 'plan'],
182
- opencode: ['opencode', 'run', '--format', 'json', '{prompt}'],
183
- };
184
- /**
185
- * Rewrite a plan-mode command into edit mode (writes inside cwd allowed,
186
- * approval prompts may still appear). Pure function — exported for tests.
187
- */
188
- export function applyEditMode(agentType, cmd) {
189
- const editCmd = [...cmd];
190
- switch (agentType) {
191
- case 'codex': {
192
- // Swap --sandbox read-only -> --sandbox workspace-write so the codex
193
- // sandbox actually permits writes. --full-auto then disables approvals.
194
- const sandboxIndex = editCmd.indexOf('--sandbox');
195
- if (sandboxIndex !== -1 && sandboxIndex + 1 < editCmd.length) {
196
- editCmd[sandboxIndex + 1] = 'workspace-write';
197
- }
198
- editCmd.push('--full-auto');
199
- break;
200
- }
201
- case 'cursor':
202
- editCmd.push('-f');
203
- break;
204
- case 'gemini': {
205
- const approvalIndex = editCmd.indexOf('--approval-mode');
206
- if (approvalIndex !== -1) {
207
- editCmd.splice(approvalIndex, 2);
208
- }
209
- editCmd.push('--yolo');
210
- break;
211
- }
212
- case 'claude': {
213
- const permModeIndex = editCmd.indexOf('--permission-mode');
214
- if (permModeIndex !== -1 && permModeIndex + 1 < editCmd.length) {
215
- editCmd[permModeIndex + 1] = 'acceptEdits';
216
- }
217
- break;
218
- }
219
- }
220
- return editCmd;
221
- }
222
- /**
223
- * Rewrite a plan-mode command into full mode (writes + approval gates
224
- * bypassed). Pure function — exported for tests.
225
- */
226
- export function applyFullMode(agentType, cmd) {
227
- const fullCmd = [...cmd];
228
- switch (agentType) {
229
- case 'codex': {
230
- const sandboxIndex = fullCmd.indexOf('--sandbox');
231
- if (sandboxIndex !== -1 && sandboxIndex + 1 < fullCmd.length) {
232
- fullCmd[sandboxIndex + 1] = 'workspace-write';
233
- }
234
- fullCmd.push('--full-auto');
235
- break;
236
- }
237
- case 'cursor':
238
- fullCmd.push('-f');
239
- break;
240
- case 'gemini': {
241
- const approvalIndex = fullCmd.indexOf('--approval-mode');
242
- if (approvalIndex !== -1) {
243
- fullCmd.splice(approvalIndex, 2);
244
- }
245
- fullCmd.push('--yolo');
246
- break;
247
- }
248
- case 'claude': {
249
- const permModeIndex = fullCmd.indexOf('--permission-mode');
250
- if (permModeIndex !== -1) {
251
- fullCmd.splice(permModeIndex, 2);
252
- }
253
- fullCmd.push('--dangerously-skip-permissions');
254
- break;
255
- }
256
- }
257
- return fullCmd;
258
- }
259
- // Minimal defaults — no per-effort model map. Configs on disk may still have
260
- // a model pinned; launchProcess picks it up from agent.model when set.
261
- function loadDefaultAgentConfigs() {
262
- return {
263
- claude: { command: 'claude -p \'{prompt}\' --output-format stream-json --json', enabled: true, model: null, provider: 'anthropic' },
264
- codex: { command: 'codex exec --sandbox workspace-write \'{prompt}\' --json', enabled: true, model: null, provider: 'openai' },
265
- gemini: { command: 'gemini \'{prompt}\' --output-format stream-json', enabled: true, model: null, provider: 'google' },
266
- cursor: { command: 'cursor-agent -p --output-format stream-json \'{prompt}\'', enabled: true, model: null, provider: 'custom' },
267
- opencode: { command: 'opencode run --format json \'{prompt}\'', enabled: true, model: null, provider: 'custom' },
268
- };
269
- }
173
+ /** Agent types the team runner supports. */
174
+ const TEAM_AGENT_TYPES = ['codex', 'cursor', 'gemini', 'claude', 'opencode'];
270
175
  // Suffix appended to all prompts to ensure agents provide a summary
271
176
  const PROMPT_SUFFIX = `
272
177
 
@@ -385,11 +290,10 @@ export async function ensureGeminiPlanMode() {
385
290
  }
386
291
  /** Check whether the CLI binary for a given agent type exists in PATH. Returns [available, pathOrError]. */
387
292
  export function checkCliAvailable(agentType) {
388
- const cmdTemplate = AGENT_COMMANDS[agentType];
389
- if (!cmdTemplate) {
293
+ const executable = AGENTS[agentType]?.cliCommand;
294
+ if (!executable) {
390
295
  return [false, `Unknown agent type: ${agentType}`];
391
296
  }
392
- const executable = cmdTemplate[0];
393
297
  try {
394
298
  const whichPath = execSync(`which ${executable}`, { encoding: 'utf-8' }).trim();
395
299
  return [true, whichPath];
@@ -401,7 +305,7 @@ export function checkCliAvailable(agentType) {
401
305
  /** Check availability of all known agent CLIs. Returns a map of agent type to install status. */
402
306
  export function checkAllClis() {
403
307
  const results = {};
404
- for (const agentType of Object.keys(AGENT_COMMANDS)) {
308
+ for (const agentType of TEAM_AGENT_TYPES) {
405
309
  const [available, pathOrError] = checkCliAvailable(agentType);
406
310
  if (available) {
407
311
  results[agentType] = { installed: true, path: pathOrError, error: null };
@@ -845,12 +749,10 @@ export class AgentManager {
845
749
  filterByCwd;
846
750
  cleanupAgeDays;
847
751
  defaultMode;
848
- agentConfigs;
849
- constructorAgentConfigs = null;
850
752
  initPromise = null;
851
753
  cloudDispatcher = null;
852
754
  constructorAgentsDir = null;
853
- constructor(maxAgents = 50, agentsDir = null, defaultMode = null, filterByCwd = null, cleanupAgeDays = 7, agentConfigs = null) {
755
+ constructor(maxAgents = 50, agentsDir = null, defaultMode = null, filterByCwd = null, cleanupAgeDays = 7) {
854
756
  this.maxAgents = maxAgents;
855
757
  this.constructorAgentsDir = agentsDir;
856
758
  this.filterByCwd = filterByCwd;
@@ -860,7 +762,6 @@ export class AgentManager {
860
762
  throw new Error(`Invalid default_mode '${defaultMode}'. Use 'plan' or 'edit'.`);
861
763
  }
862
764
  this.defaultMode = resolvedDefaultMode;
863
- this.constructorAgentConfigs = agentConfigs;
864
765
  this.initPromise = this.doInitialize();
865
766
  }
866
767
  async initialize() {
@@ -872,15 +773,11 @@ export class AgentManager {
872
773
  async doInitialize() {
873
774
  this.agentsDir = this.constructorAgentsDir || await getAgentsDir();
874
775
  await fs.mkdir(this.agentsDir, { recursive: true });
875
- this.agentConfigs = this.constructorAgentConfigs ?? loadDefaultAgentConfigs();
876
776
  await this.loadExistingAgents();
877
777
  }
878
778
  getDefaultMode() {
879
779
  return this.defaultMode;
880
780
  }
881
- setModelOverrides(agentConfigs) {
882
- this.agentConfigs = agentConfigs;
883
- }
884
781
  /**
885
782
  * Register the callback used to dispatch cloud-backed teammates when their
886
783
  * --after deps resolve. Called once at CLI startup by `agents teams`.
@@ -1070,14 +967,11 @@ export class AgentManager {
1070
967
  const running = await this.listRunning();
1071
968
  warnIfMemoryLow(running.length);
1072
969
  const effort = agent.effort ?? 'medium';
1073
- // Falls back to the pinned model in agentConfigs; null means "let the
1074
- // CLI pick its own default" (no --model flag forwarded). Effort is a
1075
- // separate knob wired into buildReasoningFlags inside buildCommand.
1076
- const resolvedModel = agent.model ?? this.agentConfigs[agent.agentType]?.model ?? null;
1077
- const cmd = this.buildCommand(agent.agentType, agent.prompt, agent.mode, resolvedModel, agent.cwd, agent.agentId, effort);
1078
- if (agent.version && cmd.length > 0) {
1079
- cmd[0] = `${cmd[0]}@${agent.version}`;
1080
- }
970
+ // null model means "let the CLI pick its own default" (no --model flag
971
+ // forwarded). Effort is a separate knob wired into buildReasoningFlags
972
+ // inside buildCommand.
973
+ const resolvedModel = agent.model ?? null;
974
+ const cmd = this.buildCommand(agent.agentType, agent.prompt, agent.mode, resolvedModel, agent.cwd, agent.agentId, effort, agent.version);
1081
975
  debug(`Launching ${agent.agentType} agent ${agent.agentId} [${agent.mode}]: ${cmd.slice(0, 3).join(' ')}...`);
1082
976
  try {
1083
977
  const stdoutPath = await agent.getStdoutPath();
@@ -1154,98 +1048,57 @@ export class AgentManager {
1154
1048
  }
1155
1049
  return launched;
1156
1050
  }
1157
- buildCommand(agentType, prompt, mode, model, cwd = null, sessionId = null, effort = 'medium') {
1158
- const cmdTemplate = AGENT_COMMANDS[agentType];
1159
- if (!cmdTemplate) {
1160
- throw new Error(`Unknown agent type: ${agentType}`);
1161
- }
1162
- const isEditMode = mode === 'edit';
1163
- // Build the full prompt with prefix (for plan mode) and suffix
1051
+ /**
1052
+ * Build the argv to spawn for a teammate. Delegates to `agents run` so the
1053
+ * agent's CLI flags, version routing, mode handling (plan/edit/full), model
1054
+ * injection, and reasoning-intensity flags are owned by a single canonical
1055
+ * exec path (src/lib/exec.ts). The team runner just supplies prompt + mode
1056
+ * and reads stream-json events off stdout.
1057
+ */
1058
+ buildCommand(agentType, prompt, mode, model, cwd = null, sessionId = null, effort = 'medium', version = null) {
1059
+ // Compose the prompt: a plan-mode prefix for Claude (clarifying headless
1060
+ // plan-mode restrictions) and a universal summary suffix. These are
1061
+ // team-specific prompt scaffolding — `agents run` does not apply them.
1164
1062
  let fullPrompt = prompt + PROMPT_SUFFIX;
1165
- // For Claude in plan mode, add prefix explaining headless plan mode restrictions
1166
- if (agentType === 'claude' && !isEditMode) {
1063
+ if (agentType === 'claude' && mode !== 'edit') {
1167
1064
  fullPrompt = CLAUDE_PLAN_MODE_PREFIX + fullPrompt;
1168
1065
  }
1169
- let cmd = cmdTemplate.map(part => part.replace('{prompt}', fullPrompt));
1170
- if (agentType === 'claude') {
1171
- // Grant access to the working directory.
1172
- if (cwd) {
1173
- cmd.push('--add-dir', cwd);
1174
- }
1175
- // Pin Claude's session UUID to our agent_id so the session file lands
1176
- // at ~/.claude/projects/.../<agent_id>.jsonl — unified identity.
1177
- if (sessionId) {
1178
- cmd.push('--session-id', sessionId);
1179
- }
1180
- // Note: we deliberately do NOT pass --settings here. The agents-cli
1181
- // shim exports CLAUDE_CONFIG_DIR scoped to the version being spawned,
1182
- // which makes Claude read settings.json, commands/, skills/, hooks/,
1183
- // and MCP config from that version's home. Passing a fixed
1184
- // ~/.claude/settings.json would override that and bind settings to the
1185
- // *default* version rather than the one this teammate is running.
1186
- }
1066
+ const target = version ? `${agentType}@${version}` : agentType;
1067
+ const agentsCli = process.argv[1];
1068
+ const cmd = [
1069
+ process.execPath,
1070
+ agentsCli,
1071
+ 'run',
1072
+ target,
1073
+ fullPrompt,
1074
+ '--mode', mode,
1075
+ '--effort', effort,
1076
+ '--json',
1077
+ '--headless',
1078
+ '--quiet',
1079
+ ];
1080
+ if (model)
1081
+ cmd.push('--model', model);
1082
+ if (cwd)
1083
+ cmd.push('--cwd', cwd);
1084
+ // Pin Claude's session UUID to our agent_id so its session file lands at
1085
+ // ~/.claude/projects/.../<agent_id>.jsonl — unified identity for status polling.
1086
+ if (agentType === 'claude' && sessionId) {
1087
+ cmd.push('--session-id', sessionId);
1088
+ }
1089
+ // Claude: grant access to the teammate's working directory.
1090
+ if (agentType === 'claude' && cwd) {
1091
+ cmd.push('--add-dir', cwd);
1092
+ }
1093
+ // Codex's workspace-write sandbox blocks writes outside cwd. Factory
1094
+ // teammates need to run further `agents teams add` commands, which
1095
+ // write to ~/.agents/. Grant that root so subprocess-issued
1096
+ // `agents teams add` calls hit the real store.
1187
1097
  if (agentType === 'codex') {
1188
- // Codex's workspace-write sandbox blocks writes outside cwd. Factory
1189
- // teammates need to run further `agents teams add` commands,
1190
- // which write to ~/.agents/. Grant that root so subprocess-issued
1191
- // `agents teams add` calls hit the real store instead of the tmp
1192
- // fallback (which the supervisor does not watch).
1193
1098
  cmd.push('--add-dir', getSystemAgentsDir());
1194
1099
  }
1195
- // Add model flag for each agent type only when the teammate has a pinned
1196
- // model. When null, the agent's CLI picks its own default.
1197
- if (model) {
1198
- if (agentType === 'codex') {
1199
- const execIndex = cmd.indexOf('exec');
1200
- const sandboxIndex = cmd.indexOf('--sandbox');
1201
- const insertIndex = sandboxIndex !== -1 ? sandboxIndex : execIndex + 1;
1202
- cmd.splice(insertIndex, 0, '--model', model);
1203
- }
1204
- else if (agentType === 'cursor') {
1205
- cmd.push('--model', model);
1206
- }
1207
- else if (agentType === 'gemini' || agentType === 'claude') {
1208
- cmd.push('--model', model);
1209
- }
1210
- else if (agentType === 'opencode') {
1211
- cmd.push('--model', model);
1212
- }
1213
- }
1214
- if (agentType === 'opencode') {
1215
- const opencodeAgent = mode === 'edit' || mode === 'full' ? 'build' : 'plan';
1216
- const promptIndex = cmd.indexOf(fullPrompt);
1217
- if (promptIndex !== -1) {
1218
- cmd.splice(promptIndex + 1, 0, '--agent', opencodeAgent);
1219
- }
1220
- }
1221
- // Inject reasoning-intensity flags for agents that support them. Claude
1222
- // gets --effort appended; Codex gets `-c model_reasoning_effort=...`
1223
- // inserted before `exec` so it's parsed as a global config override.
1224
- const reasoningFlags = buildReasoningFlags(agentType, effort);
1225
- if (reasoningFlags.length > 0) {
1226
- if (agentType === 'codex') {
1227
- const execIndex = cmd.indexOf('exec');
1228
- const insertIndex = execIndex !== -1 ? execIndex : 1;
1229
- cmd.splice(insertIndex, 0, ...reasoningFlags);
1230
- }
1231
- else {
1232
- cmd.push(...reasoningFlags);
1233
- }
1234
- }
1235
- if (mode === 'full') {
1236
- cmd = this.applyFullMode(agentType, cmd);
1237
- }
1238
- else if (isEditMode) {
1239
- cmd = this.applyEditMode(agentType, cmd);
1240
- }
1241
1100
  return cmd;
1242
1101
  }
1243
- applyEditMode(agentType, cmd) {
1244
- return applyEditMode(agentType, cmd);
1245
- }
1246
- applyFullMode(agentType, cmd) {
1247
- return applyFullMode(agentType, cmd);
1248
- }
1249
1102
  async get(agentId) {
1250
1103
  await this.initialize();
1251
1104
  let agent = this.agents.get(agentId) || null;
@@ -5,11 +5,12 @@
5
5
  * to reuse the same agent lifecycle, parsing, summarization, and persistence
6
6
  * layer that powers the `agents teams` CLI.
7
7
  */
8
- export { AgentManager, AgentProcess, AgentStatus, VALID_TASK_TYPES, AGENT_COMMANDS, computePathLCA, checkAllClis, checkCliAvailable, ensureGeminiPlanMode, getAgentsDir, resolveMode, type TaskType, type CloudDispatchFn, } from './agents.js';
8
+ export { AgentManager, AgentProcess, AgentStatus, VALID_TASK_TYPES, computePathLCA, checkAllClis, checkCliAvailable, ensureGeminiPlanMode, getAgentsDir, resolveMode, type TaskType, type CloudDispatchFn, } from './agents.js';
9
9
  export { type AgentType } from './parsers.js';
10
10
  export { normalizeEvents, normalizeEvent, parseEvent } from './parsers.js';
11
11
  export { handleSpawn, handleStatus, handleStop, handleTasks, type SpawnResult, type AgentStatusDetail, type TaskStatusResult, type StopResult, type TaskInfo, type TasksResult, } from './api.js';
12
- export { readConfig, resolveAgentsDir, resolveBaseDir, type EffortLevel, type ModelOverrides, type ProviderConfig, type AgentConfig, type SwarmConfig, type ReadConfigResult, } from './persistence.js';
12
+ export { resolveAgentsDir, resolveBaseDir, } from './persistence.js';
13
+ export { type EffortLevel } from './agents.js';
13
14
  export { collapseEvents, getToolBreakdown, groupAndFlattenEvents, summarizeEvents, getDelta, filterEventsByPriority, getLastTool, getToolUses, getLastMessages, getQuickStatus, getStatusSummary, AgentSummary, PRIORITY, type QuickStatus, } from './summarizer.js';
14
15
  export { extractFileOpsFromBash } from './file_ops.js';
15
16
  export { debug } from './debug.js';
@@ -5,10 +5,10 @@
5
5
  * to reuse the same agent lifecycle, parsing, summarization, and persistence
6
6
  * layer that powers the `agents teams` CLI.
7
7
  */
8
- export { AgentManager, AgentProcess, AgentStatus, VALID_TASK_TYPES, AGENT_COMMANDS, computePathLCA, checkAllClis, checkCliAvailable, ensureGeminiPlanMode, getAgentsDir, resolveMode, } from './agents.js';
8
+ export { AgentManager, AgentProcess, AgentStatus, VALID_TASK_TYPES, computePathLCA, checkAllClis, checkCliAvailable, ensureGeminiPlanMode, getAgentsDir, resolveMode, } from './agents.js';
9
9
  export { normalizeEvents, normalizeEvent, parseEvent } from './parsers.js';
10
10
  export { handleSpawn, handleStatus, handleStop, handleTasks, } from './api.js';
11
- export { readConfig, resolveAgentsDir, resolveBaseDir, } from './persistence.js';
11
+ export { resolveAgentsDir, resolveBaseDir, } from './persistence.js';
12
12
  export { collapseEvents, getToolBreakdown, groupAndFlattenEvents, summarizeEvents, getDelta, filterEventsByPriority, getLastTool, getToolUses, getLastMessages, getQuickStatus, getStatusSummary, AgentSummary, PRIORITY, } from './summarizer.js';
13
13
  export { extractFileOpsFromBash } from './file_ops.js';
14
14
  export { debug } from './debug.js';
@@ -1,42 +1,4 @@
1
- import { AgentType } from './parsers.js';
2
1
  /** Resolve the base data directory for teams, preferring ~/.agents/teams/ with a temp fallback. */
3
2
  export declare function resolveBaseDir(): Promise<string>;
4
- /** Reasoning-intensity levels supported by the teams system. */
5
- export type EffortLevel = 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto';
6
- /**
7
- * Legacy type retained for config-file back-compat. Older configs pinned a
8
- * model per effort tier; we no longer act on these entries but accept them
9
- * without error when loading from disk.
10
- */
11
- export type ModelOverrides = Partial<Record<AgentType, Partial<Record<EffortLevel, string>>>>;
12
- /** API endpoint configuration for a model provider. */
13
- export interface ProviderConfig {
14
- apiEndpoint: string | null;
15
- }
16
- /** Per-agent-type configuration: CLI command template, enabled state, optional pinned model, and provider. */
17
- export interface AgentConfig {
18
- command: string;
19
- enabled: boolean;
20
- model: string | null;
21
- provider: string;
22
- }
23
- /** Top-level teams configuration structure persisted to config.json. */
24
- export interface SwarmConfig {
25
- agents: Record<AgentType, AgentConfig>;
26
- providers: Record<string, ProviderConfig>;
27
- }
28
- /** Result of reading the teams config, including resolved agent and provider configurations. */
29
- export interface ReadConfigResult {
30
- hasConfig: boolean;
31
- enabledAgents: AgentType[];
32
- agentConfigs: Record<AgentType, AgentConfig>;
33
- providerConfigs: Record<string, ProviderConfig>;
34
- }
35
3
  /** Resolve and ensure the agents subdirectory exists under the teams base dir. */
36
4
  export declare function resolveAgentsDir(): Promise<string>;
37
- /** Read teams config from disk, migrating legacy formats if needed. Returns defaults when no config exists. */
38
- export declare function readConfig(): Promise<ReadConfigResult>;
39
- /** Write teams config to disk. */
40
- export declare function writeConfig(config: SwarmConfig): Promise<void>;
41
- /** Update the enabled/disabled status of a specific agent type in the config file. */
42
- export declare function setAgentEnabled(agentType: AgentType, enabled: boolean): Promise<void>;