@iaforged/context-code 1.2.8 → 1.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -119
- package/context-bootstrap.js +26 -26
- package/dist/src/QueryEngine.js +394 -327
- package/dist/src/bridge/bridgeUI.js +1 -1
- package/dist/src/buddy/prompt.js +4 -4
- package/dist/src/cli/handlers/auth.js +126 -9
- package/dist/src/cli/print.js +35 -1
- package/dist/src/commands/agent/agent.js +28 -2
- package/dist/src/commands/agent/agentStore.js +8 -1
- package/dist/src/commands/agent/index.js +1 -1
- package/dist/src/commands/bridge-kick.js +9 -9
- package/dist/src/commands/commit.js +34 -34
- package/dist/src/commands/init-verifiers.js +3 -3
- package/dist/src/commands/init.js +88 -88
- package/dist/src/commands/insights.js +787 -787
- package/dist/src/commands/install.js +19 -19
- package/dist/src/commands/login/login.js +21 -12
- package/dist/src/commands/logout/logout.js +9 -0
- package/dist/src/commands/model/model.js +9 -4
- package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
- package/dist/src/commands/orchestrate/index.js +2 -2
- package/dist/src/commands/orchestrate/orchestrate.js +708 -12
- package/dist/src/commands/pr_comments/index.js +33 -33
- package/dist/src/commands/profile/index.js +1 -1
- package/dist/src/commands/profile/profile.js +52 -3
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +117 -45
- package/dist/src/commands/resumen/index.js +9 -0
- package/dist/src/commands/resumen/resumen.js +29 -0
- package/dist/src/commands/security-review.js +190 -190
- package/dist/src/commands/swarm-auto/index.js +9 -0
- package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
- package/dist/src/commands/swarm-init/index.js +9 -0
- package/dist/src/commands/swarm-init/swarmInit.js +72 -0
- package/dist/src/commands/team/team.js +39 -6
- package/dist/src/commands.js +14 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
- package/dist/src/components/agents/agentFileUtils.js +6 -6
- package/dist/src/components/permissions/hooks.js +5 -5
- package/dist/src/constants/outputStyles.js +83 -83
- package/dist/src/core/agents/blueprints.js +58 -0
- package/dist/src/core/agents/cliAdapter.js +61 -0
- package/dist/src/core/agents/registry.js +93 -0
- package/dist/src/core/agents/runtime.js +4 -0
- package/dist/src/core/agents/runtime.smoke.js +42 -0
- package/dist/src/core/agents/swarm.smoke.js +48 -0
- package/dist/src/core/agents/swarmTools.js +38 -0
- package/dist/src/core/auth/index.js +2 -0
- package/dist/src/core/auth/loginCliAdapter.js +24 -0
- package/dist/src/core/auth/loginCore.js +67 -0
- package/dist/src/core/auth/logoutCliAdapter.js +34 -0
- package/dist/src/core/auth/logoutCore.js +52 -0
- package/dist/src/core/auth/preflight.smoke.js +151 -0
- package/dist/src/core/index.js +21 -0
- package/dist/src/core/mcp/blueprints.js +27 -0
- package/dist/src/core/mcp/common.js +14 -0
- package/dist/src/core/mcp/runtime.js +67 -0
- package/dist/src/core/mcp/runtime.smoke.js +50 -0
- package/dist/src/core/mcp/swarmClient.js +40 -0
- package/dist/src/core/mcp/swarmSetup.js +43 -0
- package/dist/src/core/providers/cliAdapter.js +39 -0
- package/dist/src/core/providers/contracts.js +1 -0
- package/dist/src/core/providers/index.js +3 -0
- package/dist/src/core/providers/llmCore.js +123 -0
- package/dist/src/core/providers/providerCore.js +141 -0
- package/dist/src/core/providers/providerModelCompatibility.js +98 -0
- package/dist/src/core/providers/providerParitySmoke.js +83 -0
- package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
- package/dist/src/core/query/contracts.js +1 -0
- package/dist/src/core/query/runtime.js +117 -0
- package/dist/src/core/query/runtime.smoke.js +39 -0
- package/dist/src/core/query/timelineThinking.smoke.js +25 -0
- package/dist/src/core/query/wiring.smoke.js +76 -0
- package/dist/src/core/skills/cliAdapter.js +38 -0
- package/dist/src/core/skills/index.js +52 -0
- package/dist/src/core/skills/runtime.smoke.js +53 -0
- package/dist/src/core/tasks/runtime.js +205 -0
- package/dist/src/core/tasks/runtime.smoke.js +63 -0
- package/dist/src/core/tasks/sdkAdapter.js +4 -0
- package/dist/src/core/tools/contracts.js +3 -0
- package/dist/src/core/tools/fileResolution.js +112 -0
- package/dist/src/core/tools/fileResolution.smoke.js +33 -0
- package/dist/src/core/tools/filesCore.js +51 -0
- package/dist/src/core/tools/filesCore.smoke.js +108 -0
- package/dist/src/core/tools/gitCore.js +20 -0
- package/dist/src/core/tools/imageParity.smoke.js +36 -0
- package/dist/src/core/tools/notebookParity.smoke.js +68 -0
- package/dist/src/core/tools/registry.js +22 -0
- package/dist/src/core/tools/runtime.smoke.js +32 -0
- package/dist/src/core/tools/shellCore.js +60 -0
- package/dist/src/core/types/agentContext.js +9 -0
- package/dist/src/core/types/auth.js +3 -0
- package/dist/src/core/types/command.js +13 -0
- package/dist/src/core/types/provider.js +3 -0
- package/dist/src/core/types/sdkEvent.js +10 -0
- package/dist/src/core/types/swarm.js +1 -0
- package/dist/src/cost-tracker.js +3 -3
- package/dist/src/hooks/useAwaySummary.js +22 -9
- package/dist/src/main.js +32 -2
- package/dist/src/screens/REPL.js +9 -0
- package/dist/src/services/AgentSummary/agentSummary.js +10 -10
- package/dist/src/services/autoDream/autoDream.js +5 -5
- package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
- package/dist/src/services/compact/prompt.js +238 -238
- package/dist/src/services/limits/sessionCounter.js +17 -17
- package/dist/src/services/mcp/client.js +27 -1
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
- package/dist/src/skills/bundled/loop.js +57 -57
- package/dist/src/skills/bundled/remember.js +53 -53
- package/dist/src/skills/bundled/simplify.js +49 -49
- package/dist/src/skills/bundled/skillify.js +2 -2
- package/dist/src/state/onChangeAppState.js +6 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
- package/dist/src/tasks/LocalMainSessionTask.js +5 -5
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
- package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
- package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
- package/dist/src/tools/BashTool/BashTool.js +27 -2
- package/dist/src/tools/BriefTool/prompt.js +14 -14
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
- package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
- package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
- package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
- package/dist/src/tools/FileEditTool/prompt.js +7 -7
- package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
- package/dist/src/tools/FileWriteTool/prompt.js +6 -6
- package/dist/src/tools/GlobTool/prompt.js +4 -4
- package/dist/src/tools/GrepTool/prompt.js +10 -10
- package/dist/src/tools/LSPTool/prompt.js +18 -18
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
- package/dist/src/tools/SendMessageTool/prompt.js +36 -36
- package/dist/src/tools/SkillTool/prompt.js +21 -21
- package/dist/src/tools/SleepTool/prompt.js +10 -10
- package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
- package/dist/src/tools/TaskGetTool/prompt.js +21 -21
- package/dist/src/tools/TaskListTool/prompt.js +30 -30
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
- package/dist/src/tools/TaskStopTool/prompt.js +5 -5
- package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
- package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
- package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
- package/dist/src/tools/WebFetchTool/prompt.js +31 -31
- package/dist/src/tools/WebSearchTool/prompt.js +26 -26
- package/dist/src/utils/agentContext.js +2 -0
- package/dist/src/utils/agenticSessionSearch.js +38 -38
- package/dist/src/utils/config.js +2 -0
- package/dist/src/utils/genericProcessUtils.js +21 -21
- package/dist/src/utils/heapDumpService.js +4 -4
- package/dist/src/utils/mcpValidation.js +2 -2
- package/dist/src/utils/model/modelStrings.js +1 -1
- package/dist/src/utils/model/providers.js +5 -0
- package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
- package/dist/src/utils/orchestration/store/runStore.js +68 -68
- package/dist/src/utils/orchestration/store/teamStore.js +28 -28
- package/dist/src/utils/permissions/permissionExplainer.js +6 -6
- package/dist/src/utils/permissions/permissionsDb.js +43 -43
- package/dist/src/utils/sdkEventQueue.js +2 -0
- package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
- package/dist/src/utils/standardMcp/common.js +15 -0
- package/dist/src/utils/standardMcp/setup.js +52 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
- package/dist/src/utils/task/framework.js +6 -6
- package/package.json +1 -1
- package/dist/src/commands/usage/index.js +0 -7
- package/dist/src/commands/usage/usage.js +0 -5
package/dist/src/buddy/prompt.js
CHANGED
|
@@ -2,10 +2,10 @@ import { feature } from '../recovery/bunBundleShim.js';
|
|
|
2
2
|
import { getGlobalConfig } from '../utils/config.js';
|
|
3
3
|
import { getCompanion } from './companion.js';
|
|
4
4
|
export function companionIntroText(name, species) {
|
|
5
|
-
return `# Companion
|
|
6
|
-
|
|
7
|
-
A small ${species} named ${name} sits beside the user's input box and occasionally comments in a speech bubble. You're not ${name} — it's a separate watcher.
|
|
8
|
-
|
|
5
|
+
return `# Companion
|
|
6
|
+
|
|
7
|
+
A small ${species} named ${name} sits beside the user's input box and occasionally comments in a speech bubble. You're not ${name} — it's a separate watcher.
|
|
8
|
+
|
|
9
9
|
When the user addresses ${name} directly (by name), its bubble will answer. Your job in that moment is to stay out of the way: respond in ONE line or less, or just answer any part of the message meant for you. Don't explain that you're not ${name} — they know. Don't narrate what ${name} might say — the bubble handles that.`;
|
|
10
10
|
}
|
|
11
11
|
export function getCompanionIntroAttachment(messages) {
|
|
@@ -8,7 +8,8 @@ import { fetchAndStoreClaudeCodeFirstTokenDate } from '../../services/api/firstT
|
|
|
8
8
|
import { createAndStoreApiKey, fetchAndStoreUserRoles, refreshOAuthToken, shouldUseClaudeAIAuth, storeOAuthAccountInfo, } from '../../services/oauth/client.js';
|
|
9
9
|
import { getOauthProfileFromOauthToken } from '../../services/oauth/getOauthProfile.js';
|
|
10
10
|
import { OAuthService } from '../../services/oauth/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { startGeminiCliOAuthFlow } from '../../services/oauth/geminiCli.js';
|
|
12
|
+
import { clearOAuthTokenCache, getAnthropicApiKeyWithSource, getAuthTokenSource, getClaudeAIOAuthTokens, getOpenAIOAuthTokens, getOauthAccountInfo, removeApiKey, saveOpenAIOAuthTokens, saveGeminiGoogleOAuthTokens, saveProviderApiKey, getSubscriptionType, isUsing3PServices, saveOAuthTokensIfNeeded, validateForceLoginOrg, removeProviderScopedCredentials, removeProviderApiKey, } from '../../utils/auth.js';
|
|
12
13
|
import { saveGlobalConfig } from '../../utils/config.js';
|
|
13
14
|
import { logForDebugging } from '../../utils/debug.js';
|
|
14
15
|
import { isRunningOnHomespace } from '../../utils/envUtils.js';
|
|
@@ -16,6 +17,9 @@ import { errorMessage } from '../../utils/errors.js';
|
|
|
16
17
|
import { logError } from '../../utils/log.js';
|
|
17
18
|
import { getAPIProvider } from '../../utils/model/providers.js';
|
|
18
19
|
import { setStoredActiveProviderPreference } from '../../utils/model/providerProfilesDb.js';
|
|
20
|
+
import { isProfiledProvider, setActiveProfileForProvider } from '../../utils/model/providerProfiles.js';
|
|
21
|
+
import { getLastUsedProviderProfile, removeProviderProfile } from '../../utils/model/providerProfiles.js';
|
|
22
|
+
import { clearProviderBaseUrl, setProviderBaseUrl, } from '../../utils/model/providerBaseUrls.js';
|
|
19
23
|
import { getInitialSettings } from '../../utils/settings/settings.js';
|
|
20
24
|
import { jsonStringify } from '../../utils/slowOperations.js';
|
|
21
25
|
import { buildAccountProperties, buildAPIProviderProperties, } from '../../utils/status.js';
|
|
@@ -133,7 +137,7 @@ export async function installOAuthTokens(tokens, provider = 'anthropic', profile
|
|
|
133
137
|
setMainLoopModelOverride(undefined);
|
|
134
138
|
await clearAuthRelatedCaches();
|
|
135
139
|
}
|
|
136
|
-
export async function authLogin({ email, sso, console: useConsole, claudeai, }) {
|
|
140
|
+
export async function authLogin({ email, sso, console: useConsole, claudeai, provider, }) {
|
|
137
141
|
if (useConsole && claudeai) {
|
|
138
142
|
process.stderr.write('Error: --console and --claudeai cannot be used together.\n');
|
|
139
143
|
process.exit(1);
|
|
@@ -145,6 +149,7 @@ export async function authLogin({ email, sso, console: useConsole, claudeai, })
|
|
|
145
149
|
? settings.forceLoginMethod === 'claudeai'
|
|
146
150
|
: !useConsole;
|
|
147
151
|
const orgUUID = settings.forceLoginOrgUUID;
|
|
152
|
+
const selectedProvider = provider?.trim().toLowerCase();
|
|
148
153
|
// Fast path: if a refresh token is provided via env var, skip the browser
|
|
149
154
|
// OAuth flow and exchange it directly for tokens.
|
|
150
155
|
const envRefreshToken = process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;
|
|
@@ -190,22 +195,34 @@ export async function authLogin({ email, sso, console: useConsole, claudeai, })
|
|
|
190
195
|
const oauthService = new OAuthService();
|
|
191
196
|
try {
|
|
192
197
|
logEvent('tengu_oauth_flow_start', { loginWithClaudeAi });
|
|
198
|
+
if (selectedProvider === 'gemini-google') {
|
|
199
|
+
const tokens = await startGeminiCliOAuthFlow();
|
|
200
|
+
saveGeminiGoogleOAuthTokens(tokens);
|
|
201
|
+
setStoredActiveProviderPreference('gemini-google');
|
|
202
|
+
process.stdout.write('Inicio de sesión exitoso.\n');
|
|
203
|
+
process.exit(0);
|
|
204
|
+
}
|
|
205
|
+
const oauthProvider = selectedProvider === 'openai' ? 'openai' : 'anthropic';
|
|
206
|
+
const loginWithClaudeAiResolved = oauthProvider === 'openai' ? false : loginWithClaudeAi;
|
|
193
207
|
const result = await oauthService.startOAuthFlow(async (url) => {
|
|
194
208
|
process.stdout.write('Abriendo el navegador para iniciar sesión…\n');
|
|
195
209
|
process.stdout.write(`Si el navegador no se abre, visita: ${url}\n`);
|
|
196
210
|
}, {
|
|
197
|
-
loginWithClaudeAi,
|
|
211
|
+
loginWithClaudeAi: loginWithClaudeAiResolved,
|
|
212
|
+
provider: oauthProvider,
|
|
198
213
|
loginHint: email,
|
|
199
214
|
loginMethod: resolvedLoginMethod,
|
|
200
215
|
orgUUID,
|
|
201
216
|
});
|
|
202
|
-
await installOAuthTokens(result);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
217
|
+
await installOAuthTokens(result, oauthProvider);
|
|
218
|
+
if (oauthProvider === 'anthropic') {
|
|
219
|
+
const orgResult = await validateForceLoginOrg();
|
|
220
|
+
if (!orgResult.valid) {
|
|
221
|
+
process.stderr.write(orgResult.message + '\n');
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
207
224
|
}
|
|
208
|
-
logEvent('tengu_oauth_success', { loginWithClaudeAi });
|
|
225
|
+
logEvent('tengu_oauth_success', { loginWithClaudeAi: loginWithClaudeAiResolved });
|
|
209
226
|
process.stdout.write('Inicio de sesión exitoso.\n');
|
|
210
227
|
process.exit(0);
|
|
211
228
|
}
|
|
@@ -318,3 +335,103 @@ export async function authLogout() {
|
|
|
318
335
|
process.stdout.write(`Sesión cerrada exitosamente de tu cuenta ${getProviderDisplayName()}.\n`);
|
|
319
336
|
process.exit(0);
|
|
320
337
|
}
|
|
338
|
+
export async function authProviderApiKey(params) {
|
|
339
|
+
const provider = params.provider.trim().toLowerCase();
|
|
340
|
+
const allowed = [
|
|
341
|
+
'openrouter',
|
|
342
|
+
'ollama-cloud',
|
|
343
|
+
'gemini-api',
|
|
344
|
+
'zai',
|
|
345
|
+
'minimax',
|
|
346
|
+
'nvidia',
|
|
347
|
+
];
|
|
348
|
+
if (!allowed.includes(provider)) {
|
|
349
|
+
process.stderr.write(`Provider no soportado para API key: ${provider}. Soportados: ${allowed.join(', ')}\n`);
|
|
350
|
+
process.exit(1);
|
|
351
|
+
}
|
|
352
|
+
const profileName = params.profile?.trim();
|
|
353
|
+
if (profileName && isProfiledProvider(provider)) {
|
|
354
|
+
setActiveProfileForProvider(provider, profileName);
|
|
355
|
+
}
|
|
356
|
+
await saveProviderApiKey(provider, params.apiKey);
|
|
357
|
+
setStoredActiveProviderPreference(provider);
|
|
358
|
+
process.stdout.write(`API key guardada para ${provider}${profileName ? ` (perfil ${profileName})` : ''}.\n`);
|
|
359
|
+
process.exit(0);
|
|
360
|
+
}
|
|
361
|
+
export async function authProviderBaseUrl(params) {
|
|
362
|
+
const provider = params.provider.trim().toLowerCase();
|
|
363
|
+
const allowed = [
|
|
364
|
+
'ollama',
|
|
365
|
+
'ollama-cloud',
|
|
366
|
+
'openrouter',
|
|
367
|
+
'gemini-google',
|
|
368
|
+
'zai',
|
|
369
|
+
'minimax',
|
|
370
|
+
'nvidia',
|
|
371
|
+
];
|
|
372
|
+
if (!allowed.includes(provider)) {
|
|
373
|
+
process.stderr.write(`Provider no soportado para base URL: ${provider}. Soportados: ${allowed.join(', ')}\n`);
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|
|
376
|
+
const profileName = params.profile?.trim();
|
|
377
|
+
if (profileName && isProfiledProvider(provider)) {
|
|
378
|
+
setActiveProfileForProvider(provider, profileName);
|
|
379
|
+
}
|
|
380
|
+
const normalized = setProviderBaseUrl(provider, params.baseUrl);
|
|
381
|
+
setStoredActiveProviderPreference(provider);
|
|
382
|
+
process.stdout.write(`Base URL guardada para ${provider}: ${normalized}${profileName ? ` (perfil ${profileName})` : ''}.\n`);
|
|
383
|
+
process.exit(0);
|
|
384
|
+
}
|
|
385
|
+
export async function authSetProviderPreference(params) {
|
|
386
|
+
const provider = params.provider.trim().toLowerCase();
|
|
387
|
+
setStoredActiveProviderPreference(provider);
|
|
388
|
+
process.stdout.write(`Provider activo establecido a ${provider}.\n`);
|
|
389
|
+
process.exit(0);
|
|
390
|
+
}
|
|
391
|
+
export async function authProviderRemove(params) {
|
|
392
|
+
const provider = params.provider.trim().toLowerCase();
|
|
393
|
+
if (!provider) {
|
|
394
|
+
process.stderr.write('Debes indicar un provider.\n');
|
|
395
|
+
process.exit(1);
|
|
396
|
+
}
|
|
397
|
+
const profiledProvider = provider;
|
|
398
|
+
const profileName = params.profile?.trim();
|
|
399
|
+
let removedProfileMsg = null;
|
|
400
|
+
if (isProfiledProvider(profiledProvider)) {
|
|
401
|
+
const targetProfileName = profileName || getLastUsedProviderProfile(profiledProvider)?.name;
|
|
402
|
+
if (targetProfileName) {
|
|
403
|
+
const removed = removeProviderProfile(profiledProvider, targetProfileName);
|
|
404
|
+
if (removed) {
|
|
405
|
+
await removeProviderScopedCredentials(removed.id);
|
|
406
|
+
removedProfileMsg = `${removed.provider}/${removed.name}`;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const apiKeyProviders = [
|
|
411
|
+
'openrouter',
|
|
412
|
+
'ollama-cloud',
|
|
413
|
+
'gemini-api',
|
|
414
|
+
'zai',
|
|
415
|
+
'minimax',
|
|
416
|
+
'nvidia',
|
|
417
|
+
];
|
|
418
|
+
if (apiKeyProviders.includes(provider)) {
|
|
419
|
+
await removeProviderApiKey(provider);
|
|
420
|
+
}
|
|
421
|
+
const configurableBaseUrlProviders = [
|
|
422
|
+
'ollama',
|
|
423
|
+
'ollama-cloud',
|
|
424
|
+
'openrouter',
|
|
425
|
+
'gemini-google',
|
|
426
|
+
'zai',
|
|
427
|
+
'minimax',
|
|
428
|
+
'nvidia',
|
|
429
|
+
];
|
|
430
|
+
if (configurableBaseUrlProviders.includes(provider)) {
|
|
431
|
+
clearProviderBaseUrl(provider);
|
|
432
|
+
}
|
|
433
|
+
process.stdout.write(removedProfileMsg
|
|
434
|
+
? `Proveedor eliminado: ${removedProfileMsg}.\n`
|
|
435
|
+
: `Credenciales/base URL limpiadas para ${provider}.\n`);
|
|
436
|
+
process.exit(0);
|
|
437
|
+
}
|
package/dist/src/cli/print.js
CHANGED
|
@@ -23,7 +23,7 @@ import { toolMatchesName } from '../Tool.js';
|
|
|
23
23
|
import { isBuiltInAgent, parseAgentsFromJson, } from '../tools/AgentTool/loadAgentsDir.js';
|
|
24
24
|
import { dequeue, dequeueAllMatching, enqueue, hasCommandsInQueue, peek, subscribeToCommandQueue, getCommandsByMaxPriority, } from '../utils/messageQueueManager.js';
|
|
25
25
|
import { notifyCommandLifecycle } from '../utils/commandLifecycle.js';
|
|
26
|
-
import { getSessionState, notifySessionStateChanged, notifySessionMetadataChanged, setPermissionModeChangedListener, } from '../utils/sessionState.js';
|
|
26
|
+
import { getSessionState, notifySessionStateChanged, notifySessionMetadataChanged, setPermissionModeChangedListener, setSessionMetadataChangedListener, } from '../utils/sessionState.js';
|
|
27
27
|
import { externalMetadataToAppState } from '../state/onChangeAppState.js';
|
|
28
28
|
import { getInMemoryErrors, logError, logMCPDebug } from '../utils/log.js';
|
|
29
29
|
import { writeToStdout, registerProcessOutputErrorHandlers, } from '../utils/process.js';
|
|
@@ -647,6 +647,18 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
|
|
|
647
647
|
});
|
|
648
648
|
}
|
|
649
649
|
});
|
|
650
|
+
// Wire session metadata changes to the SDK output stream.
|
|
651
|
+
setSessionMetadataChangedListener(metadata => {
|
|
652
|
+
if (metadata.orchestration_activity !== undefined) {
|
|
653
|
+
output.enqueue({
|
|
654
|
+
type: 'system',
|
|
655
|
+
subtype: 'orchestration_activity',
|
|
656
|
+
activity: metadata.orchestration_activity ?? null,
|
|
657
|
+
uuid: randomUUID(),
|
|
658
|
+
session_id: getSessionId(),
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
});
|
|
650
662
|
// Prompt suggestion tracking (push model)
|
|
651
663
|
const suggestionState = {
|
|
652
664
|
abortController: null,
|
|
@@ -1484,6 +1496,28 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands, tools, initial
|
|
|
1484
1496
|
uuid: randomUUID(),
|
|
1485
1497
|
});
|
|
1486
1498
|
},
|
|
1499
|
+
// Wiring del adapter Desktop core-query (Fase 3 cierre real).
|
|
1500
|
+
// Solo emitimos cuando el host (Desktop/Tauri) está pidiendo
|
|
1501
|
+
// stream-json, para no contaminar pipes que esperan SDKMessage
|
|
1502
|
+
// estricto. Se escribe directo a stdout (línea NDJSON) para
|
|
1503
|
+
// saltar la validación zod del schema SDK; el adapter desktop
|
|
1504
|
+
// lo parsea por el campo `type: "core_query_event"`.
|
|
1505
|
+
onCoreQueryEvent: process.env.CORE_QUERY_ENABLED === '1' &&
|
|
1506
|
+
options.outputFormat === 'stream-json'
|
|
1507
|
+
? event => {
|
|
1508
|
+
const envelope = {
|
|
1509
|
+
type: 'core_query_event',
|
|
1510
|
+
eventType: event.type,
|
|
1511
|
+
...event,
|
|
1512
|
+
};
|
|
1513
|
+
try {
|
|
1514
|
+
process.stdout.write(jsonStringify(envelope) + '\n');
|
|
1515
|
+
}
|
|
1516
|
+
catch {
|
|
1517
|
+
// El sink no debe romper el loop si stdout falla.
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
: undefined,
|
|
1487
1521
|
})) {
|
|
1488
1522
|
// Forward messages to bridge incrementally (mid-turn) so
|
|
1489
1523
|
// claude.ai sees progress and the connection stays alive
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getVisibleProvider } from '../../utils/model/providerCatalog.js';
|
|
2
|
-
import { buildAgentDetailMessage, buildAgentSummary, createAgent, getAgent, isKnownAgentProvider, listAgents, setAgentModelByName, setAgentOrchestratorByName, setAgentRoleByName, } from './agentStore.js';
|
|
2
|
+
import { buildAgentDetailMessage, buildAgentSummary, createAgent, deleteAgent, getAgent, isKnownAgentProvider, listAgents, setAgentModelByName, setAgentOrchestratorByName, setAgentRoleByName, } from './agentStore.js';
|
|
3
3
|
function normalizeProviderInput(rawProvider) {
|
|
4
4
|
if (!rawProvider) {
|
|
5
5
|
return null;
|
|
@@ -73,7 +73,7 @@ function buildUsageMessage() {
|
|
|
73
73
|
return [
|
|
74
74
|
'Uso: /agent, /agent list [proveedor], /agent create <proveedor> <name> [profile],',
|
|
75
75
|
'/agent setup <proveedor> [model] [profile],',
|
|
76
|
-
'/agent show <proveedor> <name>, /agent set-role <proveedor> <name> <role>,',
|
|
76
|
+
'/agent show <proveedor> <name>, /agent delete <proveedor> <name>, /agent set-role <proveedor> <name> <role>,',
|
|
77
77
|
'/agent set-orchestrator <proveedor> <name> <true|false>, /agent set-model <proveedor> <name> <model|clear>',
|
|
78
78
|
].join(' ');
|
|
79
79
|
}
|
|
@@ -120,6 +120,18 @@ function parseCreateArgs(args) {
|
|
|
120
120
|
const profileName = tokens.slice(3).join(' ').trim() || undefined;
|
|
121
121
|
return { provider, name, profileName };
|
|
122
122
|
}
|
|
123
|
+
function parseDeleteArgs(args) {
|
|
124
|
+
const tokens = args.trim().split(/\s+/).filter(Boolean);
|
|
125
|
+
if (tokens[0]?.toLowerCase() !== 'delete' && tokens[0]?.toLowerCase() !== 'remove') {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const provider = parseProvider(tokens[1]);
|
|
129
|
+
const name = tokens[2]?.trim();
|
|
130
|
+
if (!provider || !name) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
return { provider, name };
|
|
134
|
+
}
|
|
123
135
|
function parseShowArgs(args) {
|
|
124
136
|
const tokens = args.trim().split(/\s+/).filter(Boolean);
|
|
125
137
|
if (tokens[0]?.toLowerCase() !== 'show') {
|
|
@@ -286,6 +298,20 @@ export const call = async (args, _context) => {
|
|
|
286
298
|
}
|
|
287
299
|
return { type: 'text', value: buildAgentDetailMessage(agent) };
|
|
288
300
|
}
|
|
301
|
+
const deleteArgs = parseDeleteArgs(trimmed);
|
|
302
|
+
if (deleteArgs) {
|
|
303
|
+
const deleted = await deleteAgent(deleteArgs.provider, deleteArgs.name);
|
|
304
|
+
if (!deleted) {
|
|
305
|
+
return {
|
|
306
|
+
type: 'text',
|
|
307
|
+
value: `No existe el agente ${deleteArgs.provider}/${deleteArgs.name}.`,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
type: 'text',
|
|
312
|
+
value: `Agente eliminado: ${deleteArgs.provider}/${deleteArgs.name}`,
|
|
313
|
+
};
|
|
314
|
+
}
|
|
289
315
|
const roleArgs = parseRoleArgs(trimmed);
|
|
290
316
|
if (roleArgs) {
|
|
291
317
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createProviderAgent, getProviderAgentByProviderAndName, getProviderWorkspaceById, getProviderWorkspaceByProvider, listProviderAgents, updateProviderAgent, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
|
|
1
|
+
import { createProviderAgent, getProviderAgentByProviderAndName, getProviderWorkspaceById, getProviderWorkspaceByProvider, listProviderAgents, updateProviderAgent, deleteProviderAgent, upsertProviderWorkspace, } from '../../utils/orchestration/store/index.js';
|
|
2
2
|
import { ensureProviderProfile, getProviderProfile, resolveProviderProfile, } from '../../utils/model/providerProfiles.js';
|
|
3
3
|
import { getVisibleProvider } from '../../utils/model/providerCatalog.js';
|
|
4
4
|
async function ensureWorkspace(provider) {
|
|
@@ -83,6 +83,13 @@ export async function setAgentOrchestratorByName(provider, name, isOrchestrator)
|
|
|
83
83
|
}
|
|
84
84
|
return withHydratedAgent(await updateProviderAgent(current.id, { isOrchestrator }));
|
|
85
85
|
}
|
|
86
|
+
export async function deleteAgent(provider, name) {
|
|
87
|
+
const current = await getAgent(provider, name);
|
|
88
|
+
if (!current) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return deleteProviderAgent(current.id);
|
|
92
|
+
}
|
|
86
93
|
export async function setAgentModelByName(provider, name, model) {
|
|
87
94
|
const current = await getAgent(provider, name);
|
|
88
95
|
if (!current) {
|
|
@@ -3,7 +3,7 @@ const agent = {
|
|
|
3
3
|
supportsNonInteractive: true,
|
|
4
4
|
name: 'agent',
|
|
5
5
|
description: 'Gestionar agentes por proveedor',
|
|
6
|
-
argumentHint: '[list [proveedor]|create <proveedor> <name> [profile]|setup <proveedor> [model] [profile]|show <proveedor> <name>|set-role <proveedor> <name> <role>|set-orchestrator <proveedor> <name> <true|false>|set-model <proveedor> <name> <model|clear>]',
|
|
6
|
+
argumentHint: '[list [proveedor]|create <proveedor> <name> [profile]|setup <proveedor> [model] [profile]|show <proveedor> <name>|delete <proveedor> <name>|set-role <proveedor> <name> <role>|set-orchestrator <proveedor> <name> <true|false>|set-model <proveedor> <name> <model|clear>]',
|
|
7
7
|
load: () => import('./agent.js'),
|
|
8
8
|
};
|
|
9
9
|
export default agent;
|
|
@@ -33,15 +33,15 @@ import { getBridgeDebugHandle } from '../bridge/bridgeDebug.js';
|
|
|
33
33
|
* → expect: tengu_bridge_repl_fatal_error (gate is dead — 147K/wk)
|
|
34
34
|
* after fix: tengu_bridge_repl_env_lost → doReconnect
|
|
35
35
|
*/
|
|
36
|
-
const USAGE = `/bridge-kick <subcommand>
|
|
37
|
-
close <code> fire ws_closed with the given code (e.g. 1002)
|
|
38
|
-
poll <status> [type] next poll throws BridgeFatalError(status, type)
|
|
39
|
-
poll transient next poll throws axios-style rejection (5xx/net)
|
|
40
|
-
register fail [N] next N registers transient-fail (default 1)
|
|
41
|
-
register fatal next register 403s (terminal)
|
|
42
|
-
reconnect-session fail next POST /bridge/reconnect fails
|
|
43
|
-
heartbeat <status> next heartbeat throws BridgeFatalError(status)
|
|
44
|
-
reconnect call reconnectEnvironmentWithSession directly
|
|
36
|
+
const USAGE = `/bridge-kick <subcommand>
|
|
37
|
+
close <code> fire ws_closed with the given code (e.g. 1002)
|
|
38
|
+
poll <status> [type] next poll throws BridgeFatalError(status, type)
|
|
39
|
+
poll transient next poll throws axios-style rejection (5xx/net)
|
|
40
|
+
register fail [N] next N registers transient-fail (default 1)
|
|
41
|
+
register fatal next register 403s (terminal)
|
|
42
|
+
reconnect-session fail next POST /bridge/reconnect fails
|
|
43
|
+
heartbeat <status> next heartbeat throws BridgeFatalError(status)
|
|
44
|
+
reconnect call reconnectEnvironmentWithSession directly
|
|
45
45
|
status print bridge state`;
|
|
46
46
|
const call = async (args) => {
|
|
47
47
|
const h = getBridgeDebugHandle();
|
|
@@ -12,40 +12,40 @@ function getPromptContent() {
|
|
|
12
12
|
if (process.env.USER_TYPE === 'ant' && isUndercover()) {
|
|
13
13
|
prefix = getUndercoverInstructions() + '\n';
|
|
14
14
|
}
|
|
15
|
-
return `${prefix}## Context
|
|
16
|
-
|
|
17
|
-
- Current git status: !\`git status\`
|
|
18
|
-
- Current git diff (staged and unstaged changes): !\`git diff HEAD\`
|
|
19
|
-
- Current branch: !\`git branch --show-current\`
|
|
20
|
-
- Recent commits: !\`git log --oneline -10\`
|
|
21
|
-
|
|
22
|
-
## Git Safety Protocol
|
|
23
|
-
|
|
24
|
-
- NEVER update the git config
|
|
25
|
-
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
26
|
-
- CRITICAL: ALWAYS create NEW commits. NEVER use git commit --amend, unless the user explicitly requests it
|
|
27
|
-
- Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
|
|
28
|
-
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
|
|
29
|
-
- Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported
|
|
30
|
-
|
|
31
|
-
## Your task
|
|
32
|
-
|
|
33
|
-
Based on the above changes, create a single git commit:
|
|
34
|
-
|
|
35
|
-
1. Analyze all staged changes and draft a commit message:
|
|
36
|
-
- Look at the recent commits above to follow this repository's commit message style
|
|
37
|
-
- Summarize the nature of the changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.)
|
|
38
|
-
- Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
|
|
39
|
-
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
|
|
40
|
-
|
|
41
|
-
2. Stage relevant files and create the commit using HEREDOC syntax:
|
|
42
|
-
\`\`\`
|
|
43
|
-
git commit -m "$(cat <<'EOF'
|
|
44
|
-
Commit message here.${commitAttribution ? `\n\n${commitAttribution}` : ''}
|
|
45
|
-
EOF
|
|
46
|
-
)"
|
|
47
|
-
\`\`\`
|
|
48
|
-
|
|
15
|
+
return `${prefix}## Context
|
|
16
|
+
|
|
17
|
+
- Current git status: !\`git status\`
|
|
18
|
+
- Current git diff (staged and unstaged changes): !\`git diff HEAD\`
|
|
19
|
+
- Current branch: !\`git branch --show-current\`
|
|
20
|
+
- Recent commits: !\`git log --oneline -10\`
|
|
21
|
+
|
|
22
|
+
## Git Safety Protocol
|
|
23
|
+
|
|
24
|
+
- NEVER update the git config
|
|
25
|
+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
|
|
26
|
+
- CRITICAL: ALWAYS create NEW commits. NEVER use git commit --amend, unless the user explicitly requests it
|
|
27
|
+
- Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
|
|
28
|
+
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
|
|
29
|
+
- Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported
|
|
30
|
+
|
|
31
|
+
## Your task
|
|
32
|
+
|
|
33
|
+
Based on the above changes, create a single git commit:
|
|
34
|
+
|
|
35
|
+
1. Analyze all staged changes and draft a commit message:
|
|
36
|
+
- Look at the recent commits above to follow this repository's commit message style
|
|
37
|
+
- Summarize the nature of the changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.)
|
|
38
|
+
- Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
|
|
39
|
+
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
|
|
40
|
+
|
|
41
|
+
2. Stage relevant files and create the commit using HEREDOC syntax:
|
|
42
|
+
\`\`\`
|
|
43
|
+
git commit -m "$(cat <<'EOF'
|
|
44
|
+
Commit message here.${commitAttribution ? `\n\n${commitAttribution}` : ''}
|
|
45
|
+
EOF
|
|
46
|
+
)"
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
49
|
You have the capability to call multiple tools in a single response. Stage and create the commit using a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.`;
|
|
50
50
|
}
|
|
51
51
|
const command = {
|
|
@@ -159,9 +159,9 @@ Based on the areas detected in Phase 1, you may need to create multiple verifier
|
|
|
159
159
|
|
|
160
160
|
## Phase 4: Generate Verifier Skill
|
|
161
161
|
|
|
162
|
-
**All verifier skills are created in the project root's \`.context/skills/\` directory.** This ensures they are automatically loaded when Context runs in the project.
|
|
162
|
+
**All verifier skills are created in the project root's \`.context/skills/\` directory.** This ensures they are automatically loaded when Context runs in the project.
|
|
163
163
|
|
|
164
|
-
Write the skill file to \`.context/skills/<verifier-name>/SKILL.md\`.
|
|
164
|
+
Write the skill file to \`.context/skills/<verifier-name>/SKILL.md\`.
|
|
165
165
|
|
|
166
166
|
### Skill Template Structure
|
|
167
167
|
|
|
@@ -245,7 +245,7 @@ allowed-tools:
|
|
|
245
245
|
## Phase 5: Confirm Creation
|
|
246
246
|
|
|
247
247
|
After writing the skill file(s), inform the user:
|
|
248
|
-
1. Where each skill was created (always in \`.context/skills/\`)
|
|
248
|
+
1. Where each skill was created (always in \`.context/skills/\`)
|
|
249
249
|
2. How the Verify agent will discover them — the folder name must contain "verifier" (case-insensitive) for automatic discovery
|
|
250
250
|
3. That they can edit the skills to customize them
|
|
251
251
|
4. That they can run /init-verifiers again to add more verifiers for other areas
|