zidane 1.5.2 → 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/dist/skills.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-QPYZR2QM.js";
3
+ } from "./chunk-CFLC2I7D.js";
4
4
  import {
5
5
  buildCatalog,
6
6
  discoverSkills,
@@ -13,8 +13,7 @@ import {
13
13
  validateSkillName,
14
14
  writeSkillToDisk,
15
15
  writeSkillsToDisk
16
- } from "./chunk-PRNQ7DXE.js";
17
- import "./chunk-PNKVD2UK.js";
16
+ } from "./chunk-4C6Y56CC.js";
18
17
  export {
19
18
  buildCatalog,
20
19
  defineSkill,
@@ -1,5 +1,4 @@
1
- import { c as HarnessConfig, d as ToolDef } from './agent-DZDheE1c.js';
2
- import { a as AgentStats } from './types-CskNDruh.js';
1
+ import { i as HarnessConfig, e as AgentStats, v as ToolDef } from './agent-C7X6yygt.js';
3
2
 
4
3
  /**
5
4
  * Spawn tool — create sub-agents from a parent agent.
package/dist/tools.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- import { d as ToolDef } from './agent-DZDheE1c.js';
2
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-MUlKj85h.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
+ export { V as ValidationResult, v as validateToolArgs } from './validation-CwSuvOKf.js';
3
4
  import 'hookable';
4
- import './types-D8fzooXc.js';
5
- import '@anthropic-ai/sdk';
6
- import './types-CskNDruh.js';
5
+ import './types-CKXAp41h.js';
7
6
  import '@modelcontextprotocol/sdk/client/index.js';
8
- import './providers.js';
9
- import './session.js';
10
7
 
11
8
  declare const listFiles: ToolDef;
12
9
 
@@ -14,16 +11,6 @@ declare const readFile: ToolDef;
14
11
 
15
12
  declare const shell: ToolDef;
16
13
 
17
- /**
18
- * Simple tool argument validation against JSON Schema-style input_schema.
19
- * Checks required fields are present; type coercion is left to the tools themselves.
20
- */
21
- interface ValidationResult {
22
- valid: boolean;
23
- error?: string;
24
- }
25
- declare function validateToolArgs(input: Record<string, unknown>, schema: Record<string, unknown>): ValidationResult;
26
-
27
14
  declare const writeFile: ToolDef;
28
15
 
29
- export { type ValidationResult, listFiles, readFile, shell, validateToolArgs, writeFile };
16
+ export { listFiles, readFile, shell, writeFile };
package/dist/tools.js CHANGED
@@ -1,17 +1,14 @@
1
1
  import {
2
2
  createSpawnTool,
3
- init_tools,
4
3
  listFiles,
5
4
  readFile,
6
5
  shell,
7
6
  spawn,
8
7
  validateToolArgs,
9
8
  writeFile
10
- } from "./chunk-XMFQK35S.js";
11
- import "./chunk-26LIQARN.js";
12
- import "./chunk-PRNQ7DXE.js";
13
- import "./chunk-PNKVD2UK.js";
14
- init_tools();
9
+ } from "./chunk-SKLAWY7O.js";
10
+ import "./chunk-YTZOORAP.js";
11
+ import "./chunk-4C6Y56CC.js";
15
12
  export {
16
13
  createSpawnTool,
17
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
  }
@@ -138,4 +138,4 @@ interface SkillsConfig {
138
138
  skipDefaultPaths?: boolean;
139
139
  }
140
140
 
141
- export type { ContextCapabilities as C, ExecutionContext as E, SpawnConfig as S, ExecResult as a, ContextType as b, ExecutionHandle as c, SkillConfig as d, SkillResource as e, SkillsConfig as f };
141
+ export type { ContextCapabilities as C, ExecResult as E, SkillConfig as S, ContextType as a, ExecutionContext as b, ExecutionHandle as c, SkillResource as d, SkillsConfig as e, SpawnConfig as f };
@@ -0,0 +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-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
+ export { V as ValidationResult } from './validation-CwSuvOKf.js';
6
+ import 'hookable';
7
+ import '@modelcontextprotocol/sdk/client/index.js';
package/dist/types.js ADDED
File without changes
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Simple tool argument validation against JSON Schema-style input_schema.
3
+ * Checks required fields are present; type coercion is left to the tools themselves.
4
+ */
5
+ interface ValidationResult {
6
+ valid: boolean;
7
+ error?: string;
8
+ }
9
+ declare function validateToolArgs(input: Record<string, unknown>, schema: Record<string, unknown>): ValidationResult;
10
+
11
+ export { type ValidationResult as V, validateToolArgs as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,
@@ -19,6 +19,9 @@
19
19
  "import": "./dist/index.js",
20
20
  "types": "./dist/index.d.ts"
21
21
  },
22
+ "./types": {
23
+ "types": "./dist/types.d.ts"
24
+ },
22
25
  "./providers": {
23
26
  "import": "./dist/providers.js",
24
27
  "types": "./dist/providers.d.ts"
@@ -66,6 +69,14 @@
66
69
  "hookable": "^6.1.0",
67
70
  "md4x": "^0.0.25"
68
71
  },
72
+ "peerDependencies": {
73
+ "zod": ">=4.0.0"
74
+ },
75
+ "peerDependenciesMeta": {
76
+ "zod": {
77
+ "optional": true
78
+ }
79
+ },
69
80
  "devDependencies": {
70
81
  "@antfu/eslint-config": "^7.7.3",
71
82
  "@types/bun": "^1.3.11",
@@ -1,271 +0,0 @@
1
- import { Hookable } from 'hookable';
2
- import { E as ExecutionContext, c as ExecutionHandle, f as SkillsConfig, d as SkillConfig } from './types-D8fzooXc.js';
3
- import Anthropic from '@anthropic-ai/sdk';
4
- import { M as McpServerConfig, e as TurnUsage, b as SessionMessage, C as ChildRunStats, a as AgentStats, A as AgentRunOptions, c as SessionTurn, d as ToolExecutionMode } from './types-CskNDruh.js';
5
- import { Client } from '@modelcontextprotocol/sdk/client/index.js';
6
- import { Provider, StreamOptions } from './providers.js';
7
- import { Session } from './session.js';
8
-
9
- /** Core tools available in every basic harness (without spawn) */
10
- declare const basicTools: {
11
- shell: ToolDef;
12
- readFile: ToolDef;
13
- writeFile: ToolDef;
14
- listFiles: ToolDef;
15
- };
16
- declare const _default: HarnessConfig;
17
-
18
- /**
19
- * Runtime context passed to every tool execution.
20
- * Provides access to the agent's provider, abort signal, execution environment, and hooks.
21
- */
22
- interface ToolContext {
23
- /** The LLM provider for this agent run */
24
- provider: Provider;
25
- /** Abort signal — tools should check this for early termination */
26
- signal: AbortSignal;
27
- /** The execution context (shell, filesystem, etc.) */
28
- execution: ExecutionContext;
29
- /** The active execution handle for the current agent run */
30
- handle: ExecutionHandle;
31
- /** Agent hooks for emitting events (e.g. spawn:complete) */
32
- hooks: Hookable<AgentHooks>;
33
- /** The harness config for this agent (tools available to the agent) */
34
- harness: HarnessConfig;
35
- }
36
- interface ToolDef {
37
- spec: Anthropic.Tool;
38
- execute: (input: Record<string, unknown>, ctx: ToolContext) => Promise<string>;
39
- }
40
- type ToolMap = Map<string, ToolDef>;
41
- interface HarnessConfig {
42
- /** Display name for this harness */
43
- name: string;
44
- /** Default system prompt injected when no system is provided at run time */
45
- system?: string;
46
- /** Tool definitions available to the agent */
47
- tools: Record<string, ToolDef>;
48
- /** MCP servers to connect and expose as tools */
49
- mcpServers?: McpServerConfig[];
50
- /** Skills configuration at the harness level */
51
- skills?: SkillsConfig;
52
- }
53
- /**
54
- * Define a harness with a name, optional system prompt, and tools.
55
- */
56
- declare function defineHarness(config: HarnessConfig): HarnessConfig;
57
- type Harness = HarnessConfig;
58
- /**
59
- * A harness with no tools — for pure chat mode.
60
- * Use with `enableTools: false` or when no tool access is needed.
61
- */
62
- declare const noTools: HarnessConfig;
63
-
64
- /**
65
- * MCP (Model Context Protocol) server support.
66
- *
67
- * Connects to one or more MCP servers, discovers their tools,
68
- * and wraps them as zidane ToolDefs for use in agent loops.
69
- */
70
-
71
- interface McpConnection {
72
- tools: Record<string, ToolDef>;
73
- close: () => Promise<void>;
74
- }
75
- /**
76
- * Convert MCP tool result content blocks to a single string.
77
- * Text blocks are extracted; non-text blocks are JSON-stringified.
78
- */
79
- declare function resultToString(content: unknown[]): string;
80
- /**
81
- * Connect to MCP servers and discover their tools.
82
- *
83
- * Each tool is namespaced as `mcp_{serverName}_{toolName}` to avoid
84
- * collisions with harness tools or tools from other servers.
85
- *
86
- * @param configs - Array of MCP server configurations
87
- * @param _clientFactory - Internal: override client construction for testing
88
- * @param hooks - Optional agent hooks for firing mcp:connect, mcp:error, mcp:close events
89
- */
90
- declare function connectMcpServers(configs: McpServerConfig[], _clientFactory?: () => Client, hooks?: Hookable<AgentHooks>): Promise<McpConnection>;
91
-
92
- /**
93
- * Agent creation and state management.
94
- */
95
-
96
- interface AgentHooks {
97
- 'system:before': (ctx: {
98
- system: string;
99
- }) => void;
100
- 'turn:before': (ctx: {
101
- turn: number;
102
- turnId: string;
103
- options: StreamOptions;
104
- }) => void;
105
- 'turn:after': (ctx: {
106
- turn: number;
107
- turnId: string;
108
- usage: TurnUsage;
109
- }) => void;
110
- 'stream:text': (ctx: {
111
- delta: string;
112
- text: string;
113
- turnId: string;
114
- blockIndex: number;
115
- }) => void;
116
- 'stream:end': (ctx: {
117
- text: string;
118
- turnId: string;
119
- blockIndex: number;
120
- }) => void;
121
- 'tool:before': (ctx: {
122
- name: string;
123
- input: Record<string, unknown>;
124
- }) => void;
125
- 'tool:after': (ctx: {
126
- name: string;
127
- input: Record<string, unknown>;
128
- result: string;
129
- }) => void;
130
- 'tool:error': (ctx: {
131
- name: string;
132
- input: Record<string, unknown>;
133
- error: Error;
134
- }) => void;
135
- 'tool:gate': (ctx: {
136
- name: string;
137
- input: Record<string, unknown>;
138
- block: boolean;
139
- reason: string;
140
- }) => void;
141
- 'tool:transform': (ctx: {
142
- name: string;
143
- input: Record<string, unknown>;
144
- result: string;
145
- isError: boolean;
146
- }) => void;
147
- 'context:transform': (ctx: {
148
- messages: SessionMessage[];
149
- }) => void;
150
- 'steer:inject': (ctx: {
151
- message: string;
152
- }) => void;
153
- 'spawn:complete': (ctx: ChildRunStats) => void;
154
- 'spawn:before': (ctx: {
155
- id: string;
156
- task: string;
157
- }) => void;
158
- 'spawn:error': (ctx: {
159
- id: string;
160
- task: string;
161
- error: Error;
162
- }) => void;
163
- 'mcp:connect': (ctx: {
164
- name: string;
165
- transport: string;
166
- tools: string[];
167
- }) => void;
168
- 'mcp:error': (ctx: {
169
- name: string;
170
- error: Error;
171
- }) => void;
172
- 'mcp:close': (ctx: {
173
- name: string;
174
- }) => void;
175
- 'mcp:tool:before': (ctx: {
176
- server: string;
177
- tool: string;
178
- input: Record<string, unknown>;
179
- }) => void;
180
- 'mcp:tool:after': (ctx: {
181
- server: string;
182
- tool: string;
183
- input: Record<string, unknown>;
184
- result: string;
185
- }) => void;
186
- 'mcp:tool:error': (ctx: {
187
- server: string;
188
- tool: string;
189
- input: Record<string, unknown>;
190
- error: Error;
191
- }) => void;
192
- 'skills:resolve': (ctx: {
193
- skills: SkillConfig[];
194
- }) => void;
195
- 'skills:catalog': (ctx: {
196
- catalog: string;
197
- skills: SkillConfig[];
198
- }) => void;
199
- 'skills:activate': (ctx: {
200
- skill: SkillConfig;
201
- }) => void;
202
- 'agent:abort': (ctx: object) => void;
203
- 'agent:done': (ctx: AgentStats) => void;
204
- 'session:start': (ctx: {
205
- sessionId: string;
206
- runId: string;
207
- prompt: string;
208
- }) => void;
209
- 'session:end': (ctx: {
210
- sessionId: string;
211
- runId: string;
212
- status: 'completed' | 'aborted' | 'error';
213
- }) => void;
214
- 'session:turns': (ctx: {
215
- sessionId: string;
216
- count: number;
217
- }) => void;
218
- 'session:meta': (ctx: {
219
- sessionId: string;
220
- key: string;
221
- value: unknown;
222
- }) => void;
223
- 'session:save': (ctx: {
224
- sessionId: string;
225
- }) => void;
226
- }
227
- interface AgentOptions {
228
- /** Harness (tools + system prompt). Defaults to a no-tools harness if omitted. */
229
- harness?: HarnessConfig;
230
- provider: Provider;
231
- /** Tool execution mode: 'sequential' (default) or 'parallel' */
232
- toolExecution?: ToolExecutionMode;
233
- /** Enable tool use. When false, no tools are sent to the provider (pure chat mode). Default: true. */
234
- enableTools?: boolean;
235
- /** Execution context: where tools run. Defaults to in-process. */
236
- execution?: ExecutionContext;
237
- /** MCP servers to connect and expose as tools */
238
- mcpServers?: McpServerConfig[];
239
- /** Session for identity, turn persistence, and run tracking */
240
- session?: Session;
241
- /** Skills configuration (merged with harness-level skills, agent takes precedence) */
242
- skills?: SkillsConfig;
243
- /** Default max agent loop iterations (default: 50). Can be overridden per-run. */
244
- maxTurns?: number;
245
- /** Default max tokens per LLM response (default: 16384). Can be overridden per-run. */
246
- maxTokens?: number;
247
- /** Default thinking token budget — overrides the level-based default when set. Can be overridden per-run. */
248
- thinkingBudget?: number;
249
- /** @internal */
250
- _mcpConnector?: (configs: McpServerConfig[]) => Promise<McpConnection>;
251
- }
252
- interface Agent {
253
- hooks: Hookable<AgentHooks>;
254
- run: (options: AgentRunOptions) => Promise<AgentStats>;
255
- abort: () => void;
256
- steer: (message: string) => void;
257
- followUp: (message: string) => void;
258
- waitForIdle: () => Promise<void>;
259
- reset: () => void;
260
- /** Destroy the execution context and clean up resources */
261
- destroy: () => Promise<void>;
262
- readonly isRunning: boolean;
263
- readonly turns: SessionTurn[];
264
- readonly execution: ExecutionContext;
265
- readonly handle: ExecutionHandle | null;
266
- readonly session: Session | null;
267
- meta: Record<string, unknown>;
268
- }
269
- declare function createAgent({ harness: harnessOption, provider, toolExecution, enableTools, execution, mcpServers, session, skills: agentSkills, maxTurns: agentMaxTurns, maxTokens: agentMaxTokens, thinkingBudget: agentThinkingBudget, _mcpConnector }: AgentOptions): Agent;
270
-
271
- export { type Agent as A, type Harness as H, type McpConnection as M, type ToolContext as T, _default as _, type AgentHooks as a, type AgentOptions as b, type HarnessConfig as c, type ToolDef as d, type ToolMap as e, connectMcpServers as f, createAgent as g, defineHarness as h, basicTools as i, noTools as n, resultToString as r };
@@ -1,26 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __esm = (fn, res) => function __init() {
6
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
- };
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- export {
23
- __esm,
24
- __export,
25
- __toCommonJS
26
- };
@@ -1,21 +0,0 @@
1
- import {
2
- init_catalog,
3
- init_discovery,
4
- init_interpolate,
5
- init_resolve,
6
- init_writer
7
- } from "./chunk-PRNQ7DXE.js";
8
-
9
- // src/skills/index.ts
10
- init_catalog();
11
- init_discovery();
12
- init_interpolate();
13
- init_resolve();
14
- init_writer();
15
- function defineSkill(config) {
16
- return config;
17
- }
18
-
19
- export {
20
- defineSkill
21
- };
@@ -1,110 +0,0 @@
1
- /**
2
- * Shared types for the agent system.
3
- */
4
- type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high';
5
- interface McpServerConfig {
6
- /** Display name (used for tool namespacing) */
7
- name: string;
8
- /** Transport type */
9
- transport: 'stdio' | 'sse' | 'streamable-http';
10
- /** For stdio: command to run */
11
- command?: string;
12
- /** For stdio: command arguments */
13
- args?: string[];
14
- /** For stdio: environment variables */
15
- env?: Record<string, string>;
16
- /** For sse/streamable-http: server URL */
17
- url?: string;
18
- /** Optional headers for HTTP transports */
19
- headers?: Record<string, string>;
20
- }
21
- type ToolExecutionMode = 'sequential' | 'parallel';
22
- interface ImageContent {
23
- type: 'image';
24
- source: {
25
- type: 'base64';
26
- media_type: string;
27
- data: string;
28
- };
29
- }
30
- type SessionContentBlock = {
31
- type: 'text';
32
- text: string;
33
- } | {
34
- type: 'image';
35
- mediaType: string;
36
- data: string;
37
- } | {
38
- type: 'tool_call';
39
- id: string;
40
- name: string;
41
- input: Record<string, unknown>;
42
- } | {
43
- type: 'tool_result';
44
- callId: string;
45
- output: string;
46
- isError?: boolean;
47
- } | {
48
- type: 'thinking';
49
- text: string;
50
- };
51
- interface SessionMessage {
52
- role: 'user' | 'assistant';
53
- content: SessionContentBlock[];
54
- }
55
- interface SessionTurn {
56
- /** UUID — generated by the store if it provides generateTurnId, else crypto.randomUUID() */
57
- id: string;
58
- role: 'user' | 'assistant' | 'system';
59
- content: SessionContentBlock[];
60
- /** Token usage — only present on assistant turns */
61
- usage?: TurnUsage;
62
- /** Unix timestamp (Date.now()) when the turn was created */
63
- createdAt: number;
64
- }
65
- interface AgentRunOptions {
66
- model?: string;
67
- prompt: string;
68
- system?: string;
69
- thinking?: ThinkingLevel;
70
- images?: ImageContent[];
71
- /** Abort signal — when triggered, the agent stops after the current turn */
72
- signal?: AbortSignal;
73
- /** Maximum agent loop iterations for this run (overrides agent-level default, default: 50) */
74
- maxTurns?: number;
75
- /** Maximum tokens per LLM response for this run (overrides agent-level default, default: 16384) */
76
- maxTokens?: number;
77
- /** Exact thinking token budget — overrides the level-based default when set */
78
- thinkingBudget?: number;
79
- }
80
- interface TurnUsage {
81
- input: number;
82
- output: number;
83
- /** Tokens written to cache (Anthropic) */
84
- cacheCreation?: number;
85
- /** Tokens read from cache (Anthropic) */
86
- cacheRead?: number;
87
- /** Thinking/reasoning tokens used */
88
- thinking?: number;
89
- /** Cost in USD as reported by the provider (OpenRouter) */
90
- cost?: number;
91
- }
92
- interface AgentStats {
93
- totalIn: number;
94
- totalOut: number;
95
- turns: number;
96
- elapsed: number;
97
- /** Per-turn usage breakdown */
98
- turnUsage?: TurnUsage[];
99
- /** Total cost in USD (sum of per-turn costs reported by provider) */
100
- cost?: number;
101
- /** Stats from child agents spawned during this run */
102
- children?: ChildRunStats[];
103
- }
104
- interface ChildRunStats {
105
- id: string;
106
- task: string;
107
- stats: AgentStats;
108
- }
109
-
110
- export type { AgentRunOptions as A, ChildRunStats as C, ImageContent as I, McpServerConfig as M, SessionContentBlock as S, ThinkingLevel as T, AgentStats as a, SessionMessage as b, SessionTurn as c, ToolExecutionMode as d, TurnUsage as e };