zidane 3.1.2 → 3.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.
- package/dist/{agent-C9q5VMGa.d.ts → agent-CE2jhpNE.d.ts} +15 -2
- package/dist/{chunk-2AE3VM5O.js → chunk-6JIVVEQQ.js} +83 -67
- package/dist/{chunk-BRMURQA2.js → chunk-AUBXCLUC.js} +1 -1
- package/dist/{chunk-BXO7CZHJ.js → chunk-HPTCF3EX.js} +1 -1
- package/dist/{chunk-TPXPVEH6.js → chunk-J4ZOSNSH.js} +16 -3
- package/dist/{chunk-YQ7LY6CL.js → chunk-QX7TDFD4.js} +24 -13
- package/dist/{chunk-IUBBVF53.js → chunk-UD25QF3H.js} +66 -8
- package/dist/{chunk-BW3WTFIR.js → chunk-YPU6KVL6.js} +1 -1
- package/dist/contexts.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/mcp.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/presets.js +4 -4
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +2 -2
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.js +6 -7
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/{skills-use-DU0unNP4.d.ts → skills-use-CqOKEN56.d.ts} +1 -1
- package/dist/skills.d.ts +12 -2
- package/dist/skills.js +2 -2
- package/dist/tools.d.ts +4 -4
- package/dist/tools.js +3 -3
- package/dist/types.d.ts +2 -2
- package/dist/{validation-BKA33eqb.d.ts → validation-DlIURVGV.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -2092,7 +2092,14 @@ interface AgentOptions {
|
|
|
2092
2092
|
session?: Session;
|
|
2093
2093
|
/** Skills configuration */
|
|
2094
2094
|
skills?: SkillsConfig;
|
|
2095
|
-
/**
|
|
2095
|
+
/**
|
|
2096
|
+
* Test seam — replaces the default MCP connector with a custom
|
|
2097
|
+
* implementation. Bypasses the `mcpServers` normalization layer entirely
|
|
2098
|
+
* and is **not** part of the supported public API. Subject to change or
|
|
2099
|
+
* removal in any release.
|
|
2100
|
+
*
|
|
2101
|
+
* @internal
|
|
2102
|
+
*/
|
|
2096
2103
|
mcpConnector?: (configs: McpServerConfig[]) => Promise<McpConnection>;
|
|
2097
2104
|
/**
|
|
2098
2105
|
* Pre-connect MCP servers in the background as soon as `createAgent` returns,
|
|
@@ -2156,7 +2163,13 @@ interface Agent {
|
|
|
2156
2163
|
readonly session: Session | null;
|
|
2157
2164
|
/** Snapshot of currently active skills. */
|
|
2158
2165
|
readonly activeSkills: readonly ActiveSkill[];
|
|
2159
|
-
|
|
2166
|
+
/**
|
|
2167
|
+
* Frozen view of the underlying `provider.meta`. Read-only to prevent
|
|
2168
|
+
* accidental cross-agent contamination — writes are rejected at runtime
|
|
2169
|
+
* (via `Object.freeze`) and at compile time (via `Readonly`). To override
|
|
2170
|
+
* model / capability defaults, construct a new provider.
|
|
2171
|
+
*/
|
|
2172
|
+
readonly meta: Readonly<Record<string, unknown>>;
|
|
2160
2173
|
}
|
|
2161
2174
|
declare function createAgent({ provider, name: agentName, system: agentSystem, tools: agentTools, toolAliases, behavior: agentBehavior, execution, mcpServers, session, skills: agentSkills, mcpConnector, eager }: AgentOptions): Agent;
|
|
2162
2175
|
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
createSkillActivationState,
|
|
4
4
|
installAllowedToolsGate,
|
|
5
5
|
interpolateShellCommands,
|
|
6
|
-
|
|
6
|
+
resolveSkillsWithCleanup,
|
|
7
7
|
validateResourcePath
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-J4ZOSNSH.js";
|
|
9
9
|
import {
|
|
10
10
|
createProcessContext
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UD25QF3H.js";
|
|
12
12
|
import {
|
|
13
13
|
connectMcpServers
|
|
14
14
|
} from "./chunk-7H34OFDA.js";
|
|
@@ -367,6 +367,18 @@ var glob = {
|
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
369
|
|
|
370
|
+
// src/tools/shell-quote.ts
|
|
371
|
+
var SAFE_TOKEN_RE = /^[\w@%+=:,./-]+$/;
|
|
372
|
+
var SINGLE_QUOTE_RE = /'/g;
|
|
373
|
+
function shellQuote(arg) {
|
|
374
|
+
if (SAFE_TOKEN_RE.test(arg))
|
|
375
|
+
return arg;
|
|
376
|
+
return `'${arg.replace(SINGLE_QUOTE_RE, "'\\''")}'`;
|
|
377
|
+
}
|
|
378
|
+
function alwaysQuote(arg) {
|
|
379
|
+
return `'${arg.replace(SINGLE_QUOTE_RE, "'\\''")}'`;
|
|
380
|
+
}
|
|
381
|
+
|
|
370
382
|
// src/tools/grep.ts
|
|
371
383
|
var DEFAULT_HEAD_LIMIT = 250;
|
|
372
384
|
var DEFAULT_OUTPUT_MODE = "files_with_matches";
|
|
@@ -442,11 +454,6 @@ async function runViaRipgrep(input, ctx) {
|
|
|
442
454
|
}
|
|
443
455
|
return formatPaginated(result.stdout, input);
|
|
444
456
|
}
|
|
445
|
-
function shellQuote(arg) {
|
|
446
|
-
if (/^[\w@%+=:,./-]+$/.test(arg))
|
|
447
|
-
return arg;
|
|
448
|
-
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
449
|
-
}
|
|
450
457
|
async function runInProcess(input, ctx) {
|
|
451
458
|
const mode = input.output_mode ?? DEFAULT_OUTPUT_MODE;
|
|
452
459
|
const flags = `${input["-i"] ? "i" : ""}${input.multiline ? "s" : ""}${mode !== "content" ? "" : "g"}`;
|
|
@@ -695,6 +702,33 @@ var multiEdit = {
|
|
|
695
702
|
// src/tools/read-file.ts
|
|
696
703
|
import { Buffer as Buffer2 } from "buffer";
|
|
697
704
|
|
|
705
|
+
// src/tools/binary-detect.ts
|
|
706
|
+
var SNIFF_BYTES = 8192;
|
|
707
|
+
var REPLACEMENT_RATIO_THRESHOLD = 0.01;
|
|
708
|
+
var REPLACEMENT_MIN_COUNT = 5;
|
|
709
|
+
function containsNullByte(text, sniffBytes = SNIFF_BYTES) {
|
|
710
|
+
const sample = text.length > sniffBytes ? text.slice(0, sniffBytes) : text;
|
|
711
|
+
for (let i = 0; i < sample.length; i++) {
|
|
712
|
+
if (sample.charCodeAt(i) === 0)
|
|
713
|
+
return true;
|
|
714
|
+
}
|
|
715
|
+
return false;
|
|
716
|
+
}
|
|
717
|
+
function looksBinary(text, sniffBytes = SNIFF_BYTES) {
|
|
718
|
+
const sample = text.length > sniffBytes ? text.slice(0, sniffBytes) : text;
|
|
719
|
+
if (sample.length === 0)
|
|
720
|
+
return false;
|
|
721
|
+
let replacementCount = 0;
|
|
722
|
+
for (let i = 0; i < sample.length; i++) {
|
|
723
|
+
const code = sample.charCodeAt(i);
|
|
724
|
+
if (code === 0)
|
|
725
|
+
return true;
|
|
726
|
+
if (code === 65533)
|
|
727
|
+
replacementCount++;
|
|
728
|
+
}
|
|
729
|
+
return replacementCount >= REPLACEMENT_MIN_COUNT && replacementCount / sample.length > REPLACEMENT_RATIO_THRESHOLD;
|
|
730
|
+
}
|
|
731
|
+
|
|
698
732
|
// src/tools/binary-read.ts
|
|
699
733
|
import { Buffer } from "buffer";
|
|
700
734
|
function imageMediaTypeFor(path) {
|
|
@@ -722,21 +756,27 @@ async function readFileAsBase64(execution, handle, path) {
|
|
|
722
756
|
const b642 = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64");
|
|
723
757
|
return { base64: b642, byteLength: bytes.byteLength };
|
|
724
758
|
}
|
|
725
|
-
const cmd = `base64 < ${
|
|
759
|
+
const cmd = `base64 < ${alwaysQuote(path)}`;
|
|
726
760
|
const result = await execution.exec(handle, cmd);
|
|
727
761
|
if (result.exitCode !== 0)
|
|
728
762
|
throw new Error(`base64 read failed: ${result.stderr || `exit ${result.exitCode}`}`);
|
|
729
763
|
const b64 = result.stdout.replace(/\s+/g, "");
|
|
730
|
-
return { base64: b64, byteLength:
|
|
764
|
+
return { base64: b64, byteLength: decodedBase64ByteLength(b64) };
|
|
731
765
|
}
|
|
732
|
-
function
|
|
733
|
-
|
|
766
|
+
function decodedBase64ByteLength(b64) {
|
|
767
|
+
if (b64.length === 0)
|
|
768
|
+
return 0;
|
|
769
|
+
let pad = 0;
|
|
770
|
+
if (b64.endsWith("=="))
|
|
771
|
+
pad = 2;
|
|
772
|
+
else if (b64.endsWith("="))
|
|
773
|
+
pad = 1;
|
|
774
|
+
return Math.max(0, b64.length * 3 / 4 - pad);
|
|
734
775
|
}
|
|
735
776
|
|
|
736
777
|
// src/tools/read-file.ts
|
|
737
778
|
var DEFAULT_LINE_LIMIT = 2e3;
|
|
738
779
|
var DEFAULT_BYTE_CAP = 65536;
|
|
739
|
-
var BINARY_PROBE_BYTES = 8e3;
|
|
740
780
|
var DEFAULT_IMAGE_BYTE_CAP = 5 * 1024 * 1024;
|
|
741
781
|
var readFile = {
|
|
742
782
|
spec: {
|
|
@@ -879,21 +919,6 @@ function normalizeInteger(value, fallback) {
|
|
|
879
919
|
return fallback;
|
|
880
920
|
return Math.floor(value);
|
|
881
921
|
}
|
|
882
|
-
var REPLACEMENT_RATIO_THRESHOLD = 0.01;
|
|
883
|
-
var REPLACEMENT_MIN_COUNT = 5;
|
|
884
|
-
function looksBinary(text) {
|
|
885
|
-
const sample = text.length > BINARY_PROBE_BYTES ? text.slice(0, BINARY_PROBE_BYTES) : text;
|
|
886
|
-
if (sample.includes("\0"))
|
|
887
|
-
return true;
|
|
888
|
-
if (sample.length === 0)
|
|
889
|
-
return false;
|
|
890
|
-
let replacementCount = 0;
|
|
891
|
-
for (let i = 0; i < sample.length; i++) {
|
|
892
|
-
if (sample.charCodeAt(i) === 65533)
|
|
893
|
-
replacementCount++;
|
|
894
|
-
}
|
|
895
|
-
return replacementCount >= REPLACEMENT_MIN_COUNT && replacementCount / sample.length > REPLACEMENT_RATIO_THRESHOLD;
|
|
896
|
-
}
|
|
897
922
|
|
|
898
923
|
// src/tools/shell.ts
|
|
899
924
|
import { Buffer as Buffer3 } from "buffer";
|
|
@@ -996,15 +1021,6 @@ ${tail}`;
|
|
|
996
1021
|
}
|
|
997
1022
|
|
|
998
1023
|
// src/tools/skills-read.ts
|
|
999
|
-
var SNIFF_BYTES = 8192;
|
|
1000
|
-
function looksBinary2(text) {
|
|
1001
|
-
const len = Math.min(text.length, SNIFF_BYTES);
|
|
1002
|
-
for (let i = 0; i < len; i++) {
|
|
1003
|
-
if (text.charCodeAt(i) === 0)
|
|
1004
|
-
return true;
|
|
1005
|
-
}
|
|
1006
|
-
return false;
|
|
1007
|
-
}
|
|
1008
1024
|
function createSkillsReadTool(options) {
|
|
1009
1025
|
const byName = new Map(options.catalog.map((s) => [s.name, s]));
|
|
1010
1026
|
return {
|
|
@@ -1049,7 +1065,7 @@ function createSkillsReadTool(options) {
|
|
|
1049
1065
|
const message = err instanceof Error ? err.message : String(err);
|
|
1050
1066
|
return `Error reading "${relPath}" in skill "${skillName}": ${message}`;
|
|
1051
1067
|
}
|
|
1052
|
-
if (
|
|
1068
|
+
if (containsNullByte(content)) {
|
|
1053
1069
|
return JSON.stringify({
|
|
1054
1070
|
kind: "binary-unsupported",
|
|
1055
1071
|
path: validated.absolutePath,
|
|
@@ -1062,12 +1078,8 @@ function createSkillsReadTool(options) {
|
|
|
1062
1078
|
}
|
|
1063
1079
|
|
|
1064
1080
|
// src/tools/skills-run-script.ts
|
|
1065
|
-
var SINGLE_QUOTE_RE = /'/g;
|
|
1066
1081
|
var ABS_WINDOWS_RE = /^[a-z]:[\\/]/i;
|
|
1067
1082
|
var COLLAPSE_SLASHES_RE = /\/+/g;
|
|
1068
|
-
function quoteShellArg(arg) {
|
|
1069
|
-
return `'${arg.replace(SINGLE_QUOTE_RE, `'\\''`)}'`;
|
|
1070
|
-
}
|
|
1071
1083
|
function createSkillsRunScriptTool(options) {
|
|
1072
1084
|
const byName = new Map(options.catalog.map((s) => [s.name, s]));
|
|
1073
1085
|
const timeoutMs = options.scriptTimeoutMs ?? 6e4;
|
|
@@ -1114,7 +1126,7 @@ function createSkillsRunScriptTool(options) {
|
|
|
1114
1126
|
const validated = validateResourcePath(joinedPath, skill.baseDir);
|
|
1115
1127
|
if (!validated.valid)
|
|
1116
1128
|
return `Error: ${validated.error}`;
|
|
1117
|
-
const cmd = [validated.absolutePath, ...args].map(
|
|
1129
|
+
const cmd = [validated.absolutePath, ...args].map(alwaysQuote).join(" ");
|
|
1118
1130
|
try {
|
|
1119
1131
|
const result = await ctx.execution.exec(ctx.handle, cmd, {
|
|
1120
1132
|
timeout: Math.max(1, Math.round(timeoutMs / 1e3))
|
|
@@ -1718,11 +1730,12 @@ async function executeTurn(ctx, turn) {
|
|
|
1718
1730
|
);
|
|
1719
1731
|
} catch (err) {
|
|
1720
1732
|
const errorUsage = { input: 0, output: 0 };
|
|
1733
|
+
const errorContent = currentText ? [{ type: "text", text: currentText }] : [{ type: "text", text: "[provider error before any output]" }];
|
|
1721
1734
|
const errorTurn = {
|
|
1722
1735
|
id: turnId,
|
|
1723
1736
|
runId: ctx.runId,
|
|
1724
1737
|
role: "assistant",
|
|
1725
|
-
content:
|
|
1738
|
+
content: errorContent,
|
|
1726
1739
|
usage: errorUsage,
|
|
1727
1740
|
createdAt: Date.now()
|
|
1728
1741
|
};
|
|
@@ -2055,28 +2068,10 @@ async function executeToolsSequential(ctx, toolCalls, turnId) {
|
|
|
2055
2068
|
if (ctx.signal.aborted)
|
|
2056
2069
|
break;
|
|
2057
2070
|
if (ctx.steeringQueue.length > 0) {
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
}
|
|
2063
|
-
const toolResultMsg = ctx.provider.toolResultsMessage(results);
|
|
2064
|
-
ctx.turns.push({
|
|
2065
|
-
id: await ctx.generateTurnId(),
|
|
2066
|
-
runId: ctx.runId,
|
|
2067
|
-
role: toolResultMsg.role,
|
|
2068
|
-
content: toolResultMsg.content,
|
|
2069
|
-
createdAt: Date.now()
|
|
2070
|
-
});
|
|
2071
|
-
const steerUserMsg = ctx.provider.userMessage(steerMsg);
|
|
2072
|
-
ctx.turns.push({
|
|
2073
|
-
id: await ctx.generateTurnId(),
|
|
2074
|
-
runId: ctx.runId,
|
|
2075
|
-
role: steerUserMsg.role,
|
|
2076
|
-
content: steerUserMsg.content,
|
|
2077
|
-
createdAt: Date.now()
|
|
2078
|
-
});
|
|
2079
|
-
return [];
|
|
2071
|
+
const fromIdx = toolCalls.indexOf(call);
|
|
2072
|
+
for (let i = fromIdx; i < toolCalls.length; i++)
|
|
2073
|
+
results.push({ id: toolCalls[i].id, content: "Skipped: steering message received" });
|
|
2074
|
+
return results;
|
|
2080
2075
|
}
|
|
2081
2076
|
const { result } = await executeSingleTool(ctx, call, turnId);
|
|
2082
2077
|
results.push(result);
|
|
@@ -2120,6 +2115,15 @@ function canonicalizePrompt(prompt, legacyImages) {
|
|
|
2120
2115
|
}
|
|
2121
2116
|
if (prompt.length === 0)
|
|
2122
2117
|
return void 0;
|
|
2118
|
+
for (const part of prompt) {
|
|
2119
|
+
if (!part || typeof part !== "object" || typeof part.type !== "string") {
|
|
2120
|
+
throw new Error("Invalid PromptPart: each part must be an object with a `type` field.");
|
|
2121
|
+
}
|
|
2122
|
+
const type = part.type;
|
|
2123
|
+
if (type !== "text" && type !== "image" && type !== "document") {
|
|
2124
|
+
throw new Error(`Invalid PromptPart type "${type}". Expected "text" | "image" | "document".`);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2123
2127
|
const hasMeaningfulPart = prompt.some((part) => part.type === "text" && part.text.length > 0 || part.type === "image" || part.type === "document");
|
|
2124
2128
|
if (!hasMeaningfulPart)
|
|
2125
2129
|
return void 0;
|
|
@@ -2331,6 +2335,8 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
2331
2335
|
const skillsDisabled = skillsEnabledValue === false || Array.isArray(skillsEnabledValue) && skillsEnabledValue.length === 0;
|
|
2332
2336
|
let resolvedSkills = null;
|
|
2333
2337
|
let skillsCatalog = null;
|
|
2338
|
+
let skillsCleanup = () => {
|
|
2339
|
+
};
|
|
2334
2340
|
const skillActivationState = createSkillActivationState({
|
|
2335
2341
|
maxActive: skillsConfig?.maxActive
|
|
2336
2342
|
});
|
|
@@ -2398,7 +2404,9 @@ function createAgent({ provider, name: agentName, system: agentSystem, tools: ag
|
|
|
2398
2404
|
await warmup();
|
|
2399
2405
|
}
|
|
2400
2406
|
if (!skillsDisabled && skillsConfig && !resolvedSkills) {
|
|
2401
|
-
|
|
2407
|
+
const bundle = await resolveSkillsWithCleanup(skillsConfig);
|
|
2408
|
+
resolvedSkills = bundle.skills;
|
|
2409
|
+
skillsCleanup = bundle.cleanup;
|
|
2402
2410
|
await hooks.callHook("skills:resolve", { skills: resolvedSkills });
|
|
2403
2411
|
const skillsToolRegistered = skillsConfig?.tool !== false && resolvedSkills.length > 0;
|
|
2404
2412
|
const catalogCtx = {
|
|
@@ -2655,6 +2663,11 @@ ${skillsCatalog}`;
|
|
|
2655
2663
|
return idlePromise ?? Promise.resolve();
|
|
2656
2664
|
}
|
|
2657
2665
|
async function reset() {
|
|
2666
|
+
if (running) {
|
|
2667
|
+
throw new Error(
|
|
2668
|
+
"Cannot reset() while the agent is running. Call `agent.abort()` and `await agent.waitForIdle()` first."
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2658
2671
|
conversationTurns = [];
|
|
2659
2672
|
steeringQueue.length = 0;
|
|
2660
2673
|
followUpQueue.length = 0;
|
|
@@ -2743,6 +2756,9 @@ ${skillsCatalog}`;
|
|
|
2743
2756
|
await executionContext.destroy(executionHandle);
|
|
2744
2757
|
executionHandle = null;
|
|
2745
2758
|
}
|
|
2759
|
+
skillsCleanup();
|
|
2760
|
+
skillsCleanup = () => {
|
|
2761
|
+
};
|
|
2746
2762
|
}
|
|
2747
2763
|
if (eager && allMcpServers.length > 0) {
|
|
2748
2764
|
void warmup().catch(() => {
|
|
@@ -740,11 +740,16 @@ function writeSkillsToDisk(skills, targetDir) {
|
|
|
740
740
|
}
|
|
741
741
|
|
|
742
742
|
// src/skills/resolve.ts
|
|
743
|
-
import { mkdtempSync } from "fs";
|
|
743
|
+
import { mkdtempSync, rmSync } from "fs";
|
|
744
744
|
import { tmpdir } from "os";
|
|
745
745
|
import { join as join3 } from "path";
|
|
746
746
|
async function resolveSkills(config) {
|
|
747
|
+
const { skills } = await resolveSkillsWithCleanup(config);
|
|
748
|
+
return skills;
|
|
749
|
+
}
|
|
750
|
+
async function resolveSkillsWithCleanup(config) {
|
|
747
751
|
const sourcedPaths = [];
|
|
752
|
+
let writeDir;
|
|
748
753
|
if (!config.skipDefaultPaths) {
|
|
749
754
|
sourcedPaths.push(...getDefaultScanPaths());
|
|
750
755
|
}
|
|
@@ -752,7 +757,7 @@ async function resolveSkills(config) {
|
|
|
752
757
|
sourcedPaths.push({ path: p, source: inferSource(p) });
|
|
753
758
|
}
|
|
754
759
|
if (config.write?.length) {
|
|
755
|
-
|
|
760
|
+
writeDir = mkdtempSync(join3(tmpdir(), "zidane-skills-"));
|
|
756
761
|
writeSkillsToDisk(config.write, writeDir);
|
|
757
762
|
sourcedPaths.push({ path: writeDir, source: "inline" });
|
|
758
763
|
}
|
|
@@ -766,7 +771,14 @@ async function resolveSkills(config) {
|
|
|
766
771
|
const allowlist = new Set(config.enabled);
|
|
767
772
|
filtered = filtered.filter((s) => allowlist.has(s.name));
|
|
768
773
|
}
|
|
769
|
-
|
|
774
|
+
const cleanup = writeDir ? () => {
|
|
775
|
+
try {
|
|
776
|
+
rmSync(writeDir, { recursive: true, force: true });
|
|
777
|
+
} catch {
|
|
778
|
+
}
|
|
779
|
+
} : () => {
|
|
780
|
+
};
|
|
781
|
+
return { skills: filtered, cleanup };
|
|
770
782
|
}
|
|
771
783
|
|
|
772
784
|
// src/skills/interpolate.ts
|
|
@@ -816,5 +828,6 @@ export {
|
|
|
816
828
|
writeSkillToDisk,
|
|
817
829
|
writeSkillsToDisk,
|
|
818
830
|
resolveSkills,
|
|
831
|
+
resolveSkillsWithCleanup,
|
|
819
832
|
interpolateShellCommands
|
|
820
833
|
};
|
|
@@ -532,22 +532,31 @@ function fromOpenAI(msg) {
|
|
|
532
532
|
content.push({ type: "text", text: c });
|
|
533
533
|
return { role, content };
|
|
534
534
|
}
|
|
535
|
-
if (typeof c === "object" && c._tag === ASSISTANT_TOOL_CALLS_TAG) {
|
|
536
|
-
|
|
537
|
-
|
|
535
|
+
if (typeof c === "object" && !Array.isArray(c) && c._tag === ASSISTANT_TOOL_CALLS_TAG) {
|
|
536
|
+
const tagged = c;
|
|
537
|
+
if (typeof tagged.text === "string" && tagged.text) {
|
|
538
|
+
content.push({ type: "text", text: tagged.text });
|
|
538
539
|
}
|
|
539
|
-
if (Array.isArray(
|
|
540
|
-
for (const
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
if (Array.isArray(tagged.tool_calls)) {
|
|
541
|
+
for (const raw of tagged.tool_calls) {
|
|
542
|
+
if (!raw || typeof raw !== "object")
|
|
543
|
+
continue;
|
|
544
|
+
const tc = raw;
|
|
545
|
+
const rawArgs = tc.function?.arguments;
|
|
546
|
+
const input = rawArgs ? typeof rawArgs === "string" ? JSON.parse(rawArgs) : rawArgs : {};
|
|
547
|
+
content.push({ type: "tool_call", id: tc.id ?? "", name: tc.function?.name ?? "", input });
|
|
543
548
|
}
|
|
544
549
|
}
|
|
545
550
|
return { role, content };
|
|
546
551
|
}
|
|
547
|
-
if (typeof c === "object" && c._tag === TOOL_RESULTS_TAG) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
552
|
+
if (typeof c === "object" && !Array.isArray(c) && c._tag === TOOL_RESULTS_TAG) {
|
|
553
|
+
const tagged = c;
|
|
554
|
+
if (Array.isArray(tagged.results)) {
|
|
555
|
+
for (const raw of tagged.results) {
|
|
556
|
+
if (!raw || typeof raw !== "object")
|
|
557
|
+
continue;
|
|
558
|
+
const r = raw;
|
|
559
|
+
content.push({ type: "tool_result", callId: r.tool_call_id ?? "", output: r.content ?? "" });
|
|
551
560
|
}
|
|
552
561
|
}
|
|
553
562
|
return { role, content };
|
|
@@ -649,8 +658,10 @@ function toOpenAI(msg) {
|
|
|
649
658
|
}
|
|
650
659
|
function autoDetectAndConvert(msg) {
|
|
651
660
|
const c = msg.content;
|
|
652
|
-
if (c && typeof c === "object" &&
|
|
653
|
-
|
|
661
|
+
if (c && typeof c === "object" && !Array.isArray(c)) {
|
|
662
|
+
const tag = c._tag;
|
|
663
|
+
if (typeof tag === "string" && tag.startsWith("__zidane_"))
|
|
664
|
+
return fromOpenAI(msg);
|
|
654
665
|
}
|
|
655
666
|
if (Array.isArray(c)) {
|
|
656
667
|
for (const block of c) {
|
|
@@ -78,19 +78,77 @@ function createDockerContext(config) {
|
|
|
78
78
|
const stream = await exec.start({ Detach: false });
|
|
79
79
|
return new Promise((resolve2) => {
|
|
80
80
|
let stdout = "";
|
|
81
|
-
|
|
81
|
+
let stderr = "";
|
|
82
|
+
let resolved = false;
|
|
83
|
+
const stdoutSink = {
|
|
84
|
+
write(chunk) {
|
|
85
|
+
stdout += typeof chunk === "string" ? chunk : chunk.toString("utf-8");
|
|
86
|
+
return true;
|
|
87
|
+
},
|
|
88
|
+
end() {
|
|
89
|
+
},
|
|
90
|
+
on() {
|
|
91
|
+
},
|
|
92
|
+
once() {
|
|
93
|
+
},
|
|
94
|
+
emit() {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const stderrSink = {
|
|
99
|
+
write(chunk) {
|
|
100
|
+
stderr += typeof chunk === "string" ? chunk : chunk.toString("utf-8");
|
|
101
|
+
return true;
|
|
102
|
+
},
|
|
103
|
+
end() {
|
|
104
|
+
},
|
|
105
|
+
on() {
|
|
106
|
+
},
|
|
107
|
+
once() {
|
|
108
|
+
},
|
|
109
|
+
emit() {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
ref.docker.modem.demuxStream(stream, stdoutSink, stderrSink);
|
|
115
|
+
} catch {
|
|
116
|
+
stream.on("data", (chunk) => {
|
|
117
|
+
stdout += chunk.toString("utf-8");
|
|
118
|
+
});
|
|
119
|
+
}
|
|
82
120
|
const timeout = options?.timeout ?? defaultLimits?.timeout ?? 30;
|
|
83
121
|
const timer = setTimeout(() => {
|
|
84
|
-
|
|
85
|
-
|
|
122
|
+
if (resolved)
|
|
123
|
+
return;
|
|
124
|
+
resolved = true;
|
|
125
|
+
try {
|
|
126
|
+
stream.destroy?.();
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
129
|
+
resolve2({ stdout, stderr: stderr ? `${stderr}
|
|
130
|
+
[timeout]` : "[timeout]", exitCode: 124 });
|
|
86
131
|
}, timeout * 1e3);
|
|
87
|
-
stream.on("data", (chunk) => {
|
|
88
|
-
stdout += chunk.toString("utf-8");
|
|
89
|
-
});
|
|
90
132
|
stream.on("end", async () => {
|
|
133
|
+
if (resolved)
|
|
134
|
+
return;
|
|
135
|
+
resolved = true;
|
|
136
|
+
clearTimeout(timer);
|
|
137
|
+
let exitCode = 0;
|
|
138
|
+
try {
|
|
139
|
+
const inspect = await exec.inspect();
|
|
140
|
+
exitCode = inspect.ExitCode ?? 0;
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
resolve2({ stdout, stderr, exitCode });
|
|
144
|
+
});
|
|
145
|
+
stream.on("error", (err) => {
|
|
146
|
+
if (resolved)
|
|
147
|
+
return;
|
|
148
|
+
resolved = true;
|
|
91
149
|
clearTimeout(timer);
|
|
92
|
-
|
|
93
|
-
|
|
150
|
+
resolve2({ stdout, stderr: stderr ? `${stderr}
|
|
151
|
+
${err.message}` : err.message, exitCode: 1 });
|
|
94
152
|
});
|
|
95
153
|
});
|
|
96
154
|
},
|
package/dist/contexts.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { d as AgentHooks } from './agent-
|
|
2
|
-
export { ac as ActivationVia, ad 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, ae as DeactivationReason, af as FileMapAdapter, ag as FileMapStoreOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj 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, ak as SkillActivationState, al as SkillActivationStateOptions, K as SkillConfig, am as SkillDiagnostic, L as SkillResource, an 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, ao as anthropic, ap as autoDetectAndConvert, aq as cerebras, ar as classifyOpenAICompatError, as as connectMcpServers, at as createAgent, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, ay as createSkillActivationState, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aC as mapOAIFinishReason, a9 as matchesContextExceeded, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aF as openai, aG as openaiCompat, aH as openrouter, aI as resultToString, aJ as toAnthropic, aK as toOpenAI, aL as toTypedError, aa as toolOutputByteLength, ab as toolResultToText } from './agent-
|
|
1
|
+
import { d as AgentHooks } from './agent-CE2jhpNE.js';
|
|
2
|
+
export { ac as ActivationVia, ad 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, ae as DeactivationReason, af as FileMapAdapter, ag as FileMapStoreOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj 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, ak as SkillActivationState, al as SkillActivationStateOptions, K as SkillConfig, am as SkillDiagnostic, L as SkillResource, an 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, ao as anthropic, ap as autoDetectAndConvert, aq as cerebras, ar as classifyOpenAICompatError, as as connectMcpServers, at as createAgent, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, ay as createSkillActivationState, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aC as mapOAIFinishReason, a9 as matchesContextExceeded, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aF as openai, aG as openaiCompat, aH as openrouter, aI as resultToString, aJ as toAnthropic, aK as toOpenAI, aL as toTypedError, aa as toolOutputByteLength, ab as toolResultToText } from './agent-CE2jhpNE.js';
|
|
3
3
|
export { createDockerContext, createProcessContext } from './contexts.js';
|
|
4
4
|
export { S as SandboxProvider, c as createSandboxContext } from './sandbox-CLghrTLi.js';
|
|
5
5
|
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-vA1a_ZX7.js';
|
|
6
6
|
export { Preset, basic, basicTools, definePreset } from './presets.js';
|
|
7
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, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-
|
|
9
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-
|
|
8
|
+
export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-CqOKEN56.js';
|
|
9
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-DlIURVGV.js';
|
|
10
10
|
import { Hookable } from 'hookable';
|
|
11
11
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
12
12
|
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineSkill
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YPU6KVL6.js";
|
|
4
4
|
import {
|
|
5
5
|
anthropic,
|
|
6
6
|
cerebras,
|
|
7
7
|
openai,
|
|
8
8
|
openrouter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AUBXCLUC.js";
|
|
10
10
|
import {
|
|
11
11
|
basicTools,
|
|
12
12
|
basic_default,
|
|
13
13
|
definePreset
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HPTCF3EX.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgent,
|
|
17
17
|
createInteractionTool,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
multiEdit,
|
|
26
26
|
spawn,
|
|
27
27
|
validateToolArgs
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6JIVVEQQ.js";
|
|
29
29
|
import {
|
|
30
30
|
IMPLICITLY_ALLOWED_SKILL_TOOLS,
|
|
31
31
|
buildCatalog,
|
|
@@ -43,12 +43,12 @@ import {
|
|
|
43
43
|
validateSkillName,
|
|
44
44
|
writeSkillToDisk,
|
|
45
45
|
writeSkillsToDisk
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-J4ZOSNSH.js";
|
|
47
47
|
import {
|
|
48
48
|
createDockerContext,
|
|
49
49
|
createProcessContext,
|
|
50
50
|
createSandboxContext
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-UD25QF3H.js";
|
|
52
52
|
import {
|
|
53
53
|
connectMcpServers,
|
|
54
54
|
normalizeMcpBlocks,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
openaiCompat,
|
|
77
77
|
toAnthropic,
|
|
78
78
|
toOpenAI
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-QX7TDFD4.js";
|
|
80
80
|
import {
|
|
81
81
|
AgentAbortedError,
|
|
82
82
|
AgentContextExceededError,
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'hookable';
|
|
2
|
-
export { M as McpConnection, p as McpServerConfig, as as connectMcpServers, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aI as resultToString } from './agent-
|
|
2
|
+
export { M as McpConnection, p as McpServerConfig, as as connectMcpServers, aD as normalizeMcpBlocks, aE as normalizeMcpServers, aI as resultToString } from './agent-CE2jhpNE.js';
|
|
3
3
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
4
4
|
import './types-vA1a_ZX7.js';
|
package/dist/presets.d.ts
CHANGED
package/dist/presets.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
basicTools,
|
|
3
3
|
basic_default,
|
|
4
4
|
definePreset
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-HPTCF3EX.js";
|
|
6
|
+
import "./chunk-6JIVVEQQ.js";
|
|
7
|
+
import "./chunk-J4ZOSNSH.js";
|
|
8
|
+
import "./chunk-UD25QF3H.js";
|
|
9
9
|
import "./chunk-7H34OFDA.js";
|
|
10
10
|
import "./chunk-JH6IAAFA.js";
|
|
11
11
|
import "./chunk-LNN5UTS2.js";
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { j as AnthropicParams, k as CerebrasParams, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, x as ProviderCapabilities, T as StreamCallbacks, V as StreamOptions, X as ToolCall, a1 as ToolResult, a5 as ToolSpec, a7 as TurnResult, ao as anthropic, aq as cerebras, ar as classifyOpenAICompatError, aC as mapOAIFinishReason, aF as openai, aG as openaiCompat, aH as openrouter } from './agent-
|
|
1
|
+
export { j as AnthropicParams, k as CerebrasParams, ah as OpenAICompatAuthHeader, ai as OpenAICompatHttpError, aj as OpenAICompatParams, r as OpenAIParams, s as OpenRouterParams, w as Provider, x as ProviderCapabilities, T as StreamCallbacks, V as StreamOptions, X as ToolCall, a1 as ToolResult, a5 as ToolSpec, a7 as TurnResult, ao as anthropic, aq as cerebras, ar as classifyOpenAICompatError, aC as mapOAIFinishReason, aF as openai, aG as openaiCompat, aH as openrouter } from './agent-CE2jhpNE.js';
|
|
2
2
|
import 'hookable';
|
|
3
3
|
import './types-vA1a_ZX7.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/providers.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
cerebras,
|
|
4
4
|
openai,
|
|
5
5
|
openrouter
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AUBXCLUC.js";
|
|
7
7
|
import {
|
|
8
8
|
OpenAICompatHttpError,
|
|
9
9
|
classifyOpenAICompatError,
|
|
10
10
|
mapOAIFinishReason,
|
|
11
11
|
openaiCompat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QX7TDFD4.js";
|
|
13
13
|
import "./chunk-LNN5UTS2.js";
|
|
14
14
|
export {
|
|
15
15
|
OpenAICompatHttpError,
|
package/dist/session/sqlite.d.ts
CHANGED
package/dist/session/sqlite.js
CHANGED
|
@@ -24,7 +24,9 @@ function createSqliteStore(options) {
|
|
|
24
24
|
`);
|
|
25
25
|
const stmtDelete = db.prepare("DELETE FROM sessions WHERE id = ?");
|
|
26
26
|
const stmtList = db.prepare("SELECT id FROM sessions ORDER BY updated_at DESC");
|
|
27
|
+
const stmtListLimited = db.prepare("SELECT id FROM sessions ORDER BY updated_at DESC LIMIT ?");
|
|
27
28
|
const stmtListByAgent = db.prepare("SELECT id FROM sessions WHERE agent_id = ? ORDER BY updated_at DESC");
|
|
29
|
+
const stmtListByAgentLimited = db.prepare("SELECT id FROM sessions WHERE agent_id = ? ORDER BY updated_at DESC LIMIT ?");
|
|
28
30
|
const store = {
|
|
29
31
|
async load(sessionId) {
|
|
30
32
|
const row = stmtLoad.get(sessionId);
|
|
@@ -45,17 +47,14 @@ function createSqliteStore(options) {
|
|
|
45
47
|
stmtDelete.run(sessionId);
|
|
46
48
|
},
|
|
47
49
|
async list(filter) {
|
|
50
|
+
const limit = typeof filter?.limit === "number" && filter.limit > 0 ? filter.limit : void 0;
|
|
48
51
|
let rows;
|
|
49
52
|
if (filter?.agentId) {
|
|
50
|
-
rows = stmtListByAgent.all(filter.agentId);
|
|
53
|
+
rows = limit ? stmtListByAgentLimited.all(filter.agentId, limit) : stmtListByAgent.all(filter.agentId);
|
|
51
54
|
} else {
|
|
52
|
-
rows = stmtList.all();
|
|
55
|
+
rows = limit ? stmtListLimited.all(limit) : stmtList.all();
|
|
53
56
|
}
|
|
54
|
-
|
|
55
|
-
if (filter?.limit) {
|
|
56
|
-
return ids.slice(0, filter.limit);
|
|
57
|
-
}
|
|
58
|
-
return ids;
|
|
57
|
+
return rows.map((r) => r.id);
|
|
59
58
|
},
|
|
60
59
|
async appendTurns(sessionId, turns) {
|
|
61
60
|
const data = await store.load(sessionId);
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { o as CreateSessionOptions, af as FileMapAdapter, ag as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, z as SessionContentBlock, B as SessionData, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, ap as autoDetectAndConvert, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aJ as toAnthropic, aK as toOpenAI } from './agent-
|
|
1
|
+
export { o as CreateSessionOptions, af as FileMapAdapter, ag as FileMapStoreOptions, R as RemoteStoreOptions, S as Session, z as SessionContentBlock, B as SessionData, F as SessionMessage, G as SessionRun, H as SessionStore, J as SessionTurn, ap as autoDetectAndConvert, au as createFileMapStore, av as createMemoryStore, aw as createRemoteStore, ax as createSession, az as fromAnthropic, aA as fromOpenAI, aB as loadSession, aJ as toAnthropic, aK as toOpenAI } from './agent-CE2jhpNE.js';
|
|
2
2
|
import 'hookable';
|
|
3
3
|
import './types-vA1a_ZX7.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/session.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as ToolDef, K as SkillConfig, ak as SkillActivationState, d as AgentHooks } from './agent-
|
|
1
|
+
import { Z as ToolDef, K as SkillConfig, ak as SkillActivationState, d as AgentHooks } from './agent-CE2jhpNE.js';
|
|
2
2
|
import { Hookable } from 'hookable';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/skills.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as AgentHooks, ak as SkillActivationState, K as SkillConfig, an as SkillSource, am as SkillDiagnostic, N as SkillsConfig } from './agent-
|
|
2
|
-
export { ac as ActivationVia, ad as ActiveSkill, ae as DeactivationReason, al as SkillActivationStateOptions, L as SkillResource, ay as createSkillActivationState } from './agent-
|
|
1
|
+
import { d as AgentHooks, ak as SkillActivationState, K as SkillConfig, an as SkillSource, am as SkillDiagnostic, N as SkillsConfig } from './agent-CE2jhpNE.js';
|
|
2
|
+
export { ac as ActivationVia, ad as ActiveSkill, ae as DeactivationReason, al as SkillActivationStateOptions, L as SkillResource, ay as createSkillActivationState } from './agent-CE2jhpNE.js';
|
|
3
3
|
import { Hookable } from 'hookable';
|
|
4
4
|
import { b as ExecutionContext, c as ExecutionHandle } from './types-vA1a_ZX7.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
@@ -65,6 +65,12 @@ interface BuildCatalogOptions {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Build the skill catalog XML and behavioral instructions for the system prompt.
|
|
68
|
+
*
|
|
69
|
+
* The second argument accepts either {@link BuildCatalogOptions} (preferred)
|
|
70
|
+
* or — for legacy callers — a bare string interpreted as `readToolName` with
|
|
71
|
+
* `skillsToolRegistered: false`. The string form is kept for backward
|
|
72
|
+
* compatibility and will be removed in a future major; pass an options
|
|
73
|
+
* object instead.
|
|
68
74
|
*/
|
|
69
75
|
declare function buildCatalog(skills: SkillConfig[], optionsOrReadToolName?: BuildCatalogOptions | string): string;
|
|
70
76
|
|
|
@@ -265,6 +271,10 @@ declare function interpolateShellCommands(instructions: string, execution: Execu
|
|
|
265
271
|
* 2. Combine with default + user-provided scan paths (project-first, user-next)
|
|
266
272
|
* 3. Run lenient discovery
|
|
267
273
|
* 4. Apply filters: `exclude`, `enabled` allowlist, optional project-skill trust gate
|
|
274
|
+
*
|
|
275
|
+
* Backwards-compatible signature: returns `Promise<SkillConfig[]>`. Use
|
|
276
|
+
* {@link resolveSkillsWithCleanup} when you need to clean up the temp
|
|
277
|
+
* directory created for inline `write` skills (e.g. on `agent.destroy()`).
|
|
268
278
|
*/
|
|
269
279
|
declare function resolveSkills(config: SkillsConfig): Promise<SkillConfig[]>;
|
|
270
280
|
|
package/dist/skills.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineSkill
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YPU6KVL6.js";
|
|
4
4
|
import {
|
|
5
5
|
IMPLICITLY_ALLOWED_SKILL_TOOLS,
|
|
6
6
|
buildCatalog,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
validateSkillName,
|
|
22
22
|
writeSkillToDisk,
|
|
23
23
|
writeSkillsToDisk
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-J4ZOSNSH.js";
|
|
25
25
|
import "./chunk-LNN5UTS2.js";
|
|
26
26
|
export {
|
|
27
27
|
IMPLICITLY_ALLOWED_SKILL_TOOLS,
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-
|
|
2
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-
|
|
3
|
-
import { Z as ToolDef } from './agent-
|
|
4
|
-
export { Y as ToolContext, a0 as ToolMap } from './agent-
|
|
1
|
+
export { S as SkillsReadToolOptions, a as SkillsRunScriptToolOptions, b as SkillsUseToolOptions, c as createSkillsReadTool, d as createSkillsRunScriptTool, e as createSkillsUseTool, f as edit, g as glob, h as grep, m as multiEdit } from './skills-use-CqOKEN56.js';
|
|
2
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult, c as createInteractionTool, b as createSpawnTool, s as spawn, v as validateToolArgs } from './validation-DlIURVGV.js';
|
|
3
|
+
import { Z as ToolDef } from './agent-CE2jhpNE.js';
|
|
4
|
+
export { Y as ToolContext, a0 as ToolMap } from './agent-CE2jhpNE.js';
|
|
5
5
|
import 'hookable';
|
|
6
6
|
import './presets.js';
|
|
7
7
|
import './types-vA1a_ZX7.js';
|
package/dist/tools.js
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
spawn,
|
|
15
15
|
validateToolArgs,
|
|
16
16
|
writeFile
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-6JIVVEQQ.js";
|
|
18
|
+
import "./chunk-J4ZOSNSH.js";
|
|
19
|
+
import "./chunk-UD25QF3H.js";
|
|
20
20
|
import "./chunk-7H34OFDA.js";
|
|
21
21
|
import "./chunk-JH6IAAFA.js";
|
|
22
22
|
import "./chunk-LNN5UTS2.js";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, 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, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, 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, K as SkillConfig, L as SkillResource, 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, a9 as matchesContextExceeded, aa as toolOutputByteLength, ab as toolResultToText } from './agent-
|
|
1
|
+
export { A as Agent, a as AgentAbortedError, b as AgentBehavior, c as AgentContextExceededError, d as AgentHooks, 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, l as ChildRunStats, m as ClassifiedError, n as ClassifiedErrorKind, o as CreateSessionOptions, I as ImageContent, M as McpConnection, p as McpServerConfig, q as McpToolHookContext, O as OAuthRefreshHookContext, 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, K as SkillConfig, L as SkillResource, 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, a9 as matchesContextExceeded, aa as toolOutputByteLength, ab as toolResultToText } from './agent-CE2jhpNE.js';
|
|
2
2
|
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SpawnConfig } from './types-vA1a_ZX7.js';
|
|
3
3
|
export { S as SandboxProvider } from './sandbox-CLghrTLi.js';
|
|
4
4
|
export { Preset } from './presets.js';
|
|
5
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult } from './validation-
|
|
5
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, V as ValidationResult } from './validation-DlIURVGV.js';
|
|
6
6
|
import 'hookable';
|
|
7
7
|
import '@modelcontextprotocol/sdk/client/index.js';
|