@iaforged/context-code 1.2.9 → 1.2.12

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 (172) hide show
  1. package/README.md +119 -119
  2. package/context-bootstrap.js +28 -26
  3. package/dist/src/QueryEngine.js +394 -327
  4. package/dist/src/bridge/bridgeUI.js +1 -1
  5. package/dist/src/buddy/prompt.js +4 -4
  6. package/dist/src/cli/handlers/auth.js +126 -9
  7. package/dist/src/cli/print.js +35 -1
  8. package/dist/src/commands/agent/agent.js +28 -2
  9. package/dist/src/commands/agent/agentStore.js +8 -1
  10. package/dist/src/commands/agent/index.js +1 -1
  11. package/dist/src/commands/bridge-kick.js +9 -9
  12. package/dist/src/commands/commit.js +34 -34
  13. package/dist/src/commands/init-verifiers.js +3 -3
  14. package/dist/src/commands/init.js +88 -88
  15. package/dist/src/commands/insights.js +787 -787
  16. package/dist/src/commands/install.js +19 -19
  17. package/dist/src/commands/login/login.js +21 -12
  18. package/dist/src/commands/logout/logout.js +9 -0
  19. package/dist/src/commands/model/model.js +9 -4
  20. package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
  21. package/dist/src/commands/orchestrate/index.js +2 -2
  22. package/dist/src/commands/orchestrate/orchestrate.js +708 -12
  23. package/dist/src/commands/pr_comments/index.js +33 -33
  24. package/dist/src/commands/profile/index.js +1 -1
  25. package/dist/src/commands/profile/profile.js +52 -3
  26. package/dist/src/commands/provider/index.js +1 -1
  27. package/dist/src/commands/provider/provider.js +117 -45
  28. package/dist/src/commands/resumen/index.js +9 -0
  29. package/dist/src/commands/resumen/resumen.js +29 -0
  30. package/dist/src/commands/security-review.js +190 -190
  31. package/dist/src/commands/swarm-auto/index.js +9 -0
  32. package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
  33. package/dist/src/commands/swarm-init/index.js +9 -0
  34. package/dist/src/commands/swarm-init/swarmInit.js +72 -0
  35. package/dist/src/commands/team/team.js +39 -6
  36. package/dist/src/commands.js +14 -0
  37. package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
  38. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
  39. package/dist/src/components/agents/agentFileUtils.js +6 -6
  40. package/dist/src/components/permissions/hooks.js +5 -5
  41. package/dist/src/constants/outputStyles.js +83 -83
  42. package/dist/src/core/agents/blueprints.js +58 -0
  43. package/dist/src/core/agents/cliAdapter.js +61 -0
  44. package/dist/src/core/agents/registry.js +93 -0
  45. package/dist/src/core/agents/runtime.js +4 -0
  46. package/dist/src/core/agents/runtime.smoke.js +42 -0
  47. package/dist/src/core/agents/swarm.smoke.js +48 -0
  48. package/dist/src/core/agents/swarmTools.js +38 -0
  49. package/dist/src/core/auth/index.js +2 -0
  50. package/dist/src/core/auth/loginCliAdapter.js +24 -0
  51. package/dist/src/core/auth/loginCore.js +67 -0
  52. package/dist/src/core/auth/logoutCliAdapter.js +34 -0
  53. package/dist/src/core/auth/logoutCore.js +52 -0
  54. package/dist/src/core/auth/preflight.smoke.js +151 -0
  55. package/dist/src/core/index.js +21 -0
  56. package/dist/src/core/mcp/blueprints.js +27 -0
  57. package/dist/src/core/mcp/common.js +14 -0
  58. package/dist/src/core/mcp/runtime.js +67 -0
  59. package/dist/src/core/mcp/runtime.smoke.js +50 -0
  60. package/dist/src/core/mcp/swarmClient.js +40 -0
  61. package/dist/src/core/mcp/swarmSetup.js +43 -0
  62. package/dist/src/core/providers/cliAdapter.js +39 -0
  63. package/dist/src/core/providers/contracts.js +1 -0
  64. package/dist/src/core/providers/index.js +3 -0
  65. package/dist/src/core/providers/llmCore.js +123 -0
  66. package/dist/src/core/providers/providerCore.js +141 -0
  67. package/dist/src/core/providers/providerModelCompatibility.js +98 -0
  68. package/dist/src/core/providers/providerParitySmoke.js +83 -0
  69. package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
  70. package/dist/src/core/query/contracts.js +1 -0
  71. package/dist/src/core/query/runtime.js +117 -0
  72. package/dist/src/core/query/runtime.smoke.js +39 -0
  73. package/dist/src/core/query/timelineThinking.smoke.js +25 -0
  74. package/dist/src/core/query/wiring.smoke.js +76 -0
  75. package/dist/src/core/skills/cliAdapter.js +38 -0
  76. package/dist/src/core/skills/index.js +52 -0
  77. package/dist/src/core/skills/runtime.smoke.js +53 -0
  78. package/dist/src/core/tasks/runtime.js +205 -0
  79. package/dist/src/core/tasks/runtime.smoke.js +63 -0
  80. package/dist/src/core/tasks/sdkAdapter.js +4 -0
  81. package/dist/src/core/tools/contracts.js +3 -0
  82. package/dist/src/core/tools/fileResolution.js +112 -0
  83. package/dist/src/core/tools/fileResolution.smoke.js +33 -0
  84. package/dist/src/core/tools/filesCore.js +51 -0
  85. package/dist/src/core/tools/filesCore.smoke.js +108 -0
  86. package/dist/src/core/tools/gitCore.js +20 -0
  87. package/dist/src/core/tools/imageParity.smoke.js +36 -0
  88. package/dist/src/core/tools/notebookParity.smoke.js +68 -0
  89. package/dist/src/core/tools/registry.js +22 -0
  90. package/dist/src/core/tools/runtime.smoke.js +32 -0
  91. package/dist/src/core/tools/shellCore.js +60 -0
  92. package/dist/src/core/types/agentContext.js +9 -0
  93. package/dist/src/core/types/auth.js +3 -0
  94. package/dist/src/core/types/command.js +13 -0
  95. package/dist/src/core/types/provider.js +3 -0
  96. package/dist/src/core/types/sdkEvent.js +10 -0
  97. package/dist/src/core/types/swarm.js +1 -0
  98. package/dist/src/cost-tracker.js +3 -3
  99. package/dist/src/hooks/useAwaySummary.js +22 -9
  100. package/dist/src/main.js +32 -2
  101. package/dist/src/screens/REPL.js +9 -0
  102. package/dist/src/services/AgentSummary/agentSummary.js +10 -10
  103. package/dist/src/services/autoDream/autoDream.js +5 -5
  104. package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
  105. package/dist/src/services/compact/prompt.js +238 -238
  106. package/dist/src/services/limits/sessionCounter.js +17 -17
  107. package/dist/src/services/mcp/client.js +27 -1
  108. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
  109. package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
  110. package/dist/src/skills/bundled/loop.js +57 -57
  111. package/dist/src/skills/bundled/remember.js +53 -53
  112. package/dist/src/skills/bundled/simplify.js +49 -49
  113. package/dist/src/skills/bundled/skillify.js +2 -2
  114. package/dist/src/state/onChangeAppState.js +6 -0
  115. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
  116. package/dist/src/tasks/LocalMainSessionTask.js +5 -5
  117. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
  118. package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
  119. package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
  120. package/dist/src/tools/BashTool/BashTool.js +27 -2
  121. package/dist/src/tools/BriefTool/prompt.js +14 -14
  122. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
  123. package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
  124. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
  125. package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
  126. package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
  127. package/dist/src/tools/FileEditTool/prompt.js +7 -7
  128. package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
  129. package/dist/src/tools/FileWriteTool/prompt.js +6 -6
  130. package/dist/src/tools/GlobTool/prompt.js +4 -4
  131. package/dist/src/tools/GrepTool/prompt.js +10 -10
  132. package/dist/src/tools/LSPTool/prompt.js +18 -18
  133. package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
  134. package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
  135. package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
  136. package/dist/src/tools/SendMessageTool/prompt.js +36 -36
  137. package/dist/src/tools/SkillTool/prompt.js +21 -21
  138. package/dist/src/tools/SleepTool/prompt.js +10 -10
  139. package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
  140. package/dist/src/tools/TaskGetTool/prompt.js +21 -21
  141. package/dist/src/tools/TaskListTool/prompt.js +30 -30
  142. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
  143. package/dist/src/tools/TaskStopTool/prompt.js +5 -5
  144. package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
  145. package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
  146. package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
  147. package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
  148. package/dist/src/tools/WebFetchTool/prompt.js +31 -31
  149. package/dist/src/tools/WebSearchTool/prompt.js +26 -26
  150. package/dist/src/utils/agentContext.js +2 -0
  151. package/dist/src/utils/agenticSessionSearch.js +38 -38
  152. package/dist/src/utils/config.js +2 -0
  153. package/dist/src/utils/genericProcessUtils.js +21 -21
  154. package/dist/src/utils/heapDumpService.js +4 -4
  155. package/dist/src/utils/mcpValidation.js +2 -2
  156. package/dist/src/utils/model/modelStrings.js +1 -1
  157. package/dist/src/utils/model/providers.js +5 -0
  158. package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
  159. package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
  160. package/dist/src/utils/orchestration/store/runStore.js +68 -68
  161. package/dist/src/utils/orchestration/store/teamStore.js +28 -28
  162. package/dist/src/utils/permissions/permissionExplainer.js +6 -6
  163. package/dist/src/utils/permissions/permissionsDb.js +43 -43
  164. package/dist/src/utils/sdkEventQueue.js +2 -0
  165. package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
  166. package/dist/src/utils/standardMcp/common.js +15 -0
  167. package/dist/src/utils/standardMcp/setup.js +52 -0
  168. package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
  169. package/dist/src/utils/task/framework.js +6 -6
  170. package/package.json +1 -1
  171. package/dist/src/commands/usage/index.js +0 -7
  172. package/dist/src/commands/usage/usage.js +0 -5
@@ -9,39 +9,39 @@ export default createMovedToPluginCommand({
9
9
  return [
10
10
  {
11
11
  type: 'text',
12
- text: `You are an AI assistant integrated into a git-based version control system. Your task is to fetch and display comments from a GitHub pull request.
13
-
14
- Follow these steps:
15
-
16
- 1. Use \`gh pr view --json number,headRepository\` to get the PR number and repository info
17
- 2. Use \`gh api /repos/{owner}/{repo}/issues/{number}/comments\` to get PR-level comments
18
- 3. Use \`gh api /repos/{owner}/{repo}/pulls/{number}/comments\` to get review comments. Pay particular attention to the following fields: \`body\`, \`diff_hunk\`, \`path\`, \`line\`, etc. If the comment references some code, consider fetching it using eg \`gh api /repos/{owner}/{repo}/contents/{path}?ref={branch} | jq .content -r | base64 -d\`
19
- 4. Parse and format all comments in a readable way
20
- 5. Return ONLY the formatted comments, with no additional text
21
-
22
- Format the comments as:
23
-
24
- ## Comments
25
-
26
- [For each comment thread:]
27
- - @author file.ts#line:
28
- \`\`\`diff
29
- [diff_hunk from the API response]
30
- \`\`\`
31
- > quoted comment text
32
-
33
- [any replies indented]
34
-
35
- If there are no comments, return "No comments found."
36
-
37
- Remember:
38
- 1. Only show the actual comments, no explanatory text
39
- 2. Include both PR-level and code review comments
40
- 3. Preserve the threading/nesting of comment replies
41
- 4. Show the file and line number context for code review comments
42
- 5. Use jq to parse the JSON responses from the GitHub API
43
-
44
- ${args ? 'Additional user input: ' + args : ''}
12
+ text: `You are an AI assistant integrated into a git-based version control system. Your task is to fetch and display comments from a GitHub pull request.
13
+
14
+ Follow these steps:
15
+
16
+ 1. Use \`gh pr view --json number,headRepository\` to get the PR number and repository info
17
+ 2. Use \`gh api /repos/{owner}/{repo}/issues/{number}/comments\` to get PR-level comments
18
+ 3. Use \`gh api /repos/{owner}/{repo}/pulls/{number}/comments\` to get review comments. Pay particular attention to the following fields: \`body\`, \`diff_hunk\`, \`path\`, \`line\`, etc. If the comment references some code, consider fetching it using eg \`gh api /repos/{owner}/{repo}/contents/{path}?ref={branch} | jq .content -r | base64 -d\`
19
+ 4. Parse and format all comments in a readable way
20
+ 5. Return ONLY the formatted comments, with no additional text
21
+
22
+ Format the comments as:
23
+
24
+ ## Comments
25
+
26
+ [For each comment thread:]
27
+ - @author file.ts#line:
28
+ \`\`\`diff
29
+ [diff_hunk from the API response]
30
+ \`\`\`
31
+ > quoted comment text
32
+
33
+ [any replies indented]
34
+
35
+ If there are no comments, return "No comments found."
36
+
37
+ Remember:
38
+ 1. Only show the actual comments, no explanatory text
39
+ 2. Include both PR-level and code review comments
40
+ 3. Preserve the threading/nesting of comment replies
41
+ 4. Show the file and line number context for code review comments
42
+ 5. Use jq to parse the JSON responses from the GitHub API
43
+
44
+ ${args ? 'Additional user input: ' + args : ''}
45
45
  `,
46
46
  },
47
47
  ];
@@ -3,7 +3,7 @@ export default {
3
3
  type: 'local-jsx',
4
4
  name: 'profile',
5
5
  description: 'Listar, inspeccionar y cambiar perfiles de proveedor',
6
- argumentHint: '[list|current|migrate|use <proveedor> <perfil>|rename <proveedor> <actual> <nuevo>|remove <proveedor> <perfil>|remove all|model <proveedor> <perfil> <modelo|clear>]',
6
+ argumentHint: '[list|current|migrate|create <proveedor> <perfil>|use <proveedor> <perfil>|rename <proveedor> <actual> <nuevo>|remove <proveedor> <perfil>|remove all|model <proveedor> <perfil> <modelo|clear>]',
7
7
  isEnabled: () => true,
8
8
  load: () => import('./profile.js'),
9
9
  };
@@ -5,8 +5,8 @@ import { Dialog } from '../../components/design-system/Dialog.js';
5
5
  import { useMainLoopModel } from '../../hooks/useMainLoopModel.js';
6
6
  import { useSetAppState } from '../../state/AppState.js';
7
7
  import { getAPIProvider, } from '../../utils/model/providers.js';
8
- import { finalizeProviderProfilesMigration, getProviderProfilesDbPath, getProviderProfilesStorageBackend, getProviderProfilesStorageMode, purgeLegacyProviderStateInConfig, } from '../../utils/model/providerProfilesDb.js';
9
- import { clearAllProviderProfiles, findProviderProfileByName, getActiveProviderProfile, getLastUsedProviderProfile, getProviderProfile, isProfiledProvider, listProviderProfiles, removeProviderProfile, renameProviderProfile, setProviderProfileAgentNameByName, setProviderProfileLastModelByName, } from '../../utils/model/providerProfiles.js';
8
+ import { finalizeProviderProfilesMigration, getProviderProfilesDbPath, getProviderProfilesStorageBackend, getProviderProfilesStorageMode, purgeLegacyProviderStateInConfig, setStoredActiveProviderPreference, } from '../../utils/model/providerProfilesDb.js';
9
+ import { clearAllProviderProfiles, createProviderProfile, findProviderProfileByName, getActiveProviderProfile, getLastUsedProviderProfile, getProviderProfile, isProfiledProvider, listProviderProfiles, removeProviderProfile, renameProviderProfile, setActiveProviderProfile, setProviderProfileAgentNameByName, setProviderProfileLastModelByName, } from '../../utils/model/providerProfiles.js';
10
10
  import { fetchProviderModels } from '../../utils/model/providerModels.js';
11
11
  import { switchProviderPreference } from '../../utils/model/providerSwitch.js';
12
12
  import { removeAllProviderScopedCredentials, removeProviderScopedCredentials, renameProviderScopedCredentials, } from '../../utils/auth.js';
@@ -148,6 +148,24 @@ function parseUseArgs(args) {
148
148
  }
149
149
  return { provider, profileName };
150
150
  }
151
+ function parseCreateArgs(args) {
152
+ if (!args) {
153
+ return null;
154
+ }
155
+ const tokens = args.trim().split(/\s+/).filter(Boolean);
156
+ if (tokens[0]?.toLowerCase() !== 'create') {
157
+ return null;
158
+ }
159
+ const provider = normalizeProviderInput(tokens[1]);
160
+ if (!provider || !isProfiledProvider(provider)) {
161
+ return null;
162
+ }
163
+ const profileName = tokens.slice(2).join(' ').trim();
164
+ if (!profileName) {
165
+ return null;
166
+ }
167
+ return { provider, profileName };
168
+ }
151
169
  function parseRenameArgs(args) {
152
170
  if (!args) {
153
171
  return null;
@@ -306,9 +324,24 @@ function buildMigrationSummaryMessage() {
306
324
  }
307
325
  return lines.join('\n');
308
326
  }
327
+ function reconcileActiveProviderProfileState() {
328
+ const activeProfile = getActiveProviderProfile();
329
+ if (activeProfile) {
330
+ setStoredActiveProviderPreference(activeProfile.provider);
331
+ return;
332
+ }
333
+ const fallbackProfile = listProviderProfiles()[0];
334
+ if (!fallbackProfile) {
335
+ setStoredActiveProviderPreference(null);
336
+ return;
337
+ }
338
+ setActiveProviderProfile(fallbackProfile.id);
339
+ setStoredActiveProviderPreference(fallbackProfile.provider);
340
+ }
309
341
  async function performRemoveAllProfiles(onDone, context) {
310
342
  try {
311
343
  const removedProfiles = clearAllProviderProfiles();
344
+ reconcileActiveProviderProfileState();
312
345
  await removeAllProviderScopedCredentials();
313
346
  await clearAuthRelatedCaches();
314
347
  context.onChangeAPIKey();
@@ -388,6 +421,21 @@ export async function call(onDone, context, args) {
388
421
  onDone(buildMigrationSummaryMessage());
389
422
  return null;
390
423
  }
424
+ const createArgs = parseCreateArgs(trimmedArgs);
425
+ if (createArgs) {
426
+ const existing = findProviderProfileByName(createArgs.provider, createArgs.profileName);
427
+ if (existing) {
428
+ onDone(`Ya existe el perfil ${existing.provider}/${existing.name}.`);
429
+ return null;
430
+ }
431
+ const created = createProviderProfile({
432
+ provider: createArgs.provider,
433
+ name: createArgs.profileName,
434
+ });
435
+ reconcileActiveProviderProfileState();
436
+ onDone(`Perfil creado: ${created.provider}/${created.name}`);
437
+ return null;
438
+ }
391
439
  const useArgs = parseUseArgs(trimmedArgs);
392
440
  if (useArgs) {
393
441
  return (_jsx(SwitchProfileOnMount, { onDone: onDone, context: context, provider: useArgs.provider, profileName: useArgs.profileName }));
@@ -430,6 +478,7 @@ export async function call(onDone, context, args) {
430
478
  return null;
431
479
  }
432
480
  await removeProviderScopedCredentials(removed.id);
481
+ reconcileActiveProviderProfileState();
433
482
  await clearAuthRelatedCaches();
434
483
  context.onChangeAPIKey();
435
484
  onDone(`Perfil eliminado: ${removed.provider}/${removed.name}`);
@@ -491,6 +540,6 @@ export async function call(onDone, context, args) {
491
540
  }
492
541
  return null;
493
542
  }
494
- onDone('Uso: /profile, /profile list, /profile current, /profile migrate, /profile use <proveedor> <perfil>, /profile rename <proveedor> <actual> <nuevo>, /profile remove <proveedor> <perfil>, /profile remove all, /profile model <proveedor> <perfil> <modelo|clear>, /profile agent <proveedor> <perfil> <agentName>');
543
+ onDone('Uso: /profile, /profile list, /profile current, /profile migrate, /profile create <proveedor> <perfil>, /profile use <proveedor> <perfil>, /profile rename <proveedor> <actual> <nuevo>, /profile remove <proveedor> <perfil>, /profile remove all, /profile model <proveedor> <perfil> <modelo|clear>, /profile agent <proveedor> <perfil> <agentName>');
495
544
  return null;
496
545
  }
@@ -2,7 +2,7 @@ export default {
2
2
  type: 'local-jsx',
3
3
  name: 'provider',
4
4
  description: 'Cambiar entre proveedores y configurar endpoints sin cerrar sesion',
5
- argumentHint: '[list|current|claude|openai|openrouter|ollama|ollama-cloud|gemini-api|gemini-google|zai|minimax] [baseURL|clear]',
5
+ argumentHint: '[list|current|claude|openai|openrouter|ollama|ollama-cloud|gemini-api|gemini-google|zai|minimax|nvidia] [baseURL|clear]',
6
6
  isEnabled: () => true,
7
7
  load: () => import('./provider.js'),
8
8
  };
@@ -5,7 +5,8 @@ import { Box, Text } from '../../ink.js';
5
5
  import { useMainLoopModel } from '../../hooks/useMainLoopModel.js';
6
6
  import { useSetAppState } from '../../state/AppState.js';
7
7
  import { getStoredActiveProviderPreference } from '../../utils/model/providerProfilesDb.js';
8
- import { getAPIProvider, isGeminiApiProviderConfigured, isGeminiGoogleProviderConfigured, isOllamaCloudProviderConfigured, isMiniMaxProviderConfigured, isOpenAIProviderConfigured, isOpenRouterProviderConfigured, isZAIProviderConfigured, } from '../../utils/model/providers.js';
8
+ import { getCoreCurrentProviderProfile, getCoreProviderLabel, isCoreProviderEnabled, isCoreSelectedProfileReady, listCoreProviderProfiles, normalizeCoreProviderInput, setCoreActiveProfile, switchCoreProvider, } from '../../core/providers/providerCore.js';
9
+ import { getAPIProvider, isGeminiApiProviderConfigured, isGeminiGoogleProviderConfigured, isNvidiaProviderConfigured, isOllamaCloudProviderConfigured, isMiniMaxProviderConfigured, isOpenAIProviderConfigured, isOpenRouterProviderConfigured, isZAIProviderConfigured, } from '../../utils/model/providers.js';
9
10
  import { clearProviderBaseUrl, getConfiguredProviderBaseUrl, getDefaultProviderBaseUrl, isProviderBaseUrlCustomized, setProviderBaseUrl, } from '../../utils/model/providerBaseUrls.js';
10
11
  import { getVisibleProvider, VISIBLE_PROVIDERS, } from '../../utils/model/providerCatalog.js';
11
12
  import { getActiveProviderProfile, getLastUsedProviderProfile, isProfiledProvider, listProviderProfiles, setActiveProfileForProvider, } from '../../utils/model/providerProfiles.js';
@@ -23,14 +24,21 @@ const CONFIGURABLE_BASE_URL_PROVIDERS = [
23
24
  'gemini-google',
24
25
  'zai',
25
26
  'minimax',
27
+ 'nvidia',
26
28
  ];
27
29
  function isConfigurableBaseUrlProvider(provider) {
28
30
  return CONFIGURABLE_BASE_URL_PROVIDERS.includes(provider);
29
31
  }
30
32
  function getProviderLabel(provider) {
33
+ if (isCoreProviderEnabled()) {
34
+ return getCoreProviderLabel(provider);
35
+ }
31
36
  return getVisibleProvider(provider).label;
32
37
  }
33
38
  function normalizeProviderInput(rawProvider) {
39
+ if (isCoreProviderEnabled()) {
40
+ return normalizeCoreProviderInput(rawProvider);
41
+ }
34
42
  if (!rawProvider) {
35
43
  return undefined;
36
44
  }
@@ -77,6 +85,8 @@ function getProviderSetupMessage(provider) {
77
85
  return 'Z.AI requiere una API key. Usa /login para guardarla y /provider zai <baseURL> para cambiar el endpoint si hace falta.';
78
86
  case 'minimax':
79
87
  return 'MiniMax requiere una API key. Usa /login para guardarla. El endpoint por defecto es Anthropic-compatible (https://api.minimax.io/anthropic) y puedes cambiarlo con /provider minimax <baseURL>.';
88
+ case 'nvidia':
89
+ return 'NVIDIA requiere una API key. Usa /login para guardarla. El endpoint por defecto es https://integrate.api.nvidia.com/v1 y puedes cambiarlo con /provider nvidia <baseURL>.';
80
90
  default:
81
91
  return 'OpenRouter requiere una API key. Usa /login para guardarla y /provider openrouter <baseURL> para cambiar el endpoint si hace falta.';
82
92
  }
@@ -159,12 +169,19 @@ function parseProfileSelection(provider, args) {
159
169
  return null;
160
170
  }
161
171
  async function switchProvider(params) {
162
- const restoredModel = switchProviderPreference({
163
- currentModel: params.currentModel,
164
- currentProvider: params.currentProvider,
165
- targetProvider: params.target,
166
- targetProfileName: params.targetProfileName,
167
- });
172
+ const restoredModel = isCoreProviderEnabled()
173
+ ? switchCoreProvider({
174
+ currentModel: params.currentModel,
175
+ currentProvider: params.currentProvider,
176
+ targetProvider: params.target,
177
+ targetProfileName: params.targetProfileName,
178
+ }).restoredModel
179
+ : switchProviderPreference({
180
+ currentModel: params.currentModel,
181
+ currentProvider: params.currentProvider,
182
+ targetProvider: params.target,
183
+ targetProfileName: params.targetProfileName,
184
+ });
168
185
  await clearAuthRelatedCaches();
169
186
  params.context.onChangeAPIKey();
170
187
  const profileSuffix = isProfiledProvider(params.target) && getLastUsedProviderProfile(params.target)
@@ -193,6 +210,9 @@ function getProviderSelectionMessage(target, baseUrlMessage) {
193
210
  return baseUrlMessage ?? setupMessage ?? `Proveedor preparado: ${getProviderLabel(target)}`;
194
211
  }
195
212
  function isSelectedProfileReady(provider, profileName) {
213
+ if (isCoreProviderEnabled()) {
214
+ return isCoreSelectedProfileReady(provider, profileName);
215
+ }
196
216
  if (!profileName || !isProfiledProvider(provider)) {
197
217
  return true;
198
218
  }
@@ -221,6 +241,9 @@ function isSelectedProfileReady(provider, profileName) {
221
241
  if (provider === 'minimax') {
222
242
  return hasStoredProviderApiKey('minimax', profile.id);
223
243
  }
244
+ if (provider === 'nvidia') {
245
+ return hasStoredProviderApiKey('nvidia', profile.id);
246
+ }
224
247
  return true;
225
248
  }
226
249
  export async function call(onDone, context, args) {
@@ -229,57 +252,95 @@ export async function call(onDone, context, args) {
229
252
  const firstToken = tokens[0]?.toLowerCase();
230
253
  // 1. Manejo de subcomandos explícitos
231
254
  if (firstToken === 'list') {
232
- const allProfiles = listProviderProfiles();
233
- const activeProfile = getActiveProviderProfile();
234
- if (allProfiles.length === 0) {
235
- onDone(chalk.yellow('⚠ No tienes proveedores configurados en la base de datos.'));
236
- return null;
237
- }
238
- const grouped = allProfiles.reduce((acc, p) => {
239
- if (!acc[p.provider])
240
- acc[p.provider] = [];
241
- acc[p.provider].push(p);
242
- return acc;
243
- }, {});
244
- let message = '\n' + chalk.cyan.bold(' ╭──────────────────────────────────────────────────────────╮') + '\n';
245
- message += chalk.cyan.bold(' │ ') + chalk.white.bold('GESTIÓN DE PROVEEDORES Y CUENTAS') + chalk.cyan.bold(' │') + '\n';
246
- message += chalk.cyan.bold(' ╰──────────────────────────────────────────────────────────╯') + '\n';
247
- for (const [providerId, profiles] of Object.entries(grouped)) {
248
- const providerInfo = getVisibleProvider(providerId);
249
- message += `\n ${chalk.magenta.bold('')}${chalk.bgMagenta.white.bold(' ' + providerInfo.label.toUpperCase() + ' ')}${chalk.magenta.bold('')} ${chalk.dim('(' + providerId + ')')}\n`;
255
+ const useCore = isCoreProviderEnabled();
256
+ const coreResult = useCore ? listCoreProviderProfiles() : null;
257
+ const allProfiles = useCore
258
+ ? Object.values(coreResult.providers).flat()
259
+ : listProviderProfiles();
260
+ const activeProfile = useCore
261
+ ? coreResult.activeProfile
262
+ : getActiveProviderProfile();
263
+ const grouped = useCore
264
+ ? coreResult.providers
265
+ : allProfiles.reduce((acc, p) => {
266
+ if (!acc[p.provider])
267
+ acc[p.provider] = [];
268
+ acc[p.provider].push(p);
269
+ return acc;
270
+ }, {});
271
+ let message = '\n' + chalk.cyan.bold(' ?----------------------------------------------------------?') + '\n';
272
+ message += chalk.cyan.bold('') + chalk.white.bold('GESTI�N DE PROVEEDORES Y CUENTAS') + chalk.cyan.bold('') + '\n';
273
+ message += chalk.cyan.bold(' ?----------------------------------------------------------?') + '\n';
274
+ const providersToRender = VISIBLE_PROVIDERS.filter(p => p.implemented);
275
+ for (const providerInfo of providersToRender) {
276
+ const providerId = providerInfo.id;
277
+ const profiles = grouped[providerId] ?? [];
278
+ message += `\n ${chalk.magenta.bold('?')}${chalk.bgMagenta.white.bold(' ' + providerInfo.label.toUpperCase() + ' ')}${chalk.magenta.bold('?')} ${chalk.dim('(' + providerId + ')')}\n`;
279
+ if (profiles.length === 0) {
280
+ let configured = false;
281
+ if (providerId === 'claude')
282
+ configured = hasStoredProviderOAuthTokens('claude');
283
+ else if (providerId === 'openai')
284
+ configured = isOpenAIProviderConfigured();
285
+ else if (providerId === 'openrouter')
286
+ configured = isOpenRouterProviderConfigured();
287
+ else if (providerId === 'gemini-api')
288
+ configured = isGeminiApiProviderConfigured();
289
+ else if (providerId === 'gemini-google')
290
+ configured = isGeminiGoogleProviderConfigured();
291
+ else if (providerId === 'zai')
292
+ configured = isZAIProviderConfigured();
293
+ else if (providerId === 'minimax')
294
+ configured = isMiniMaxProviderConfigured();
295
+ else if (providerId === 'nvidia')
296
+ configured = isNvidiaProviderConfigured();
297
+ else if (providerId === 'ollama')
298
+ configured = true;
299
+ else if (providerId === 'ollama-cloud')
300
+ configured = isOllamaCloudProviderConfigured();
301
+ const setupHint = configured
302
+ ? chalk.green('? Configurado (sin perfil creado)')
303
+ : chalk.yellow('? Sin perfiles');
304
+ message += ` ${chalk.dim('?')} ${chalk.white('sin perfiles'.padEnd(15))} ${setupHint}\n`;
305
+ continue;
306
+ }
250
307
  for (const p of profiles) {
251
308
  const isActive = p.id === activeProfile?.id;
252
309
  let isAuthenticated = false;
253
310
  if (p.provider === 'claude' || p.provider === 'openai') {
254
311
  isAuthenticated = !!getStoredProviderOAuthTokens(p.provider, p.id);
255
312
  }
256
- else if (['openrouter', 'zai', 'minimax'].includes(p.provider)) {
313
+ else if (['openrouter', 'zai', 'minimax', 'nvidia'].includes(p.provider)) {
257
314
  isAuthenticated = hasStoredProviderApiKey(p.provider, p.id);
258
315
  }
259
316
  else if (p.provider === 'ollama' || p.provider === 'ollama-cloud') {
260
317
  isAuthenticated = true;
261
318
  }
262
- const statusIcon = isActive ? chalk.cyan('') : chalk.dim('');
263
- const nameLabel = isActive ? chalk.cyan.bold(p.name.padEnd(15)) : chalk.white(p.name.padEnd(15));
319
+ const statusIcon = isActive ? chalk.cyan('?') : chalk.dim('?');
320
+ const nameLabel = isActive
321
+ ? chalk.cyan.bold(p.name.padEnd(15))
322
+ : chalk.white(p.name.padEnd(15));
264
323
  const authStatus = isAuthenticated
265
- ? chalk.green(' Conectado')
266
- : chalk.red(' Desconectado');
324
+ ? chalk.green('? Conectado')
325
+ : chalk.red('? Desconectado');
267
326
  const badge = isActive ? chalk.bgCyan.black(' ACTUAL ') : '';
268
327
  message += ` ${statusIcon} ${nameLabel} ${authStatus} ${badge}\n`;
269
328
  if (p.baseUrl) {
270
- message += ` ${chalk.dim('└─')} ${chalk.blue('󰖟')} ${chalk.dim(p.baseUrl)}\n`;
329
+ message += ` ${chalk.dim('+-')} ${chalk.blue('??')} ${chalk.dim(p.baseUrl)}\n`;
271
330
  }
272
331
  }
273
332
  }
274
- message += '\n' + chalk.cyan.bold(' Guía rápida:') + '\n';
275
- message += ` ${chalk.dim('')} Cambiar perfil: ${chalk.yellow('/provider [id] profile [nombre]')}\n`;
276
- message += ` ${chalk.dim('')} Nueva cuenta: ${chalk.yellow('/login --profile [nombre]')}\n`;
277
- message += ` ${chalk.dim('')} Ver actual: ${chalk.yellow('/provider current')}\n`;
333
+ message += '\n' + chalk.cyan.bold(' ? Gu�a r�pida:') + '\n';
334
+ message += ` ${chalk.dim('')} Cambiar perfil: ${chalk.yellow('/provider [id] profile [nombre]')}\n`;
335
+ message += ` ${chalk.dim('')} Nueva cuenta: ${chalk.yellow('/login --profile [nombre]')}\n`;
336
+ message += ` ${chalk.dim('')} Ver actual: ${chalk.yellow('/provider current')}\n`;
278
337
  onDone(message);
279
338
  return null;
280
339
  }
281
340
  if (firstToken === 'current') {
282
- const activeProfile = getActiveProviderProfile();
341
+ const activeProfile = isCoreProviderEnabled()
342
+ ? getCoreCurrentProviderProfile().activeProfile
343
+ : getActiveProviderProfile();
283
344
  if (!activeProfile) {
284
345
  onDone(chalk.yellow('No hay un perfil de proveedor activo configurado.'));
285
346
  return null;
@@ -304,7 +365,12 @@ export async function call(onDone, context, args) {
304
365
  }
305
366
  const profileSelection = parseProfileSelection(providerName, trimmedArgs);
306
367
  if (profileSelection && isProfiledProvider(providerName)) {
307
- setActiveProfileForProvider(providerName, profileSelection);
368
+ if (isCoreProviderEnabled()) {
369
+ setCoreActiveProfile(providerName, profileSelection);
370
+ }
371
+ else {
372
+ setActiveProfileForProvider(providerName, profileSelection);
373
+ }
308
374
  }
309
375
  if (providerName === 'claude' &&
310
376
  (!hasStoredProviderOAuthTokens('claude') ||
@@ -349,10 +415,6 @@ export async function call(onDone, context, args) {
349
415
  onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
350
416
  return null;
351
417
  }
352
- if (providerName === 'ollama-cloud' && !isOllamaCloudProviderConfigured()) {
353
- onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
354
- return null;
355
- }
356
418
  if (providerName === 'zai' &&
357
419
  (!isZAIProviderConfigured() || !isSelectedProfileReady(providerName, profileSelection))) {
358
420
  onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
@@ -367,6 +429,15 @@ export async function call(onDone, context, args) {
367
429
  onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
368
430
  return null;
369
431
  }
432
+ if (providerName === 'nvidia' && !isNvidiaProviderConfigured()) {
433
+ onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
434
+ return null;
435
+ }
436
+ if (providerName === 'nvidia' &&
437
+ !isSelectedProfileReady(providerName, profileSelection)) {
438
+ onDone(getProviderSelectionMessage(providerName, baseUrlMessage));
439
+ return null;
440
+ }
370
441
  return (_jsx(SwitchProviderOnMount, { onDone: onDone, context: context, target: providerName, baseUrlMessage: baseUrlMessage, targetProfileName: profileSelection }));
371
442
  }
372
443
  return _jsx(ProviderPicker, { onDone: onDone, context: context });
@@ -416,7 +487,8 @@ function ProviderPicker({ onDone, context, }) {
416
487
  provider.id === 'ollama' ||
417
488
  (provider.id === 'ollama-cloud' && isOllamaCloudProviderConfigured()) ||
418
489
  (provider.id === 'zai' && isZAIProviderConfigured()) ||
419
- (provider.id === 'minimax' && isMiniMaxProviderConfigured());
490
+ (provider.id === 'minimax' && isMiniMaxProviderConfigured()) ||
491
+ (provider.id === 'nvidia' && isNvidiaProviderConfigured());
420
492
  const status = isActive
421
493
  ? ' [active]'
422
494
  : isConfigured
@@ -452,15 +524,15 @@ function ProviderPicker({ onDone, context, }) {
452
524
  onDone(getProviderSetupMessage(target));
453
525
  return;
454
526
  }
455
- if (target === 'ollama-cloud' && !isOllamaCloudProviderConfigured()) {
527
+ if (target === 'zai' && !isZAIProviderConfigured()) {
456
528
  onDone(getProviderSetupMessage(target));
457
529
  return;
458
530
  }
459
- if (target === 'zai' && !isZAIProviderConfigured()) {
531
+ if (target === 'minimax' && !isMiniMaxProviderConfigured()) {
460
532
  onDone(getProviderSetupMessage(target));
461
533
  return;
462
534
  }
463
- if (target === 'minimax' && !isMiniMaxProviderConfigured()) {
535
+ if (target === 'nvidia' && !isNvidiaProviderConfigured()) {
464
536
  onDone(getProviderSetupMessage(target));
465
537
  return;
466
538
  }
@@ -0,0 +1,9 @@
1
+ const resumen = {
2
+ type: 'local',
3
+ supportsNonInteractive: true,
4
+ name: 'resumen',
5
+ description: 'Mostrar el informe resumido de la ultima ejecucion de orquestacion',
6
+ argumentHint: '[run-id]',
7
+ load: () => import('./resumen.js'),
8
+ };
9
+ export default resumen;
@@ -0,0 +1,29 @@
1
+ import { listOrchestrationRuns, } from '../../utils/orchestration/store/index.js';
2
+ import { parseArguments } from '../../utils/argumentSubstitution.js';
3
+ import runHandler from '../run/run.js';
4
+ /**
5
+ * El comando /resumen es un alias simplificado para /run report.
6
+ * Si no se proporciona un run-id, busca automáticamente la ejecución más reciente.
7
+ */
8
+ export default async function resumenHandler(call) {
9
+ const { args } = call;
10
+ const parsedArgs = parseArguments(args);
11
+ let runId = parsedArgs[0];
12
+ // Si no se proporcionó runId, buscar el más reciente
13
+ if (!runId) {
14
+ const runs = await listOrchestrationRuns();
15
+ if (runs.length === 0) {
16
+ return {
17
+ type: 'text',
18
+ value: 'No se encontraron ejecuciones de orquestación previas.',
19
+ };
20
+ }
21
+ runId = runs[0].id;
22
+ }
23
+ // Delegar al handler de /run.
24
+ // IMPORTANTE: /run espera como primer token el subcomando.
25
+ return runHandler({
26
+ ...call,
27
+ args: `report ${runId}`,
28
+ });
29
+ }