@push.rocks/smartagent 1.7.0 → 3.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 (81) hide show
  1. package/dist_ts/00_commitinfo_data.js +3 -3
  2. package/dist_ts/index.d.ts +9 -12
  3. package/dist_ts/index.js +9 -20
  4. package/dist_ts/plugins.d.ts +8 -9
  5. package/dist_ts/plugins.js +10 -12
  6. package/dist_ts/smartagent.classes.agent.d.ts +2 -0
  7. package/dist_ts/smartagent.classes.agent.js +173 -0
  8. package/dist_ts/smartagent.classes.toolregistry.d.ts +12 -0
  9. package/dist_ts/smartagent.classes.toolregistry.js +17 -0
  10. package/dist_ts/smartagent.interfaces.d.ts +47 -231
  11. package/dist_ts/smartagent.interfaces.js +6 -7
  12. package/dist_ts/smartagent.utils.truncation.d.ts +10 -0
  13. package/dist_ts/smartagent.utils.truncation.js +26 -0
  14. package/dist_ts_compaction/index.d.ts +1 -0
  15. package/dist_ts_compaction/index.js +2 -0
  16. package/dist_ts_compaction/plugins.d.ts +4 -0
  17. package/dist_ts_compaction/plugins.js +3 -0
  18. package/dist_ts_compaction/smartagent.compaction.d.ts +10 -0
  19. package/dist_ts_compaction/smartagent.compaction.js +46 -0
  20. package/dist_ts_tools/index.d.ts +8 -0
  21. package/dist_ts_tools/index.js +6 -0
  22. package/dist_ts_tools/plugins.d.ts +15 -0
  23. package/dist_ts_tools/plugins.js +19 -0
  24. package/dist_ts_tools/tool.filesystem.d.ts +6 -0
  25. package/dist_ts_tools/tool.filesystem.js +102 -0
  26. package/dist_ts_tools/tool.http.d.ts +2 -0
  27. package/dist_ts_tools/tool.http.js +65 -0
  28. package/dist_ts_tools/tool.json.d.ts +2 -0
  29. package/dist_ts_tools/tool.json.js +47 -0
  30. package/dist_ts_tools/tool.shell.d.ts +8 -0
  31. package/dist_ts_tools/tool.shell.js +40 -0
  32. package/npmextra.json +1 -1
  33. package/package.json +30 -18
  34. package/readme.hints.md +43 -42
  35. package/readme.md +257 -526
  36. package/ts/00_commitinfo_data.ts +2 -2
  37. package/ts/index.ts +11 -31
  38. package/ts/plugins.ts +22 -21
  39. package/ts/smartagent.classes.agent.ts +198 -0
  40. package/ts/smartagent.classes.toolregistry.ts +20 -0
  41. package/ts/smartagent.interfaces.ts +51 -303
  42. package/ts/smartagent.utils.truncation.ts +39 -0
  43. package/ts_compaction/index.ts +1 -0
  44. package/ts_compaction/plugins.ts +6 -0
  45. package/ts_compaction/smartagent.compaction.ts +51 -0
  46. package/ts_tools/index.ts +8 -0
  47. package/ts_tools/plugins.ts +30 -0
  48. package/ts_tools/tool.filesystem.ts +131 -0
  49. package/ts_tools/tool.http.ts +78 -0
  50. package/ts_tools/tool.json.ts +53 -0
  51. package/ts_tools/tool.shell.ts +62 -0
  52. package/dist_ts/smartagent.classes.driveragent.d.ts +0 -134
  53. package/dist_ts/smartagent.classes.driveragent.js +0 -671
  54. package/dist_ts/smartagent.classes.dualagent.d.ts +0 -79
  55. package/dist_ts/smartagent.classes.dualagent.js +0 -583
  56. package/dist_ts/smartagent.classes.guardianagent.d.ts +0 -46
  57. package/dist_ts/smartagent.classes.guardianagent.js +0 -201
  58. package/dist_ts/smartagent.tools.base.d.ts +0 -52
  59. package/dist_ts/smartagent.tools.base.js +0 -42
  60. package/dist_ts/smartagent.tools.browser.d.ts +0 -17
  61. package/dist_ts/smartagent.tools.browser.js +0 -229
  62. package/dist_ts/smartagent.tools.deno.d.ts +0 -21
  63. package/dist_ts/smartagent.tools.deno.js +0 -191
  64. package/dist_ts/smartagent.tools.filesystem.d.ts +0 -40
  65. package/dist_ts/smartagent.tools.filesystem.js +0 -801
  66. package/dist_ts/smartagent.tools.http.d.ts +0 -16
  67. package/dist_ts/smartagent.tools.http.js +0 -264
  68. package/dist_ts/smartagent.tools.json.d.ts +0 -24
  69. package/dist_ts/smartagent.tools.json.js +0 -202
  70. package/dist_ts/smartagent.tools.shell.d.ts +0 -17
  71. package/dist_ts/smartagent.tools.shell.js +0 -202
  72. package/ts/smartagent.classes.driveragent.ts +0 -775
  73. package/ts/smartagent.classes.dualagent.ts +0 -657
  74. package/ts/smartagent.classes.guardianagent.ts +0 -241
  75. package/ts/smartagent.tools.base.ts +0 -83
  76. package/ts/smartagent.tools.browser.ts +0 -253
  77. package/ts/smartagent.tools.deno.ts +0 -230
  78. package/ts/smartagent.tools.filesystem.ts +0 -885
  79. package/ts/smartagent.tools.http.ts +0 -283
  80. package/ts/smartagent.tools.json.ts +0 -224
  81. package/ts/smartagent.tools.shell.ts +0 -230
package/readme.hints.md CHANGED
@@ -1,50 +1,51 @@
1
1
  # Project Readme Hints
2
2
 
3
3
  ## Overview
4
- `@push.rocks/smartagent` is a dual-agent agentic framework built on top of `@push.rocks/smartai`. It implements a Driver/Guardian architecture where the Driver proposes tool calls and the Guardian evaluates them against security policies.
5
-
6
- ## Architecture
7
- - **DualAgentOrchestrator**: Main entry point, coordinates Driver and Guardian agents
8
- - **DriverAgent**: Reasons about tasks, plans steps, proposes tool calls (supports both XML and native tool calling)
9
- - **GuardianAgent**: Evaluates tool calls against configured policies
10
- - **BaseToolWrapper**: Base class for creating custom tools
11
- - **plugins.ts**: Imports and re-exports smartai and other dependencies
12
-
13
- ## Standard Tools (via registerStandardTools)
14
- 1. **FilesystemTool** - File operations with scoping and exclusion patterns
15
- 2. **HttpTool** - HTTP requests
16
- 3. **ShellTool** - Secure shell commands (no injection possible)
17
- 4. **BrowserTool** - Web page interaction via Puppeteer
18
- 5. **DenoTool** - Sandboxed TypeScript/JavaScript execution
19
-
20
- ## Additional Tools (must register manually)
21
- 6. **JsonValidatorTool** - JSON validation and formatting (NOT in registerStandardTools)
22
-
23
- ## Key Features
24
- - Token streaming support (`onToken` callback)
25
- - Vision support (pass images as base64)
26
- - Progress events (`onProgress` callback)
27
- - Scoped filesystem with exclusion patterns
28
- - Result truncation with configurable limits
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
4
+ `@push.rocks/smartagent` v2.0.0 is an agentic loop built on Vercel AI SDK v6 via `@push.rocks/smartai`. It wraps `streamText` with `stopWhen: stepCountIs(n)` for parallel multi-step tool execution.
5
+
6
+ ## Architecture (v2)
7
+ - **`runAgent()`**: Pure async function the core agentic loop. No class state.
8
+ - **`ToolRegistry`**: Lightweight helper for collecting tools into a `ToolSet`.
9
+ - **`truncateOutput()`**: Utility to prevent tool output from bloating context.
10
+ - **`compactMessages()`**: Context overflow handler (separate subpath export).
11
+
12
+ ## Source Layout
13
+ ```
14
+ ts/ → core: runAgent, ToolRegistry, truncateOutput, interfaces
15
+ ts_tools/ → built-in tool factories (filesystem, shell, http, json)
16
+ ts_compaction/ → compactMessages helper for onContextOverflow
17
+ ```
18
+
19
+ ## Built-in Tools (ts_tools/)
20
+ Each exports a factory returning a flat `ToolSet` (Record<string, Tool>):
21
+ 1. **filesystemTool()** `read_file`, `write_file`, `list_directory`, `delete_file`
22
+ 2. **shellTool()** → `run_command`
23
+ 3. **httpTool()** → `http_get`, `http_post`
24
+ 4. **jsonTool()** `json_validate`, `json_transform`
38
25
 
39
26
  ## Key Dependencies
40
- - `@push.rocks/smartai`: Multi-provider AI interface
41
- - `@push.rocks/smartfs`: Filesystem operations
42
- - `@push.rocks/smartshell`: Shell command execution
43
- - `@push.rocks/smartbrowser`: Browser automation
44
- - `@push.rocks/smartdeno`: Deno code execution
45
- - `@push.rocks/smartrequest`: HTTP requests
46
- - `minimatch`: Glob pattern matching for exclusions
27
+ - `@push.rocks/smartai` ^2.0.0 — provider registry, `getModel()`, re-exports `tool`, `jsonSchema`
28
+ - `ai` ^6.0.0 Vercel AI SDK v6 (`streamText`, `stepCountIs`, `ModelMessage`, `ToolSet`)
29
+ - `zod` ^3.25.0 tool input schema definitions
30
+ - `@push.rocks/smartfs`, `smartshell`, `smartrequest` — tool implementations
31
+
32
+ ## AI SDK v6 Key APIs
33
+ - `streamText({ model, messages, tools, stopWhen: stepCountIs(20) })` — agentic loop
34
+ - `tool({ description, inputSchema: z.object({...}), execute })` — define tools
35
+ - `ModelMessage` — message type (replaces v4's `CoreMessage`)
36
+ - `LanguageModelV3` — model type from `@ai-sdk/provider`
37
+ - Result is `StreamTextResult` with PromiseLike properties (`await result.text`, etc.)
38
+
39
+ ## Package Exports
40
+ - `.` → core (runAgent, ToolRegistry, truncateOutput, re-exports)
41
+ - `./tools` → built-in tool factories
42
+ - `./compaction` → compactMessages
43
+
44
+ ## Build
45
+ - `pnpm build` → `tsbuild tsfolders --allowimplicitany`
46
+ - Cross-folder imports via each folder's `plugins.ts` (tsbuild unpack resolves them)
47
47
 
48
48
  ## Test Structure
49
49
  - Tests use `@git.zone/tstest/tapbundle`
50
- - Tests must end with `export default tap.start();`
50
+ - Tests must end with `export default tap.start()`
51
+ - `pnpm test` → `tstest test/ --verbose`