@compilr-dev/sdk 0.10.5 → 0.10.7
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-Detect Capabilities — scans agent messages for "Tool not found"
|
|
3
3
|
* errors and auto-loads the corresponding capability packs.
|
|
4
|
+
* Also detects programming languages from file paths to pre-load
|
|
5
|
+
* language-specific analysis packs.
|
|
4
6
|
*/
|
|
5
7
|
import type { Message } from '@compilr-dev/agents';
|
|
6
8
|
import type { CapabilityManager } from './manager.js';
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-Detect Capabilities — scans agent messages for "Tool not found"
|
|
3
3
|
* errors and auto-loads the corresponding capability packs.
|
|
4
|
+
* Also detects programming languages from file paths to pre-load
|
|
5
|
+
* language-specific analysis packs.
|
|
4
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Map file extensions to language capability pack IDs.
|
|
9
|
+
*/
|
|
10
|
+
const EXT_TO_LANG_PACK = {
|
|
11
|
+
'.ts': 'lang_typescript',
|
|
12
|
+
'.tsx': 'lang_typescript',
|
|
13
|
+
'.js': 'lang_typescript',
|
|
14
|
+
'.jsx': 'lang_typescript',
|
|
15
|
+
'.mjs': 'lang_typescript',
|
|
16
|
+
'.cjs': 'lang_typescript',
|
|
17
|
+
'.py': 'lang_python',
|
|
18
|
+
'.pyw': 'lang_python',
|
|
19
|
+
'.go': 'lang_go',
|
|
20
|
+
};
|
|
5
21
|
/**
|
|
6
22
|
* Scan recent messages for "Tool not found: X" errors and auto-load
|
|
7
23
|
* the corresponding capability packs (max N per turn, loadable only).
|
|
@@ -45,5 +61,59 @@ export function autoDetectCapabilities(manager, messages, maxLoads = 2) {
|
|
|
45
61
|
// Only scan the most recent user message
|
|
46
62
|
break;
|
|
47
63
|
}
|
|
64
|
+
// Also detect languages from file paths in recent tool calls
|
|
65
|
+
autoDetectLanguagePacks(manager, messages, result, maxLoads - result.loaded.length);
|
|
48
66
|
return result;
|
|
49
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Scan recent assistant messages for file-related tool calls (read_file, edit, write_file, glob)
|
|
70
|
+
* and auto-load language packs based on file extensions.
|
|
71
|
+
*/
|
|
72
|
+
function autoDetectLanguagePacks(manager, messages, result, maxLoads) {
|
|
73
|
+
if (maxLoads <= 0)
|
|
74
|
+
return;
|
|
75
|
+
const detectedPacks = new Set();
|
|
76
|
+
// Scan the last few assistant messages for tool_use blocks with file paths
|
|
77
|
+
const recentMessages = messages.slice(-6);
|
|
78
|
+
for (const msg of recentMessages) {
|
|
79
|
+
if (msg.role !== 'assistant' || typeof msg.content === 'string')
|
|
80
|
+
continue;
|
|
81
|
+
for (const block of msg.content) {
|
|
82
|
+
if (block.type !== 'tool_use')
|
|
83
|
+
continue;
|
|
84
|
+
// Extract file paths from common tool inputs
|
|
85
|
+
const input = block.input;
|
|
86
|
+
if (!input)
|
|
87
|
+
continue;
|
|
88
|
+
const paths = [];
|
|
89
|
+
if (typeof input.path === 'string')
|
|
90
|
+
paths.push(input.path);
|
|
91
|
+
if (typeof input.file_path === 'string')
|
|
92
|
+
paths.push(input.file_path);
|
|
93
|
+
if (typeof input.filePath === 'string')
|
|
94
|
+
paths.push(input.filePath);
|
|
95
|
+
if (typeof input.pattern === 'string')
|
|
96
|
+
paths.push(input.pattern);
|
|
97
|
+
for (const p of paths) {
|
|
98
|
+
const lastDot = p.lastIndexOf('.');
|
|
99
|
+
const ext = lastDot >= 0 ? p.slice(lastDot).toLowerCase() : '';
|
|
100
|
+
const packId = EXT_TO_LANG_PACK[ext];
|
|
101
|
+
if (packId && !manager.isLoaded(packId)) {
|
|
102
|
+
detectedPacks.add(packId);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Load detected language packs
|
|
108
|
+
let loaded = 0;
|
|
109
|
+
for (const packId of detectedPacks) {
|
|
110
|
+
if (loaded >= maxLoads)
|
|
111
|
+
break;
|
|
112
|
+
const tier = manager.getTier(packId);
|
|
113
|
+
if (tier === 'loadable') {
|
|
114
|
+
manager.load(packId, 'auto-detect');
|
|
115
|
+
result.loaded.push(packId);
|
|
116
|
+
loaded++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -327,6 +327,94 @@ export const CAPABILITY_PACKS = {
|
|
|
327
327
|
estimatedPromptTokens: 60,
|
|
328
328
|
estimatedToolTokens: 300,
|
|
329
329
|
},
|
|
330
|
+
// ============= LANGUAGE-SPECIFIC ANALYSIS PACKS =============
|
|
331
|
+
lang_typescript: {
|
|
332
|
+
id: 'lang_typescript',
|
|
333
|
+
label: 'TypeScript/JavaScript Analysis',
|
|
334
|
+
tools: [
|
|
335
|
+
'ts_find_symbol',
|
|
336
|
+
'ts_find_references',
|
|
337
|
+
'ts_find_implementations',
|
|
338
|
+
'ts_find_dead_code',
|
|
339
|
+
'ts_find_duplicates',
|
|
340
|
+
'ts_find_patterns',
|
|
341
|
+
'ts_get_file_structure',
|
|
342
|
+
'ts_get_imports',
|
|
343
|
+
'ts_get_exports',
|
|
344
|
+
'ts_get_call_graph',
|
|
345
|
+
'ts_get_dependency_graph',
|
|
346
|
+
'ts_get_type_hierarchy',
|
|
347
|
+
'ts_get_complexity',
|
|
348
|
+
'ts_get_signature',
|
|
349
|
+
'ts_get_documentation',
|
|
350
|
+
'ts_read_function',
|
|
351
|
+
'ts_read_class',
|
|
352
|
+
'ts_read_type',
|
|
353
|
+
],
|
|
354
|
+
readOnly: true,
|
|
355
|
+
promptModules: [],
|
|
356
|
+
promptSnippet: 'TypeScript/JS AST analysis loaded: ts_find_symbol, ts_get_call_graph, ts_get_type_hierarchy, ts_find_dead_code, ts_get_imports/exports, ts_find_patterns, ts_read_function/class/type. Use these for precise structural analysis (prefer over grep for code structure questions).',
|
|
357
|
+
estimatedPromptTokens: 120,
|
|
358
|
+
estimatedToolTokens: 4200,
|
|
359
|
+
},
|
|
360
|
+
lang_python: {
|
|
361
|
+
id: 'lang_python',
|
|
362
|
+
label: 'Python Analysis',
|
|
363
|
+
tools: [
|
|
364
|
+
'find_symbol_python',
|
|
365
|
+
'find_references_python',
|
|
366
|
+
'find_implementations_python',
|
|
367
|
+
'find_dead_code_python',
|
|
368
|
+
'find_duplicates_python',
|
|
369
|
+
'find_patterns_python',
|
|
370
|
+
'get_file_structure_python',
|
|
371
|
+
'get_imports_python',
|
|
372
|
+
'get_exports_python',
|
|
373
|
+
'get_call_graph_python',
|
|
374
|
+
'get_dependency_graph_python',
|
|
375
|
+
'get_class_hierarchy_python',
|
|
376
|
+
'get_complexity_python',
|
|
377
|
+
'get_signature_python',
|
|
378
|
+
'extract_docstrings_python',
|
|
379
|
+
'read_function_py',
|
|
380
|
+
'read_class_py',
|
|
381
|
+
'read_type_py',
|
|
382
|
+
],
|
|
383
|
+
readOnly: true,
|
|
384
|
+
promptModules: [],
|
|
385
|
+
promptSnippet: 'Python AST analysis loaded: find_symbol_python, get_call_graph_python, get_class_hierarchy_python, find_dead_code_python, get_imports_python, extract_docstrings_python, read_function_py/class_py. Use these for precise structural analysis.',
|
|
386
|
+
estimatedPromptTokens: 120,
|
|
387
|
+
estimatedToolTokens: 4200,
|
|
388
|
+
},
|
|
389
|
+
lang_go: {
|
|
390
|
+
id: 'lang_go',
|
|
391
|
+
label: 'Go Analysis',
|
|
392
|
+
tools: [
|
|
393
|
+
'find_symbol_go',
|
|
394
|
+
'find_references_go',
|
|
395
|
+
'find_implementations_go',
|
|
396
|
+
'find_dead_code_go',
|
|
397
|
+
'find_duplicates_go',
|
|
398
|
+
'find_patterns_go',
|
|
399
|
+
'get_file_structure_go',
|
|
400
|
+
'get_imports_go',
|
|
401
|
+
'get_exports_go',
|
|
402
|
+
'get_call_graph_go',
|
|
403
|
+
'get_dependency_graph_go',
|
|
404
|
+
'get_class_hierarchy_go',
|
|
405
|
+
'get_complexity_go',
|
|
406
|
+
'get_signature_go',
|
|
407
|
+
'extract_docstrings_go',
|
|
408
|
+
'read_function_go',
|
|
409
|
+
'read_struct_go',
|
|
410
|
+
'read_type_go',
|
|
411
|
+
],
|
|
412
|
+
readOnly: true,
|
|
413
|
+
promptModules: [],
|
|
414
|
+
promptSnippet: 'Go AST analysis loaded: find_symbol_go, get_call_graph_go, find_dead_code_go, get_imports_go, read_function_go/struct_go. Use these for precise structural analysis.',
|
|
415
|
+
estimatedPromptTokens: 120,
|
|
416
|
+
estimatedToolTokens: 4200,
|
|
417
|
+
},
|
|
330
418
|
};
|
|
331
419
|
/**
|
|
332
420
|
* Mapping from forbidden pack IDs to suggested agent roles.
|
|
@@ -174,18 +174,58 @@ Skills with issues (short description, empty body, name mismatch) show a ⚠ war
|
|
|
174
174
|
// ── Models & Providers ──────────────────────────────────────────────────
|
|
175
175
|
{
|
|
176
176
|
id: 'models',
|
|
177
|
-
title: 'Models and
|
|
178
|
-
keywords: [
|
|
177
|
+
title: 'Models, Providers, and Model Switching',
|
|
178
|
+
keywords: [
|
|
179
|
+
'model',
|
|
180
|
+
'provider',
|
|
181
|
+
'claude',
|
|
182
|
+
'openai',
|
|
183
|
+
'gemini',
|
|
184
|
+
'ollama',
|
|
185
|
+
'llm',
|
|
186
|
+
'switch model',
|
|
187
|
+
'change model',
|
|
188
|
+
'hot swap',
|
|
189
|
+
'tier',
|
|
190
|
+
'fast',
|
|
191
|
+
'balanced',
|
|
192
|
+
'powerful',
|
|
193
|
+
'settings model',
|
|
194
|
+
'agent model',
|
|
195
|
+
'per-agent model',
|
|
196
|
+
],
|
|
179
197
|
content: `Compilr Dev supports multiple LLM providers:
|
|
180
198
|
|
|
181
|
-
- Claude (Anthropic) —
|
|
199
|
+
- Claude (Anthropic) — Opus (powerful), Sonnet (balanced), Haiku (fast)
|
|
182
200
|
- OpenAI — GPT-4o, GPT-4o-mini
|
|
183
201
|
- Gemini (Google) — Gemini 2.5 Pro, Flash
|
|
184
202
|
- Ollama — Local models (llama, codellama, etc.)
|
|
185
203
|
- Together, Groq, Fireworks, Perplexity, OpenRouter
|
|
186
204
|
|
|
187
205
|
Each provider requires an API key (except Ollama which runs locally).
|
|
188
|
-
|
|
206
|
+
|
|
207
|
+
**Model tiers:**
|
|
208
|
+
- **Fast** — quick responses, lower cost (Haiku, GPT-4o-mini, Flash)
|
|
209
|
+
- **Balanced** — best mix of speed and capability, the default (Sonnet, GPT-4o)
|
|
210
|
+
- **Powerful** — best reasoning for complex tasks (Opus)
|
|
211
|
+
|
|
212
|
+
**Settings model vs agent model — important distinction:**
|
|
213
|
+
- The model in Settings is a **template for new agents**. Changing it does NOT affect existing agents. It only determines which model new agents get when you create them.
|
|
214
|
+
- Each agent has its **own model**. You can change an agent's model independently without affecting other agents.
|
|
215
|
+
|
|
216
|
+
**How to change an agent's model:**
|
|
217
|
+
- **Desktop:** Click the model name in the status bar (bottom right) to open the model picker for the active chat's agent. You can also change models from the Agents panel.
|
|
218
|
+
- **CLI:** Use /model to change the active agent's model.
|
|
219
|
+
|
|
220
|
+
**Same provider only (Level 1):** You can switch between models within the same provider (e.g., Claude Sonnet → Claude Opus). Switching providers (e.g., Claude → Gemini) is not yet supported.
|
|
221
|
+
|
|
222
|
+
**When to switch models:**
|
|
223
|
+
- Use a **powerful** model (Opus) for complex architecture decisions, debugging hard problems, or writing nuanced content
|
|
224
|
+
- Use the **balanced** model (Sonnet) for everyday coding, planning, and general tasks
|
|
225
|
+
- Use a **fast** model (Haiku) for quick questions, simple edits, or when cost matters
|
|
226
|
+
- Switch back after the hard task is done — no need to stay on the expensive model
|
|
227
|
+
|
|
228
|
+
**Cost awareness:** switching from Haiku to Opus mid-conversation can significantly increase cost. The model tier is shown in the status bar and agent cards so you always know what you're using.`,
|
|
189
229
|
},
|
|
190
230
|
// ── Context & Memory ────────────────────────────────────────────────────
|
|
191
231
|
{
|
package/dist/presets/coding.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Coding preset — batteries-included for software development
|
|
3
3
|
*/
|
|
4
4
|
import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, todoWriteTool, todoReadTool, webFetchTool, suggestTool, } from '@compilr-dev/agents';
|
|
5
|
-
import { allCodingTools, unifiedTools } from '@compilr-dev/agents-coding';
|
|
5
|
+
import { allCodingTools, unifiedTools, ts, python, go } from '@compilr-dev/agents-coding';
|
|
6
6
|
const CODING_SYSTEM_PROMPT = `You are a skilled software engineer. You help users with coding tasks including:
|
|
7
7
|
- Writing, reviewing, and debugging code
|
|
8
8
|
- Understanding codebases and architecture
|
|
@@ -42,12 +42,23 @@ const utilityTools = [todoWriteTool, todoReadTool, suggestTool];
|
|
|
42
42
|
/**
|
|
43
43
|
* All coding preset tools combined
|
|
44
44
|
*/
|
|
45
|
+
/**
|
|
46
|
+
* Language-specific AST analysis tools (loaded on-demand via capability packs).
|
|
47
|
+
* Registered in the MetaToolsRegistry but hidden until the matching
|
|
48
|
+
* lang_typescript / lang_python / lang_go pack is loaded.
|
|
49
|
+
*/
|
|
50
|
+
const langTools = [
|
|
51
|
+
...ts.allTsTools,
|
|
52
|
+
...python.allPythonTools,
|
|
53
|
+
...go.allGoTools,
|
|
54
|
+
];
|
|
45
55
|
const allPresetTools = [
|
|
46
56
|
...fileTools,
|
|
47
57
|
...shellTools,
|
|
48
58
|
...utilityTools,
|
|
49
59
|
...allCodingTools,
|
|
50
60
|
...unifiedTools,
|
|
61
|
+
...langTools,
|
|
51
62
|
];
|
|
52
63
|
/**
|
|
53
64
|
* Coding preset — full development environment
|
package/dist/team/tool-config.js
CHANGED
|
@@ -380,6 +380,85 @@ export const TOOL_GROUPS = {
|
|
|
380
380
|
tier: 'meta',
|
|
381
381
|
note: 'Generate project files from structured models',
|
|
382
382
|
},
|
|
383
|
+
// Language-specific AST analysis (auto-loaded based on project language)
|
|
384
|
+
lang_typescript: {
|
|
385
|
+
label: 'TypeScript/JS Analysis',
|
|
386
|
+
tools: [
|
|
387
|
+
'ts_find_symbol',
|
|
388
|
+
'ts_find_references',
|
|
389
|
+
'ts_find_implementations',
|
|
390
|
+
'ts_find_dead_code',
|
|
391
|
+
'ts_find_duplicates',
|
|
392
|
+
'ts_find_patterns',
|
|
393
|
+
'ts_get_file_structure',
|
|
394
|
+
'ts_get_imports',
|
|
395
|
+
'ts_get_exports',
|
|
396
|
+
'ts_get_call_graph',
|
|
397
|
+
'ts_get_dependency_graph',
|
|
398
|
+
'ts_get_type_hierarchy',
|
|
399
|
+
'ts_get_complexity',
|
|
400
|
+
'ts_get_signature',
|
|
401
|
+
'ts_get_documentation',
|
|
402
|
+
'ts_read_function',
|
|
403
|
+
'ts_read_class',
|
|
404
|
+
'ts_read_type',
|
|
405
|
+
],
|
|
406
|
+
readOnly: true,
|
|
407
|
+
tier: 'direct',
|
|
408
|
+
note: 'AST-based TypeScript/JavaScript analysis via TypeScript Compiler API',
|
|
409
|
+
},
|
|
410
|
+
lang_python: {
|
|
411
|
+
label: 'Python Analysis',
|
|
412
|
+
tools: [
|
|
413
|
+
'find_symbol_python',
|
|
414
|
+
'find_references_python',
|
|
415
|
+
'find_implementations_python',
|
|
416
|
+
'find_dead_code_python',
|
|
417
|
+
'find_duplicates_python',
|
|
418
|
+
'find_patterns_python',
|
|
419
|
+
'get_file_structure_python',
|
|
420
|
+
'get_imports_python',
|
|
421
|
+
'get_exports_python',
|
|
422
|
+
'get_call_graph_python',
|
|
423
|
+
'get_dependency_graph_python',
|
|
424
|
+
'get_class_hierarchy_python',
|
|
425
|
+
'get_complexity_python',
|
|
426
|
+
'get_signature_python',
|
|
427
|
+
'extract_docstrings_python',
|
|
428
|
+
'read_function_py',
|
|
429
|
+
'read_class_py',
|
|
430
|
+
'read_type_py',
|
|
431
|
+
],
|
|
432
|
+
readOnly: true,
|
|
433
|
+
tier: 'direct',
|
|
434
|
+
note: 'AST-based Python analysis via Tree-sitter',
|
|
435
|
+
},
|
|
436
|
+
lang_go: {
|
|
437
|
+
label: 'Go Analysis',
|
|
438
|
+
tools: [
|
|
439
|
+
'find_symbol_go',
|
|
440
|
+
'find_references_go',
|
|
441
|
+
'find_implementations_go',
|
|
442
|
+
'find_dead_code_go',
|
|
443
|
+
'find_duplicates_go',
|
|
444
|
+
'find_patterns_go',
|
|
445
|
+
'get_file_structure_go',
|
|
446
|
+
'get_imports_go',
|
|
447
|
+
'get_exports_go',
|
|
448
|
+
'get_call_graph_go',
|
|
449
|
+
'get_dependency_graph_go',
|
|
450
|
+
'get_class_hierarchy_go',
|
|
451
|
+
'get_complexity_go',
|
|
452
|
+
'get_signature_go',
|
|
453
|
+
'extract_docstrings_go',
|
|
454
|
+
'read_function_go',
|
|
455
|
+
'read_struct_go',
|
|
456
|
+
'read_type_go',
|
|
457
|
+
],
|
|
458
|
+
readOnly: true,
|
|
459
|
+
tier: 'direct',
|
|
460
|
+
note: 'AST-based Go analysis via Tree-sitter',
|
|
461
|
+
},
|
|
383
462
|
};
|
|
384
463
|
// =============================================================================
|
|
385
464
|
// Tool Profiles
|
|
@@ -401,6 +480,9 @@ export const TOOL_PROFILES = {
|
|
|
401
480
|
'search',
|
|
402
481
|
'dependencies',
|
|
403
482
|
'backlog_read',
|
|
483
|
+
'lang_typescript',
|
|
484
|
+
'lang_python',
|
|
485
|
+
'lang_go',
|
|
404
486
|
],
|
|
405
487
|
// Developer - coding tasks
|
|
406
488
|
developer: [
|
|
@@ -429,6 +511,9 @@ export const TOOL_PROFILES = {
|
|
|
429
511
|
'web',
|
|
430
512
|
'factory_models',
|
|
431
513
|
'factory_scaffold',
|
|
514
|
+
'lang_typescript',
|
|
515
|
+
'lang_python',
|
|
516
|
+
'lang_go',
|
|
432
517
|
],
|
|
433
518
|
// Security - security audits
|
|
434
519
|
security: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Universal agent runtime for building AI-powered applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
79
|
-
"@compilr-dev/agents-coding": "^1.0.
|
|
79
|
+
"@compilr-dev/agents-coding": "^1.0.8",
|
|
80
80
|
"@eslint/js": "^9.39.1",
|
|
81
81
|
"@opentelemetry/api": "^1.9.0",
|
|
82
82
|
"@types/better-sqlite3": "^7.6.13",
|