zidane 1.6.0 → 1.6.1

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 CHANGED
@@ -166,10 +166,10 @@ Extended reasoning with named levels or exact token budgets.
166
166
  await agent.run({ prompt: 'solve this', thinking: 'high' })
167
167
 
168
168
  // Exact budget (overrides level default)
169
- await agent.run({ prompt: 'solve this', thinking: 'high', thinkingBudget: 50000 })
169
+ await agent.run({ prompt: 'solve this', thinking: 'high', behavior: { thinkingBudget: 50000 } })
170
170
 
171
171
  // Agent-level default
172
- const agent = createAgent({ provider, harness, thinkingBudget: 16384 })
172
+ const agent = createAgent({ provider, harness, behavior: { thinkingBudget: 16384 } })
173
173
  ```
174
174
 
175
175
  ## Hooks
@@ -184,12 +184,19 @@ agent.hooks.hook('turn:before', (ctx) => {
184
184
  })
185
185
 
186
186
  agent.hooks.hook('turn:after', (ctx) => {
187
- // ctx.turn, ctx.turnId, ctx.usage { input, output }
187
+ // ctx.turn, ctx.turnId, ctx.usage, ctx.message (full SessionTurn)
188
188
  // Always fires — even if the provider throws mid-stream
189
+ // Turn is guaranteed to be in agent.turns before this fires
190
+ })
191
+
192
+ agent.hooks.hook('usage', (ctx) => {
193
+ // ctx.turn, ctx.turnId, ctx.usage (per-turn)
194
+ // ctx.totalIn, ctx.totalOut (running totals)
189
195
  })
190
196
 
191
197
  agent.hooks.hook('agent:done', (ctx) => {
192
198
  // ctx.totalIn, ctx.totalOut, ctx.turns, ctx.elapsed, ctx.children?
199
+ // ctx.output — structured output (when behavior.schema is set)
193
200
  // Fires on all exit paths: completion, maxTurns, and abort
194
201
  })
195
202
  ```
@@ -333,7 +340,7 @@ if (session) {
333
340
 
334
341
  ```ts
335
342
  agent.hooks.hook('session:start', (ctx) => { /* ctx.sessionId, ctx.runId, ctx.prompt */ })
336
- agent.hooks.hook('session:end', (ctx) => { /* ctx.sessionId, ctx.runId, ctx.status */ })
343
+ agent.hooks.hook('session:end', (ctx) => { /* ctx.sessionId, ctx.runId, ctx.status, ctx.turnRange */ })
337
344
  agent.hooks.hook('session:turns', (ctx) => { /* ctx.sessionId, ctx.count */ })
338
345
  ```
339
346
 
@@ -453,7 +460,7 @@ const agent = createAgent({
453
460
 
454
461
  ```ts
455
462
  agent.isRunning // is a run in progress?
456
- agent.messages // conversation history
463
+ agent.turns // conversation history (SessionTurn[])
457
464
  agent.abort() // cancel the current run
458
465
  agent.reset() // clear messages and queues
459
466
  await agent.destroy() // clean up context + MCP connections
@@ -484,6 +491,45 @@ Converters for external interop:
484
491
  import { fromAnthropic, toAnthropic, fromOpenAI, toOpenAI, autoDetectAndConvert } from 'zidane'
485
492
  ```
486
493
 
494
+ ## Structured Output
495
+
496
+ Force the agent's final response to match a JSON Schema via provider-level tool forcing.
497
+
498
+ ```ts
499
+ const stats = await agent.run({
500
+ prompt: 'Extract the entities',
501
+ behavior: {
502
+ schema: {
503
+ type: 'object',
504
+ properties: { name: { type: 'string' }, age: { type: 'number' } },
505
+ required: ['name', 'age'],
506
+ },
507
+ },
508
+ })
509
+
510
+ console.log(stats.output) // { name: 'Alice', age: 30 }
511
+ ```
512
+
513
+ The `output` hook fires when structured output is extracted:
514
+
515
+ ```ts
516
+ agent.hooks.hook('output', (ctx) => {
517
+ // ctx.output — the parsed JSON matching the schema
518
+ // ctx.schema — the schema that was enforced
519
+ })
520
+ ```
521
+
522
+ ### Zod v4 integration
523
+
524
+ Use `zodToJsonSchema` to normalize `z.toJsonSchema()` output for tool schemas:
525
+
526
+ ```ts
527
+ import { z } from 'zod'
528
+ import { zodToJsonSchema } from 'zidane'
529
+
530
+ const schema = zodToJsonSchema(z.toJsonSchema(z.object({ name: z.string() })))
531
+ ```
532
+
487
533
  ## Usage Tracking
488
534
 
489
535
  ```ts
@@ -492,13 +538,21 @@ stats.turnUsage // TurnUsage[] — per-turn { input, output, cacheCreation?, c
492
538
  stats.cost // total USD cost (if reported by provider)
493
539
  ```
494
540
 
541
+ ## Types
542
+
543
+ All types are available from `zidane/types`:
544
+
545
+ ```ts
546
+ import type { Agent, SessionTurn, TurnUsage, Provider, ToolDef } from 'zidane/types'
547
+ ```
548
+
495
549
  ## Testing
496
550
 
497
551
  ```bash
498
552
  bun test
499
553
  ```
500
554
 
501
- 430+ tests with mock provider and execution context. No API keys or Docker needed.
555
+ 460+ tests with mock provider and execution context. No API keys or Docker needed.
502
556
 
503
557
  ## License
504
558
 
@@ -1,5 +1,5 @@
1
1
  import { Hookable } from 'hookable';
2
- import { b as ExecutionContext, c as ExecutionHandle, e as SkillsConfig, S as SkillConfig } from './types-CyRzBgm0.js';
2
+ import { b as ExecutionContext, c as ExecutionHandle, e as SkillsConfig, S as SkillConfig } from './types-CKXAp41h.js';
3
3
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
4
4
 
5
5
  /**
@@ -229,10 +229,9 @@ async function parseSkillFile(filePath) {
229
229
  config.allowedTools = frontmatter["allowed-tools"].split(WHITESPACE_SPLIT_RE);
230
230
  if (frontmatter.model)
231
231
  config.model = frontmatter.model;
232
- if (frontmatter.thinking)
233
- config.thinking = frontmatter.thinking;
234
- if (frontmatter.effort)
235
- config.thinking = frontmatter.effort;
232
+ const thinkingValue = frontmatter.thinking ?? frontmatter.effort;
233
+ if (thinkingValue)
234
+ config.thinking = thinkingValue;
236
235
  if (frontmatter.paths) {
237
236
  const raw = frontmatter.paths;
238
237
  config.paths = raw.split(COMMA_OR_SPACE_RE).filter(Boolean);
@@ -4,7 +4,7 @@ import {
4
4
  shell,
5
5
  spawn,
6
6
  writeFile
7
- } from "./chunk-VRAZJES3.js";
7
+ } from "./chunk-SKLAWY7O.js";
8
8
 
9
9
  // src/harnesses/basic.ts
10
10
  var basicTools = { shell, readFile, writeFile, listFiles };
@@ -6,7 +6,7 @@ import {
6
6
  interpolateShellCommands,
7
7
  mergeSkillsConfig,
8
8
  resolveSkills
9
- } from "./chunk-3K5D27BF.js";
9
+ } from "./chunk-4C6Y56CC.js";
10
10
 
11
11
  // src/tools/list-files.ts
12
12
  var listFiles = {
@@ -1,4 +1,4 @@
1
1
  import 'hookable';
2
- export { H as Harness, i as HarnessConfig, u as ToolContext, v as ToolDef, x as ToolMap, a1 as basic, a2 as basicTools, Q as defineHarness, X as noTools } from './agent-DVvuhEN-.js';
3
- import './types-CyRzBgm0.js';
2
+ export { H as Harness, i as HarnessConfig, u as ToolContext, v as ToolDef, x as ToolMap, a1 as basic, a2 as basicTools, Q as defineHarness, X as noTools } from './agent-C7X6yygt.js';
3
+ import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/harnesses.js CHANGED
@@ -3,10 +3,10 @@ import {
3
3
  basic_default,
4
4
  defineHarness,
5
5
  noTools
6
- } from "./chunk-7V33E7LT.js";
7
- import "./chunk-VRAZJES3.js";
6
+ } from "./chunk-JR4QNFMD.js";
7
+ import "./chunk-SKLAWY7O.js";
8
8
  import "./chunk-YTZOORAP.js";
9
- import "./chunk-3K5D27BF.js";
9
+ import "./chunk-4C6Y56CC.js";
10
10
  export {
11
11
  basic_default as basic,
12
12
  basicTools,
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, T as ThinkingLevel, u as ToolContext, v as ToolDef, w as ToolExecutionMode, x as ToolMap, D as TurnUsage, E as autoDetectAndConvert, F as connectMcpServers, G as createAgent, J as createMemoryStore, K as createRemoteStore, L as createSession, N as createSqliteStore, Q as defineHarness, U as fromAnthropic, V as fromOpenAI, W as loadSession, X as noTools, Y as toAnthropic, Z as toOpenAI } from './agent-DVvuhEN-.js';
2
- import { f as SpawnConfig, b as ExecutionContext } from './types-CyRzBgm0.js';
3
- export { C as ContextCapabilities, a as ContextType, E as ExecResult, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig } from './types-CyRzBgm0.js';
4
- export { S as SandboxProvider, c as createSandboxContext } from './sandbox-C08DQPTu.js';
1
+ export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, T as ThinkingLevel, u as ToolContext, v as ToolDef, w as ToolExecutionMode, x as ToolMap, D as TurnUsage, E as autoDetectAndConvert, F as connectMcpServers, G as createAgent, J as createMemoryStore, K as createRemoteStore, L as createSession, N as createSqliteStore, Q as defineHarness, U as fromAnthropic, V as fromOpenAI, W as loadSession, X as noTools, Y as toAnthropic, Z as toOpenAI } from './agent-C7X6yygt.js';
2
+ import { f as SpawnConfig, b as ExecutionContext } from './types-CKXAp41h.js';
3
+ export { C as ContextCapabilities, a as ContextType, E as ExecResult, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig } from './types-CKXAp41h.js';
4
+ export { S as SandboxProvider, c as createSandboxContext } from './sandbox-DZn3ybp_.js';
5
5
  export { buildCatalog, defineSkill, discoverSkills, interpolateShellCommands, mergeSkillsConfig, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
6
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-DJZZ9ZWw.js';
6
+ export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-CIxEFPrs.js';
7
7
  import 'hookable';
8
8
  import '@modelcontextprotocol/sdk/client/index.js';
9
9
 
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineHarness,
3
3
  noTools
4
- } from "./chunk-7V33E7LT.js";
4
+ } from "./chunk-JR4QNFMD.js";
5
5
  import {
6
6
  createAgent,
7
7
  createDockerContext,
@@ -9,7 +9,7 @@ import {
9
9
  createSandboxContext,
10
10
  createSpawnTool,
11
11
  spawn
12
- } from "./chunk-VRAZJES3.js";
12
+ } from "./chunk-SKLAWY7O.js";
13
13
  import {
14
14
  connectMcpServers
15
15
  } from "./chunk-YTZOORAP.js";
@@ -40,7 +40,7 @@ import {
40
40
  validateSkillName,
41
41
  writeSkillToDisk,
42
42
  writeSkillsToDisk
43
- } from "./chunk-3K5D27BF.js";
43
+ } from "./chunk-4C6Y56CC.js";
44
44
 
45
45
  // src/zod.ts
46
46
  function zodToJsonSchema(jsonSchema) {
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'hookable';
2
- export { M as McpConnection, j as McpServerConfig, F as connectMcpServers, a3 as resultToString } from './agent-DVvuhEN-.js';
2
+ export { M as McpConnection, j as McpServerConfig, F as connectMcpServers, a3 as resultToString } from './agent-C7X6yygt.js';
3
3
  import '@modelcontextprotocol/sdk/client/index.js';
4
- import './types-CyRzBgm0.js';
4
+ import './types-CKXAp41h.js';
@@ -1,4 +1,4 @@
1
- export { f as AnthropicParams, C as CerebrasParams, O as OpenRouterParams, P as Provider, r as StreamCallbacks, s as StreamOptions, t as ToolCall, y as ToolResult, z as ToolSpec, B as TurnResult, _ as anthropic, $ as cerebras, a0 as openrouter } from './agent-DVvuhEN-.js';
1
+ export { f as AnthropicParams, C as CerebrasParams, O as OpenRouterParams, P as Provider, r as StreamCallbacks, s as StreamOptions, t as ToolCall, y as ToolResult, z as ToolSpec, B as TurnResult, _ as anthropic, $ as cerebras, a0 as openrouter } from './agent-C7X6yygt.js';
2
2
  import 'hookable';
3
- import './types-CyRzBgm0.js';
3
+ import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
@@ -1,4 +1,4 @@
1
- import { f as SpawnConfig, E as ExecResult, b as ExecutionContext } from './types-CyRzBgm0.js';
1
+ import { f as SpawnConfig, E as ExecResult, b as ExecutionContext } from './types-CKXAp41h.js';
2
2
 
3
3
  /**
4
4
  * Remote sandbox execution context.
package/dist/session.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { h as CreateSessionOptions, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, E as autoDetectAndConvert, J as createMemoryStore, K as createRemoteStore, L as createSession, N as createSqliteStore, U as fromAnthropic, V as fromOpenAI, W as loadSession, Y as toAnthropic, Z as toOpenAI } from './agent-DVvuhEN-.js';
1
+ export { h as CreateSessionOptions, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, E as autoDetectAndConvert, J as createMemoryStore, K as createRemoteStore, L as createSession, N as createSqliteStore, U as fromAnthropic, V as fromOpenAI, W as loadSession, Y as toAnthropic, Z as toOpenAI } from './agent-C7X6yygt.js';
2
2
  import 'hookable';
3
- import './types-CyRzBgm0.js';
3
+ import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/skills.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SkillConfig, b as ExecutionContext, c as ExecutionHandle, e as SkillsConfig } from './types-CyRzBgm0.js';
2
- export { d as SkillResource } from './types-CyRzBgm0.js';
1
+ import { S as SkillConfig, b as ExecutionContext, c as ExecutionHandle, e as SkillsConfig } from './types-CKXAp41h.js';
2
+ export { d as SkillResource } from './types-CKXAp41h.js';
3
3
 
4
4
  /**
5
5
  * Skill catalog generation.
package/dist/skills.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  validateSkillName,
14
14
  writeSkillToDisk,
15
15
  writeSkillsToDisk
16
- } from "./chunk-3K5D27BF.js";
16
+ } from "./chunk-4C6Y56CC.js";
17
17
  export {
18
18
  buildCatalog,
19
19
  defineSkill,
@@ -1,4 +1,4 @@
1
- import { i as HarnessConfig, e as AgentStats, v as ToolDef } from './agent-DVvuhEN-.js';
1
+ import { i as HarnessConfig, e as AgentStats, v as ToolDef } from './agent-C7X6yygt.js';
2
2
 
3
3
  /**
4
4
  * Spawn tool — create sub-agents from a parent agent.
package/dist/tools.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { v as ToolDef } from './agent-DVvuhEN-.js';
2
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-DJZZ9ZWw.js';
1
+ import { v as ToolDef } from './agent-C7X6yygt.js';
2
+ export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-CIxEFPrs.js';
3
3
  export { V as ValidationResult, v as validateToolArgs } from './validation-CwSuvOKf.js';
4
4
  import 'hookable';
5
- import './types-CyRzBgm0.js';
5
+ import './types-CKXAp41h.js';
6
6
  import '@modelcontextprotocol/sdk/client/index.js';
7
7
 
8
8
  declare const listFiles: ToolDef;
package/dist/tools.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  spawn,
7
7
  validateToolArgs,
8
8
  writeFile
9
- } from "./chunk-VRAZJES3.js";
9
+ } from "./chunk-SKLAWY7O.js";
10
10
  import "./chunk-YTZOORAP.js";
11
- import "./chunk-3K5D27BF.js";
11
+ import "./chunk-4C6Y56CC.js";
12
12
  export {
13
13
  createSpawnTool,
14
14
  listFiles,
@@ -113,8 +113,8 @@ interface SkillConfig {
113
113
  thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
114
114
  /**
115
115
  * Glob patterns that limit when this skill auto-activates.
116
- * When set, the skill is only included in the catalog when
117
- * the agent is working with files matching these patterns.
116
+ * Parsed and stored per the Agent Skills spec, but not yet
117
+ * enforced at runtime all skills are included in the catalog.
118
118
  */
119
119
  paths?: string[];
120
120
  }
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, f as AnthropicParams, C as CerebrasParams, g as ChildRunStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, O as OpenRouterParams, P as Provider, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, r as StreamCallbacks, s as StreamOptions, T as ThinkingLevel, t as ToolCall, u as ToolContext, v as ToolDef, w as ToolExecutionMode, x as ToolMap, y as ToolResult, z as ToolSpec, B as TurnResult, D as TurnUsage } from './agent-DVvuhEN-.js';
2
- export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig, f as SpawnConfig } from './types-CyRzBgm0.js';
3
- export { S as SandboxProvider } from './sandbox-C08DQPTu.js';
4
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState } from './spawn-DJZZ9ZWw.js';
1
+ export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, f as AnthropicParams, C as CerebrasParams, g as ChildRunStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, O as OpenRouterParams, P as Provider, R as RemoteStoreOptions, S as Session, k as SessionContentBlock, l as SessionData, m as SessionMessage, n as SessionRun, o as SessionStore, p as SessionTurn, q as SqliteStoreOptions, r as StreamCallbacks, s as StreamOptions, T as ThinkingLevel, t as ToolCall, u as ToolContext, v as ToolDef, w as ToolExecutionMode, x as ToolMap, y as ToolResult, z as ToolSpec, B as TurnResult, D as TurnUsage } from './agent-C7X6yygt.js';
2
+ export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig, f as SpawnConfig } from './types-CKXAp41h.js';
3
+ export { S as SandboxProvider } from './sandbox-DZn3ybp_.js';
4
+ export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState } from './spawn-CIxEFPrs.js';
5
5
  export { V as ValidationResult } from './validation-CwSuvOKf.js';
6
6
  import 'hookable';
7
7
  import '@modelcontextprotocol/sdk/client/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,