zidane 1.6.12 → 1.6.13
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.
- package/dist/{agent-KbjiZ_hH.d.ts → agent-CUKZMA-_.d.ts} +2 -1
- package/dist/{chunk-LACFS6JT.js → chunk-474ILKQA.js} +10 -246
- package/dist/{chunk-QBORJLR3.js → chunk-7SMBCRUX.js} +1 -1
- package/dist/chunk-SZA4FKW5.js +241 -0
- package/dist/contexts.d.ts +25 -0
- package/dist/contexts.js +10 -0
- package/dist/harnesses.d.ts +3 -2
- package/dist/harnesses.js +4 -3
- package/dist/index.d.ts +7 -26
- package/dist/index.js +21 -19
- package/dist/mcp.d.ts +3 -2
- package/dist/providers.d.ts +3 -2
- package/dist/providers.js +1 -4
- package/dist/{sandbox-DZn3ybp_.d.ts → sandbox-CW72eLDP.d.ts} +1 -1
- package/dist/session.d.ts +3 -2
- package/dist/skills.d.ts +3 -2
- package/dist/{spawn-ClpvpWty.d.ts → spawn-B7AtyfuG.d.ts} +1 -1
- package/dist/tools.d.ts +4 -3
- package/dist/tools.js +3 -2
- package/dist/{types-CKXAp41h.d.ts → types-BpvTmawk.d.ts} +1 -64
- package/dist/types-CDI8Kmve.d.ts +64 -0
- package/dist/types.d.ts +5 -4
- package/package.json +5 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Hookable } from 'hookable';
|
|
2
|
-
import { b as ExecutionContext, c as ExecutionHandle
|
|
2
|
+
import { b as ExecutionContext, c as ExecutionHandle } from './types-BpvTmawk.js';
|
|
3
3
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
+
import { b as SkillsConfig, S as SkillConfig } from './types-CDI8Kmve.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Shared types for the agent system.
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
connectMcpServers
|
|
3
|
-
} from "./chunk-5LOHDFK3.js";
|
|
4
1
|
import {
|
|
5
2
|
buildCatalog,
|
|
6
3
|
interpolateShellCommands,
|
|
7
4
|
mergeSkillsConfig,
|
|
8
5
|
resolveSkills
|
|
9
6
|
} from "./chunk-4C6Y56CC.js";
|
|
7
|
+
import {
|
|
8
|
+
createProcessContext
|
|
9
|
+
} from "./chunk-SZA4FKW5.js";
|
|
10
|
+
import {
|
|
11
|
+
connectMcpServers
|
|
12
|
+
} from "./chunk-5LOHDFK3.js";
|
|
10
13
|
|
|
11
14
|
// src/tools/interaction.ts
|
|
12
15
|
function createInteractionTool(options) {
|
|
@@ -97,242 +100,6 @@ ${result.stderr}`.trim();
|
|
|
97
100
|
// src/agent.ts
|
|
98
101
|
import { createHooks } from "hookable";
|
|
99
102
|
|
|
100
|
-
// src/contexts/docker.ts
|
|
101
|
-
var SINGLE_QUOTE_RE = /'/g;
|
|
102
|
-
function createDockerContext(config) {
|
|
103
|
-
let counter = 0;
|
|
104
|
-
const containers = /* @__PURE__ */ new Map();
|
|
105
|
-
const defaultImage = config?.image ?? "oven/bun:latest";
|
|
106
|
-
const defaultCwd = config?.cwd ?? "/workspace";
|
|
107
|
-
const defaultEnv = config?.env;
|
|
108
|
-
const defaultLimits = config?.limits;
|
|
109
|
-
async function getDockerode() {
|
|
110
|
-
try {
|
|
111
|
-
const Dockerode = (await import("dockerode")).default;
|
|
112
|
-
return new Dockerode();
|
|
113
|
-
} catch {
|
|
114
|
-
throw new Error("dockerode is required for Docker execution context. Install it with: bun add dockerode");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
const ctx = {
|
|
118
|
-
type: "docker",
|
|
119
|
-
capabilities: {
|
|
120
|
-
shell: true,
|
|
121
|
-
filesystem: true,
|
|
122
|
-
network: true,
|
|
123
|
-
gpu: false
|
|
124
|
-
},
|
|
125
|
-
async spawn(overrides) {
|
|
126
|
-
const docker = await getDockerode();
|
|
127
|
-
const id = `docker-${++counter}`;
|
|
128
|
-
const image = overrides?.image ?? defaultImage;
|
|
129
|
-
const cwd = overrides?.cwd ?? defaultCwd;
|
|
130
|
-
try {
|
|
131
|
-
await docker.getImage(image).inspect();
|
|
132
|
-
} catch {
|
|
133
|
-
await new Promise((resolve2, reject) => {
|
|
134
|
-
docker.pull(image, (err, stream) => {
|
|
135
|
-
if (err)
|
|
136
|
-
return reject(err);
|
|
137
|
-
docker.modem.followProgress(stream, (err2) => {
|
|
138
|
-
err2 ? reject(err2) : resolve2();
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
const limits = { ...defaultLimits, ...overrides?.limits };
|
|
144
|
-
const hostConfig = {};
|
|
145
|
-
if (limits?.memory) {
|
|
146
|
-
hostConfig.Memory = limits.memory * 1024 * 1024;
|
|
147
|
-
}
|
|
148
|
-
if (limits?.cpu) {
|
|
149
|
-
hostConfig.NanoCpus = Number.parseFloat(limits.cpu) * 1e9;
|
|
150
|
-
}
|
|
151
|
-
const env = { ...defaultEnv, ...overrides?.env };
|
|
152
|
-
const container = await docker.createContainer({
|
|
153
|
-
Image: image,
|
|
154
|
-
Cmd: ["sleep", "infinity"],
|
|
155
|
-
WorkingDir: cwd,
|
|
156
|
-
Env: Object.entries(env).map(([k, v]) => `${k}=${v}`),
|
|
157
|
-
HostConfig: hostConfig
|
|
158
|
-
});
|
|
159
|
-
await container.start();
|
|
160
|
-
const handle = { id, type: "docker", cwd };
|
|
161
|
-
containers.set(id, { handle, container, docker });
|
|
162
|
-
return handle;
|
|
163
|
-
},
|
|
164
|
-
async exec(handle, command, options) {
|
|
165
|
-
const ref = containers.get(handle.id);
|
|
166
|
-
if (!ref)
|
|
167
|
-
throw new Error(`Container ${handle.id} not found`);
|
|
168
|
-
const execCwd = options?.cwd ?? handle.cwd;
|
|
169
|
-
const env = options?.env ? Object.entries(options.env).map(([k, v]) => `${k}=${v}`) : [];
|
|
170
|
-
const exec = await ref.container.exec({
|
|
171
|
-
Cmd: ["sh", "-c", command],
|
|
172
|
-
WorkingDir: execCwd,
|
|
173
|
-
Env: env,
|
|
174
|
-
AttachStdout: true,
|
|
175
|
-
AttachStderr: true
|
|
176
|
-
});
|
|
177
|
-
const stream = await exec.start({ Detach: false });
|
|
178
|
-
return new Promise((resolve2) => {
|
|
179
|
-
let stdout = "";
|
|
180
|
-
const stderr = "";
|
|
181
|
-
const timeout = options?.timeout ?? defaultLimits?.timeout ?? 30;
|
|
182
|
-
const timer = setTimeout(() => {
|
|
183
|
-
resolve2({ stdout, stderr: `${stderr}
|
|
184
|
-
[timeout]`, exitCode: 124 });
|
|
185
|
-
}, timeout * 1e3);
|
|
186
|
-
stream.on("data", (chunk) => {
|
|
187
|
-
stdout += chunk.toString("utf-8");
|
|
188
|
-
});
|
|
189
|
-
stream.on("end", async () => {
|
|
190
|
-
clearTimeout(timer);
|
|
191
|
-
const inspect = await exec.inspect();
|
|
192
|
-
resolve2({ stdout, stderr, exitCode: inspect.ExitCode ?? 0 });
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
async readFile(handle, path) {
|
|
197
|
-
const result = await ctx.exec(handle, `cat ${JSON.stringify(path)}`);
|
|
198
|
-
if (result.exitCode !== 0)
|
|
199
|
-
throw new Error(`Failed to read file: ${result.stderr}`);
|
|
200
|
-
return result.stdout;
|
|
201
|
-
},
|
|
202
|
-
async writeFile(handle, path, content) {
|
|
203
|
-
const escaped = content.replace(SINGLE_QUOTE_RE, String.raw`'\''`);
|
|
204
|
-
const result = await ctx.exec(handle, `mkdir -p "$(dirname ${JSON.stringify(path)})" && printf '%s' '${escaped}' > ${JSON.stringify(path)}`);
|
|
205
|
-
if (result.exitCode !== 0)
|
|
206
|
-
throw new Error(`Failed to write file: ${result.stderr}`);
|
|
207
|
-
},
|
|
208
|
-
async listFiles(handle, path) {
|
|
209
|
-
const result = await ctx.exec(handle, `ls -1 ${JSON.stringify(path)}`);
|
|
210
|
-
if (result.exitCode !== 0)
|
|
211
|
-
return [];
|
|
212
|
-
return result.stdout.trim().split("\n").filter(Boolean);
|
|
213
|
-
},
|
|
214
|
-
async destroy(handle) {
|
|
215
|
-
const ref = containers.get(handle.id);
|
|
216
|
-
if (!ref)
|
|
217
|
-
return;
|
|
218
|
-
try {
|
|
219
|
-
await ref.container.stop({ t: 5 });
|
|
220
|
-
await ref.container.remove({ force: true });
|
|
221
|
-
} catch {
|
|
222
|
-
}
|
|
223
|
-
containers.delete(handle.id);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
return ctx;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// src/contexts/process.ts
|
|
230
|
-
import { exec as execCb } from "child_process";
|
|
231
|
-
import { mkdir, readdir, readFile as readFile2, writeFile } from "fs/promises";
|
|
232
|
-
import { dirname, resolve } from "path";
|
|
233
|
-
import { promisify } from "util";
|
|
234
|
-
var execAsync = promisify(execCb);
|
|
235
|
-
function createProcessContext(config) {
|
|
236
|
-
let counter = 0;
|
|
237
|
-
const handles = /* @__PURE__ */ new Map();
|
|
238
|
-
const defaultCwd = config?.cwd ?? process.cwd();
|
|
239
|
-
const defaultEnv = config?.env;
|
|
240
|
-
return {
|
|
241
|
-
type: "process",
|
|
242
|
-
capabilities: {
|
|
243
|
-
shell: true,
|
|
244
|
-
filesystem: true,
|
|
245
|
-
network: true,
|
|
246
|
-
gpu: false
|
|
247
|
-
},
|
|
248
|
-
async spawn(overrides) {
|
|
249
|
-
const id = `process-${++counter}`;
|
|
250
|
-
const cwd = overrides?.cwd ?? defaultCwd;
|
|
251
|
-
await mkdir(cwd, { recursive: true });
|
|
252
|
-
const handle = { id, type: "process", cwd };
|
|
253
|
-
handles.set(id, handle);
|
|
254
|
-
return handle;
|
|
255
|
-
},
|
|
256
|
-
async exec(handle, command, options) {
|
|
257
|
-
const cwd = options?.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd;
|
|
258
|
-
try {
|
|
259
|
-
const { stdout, stderr } = await execAsync(command, {
|
|
260
|
-
cwd,
|
|
261
|
-
env: { ...process.env, ...defaultEnv, ...options?.env },
|
|
262
|
-
timeout: (options?.timeout ?? config?.limits?.timeout ?? 30) * 1e3,
|
|
263
|
-
maxBuffer: 10 * 1024 * 1024
|
|
264
|
-
});
|
|
265
|
-
return { stdout, stderr, exitCode: 0 };
|
|
266
|
-
} catch (err) {
|
|
267
|
-
return {
|
|
268
|
-
stdout: err.stdout ?? "",
|
|
269
|
-
stderr: err.stderr ?? err.message,
|
|
270
|
-
exitCode: err.code ?? 1
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
async readFile(handle, path) {
|
|
275
|
-
return readFile2(resolve(handle.cwd, path), "utf-8");
|
|
276
|
-
},
|
|
277
|
-
async writeFile(handle, path, content) {
|
|
278
|
-
const fullPath = resolve(handle.cwd, path);
|
|
279
|
-
await mkdir(dirname(fullPath), { recursive: true });
|
|
280
|
-
await writeFile(fullPath, content, "utf-8");
|
|
281
|
-
},
|
|
282
|
-
async listFiles(handle, path) {
|
|
283
|
-
return readdir(resolve(handle.cwd, path));
|
|
284
|
-
},
|
|
285
|
-
async destroy(handle) {
|
|
286
|
-
handles.delete(handle.id);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// src/contexts/sandbox.ts
|
|
292
|
-
function createSandboxContext(provider) {
|
|
293
|
-
const sandboxes = /* @__PURE__ */ new Map();
|
|
294
|
-
function getSandboxId(handle) {
|
|
295
|
-
const id = sandboxes.get(handle.id);
|
|
296
|
-
if (!id)
|
|
297
|
-
throw new Error(`Sandbox ${handle.id} not found`);
|
|
298
|
-
return id;
|
|
299
|
-
}
|
|
300
|
-
return {
|
|
301
|
-
type: "sandbox",
|
|
302
|
-
capabilities: {
|
|
303
|
-
shell: true,
|
|
304
|
-
filesystem: true,
|
|
305
|
-
network: true,
|
|
306
|
-
gpu: false
|
|
307
|
-
},
|
|
308
|
-
async spawn(config) {
|
|
309
|
-
const result = await provider.spawn(config ?? {});
|
|
310
|
-
const handle = { id: result.id, type: "sandbox", cwd: result.cwd };
|
|
311
|
-
sandboxes.set(handle.id, result.id);
|
|
312
|
-
return handle;
|
|
313
|
-
},
|
|
314
|
-
async exec(handle, command, options) {
|
|
315
|
-
return provider.exec(getSandboxId(handle), command, options);
|
|
316
|
-
},
|
|
317
|
-
async readFile(handle, path) {
|
|
318
|
-
return provider.readFile(getSandboxId(handle), path);
|
|
319
|
-
},
|
|
320
|
-
async writeFile(handle, path, content) {
|
|
321
|
-
return provider.writeFile(getSandboxId(handle), path, content);
|
|
322
|
-
},
|
|
323
|
-
async listFiles(handle, path) {
|
|
324
|
-
return provider.listFiles(getSandboxId(handle), path);
|
|
325
|
-
},
|
|
326
|
-
async destroy(handle) {
|
|
327
|
-
const id = sandboxes.get(handle.id);
|
|
328
|
-
if (!id)
|
|
329
|
-
return;
|
|
330
|
-
await provider.destroy(id);
|
|
331
|
-
sandboxes.delete(handle.id);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
|
|
336
103
|
// src/tools/validation.ts
|
|
337
104
|
function validateToolArgs(input, schema) {
|
|
338
105
|
const required = schema.required ?? [];
|
|
@@ -660,8 +427,8 @@ function createAgent({ harness: harnessOption, provider, behavior: agentBehavior
|
|
|
660
427
|
options.signal.addEventListener("abort", onExternalAbort, { once: true });
|
|
661
428
|
}
|
|
662
429
|
}
|
|
663
|
-
idlePromise = new Promise((
|
|
664
|
-
idleResolve =
|
|
430
|
+
idlePromise = new Promise((resolve) => {
|
|
431
|
+
idleResolve = resolve;
|
|
665
432
|
});
|
|
666
433
|
const childrenStats = [];
|
|
667
434
|
const unregisterSpawnHook = hooks.hook("spawn:complete", (ctx) => {
|
|
@@ -1039,7 +806,7 @@ function createSpawnTool(options = {}) {
|
|
|
1039
806
|
var spawn = createSpawnTool();
|
|
1040
807
|
|
|
1041
808
|
// src/tools/write-file.ts
|
|
1042
|
-
var
|
|
809
|
+
var writeFile = {
|
|
1043
810
|
spec: {
|
|
1044
811
|
name: "write_file",
|
|
1045
812
|
description: "Write content to a file. Creates parent directories if needed.",
|
|
@@ -1059,9 +826,6 @@ var writeFile2 = {
|
|
|
1059
826
|
};
|
|
1060
827
|
|
|
1061
828
|
export {
|
|
1062
|
-
createDockerContext,
|
|
1063
|
-
createProcessContext,
|
|
1064
|
-
createSandboxContext,
|
|
1065
829
|
validateToolArgs,
|
|
1066
830
|
createAgent,
|
|
1067
831
|
createInteractionTool,
|
|
@@ -1070,5 +834,5 @@ export {
|
|
|
1070
834
|
shell,
|
|
1071
835
|
createSpawnTool,
|
|
1072
836
|
spawn,
|
|
1073
|
-
|
|
837
|
+
writeFile
|
|
1074
838
|
};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// src/contexts/docker.ts
|
|
2
|
+
var SINGLE_QUOTE_RE = /'/g;
|
|
3
|
+
function createDockerContext(config) {
|
|
4
|
+
let counter = 0;
|
|
5
|
+
const containers = /* @__PURE__ */ new Map();
|
|
6
|
+
const defaultImage = config?.image ?? "oven/bun:latest";
|
|
7
|
+
const defaultCwd = config?.cwd ?? "/workspace";
|
|
8
|
+
const defaultEnv = config?.env;
|
|
9
|
+
const defaultLimits = config?.limits;
|
|
10
|
+
async function getDockerode() {
|
|
11
|
+
try {
|
|
12
|
+
const Dockerode = (await import("dockerode")).default;
|
|
13
|
+
return new Dockerode();
|
|
14
|
+
} catch {
|
|
15
|
+
throw new Error("dockerode is required for Docker execution context. Install it with: bun add dockerode");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const ctx = {
|
|
19
|
+
type: "docker",
|
|
20
|
+
capabilities: {
|
|
21
|
+
shell: true,
|
|
22
|
+
filesystem: true,
|
|
23
|
+
network: true,
|
|
24
|
+
gpu: false
|
|
25
|
+
},
|
|
26
|
+
async spawn(overrides) {
|
|
27
|
+
const docker = await getDockerode();
|
|
28
|
+
const id = `docker-${++counter}`;
|
|
29
|
+
const image = overrides?.image ?? defaultImage;
|
|
30
|
+
const cwd = overrides?.cwd ?? defaultCwd;
|
|
31
|
+
try {
|
|
32
|
+
await docker.getImage(image).inspect();
|
|
33
|
+
} catch {
|
|
34
|
+
await new Promise((resolve2, reject) => {
|
|
35
|
+
docker.pull(image, (err, stream) => {
|
|
36
|
+
if (err)
|
|
37
|
+
return reject(err);
|
|
38
|
+
docker.modem.followProgress(stream, (err2) => {
|
|
39
|
+
err2 ? reject(err2) : resolve2();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const limits = { ...defaultLimits, ...overrides?.limits };
|
|
45
|
+
const hostConfig = {};
|
|
46
|
+
if (limits?.memory) {
|
|
47
|
+
hostConfig.Memory = limits.memory * 1024 * 1024;
|
|
48
|
+
}
|
|
49
|
+
if (limits?.cpu) {
|
|
50
|
+
hostConfig.NanoCpus = Number.parseFloat(limits.cpu) * 1e9;
|
|
51
|
+
}
|
|
52
|
+
const env = { ...defaultEnv, ...overrides?.env };
|
|
53
|
+
const container = await docker.createContainer({
|
|
54
|
+
Image: image,
|
|
55
|
+
Cmd: ["sleep", "infinity"],
|
|
56
|
+
WorkingDir: cwd,
|
|
57
|
+
Env: Object.entries(env).map(([k, v]) => `${k}=${v}`),
|
|
58
|
+
HostConfig: hostConfig
|
|
59
|
+
});
|
|
60
|
+
await container.start();
|
|
61
|
+
const handle = { id, type: "docker", cwd };
|
|
62
|
+
containers.set(id, { handle, container, docker });
|
|
63
|
+
return handle;
|
|
64
|
+
},
|
|
65
|
+
async exec(handle, command, options) {
|
|
66
|
+
const ref = containers.get(handle.id);
|
|
67
|
+
if (!ref)
|
|
68
|
+
throw new Error(`Container ${handle.id} not found`);
|
|
69
|
+
const execCwd = options?.cwd ?? handle.cwd;
|
|
70
|
+
const env = options?.env ? Object.entries(options.env).map(([k, v]) => `${k}=${v}`) : [];
|
|
71
|
+
const exec = await ref.container.exec({
|
|
72
|
+
Cmd: ["sh", "-c", command],
|
|
73
|
+
WorkingDir: execCwd,
|
|
74
|
+
Env: env,
|
|
75
|
+
AttachStdout: true,
|
|
76
|
+
AttachStderr: true
|
|
77
|
+
});
|
|
78
|
+
const stream = await exec.start({ Detach: false });
|
|
79
|
+
return new Promise((resolve2) => {
|
|
80
|
+
let stdout = "";
|
|
81
|
+
const stderr = "";
|
|
82
|
+
const timeout = options?.timeout ?? defaultLimits?.timeout ?? 30;
|
|
83
|
+
const timer = setTimeout(() => {
|
|
84
|
+
resolve2({ stdout, stderr: `${stderr}
|
|
85
|
+
[timeout]`, exitCode: 124 });
|
|
86
|
+
}, timeout * 1e3);
|
|
87
|
+
stream.on("data", (chunk) => {
|
|
88
|
+
stdout += chunk.toString("utf-8");
|
|
89
|
+
});
|
|
90
|
+
stream.on("end", async () => {
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
const inspect = await exec.inspect();
|
|
93
|
+
resolve2({ stdout, stderr, exitCode: inspect.ExitCode ?? 0 });
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
async readFile(handle, path) {
|
|
98
|
+
const result = await ctx.exec(handle, `cat ${JSON.stringify(path)}`);
|
|
99
|
+
if (result.exitCode !== 0)
|
|
100
|
+
throw new Error(`Failed to read file: ${result.stderr}`);
|
|
101
|
+
return result.stdout;
|
|
102
|
+
},
|
|
103
|
+
async writeFile(handle, path, content) {
|
|
104
|
+
const escaped = content.replace(SINGLE_QUOTE_RE, String.raw`'\''`);
|
|
105
|
+
const result = await ctx.exec(handle, `mkdir -p "$(dirname ${JSON.stringify(path)})" && printf '%s' '${escaped}' > ${JSON.stringify(path)}`);
|
|
106
|
+
if (result.exitCode !== 0)
|
|
107
|
+
throw new Error(`Failed to write file: ${result.stderr}`);
|
|
108
|
+
},
|
|
109
|
+
async listFiles(handle, path) {
|
|
110
|
+
const result = await ctx.exec(handle, `ls -1 ${JSON.stringify(path)}`);
|
|
111
|
+
if (result.exitCode !== 0)
|
|
112
|
+
return [];
|
|
113
|
+
return result.stdout.trim().split("\n").filter(Boolean);
|
|
114
|
+
},
|
|
115
|
+
async destroy(handle) {
|
|
116
|
+
const ref = containers.get(handle.id);
|
|
117
|
+
if (!ref)
|
|
118
|
+
return;
|
|
119
|
+
try {
|
|
120
|
+
await ref.container.stop({ t: 5 });
|
|
121
|
+
await ref.container.remove({ force: true });
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
containers.delete(handle.id);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
return ctx;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// src/contexts/process.ts
|
|
131
|
+
import { exec as execCb } from "child_process";
|
|
132
|
+
import { mkdir, readdir, readFile, writeFile } from "fs/promises";
|
|
133
|
+
import { dirname, resolve } from "path";
|
|
134
|
+
import { promisify } from "util";
|
|
135
|
+
var execAsync = promisify(execCb);
|
|
136
|
+
function createProcessContext(config) {
|
|
137
|
+
let counter = 0;
|
|
138
|
+
const handles = /* @__PURE__ */ new Map();
|
|
139
|
+
const defaultCwd = config?.cwd ?? process.cwd();
|
|
140
|
+
const defaultEnv = config?.env;
|
|
141
|
+
return {
|
|
142
|
+
type: "process",
|
|
143
|
+
capabilities: {
|
|
144
|
+
shell: true,
|
|
145
|
+
filesystem: true,
|
|
146
|
+
network: true,
|
|
147
|
+
gpu: false
|
|
148
|
+
},
|
|
149
|
+
async spawn(overrides) {
|
|
150
|
+
const id = `process-${++counter}`;
|
|
151
|
+
const cwd = overrides?.cwd ?? defaultCwd;
|
|
152
|
+
await mkdir(cwd, { recursive: true });
|
|
153
|
+
const handle = { id, type: "process", cwd };
|
|
154
|
+
handles.set(id, handle);
|
|
155
|
+
return handle;
|
|
156
|
+
},
|
|
157
|
+
async exec(handle, command, options) {
|
|
158
|
+
const cwd = options?.cwd ? resolve(handle.cwd, options.cwd) : handle.cwd;
|
|
159
|
+
try {
|
|
160
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
161
|
+
cwd,
|
|
162
|
+
env: { ...process.env, ...defaultEnv, ...options?.env },
|
|
163
|
+
timeout: (options?.timeout ?? config?.limits?.timeout ?? 30) * 1e3,
|
|
164
|
+
maxBuffer: 10 * 1024 * 1024
|
|
165
|
+
});
|
|
166
|
+
return { stdout, stderr, exitCode: 0 };
|
|
167
|
+
} catch (err) {
|
|
168
|
+
return {
|
|
169
|
+
stdout: err.stdout ?? "",
|
|
170
|
+
stderr: err.stderr ?? err.message,
|
|
171
|
+
exitCode: err.code ?? 1
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
async readFile(handle, path) {
|
|
176
|
+
return readFile(resolve(handle.cwd, path), "utf-8");
|
|
177
|
+
},
|
|
178
|
+
async writeFile(handle, path, content) {
|
|
179
|
+
const fullPath = resolve(handle.cwd, path);
|
|
180
|
+
await mkdir(dirname(fullPath), { recursive: true });
|
|
181
|
+
await writeFile(fullPath, content, "utf-8");
|
|
182
|
+
},
|
|
183
|
+
async listFiles(handle, path) {
|
|
184
|
+
return readdir(resolve(handle.cwd, path));
|
|
185
|
+
},
|
|
186
|
+
async destroy(handle) {
|
|
187
|
+
handles.delete(handle.id);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/contexts/sandbox.ts
|
|
193
|
+
function createSandboxContext(provider) {
|
|
194
|
+
const sandboxes = /* @__PURE__ */ new Map();
|
|
195
|
+
function getSandboxId(handle) {
|
|
196
|
+
const id = sandboxes.get(handle.id);
|
|
197
|
+
if (!id)
|
|
198
|
+
throw new Error(`Sandbox ${handle.id} not found`);
|
|
199
|
+
return id;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
type: "sandbox",
|
|
203
|
+
capabilities: {
|
|
204
|
+
shell: true,
|
|
205
|
+
filesystem: true,
|
|
206
|
+
network: true,
|
|
207
|
+
gpu: false
|
|
208
|
+
},
|
|
209
|
+
async spawn(config) {
|
|
210
|
+
const result = await provider.spawn(config ?? {});
|
|
211
|
+
const handle = { id: result.id, type: "sandbox", cwd: result.cwd };
|
|
212
|
+
sandboxes.set(handle.id, result.id);
|
|
213
|
+
return handle;
|
|
214
|
+
},
|
|
215
|
+
async exec(handle, command, options) {
|
|
216
|
+
return provider.exec(getSandboxId(handle), command, options);
|
|
217
|
+
},
|
|
218
|
+
async readFile(handle, path) {
|
|
219
|
+
return provider.readFile(getSandboxId(handle), path);
|
|
220
|
+
},
|
|
221
|
+
async writeFile(handle, path, content) {
|
|
222
|
+
return provider.writeFile(getSandboxId(handle), path, content);
|
|
223
|
+
},
|
|
224
|
+
async listFiles(handle, path) {
|
|
225
|
+
return provider.listFiles(getSandboxId(handle), path);
|
|
226
|
+
},
|
|
227
|
+
async destroy(handle) {
|
|
228
|
+
const id = sandboxes.get(handle.id);
|
|
229
|
+
if (!id)
|
|
230
|
+
return;
|
|
231
|
+
await provider.destroy(id);
|
|
232
|
+
sandboxes.delete(handle.id);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
createDockerContext,
|
|
239
|
+
createProcessContext,
|
|
240
|
+
createSandboxContext
|
|
241
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { S as SpawnConfig, b as ExecutionContext } from './types-BpvTmawk.js';
|
|
2
|
+
export { C as ContextCapabilities, a as ContextType, E as ExecResult, c as ExecutionHandle } from './types-BpvTmawk.js';
|
|
3
|
+
export { S as SandboxProvider, c as createSandboxContext } from './sandbox-CW72eLDP.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Docker execution context.
|
|
7
|
+
*
|
|
8
|
+
* Runs tools inside a Docker container via dockerode.
|
|
9
|
+
* Full isolation with configurable resource limits.
|
|
10
|
+
*
|
|
11
|
+
* Requires `dockerode` as an optional peer dependency.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* In-process execution context.
|
|
18
|
+
*
|
|
19
|
+
* Runs everything in the current Node/Bun process.
|
|
20
|
+
* No isolation — fastest, used as the default.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare function createProcessContext(config?: SpawnConfig): ExecutionContext;
|
|
24
|
+
|
|
25
|
+
export { ExecutionContext, SpawnConfig, createDockerContext, createProcessContext };
|
package/dist/contexts.js
ADDED
package/dist/harnesses.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'hookable';
|
|
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-
|
|
3
|
-
import './types-
|
|
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-CUKZMA-_.js';
|
|
3
|
+
import './types-BpvTmawk.js';
|
|
4
|
+
import './types-CDI8Kmve.js';
|
|
4
5
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/harnesses.js
CHANGED
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
basic_default,
|
|
4
4
|
defineHarness,
|
|
5
5
|
noTools
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-5LOHDFK3.js";
|
|
6
|
+
} from "./chunk-7SMBCRUX.js";
|
|
7
|
+
import "./chunk-474ILKQA.js";
|
|
9
8
|
import "./chunk-4C6Y56CC.js";
|
|
9
|
+
import "./chunk-SZA4FKW5.js";
|
|
10
|
+
import "./chunk-5LOHDFK3.js";
|
|
10
11
|
export {
|
|
11
12
|
basic_default as basic,
|
|
12
13
|
basicTools,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
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-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
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-CUKZMA-_.js';
|
|
2
|
+
export { createDockerContext, createProcessContext } from './contexts.js';
|
|
3
|
+
export { S as SandboxProvider, c as createSandboxContext } from './sandbox-CW72eLDP.js';
|
|
4
|
+
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-BpvTmawk.js';
|
|
5
5
|
export { buildCatalog, defineSkill, discoverSkills, interpolateShellCommands, mergeSkillsConfig, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
|
|
6
|
-
export {
|
|
6
|
+
export { S as SkillConfig, a as SkillResource, b as SkillsConfig } from './types-CDI8Kmve.js';
|
|
7
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-B7AtyfuG.js';
|
|
7
8
|
import 'hookable';
|
|
8
9
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* Docker execution context.
|
|
12
|
-
*
|
|
13
|
-
* Runs tools inside a Docker container via dockerode.
|
|
14
|
-
* Full isolation with configurable resource limits.
|
|
15
|
-
*
|
|
16
|
-
* Requires `dockerode` as an optional peer dependency.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
declare function createDockerContext(config?: SpawnConfig): ExecutionContext;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* In-process execution context.
|
|
23
|
-
*
|
|
24
|
-
* Runs everything in the current Node/Bun process.
|
|
25
|
-
* No isolation — fastest, used as the default.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
declare function createProcessContext(config?: SpawnConfig): ExecutionContext;
|
|
29
|
-
|
|
30
11
|
/**
|
|
31
12
|
* Zod v4 integration helper.
|
|
32
13
|
*
|
|
@@ -46,4 +27,4 @@ declare function createProcessContext(config?: SpawnConfig): ExecutionContext;
|
|
|
46
27
|
*/
|
|
47
28
|
declare function zodToJsonSchema(jsonSchema: Record<string, unknown>): Record<string, unknown>;
|
|
48
29
|
|
|
49
|
-
export {
|
|
30
|
+
export { zodToJsonSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineSkill
|
|
3
|
+
} from "./chunk-CFLC2I7D.js";
|
|
1
4
|
import {
|
|
2
5
|
defineHarness,
|
|
3
6
|
noTools
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7SMBCRUX.js";
|
|
5
8
|
import {
|
|
6
9
|
createAgent,
|
|
7
|
-
createDockerContext,
|
|
8
10
|
createInteractionTool,
|
|
9
|
-
createProcessContext,
|
|
10
|
-
createSandboxContext,
|
|
11
11
|
createSpawnTool,
|
|
12
12
|
spawn
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-474ILKQA.js";
|
|
14
|
+
import {
|
|
15
|
+
buildCatalog,
|
|
16
|
+
discoverSkills,
|
|
17
|
+
interpolateShellCommands,
|
|
18
|
+
mergeSkillsConfig,
|
|
19
|
+
parseSkillFile,
|
|
20
|
+
resolveSkills,
|
|
21
|
+
validateSkillName,
|
|
22
|
+
writeSkillToDisk,
|
|
23
|
+
writeSkillsToDisk
|
|
24
|
+
} from "./chunk-4C6Y56CC.js";
|
|
25
|
+
import {
|
|
26
|
+
createDockerContext,
|
|
27
|
+
createProcessContext,
|
|
28
|
+
createSandboxContext
|
|
29
|
+
} from "./chunk-SZA4FKW5.js";
|
|
14
30
|
import {
|
|
15
31
|
connectMcpServers
|
|
16
32
|
} from "./chunk-5LOHDFK3.js";
|
|
@@ -28,20 +44,6 @@ import {
|
|
|
28
44
|
toAnthropic,
|
|
29
45
|
toOpenAI
|
|
30
46
|
} from "./chunk-QCJKUQTQ.js";
|
|
31
|
-
import {
|
|
32
|
-
defineSkill
|
|
33
|
-
} from "./chunk-CFLC2I7D.js";
|
|
34
|
-
import {
|
|
35
|
-
buildCatalog,
|
|
36
|
-
discoverSkills,
|
|
37
|
-
interpolateShellCommands,
|
|
38
|
-
mergeSkillsConfig,
|
|
39
|
-
parseSkillFile,
|
|
40
|
-
resolveSkills,
|
|
41
|
-
validateSkillName,
|
|
42
|
-
writeSkillToDisk,
|
|
43
|
-
writeSkillsToDisk
|
|
44
|
-
} from "./chunk-4C6Y56CC.js";
|
|
45
47
|
|
|
46
48
|
// src/zod.ts
|
|
47
49
|
function zodToJsonSchema(jsonSchema) {
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'hookable';
|
|
2
|
-
export { M as McpConnection, j as McpServerConfig, Q as connectMcpServers, a9 as resultToString } from './agent-
|
|
2
|
+
export { M as McpConnection, j as McpServerConfig, Q as connectMcpServers, a9 as resultToString } from './agent-CUKZMA-_.js';
|
|
3
3
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-BpvTmawk.js';
|
|
5
|
+
import './types-CDI8Kmve.js';
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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-
|
|
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-CUKZMA-_.js';
|
|
2
2
|
import 'hookable';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-BpvTmawk.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
import './types-CDI8Kmve.js';
|
package/dist/providers.js
CHANGED
|
@@ -235,10 +235,7 @@ function openrouter(params) {
|
|
|
235
235
|
assistantMessage,
|
|
236
236
|
toolResultsMessage,
|
|
237
237
|
async stream(options, callbacks) {
|
|
238
|
-
|
|
239
|
-
const thinking = options.thinking ?? "off";
|
|
240
|
-
if (thinking !== "off" && !modelId.includes(":thinking"))
|
|
241
|
-
modelId = `${modelId}:thinking`;
|
|
238
|
+
const modelId = options.model || defaultModel;
|
|
242
239
|
const messages = toOAIMessages(options.system, options.messages);
|
|
243
240
|
const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
|
|
244
241
|
const body = {
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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-
|
|
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-CUKZMA-_.js';
|
|
2
2
|
import 'hookable';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-BpvTmawk.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
import './types-CDI8Kmve.js';
|
package/dist/skills.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { S as SkillConfig, b as
|
|
2
|
-
export {
|
|
1
|
+
import { S as SkillConfig, b as SkillsConfig } from './types-CDI8Kmve.js';
|
|
2
|
+
export { a as SkillResource } from './types-CDI8Kmve.js';
|
|
3
|
+
import { b as ExecutionContext, c as ExecutionHandle } from './types-BpvTmawk.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Skill catalog generation.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as ToolDef, i as HarnessConfig, e as AgentStats } from './agent-
|
|
1
|
+
import { B as ToolDef, i as HarnessConfig, e as AgentStats } from './agent-CUKZMA-_.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,9 +1,10 @@
|
|
|
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-
|
|
2
|
-
import { B as ToolDef } from './agent-
|
|
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-B7AtyfuG.js';
|
|
2
|
+
import { B as ToolDef } from './agent-CUKZMA-_.js';
|
|
3
3
|
export { V as ValidationResult, v as validateToolArgs } from './validation-DOY_k7lW.js';
|
|
4
4
|
import 'hookable';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-BpvTmawk.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
7
|
+
import './types-CDI8Kmve.js';
|
|
7
8
|
|
|
8
9
|
declare const listFiles: ToolDef;
|
|
9
10
|
|
package/dist/tools.js
CHANGED
|
@@ -7,9 +7,10 @@ import {
|
|
|
7
7
|
spawn,
|
|
8
8
|
validateToolArgs,
|
|
9
9
|
writeFile
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-5LOHDFK3.js";
|
|
10
|
+
} from "./chunk-474ILKQA.js";
|
|
12
11
|
import "./chunk-4C6Y56CC.js";
|
|
12
|
+
import "./chunk-SZA4FKW5.js";
|
|
13
|
+
import "./chunk-5LOHDFK3.js";
|
|
13
14
|
export {
|
|
14
15
|
createInteractionTool,
|
|
15
16
|
createSpawnTool,
|
|
@@ -75,67 +75,4 @@ interface ExecutionContext {
|
|
|
75
75
|
destroy: (handle: ExecutionHandle) => Promise<void>;
|
|
76
76
|
}
|
|
77
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
|
-
* Parsed and stored per the Agent Skills spec, but not yet
|
|
117
|
-
* enforced at runtime — all skills are included in the catalog.
|
|
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, ExecResult as E, SkillConfig as S, ContextType as a, ExecutionContext as b, ExecutionHandle as c, SkillResource as d, SkillsConfig as e, SpawnConfig as f };
|
|
78
|
+
export type { ContextCapabilities as C, ExecResult as E, SpawnConfig as S, ContextType as a, ExecutionContext as b, ExecutionHandle as c };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Agent Skills system.
|
|
3
|
+
*
|
|
4
|
+
* Follows the Agent Skills open standard (agentskills.io/specification).
|
|
5
|
+
*/
|
|
6
|
+
interface SkillResource {
|
|
7
|
+
/** Relative path from skill directory */
|
|
8
|
+
path: string;
|
|
9
|
+
/** Resource type inferred from directory */
|
|
10
|
+
type: 'script' | 'reference' | 'asset' | 'other';
|
|
11
|
+
}
|
|
12
|
+
interface SkillConfig {
|
|
13
|
+
/** Skill name: 1-64 chars, lowercase alphanumeric + hyphens */
|
|
14
|
+
name: string;
|
|
15
|
+
/** What the skill does and when to use it (1-1024 chars) */
|
|
16
|
+
description: string;
|
|
17
|
+
/** The SKILL.md body content (after YAML frontmatter) */
|
|
18
|
+
instructions: string;
|
|
19
|
+
/** Absolute path to SKILL.md (undefined for inline skills) */
|
|
20
|
+
location?: string;
|
|
21
|
+
/** Skill directory path for resolving relative references */
|
|
22
|
+
baseDir?: string;
|
|
23
|
+
/** License identifier or reference */
|
|
24
|
+
license?: string;
|
|
25
|
+
/** Environment requirements */
|
|
26
|
+
compatibility?: string;
|
|
27
|
+
/** Arbitrary key-value metadata */
|
|
28
|
+
metadata?: Record<string, string>;
|
|
29
|
+
/** Pre-approved tool names (experimental) */
|
|
30
|
+
allowedTools?: string[];
|
|
31
|
+
/** Bundled resource files discovered in the skill directory */
|
|
32
|
+
resources?: SkillResource[];
|
|
33
|
+
/** Model override when this skill is active */
|
|
34
|
+
model?: string;
|
|
35
|
+
/** Thinking/reasoning level override when this skill is active */
|
|
36
|
+
thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high';
|
|
37
|
+
/**
|
|
38
|
+
* Glob patterns that limit when this skill auto-activates.
|
|
39
|
+
* Parsed and stored per the Agent Skills spec, but not yet
|
|
40
|
+
* enforced at runtime — all skills are included in the catalog.
|
|
41
|
+
*/
|
|
42
|
+
paths?: string[];
|
|
43
|
+
}
|
|
44
|
+
interface SkillsConfig {
|
|
45
|
+
/**
|
|
46
|
+
* Control which skills are active.
|
|
47
|
+
* - `true` (default): all discovered skills are enabled
|
|
48
|
+
* - `false` or `[]`: fully disable the skills system (no resolution, no catalog, no hooks)
|
|
49
|
+
* - `string[]`: allowlist — only skills with matching names are enabled
|
|
50
|
+
*/
|
|
51
|
+
enabled?: boolean | string[];
|
|
52
|
+
/** Directories to scan for SKILL.md files */
|
|
53
|
+
scan?: string[];
|
|
54
|
+
/** Dynamic skills written to disk at agent start, then loaded normally */
|
|
55
|
+
write?: SkillConfig[];
|
|
56
|
+
/** Tool name the agent should use to read skill files (default: 'read_file') */
|
|
57
|
+
readToolName?: string;
|
|
58
|
+
/** Skill names to exclude from the catalog */
|
|
59
|
+
exclude?: string[];
|
|
60
|
+
/** Skip default scan paths (~/.agents/skills, .zidane/skills, etc.) */
|
|
61
|
+
skipDefaultPaths?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type { SkillConfig as S, SkillResource as a, SkillsConfig as b };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-
|
|
2
|
-
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as
|
|
3
|
-
export { S as SandboxProvider } from './sandbox-
|
|
4
|
-
export {
|
|
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-CUKZMA-_.js';
|
|
2
|
+
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-BpvTmawk.js';
|
|
3
|
+
export { S as SandboxProvider } from './sandbox-CW72eLDP.js';
|
|
4
|
+
export { S as SkillConfig, a as SkillResource, b as SkillsConfig } from './types-CDI8Kmve.js';
|
|
5
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-B7AtyfuG.js';
|
|
5
6
|
export { V as ValidationResult } from './validation-DOY_k7lW.js';
|
|
6
7
|
import 'hookable';
|
|
7
8
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zidane",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "an agent that goes straight to the goal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"import": "./dist/harnesses.js",
|
|
35
35
|
"types": "./dist/harnesses.d.ts"
|
|
36
36
|
},
|
|
37
|
+
"./contexts": {
|
|
38
|
+
"import": "./dist/contexts.js",
|
|
39
|
+
"types": "./dist/contexts.d.ts"
|
|
40
|
+
},
|
|
37
41
|
"./mcp": {
|
|
38
42
|
"import": "./dist/mcp.js",
|
|
39
43
|
"types": "./dist/mcp.d.ts"
|