cliskill 1.0.6 → 1.0.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/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)) {
|
|
@@ -7228,9 +7259,11 @@ var StatusBar = memo(function StatusBar2({
|
|
|
7228
7259
|
] })
|
|
7229
7260
|
] });
|
|
7230
7261
|
});
|
|
7231
|
-
var
|
|
7262
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
7263
|
+
var Spinner = memo(function Spinner2({ label, frame }) {
|
|
7264
|
+
const ch = SPINNER_FRAMES[frame % SPINNER_FRAMES.length];
|
|
7232
7265
|
return /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
7233
|
-
/* @__PURE__ */ jsx(Text, { color: C.primary, children:
|
|
7266
|
+
/* @__PURE__ */ jsx(Text, { color: C.primary, children: ch }),
|
|
7234
7267
|
/* @__PURE__ */ jsx(Text, { color: C.dimText, children: label })
|
|
7235
7268
|
] });
|
|
7236
7269
|
});
|
|
@@ -7240,6 +7273,7 @@ var ChatPanel = memo(function ChatPanel2({
|
|
|
7240
7273
|
contentWidth,
|
|
7241
7274
|
loading,
|
|
7242
7275
|
spinnerLabel,
|
|
7276
|
+
spinnerFrame,
|
|
7243
7277
|
width,
|
|
7244
7278
|
showScroll,
|
|
7245
7279
|
thumbPos,
|
|
@@ -7290,7 +7324,7 @@ var ChatPanel = memo(function ChatPanel2({
|
|
|
7290
7324
|
lines,
|
|
7291
7325
|
loading && /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
7292
7326
|
/* @__PURE__ */ jsx(Text, { color: C.border, children: "\u2502" }),
|
|
7293
|
-
/* @__PURE__ */ jsx(Box, { width: contentWidth, children: /* @__PURE__ */ jsx(Spinner, { label: clampLine(spinnerLabel, contentWidth - 2) }) }),
|
|
7327
|
+
/* @__PURE__ */ jsx(Box, { width: contentWidth, children: /* @__PURE__ */ jsx(Spinner, { label: clampLine(spinnerLabel, contentWidth - 2), frame: spinnerFrame }) }),
|
|
7294
7328
|
/* @__PURE__ */ jsx(Text, { color: C.border, children: "\u2502" })
|
|
7295
7329
|
] }),
|
|
7296
7330
|
/* @__PURE__ */ jsx(Text, { color: C.primary, children: panelBottom(width) })
|
|
@@ -7311,6 +7345,7 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7311
7345
|
const [messages, setMessages] = useState([]);
|
|
7312
7346
|
const [loading, setLoading] = useState(false);
|
|
7313
7347
|
const [spinnerLabel, setSpinnerLabel] = useState("Thinking...");
|
|
7348
|
+
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
|
7314
7349
|
const [inputTokens, setInputTokens] = useState(0);
|
|
7315
7350
|
const [outputTokens, setOutputTokens] = useState(0);
|
|
7316
7351
|
const [sessionStart] = useState(Date.now());
|
|
@@ -7321,6 +7356,11 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7321
7356
|
const autoScrollRef = useRef(true);
|
|
7322
7357
|
const assistantBufferRef = useRef("");
|
|
7323
7358
|
const flushTimerRef = useRef(null);
|
|
7359
|
+
useEffect(() => {
|
|
7360
|
+
if (!loading) return;
|
|
7361
|
+
const t = setInterval(() => setSpinnerFrame((f) => f + 1), 80);
|
|
7362
|
+
return () => clearInterval(t);
|
|
7363
|
+
}, [loading]);
|
|
7324
7364
|
const inputRef = useRef("");
|
|
7325
7365
|
const [input, setInput] = useState("");
|
|
7326
7366
|
useEffect(() => {
|
|
@@ -7380,6 +7420,7 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7380
7420
|
switch (event.type) {
|
|
7381
7421
|
case "assistant_text": {
|
|
7382
7422
|
assistantBufferRef.current += event.text;
|
|
7423
|
+
setSpinnerLabel("Writing...");
|
|
7383
7424
|
if (!flushTimerRef.current) {
|
|
7384
7425
|
flushTimerRef.current = setTimeout(flushAssistantBuffer, 150);
|
|
7385
7426
|
}
|
|
@@ -7389,6 +7430,9 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7389
7430
|
setSpinnerLabel(`Running ${event.toolName}...`);
|
|
7390
7431
|
setMessages((prev) => [...prev, { id: msgId(), role: "tool", content: "...", toolName: event.toolName }]);
|
|
7391
7432
|
break;
|
|
7433
|
+
case "tool_progress":
|
|
7434
|
+
setSpinnerLabel(`${event.toolName}: ${event.message}`);
|
|
7435
|
+
break;
|
|
7392
7436
|
case "tool_result":
|
|
7393
7437
|
setSpinnerLabel("Thinking...");
|
|
7394
7438
|
setMessages((prev) => {
|
|
@@ -7407,6 +7451,7 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7407
7451
|
});
|
|
7408
7452
|
break;
|
|
7409
7453
|
case "turn_complete":
|
|
7454
|
+
setSpinnerLabel(`Turn ${event.turnNumber} done, thinking...`);
|
|
7410
7455
|
if (flushTimerRef.current) {
|
|
7411
7456
|
clearTimeout(flushTimerRef.current);
|
|
7412
7457
|
flushAssistantBuffer();
|
|
@@ -7417,6 +7462,9 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7417
7462
|
setInputTokens(event.inputTokens);
|
|
7418
7463
|
setOutputTokens(event.outputTokens);
|
|
7419
7464
|
break;
|
|
7465
|
+
case "context_compacted":
|
|
7466
|
+
setSpinnerLabel(`Compacting context (${event.removedCount} msgs)...`);
|
|
7467
|
+
break;
|
|
7420
7468
|
case "loop_complete":
|
|
7421
7469
|
setInputTokens(event.usage.inputTokens);
|
|
7422
7470
|
setOutputTokens(event.usage.outputTokens);
|
|
@@ -7552,6 +7600,7 @@ function InkApp({ model, toolCount, onSubmit, onCancel }) {
|
|
|
7552
7600
|
contentWidth: chatContentWidth,
|
|
7553
7601
|
loading,
|
|
7554
7602
|
spinnerLabel,
|
|
7603
|
+
spinnerFrame,
|
|
7555
7604
|
width: chatWidth,
|
|
7556
7605
|
showScroll,
|
|
7557
7606
|
thumbPos,
|
|
@@ -8468,6 +8517,9 @@ async function runBasicRepl(config) {
|
|
|
8468
8517
|
toolName: event.toolName
|
|
8469
8518
|
});
|
|
8470
8519
|
break;
|
|
8520
|
+
case "tool_progress":
|
|
8521
|
+
process.stdout.write(`\r [${event.toolName}: ${event.message}]`);
|
|
8522
|
+
break;
|
|
8471
8523
|
case "tool_result":
|
|
8472
8524
|
console.log(` [Result: ${event.result.slice(0, 200)}${event.result.length > 200 ? "..." : ""}]`);
|
|
8473
8525
|
await sessionSaver.append({
|
|
@@ -11476,4 +11528,4 @@ export {
|
|
|
11476
11528
|
MCPConnectionManager,
|
|
11477
11529
|
runCli
|
|
11478
11530
|
};
|
|
11479
|
-
//# sourceMappingURL=chunk-
|
|
11531
|
+
//# sourceMappingURL=chunk-4XDWZXBP.js.map
|