@agentstep/gateway 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.
- package/dist/gateway.js +85 -11
- package/package.json +1 -1
package/dist/gateway.js
CHANGED
|
@@ -223292,7 +223292,7 @@ var init_models = __esm({
|
|
|
223292
223292
|
}
|
|
223293
223293
|
});
|
|
223294
223294
|
|
|
223295
|
-
// ../agent-sdk/dist/chunk-
|
|
223295
|
+
// ../agent-sdk/dist/chunk-EXNZ74GW.js
|
|
223296
223296
|
function getAgentTenantId2(id) {
|
|
223297
223297
|
const row = getDb().prepare(`SELECT tenant_id FROM agents WHERE id = ?`).get(id);
|
|
223298
223298
|
return row?.tenant_id;
|
|
@@ -223310,6 +223310,55 @@ function assertProxiedAgentTenant(auth, id) {
|
|
|
223310
223310
|
if (proxied === void 0) return;
|
|
223311
223311
|
assertResourceTenant(auth, proxied, `agent ${id} not found`);
|
|
223312
223312
|
}
|
|
223313
|
+
async function fetchAnthropicSkill(skillName) {
|
|
223314
|
+
const rawBase = `https://raw.githubusercontent.com/anthropics/skills/main/skills/${skillName}`;
|
|
223315
|
+
const files2 = {};
|
|
223316
|
+
const treeResp = await fetch(
|
|
223317
|
+
`https://api.github.com/repos/anthropics/skills/git/trees/main?recursive=1`,
|
|
223318
|
+
{ signal: AbortSignal.timeout(15e3) }
|
|
223319
|
+
);
|
|
223320
|
+
if (!treeResp.ok) {
|
|
223321
|
+
const mdResp = await fetch(`${rawBase}/SKILL.md`, { signal: AbortSignal.timeout(1e4) });
|
|
223322
|
+
if (!mdResp.ok) throw new Error(`SKILL.md not found for ${skillName}`);
|
|
223323
|
+
const content = await mdResp.text();
|
|
223324
|
+
return { content, files: { "SKILL.md": content } };
|
|
223325
|
+
}
|
|
223326
|
+
const tree = await treeResp.json();
|
|
223327
|
+
const prefix = `skills/${skillName}/`;
|
|
223328
|
+
const skillFiles = tree.tree.filter(
|
|
223329
|
+
(f) => f.type === "blob" && f.path.startsWith(prefix)
|
|
223330
|
+
);
|
|
223331
|
+
if (skillFiles.length === 0) {
|
|
223332
|
+
throw new Error(`No files found for skill "${skillName}"`);
|
|
223333
|
+
}
|
|
223334
|
+
let skillMdContent = "";
|
|
223335
|
+
await Promise.all(
|
|
223336
|
+
skillFiles.map(async (f) => {
|
|
223337
|
+
const relativePath = f.path.slice(prefix.length);
|
|
223338
|
+
const ext = relativePath.substring(relativePath.lastIndexOf(".")).toLowerCase();
|
|
223339
|
+
const isText = TEXT_EXTENSIONS2.has(ext) || relativePath === "LICENSE.txt";
|
|
223340
|
+
try {
|
|
223341
|
+
const resp = await fetch(`${rawBase}/${relativePath}`, {
|
|
223342
|
+
signal: AbortSignal.timeout(1e4)
|
|
223343
|
+
});
|
|
223344
|
+
if (!resp.ok) return;
|
|
223345
|
+
if (isText) {
|
|
223346
|
+
const text2 = await resp.text();
|
|
223347
|
+
files2[relativePath] = text2;
|
|
223348
|
+
if (relativePath === "SKILL.md") skillMdContent = text2;
|
|
223349
|
+
} else {
|
|
223350
|
+
const buf = Buffer.from(await resp.arrayBuffer());
|
|
223351
|
+
files2[relativePath] = `base64:${buf.toString("base64")}`;
|
|
223352
|
+
}
|
|
223353
|
+
} catch {
|
|
223354
|
+
}
|
|
223355
|
+
})
|
|
223356
|
+
);
|
|
223357
|
+
if (!skillMdContent) {
|
|
223358
|
+
throw new Error(`No SKILL.md found in anthropics/skills/skills/${skillName}`);
|
|
223359
|
+
}
|
|
223360
|
+
return { content: skillMdContent, files: files2 };
|
|
223361
|
+
}
|
|
223313
223362
|
async function resolveSkillInputs(skills2, nowIso) {
|
|
223314
223363
|
if (!skills2) return void 0;
|
|
223315
223364
|
const resolved = [];
|
|
@@ -223331,19 +223380,17 @@ async function resolveSkillInputs(skills2, nowIso) {
|
|
|
223331
223380
|
} else if (s.type === "anthropic" || !s.type) {
|
|
223332
223381
|
const skillName = s.skill_id;
|
|
223333
223382
|
try {
|
|
223334
|
-
const
|
|
223335
|
-
const resp = await fetch(skillMdUrl, { signal: AbortSignal.timeout(1e4) });
|
|
223336
|
-
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
|
223337
|
-
const content = await resp.text();
|
|
223383
|
+
const result = await fetchAnthropicSkill(skillName);
|
|
223338
223384
|
resolved.push({
|
|
223339
223385
|
name: skillName,
|
|
223340
223386
|
source: `anthropic:${skillName}`,
|
|
223341
|
-
content,
|
|
223387
|
+
content: result.content,
|
|
223388
|
+
...Object.keys(result.files).length > 0 ? { files: result.files } : {},
|
|
223342
223389
|
installed_at: nowIso
|
|
223343
223390
|
});
|
|
223344
223391
|
} catch (err) {
|
|
223345
223392
|
throw badRequest(
|
|
223346
|
-
`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`
|
|
223393
|
+
`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`
|
|
223347
223394
|
);
|
|
223348
223395
|
}
|
|
223349
223396
|
} else {
|
|
@@ -223567,9 +223614,9 @@ function handleListAgentVersions(request2, id) {
|
|
|
223567
223614
|
return jsonOk({ data, next_page: nextPage });
|
|
223568
223615
|
});
|
|
223569
223616
|
}
|
|
223570
|
-
var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, CreateSchema3, UpdateSchema3;
|
|
223571
|
-
var
|
|
223572
|
-
"../agent-sdk/dist/chunk-
|
|
223617
|
+
var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, TEXT_EXTENSIONS2, CreateSchema3, UpdateSchema3;
|
|
223618
|
+
var init_chunk_EXNZ74GW = __esm({
|
|
223619
|
+
"../agent-sdk/dist/chunk-EXNZ74GW.js"() {
|
|
223573
223620
|
"use strict";
|
|
223574
223621
|
init_chunk_23UKWXJH();
|
|
223575
223622
|
init_chunk_HZY43FS6();
|
|
@@ -223611,6 +223658,33 @@ var init_chunk_EH73DPPL = __esm({
|
|
|
223611
223658
|
ModelConfigSchema2 = external_exports.object({
|
|
223612
223659
|
speed: external_exports.enum(["standard", "fast"]).optional()
|
|
223613
223660
|
});
|
|
223661
|
+
TEXT_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
223662
|
+
".md",
|
|
223663
|
+
".txt",
|
|
223664
|
+
".py",
|
|
223665
|
+
".js",
|
|
223666
|
+
".ts",
|
|
223667
|
+
".sh",
|
|
223668
|
+
".json",
|
|
223669
|
+
".yaml",
|
|
223670
|
+
".yml",
|
|
223671
|
+
".html",
|
|
223672
|
+
".css",
|
|
223673
|
+
".xml",
|
|
223674
|
+
".csv",
|
|
223675
|
+
".toml",
|
|
223676
|
+
".cfg",
|
|
223677
|
+
".ini",
|
|
223678
|
+
".sql",
|
|
223679
|
+
".jsx",
|
|
223680
|
+
".tsx",
|
|
223681
|
+
".mjs",
|
|
223682
|
+
".cjs",
|
|
223683
|
+
".rb",
|
|
223684
|
+
".go",
|
|
223685
|
+
".rs",
|
|
223686
|
+
".java"
|
|
223687
|
+
]);
|
|
223614
223688
|
CreateSchema3 = external_exports.object({
|
|
223615
223689
|
name: external_exports.string().min(1),
|
|
223616
223690
|
model: external_exports.object({ id: external_exports.string().min(1), speed: external_exports.enum(["standard", "fast"]).optional() }),
|
|
@@ -224638,7 +224712,7 @@ var init_handlers3 = __esm({
|
|
|
224638
224712
|
init_chunk_PZRRE4CA();
|
|
224639
224713
|
init_chunk_NWIMPG4M();
|
|
224640
224714
|
init_chunk_STPT3SWU();
|
|
224641
|
-
|
|
224715
|
+
init_chunk_EXNZ74GW();
|
|
224642
224716
|
init_chunk_XWWKOIA5();
|
|
224643
224717
|
init_chunk_BSRT6GK5();
|
|
224644
224718
|
init_chunk_HQMQHYZB();
|
package/package.json
CHANGED