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
@@ -1,10 +1,17 @@
1
1
  import {
2
2
  matchesContextExceeded
3
- } from "./chunk-7JTBBZ2U.js";
3
+ } from "./chunk-LNN5UTS2.js";
4
4
 
5
5
  // src/providers/openai-compat.ts
6
6
  var TOOL_RESULTS_TAG = "__zidane_tool_results__";
7
7
  var ASSISTANT_TOOL_CALLS_TAG = "__zidane_assistant_tc__";
8
+ var SSE_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
9
+ var OpenAICompatStreamError = class extends Error {
10
+ constructor(message) {
11
+ super(message);
12
+ this.name = "OpenAICompatStreamError";
13
+ }
14
+ };
8
15
  async function consumeSSE(response, callbacks, signal) {
9
16
  const reader = response.body.getReader();
10
17
  const decoder = new TextDecoder();
@@ -22,6 +29,11 @@ async function consumeSSE(response, callbacks, signal) {
22
29
  if (done)
23
30
  break;
24
31
  buffer += decoder.decode(value, { stream: true });
32
+ if (buffer.length > SSE_MAX_BUFFER_BYTES) {
33
+ throw new OpenAICompatStreamError(
34
+ `SSE buffer exceeded ${SSE_MAX_BUFFER_BYTES} bytes without a line boundary \u2014 upstream may be streaming non-SSE data.`
35
+ );
36
+ }
25
37
  const lines = buffer.split("\n");
26
38
  buffer = lines.pop() || "";
27
39
  for (const line of lines) {
@@ -36,22 +48,27 @@ async function consumeSSE(response, callbacks, signal) {
36
48
  } catch {
37
49
  continue;
38
50
  }
39
- const choice = chunk.choices?.[0];
51
+ const choices = chunk.choices;
52
+ const choice = choices?.[0];
40
53
  if (!choice)
41
54
  continue;
42
- if (choice.finish_reason)
43
- finishReason = choice.finish_reason;
44
- const thinkingDelta = choice.delta?.reasoning_content ?? choice.delta?.reasoning;
55
+ const fr = choice.finish_reason;
56
+ if (fr)
57
+ finishReason = fr;
58
+ const delta = choice.delta;
59
+ const thinkingDelta = delta?.reasoning_content ?? delta?.reasoning;
45
60
  if (thinkingDelta) {
46
61
  thinking += thinkingDelta;
47
62
  callbacks.onThinking?.(thinkingDelta);
48
63
  }
49
- if (choice.delta?.content) {
50
- text += choice.delta.content;
51
- callbacks.onText(choice.delta.content);
64
+ const contentDelta = delta?.content;
65
+ if (contentDelta) {
66
+ text += contentDelta;
67
+ callbacks.onText(contentDelta);
52
68
  }
53
- if (choice.delta?.tool_calls) {
54
- for (const tc of choice.delta.tool_calls) {
69
+ const toolCallsDelta = delta?.tool_calls;
70
+ if (toolCallsDelta) {
71
+ for (const tc of toolCallsDelta) {
55
72
  const existing = tcMap.get(tc.index);
56
73
  if (existing) {
57
74
  if (tc.function?.arguments)
@@ -65,11 +82,12 @@ async function consumeSSE(response, callbacks, signal) {
65
82
  }
66
83
  }
67
84
  }
68
- if (chunk.usage) {
85
+ const chunkUsage = chunk.usage;
86
+ if (chunkUsage) {
69
87
  usage = {
70
- input: chunk.usage.prompt_tokens,
71
- output: chunk.usage.completion_tokens,
72
- cost: chunk.usage.total_cost ?? void 0
88
+ input: chunkUsage.prompt_tokens ?? 0,
89
+ output: chunkUsage.completion_tokens ?? 0,
90
+ cost: chunkUsage.total_cost ?? void 0
73
91
  };
74
92
  }
75
93
  }
@@ -77,11 +95,20 @@ async function consumeSSE(response, callbacks, signal) {
77
95
  } finally {
78
96
  reader.releaseLock();
79
97
  }
80
- const toolCalls = Array.from(tcMap.values()).map((tc) => ({
81
- id: tc.id,
82
- name: tc.name,
83
- input: tc.args ? JSON.parse(tc.args) : {}
84
- }));
98
+ const toolCalls = [];
99
+ for (const tc of tcMap.values()) {
100
+ if (!tc.args) {
101
+ toolCalls.push({ id: tc.id, name: tc.name, input: {} });
102
+ continue;
103
+ }
104
+ try {
105
+ toolCalls.push({ id: tc.id, name: tc.name, input: JSON.parse(tc.args) });
106
+ } catch (err) {
107
+ throw new OpenAICompatStreamError(
108
+ `Tool call "${tc.name}" (${tc.id}) arguments were truncated or malformed: ${err.message}`
109
+ );
110
+ }
111
+ }
85
112
  return { text, thinking, toolCalls, finishReason, usage };
86
113
  }
87
114
  function toImageUrlPart(img) {
@@ -249,6 +276,14 @@ function classifyOpenAICompatError(err) {
249
276
  return null;
250
277
  if (err.name === "AbortError")
251
278
  return { kind: "aborted" };
279
+ if (err instanceof OpenAICompatStreamError) {
280
+ return {
281
+ kind: "provider_error",
282
+ providerCode: "stream_error",
283
+ message: err.message,
284
+ retryable: true
285
+ };
286
+ }
252
287
  if (!(err instanceof OpenAICompatHttpError))
253
288
  return null;
254
289
  const code = err.providerCode;
@@ -263,9 +298,17 @@ function classifyOpenAICompatError(err) {
263
298
  return {
264
299
  kind: "provider_error",
265
300
  providerCode: code ?? String(err.status),
266
- message: msg
301
+ message: msg,
302
+ retryable: isRetryableHttpStatus(err.status)
267
303
  };
268
304
  }
305
+ function isRetryableHttpStatus(status) {
306
+ if (status === 429)
307
+ return true;
308
+ if (status >= 500 && status !== 501)
309
+ return true;
310
+ return false;
311
+ }
269
312
  function mapOAIFinishReason(reason) {
270
313
  if (!reason)
271
314
  return void 0;
@@ -4,29 +4,23 @@ import {
4
4
  shell,
5
5
  spawn,
6
6
  writeFile
7
- } from "./chunk-PASFWG7S.js";
7
+ } from "./chunk-F5UBXERT.js";
8
8
 
9
- // src/harnesses/basic.ts
9
+ // src/presets/basic.ts
10
10
  var basicTools = { shell, readFile, writeFile, listFiles };
11
- var basic_default = defineHarness({
11
+ var basic_default = definePreset({
12
12
  name: "basic",
13
13
  system: "You are a helpful assistant with access to shell, file reading, file writing, directory listing, and sub-agent spawning tools. Use them to accomplish tasks in the project directory.",
14
14
  tools: { ...basicTools, spawn }
15
15
  });
16
16
 
17
- // src/harnesses/index.ts
18
- function defineHarness(config) {
17
+ // src/presets/index.ts
18
+ function definePreset(config) {
19
19
  return config;
20
20
  }
21
- var noTools = defineHarness({
22
- name: "none",
23
- system: "You are a helpful assistant.",
24
- tools: {}
25
- });
26
21
 
27
22
  export {
28
23
  basicTools,
29
24
  basic_default,
30
- defineHarness,
31
- noTools
25
+ definePreset
32
26
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AgentToolNotAllowedError
3
- } from "./chunk-7JTBBZ2U.js";
3
+ } from "./chunk-LNN5UTS2.js";
4
4
 
5
5
  // src/skills/activation.ts
6
6
  function createSkillActivationState(options = {}) {
@@ -328,10 +328,12 @@ function escapeXml(str) {
328
328
  import { existsSync, readdirSync, readFileSync, statSync } from "fs";
329
329
  import { homedir } from "os";
330
330
  import { basename as basename2, dirname, join, resolve } from "path";
331
- var FRONTMATTER_RE = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
331
+ var FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
332
332
  var INDENT_RE = /^[ \t]{2,}/;
333
333
  var KV_RE = /^([^:]+):(.*)$/;
334
- var QUOTE_RE = /^(['"])(.*)\1$/;
334
+ var DOUBLE_QUOTED_RE = /^"((?:\\.|[^"\\])*)"$/;
335
+ var SINGLE_QUOTED_RE = /^'((?:''|[^'])*)'$/;
336
+ var DQ_ESCAPE_RE = /\\(["\\/bfnrt])/g;
335
337
  var WHITESPACE_SPLIT_RE = /\s+/;
336
338
  var PARAGRAPH_SPLIT_RE = /\n\n/;
337
339
  var COMMA_OR_SPACE_RE = /[,\s]+/;
@@ -390,11 +392,54 @@ function matchFirstColon(line) {
390
392
  return { key, value };
391
393
  }
392
394
  function unquoteYaml(val) {
393
- const m = val.match(QUOTE_RE);
394
- if (m)
395
- return m[2];
395
+ const dq = val.match(DOUBLE_QUOTED_RE);
396
+ if (dq) {
397
+ return dq[1].replace(DQ_ESCAPE_RE, (_, ch) => {
398
+ switch (ch) {
399
+ case '"':
400
+ return '"';
401
+ case "\\":
402
+ return "\\";
403
+ case "/":
404
+ return "/";
405
+ case "b":
406
+ return "\b";
407
+ case "f":
408
+ return "\f";
409
+ case "n":
410
+ return "\n";
411
+ case "r":
412
+ return "\r";
413
+ case "t":
414
+ return " ";
415
+ default:
416
+ return ch;
417
+ }
418
+ });
419
+ }
420
+ const sq = val.match(SINGLE_QUOTED_RE);
421
+ if (sq) {
422
+ return sq[1].replace(/''/g, "'");
423
+ }
424
+ const hashIdx = val.indexOf(" #");
425
+ if (hashIdx >= 0)
426
+ return val.slice(0, hashIdx).trimEnd();
396
427
  return val;
397
428
  }
429
+ function takeString(frontmatter, key, diagnostics) {
430
+ const raw = frontmatter[key];
431
+ if (raw === void 0 || raw === null)
432
+ return void 0;
433
+ if (typeof raw === "string")
434
+ return raw;
435
+ diagnostics.push({
436
+ severity: "warning",
437
+ code: "invalid-field-type",
438
+ message: `Frontmatter field "${key}" expected string, got ${typeof raw}. Coerced.`,
439
+ field: key
440
+ });
441
+ return String(raw);
442
+ }
398
443
  var RESOURCE_DIRS = {
399
444
  scripts: "script",
400
445
  references: "reference",
@@ -409,9 +454,10 @@ function enumerateResources(baseDir) {
409
454
  try {
410
455
  const files = readdirSync(dirPath, { recursive: true });
411
456
  for (const file of files) {
412
- const fullPath = join(dirPath, file);
457
+ const rel = typeof file === "string" ? file : file.toString("utf-8");
458
+ const fullPath = join(dirPath, rel);
413
459
  if (statSync(fullPath).isFile()) {
414
- resources.push({ path: join(dir, file), type });
460
+ resources.push({ path: join(dir, rel), type });
415
461
  }
416
462
  }
417
463
  } catch {
@@ -436,7 +482,7 @@ async function parseSkillFile(filePath, options = {}) {
436
482
  return null;
437
483
  const content = readFileSync(absPath, "utf-8");
438
484
  const { frontmatter, body, diagnostics } = parseFrontmatter(content);
439
- let description = frontmatter.description;
485
+ let description = takeString(frontmatter, "description", diagnostics);
440
486
  if (!description && body) {
441
487
  const firstParagraph = body.split(PARAGRAPH_SPLIT_RE)[0]?.trim();
442
488
  if (firstParagraph)
@@ -454,12 +500,13 @@ async function parseSkillFile(filePath, options = {}) {
454
500
  }
455
501
  const baseDir = dirname(absPath);
456
502
  const dirName = basename2(baseDir);
457
- const name = frontmatter.name || dirName;
458
- if (frontmatter.name && frontmatter.name !== dirName) {
503
+ const frontmatterName = takeString(frontmatter, "name", diagnostics);
504
+ const name = frontmatterName || dirName;
505
+ if (frontmatterName && frontmatterName !== dirName) {
459
506
  diagnostics.push({
460
507
  severity: "warning",
461
508
  code: "name-mismatch-directory",
462
- message: `Skill name "${frontmatter.name}" does not match parent directory "${dirName}". Loading anyway.`,
509
+ message: `Skill name "${frontmatterName}" does not match parent directory "${dirName}". Loading anyway.`,
463
510
  field: "name"
464
511
  });
465
512
  }
@@ -488,23 +535,25 @@ async function parseSkillFile(filePath, options = {}) {
488
535
  baseDir,
489
536
  resources: enumerateResources(baseDir)
490
537
  };
491
- if (frontmatter.license)
492
- config.license = frontmatter.license;
493
- if (frontmatter.compatibility) {
494
- const comp = frontmatter.compatibility;
495
- if (comp.length > 500) {
538
+ const license = takeString(frontmatter, "license", diagnostics);
539
+ if (license)
540
+ config.license = license;
541
+ const compatibility = takeString(frontmatter, "compatibility", diagnostics);
542
+ if (compatibility) {
543
+ if (compatibility.length > 500) {
496
544
  diagnostics.push({
497
545
  severity: "warning",
498
546
  code: "compatibility-too-long",
499
- message: `Compatibility exceeds spec limit of 500 characters (got ${comp.length}). Loading anyway.`,
547
+ message: `Compatibility exceeds spec limit of 500 characters (got ${compatibility.length}). Loading anyway.`,
500
548
  field: "compatibility"
501
549
  });
502
550
  }
503
- config.compatibility = comp;
551
+ config.compatibility = compatibility;
504
552
  }
505
553
  const metadata = {};
506
- if (frontmatter.metadata && typeof frontmatter.metadata === "object") {
507
- for (const [k, v] of Object.entries(frontmatter.metadata)) {
554
+ const rawMetadata = frontmatter.metadata;
555
+ if (rawMetadata && typeof rawMetadata === "object" && !Array.isArray(rawMetadata)) {
556
+ for (const [k, v] of Object.entries(rawMetadata)) {
508
557
  if (typeof v !== "string") {
509
558
  diagnostics.push({
510
559
  severity: "warning",
@@ -517,11 +566,17 @@ async function parseSkillFile(filePath, options = {}) {
517
566
  }
518
567
  metadata[k] = v;
519
568
  }
569
+ } else if (rawMetadata !== void 0) {
570
+ diagnostics.push({
571
+ severity: "warning",
572
+ code: "invalid-metadata-shape",
573
+ message: `Frontmatter "metadata" expected a map, got ${Array.isArray(rawMetadata) ? "array" : typeof rawMetadata}. Ignored.`,
574
+ field: "metadata"
575
+ });
520
576
  }
521
- if (frontmatter.paths) {
522
- const raw = frontmatter.paths;
523
- const normalized = raw.split(COMMA_OR_SPACE_RE).filter(Boolean).join(",");
524
- metadata["zidane.paths"] = normalized;
577
+ const pathsField = takeString(frontmatter, "paths", diagnostics);
578
+ if (pathsField) {
579
+ metadata["zidane.paths"] = pathsField.split(COMMA_OR_SPACE_RE).filter(Boolean).join(",");
525
580
  diagnostics.push({
526
581
  severity: "warning",
527
582
  code: "deprecated-top-level-field",
@@ -529,8 +584,9 @@ async function parseSkillFile(filePath, options = {}) {
529
584
  field: "paths"
530
585
  });
531
586
  }
532
- if (frontmatter.model) {
533
- metadata["zidane.model"] = frontmatter.model;
587
+ const modelField = takeString(frontmatter, "model", diagnostics);
588
+ if (modelField) {
589
+ metadata["zidane.model"] = modelField;
534
590
  diagnostics.push({
535
591
  severity: "warning",
536
592
  code: "deprecated-top-level-field",
@@ -538,20 +594,23 @@ async function parseSkillFile(filePath, options = {}) {
538
594
  field: "model"
539
595
  });
540
596
  }
541
- const legacyThinking = frontmatter.thinking ?? frontmatter.effort;
597
+ const thinkingField = takeString(frontmatter, "thinking", diagnostics);
598
+ const effortField = thinkingField ? void 0 : takeString(frontmatter, "effort", diagnostics);
599
+ const legacyThinking = thinkingField ?? effortField;
542
600
  if (legacyThinking) {
543
601
  metadata["zidane.thinking"] = legacyThinking;
544
602
  diagnostics.push({
545
603
  severity: "warning",
546
604
  code: "deprecated-top-level-field",
547
- message: `\`${frontmatter.thinking ? "thinking" : "effort"}\` is not a spec field and is deprecated \u2014 moved to \`metadata["zidane.thinking"]\`.`,
548
- field: frontmatter.thinking ? "thinking" : "effort"
605
+ message: `\`${thinkingField ? "thinking" : "effort"}\` is not a spec field and is deprecated \u2014 moved to \`metadata["zidane.thinking"]\`.`,
606
+ field: thinkingField ? "thinking" : "effort"
549
607
  });
550
608
  }
551
609
  if (Object.keys(metadata).length > 0)
552
610
  config.metadata = metadata;
553
- if (frontmatter["allowed-tools"]) {
554
- config.allowedTools = frontmatter["allowed-tools"].split(WHITESPACE_SPLIT_RE).filter(Boolean);
611
+ const allowedTools = takeString(frontmatter, "allowed-tools", diagnostics);
612
+ if (allowedTools) {
613
+ config.allowedTools = allowedTools.split(WHITESPACE_SPLIT_RE).filter(Boolean);
555
614
  }
556
615
  if (diagnostics.length > 0)
557
616
  config.diagnostics = diagnostics;
@@ -627,6 +686,7 @@ import { join as join2 } from "path";
627
686
  var YAML_RESERVED_RE = /[:#&*!|>%@`]/;
628
687
  var YAML_EDGE_OR_QUOTE_RE = /^\s|\s$|["']/;
629
688
  var DQUOTE_RE = /"/g;
689
+ var LEADING_NEWLINES_RE = /^\n+/;
630
690
  function yamlEscape(value) {
631
691
  if (YAML_RESERVED_RE.test(value) || YAML_EDGE_OR_QUOTE_RE.test(value) || value === "")
632
692
  return `"${value.replace(DQUOTE_RE, '\\"')}"`;
@@ -661,10 +721,11 @@ ${summary}`);
661
721
  const skillDir = join2(targetDir, skill.name);
662
722
  mkdirSync(skillDir, { recursive: true });
663
723
  const frontmatter = serializeFrontmatter(skill);
664
- const body = skill.instructions ? `
665
- ${skill.instructions}` : "";
666
- const content = `${frontmatter}
667
- ${body}
724
+ const bodyTrimmed = skill.instructions ? skill.instructions.replace(LEADING_NEWLINES_RE, "") : "";
725
+ const content = bodyTrimmed ? `${frontmatter}
726
+
727
+ ${bodyTrimmed}
728
+ ` : `${frontmatter}
668
729
  `;
669
730
  const skillPath = join2(skillDir, "SKILL.md");
670
731
  writeFileSync(skillPath, content);
@@ -707,26 +768,6 @@ async function resolveSkills(config) {
707
768
  }
708
769
  return filtered;
709
770
  }
710
- function mergeSkillsConfig(harness, agent) {
711
- if (!harness && !agent)
712
- return void 0;
713
- if (!harness)
714
- return agent;
715
- if (!agent)
716
- return harness;
717
- return {
718
- // Agent-level takes precedence when explicitly set
719
- enabled: agent.enabled !== void 0 ? agent.enabled : harness.enabled,
720
- scan: [...harness.scan ?? [], ...agent.scan ?? []],
721
- write: [...harness.write ?? [], ...agent.write ?? []],
722
- exclude: [.../* @__PURE__ */ new Set([...harness.exclude ?? [], ...agent.exclude ?? []])],
723
- skipDefaultPaths: agent.skipDefaultPaths ?? harness.skipDefaultPaths,
724
- tool: agent.tool ?? harness.tool,
725
- maxActive: agent.maxActive ?? harness.maxActive,
726
- scriptTimeoutMs: agent.scriptTimeoutMs ?? harness.scriptTimeoutMs,
727
- trustProjectSkills: agent.trustProjectSkills ?? harness.trustProjectSkills
728
- };
729
- }
730
771
 
731
772
  // src/skills/interpolate.ts
732
773
  var SHELL_INTERPOLATION_RE = /!`([^`]+)`/g;
@@ -744,7 +785,8 @@ async function interpolateShellCommands(instructions, execution, handle) {
744
785
  const output = result2.exitCode === 0 ? result2.stdout.trim() : `[command failed (exit ${result2.exitCode}): ${result2.stderr.trim() || result2.stdout.trim()}]`;
745
786
  replacements.push({ index, length, output });
746
787
  } catch (err) {
747
- replacements.push({ index, length, output: `[command error: ${err.message}]` });
788
+ const message = err instanceof Error ? err.message : String(err);
789
+ replacements.push({ index, length, output: `[command error: ${message}]` });
748
790
  }
749
791
  }
750
792
  let result = instructions;
@@ -774,6 +816,5 @@ export {
774
816
  writeSkillToDisk,
775
817
  writeSkillsToDisk,
776
818
  resolveSkills,
777
- mergeSkillsConfig,
778
819
  interpolateShellCommands
779
820
  };
package/dist/contexts.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createDockerContext,
3
3
  createProcessContext,
4
4
  createSandboxContext
5
- } from "./chunk-SZA4FKW5.js";
5
+ } from "./chunk-2EQT4EHD.js";
6
6
  export {
7
7
  createDockerContext,
8
8
  createProcessContext,
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { d as AgentHooks } from './agent-D-ZFMbSd.js';
2
- export { ad as ActivationVia, ae as ActiveSkill, A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, 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, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, af as DeactivationReason, ag as FileMapAdapter, ah as FileMapStoreOptions, H as Harness, p as HarnessConfig, I as ImageContent, M as McpConnection, q as McpServerConfig, r as McpToolHookContext, O as OAuthRefreshHookContext, ai as OpenAICompatAuthHeader, aj as OpenAICompatHttpError, ak as OpenAICompatParams, 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, al as SkillActivationState, am as SkillActivationStateOptions, N as SkillConfig, an as SkillDiagnostic, Q as SkillResource, ao as SkillSource, 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, ap as anthropic, aq as autoDetectAndConvert, ar as cerebras, as as classifyOpenAICompatError, at as connectMcpServers, au as createAgent, av as createFileMapStore, aw as createMemoryStore, ax as createRemoteStore, ay as createSession, az as createSkillActivationState, aA as defineHarness, aB as fromAnthropic, aC as fromOpenAI, aD as loadSession, aE as mapOAIFinishReason, ab as matchesContextExceeded, aF as noTools, aG as normalizeMcpBlocks, aH as normalizeMcpServers, aI as openai, aJ as openaiCompat, aK as openrouter, aL as resultToString, aM as toAnthropic, aN as toOpenAI, aO as toTypedError, ac as toolResultToText } from './agent-D-ZFMbSd.js';
1
+ import { d as AgentHooks } from './agent-vPBFXnu-.js';
2
+ export { ab as ActivationVia, ac as ActiveSkill, A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, 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, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, ad as DeactivationReason, ae as FileMapAdapter, af as FileMapStoreOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, ag as OpenAICompatAuthHeader, ah as OpenAICompatHttpError, ai as OpenAICompatParams, 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, aj as SkillActivationState, ak as SkillActivationStateOptions, K as SkillConfig, al as SkillDiagnostic, L as SkillResource, am as SkillSource, 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, an as anthropic, ao as autoDetectAndConvert, ap as cerebras, aq as classifyOpenAICompatError, ar as connectMcpServers, as as createAgent, at as createFileMapStore, au as createMemoryStore, av as createRemoteStore, aw as createSession, ax as createSkillActivationState, ay as fromAnthropic, az as fromOpenAI, aA as loadSession, aB as mapOAIFinishReason, a9 as matchesContextExceeded, aC as normalizeMcpBlocks, aD as normalizeMcpServers, aE as openai, aF as openaiCompat, aG as openrouter, aH as resultToString, aI as toAnthropic, aJ as toOpenAI, aK as toTypedError, aa as toolResultToText } from './agent-vPBFXnu-.js';
3
3
  export { createDockerContext, createProcessContext } from './contexts.js';
4
4
  export { S as SandboxProvider, c as createSandboxContext } from './sandbox-CW72eLDP.js';
5
5
  export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-BpvTmawk.js';
6
- export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillValidationIssue, SkillValidationResult, SourcedScanPath, buildCatalog, defineSkill, discoverSkills, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, mergeSkillsConfig, parseAllowedToolPattern, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
7
- 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';
8
- 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';
6
+ export { Preset, basic, basicTools, definePreset } from './presets.js';
7
+ export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SkillValidationIssue, SkillValidationResult, SourcedScanPath, buildCatalog, defineSkill, discoverSkills, installAllowedToolsGate, interpolateShellCommands, isToolAllowedByUnion, matchesAllowedTool, parseAllowedToolPattern, parseSkillFile, resolveSkills, validateResourcePath, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
8
+ 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';
9
+ 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';
9
10
  import { Hookable } from 'hookable';
10
11
  import '@modelcontextprotocol/sdk/client/index.js';
11
12
 
package/dist/index.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
  toolResultToText
6
6
  } from "./chunk-MYWDHD7C.js";
@@ -9,11 +9,12 @@ import {
9
9
  cerebras,
10
10
  openai,
11
11
  openrouter
12
- } from "./chunk-FRNFVKWW.js";
12
+ } from "./chunk-CDRXC7A7.js";
13
13
  import {
14
- defineHarness,
15
- noTools
16
- } from "./chunk-OVQ4N64O.js";
14
+ basicTools,
15
+ basic_default,
16
+ definePreset
17
+ } from "./chunk-SP5NA6WF.js";
17
18
  import {
18
19
  createAgent,
19
20
  createInteractionTool,
@@ -23,7 +24,7 @@ import {
23
24
  createSpawnTool,
24
25
  glob,
25
26
  spawn
26
- } from "./chunk-PASFWG7S.js";
27
+ } from "./chunk-F5UBXERT.js";
27
28
  import {
28
29
  IMPLICITLY_ALLOWED_SKILL_TOOLS,
29
30
  buildCatalog,
@@ -33,7 +34,6 @@ import {
33
34
  interpolateShellCommands,
34
35
  isToolAllowedByUnion,
35
36
  matchesAllowedTool,
36
- mergeSkillsConfig,
37
37
  parseAllowedToolPattern,
38
38
  parseSkillFile,
39
39
  resolveSkills,
@@ -42,25 +42,25 @@ import {
42
42
  validateSkillName,
43
43
  writeSkillToDisk,
44
44
  writeSkillsToDisk
45
- } from "./chunk-BCXXXJ3G.js";
45
+ } from "./chunk-TPXPVEH6.js";
46
46
  import {
47
47
  createDockerContext,
48
48
  createProcessContext,
49
49
  createSandboxContext
50
- } from "./chunk-SZA4FKW5.js";
50
+ } from "./chunk-2EQT4EHD.js";
51
51
  import {
52
52
  connectMcpServers,
53
53
  normalizeMcpBlocks,
54
54
  normalizeMcpServers,
55
55
  resultToString
56
- } from "./chunk-PJUUYBKF.js";
56
+ } from "./chunk-37GD7NL3.js";
57
57
  import {
58
58
  createFileMapStore,
59
59
  createMemoryStore,
60
60
  createRemoteStore,
61
61
  createSession,
62
62
  loadSession
63
- } from "./chunk-VG2E6YK3.js";
63
+ } from "./chunk-PMCQOMV4.js";
64
64
  import {
65
65
  OpenAICompatHttpError,
66
66
  autoDetectAndConvert,
@@ -71,7 +71,7 @@ import {
71
71
  openaiCompat,
72
72
  toAnthropic,
73
73
  toOpenAI
74
- } from "./chunk-LN4LLLHA.js";
74
+ } from "./chunk-S3FCOMRI.js";
75
75
  import {
76
76
  AgentAbortedError,
77
77
  AgentContextExceededError,
@@ -80,7 +80,7 @@ import {
80
80
  CONTEXT_EXCEEDED_MESSAGE_PATTERNS,
81
81
  matchesContextExceeded,
82
82
  toTypedError
83
- } from "./chunk-7JTBBZ2U.js";
83
+ } from "./chunk-LNN5UTS2.js";
84
84
 
85
85
  // src/tracing.ts
86
86
  function createTracingHooks(options) {
@@ -204,6 +204,8 @@ export {
204
204
  OpenAICompatHttpError,
205
205
  anthropic,
206
206
  autoDetectAndConvert,
207
+ basic_default as basic,
208
+ basicTools,
207
209
  buildCatalog,
208
210
  cerebras,
209
211
  classifyOpenAICompatError,
@@ -223,7 +225,7 @@ export {
223
225
  createSkillsUseTool,
224
226
  createSpawnTool,
225
227
  createTracingHooks,
226
- defineHarness,
228
+ definePreset,
227
229
  defineSkill,
228
230
  discoverSkills,
229
231
  fromAnthropic,
@@ -236,8 +238,6 @@ export {
236
238
  mapOAIFinishReason,
237
239
  matchesAllowedTool,
238
240
  matchesContextExceeded,
239
- mergeSkillsConfig,
240
- noTools,
241
241
  normalizeMcpBlocks,
242
242
  normalizeMcpServers,
243
243
  openai,
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import 'hookable';
2
- export { M as McpConnection, q as McpServerConfig, at as connectMcpServers, aG as normalizeMcpBlocks, aH as normalizeMcpServers, aL as resultToString } from './agent-D-ZFMbSd.js';
2
+ export { M as McpConnection, p as McpServerConfig, ar as connectMcpServers, aC as normalizeMcpBlocks, aD as normalizeMcpServers, aH as resultToString } from './agent-vPBFXnu-.js';
3
3
  import '@modelcontextprotocol/sdk/client/index.js';
4
4
  import './types-BpvTmawk.js';
package/dist/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  normalizeMcpBlocks,
4
4
  normalizeMcpServers,
5
5
  resultToString
6
- } from "./chunk-PJUUYBKF.js";
6
+ } from "./chunk-37GD7NL3.js";
7
7
  export {
8
8
  connectMcpServers,
9
9
  normalizeMcpBlocks,
@@ -0,0 +1,33 @@
1
+ import { Z as ToolDef, e as AgentOptions } from './agent-vPBFXnu-.js';
2
+ import 'hookable';
3
+ import './types-BpvTmawk.js';
4
+ import '@modelcontextprotocol/sdk/client/index.js';
5
+
6
+ /** Core tools available in every basic preset (without spawn) */
7
+ declare const basicTools: {
8
+ shell: ToolDef;
9
+ readFile: ToolDef;
10
+ writeFile: ToolDef;
11
+ listFiles: ToolDef;
12
+ };
13
+ declare const _default: Preset;
14
+
15
+ /**
16
+ * A preset is a reusable slice of `AgentOptions` — spread it into `createAgent()`
17
+ * to configure tools, a default system prompt, aliases, and behavior defaults.
18
+ *
19
+ * `provider`, `execution`, `session`, and internal fields are excluded so presets
20
+ * remain shareable and composable.
21
+ *
22
+ * ```ts
23
+ * import { basic } from 'zidane/presets'
24
+ * createAgent({ ...basic, provider })
25
+ * ```
26
+ */
27
+ type Preset = Omit<Partial<AgentOptions>, 'provider' | 'execution' | 'session' | '_mcpConnector'>;
28
+ /**
29
+ * Identity helper for type inference when defining a preset.
30
+ */
31
+ declare function definePreset(config: Preset): Preset;
32
+
33
+ export { type Preset, _default as basic, basicTools, definePreset };