zidane 1.3.1 → 1.4.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.
@@ -1,6 +1,7 @@
1
1
  import '@anthropic-ai/sdk';
2
2
  import 'hookable';
3
- export { H as Harness, f as HarnessConfig, T as ToolContext, g as ToolDef, h as ToolMap, _ as basic, l as basicTools, k as defineHarness } from './agent-DxIUxou4.js';
3
+ export { H as Harness, c as HarnessConfig, T as ToolContext, d as ToolDef, e as ToolMap, _ as basic, i as basicTools, h as defineHarness, n as noTools } from './agent-B4wguzkU.js';
4
+ import './types-D8fzooXc.js';
4
5
  import './providers.js';
5
6
  import './types-CLRMCak3.js';
6
7
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/harnesses.js CHANGED
@@ -1,13 +1,17 @@
1
1
  import {
2
2
  basicTools,
3
3
  basic_default,
4
- defineHarness
5
- } from "./chunk-N523NBO2.js";
6
- import "./chunk-SWS5624X.js";
4
+ defineHarness,
5
+ init_harnesses,
6
+ noTools
7
+ } from "./chunk-YCH7G7YC.js";
7
8
  import "./chunk-26LIQARN.js";
9
+ import "./chunk-PRNQ7DXE.js";
8
10
  import "./chunk-PNKVD2UK.js";
11
+ init_harnesses();
9
12
  export {
10
13
  basic_default as basic,
11
14
  basicTools,
12
- defineHarness
15
+ defineHarness,
16
+ noTools
13
17
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { S as SpawnConfig, E as ExecutionContext, a as ExecResult } from './agent-DxIUxou4.js';
2
- export { A as Agent, b as AgentHooks, c as AgentOptions, C as ContextCapabilities, d as ContextType, e as ExecutionHandle, H as Harness, f as HarnessConfig, M as McpConnection, T as ToolContext, g as ToolDef, h as ToolMap, i as connectMcpServers, j as createAgent, k as defineHarness } from './agent-DxIUxou4.js';
1
+ export { A as Agent, a as AgentHooks, b as AgentOptions, H as Harness, c as HarnessConfig, M as McpConnection, T as ToolContext, d as ToolDef, e as ToolMap, f as connectMcpServers, g as createAgent, h as defineHarness, n as noTools } from './agent-B4wguzkU.js';
2
+ import { S as SpawnConfig, E as ExecutionContext, a as ExecResult } from './types-D8fzooXc.js';
3
+ export { C as ContextCapabilities, b as ContextType, c as ExecutionHandle, d as SkillConfig, e as SkillResource, f as SkillsConfig } from './types-D8fzooXc.js';
3
4
  export { CreateSessionOptions, RemoteStoreOptions, Session, SessionData, SessionRun, SessionStore, SqliteStoreOptions, autoDetectAndConvert, createMemoryStore, createRemoteStore, createSession, createSqliteStore, fromAnthropic, fromOpenAI, loadSession, toAnthropic, toOpenAI } from './session.js';
4
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-bEqlGUVT.js';
5
+ export { buildCatalog, defineSkill, discoverSkills, interpolateShellCommands, mergeSkillsConfig, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
6
+ export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-vZAQfDkd.js';
5
7
  export { A as AgentRunOptions, a as AgentStats, I as ImageContent, M as McpServerConfig, S as SessionContentBlock, b as SessionMessage, c as SessionTurn, T as ThinkingLevel, d as ToolExecutionMode, e as TurnUsage } from './types-CLRMCak3.js';
6
8
  import 'hookable';
7
9
  import '@anthropic-ai/sdk';
package/dist/index.js CHANGED
@@ -1,16 +1,17 @@
1
- import {
2
- defineHarness
3
- } from "./chunk-N523NBO2.js";
4
1
  import {
5
2
  createAgent,
6
3
  createDockerContext,
7
4
  createProcessContext,
8
5
  createSandboxContext,
9
6
  createSpawnTool,
7
+ defineHarness,
10
8
  init_agent,
11
9
  init_contexts,
10
+ init_harnesses,
11
+ init_tools,
12
+ noTools,
12
13
  spawn
13
- } from "./chunk-SWS5624X.js";
14
+ } from "./chunk-YCH7G7YC.js";
14
15
  import {
15
16
  connectMcpServers,
16
17
  init_mcp
@@ -29,14 +30,31 @@ import {
29
30
  toAnthropic,
30
31
  toOpenAI
31
32
  } from "./chunk-LS57GDAV.js";
33
+ import {
34
+ defineSkill
35
+ } from "./chunk-QPYZR2QM.js";
36
+ import {
37
+ buildCatalog,
38
+ discoverSkills,
39
+ interpolateShellCommands,
40
+ mergeSkillsConfig,
41
+ parseSkillFile,
42
+ resolveSkills,
43
+ validateSkillName,
44
+ writeSkillToDisk,
45
+ writeSkillsToDisk
46
+ } from "./chunk-PRNQ7DXE.js";
32
47
  import "./chunk-PNKVD2UK.js";
33
48
 
34
49
  // src/index.ts
35
50
  init_agent();
36
51
  init_contexts();
52
+ init_harnesses();
37
53
  init_mcp();
54
+ init_tools();
38
55
  export {
39
56
  autoDetectAndConvert,
57
+ buildCatalog,
40
58
  connectMcpServers,
41
59
  createAgent,
42
60
  createDockerContext,
@@ -48,10 +66,20 @@ export {
48
66
  createSpawnTool,
49
67
  createSqliteStore,
50
68
  defineHarness,
69
+ defineSkill,
70
+ discoverSkills,
51
71
  fromAnthropic,
52
72
  fromOpenAI,
73
+ interpolateShellCommands,
53
74
  loadSession,
75
+ mergeSkillsConfig,
76
+ noTools,
77
+ parseSkillFile,
78
+ resolveSkills,
54
79
  spawn,
55
80
  toAnthropic,
56
- toOpenAI
81
+ toOpenAI,
82
+ validateSkillName,
83
+ writeSkillToDisk,
84
+ writeSkillsToDisk
57
85
  };
package/dist/mcp.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import 'hookable';
2
- export { M as McpConnection, i as connectMcpServers, r as resultToString } from './agent-DxIUxou4.js';
2
+ export { M as McpConnection, f as connectMcpServers, r as resultToString } from './agent-B4wguzkU.js';
3
3
  export { M as McpServerConfig } from './types-CLRMCak3.js';
4
4
  import '@modelcontextprotocol/sdk/client/index.js';
5
+ import './types-D8fzooXc.js';
5
6
  import '@anthropic-ai/sdk';
6
7
  import './providers.js';
7
8
  import './session.js';
@@ -1,10 +1,25 @@
1
1
  import { b as SessionMessage, T as ThinkingLevel, I as ImageContent, e as TurnUsage } from './types-CLRMCak3.js';
2
2
 
3
- declare function anthropic(): Provider;
3
+ interface AnthropicParams {
4
+ apiKey?: string;
5
+ access?: string;
6
+ refresh?: string;
7
+ expires?: number;
8
+ defaultModel?: string;
9
+ }
10
+ declare function anthropic(anthropicParams?: AnthropicParams): Provider;
4
11
 
5
- declare function cerebras(defaultModel?: string): Provider;
12
+ interface CerebrasParams {
13
+ apiKey?: string;
14
+ defaultModel?: string;
15
+ }
16
+ declare function cerebras(params?: CerebrasParams): Provider;
6
17
 
7
- declare function openrouter(defaultModel?: string): Provider;
18
+ interface OpenRouterParams {
19
+ apiKey?: string;
20
+ defaultModel?: string;
21
+ }
22
+ declare function openrouter(params?: OpenRouterParams): Provider;
8
23
 
9
24
  interface ToolSpec {
10
25
  name: string;
@@ -62,4 +77,4 @@ interface Provider {
62
77
  stream: (options: StreamOptions, callbacks: StreamCallbacks) => Promise<TurnResult>;
63
78
  }
64
79
 
65
- export { type Provider, type StreamCallbacks, type StreamOptions, type ToolCall, type ToolResult, type ToolSpec, type TurnResult, anthropic, cerebras, openrouter };
80
+ export { type AnthropicParams, type CerebrasParams, type OpenRouterParams, type Provider, type StreamCallbacks, type StreamOptions, type ToolCall, type ToolResult, type ToolSpec, type TurnResult, anthropic, cerebras, openrouter };
package/dist/providers.js CHANGED
@@ -16,7 +16,11 @@ import { existsSync, readFileSync } from "fs";
16
16
  import { resolve } from "path";
17
17
  import Anthropic from "@anthropic-ai/sdk";
18
18
  var CREDENTIALS_FILE = resolve(import.meta.dir, "../../.credentials.json");
19
- function getApiKey() {
19
+ function getApiKey(anthropicParams) {
20
+ if (anthropicParams?.apiKey)
21
+ return anthropicParams.apiKey;
22
+ if (anthropicParams?.access)
23
+ return anthropicParams.access;
20
24
  if (process.env.ANTHROPIC_API_KEY)
21
25
  return process.env.ANTHROPIC_API_KEY;
22
26
  if (existsSync(CREDENTIALS_FILE)) {
@@ -32,9 +36,10 @@ var THINKING_BUDGETS = {
32
36
  medium: 10240,
33
37
  high: 32768
34
38
  };
35
- function anthropic() {
36
- const apiKey = getApiKey();
39
+ function anthropic(anthropicParams) {
40
+ const apiKey = getApiKey(anthropicParams);
37
41
  const isOAuth = apiKey.includes("sk-ant-oat");
42
+ const defaultModel = anthropicParams?.defaultModel || "claude-opus-4-6";
38
43
  const client = new Anthropic(
39
44
  isOAuth ? {
40
45
  apiKey: null,
@@ -50,7 +55,7 @@ function anthropic() {
50
55
  );
51
56
  return {
52
57
  name: "anthropic",
53
- meta: { defaultModel: "claude-opus-4-6", isOAuth },
58
+ meta: { defaultModel, isOAuth },
54
59
  formatTools(tools) {
55
60
  return tools.map((t) => ({
56
61
  name: t.name,
@@ -88,16 +93,9 @@ function anthropic() {
88
93
  };
89
94
  },
90
95
  async stream(options, callbacks) {
91
- let system = options.system;
96
+ const system = isOAuth ? `You are Claude Code, Anthropic's official CLI for Claude.` : options.system;
92
97
  const messages = [...options.messages];
93
98
  const thinking = options.thinking ?? "off";
94
- if (isOAuth) {
95
- system = `You are Claude Code, Anthropic's official CLI for Claude.`;
96
- messages.unshift(
97
- { role: "user", content: [{ type: "text", text: options.system }] },
98
- { role: "assistant", content: [{ type: "text", text: "Understood. I will proceed with these instructions above the rest of my system prompt." }] }
99
- );
100
- }
101
99
  const params = {
102
100
  model: options.model,
103
101
  max_tokens: options.maxTokens ?? 16384,
@@ -142,23 +140,25 @@ function anthropic() {
142
140
 
143
141
  // src/providers/cerebras.ts
144
142
  var BASE_URL = "https://api.cerebras.ai/v1";
145
- function getApiKey2() {
143
+ function getApiKey2(params) {
144
+ if (params?.apiKey)
145
+ return params.apiKey;
146
146
  if (process.env.CEREBRAS_API_KEY)
147
147
  return process.env.CEREBRAS_API_KEY;
148
148
  throw new Error("No Cerebras API key found. Set CEREBRAS_API_KEY in your environment.");
149
149
  }
150
- function cerebras(defaultModel) {
151
- const apiKey = getApiKey2();
152
- const fallbackModel = defaultModel || "zai-glm-4.7";
150
+ function cerebras(params) {
151
+ const apiKey = getApiKey2(params);
152
+ const defaultModel = params?.defaultModel || "zai-glm-4.7";
153
153
  return {
154
154
  name: "cerebras",
155
- meta: { defaultModel: fallbackModel },
155
+ meta: { defaultModel },
156
156
  formatTools,
157
157
  userMessage,
158
158
  assistantMessage,
159
159
  toolResultsMessage,
160
160
  async stream(options, callbacks) {
161
- const modelId = options.model || fallbackModel;
161
+ const modelId = options.model || defaultModel;
162
162
  const messages = toOAIMessages(options.system, options.messages);
163
163
  const body = {
164
164
  model: modelId,
@@ -195,23 +195,25 @@ function cerebras(defaultModel) {
195
195
 
196
196
  // src/providers/openrouter.ts
197
197
  var BASE_URL2 = "https://openrouter.ai/api/v1";
198
- function getApiKey3() {
198
+ function getApiKey3(params) {
199
+ if (params?.apiKey)
200
+ return params.apiKey;
199
201
  if (process.env.OPENROUTER_API_KEY)
200
202
  return process.env.OPENROUTER_API_KEY;
201
203
  throw new Error("No OpenRouter API key found. Set OPENROUTER_API_KEY in your environment.");
202
204
  }
203
- function openrouter(defaultModel) {
204
- const apiKey = getApiKey3();
205
- const fallbackModel = defaultModel || "anthropic/claude-sonnet-4-6";
205
+ function openrouter(params) {
206
+ const apiKey = getApiKey3(params);
207
+ const defaultModel = params?.defaultModel || "anthropic/claude-sonnet-4-6";
206
208
  return {
207
209
  name: "openrouter",
208
- meta: { defaultModel: fallbackModel },
210
+ meta: { defaultModel },
209
211
  formatTools,
210
212
  userMessage,
211
213
  assistantMessage,
212
214
  toolResultsMessage,
213
215
  async stream(options, callbacks) {
214
- let modelId = options.model || fallbackModel;
216
+ let modelId = options.model || defaultModel;
215
217
  const thinking = options.thinking ?? "off";
216
218
  if (thinking !== "off" && !modelId.includes(":thinking"))
217
219
  modelId = `${modelId}:thinking`;
@@ -0,0 +1,124 @@
1
+ import { d as SkillConfig, E as ExecutionContext, c as ExecutionHandle, f as SkillsConfig } from './types-D8fzooXc.js';
2
+ export { e as SkillResource } from './types-D8fzooXc.js';
3
+
4
+ /**
5
+ * Skill catalog generation.
6
+ *
7
+ * Builds the system prompt section that discloses available skills
8
+ * to the agent, following progressive disclosure (tier 1: name + description only).
9
+ */
10
+
11
+ /**
12
+ * Build the skill catalog XML and behavioral instructions for the system prompt.
13
+ *
14
+ * @param skills - Resolved skills to include (already filtered for excluded)
15
+ * @param readToolName - Tool name the agent should use to read skill files (default: 'read_file')
16
+ */
17
+ declare function buildCatalog(skills: SkillConfig[], readToolName?: string): string;
18
+
19
+ /**
20
+ * Skill discovery and parsing.
21
+ *
22
+ * Scans filesystem directories for SKILL.md files following the
23
+ * Agent Skills specification (agentskills.io/specification).
24
+ */
25
+
26
+ /**
27
+ * Validate a skill name per the Agent Skills spec:
28
+ * 1-64 chars, lowercase alphanumeric + hyphens, no leading/trailing/consecutive hyphens.
29
+ */
30
+ declare function validateSkillName(name: string): boolean;
31
+ interface ParsedSkillFile {
32
+ frontmatter: Record<string, unknown>;
33
+ body: string;
34
+ }
35
+ /**
36
+ * Parse a SKILL.md file into frontmatter + body.
37
+ * Uses simple regex-based extraction (no external YAML lib needed for simple cases).
38
+ */
39
+ declare function parseFrontmatter(content: string): ParsedSkillFile;
40
+ /**
41
+ * Parse a SKILL.md file into a SkillConfig.
42
+ * Returns null if the file is invalid (missing description).
43
+ */
44
+ declare function parseSkillFile(filePath: string): Promise<SkillConfig | null>;
45
+ declare function getDefaultScanPaths(): string[];
46
+ /**
47
+ * Discover skills from filesystem paths.
48
+ * Each path is scanned for subdirectories containing SKILL.md.
49
+ * Later paths have lower priority (earlier skill with same name wins).
50
+ */
51
+ declare function discoverSkills(paths: string[]): Promise<SkillConfig[]>;
52
+
53
+ /**
54
+ * Shell interpolation for skill instructions.
55
+ *
56
+ * The `!\`command\`` syntax runs shell commands as a preprocessing step
57
+ * before skill content is sent to the agent. The command output replaces
58
+ * the placeholder — the agent only sees the final result.
59
+ *
60
+ * Example:
61
+ * - PR diff: !\`gh pr diff\`
62
+ * → - PR diff: <actual diff output>
63
+ */
64
+
65
+ /**
66
+ * Interpolate shell commands in skill instructions.
67
+ *
68
+ * Runs each !\`command\` through the execution context and replaces
69
+ * the placeholder with the command's stdout. If a command fails,
70
+ * the placeholder is replaced with an error message.
71
+ *
72
+ * @param instructions - Raw skill instructions with potential !\`command\` patterns
73
+ * @param execution - The execution context to run commands in
74
+ * @param handle - The active execution handle
75
+ * @returns Instructions with all !\`command\` patterns replaced by output
76
+ */
77
+ declare function interpolateShellCommands(instructions: string, execution: ExecutionContext, handle: ExecutionHandle): Promise<string>;
78
+
79
+ /**
80
+ * Skill resolution — discovers filesystem skills, writes dynamic skills,
81
+ * merges everything, and applies filtering.
82
+ */
83
+
84
+ /**
85
+ * Resolve all skills from a SkillsConfig:
86
+ * 1. Write dynamic skills (config.write) to a temp directory
87
+ * 2. Discover skills from scan paths (defaults + config.scan + written dir)
88
+ * 3. Filter out exclude skills
89
+ *
90
+ * Written skills are materialized as proper SKILL.md files on disk,
91
+ * so they participate in discovery like any other filesystem skill.
92
+ */
93
+ declare function resolveSkills(config: SkillsConfig): Promise<SkillConfig[]>;
94
+ /**
95
+ * Merge harness-level and agent-level SkillsConfig.
96
+ * Agent-level settings take precedence for scalar fields.
97
+ * Arrays (scan, write, exclude) are concatenated.
98
+ */
99
+ declare function mergeSkillsConfig(harness?: SkillsConfig, agent?: SkillsConfig): SkillsConfig | undefined;
100
+
101
+ /**
102
+ * Skill writer — materializes inline SkillConfig objects to disk as proper
103
+ * SKILL.md files so they participate fully in the filesystem-based skill system.
104
+ */
105
+
106
+ /**
107
+ * Write a SkillConfig to disk as a proper skill directory with SKILL.md.
108
+ * Returns the path to the written SKILL.md file.
109
+ */
110
+ declare function writeSkillToDisk(skill: SkillConfig, targetDir: string): string;
111
+ /**
112
+ * Write multiple SkillConfig objects to a target directory.
113
+ * Each skill gets its own subdirectory with a SKILL.md file.
114
+ * Returns the target directory path (for use as a scan path).
115
+ */
116
+ declare function writeSkillsToDisk(skills: SkillConfig[], targetDir: string): string;
117
+
118
+ /**
119
+ * Define an inline skill configuration.
120
+ * Convenience wrapper for type safety — returns the config as-is.
121
+ */
122
+ declare function defineSkill(config: SkillConfig): SkillConfig;
123
+
124
+ export { SkillConfig, SkillsConfig, buildCatalog, defineSkill, discoverSkills, getDefaultScanPaths, interpolateShellCommands, mergeSkillsConfig, parseFrontmatter, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
package/dist/skills.js ADDED
@@ -0,0 +1,31 @@
1
+ import {
2
+ defineSkill
3
+ } from "./chunk-QPYZR2QM.js";
4
+ import {
5
+ buildCatalog,
6
+ discoverSkills,
7
+ getDefaultScanPaths,
8
+ interpolateShellCommands,
9
+ mergeSkillsConfig,
10
+ parseFrontmatter,
11
+ parseSkillFile,
12
+ resolveSkills,
13
+ validateSkillName,
14
+ writeSkillToDisk,
15
+ writeSkillsToDisk
16
+ } from "./chunk-PRNQ7DXE.js";
17
+ import "./chunk-PNKVD2UK.js";
18
+ export {
19
+ buildCatalog,
20
+ defineSkill,
21
+ discoverSkills,
22
+ getDefaultScanPaths,
23
+ interpolateShellCommands,
24
+ mergeSkillsConfig,
25
+ parseFrontmatter,
26
+ parseSkillFile,
27
+ resolveSkills,
28
+ validateSkillName,
29
+ writeSkillToDisk,
30
+ writeSkillsToDisk
31
+ };
@@ -1,4 +1,4 @@
1
- import { f as HarnessConfig, g as ToolDef } from './agent-DxIUxou4.js';
1
+ import { c as HarnessConfig, d as ToolDef } from './agent-B4wguzkU.js';
2
2
  import { a as AgentStats } from './types-CLRMCak3.js';
3
3
 
4
4
  /**
@@ -27,14 +27,6 @@ interface SpawnToolState {
27
27
  /** Aggregated stats from all completed children (returns a copy) */
28
28
  readonly totalChildStats: Readonly<AgentStats>;
29
29
  }
30
- /**
31
- * Static spawn tool — add directly to any harness.
32
- *
33
- * Reads provider and harness from ToolContext at execution time.
34
- * Children get the same harness as the parent (including spawn),
35
- * so sub-agents can spawn their own children.
36
- */
37
- declare const spawn: ToolDef & SpawnToolState;
38
30
  interface SpawnToolOptions {
39
31
  /** Maximum concurrent sub-agents (default: 3) */
40
32
  maxConcurrent?: number;
@@ -59,5 +51,13 @@ interface SpawnToolOptions {
59
51
  * model overrides, or lifecycle callbacks.
60
52
  */
61
53
  declare function createSpawnTool(options?: SpawnToolOptions): ToolDef & SpawnToolState;
54
+ /**
55
+ * Static spawn tool — add directly to any harness.
56
+ *
57
+ * Reads provider and harness from ToolContext at execution time.
58
+ * Children get the same harness as the parent (including spawn),
59
+ * so sub-agents can spawn their own children.
60
+ */
61
+ declare const spawn: ToolDef & SpawnToolState;
62
62
 
63
63
  export { type ChildAgent as C, type SpawnToolOptions as S, type SpawnToolState as a, createSpawnTool as c, spawn as s };
package/dist/tools.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { g as ToolDef } from './agent-DxIUxou4.js';
2
- export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-bEqlGUVT.js';
1
+ import { d as ToolDef } from './agent-B4wguzkU.js';
2
+ export { C as ChildAgent, S as SpawnToolOptions, a as SpawnToolState, c as createSpawnTool, s as spawn } from './spawn-vZAQfDkd.js';
3
3
  import 'hookable';
4
+ import './types-D8fzooXc.js';
4
5
  import '@anthropic-ai/sdk';
5
6
  import './types-CLRMCak3.js';
6
7
  import '@modelcontextprotocol/sdk/client/index.js';
package/dist/tools.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import {
2
2
  createSpawnTool,
3
+ init_tools,
3
4
  listFiles,
4
5
  readFile,
5
6
  shell,
6
7
  spawn,
7
8
  validateToolArgs,
8
9
  writeFile
9
- } from "./chunk-SWS5624X.js";
10
+ } from "./chunk-YCH7G7YC.js";
10
11
  import "./chunk-26LIQARN.js";
12
+ import "./chunk-PRNQ7DXE.js";
11
13
  import "./chunk-PNKVD2UK.js";
14
+ init_tools();
12
15
  export {
13
16
  createSpawnTool,
14
17
  listFiles,
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Execution context types.
3
+ *
4
+ * An execution context defines *where* and *how* an agent's tools run.
5
+ * The agent loop and tools interact through this interface without knowing
6
+ * whether they're running in-process, in a Docker container, or in a
7
+ * remote sandbox.
8
+ */
9
+ interface ContextCapabilities {
10
+ /** Can execute shell commands */
11
+ shell: boolean;
12
+ /** Can read/write files in a workspace */
13
+ filesystem: boolean;
14
+ /** Can make outbound network requests */
15
+ network: boolean;
16
+ /** Has GPU access */
17
+ gpu: boolean;
18
+ }
19
+ /** Opaque handle to a running execution context instance */
20
+ interface ExecutionHandle {
21
+ id: string;
22
+ type: ContextType;
23
+ /** Working directory within the context */
24
+ cwd: string;
25
+ }
26
+ interface ExecResult {
27
+ stdout: string;
28
+ stderr: string;
29
+ exitCode: number;
30
+ }
31
+ interface SpawnConfig {
32
+ /** Working directory (created if it doesn't exist) */
33
+ cwd?: string;
34
+ /** Environment variables */
35
+ env?: Record<string, string>;
36
+ /** Docker image (only for 'docker' context) */
37
+ image?: string;
38
+ /** Resource limits */
39
+ limits?: {
40
+ /** Memory limit in MB */
41
+ memory?: number;
42
+ /** CPU limit (e.g. '1.0' = 1 core) */
43
+ cpu?: string;
44
+ /** Timeout in seconds for the entire context lifetime */
45
+ timeout?: number;
46
+ };
47
+ /** Sandbox provider config (only for 'sandbox' context) */
48
+ sandbox?: {
49
+ provider: string;
50
+ apiKey?: string;
51
+ [key: string]: unknown;
52
+ };
53
+ }
54
+ type ContextType = 'process' | 'docker' | 'sandbox';
55
+ interface ExecutionContext {
56
+ /** Context type identifier */
57
+ readonly type: ContextType;
58
+ /** What this context supports */
59
+ readonly capabilities: ContextCapabilities;
60
+ /** Spawn a new execution environment */
61
+ spawn: (config?: SpawnConfig) => Promise<ExecutionHandle>;
62
+ /** Execute a shell command in the context */
63
+ exec: (handle: ExecutionHandle, command: string, options?: {
64
+ cwd?: string;
65
+ env?: Record<string, string>;
66
+ timeout?: number;
67
+ }) => Promise<ExecResult>;
68
+ /** Read a file from the context's filesystem */
69
+ readFile: (handle: ExecutionHandle, path: string) => Promise<string>;
70
+ /** Write a file to the context's filesystem */
71
+ writeFile: (handle: ExecutionHandle, path: string, content: string) => Promise<void>;
72
+ /** List files in a directory */
73
+ listFiles: (handle: ExecutionHandle, path: string) => Promise<string[]>;
74
+ /** Destroy the execution environment and clean up resources */
75
+ destroy: (handle: ExecutionHandle) => Promise<void>;
76
+ }
77
+
78
+ /**
79
+ * Types for the Agent Skills system.
80
+ *
81
+ * Follows the Agent Skills open standard (agentskills.io/specification).
82
+ */
83
+ interface SkillResource {
84
+ /** Relative path from skill directory */
85
+ path: string;
86
+ /** Resource type inferred from directory */
87
+ type: 'script' | 'reference' | 'asset' | 'other';
88
+ }
89
+ interface SkillConfig {
90
+ /** Skill name: 1-64 chars, lowercase alphanumeric + hyphens */
91
+ name: string;
92
+ /** What the skill does and when to use it (1-1024 chars) */
93
+ description: string;
94
+ /** The SKILL.md body content (after YAML frontmatter) */
95
+ instructions: string;
96
+ /** Absolute path to SKILL.md (undefined for inline skills) */
97
+ location?: string;
98
+ /** Skill directory path for resolving relative references */
99
+ baseDir?: string;
100
+ /** License identifier or reference */
101
+ license?: string;
102
+ /** Environment requirements */
103
+ compatibility?: string;
104
+ /** Arbitrary key-value metadata */
105
+ metadata?: Record<string, string>;
106
+ /** Pre-approved tool names (experimental) */
107
+ allowedTools?: string[];
108
+ /** Bundled resource files discovered in the skill directory */
109
+ resources?: SkillResource[];
110
+ /** Model override when this skill is active */
111
+ model?: string;
112
+ /** Thinking/reasoning level override when this skill is active */
113
+ thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
114
+ /**
115
+ * Glob patterns that limit when this skill auto-activates.
116
+ * When set, the skill is only included in the catalog when
117
+ * the agent is working with files matching these patterns.
118
+ */
119
+ paths?: string[];
120
+ }
121
+ interface SkillsConfig {
122
+ /**
123
+ * Control which skills are active.
124
+ * - `true` (default): all discovered skills are enabled
125
+ * - `false` or `[]`: fully disable the skills system (no resolution, no catalog, no hooks)
126
+ * - `string[]`: allowlist — only skills with matching names are enabled
127
+ */
128
+ enabled?: boolean | string[];
129
+ /** Directories to scan for SKILL.md files */
130
+ scan?: string[];
131
+ /** Dynamic skills written to disk at agent start, then loaded normally */
132
+ write?: SkillConfig[];
133
+ /** Tool name the agent should use to read skill files (default: 'read_file') */
134
+ readToolName?: string;
135
+ /** Skill names to exclude from the catalog */
136
+ exclude?: string[];
137
+ /** Skip default scan paths (~/.agents/skills, .zidane/skills, etc.) */
138
+ skipDefaultPaths?: boolean;
139
+ }
140
+
141
+ export type { ContextCapabilities as C, ExecutionContext as E, SpawnConfig as S, ExecResult as a, ContextType as b, ExecutionHandle as c, SkillConfig as d, SkillResource as e, SkillsConfig as f };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zidane",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "an agent that goes straight to the goal",
5
5
  "type": "module",
6
6
  "private": false,
@@ -38,6 +38,10 @@
38
38
  "./session": {
39
39
  "import": "./dist/session.js",
40
40
  "types": "./dist/session.d.ts"
41
+ },
42
+ "./skills": {
43
+ "import": "./dist/skills.js",
44
+ "types": "./dist/skills.d.ts"
41
45
  }
42
46
  },
43
47
  "main": "./dist/index.js",