@agentstep/gateway 0.5.19 → 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.
Files changed (2) hide show
  1. package/dist/gateway.js +111 -16
  2. 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-37JORFNW.js
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 = [];
@@ -223317,17 +223366,36 @@ async function resolveSkillInputs(skills2, nowIso) {
223317
223366
  if ("skill_id" in s && s.skill_id) {
223318
223367
  const { getSkill: dbGetSkill, getSkillVersion: dbGetSkillVersion } = await Promise.resolve().then(() => (init_skills(), skills_exports));
223319
223368
  const dbSkill = dbGetSkill(s.skill_id);
223320
- if (!dbSkill) throw badRequest(`skill ${s.skill_id} not found`);
223321
- const version3 = s.version ?? dbSkill.current_version;
223322
- const sv = dbGetSkillVersion(s.skill_id, version3);
223323
- if (!sv) throw badRequest(`skill version ${version3} not found for skill ${s.skill_id}`);
223324
- resolved.push({
223325
- name: dbSkill.name,
223326
- source: `skill:${s.skill_id}@${version3}`,
223327
- content: sv.content,
223328
- ...sv.files && Object.keys(sv.files).length > 0 ? { files: sv.files } : {},
223329
- installed_at: nowIso
223330
- });
223369
+ if (dbSkill) {
223370
+ const version3 = s.version ?? dbSkill.current_version;
223371
+ const sv = dbGetSkillVersion(s.skill_id, version3);
223372
+ if (!sv) throw badRequest(`skill version ${version3} not found for skill ${s.skill_id}`);
223373
+ resolved.push({
223374
+ name: dbSkill.name,
223375
+ source: `skill:${s.skill_id}@${version3}`,
223376
+ content: sv.content,
223377
+ ...sv.files && Object.keys(sv.files).length > 0 ? { files: sv.files } : {},
223378
+ installed_at: nowIso
223379
+ });
223380
+ } else if (s.type === "anthropic" || !s.type) {
223381
+ const skillName = s.skill_id;
223382
+ try {
223383
+ const result = await fetchAnthropicSkill(skillName);
223384
+ resolved.push({
223385
+ name: skillName,
223386
+ source: `anthropic:${skillName}`,
223387
+ content: result.content,
223388
+ ...Object.keys(result.files).length > 0 ? { files: result.files } : {},
223389
+ installed_at: nowIso
223390
+ });
223391
+ } catch (err) {
223392
+ throw badRequest(
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`
223394
+ );
223395
+ }
223396
+ } else {
223397
+ throw badRequest(`skill "${s.skill_id}" not found`);
223398
+ }
223331
223399
  } else {
223332
223400
  const inline = s;
223333
223401
  resolved.push({
@@ -223546,9 +223614,9 @@ function handleListAgentVersions(request2, id) {
223546
223614
  return jsonOk({ data, next_page: nextPage });
223547
223615
  });
223548
223616
  }
223549
- var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, CreateSchema3, UpdateSchema3;
223550
- var init_chunk_37JORFNW = __esm({
223551
- "../agent-sdk/dist/chunk-37JORFNW.js"() {
223617
+ var InlineSkillSchema, RefSkillSchema, SkillSchema, ToolSchema, ModelConfigSchema2, TEXT_EXTENSIONS2, CreateSchema3, UpdateSchema3;
223618
+ var init_chunk_EXNZ74GW = __esm({
223619
+ "../agent-sdk/dist/chunk-EXNZ74GW.js"() {
223552
223620
  "use strict";
223553
223621
  init_chunk_23UKWXJH();
223554
223622
  init_chunk_HZY43FS6();
@@ -223590,6 +223658,33 @@ var init_chunk_37JORFNW = __esm({
223590
223658
  ModelConfigSchema2 = external_exports.object({
223591
223659
  speed: external_exports.enum(["standard", "fast"]).optional()
223592
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
+ ]);
223593
223688
  CreateSchema3 = external_exports.object({
223594
223689
  name: external_exports.string().min(1),
223595
223690
  model: external_exports.object({ id: external_exports.string().min(1), speed: external_exports.enum(["standard", "fast"]).optional() }),
@@ -224617,7 +224712,7 @@ var init_handlers3 = __esm({
224617
224712
  init_chunk_PZRRE4CA();
224618
224713
  init_chunk_NWIMPG4M();
224619
224714
  init_chunk_STPT3SWU();
224620
- init_chunk_37JORFNW();
224715
+ init_chunk_EXNZ74GW();
224621
224716
  init_chunk_XWWKOIA5();
224622
224717
  init_chunk_BSRT6GK5();
224623
224718
  init_chunk_HQMQHYZB();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentstep/gateway",
3
- "version": "0.5.19",
3
+ "version": "0.5.21",
4
4
  "description": "Self-hosted, open-source, Anthropic Managed Agents-compatible. CLI + web UI for running AI agents in sandboxed environments.",
5
5
  "keywords": [
6
6
  "anthropic",