agentx-sdk 0.2.1 → 0.3.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 +629 -25
- package/dist/config/config.d.ts +4 -4
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +3 -2
- package/dist/config/config.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/llm/message-types.d.ts +0 -6
- package/dist/llm/message-types.d.ts.map +1 -1
- package/dist/memory/memory-paths.d.ts +6 -1
- package/dist/memory/memory-paths.d.ts.map +1 -1
- package/dist/memory/memory-paths.js +13 -5
- package/dist/memory/memory-paths.js.map +1 -1
- package/package.json +4 -2
- package/dist/llm/openrouter-client.d.ts +0 -3
- package/dist/llm/openrouter-client.d.ts.map +0 -1
- package/dist/llm/openrouter-client.js +0 -3
- package/dist/llm/openrouter-client.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,595 @@
|
|
|
1
1
|
# AgentX SDK
|
|
2
2
|
|
|
3
|
+
TypeScript library for building conversational agents with LLMs. Streaming-first, tools, memory, knowledge/RAG, skills and MCP — all in-process, no frameworks.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install agentx-sdk
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from 'agentx-sdk';
|
|
13
|
+
|
|
14
|
+
// Works with any OpenAI-compatible API (OpenRouter, OpenAI, Azure, Groq, etc.)
|
|
15
|
+
const agent = Agent.create({
|
|
16
|
+
apiKey: process.env.LLM_API_KEY!,
|
|
17
|
+
// baseUrl: 'https://api.openai.com/v1', // optional — defaults to OpenRouter
|
|
18
|
+
// model: 'gpt-4o', // optional — defaults to Claude Sonnet
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Simple chat
|
|
22
|
+
const response = await agent.chat('What is the capital of France?');
|
|
23
|
+
|
|
24
|
+
// Streaming
|
|
25
|
+
for await (const event of agent.stream('Explain recursion')) {
|
|
26
|
+
if (event.type === 'text_delta') process.stdout.write(event.content);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Separate embedding provider (e.g. OpenAI direct for lower latency)
|
|
30
|
+
const agentWithEmbeddings = Agent.create({
|
|
31
|
+
apiKey: process.env.LLM_API_KEY!,
|
|
32
|
+
embedding: {
|
|
33
|
+
apiKey: process.env.OPENAI_API_KEY!,
|
|
34
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
35
|
+
model: 'text-embedding-3-small',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Tools
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { z } from 'zod';
|
|
44
|
+
|
|
45
|
+
agent.addTool({
|
|
46
|
+
name: 'weather',
|
|
47
|
+
description: 'Get current weather for a city',
|
|
48
|
+
parameters: z.object({ city: z.string() }),
|
|
49
|
+
execute: async ({ city }) => {
|
|
50
|
+
const res = await fetch(`https://api.weather.com/${city}`);
|
|
51
|
+
return await res.text();
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
await agent.chat('What is the weather in Sao Paulo?');
|
|
56
|
+
// The agent decides to call the tool automatically
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Builtin Tools
|
|
60
|
+
|
|
61
|
+
The SDK includes ready-to-use tools — filesystem, shell, web and interaction:
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { Agent, builtinTools } from 'agentx-sdk';
|
|
65
|
+
|
|
66
|
+
const agent = Agent.create({ apiKey: '...' });
|
|
67
|
+
|
|
68
|
+
// Register all (except askUser which needs a callback)
|
|
69
|
+
builtinTools.all().forEach(t => agent.addTool(t));
|
|
70
|
+
|
|
71
|
+
// Or register individually
|
|
72
|
+
agent.addTool(builtinTools.fileRead());
|
|
73
|
+
agent.addTool(builtinTools.fileWrite());
|
|
74
|
+
agent.addTool(builtinTools.fileEdit());
|
|
75
|
+
agent.addTool(builtinTools.glob());
|
|
76
|
+
agent.addTool(builtinTools.grep());
|
|
77
|
+
agent.addTool(builtinTools.bash());
|
|
78
|
+
agent.addTool(builtinTools.webFetch());
|
|
79
|
+
|
|
80
|
+
// askUser needs a callback — you implement the interaction
|
|
81
|
+
agent.addTool(builtinTools.askUser({
|
|
82
|
+
onAsk: async (question, options) => {
|
|
83
|
+
// Your logic (readline, UI, API, etc.)
|
|
84
|
+
return readline.question(question);
|
|
85
|
+
},
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
// Shortcut: file ops only (read + write + edit + glob + grep)
|
|
89
|
+
builtinTools.fileOps().forEach(t => agent.addTool(t));
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
| Tool | Name | Description |
|
|
93
|
+
|------|------|-------------|
|
|
94
|
+
| `builtinTools.fileRead()` | Read | Read files with line numbers and offset/limit |
|
|
95
|
+
| `builtinTools.fileWrite()` | Write | Write/create files (creates dirs automatically) |
|
|
96
|
+
| `builtinTools.fileEdit()` | Edit | Exact find/replace in files |
|
|
97
|
+
| `builtinTools.glob()` | Glob | Search files by pattern (`**/*.ts`) |
|
|
98
|
+
| `builtinTools.grep()` | Grep | Search content via regex in files |
|
|
99
|
+
| `builtinTools.bash()` | Bash | Execute shell commands with timeout |
|
|
100
|
+
| `builtinTools.webFetch()` | WebFetch | Fetch content from URL (HTML → text) |
|
|
101
|
+
| `builtinTools.askUser()` | AskUser | Ask the user a question (callback pattern) |
|
|
102
|
+
|
|
103
|
+
## Skills
|
|
104
|
+
|
|
105
|
+
Skills are modular behaviors that modify the agent when activated. Unlike tools (which the LLM calls to obtain data), skills **inject instructions into the context** to guide LLM behavior.
|
|
106
|
+
|
|
107
|
+
### Programmatic skill
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
agent.addSkill({
|
|
111
|
+
name: 'code-review',
|
|
112
|
+
description: 'Reviews code for quality and bugs',
|
|
113
|
+
instructions: `You are in code review mode.
|
|
114
|
+
Analyze for bugs, security issues, and performance.
|
|
115
|
+
Rate quality from 1-10.`,
|
|
116
|
+
triggerPrefix: '/review',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
await agent.chat('/review function add(a, b) { return a + b; }');
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Skill with arguments
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
agent.addSkill({
|
|
126
|
+
name: 'translate',
|
|
127
|
+
description: 'Translates text to a target language',
|
|
128
|
+
instructions: 'Translate the following to $lang: $ARGS',
|
|
129
|
+
argNames: ['lang'],
|
|
130
|
+
triggerPrefix: '/translate',
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// $lang = "pt", $ARGS = "Hello world"
|
|
134
|
+
await agent.chat('/translate pt Hello world');
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Skill with dynamic prompt
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
agent.addSkill({
|
|
141
|
+
name: 'explain',
|
|
142
|
+
description: 'Explains code at different levels',
|
|
143
|
+
instructions: '',
|
|
144
|
+
triggerPrefix: '/explain',
|
|
145
|
+
argNames: ['level'],
|
|
146
|
+
getPrompt: async (args, ctx) => {
|
|
147
|
+
const level = args.split(' ')[0] || 'intermediate';
|
|
148
|
+
return `Explain for a ${level} developer. Thread: ${ctx.threadId}`;
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
await agent.chat('/explain beginner What is a closure?');
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Skill with its own tools
|
|
156
|
+
|
|
157
|
+
Tools registered in the skill are activated **only when the skill is active** and removed at the end of the turn.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
agent.addSkill({
|
|
161
|
+
name: 'file-manager',
|
|
162
|
+
description: 'File management operations',
|
|
163
|
+
instructions: 'You can read files using the read_file tool.',
|
|
164
|
+
triggerPrefix: '/files',
|
|
165
|
+
tools: [
|
|
166
|
+
{
|
|
167
|
+
name: 'read_file',
|
|
168
|
+
description: 'Read a file from disk',
|
|
169
|
+
parameters: z.object({ path: z.string() }),
|
|
170
|
+
execute: async ({ path }) => {
|
|
171
|
+
const fs = await import('fs/promises');
|
|
172
|
+
return fs.readFile(path as string, 'utf-8');
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Skill with model discovery (whenToUse)
|
|
180
|
+
|
|
181
|
+
Skills with `whenToUse` are listed in the model context so it can proactively suggest them.
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
agent.addSkill({
|
|
185
|
+
name: 'deploy',
|
|
186
|
+
description: 'Deploy to production',
|
|
187
|
+
whenToUse: 'When user mentions deploy, release, ship, or push to prod',
|
|
188
|
+
instructions: 'Guide the user through deployment steps...',
|
|
189
|
+
// No triggerPrefix — activates via semantic matching or model suggestion
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Skill via SKILL.md file
|
|
194
|
+
|
|
195
|
+
Create markdown files with YAML frontmatter in a directory:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
.skills/
|
|
199
|
+
code-review/
|
|
200
|
+
SKILL.md
|
|
201
|
+
translate/
|
|
202
|
+
SKILL.md
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**`.skills/code-review/SKILL.md`:**
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
---
|
|
209
|
+
name: code-review
|
|
210
|
+
description: Reviews code for quality and bugs
|
|
211
|
+
whenToUse: When user asks to review, audit, or check code quality
|
|
212
|
+
triggerPrefix: /review
|
|
213
|
+
aliases: [cr, audit]
|
|
214
|
+
argNames: [file]
|
|
215
|
+
allowedTools: [Read, Grep]
|
|
216
|
+
priority: 8
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
You are in code review mode.
|
|
220
|
+
Review $file for bugs, security issues, and performance.
|
|
221
|
+
Skill directory: ${SKILL_DIR}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Loading:**
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
// Via config (auto-load in constructor)
|
|
228
|
+
const agent = Agent.create({
|
|
229
|
+
apiKey: '...',
|
|
230
|
+
skills: { skillsDir: './.skills' },
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Or manually
|
|
234
|
+
await agent.loadSkillsDir('./.skills');
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Conditional skill (path-activated)
|
|
238
|
+
|
|
239
|
+
Skills with `paths` remain inactive until a matching file is touched.
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
agent.addSkill({
|
|
243
|
+
name: 'ts-linter',
|
|
244
|
+
description: 'TypeScript linting rules',
|
|
245
|
+
instructions: 'Apply strict TypeScript linting...',
|
|
246
|
+
paths: ['src/**/*.ts', 'tests/**/*.ts'],
|
|
247
|
+
match: () => true,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// Activates when a file is touched
|
|
251
|
+
agent.activateSkillsForPaths(['src/agent.ts']);
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Exclusive skill
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
agent.addSkill({
|
|
258
|
+
name: 'focus-mode',
|
|
259
|
+
description: 'Deep focus on a single task',
|
|
260
|
+
instructions: 'Focus exclusively on the current task.',
|
|
261
|
+
triggerPrefix: '/focus',
|
|
262
|
+
exclusive: true, // blocks all other skills
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Frontmatter reference (SKILL.md)
|
|
267
|
+
|
|
268
|
+
| Field | Type | Description |
|
|
269
|
+
|-------|------|-------------|
|
|
270
|
+
| `name` | string | Unique skill name |
|
|
271
|
+
| `description` | string | Short description |
|
|
272
|
+
| `whenToUse` | string | Usage scenarios (for model discovery) |
|
|
273
|
+
| `triggerPrefix` | string | Activation prefix (e.g. `/review`) |
|
|
274
|
+
| `aliases` | string[] | Alternative names |
|
|
275
|
+
| `argNames` | string[] | Argument names for substitution |
|
|
276
|
+
| `allowedTools` | string[] | Tools the skill can use |
|
|
277
|
+
| `model` | string | Model override |
|
|
278
|
+
| `context` | `inline` \| `fork` | Execution mode |
|
|
279
|
+
| `paths` | string[] | Globs for conditional activation |
|
|
280
|
+
| `effort` | number | Computational effort hint (1-10) |
|
|
281
|
+
| `exclusive` | boolean | Blocks other skills |
|
|
282
|
+
| `priority` | number | Priority (higher wins) |
|
|
283
|
+
| `modelInvocable` | boolean | Whether the model can invoke (default: true) |
|
|
284
|
+
|
|
285
|
+
### Skills API
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
agent.addSkill(skill) // register
|
|
289
|
+
agent.removeSkill('name') // remove
|
|
290
|
+
agent.listSkills() // list
|
|
291
|
+
await agent.loadSkillsDir('./skills') // load from directory
|
|
292
|
+
agent.activateSkillsForPaths(['file.ts']) // activate conditionals
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Matching hierarchy
|
|
296
|
+
|
|
297
|
+
Skills are evaluated at 4 levels (most specific first):
|
|
298
|
+
|
|
299
|
+
1. **Prefix** — `input.startsWith(triggerPrefix)` (score 1.0)
|
|
300
|
+
2. **Alias** — `input.startsWith(/alias)` (score 0.95)
|
|
301
|
+
3. **Custom** — `skill.match(input)` returns true (score 0.8)
|
|
302
|
+
4. **Semantic** — cosine similarity > 0.7 with `description + whenToUse` (requires EmbeddingService)
|
|
303
|
+
|
|
304
|
+
Maximum of 3 simultaneously active skills (configurable via `skills.maxActiveSkills`).
|
|
305
|
+
|
|
306
|
+
## Memory
|
|
307
|
+
|
|
308
|
+
Persistent file-based memory system inspired by Claude Code.
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// Save memory explicitly
|
|
312
|
+
await agent.remember('User prefers dark mode', 'user');
|
|
313
|
+
|
|
314
|
+
// Search relevant memories
|
|
315
|
+
const memories = await agent.recall('What are the user preferences?');
|
|
316
|
+
|
|
317
|
+
// Automatic extraction: after each turn, the agent extracts memories
|
|
318
|
+
// from the conversation in the background (fire-and-forget)
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Memories are `.md` files with YAML frontmatter in `.agentx/memory/` (configurable). Four types: `user`, `feedback`, `project`, `reference`.
|
|
322
|
+
|
|
323
|
+
## Knowledge (RAG)
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
await agent.ingestKnowledge({
|
|
327
|
+
id: 'docs-api',
|
|
328
|
+
content: apiDocs,
|
|
329
|
+
metadata: { source: 'api-docs.md' },
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// The agent automatically searches knowledge when relevant
|
|
333
|
+
await agent.chat('How do I authenticate with the API?');
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## MCP (Model Context Protocol)
|
|
337
|
+
|
|
338
|
+
Connect to any MCP server to extend agent capabilities with external tools, resources and prompts.
|
|
339
|
+
|
|
340
|
+
### Basic connection
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
await agent.connectMCP({
|
|
344
|
+
name: 'github',
|
|
345
|
+
transport: 'stdio',
|
|
346
|
+
command: 'npx',
|
|
347
|
+
args: ['-y', '@modelcontextprotocol/server-github'],
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Server tools are registered automatically (mcp__github__create_issue, etc.)
|
|
351
|
+
await agent.chat('List my open PRs');
|
|
352
|
+
await agent.disconnectMCP('github');
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Supported transports
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
// Stdio — local subprocess (Node, Python, Rust MCP servers)
|
|
359
|
+
await agent.connectMCP({
|
|
360
|
+
name: 'local-server',
|
|
361
|
+
transport: 'stdio',
|
|
362
|
+
command: 'npx',
|
|
363
|
+
args: ['-y', '@modelcontextprotocol/server-filesystem'],
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// SSE — Server-Sent Events (long-lived connection)
|
|
367
|
+
await agent.connectMCP({
|
|
368
|
+
name: 'remote-sse',
|
|
369
|
+
transport: 'sse',
|
|
370
|
+
url: 'https://mcp.example.com/sse',
|
|
371
|
+
headers: { 'Authorization': 'Bearer sk-...' },
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
// HTTP — Streamable HTTP (modern servers, bidirectional)
|
|
375
|
+
await agent.connectMCP({
|
|
376
|
+
name: 'remote-http',
|
|
377
|
+
transport: 'http',
|
|
378
|
+
url: 'https://mcp.example.com/v1',
|
|
379
|
+
headers: { 'Authorization': 'Bearer sk-...' },
|
|
380
|
+
});
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Automatic tool annotations
|
|
384
|
+
|
|
385
|
+
MCP servers that declare `readOnlyHint` or `destructiveHint` in tools are automatically mapped to AgentTool flags:
|
|
386
|
+
|
|
387
|
+
| MCP Annotation | AgentTool Flag | Effect |
|
|
388
|
+
|---|---|---|
|
|
389
|
+
| `readOnlyHint: true` | `isReadOnly: true` + `isConcurrencySafe: true` | Tools run in parallel, no warning |
|
|
390
|
+
| `destructiveHint: true` | `isDestructive: true` | Model receives caution warning |
|
|
391
|
+
|
|
392
|
+
### Server instructions
|
|
393
|
+
|
|
394
|
+
If the MCP server returns `instructions` in the handshake, they are automatically injected into the model context — the agent follows the server's guidance.
|
|
395
|
+
|
|
396
|
+
### MCP Prompts as Skills
|
|
397
|
+
|
|
398
|
+
Prompts that the MCP server offers via `prompts/list` are automatically registered as skills. The model can invoke them via SkillTool:
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
await agent.connectMCP({
|
|
402
|
+
name: 'docs',
|
|
403
|
+
transport: 'stdio',
|
|
404
|
+
command: 'npx',
|
|
405
|
+
args: ['my-docs-server'],
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// If the server has a "summarize" prompt, it becomes a skill: mcp__docs__summarize
|
|
409
|
+
// The model can call: Skill({ skill: "mcp__docs__summarize", args: "..." })
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Resources
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
// List available resources from a server
|
|
416
|
+
const resources = await agent.mcpAdapter.listResources('github');
|
|
417
|
+
// [{ uri: 'repo://owner/project', name: 'Project', serverName: 'github' }]
|
|
418
|
+
|
|
419
|
+
// Read resource content
|
|
420
|
+
const content = await agent.mcpAdapter.readResource('github', 'repo://owner/project');
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Full configuration
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
await agent.connectMCP({
|
|
427
|
+
name: 'my-server',
|
|
428
|
+
transport: 'stdio', // 'stdio' | 'sse' | 'http'
|
|
429
|
+
command: 'npx', // for stdio
|
|
430
|
+
args: ['-y', 'my-mcp-server'],
|
|
431
|
+
// url: 'https://...', // for sse/http
|
|
432
|
+
// headers: { ... }, // for sse/http
|
|
433
|
+
timeout: 30_000, // timeout per tool call (ms)
|
|
434
|
+
maxRetries: 3, // reconnection attempts
|
|
435
|
+
healthCheckInterval: 60_000, // periodic health check (ms)
|
|
436
|
+
isolateErrors: true, // errors don't propagate (default: true)
|
|
437
|
+
});
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Health monitoring
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
const health = agent.getHealth();
|
|
444
|
+
// {
|
|
445
|
+
// servers: [{
|
|
446
|
+
// name: 'github',
|
|
447
|
+
// status: 'connected', // 'connected' | 'disconnected' | 'error' | 'reconnecting'
|
|
448
|
+
// toolCount: 15,
|
|
449
|
+
// uptime: 120000
|
|
450
|
+
// }]
|
|
451
|
+
// }
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Deep JSON Schema
|
|
455
|
+
|
|
456
|
+
MCP tools with complex schemas (nested objects, arrays, enums) are automatically converted to Zod — works with GitHub, Slack, and any server that uses rich schemas:
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
// This works automatically — nested schema converted to Zod
|
|
460
|
+
await agent.chat('Create a GitHub issue with labels bug and urgent');
|
|
461
|
+
// LLM calls: mcp__github__create_issue({
|
|
462
|
+
// owner: "user", repo: "project",
|
|
463
|
+
// title: "...", labels: ["bug", "urgent"]
|
|
464
|
+
// })
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
## Streaming Events
|
|
468
|
+
|
|
469
|
+
```typescript
|
|
470
|
+
for await (const event of agent.stream('Build a TODO app')) {
|
|
471
|
+
switch (event.type) {
|
|
472
|
+
case 'agent_start': // Execution started
|
|
473
|
+
case 'skill_activated': // Skill activated (event.skillName)
|
|
474
|
+
case 'text_delta': // Text chunk (event.content)
|
|
475
|
+
case 'text_done': // Full text complete
|
|
476
|
+
case 'tool_call_start': // Tool called
|
|
477
|
+
case 'tool_call_end': // Tool result
|
|
478
|
+
case 'turn_start': // Loop iteration started
|
|
479
|
+
case 'turn_end': // Loop iteration ended
|
|
480
|
+
case 'agent_end': // Finished (event.usage, event.duration)
|
|
481
|
+
case 'error': // Error (event.recoverable)
|
|
482
|
+
case 'warning': // Warning
|
|
483
|
+
case 'compaction': // Context compacted
|
|
484
|
+
case 'recovery': // Automatic recovery
|
|
485
|
+
case 'model_fallback': // Model fallback
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## Configuration
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
const agent = Agent.create({
|
|
494
|
+
apiKey: 'sk-...',
|
|
495
|
+
baseUrl: 'https://api.openai.com/v1', // optional — any OpenAI-compatible URL
|
|
496
|
+
model: 'gpt-4o',
|
|
497
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
498
|
+
|
|
499
|
+
// Separate embedding provider (optional)
|
|
500
|
+
embedding: {
|
|
501
|
+
apiKey: 'sk-...',
|
|
502
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
503
|
+
model: 'text-embedding-3-small',
|
|
504
|
+
},
|
|
505
|
+
|
|
506
|
+
// Skills
|
|
507
|
+
skills: {
|
|
508
|
+
skillsDir: './.skills', // Auto-load skills from directory
|
|
509
|
+
maxActiveSkills: 3, // Max simultaneous skills
|
|
510
|
+
modelDiscovery: true, // List skills for model context
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
// Memory
|
|
514
|
+
memory: {
|
|
515
|
+
enabled: true,
|
|
516
|
+
memoryDir: '.agentx/memory/',
|
|
517
|
+
extractionEnabled: true,
|
|
518
|
+
samplingRate: 0.3, // 30% chance per turn
|
|
519
|
+
extractionInterval: 10, // Force every 10 turns
|
|
520
|
+
},
|
|
521
|
+
|
|
522
|
+
// Knowledge
|
|
523
|
+
knowledge: {
|
|
524
|
+
enabled: true,
|
|
525
|
+
chunkSize: 512,
|
|
526
|
+
topK: 5,
|
|
527
|
+
minScore: 0.3,
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
// Behavior
|
|
531
|
+
maxIterations: 10,
|
|
532
|
+
onToolError: 'continue', // 'continue' | 'stop' | 'retry'
|
|
533
|
+
|
|
534
|
+
// Cost control
|
|
535
|
+
costPolicy: {
|
|
536
|
+
maxTokensPerExecution: 50_000,
|
|
537
|
+
onLimitReached: 'stop',
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
// Context
|
|
541
|
+
maxContextTokens: 128_000,
|
|
542
|
+
compactionThreshold: 0.8,
|
|
543
|
+
|
|
544
|
+
// Recovery
|
|
545
|
+
fallbackModel: 'anthropic/claude-haiku-4-5-20251001',
|
|
546
|
+
maxOutputTokens: 4096,
|
|
547
|
+
escalatedMaxOutputTokens: 16384,
|
|
548
|
+
|
|
549
|
+
// Observability
|
|
550
|
+
logLevel: 'info',
|
|
551
|
+
});
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
## Pluggable Stores
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
import { Agent } from 'agentx-sdk';
|
|
558
|
+
|
|
559
|
+
// Custom conversation store (e.g. PostgreSQL)
|
|
560
|
+
const agent = Agent.create({
|
|
561
|
+
apiKey: '...',
|
|
562
|
+
conversation: { store: myPostgresConversationStore },
|
|
563
|
+
knowledge: { store: myPineconeVectorStore },
|
|
564
|
+
});
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Interfaces: `ConversationStore`, `VectorStore` — implement to use any backend.
|
|
568
|
+
|
|
569
|
+
## Stack
|
|
570
|
+
|
|
571
|
+
| Layer | Technology |
|
|
572
|
+
|-------|-----------|
|
|
573
|
+
| Language | TypeScript 5.x |
|
|
574
|
+
| Runtime | Node.js 22+ |
|
|
575
|
+
| Validation | Zod 3.x |
|
|
576
|
+
| Persistence | better-sqlite3 + SQLite |
|
|
577
|
+
| Tools schema | zod-to-json-schema |
|
|
578
|
+
| LLM | Any OpenAI-compatible API (native fetch) |
|
|
579
|
+
|
|
580
|
+
**<= 4 direct dependencies.** Zero AI frameworks. No vendor lock-in.
|
|
581
|
+
|
|
582
|
+
## License
|
|
583
|
+
|
|
584
|
+
MIT
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
<details>
|
|
589
|
+
<summary><h1>Portugues</h1></summary>
|
|
590
|
+
|
|
591
|
+
# AgentX SDK
|
|
592
|
+
|
|
3
593
|
Biblioteca TypeScript para construir agentes conversacionais com LLM. Streaming-first, tools, memory, knowledge/RAG, skills e MCP — tudo in-process, sem frameworks.
|
|
4
594
|
|
|
5
595
|
```bash
|
|
@@ -11,7 +601,11 @@ npm install agentx-sdk
|
|
|
11
601
|
```typescript
|
|
12
602
|
import { Agent } from 'agentx-sdk';
|
|
13
603
|
|
|
14
|
-
|
|
604
|
+
// Funciona com qualquer API OpenAI-compatible (OpenRouter, OpenAI, Azure, Groq, etc.)
|
|
605
|
+
const agent = Agent.create({
|
|
606
|
+
apiKey: process.env.LLM_API_KEY!,
|
|
607
|
+
// baseUrl: 'https://api.openai.com/v1', // opcional — default: OpenRouter
|
|
608
|
+
});
|
|
15
609
|
|
|
16
610
|
// Chat simples
|
|
17
611
|
const response = await agent.chat('Qual a capital da Franca?');
|
|
@@ -248,7 +842,7 @@ agent.addSkill({
|
|
|
248
842
|
});
|
|
249
843
|
```
|
|
250
844
|
|
|
251
|
-
###
|
|
845
|
+
### Referencia de frontmatter (SKILL.md)
|
|
252
846
|
|
|
253
847
|
| Campo | Tipo | Descricao |
|
|
254
848
|
|-------|------|-----------|
|
|
@@ -267,7 +861,7 @@ agent.addSkill({
|
|
|
267
861
|
| `priority` | number | Prioridade (maior vence) |
|
|
268
862
|
| `modelInvocable` | boolean | Se o modelo pode invocar (default: true) |
|
|
269
863
|
|
|
270
|
-
### Skills
|
|
864
|
+
### API de Skills
|
|
271
865
|
|
|
272
866
|
```typescript
|
|
273
867
|
agent.addSkill(skill) // registrar
|
|
@@ -277,7 +871,7 @@ await agent.loadSkillsDir('./skills') // carregar de diretorio
|
|
|
277
871
|
agent.activateSkillsForPaths(['file.ts']) // ativar condicionais
|
|
278
872
|
```
|
|
279
873
|
|
|
280
|
-
###
|
|
874
|
+
### Hierarquia de matching
|
|
281
875
|
|
|
282
876
|
Skills sao avaliadas em 4 niveis (mais especifico primeiro):
|
|
283
877
|
|
|
@@ -303,7 +897,7 @@ const memories = await agent.recall('What are the user preferences?');
|
|
|
303
897
|
// da conversa em background (fire-and-forget)
|
|
304
898
|
```
|
|
305
899
|
|
|
306
|
-
Memorias sao arquivos `.md` com frontmatter YAML em
|
|
900
|
+
Memorias sao arquivos `.md` com frontmatter YAML em `.agentx/memory/` (configuravel). Quatro tipos: `user`, `feedback`, `project`, `reference`.
|
|
307
901
|
|
|
308
902
|
## Knowledge (RAG)
|
|
309
903
|
|
|
@@ -348,7 +942,7 @@ await agent.connectMCP({
|
|
|
348
942
|
args: ['-y', '@modelcontextprotocol/server-filesystem'],
|
|
349
943
|
});
|
|
350
944
|
|
|
351
|
-
// SSE — Server-Sent Events (
|
|
945
|
+
// SSE — Server-Sent Events (conexao persistente)
|
|
352
946
|
await agent.connectMCP({
|
|
353
947
|
name: 'remote-sse',
|
|
354
948
|
transport: 'sse',
|
|
@@ -356,7 +950,7 @@ await agent.connectMCP({
|
|
|
356
950
|
headers: { 'Authorization': 'Bearer sk-...' },
|
|
357
951
|
});
|
|
358
952
|
|
|
359
|
-
// HTTP — Streamable HTTP (servers modernos,
|
|
953
|
+
// HTTP — Streamable HTTP (servers modernos, bidirecional)
|
|
360
954
|
await agent.connectMCP({
|
|
361
955
|
name: 'remote-http',
|
|
362
956
|
transport: 'http',
|
|
@@ -365,16 +959,16 @@ await agent.connectMCP({
|
|
|
365
959
|
});
|
|
366
960
|
```
|
|
367
961
|
|
|
368
|
-
###
|
|
962
|
+
### Anotacoes automaticas de tools
|
|
369
963
|
|
|
370
964
|
MCP servers que declaram `readOnlyHint` ou `destructiveHint` nas tools sao mapeados automaticamente para os flags do AgentTool:
|
|
371
965
|
|
|
372
|
-
| MCP
|
|
966
|
+
| Anotacao MCP | Flag AgentTool | Efeito |
|
|
373
967
|
|---|---|---|
|
|
374
968
|
| `readOnlyHint: true` | `isReadOnly: true` + `isConcurrencySafe: true` | Tools executam em paralelo, sem warning |
|
|
375
969
|
| `destructiveHint: true` | `isDestructive: true` | Modelo recebe aviso de cautela |
|
|
376
970
|
|
|
377
|
-
###
|
|
971
|
+
### Instrucoes do server
|
|
378
972
|
|
|
379
973
|
Se o MCP server retorna `instructions` no handshake, elas sao injetadas automaticamente no contexto do modelo — o agente segue as orientacoes do server.
|
|
380
974
|
|
|
@@ -422,7 +1016,7 @@ await agent.connectMCP({
|
|
|
422
1016
|
});
|
|
423
1017
|
```
|
|
424
1018
|
|
|
425
|
-
###
|
|
1019
|
+
### Monitoramento de saude
|
|
426
1020
|
|
|
427
1021
|
```typescript
|
|
428
1022
|
const health = agent.getHealth();
|
|
@@ -472,28 +1066,36 @@ for await (const event of agent.stream('Build a TODO app')) {
|
|
|
472
1066
|
}
|
|
473
1067
|
```
|
|
474
1068
|
|
|
475
|
-
##
|
|
1069
|
+
## Configuracao
|
|
476
1070
|
|
|
477
1071
|
```typescript
|
|
478
1072
|
const agent = Agent.create({
|
|
479
1073
|
apiKey: 'sk-...',
|
|
480
|
-
|
|
1074
|
+
baseUrl: 'https://api.openai.com/v1', // optional — any OpenAI-compatible URL
|
|
1075
|
+
model: 'gpt-4o',
|
|
481
1076
|
systemPrompt: 'You are a helpful assistant.',
|
|
482
1077
|
|
|
1078
|
+
// Separate embedding provider (optional)
|
|
1079
|
+
embedding: {
|
|
1080
|
+
apiKey: 'sk-...',
|
|
1081
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
1082
|
+
model: 'text-embedding-3-small',
|
|
1083
|
+
},
|
|
1084
|
+
|
|
483
1085
|
// Skills
|
|
484
1086
|
skills: {
|
|
485
|
-
skillsDir: './.skills', // Auto-load skills
|
|
486
|
-
maxActiveSkills: 3, // Max
|
|
487
|
-
modelDiscovery: true, //
|
|
1087
|
+
skillsDir: './.skills', // Auto-load de skills do diretorio
|
|
1088
|
+
maxActiveSkills: 3, // Max skills simultaneas
|
|
1089
|
+
modelDiscovery: true, // Listar skills no contexto do modelo
|
|
488
1090
|
},
|
|
489
1091
|
|
|
490
1092
|
// Memory
|
|
491
1093
|
memory: {
|
|
492
1094
|
enabled: true,
|
|
493
|
-
memoryDir: '
|
|
1095
|
+
memoryDir: '.agentx/memory/',
|
|
494
1096
|
extractionEnabled: true,
|
|
495
|
-
samplingRate: 0.3, // 30% chance
|
|
496
|
-
extractionInterval: 10, //
|
|
1097
|
+
samplingRate: 0.3, // 30% de chance por turn
|
|
1098
|
+
extractionInterval: 10, // Forcar a cada 10 turns
|
|
497
1099
|
},
|
|
498
1100
|
|
|
499
1101
|
// Knowledge
|
|
@@ -504,17 +1106,17 @@ const agent = Agent.create({
|
|
|
504
1106
|
minScore: 0.3,
|
|
505
1107
|
},
|
|
506
1108
|
|
|
507
|
-
//
|
|
1109
|
+
// Comportamento
|
|
508
1110
|
maxIterations: 10,
|
|
509
1111
|
onToolError: 'continue', // 'continue' | 'stop' | 'retry'
|
|
510
1112
|
|
|
511
|
-
//
|
|
1113
|
+
// Controle de custo
|
|
512
1114
|
costPolicy: {
|
|
513
1115
|
maxTokensPerExecution: 50_000,
|
|
514
1116
|
onLimitReached: 'stop',
|
|
515
1117
|
},
|
|
516
1118
|
|
|
517
|
-
//
|
|
1119
|
+
// Contexto
|
|
518
1120
|
maxContextTokens: 128_000,
|
|
519
1121
|
compactionThreshold: 0.8,
|
|
520
1122
|
|
|
@@ -523,7 +1125,7 @@ const agent = Agent.create({
|
|
|
523
1125
|
maxOutputTokens: 4096,
|
|
524
1126
|
escalatedMaxOutputTokens: 16384,
|
|
525
1127
|
|
|
526
|
-
//
|
|
1128
|
+
// Observabilidade
|
|
527
1129
|
logLevel: 'info',
|
|
528
1130
|
});
|
|
529
1131
|
```
|
|
@@ -552,10 +1154,12 @@ Interfaces: `ConversationStore`, `VectorStore` — implemente para usar qualquer
|
|
|
552
1154
|
| Validacao | Zod 3.x |
|
|
553
1155
|
| Persistencia | better-sqlite3 + SQLite |
|
|
554
1156
|
| Tools schema | zod-to-json-schema |
|
|
555
|
-
| LLM |
|
|
1157
|
+
| LLM | Qualquer API OpenAI-compatible (fetch nativo) |
|
|
556
1158
|
|
|
557
|
-
**<= 4 dependencias diretas.** Zero frameworks de IA.
|
|
1159
|
+
**<= 4 dependencias diretas.** Zero frameworks de IA. Sem vendor lock-in.
|
|
558
1160
|
|
|
559
1161
|
## License
|
|
560
1162
|
|
|
561
1163
|
MIT
|
|
1164
|
+
|
|
1165
|
+
</details>
|
package/dist/config/config.d.ts
CHANGED
|
@@ -228,7 +228,6 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
228
228
|
deterministic: boolean;
|
|
229
229
|
embeddingModel: string;
|
|
230
230
|
dbPath: string;
|
|
231
|
-
systemPrompt?: string | undefined;
|
|
232
231
|
memory?: {
|
|
233
232
|
enabled: boolean;
|
|
234
233
|
memoryDir: string;
|
|
@@ -238,6 +237,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
238
237
|
extractionInterval: number;
|
|
239
238
|
relevanceModel?: string | undefined;
|
|
240
239
|
} | undefined;
|
|
240
|
+
systemPrompt?: string | undefined;
|
|
241
241
|
knowledge?: {
|
|
242
242
|
enabled: boolean;
|
|
243
243
|
chunkSize: number;
|
|
@@ -287,9 +287,6 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
287
287
|
} | undefined;
|
|
288
288
|
}, {
|
|
289
289
|
apiKey: string;
|
|
290
|
-
baseUrl?: string | undefined;
|
|
291
|
-
model?: string | undefined;
|
|
292
|
-
systemPrompt?: string | undefined;
|
|
293
290
|
memory?: {
|
|
294
291
|
enabled?: boolean | undefined;
|
|
295
292
|
memoryDir?: string | undefined;
|
|
@@ -299,6 +296,9 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
299
296
|
samplingRate?: number | undefined;
|
|
300
297
|
extractionInterval?: number | undefined;
|
|
301
298
|
} | undefined;
|
|
299
|
+
baseUrl?: string | undefined;
|
|
300
|
+
model?: string | undefined;
|
|
301
|
+
systemPrompt?: string | undefined;
|
|
302
302
|
knowledge?: {
|
|
303
303
|
enabled?: boolean | undefined;
|
|
304
304
|
store?: VectorStore | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEtF,0CAA0C;AAC1C,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW7B,CAAC;AAEH,yDAAyD;AACzD,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;EAKpB,CAAC;AAqCH,oDAAoD;AACpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2D5B,CAAC;AAEH,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,4BAA4B;AAC5B,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC7E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/config/config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
/** MCP server connection configuration */
|
|
3
4
|
const MCPConnectionConfigSchema = z.object({
|
|
@@ -22,7 +23,7 @@ const CostPolicySchema = z.object({
|
|
|
22
23
|
/** Memory subsystem configuration (file-based) */
|
|
23
24
|
const MemoryConfigSchema = z.object({
|
|
24
25
|
enabled: z.boolean().default(true),
|
|
25
|
-
memoryDir: z.string().default('
|
|
26
|
+
memoryDir: z.string().default(() => join(process.cwd(), '.agentx', 'memory') + '/'),
|
|
26
27
|
relevanceModel: z.string().optional(),
|
|
27
28
|
maxMemoryFiles: z.number().int().positive().default(200),
|
|
28
29
|
extractionEnabled: z.boolean().default(true),
|
|
@@ -96,6 +97,6 @@ export const AgentConfigSchema = z.object({
|
|
|
96
97
|
// Embedding provider (separate API key/URL for embeddings, e.g. direct OpenAI)
|
|
97
98
|
embedding: EmbeddingProviderConfigSchema.optional(),
|
|
98
99
|
// Database path
|
|
99
|
-
dbPath: z.string().default('
|
|
100
|
+
dbPath: z.string().default(() => join(process.cwd(), '.agentx', 'data.db')),
|
|
100
101
|
});
|
|
101
102
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,0CAA0C;AAC1C,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,OAAO,EAAE,CAA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AE;IAEjC,sCAAsC;IACtC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,+BAA+B,CAAC;IAEnE,+EAA+E;IAC/E,SAAS,EAAE,6BAA6B,CAAC,QAAQ,EAAE;IAEnD,gBAAgB;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;CAC5E,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,11 +33,7 @@ export type { ContextAnalysis } from './core/context-analysis.js';
|
|
|
33
33
|
export { getModelContextWindow } from './utils/model-context.js';
|
|
34
34
|
export { LLMClient } from './llm/llm-client.js';
|
|
35
35
|
export type { LLMClientConfig } from './llm/llm-client.js';
|
|
36
|
-
|
|
37
|
-
export { LLMClient as OpenRouterClient } from './llm/llm-client.js';
|
|
38
|
-
/** @deprecated Use LLMClientConfig instead */
|
|
39
|
-
export type { LLMClientConfig as OpenRouterClientConfig } from './llm/llm-client.js';
|
|
40
|
-
export type { LLMMessage, LLMToolCall, LLMContentPart, StreamChunk, ChatResponse, StreamChatParams, ChatParams, ToolDefinition, ResponseFormat, OpenRouterMessage, OpenRouterToolCall, OpenRouterContentPart, } from './llm/message-types.js';
|
|
36
|
+
export type { LLMMessage, LLMToolCall, LLMContentPart, StreamChunk, ChatResponse, StreamChatParams, ChatParams, ToolDefinition, ResponseFormat, } from './llm/message-types.js';
|
|
41
37
|
export { createLogger } from './utils/logger.js';
|
|
42
38
|
export type { Logger } from './utils/logger.js';
|
|
43
39
|
export { LRUCache } from './utils/cache.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,Y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AA0B,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGnG,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACzF,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3D,YAAY,EACV,UAAU,EAAE,WAAW,EAAE,cAAc,EACvC,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EACvD,cAAc,EAAE,cAAc,GAC/B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -39,8 +39,6 @@ export { analyzeContext } from './core/context-analysis.js';
|
|
|
39
39
|
export { getModelContextWindow } from './utils/model-context.js';
|
|
40
40
|
// LLM Client
|
|
41
41
|
export { LLMClient } from './llm/llm-client.js';
|
|
42
|
-
/** @deprecated Use LLMClient instead */
|
|
43
|
-
export { LLMClient as OpenRouterClient } from './llm/llm-client.js';
|
|
44
42
|
// Utils
|
|
45
43
|
export { createLogger } from './utils/logger.js';
|
|
46
44
|
export { LRUCache } from './utils/cache.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,8BAA8B;AAC9B,cAAc,sBAAsB,CAAC;AAErC,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,2BAA2B;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,gDAAgD;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EACvE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,GAC1E,MAAM,0BAA0B,CAAC;AAGlC,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM;AACN,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAChG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c,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -77,10 +77,4 @@ export interface ChatResponse {
|
|
|
77
77
|
finishReason: string;
|
|
78
78
|
usage: TokenUsage;
|
|
79
79
|
}
|
|
80
|
-
/** @deprecated Use LLMMessage instead */
|
|
81
|
-
export type OpenRouterMessage = LLMMessage;
|
|
82
|
-
/** @deprecated Use LLMContentPart instead */
|
|
83
|
-
export type OpenRouterContentPart = LLMContentPart;
|
|
84
|
-
/** @deprecated Use LLMToolCall instead */
|
|
85
|
-
export type OpenRouterToolCall = LLMToolCall;
|
|
86
80
|
//# sourceMappingURL=message-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-types.d.ts","sourceRoot":"","sources":["../../src/llm/message-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEvE,gDAAgD;AAChD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CAC/D;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,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AM,CAAC;IAChB,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
|
@@ -6,9 +6,14 @@
|
|
|
6
6
|
* - Tilde expansion only from config (~/), not from bare ~ or ~/. or ~/..
|
|
7
7
|
* - All paths normalized to NFC to prevent Unicode normalization attacks
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* Default memory directory: `<cwd>/.agentx/memory/`.
|
|
11
|
+
* Computed dynamically because `process.cwd()` can change across tests.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDefaultMemoryDir(): string;
|
|
9
14
|
/**
|
|
10
15
|
* Resolve the memory directory from config, env var, or default.
|
|
11
|
-
* Priority: config.memoryDir → AGENT_MEMORY_DIR env →
|
|
16
|
+
* Priority: config.memoryDir → AGENT_MEMORY_DIR env → <cwd>/.agentx/memory/
|
|
12
17
|
*
|
|
13
18
|
* Config paths support ~/ expansion (user-friendly).
|
|
14
19
|
* Env var paths must be absolute (set programmatically).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-paths.d.ts","sourceRoot":"","sources":["../../src/memory/memory-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"memory-paths.d.ts","sourceRoot":"","sources":["../../src/memory/memory-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAY3D;AAyBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAqBpB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYrD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAI7E"}
|
|
@@ -9,10 +9,17 @@
|
|
|
9
9
|
import { homedir } from 'node:os';
|
|
10
10
|
import { isAbsolute, join, normalize, sep } from 'node:path';
|
|
11
11
|
import { mkdir } from 'node:fs/promises';
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Default memory directory: `<cwd>/.agentx/memory/`.
|
|
14
|
+
* Computed dynamically because `process.cwd()` can change across tests.
|
|
15
|
+
*/
|
|
16
|
+
export function getDefaultMemoryDir() {
|
|
17
|
+
const path = join(process.cwd(), '.agentx', 'memory');
|
|
18
|
+
return (path + sep).normalize('NFC');
|
|
19
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Resolve the memory directory from config, env var, or default.
|
|
15
|
-
* Priority: config.memoryDir → AGENT_MEMORY_DIR env →
|
|
22
|
+
* Priority: config.memoryDir → AGENT_MEMORY_DIR env → <cwd>/.agentx/memory/
|
|
16
23
|
*
|
|
17
24
|
* Config paths support ~/ expansion (user-friendly).
|
|
18
25
|
* Env var paths must be absolute (set programmatically).
|
|
@@ -26,8 +33,9 @@ export function resolveMemoryDir(memoryDir) {
|
|
|
26
33
|
return (normalized + sep).normalize('NFC');
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
if (!memoryDir)
|
|
37
|
+
return getDefaultMemoryDir();
|
|
38
|
+
return expandAndNormalize(memoryDir);
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* Expand ~ and normalize a path. Returns absolute path with trailing separator.
|
|
@@ -41,7 +49,7 @@ function expandAndNormalize(raw) {
|
|
|
41
49
|
const restNorm = normalize(rest || '.');
|
|
42
50
|
if (restNorm === '.' || restNorm === '..') {
|
|
43
51
|
// Fall through to default — don't expand dangerous paths
|
|
44
|
-
candidate = join(
|
|
52
|
+
candidate = join(process.cwd(), '.agentx', 'memory');
|
|
45
53
|
}
|
|
46
54
|
else {
|
|
47
55
|
candidate = join(homedir(), rest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-paths.js","sourceRoot":"","sources":["../../src/memory/memory-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,
|
|
1
|
+
{"version":3,"file":"memory-paths.js","sourceRoot":"","sources":["../../src/memory/memory-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAkB;IACjD,iDAAiD;IACjD,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAC7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E,CAAC;SAC5B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEhB,IAAI,CAAC,SAAS;QAAE,OAAO,WAAW,CAAC;IACnC,OAAO,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB,EAAE,SAAiB;IAClE,MAAM,cAAc,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,aAAa,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;IACzF,OAAO,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentx-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AgentX SDK - Standalone TypeScript agent library with streaming, tools, memory, knowledge (RAG), and skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"test": "vitest run",
|
|
21
21
|
"test:watch": "vitest",
|
|
22
22
|
"test:coverage": "vitest run --coverage",
|
|
23
|
-
"lint": "tsc --noEmit"
|
|
23
|
+
"lint": "tsc --noEmit",
|
|
24
|
+
"docs:dev": "cd documentation && npx mintlify@latest dev",
|
|
25
|
+
"docs:build": "cd documentation && npx mintlify@latest build"
|
|
24
26
|
},
|
|
25
27
|
"engines": {
|
|
26
28
|
"node": ">=22.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openrouter-client.d.ts","sourceRoot":"","sources":["../../src/llm/openrouter-client.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,KAAK,eAAe,IAAI,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openrouter-client.js","sourceRoot":"","sources":["../../src/llm/openrouter-client.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAkD,MAAM,iBAAiB,CAAC"}
|