toolpack-sdk 1.3.0 → 1.4.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 +90 -6
- package/dist/index.cjs +135 -130
- package/dist/index.d.cts +339 -181
- package/dist/index.d.ts +339 -181
- package/dist/index.js +135 -130
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Toolpack SDK
|
|
2
2
|
|
|
3
|
-
A unified TypeScript/Node.js SDK for building AI-powered applications with multiple providers,
|
|
3
|
+
A unified TypeScript/Node.js SDK for building AI-powered applications with multiple providers, 90 built-in tools, a workflow engine, and a flexible mode system — all through a single API.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/toolpack-sdk)
|
|
6
6
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
@@ -16,8 +16,9 @@ A unified TypeScript/Node.js SDK for building AI-powered applications with multi
|
|
|
16
16
|
- **Embeddings** — Vector generation for RAG applications (OpenAI, Gemini, Ollama)
|
|
17
17
|
- **Workflow Engine** — AI-driven planning and step-by-step task execution with progress events
|
|
18
18
|
- **Mode System** — Built-in Agent and Chat modes, plus `createMode()` for custom modes with tool filtering
|
|
19
|
+
- **HITL Confirmation** — Human-in-the-loop approval for high-risk operations with configurable bypass rules
|
|
19
20
|
- **Custom Providers** — Bring your own provider by implementing the `ProviderAdapter` interface
|
|
20
|
-
- **
|
|
21
|
+
- **90 Built-in Tools** across 11 categories:
|
|
21
22
|
- **MCP Tool Server Integration** — dynamically bridge external Model Context Protocol servers into Toolpack as first-class tools via `createMcpToolProject()` and `disconnectMcpToolProject()`.
|
|
22
23
|
|
|
23
24
|
| Category | Tools | Description |
|
|
@@ -32,6 +33,7 @@ A unified TypeScript/Node.js SDK for building AI-powered applications with multi
|
|
|
32
33
|
| **`system-tools`** | 5 | System info — env vars, cwd, disk usage, system info, set env |
|
|
33
34
|
| **`diff-tools`** | 3 | Patch operations — create, apply, and preview diffs |
|
|
34
35
|
| **`cloud-tools`** | 3 | Deployments — deploy, status, list (via Netlify) |
|
|
36
|
+
| **`k8s-tools`** | 11 | Kubernetes cluster inspection and management via kubectl |
|
|
35
37
|
| **`mcp-tools`** | 2 | MCP integration — createMcpToolProject, disconnectMcpToolProject |
|
|
36
38
|
|
|
37
39
|
## Quick Start
|
|
@@ -58,7 +60,7 @@ const sdk = await Toolpack.init({
|
|
|
58
60
|
anthropic: {}, // Reads ANTHROPIC_API_KEY from env
|
|
59
61
|
},
|
|
60
62
|
defaultProvider: 'openai',
|
|
61
|
-
tools: true, // Load all
|
|
63
|
+
tools: true, // Load all 90 built-in tools
|
|
62
64
|
defaultMode: 'agent', // Agent mode with workflow engine
|
|
63
65
|
});
|
|
64
66
|
|
|
@@ -90,6 +92,44 @@ const sdk = await Toolpack.init({
|
|
|
90
92
|
});
|
|
91
93
|
```
|
|
92
94
|
|
|
95
|
+
## Kubernetes Tools
|
|
96
|
+
|
|
97
|
+
Toolpack SDK now includes a dedicated Kubernetes tool category that exposes `kubectl`-backed operations when `tools: true` is enabled. Use these tools to inspect cluster state, fetch pod logs, apply manifests, and wait for rollout status.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
const sdk = await Toolpack.init({
|
|
101
|
+
provider: 'openai',
|
|
102
|
+
tools: true,
|
|
103
|
+
defaultMode: 'agent',
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const podsResponse = await sdk.generate({
|
|
107
|
+
model: 'gpt-4o',
|
|
108
|
+
messages: [
|
|
109
|
+
{
|
|
110
|
+
role: 'user',
|
|
111
|
+
content: 'List pods in the default namespace using Kubernetes tools.',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
console.log(podsResponse.content);
|
|
116
|
+
|
|
117
|
+
const applyResponse = await sdk.generate({
|
|
118
|
+
model: 'gpt-4o',
|
|
119
|
+
messages: [
|
|
120
|
+
{
|
|
121
|
+
role: 'user',
|
|
122
|
+
content: 'Apply the manifest at ./deploy/my-app.yaml to the staging namespace using Kubernetes tools.',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
console.log(applyResponse.content);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> Requires `kubectl` installed and configured with a valid kubeconfig.
|
|
130
|
+
|
|
131
|
+
See `packages/toolpack-sdk/docs/examples/kubernetes-usage.ts` for a complete example.
|
|
132
|
+
|
|
93
133
|
## Providers
|
|
94
134
|
|
|
95
135
|
### Built-in Providers
|
|
@@ -508,7 +548,7 @@ client.on('tool:failed', (event) => { /* ... */ });
|
|
|
508
548
|
|
|
509
549
|
## Custom Tools
|
|
510
550
|
|
|
511
|
-
In addition to the
|
|
551
|
+
In addition to the 90 built-in tools, you can create and register your own custom tool projects using `createToolProject()`:
|
|
512
552
|
|
|
513
553
|
```typescript
|
|
514
554
|
import { Toolpack, createToolProject } from 'toolpack-sdk';
|
|
@@ -766,6 +806,49 @@ Create a `toolpack.config.json` in your project root:
|
|
|
766
806
|
| `enabledTools` | string[] | `[]` | Whitelist specific tools (empty = all) |
|
|
767
807
|
| `enabledToolCategories` | string[] | `[]` | Whitelist categories (empty = all) |
|
|
768
808
|
|
|
809
|
+
### HITL (Human-in-the-Loop) Configuration
|
|
810
|
+
|
|
811
|
+
Configure user confirmation for high-risk tool operations:
|
|
812
|
+
|
|
813
|
+
```json
|
|
814
|
+
{
|
|
815
|
+
"hitl": {
|
|
816
|
+
"enabled": true,
|
|
817
|
+
"confirmationMode": "all",
|
|
818
|
+
"bypass": {
|
|
819
|
+
"tools": ["fs.write_file"],
|
|
820
|
+
"categories": ["filesystem"],
|
|
821
|
+
"levels": ["medium"]
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
| Option | Type | Default | Description |
|
|
828
|
+
|--------|------|---------|-------------|
|
|
829
|
+
| `enabled` | boolean | `true` | Master switch for HITL confirmation |
|
|
830
|
+
| `confirmationMode` | string | `"all"` | `"off"`, `"high-only"`, or `"all"` |
|
|
831
|
+
| `bypass.tools` | string[] | `[]` | Tool names to bypass (e.g., `["fs.write_file"]`) |
|
|
832
|
+
| `bypass.categories` | string[] | `[]` | Categories to bypass (e.g., `["filesystem"]`) |
|
|
833
|
+
| `bypass.levels` | string[] | `[]` | Risk levels to bypass (`["high"]` or `["medium"]`) |
|
|
834
|
+
|
|
835
|
+
**Programmatic API:**
|
|
836
|
+
|
|
837
|
+
```typescript
|
|
838
|
+
import { addBypassRule, removeBypassRule } from 'toolpack-sdk';
|
|
839
|
+
|
|
840
|
+
// Add bypass rule
|
|
841
|
+
await addBypassRule({ type: 'tool', value: 'fs.delete_file' });
|
|
842
|
+
|
|
843
|
+
// Remove bypass rule
|
|
844
|
+
await removeBypassRule({ type: 'tool', value: 'fs.delete_file' });
|
|
845
|
+
|
|
846
|
+
// Reload config to apply changes
|
|
847
|
+
toolpack.reloadConfig();
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
See the [HITL documentation](https://toolpacksdk.com/guides/hitl-confirmation) for detailed configuration options and best practices.
|
|
851
|
+
|
|
769
852
|
#### Web Search Providers
|
|
770
853
|
|
|
771
854
|
The `web.search` tool supports multiple search backends with automatic fallback:
|
|
@@ -928,7 +1011,7 @@ toolpack-sdk/
|
|
|
928
1011
|
│ │ └── ollama/ # Ollama adapter + provider (auto-discovery)
|
|
929
1012
|
│ ├── modes/ # Mode system (Agent, Chat, createMode)
|
|
930
1013
|
│ ├── workflows/ # Workflow engine (planner, step executor, progress)
|
|
931
|
-
│ ├── tools/ #
|
|
1014
|
+
│ ├── tools/ # 90 built-in tools + registry + router + BM25 search
|
|
932
1015
|
│ │ ├── fs-tools/ # File system (18 tools)
|
|
933
1016
|
│ │ ├── coding-tools/ # Code analysis (12 tools)
|
|
934
1017
|
│ │ ├── git-tools/ # Git operations (9 tools)
|
|
@@ -939,6 +1022,7 @@ toolpack-sdk/
|
|
|
939
1022
|
│ │ ├── system-tools/ # System info (5 tools)
|
|
940
1023
|
│ │ ├── diff-tools/ # Patch operations (3 tools)
|
|
941
1024
|
│ │ ├── cloud-tools/ # Deployments (3 tools)
|
|
1025
|
+
│ │ ├── k8s-tools/ # Kubernetes management (11 tools)
|
|
942
1026
|
│ │ ├── registry.ts # Tool registry and loading
|
|
943
1027
|
│ │ ├── router.ts # Tool routing and filtering
|
|
944
1028
|
│ │ └── search/ # BM25 tool discovery engine (internal)
|
|
@@ -954,7 +1038,7 @@ toolpack-sdk/
|
|
|
954
1038
|
**Current Version:** 0.1.0
|
|
955
1039
|
|
|
956
1040
|
- ✓ **4 Built-in Providers** — OpenAI, Anthropic, Gemini, Ollama (+ custom provider API)
|
|
957
|
-
- ✓ **
|
|
1041
|
+
- ✓ **90 Built-in Tools** — fs, exec, git, diff, web, coding, db, cloud, http, system, Kubernetes
|
|
958
1042
|
- ✓ **Workflow Engine** — AI-driven planning, step execution, retries, dynamic steps, progress events
|
|
959
1043
|
- ✓ **Mode System** — Agent, Coding, Chat, and custom modes via `createMode()` with `blockAllTools` support
|
|
960
1044
|
- ✓ **Tool Search** — BM25-based on-demand tool discovery for large tool libraries
|