@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/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
- * These are declared normally and can be called by name.
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
- * Direct tools are the most frequently used tools.
140
- * These are always available and can be called directly by name.
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 DIRECT_TOOLS = [
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
- // Task tracking (always needed)
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 (always needed)
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 (always available)
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
- * These are declared normally and can be called by name.
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
- initializeMetaToolRegistry(META_REGISTRY_TOOLS);
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 directCount = DIRECT_TOOLS.length;
307
- const metaCount = META_REGISTRY_TOOLS.length;
308
- const totalCount = directCount + metaCount;
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 = 800; // Tool index + meta-tool definitions
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,
@@ -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 (char counts)
106
+ * @param debugPayload - Optional debug payload sizes (token estimates)
107
107
  */
108
108
  addTokens(inputTokens: number, outputTokens: number, thinkingTokens?: number, cacheReadTokens?: number, debugPayload?: {
109
- systemChars: number;
110
- contentsChars: number;
111
- toolsChars: number;
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
- systemChars: number;
138
- contentsChars: number;
139
- toolsChars: number;
137
+ systemTokens: number;
138
+ contentsTokens: number;
139
+ toolsTokens: number;
140
140
  };
141
141
  };
142
142
  setMode(mode: AgentMode): void;
@@ -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 (char counts)
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
- systemChars: number;
17
- contentsChars: number;
18
- toolsChars: number;
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
- systemChars: number;
28
- contentsChars: number;
29
- toolsChars: number;
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 (char counts)
39
+ * @param debugPayload - Optional debug payload sizes (token estimates)
40
40
  */
41
41
  addTokens(inputTokens: number, outputTokens: number, thinkingTokens?: number, cacheReadTokens?: number, debugPayload?: {
42
- systemChars: number;
43
- contentsChars: number;
44
- toolsChars: number;
42
+ systemTokens: number;
43
+ contentsTokens: number;
44
+ toolsTokens: number;
45
45
  }): void;
46
46
  incrementToolCalls(): void;
47
47
  incrementApiCalls(): void;
@@ -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 (char counts)
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 = { systemChars: 0, contentsChars: 0, toolsChars: 0 };
34
+ this.debugPayload = { systemTokens: 0, contentsTokens: 0, toolsTokens: 0 };
35
35
  }
36
- this.debugPayload.systemChars += debugPayload.systemChars;
37
- this.debugPayload.contentsChars += debugPayload.contentsChars;
38
- this.debugPayload.toolsChars += debugPayload.toolsChars;
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() {
@@ -53,11 +53,11 @@ export interface TurnMetrics {
53
53
  subagentOutputTokens: number;
54
54
  toolCalls: number;
55
55
  durationMs: number;
56
- /** Debug payload info - char counts sent to provider (for debugging token discrepancies) */
56
+ /** Debug payload info - token estimates sent to provider */
57
57
  debugPayload?: {
58
- systemChars: number;
59
- contentsChars: number;
60
- toolsChars: number;
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.2",
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.20",
58
- "@compilr-dev/agents-coding": "^1.0.2",
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.4",
61
- "@compilr-dev/sdk": "^0.1.16",
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",