@push.rocks/smartagent 1.6.2 → 1.7.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/dist_ts/00_commitinfo_data.js +1 -1
- package/package.json +1 -1
- package/readme.hints.md +13 -3
- package/readme.md +38 -3
- package/ts/00_commitinfo_data.ts +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartagent',
|
|
6
|
-
version: '1.
|
|
6
|
+
version: '1.7.0',
|
|
7
7
|
description: 'an agentic framework built on top of @push.rocks/smartai'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLDBEQUEwRDtDQUN4RSxDQUFBIn0=
|
package/package.json
CHANGED
package/readme.hints.md
CHANGED
|
@@ -5,18 +5,20 @@
|
|
|
5
5
|
|
|
6
6
|
## Architecture
|
|
7
7
|
- **DualAgentOrchestrator**: Main entry point, coordinates Driver and Guardian agents
|
|
8
|
-
- **DriverAgent**: Reasons about tasks, plans steps, proposes tool calls
|
|
8
|
+
- **DriverAgent**: Reasons about tasks, plans steps, proposes tool calls (supports both XML and native tool calling)
|
|
9
9
|
- **GuardianAgent**: Evaluates tool calls against configured policies
|
|
10
10
|
- **BaseToolWrapper**: Base class for creating custom tools
|
|
11
11
|
- **plugins.ts**: Imports and re-exports smartai and other dependencies
|
|
12
12
|
|
|
13
|
-
## Standard Tools
|
|
13
|
+
## Standard Tools (via registerStandardTools)
|
|
14
14
|
1. **FilesystemTool** - File operations with scoping and exclusion patterns
|
|
15
15
|
2. **HttpTool** - HTTP requests
|
|
16
16
|
3. **ShellTool** - Secure shell commands (no injection possible)
|
|
17
17
|
4. **BrowserTool** - Web page interaction via Puppeteer
|
|
18
18
|
5. **DenoTool** - Sandboxed TypeScript/JavaScript execution
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
## Additional Tools (must register manually)
|
|
21
|
+
6. **JsonValidatorTool** - JSON validation and formatting (NOT in registerStandardTools)
|
|
20
22
|
|
|
21
23
|
## Key Features
|
|
22
24
|
- Token streaming support (`onToken` callback)
|
|
@@ -25,6 +27,14 @@
|
|
|
25
27
|
- Scoped filesystem with exclusion patterns
|
|
26
28
|
- Result truncation with configurable limits
|
|
27
29
|
- History windowing to manage token usage
|
|
30
|
+
- **Native tool calling mode** (`useNativeToolCalling: true`) for providers like Ollama
|
|
31
|
+
|
|
32
|
+
## Native Tool Calling
|
|
33
|
+
When `useNativeToolCalling` is enabled:
|
|
34
|
+
- Uses provider's built-in tool calling API instead of XML parsing
|
|
35
|
+
- Tool names become `toolName_actionName` (e.g., `json_validate`)
|
|
36
|
+
- Streaming includes `[THINKING]` and `[OUTPUT]` markers
|
|
37
|
+
- More efficient for models that support it
|
|
28
38
|
|
|
29
39
|
## Key Dependencies
|
|
30
40
|
- `@push.rocks/smartai`: Multi-provider AI interface
|
package/readme.md
CHANGED
|
@@ -50,7 +50,6 @@ flowchart TB
|
|
|
50
50
|
Shell["Shell"]
|
|
51
51
|
Browser["Browser"]
|
|
52
52
|
Deno["Deno"]
|
|
53
|
-
JSON["JSON Validator"]
|
|
54
53
|
end
|
|
55
54
|
|
|
56
55
|
Task --> Orchestrator
|
|
@@ -100,7 +99,7 @@ await orchestrator.stop();
|
|
|
100
99
|
|
|
101
100
|
## Standard Tools
|
|
102
101
|
|
|
103
|
-
SmartAgent comes with
|
|
102
|
+
SmartAgent comes with five battle-tested tools out of the box via `registerStandardTools()`:
|
|
104
103
|
|
|
105
104
|
### 🗂️ FilesystemTool
|
|
106
105
|
|
|
@@ -231,12 +230,21 @@ By default, code runs **fully sandboxed with no permissions**. Permissions must
|
|
|
231
230
|
</tool_call>
|
|
232
231
|
```
|
|
233
232
|
|
|
233
|
+
## Additional Tools
|
|
234
|
+
|
|
234
235
|
### 📋 JsonValidatorTool
|
|
235
236
|
|
|
236
237
|
Validate and format JSON data. Perfect for agents to self-check their JSON output before completing tasks.
|
|
237
238
|
|
|
238
239
|
**Actions**: `validate`, `format`
|
|
239
240
|
|
|
241
|
+
```typescript
|
|
242
|
+
import { JsonValidatorTool } from '@push.rocks/smartagent';
|
|
243
|
+
|
|
244
|
+
// Register the JSON validator tool (not included in registerStandardTools)
|
|
245
|
+
orchestrator.registerTool(new JsonValidatorTool());
|
|
246
|
+
```
|
|
247
|
+
|
|
240
248
|
```typescript
|
|
241
249
|
// Validate JSON with required field checking
|
|
242
250
|
<tool_call>
|
|
@@ -330,6 +338,29 @@ const orchestrator = new DualAgentOrchestrator({
|
|
|
330
338
|
|
|
331
339
|
**Event Types**: `task_started`, `iteration_started`, `tool_proposed`, `guardian_evaluating`, `tool_approved`, `tool_rejected`, `tool_executing`, `tool_completed`, `task_completed`, `clarification_needed`, `max_iterations`, `max_rejections`
|
|
332
340
|
|
|
341
|
+
## 🔧 Native Tool Calling
|
|
342
|
+
|
|
343
|
+
For providers that support native tool calling (like Ollama with certain models), SmartAgent can use the provider's built-in tool calling API instead of XML parsing:
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
const orchestrator = new DualAgentOrchestrator({
|
|
347
|
+
ollamaToken: 'http://localhost:11434', // Ollama endpoint
|
|
348
|
+
defaultProvider: 'ollama',
|
|
349
|
+
guardianPolicyPrompt: '...',
|
|
350
|
+
|
|
351
|
+
// Enable native tool calling
|
|
352
|
+
useNativeToolCalling: true,
|
|
353
|
+
});
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
When `useNativeToolCalling` is enabled:
|
|
357
|
+
- Tools are converted to JSON schema format automatically
|
|
358
|
+
- The provider handles tool call parsing natively
|
|
359
|
+
- Streaming still works with `[THINKING]` and `[OUTPUT]` markers for supported models
|
|
360
|
+
- Tool calls appear as `toolName_actionName` (e.g., `json_validate`)
|
|
361
|
+
|
|
362
|
+
This is more efficient for models that support it and avoids potential XML parsing issues.
|
|
363
|
+
|
|
333
364
|
## Guardian Policy Examples
|
|
334
365
|
|
|
335
366
|
The Guardian's power comes from your policy. Here are battle-tested examples:
|
|
@@ -401,6 +432,7 @@ interface IDualAgentOptions {
|
|
|
401
432
|
perplexityToken?: string;
|
|
402
433
|
groqToken?: string;
|
|
403
434
|
xaiToken?: string;
|
|
435
|
+
ollamaToken?: string; // URL for Ollama endpoint
|
|
404
436
|
|
|
405
437
|
// Use existing SmartAi instance (optional - avoids duplicate providers)
|
|
406
438
|
smartAiInstance?: SmartAi;
|
|
@@ -415,6 +447,9 @@ interface IDualAgentOptions {
|
|
|
415
447
|
name?: string; // Agent system name
|
|
416
448
|
verbose?: boolean; // Enable verbose logging
|
|
417
449
|
|
|
450
|
+
// Native tool calling
|
|
451
|
+
useNativeToolCalling?: boolean; // Use provider's native tool calling API (default: false)
|
|
452
|
+
|
|
418
453
|
// Limits
|
|
419
454
|
maxIterations?: number; // Max task iterations (default: 20)
|
|
420
455
|
maxConsecutiveRejections?: number; // Abort after N rejections (default: 3)
|
|
@@ -574,7 +609,7 @@ const orchestrator = new DualAgentOrchestrator({
|
|
|
574
609
|
| `run(task, options?)` | Execute a task with optional images for vision |
|
|
575
610
|
| `continueTask(input)` | Continue a task with user input |
|
|
576
611
|
| `registerTool(tool)` | Register a custom tool |
|
|
577
|
-
| `registerStandardTools()` | Register all built-in tools |
|
|
612
|
+
| `registerStandardTools()` | Register all built-in tools (Filesystem, HTTP, Shell, Browser, Deno) |
|
|
578
613
|
| `registerScopedFilesystemTool(basePath, excludePatterns?)` | Register filesystem tool with path restriction |
|
|
579
614
|
| `setGuardianPolicy(policy)` | Update Guardian policy at runtime |
|
|
580
615
|
| `getHistory()` | Get conversation history |
|