concevent-ai-agent-sdk 2.2.0 → 2.3.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.
- package/README.md +279 -0
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/bash-output.d.ts +19 -0
- package/dist/tools/bash-output.d.ts.map +1 -0
- package/dist/tools/bash-output.js +47 -0
- package/dist/tools/bash-output.js.map +1 -0
- package/dist/tools/bash.d.ts +25 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +79 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +28 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +97 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +25 -0
- package/dist/tools/glob.d.ts.map +1 -0
- package/dist/tools/glob.js +88 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +31 -0
- package/dist/tools/grep.d.ts.map +1 -0
- package/dist/tools/grep.js +195 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +85 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +141 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/kill-bash.d.ts +19 -0
- package/dist/tools/kill-bash.d.ts.map +1 -0
- package/dist/tools/kill-bash.js +49 -0
- package/dist/tools/kill-bash.js.map +1 -0
- package/dist/tools/read.d.ts +25 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +103 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/task.d.ts +25 -0
- package/dist/tools/task.d.ts.map +1 -0
- package/dist/tools/task.js +71 -0
- package/dist/tools/task.js.map +1 -0
- package/dist/tools/todo-write.d.ts +46 -0
- package/dist/tools/todo-write.d.ts.map +1 -0
- package/dist/tools/todo-write.js +151 -0
- package/dist/tools/todo-write.js.map +1 -0
- package/dist/tools/types.d.ts +147 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +16 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/utils/index.d.ts +3 -0
- package/dist/tools/utils/index.d.ts.map +1 -0
- package/dist/tools/utils/index.js +3 -0
- package/dist/tools/utils/index.js.map +1 -0
- package/dist/tools/utils/path.d.ts +40 -0
- package/dist/tools/utils/path.d.ts.map +1 -0
- package/dist/tools/utils/path.js +146 -0
- package/dist/tools/utils/path.js.map +1 -0
- package/dist/tools/utils/shell.d.ts +49 -0
- package/dist/tools/utils/shell.d.ts.map +1 -0
- package/dist/tools/utils/shell.js +232 -0
- package/dist/tools/utils/shell.js.map +1 -0
- package/dist/tools/write.d.ts +22 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +70 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ A framework-agnostic AI Agent SDK for building intelligent conversational agents
|
|
|
6
6
|
|
|
7
7
|
- 🤖 **AI Agent Framework** - Create intelligent agents with tool/function calling capabilities
|
|
8
8
|
- 🔧 **Tool Execution** - Define and execute custom tools with typed parameters using Zod schemas
|
|
9
|
+
- 🧰 **Built-in Tools** - Ready-to-use tools for file operations, shell commands, and task management
|
|
9
10
|
- 💬 **Conversation Management** - Automatic history tracking with built-in summarization
|
|
10
11
|
- 📊 **Token Usage Tracking** - Monitor token consumption across conversations
|
|
11
12
|
- 🔄 **Auto-Summarization** - Automatically summarize long conversations to stay within context limits
|
|
@@ -87,6 +88,7 @@ console.log(result.message);
|
|
|
87
88
|
- [createAgent](#createagent)
|
|
88
89
|
- [Agent Interface](#agent-interface)
|
|
89
90
|
- [Tool Definitions](#tool-definitions)
|
|
91
|
+
- [Built-in Tools](#built-in-tools)
|
|
90
92
|
- [Callbacks & Events](#callbacks--events)
|
|
91
93
|
- [Types](#types)
|
|
92
94
|
- [Streaming](#streaming)
|
|
@@ -454,6 +456,213 @@ const longRunningTool: ToolDefinition = {
|
|
|
454
456
|
|
|
455
457
|
---
|
|
456
458
|
|
|
459
|
+
### Built-in Tools
|
|
460
|
+
|
|
461
|
+
The SDK provides a collection of general-purpose, OS-agnostic built-in tools that can be used directly with agents or orchestrators. These tools cover common operations like file system access, shell execution, and task management.
|
|
462
|
+
|
|
463
|
+
#### Quick Start
|
|
464
|
+
|
|
465
|
+
You must explicitly specify which tools you need using the `tools` property. Tool names are strongly typed with autocomplete support:
|
|
466
|
+
|
|
467
|
+
```typescript
|
|
468
|
+
import { createAgent, createBuiltInTools } from 'concevent-ai-agent-sdk';
|
|
469
|
+
|
|
470
|
+
// Explicitly specify which tools you need
|
|
471
|
+
const { tools, cleanup } = createBuiltInTools({
|
|
472
|
+
workingDirectory: '/path/to/project',
|
|
473
|
+
tools: ['Read', 'Write', 'Edit', 'Glob', 'Grep'],
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
const agent = createAgent({
|
|
477
|
+
apiKey: process.env.OPENROUTER_API_KEY!,
|
|
478
|
+
model: 'anthropic/claude-3.5-sonnet',
|
|
479
|
+
systemPrompts: ['You are a helpful coding assistant.'],
|
|
480
|
+
tools: [...tools],
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// Don't forget to cleanup background processes when done
|
|
484
|
+
process.on('exit', () => cleanup());
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### Available Tools
|
|
488
|
+
|
|
489
|
+
| Tool | Description | Parallel-Safe |
|
|
490
|
+
|------|-------------|---------------|
|
|
491
|
+
| `'Read'` | Read file contents with optional line range | ✅ |
|
|
492
|
+
| `'Write'` | Create or overwrite files | ❌ |
|
|
493
|
+
| `'Edit'` | Targeted string replacement in files | ❌ |
|
|
494
|
+
| `'Glob'` | Find files matching glob patterns | ✅ |
|
|
495
|
+
| `'Grep'` | Search for patterns in file contents | ✅ |
|
|
496
|
+
| `'Bash'` | Execute shell commands | ❌ |
|
|
497
|
+
| `'BashOutput'` | Get output from background processes | ✅ |
|
|
498
|
+
| `'KillBash'` | Terminate background processes | ❌ |
|
|
499
|
+
| `'Task'` | Launch sub-agents for complex tasks | ❌ |
|
|
500
|
+
| `'TodoWrite'` | Manage structured todo items | ❌ |
|
|
501
|
+
|
|
502
|
+
#### Tool Selection Examples
|
|
503
|
+
|
|
504
|
+
```typescript
|
|
505
|
+
import { createBuiltInTools } from 'concevent-ai-agent-sdk';
|
|
506
|
+
|
|
507
|
+
// Read-only tools for safe analysis
|
|
508
|
+
const { tools: readOnlyTools } = createBuiltInTools({
|
|
509
|
+
workingDirectory: '/project',
|
|
510
|
+
tools: ['Read', 'Glob', 'Grep'],
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
// File tools only (no shell access)
|
|
514
|
+
const { tools: fileTools } = createBuiltInTools({
|
|
515
|
+
workingDirectory: '/project',
|
|
516
|
+
tools: ['Read', 'Write', 'Edit', 'Glob', 'Grep'],
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
// Shell tools only
|
|
520
|
+
const { tools: shellTools } = createBuiltInTools({
|
|
521
|
+
workingDirectory: '/project',
|
|
522
|
+
tools: ['Bash', 'BashOutput', 'KillBash'],
|
|
523
|
+
});
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
#### Configuration
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
interface BuiltInToolsConfig {
|
|
530
|
+
/** Required: Which tools to include (strongly typed with autocomplete). */
|
|
531
|
+
tools: ToolName[];
|
|
532
|
+
|
|
533
|
+
/** Working directory for file operations (defaults to process.cwd()) */
|
|
534
|
+
workingDirectory?: string;
|
|
535
|
+
|
|
536
|
+
/** Allowed file paths for sandboxing */
|
|
537
|
+
allowedPaths?: string[];
|
|
538
|
+
|
|
539
|
+
/** Blocked shell command patterns (defaults to dangerous patterns) */
|
|
540
|
+
blockedCommands?: RegExp[];
|
|
541
|
+
|
|
542
|
+
/** Default timeout for shell commands in ms (default: 30000) */
|
|
543
|
+
defaultTimeout?: number;
|
|
544
|
+
|
|
545
|
+
/** Agent factory for Task tool (required if using Task) */
|
|
546
|
+
agentFactory?: (config: TaskAgentConfig) => Promise<{ message: string }>;
|
|
547
|
+
|
|
548
|
+
/** Custom todo storage (defaults to in-memory) */
|
|
549
|
+
todoStorage?: TodoStorage;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
#### Individual Tool Creation
|
|
553
|
+
|
|
554
|
+
Create specific tools when you need fine-grained control:
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
import {
|
|
558
|
+
createReadTool,
|
|
559
|
+
createBashTool,
|
|
560
|
+
createBuiltInTool,
|
|
561
|
+
} from 'concevent-ai-agent-sdk';
|
|
562
|
+
|
|
563
|
+
// Create a specific tool using its creator function
|
|
564
|
+
const readTool = createReadTool({ workingDirectory: '/project' });
|
|
565
|
+
|
|
566
|
+
// Or use the generic factory with tool name (strongly typed)
|
|
567
|
+
const bashTool = createBuiltInTool('Bash', {
|
|
568
|
+
workingDirectory: '/project',
|
|
569
|
+
defaultTimeout: 60000,
|
|
570
|
+
});
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
#### Security Features
|
|
574
|
+
|
|
575
|
+
**Path Sandboxing:**
|
|
576
|
+
```typescript
|
|
577
|
+
const { tools } = createBuiltInTools({
|
|
578
|
+
workingDirectory: '/project',
|
|
579
|
+
tools: ['Read', 'Write'],
|
|
580
|
+
allowedPaths: ['/project/src', '/project/tests'],
|
|
581
|
+
// File tools will reject paths outside these directories
|
|
582
|
+
});
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
**Command Blocking:**
|
|
586
|
+
```typescript
|
|
587
|
+
const { tools } = createBuiltInTools({
|
|
588
|
+
workingDirectory: '/project',
|
|
589
|
+
tools: ['Bash'],
|
|
590
|
+
blockedCommands: [
|
|
591
|
+
/rm\s+(-rf?|--recursive)/i,
|
|
592
|
+
/sudo\s+/i,
|
|
593
|
+
/curl.*\|\s*bash/i,
|
|
594
|
+
],
|
|
595
|
+
// Bash tool will reject commands matching these patterns
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
#### Task Tool with Agent Factory
|
|
600
|
+
|
|
601
|
+
The Task tool requires an agent factory to launch sub-agents:
|
|
602
|
+
|
|
603
|
+
```typescript
|
|
604
|
+
import { createAgent, createBuiltInTools } from 'concevent-ai-agent-sdk';
|
|
605
|
+
|
|
606
|
+
const { tools } = createBuiltInTools({
|
|
607
|
+
workingDirectory: '/project',
|
|
608
|
+
agentFactory: async (config) => {
|
|
609
|
+
// Create a sub-agent for the task
|
|
610
|
+
const subAgent = createAgent({
|
|
611
|
+
apiKey: process.env.OPENROUTER_API_KEY!,
|
|
612
|
+
model: 'anthropic/claude-3.5-sonnet',
|
|
613
|
+
systemPrompts: [config.description],
|
|
614
|
+
tools: [], // Configure tools based on config.allowedTools
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
const result = await subAgent.chat(config.prompt, {
|
|
618
|
+
userId: 'task-agent',
|
|
619
|
+
timezone: 'UTC',
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
return { message: result.message };
|
|
623
|
+
},
|
|
624
|
+
});
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
#### Custom Todo Storage
|
|
628
|
+
|
|
629
|
+
Implement custom storage for persisting todos:
|
|
630
|
+
|
|
631
|
+
```typescript
|
|
632
|
+
import type { TodoStorage, TodoItem } from 'concevent-ai-agent-sdk';
|
|
633
|
+
|
|
634
|
+
const customStorage: TodoStorage = {
|
|
635
|
+
async getAll(): Promise<TodoItem[]> {
|
|
636
|
+
// Load from database, file, etc.
|
|
637
|
+
return JSON.parse(await fs.readFile('todos.json', 'utf-8'));
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
async save(todos: TodoItem[], merge: boolean): Promise<TodoItem[]> {
|
|
641
|
+
if (merge) {
|
|
642
|
+
const existing = await this.getAll();
|
|
643
|
+
const merged = new Map(existing.map(t => [t.id, t]));
|
|
644
|
+
todos.forEach(t => merged.set(t.id, t));
|
|
645
|
+
const all = Array.from(merged.values());
|
|
646
|
+
await fs.writeFile('todos.json', JSON.stringify(all));
|
|
647
|
+
return all;
|
|
648
|
+
}
|
|
649
|
+
await fs.writeFile('todos.json', JSON.stringify(todos));
|
|
650
|
+
return todos;
|
|
651
|
+
},
|
|
652
|
+
|
|
653
|
+
async clear(): Promise<void> {
|
|
654
|
+
await fs.writeFile('todos.json', '[]');
|
|
655
|
+
},
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
const { tools } = createBuiltInTools({
|
|
659
|
+
workingDirectory: '/project',
|
|
660
|
+
todoStorage: customStorage,
|
|
661
|
+
});
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
---
|
|
665
|
+
|
|
457
666
|
### Callbacks & Events
|
|
458
667
|
|
|
459
668
|
The SDK provides a comprehensive callback system for real-time updates during agent execution.
|
|
@@ -1790,6 +1999,76 @@ export {
|
|
|
1790
1999
|
|
|
1791
2000
|
// Timeout error class
|
|
1792
2001
|
export { ToolExecutionTimeoutError } from "./core/tool-executor";
|
|
2002
|
+
|
|
2003
|
+
// Built-in Tools - Factory & Utilities
|
|
2004
|
+
export {
|
|
2005
|
+
createBuiltInTools,
|
|
2006
|
+
createBuiltInTool,
|
|
2007
|
+
getBuiltInToolNames,
|
|
2008
|
+
isBuiltInTool,
|
|
2009
|
+
BUILTIN_TOOLS_ALL,
|
|
2010
|
+
BUILTIN_TOOLS_READONLY,
|
|
2011
|
+
BUILTIN_TOOLS_FILE_ONLY,
|
|
2012
|
+
BUILTIN_TOOLS_SHELL_ONLY,
|
|
2013
|
+
TOOL_NAMES,
|
|
2014
|
+
} from "./tools";
|
|
2015
|
+
|
|
2016
|
+
// Built-in Tools - Individual Creators
|
|
2017
|
+
export {
|
|
2018
|
+
createReadTool,
|
|
2019
|
+
createWriteTool,
|
|
2020
|
+
createEditTool,
|
|
2021
|
+
createGlobTool,
|
|
2022
|
+
createGrepTool,
|
|
2023
|
+
createBashTool,
|
|
2024
|
+
createBashOutputTool,
|
|
2025
|
+
createKillBashTool,
|
|
2026
|
+
createTaskTool,
|
|
2027
|
+
createTodoWriteTool,
|
|
2028
|
+
createTodoReadTool,
|
|
2029
|
+
} from "./tools";
|
|
2030
|
+
|
|
2031
|
+
// Built-in Tools - Types
|
|
2032
|
+
export type {
|
|
2033
|
+
BuiltInToolsConfig,
|
|
2034
|
+
BuiltInToolsResult,
|
|
2035
|
+
ToolName,
|
|
2036
|
+
TodoStorage,
|
|
2037
|
+
TodoItem,
|
|
2038
|
+
TodoStatus,
|
|
2039
|
+
ProcessManager,
|
|
2040
|
+
ProcessInfo,
|
|
2041
|
+
AgentFactory,
|
|
2042
|
+
TaskAgentConfig,
|
|
2043
|
+
ShellResult,
|
|
2044
|
+
} from "./tools";
|
|
2045
|
+
|
|
2046
|
+
// Built-in Tools - Parameter Schemas & Types
|
|
2047
|
+
export {
|
|
2048
|
+
readSchema,
|
|
2049
|
+
writeSchema,
|
|
2050
|
+
editSchema,
|
|
2051
|
+
globSchema,
|
|
2052
|
+
grepSchema,
|
|
2053
|
+
bashSchema,
|
|
2054
|
+
bashOutputSchema,
|
|
2055
|
+
killBashSchema,
|
|
2056
|
+
taskSchema,
|
|
2057
|
+
todoWriteSchema,
|
|
2058
|
+
} from "./tools";
|
|
2059
|
+
|
|
2060
|
+
export type {
|
|
2061
|
+
ReadParams,
|
|
2062
|
+
WriteParams,
|
|
2063
|
+
EditParams,
|
|
2064
|
+
GlobParams,
|
|
2065
|
+
GrepParams,
|
|
2066
|
+
BashParams,
|
|
2067
|
+
BashOutputParams,
|
|
2068
|
+
KillBashParams,
|
|
2069
|
+
TaskParams,
|
|
2070
|
+
TodoWriteParams,
|
|
2071
|
+
} from "./tools";
|
|
1793
2072
|
```
|
|
1794
2073
|
|
|
1795
2074
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/core/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAmJlC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/core/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAmJlC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,iBAAiB,CAmIrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/core/orchestrator.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAEjE;;GAEG;AACH,SAAS,mBAAmB,CAAC,KAAY;IACvC,OAAO,mBAAmB,IAAI,KAAK,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CACzB,UAA2B,EAC3B,SAA0B,EAC1B,cAA+B;IAE/B,OAAO;QACL,WAAW,EAAE;YACX,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,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;YAC7B,qBAAqB,GAAG,cAAc,CAAC;YAEvC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;gBAEvE,2CAA2C;gBAC3C,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAE1D,kDAAkD;gBAClD,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC;gBAEvC,OAAO;oBACL,GAAG,MAAM;oBACT,OAAO;iBACR,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,gBAAgB,GAAG,SAAS,CAAC;gBAC7B,qBAAqB,GAAG,SAAS,CAAC;YACpC,CAAC;QACH,CAAC;QAED,KAAK;YACH,eAAe,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QAED,UAAU;YACR,OAAO,eAAe,CAAC,UAAU,EAAE,CAAC;QACtC,CAAC;QAED,UAAU,CAAC,OAAsB;YAC/B,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAED,YAAY;YACV,eAAe,CAAC,YAAY,EAAE,CAAC;QACjC,CAAC;QAED,aAAa;YACX,OAAO,eAAe,CAAC,aAAa,EAAE,CAAC;QACzC,CAAC;QAED,YAAY;YACV,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;QACxB,CAAC;KACF,CAAC;IAEF,0CAA0C;IAC1C,MAAM,CAAC,cAAc,CAAC,iBAAiB,EAAE,mBAAmB,EAAE;QAC5D,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,9 @@ export type { AgentErrorCode } from './core/errors.js';
|
|
|
8
8
|
export type { ReasoningDetail, ChatMessage, FunctionDeclaration, ToolExecutorContext, ToolDefinition, AgentConfig, ParallelExecutionConfig, RetryConfig, TimeoutConfig, UsageMetadata, AgentResult, ToolCallStartData, ToolResultData, AgentCallbacks, AgentEventType, ThinkingEventData, UsageUpdateEventData, RetryEventData, ErrorEventData, CompleteEventData, MessageDeltaEventData, ReasoningDeltaEventData, AgentEvent, ResponseFormatConfig, Middleware, MiddlewareContext, BeforeChatContext, AfterChatContext, BeforeToolCallContext, AfterToolCallContext, ErrorContext, AgentDefinition, OrchestratorConfig, OrchestratorAgent, OrchestratorResult, SubAgentStartData, SubAgentCompleteData, OrchestratorCallbacks, } from './types/index.js';
|
|
9
9
|
export { DEFAULT_TOOL_EXECUTION_TIMEOUT_MS, DEFAULT_API_REQUEST_TIMEOUT_MS, } from './types/index.js';
|
|
10
10
|
export { ToolExecutionTimeoutError } from './core/tool-executor.js';
|
|
11
|
+
export { createBuiltInTools, createBuiltInTool, getBuiltInToolNames, isBuiltInTool, TOOL_NAMES, } from './tools/index.js';
|
|
12
|
+
export { createReadTool, createWriteTool, createEditTool, createGlobTool, createGrepTool, createBashTool, createBashOutputTool, createKillBashTool, createTaskTool, createTodoWriteTool, createTodoReadTool, } from './tools/index.js';
|
|
13
|
+
export type { ToolConfig, BuiltInToolsConfig, BuiltInToolsResult, ToolName, TodoStorage, TodoItem, TodoStatus, ProcessManager, ProcessInfo, AgentFactory, TaskAgentConfig, ShellResult, } from './tools/index.js';
|
|
14
|
+
export { readSchema, writeSchema, editSchema, globSchema, grepSchema, bashSchema, bashOutputSchema, killBashSchema, taskSchema, todoWriteSchema, } from './tools/index.js';
|
|
15
|
+
export type { ReadParams, WriteParams, EditParams, GlobParams, GrepParams, BashParams, BashOutputParams, KillBashParams, TaskParams, TodoWriteParams, } from './tools/index.js';
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EACV,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,oBAAoB,EAEpB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EAEZ,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAA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EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,13 @@ export { ENCRYPTED_REASONING_MARKER } from './core/openrouter-utils.js';
|
|
|
5
5
|
export { AgentError, formatErrorTrace, isAbortError } from './core/errors.js';
|
|
6
6
|
export { DEFAULT_TOOL_EXECUTION_TIMEOUT_MS, DEFAULT_API_REQUEST_TIMEOUT_MS, } from './types/index.js';
|
|
7
7
|
export { ToolExecutionTimeoutError } from './core/tool-executor.js';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Built-in Tools
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Main factory and utilities
|
|
12
|
+
export { createBuiltInTools, createBuiltInTool, getBuiltInToolNames, isBuiltInTool, TOOL_NAMES, } from './tools/index.js';
|
|
13
|
+
// Individual tool creators
|
|
14
|
+
export { createReadTool, createWriteTool, createEditTool, createGlobTool, createGrepTool, createBashTool, createBashOutputTool, createKillBashTool, createTaskTool, createTodoWriteTool, createTodoReadTool, } from './tools/index.js';
|
|
15
|
+
// Parameter schemas for advanced usage
|
|
16
|
+
export { readSchema, writeSchema, editSchema, globSchema, grepSchema, bashSchema, bashOutputSchema, killBashSchema, taskSchema, todoWriteSchema, } from './tools/index.js';
|
|
8
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA8C9E,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA8C9E,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,6BAA6B;AAC7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,2BAA2B;AAC3B,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAkB1B,uCAAuC;AACvC,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from '../types/index.js';
|
|
3
|
+
import type { ToolConfig, ProcessManager } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Schema for the BashOutput tool parameters
|
|
6
|
+
*/
|
|
7
|
+
export declare const bashOutputSchema: z.ZodObject<{
|
|
8
|
+
process_id: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
process_id: string;
|
|
11
|
+
}, {
|
|
12
|
+
process_id: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type BashOutputParams = z.infer<typeof bashOutputSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates the BashOutput tool for retrieving output from background processes
|
|
17
|
+
*/
|
|
18
|
+
export declare function createBashOutputTool(_config?: ToolConfig, processManager?: ProcessManager): ToolDefinition;
|
|
19
|
+
//# sourceMappingURL=bash-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-output.d.ts","sourceRoot":"","sources":["../../src/tools/bash-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,UAAe,EACxB,cAAc,CAAC,EAAE,cAAc,GAC9B,cAAc,CAwChB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
/**
|
|
4
|
+
* Schema for the BashOutput tool parameters
|
|
5
|
+
*/
|
|
6
|
+
export const bashOutputSchema = z.object({
|
|
7
|
+
process_id: z.string().describe('The ID of the background process to get output from.'),
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Creates the BashOutput tool for retrieving output from background processes
|
|
11
|
+
*/
|
|
12
|
+
export function createBashOutputTool(_config = {}, processManager) {
|
|
13
|
+
return {
|
|
14
|
+
declaration: {
|
|
15
|
+
name: 'BashOutput',
|
|
16
|
+
description: `Retrieves the current output from a background bash process.
|
|
17
|
+
Returns the accumulated stdout and stderr, along with process status.
|
|
18
|
+
|
|
19
|
+
Use this to check on long-running background processes.`,
|
|
20
|
+
parametersJsonSchema: zodToJsonSchema(bashOutputSchema),
|
|
21
|
+
},
|
|
22
|
+
executor: async (args) => {
|
|
23
|
+
const params = bashOutputSchema.parse(args);
|
|
24
|
+
if (!processManager) {
|
|
25
|
+
throw new Error('ProcessManager not available. Background processes are not enabled.');
|
|
26
|
+
}
|
|
27
|
+
const process = processManager.get(params.process_id);
|
|
28
|
+
if (!process) {
|
|
29
|
+
throw new Error(`Process not found: ${params.process_id}. The process may have been terminated or the ID is invalid.`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
process_id: process.id,
|
|
33
|
+
command: process.command,
|
|
34
|
+
running: process.running,
|
|
35
|
+
exit_code: process.exitCode,
|
|
36
|
+
stdout: process.stdout,
|
|
37
|
+
stderr: process.stderr,
|
|
38
|
+
started_at: process.startTime.toISOString(),
|
|
39
|
+
message: process.running
|
|
40
|
+
? `Process ${process.id} is still running`
|
|
41
|
+
: `Process ${process.id} has completed with exit code ${process.exitCode}`,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
parallel: true, // Reading output is safe to do in parallel
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=bash-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-output.js","sourceRoot":"","sources":["../../src/tools/bash-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;CACxF,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAsB,EAAE,EACxB,cAA+B;IAE/B,OAAO;QACL,WAAW,EAAE;YACX,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE;;;wDAGqC;YAClD,oBAAoB,EAAE,eAAe,CAAC,gBAAgB,CAAC;SACxD;QACD,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAE5C,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;YACzF,CAAC;YAED,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CACb,sBAAsB,MAAM,CAAC,UAAU,8DAA8D,CACtG,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,UAAU,EAAE,OAAO,CAAC,EAAE;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,SAAS,EAAE,OAAO,CAAC,QAAQ;gBAC3B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE;gBAC3C,OAAO,EAAE,OAAO,CAAC,OAAO;oBACtB,CAAC,CAAC,WAAW,OAAO,CAAC,EAAE,mBAAmB;oBAC1C,CAAC,CAAC,WAAW,OAAO,CAAC,EAAE,iCAAiC,OAAO,CAAC,QAAQ,EAAE;aAC7E,CAAC;QACJ,CAAC;QACD,QAAQ,EAAE,IAAI,EAAE,2CAA2C;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from '../types/index.js';
|
|
3
|
+
import type { ToolConfig, ProcessManager } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Schema for the Bash tool parameters
|
|
6
|
+
*/
|
|
7
|
+
export declare const bashSchema: z.ZodObject<{
|
|
8
|
+
command: z.ZodString;
|
|
9
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
command: string;
|
|
13
|
+
cwd?: string | undefined;
|
|
14
|
+
timeout_ms?: number | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
command: string;
|
|
17
|
+
cwd?: string | undefined;
|
|
18
|
+
timeout_ms?: number | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export type BashParams = z.infer<typeof bashSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates the Bash tool for executing shell commands
|
|
23
|
+
*/
|
|
24
|
+
export declare function createBashTool(config?: ToolConfig, _processManager?: ProcessManager): ToolDefinition;
|
|
25
|
+
//# sourceMappingURL=bash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI7D;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;EAUrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,GAAE,UAAe,EACvB,eAAe,CAAC,EAAE,cAAc,GAC/B,cAAc,CA8DhB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
import { executeCommand, isCommandBlocked, DEFAULT_BLOCKED_COMMANDS } from './utils/shell.js';
|
|
4
|
+
import { resolvePath, isPathAllowed } from './utils/path.js';
|
|
5
|
+
/**
|
|
6
|
+
* Schema for the Bash tool parameters
|
|
7
|
+
*/
|
|
8
|
+
export const bashSchema = z.object({
|
|
9
|
+
command: z.string().describe('The shell command to execute.'),
|
|
10
|
+
timeout_ms: z
|
|
11
|
+
.number()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Timeout in milliseconds. Defaults to 30000 (30 seconds). Set to 0 for no timeout.'),
|
|
14
|
+
cwd: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Working directory for the command. Defaults to the configured working directory.'),
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Creates the Bash tool for executing shell commands
|
|
21
|
+
*/
|
|
22
|
+
export function createBashTool(config = {}, _processManager) {
|
|
23
|
+
const workingDirectory = config.workingDirectory || process.cwd();
|
|
24
|
+
const defaultTimeout = config.defaultTimeout ?? 30000;
|
|
25
|
+
const blockedPatterns = config.blockedCommands ?? DEFAULT_BLOCKED_COMMANDS;
|
|
26
|
+
return {
|
|
27
|
+
declaration: {
|
|
28
|
+
name: 'Bash',
|
|
29
|
+
description: `Executes a shell command and returns the output.
|
|
30
|
+
Uses the system's default shell (bash on Unix, cmd on Windows).
|
|
31
|
+
|
|
32
|
+
Returns stdout, stderr, and exit code.
|
|
33
|
+
Commands have a default timeout of 30 seconds.
|
|
34
|
+
|
|
35
|
+
SECURITY: Certain dangerous commands are blocked by default.`,
|
|
36
|
+
parametersJsonSchema: zodToJsonSchema(bashSchema),
|
|
37
|
+
},
|
|
38
|
+
executor: async (args, context) => {
|
|
39
|
+
const params = bashSchema.parse(args);
|
|
40
|
+
// Security check: block dangerous commands
|
|
41
|
+
const blockReason = isCommandBlocked(params.command, blockedPatterns);
|
|
42
|
+
if (blockReason) {
|
|
43
|
+
throw new Error(blockReason);
|
|
44
|
+
}
|
|
45
|
+
// Resolve working directory
|
|
46
|
+
const cwd = params.cwd ? resolvePath(params.cwd, workingDirectory) : workingDirectory;
|
|
47
|
+
// Security check for cwd
|
|
48
|
+
if (params.cwd && !isPathAllowed(cwd, config.allowedPaths)) {
|
|
49
|
+
throw new Error(`Access denied: working directory ${params.cwd} is outside allowed paths`);
|
|
50
|
+
}
|
|
51
|
+
const timeout = params.timeout_ms ?? defaultTimeout;
|
|
52
|
+
try {
|
|
53
|
+
const result = await executeCommand(params.command, {
|
|
54
|
+
cwd,
|
|
55
|
+
timeout,
|
|
56
|
+
abortSignal: context.abortSignal,
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
command: params.command,
|
|
60
|
+
stdout: result.stdout,
|
|
61
|
+
stderr: result.stderr,
|
|
62
|
+
exit_code: result.exitCode,
|
|
63
|
+
timed_out: result.timedOut ?? false,
|
|
64
|
+
success: result.exitCode === 0,
|
|
65
|
+
message: result.timedOut
|
|
66
|
+
? `Command timed out after ${timeout}ms`
|
|
67
|
+
: result.exitCode === 0
|
|
68
|
+
? 'Command completed successfully'
|
|
69
|
+
: `Command failed with exit code ${result.exitCode}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw new Error(`Failed to execute command: ${error.message}`);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
parallel: false, // Shell commands should be sequential to avoid race conditions
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=bash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC7D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,mFAAmF,CAAC;IAChG,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kFAAkF,CAAC;CAChG,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAqB,EAAE,EACvB,eAAgC;IAEhC,MAAM,gBAAgB,GAA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EH,OAAO;oBACL,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,SAAS,EAAE,MAAM,CAAC,QAAQ;oBAC1B,SAAS,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;oBACnC,OAAO,EAAE,MAAM,CAAC,QAAQ,KAAK,CAAC;oBAC9B,OAAO,EAAE,MAAM,CAAC,QAAQ;wBACtB,CAAC,CAAC,2BAA2B,OAAO,IAAI;wBACxC,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC;4BACrB,CAAC,CAAC,gCAAgC;4BAClC,CAAC,CAAC,iCAAiC,MAAM,CAAC,QAAQ,EAAE;iBACzD,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,8BAA+B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;QACD,QAAQ,EAAE,KAAK,EAAE,+DAA+D;KACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolDefinition } from '../types/index.js';
|
|
3
|
+
import type { ToolConfig } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Schema for the Edit tool parameters
|
|
6
|
+
*/
|
|
7
|
+
export declare const editSchema: z.ZodObject<{
|
|
8
|
+
file_path: z.ZodString;
|
|
9
|
+
old_string: z.ZodString;
|
|
10
|
+
new_string: z.ZodString;
|
|
11
|
+
replace_all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
file_path: string;
|
|
14
|
+
old_string: string;
|
|
15
|
+
new_string: string;
|
|
16
|
+
replace_all: boolean;
|
|
17
|
+
}, {
|
|
18
|
+
file_path: string;
|
|
19
|
+
old_string: string;
|
|
20
|
+
new_string: string;
|
|
21
|
+
replace_all?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export type EditParams = z.infer<typeof editSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates the Edit tool for targeted string replacement in files
|
|
26
|
+
*/
|
|
27
|
+
export declare function createEditTool(config?: ToolConfig): ToolDefinition;
|
|
28
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/tools/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAiBrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,UAAe,GAAG,cAAc,CAqFtE"}
|