@skilder-ai/runtime 0.8.6 → 0.8.8
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/index.js +725 -589
- package/dist/index.js.map +4 -4
- package/dist/script-sdk-bundle.cjs +24 -2
- package/package.json +2 -2
|
@@ -29,7 +29,8 @@ __export(index_exports, {
|
|
|
29
29
|
downloadAsset: () => downloadAsset,
|
|
30
30
|
execute: () => execute,
|
|
31
31
|
executeJson: () => executeJson,
|
|
32
|
-
executeText: () => executeText
|
|
32
|
+
executeText: () => executeText,
|
|
33
|
+
output: () => output
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(index_exports);
|
|
35
36
|
|
|
@@ -54,6 +55,26 @@ function sendRequest(method, params) {
|
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
}
|
|
58
|
+
function sendNotification(method, params) {
|
|
59
|
+
try {
|
|
60
|
+
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", method, params }) + "\n");
|
|
61
|
+
} catch (err) {
|
|
62
|
+
if (err.code !== "EPIPE") throw err;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function output(value) {
|
|
66
|
+
let text;
|
|
67
|
+
if (typeof value === "string") {
|
|
68
|
+
text = value;
|
|
69
|
+
} else {
|
|
70
|
+
try {
|
|
71
|
+
text = JSON.stringify(value);
|
|
72
|
+
} catch {
|
|
73
|
+
text = String(value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
sendNotification("$output", { text });
|
|
77
|
+
}
|
|
57
78
|
var rl = (0, import_readline.createInterface)({ input: process.stdin, crlfDelay: Infinity });
|
|
58
79
|
process.stdin.unref();
|
|
59
80
|
rl.on("line", (line) => {
|
|
@@ -179,5 +200,6 @@ async function downloadAsset(path) {
|
|
|
179
200
|
downloadAsset,
|
|
180
201
|
execute,
|
|
181
202
|
executeJson,
|
|
182
|
-
executeText
|
|
203
|
+
executeText,
|
|
204
|
+
output
|
|
183
205
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skilder-ai/runtime",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "Skilder Runtime - NodeJS processes for edge execution connected to backend orchestrator via NATS",
|
|
5
5
|
"author": "Skilder AI",
|
|
6
6
|
"license": "See license in LICENSE",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"esbuild-plugin-tsc": "^0.5.0",
|
|
62
62
|
"inversify": "^7.0.0-alpha.5",
|
|
63
63
|
"reflect-metadata": "^0.2.2",
|
|
64
|
-
"@skilder-ai/common": "0.8.
|
|
64
|
+
"@skilder-ai/common": "0.8.8"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsx tooling/esbuild.build.ts",
|