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
@@ -0,0 +1,15 @@
1
+ import {
2
+ basicTools,
3
+ basic_default,
4
+ definePreset
5
+ } from "./chunk-SP5NA6WF.js";
6
+ import "./chunk-F5UBXERT.js";
7
+ import "./chunk-TPXPVEH6.js";
8
+ import "./chunk-2EQT4EHD.js";
9
+ import "./chunk-37GD7NL3.js";
10
+ import "./chunk-LNN5UTS2.js";
11
+ export {
12
+ basic_default as basic,
13
+ basicTools,
14
+ definePreset
15
+ };
@@ -1,4 +1,4 @@
1
- export { j as AnthropicParams, k as CerebrasParams, ai as OpenAICompatAuthHeader, aj as OpenAICompatHttpError, ak as OpenAICompatParams, s as OpenAIParams, t as OpenRouterParams, x as Provider, y as ProviderCapabilities, V as StreamCallbacks, X as StreamOptions, Z as ToolCall, a3 as ToolResult, a7 as ToolSpec, a9 as TurnResult, ap as anthropic, ar as cerebras, as as classifyOpenAICompatError, aE as mapOAIFinishReason, aI as openai, aJ as openaiCompat, aK as openrouter } from './agent-D-ZFMbSd.js';
1
+ export { j as AnthropicParams, k as CerebrasParams, ag as OpenAICompatAuthHeader, ah as OpenAICompatHttpError, ai as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, x as ProviderCapabilities, T as StreamCallbacks, V as StreamOptions, X as ToolCall, a1 as ToolResult, a5 as ToolSpec, a7 as TurnResult, an as anthropic, ap as cerebras, aq as classifyOpenAICompatError, aB as mapOAIFinishReason, aE as openai, aF as openaiCompat, aG as openrouter } from './agent-vPBFXnu-.js';
2
2
  import 'hookable';
3
3
  import './types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/providers.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  cerebras,
4
4
  openai,
5
5
  openrouter
6
- } from "./chunk-FRNFVKWW.js";
6
+ } from "./chunk-CDRXC7A7.js";
7
7
  import {
8
8
  OpenAICompatHttpError,
9
9
  classifyOpenAICompatError,
10
10
  mapOAIFinishReason,
11
11
  openaiCompat
12
- } from "./chunk-LN4LLLHA.js";
13
- import "./chunk-7JTBBZ2U.js";
12
+ } from "./chunk-S3FCOMRI.js";
13
+ import "./chunk-LNN5UTS2.js";
14
14
  export {
15
15
  OpenAICompatHttpError,
16
16
  anthropic,
@@ -1,4 +1,4 @@
1
- import { K as SessionStore } from '../agent-D-ZFMbSd.js';
1
+ import { H as SessionStore } from '../agent-vPBFXnu-.js';
2
2
  import 'hookable';
3
3
  import '../types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/session.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { o as CreateSessionOptions, ag as FileMapAdapter, ah as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, B as SessionContentBlock, D as SessionData, G as SessionMessage, J as SessionRun, K as SessionStore, L as SessionTurn, aq as autoDetectAndConvert, av as createFileMapStore, aw as createMemoryStore, ax as createRemoteStore, ay as createSession, aB as fromAnthropic, aC as fromOpenAI, aD as loadSession, aM as toAnthropic, aN as toOpenAI } from './agent-D-ZFMbSd.js';
1
+ export { o as CreateSessionOptions, ae as FileMapAdapter, af as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, z as SessionContentBlock, B as SessionData, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, ao as autoDetectAndConvert, at as createFileMapStore, au as createMemoryStore, av as createRemoteStore, aw as createSession, ay as fromAnthropic, az as fromOpenAI, aA as loadSession, aI as toAnthropic, aJ as toOpenAI } from './agent-vPBFXnu-.js';
2
2
  import 'hookable';
3
3
  import './types-BpvTmawk.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/session.js CHANGED
@@ -4,15 +4,15 @@ import {
4
4
  createRemoteStore,
5
5
  createSession,
6
6
  loadSession
7
- } from "./chunk-VG2E6YK3.js";
7
+ } from "./chunk-PMCQOMV4.js";
8
8
  import {
9
9
  autoDetectAndConvert,
10
10
  fromAnthropic,
11
11
  fromOpenAI,
12
12
  toAnthropic,
13
13
  toOpenAI
14
- } from "./chunk-LN4LLLHA.js";
15
- import "./chunk-7JTBBZ2U.js";
14
+ } from "./chunk-S3FCOMRI.js";
15
+ import "./chunk-LNN5UTS2.js";
16
16
  export {
17
17
  autoDetectAndConvert,
18
18
  createFileMapStore,
@@ -1,4 +1,4 @@
1
- import { $ as ToolDef, N as SkillConfig, al as SkillActivationState, d as AgentHooks } from './agent-D-ZFMbSd.js';
1
+ import { Z as ToolDef, K as SkillConfig, aj as SkillActivationState, d as AgentHooks } from './agent-vPBFXnu-.js';
2
2
  import { Hookable } from 'hookable';
3
3
 
4
4
  declare const glob: ToolDef;
@@ -40,9 +40,9 @@ declare function createSkillsRunScriptTool(options: SkillsRunScriptToolOptions):
40
40
  *
41
41
  * Implements tier 2 of progressive disclosure per the Agent Skills spec.
42
42
  * Body is frontmatter-stripped (the model gets the markdown only, wrapped in
43
- * `<skill_content>` tags so the harness can identify it during context
44
- * management). Shell-interpolation (`!` `` `cmd` ``) runs per-activation rather
45
- * than once per agent, so values like `gh pr diff` reflect the current state.
43
+ * `<skill_content>` tags so downstream context management can identify it).
44
+ * Shell-interpolation (`!` `` `cmd` ``) runs per-activation rather than once
45
+ * per agent, so values like `gh pr diff` reflect the current state.
46
46
  */
47
47
 
48
48
  interface SkillsUseToolOptions {
package/dist/skills.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { d as AgentHooks, al as SkillActivationState, N as SkillConfig, ao as SkillSource, an as SkillDiagnostic, T as SkillsConfig } from './agent-D-ZFMbSd.js';
2
- export { ad as ActivationVia, ae as ActiveSkill, af as DeactivationReason, am as SkillActivationStateOptions, Q as SkillResource, az as createSkillActivationState } from './agent-D-ZFMbSd.js';
1
+ import { d as AgentHooks, aj as SkillActivationState, K as SkillConfig, am as SkillSource, al as SkillDiagnostic, N as SkillsConfig } from './agent-vPBFXnu-.js';
2
+ export { ab as ActivationVia, ac as ActiveSkill, ad as DeactivationReason, ak as SkillActivationStateOptions, L as SkillResource, ax as createSkillActivationState } from './agent-vPBFXnu-.js';
3
3
  import { Hookable } from 'hookable';
4
4
  import { b as ExecutionContext, c as ExecutionHandle } from './types-BpvTmawk.js';
5
5
  import '@modelcontextprotocol/sdk/client/index.js';
@@ -267,12 +267,6 @@ declare function interpolateShellCommands(instructions: string, execution: Execu
267
267
  * 4. Apply filters: `exclude`, `enabled` allowlist, optional project-skill trust gate
268
268
  */
269
269
  declare function resolveSkills(config: SkillsConfig): Promise<SkillConfig[]>;
270
- /**
271
- * Merge harness-level and agent-level SkillsConfig.
272
- * Agent-level settings take precedence for scalar fields.
273
- * Arrays (scan, write, exclude) are concatenated.
274
- */
275
- declare function mergeSkillsConfig(harness?: SkillsConfig, agent?: SkillsConfig): SkillsConfig | undefined;
276
270
 
277
271
  /**
278
272
  * Skill writer — materializes inline SkillConfig objects to disk as proper
@@ -307,4 +301,4 @@ declare function defineSkill(config: Omit<SkillConfig, 'source'> & {
307
301
  source?: SkillConfig['source'];
308
302
  }): SkillConfig;
309
303
 
310
- export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillActivationState, SkillConfig, SkillDiagnostic, SkillSource, type SkillValidationIssue, type SkillValidationResult, SkillsConfig, type SourcedScanPath, buildCatalog, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, mergeSkillsConfig, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
304
+ export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillActivationState, SkillConfig, SkillDiagnostic, SkillSource, type SkillValidationIssue, type SkillValidationResult, SkillsConfig, type SourcedScanPath, buildCatalog, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
package/dist/skills.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineSkill
3
- } from "./chunk-LVC7NQUZ.js";
3
+ } from "./chunk-BW3WTFIR.js";
4
4
  import {
5
5
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
6
6
  buildCatalog,
@@ -12,7 +12,6 @@ import {
12
12
  interpolateShellCommands,
13
13
  isToolAllowedByUnion,
14
14
  matchesAllowedTool,
15
- mergeSkillsConfig,
16
15
  parseAllowedToolPattern,
17
16
  parseFrontmatter,
18
17
  parseSkillFile,
@@ -22,8 +21,8 @@ import {
22
21
  validateSkillName,
23
22
  writeSkillToDisk,
24
23
  writeSkillsToDisk
25
- } from "./chunk-BCXXXJ3G.js";
26
- import "./chunk-7JTBBZ2U.js";
24
+ } from "./chunk-TPXPVEH6.js";
25
+ import "./chunk-LNN5UTS2.js";
27
26
  export {
28
27
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
29
28
  buildCatalog,
@@ -36,7 +35,6 @@ export {
36
35
  interpolateShellCommands,
37
36
  isToolAllowedByUnion,
38
37
  matchesAllowedTool,
39
- mergeSkillsConfig,
40
38
  parseAllowedToolPattern,
41
39
  parseFrontmatter,
42
40
  parseSkillFile,
@@ -0,0 +1,152 @@
1
+ import { Y as ToolContext, Z as ToolDef, h as AgentStats, l as ChildRunStats } from './agent-vPBFXnu-.js';
2
+ import { Preset } from './presets.js';
3
+
4
+ /**
5
+ * Interaction tool — lets the agent request structured input from the outside world.
6
+ *
7
+ * Not included in any preset by default. Add it explicitly:
8
+ *
9
+ * import { createInteractionTool } from 'zidane'
10
+ *
11
+ * const askUser = createInteractionTool({
12
+ * schema: { type: 'object', properties: { question: { type: 'string' } }, required: ['question'] },
13
+ * onRequest: async (payload) => {
14
+ * const answer = await promptUser(payload.question)
15
+ * return { answer }
16
+ * },
17
+ * })
18
+ *
19
+ * const preset = definePreset({ name: 'interactive', tools: { ...basicTools, ask_user: askUser } })
20
+ */
21
+
22
+ interface InteractionToolOptions {
23
+ /** JSON Schema for the request payload the model sends */
24
+ schema: Record<string, unknown>;
25
+ /** Tool name (default: 'interaction') */
26
+ name?: string;
27
+ /** Tool description shown to the model */
28
+ description?: string;
29
+ /** Called when the model invokes this tool. Receives the validated payload and tool context, returns data for the model. */
30
+ onRequest: (payload: Record<string, unknown>, ctx: ToolContext) => Promise<Record<string, unknown> | string>;
31
+ }
32
+ /**
33
+ * Create an interaction tool that lets the agent request structured input.
34
+ *
35
+ * The model calls this tool with a payload matching the schema.
36
+ * `onRequest` is called with the payload and should return the response
37
+ * (string or object) that gets sent back to the model as the tool result.
38
+ */
39
+ declare function createInteractionTool(options: InteractionToolOptions): ToolDef;
40
+
41
+ /**
42
+ * Spawn tool — create sub-agents from a parent agent.
43
+ *
44
+ * A configurable factory that reads the parent's preset-y fields from ToolContext.
45
+ *
46
+ * Usage — default (stateless, safe across parent agents):
47
+ * ```ts
48
+ * import { spawn } from 'zidane'
49
+ * import { definePreset, basicTools } from 'zidane/presets'
50
+ * const preset = definePreset({ name: 'orchestrator', tools: { ...basicTools, spawn } })
51
+ * ```
52
+ *
53
+ * Usage — with shared state (telemetry, lifecycle callbacks):
54
+ * ```ts
55
+ * const tool = createSpawnTool({ maxConcurrent: 5, onComplete })
56
+ * ```
57
+ *
58
+ * Key guarantees:
59
+ * - **Depth-capped** to `maxDepth` (default 3) to prevent infinite recursion.
60
+ * - **Concurrency slot is reserved synchronously** before any `await`, so a
61
+ * parent running tools in parallel cannot exceed `maxConcurrent`.
62
+ * - **Pre-aborted signals short-circuit** without paying agent-spawn cost.
63
+ * - **Abort / timeout / error are surfaced distinctly** in the returned text
64
+ * and via `ChildRunStats.status` on `spawn:complete`.
65
+ * - **`agent.destroy()` errors never mask the original run error** (captured
66
+ * and emitted via `spawn:error` but the primary error wins).
67
+ * - **Child hooks bubble** to the parent as `child:*` events when
68
+ * `forwardHooks` is set (default `true`).
69
+ * - **Persistence** via `persist: true` — child runs get appended to the
70
+ * parent's session with `parentRunId` wired, so the run tree is
71
+ * reconstructible from a stored `SessionData`.
72
+ */
73
+
74
+ interface ChildAgent {
75
+ id: string;
76
+ task: string;
77
+ startedAt: number;
78
+ /** Subagent depth — 1 for a direct child of a top-level agent. */
79
+ depth: number;
80
+ }
81
+ interface SpawnToolState {
82
+ /** Currently running children. */
83
+ readonly children: ReadonlyMap<string, ChildAgent>;
84
+ /** Aggregated stats from all completed children (returns a copy). */
85
+ readonly totalChildStats: Readonly<AgentStats>;
86
+ }
87
+ interface SpawnToolOptions {
88
+ /** Maximum concurrent sub-agents (default: 3). */
89
+ maxConcurrent?: number;
90
+ /**
91
+ * Maximum subagent depth. 0 disables spawning entirely; 1 allows top-level
92
+ * spawns but forbids grandchildren; 3 (default) allows three levels of
93
+ * recursion — enough for most orchestration patterns, a sharp ceiling
94
+ * against runaway loops.
95
+ */
96
+ maxDepth?: number;
97
+ /** Child model override. */
98
+ model?: string;
99
+ /** Child system prompt override. Per-spawn `input.system` takes precedence. */
100
+ system?: string;
101
+ /** Child thinking level. */
102
+ thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
103
+ /** Preset override for children. Shallow-merged over the parent's preset (parent fields still win for anything left unset). */
104
+ preset?: Preset;
105
+ /**
106
+ * Per-child timeout, in milliseconds. When the child exceeds it the spawn
107
+ * tool returns a timeout marker, fires `spawn:error`, and destroys the
108
+ * child agent. Default: none.
109
+ */
110
+ timeoutMs?: number;
111
+ /**
112
+ * When `true` and the parent has a session, the child reuses the parent's
113
+ * session — child turns are appended with the child's own `runId`, and the
114
+ * resulting `SessionRun` carries `parentRunId` so the tree is
115
+ * reconstructible. Default: `false` (child is in-memory only).
116
+ */
117
+ persist?: boolean;
118
+ /**
119
+ * Forward a curated subset of child hook events (`stream:*`, `tool:*`,
120
+ * `turn:after`) onto the parent's hook bus as `child:*` events. Default:
121
+ * `true`. Grandchildren bubble through their child transparently.
122
+ */
123
+ forwardHooks?: boolean;
124
+ /** Called when a child agent starts. */
125
+ onSpawn?: (child: ChildAgent) => void;
126
+ /** Called when a child agent completes (success, abort, timeout, or error). */
127
+ onComplete?: (child: ChildAgent, stats: AgentStats, status: NonNullable<ChildRunStats['status']>) => void;
128
+ }
129
+ /**
130
+ * Create a configured spawn tool.
131
+ *
132
+ * State (`children`, `totalChildStats`, counters, active count) is scoped to
133
+ * the returned instance. Multiple parent agents using the same instance will
134
+ * share counters + stats + concurrency slots — call `createSpawnTool()` per
135
+ * agent (or use the stateless default `spawn`) to keep them isolated.
136
+ */
137
+ declare function createSpawnTool(options?: SpawnToolOptions): ToolDef & SpawnToolState;
138
+ /**
139
+ * Default spawn tool.
140
+ *
141
+ * Historically this was a module-scoped `createSpawnTool()` instance shared
142
+ * across every agent using `basic` — which meant `maxConcurrent`, `children`,
143
+ * and `totalChildStats` leaked between unrelated runs. The shared-state
144
+ * surface is preserved for backward compat: the spec + execute still work
145
+ * standalone.
146
+ *
147
+ * Prefer calling `createSpawnTool()` explicitly when you care about
148
+ * telemetry isolation between agents.
149
+ */
150
+ declare const spawn: ToolDef & SpawnToolState;
151
+
152
+ export { type ChildAgent as C, type InteractionToolOptions as I, type SpawnToolOptions as S, type SpawnToolState as a, createSpawnTool as b, createInteractionTool as c, spawn as s };
package/dist/tools.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, g as glob } from './skills-use-C4KFVla0.js';
2
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-RoqpjYLZ.js';
3
- import { $ as ToolDef } from './agent-D-ZFMbSd.js';
1
+ export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, g as glob } from './skills-use-39cCsA7_.js';
2
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-Czx3owjX.js';
3
+ import { Z as ToolDef } from './agent-vPBFXnu-.js';
4
+ export { Y as ToolContext, a0 as ToolMap } from './agent-vPBFXnu-.js';
4
5
  export { V as ValidationResult, v as validateToolArgs } from './validation-DOY_k7lW.js';
5
6
  import 'hookable';
7
+ import './presets.js';
6
8
  import './types-BpvTmawk.js';
7
9
  import '@modelcontextprotocol/sdk/client/index.js';
8
10
 
@@ -14,4 +16,4 @@ declare const shell: ToolDef;
14
16
 
15
17
  declare const writeFile: ToolDef;
16
18
 
17
- export { listFiles, readFile, shell, writeFile };
19
+ export { ToolDef, listFiles, readFile, shell, writeFile };
package/dist/tools.js CHANGED
@@ -11,11 +11,11 @@ import {
11
11
  spawn,
12
12
  validateToolArgs,
13
13
  writeFile
14
- } from "./chunk-PASFWG7S.js";
15
- import "./chunk-BCXXXJ3G.js";
16
- import "./chunk-SZA4FKW5.js";
17
- import "./chunk-PJUUYBKF.js";
18
- import "./chunk-7JTBBZ2U.js";
14
+ } from "./chunk-F5UBXERT.js";
15
+ import "./chunk-TPXPVEH6.js";
16
+ import "./chunk-2EQT4EHD.js";
17
+ import "./chunk-37GD7NL3.js";
18
+ import "./chunk-LNN5UTS2.js";
19
19
  export {
20
20
  createInteractionTool,
21
21
  createSkillsReadTool,
package/dist/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, H as Harness, p as HarnessConfig, I as ImageContent, M as McpConnection, q as McpServerConfig, r as McpToolHookContext, O as OAuthRefreshHookContext, s as OpenAIParams, t as OpenRouterParams, P as PromptDocumentPart, u as PromptImagePart, v as PromptPart, w as PromptTextPart, x as Provider, y as ProviderCapabilities, R as RemoteStoreOptions, z as RunHookMap, S as Session, B as SessionContentBlock, D as SessionData, E as SessionEndStatus, F as SessionHookContext, G as SessionMessage, J as SessionRun, K as SessionStore, L as SessionTurn, N as SkillConfig, Q as SkillResource, T as SkillsConfig, U as SpawnHookContext, V as StreamCallbacks, W as StreamHookContext, X as StreamOptions, Y as ThinkingLevel, Z as ToolCall, _ as ToolContext, $ as ToolDef, a0 as ToolExecutionMode, a1 as ToolHookContext, a2 as ToolMap, a3 as ToolResult, a4 as ToolResultContent, a5 as ToolResultImageContent, a6 as ToolResultTextContent, a7 as ToolSpec, a8 as TurnFinishReason, a9 as TurnResult, aa as TurnUsage, ab as matchesContextExceeded, ac as toolResultToText } from './agent-D-ZFMbSd.js';
1
+ export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, e as AgentOptions, f as AgentProviderError, g as AgentRunOptions, h as AgentStats, i as AgentToolNotAllowedError, j as AnthropicParams, C as CONTEXT_EXCEEDED_MESSAGE_PATTERNS, k as CerebrasParams, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, r as OpenAIParams, s as OpenRouterParams, P as PromptDocumentPart, t as PromptImagePart, u as PromptPart, v as PromptTextPart, w as Provider, x as ProviderCapabilities, R as RemoteStoreOptions, y as RunHookMap, S as Session, z as SessionContentBlock, B as SessionData, D as SessionEndStatus, E as SessionHookContext, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, K as SkillConfig, L as SkillResource, N as SkillsConfig, Q as SpawnHookContext, T as StreamCallbacks, U as StreamHookContext, V as StreamOptions, W as ThinkingLevel, X as ToolCall, Y as ToolContext, Z as ToolDef, _ as ToolExecutionMode, $ as ToolHookContext, a0 as ToolMap, a1 as ToolResult, a2 as ToolResultContent, a3 as ToolResultImageContent, a4 as ToolResultTextContent, a5 as ToolSpec, a6 as TurnFinishReason, a7 as TurnResult, a8 as TurnUsage, a9 as matchesContextExceeded, aa as toolResultToText } from './agent-vPBFXnu-.js';
2
2
  export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-BpvTmawk.js';
3
3
  export { S as SandboxProvider } from './sandbox-CW72eLDP.js';
4
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-RoqpjYLZ.js';
4
+ export { Preset } from './presets.js';
5
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-Czx3owjX.js';
5
6
  export { V as ValidationResult } from './validation-DOY_k7lW.js';
6
7
  import 'hookable';
7
8
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/types.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  AgentToolNotAllowedError,
9
9
  CONTEXT_EXCEEDED_MESSAGE_PATTERNS,
10
10
  matchesContextExceeded
11
- } from "./chunk-7JTBBZ2U.js";
11
+ } from "./chunk-LNN5UTS2.js";
12
12
  export {
13
13
  AgentAbortedError,
14
14
  AgentContextExceededError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,
@@ -30,9 +30,9 @@
30
30
  "import": "./dist/tools.js",
31
31
  "types": "./dist/tools.d.ts"
32
32
  },
33
- "./harnesses": {
34
- "import": "./dist/harnesses.js",
35
- "types": "./dist/harnesses.d.ts"
33
+ "./presets": {
34
+ "import": "./dist/presets.js",
35
+ "types": "./dist/presets.d.ts"
36
36
  },
37
37
  "./contexts": {
38
38
  "import": "./dist/contexts.js",
@@ -90,8 +90,8 @@
90
90
  }
91
91
  },
92
92
  "devDependencies": {
93
- "@anthropic-ai/sdk": "^0.88.0",
94
93
  "@antfu/eslint-config": "^8.1.1",
94
+ "@anthropic-ai/sdk": "^0.88.0",
95
95
  "@modelcontextprotocol/sdk": "^1.29.0",
96
96
  "@types/bun": "^1.3.12",
97
97
  "@types/dockerode": "^4.0.1",
@@ -1,4 +0,0 @@
1
- import 'hookable';
2
- export { H as Harness, p as HarnessConfig, _ as ToolContext, $ as ToolDef, a2 as ToolMap, aP as basic, aQ as basicTools, aA as defineHarness, aF as noTools } from './agent-D-ZFMbSd.js';
3
- import './types-BpvTmawk.js';
4
- import '@modelcontextprotocol/sdk/client/index.js';
package/dist/harnesses.js DELETED
@@ -1,17 +0,0 @@
1
- import {
2
- basicTools,
3
- basic_default,
4
- defineHarness,
5
- noTools
6
- } from "./chunk-OVQ4N64O.js";
7
- import "./chunk-PASFWG7S.js";
8
- import "./chunk-BCXXXJ3G.js";
9
- import "./chunk-SZA4FKW5.js";
10
- import "./chunk-PJUUYBKF.js";
11
- import "./chunk-7JTBBZ2U.js";
12
- export {
13
- basic_default as basic,
14
- basicTools,
15
- defineHarness,
16
- noTools
17
- };
@@ -1,99 +0,0 @@
1
- import { _ as ToolContext, $ as ToolDef, p as HarnessConfig, h as AgentStats } from './agent-D-ZFMbSd.js';
2
-
3
- /**
4
- * Interaction tool — lets the agent request structured input from the outside world.
5
- *
6
- * Not included in any harness by default. Add it explicitly:
7
- *
8
- * import { createInteractionTool } from 'zidane'
9
- *
10
- * const askUser = createInteractionTool({
11
- * schema: { type: 'object', properties: { question: { type: 'string' } }, required: ['question'] },
12
- * onRequest: async (payload) => {
13
- * const answer = await promptUser(payload.question)
14
- * return { answer }
15
- * },
16
- * })
17
- *
18
- * const harness = defineHarness({ name: 'interactive', tools: { ...basicTools, ask_user: askUser } })
19
- */
20
-
21
- interface InteractionToolOptions {
22
- /** JSON Schema for the request payload the model sends */
23
- schema: Record<string, unknown>;
24
- /** Tool name (default: 'interaction') */
25
- name?: string;
26
- /** Tool description shown to the model */
27
- description?: string;
28
- /** Called when the model invokes this tool. Receives the validated payload and tool context, returns data for the model. */
29
- onRequest: (payload: Record<string, unknown>, ctx: ToolContext) => Promise<Record<string, unknown> | string>;
30
- }
31
- /**
32
- * Create an interaction tool that lets the agent request structured input.
33
- *
34
- * The model calls this tool with a payload matching the schema.
35
- * `onRequest` is called with the payload and should return the response
36
- * (string or object) that gets sent back to the model as the tool result.
37
- */
38
- declare function createInteractionTool(options: InteractionToolOptions): ToolDef;
39
-
40
- /**
41
- * Spawn tool — create sub-agents from a parent agent.
42
- *
43
- * A static tool that reads provider and harness from ToolContext.
44
- * Just add it to any harness's tools — no factory needed.
45
- *
46
- * Usage:
47
- * import { spawn } from 'zidane'
48
- *
49
- * const harness = defineHarness({
50
- * name: 'orchestrator',
51
- * tools: { ...basicTools, spawn },
52
- * })
53
- */
54
-
55
- interface ChildAgent {
56
- id: string;
57
- task: string;
58
- startedAt: number;
59
- }
60
- interface SpawnToolState {
61
- /** Currently running children */
62
- readonly children: ReadonlyMap<string, ChildAgent>;
63
- /** Aggregated stats from all completed children (returns a copy) */
64
- readonly totalChildStats: Readonly<AgentStats>;
65
- }
66
- interface SpawnToolOptions {
67
- /** Maximum concurrent sub-agents (default: 3) */
68
- maxConcurrent?: number;
69
- /** Model override for child agents */
70
- model?: string;
71
- /** System prompt for child agents */
72
- system?: string;
73
- /** Thinking level for child agents */
74
- thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
75
- /** Override harness for children (defaults to parent's harness from ToolContext) */
76
- harness?: HarnessConfig;
77
- /** Called when a child agent starts */
78
- onSpawn?: (child: ChildAgent) => void;
79
- /** Called when a child agent completes */
80
- onComplete?: (child: ChildAgent, stats: AgentStats) => void;
81
- }
82
- /**
83
- * Create a configured spawn tool with custom options.
84
- *
85
- * For most cases, use the static `spawn` export directly.
86
- * Use this factory when you need custom concurrency limits,
87
- * model overrides, or lifecycle callbacks.
88
- */
89
- declare function createSpawnTool(options?: SpawnToolOptions): ToolDef & SpawnToolState;
90
- /**
91
- * Static spawn tool — add directly to any harness.
92
- *
93
- * Reads provider and harness from ToolContext at execution time.
94
- * Children get the same harness as the parent (including spawn),
95
- * so sub-agents can spawn their own children.
96
- */
97
- declare const spawn: ToolDef & SpawnToolState;
98
-
99
- export { type ChildAgent as C, type InteractionToolOptions as I, type SpawnToolOptions as S, type SpawnToolState as a, createSpawnTool as b, createInteractionTool as c, spawn as s };