zidane 2.0.1 → 2.2.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 (36) hide show
  1. package/README.md +40 -26
  2. package/dist/{agent-D-ZFMbSd.d.ts → agent-vPBFXnu-.d.ts} +389 -274
  3. package/dist/{chunk-SZA4FKW5.js → chunk-2EQT4EHD.js} +4 -3
  4. package/dist/{chunk-PJUUYBKF.js → chunk-37GD7NL3.js} +45 -16
  5. package/dist/{chunk-LVC7NQUZ.js → chunk-BW3WTFIR.js} +1 -1
  6. package/dist/{chunk-FRNFVKWW.js → chunk-CDRXC7A7.js} +64 -33
  7. package/dist/{chunk-PASFWG7S.js → chunk-F5UBXERT.js} +309 -77
  8. package/dist/{chunk-7JTBBZ2U.js → chunk-LNN5UTS2.js} +8 -0
  9. package/dist/{chunk-VG2E6YK3.js → chunk-PMCQOMV4.js} +4 -2
  10. package/dist/{chunk-LN4LLLHA.js → chunk-S3FCOMRI.js} +63 -20
  11. package/dist/{chunk-OVQ4N64O.js → chunk-SP5NA6WF.js} +6 -12
  12. package/dist/{chunk-BCXXXJ3G.js → chunk-TPXPVEH6.js} +99 -58
  13. package/dist/contexts.js +1 -1
  14. package/dist/index.d.ts +6 -5
  15. package/dist/index.js +16 -16
  16. package/dist/mcp.d.ts +1 -1
  17. package/dist/mcp.js +1 -1
  18. package/dist/presets.d.ts +33 -0
  19. package/dist/presets.js +15 -0
  20. package/dist/providers.d.ts +1 -1
  21. package/dist/providers.js +3 -3
  22. package/dist/session/sqlite.d.ts +1 -1
  23. package/dist/session.d.ts +1 -1
  24. package/dist/session.js +3 -3
  25. package/dist/{skills-use-C4KFVla0.d.ts → skills-use-39cCsA7_.d.ts} +4 -4
  26. package/dist/skills.d.ts +3 -9
  27. package/dist/skills.js +3 -5
  28. package/dist/spawn-Czx3owjX.d.ts +152 -0
  29. package/dist/tools.d.ts +6 -4
  30. package/dist/tools.js +5 -5
  31. package/dist/types.d.ts +3 -2
  32. package/dist/types.js +1 -1
  33. package/package.json +5 -5
  34. package/dist/harnesses.d.ts +0 -4
  35. package/dist/harnesses.js +0 -17
  36. package/dist/spawn-RoqpjYLZ.d.ts +0 -99
package/README.md CHANGED
@@ -20,12 +20,12 @@ bun start --prompt "create a hello world app"
20
20
 
21
21
  ```ts
22
22
  import { createAgent } from 'zidane'
23
- import { basic } from 'zidane/harnesses'
23
+ import { basic } from 'zidane/presets'
24
24
  import { anthropic } from 'zidane/providers'
25
25
 
26
26
  const agent = createAgent({
27
+ ...basic,
27
28
  provider: anthropic({ apiKey: 'sk-ant-...' }),
28
- harness: basic,
29
29
  })
30
30
 
31
31
  const stats = await agent.run({ prompt: 'build a REST API' })
@@ -37,8 +37,11 @@ All options on `createAgent`:
37
37
  ```ts
38
38
  createAgent({
39
39
  provider, // required: LLM provider
40
+ name: 'basic', // optional display name (shown in traces/logs)
41
+ system: 'You are a helpful...', // default system prompt
42
+ tools: { shell, readFile }, // tool set (default: no tools)
43
+ toolAliases: { shell: 'Bash' }, // map canonical names to LLM-facing names
40
44
  session, // session for persistence
41
- harness: basic, // tool set (default: noTools)
42
45
  behavior: { // agent-level defaults
43
46
  toolExecution: 'parallel', // or 'sequential' (default: parallel)
44
47
  maxTurns: 50, // max loop iterations
@@ -51,6 +54,12 @@ createAgent({
51
54
  })
52
55
  ```
53
56
 
57
+ Presets are just `Partial<AgentOptions>` — spread them in, override any field:
58
+
59
+ ```ts
60
+ createAgent({ ...basic, provider, system: 'be concise' })
61
+ ```
62
+
54
63
  All options on `agent.run()`:
55
64
 
56
65
  ```ts
@@ -72,7 +81,7 @@ await agent.run({
72
81
 
73
82
  `prompt` is optional when a session with existing turns is provided — the agent resumes from the last turn. This supports apps where the user message is persisted to the session before the agent runs (e.g. WebSocket → session → queue → agent).
74
83
 
75
- Precedence: `run.behavior` > `agent.behavior` > `harness.behavior` > hardcoded defaults.
84
+ Precedence: `run.behavior` > `agent.behavior` > hardcoded defaults.
76
85
 
77
86
  ## CLI
78
87
 
@@ -81,7 +90,7 @@ bun start \
81
90
  --prompt "your task" \ # required
82
91
  --model claude-opus-4-6 \ # model id
83
92
  --provider anthropic \ # anthropic | openai | openrouter | cerebras
84
- --harness basic \ # tool set
93
+ --preset basic \ # preset name
85
94
  --system "be concise" \ # system prompt
86
95
  --thinking off \ # off | minimal | low | medium | high
87
96
  --context process \ # process | docker
@@ -139,9 +148,11 @@ cerebras({ apiKey: 'csk-...', defaultModel: 'zai-glm-4.7' })
139
148
 
140
149
  Fallback: `params.apiKey` > `CEREBRAS_API_KEY` env
141
150
 
142
- ## Harnesses
151
+ ## Presets
152
+
153
+ Reusable slices of `AgentOptions` — spread them into `createAgent()`.
143
154
 
144
- Tools are grouped into **harnesses**. The `basic` harness includes:
155
+ The `basic` preset bundles:
145
156
 
146
157
  | Tool | Description |
147
158
  |---|---|
@@ -151,22 +162,25 @@ Tools are grouped into **harnesses**. The `basic` harness includes:
151
162
  | `list_files` | List directory contents |
152
163
  | `spawn` | Spawn a sub-agent |
153
164
 
154
- Define a custom harness:
165
+ Define a custom preset:
155
166
 
156
167
  ```ts
157
- import { defineHarness, basicTools } from 'zidane/harnesses'
168
+ import { basicTools, definePreset } from 'zidane/presets'
158
169
 
159
- const harness = defineHarness({
170
+ const researcher = definePreset({
160
171
  name: 'researcher',
161
172
  system: 'You are a research assistant.',
162
173
  tools: { ...basicTools },
163
174
  })
175
+
176
+ createAgent({ ...researcher, provider })
164
177
  ```
165
178
 
166
- For pure chat with no tools, pass `tools: {}` on a specific run or use the `noTools` harness:
179
+ For pure chat with no tools, omit `tools` or pass `{}` at run time:
167
180
 
168
181
  ```ts
169
- await agent.run({ prompt: 'just chat', tools: {} })
182
+ createAgent({ provider }) // no tools
183
+ await agent.run({ prompt: 'just chat', tools: {} }) // override for one run
170
184
  ```
171
185
 
172
186
  ## Thinking
@@ -189,7 +203,7 @@ await agent.run({ prompt: 'solve this', thinking: 'high' })
189
203
  await agent.run({ prompt: 'solve this', thinking: 'high', behavior: { thinkingBudget: 50000 } })
190
204
 
191
205
  // Agent-level default
192
- const agent = createAgent({ provider, harness, behavior: { thinkingBudget: 16384 } })
206
+ const agent = createAgent({ ...basic, provider, behavior: { thinkingBudget: 16384 } })
193
207
  ```
194
208
 
195
209
  Thinking traces are stored in session turns as `{ type: 'thinking', text }` content blocks and streamed live via the `stream:thinking` hook. Supported by Anthropic (native) and OpenRouter/Cerebras (`reasoning_content`/`reasoning` SSE fields).
@@ -314,10 +328,10 @@ agent.followUp('now write tests for what you built')
314
328
  The `spawn` tool delegates tasks to child agents that run independently.
315
329
 
316
330
  ```ts
331
+ import { basicTools, definePreset } from 'zidane/presets'
317
332
  import { createSpawnTool } from 'zidane/tools'
318
- import { defineHarness, basicTools } from 'zidane/harnesses'
319
333
 
320
- const harness = defineHarness({
334
+ const orchestrator = definePreset({
321
335
  name: 'orchestrator',
322
336
  tools: {
323
337
  ...basicTools,
@@ -330,15 +344,15 @@ const harness = defineHarness({
330
344
  })
331
345
  ```
332
346
 
333
- Children inherit the parent's harness and can spawn their own children.
347
+ Children inherit the parent's preset (tools, system prompt, aliases, MCP servers, skills, behavior) and can spawn their own children. Pass `preset` on `createSpawnTool()` to override the inherited slice per child.
334
348
 
335
349
  ## Interaction Tool
336
350
 
337
- Let the agent pause and request structured input from the outside world. Not included in any harness by default.
351
+ Let the agent pause and request structured input from the outside world. Not included in any preset by default.
338
352
 
339
353
  ```ts
354
+ import { basicTools, definePreset } from 'zidane/presets'
340
355
  import { createInteractionTool } from 'zidane/tools'
341
- import { defineHarness, basicTools } from 'zidane/harnesses'
342
356
 
343
357
  const askUser = createInteractionTool({
344
358
  name: 'ask_user',
@@ -353,7 +367,7 @@ const askUser = createInteractionTool({
353
367
  },
354
368
  })
355
369
 
356
- const harness = defineHarness({
370
+ const interactive = definePreset({
357
371
  name: 'interactive',
358
372
  tools: { ...basicTools, ask_user: askUser },
359
373
  })
@@ -371,7 +385,7 @@ import { createAgent, createSession, createSqliteStore } from 'zidane'
371
385
  const store = createSqliteStore({ path: './sessions.db' })
372
386
  const session = await createSession({ store })
373
387
 
374
- const agent = createAgent({ harness, provider, session })
388
+ const agent = createAgent({ ...basic, provider, session })
375
389
  await agent.run({ prompt: 'hello' })
376
390
  await session.save()
377
391
  ```
@@ -395,7 +409,7 @@ import { loadSession } from 'zidane/session'
395
409
 
396
410
  const session = await loadSession(store, 'my-session')
397
411
  if (session) {
398
- const agent = createAgent({ harness, provider, session })
412
+ const agent = createAgent({ ...basic, provider, session })
399
413
  await agent.run({ prompt: 'continue' })
400
414
  }
401
415
  ```
@@ -414,7 +428,7 @@ Connect any MCP-compatible tool server. Tools are namespaced as `mcp_{server}_{t
414
428
 
415
429
  ```ts
416
430
  const agent = createAgent({
417
- harness,
431
+ ...basic,
418
432
  provider,
419
433
  mcpServers: [
420
434
  { name: 'fs', transport: 'stdio', command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '.'] },
@@ -423,7 +437,7 @@ const agent = createAgent({
423
437
  })
424
438
  ```
425
439
 
426
- MCP servers can also be declared on the harness. Connections are lazy (first `run()`) and reused.
440
+ MCP servers can live on a preset too (they're just `AgentOptions` fields). Connections are lazy (first `run()`) and reused.
427
441
 
428
442
  ## Skills
429
443
 
@@ -467,7 +481,7 @@ Scan paths in priority order (first found wins):
467
481
  import { createAgent, defineSkill } from 'zidane'
468
482
 
469
483
  const agent = createAgent({
470
- harness,
484
+ ...basic,
471
485
  provider,
472
486
  skills: {
473
487
  scan: ['./custom-skills'],
@@ -496,7 +510,7 @@ An execution context defines **where** tools run. Defaults to in-process.
496
510
  import { createAgent, createDockerContext } from 'zidane'
497
511
 
498
512
  const agent = createAgent({
499
- harness,
513
+ ...basic,
500
514
  provider,
501
515
  execution: createDockerContext({
502
516
  image: 'node:22',
@@ -514,7 +528,7 @@ Implement `SandboxProvider` for your provider (E2B, Rivet, etc.):
514
528
  import { createAgent, createSandboxContext } from 'zidane'
515
529
 
516
530
  const agent = createAgent({
517
- harness,
531
+ ...basic,
518
532
  provider,
519
533
  execution: createSandboxContext(myProvider),
520
534
  })