zidane 3.2.0 → 3.3.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.
@@ -242,7 +242,7 @@ interface AgentBehavior {
242
242
  * `runTurn` is 1-indexed, run-relative (resumed sessions reset).
243
243
  *
244
244
  * No-op when `thinkingBudget` is unset. Honored by every provider that
245
- * respects `thinkingBudget` (anthropic legacy enabled+budget path,
245
+ * respects `thinkingBudget` (anthropic explicit-budget `enabled` path,
246
246
  * adaptive `maxTokensCap`, openai-compat `max_tokens` padding).
247
247
  *
248
248
  * Default: `undefined` (no decay).
@@ -356,8 +356,8 @@ interface AgentBehavior {
356
356
  * model "remembers" stale content and applies a substring edit against
357
357
  * bytes that have moved.
358
358
  *
359
- * Requires a session. Off by default to preserve back-compat turn it on
360
- * for stricter eval-grade runs.
359
+ * Requires a session. Off by default; turn it on for stricter eval-grade
360
+ * runs where silent edit corruption would invalidate the result.
361
361
  *
362
362
  * Default: `false`.
363
363
  */
@@ -392,14 +392,40 @@ interface AgentBehavior {
392
392
  * for elision so the model keeps the freshest tool context. Default: `4`.
393
393
  */
394
394
  compactKeepTurns?: number;
395
- }
396
- interface ImageContent {
397
- type: 'image';
398
- source: {
399
- type: 'base64';
400
- media_type: string;
401
- data: string;
402
- };
395
+ /**
396
+ * Prefix every line of `read_file` output with its 1-indexed line number
397
+ * followed by a tab (`<N>\t<content>`) — the compact `cat -n`-style
398
+ * format Claude Code emits. The `edit` tool strips the prefix from
399
+ * `old_string` / `new_string` so the model can paste back a numbered
400
+ * chunk verbatim without breaking the match.
401
+ *
402
+ * Set `false` to opt out — useful for callers piping `read_file` into
403
+ * downstream parsers that don't recognize the prefix. Per-call
404
+ * `read_file({ lineNumbers: false })` overrides this default.
405
+ *
406
+ * Default: `true`.
407
+ */
408
+ readLineNumbers?: boolean;
409
+ /**
410
+ * Replace older `read_file` `tool_result` blocks with a short stub when
411
+ * a successful `edit` / `multi_edit` / `write_file` later in the same
412
+ * run modified the same path. The replacement is applied to the
413
+ * wire-level message list only — persisted session turns keep the
414
+ * original content.
415
+ *
416
+ * Eliminates the common waste pattern where the model carries the
417
+ * pre-edit file body forward across many turns "in case it needs it".
418
+ * Pairs cleanly with `compactStrategy: 'tail'`: stale reads shrink
419
+ * first, then the byte-threshold compaction fires if anything's left.
420
+ *
421
+ * Detection is conservative — only triggers when the corresponding
422
+ * tool_result confirms success (`Edited …`, `Created …`, `Updated …`).
423
+ * Failed edits and `No change needed` write_file calls do NOT
424
+ * invalidate prior reads.
425
+ *
426
+ * Default: `false`.
427
+ */
428
+ elideStaleReads?: boolean;
403
429
  }
404
430
  /**
405
431
  * One block of a multimodal user prompt.
@@ -540,11 +566,6 @@ interface AgentRunOptions {
540
566
  prompt?: string | PromptPart[];
541
567
  system?: string;
542
568
  thinking?: ThinkingLevel;
543
- /**
544
- * Legacy image attachments. When `prompt` is a string, these are appended as image
545
- * parts after the text. Ignored when `prompt` is a `PromptPart[]`.
546
- */
547
- images?: ImageContent[];
548
569
  /** Abort signal — when triggered, the agent stops after the current turn */
549
570
  signal?: AbortSignal;
550
571
  /** Behavior overrides for this run (overrides agent defaults) */
@@ -1082,8 +1103,8 @@ interface Provider {
1082
1103
  } & Record<string, unknown>;
1083
1104
  /** Format tool specs for this provider */
1084
1105
  formatTools: (tools: ToolSpec[]) => unknown[];
1085
- /** Create a user message (text or with images) */
1086
- userMessage: (content: string, images?: ImageContent[]) => SessionMessage;
1106
+ /** Create a text-only user message. Multimodal content goes through `promptMessage`. */
1107
+ userMessage: (content: string) => SessionMessage;
1087
1108
  /** Create an assistant message (for priming) */
1088
1109
  assistantMessage: (content: string) => SessionMessage;
1089
1110
  /** Create a tool results message to send back */
@@ -1584,13 +1605,13 @@ interface McpConnection {
1584
1605
  */
1585
1606
  declare function normalizeMcpServers(input: unknown): McpServerConfig[];
1586
1607
  /**
1587
- * Lossy flattener — converts MCP `CallToolResult.content` blocks to a single string.
1588
- * Text blocks are extracted; non-text blocks are JSON-stringified.
1608
+ * Lossy flattener — converts MCP `CallToolResult.content` blocks to a single
1609
+ * string. Text blocks are extracted; non-text blocks are JSON-stringified.
1589
1610
  *
1590
- * Prefer {@link normalizeMcpBlocks} for new code it preserves image blocks so the
1591
- * provider can route them through to the model natively (Anthropic tool_result blocks,
1592
- * OpenAI companion-user-message). This function is kept for back-compat and is useful
1593
- * as a logging/display helper where a single string is required.
1611
+ * Use this only at UI / log boundaries that require a string. The agent
1612
+ * loop itself routes through {@link normalizeMcpBlocks} so image blocks
1613
+ * survive into provider-native tool_result content (Anthropic blocks,
1614
+ * OpenAI companion-user-message).
1594
1615
  */
1595
1616
  declare function resultToString(content: unknown[]): string;
1596
1617
  /**
@@ -2173,4 +2194,4 @@ interface Agent {
2173
2194
  }
2174
2195
  declare function createAgent({ provider, name: agentName, system: agentSystem, tools: agentTools, toolAliases, behavior: agentBehavior, execution, mcpServers, session, skills: agentSkills, mcpConnector, eager }: AgentOptions): Agent;
2175
2196
 
2176
- export { type ToolHookContext as $, type Agent as A, type SessionData as B, CONTEXT_EXCEEDED_MESSAGE_PATTERNS as C, type SessionEndStatus as D, type SessionHookContext as E, type SessionMessage as F, type SessionRun as G, type SessionStore as H, type ImageContent as I, type SessionTurn as J, type SkillConfig as K, type SkillResource as L, type McpConnection as M, type SkillsConfig as N, type OAuthRefreshHookContext as O, type PromptDocumentPart as P, type SpawnHookContext as Q, type RemoteStoreOptions as R, type Session as S, type StreamCallbacks as T, type StreamHookContext as U, type StreamOptions as V, type ThinkingLevel as W, type ToolCall as X, type ToolContext as Y, type ToolDef as Z, type ToolExecutionMode as _, AgentAbortedError as a, type ToolMap as a0, type ToolResult as a1, type ToolResultContent as a2, type ToolResultImageContent as a3, type ToolResultTextContent as a4, type ToolSpec as a5, type TurnFinishReason as a6, type TurnResult as a7, type TurnUsage as a8, matchesContextExceeded as a9, fromOpenAI as aA, loadSession as aB, mapOAIFinishReason as aC, normalizeMcpBlocks as aD, normalizeMcpServers as aE, openai as aF, openaiCompat as aG, openrouter as aH, resultToString as aI, toAnthropic as aJ, toOpenAI as aK, toTypedError as aL, toolOutputByteLength as aa, toolResultToText as ab, type ActivationVia as ac, type ActiveSkill as ad, type DeactivationReason as ae, type FileMapAdapter as af, type FileMapStoreOptions as ag, type OpenAICompatAuthHeader as ah, OpenAICompatHttpError as ai, type OpenAICompatParams as aj, type SkillActivationState as ak, type SkillActivationStateOptions as al, type SkillDiagnostic as am, type SkillSource as an, anthropic as ao, autoDetectAndConvert as ap, cerebras as aq, classifyOpenAICompatError as ar, connectMcpServers as as, createAgent as at, createFileMapStore as au, createMemoryStore as av, createRemoteStore as aw, createSession as ax, createSkillActivationState as ay, fromAnthropic as az, type AgentBehavior as b, AgentContextExceededError as c, type AgentHooks as d, type AgentOptions as e, AgentProviderError as f, type AgentRunOptions as g, type AgentStats as h, AgentToolNotAllowedError as i, type AnthropicParams as j, type CerebrasParams as k, type ChildRunStats as l, type ClassifiedError as m, type ClassifiedErrorKind as n, type CreateSessionOptions as o, type McpServerConfig as p, type McpToolHookContext as q, type OpenAIParams as r, type OpenRouterParams as s, type PromptImagePart as t, type PromptPart as u, type PromptTextPart as v, type Provider as w, type ProviderCapabilities as x, type RunHookMap as y, type SessionContentBlock as z };
2197
+ export { type ToolMap as $, type Agent as A, type SessionData as B, CONTEXT_EXCEEDED_MESSAGE_PATTERNS as C, type SessionEndStatus as D, type SessionHookContext as E, type SessionMessage as F, type SessionRun as G, type SessionStore as H, type SessionTurn as I, type SkillConfig as J, type SkillResource as K, type SkillsConfig as L, type McpConnection as M, type SpawnHookContext as N, type OAuthRefreshHookContext as O, type PromptDocumentPart as P, type StreamCallbacks as Q, type RemoteStoreOptions as R, type Session as S, type StreamHookContext as T, type StreamOptions as U, type ThinkingLevel as V, type ToolCall as W, type ToolContext as X, type ToolDef as Y, type ToolExecutionMode as Z, type ToolHookContext as _, AgentAbortedError as a, type ToolResult as a0, type ToolResultContent as a1, type ToolResultImageContent as a2, type ToolResultTextContent as a3, type ToolSpec as a4, type TurnFinishReason as a5, type TurnResult as a6, type TurnUsage as a7, matchesContextExceeded as a8, toolOutputByteLength as a9, loadSession as aA, mapOAIFinishReason as aB, normalizeMcpBlocks as aC, normalizeMcpServers as aD, openai as aE, openaiCompat as aF, openrouter as aG, resultToString as aH, toAnthropic as aI, toOpenAI as aJ, toTypedError as aK, toolResultToText as aa, type ActivationVia as ab, type ActiveSkill as ac, type DeactivationReason as ad, type FileMapAdapter as ae, type FileMapStoreOptions as af, type OpenAICompatAuthHeader as ag, OpenAICompatHttpError as ah, type OpenAICompatParams as ai, type SkillActivationState as aj, type SkillActivationStateOptions as ak, type SkillDiagnostic as al, type SkillSource as am, anthropic as an, autoDetectAndConvert as ao, cerebras as ap, classifyOpenAICompatError as aq, connectMcpServers as ar, createAgent as as, createFileMapStore as at, createMemoryStore as au, createRemoteStore as av, createSession as aw, createSkillActivationState as ax, fromAnthropic as ay, fromOpenAI as az, type AgentBehavior as b, AgentContextExceededError as c, type AgentHooks as d, type AgentOptions as e, AgentProviderError as f, type AgentRunOptions as g, type AgentStats as h, AgentToolNotAllowedError as i, type AnthropicParams as j, type CerebrasParams as k, type ChildRunStats as l, type ClassifiedError as m, type ClassifiedErrorKind as n, type CreateSessionOptions as o, type McpServerConfig as p, type McpToolHookContext as q, type OpenAIParams as r, type OpenRouterParams as s, type PromptImagePart as t, type PromptPart as u, type PromptTextPart as v, type Provider as w, type ProviderCapabilities as x, type RunHookMap as y, type SessionContentBlock as z };
@@ -1,19 +1,19 @@
1
1
  import {
2
+ createSpawnTool,
2
3
  edit,
3
4
  listFiles,
4
5
  multiEdit,
5
6
  readFile,
6
7
  shell,
7
- spawn,
8
8
  writeFile
9
- } from "./chunk-6JIVVEQQ.js";
9
+ } from "./chunk-Z2E5QN5X.js";
10
10
 
11
11
  // src/presets/basic.ts
12
12
  var basicTools = { shell, readFile, writeFile, listFiles, edit, multiEdit };
13
13
  var basic_default = definePreset({
14
14
  name: "basic",
15
15
  system: "You are a helpful assistant with access to shell, file reading, file writing, surgical and multi-edit tools, directory listing, and sub-agent spawning. Prefer `edit` / `multi_edit` for in-place changes and `write_file` for full file overwrites. Use them to accomplish tasks in the project directory.",
16
- tools: { ...basicTools, spawn }
16
+ tools: { ...basicTools, spawn: createSpawnTool() }
17
17
  });
18
18
 
19
19
  // src/presets/index.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateSkillForWrite
3
- } from "./chunk-J4ZOSNSH.js";
3
+ } from "./chunk-X3VOTPVM.js";
4
4
 
5
5
  // src/skills/index.ts
6
6
  function defineSkill(config) {
@@ -5,7 +5,7 @@ import {
5
5
  toAnthropic,
6
6
  toolResultsMessage,
7
7
  userMessage
8
- } from "./chunk-QX7TDFD4.js";
8
+ } from "./chunk-X244RS5H.js";
9
9
  import {
10
10
  matchesContextExceeded
11
11
  } from "./chunk-LNN5UTS2.js";
@@ -365,20 +365,7 @@ function anthropic(anthropicParams) {
365
365
  input_schema: t.inputSchema
366
366
  }));
367
367
  },
368
- userMessage(content, images) {
369
- if (images && images.length > 0) {
370
- return {
371
- role: "user",
372
- content: [
373
- ...images.map((img) => ({
374
- type: "image",
375
- mediaType: img.source.media_type,
376
- data: img.source.data
377
- })),
378
- { type: "text", text: content }
379
- ]
380
- };
381
- }
368
+ userMessage(content) {
382
369
  return { role: "user", content: [{ type: "text", text: content }] };
383
370
  },
384
371
  assistantMessage(content) {
@@ -246,20 +246,7 @@ function formatTools(tools) {
246
246
  function: { name: t.name, description: t.description, parameters: t.inputSchema }
247
247
  }));
248
248
  }
249
- function userMessage(content, images) {
250
- if (images?.length) {
251
- return {
252
- role: "user",
253
- content: [
254
- ...images.map((img) => ({
255
- type: "image",
256
- mediaType: img.source.media_type,
257
- data: img.source.data
258
- })),
259
- { type: "text", text: content }
260
- ]
261
- };
262
- }
249
+ function userMessage(content) {
263
250
  return { role: "user", content: [{ type: "text", text: content }] };
264
251
  }
265
252
  function assistantMessage(content) {
@@ -252,10 +252,9 @@ function installAllowedToolsGate(hooks, state) {
252
252
  }
253
253
 
254
254
  // src/skills/catalog.ts
255
- function buildCatalog(skills, optionsOrReadToolName = {}) {
255
+ function buildCatalog(skills, options = {}) {
256
256
  if (skills.length === 0)
257
257
  return "";
258
- const options = typeof optionsOrReadToolName === "string" ? { skillsToolRegistered: false, readToolName: optionsOrReadToolName } : optionsOrReadToolName;
259
258
  const skillsToolRegistered = options.skillsToolRegistered ?? true;
260
259
  const readToolName = options.readToolName ?? "read_file";
261
260
  const entries = skills.map((skill) => {
@@ -744,10 +743,6 @@ import { mkdtempSync, rmSync } from "fs";
744
743
  import { tmpdir } from "os";
745
744
  import { join as join3 } from "path";
746
745
  async function resolveSkills(config) {
747
- const { skills } = await resolveSkillsWithCleanup(config);
748
- return skills;
749
- }
750
- async function resolveSkillsWithCleanup(config) {
751
746
  const sourcedPaths = [];
752
747
  let writeDir;
753
748
  if (!config.skipDefaultPaths) {
@@ -828,6 +823,5 @@ export {
828
823
  writeSkillToDisk,
829
824
  writeSkillsToDisk,
830
825
  resolveSkills,
831
- resolveSkillsWithCleanup,
832
826
  interpolateShellCommands
833
827
  };