@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.
- package/README.md +68 -68
- package/cli.js +8515 -8515
- package/context-bootstrap.js +27 -27
- package/dist/src/bootstrap/state.js +3 -0
- package/dist/src/bridge/bridgeMain.js +40 -40
- package/dist/src/cli/print.js +12 -12
- package/dist/src/commands/agent/agent.js +8 -0
- package/dist/src/commands/commit-push-pr.js +55 -55
- package/dist/src/commands/createMovedToPluginCommand.js +9 -9
- package/dist/src/commands/init-verifiers.js +238 -238
- package/dist/src/commands/init.js +226 -225
- package/dist/src/commands/install.js +2 -2
- package/dist/src/commands/login/login.js +24 -10
- package/dist/src/commands/orchestrate/index.js +1 -1
- package/dist/src/commands/orchestrate/orchestrate.js +110 -24
- package/dist/src/commands/profile/profile.js +15 -1
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +34 -1
- package/dist/src/commands/review.js +22 -22
- package/dist/src/commands/run/index.js +2 -2
- package/dist/src/commands/run/run.js +63 -61
- package/dist/src/commands/team/index.js +1 -1
- package/dist/src/commands/team/team.js +84 -76
- package/dist/src/commands/team-auto/teamAuto.js +89 -29
- package/dist/src/commands/terminalSetup/terminalSetup.js +24 -24
- package/dist/src/commands/usage/index.js +7 -0
- package/dist/src/commands/usage/usage.js +5 -0
- package/dist/src/commands/workspace/workspace.js +39 -31
- package/dist/src/commands.js +0 -2
- package/dist/src/components/ConsoleOAuthFlow.js +92 -14
- package/dist/src/components/ModelPicker.js +2 -0
- package/dist/src/components/agents/AgentsList.js +9 -9
- package/dist/src/components/agents/AgentsMenu.js +3 -3
- package/dist/src/components/agents/generateAgent.js +92 -92
- package/dist/src/components/agents/utils.js +13 -9
- package/dist/src/components/grove/Grove.js +10 -10
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +8 -8
- package/dist/src/constants/geminiOAuth.js +13 -0
- package/dist/src/constants/github-app.js +134 -134
- package/dist/src/constants/prompts.js +123 -123
- package/dist/src/coordinator/coordinatorMode.js +252 -252
- package/dist/src/hooks/useTypeahead.js +7 -7
- package/dist/src/ink/reconciler.js +7 -7
- package/dist/src/main.js +5 -5
- package/dist/src/memdir/findRelevantMemories.js +6 -6
- package/dist/src/projectOnboardingState.js +3 -3
- package/dist/src/services/MagicDocs/prompts.js +56 -56
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +29 -29
- package/dist/src/services/SessionMemory/prompts.js +66 -66
- package/dist/src/services/api/openai.js +584 -21
- package/dist/src/services/limits/adapters/ollama.js +3 -3
- package/dist/src/services/oauth/geminiCli.js +107 -0
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +5 -3
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +18 -18
- package/dist/src/services/orchestration/global/reporting.js +2 -2
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +9 -9
- package/dist/src/skills/bundled/batch.js +78 -78
- package/dist/src/skills/bundled/claudeApi.js +34 -34
- package/dist/src/skills/bundled/claudeInChrome.js +4 -4
- package/dist/src/skills/bundled/debug.js +36 -36
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +151 -151
- package/dist/src/skills/bundled/skillify.js +132 -132
- package/dist/src/skills/bundled/stuck.js +53 -53
- package/dist/src/skills/bundled/updateConfig.js +418 -418
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +26 -26
- package/dist/src/tools/AgentTool/AgentTool.js +7 -7
- package/dist/src/tools/AgentTool/agentDisplay.js +18 -10
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +67 -67
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +32 -32
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +13 -13
- package/dist/src/tools/AgentTool/built-in/planAgent.js +49 -49
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +129 -129
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +119 -119
- package/dist/src/tools/AgentTool/prompt.js +131 -131
- package/dist/src/tools/AgentTool/runAgent.js +9 -9
- package/dist/src/tools/BashTool/BashTool.js +10 -10
- package/dist/src/tools/BashTool/prompt.js +94 -94
- package/dist/src/tools/ConfigTool/prompt.js +29 -29
- package/dist/src/tools/EnterWorktreeTool/prompt.js +27 -27
- package/dist/src/tools/FileReadTool/prompt.js +12 -12
- package/dist/src/tools/PowerShellTool/prompt.js +82 -82
- package/dist/src/tools/RemoteTriggerTool/prompt.js +9 -9
- package/dist/src/tools/ScheduleCronTool/prompt.js +37 -37
- package/dist/src/tools/TeamCreateTool/prompt.js +110 -110
- package/dist/src/tools/TeamDeleteTool/prompt.js +13 -13
- package/dist/src/utils/advisor.js +15 -15
- package/dist/src/utils/api.js +2 -2
- package/dist/src/utils/auth.js +207 -2
- package/dist/src/utils/autoUpdater.js +18 -18
- package/dist/src/utils/bash/ShellSnapshot.js +86 -86
- package/dist/src/utils/bash/commands.js +61 -61
- package/dist/src/utils/claudeInChrome/prompt.js +53 -53
- package/dist/src/utils/claudeInChrome/setup.js +8 -8
- package/dist/src/utils/claudemd.js +19 -7
- package/dist/src/utils/databaseMcp/server/queries.js +632 -632
- package/dist/src/utils/deepLink/registerProtocol.js +35 -35
- package/dist/src/utils/deepLink/terminalLauncher.js +12 -12
- package/dist/src/utils/hooks/execAgentHook.js +7 -7
- package/dist/src/utils/hooks/execPromptHook.js +4 -4
- package/dist/src/utils/hooks/skillImprovement.js +36 -36
- package/dist/src/utils/logoV2Utils.js +1 -1
- package/dist/src/utils/mcp/dateTimeParser.js +9 -9
- package/dist/src/utils/messages.js +191 -191
- package/dist/src/utils/model/model.js +18 -0
- package/dist/src/utils/model/modelOptions.js +51 -1
- package/dist/src/utils/model/modelStrings.js +5 -1
- package/dist/src/utils/model/modelSupportOverrides.js +3 -0
- package/dist/src/utils/model/providerBaseUrls.js +6 -1
- package/dist/src/utils/model/providerCatalog.js +64 -28
- package/dist/src/utils/model/providerModels.js +88 -17
- package/dist/src/utils/model/providerProfiles.js +8 -0
- package/dist/src/utils/model/providerProfilesDb.js +578 -393
- package/dist/src/utils/model/providerSwitch.js +12 -0
- package/dist/src/utils/model/providerWorkspaces.js +2 -0
- package/dist/src/utils/model/providers.js +65 -2
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +3 -1
- package/dist/src/utils/orchestration/store/runStore.js +47 -47
- package/dist/src/utils/orchestration/store/teamStore.js +61 -61
- package/dist/src/utils/powershell/parser.js +253 -253
- package/dist/src/utils/sessionTitle.js +12 -12
- package/dist/src/utils/sideQuestion.js +17 -17
- package/dist/src/utils/status.js +1 -1
- package/dist/src/utils/swarm/backends/registry.js +9 -9
- package/dist/src/utils/telemetry/instrumentation.js +9 -9
- package/dist/src/utils/teleport.js +15 -15
- package/dist/src/utils/undercover.js +28 -28
- package/package.json +1 -1
|
@@ -102,7 +102,7 @@ export const ollamaLimitAdapter = {
|
|
|
102
102
|
return {
|
|
103
103
|
...base,
|
|
104
104
|
status: 'ok',
|
|
105
|
-
plan: 'Ollama
|
|
105
|
+
plan: 'Ollama (ilimitado)',
|
|
106
106
|
tokensLimit: null,
|
|
107
107
|
costLimitUsd: null,
|
|
108
108
|
message: 'Ollama corre localmente; no hay limite de proveedor.',
|
|
@@ -142,10 +142,10 @@ export const ollamaCloudLimitAdapter = {
|
|
|
142
142
|
return {
|
|
143
143
|
...base,
|
|
144
144
|
status: 'ok',
|
|
145
|
-
plan: 'Ollama
|
|
145
|
+
plan: 'Ollama (ilimitado)',
|
|
146
146
|
tokensLimit: null,
|
|
147
147
|
costLimitUsd: null,
|
|
148
|
-
message: 'El perfil ollama-cloud apunta a un host local; se trata como Ollama
|
|
148
|
+
message: 'El perfil ollama-cloud apunta a un host local; se trata como Ollama ilimitado.',
|
|
149
149
|
raw,
|
|
150
150
|
};
|
|
151
151
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
2
|
+
import { GEMINI_CLI_OAUTH_AUTHORIZE_URL, GEMINI_CLI_OAUTH_CALLBACK_PATH, GEMINI_CLI_OAUTH_CALLBACK_PORT, GEMINI_CLI_OAUTH_CLIENT_ID, GEMINI_CLI_OAUTH_CLIENT_SECRET, GEMINI_CLI_OAUTH_REDIRECT_URI, GEMINI_CLI_OAUTH_SCOPES, GEMINI_CLI_OAUTH_TOKEN_URL, } from '../../constants/geminiOAuth.js';
|
|
3
|
+
import { openBrowser } from '../../utils/browser.js';
|
|
4
|
+
import { logForDebugging } from '../../utils/debug.js';
|
|
5
|
+
import { AuthCodeListener } from './auth-code-listener.js';
|
|
6
|
+
function base64Url(value) {
|
|
7
|
+
return value
|
|
8
|
+
.toString('base64')
|
|
9
|
+
.replace(/\+/g, '-')
|
|
10
|
+
.replace(/\//g, '_')
|
|
11
|
+
.replace(/=+$/g, '');
|
|
12
|
+
}
|
|
13
|
+
function generateCodeVerifier() {
|
|
14
|
+
return base64Url(randomBytes(32));
|
|
15
|
+
}
|
|
16
|
+
function generateCodeChallenge(verifier) {
|
|
17
|
+
return base64Url(createHash('sha256').update(verifier).digest());
|
|
18
|
+
}
|
|
19
|
+
async function discoverGoogleProject(accessToken) {
|
|
20
|
+
const envProjectId = process.env.GEMINI_GOOGLE_PROJECT_ID?.trim() || undefined;
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch('https://cloudcode-pa.googleapis.com/v1internal:loadCodeAssist', {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${accessToken}`,
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
cloudaicompanionProject: envProjectId,
|
|
30
|
+
metadata: {
|
|
31
|
+
ideType: 'IDE_UNSPECIFIED',
|
|
32
|
+
platform: 'PLATFORM_UNSPECIFIED',
|
|
33
|
+
pluginType: 'GEMINI',
|
|
34
|
+
duetProject: envProjectId,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
if (response.ok) {
|
|
39
|
+
const data = (await response.json());
|
|
40
|
+
return data.cloudaicompanionProject;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logForDebugging(`Gemini CLI project discovery failed: ${String(error)}`, {
|
|
45
|
+
level: 'debug',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return envProjectId;
|
|
49
|
+
}
|
|
50
|
+
export async function startGeminiCliOAuthFlow() {
|
|
51
|
+
const listener = new AuthCodeListener(GEMINI_CLI_OAUTH_CALLBACK_PATH);
|
|
52
|
+
const codeVerifier = generateCodeVerifier();
|
|
53
|
+
const codeChallenge = generateCodeChallenge(codeVerifier);
|
|
54
|
+
const state = randomBytes(16).toString('hex');
|
|
55
|
+
await listener.start(GEMINI_CLI_OAUTH_CALLBACK_PORT, 'localhost');
|
|
56
|
+
const authUrl = new URL(GEMINI_CLI_OAUTH_AUTHORIZE_URL);
|
|
57
|
+
authUrl.searchParams.set('client_id', GEMINI_CLI_OAUTH_CLIENT_ID);
|
|
58
|
+
authUrl.searchParams.set('redirect_uri', GEMINI_CLI_OAUTH_REDIRECT_URI);
|
|
59
|
+
authUrl.searchParams.set('response_type', 'code');
|
|
60
|
+
authUrl.searchParams.set('scope', GEMINI_CLI_OAUTH_SCOPES.join(' '));
|
|
61
|
+
authUrl.searchParams.set('state', state);
|
|
62
|
+
authUrl.searchParams.set('code_challenge', codeChallenge);
|
|
63
|
+
authUrl.searchParams.set('code_challenge_method', 'S256');
|
|
64
|
+
authUrl.searchParams.set('access_type', 'offline');
|
|
65
|
+
authUrl.searchParams.set('prompt', 'consent');
|
|
66
|
+
try {
|
|
67
|
+
const authorizationCode = await listener.waitForAuthorization(state, async () => {
|
|
68
|
+
await openBrowser(authUrl.toString());
|
|
69
|
+
});
|
|
70
|
+
const tokenResponse = await fetch(GEMINI_CLI_OAUTH_TOKEN_URL, {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
73
|
+
body: new URLSearchParams({
|
|
74
|
+
grant_type: 'authorization_code',
|
|
75
|
+
code: authorizationCode,
|
|
76
|
+
redirect_uri: GEMINI_CLI_OAUTH_REDIRECT_URI,
|
|
77
|
+
client_id: GEMINI_CLI_OAUTH_CLIENT_ID,
|
|
78
|
+
client_secret: GEMINI_CLI_OAUTH_CLIENT_SECRET,
|
|
79
|
+
code_verifier: codeVerifier,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
if (!tokenResponse.ok) {
|
|
83
|
+
const message = await tokenResponse.text().catch(() => tokenResponse.statusText);
|
|
84
|
+
throw new Error(`Gemini CLI OAuth token exchange failed: ${message}`);
|
|
85
|
+
}
|
|
86
|
+
const data = (await tokenResponse.json());
|
|
87
|
+
const projectId = await discoverGoogleProject(data.access_token);
|
|
88
|
+
listener.handleSuccessRedirect([], 'openai', response => {
|
|
89
|
+
response.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
90
|
+
response.end('<html><body style="font-family:sans-serif;padding:2rem;text-align:center"><h2>Conectado a Gemini</h2><p>Puedes cerrar esta ventana y volver a Context Code.</p></body></html>');
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
accessToken: data.access_token,
|
|
94
|
+
refreshToken: data.refresh_token ?? null,
|
|
95
|
+
expiresAt: data.expires_in
|
|
96
|
+
? Date.now() + data.expires_in * 1000
|
|
97
|
+
: null,
|
|
98
|
+
scopes: data.scope?.split(/\s+/).filter(Boolean) ?? GEMINI_CLI_OAUTH_SCOPES,
|
|
99
|
+
subscriptionType: null,
|
|
100
|
+
rateLimitTier: null,
|
|
101
|
+
projectId,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
listener.close();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -6,6 +6,8 @@ const DEFAULT_BASE_URLS = {
|
|
|
6
6
|
openrouter: 'https://openrouter.ai/api/v1',
|
|
7
7
|
ollama: 'http://localhost:11434/v1',
|
|
8
8
|
'ollama-cloud': 'http://localhost:11434/v1',
|
|
9
|
+
'gemini-api': 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
10
|
+
'gemini-google': 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
9
11
|
zai: 'https://api.z.ai/api/coding/paas/v4',
|
|
10
12
|
minimax: 'https://api.minimax.io/anthropic',
|
|
11
13
|
};
|
|
@@ -78,7 +80,7 @@ function buildSystemPrompt(input) {
|
|
|
78
80
|
const capabilities = input.capabilities.length > 0 ? input.capabilities.join(', ') : 'sin declarar';
|
|
79
81
|
return [
|
|
80
82
|
input.agent.systemPrompt?.trim() ||
|
|
81
|
-
`Eres ${input.agent.name}, agente del
|
|
83
|
+
`Eres ${input.agent.name}, agente del equipo ${domainName}.`,
|
|
82
84
|
`Rol: ${input.agent.roleKind ?? 'general'}.`,
|
|
83
85
|
`Capacidades: ${capabilities}.`,
|
|
84
86
|
'Responde con un reporte ejecutivo y accionable para el orquestador global.',
|
|
@@ -92,13 +94,13 @@ function buildUserPrompt(input) {
|
|
|
92
94
|
: 'sin miembros internos';
|
|
93
95
|
return [
|
|
94
96
|
`Objetivo global: ${input.run.goal}`,
|
|
95
|
-
`
|
|
97
|
+
`Equipo: ${domainName}`,
|
|
96
98
|
`Tarea: ${input.task.title}`,
|
|
97
99
|
`Instrucciones: ${input.task.instructions}`,
|
|
98
100
|
`Miembros del escuadron: ${memberText}`,
|
|
99
101
|
'',
|
|
100
102
|
'Entrega:',
|
|
101
|
-
'1. Resultado del
|
|
103
|
+
'1. Resultado del equipo.',
|
|
102
104
|
'2. Decisiones tomadas.',
|
|
103
105
|
'3. Riesgos o bloqueos.',
|
|
104
106
|
'4. Siguientes pasos recomendados.',
|
|
@@ -47,7 +47,7 @@ function rowToTask(row) {
|
|
|
47
47
|
runId: typed.run_id,
|
|
48
48
|
parentTaskId: typed.parent_task_id ?? null,
|
|
49
49
|
scopeType: typed.scope_type,
|
|
50
|
-
teamDomainId: typed.
|
|
50
|
+
teamDomainId: typed.team_unit_id ?? null,
|
|
51
51
|
assignedAgentId: typed.assigned_agent_id ?? null,
|
|
52
52
|
title: typed.title,
|
|
53
53
|
instructions: typed.instructions,
|
|
@@ -92,7 +92,7 @@ function validateRunTransition(current, next) {
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
if (!RUN_TRANSITIONS[current].includes(next)) {
|
|
95
|
-
throw new Error(`No se puede transicionar una
|
|
95
|
+
throw new Error(`No se puede transicionar una ejecucion de ${current} a ${next}.`);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
function validateTaskTransition(current, next) {
|
|
@@ -205,7 +205,7 @@ async function loadRunState(runId) {
|
|
|
205
205
|
}
|
|
206
206
|
const db = await getOrchestrationDatabase();
|
|
207
207
|
const tasks = db
|
|
208
|
-
.prepare(`SELECT id, run_id, parent_task_id, scope_type,
|
|
208
|
+
.prepare(`SELECT id, run_id, parent_task_id, scope_type, team_unit_id, assigned_agent_id, title, instructions, status, result_summary, created_at, finished_at
|
|
209
209
|
FROM orchestration_tasks
|
|
210
210
|
WHERE run_id = ?
|
|
211
211
|
ORDER BY created_at, id`)
|
|
@@ -225,7 +225,7 @@ async function loadRunState(runId) {
|
|
|
225
225
|
async function loadTaskAndRunState(taskId) {
|
|
226
226
|
const db = await getOrchestrationDatabase();
|
|
227
227
|
const row = db
|
|
228
|
-
.prepare(`SELECT id, run_id, parent_task_id, scope_type,
|
|
228
|
+
.prepare(`SELECT id, run_id, parent_task_id, scope_type, team_unit_id, assigned_agent_id, title, instructions, status, result_summary, created_at, finished_at
|
|
229
229
|
FROM orchestration_tasks
|
|
230
230
|
WHERE id = ?`)
|
|
231
231
|
.get(requireText(taskId, 'taskId'));
|
|
@@ -242,7 +242,7 @@ async function loadTaskAndRunState(taskId) {
|
|
|
242
242
|
async function updateTasksByRun(runId, transform) {
|
|
243
243
|
const db = await getOrchestrationDatabase();
|
|
244
244
|
const rows = db
|
|
245
|
-
.prepare(`SELECT id, run_id, parent_task_id, scope_type,
|
|
245
|
+
.prepare(`SELECT id, run_id, parent_task_id, scope_type, team_unit_id, assigned_agent_id, title, instructions, status, result_summary, created_at, finished_at
|
|
246
246
|
FROM orchestration_tasks
|
|
247
247
|
WHERE run_id = ?`)
|
|
248
248
|
.all(requireText(runId, 'runId'))
|
|
@@ -385,8 +385,8 @@ async function finalizeRunFromTasks(runId) {
|
|
|
385
385
|
finishedAt: nowIso(),
|
|
386
386
|
});
|
|
387
387
|
await new OrchestrationExecutionRuntime().appendMessage(runId, nextStatus === 'completed' ? 'run.completed' : 'run.failed', nextStatus === 'completed'
|
|
388
|
-
? 'Todos los
|
|
389
|
-
: 'La
|
|
388
|
+
? 'Todos los equipos ejecutables reportaron resultado al orquestador global.'
|
|
389
|
+
: 'La ejecucion termino con equipos bloqueados o fallidos.', null, state.run.globalOrchestratorAgentId, null);
|
|
390
390
|
}
|
|
391
391
|
export class OrchestrationExecutionRuntime {
|
|
392
392
|
async getRunState(runId) {
|
|
@@ -402,7 +402,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
402
402
|
throw new Error(`Orchestration run not found: ${runId}`);
|
|
403
403
|
}
|
|
404
404
|
if (runState.run.status === 'completed') {
|
|
405
|
-
throw new Error('No se puede iniciar una
|
|
405
|
+
throw new Error('No se puede iniciar una ejecucion completada.');
|
|
406
406
|
}
|
|
407
407
|
const changed = runState.run.status !== 'in_progress';
|
|
408
408
|
await withOrchestrationTransaction(async (db) => {
|
|
@@ -447,7 +447,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
447
447
|
throw new Error(`Orchestration run not found: ${runId}`);
|
|
448
448
|
}
|
|
449
449
|
if (runState.run.status === 'completed') {
|
|
450
|
-
throw new Error('No se puede reanudar una
|
|
450
|
+
throw new Error('No se puede reanudar una ejecucion completada.');
|
|
451
451
|
}
|
|
452
452
|
const changed = runState.run.status !== 'in_progress';
|
|
453
453
|
await withOrchestrationTransaction(async (db) => {
|
|
@@ -594,10 +594,10 @@ export class OrchestrationExecutionRuntime {
|
|
|
594
594
|
throw new Error(`Orchestration run not found: ${runId}`);
|
|
595
595
|
}
|
|
596
596
|
if (initial.run.status === 'completed') {
|
|
597
|
-
throw new Error('No se puede ejecutar una
|
|
597
|
+
throw new Error('No se puede ejecutar una ejecucion completada.');
|
|
598
598
|
}
|
|
599
599
|
if (initial.run.status === 'cancelled') {
|
|
600
|
-
throw new Error('No se puede ejecutar una
|
|
600
|
+
throw new Error('No se puede ejecutar una ejecucion cancelada.');
|
|
601
601
|
}
|
|
602
602
|
const readyTasks = initial.tasks
|
|
603
603
|
.filter(task => task.status === 'ready')
|
|
@@ -646,7 +646,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
646
646
|
progressPercent: progressPercent(),
|
|
647
647
|
});
|
|
648
648
|
if (!selectedAgentId) {
|
|
649
|
-
const summary = `
|
|
649
|
+
const summary = `Equipo ${domainName} bloqueado: no hay agente asignado ni miembros disponibles.`;
|
|
650
650
|
const blockedAt = nowIso();
|
|
651
651
|
input.onProgress?.({
|
|
652
652
|
runId,
|
|
@@ -681,7 +681,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
681
681
|
localOrchestratorAgentId,
|
|
682
682
|
status: 'needs_revision',
|
|
683
683
|
summary,
|
|
684
|
-
blockers: 'No hay agente disponible para ejecutar el
|
|
684
|
+
blockers: 'No hay agente disponible para ejecutar el equipo.',
|
|
685
685
|
output: summary,
|
|
686
686
|
metricsJson: JSON.stringify({
|
|
687
687
|
completedTasks: 0,
|
|
@@ -702,7 +702,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
702
702
|
memberAgentIds: members.map(member => member.agentId),
|
|
703
703
|
status: 'blocked',
|
|
704
704
|
summary,
|
|
705
|
-
blockers: ['No hay agente disponible para ejecutar el
|
|
705
|
+
blockers: ['No hay agente disponible para ejecutar el equipo.'],
|
|
706
706
|
completedAt: blockedAt,
|
|
707
707
|
});
|
|
708
708
|
processedReadyTasks += 1;
|
|
@@ -711,7 +711,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
711
711
|
const agent = await getProviderAgentById(selectedAgentId);
|
|
712
712
|
const capabilities = sortCapabilities(agent ? await listProviderAgentCapabilities(agent.id) : []);
|
|
713
713
|
if (!agent || !agent.isEnabled) {
|
|
714
|
-
const summary = `
|
|
714
|
+
const summary = `Equipo ${domainName} bloqueado: el agente asignado no existe o esta deshabilitado.`;
|
|
715
715
|
const blockedAt = nowIso();
|
|
716
716
|
input.onProgress?.({
|
|
717
717
|
runId,
|
|
@@ -777,7 +777,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
777
777
|
const workspace = await getProviderWorkspaceById(agent.workspaceId);
|
|
778
778
|
const agentLabel = workspace ? `${workspace.provider}/${agent.name}` : agent.name;
|
|
779
779
|
if (!workspace || !workspace.isEnabled) {
|
|
780
|
-
const summary = `
|
|
780
|
+
const summary = `Equipo ${domainName} bloqueado: el workspace del agente no existe o esta deshabilitado.`;
|
|
781
781
|
const blockedAt = nowIso();
|
|
782
782
|
input.onProgress?.({
|
|
783
783
|
runId,
|
|
@@ -846,7 +846,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
846
846
|
WHERE id = ?`).run('in_progress', selectedAgentId, task.id);
|
|
847
847
|
db.prepare(`INSERT INTO orchestration_messages (
|
|
848
848
|
id, run_id, task_id, from_agent_id, to_agent_id, message_type, content, created_at
|
|
849
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(randomUUID(), runId, task.id, initial.run.globalOrchestratorAgentId, selectedAgentId, 'task.dispatch', `
|
|
849
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(randomUUID(), runId, task.id, initial.run.globalOrchestratorAgentId, selectedAgentId, 'task.dispatch', `Equipo ${domainName}: tarea enviada a ${agent.name}.`, nowIso());
|
|
850
850
|
});
|
|
851
851
|
input.onProgress?.({
|
|
852
852
|
runId,
|
|
@@ -1026,7 +1026,7 @@ export class OrchestrationExecutionRuntime {
|
|
|
1026
1026
|
domainReports: report.domainReports,
|
|
1027
1027
|
}),
|
|
1028
1028
|
risks: report.failedTasks > 0 || report.blockedTasks > 0
|
|
1029
|
-
? 'Hay tareas fallidas o bloqueadas que requieren revision antes de cerrar la
|
|
1029
|
+
? 'Hay tareas fallidas o bloqueadas que requieren revision antes de cerrar la ejecucion.'
|
|
1030
1030
|
: null,
|
|
1031
1031
|
nextSteps: report.openTasks > 0
|
|
1032
1032
|
? 'Ejecutar /run resume <run-id> para continuar las tareas abiertas.'
|
|
@@ -438,13 +438,13 @@ function buildClosureRecommendation(domain, reports, blockers, artifacts, nextAc
|
|
|
438
438
|
function buildConsolidatedRecommendations(domainSummaries, blockers) {
|
|
439
439
|
const recommendations = [];
|
|
440
440
|
if (blockers.length > 0) {
|
|
441
|
-
recommendations.push('Resolver bloqueos de escuadron antes de cerrar la
|
|
441
|
+
recommendations.push('Resolver bloqueos de escuadron antes de cerrar la ejecucion global.');
|
|
442
442
|
}
|
|
443
443
|
if (domainSummaries.some(summary => summary.status === 'in_progress')) {
|
|
444
444
|
recommendations.push('Esperar reportes finales de dominios en progreso.');
|
|
445
445
|
}
|
|
446
446
|
if (domainSummaries.every(summary => summary.status === 'completed')) {
|
|
447
|
-
recommendations.push('Consolidar resultado final y cerrar la
|
|
447
|
+
recommendations.push('Consolidar resultado final y cerrar la ejecucion.');
|
|
448
448
|
}
|
|
449
449
|
if (domainSummaries.some(summary => summary.closureRecommendation.action === 'retry')) {
|
|
450
450
|
recommendations.push('Reintentar dominios con fallo, baja confianza o evidencia insuficiente.');
|
|
@@ -10,15 +10,15 @@ import { logError } from '../../utils/log.js';
|
|
|
10
10
|
import { jsonStringify } from '../../utils/slowOperations.js';
|
|
11
11
|
import { asSystemPrompt } from '../../utils/systemPromptType.js';
|
|
12
12
|
import { queryHaiku } from '../api/claude.js';
|
|
13
|
-
const TOOL_USE_SUMMARY_SYSTEM_PROMPT = `Write a short summary label describing what these tool calls accomplished. It appears as a single-line row in a mobile app and truncates around 30 characters, so think git-commit-subject, not sentence.
|
|
14
|
-
|
|
15
|
-
Keep the verb in past tense and the most distinctive noun. Drop articles, connectors, and long location context first.
|
|
16
|
-
|
|
17
|
-
Examples:
|
|
18
|
-
- Searched in auth/
|
|
19
|
-
- Fixed NPE in UserService
|
|
20
|
-
- Created signup endpoint
|
|
21
|
-
- Read config.json
|
|
13
|
+
const TOOL_USE_SUMMARY_SYSTEM_PROMPT = `Write a short summary label describing what these tool calls accomplished. It appears as a single-line row in a mobile app and truncates around 30 characters, so think git-commit-subject, not sentence.
|
|
14
|
+
|
|
15
|
+
Keep the verb in past tense and the most distinctive noun. Drop articles, connectors, and long location context first.
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
- Searched in auth/
|
|
19
|
+
- Fixed NPE in UserService
|
|
20
|
+
- Created signup endpoint
|
|
21
|
+
- Read config.json
|
|
22
22
|
- Ran failing tests`;
|
|
23
23
|
/**
|
|
24
24
|
* Generates a human-readable summary of completed tools.
|
|
@@ -7,89 +7,89 @@ import { getIsGit } from '../../utils/git.js';
|
|
|
7
7
|
import { registerBundledSkill } from '../bundledSkills.js';
|
|
8
8
|
const MIN_AGENTS = 5;
|
|
9
9
|
const MAX_AGENTS = 30;
|
|
10
|
-
const WORKER_INSTRUCTIONS = `After you finish implementing the change:
|
|
11
|
-
1. **Simplify** — Invoke the \`${SKILL_TOOL_NAME}\` tool with \`skill: "simplify"\` to review and clean up your changes.
|
|
12
|
-
2. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like \`npm test\`, \`bun test\`, \`pytest\`, \`go test\`). If tests fail, fix them.
|
|
13
|
-
3. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.
|
|
14
|
-
4. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with \`gh pr create\`. Use a descriptive title. If \`gh\` is not available or the push fails, note it in your final message.
|
|
10
|
+
const WORKER_INSTRUCTIONS = `After you finish implementing the change:
|
|
11
|
+
1. **Simplify** — Invoke the \`${SKILL_TOOL_NAME}\` tool with \`skill: "simplify"\` to review and clean up your changes.
|
|
12
|
+
2. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like \`npm test\`, \`bun test\`, \`pytest\`, \`go test\`). If tests fail, fix them.
|
|
13
|
+
3. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.
|
|
14
|
+
4. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with \`gh pr create\`. Use a descriptive title. If \`gh\` is not available or the push fails, note it in your final message.
|
|
15
15
|
5. **Report** — End with a single line: \`PR: <url>\` so the coordinator can track it. If no PR was created, end with \`PR: none — <reason>\`.`;
|
|
16
16
|
function buildPrompt(instruction) {
|
|
17
|
-
return `# Batch: Parallel Work Orchestration
|
|
18
|
-
|
|
19
|
-
You are orchestrating a large, parallelizable change across this codebase.
|
|
20
|
-
|
|
21
|
-
## User Instruction
|
|
22
|
-
|
|
23
|
-
${instruction}
|
|
24
|
-
|
|
25
|
-
## Phase 1: Research and Plan (Plan Mode)
|
|
26
|
-
|
|
27
|
-
Call the \`${ENTER_PLAN_MODE_TOOL_NAME}\` tool now to enter plan mode, then:
|
|
28
|
-
|
|
29
|
-
1. **Understand the scope.** Launch one or more subagents (in the foreground — you need their results) to deeply research what this instruction touches. Find all the files, patterns, and call sites that need to change. Understand the existing conventions so the migration is consistent.
|
|
30
|
-
|
|
31
|
-
2. **Decompose into independent units.** Break the work into ${MIN_AGENTS}–${MAX_AGENTS} self-contained units. Each unit must:
|
|
32
|
-
- Be independently implementable in an isolated git worktree (no shared state with sibling units)
|
|
33
|
-
- Be mergeable on its own without depending on another unit's PR landing first
|
|
34
|
-
- Be roughly uniform in size (split large units, merge trivial ones)
|
|
35
|
-
|
|
36
|
-
Scale the count to the actual work: few files → closer to ${MIN_AGENTS}; hundreds of files → closer to ${MAX_AGENTS}. Prefer per-directory or per-module slicing over arbitrary file lists.
|
|
37
|
-
|
|
38
|
-
3. **Determine the e2e test recipe.** Figure out how a worker can verify its change actually works end-to-end — not just that unit tests pass. Look for:
|
|
39
|
-
- A \`claude-in-chrome\` skill or browser-automation tool (for UI changes: click through the affected flow, screenshot the result)
|
|
40
|
-
- A \`tmux\` or CLI-verifier skill (for CLI changes: launch the app interactively, exercise the changed behavior)
|
|
41
|
-
- A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
|
|
42
|
-
- An existing e2e/integration test suite the worker can run
|
|
43
|
-
|
|
44
|
-
If you cannot find a concrete e2e path, use the \`${ASK_USER_QUESTION_TOOL_NAME}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
|
|
45
|
-
|
|
46
|
-
Write the recipe as a short, concrete set of steps that a worker can execute autonomously. Include any setup (start a dev server, build first) and the exact command/interaction to verify.
|
|
47
|
-
|
|
48
|
-
4. **Write the plan.** In your plan file, include:
|
|
49
|
-
- A summary of what you found during research
|
|
50
|
-
- A numbered list of work units — for each: a short title, the list of files/directories it covers, and a one-line description of the change
|
|
51
|
-
- The e2e test recipe (or "skip e2e because …" if the user chose that)
|
|
52
|
-
- The exact worker instructions you will give each agent (the shared template)
|
|
53
|
-
|
|
54
|
-
5. Call \`${EXIT_PLAN_MODE_TOOL_NAME}\` to present the plan for approval.
|
|
55
|
-
|
|
56
|
-
## Phase 2: Spawn Workers (After Plan Approval)
|
|
57
|
-
|
|
58
|
-
Once the plan is approved, spawn one background agent per work unit using the \`${AGENT_TOOL_NAME}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
|
|
59
|
-
|
|
60
|
-
For each agent, the prompt must be fully self-contained. Include:
|
|
61
|
-
- The overall goal (the user's instruction)
|
|
62
|
-
- This unit's specific task (title, file list, change description — copied verbatim from your plan)
|
|
63
|
-
- Any codebase conventions you discovered that the worker needs to follow
|
|
64
|
-
- The e2e test recipe from your plan (or "skip e2e because …")
|
|
65
|
-
- The worker instructions below, copied verbatim:
|
|
66
|
-
|
|
67
|
-
\`\`\`
|
|
68
|
-
${WORKER_INSTRUCTIONS}
|
|
69
|
-
\`\`\`
|
|
70
|
-
|
|
71
|
-
Use \`subagent_type: "general-purpose"\` unless a more specific agent type fits.
|
|
72
|
-
|
|
73
|
-
## Phase 3: Track Progress
|
|
74
|
-
|
|
75
|
-
After launching all workers, render an initial status table:
|
|
76
|
-
|
|
77
|
-
| # | Unit | Status | PR |
|
|
78
|
-
|---|------|--------|----|
|
|
79
|
-
| 1 | <title> | running | — |
|
|
80
|
-
| 2 | <title> | running | — |
|
|
81
|
-
|
|
82
|
-
As background-agent completion notifications arrive, parse the \`PR: <url>\` line from each agent's result and re-render the table with updated status (\`done\` / \`failed\`) and PR links. Keep a brief failure note for any agent that did not produce a PR.
|
|
83
|
-
|
|
84
|
-
When all agents have reported, render the final table and a one-line summary (e.g., "22/24 units landed as PRs").
|
|
17
|
+
return `# Batch: Parallel Work Orchestration
|
|
18
|
+
|
|
19
|
+
You are orchestrating a large, parallelizable change across this codebase.
|
|
20
|
+
|
|
21
|
+
## User Instruction
|
|
22
|
+
|
|
23
|
+
${instruction}
|
|
24
|
+
|
|
25
|
+
## Phase 1: Research and Plan (Plan Mode)
|
|
26
|
+
|
|
27
|
+
Call the \`${ENTER_PLAN_MODE_TOOL_NAME}\` tool now to enter plan mode, then:
|
|
28
|
+
|
|
29
|
+
1. **Understand the scope.** Launch one or more subagents (in the foreground — you need their results) to deeply research what this instruction touches. Find all the files, patterns, and call sites that need to change. Understand the existing conventions so the migration is consistent.
|
|
30
|
+
|
|
31
|
+
2. **Decompose into independent units.** Break the work into ${MIN_AGENTS}–${MAX_AGENTS} self-contained units. Each unit must:
|
|
32
|
+
- Be independently implementable in an isolated git worktree (no shared state with sibling units)
|
|
33
|
+
- Be mergeable on its own without depending on another unit's PR landing first
|
|
34
|
+
- Be roughly uniform in size (split large units, merge trivial ones)
|
|
35
|
+
|
|
36
|
+
Scale the count to the actual work: few files → closer to ${MIN_AGENTS}; hundreds of files → closer to ${MAX_AGENTS}. Prefer per-directory or per-module slicing over arbitrary file lists.
|
|
37
|
+
|
|
38
|
+
3. **Determine the e2e test recipe.** Figure out how a worker can verify its change actually works end-to-end — not just that unit tests pass. Look for:
|
|
39
|
+
- A \`claude-in-chrome\` skill or browser-automation tool (for UI changes: click through the affected flow, screenshot the result)
|
|
40
|
+
- A \`tmux\` or CLI-verifier skill (for CLI changes: launch the app interactively, exercise the changed behavior)
|
|
41
|
+
- A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
|
|
42
|
+
- An existing e2e/integration test suite the worker can run
|
|
43
|
+
|
|
44
|
+
If you cannot find a concrete e2e path, use the \`${ASK_USER_QUESTION_TOOL_NAME}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
|
|
45
|
+
|
|
46
|
+
Write the recipe as a short, concrete set of steps that a worker can execute autonomously. Include any setup (start a dev server, build first) and the exact command/interaction to verify.
|
|
47
|
+
|
|
48
|
+
4. **Write the plan.** In your plan file, include:
|
|
49
|
+
- A summary of what you found during research
|
|
50
|
+
- A numbered list of work units — for each: a short title, the list of files/directories it covers, and a one-line description of the change
|
|
51
|
+
- The e2e test recipe (or "skip e2e because …" if the user chose that)
|
|
52
|
+
- The exact worker instructions you will give each agent (the shared template)
|
|
53
|
+
|
|
54
|
+
5. Call \`${EXIT_PLAN_MODE_TOOL_NAME}\` to present the plan for approval.
|
|
55
|
+
|
|
56
|
+
## Phase 2: Spawn Workers (After Plan Approval)
|
|
57
|
+
|
|
58
|
+
Once the plan is approved, spawn one background agent per work unit using the \`${AGENT_TOOL_NAME}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
|
|
59
|
+
|
|
60
|
+
For each agent, the prompt must be fully self-contained. Include:
|
|
61
|
+
- The overall goal (the user's instruction)
|
|
62
|
+
- This unit's specific task (title, file list, change description — copied verbatim from your plan)
|
|
63
|
+
- Any codebase conventions you discovered that the worker needs to follow
|
|
64
|
+
- The e2e test recipe from your plan (or "skip e2e because …")
|
|
65
|
+
- The worker instructions below, copied verbatim:
|
|
66
|
+
|
|
67
|
+
\`\`\`
|
|
68
|
+
${WORKER_INSTRUCTIONS}
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
Use \`subagent_type: "general-purpose"\` unless a more specific agent type fits.
|
|
72
|
+
|
|
73
|
+
## Phase 3: Track Progress
|
|
74
|
+
|
|
75
|
+
After launching all workers, render an initial status table:
|
|
76
|
+
|
|
77
|
+
| # | Unit | Status | PR |
|
|
78
|
+
|---|------|--------|----|
|
|
79
|
+
| 1 | <title> | running | — |
|
|
80
|
+
| 2 | <title> | running | — |
|
|
81
|
+
|
|
82
|
+
As background-agent completion notifications arrive, parse the \`PR: <url>\` line from each agent's result and re-render the table with updated status (\`done\` / \`failed\`) and PR links. Keep a brief failure note for any agent that did not produce a PR.
|
|
83
|
+
|
|
84
|
+
When all agents have reported, render the final table and a one-line summary (e.g., "22/24 units landed as PRs").
|
|
85
85
|
`;
|
|
86
86
|
}
|
|
87
87
|
const NOT_A_GIT_REPO_MESSAGE = `This is not a git repository. The \`/batch\` command requires a git repo because it spawns agents in isolated git worktrees and creates PRs from each. Initialize a repo first, or run this from inside an existing one.`;
|
|
88
|
-
const MISSING_INSTRUCTION_MESSAGE = `Provide an instruction describing the batch change you want to make.
|
|
89
|
-
|
|
90
|
-
Examples:
|
|
91
|
-
/batch migrate from react to vue
|
|
92
|
-
/batch replace all uses of lodash with native equivalents
|
|
88
|
+
const MISSING_INSTRUCTION_MESSAGE = `Provide an instruction describing the batch change you want to make.
|
|
89
|
+
|
|
90
|
+
Examples:
|
|
91
|
+
/batch migrate from react to vue
|
|
92
|
+
/batch replace all uses of lodash with native equivalents
|
|
93
93
|
/batch add type annotations to all untyped function parameters`;
|
|
94
94
|
export function registerBatchSkill() {
|
|
95
95
|
registerBundledSkill({
|
|
@@ -60,40 +60,40 @@ function buildInlineReference(filePaths, content) {
|
|
|
60
60
|
}
|
|
61
61
|
return sections.join('\n\n');
|
|
62
62
|
}
|
|
63
|
-
const INLINE_READING_GUIDE = `## Reference Documentation
|
|
64
|
-
|
|
65
|
-
The relevant documentation for your detected language is included below in \`<doc>\` tags. Each tag has a \`path\` attribute showing its original file path. Use this to find the right section:
|
|
66
|
-
|
|
67
|
-
### Quick Task Reference
|
|
68
|
-
|
|
69
|
-
**Single text classification/summarization/extraction/Q&A:**
|
|
70
|
-
→ Refer to \`{lang}/claude-api/README.md\`
|
|
71
|
-
|
|
72
|
-
**Chat UI or real-time response display:**
|
|
73
|
-
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/streaming.md\`
|
|
74
|
-
|
|
75
|
-
**Long-running conversations (may exceed context window):**
|
|
76
|
-
→ Refer to \`{lang}/claude-api/README.md\` — see Compaction section
|
|
77
|
-
|
|
78
|
-
**Prompt caching / optimize caching / "why is my cache hit rate low":**
|
|
79
|
-
→ Refer to \`shared/prompt-caching.md\` + \`{lang}/claude-api/README.md\` (Prompt Caching section)
|
|
80
|
-
|
|
81
|
-
**Function calling / tool use / agents:**
|
|
82
|
-
→ Refer to \`{lang}/claude-api/README.md\` + \`shared/tool-use-concepts.md\` + \`{lang}/claude-api/tool-use.md\`
|
|
83
|
-
|
|
84
|
-
**Batch processing (non-latency-sensitive):**
|
|
85
|
-
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/batches.md\`
|
|
86
|
-
|
|
87
|
-
**File uploads across multiple requests:**
|
|
88
|
-
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/files-api.md\`
|
|
89
|
-
|
|
90
|
-
**Agent with built-in tools (file/web/terminal) (Python & TypeScript only):**
|
|
91
|
-
→ Refer to \`{lang}/agent-sdk/README.md\` + \`{lang}/agent-sdk/patterns.md\`
|
|
92
|
-
|
|
93
|
-
**Error handling:**
|
|
94
|
-
→ Refer to \`shared/error-codes.md\`
|
|
95
|
-
|
|
96
|
-
**Latest docs via WebFetch:**
|
|
63
|
+
const INLINE_READING_GUIDE = `## Reference Documentation
|
|
64
|
+
|
|
65
|
+
The relevant documentation for your detected language is included below in \`<doc>\` tags. Each tag has a \`path\` attribute showing its original file path. Use this to find the right section:
|
|
66
|
+
|
|
67
|
+
### Quick Task Reference
|
|
68
|
+
|
|
69
|
+
**Single text classification/summarization/extraction/Q&A:**
|
|
70
|
+
→ Refer to \`{lang}/claude-api/README.md\`
|
|
71
|
+
|
|
72
|
+
**Chat UI or real-time response display:**
|
|
73
|
+
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/streaming.md\`
|
|
74
|
+
|
|
75
|
+
**Long-running conversations (may exceed context window):**
|
|
76
|
+
→ Refer to \`{lang}/claude-api/README.md\` — see Compaction section
|
|
77
|
+
|
|
78
|
+
**Prompt caching / optimize caching / "why is my cache hit rate low":**
|
|
79
|
+
→ Refer to \`shared/prompt-caching.md\` + \`{lang}/claude-api/README.md\` (Prompt Caching section)
|
|
80
|
+
|
|
81
|
+
**Function calling / tool use / agents:**
|
|
82
|
+
→ Refer to \`{lang}/claude-api/README.md\` + \`shared/tool-use-concepts.md\` + \`{lang}/claude-api/tool-use.md\`
|
|
83
|
+
|
|
84
|
+
**Batch processing (non-latency-sensitive):**
|
|
85
|
+
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/batches.md\`
|
|
86
|
+
|
|
87
|
+
**File uploads across multiple requests:**
|
|
88
|
+
→ Refer to \`{lang}/claude-api/README.md\` + \`{lang}/claude-api/files-api.md\`
|
|
89
|
+
|
|
90
|
+
**Agent with built-in tools (file/web/terminal) (Python & TypeScript only):**
|
|
91
|
+
→ Refer to \`{lang}/agent-sdk/README.md\` + \`{lang}/agent-sdk/patterns.md\`
|
|
92
|
+
|
|
93
|
+
**Error handling:**
|
|
94
|
+
→ Refer to \`shared/error-codes.md\`
|
|
95
|
+
|
|
96
|
+
**Latest docs via WebFetch:**
|
|
97
97
|
→ Refer to \`shared/live-sources.md\` for URLs`;
|
|
98
98
|
function buildPrompt(lang, args, content) {
|
|
99
99
|
// Take the SKILL.md content up to the "Reading Guide" section
|
|
@@ -3,10 +3,10 @@ import { BASE_CHROME_PROMPT } from '../../utils/claudeInChrome/prompt.js';
|
|
|
3
3
|
import { shouldAutoEnableClaudeInChrome } from '../../utils/claudeInChrome/setup.js';
|
|
4
4
|
import { registerBundledSkill } from '../bundledSkills.js';
|
|
5
5
|
const CLAUDE_IN_CHROME_MCP_TOOLS = BROWSER_TOOLS.map(tool => `mcp__claude-in-chrome__${tool.name}`);
|
|
6
|
-
const SKILL_ACTIVATION_MESSAGE = `
|
|
7
|
-
Now that this skill is invoked, you have access to Chrome browser automation tools. You can now use the mcp__claude-in-chrome__* tools to interact with web pages.
|
|
8
|
-
|
|
9
|
-
IMPORTANT: Start by calling mcp__claude-in-chrome__tabs_context_mcp to get information about the user's current browser tabs.
|
|
6
|
+
const SKILL_ACTIVATION_MESSAGE = `
|
|
7
|
+
Now that this skill is invoked, you have access to Chrome browser automation tools. You can now use the mcp__claude-in-chrome__* tools to interact with web pages.
|
|
8
|
+
|
|
9
|
+
IMPORTANT: Start by calling mcp__claude-in-chrome__tabs_context_mcp to get information about the user's current browser tabs.
|
|
10
10
|
`;
|
|
11
11
|
export function registerClaudeInChromeSkill() {
|
|
12
12
|
registerBundledSkill({
|