cliskill 1.0.6 → 1.0.7
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/bootstrap/cli.js
CHANGED
|
@@ -2802,6 +2802,7 @@ import { z as z15 } from "zod";
|
|
|
2802
2802
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
2803
2803
|
|
|
2804
2804
|
// src/services/streaming-tool-executor.ts
|
|
2805
|
+
var HEARTBEAT_INTERVAL_MS = 2e3;
|
|
2805
2806
|
var StreamingToolExecutor = class {
|
|
2806
2807
|
tools = [];
|
|
2807
2808
|
hasBashError = false;
|
|
@@ -2897,11 +2898,11 @@ var StreamingToolExecutor = class {
|
|
|
2897
2898
|
const progressPromise = new Promise((resolve10) => {
|
|
2898
2899
|
this.progressAvailableResolve = resolve10;
|
|
2899
2900
|
});
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
}
|
|
2903
|
-
|
|
2904
|
-
|
|
2901
|
+
const heartbeatPromise = new Promise((resolve10) => {
|
|
2902
|
+
setTimeout(resolve10, HEARTBEAT_INTERVAL_MS);
|
|
2903
|
+
});
|
|
2904
|
+
const waitTargets = executingPromises.length > 0 ? [...executingPromises, progressPromise, heartbeatPromise] : [progressPromise, heartbeatPromise];
|
|
2905
|
+
await Promise.race(waitTargets);
|
|
2905
2906
|
for (const progress of this.drainProgress()) {
|
|
2906
2907
|
yield { type: "progress", progress };
|
|
2907
2908
|
}
|
|
@@ -2982,7 +2983,9 @@ var StreamingToolExecutor = class {
|
|
|
2982
2983
|
for (const tool of this.tools) {
|
|
2983
2984
|
if (tool.status !== "queued") continue;
|
|
2984
2985
|
if (this.canExecuteTool(tool.isConcurrencySafe)) {
|
|
2985
|
-
|
|
2986
|
+
tool.promise = this.executeTool(tool, ctx);
|
|
2987
|
+
} else if (this.discarded || this.siblingAbortController.signal.aborted) {
|
|
2988
|
+
tool.promise = this.executeTool(tool, ctx);
|
|
2986
2989
|
} else if (!tool.isConcurrencySafe) {
|
|
2987
2990
|
break;
|
|
2988
2991
|
}
|
|
@@ -3054,17 +3057,6 @@ var StreamingToolExecutor = class {
|
|
|
3054
3057
|
}
|
|
3055
3058
|
};
|
|
3056
3059
|
}
|
|
3057
|
-
if (tool.result.toolResult.isError) {
|
|
3058
|
-
if (tool.name === "bash") {
|
|
3059
|
-
this.hasBashError = true;
|
|
3060
|
-
const cmd = typeof tool.input.command === "string" ? tool.input.command : "";
|
|
3061
|
-
this.bashErrorDescription = cmd.length > 40 ? cmd.slice(0, 40) + "\u2026" : cmd;
|
|
3062
|
-
this.siblingAbortController.abort("sibling_error");
|
|
3063
|
-
}
|
|
3064
|
-
if (this.executorConfig.abortOnError && !this.autoMode) {
|
|
3065
|
-
this.siblingAbortController.abort("sibling_error");
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
3060
|
} catch (err) {
|
|
3069
3061
|
const errorMsg = err && typeof err === "object" && "issues" in err ? `Validation error: ${err.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}` : err.message;
|
|
3070
3062
|
tool.result = {
|
|
@@ -3088,6 +3080,17 @@ var StreamingToolExecutor = class {
|
|
|
3088
3080
|
externalSignal.removeEventListener("abort", onDiscard);
|
|
3089
3081
|
}
|
|
3090
3082
|
}
|
|
3083
|
+
if (tool.result?.toolResult.isError) {
|
|
3084
|
+
if (tool.name === "bash") {
|
|
3085
|
+
this.hasBashError = true;
|
|
3086
|
+
const cmd = typeof tool.input.command === "string" ? tool.input.command : "";
|
|
3087
|
+
this.bashErrorDescription = cmd.length > 40 ? cmd.slice(0, 40) + "\u2026" : cmd;
|
|
3088
|
+
this.siblingAbortController.abort("sibling_error");
|
|
3089
|
+
}
|
|
3090
|
+
if (this.executorConfig.abortOnError && !this.autoMode) {
|
|
3091
|
+
this.siblingAbortController.abort("sibling_error");
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3091
3094
|
tool.status = "completed";
|
|
3092
3095
|
void this.processQueue(context);
|
|
3093
3096
|
}
|
|
@@ -3963,6 +3966,8 @@ var AgentTool = class extends BaseTool {
|
|
|
3963
3966
|
);
|
|
3964
3967
|
let finalText = "";
|
|
3965
3968
|
let turnsUsed = 0;
|
|
3969
|
+
let lastProgressLen = 0;
|
|
3970
|
+
const PROGRESS_REPORT_INTERVAL = 200;
|
|
3966
3971
|
try {
|
|
3967
3972
|
const eventStream = runWithAgentContext(
|
|
3968
3973
|
{ agentId: randomUUID3(), agentType: "subagent", agentName: "agent" },
|
|
@@ -3973,9 +3978,35 @@ var AgentTool = class extends BaseTool {
|
|
|
3973
3978
|
switch (event.type) {
|
|
3974
3979
|
case "text_delta":
|
|
3975
3980
|
finalText += event.text;
|
|
3981
|
+
if (finalText.length - lastProgressLen >= PROGRESS_REPORT_INTERVAL) {
|
|
3982
|
+
lastProgressLen = finalText.length;
|
|
3983
|
+
const preview = finalText.slice(-80).replace(/\n/g, " ");
|
|
3984
|
+
context.onProgress?.(`Generating: ...${preview}`);
|
|
3985
|
+
}
|
|
3986
|
+
break;
|
|
3987
|
+
case "turn_start":
|
|
3988
|
+
context.onProgress?.(`Turn ${event.turn}/${input.max_turns}`);
|
|
3976
3989
|
break;
|
|
3977
3990
|
case "turn_end":
|
|
3978
3991
|
turnsUsed = event.turn;
|
|
3992
|
+
context.onProgress?.(`Turn ${event.turn} completed`);
|
|
3993
|
+
break;
|
|
3994
|
+
case "tool_use":
|
|
3995
|
+
context.onProgress?.(`Calling: ${event.name}`);
|
|
3996
|
+
break;
|
|
3997
|
+
case "tool_result": {
|
|
3998
|
+
const status = event.isError ? "error" : "ok";
|
|
3999
|
+
const outputPreview = event.output.length > 60 ? event.output.slice(0, 60) + "..." : event.output;
|
|
4000
|
+
context.onProgress?.(`${event.name} (${status}): ${outputPreview.replace(/\n/g, " ")}`);
|
|
4001
|
+
break;
|
|
4002
|
+
}
|
|
4003
|
+
case "cost_update":
|
|
4004
|
+
break;
|
|
4005
|
+
case "compaction":
|
|
4006
|
+
context.onProgress?.(`Context compacted (${event.removedCount} messages)`);
|
|
4007
|
+
break;
|
|
4008
|
+
case "complete":
|
|
4009
|
+
context.onProgress?.(`Completed in ${event.result.turns} turns`);
|
|
3979
4010
|
break;
|
|
3980
4011
|
case "error":
|
|
3981
4012
|
if (isAbortError(event.error)) {
|
|
@@ -11476,4 +11507,4 @@ export {
|
|
|
11476
11507
|
MCPConnectionManager,
|
|
11477
11508
|
runCli
|
|
11478
11509
|
};
|
|
11479
|
-
//# sourceMappingURL=chunk-
|
|
11510
|
+
//# sourceMappingURL=chunk-SE4GOVKS.js.map
|