@slashfi/agents-sdk 0.61.0 → 0.62.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 +266 -212
- package/dist/adk.js +47 -0
- package/dist/adk.js.map +1 -1
- package/dist/agent-definitions/config.js +2 -2
- package/dist/agent-definitions/config.js.map +1 -1
- package/dist/cjs/agent-definitions/config.js +2 -2
- package/dist/cjs/agent-definitions/config.js.map +1 -1
- package/dist/cjs/config-store.js +19 -11
- package/dist/cjs/config-store.js.map +1 -1
- package/dist/config-store.d.ts +2 -2
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +19 -11
- package/dist/config-store.js.map +1 -1
- package/package.json +1 -1
- package/src/adk.ts +40 -0
- package/src/agent-definitions/config.ts +2 -2
- package/src/config-store.test.ts +2 -2
- package/src/config-store.ts +17 -11
- package/src/consumer.test.ts +4 -4
package/README.md
CHANGED
|
@@ -1,244 +1,335 @@
|
|
|
1
1
|
# Agents SDK
|
|
2
2
|
|
|
3
|
-
SDK for building,
|
|
3
|
+
SDK for building, connecting, and using AI agents. Includes the `adk` CLI for managing agent connections, installing skills for coding agents, and working with MCP servers.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Copy this into your coding agent
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Help me install the Agent Development Kit (adk) — a CLI that connects coding agents to remote
|
|
9
|
+
APIs and MCPs. It also installs skill files so you know how to use them.
|
|
10
|
+
|
|
11
|
+
Run this to install it:
|
|
12
|
+
curl -fsSL https://registry.slash.com/adk/install | sh
|
|
13
|
+
|
|
14
|
+
Then follow the printed instructions to set up skills and connect to agents.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
6
20
|
|
|
7
21
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
22
|
+
# Install via curl
|
|
23
|
+
curl -fsSL https://registry.slash.com/adk/install | sh
|
|
24
|
+
|
|
25
|
+
# Or via npm
|
|
26
|
+
npm install -g @slashfi/agents-sdk
|
|
11
27
|
```
|
|
12
28
|
|
|
13
|
-
|
|
29
|
+
```bash
|
|
30
|
+
# Set up skills for your coding agent (Claude Code, Cursor, Copilot, etc.)
|
|
31
|
+
adk init
|
|
32
|
+
|
|
33
|
+
# Connect to an agent from the public registry
|
|
34
|
+
adk ref add notion
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
# Browse available agents
|
|
37
|
+
adk registry browse public
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
# Call a tool
|
|
40
|
+
adk ref call notion notion-search '{"query": "hello"}'
|
|
41
|
+
```
|
|
19
42
|
|
|
20
43
|
---
|
|
21
44
|
|
|
22
45
|
## ADK CLI
|
|
23
46
|
|
|
24
|
-
The Agent Development Kit CLI. One tool for the full agent definition lifecycle.
|
|
47
|
+
The Agent Development Kit CLI. One tool for connecting to agents, managing skills, and the full agent definition lifecycle.
|
|
25
48
|
|
|
26
49
|
```bash
|
|
27
50
|
adk --help
|
|
28
51
|
```
|
|
29
52
|
|
|
30
|
-
### Commands
|
|
53
|
+
### Commands Overview
|
|
31
54
|
|
|
32
55
|
| Command | Description |
|
|
33
56
|
|---------|-------------|
|
|
34
|
-
| `adk
|
|
35
|
-
| `adk
|
|
36
|
-
| `adk
|
|
37
|
-
| `adk
|
|
38
|
-
| `adk
|
|
39
|
-
| `adk
|
|
57
|
+
| `adk init` | Set up skills for coding agents (Claude, Cursor, Copilot, Codex, Windsurf, Hermes) |
|
|
58
|
+
| `adk ref add <name>` | Install an agent from a registry |
|
|
59
|
+
| `adk ref call <name> <tool>` | Call a tool on a connected agent |
|
|
60
|
+
| `adk ref auth <name>` | Authenticate to a service |
|
|
61
|
+
| `adk ref inspect <name>` | See available tools and resources |
|
|
62
|
+
| `adk registry browse <name>` | Browse agents on a registry |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Working with Agents
|
|
40
67
|
|
|
41
|
-
###
|
|
68
|
+
### Setting Up Skills
|
|
69
|
+
|
|
70
|
+
`adk init` installs skill files for your coding agents. It auto-detects which agents you have installed and writes skill files in the standard YAML-frontmatter markdown format from [agentskills.io](https://agentskills.io).
|
|
42
71
|
|
|
43
72
|
```bash
|
|
44
|
-
#
|
|
45
|
-
adk
|
|
46
|
-
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
adk
|
|
52
|
-
# ✅ Packed @agentdef/notion@1.0.0
|
|
53
|
-
# Hash: ba845dfb
|
|
54
|
-
# Tools: 22
|
|
55
|
-
# Size: 28.7KB
|
|
56
|
-
|
|
57
|
-
# 4. Publish to npm
|
|
58
|
-
adk publish
|
|
59
|
-
# ✅ Published @agentdef/notion@1.0.0
|
|
73
|
+
# Auto-detect and set up all detected agents
|
|
74
|
+
adk init
|
|
75
|
+
|
|
76
|
+
# Target specific agents
|
|
77
|
+
adk init --target claude --target cursor --target codex
|
|
78
|
+
|
|
79
|
+
# Custom output path
|
|
80
|
+
adk init --target claude:./my-skills
|
|
60
81
|
```
|
|
61
82
|
|
|
62
|
-
|
|
83
|
+
Supported agents:
|
|
84
|
+
|
|
85
|
+
| Preset | Default Path | Format |
|
|
86
|
+
|--------|-------------|--------|
|
|
87
|
+
| `claude` | `~/.claude/skills` | SKILL.md |
|
|
88
|
+
| `cursor` | `.cursor/rules` | SKILL.md |
|
|
89
|
+
| `copilot` | `.github` | SKILL.md |
|
|
90
|
+
| `windsurf` | `.` | SKILL.md |
|
|
91
|
+
| `codex` | `.` | SKILL.md |
|
|
92
|
+
| `hermes` | `~/.hermes/skills` | SKILL.md |
|
|
93
|
+
|
|
94
|
+
### Connecting to Agents
|
|
63
95
|
|
|
64
|
-
|
|
96
|
+
Install agents from a registry. The public registry at `registry.slash.com` is configured by default.
|
|
65
97
|
|
|
66
98
|
```bash
|
|
67
|
-
|
|
68
|
-
adk
|
|
99
|
+
# Install from the public registry (default)
|
|
100
|
+
adk ref add notion
|
|
101
|
+
adk ref add linear
|
|
102
|
+
adk ref add github
|
|
103
|
+
|
|
104
|
+
# Install from a specific registry
|
|
105
|
+
adk ref add myagent --registry internal
|
|
106
|
+
|
|
107
|
+
# Install from a direct URL
|
|
108
|
+
adk ref add myapi --url https://api.example.com/mcp
|
|
69
109
|
```
|
|
70
110
|
|
|
71
|
-
|
|
111
|
+
When you install a ref, the CLI:
|
|
112
|
+
1. Resolves the agent from the registry
|
|
113
|
+
2. Materializes tool schemas locally (`~/.adk/refs/<name>/tools/`)
|
|
114
|
+
3. Downloads skill files (`~/.adk/refs/<name>/skills/`)
|
|
115
|
+
4. Generates TypeScript types (`~/.adk/refs/<name>/types/`)
|
|
72
116
|
|
|
73
|
-
|
|
74
|
-
|------|-------------|---------|
|
|
75
|
-
| `--server <cmd>` | MCP server command to run | required |
|
|
76
|
-
| `--name <name>` | Agent name | required |
|
|
77
|
-
| `--out <path>` | Output file path | `./<name>.json` |
|
|
117
|
+
### Authentication
|
|
78
118
|
|
|
79
|
-
|
|
119
|
+
```bash
|
|
120
|
+
# Authenticate to a service (opens browser for OAuth, or prompts for API key)
|
|
121
|
+
adk ref auth notion
|
|
80
122
|
|
|
81
|
-
|
|
123
|
+
# Check auth status
|
|
124
|
+
adk ref auth-status notion
|
|
82
125
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
├── package.json ← generated from agent.json
|
|
86
|
-
├── agent.json ← full SerializedAgentDefinition
|
|
87
|
-
├── meta.json ← version metadata + diff from previous
|
|
88
|
-
├── index.js ← re-export for ESM import
|
|
89
|
-
└── index.d.ts ← typed as SerializedAgentDefinition
|
|
126
|
+
# Provide an API key directly
|
|
127
|
+
adk ref auth myapi --api-key sk-...
|
|
90
128
|
```
|
|
91
129
|
|
|
92
|
-
|
|
130
|
+
### Using Agents
|
|
93
131
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| `--out <dir>` | Output directory | `./dist` |
|
|
98
|
-
| `--scope <scope>` | npm scope | `@agentdef` |
|
|
99
|
-
| `--previous <path>` | Previous agent.json for version diff | — |
|
|
132
|
+
```bash
|
|
133
|
+
# Call a tool
|
|
134
|
+
adk ref call notion notion-search '{"query": "meeting notes"}'
|
|
100
135
|
|
|
101
|
-
|
|
136
|
+
# Inspect available tools
|
|
137
|
+
adk ref inspect notion
|
|
138
|
+
adk ref inspect notion --full # Include full input schemas
|
|
102
139
|
|
|
103
|
-
|
|
104
|
-
adk
|
|
105
|
-
# ✅ Packed @agentdef/notion@1.1.0
|
|
106
|
-
# Added: new-tool
|
|
107
|
-
# Removed: deprecated-tool
|
|
108
|
-
# Modified: search (inputSchema changed)
|
|
109
|
-
```
|
|
140
|
+
# List resources
|
|
141
|
+
adk ref resources notion
|
|
110
142
|
|
|
111
|
-
|
|
143
|
+
# Read a resource
|
|
144
|
+
adk ref read notion resource://docs/readme
|
|
112
145
|
|
|
113
|
-
|
|
146
|
+
# List all connected agents
|
|
147
|
+
adk ref list
|
|
148
|
+
```
|
|
114
149
|
|
|
115
|
-
|
|
116
|
-
- **Out-of-order version** — refuses to clobber `latest` tag
|
|
117
|
-
- **Auth failures** — hints to `npm login` or set `NPM_TOKEN`
|
|
150
|
+
### Managing Registries
|
|
118
151
|
|
|
119
152
|
```bash
|
|
120
|
-
|
|
121
|
-
adk
|
|
122
|
-
adk publish --tag beta
|
|
123
|
-
adk publish --registry http://localhost:4873
|
|
124
|
-
```
|
|
153
|
+
# Add a registry
|
|
154
|
+
adk registry add https://registry.slash.com --name public
|
|
125
155
|
|
|
126
|
-
|
|
156
|
+
# Browse available agents
|
|
157
|
+
adk registry browse public
|
|
158
|
+
adk registry browse public --query "database"
|
|
127
159
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
| `--dry-run` | Pack without publishing | — |
|
|
131
|
-
| `--tag <tag>` | npm dist-tag | `latest` |
|
|
132
|
-
| `--access <level>` | `public` or `restricted` | `public` |
|
|
133
|
-
| `--registry <url>` | npm registry URL | default npm |
|
|
134
|
-
| + all `pack` options | | |
|
|
160
|
+
# Inspect registry details
|
|
161
|
+
adk registry inspect public
|
|
135
162
|
|
|
136
|
-
|
|
163
|
+
# Test connectivity
|
|
164
|
+
adk registry test
|
|
137
165
|
|
|
166
|
+
# List configured registries
|
|
167
|
+
adk registry list
|
|
138
168
|
```
|
|
139
|
-
✗ @agentdef/notion@1.0.0 already exists in registry
|
|
140
169
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Configuration
|
|
173
|
+
|
|
174
|
+
### consumer-config.json
|
|
175
|
+
|
|
176
|
+
All state lives in `~/.adk/consumer-config.json`. This is the "package.json" of the agent world — registries are like npm registries, refs are like dependencies.
|
|
177
|
+
|
|
178
|
+
```jsonc
|
|
179
|
+
{
|
|
180
|
+
"registries": [
|
|
181
|
+
{ "url": "https://registry.slash.com", "name": "public", "status": "active" }
|
|
182
|
+
],
|
|
183
|
+
"refs": [
|
|
184
|
+
{
|
|
185
|
+
"ref": "notion",
|
|
186
|
+
"scheme": "registry",
|
|
187
|
+
"sourceRegistry": { "url": "https://registry.slash.com", "agentPath": "notion" },
|
|
188
|
+
"config": {
|
|
189
|
+
"access_token": "secret:v1:aes-256-gcm:base64encodedciphertext..."
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
144
194
|
```
|
|
145
195
|
|
|
196
|
+
Config values prefixed with `secret:` are encrypted. Plain values are stored as-is.
|
|
197
|
+
|
|
198
|
+
### Encrypted Secrets
|
|
199
|
+
|
|
200
|
+
Secrets (OAuth tokens, API keys) are encrypted with AES-256-GCM before being stored in `consumer-config.json`. The encryption key lives at `~/.adk/.encryption-key` — a random 32-byte hex string auto-generated on first use.
|
|
201
|
+
|
|
146
202
|
```
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
203
|
+
~/.adk/
|
|
204
|
+
├── consumer-config.json # Refs, registries, encrypted secrets
|
|
205
|
+
├── .encryption-key # AES-256-GCM key (auto-generated)
|
|
206
|
+
└── refs/
|
|
207
|
+
└── notion/
|
|
208
|
+
├── tools/ # Materialized tool schemas
|
|
209
|
+
├── skills/ # Downloaded skill files
|
|
210
|
+
└── types/ # Generated TypeScript types
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Security note:** The `.encryption-key` file is currently readable by any process running as the same user, which means a coding agent can technically read it. We plan to lock this down with `0600` permissions and potentially OS keychain integration in a future release. For now, secrets are protected against casual inspection of the config file, but not against a determined local process.
|
|
214
|
+
|
|
215
|
+
Override the encryption key via environment variable:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
export ADK_ENCRYPTION_KEY="your-custom-key"
|
|
151
219
|
```
|
|
152
220
|
|
|
153
221
|
---
|
|
154
222
|
|
|
155
|
-
##
|
|
223
|
+
## Creating a Registry Server
|
|
156
224
|
|
|
157
|
-
|
|
225
|
+
A registry is a collection of agents (MCP servers) hosted behind a single endpoint. Use `createAgentServer` to host your own:
|
|
158
226
|
|
|
159
|
-
|
|
227
|
+
```typescript
|
|
228
|
+
import { defineAgent, defineTool, createAgentRegistry, createAgentServer } from '@slashfi/agents-sdk';
|
|
160
229
|
|
|
161
|
-
|
|
162
|
-
|
|
230
|
+
// Define agents
|
|
231
|
+
const searchTool = defineTool({
|
|
232
|
+
name: 'search',
|
|
233
|
+
description: 'Search the database',
|
|
234
|
+
inputSchema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] },
|
|
235
|
+
execute: async ({ query }) => ({ results: [] }),
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
const searchAgent = defineAgent({
|
|
239
|
+
path: 'search',
|
|
240
|
+
entrypoint: 'A search agent',
|
|
241
|
+
config: { name: 'Search', description: 'Search the database' },
|
|
242
|
+
tools: [searchTool],
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Create registry and register agents
|
|
246
|
+
const registry = createAgentRegistry();
|
|
247
|
+
registry.register(searchAgent);
|
|
248
|
+
|
|
249
|
+
// Start the server
|
|
250
|
+
const server = createAgentServer(registry, { port: 3000 });
|
|
251
|
+
await server.start();
|
|
252
|
+
// Clients can now: adk registry add http://localhost:3000 --name my-registry
|
|
163
253
|
```
|
|
164
254
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
255
|
+
The server exposes:
|
|
256
|
+
- **MCP JSON-RPC** (`POST /`) — standard MCP protocol (tools/list, tools/call)
|
|
257
|
+
- **Agent discovery** (`GET /agents`) — list all public agents
|
|
258
|
+
- **Agent actions** (`POST /call`) — call_agent, list_agents
|
|
259
|
+
- **Health check** (`GET /health`)
|
|
168
260
|
|
|
169
|
-
|
|
170
|
-
|
|
261
|
+
Clients connect with:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
adk registry add http://localhost:3000 --name my-registry
|
|
265
|
+
adk registry browse my-registry
|
|
266
|
+
adk ref add search --registry my-registry
|
|
171
267
|
```
|
|
172
268
|
|
|
173
|
-
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Proxy (Experimental)
|
|
174
272
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
273
|
+
Proxies let you forward `adk` operations to a remote server. This is useful when you want a central server to manage refs and registries on behalf of multiple users (e.g., a team server that holds shared credentials).
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Point adk at a remote server
|
|
277
|
+
adk proxy add https://my-team-server.com --name team --type mcp --default
|
|
278
|
+
|
|
279
|
+
# Now ref/registry operations are forwarded to the proxy
|
|
280
|
+
adk ref list # forwarded to team server
|
|
281
|
+
adk ref add notion # forwarded to team server
|
|
178
282
|
```
|
|
179
283
|
|
|
180
|
-
|
|
284
|
+
**Status:** Experimental. The basic add/remove/list flow works, but auth forwarding and multi-proxy routing are still being stabilized.
|
|
181
285
|
|
|
182
|
-
|
|
286
|
+
---
|
|
183
287
|
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
// Agent identity
|
|
187
|
-
"path": "notion",
|
|
188
|
-
"name": "Notion MCP Server",
|
|
189
|
-
"description": "Agent for Notion API",
|
|
190
|
-
"version": "1.0.0",
|
|
191
|
-
"visibility": "public",
|
|
192
|
-
|
|
193
|
-
// MCP server source (for re-introspection)
|
|
194
|
-
"serverSource": "npx @notionhq/notion-mcp-server",
|
|
195
|
-
"serverInfo": { "name": "Notion MCP Server", "version": "1.6.2" },
|
|
196
|
-
|
|
197
|
-
// Shared JSON Schema $defs (deduplicated across tools)
|
|
198
|
-
"$defs": { ... },
|
|
199
|
-
|
|
200
|
-
// Tool definitions
|
|
201
|
-
"tools": [
|
|
202
|
-
{
|
|
203
|
-
"name": "API-post-search",
|
|
204
|
-
"description": "Search Notion pages and databases",
|
|
205
|
-
"inputSchema": {
|
|
206
|
-
"type": "object",
|
|
207
|
-
"properties": {
|
|
208
|
-
"query": { "type": "string" }
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
// ...
|
|
213
|
-
],
|
|
288
|
+
## Using ADK as an SDK
|
|
214
289
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
290
|
+
The `adk` CLI is built on a pluggable SDK. The core `createAdk(fs)` factory takes an `FsStore` interface — just `readFile` and `writeFile` — so you can back it with anything:
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
import { createAdk } from '@slashfi/agents-sdk';
|
|
294
|
+
import type { FsStore } from '@slashfi/agents-sdk';
|
|
295
|
+
|
|
296
|
+
// Local filesystem (what the CLI uses)
|
|
297
|
+
import { createLocalFsStore } from '@slashfi/agents-sdk';
|
|
298
|
+
const adk = createAdk(createLocalFsStore());
|
|
299
|
+
|
|
300
|
+
// In-memory (for testing)
|
|
301
|
+
const memFs: FsStore = {
|
|
302
|
+
_files: new Map<string, string>(),
|
|
303
|
+
async readFile(path) { return this._files.get(path) ?? null; },
|
|
304
|
+
async writeFile(path, content) { this._files.set(path, content); },
|
|
305
|
+
};
|
|
306
|
+
const testAdk = createAdk(memFs);
|
|
307
|
+
|
|
308
|
+
// S3-backed (for serverless)
|
|
309
|
+
const s3Fs: FsStore = {
|
|
310
|
+
async readFile(path) { return getFromS3(`adk/${path}`); },
|
|
311
|
+
async writeFile(path, content) { await putToS3(`adk/${path}`, content); },
|
|
312
|
+
};
|
|
313
|
+
const serverlessAdk = createAdk(s3Fs, { encryptionKey: process.env.ADK_KEY });
|
|
219
314
|
```
|
|
220
315
|
|
|
221
|
-
|
|
316
|
+
The `Adk` object exposes the same API the CLI uses:
|
|
222
317
|
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
"toolsAdded": ["new-tool"],
|
|
235
|
-
"toolsRemoved": [],
|
|
236
|
-
"toolsModified": ["search"],
|
|
237
|
-
"schemaChanges": ["search: added property 'filter'"]
|
|
238
|
-
}
|
|
239
|
-
}
|
|
318
|
+
```typescript
|
|
319
|
+
// Manage registries
|
|
320
|
+
await adk.registry.add({ url: 'https://registry.slash.com', name: 'public' });
|
|
321
|
+
const agents = await adk.registry.browse('public');
|
|
322
|
+
|
|
323
|
+
// Manage refs
|
|
324
|
+
await adk.ref.add({ ref: 'notion', scheme: 'registry', sourceRegistry: { url: '...', agentPath: 'notion' } });
|
|
325
|
+
const result = await adk.ref.call('notion', 'notion-search', { query: 'hello' });
|
|
326
|
+
|
|
327
|
+
// Read/write config directly
|
|
328
|
+
const config = await adk.readConfig();
|
|
240
329
|
```
|
|
241
330
|
|
|
331
|
+
This makes it straightforward to embed `adk` in a server, a CI pipeline, or any environment where the local filesystem isn't available.
|
|
332
|
+
|
|
242
333
|
---
|
|
243
334
|
|
|
244
335
|
## Runtime API
|
|
@@ -278,7 +369,7 @@ const agent = defineAgent({
|
|
|
278
369
|
|
|
279
370
|
### `createClient(definition)`
|
|
280
371
|
|
|
281
|
-
Create a typed client from a `SerializedAgentDefinition`.
|
|
372
|
+
Create a typed client from a `SerializedAgentDefinition`.
|
|
282
373
|
|
|
283
374
|
```typescript
|
|
284
375
|
import { createClient } from '@slashfi/agents-sdk';
|
|
@@ -354,18 +445,6 @@ interface SerializedAgentDefinition {
|
|
|
354
445
|
|
|
355
446
|
All JSON files read by `adk` support JSONC (JSON with Comments):
|
|
356
447
|
|
|
357
|
-
```jsonc
|
|
358
|
-
{
|
|
359
|
-
// This is a comment
|
|
360
|
-
"name": "notion",
|
|
361
|
-
"tools": [
|
|
362
|
-
/* multi-line
|
|
363
|
-
comment */
|
|
364
|
-
{ "name": "search" }
|
|
365
|
-
], // trailing commas are fine
|
|
366
|
-
}
|
|
367
|
-
```
|
|
368
|
-
|
|
369
448
|
```typescript
|
|
370
449
|
import { parseJsonc, readJsoncFile } from '@slashfi/agents-sdk';
|
|
371
450
|
|
|
@@ -377,52 +456,27 @@ const file = readJsoncFile('./config.jsonc');
|
|
|
377
456
|
|
|
378
457
|
## Testing
|
|
379
458
|
|
|
380
|
-
### Unit tests (tarball round-trip)
|
|
381
|
-
|
|
382
459
|
```bash
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
Tests: pack → npm pack → install tarball → import → verify → version diff.
|
|
387
|
-
|
|
388
|
-
### Integration tests (verdaccio)
|
|
460
|
+
# Unit tests
|
|
461
|
+
bun test
|
|
389
462
|
|
|
390
|
-
|
|
463
|
+
# E2E tarball round-trip
|
|
464
|
+
bun test/e2e-adk.ts
|
|
391
465
|
|
|
392
|
-
|
|
393
|
-
# Start verdaccio
|
|
466
|
+
# Integration tests with local registry
|
|
394
467
|
npx verdaccio --config test/verdaccio-config.yaml --listen 4873
|
|
395
|
-
|
|
396
|
-
# Run tests (in another terminal)
|
|
397
468
|
bun test/e2e-verdaccio.ts
|
|
398
469
|
```
|
|
399
470
|
|
|
400
|
-
Tests: publish v1 → install → publish v2 → npm update → pinned install → version listing.
|
|
401
|
-
|
|
402
471
|
---
|
|
403
472
|
|
|
404
|
-
##
|
|
473
|
+
## Environment Variables
|
|
405
474
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
├── jsonc.ts # JSONC parser
|
|
412
|
-
├── codegen.ts # Full codegen (TypeScript types, CLI, manifest)
|
|
413
|
-
├── serialized.ts # SerializedAgentDefinition type
|
|
414
|
-
├── client.ts # createClient()
|
|
415
|
-
├── define.ts # defineAgent(), defineTool()
|
|
416
|
-
├── registry.ts # Agent registry
|
|
417
|
-
├── server.ts # HTTP server
|
|
418
|
-
├── index.ts # Public API exports
|
|
419
|
-
└── ...
|
|
420
|
-
|
|
421
|
-
test/
|
|
422
|
-
├── e2e-adk.ts # Tarball round-trip test
|
|
423
|
-
├── e2e-verdaccio.ts # Full registry lifecycle test
|
|
424
|
-
└── verdaccio-config.yaml # Local registry config
|
|
425
|
-
```
|
|
475
|
+
| Variable | Description | Default |
|
|
476
|
+
|----------|-------------|--------|
|
|
477
|
+
| `ADK_CONFIG_DIR` | Config directory | `~/.adk` |
|
|
478
|
+
| `ADK_TOKEN` | Bearer token for authenticated registries | — |
|
|
479
|
+
| `ADK_ENCRYPTION_KEY` | Override encryption key | auto from `~/.adk/.encryption-key` |
|
|
426
480
|
|
|
427
481
|
---
|
|
428
482
|
|
package/dist/adk.js
CHANGED
|
@@ -37,6 +37,41 @@ function getArg(flag) {
|
|
|
37
37
|
function hasFlag(flag) {
|
|
38
38
|
return args.includes(flag);
|
|
39
39
|
}
|
|
40
|
+
function wantsHelp() {
|
|
41
|
+
return args.includes("--help") || args.includes("-h");
|
|
42
|
+
}
|
|
43
|
+
const HELP_SECTIONS = {
|
|
44
|
+
proxy: `Proxy operations:
|
|
45
|
+
adk proxy add <url> --name <name> [--type mcp|registry] [--agent @config] [--default]
|
|
46
|
+
adk proxy remove <name>
|
|
47
|
+
adk proxy list`,
|
|
48
|
+
registry: `Registry operations:
|
|
49
|
+
adk registry add <url> --name <name> [--auth-type bearer|api-key|none]
|
|
50
|
+
adk registry remove <name>
|
|
51
|
+
adk registry list
|
|
52
|
+
adk registry browse <name> [--query <q>]
|
|
53
|
+
adk registry inspect <name>
|
|
54
|
+
adk registry test [name]`,
|
|
55
|
+
ref: `Ref operations:
|
|
56
|
+
adk ref add <name> Install from default (public) registry
|
|
57
|
+
adk ref add <name> --registry <reg> Install from a specific registry
|
|
58
|
+
adk ref add <name> --url <url> Install from a direct URL
|
|
59
|
+
adk ref remove <name>
|
|
60
|
+
adk ref list
|
|
61
|
+
adk ref get <name>
|
|
62
|
+
adk ref inspect <name> [--full]
|
|
63
|
+
adk ref call <name> <tool> [params_json]
|
|
64
|
+
adk ref resources <name>
|
|
65
|
+
adk ref read <name> <uri> [uri...]
|
|
66
|
+
adk ref auth <name> [--api-key <key>]
|
|
67
|
+
adk ref auth-status <name>
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
adk ref add notion # Install from public registry
|
|
71
|
+
adk ref add notion --registry internal # Install from "internal" registry
|
|
72
|
+
adk ref add myapi --url https://api.example.com/mcp
|
|
73
|
+
adk ref call notion notion-search '{"query":"hello"}'`,
|
|
74
|
+
};
|
|
40
75
|
function getAdk() {
|
|
41
76
|
const token = process.env.ADK_TOKEN ?? undefined;
|
|
42
77
|
const encryptionKey = getLocalEncryptionKey();
|
|
@@ -107,6 +142,10 @@ Examples:
|
|
|
107
142
|
// Commands
|
|
108
143
|
// ============================================
|
|
109
144
|
async function runProxy() {
|
|
145
|
+
if (wantsHelp()) {
|
|
146
|
+
console.log(HELP_SECTIONS.proxy);
|
|
147
|
+
process.exit(0);
|
|
148
|
+
}
|
|
110
149
|
const op = args[1];
|
|
111
150
|
const adk = getAdk();
|
|
112
151
|
switch (op) {
|
|
@@ -159,6 +198,10 @@ async function runProxy() {
|
|
|
159
198
|
// Registry CLI
|
|
160
199
|
// ============================================
|
|
161
200
|
async function runRegistry() {
|
|
201
|
+
if (wantsHelp()) {
|
|
202
|
+
console.log(HELP_SECTIONS.registry);
|
|
203
|
+
process.exit(0);
|
|
204
|
+
}
|
|
162
205
|
const op = args[1];
|
|
163
206
|
const adk = getAdk();
|
|
164
207
|
switch (op) {
|
|
@@ -259,6 +302,10 @@ async function runRegistry() {
|
|
|
259
302
|
// Ref CLI
|
|
260
303
|
// ============================================
|
|
261
304
|
async function runRef() {
|
|
305
|
+
if (wantsHelp()) {
|
|
306
|
+
console.log(HELP_SECTIONS.ref);
|
|
307
|
+
process.exit(0);
|
|
308
|
+
}
|
|
262
309
|
const op = args[1];
|
|
263
310
|
const adk = getAdk();
|
|
264
311
|
switch (op) {
|