zidane 1.6.5 → 1.6.7

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.
@@ -64,6 +64,7 @@ type SessionContentBlock = {
64
64
  } | {
65
65
  type: 'thinking';
66
66
  text: string;
67
+ signature?: string;
67
68
  };
68
69
  interface SessionMessage {
69
70
  role: 'user' | 'assistant';
@@ -126,6 +127,35 @@ interface ChildRunStats {
126
127
  task: string;
127
128
  stats: AgentStats;
128
129
  }
130
+ /** Base context for tool execution hooks */
131
+ interface ToolHookContext {
132
+ turnId: string;
133
+ callId: string;
134
+ name: string;
135
+ input: Record<string, unknown>;
136
+ }
137
+ /** Base context for MCP tool hooks */
138
+ interface McpToolHookContext {
139
+ turnId: string;
140
+ callId: string;
141
+ server: string;
142
+ tool: string;
143
+ input: Record<string, unknown>;
144
+ }
145
+ /** Base context for session hooks */
146
+ interface SessionHookContext {
147
+ sessionId: string;
148
+ }
149
+ /** Base context for spawn hooks */
150
+ interface SpawnHookContext {
151
+ id: string;
152
+ task: string;
153
+ }
154
+ /** Context for stream hooks */
155
+ interface StreamHookContext {
156
+ turnId: string;
157
+ }
158
+ type SessionEndStatus = 'completed' | 'aborted' | 'error';
129
159
 
130
160
  interface AnthropicParams {
131
161
  apiKey?: string;
@@ -238,6 +268,10 @@ interface ToolContext {
238
268
  hooks: Hookable<AgentHooks>;
239
269
  /** The harness config for this agent (tools available to the agent) */
240
270
  harness: HarnessConfig;
271
+ /** Turn ID that requested this tool call */
272
+ turnId: string;
273
+ /** Tool call ID from the model */
274
+ callId: string;
241
275
  }
242
276
  interface ToolDef {
243
277
  spec: ToolSpec;
@@ -505,43 +539,29 @@ interface AgentHooks {
505
539
  usage: TurnUsage;
506
540
  message: SessionTurn;
507
541
  }) => void;
508
- 'stream:text': (ctx: {
542
+ 'stream:text': (ctx: StreamHookContext & {
509
543
  delta: string;
510
544
  text: string;
511
- turnId: string;
512
545
  }) => void;
513
- 'stream:end': (ctx: {
546
+ 'stream:end': (ctx: StreamHookContext & {
514
547
  text: string;
515
- turnId: string;
516
548
  }) => void;
517
- 'stream:thinking': (ctx: {
549
+ 'stream:thinking': (ctx: StreamHookContext & {
518
550
  delta: string;
519
551
  thinking: string;
520
- turnId: string;
521
552
  }) => void;
522
- 'tool:before': (ctx: {
523
- name: string;
524
- input: Record<string, unknown>;
553
+ 'tool:gate': (ctx: ToolHookContext & {
554
+ block: boolean;
555
+ reason: string;
525
556
  }) => void;
526
- 'tool:after': (ctx: {
527
- name: string;
528
- input: Record<string, unknown>;
557
+ 'tool:before': (ctx: ToolHookContext) => void;
558
+ 'tool:after': (ctx: ToolHookContext & {
529
559
  result: string;
530
560
  }) => void;
531
- 'tool:error': (ctx: {
532
- name: string;
533
- input: Record<string, unknown>;
561
+ 'tool:error': (ctx: ToolHookContext & {
534
562
  error: Error;
535
563
  }) => void;
536
- 'tool:gate': (ctx: {
537
- name: string;
538
- input: Record<string, unknown>;
539
- block: boolean;
540
- reason: string;
541
- }) => void;
542
- 'tool:transform': (ctx: {
543
- name: string;
544
- input: Record<string, unknown>;
564
+ 'tool:transform': (ctx: ToolHookContext & {
545
565
  result: string;
546
566
  isError: boolean;
547
567
  }) => void;
@@ -551,14 +571,9 @@ interface AgentHooks {
551
571
  'steer:inject': (ctx: {
552
572
  message: string;
553
573
  }) => void;
574
+ 'spawn:before': (ctx: SpawnHookContext) => void;
554
575
  'spawn:complete': (ctx: ChildRunStats) => void;
555
- 'spawn:before': (ctx: {
556
- id: string;
557
- task: string;
558
- }) => void;
559
- 'spawn:error': (ctx: {
560
- id: string;
561
- task: string;
576
+ 'spawn:error': (ctx: SpawnHookContext & {
562
577
  error: Error;
563
578
  }) => void;
564
579
  'mcp:connect': (ctx: {
@@ -573,21 +588,18 @@ interface AgentHooks {
573
588
  'mcp:close': (ctx: {
574
589
  name: string;
575
590
  }) => void;
576
- 'mcp:tool:before': (ctx: {
577
- server: string;
578
- tool: string;
579
- input: Record<string, unknown>;
591
+ 'mcp:tool:gate': (ctx: McpToolHookContext & {
592
+ block: boolean;
593
+ reason: string;
594
+ }) => void;
595
+ 'mcp:tool:before': (ctx: McpToolHookContext) => void;
596
+ 'mcp:tool:after': (ctx: McpToolHookContext & {
597
+ result: string;
580
598
  }) => void;
581
- 'mcp:tool:after': (ctx: {
582
- server: string;
583
- tool: string;
584
- input: Record<string, unknown>;
599
+ 'mcp:tool:transform': (ctx: McpToolHookContext & {
585
600
  result: string;
586
601
  }) => void;
587
- 'mcp:tool:error': (ctx: {
588
- server: string;
589
- tool: string;
590
- input: Record<string, unknown>;
602
+ 'mcp:tool:error': (ctx: McpToolHookContext & {
591
603
  error: Error;
592
604
  }) => void;
593
605
  'skills:resolve': (ctx: {
@@ -613,29 +625,23 @@ interface AgentHooks {
613
625
  }) => void;
614
626
  'agent:abort': (ctx: object) => void;
615
627
  'agent:done': (ctx: AgentStats) => void;
616
- 'session:start': (ctx: {
617
- sessionId: string;
628
+ 'session:start': (ctx: SessionHookContext & {
618
629
  runId: string;
619
630
  prompt: string;
620
631
  }) => void;
621
- 'session:end': (ctx: {
622
- sessionId: string;
632
+ 'session:end': (ctx: SessionHookContext & {
623
633
  runId: string;
624
- status: 'completed' | 'aborted' | 'error';
634
+ status: SessionEndStatus;
625
635
  turnRange: [number, number];
626
636
  }) => void;
627
- 'session:turns': (ctx: {
628
- sessionId: string;
637
+ 'session:turns': (ctx: SessionHookContext & {
629
638
  count: number;
630
639
  }) => void;
631
- 'session:meta': (ctx: {
632
- sessionId: string;
640
+ 'session:meta': (ctx: SessionHookContext & {
633
641
  key: string;
634
642
  value: unknown;
635
643
  }) => void;
636
- 'session:save': (ctx: {
637
- sessionId: string;
638
- }) => void;
644
+ 'session:save': (ctx: SessionHookContext) => void;
639
645
  }
640
646
  interface AgentOptions {
641
647
  /** Harness (tools + system prompt). Defaults to a no-tools harness if omitted. */
@@ -673,4 +679,4 @@ interface Agent {
673
679
  }
674
680
  declare function createAgent({ harness: harnessOption, provider, behavior: agentBehavior, execution, mcpServers, session, skills: agentSkills, _mcpConnector }: AgentOptions): Agent;
675
681
 
676
- export { cerebras as $, type Agent as A, type TurnResult as B, type CerebrasParams as C, type TurnUsage as D, autoDetectAndConvert as E, connectMcpServers as F, createAgent as G, type Harness as H, type ImageContent as I, createMemoryStore as J, createRemoteStore as K, createSession as L, type McpConnection as M, createSqliteStore as N, type OpenRouterParams as O, type Provider as P, defineHarness as Q, type RemoteStoreOptions as R, type Session as S, type ThinkingLevel as T, fromAnthropic as U, fromOpenAI as V, loadSession as W, noTools as X, toAnthropic as Y, toOpenAI as Z, anthropic as _, type AgentBehavior as a, openrouter as a0, _default as a1, basicTools as a2, resultToString as a3, type AgentHooks as b, type AgentOptions as c, type AgentRunOptions as d, type AgentStats as e, type AnthropicParams as f, type ChildRunStats as g, type CreateSessionOptions as h, type HarnessConfig as i, type McpServerConfig as j, type SessionContentBlock as k, type SessionData as l, type SessionMessage as m, type SessionRun as n, type SessionStore as o, type SessionTurn as p, type SqliteStoreOptions as q, type StreamCallbacks as r, type StreamOptions as s, type ToolCall as t, type ToolContext as u, type ToolDef as v, type ToolExecutionMode as w, type ToolMap as x, type ToolResult as y, type ToolSpec as z };
682
+ export { fromOpenAI as $, type Agent as A, type ToolDef as B, type CerebrasParams as C, type ToolExecutionMode as D, type ToolHookContext as E, type ToolMap as F, type ToolResult as G, type Harness as H, type ImageContent as I, type ToolSpec as J, type TurnResult as K, type TurnUsage as L, type McpConnection as M, autoDetectAndConvert as N, type OpenRouterParams as O, type Provider as P, connectMcpServers as Q, type RemoteStoreOptions as R, type Session as S, type ThinkingLevel as T, createAgent as U, createMemoryStore as V, createRemoteStore as W, createSession as X, createSqliteStore as Y, defineHarness as Z, fromAnthropic as _, type AgentBehavior as a, loadSession as a0, noTools as a1, toAnthropic as a2, toOpenAI as a3, anthropic as a4, cerebras as a5, openrouter as a6, _default as a7, basicTools as a8, resultToString as a9, type AgentHooks as b, type AgentOptions as c, type AgentRunOptions as d, type AgentStats as e, type AnthropicParams as f, type ChildRunStats as g, type CreateSessionOptions as h, type HarnessConfig as i, type McpServerConfig as j, type McpToolHookContext as k, type SessionContentBlock as l, type SessionData as m, type SessionEndStatus as n, type SessionHookContext as o, type SessionMessage as p, type SessionRun as q, type SessionStore as r, type SessionTurn as s, type SpawnHookContext as t, type SqliteStoreOptions as u, type StreamCallbacks as v, type StreamHookContext as w, type StreamOptions as x, type ToolCall as y, type ToolContext as z };
@@ -53,15 +53,23 @@ async function connectMcpServers(configs, _clientFactory, hooks) {
53
53
  description: tool.description || "",
54
54
  inputSchema: tool.inputSchema ?? { type: "object", properties: {} }
55
55
  },
56
- execute: async (input, _ctx) => {
57
- await hooks?.callHook("mcp:tool:before", { server: config.name, tool: tool.name, input });
56
+ execute: async (input, ctx) => {
57
+ const { turnId, callId } = ctx;
58
+ const gateCtx = { turnId, callId, server: config.name, tool: tool.name, input, block: false, reason: "MCP tool execution was blocked" };
59
+ await hooks?.callHook("mcp:tool:gate", gateCtx);
60
+ if (gateCtx.block)
61
+ return `Blocked: ${gateCtx.reason}`;
62
+ await hooks?.callHook("mcp:tool:before", { turnId, callId, server: config.name, tool: tool.name, input });
58
63
  try {
59
64
  const result = await client.callTool({ name: tool.name, arguments: input });
60
- const output = resultToString(result.content);
61
- await hooks?.callHook("mcp:tool:after", { server: config.name, tool: tool.name, input, result: output });
65
+ let output = resultToString(result.content);
66
+ const transformCtx = { turnId, callId, server: config.name, tool: tool.name, input, result: output };
67
+ await hooks?.callHook("mcp:tool:transform", transformCtx);
68
+ output = transformCtx.result;
69
+ await hooks?.callHook("mcp:tool:after", { turnId, callId, server: config.name, tool: tool.name, input, result: output });
62
70
  return output;
63
71
  } catch (err) {
64
- await hooks?.callHook("mcp:tool:error", { server: config.name, tool: tool.name, input, error: err });
72
+ await hooks?.callHook("mcp:tool:error", { turnId, callId, server: config.name, tool: tool.name, input, error: err });
65
73
  throw err;
66
74
  }
67
75
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  connectMcpServers
3
- } from "./chunk-NNMWWSBY.js";
3
+ } from "./chunk-5LOHDFK3.js";
4
4
  import {
5
5
  buildCatalog,
6
6
  interpolateShellCommands,
@@ -395,14 +395,10 @@ async function runLoop(ctx) {
395
395
  });
396
396
  continue;
397
397
  }
398
- const stats2 = { totalIn, totalOut, turns: turn + 1, elapsed: Date.now() - startTime, turnUsage: turnUsages, output: result.output };
399
- await ctx.hooks.callHook("agent:done", stats2);
400
- return stats2;
398
+ return { totalIn, totalOut, turns: turn + 1, elapsed: Date.now() - startTime, turnUsage: turnUsages, output: result.output };
401
399
  }
402
400
  }
403
- const stats = { totalIn, totalOut, turns: maxTurns, elapsed: Date.now() - startTime, turnUsage: turnUsages };
404
- await ctx.hooks.callHook("agent:done", stats);
405
- return stats;
401
+ return { totalIn, totalOut, turns: maxTurns, elapsed: Date.now() - startTime, turnUsage: turnUsages };
406
402
  }
407
403
  async function executeTurn(ctx, turn) {
408
404
  const turnId = await ctx.generateTurnId();
@@ -508,7 +504,7 @@ async function executeTurn(ctx, turn) {
508
504
  }
509
505
  return { ended: true, turnId, usage: result.usage };
510
506
  }
511
- const toolResults = ctx.toolExecution === "parallel" ? await executeToolsParallel(ctx, result.toolCalls) : await executeToolsSequential(ctx, result.toolCalls);
507
+ const toolResults = ctx.toolExecution === "parallel" ? await executeToolsParallel(ctx, result.toolCalls, turnId) : await executeToolsSequential(ctx, result.toolCalls, turnId);
512
508
  const toolResultMsg = ctx.provider.toolResultsMessage(toolResults);
513
509
  ctx.turns.push({
514
510
  id: await ctx.generateTurnId(),
@@ -519,23 +515,24 @@ async function executeTurn(ctx, turn) {
519
515
  });
520
516
  return { ended: false, turnId, usage: result.usage };
521
517
  }
522
- async function executeSingleTool(ctx, call) {
518
+ async function executeSingleTool(ctx, call, turnId) {
523
519
  const toolDef = ctx.tools[call.name];
524
- const gateCtx = { name: call.name, input: call.input, block: false, reason: "Tool execution was blocked" };
520
+ const callId = call.id;
521
+ const gateCtx = { turnId, callId, name: call.name, input: call.input, block: false, reason: "Tool execution was blocked" };
525
522
  await ctx.hooks.callHook("tool:gate", gateCtx);
526
523
  if (gateCtx.block) {
527
- return { result: { id: call.id, content: `Blocked: ${gateCtx.reason}` } };
524
+ return { result: { id: callId, content: `Blocked: ${gateCtx.reason}` } };
528
525
  }
529
526
  if (!toolDef) {
530
527
  const err = new Error(`Unknown tool: ${call.name}`);
531
- await ctx.hooks.callHook("tool:error", { name: call.name, input: call.input, error: err });
532
- return { result: { id: call.id, content: `Tool error: ${err.message}` } };
528
+ await ctx.hooks.callHook("tool:error", { turnId, callId, name: call.name, input: call.input, error: err });
529
+ return { result: { id: callId, content: `Tool error: ${err.message}` } };
533
530
  }
534
531
  const validation = validateToolArgs(call.input, toolDef.spec.inputSchema);
535
532
  if (!validation.valid) {
536
- return { result: { id: call.id, content: `Validation error: ${validation.error}` } };
533
+ return { result: { id: callId, content: `Validation error: ${validation.error}` } };
537
534
  }
538
- await ctx.hooks.callHook("tool:before", { name: call.name, input: call.input });
535
+ await ctx.hooks.callHook("tool:before", { turnId, callId, name: call.name, input: call.input });
539
536
  let output;
540
537
  let isError = false;
541
538
  try {
@@ -545,22 +542,24 @@ async function executeSingleTool(ctx, call) {
545
542
  execution: ctx.execution,
546
543
  handle: ctx.handle,
547
544
  hooks: ctx.hooks,
548
- harness: ctx.harness
545
+ harness: ctx.harness,
546
+ turnId,
547
+ callId
549
548
  };
550
549
  output = await toolDef.execute(call.input, toolCtx);
551
550
  } catch (err) {
552
- await ctx.hooks.callHook("tool:error", { name: call.name, input: call.input, error: err });
551
+ await ctx.hooks.callHook("tool:error", { turnId, callId, name: call.name, input: call.input, error: err });
553
552
  output = `Tool error: ${err.message}`;
554
553
  isError = true;
555
554
  }
556
- const transformCtx = { name: call.name, input: call.input, result: output, isError };
555
+ const transformCtx = { turnId, callId, name: call.name, input: call.input, result: output, isError };
557
556
  await ctx.hooks.callHook("tool:transform", transformCtx);
558
557
  output = transformCtx.result;
559
558
  isError = transformCtx.isError;
560
- await ctx.hooks.callHook("tool:after", { name: call.name, input: call.input, result: output });
561
- return { result: { id: call.id, content: output } };
559
+ await ctx.hooks.callHook("tool:after", { turnId, callId, name: call.name, input: call.input, result: output });
560
+ return { result: { id: callId, content: output } };
562
561
  }
563
- async function executeToolsSequential(ctx, toolCalls) {
562
+ async function executeToolsSequential(ctx, toolCalls, turnId) {
564
563
  const results = [];
565
564
  for (const call of toolCalls) {
566
565
  if (ctx.signal.aborted)
@@ -589,13 +588,13 @@ async function executeToolsSequential(ctx, toolCalls) {
589
588
  });
590
589
  return [];
591
590
  }
592
- const { result } = await executeSingleTool(ctx, call);
591
+ const { result } = await executeSingleTool(ctx, call, turnId);
593
592
  results.push(result);
594
593
  }
595
594
  return results;
596
595
  }
597
- async function executeToolsParallel(ctx, toolCalls) {
598
- const executions = toolCalls.map((call) => executeSingleTool(ctx, call));
596
+ async function executeToolsParallel(ctx, toolCalls, turnId) {
597
+ const executions = toolCalls.map((call) => executeSingleTool(ctx, call, turnId));
599
598
  const settled = await Promise.all(executions);
600
599
  return settled.map((s) => s.result);
601
600
  }
@@ -200,7 +200,7 @@ function fromAnthropic(msg) {
200
200
  const output = typeof b.content === "string" ? b.content : JSON.stringify(b.content);
201
201
  content.push({ type: "tool_result", callId: b.tool_use_id, output });
202
202
  } else if (b.type === "thinking") {
203
- content.push({ type: "thinking", text: b.thinking });
203
+ content.push({ type: "thinking", text: b.thinking, signature: b.signature });
204
204
  }
205
205
  }
206
206
  }
@@ -269,7 +269,7 @@ function toAnthropic(msg) {
269
269
  case "tool_result":
270
270
  return { type: "tool_result", tool_use_id: block.callId, content: block.output };
271
271
  case "thinking":
272
- return { type: "thinking", thinking: block.text };
272
+ return { type: "thinking", thinking: block.text, signature: block.signature };
273
273
  default:
274
274
  return { type: "text", text: "" };
275
275
  }
@@ -4,7 +4,7 @@ import {
4
4
  shell,
5
5
  spawn,
6
6
  writeFile
7
- } from "./chunk-R7PIZ4MU.js";
7
+ } from "./chunk-GCALAOLD.js";
8
8
 
9
9
  // src/harnesses/basic.ts
10
10
  var basicTools = { shell, readFile, writeFile, 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-BDZbObgy.js';
2
+ export { H as Harness, i as HarnessConfig, z as ToolContext, B as ToolDef, F as ToolMap, a7 as basic, a8 as basicTools, Z as defineHarness, a1 as noTools } from './agent-CXMcPke1.js';
3
3
  import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/harnesses.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  basic_default,
4
4
  defineHarness,
5
5
  noTools
6
- } from "./chunk-TWRNLI6I.js";
7
- import "./chunk-R7PIZ4MU.js";
8
- import "./chunk-NNMWWSBY.js";
6
+ } from "./chunk-Z2NZSEBZ.js";
7
+ import "./chunk-GCALAOLD.js";
8
+ import "./chunk-5LOHDFK3.js";
9
9
  import "./chunk-4C6Y56CC.js";
10
10
  export {
11
11
  basic_default as basic,
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-BDZbObgy.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, k as McpToolHookContext, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, n as SessionEndStatus, o as SessionHookContext, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, t as SpawnHookContext, u as SqliteStoreOptions, w as StreamHookContext, T as ThinkingLevel, z as ToolContext, B as ToolDef, D as ToolExecutionMode, E as ToolHookContext, F as ToolMap, L as TurnUsage, N as autoDetectAndConvert, Q as connectMcpServers, U as createAgent, V as createMemoryStore, W as createRemoteStore, X as createSession, Y as createSqliteStore, Z as defineHarness, _ as fromAnthropic, $ as fromOpenAI, a0 as loadSession, a1 as noTools, a2 as toAnthropic, a3 as toOpenAI } from './agent-CXMcPke1.js';
2
2
  import { f as SpawnConfig, b as ExecutionContext } from './types-CKXAp41h.js';
3
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
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, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-CQieNB1Y.js';
6
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-BUUQxLIp.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-TWRNLI6I.js";
4
+ } from "./chunk-Z2NZSEBZ.js";
5
5
  import {
6
6
  createAgent,
7
7
  createDockerContext,
@@ -10,10 +10,10 @@ import {
10
10
  createSandboxContext,
11
11
  createSpawnTool,
12
12
  spawn
13
- } from "./chunk-R7PIZ4MU.js";
13
+ } from "./chunk-GCALAOLD.js";
14
14
  import {
15
15
  connectMcpServers
16
- } from "./chunk-NNMWWSBY.js";
16
+ } from "./chunk-5LOHDFK3.js";
17
17
  import {
18
18
  createMemoryStore,
19
19
  createRemoteStore,
@@ -27,7 +27,7 @@ import {
27
27
  fromOpenAI,
28
28
  toAnthropic,
29
29
  toOpenAI
30
- } from "./chunk-UUITMJ7G.js";
30
+ } from "./chunk-QCJKUQTQ.js";
31
31
  import {
32
32
  defineSkill
33
33
  } from "./chunk-CFLC2I7D.js";
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-BDZbObgy.js';
2
+ export { M as McpConnection, j as McpServerConfig, Q as connectMcpServers, a9 as resultToString } from './agent-CXMcPke1.js';
3
3
  import '@modelcontextprotocol/sdk/client/index.js';
4
4
  import './types-CKXAp41h.js';
package/dist/mcp.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  connectMcpServers,
3
3
  resultToString
4
- } from "./chunk-NNMWWSBY.js";
4
+ } from "./chunk-5LOHDFK3.js";
5
5
  export {
6
6
  connectMcpServers,
7
7
  resultToString
@@ -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-BDZbObgy.js';
1
+ export { f as AnthropicParams, C as CerebrasParams, O as OpenRouterParams, P as Provider, v as StreamCallbacks, x as StreamOptions, y as ToolCall, G as ToolResult, J as ToolSpec, K as TurnResult, a4 as anthropic, a5 as cerebras, a6 as openrouter } from './agent-CXMcPke1.js';
2
2
  import 'hookable';
3
3
  import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/providers.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  toOAIMessages,
9
9
  toolResultsMessage,
10
10
  userMessage
11
- } from "./chunk-UUITMJ7G.js";
11
+ } from "./chunk-QCJKUQTQ.js";
12
12
 
13
13
  // src/providers/anthropic.ts
14
14
  import { existsSync, readFileSync } from "fs";
@@ -109,6 +109,7 @@ function anthropic(anthropicParams) {
109
109
  type: "enabled",
110
110
  budget_tokens: budgetTokens
111
111
  };
112
+ params.max_tokens = budgetTokens + params.max_tokens;
112
113
  params.temperature = 1;
113
114
  }
114
115
  if (options.toolChoice) {
@@ -172,10 +173,11 @@ function cerebras(params) {
172
173
  async stream(options, callbacks) {
173
174
  const modelId = options.model || defaultModel;
174
175
  const messages = toOAIMessages(options.system, options.messages);
176
+ const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
175
177
  const body = {
176
178
  model: modelId,
177
179
  messages,
178
- max_tokens: options.maxTokens,
180
+ max_tokens: maxTokens,
179
181
  stream: true
180
182
  };
181
183
  if (options.tools && options.tools.length > 0)
@@ -238,10 +240,11 @@ function openrouter(params) {
238
240
  if (thinking !== "off" && !modelId.includes(":thinking"))
239
241
  modelId = `${modelId}:thinking`;
240
242
  const messages = toOAIMessages(options.system, options.messages);
243
+ const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
241
244
  const body = {
242
245
  model: modelId,
243
246
  messages,
244
- max_tokens: options.maxTokens,
247
+ max_tokens: maxTokens,
245
248
  stream: true
246
249
  };
247
250
  if (options.tools && options.tools.length > 0)
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-BDZbObgy.js';
1
+ export { h as CreateSessionOptions, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, u as SqliteStoreOptions, N as autoDetectAndConvert, V as createMemoryStore, W as createRemoteStore, X as createSession, Y as createSqliteStore, _ as fromAnthropic, $ as fromOpenAI, a0 as loadSession, a2 as toAnthropic, a3 as toOpenAI } from './agent-CXMcPke1.js';
2
2
  import 'hookable';
3
3
  import './types-CKXAp41h.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/session.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  fromOpenAI,
12
12
  toAnthropic,
13
13
  toOpenAI
14
- } from "./chunk-UUITMJ7G.js";
14
+ } from "./chunk-QCJKUQTQ.js";
15
15
  export {
16
16
  autoDetectAndConvert,
17
17
  createMemoryStore,
@@ -1,4 +1,4 @@
1
- import { v as ToolDef, i as HarnessConfig, e as AgentStats } from './agent-BDZbObgy.js';
1
+ import { B as ToolDef, i as HarnessConfig, e as AgentStats } from './agent-CXMcPke1.js';
2
2
 
3
3
  /**
4
4
  * Interaction tool — lets the agent request structured input from the outside world.
package/dist/tools.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-CQieNB1Y.js';
2
- import { v as ToolDef } from './agent-BDZbObgy.js';
1
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-BUUQxLIp.js';
2
+ import { B as ToolDef } from './agent-CXMcPke1.js';
3
3
  export { V as ValidationResult, v as validateToolArgs } from './validation-DOY_k7lW.js';
4
4
  import 'hookable';
5
5
  import './types-CKXAp41h.js';
package/dist/tools.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  spawn,
8
8
  validateToolArgs,
9
9
  writeFile
10
- } from "./chunk-R7PIZ4MU.js";
11
- import "./chunk-NNMWWSBY.js";
10
+ } from "./chunk-GCALAOLD.js";
11
+ import "./chunk-5LOHDFK3.js";
12
12
  import "./chunk-4C6Y56CC.js";
13
13
  export {
14
14
  createInteractionTool,
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-BDZbObgy.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, k as McpToolHookContext, O as OpenRouterParams, P as Provider, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, n as SessionEndStatus, o as SessionHookContext, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, t as SpawnHookContext, u as SqliteStoreOptions, v as StreamCallbacks, w as StreamHookContext, x as StreamOptions, T as ThinkingLevel, y as ToolCall, z as ToolContext, B as ToolDef, D as ToolExecutionMode, E as ToolHookContext, F as ToolMap, G as ToolResult, J as ToolSpec, K as TurnResult, L as TurnUsage } from './agent-CXMcPke1.js';
2
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
3
  export { S as SandboxProvider } from './sandbox-DZn3ybp_.js';
4
- export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-CQieNB1Y.js';
4
+ export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-BUUQxLIp.js';
5
5
  export { V as ValidationResult } from './validation-DOY_k7lW.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.5",
3
+ "version": "1.6.7",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,