@defai.digital/ax-cli 3.15.26 → 4.0.0

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.
Files changed (60) hide show
  1. package/README.md +56 -21
  2. package/dist/commands/init.d.ts +3 -3
  3. package/dist/commands/init.js +175 -25
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/setup.d.ts +0 -1
  6. package/dist/commands/setup.js +7 -139
  7. package/dist/commands/setup.js.map +1 -1
  8. package/dist/llm/tools.d.ts +14 -0
  9. package/dist/llm/tools.js +17 -4
  10. package/dist/llm/tools.js.map +1 -1
  11. package/dist/planner/types.d.ts +4 -4
  12. package/dist/tools/definitions/ask-user.d.ts +8 -0
  13. package/dist/tools/definitions/ask-user.js +168 -0
  14. package/dist/tools/definitions/ask-user.js.map +1 -0
  15. package/dist/tools/definitions/ax-agent.d.ts +7 -0
  16. package/dist/tools/definitions/ax-agent.js +149 -0
  17. package/dist/tools/definitions/ax-agent.js.map +1 -0
  18. package/dist/tools/definitions/bash-output.d.ts +7 -0
  19. package/dist/tools/definitions/bash-output.js +78 -0
  20. package/dist/tools/definitions/bash-output.js.map +1 -0
  21. package/dist/tools/definitions/bash.d.ts +8 -0
  22. package/dist/tools/definitions/bash.js +152 -0
  23. package/dist/tools/definitions/bash.js.map +1 -0
  24. package/dist/tools/definitions/create-file.d.ts +7 -0
  25. package/dist/tools/definitions/create-file.js +129 -0
  26. package/dist/tools/definitions/create-file.js.map +1 -0
  27. package/dist/tools/definitions/design.d.ts +12 -0
  28. package/dist/tools/definitions/design.js +368 -0
  29. package/dist/tools/definitions/design.js.map +1 -0
  30. package/dist/tools/definitions/index.d.ts +48 -0
  31. package/dist/tools/definitions/index.js +96 -0
  32. package/dist/tools/definitions/index.js.map +1 -0
  33. package/dist/tools/definitions/multi-edit.d.ts +7 -0
  34. package/dist/tools/definitions/multi-edit.js +123 -0
  35. package/dist/tools/definitions/multi-edit.js.map +1 -0
  36. package/dist/tools/definitions/search.d.ts +7 -0
  37. package/dist/tools/definitions/search.js +159 -0
  38. package/dist/tools/definitions/search.js.map +1 -0
  39. package/dist/tools/definitions/str-replace-editor.d.ts +7 -0
  40. package/dist/tools/definitions/str-replace-editor.js +145 -0
  41. package/dist/tools/definitions/str-replace-editor.js.map +1 -0
  42. package/dist/tools/definitions/todo.d.ts +8 -0
  43. package/dist/tools/definitions/todo.js +261 -0
  44. package/dist/tools/definitions/todo.js.map +1 -0
  45. package/dist/tools/definitions/view-file.d.ts +7 -0
  46. package/dist/tools/definitions/view-file.js +111 -0
  47. package/dist/tools/definitions/view-file.js.map +1 -0
  48. package/dist/tools/format-generators.d.ts +62 -0
  49. package/dist/tools/format-generators.js +291 -0
  50. package/dist/tools/format-generators.js.map +1 -0
  51. package/dist/tools/index.d.ts +4 -0
  52. package/dist/tools/index.js +6 -0
  53. package/dist/tools/index.js.map +1 -1
  54. package/dist/tools/result-enhancer.d.ts +64 -0
  55. package/dist/tools/result-enhancer.js +215 -0
  56. package/dist/tools/result-enhancer.js.map +1 -0
  57. package/dist/tools/types.d.ts +249 -0
  58. package/dist/tools/types.js +11 -0
  59. package/dist/tools/types.js.map +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,111 @@
1
+ /**
2
+ * View File Tool Definition - Claude Code Quality
3
+ *
4
+ * Read and display file contents or directory listings.
5
+ */
6
+ export const viewFileTool = {
7
+ name: 'view_file',
8
+ displayName: 'View File',
9
+ description: `Read and display file contents or directory listings.
10
+
11
+ This tool reads files from the local filesystem and displays their contents with line numbers. It can also list directory contents when given a directory path.
12
+
13
+ For files:
14
+ - Displays content with line numbers (1-indexed)
15
+ - Supports partial reading with start_line/end_line
16
+ - Handles text files, images, PDFs, and Jupyter notebooks
17
+ - Lines over 2000 characters are truncated
18
+
19
+ For directories:
20
+ - Lists files and subdirectories
21
+ - Shows file types and sizes
22
+ - Respects .gitignore patterns
23
+
24
+ IMPORTANT: Always use this tool to read a file BEFORE attempting to edit it. This ensures you have the exact current content and correct indentation for str_replace_editor.`,
25
+ parameters: {
26
+ type: 'object',
27
+ properties: {
28
+ path: {
29
+ type: 'string',
30
+ description: 'Absolute or relative path to file or directory. Use absolute paths for reliability.',
31
+ format: 'file-path',
32
+ examples: ['/project/src/index.ts', 'package.json', './src/'],
33
+ },
34
+ start_line: {
35
+ type: 'number',
36
+ description: 'Starting line number for partial file view (1-indexed). Only for files.',
37
+ constraints: ['Must be >= 1', 'Must be <= end_line if end_line is specified'],
38
+ },
39
+ end_line: {
40
+ type: 'number',
41
+ description: 'Ending line number for partial file view (inclusive). Only for files.',
42
+ constraints: ['Must be >= start_line'],
43
+ },
44
+ },
45
+ required: ['path'],
46
+ },
47
+ usageNotes: [
48
+ 'ALWAYS read a file before attempting to edit it with str_replace_editor',
49
+ 'Use absolute paths for reliability across different working directories',
50
+ 'For large files, use start_line/end_line to read specific sections',
51
+ 'When viewing a directory, returns a listing instead of contents',
52
+ 'Supports various file types:',
53
+ ' - Text files: displayed with line numbers',
54
+ ' - Images (PNG, JPG, etc.): displayed visually',
55
+ ' - PDFs: extracted text and visual content',
56
+ ' - Jupyter notebooks (.ipynb): cells with outputs',
57
+ ' - Binary files: shows file type information',
58
+ 'Line numbers in output start at 1, matching editor conventions',
59
+ 'Empty files return a system reminder warning',
60
+ 'When editing code from view_file output, copy the exact content after the line number prefix',
61
+ ],
62
+ constraints: [
63
+ 'Cannot modify files (use str_replace_editor or create_file)',
64
+ 'Do not view potentially sensitive files unless necessary:',
65
+ ' - .env files with secrets',
66
+ ' - credential files',
67
+ ' - private keys',
68
+ 'Lines over 2000 characters are truncated',
69
+ 'Maximum default read is 2000 lines from start',
70
+ ],
71
+ antiPatterns: [
72
+ 'Using bash cat/head/tail instead of view_file',
73
+ 'Modifying files (use str_replace_editor instead)',
74
+ 'Creating files (use create_file instead)',
75
+ 'Viewing binary files expecting text content',
76
+ 'Editing without reading first',
77
+ ],
78
+ examples: [
79
+ {
80
+ description: 'Read entire file',
81
+ scenario: 'Understand a source file before editing',
82
+ input: { path: '/project/src/utils.ts' },
83
+ expectedBehavior: 'Returns file contents with line numbers',
84
+ },
85
+ {
86
+ description: 'Read specific lines',
87
+ scenario: 'Focus on a particular function or section',
88
+ input: { path: '/project/src/utils.ts', start_line: 50, end_line: 75 },
89
+ expectedBehavior: 'Returns lines 50-75 with line numbers',
90
+ },
91
+ {
92
+ description: 'List directory contents',
93
+ scenario: 'Explore project structure',
94
+ input: { path: '/project/src/' },
95
+ expectedBehavior: 'Returns listing of files and directories',
96
+ },
97
+ {
98
+ description: 'Read package.json',
99
+ scenario: 'Check project dependencies and scripts',
100
+ input: { path: 'package.json' },
101
+ expectedBehavior: 'Returns package.json contents',
102
+ },
103
+ ],
104
+ tokenCost: 500,
105
+ safetyLevel: 'safe',
106
+ requiresConfirmation: false,
107
+ categories: ['file-operations'],
108
+ alternatives: [],
109
+ relatedTools: ['str_replace_editor', 'create_file', 'search'],
110
+ };
111
+ //# sourceMappingURL=view-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-file.js","sourceRoot":"","sources":["../../../src/tools/definitions/view-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,CAAC,MAAM,YAAY,GAAmB;IAC1C,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IAExB,WAAW,EAAE;;;;;;;;;;;;;;;6KAe8J;IAE3K,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,qFAAqF;gBACvF,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,CAAC,uBAAuB,EAAE,cAAc,EAAE,QAAQ,CAAC;aAC9D;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,yEAAyE;gBAC3E,WAAW,EAAE,CAAC,cAAc,EAAE,8CAA8C,CAAC;aAC9E;YACD,QAAQ,EAAE;gBACR,IAAI,EA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E,GAAG;IACd,WAAW,EAAE,MAAM;IACnB,oBAAoB,EAAE,KAAK;IAE3B,UAAU,EAAE,CAAC,iBAAiB,CAAC;IAC/B,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,CAAC,oBAAoB,EAAE,aAAa,EAAE,QAAQ,CAAC;CAC9D,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Format Generators for Tool Definitions
3
+ *
4
+ * Converts rich ToolDefinition objects to various output formats:
5
+ * - OpenAI function calling format
6
+ * - Anthropic tool format
7
+ * - System prompt sections
8
+ *
9
+ * These are DERIVED formats - the ToolDefinition is the source of truth.
10
+ */
11
+ import type { ToolDefinition, AnthropicTool } from './types.js';
12
+ import type { LLMTool } from '../llm/client.js';
13
+ /**
14
+ * Generate a compact description suitable for API calls
15
+ *
16
+ * The compact description is the first paragraph plus key constraints
17
+ * for dangerous tools.
18
+ */
19
+ export declare function generateCompactDescription(tool: ToolDefinition): string;
20
+ /**
21
+ * Convert rich ToolDefinition to OpenAI function calling format
22
+ *
23
+ * This is a DERIVED format for API calls. The full tool details
24
+ * should be provided in the system prompt.
25
+ */
26
+ export declare function toOpenAIFormat(tool: ToolDefinition): LLMTool;
27
+ /**
28
+ * Convert rich ToolDefinition to Anthropic tool format
29
+ */
30
+ export declare function toAnthropicFormat(tool: ToolDefinition): AnthropicTool;
31
+ /**
32
+ * Generate a full system prompt section for a tool
33
+ *
34
+ * This includes all the rich metadata: description, parameters,
35
+ * usage notes, constraints, anti-patterns, and examples.
36
+ */
37
+ export declare function toSystemPromptSection(tool: ToolDefinition): string;
38
+ /**
39
+ * Generate the complete tool instructions section for system prompt
40
+ *
41
+ * @param tools - Array of tool definitions
42
+ * @returns Formatted markdown string with all tool documentation
43
+ */
44
+ export declare function generateToolInstructions(tools: ToolDefinition[]): string;
45
+ /**
46
+ * Calculate total token cost for a set of tools
47
+ *
48
+ * Useful for budget planning and deciding which tools to include
49
+ */
50
+ export declare function calculateTotalTokenCost(tools: ToolDefinition[]): number;
51
+ /**
52
+ * Filter tools by category
53
+ */
54
+ export declare function filterByCategory(tools: ToolDefinition[], categories: string[]): ToolDefinition[];
55
+ /**
56
+ * Filter tools by safety level
57
+ */
58
+ export declare function filterBySafetyLevel(tools: ToolDefinition[], levels: Array<'safe' | 'moderate' | 'dangerous'>): ToolDefinition[];
59
+ /**
60
+ * Get tools that require confirmation
61
+ */
62
+ export declare function getToolsRequiringConfirmation(tools: ToolDefinition[]): ToolDefinition[];
@@ -0,0 +1,291 @@
1
+ /**
2
+ * Format Generators for Tool Definitions
3
+ *
4
+ * Converts rich ToolDefinition objects to various output formats:
5
+ * - OpenAI function calling format
6
+ * - Anthropic tool format
7
+ * - System prompt sections
8
+ *
9
+ * These are DERIVED formats - the ToolDefinition is the source of truth.
10
+ */
11
+ /**
12
+ * Convert ParameterDefinition to JSON Schema format for OpenAI
13
+ */
14
+ function toJSONSchemaProperty(param) {
15
+ // Build the base schema
16
+ const baseSchema = {
17
+ type: param.type,
18
+ description: param.description,
19
+ };
20
+ if (param.default !== undefined) {
21
+ baseSchema.default = param.default;
22
+ }
23
+ if (param.enum) {
24
+ baseSchema.enum = param.enum;
25
+ }
26
+ if (param.items && param.type === 'array') {
27
+ const items = param.items;
28
+ if (items.type === 'object' && items.properties) {
29
+ baseSchema.items = {
30
+ type: 'object',
31
+ properties: Object.fromEntries(Object.entries(items.properties).map(([key, val]) => [
32
+ key,
33
+ toJSONSchemaProperty(val),
34
+ ])),
35
+ required: items.required || [],
36
+ };
37
+ }
38
+ else {
39
+ baseSchema.items = { type: items.type };
40
+ }
41
+ }
42
+ return baseSchema;
43
+ }
44
+ /**
45
+ * Generate a compact description suitable for API calls
46
+ *
47
+ * The compact description is the first paragraph plus key constraints
48
+ * for dangerous tools.
49
+ */
50
+ export function generateCompactDescription(tool) {
51
+ // Get first paragraph (up to first double newline or 500 chars)
52
+ const firstParagraph = tool.description.split('\n\n')[0].slice(0, 500);
53
+ // For dangerous tools, add the most important constraint
54
+ if (tool.safetyLevel === 'dangerous' && tool.constraints.length > 0) {
55
+ return `${firstParagraph} IMPORTANT: ${tool.constraints[0]}`;
56
+ }
57
+ return firstParagraph;
58
+ }
59
+ /**
60
+ * Convert rich ToolDefinition to OpenAI function calling format
61
+ *
62
+ * This is a DERIVED format for API calls. The full tool details
63
+ * should be provided in the system prompt.
64
+ */
65
+ export function toOpenAIFormat(tool) {
66
+ const properties = {};
67
+ for (const [name, param] of Object.entries(tool.parameters.properties)) {
68
+ properties[name] = toJSONSchemaProperty(param);
69
+ }
70
+ return {
71
+ type: 'function',
72
+ function: {
73
+ name: tool.name,
74
+ description: generateCompactDescription(tool),
75
+ parameters: {
76
+ type: 'object',
77
+ properties,
78
+ required: tool.parameters.required,
79
+ },
80
+ },
81
+ };
82
+ }
83
+ /**
84
+ * Convert rich ToolDefinition to Anthropic tool format
85
+ */
86
+ export function toAnthropicFormat(tool) {
87
+ const properties = {};
88
+ for (const [name, param] of Object.entries(tool.parameters.properties)) {
89
+ properties[name] = toJSONSchemaProperty(param);
90
+ }
91
+ return {
92
+ name: tool.name,
93
+ description: generateCompactDescription(tool),
94
+ input_schema: {
95
+ type: 'object',
96
+ properties,
97
+ required: tool.parameters.required,
98
+ },
99
+ };
100
+ }
101
+ /**
102
+ * Generate a full system prompt section for a tool
103
+ *
104
+ * This includes all the rich metadata: description, parameters,
105
+ * usage notes, constraints, anti-patterns, and examples.
106
+ */
107
+ export function toSystemPromptSection(tool) {
108
+ const sections = [];
109
+ // Header
110
+ sections.push(`## ${tool.displayName}`);
111
+ sections.push('');
112
+ sections.push(tool.description);
113
+ sections.push('');
114
+ // Parameters
115
+ sections.push('### Parameters');
116
+ sections.push('');
117
+ for (const [name, param] of Object.entries(tool.parameters.properties)) {
118
+ const required = tool.parameters.required.includes(name) ? '(required)' : '(optional)';
119
+ sections.push(`- \`${name}\` ${required}: ${param.description}`);
120
+ if (param.default !== undefined) {
121
+ sections.push(` - Default: \`${JSON.stringify(param.default)}\``);
122
+ }
123
+ if (param.enum) {
124
+ sections.push(` - Options: ${param.enum.map(e => `\`${e}\``).join(', ')}`);
125
+ }
126
+ if (param.examples && param.examples.length > 0) {
127
+ sections.push(` - Examples: ${param.examples.map(e => `\`${JSON.stringify(e)}\``).join(', ')}`);
128
+ }
129
+ if (param.constraints && param.constraints.length > 0) {
130
+ param.constraints.forEach(c => sections.push(` - ${c}`));
131
+ }
132
+ }
133
+ sections.push('');
134
+ // Usage Notes
135
+ if (tool.usageNotes.length > 0) {
136
+ sections.push('### Usage Notes');
137
+ sections.push('');
138
+ tool.usageNotes.forEach(note => sections.push(`- ${note}`));
139
+ sections.push('');
140
+ }
141
+ // Constraints
142
+ if (tool.constraints.length > 0) {
143
+ sections.push('### Constraints');
144
+ sections.push('');
145
+ tool.constraints.forEach(c => sections.push(`- ${c}`));
146
+ sections.push('');
147
+ }
148
+ // Anti-patterns (when NOT to use)
149
+ if (tool.antiPatterns && tool.antiPatterns.length > 0) {
150
+ sections.push('### Do NOT Use When');
151
+ sections.push('');
152
+ tool.antiPatterns.forEach(ap => sections.push(`- ${ap}`));
153
+ sections.push('');
154
+ }
155
+ // Examples
156
+ if (tool.examples.length > 0) {
157
+ sections.push('### Examples');
158
+ sections.push('');
159
+ tool.examples.forEach(ex => {
160
+ sections.push(`**${ex.description}**`);
161
+ sections.push(`- Scenario: ${ex.scenario}`);
162
+ sections.push(`- Input: \`${JSON.stringify(ex.input)}\``);
163
+ sections.push(`- Expected: ${ex.expectedBehavior}`);
164
+ if (ex.notes) {
165
+ sections.push(`- Note: ${ex.notes}`);
166
+ }
167
+ sections.push('');
168
+ });
169
+ }
170
+ // Related tools
171
+ if (tool.relatedTools && tool.relatedTools.length > 0) {
172
+ sections.push(`**Related tools:** ${tool.relatedTools.join(', ')}`);
173
+ sections.push('');
174
+ }
175
+ // Alternatives
176
+ if (tool.alternatives && tool.alternatives.length > 0) {
177
+ sections.push(`**Alternatives:** ${tool.alternatives.join(', ')}`);
178
+ sections.push('');
179
+ }
180
+ return sections.join('\n');
181
+ }
182
+ /**
183
+ * Generate the complete tool instructions section for system prompt
184
+ *
185
+ * @param tools - Array of tool definitions
186
+ * @returns Formatted markdown string with all tool documentation
187
+ */
188
+ export function generateToolInstructions(tools) {
189
+ const sections = [];
190
+ sections.push('# Available Tools');
191
+ sections.push('');
192
+ sections.push('The following tools are available. Read each description carefully before using.');
193
+ sections.push('');
194
+ // Group tools by category
195
+ const byCategory = new Map();
196
+ for (const tool of tools) {
197
+ for (const category of tool.categories) {
198
+ if (!byCategory.has(category)) {
199
+ byCategory.set(category, []);
200
+ }
201
+ const categoryTools = byCategory.get(category);
202
+ if (categoryTools) {
203
+ categoryTools.push(tool);
204
+ }
205
+ }
206
+ }
207
+ // Generate sections by category
208
+ const categoryOrder = [
209
+ 'file-operations',
210
+ 'command-execution',
211
+ 'search',
212
+ 'task-management',
213
+ 'user-interaction',
214
+ 'agent-delegation',
215
+ 'design',
216
+ 'web',
217
+ ];
218
+ for (const category of categoryOrder) {
219
+ const categoryTools = byCategory.get(category);
220
+ if (categoryTools && categoryTools.length > 0) {
221
+ sections.push(`---`);
222
+ sections.push('');
223
+ sections.push(`# ${formatCategoryName(category)}`);
224
+ sections.push('');
225
+ // Deduplicate tools (a tool might be in multiple categories)
226
+ const seen = new Set();
227
+ for (const tool of categoryTools) {
228
+ if (!seen.has(tool.name)) {
229
+ seen.add(tool.name);
230
+ sections.push(toSystemPromptSection(tool));
231
+ sections.push('---');
232
+ sections.push('');
233
+ }
234
+ }
235
+ }
236
+ }
237
+ // Add general tool usage principles
238
+ sections.push('# Tool Usage Principles');
239
+ sections.push('');
240
+ sections.push('1. **Use specialized tools over general tools** - Use view_file instead of bash cat');
241
+ sections.push('2. **Read before editing** - Always view_file before str_replace_editor');
242
+ sections.push('3. **Parallel execution** - Make independent tool calls in parallel');
243
+ sections.push('4. **Sequential for dependencies** - Chain dependent calls with proper ordering');
244
+ sections.push('5. **Never guess parameters** - Ask if unsure about required values');
245
+ sections.push('6. **Match exact content** - For str_replace_editor, copy exact text from file');
246
+ sections.push('');
247
+ return sections.join('\n');
248
+ }
249
+ /**
250
+ * Format category name for display
251
+ */
252
+ function formatCategoryName(category) {
253
+ const names = {
254
+ 'file-operations': 'File Operations',
255
+ 'command-execution': 'Command Execution',
256
+ 'search': 'Search',
257
+ 'task-management': 'Task Management',
258
+ 'user-interaction': 'User Interaction',
259
+ 'agent-delegation': 'Agent Delegation',
260
+ 'design': 'Design Tools',
261
+ 'web': 'Web Tools',
262
+ };
263
+ return names[category] || category;
264
+ }
265
+ /**
266
+ * Calculate total token cost for a set of tools
267
+ *
268
+ * Useful for budget planning and deciding which tools to include
269
+ */
270
+ export function calculateTotalTokenCost(tools) {
271
+ return tools.reduce((sum, tool) => sum + tool.tokenCost, 0);
272
+ }
273
+ /**
274
+ * Filter tools by category
275
+ */
276
+ export function filterByCategory(tools, categories) {
277
+ return tools.filter(tool => tool.categories.some(c => categories.includes(c)));
278
+ }
279
+ /**
280
+ * Filter tools by safety level
281
+ */
282
+ export function filterBySafetyLevel(tools, levels) {
283
+ return tools.filter(tool => levels.includes(tool.safetyLevel));
284
+ }
285
+ /**
286
+ * Get tools that require confirmation
287
+ */
288
+ export function getToolsRequiringConfirmation(tools) {
289
+ return tools.filter(tool => tool.requiresConfirmation);
290
+ }
291
+ //# sourceMappingURL=format-generators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-generators.js","sourceRoot":"","sources":["../../src/tools/format-generators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH;;GAEG;AACH,SAAS,oBAAoB,CAAC,KAA0B;IACtD,wBAAwB;IACxB,MAAM,UAAU,GAAkE;QAChF,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CAAC;IAEF,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,UAAU,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACrC,CAAC;I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AC,CAAC,CAAC,CAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAuB,EACvB,MAAgD;IAEhD,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,KAAuB;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AACzD,CAAC"}
@@ -3,3 +3,7 @@ export { TextEditorTool } from "./text-editor.js";
3
3
  export { TodoTool } from "./todo-tool.js";
4
4
  export { ConfirmationTool } from "./confirmation-tool.js";
5
5
  export { SearchTool } from "./search.js";
6
+ export * from "./types.js";
7
+ export * from "./format-generators.js";
8
+ export * from "./result-enhancer.js";
9
+ export { TOOL_DEFINITIONS, getToolDefinition, getToolsByCategory } from "./definitions/index.js";
@@ -1,6 +1,12 @@
1
+ // Tool implementations
1
2
  export { BashTool } from "./bash.js";
2
3
  export { TextEditorTool } from "./text-editor.js";
3
4
  export { TodoTool } from "./todo-tool.js";
4
5
  export { ConfirmationTool } from "./confirmation-tool.js";
5
6
  export { SearchTool } from "./search.js";
7
+ // Tool System v3.0 - Rich definitions and utilities
8
+ export * from "./types.js";
9
+ export * from "./format-generators.js";
10
+ export * from "./result-enhancer.js";
11
+ export { TOOL_DEFINITIONS, getToolDefinition, getToolsByCategory } from "./definitions/index.js";
6
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,oDAAoD;AACpD,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Tool Result Enhancer
3
+ *
4
+ * Enhances tool results with embedded instructions, security reminders,
5
+ * and contextual guidance based on the tool definition and result content.
6
+ */
7
+ import type { ToolDefinition, EnhancedToolResult, ResultEnhancerConfig } from './types.js';
8
+ /**
9
+ * Result Enhancer Class
10
+ *
11
+ * Enhances tool results with:
12
+ * - Security reminders for potentially dangerous content
13
+ * - Failure guidance based on tool constraints
14
+ * - Format reminders for large outputs
15
+ */
16
+ export declare class ToolResultEnhancer {
17
+ private config;
18
+ constructor(config?: Partial<ResultEnhancerConfig>);
19
+ /**
20
+ * Enhance a tool result with embedded instructions
21
+ *
22
+ * @param toolName - Name of the tool that was executed
23
+ * @param result - Raw result from tool execution
24
+ * @param success - Whether the tool executed successfully
25
+ * @param definition - Tool definition with metadata
26
+ * @returns Enhanced result with reminders
27
+ */
28
+ enhance(toolName: string, result: string, success: boolean, definition?: ToolDefinition): EnhancedToolResult;
29
+ /**
30
+ * Get security reminders based on content patterns
31
+ */
32
+ private getSecurityReminders;
33
+ /**
34
+ * Get failure guidance from tool constraints
35
+ */
36
+ private getFailureGuidance;
37
+ /**
38
+ * Get format reminders for output handling
39
+ */
40
+ private getFormatReminders;
41
+ /**
42
+ * Get tool-specific reminders based on tool and context
43
+ */
44
+ private getToolSpecificReminders;
45
+ /**
46
+ * Update configuration
47
+ */
48
+ setConfig(config: Partial<ResultEnhancerConfig>): void;
49
+ /**
50
+ * Get current configuration
51
+ */
52
+ getConfig(): ResultEnhancerConfig;
53
+ }
54
+ /**
55
+ * Create a default result enhancer instance
56
+ */
57
+ export declare function createResultEnhancer(config?: Partial<ResultEnhancerConfig>): ToolResultEnhancer;
58
+ /**
59
+ * Format reminders for inclusion in tool result message
60
+ *
61
+ * @param reminders - Array of reminder strings
62
+ * @returns Formatted string to append to result
63
+ */
64
+ export declare function formatReminders(reminders: string[]): string;