@skilder-ai/runtime 0.8.8 → 0.8.10
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 +24 -12
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -138560,6 +138560,15 @@ function parseScriptArgs(argsString) {
|
|
|
138560
138560
|
return args;
|
|
138561
138561
|
}
|
|
138562
138562
|
|
|
138563
|
+
// ../common/src/utils/debug-utils.ts
|
|
138564
|
+
var MAX_DEBUG_SIZE = 5e4;
|
|
138565
|
+
function truncateDebug(consoleOutput) {
|
|
138566
|
+
if (!consoleOutput) return void 0;
|
|
138567
|
+
if (consoleOutput.length <= MAX_DEBUG_SIZE) return consoleOutput;
|
|
138568
|
+
return consoleOutput.slice(0, MAX_DEBUG_SIZE) + `
|
|
138569
|
+
... [truncated, ${consoleOutput.length} chars total]`;
|
|
138570
|
+
}
|
|
138571
|
+
|
|
138563
138572
|
// ../common/src/related-content-detector.ts
|
|
138564
138573
|
function escapeRegex2(str) {
|
|
138565
138574
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -144530,7 +144539,9 @@ For other resources, use the \`learn\` tool instead.`
|
|
|
144530
144539
|
const textContent = result.content.filter((c3) => c3.type === "text").map((c3) => ({ type: "text", text: c3.text }));
|
|
144531
144540
|
return {
|
|
144532
144541
|
content: textContent.length > 0 ? textContent : [{ type: "text", text: "(No text output)" }],
|
|
144533
|
-
|
|
144542
|
+
isError: result.isError,
|
|
144543
|
+
skillIds: [skill.id],
|
|
144544
|
+
debug: response.data.debug ?? void 0
|
|
144534
144545
|
};
|
|
144535
144546
|
}
|
|
144536
144547
|
return {
|
|
@@ -145019,7 +145030,7 @@ async function handleExecuteScript(args, ctx) {
|
|
|
145019
145030
|
};
|
|
145020
145031
|
}
|
|
145021
145032
|
const path4 = args.path;
|
|
145022
|
-
const { content, isError, skillIds } = await ctx.scriptService.execute({
|
|
145033
|
+
const { content, isError, skillIds, debug } = await ctx.scriptService.execute({
|
|
145023
145034
|
path: path4 ?? "",
|
|
145024
145035
|
workspaceId: ctx.identity.workspaceId,
|
|
145025
145036
|
userId: ctx.identity.id,
|
|
@@ -145027,7 +145038,7 @@ async function handleExecuteScript(args, ctx) {
|
|
|
145027
145038
|
runtimeExecutionId: ctx.identity.runtimeExecutionId,
|
|
145028
145039
|
delegateDepth: ctx.identity.delegateDepth
|
|
145029
145040
|
});
|
|
145030
|
-
return { response: { content, isError }, skillIds };
|
|
145041
|
+
return { response: { content, isError }, skillIds, ...debug ? { debug } : {} };
|
|
145031
145042
|
}
|
|
145032
145043
|
|
|
145033
145044
|
// src/services/static-tools/feedback-skill.handler.ts
|
|
@@ -145966,7 +145977,7 @@ The path must point to a downloadable (binary) resource in a skill's related ite
|
|
|
145966
145977
|
}
|
|
145967
145978
|
if (toolConfig.__routing.type === "static") {
|
|
145968
145979
|
this.logger.debug(`Handling static tool ${toolConfig.__routing.toolName} for user ${this.identity.id}`);
|
|
145969
|
-
const { response, skillIds } = await this.handleStaticTool(toolConfig.__routing.toolName, args);
|
|
145980
|
+
const { response, skillIds, debug } = await this.handleStaticTool(toolConfig.__routing.toolName, args);
|
|
145970
145981
|
const isWrapperTool = toolConfig.__routing.toolName === "call_tool";
|
|
145971
145982
|
if (toolConfig.__routing.workspaceId && !isWrapperTool) {
|
|
145972
145983
|
try {
|
|
@@ -145978,7 +145989,8 @@ The path must point to a downloadable (binary) resource in a skill's related ite
|
|
|
145978
145989
|
userId: this.identity.id,
|
|
145979
145990
|
arguments: args,
|
|
145980
145991
|
response,
|
|
145981
|
-
skillIds
|
|
145992
|
+
skillIds,
|
|
145993
|
+
...debug ? { debug } : {}
|
|
145982
145994
|
});
|
|
145983
145995
|
this.logger.info(`Publishing static tool call ${toolConfig.__routing.toolName} to subject: ${message.getSubject()}`);
|
|
145984
145996
|
this.natsService.publish(message);
|
|
@@ -154199,25 +154211,25 @@ ${result.stderr}`;
|
|
|
154199
154211
|
result: {
|
|
154200
154212
|
content: [{ type: "text", text: output || (useInteractive ? "(Script executed with no output() call)" : "(Script executed successfully with no output)") }]
|
|
154201
154213
|
},
|
|
154202
|
-
executedBy
|
|
154214
|
+
executedBy,
|
|
154215
|
+
debug: truncateDebug(result.consoleOutput)
|
|
154216
|
+
// collapse empty string to undefined
|
|
154203
154217
|
}));
|
|
154204
154218
|
} else {
|
|
154205
154219
|
const cleanError = result.stderr ? formatScriptError(result.stderr, result.exitCode) : result.error || "Unknown error";
|
|
154206
|
-
const consolePart = result.consoleOutput ? `Console output:
|
|
154207
|
-
${result.consoleOutput}
|
|
154208
|
-
|
|
154209
|
-
` : "";
|
|
154210
154220
|
const stdoutPart = result.stdout ? `Output:
|
|
154211
154221
|
${result.stdout}
|
|
154212
154222
|
|
|
154213
154223
|
` : "";
|
|
154214
|
-
const fullOutput = stdoutPart
|
|
154224
|
+
const fullOutput = stdoutPart ? `${stdoutPart}${cleanError}` : cleanError;
|
|
154215
154225
|
respond(new RuntimeCallToolResponse({
|
|
154216
154226
|
result: {
|
|
154217
154227
|
content: [{ type: "text", text: fullOutput }],
|
|
154218
154228
|
isError: true
|
|
154219
154229
|
},
|
|
154220
|
-
executedBy
|
|
154230
|
+
executedBy,
|
|
154231
|
+
debug: truncateDebug(result.consoleOutput)
|
|
154232
|
+
// collapse empty string to undefined
|
|
154221
154233
|
}));
|
|
154222
154234
|
}
|
|
154223
154235
|
}
|