@compilr-dev/cli 0.5.2 → 0.5.3

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.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
  // =============================================================================
@@ -136,29 +136,36 @@ export { setMetaToolFilter, getRegisteredMetaTools };
136
136
  // DIRECT TOOLS - Always available, called by name
137
137
  // =============================================================================
138
138
  /**
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
139
+ * Hot tools used in >50% of turns. Always declared as direct schemas.
140
+ * Estimated: ~2,100 tokens for definitions
142
141
  */
143
- const DIRECT_TOOLS = [
142
+ const HOT_TOOLS = [
144
143
  // File operations (most common)
145
144
  readFileTool,
146
145
  writeFileTool,
147
146
  editTool,
148
147
  // Shell (very common)
149
148
  bashTool,
150
- bashOutputTool,
151
- killShellTool,
152
149
  // Search (very common)
153
150
  globTool,
154
151
  grepTool,
155
- // Task tracking (always needed)
152
+ // User interaction (always needed)
153
+ askUserTool,
154
+ ];
155
+ /**
156
+ * Warm tools — used occasionally. In hot-tools mode these move to meta-registry.
157
+ * Estimated: ~3,300 tokens for definitions
158
+ */
159
+ const WARM_TOOLS = [
160
+ // Shell management
161
+ bashOutputTool,
162
+ killShellTool,
163
+ // Task tracking
156
164
  todoWriteTool,
157
165
  todoReadTool,
158
166
  todoClaimTool,
159
167
  todoHandoffTool,
160
- // User interaction (always needed)
161
- askUserTool,
168
+ // User interaction (simple variant)
162
169
  askUserSimpleTool,
163
170
  // Delegation (coordinator only)
164
171
  delegateTool,
@@ -166,9 +173,14 @@ const DIRECT_TOOLS = [
166
173
  delegateBackgroundTool,
167
174
  // Handoff (specialist-to-specialist)
168
175
  handoffTool,
169
- // CLI documentation (always available)
176
+ // CLI documentation
170
177
  guideTool,
171
178
  ];
179
+ /**
180
+ * All direct tools combined (hot + warm).
181
+ * Used in legacy mode (no meta-tools) and for backwards compatibility.
182
+ */
183
+ const DIRECT_TOOLS = [...HOT_TOOLS, ...WARM_TOOLS];
172
184
  // =============================================================================
173
185
  // META-REGISTRY TOOLS - Available via use_tool()
174
186
  // =============================================================================
@@ -248,9 +260,12 @@ export function createMinimalToolRegistry() {
248
260
  // =============================================================================
249
261
  /**
250
262
  * Get direct tools that are always available.
251
- * These are declared normally and can be called by name.
263
+ * When hotOnly is true, returns only hot tools (7 tools, ~2.1K tokens).
264
+ * When false/undefined, returns all direct tools (18 tools, ~5.4K tokens).
252
265
  */
253
- export function getDirectTools() {
266
+ export function getDirectTools(hotOnly) {
267
+ if (hotOnly)
268
+ return HOT_TOOLS;
254
269
  return DIRECT_TOOLS;
255
270
  }
256
271
  /**
@@ -269,12 +284,29 @@ export function getMetaTools() {
269
284
  export function createToolFallback() {
270
285
  return createMetaToolFallback();
271
286
  }
287
+ /** Whether hot-tools mode is active (warm tools in meta-registry) */
288
+ let hotToolsModeActive = false;
289
+ /**
290
+ * Check if hot-tools mode is active.
291
+ * When true, only hot tools are declared as direct schemas; warm tools are in meta-registry.
292
+ */
293
+ export function isHotToolsMode() {
294
+ return hotToolsModeActive;
295
+ }
272
296
  /**
273
297
  * Initialize the meta-tool registry with specialized tools.
298
+ * When includeWarmTools is true, warm tools are also added to the meta-registry
299
+ * (enabling hot-tools mode where only 7 core tools are declared directly).
274
300
  * Call this once at startup.
275
301
  */
276
- export function initializeMetaTools() {
277
- initializeMetaToolRegistry(META_REGISTRY_TOOLS);
302
+ export function initializeMetaTools(includeWarmTools) {
303
+ const tools = includeWarmTools
304
+ ? [...WARM_TOOLS, ...META_REGISTRY_TOOLS]
305
+ : META_REGISTRY_TOOLS;
306
+ initializeMetaToolRegistry(tools);
307
+ if (includeWarmTools) {
308
+ hotToolsModeActive = true;
309
+ }
278
310
  }
279
311
  /**
280
312
  * Get the tool index for the system prompt.
@@ -303,16 +335,22 @@ export function isMetaToolsEnabled() {
303
335
  * Get tool statistics for debugging/display.
304
336
  */
305
337
  export function getToolStats() {
306
- const directCount = DIRECT_TOOLS.length;
307
- const metaCount = META_REGISTRY_TOOLS.length;
308
- const totalCount = directCount + metaCount;
338
+ const hotCount = HOT_TOOLS.length;
339
+ const warmCount = WARM_TOOLS.length;
340
+ const directCount = hotToolsModeActive ? hotCount : hotCount + warmCount;
341
+ const metaCount = hotToolsModeActive
342
+ ? META_REGISTRY_TOOLS.length + warmCount
343
+ : META_REGISTRY_TOOLS.length;
344
+ const totalCount = hotCount + warmCount + META_REGISTRY_TOOLS.length;
309
345
  // Rough estimates: ~300 tokens per tool definition
310
346
  const tokensPerTool = 300;
311
347
  const estimatedDirectTokens = directCount * tokensPerTool;
312
- const estimatedMetaTokens = 800; // Tool index + meta-tool definitions
348
+ const estimatedMetaTokens = 1000; // Tool index + meta-tool definitions
313
349
  const estimatedLegacyTokens = totalCount * tokensPerTool;
314
350
  return {
315
351
  directTools: directCount,
352
+ hotTools: hotCount,
353
+ warmTools: warmCount,
316
354
  metaRegistryTools: metaCount,
317
355
  totalTools: totalCount,
318
356
  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.3",
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.22",
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.18",
62
62
  "@compilr-dev/ui-core": "^0.0.1",
63
63
  "@modelcontextprotocol/sdk": "^1.23.0",
64
64
  "better-sqlite3": "^12.5.0",