@iaforged/context-code 1.0.77 → 1.0.80

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 (127) hide show
  1. package/README.md +68 -68
  2. package/cli.js +8515 -8515
  3. package/context-bootstrap.js +27 -27
  4. package/dist/src/bootstrap/state.js +3 -0
  5. package/dist/src/bridge/bridgeMain.js +40 -40
  6. package/dist/src/cli/print.js +12 -12
  7. package/dist/src/commands/agent/agent.js +8 -0
  8. package/dist/src/commands/commit-push-pr.js +55 -55
  9. package/dist/src/commands/createMovedToPluginCommand.js +9 -9
  10. package/dist/src/commands/init-verifiers.js +238 -238
  11. package/dist/src/commands/init.js +226 -225
  12. package/dist/src/commands/install.js +2 -2
  13. package/dist/src/commands/login/login.js +24 -10
  14. package/dist/src/commands/orchestrate/index.js +1 -1
  15. package/dist/src/commands/orchestrate/orchestrate.js +110 -24
  16. package/dist/src/commands/profile/profile.js +15 -1
  17. package/dist/src/commands/provider/index.js +1 -1
  18. package/dist/src/commands/provider/provider.js +34 -1
  19. package/dist/src/commands/review.js +22 -22
  20. package/dist/src/commands/run/index.js +2 -2
  21. package/dist/src/commands/run/run.js +63 -61
  22. package/dist/src/commands/team/index.js +1 -1
  23. package/dist/src/commands/team/team.js +84 -76
  24. package/dist/src/commands/team-auto/teamAuto.js +89 -29
  25. package/dist/src/commands/terminalSetup/terminalSetup.js +24 -24
  26. package/dist/src/commands/usage/index.js +7 -0
  27. package/dist/src/commands/usage/usage.js +5 -0
  28. package/dist/src/commands/workspace/workspace.js +39 -31
  29. package/dist/src/commands.js +0 -2
  30. package/dist/src/components/ConsoleOAuthFlow.js +92 -14
  31. package/dist/src/components/ModelPicker.js +2 -0
  32. package/dist/src/components/agents/AgentsList.js +9 -9
  33. package/dist/src/components/agents/AgentsMenu.js +3 -3
  34. package/dist/src/components/agents/generateAgent.js +92 -92
  35. package/dist/src/components/agents/utils.js +13 -9
  36. package/dist/src/components/grove/Grove.js +10 -10
  37. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +8 -8
  38. package/dist/src/constants/geminiOAuth.js +13 -0
  39. package/dist/src/constants/github-app.js +134 -134
  40. package/dist/src/constants/prompts.js +123 -123
  41. package/dist/src/coordinator/coordinatorMode.js +252 -252
  42. package/dist/src/hooks/useTypeahead.js +7 -7
  43. package/dist/src/ink/reconciler.js +7 -7
  44. package/dist/src/main.js +5 -5
  45. package/dist/src/memdir/findRelevantMemories.js +6 -6
  46. package/dist/src/projectOnboardingState.js +3 -3
  47. package/dist/src/services/MagicDocs/prompts.js +56 -56
  48. package/dist/src/services/PromptSuggestion/promptSuggestion.js +29 -29
  49. package/dist/src/services/SessionMemory/prompts.js +66 -66
  50. package/dist/src/services/api/openai.js +584 -21
  51. package/dist/src/services/limits/adapters/ollama.js +3 -3
  52. package/dist/src/services/oauth/geminiCli.js +107 -0
  53. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +5 -3
  54. package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +18 -18
  55. package/dist/src/services/orchestration/global/reporting.js +2 -2
  56. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +9 -9
  57. package/dist/src/skills/bundled/batch.js +78 -78
  58. package/dist/src/skills/bundled/claudeApi.js +34 -34
  59. package/dist/src/skills/bundled/claudeInChrome.js +4 -4
  60. package/dist/src/skills/bundled/debug.js +36 -36
  61. package/dist/src/skills/bundled/scheduleRemoteAgents.js +151 -151
  62. package/dist/src/skills/bundled/skillify.js +132 -132
  63. package/dist/src/skills/bundled/stuck.js +53 -53
  64. package/dist/src/skills/bundled/updateConfig.js +418 -418
  65. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +26 -26
  66. package/dist/src/tools/AgentTool/AgentTool.js +7 -7
  67. package/dist/src/tools/AgentTool/agentDisplay.js +18 -10
  68. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +67 -67
  69. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +32 -32
  70. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +13 -13
  71. package/dist/src/tools/AgentTool/built-in/planAgent.js +49 -49
  72. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +129 -129
  73. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +119 -119
  74. package/dist/src/tools/AgentTool/prompt.js +131 -131
  75. package/dist/src/tools/AgentTool/runAgent.js +9 -9
  76. package/dist/src/tools/BashTool/BashTool.js +10 -10
  77. package/dist/src/tools/BashTool/prompt.js +94 -94
  78. package/dist/src/tools/ConfigTool/prompt.js +29 -29
  79. package/dist/src/tools/EnterWorktreeTool/prompt.js +27 -27
  80. package/dist/src/tools/FileReadTool/prompt.js +12 -12
  81. package/dist/src/tools/PowerShellTool/prompt.js +82 -82
  82. package/dist/src/tools/RemoteTriggerTool/prompt.js +9 -9
  83. package/dist/src/tools/ScheduleCronTool/prompt.js +37 -37
  84. package/dist/src/tools/TeamCreateTool/prompt.js +110 -110
  85. package/dist/src/tools/TeamDeleteTool/prompt.js +13 -13
  86. package/dist/src/utils/advisor.js +15 -15
  87. package/dist/src/utils/api.js +2 -2
  88. package/dist/src/utils/auth.js +207 -2
  89. package/dist/src/utils/autoUpdater.js +18 -18
  90. package/dist/src/utils/bash/ShellSnapshot.js +86 -86
  91. package/dist/src/utils/bash/commands.js +61 -61
  92. package/dist/src/utils/claudeInChrome/prompt.js +53 -53
  93. package/dist/src/utils/claudeInChrome/setup.js +8 -8
  94. package/dist/src/utils/claudemd.js +19 -7
  95. package/dist/src/utils/databaseMcp/server/queries.js +632 -632
  96. package/dist/src/utils/deepLink/registerProtocol.js +35 -35
  97. package/dist/src/utils/deepLink/terminalLauncher.js +12 -12
  98. package/dist/src/utils/hooks/execAgentHook.js +7 -7
  99. package/dist/src/utils/hooks/execPromptHook.js +4 -4
  100. package/dist/src/utils/hooks/skillImprovement.js +36 -36
  101. package/dist/src/utils/logoV2Utils.js +1 -1
  102. package/dist/src/utils/mcp/dateTimeParser.js +9 -9
  103. package/dist/src/utils/messages.js +191 -191
  104. package/dist/src/utils/model/model.js +18 -0
  105. package/dist/src/utils/model/modelOptions.js +51 -1
  106. package/dist/src/utils/model/modelStrings.js +5 -1
  107. package/dist/src/utils/model/modelSupportOverrides.js +3 -0
  108. package/dist/src/utils/model/providerBaseUrls.js +6 -1
  109. package/dist/src/utils/model/providerCatalog.js +64 -28
  110. package/dist/src/utils/model/providerModels.js +88 -17
  111. package/dist/src/utils/model/providerProfiles.js +8 -0
  112. package/dist/src/utils/model/providerProfilesDb.js +578 -393
  113. package/dist/src/utils/model/providerSwitch.js +12 -0
  114. package/dist/src/utils/model/providerWorkspaces.js +2 -0
  115. package/dist/src/utils/model/providers.js +65 -2
  116. package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +3 -1
  117. package/dist/src/utils/orchestration/store/runStore.js +47 -47
  118. package/dist/src/utils/orchestration/store/teamStore.js +61 -61
  119. package/dist/src/utils/powershell/parser.js +253 -253
  120. package/dist/src/utils/sessionTitle.js +12 -12
  121. package/dist/src/utils/sideQuestion.js +17 -17
  122. package/dist/src/utils/status.js +1 -1
  123. package/dist/src/utils/swarm/backends/registry.js +9 -9
  124. package/dist/src/utils/telemetry/instrumentation.js +9 -9
  125. package/dist/src/utils/teleport.js +15 -15
  126. package/dist/src/utils/undercover.js +28 -28
  127. package/package.json +1 -1
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { Box, Text } from '../../ink.js';
4
4
  import { Select } from '../../components/CustomSelect/select.js';
5
5
  import { isProfiledProvider } from '../../utils/model/providerProfiles.js';
6
- import { createTeam, createTeamDomain, createTeamDomainMember, getProviderAgentById, getProviderWorkspaceById, getProviderWorkspaceByProvider, getTeamByName, listTeamDomainMembers, listTeamDomains, listTeams, updateProviderAgent, updateTeam, updateTeamDomain, upsertProviderAgentCapability, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
6
+ import { createTeam, createTeamUnit, createTeamUnitMember, getProviderAgentById, getProviderWorkspaceById, getProviderWorkspaceByProvider, getTeamByName, listTeamUnitMembers, listTeamUnits, listTeams, updateProviderAgent, updateTeam, updateTeamUnit, upsertProviderAgentCapability, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
7
7
  import { getProviderProfile } from '../../utils/model/providerProfiles.js';
8
8
  import { createAgent, getAgent, listAgents, setAgentRoleByName } from '../agent/agentStore.js';
9
9
  function normalizeProviderInput(rawProvider) {
@@ -20,6 +20,14 @@ function normalizeProviderInput(rawProvider) {
20
20
  case 'ollama_cloud':
21
21
  case 'ollamacloud':
22
22
  return 'ollama-cloud';
23
+ case 'gemini':
24
+ case 'gemini-api-key':
25
+ case 'google-ai':
26
+ return 'gemini-api';
27
+ case 'gemini-google':
28
+ case 'google':
29
+ case 'google-oauth':
30
+ return 'gemini-google';
23
31
  default:
24
32
  return rawProvider.trim().toLowerCase();
25
33
  }
@@ -83,8 +91,8 @@ async function resolveAgentRef(ref, options) {
83
91
  const workspaceId = await ensureWorkspaceId(ref.provider);
84
92
  return { agent, workspaceId, wasCreated };
85
93
  }
86
- function getDomainAutonomyProfile(domainName) {
87
- const domain = domainName.trim().toLowerCase();
94
+ function getTeamAutonomyProfile(unitName) {
95
+ const unit = unitName.trim().toLowerCase();
88
96
  const common = [
89
97
  { name: 'planning', weight: 0.8 },
90
98
  { name: 'self-assign-roles', weight: 1 },
@@ -112,7 +120,7 @@ function getDomainAutonomyProfile(domainName) {
112
120
  planning: [
113
121
  { name: 'requirements-analysis', weight: 1 },
114
122
  { name: 'task-breakdown', weight: 1 },
115
- { name: 'cross-domain-coordination', weight: 1 },
123
+ { name: 'cross-team-coordination', weight: 1 },
116
124
  ],
117
125
  tests: [
118
126
  { name: 'test-strategy', weight: 1 },
@@ -135,24 +143,24 @@ function getDomainAutonomyProfile(domainName) {
135
143
  { name: 'observability', weight: 0.8 },
136
144
  ],
137
145
  };
138
- const capabilities = [...common, ...(byDomain[domain] ?? [{ name: domain, weight: 1 }])];
146
+ const capabilities = [...common, ...(byDomain[unit] ?? [{ name: unit, weight: 1 }])];
139
147
  return {
140
- role: domain,
148
+ role: unit,
141
149
  capabilities,
142
150
  systemPrompt: [
143
- `Eres el orquestador autonomo del dominio ${domain}.`,
151
+ `Eres el orquestador autonomo del equipo ${unit}.`,
144
152
  'Tu responsabilidad es tomar el objetivo recibido, dividirlo en roles internos temporales y reportar avances claros al orquestador global.',
145
- 'Si no hay miembros extra en el escuadron, asume internamente los roles necesarios para este dominio y explica que roles asumiste.',
153
+ 'Si no hay miembros extra en el escuadron, asume internamente los roles necesarios para este equipo y explica que roles asumiste.',
146
154
  'Reporta: trabajo realizado, decisiones, riesgos, bloqueos, porcentaje estimado y siguientes pasos.',
147
155
  ].join('\n'),
148
156
  };
149
157
  }
150
- async function applyDomainAutonomyToAgent(agent, domainName) {
151
- const profile = getDomainAutonomyProfile(domainName);
158
+ async function applyTeamAutonomyToAgent(agent, unitName) {
159
+ const profile = getTeamAutonomyProfile(unitName);
152
160
  const updated = await updateProviderAgent(agent.id, {
153
161
  roleKind: profile.role,
154
162
  isOrchestrator: true,
155
- autonomyLevel: 'domain-autonomous',
163
+ autonomyLevel: 'team-autonomous',
156
164
  systemPrompt: agent.systemPrompt?.trim() ? agent.systemPrompt : profile.systemPrompt,
157
165
  });
158
166
  for (const capability of profile.capabilities) {
@@ -164,9 +172,9 @@ async function applyDomainAutonomyToAgent(agent, domainName) {
164
172
  }
165
173
  return updated;
166
174
  }
167
- async function findDomainByName(teamId, domainName) {
168
- const domains = await listTeamDomains(teamId);
169
- return (domains.find(domain => domain.domainName.toLowerCase() === domainName.toLowerCase()) ?? null);
175
+ async function findUnitByName(teamId, unitName) {
176
+ const units = await listTeamUnits(teamId);
177
+ return (units.find(unit => unit.unitName.toLowerCase() === unitName.toLowerCase()) ?? null);
170
178
  }
171
179
  function buildTeamListMessage(teams) {
172
180
  if (teams.length === 0) {
@@ -214,7 +222,7 @@ function formatTeamWorkspace(workspace, fallbackId) {
214
222
  const state = workspace.isEnabled ? 'enabled' : 'disabled';
215
223
  return `${workspace.displayName} (${workspace.provider}, ${state})`;
216
224
  }
217
- async function buildTeamReadinessStatus(team, domains) {
225
+ async function buildTeamReadinessStatus(team, units) {
218
226
  if (!team) {
219
227
  return [];
220
228
  }
@@ -229,30 +237,30 @@ async function buildTeamReadinessStatus(team, domains) {
229
237
  else if (!globalOrchestrator.agent.isEnabled) {
230
238
  status.push(`- El orquestador global esta deshabilitado: ${formatTeamAgent(globalOrchestrator)}`);
231
239
  }
232
- if (domains.length === 0) {
233
- status.push(`- No hay dominios. Usa /team domain ${team.name} <domain> <provider>/<agent>`);
240
+ if (units.length === 0) {
241
+ status.push(`- No hay equipos internos. Usa /team equipo ${team.name} <equipo> <provider>/<agent>`);
234
242
  }
235
- for (const domain of domains) {
243
+ for (const unit of units) {
236
244
  const [workspace, localOrchestrator, lead, members] = await Promise.all([
237
- domain.workspaceId ? getProviderWorkspaceById(domain.workspaceId) : null,
238
- resolveTeamAgent(domain.localOrchestratorAgentId),
239
- resolveTeamAgent(domain.leadAgentId),
240
- listTeamDomainMembers(domain.id),
245
+ unit.workspaceId ? getProviderWorkspaceById(unit.workspaceId) : null,
246
+ resolveTeamAgent(unit.localOrchestratorAgentId),
247
+ resolveTeamAgent(unit.leadAgentId),
248
+ listTeamUnitMembers(unit.id),
241
249
  ]);
242
250
  if (!workspace) {
243
- status.push(`- ${domain.domainName}: falta workspace/proveedor.`);
251
+ status.push(`- ${unit.unitName}: falta workspace/proveedor.`);
244
252
  }
245
253
  else if (!workspace.isEnabled) {
246
- status.push(`- ${domain.domainName}: workspace deshabilitado (${workspace.provider}).`);
254
+ status.push(`- ${unit.unitName}: workspace deshabilitado (${workspace.provider}).`);
247
255
  }
248
256
  if (!localOrchestrator) {
249
- status.push(`- ${domain.domainName}: falta orquestador local. Usa /team domain ${team.name} ${domain.domainName} <provider>/<agent>`);
257
+ status.push(`- ${unit.unitName}: falta orquestador local. Usa /team equipo ${team.name} ${unit.unitName} <provider>/<agent>`);
250
258
  }
251
259
  if (!lead) {
252
- status.push(`- ${domain.domainName}: falta lead. Usa /team domain ${team.name} ${domain.domainName} <provider>/<agent>`);
260
+ status.push(`- ${unit.unitName}: falta lead. Usa /team equipo ${team.name} ${unit.unitName} <provider>/<agent>`);
253
261
  }
254
262
  if (members.length === 0 && localOrchestrator) {
255
- status.push(`- ${domain.domainName}: modo autonomo. ${formatTeamAgent(localOrchestrator)} asignara roles internos; miembros extra son opcionales.`);
263
+ status.push(`- ${unit.unitName}: modo autonomo. ${formatTeamAgent(localOrchestrator)} asignara roles internos; miembros extra son opcionales.`);
256
264
  }
257
265
  }
258
266
  return status;
@@ -262,9 +270,9 @@ async function buildTeamShowMessage(teamName) {
262
270
  if (!team) {
263
271
  return `No existe el team ${teamName}.`;
264
272
  }
265
- const domains = await listTeamDomains(team.id);
273
+ const units = await listTeamUnits(team.id);
266
274
  const globalOrchestrator = await resolveTeamAgent(team.globalOrchestratorAgentId);
267
- const readinessStatus = await buildTeamReadinessStatus(team, domains);
275
+ const readinessStatus = await buildTeamReadinessStatus(team, units);
268
276
  const lines = [
269
277
  `Team: ${team.name}`,
270
278
  `ID: ${team.id}`,
@@ -279,23 +287,23 @@ async function buildTeamShowMessage(teamName) {
279
287
  else {
280
288
  lines.push(...readinessStatus);
281
289
  }
282
- lines.push('', 'Domains:');
283
- if (domains.length === 0) {
284
- lines.push('- sin dominios');
290
+ lines.push('', 'Equipos internos:');
291
+ if (units.length === 0) {
292
+ lines.push('- sin equipos internos');
285
293
  return lines.join('\n');
286
294
  }
287
- for (const domain of domains) {
295
+ for (const unit of units) {
288
296
  const [workspace, localOrchestrator, lead] = await Promise.all([
289
- domain.workspaceId ? getProviderWorkspaceById(domain.workspaceId) : null,
290
- resolveTeamAgent(domain.localOrchestratorAgentId),
291
- resolveTeamAgent(domain.leadAgentId),
297
+ unit.workspaceId ? getProviderWorkspaceById(unit.workspaceId) : null,
298
+ resolveTeamAgent(unit.localOrchestratorAgentId),
299
+ resolveTeamAgent(unit.leadAgentId),
292
300
  ]);
293
- lines.push(`- ${domain.domainName}`);
294
- lines.push(` Workspace: ${formatTeamWorkspace(workspace, domain.workspaceId)}`);
295
- lines.push(` Local orchestrator: ${formatTeamAgent(localOrchestrator, domain.localOrchestratorAgentId)}`);
296
- lines.push(` Lead: ${formatTeamAgent(lead, domain.leadAgentId)}`);
297
- lines.push(` Mode: ${domain.selectionMode}`);
298
- const members = await listTeamDomainMembers(domain.id);
301
+ lines.push(`- ${unit.unitName}`);
302
+ lines.push(` Workspace: ${formatTeamWorkspace(workspace, unit.workspaceId)}`);
303
+ lines.push(` Local orchestrator: ${formatTeamAgent(localOrchestrator, unit.localOrchestratorAgentId)}`);
304
+ lines.push(` Lead: ${formatTeamAgent(lead, unit.leadAgentId)}`);
305
+ lines.push(` Mode: ${unit.selectionMode}`);
306
+ const members = await listTeamUnitMembers(unit.id);
299
307
  if (members.length === 0) {
300
308
  if (localOrchestrator) {
301
309
  lines.push(' - sin miembros extra; el orquestador/lead opera en modo autonomo');
@@ -348,15 +356,15 @@ async function handleOrchestrator(onDone, teamName, refText) {
348
356
  onDone(error instanceof Error ? error.message : String(error));
349
357
  }
350
358
  }
351
- async function handleDomain(onDone, teamName, domainName, refText) {
359
+ async function handleDomain(onDone, teamName, unitName, refText) {
352
360
  const ref = parseProviderRef(refText);
353
361
  if (!ref) {
354
362
  onDone('Formato invalido. Usa <provider>/<agent>.');
355
363
  return;
356
364
  }
357
- const normalizedDomain = domainName.trim().toLowerCase();
358
- if (!normalizedDomain) {
359
- onDone('Debes indicar un dominio valido.');
365
+ const normalizedUnit = unitName.trim().toLowerCase();
366
+ if (!normalizedUnit) {
367
+ onDone('Debes indicar un equipo valido.');
360
368
  return;
361
369
  }
362
370
  const team = await getTeamByName(teamName);
@@ -367,33 +375,33 @@ async function handleDomain(onDone, teamName, domainName, refText) {
367
375
  try {
368
376
  const { agent, workspaceId, wasCreated } = await resolveAgentRef(ref, {
369
377
  createIfMissing: true,
370
- roleHint: normalizedDomain,
378
+ roleHint: normalizedUnit,
371
379
  });
372
- const domainAgent = await applyDomainAutonomyToAgent(agent, normalizedDomain);
373
- const existing = await findDomainByName(team.id, normalizedDomain);
374
- const domain = existing
375
- ? await updateTeamDomain(existing.id, {
380
+ const unitAgent = await applyTeamAutonomyToAgent(agent, normalizedUnit);
381
+ const existing = await findUnitByName(team.id, normalizedUnit);
382
+ const unit = existing
383
+ ? await updateTeamUnit(existing.id, {
376
384
  workspaceId,
377
- localOrchestratorAgentId: domainAgent.id,
378
- leadAgentId: domainAgent.id,
385
+ localOrchestratorAgentId: unitAgent.id,
386
+ leadAgentId: unitAgent.id,
379
387
  selectionMode: 'manual',
380
388
  required: true,
381
389
  })
382
- : await createTeamDomain({
390
+ : await createTeamUnit({
383
391
  teamId: team.id,
384
- domainName: normalizedDomain,
392
+ unitName: normalizedUnit,
385
393
  workspaceId,
386
- localOrchestratorAgentId: domainAgent.id,
387
- leadAgentId: domainAgent.id,
394
+ localOrchestratorAgentId: unitAgent.id,
395
+ leadAgentId: unitAgent.id,
388
396
  selectionMode: 'manual',
389
397
  required: true,
390
398
  });
391
399
  onDone([
392
400
  wasCreated
393
- ? `Agente creado automaticamente: ${formatProviderRef(ref)} con rol ${normalizedDomain}.`
401
+ ? `Agente creado automaticamente: ${formatProviderRef(ref)} con rol ${normalizedUnit}.`
394
402
  : null,
395
- `Autonomia del dominio aplicada: ${formatProviderRef(ref)} queda como orquestador/lead de ${normalizedDomain}.`,
396
- `Dominio ${domain.domainName} actualizado en ${team.name}: ${formatProviderRef(ref)}`,
403
+ `Autonomia del equipo aplicada: ${formatProviderRef(ref)} queda como orquestador/lead de ${normalizedUnit}.`,
404
+ `Equipo ${unit.unitName} actualizado en ${team.name}: ${formatProviderRef(ref)}`,
397
405
  ]
398
406
  .filter(Boolean)
399
407
  .join('\n'));
@@ -402,15 +410,15 @@ async function handleDomain(onDone, teamName, domainName, refText) {
402
410
  onDone(error instanceof Error ? error.message : String(error));
403
411
  }
404
412
  }
405
- async function handleAddMember(onDone, teamName, domainName, refText, dutyText) {
413
+ async function handleAddMember(onDone, teamName, unitName, refText, dutyText) {
406
414
  const ref = parseProviderRef(refText);
407
415
  if (!ref) {
408
416
  onDone('Formato invalido. Usa <provider>/<agent>.');
409
417
  return;
410
418
  }
411
- const normalizedDomain = domainName.trim().toLowerCase();
412
- if (!normalizedDomain) {
413
- onDone('Debes indicar un dominio valido.');
419
+ const normalizedUnit = unitName.trim().toLowerCase();
420
+ if (!normalizedUnit) {
421
+ onDone('Debes indicar un equipo valido.');
414
422
  return;
415
423
  }
416
424
  const team = await getTeamByName(teamName);
@@ -418,26 +426,26 @@ async function handleAddMember(onDone, teamName, domainName, refText, dutyText)
418
426
  onDone(`No existe el team ${teamName}.`);
419
427
  return;
420
428
  }
421
- const domain = await findDomainByName(team.id, normalizedDomain);
422
- if (!domain) {
423
- onDone(`El dominio ${normalizedDomain} no existe en ${teamName}. Usa /team domain primero.`);
429
+ const unit = await findUnitByName(team.id, normalizedUnit);
430
+ if (!unit) {
431
+ onDone(`El equipo ${normalizedUnit} no existe en ${teamName}. Usa /team equipo primero.`);
424
432
  return;
425
433
  }
426
434
  try {
427
435
  const { agent } = await resolveAgentRef(ref);
428
- const members = await listTeamDomainMembers(domain.id);
436
+ const members = await listTeamUnitMembers(unit.id);
429
437
  const existing = members.find(member => member.agentId === agent.id);
430
438
  if (existing) {
431
- onDone(`El agente ${formatProviderRef(ref)} ya pertenece a ${teamName}/${normalizedDomain}.`);
439
+ onDone(`El agente ${formatProviderRef(ref)} ya pertenece a ${teamName}/${normalizedUnit}.`);
432
440
  return;
433
441
  }
434
- await createTeamDomainMember({
435
- teamDomainId: domain.id,
442
+ await createTeamUnitMember({
443
+ teamUnitId: unit.id,
436
444
  agentId: agent.id,
437
445
  duty: dutyText?.trim() || null,
438
446
  priority: 0,
439
447
  });
440
- onDone(`Miembro agregado a ${teamName}/${normalizedDomain}: ${formatProviderRef(ref)}${dutyText?.trim() ? ` [${dutyText.trim()}]` : ''}`);
448
+ onDone(`Miembro agregado a ${teamName}/${normalizedUnit}: ${formatProviderRef(ref)}${dutyText?.trim() ? ` [${dutyText.trim()}]` : ''}`);
441
449
  }
442
450
  catch (error) {
443
451
  onDone(error instanceof Error ? error.message : String(error));
@@ -561,9 +569,9 @@ export async function call(onDone, _context, args) {
561
569
  await handleOrchestrator(onDone, first, second);
562
570
  return null;
563
571
  }
564
- if (parsed.command === 'domain') {
572
+ if (parsed.command === 'equipo') {
565
573
  if (!first || !second || !third) {
566
- onDone('Uso: /team domain <team> <domain> <provider>/<agent>');
574
+ onDone('Uso: /team equipo <team> <equipo> <provider>/<agent>');
567
575
  return null;
568
576
  }
569
577
  await handleDomain(onDone, first, second, third);
@@ -571,12 +579,12 @@ export async function call(onDone, _context, args) {
571
579
  }
572
580
  if (parsed.command === 'add-member') {
573
581
  if (!first || !second || !third) {
574
- onDone('Uso: /team add-member <team> <domain> <provider>/<agent> [duty]');
582
+ onDone('Uso: /team add-member <team> <equipo> <provider>/<agent> [duty]');
575
583
  return null;
576
584
  }
577
585
  await handleAddMember(onDone, first, second, third, rest.join(' '));
578
586
  return null;
579
587
  }
580
- onDone('Uso: /team list, /team create <name>, /team show <name>, /team orchestrator <team> <provider>/<agent>, /team domain <team> <domain> <provider>/<agent>, /team add-member <team> <domain> <provider>/<agent> [duty]');
588
+ onDone('Uso: /team list, /team create <name>, /team show <name>, /team orchestrator <team> <provider>/<agent>, /team equipo <team> <equipo> <provider>/<agent>, /team add-member <team> <equipo> <provider>/<agent> [duty]');
581
589
  return null;
582
590
  }
@@ -3,17 +3,76 @@ import * as React from 'react';
3
3
  import { Box, Text, useInput } from '../../ink.js';
4
4
  import { getActiveProviderProfile, listProviderProfiles, } from '../../utils/model/providerProfiles.js';
5
5
  import { setProviderWorkspaceEnabled } from '../../utils/model/providerWorkspaces.js';
6
- import { createTeam, createTeamDomain, getProviderWorkspaceByProvider, getTeamByName, listTeamDomains, updateTeam, updateTeamDomain, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
6
+ import { createTeam, createTeamUnit, getProviderWorkspaceByProvider, getTeamByName, listTeamUnits, updateProviderAgent, updateTeam, updateTeamUnit, upsertProviderAgentCapability, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
7
7
  import { createAgent, getAgent, setAgentOrchestratorByName, setAgentRoleByName, } from '../agent/agentStore.js';
8
- const STANDARD_DOMAINS = ['frontend', 'backend', 'docs', 'planning'];
8
+ const STANDARD_UNITS = ['frontend', 'backend', 'docs', 'planning'];
9
9
  function pickFirstProfileForProvider(profiles, provider, active) {
10
10
  if (active && active.provider === provider) {
11
11
  return active;
12
12
  }
13
13
  return profiles.find(p => p.provider === provider) ?? null;
14
14
  }
15
- function buildAgentNameForDomain(domain) {
16
- return `${domain}-lead`;
15
+ function buildAgentNameForUnit(unit) {
16
+ return `${unit}-lead`;
17
+ }
18
+ function getTeamAutonomyProfile(unitName) {
19
+ const common = [
20
+ { name: 'planning', weight: 0.8 },
21
+ { name: 'self-assign-roles', weight: 1 },
22
+ { name: 'risk-reporting', weight: 0.8 },
23
+ { name: 'squad-reporting', weight: 1 },
24
+ ];
25
+ const byUnit = {
26
+ backend: [
27
+ { name: 'api-design', weight: 1 },
28
+ { name: 'database-design', weight: 0.9 },
29
+ { name: 'server-implementation', weight: 1 },
30
+ { name: 'backend-testing', weight: 0.8 },
31
+ ],
32
+ frontend: [
33
+ { name: 'ui-architecture', weight: 1 },
34
+ { name: 'component-design', weight: 1 },
35
+ { name: 'state-management', weight: 0.8 },
36
+ { name: 'frontend-testing', weight: 0.8 },
37
+ ],
38
+ docs: [
39
+ { name: 'technical-writing', weight: 1 },
40
+ { name: 'readme-maintenance', weight: 1 },
41
+ { name: 'developer-guides', weight: 0.9 },
42
+ ],
43
+ planning: [
44
+ { name: 'requirements-analysis', weight: 1 },
45
+ { name: 'task-breakdown', weight: 1 },
46
+ { name: 'cross-team-coordination', weight: 1 },
47
+ ],
48
+ };
49
+ return {
50
+ role: unitName,
51
+ capabilities: [...common, ...byUnit[unitName]],
52
+ systemPrompt: [
53
+ `Eres el orquestador autonomo del equipo ${unitName}.`,
54
+ 'Tu responsabilidad es tomar el objetivo recibido, dividirlo en roles internos temporales y reportar avances claros al orquestador global.',
55
+ 'Si no hay miembros extra en el escuadron, asume internamente los roles necesarios para este equipo y explica que roles asumiste.',
56
+ 'Reporta: trabajo realizado, decisiones, riesgos, bloqueos, porcentaje estimado y siguientes pasos.',
57
+ ].join('\n'),
58
+ };
59
+ }
60
+ async function applyTeamAutonomy(agent, unitName) {
61
+ const profile = getTeamAutonomyProfile(unitName);
62
+ await updateProviderAgent(agent.id, {
63
+ roleKind: profile.role,
64
+ isOrchestrator: true,
65
+ autonomyLevel: 'team-autonomous',
66
+ systemPrompt: agent.systemPrompt?.trim() ? agent.systemPrompt : profile.systemPrompt,
67
+ });
68
+ for (const capability of profile.capabilities) {
69
+ await upsertProviderAgentCapability({
70
+ agentId: agent.id,
71
+ capability: capability.name,
72
+ weight: capability.weight,
73
+ });
74
+ }
75
+ return (await getAgent(agent.provider, agent.name)) ?? agent;
17
76
  }
18
77
  async function isAgentExisting(provider, agentName) {
19
78
  const existing = await getAgent(provider, agentName);
@@ -40,15 +99,15 @@ async function buildPlan(args) {
40
99
  }
41
100
  }
42
101
  const existingTeam = await getTeamByName(teamName);
43
- const assignments = STANDARD_DOMAINS.map(domain => ({
44
- domain,
102
+ const assignments = STANDARD_UNITS.map(unit => ({
103
+ unit,
45
104
  provider: null,
46
105
  profile: null,
47
106
  agentName: null,
48
107
  agentExists: false,
49
108
  }));
50
- const setAssignment = async (domain, provider) => {
51
- const slot = assignments.find(a => a.domain === domain);
109
+ const setAssignment = async (unit, provider) => {
110
+ const slot = assignments.find(a => a.unit === unit);
52
111
  if (!slot)
53
112
  return;
54
113
  if (!provider) {
@@ -61,7 +120,7 @@ async function buildPlan(args) {
61
120
  const profile = pickFirstProfileForProvider(profiles, provider, active);
62
121
  if (!profile)
63
122
  return;
64
- const agentName = buildAgentNameForDomain(domain);
123
+ const agentName = buildAgentNameForUnit(unit);
65
124
  slot.provider = provider;
66
125
  slot.profile = profile;
67
126
  slot.agentName = agentName;
@@ -70,8 +129,8 @@ async function buildPlan(args) {
70
129
  const isAutonomousSingle = providerOrder.length === 1;
71
130
  if (isAutonomousSingle) {
72
131
  const onlyProvider = providerOrder[0];
73
- for (const domain of STANDARD_DOMAINS) {
74
- await setAssignment(domain, onlyProvider);
132
+ for (const unit of STANDARD_UNITS) {
133
+ await setAssignment(unit, onlyProvider);
75
134
  }
76
135
  }
77
136
  else {
@@ -109,7 +168,7 @@ async function buildPlan(args) {
109
168
  // Prefer to round-robin by using a provider already assigned (so we still
110
169
  // keep things diverse but don't leave domains empty).
111
170
  const fallbackProvider = providerOrder[0];
112
- await setAssignment(slot.domain, fallbackProvider);
171
+ await setAssignment(slot.unit, fallbackProvider);
113
172
  }
114
173
  }
115
174
  // Determine global orchestrator: pick first provider that has an isOrchestrator agent already,
@@ -163,10 +222,10 @@ async function buildPlan(args) {
163
222
  }
164
223
  function describeAssignment(slot) {
165
224
  if (!slot.provider || !slot.profile || !slot.agentName) {
166
- return `- ${slot.domain.padEnd(8)} -> sin asignar`;
225
+ return `- ${slot.unit.padEnd(8)} -> sin asignar`;
167
226
  }
168
227
  const reuseTag = slot.agentExists ? '[reusar]' : '[crear nuevo]';
169
- return `- ${slot.domain.padEnd(8)} -> ${slot.provider}/${slot.profile.name} (${slot.provider}/${slot.agentName}) ${reuseTag}`;
228
+ return `- ${slot.unit.padEnd(8)} -> ${slot.provider}/${slot.profile.name} (${slot.provider}/${slot.agentName}) ${reuseTag}`;
170
229
  }
171
230
  function describeGlobal(plan) {
172
231
  if (!plan.globalProvider || !plan.globalAgentName) {
@@ -198,7 +257,7 @@ async function applyPlan(plan) {
198
257
  messages.push(`Team creado: ${team.name}`);
199
258
  }
200
259
  // Step 3: create or reuse agents per assignment.
201
- const agentsByDomain = new Map();
260
+ const agentsByUnit = new Map();
202
261
  for (const slot of plan.assignments) {
203
262
  if (!slot.provider || !slot.agentName)
204
263
  continue;
@@ -209,9 +268,10 @@ async function applyPlan(plan) {
209
268
  name: slot.agentName,
210
269
  profileName: slot.profile?.name,
211
270
  }));
212
- // Apply role hint matching the domain (best-effort).
213
- const withRole = await setAgentRoleByName(slot.provider, slot.agentName, slot.domain);
214
- agentsByDomain.set(slot.domain, withRole ?? agent);
271
+ // The domain lead is also the local orchestrator for that domain.
272
+ const withRole = await setAgentRoleByName(slot.provider, slot.agentName, slot.unit);
273
+ const autonomousAgent = await applyTeamAutonomy(withRole ?? agent, slot.unit);
274
+ agentsByUnit.set(slot.unit, autonomousAgent);
215
275
  }
216
276
  // Step 4: ensure global orchestrator agent + flag.
217
277
  let globalAgent = null;
@@ -233,38 +293,38 @@ async function applyPlan(plan) {
233
293
  messages.push(`Orquestador global asignado: ${plan.globalProvider}/${plan.globalAgentName}`);
234
294
  }
235
295
  // Step 5: create/update domains.
236
- const existingDomains = await listTeamDomains(team.id);
237
- const existingByName = new Map(existingDomains.map(d => [d.domainName.toLowerCase(), d]));
296
+ const existingUnits = await listTeamUnits(team.id);
297
+ const existingByName = new Map(existingUnits.map(unit => [unit.unitName.toLowerCase(), unit]));
238
298
  for (const slot of plan.assignments) {
239
299
  if (!slot.provider || !slot.agentName)
240
300
  continue;
241
- const agent = agentsByDomain.get(slot.domain);
301
+ const agent = agentsByUnit.get(slot.unit);
242
302
  if (!agent)
243
303
  continue;
244
304
  const workspace = (await getProviderWorkspaceByProvider(slot.provider)) ??
245
305
  (await upsertProviderWorkspace({ provider: slot.provider, isEnabled: true }));
246
- const existingDomain = existingByName.get(slot.domain);
247
- if (existingDomain) {
248
- await updateTeamDomain(existingDomain.id, {
306
+ const existingUnit = existingByName.get(slot.unit);
307
+ if (existingUnit) {
308
+ await updateTeamUnit(existingUnit.id, {
249
309
  workspaceId: workspace.id,
250
310
  localOrchestratorAgentId: agent.id,
251
311
  leadAgentId: agent.id,
252
312
  selectionMode: 'manual',
253
313
  required: true,
254
314
  });
255
- messages.push(`Dominio actualizado: ${slot.domain}`);
315
+ messages.push(`Equipo actualizado: ${slot.unit}`);
256
316
  }
257
317
  else {
258
- await createTeamDomain({
318
+ await createTeamUnit({
259
319
  teamId: team.id,
260
- domainName: slot.domain,
320
+ unitName: slot.unit,
261
321
  workspaceId: workspace.id,
262
322
  localOrchestratorAgentId: agent.id,
263
323
  leadAgentId: agent.id,
264
324
  selectionMode: 'manual',
265
325
  required: true,
266
326
  });
267
- messages.push(`Dominio creado: ${slot.domain}`);
327
+ messages.push(`Equipo creado: ${slot.unit}`);
268
328
  }
269
329
  }
270
330
  return { team, messages };
@@ -323,7 +383,7 @@ function PlanReview({ plan, onDone, }) {
323
383
  if (phase === 'review') {
324
384
  return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { bold: true, children: ["Auto-configuracion para team ", plan.teamName] }), plan.teamExists ? (_jsx(Text, { color: "yellow", children: "team existente: se actualizara" })) : null, _jsxs(Text, { children: ["Detectados ", plan.detectedProfilesCount, " perfiles activos", plan.detectedProviders.length > 0
325
385
  ? ` (${plan.detectedProviders.join(', ')})`
326
- : '', "."] }), plan.isAutonomousSingle ? (_jsx(Text, { dimColor: true, children: "Solo un proveedor disponible: ese agente cubrira todos los dominios en modo autonomo." })) : null, _jsx(Box, { marginTop: 1, flexDirection: "column", children: plan.assignments.map(slot => (_jsx(Text, { children: describeAssignment(slot) }, slot.domain))) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: describeGlobal(plan) }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "[Enter] Aplicar | [Esc] Cancelar" }) })] }));
386
+ : '', "."] }), plan.isAutonomousSingle ? (_jsx(Text, { dimColor: true, children: "Solo un proveedor disponible: ese agente cubrira todos los equipos internos en modo autonomo." })) : null, _jsx(Box, { marginTop: 1, flexDirection: "column", children: plan.assignments.map(slot => (_jsx(Text, { children: describeAssignment(slot) }, slot.unit))) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: describeGlobal(plan) }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "[Enter] Aplicar | [Esc] Cancelar" }) })] }));
327
387
  }
328
388
  if (phase === 'applying') {
329
389
  return (_jsx(Box, { flexDirection: "column", children: _jsxs(Text, { bold: true, children: ["Aplicando auto-configuracion para ", plan.teamName, "..."] }) }));
@@ -136,8 +136,8 @@ export function markBackslashReturnUsed() {
136
136
  }
137
137
  export async function call(onDone, context, _args) {
138
138
  if (env.terminal && env.terminal in NATIVE_CSIU_TERMINALS) {
139
- const message = `Shift+Enter is natively supported in ${NATIVE_CSIU_TERMINALS[env.terminal]}.
140
-
139
+ const message = `Shift+Enter is natively supported in ${NATIVE_CSIU_TERMINALS[env.terminal]}.
140
+
141
141
  No configuration needed. Just use Shift+Enter to add newlines.`;
142
142
  onDone(message);
143
143
  return null;
@@ -156,18 +156,18 @@ No configuration needed. Just use Shift+Enter to add newlines.`;
156
156
  }
157
157
  // For Linux and other platforms, we don't show native terminal options
158
158
  // since they're not currently supported
159
- const message = `Terminal setup cannot be run from ${terminalName}.
160
-
161
- This command configures a convenient Shift+Enter shortcut for multi-line prompts.
162
- ${chalk.dim('Note: You can already use backslash (\\\\) + return to add newlines.')}
163
-
164
- To set up the shortcut (optional):
165
- 1. Exit tmux/screen temporarily
166
- 2. Run /terminal-setup directly in one of these terminals:
167
- ${platformTerminals} • IDE: VSCode, Cursor, Windsurf, Zed
168
- • Other: Alacritty
169
- 3. Return to tmux/screen - settings will persist
170
-
159
+ const message = `Terminal setup cannot be run from ${terminalName}.
160
+
161
+ This command configures a convenient Shift+Enter shortcut for multi-line prompts.
162
+ ${chalk.dim('Note: You can already use backslash (\\\\) + return to add newlines.')}
163
+
164
+ To set up the shortcut (optional):
165
+ 1. Exit tmux/screen temporarily
166
+ 2. Run /terminal-setup directly in one of these terminals:
167
+ ${platformTerminals} • IDE: VSCode, Cursor, Windsurf, Zed
168
+ • Other: Alacritty
169
+ 3. Return to tmux/screen - settings will persist
170
+
171
171
  ${chalk.dim('Note: iTerm2, WezTerm, Ghostty, Kitty, and Warp support Shift+Enter natively.')}`;
172
172
  onDone(message);
173
173
  return null;
@@ -180,13 +180,13 @@ async function installBindingsForVSCodeTerminal(editor = 'VSCode', theme) {
180
180
  // Check if we're running in a VSCode Remote SSH session
181
181
  // In this case, keybindings need to be installed on the LOCAL machine
182
182
  if (isVSCodeRemoteSSH()) {
183
- return `${color('warning', theme)(`Cannot install keybindings from a remote ${editor} session.`)}${EOL}${EOL}${editor} keybindings must be installed on your local machine, not the remote server.${EOL}${EOL}To install the Shift+Enter keybinding:${EOL}1. Open ${editor} on your local machine (not connected to remote)${EOL}2. Open the Command Palette (Cmd/Ctrl+Shift+P) → "Preferences: Open Keyboard Shortcuts (JSON)"${EOL}3. Add this keybinding (the file must be a JSON array):${EOL}${EOL}${chalk.dim(`[
184
- {
185
- "key": "shift+enter",
186
- "command": "workbench.action.terminal.sendSequence",
187
- "args": { "text": "\\u001b\\r" },
188
- "when": "terminalFocus"
189
- }
183
+ return `${color('warning', theme)(`Cannot install keybindings from a remote ${editor} session.`)}${EOL}${EOL}${editor} keybindings must be installed on your local machine, not the remote server.${EOL}${EOL}To install the Shift+Enter keybinding:${EOL}1. Open ${editor} on your local machine (not connected to remote)${EOL}2. Open the Command Palette (Cmd/Ctrl+Shift+P) → "Preferences: Open Keyboard Shortcuts (JSON)"${EOL}3. Add this keybinding (the file must be a JSON array):${EOL}${EOL}${chalk.dim(`[
184
+ {
185
+ "key": "shift+enter",
186
+ "command": "workbench.action.terminal.sendSequence",
187
+ "args": { "text": "\\u001b\\r" },
188
+ "when": "terminalFocus"
189
+ }
190
190
  ]`)}${EOL}`;
191
191
  }
192
192
  const editorDir = editor === 'VSCode' ? 'Code' : editor;
@@ -336,9 +336,9 @@ async function enableOptionAsMetaForTerminal(theme) {
336
336
  }
337
337
  }
338
338
  async function installBindingsForAlacritty(theme) {
339
- const ALACRITTY_KEYBINDING = `[[keyboard.bindings]]
340
- key = "Return"
341
- mods = "Shift"
339
+ const ALACRITTY_KEYBINDING = `[[keyboard.bindings]]
340
+ key = "Return"
341
+ mods = "Shift"
342
342
  chars = "\\u001B\\r"`;
343
343
  // Get Alacritty config file paths in order of preference
344
344
  const configPaths = [];
@@ -0,0 +1,7 @@
1
+ export default {
2
+ type: 'local-jsx',
3
+ name: 'usage',
4
+ description: 'Muestra los límites de uso del plan',
5
+ availability: ['claude-ai'],
6
+ load: () => import('./usage.js'),
7
+ };
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Settings } from '../../components/Settings/Settings.js';
3
+ export const call = async (onDone, context) => {
4
+ return _jsx(Settings, { onClose: onDone, context: context, defaultTab: "Usage" });
5
+ };