@agentstep/gateway 0.5.20 → 0.5.22
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 +87 -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-4Z3XBX37.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,19 @@ 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) {
|
|
223392
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
223393
|
+
console.warn(`[agents] failed to fetch Anthropic skill "${skillName}":`, msg);
|
|
223345
223394
|
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`
|
|
223395
|
+
`skill "${skillName}" not found in local DB or Anthropic skills repo (${msg}). Upload it via POST /v1/skills or check the skill_id. Available Anthropic skills: docx, pdf, pptx, xlsx, mcp-builder, frontend-design`
|
|
223347
223396
|
);
|
|
223348
223397
|
}
|
|
223349
223398
|
} else {
|
|
@@ -223567,9 +223616,9 @@ function handleListAgentVersions(request2, id) {
|
|
|
223567
223616
|
return jsonOk({ data, next_page: nextPage });
|
|
223568
223617
|
});
|
|
223569
223618
|
}
|
|
223570
|
-
var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, CreateSchema3, UpdateSchema3;
|
|
223571
|
-
var
|
|
223572
|
-
"../agent-sdk/dist/chunk-
|
|
223619
|
+
var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, TEXT_EXTENSIONS2, CreateSchema3, UpdateSchema3;
|
|
223620
|
+
var init_chunk_4Z3XBX37 = __esm({
|
|
223621
|
+
"../agent-sdk/dist/chunk-4Z3XBX37.js"() {
|
|
223573
223622
|
"use strict";
|
|
223574
223623
|
init_chunk_23UKWXJH();
|
|
223575
223624
|
init_chunk_HZY43FS6();
|
|
@@ -223611,6 +223660,33 @@ var init_chunk_EH73DPPL = __esm({
|
|
|
223611
223660
|
ModelConfigSchema2 = external_exports.object({
|
|
223612
223661
|
speed: external_exports.enum(["standard", "fast"]).optional()
|
|
223613
223662
|
});
|
|
223663
|
+
TEXT_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
223664
|
+
".md",
|
|
223665
|
+
".txt",
|
|
223666
|
+
".py",
|
|
223667
|
+
".js",
|
|
223668
|
+
".ts",
|
|
223669
|
+
".sh",
|
|
223670
|
+
".json",
|
|
223671
|
+
".yaml",
|
|
223672
|
+
".yml",
|
|
223673
|
+
".html",
|
|
223674
|
+
".css",
|
|
223675
|
+
".xml",
|
|
223676
|
+
".csv",
|
|
223677
|
+
".toml",
|
|
223678
|
+
".cfg",
|
|
223679
|
+
".ini",
|
|
223680
|
+
".sql",
|
|
223681
|
+
".jsx",
|
|
223682
|
+
".tsx",
|
|
223683
|
+
".mjs",
|
|
223684
|
+
".cjs",
|
|
223685
|
+
".rb",
|
|
223686
|
+
".go",
|
|
223687
|
+
".rs",
|
|
223688
|
+
".java"
|
|
223689
|
+
]);
|
|
223614
223690
|
CreateSchema3 = external_exports.object({
|
|
223615
223691
|
name: external_exports.string().min(1),
|
|
223616
223692
|
model: external_exports.object({ id: external_exports.string().min(1), speed: external_exports.enum(["standard", "fast"]).optional() }),
|
|
@@ -224638,7 +224714,7 @@ var init_handlers3 = __esm({
|
|
|
224638
224714
|
init_chunk_PZRRE4CA();
|
|
224639
224715
|
init_chunk_NWIMPG4M();
|
|
224640
224716
|
init_chunk_STPT3SWU();
|
|
224641
|
-
|
|
224717
|
+
init_chunk_4Z3XBX37();
|
|
224642
224718
|
init_chunk_XWWKOIA5();
|
|
224643
224719
|
init_chunk_BSRT6GK5();
|
|
224644
224720
|
init_chunk_HQMQHYZB();
|
package/package.json
CHANGED