@elisym/sdk 0.25.1 → 0.25.4
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/agent-store.cjs.map +1 -1
- package/dist/agent-store.js.map +1 -1
- package/dist/index.cjs +119 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +158 -18
- package/dist/index.d.ts +158 -18
- package/dist/index.js +118 -19
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +130 -50
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +72 -0
- package/dist/node.d.ts +72 -0
- package/dist/node.js +130 -50
- package/dist/node.js.map +1 -1
- package/dist/skills.cjs +57 -1
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.d.cts +23 -3
- package/dist/skills.d.ts +23 -3
- package/dist/skills.js +58 -2
- package/dist/skills.js.map +1 -1
- package/package.json +1 -1
package/dist/skills.cjs
CHANGED
|
@@ -372,9 +372,12 @@ var DynamicScriptSkill = class {
|
|
|
372
372
|
async execute(input, ctx) {
|
|
373
373
|
const outDir = await promises.mkdtemp(path.join(os.tmpdir(), "elisym-skill-out-"));
|
|
374
374
|
const outputFile = path.join(outDir, "output");
|
|
375
|
+
const outputDir = path.join(outDir, "files");
|
|
376
|
+
await promises.mkdir(outputDir, { recursive: true });
|
|
375
377
|
const env = {
|
|
376
378
|
...this.scriptEnv ?? process.env,
|
|
377
|
-
ELISYM_OUTPUT_FILE: outputFile
|
|
379
|
+
ELISYM_OUTPUT_FILE: outputFile,
|
|
380
|
+
ELISYM_OUTPUT_DIR: outputDir
|
|
378
381
|
};
|
|
379
382
|
if (input.filePath !== void 0) {
|
|
380
383
|
env.ELISYM_INPUT_FILE = input.filePath;
|
|
@@ -402,6 +405,29 @@ var DynamicScriptSkill = class {
|
|
|
402
405
|
const detail = result.stderr.trim() || result.stdout.trim() || "(no output)";
|
|
403
406
|
throw new ScriptExecutionError(result.code, detail);
|
|
404
407
|
}
|
|
408
|
+
const dirEntries = await promises.readdir(outputDir, { withFileTypes: true }).catch(() => []);
|
|
409
|
+
const filePaths = [];
|
|
410
|
+
for (const entry of dirEntries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
411
|
+
if (!entry.isFile()) {
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const candidate = path.join(outputDir, entry.name);
|
|
415
|
+
const entryStat = await promises.stat(candidate).catch(() => null);
|
|
416
|
+
if (entryStat !== null && entryStat.isFile() && entryStat.size > 0) {
|
|
417
|
+
filePaths.push(candidate);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (filePaths.length > 0) {
|
|
421
|
+
keepOutDir = true;
|
|
422
|
+
return {
|
|
423
|
+
data: result.stdout.trim(),
|
|
424
|
+
filePaths,
|
|
425
|
+
outputMime: this.outputMime ?? "application/octet-stream",
|
|
426
|
+
cleanup: async () => {
|
|
427
|
+
await promises.rm(outDir, { recursive: true, force: true });
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
}
|
|
405
431
|
const outputStat = await promises.stat(outputFile).catch(() => null);
|
|
406
432
|
if (outputStat !== null && outputStat.isFile() && outputStat.size > 0) {
|
|
407
433
|
keepOutDir = true;
|
|
@@ -769,6 +795,18 @@ function validateInputMime(skillName, raw) {
|
|
|
769
795
|
}
|
|
770
796
|
return raw;
|
|
771
797
|
}
|
|
798
|
+
var INPUT_TEXT_VALUES = ["required", "optional", "none"];
|
|
799
|
+
function validateInputText(skillName, raw) {
|
|
800
|
+
if (raw === void 0 || raw === null) {
|
|
801
|
+
return void 0;
|
|
802
|
+
}
|
|
803
|
+
if (typeof raw !== "string" || !INPUT_TEXT_VALUES.includes(raw)) {
|
|
804
|
+
throw new Error(
|
|
805
|
+
`SKILL.md "${skillName}": "input_text" must be one of "required", "optional", "none"`
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
return raw;
|
|
809
|
+
}
|
|
772
810
|
function validateMaxExecutionSecs(skillName, raw) {
|
|
773
811
|
if (raw === void 0 || raw === null) {
|
|
774
812
|
return void 0;
|
|
@@ -871,6 +909,7 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
871
909
|
let scriptTimeoutMs;
|
|
872
910
|
let outputMime;
|
|
873
911
|
let inputMime;
|
|
912
|
+
let inputText;
|
|
874
913
|
if (mode === "static-file") {
|
|
875
914
|
if (typeof frontmatter.output_file !== "string" || frontmatter.output_file.length === 0) {
|
|
876
915
|
throw new Error(
|
|
@@ -892,6 +931,11 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
892
931
|
`SKILL.md "${frontmatter.name}": "input_mime" is only valid in mode 'dynamic-script'`
|
|
893
932
|
);
|
|
894
933
|
}
|
|
934
|
+
if (frontmatter.input_text !== void 0) {
|
|
935
|
+
throw new Error(
|
|
936
|
+
`SKILL.md "${frontmatter.name}": "input_text" is only valid in mode 'dynamic-script'`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
895
939
|
outputFile = frontmatter.output_file;
|
|
896
940
|
} else if (mode === "static-script" || mode === "dynamic-script") {
|
|
897
941
|
if (typeof frontmatter.script !== "string" || frontmatter.script.length === 0) {
|
|
@@ -908,6 +952,7 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
908
952
|
if (mode === "dynamic-script") {
|
|
909
953
|
outputMime = validateOutputMime(frontmatter.name, frontmatter.output_mime);
|
|
910
954
|
inputMime = validateInputMime(frontmatter.name, frontmatter.input_mime);
|
|
955
|
+
inputText = validateInputText(frontmatter.name, frontmatter.input_text);
|
|
911
956
|
} else {
|
|
912
957
|
if (frontmatter.output_mime !== void 0) {
|
|
913
958
|
throw new Error(
|
|
@@ -919,6 +964,11 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
919
964
|
`SKILL.md "${frontmatter.name}": "input_mime" is only valid in mode 'dynamic-script'`
|
|
920
965
|
);
|
|
921
966
|
}
|
|
967
|
+
if (frontmatter.input_text !== void 0) {
|
|
968
|
+
throw new Error(
|
|
969
|
+
`SKILL.md "${frontmatter.name}": "input_text" is only valid in mode 'dynamic-script'`
|
|
970
|
+
);
|
|
971
|
+
}
|
|
922
972
|
}
|
|
923
973
|
} else {
|
|
924
974
|
if (frontmatter.output_file !== void 0) {
|
|
@@ -951,6 +1001,11 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
951
1001
|
`SKILL.md "${frontmatter.name}": "input_mime" is only valid in mode 'dynamic-script'`
|
|
952
1002
|
);
|
|
953
1003
|
}
|
|
1004
|
+
if (frontmatter.input_text !== void 0) {
|
|
1005
|
+
throw new Error(
|
|
1006
|
+
`SKILL.md "${frontmatter.name}": "input_text" is only valid in mode 'dynamic-script'`
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
954
1009
|
}
|
|
955
1010
|
const image = typeof frontmatter.image === "string" ? frontmatter.image : void 0;
|
|
956
1011
|
const imageFile = typeof frontmatter.image_file === "string" ? frontmatter.image_file : void 0;
|
|
@@ -979,6 +1034,7 @@ function validateSkillFrontmatter(frontmatter, systemPrompt, options = {}) {
|
|
|
979
1034
|
scriptTimeoutMs,
|
|
980
1035
|
outputMime,
|
|
981
1036
|
inputMime,
|
|
1037
|
+
inputText,
|
|
982
1038
|
rateLimit,
|
|
983
1039
|
executionTimeoutSecs
|
|
984
1040
|
};
|