@agentstep/agent-sdk 0.5.20 → 0.5.21
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.
|
@@ -90,6 +90,82 @@ var ToolSchema = z.union([
|
|
|
90
90
|
var ModelConfigSchema = z.object({
|
|
91
91
|
speed: z.enum(["standard", "fast"]).optional()
|
|
92
92
|
});
|
|
93
|
+
var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
94
|
+
".md",
|
|
95
|
+
".txt",
|
|
96
|
+
".py",
|
|
97
|
+
".js",
|
|
98
|
+
".ts",
|
|
99
|
+
".sh",
|
|
100
|
+
".json",
|
|
101
|
+
".yaml",
|
|
102
|
+
".yml",
|
|
103
|
+
".html",
|
|
104
|
+
".css",
|
|
105
|
+
".xml",
|
|
106
|
+
".csv",
|
|
107
|
+
".toml",
|
|
108
|
+
".cfg",
|
|
109
|
+
".ini",
|
|
110
|
+
".sql",
|
|
111
|
+
".jsx",
|
|
112
|
+
".tsx",
|
|
113
|
+
".mjs",
|
|
114
|
+
".cjs",
|
|
115
|
+
".rb",
|
|
116
|
+
".go",
|
|
117
|
+
".rs",
|
|
118
|
+
".java"
|
|
119
|
+
]);
|
|
120
|
+
async function fetchAnthropicSkill(skillName) {
|
|
121
|
+
const rawBase = `https://raw.githubusercontent.com/anthropics/skills/main/skills/${skillName}`;
|
|
122
|
+
const files = {};
|
|
123
|
+
const treeResp = await fetch(
|
|
124
|
+
`https://api.github.com/repos/anthropics/skills/git/trees/main?recursive=1`,
|
|
125
|
+
{ signal: AbortSignal.timeout(15e3) }
|
|
126
|
+
);
|
|
127
|
+
if (!treeResp.ok) {
|
|
128
|
+
const mdResp = await fetch(`${rawBase}/SKILL.md`, { signal: AbortSignal.timeout(1e4) });
|
|
129
|
+
if (!mdResp.ok) throw new Error(`SKILL.md not found for ${skillName}`);
|
|
130
|
+
const content = await mdResp.text();
|
|
131
|
+
return { content, files: { "SKILL.md": content } };
|
|
132
|
+
}
|
|
133
|
+
const tree = await treeResp.json();
|
|
134
|
+
const prefix = `skills/${skillName}/`;
|
|
135
|
+
const skillFiles = tree.tree.filter(
|
|
136
|
+
(f) => f.type === "blob" && f.path.startsWith(prefix)
|
|
137
|
+
);
|
|
138
|
+
if (skillFiles.length === 0) {
|
|
139
|
+
throw new Error(`No files found for skill "${skillName}"`);
|
|
140
|
+
}
|
|
141
|
+
let skillMdContent = "";
|
|
142
|
+
await Promise.all(
|
|
143
|
+
skillFiles.map(async (f) => {
|
|
144
|
+
const relativePath = f.path.slice(prefix.length);
|
|
145
|
+
const ext = relativePath.substring(relativePath.lastIndexOf(".")).toLowerCase();
|
|
146
|
+
const isText = TEXT_EXTENSIONS.has(ext) || relativePath === "LICENSE.txt";
|
|
147
|
+
try {
|
|
148
|
+
const resp = await fetch(`${rawBase}/${relativePath}`, {
|
|
149
|
+
signal: AbortSignal.timeout(1e4)
|
|
150
|
+
});
|
|
151
|
+
if (!resp.ok) return;
|
|
152
|
+
if (isText) {
|
|
153
|
+
const text = await resp.text();
|
|
154
|
+
files[relativePath] = text;
|
|
155
|
+
if (relativePath === "SKILL.md") skillMdContent = text;
|
|
156
|
+
} else {
|
|
157
|
+
const buf = Buffer.from(await resp.arrayBuffer());
|
|
158
|
+
files[relativePath] = `base64:${buf.toString("base64")}`;
|
|
159
|
+
}
|
|
160
|
+
} catch {
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
if (!skillMdContent) {
|
|
165
|
+
throw new Error(`No SKILL.md found in anthropics/skills/skills/${skillName}`);
|
|
166
|
+
}
|
|
167
|
+
return { content: skillMdContent, files };
|
|
168
|
+
}
|
|
93
169
|
async function resolveSkillInputs(skills, nowIso) {
|
|
94
170
|
if (!skills) return void 0;
|
|
95
171
|
const resolved = [];
|
|
@@ -111,19 +187,17 @@ async function resolveSkillInputs(skills, nowIso) {
|
|
|
111
187
|
} else if (s.type === "anthropic" || !s.type) {
|
|
112
188
|
const skillName = s.skill_id;
|
|
113
189
|
try {
|
|
114
|
-
const
|
|
115
|
-
const resp = await fetch(skillMdUrl, { signal: AbortSignal.timeout(1e4) });
|
|
116
|
-
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
|
117
|
-
const content = await resp.text();
|
|
190
|
+
const result = await fetchAnthropicSkill(skillName);
|
|
118
191
|
resolved.push({
|
|
119
192
|
name: skillName,
|
|
120
193
|
source: `anthropic:${skillName}`,
|
|
121
|
-
content,
|
|
194
|
+
content: result.content,
|
|
195
|
+
...Object.keys(result.files).length > 0 ? { files: result.files } : {},
|
|
122
196
|
installed_at: nowIso
|
|
123
197
|
});
|
|
124
198
|
} catch (err) {
|
|
125
199
|
throw badRequest(
|
|
126
|
-
`skill "${skillName}" not found in local DB or Anthropic skills repo. Upload it via POST /v1/skills or check the skill_id. Available Anthropic skills: docx, pdf, pptx, xlsx`
|
|
200
|
+
`skill "${skillName}" not found in local DB or Anthropic skills repo. Upload it via POST /v1/skills or check the skill_id. Available Anthropic skills: docx, pdf, pptx, xlsx, mcp-builder, frontend-design`
|
|
127
201
|
);
|
|
128
202
|
}
|
|
129
203
|
} else {
|
package/dist/handlers/agents.js
CHANGED
package/dist/handlers/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"license": "Apache-2.0",
|
|
3
3
|
"name": "@agentstep/agent-sdk",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.21",
|
|
5
5
|
"description": "Core engine for AgentStep Gateway \u2014 backends, sandbox providers, session orchestration, and vault encryption.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"anthropic",
|