@agentstep/gateway 0.5.5 → 0.5.6
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 +69 -17
- package/package.json +1 -1
package/dist/gateway.js
CHANGED
|
@@ -219913,23 +219913,75 @@ var init_chunk_KYLDNVV7 = __esm({
|
|
|
219913
219913
|
}
|
|
219914
219914
|
});
|
|
219915
219915
|
|
|
219916
|
-
// ../agent-sdk/dist/chunk-
|
|
219916
|
+
// ../agent-sdk/dist/chunk-IUJ6IDXX.js
|
|
219917
|
+
import { inflateRawSync } from "zlib";
|
|
219918
|
+
function extractFromZip(buffer) {
|
|
219919
|
+
const files2 = /* @__PURE__ */ new Map();
|
|
219920
|
+
let offset = 0;
|
|
219921
|
+
while (offset + 30 <= buffer.length) {
|
|
219922
|
+
const sig = buffer.readUInt32LE(offset);
|
|
219923
|
+
if (sig !== 67324752) break;
|
|
219924
|
+
const compMethod = buffer.readUInt16LE(offset + 8);
|
|
219925
|
+
const compSize = buffer.readUInt32LE(offset + 18);
|
|
219926
|
+
const uncompSize = buffer.readUInt32LE(offset + 22);
|
|
219927
|
+
const nameLen = buffer.readUInt16LE(offset + 26);
|
|
219928
|
+
const extraLen = buffer.readUInt16LE(offset + 28);
|
|
219929
|
+
const name = buffer.toString("utf8", offset + 30, offset + 30 + nameLen);
|
|
219930
|
+
const dataStart = offset + 30 + nameLen + extraLen;
|
|
219931
|
+
if (compMethod === 0) {
|
|
219932
|
+
const content = buffer.toString("utf8", dataStart, dataStart + uncompSize);
|
|
219933
|
+
files2.set(name, content);
|
|
219934
|
+
} else if (compMethod === 8) {
|
|
219935
|
+
const compressed = buffer.subarray(dataStart, dataStart + compSize);
|
|
219936
|
+
const content = inflateRawSync(compressed).toString("utf8");
|
|
219937
|
+
files2.set(name, content);
|
|
219938
|
+
}
|
|
219939
|
+
offset = dataStart + compSize;
|
|
219940
|
+
}
|
|
219941
|
+
return files2;
|
|
219942
|
+
}
|
|
219917
219943
|
function handleCreateSkill(request2) {
|
|
219918
219944
|
return routeWrap(request2, async ({ auth }) => {
|
|
219919
|
-
const
|
|
219920
|
-
|
|
219921
|
-
|
|
219922
|
-
|
|
219923
|
-
|
|
219924
|
-
|
|
219945
|
+
const contentType = request2.headers.get("content-type") ?? "";
|
|
219946
|
+
let name;
|
|
219947
|
+
let description;
|
|
219948
|
+
let content;
|
|
219949
|
+
let tenantId;
|
|
219950
|
+
if (contentType.includes("multipart/form-data")) {
|
|
219951
|
+
const formData = await request2.formData();
|
|
219952
|
+
name = (formData.get("display_title") ?? "").trim() || "untitled";
|
|
219953
|
+
const file = formData.get("files[]") ?? formData.get("files") ?? formData.get("file");
|
|
219954
|
+
if (!file || !(file instanceof File)) {
|
|
219955
|
+
throw badRequest("Missing file in multipart upload");
|
|
219956
|
+
}
|
|
219957
|
+
const buffer = Buffer.from(await file.arrayBuffer());
|
|
219958
|
+
if (file.name?.toLowerCase().endsWith(".zip")) {
|
|
219959
|
+
const zipFiles = extractFromZip(buffer);
|
|
219960
|
+
const skillEntry = [...zipFiles.entries()].find(
|
|
219961
|
+
([k2]) => k2.endsWith("SKILL.md") || k2.endsWith("skill.md")
|
|
219962
|
+
);
|
|
219963
|
+
if (!skillEntry) {
|
|
219964
|
+
throw badRequest("No SKILL.md found in zip archive");
|
|
219965
|
+
}
|
|
219966
|
+
content = skillEntry[1];
|
|
219967
|
+
} else {
|
|
219968
|
+
content = buffer.toString("utf-8");
|
|
219969
|
+
}
|
|
219970
|
+
tenantId = resolveCreateTenant(auth, void 0);
|
|
219971
|
+
} else {
|
|
219972
|
+
const body = await request2.json().catch(() => null);
|
|
219973
|
+
const parsed = CreateSkillSchema.safeParse(body);
|
|
219974
|
+
if (!parsed.success) {
|
|
219975
|
+
throw badRequest(
|
|
219976
|
+
`invalid body: ${parsed.error.issues.map((i) => i.message).join("; ")}`
|
|
219977
|
+
);
|
|
219978
|
+
}
|
|
219979
|
+
name = parsed.data.name;
|
|
219980
|
+
description = parsed.data.description;
|
|
219981
|
+
content = parsed.data.content;
|
|
219982
|
+
tenantId = resolveCreateTenant(auth, parsed.data.tenant_id);
|
|
219925
219983
|
}
|
|
219926
|
-
const
|
|
219927
|
-
const skill = createSkill({
|
|
219928
|
-
name: parsed.data.name,
|
|
219929
|
-
description: parsed.data.description,
|
|
219930
|
-
content: parsed.data.content,
|
|
219931
|
-
tenantId
|
|
219932
|
-
});
|
|
219984
|
+
const skill = createSkill({ name, description, content, tenantId });
|
|
219933
219985
|
return jsonOk(skill, 201);
|
|
219934
219986
|
});
|
|
219935
219987
|
}
|
|
@@ -219998,8 +220050,8 @@ function handleDeleteSkillVersion(request2, skillId, version3) {
|
|
|
219998
220050
|
});
|
|
219999
220051
|
}
|
|
220000
220052
|
var CreateSkillSchema, CreateVersionSchema;
|
|
220001
|
-
var
|
|
220002
|
-
"../agent-sdk/dist/chunk-
|
|
220053
|
+
var init_chunk_IUJ6IDXX = __esm({
|
|
220054
|
+
"../agent-sdk/dist/chunk-IUJ6IDXX.js"() {
|
|
220003
220055
|
"use strict";
|
|
220004
220056
|
init_chunk_KYLDNVV7();
|
|
220005
220057
|
init_chunk_23UKWXJH();
|
|
@@ -223677,7 +223729,7 @@ var init_handlers3 = __esm({
|
|
|
223677
223729
|
init_chunk_TXOB3PZH();
|
|
223678
223730
|
init_chunk_MFSO7IGE();
|
|
223679
223731
|
init_chunk_JPONGXV5();
|
|
223680
|
-
|
|
223732
|
+
init_chunk_IUJ6IDXX();
|
|
223681
223733
|
init_chunk_H355W724();
|
|
223682
223734
|
init_chunk_DAKCDGWV();
|
|
223683
223735
|
init_chunk_GOFQ63N3();
|
package/package.json
CHANGED