@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.
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/index.d.ts +9 -12
- package/dist_ts/index.js +9 -20
- package/dist_ts/plugins.d.ts +8 -9
- package/dist_ts/plugins.js +10 -12
- package/dist_ts/smartagent.classes.agent.d.ts +2 -0
- package/dist_ts/smartagent.classes.agent.js +173 -0
- package/dist_ts/smartagent.classes.toolregistry.d.ts +12 -0
- package/dist_ts/smartagent.classes.toolregistry.js +17 -0
- package/dist_ts/smartagent.interfaces.d.ts +47 -231
- package/dist_ts/smartagent.interfaces.js +6 -7
- package/dist_ts/smartagent.utils.truncation.d.ts +10 -0
- package/dist_ts/smartagent.utils.truncation.js +26 -0
- package/dist_ts_compaction/index.d.ts +1 -0
- package/dist_ts_compaction/index.js +2 -0
- package/dist_ts_compaction/plugins.d.ts +4 -0
- package/dist_ts_compaction/plugins.js +3 -0
- package/dist_ts_compaction/smartagent.compaction.d.ts +10 -0
- package/dist_ts_compaction/smartagent.compaction.js +46 -0
- package/dist_ts_tools/index.d.ts +8 -0
- package/dist_ts_tools/index.js +6 -0
- package/dist_ts_tools/plugins.d.ts +15 -0
- package/dist_ts_tools/plugins.js +19 -0
- package/dist_ts_tools/tool.filesystem.d.ts +6 -0
- package/dist_ts_tools/tool.filesystem.js +102 -0
- package/dist_ts_tools/tool.http.d.ts +2 -0
- package/dist_ts_tools/tool.http.js +65 -0
- package/dist_ts_tools/tool.json.d.ts +2 -0
- package/dist_ts_tools/tool.json.js +47 -0
- package/dist_ts_tools/tool.shell.d.ts +8 -0
- package/dist_ts_tools/tool.shell.js +40 -0
- package/npmextra.json +1 -1
- package/package.json +30 -18
- package/readme.hints.md +43 -42
- package/readme.md +257 -526
- package/ts/00_commitinfo_data.ts +2 -2
- package/ts/index.ts +11 -31
- package/ts/plugins.ts +22 -21
- package/ts/smartagent.classes.agent.ts +198 -0
- package/ts/smartagent.classes.toolregistry.ts +20 -0
- package/ts/smartagent.interfaces.ts +51 -303
- package/ts/smartagent.utils.truncation.ts +39 -0
- package/ts_compaction/index.ts +1 -0
- package/ts_compaction/plugins.ts +6 -0
- package/ts_compaction/smartagent.compaction.ts +51 -0
- package/ts_tools/index.ts +8 -0
- package/ts_tools/plugins.ts +30 -0
- package/ts_tools/tool.filesystem.ts +131 -0
- package/ts_tools/tool.http.ts +78 -0
- package/ts_tools/tool.json.ts +53 -0
- package/ts_tools/tool.shell.ts +62 -0
- package/dist_ts/smartagent.classes.driveragent.d.ts +0 -134
- package/dist_ts/smartagent.classes.driveragent.js +0 -671
- package/dist_ts/smartagent.classes.dualagent.d.ts +0 -79
- package/dist_ts/smartagent.classes.dualagent.js +0 -583
- package/dist_ts/smartagent.classes.guardianagent.d.ts +0 -46
- package/dist_ts/smartagent.classes.guardianagent.js +0 -201
- package/dist_ts/smartagent.tools.base.d.ts +0 -52
- package/dist_ts/smartagent.tools.base.js +0 -42
- package/dist_ts/smartagent.tools.browser.d.ts +0 -17
- package/dist_ts/smartagent.tools.browser.js +0 -229
- package/dist_ts/smartagent.tools.deno.d.ts +0 -21
- package/dist_ts/smartagent.tools.deno.js +0 -191
- package/dist_ts/smartagent.tools.filesystem.d.ts +0 -40
- package/dist_ts/smartagent.tools.filesystem.js +0 -801
- package/dist_ts/smartagent.tools.http.d.ts +0 -16
- package/dist_ts/smartagent.tools.http.js +0 -264
- package/dist_ts/smartagent.tools.json.d.ts +0 -24
- package/dist_ts/smartagent.tools.json.js +0 -202
- package/dist_ts/smartagent.tools.shell.d.ts +0 -17
- package/dist_ts/smartagent.tools.shell.js +0 -202
- package/ts/smartagent.classes.driveragent.ts +0 -775
- package/ts/smartagent.classes.dualagent.ts +0 -657
- package/ts/smartagent.classes.guardianagent.ts +0 -241
- package/ts/smartagent.tools.base.ts +0 -83
- package/ts/smartagent.tools.browser.ts +0 -253
- package/ts/smartagent.tools.deno.ts +0 -230
- package/ts/smartagent.tools.filesystem.ts +0 -885
- package/ts/smartagent.tools.http.ts +0 -283
- package/ts/smartagent.tools.json.ts +0 -224
- 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
|
|
5
|
-
|
|
6
|
-
## Architecture
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- `@push.rocks/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- `
|
|
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`
|