@compilr-dev/cli 0.5.2 → 0.5.4
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/dist/.tsbuildinfo.app +1 -1
- package/dist/.tsbuildinfo.data +1 -1
- package/dist/.tsbuildinfo.domain +1 -1
- package/dist/.tsbuildinfo.foundation +1 -1
- package/dist/agent.js +8 -6
- package/dist/commands-v2/handlers/core.js +26 -1
- package/dist/commands-v2/handlers/project.js +36 -3
- package/dist/commands-v2/handlers/reset.js +19 -6
- package/dist/commands-v2/handlers/session.d.ts +5 -1
- package/dist/commands-v2/handlers/session.js +54 -16
- package/dist/commands-v2/types.d.ts +5 -0
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/index.js +99 -30
- package/dist/models/providers.d.ts +3 -1
- package/dist/models/providers.js +9 -0
- package/dist/repl-v2.d.ts +12 -0
- package/dist/repl-v2.js +39 -27
- package/dist/tool-names.d.ts +4 -0
- package/dist/tool-names.js +24 -0
- package/dist/tools.d.ts +19 -4
- package/dist/tools.js +66 -19
- package/dist/ui/terminal-ui.d.ts +7 -7
- package/dist/ui/terminal-ui.js +1 -1
- package/dist/ui/turn-metrics.d.ts +10 -10
- package/dist/ui/turn-metrics.js +5 -5
- package/dist/ui/types.d.ts +4 -4
- package/package.json +5 -5
package/dist/tools.d.ts
CHANGED
|
@@ -14,11 +14,16 @@
|
|
|
14
14
|
* Tool names are defined in tool-names.ts (a dependency-free module).
|
|
15
15
|
* This file re-exports them for convenience. Import from here or tool-names.ts.
|
|
16
16
|
*/
|
|
17
|
-
export { TOOL_NAMES, type ToolName, DIRECT_TOOL_NAMES, META_TOOL_NAMES, META_REGISTRY_TOOL_NAMES, getAllToolNames, } from './tool-names.js';
|
|
17
|
+
export { TOOL_NAMES, type ToolName, DIRECT_TOOL_NAMES, HOT_TOOL_NAMES, WARM_TOOL_NAMES, META_TOOL_NAMES, META_REGISTRY_TOOL_NAMES, getAllToolNames, } from './tool-names.js';
|
|
18
18
|
import { TodoStore, type Tool } from '@compilr-dev/sdk';
|
|
19
19
|
export declare const todoStore: TodoStore;
|
|
20
20
|
import { setMetaToolFilter, getRegisteredMetaTools } from './tools/meta-tools.js';
|
|
21
21
|
export { setMetaToolFilter, getRegisteredMetaTools };
|
|
22
|
+
/**
|
|
23
|
+
* Check if a tool in the meta-registry is marked as silent.
|
|
24
|
+
* Used by the repl to suppress output for warm tools like todo_write/todo_read.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isMetaToolSilent(name: string): boolean;
|
|
22
27
|
/**
|
|
23
28
|
* Creates the tool registry with all available tools.
|
|
24
29
|
* Returns tools as-is - the Agent.registerTools() method handles typing.
|
|
@@ -32,9 +37,10 @@ export declare function createToolRegistry(): unknown[];
|
|
|
32
37
|
export declare function createMinimalToolRegistry(): unknown[];
|
|
33
38
|
/**
|
|
34
39
|
* Get direct tools that are always available.
|
|
35
|
-
*
|
|
40
|
+
* When hotOnly is true, returns only hot tools (7 tools, ~2.1K tokens).
|
|
41
|
+
* When false/undefined, returns all direct tools (18 tools, ~5.4K tokens).
|
|
36
42
|
*/
|
|
37
|
-
export declare function getDirectTools(): Tool[];
|
|
43
|
+
export declare function getDirectTools(hotOnly?: boolean): Tool[];
|
|
38
44
|
/**
|
|
39
45
|
* Get meta-tools for agent registration.
|
|
40
46
|
* Only get_tool_info is kept as a direct tool — use_tool and list_tools
|
|
@@ -47,11 +53,18 @@ export declare function getMetaTools(): Tool[];
|
|
|
47
53
|
* checks the meta-registry and executes it transparently.
|
|
48
54
|
*/
|
|
49
55
|
export declare function createToolFallback(): (name: string, input: Record<string, unknown>) => Promise<import('@compilr-dev/sdk').ToolExecutionResult | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if hot-tools mode is active.
|
|
58
|
+
* When true, only hot tools are declared as direct schemas; warm tools are in meta-registry.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isHotToolsMode(): boolean;
|
|
50
61
|
/**
|
|
51
62
|
* Initialize the meta-tool registry with specialized tools.
|
|
63
|
+
* When includeWarmTools is true, warm tools are also added to the meta-registry
|
|
64
|
+
* (enabling hot-tools mode where only 7 core tools are declared directly).
|
|
52
65
|
* Call this once at startup.
|
|
53
66
|
*/
|
|
54
|
-
export declare function initializeMetaTools(): void;
|
|
67
|
+
export declare function initializeMetaTools(includeWarmTools?: boolean): void;
|
|
55
68
|
/**
|
|
56
69
|
* Get the tool index for the system prompt.
|
|
57
70
|
* This lists all meta-registry tools with their signatures.
|
|
@@ -71,6 +84,8 @@ export declare function isMetaToolsEnabled(): boolean;
|
|
|
71
84
|
*/
|
|
72
85
|
export declare function getToolStats(): {
|
|
73
86
|
directTools: number;
|
|
87
|
+
hotTools: number;
|
|
88
|
+
warmTools: number;
|
|
74
89
|
metaRegistryTools: number;
|
|
75
90
|
totalTools: number;
|
|
76
91
|
estimatedDirectTokens: number;
|
package/dist/tools.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
// Re-export tool names from the dependency-free module
|
|
18
18
|
// This breaks circular dependencies while maintaining a single source of truth
|
|
19
|
-
export { TOOL_NAMES, DIRECT_TOOL_NAMES, META_TOOL_NAMES, META_REGISTRY_TOOL_NAMES, getAllToolNames, } from './tool-names.js';
|
|
19
|
+
export { TOOL_NAMES, DIRECT_TOOL_NAMES, HOT_TOOL_NAMES, WARM_TOOL_NAMES, META_TOOL_NAMES, META_REGISTRY_TOOL_NAMES, getAllToolNames, } from './tool-names.js';
|
|
20
20
|
// =============================================================================
|
|
21
21
|
// TOOL IMPORTS
|
|
22
22
|
// =============================================================================
|
|
@@ -132,33 +132,49 @@ import { allDbTools, allFactoryTools } from './tools/db-tools.js';
|
|
|
132
132
|
import { initializeMetaToolRegistry, generateToolIndex, getMetaToolCount, META_TOOLS_SYSTEM_PROMPT_PREFIX, setMetaToolFilter, getRegisteredMetaTools, createMetaToolFallback, getToolInfoTool, } from './tools/meta-tools.js';
|
|
133
133
|
// Re-export for use in agent.ts
|
|
134
134
|
export { setMetaToolFilter, getRegisteredMetaTools };
|
|
135
|
+
/**
|
|
136
|
+
* Check if a tool in the meta-registry is marked as silent.
|
|
137
|
+
* Used by the repl to suppress output for warm tools like todo_write/todo_read.
|
|
138
|
+
*/
|
|
139
|
+
export function isMetaToolSilent(name) {
|
|
140
|
+
const tools = getRegisteredMetaTools();
|
|
141
|
+
const tool = tools.find((t) => t.definition.name === name);
|
|
142
|
+
return tool?.silent === true;
|
|
143
|
+
}
|
|
135
144
|
// =============================================================================
|
|
136
145
|
// DIRECT TOOLS - Always available, called by name
|
|
137
146
|
// =============================================================================
|
|
138
147
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* Estimated: ~3,500 tokens for definitions
|
|
148
|
+
* Hot tools — used in >50% of turns. Always declared as direct schemas.
|
|
149
|
+
* Estimated: ~2,100 tokens for definitions
|
|
142
150
|
*/
|
|
143
|
-
const
|
|
151
|
+
const HOT_TOOLS = [
|
|
144
152
|
// File operations (most common)
|
|
145
153
|
readFileTool,
|
|
146
154
|
writeFileTool,
|
|
147
155
|
editTool,
|
|
148
156
|
// Shell (very common)
|
|
149
157
|
bashTool,
|
|
150
|
-
bashOutputTool,
|
|
151
|
-
killShellTool,
|
|
152
158
|
// Search (very common)
|
|
153
159
|
globTool,
|
|
154
160
|
grepTool,
|
|
155
|
-
//
|
|
161
|
+
// User interaction (always needed)
|
|
162
|
+
askUserTool,
|
|
163
|
+
];
|
|
164
|
+
/**
|
|
165
|
+
* Warm tools — used occasionally. In hot-tools mode these move to meta-registry.
|
|
166
|
+
* Estimated: ~3,300 tokens for definitions
|
|
167
|
+
*/
|
|
168
|
+
const WARM_TOOLS = [
|
|
169
|
+
// Shell management
|
|
170
|
+
bashOutputTool,
|
|
171
|
+
killShellTool,
|
|
172
|
+
// Task tracking
|
|
156
173
|
todoWriteTool,
|
|
157
174
|
todoReadTool,
|
|
158
175
|
todoClaimTool,
|
|
159
176
|
todoHandoffTool,
|
|
160
|
-
// User interaction (
|
|
161
|
-
askUserTool,
|
|
177
|
+
// User interaction (simple variant)
|
|
162
178
|
askUserSimpleTool,
|
|
163
179
|
// Delegation (coordinator only)
|
|
164
180
|
delegateTool,
|
|
@@ -166,9 +182,14 @@ const DIRECT_TOOLS = [
|
|
|
166
182
|
delegateBackgroundTool,
|
|
167
183
|
// Handoff (specialist-to-specialist)
|
|
168
184
|
handoffTool,
|
|
169
|
-
// CLI documentation
|
|
185
|
+
// CLI documentation
|
|
170
186
|
guideTool,
|
|
171
187
|
];
|
|
188
|
+
/**
|
|
189
|
+
* All direct tools combined (hot + warm).
|
|
190
|
+
* Used in legacy mode (no meta-tools) and for backwards compatibility.
|
|
191
|
+
*/
|
|
192
|
+
const DIRECT_TOOLS = [...HOT_TOOLS, ...WARM_TOOLS];
|
|
172
193
|
// =============================================================================
|
|
173
194
|
// META-REGISTRY TOOLS - Available via use_tool()
|
|
174
195
|
// =============================================================================
|
|
@@ -248,9 +269,12 @@ export function createMinimalToolRegistry() {
|
|
|
248
269
|
// =============================================================================
|
|
249
270
|
/**
|
|
250
271
|
* Get direct tools that are always available.
|
|
251
|
-
*
|
|
272
|
+
* When hotOnly is true, returns only hot tools (7 tools, ~2.1K tokens).
|
|
273
|
+
* When false/undefined, returns all direct tools (18 tools, ~5.4K tokens).
|
|
252
274
|
*/
|
|
253
|
-
export function getDirectTools() {
|
|
275
|
+
export function getDirectTools(hotOnly) {
|
|
276
|
+
if (hotOnly)
|
|
277
|
+
return HOT_TOOLS;
|
|
254
278
|
return DIRECT_TOOLS;
|
|
255
279
|
}
|
|
256
280
|
/**
|
|
@@ -269,12 +293,29 @@ export function getMetaTools() {
|
|
|
269
293
|
export function createToolFallback() {
|
|
270
294
|
return createMetaToolFallback();
|
|
271
295
|
}
|
|
296
|
+
/** Whether hot-tools mode is active (warm tools in meta-registry) */
|
|
297
|
+
let hotToolsModeActive = false;
|
|
298
|
+
/**
|
|
299
|
+
* Check if hot-tools mode is active.
|
|
300
|
+
* When true, only hot tools are declared as direct schemas; warm tools are in meta-registry.
|
|
301
|
+
*/
|
|
302
|
+
export function isHotToolsMode() {
|
|
303
|
+
return hotToolsModeActive;
|
|
304
|
+
}
|
|
272
305
|
/**
|
|
273
306
|
* Initialize the meta-tool registry with specialized tools.
|
|
307
|
+
* When includeWarmTools is true, warm tools are also added to the meta-registry
|
|
308
|
+
* (enabling hot-tools mode where only 7 core tools are declared directly).
|
|
274
309
|
* Call this once at startup.
|
|
275
310
|
*/
|
|
276
|
-
export function initializeMetaTools() {
|
|
277
|
-
|
|
311
|
+
export function initializeMetaTools(includeWarmTools) {
|
|
312
|
+
const tools = includeWarmTools
|
|
313
|
+
? [...WARM_TOOLS, ...META_REGISTRY_TOOLS]
|
|
314
|
+
: META_REGISTRY_TOOLS;
|
|
315
|
+
initializeMetaToolRegistry(tools);
|
|
316
|
+
if (includeWarmTools) {
|
|
317
|
+
hotToolsModeActive = true;
|
|
318
|
+
}
|
|
278
319
|
}
|
|
279
320
|
/**
|
|
280
321
|
* Get the tool index for the system prompt.
|
|
@@ -303,16 +344,22 @@ export function isMetaToolsEnabled() {
|
|
|
303
344
|
* Get tool statistics for debugging/display.
|
|
304
345
|
*/
|
|
305
346
|
export function getToolStats() {
|
|
306
|
-
const
|
|
307
|
-
const
|
|
308
|
-
const
|
|
347
|
+
const hotCount = HOT_TOOLS.length;
|
|
348
|
+
const warmCount = WARM_TOOLS.length;
|
|
349
|
+
const directCount = hotToolsModeActive ? hotCount : hotCount + warmCount;
|
|
350
|
+
const metaCount = hotToolsModeActive
|
|
351
|
+
? META_REGISTRY_TOOLS.length + warmCount
|
|
352
|
+
: META_REGISTRY_TOOLS.length;
|
|
353
|
+
const totalCount = hotCount + warmCount + META_REGISTRY_TOOLS.length;
|
|
309
354
|
// Rough estimates: ~300 tokens per tool definition
|
|
310
355
|
const tokensPerTool = 300;
|
|
311
356
|
const estimatedDirectTokens = directCount * tokensPerTool;
|
|
312
|
-
const estimatedMetaTokens =
|
|
357
|
+
const estimatedMetaTokens = 1000; // Tool index + meta-tool definitions
|
|
313
358
|
const estimatedLegacyTokens = totalCount * tokensPerTool;
|
|
314
359
|
return {
|
|
315
360
|
directTools: directCount,
|
|
361
|
+
hotTools: hotCount,
|
|
362
|
+
warmTools: warmCount,
|
|
316
363
|
metaRegistryTools: metaCount,
|
|
317
364
|
totalTools: totalCount,
|
|
318
365
|
estimatedDirectTokens,
|
package/dist/ui/terminal-ui.d.ts
CHANGED
|
@@ -103,12 +103,12 @@ export declare class TerminalUI extends EventEmitter {
|
|
|
103
103
|
* Add input/output tokens for live display
|
|
104
104
|
* @param thinkingTokens - Optional thinking tokens (Gemini 2.5+ models)
|
|
105
105
|
* @param cacheReadTokens - Optional cache read tokens (Anthropic/Gemini)
|
|
106
|
-
* @param debugPayload - Optional debug payload sizes (
|
|
106
|
+
* @param debugPayload - Optional debug payload sizes (token estimates)
|
|
107
107
|
*/
|
|
108
108
|
addTokens(inputTokens: number, outputTokens: number, thinkingTokens?: number, cacheReadTokens?: number, debugPayload?: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
systemTokens: number;
|
|
110
|
+
contentsTokens: number;
|
|
111
|
+
toolsTokens: number;
|
|
112
112
|
}): void;
|
|
113
113
|
/**
|
|
114
114
|
* Increment tool call counter
|
|
@@ -134,9 +134,9 @@ export declare class TerminalUI extends EventEmitter {
|
|
|
134
134
|
toolCalls: number;
|
|
135
135
|
apiCalls: number;
|
|
136
136
|
debugPayload?: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
systemTokens: number;
|
|
138
|
+
contentsTokens: number;
|
|
139
|
+
toolsTokens: number;
|
|
140
140
|
};
|
|
141
141
|
};
|
|
142
142
|
setMode(mode: AgentMode): void;
|
package/dist/ui/terminal-ui.js
CHANGED
|
@@ -339,7 +339,7 @@ export class TerminalUI extends EventEmitter {
|
|
|
339
339
|
* Add input/output tokens for live display
|
|
340
340
|
* @param thinkingTokens - Optional thinking tokens (Gemini 2.5+ models)
|
|
341
341
|
* @param cacheReadTokens - Optional cache read tokens (Anthropic/Gemini)
|
|
342
|
-
* @param debugPayload - Optional debug payload sizes (
|
|
342
|
+
* @param debugPayload - Optional debug payload sizes (token estimates)
|
|
343
343
|
*/
|
|
344
344
|
addTokens(inputTokens, outputTokens, thinkingTokens, cacheReadTokens, debugPayload) {
|
|
345
345
|
this.turnMetrics.addTokens(inputTokens, outputTokens, thinkingTokens, cacheReadTokens, debugPayload);
|
|
@@ -13,9 +13,9 @@ export interface TurnMetricsSnapshot {
|
|
|
13
13
|
toolCalls: number;
|
|
14
14
|
apiCalls: number;
|
|
15
15
|
debugPayload?: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
systemTokens: number;
|
|
17
|
+
contentsTokens: number;
|
|
18
|
+
toolsTokens: number;
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
export declare class TurnMetrics {
|
|
@@ -24,9 +24,9 @@ export declare class TurnMetrics {
|
|
|
24
24
|
thinkingTokens: number;
|
|
25
25
|
cacheReadTokens: number;
|
|
26
26
|
debugPayload?: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
systemTokens: number;
|
|
28
|
+
contentsTokens: number;
|
|
29
|
+
toolsTokens: number;
|
|
30
30
|
};
|
|
31
31
|
startTime: number;
|
|
32
32
|
toolCalls: number;
|
|
@@ -36,12 +36,12 @@ export declare class TurnMetrics {
|
|
|
36
36
|
* Add input/output tokens for live display.
|
|
37
37
|
* @param thinkingTokens - Optional thinking tokens (Gemini 2.5+ models)
|
|
38
38
|
* @param cacheReadTokens - Optional cache read tokens (Anthropic/Gemini)
|
|
39
|
-
* @param debugPayload - Optional debug payload sizes (
|
|
39
|
+
* @param debugPayload - Optional debug payload sizes (token estimates)
|
|
40
40
|
*/
|
|
41
41
|
addTokens(inputTokens: number, outputTokens: number, thinkingTokens?: number, cacheReadTokens?: number, debugPayload?: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
systemTokens: number;
|
|
43
|
+
contentsTokens: number;
|
|
44
|
+
toolsTokens: number;
|
|
45
45
|
}): void;
|
|
46
46
|
incrementToolCalls(): void;
|
|
47
47
|
incrementApiCalls(): void;
|
package/dist/ui/turn-metrics.js
CHANGED
|
@@ -18,7 +18,7 @@ export class TurnMetrics {
|
|
|
18
18
|
* Add input/output tokens for live display.
|
|
19
19
|
* @param thinkingTokens - Optional thinking tokens (Gemini 2.5+ models)
|
|
20
20
|
* @param cacheReadTokens - Optional cache read tokens (Anthropic/Gemini)
|
|
21
|
-
* @param debugPayload - Optional debug payload sizes (
|
|
21
|
+
* @param debugPayload - Optional debug payload sizes (token estimates)
|
|
22
22
|
*/
|
|
23
23
|
addTokens(inputTokens, outputTokens, thinkingTokens, cacheReadTokens, debugPayload) {
|
|
24
24
|
this.inputTokens += inputTokens;
|
|
@@ -31,11 +31,11 @@ export class TurnMetrics {
|
|
|
31
31
|
}
|
|
32
32
|
if (debugPayload) {
|
|
33
33
|
if (!this.debugPayload) {
|
|
34
|
-
this.debugPayload = {
|
|
34
|
+
this.debugPayload = { systemTokens: 0, contentsTokens: 0, toolsTokens: 0 };
|
|
35
35
|
}
|
|
36
|
-
this.debugPayload.
|
|
37
|
-
this.debugPayload.
|
|
38
|
-
this.debugPayload.
|
|
36
|
+
this.debugPayload.systemTokens += debugPayload.systemTokens;
|
|
37
|
+
this.debugPayload.contentsTokens += debugPayload.contentsTokens;
|
|
38
|
+
this.debugPayload.toolsTokens += debugPayload.toolsTokens;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
incrementToolCalls() {
|
package/dist/ui/types.d.ts
CHANGED
|
@@ -53,11 +53,11 @@ export interface TurnMetrics {
|
|
|
53
53
|
subagentOutputTokens: number;
|
|
54
54
|
toolCalls: number;
|
|
55
55
|
durationMs: number;
|
|
56
|
-
/** Debug payload info -
|
|
56
|
+
/** Debug payload info - token estimates sent to provider */
|
|
57
57
|
debugPayload?: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
systemTokens: number;
|
|
59
|
+
contentsTokens: number;
|
|
60
|
+
toolsTokens: number;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
export interface CommandOption {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "AI-powered coding assistant CLI using @compilr-dev/agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@anthropic-ai/sdk": "^0.74.0",
|
|
57
|
-
"@compilr-dev/agents": "^0.3.
|
|
58
|
-
"@compilr-dev/agents-coding": "^1.0.
|
|
57
|
+
"@compilr-dev/agents": "^0.3.23",
|
|
58
|
+
"@compilr-dev/agents-coding": "^1.0.4",
|
|
59
59
|
"@compilr-dev/editor-core": "^0.0.2",
|
|
60
|
-
"@compilr-dev/factory": "^0.1.
|
|
61
|
-
"@compilr-dev/sdk": "^0.1.
|
|
60
|
+
"@compilr-dev/factory": "^0.1.12",
|
|
61
|
+
"@compilr-dev/sdk": "^0.1.20",
|
|
62
62
|
"@compilr-dev/ui-core": "^0.0.1",
|
|
63
63
|
"@modelcontextprotocol/sdk": "^1.23.0",
|
|
64
64
|
"better-sqlite3": "^12.5.0",
|