@cargo-ai/cli 1.0.126 → 1.0.127
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/build/commands/ask/harness/bridgeOutput.d.ts +19 -0
- package/build/commands/ask/harness/bridgeOutput.d.ts.map +1 -0
- package/build/commands/ask/harness/bridgeOutput.js +42 -0
- package/build/commands/ask/harness/index.d.ts +3 -2
- package/build/commands/ask/harness/index.d.ts.map +1 -1
- package/build/commands/ask/harness/index.js +2 -1
- package/build/commands/ask/harness/turn.d.ts +17 -0
- package/build/commands/ask/harness/turn.d.ts.map +1 -1
- package/build/commands/ask/harness/turn.js +85 -3
- package/build/commands/ask/harness/usage.d.ts +19 -0
- package/build/commands/ask/harness/usage.d.ts.map +1 -1
- package/build/commands/ask/harness/usage.js +46 -0
- package/build/commands/ask/input/completer.d.ts +1 -1
- package/build/commands/ask/input/completer.d.ts.map +1 -1
- package/build/commands/ask/input/completer.js +2 -0
- package/build/commands/ask/input/prompt.d.ts.map +1 -1
- package/build/commands/ask/input/prompt.js +54 -8
- package/build/commands/ask/input/slash.d.ts +7 -1
- package/build/commands/ask/input/slash.d.ts.map +1 -1
- package/build/commands/ask/input/slash.js +10 -0
- package/build/commands/ask/session/index.d.ts +2 -1
- package/build/commands/ask/session/index.d.ts.map +1 -1
- package/build/commands/ask/session/index.js +2 -1
- package/build/commands/ask/session/markdown.d.ts +20 -0
- package/build/commands/ask/session/markdown.d.ts.map +1 -0
- package/build/commands/ask/session/markdown.js +451 -0
- package/build/commands/ask/session/run.d.ts.map +1 -1
- package/build/commands/ask/session/run.js +194 -12
- package/build/commands/ask/session/tree.d.ts +81 -0
- package/build/commands/ask/session/tree.d.ts.map +1 -1
- package/build/commands/ask/session/tree.js +322 -51
- package/build/commands/runHandler.d.ts +1 -0
- package/build/commands/runHandler.d.ts.map +1 -1
- package/build/commands/runHandler.js +6 -3
- package/build/utils/textWidth.d.ts +25 -0
- package/build/utils/textWidth.d.ts.map +1 -0
- package/build/utils/textWidth.js +147 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
4
4
|
import { getConfig } from "../../../config.js";
|
|
5
5
|
import { openPromptInput } from "../../../utils/prompt.js";
|
|
6
6
|
import { ExitCodes, failWith, handleApiCall, outputJson, startSpinner, } from "../../runHandler.js";
|
|
7
|
-
import { createLocalHarness, HarnessTurnStalled, HarnessTurnStuck, isBridgeClosedError, } from "../harness/index.js";
|
|
7
|
+
import { createLocalHarness, creditsForStep, describeBridgeRetry, HarnessTurnStalled, HarnessTurnStuck, interceptBridgeOutput, isBridgeClosedError, } from "../harness/index.js";
|
|
8
8
|
import { readAskLine } from "../input/prompt.js";
|
|
9
9
|
import { parseSlash } from "../input/slash.js";
|
|
10
10
|
import { collectTypeAhead, EMPTY_TYPE_AHEAD, } from "../input/typeAhead.js";
|
|
@@ -13,7 +13,7 @@ import { saveAskState } from "../persist/persist.js";
|
|
|
13
13
|
import { ASK_STATE_VERSION } from "../persist/state.js";
|
|
14
14
|
import { claimChatTurn, proxyTokenDeadlineMs, releaseChatTurn, reportApiFailure, } from "./claim.js";
|
|
15
15
|
import { pickThinkingWord } from "./thinking.js";
|
|
16
|
-
import { appendAssistantDelta, askToolApproval, askUserQuestions, beginAssistantTurn, describeToolActivity, endAssistantTurn, setAssistantFooter, showAssistantTurn, showCard, showNotices, showToolRun, showTouchedFiles, showUserTurn, } from "./tree.js";
|
|
16
|
+
import { appendAssistantDelta, appendReasoningDelta, askToolApproval, askUserQuestions, beginAssistantTurn, beginReasoning, describeToolActivity, endAssistantTurn, endReasoning, REASONING_DISPLAYS, setAssistantFooter, setReasoningFooter, showAssistantTurn, showCard, showNotices, showToolGroup, showToolRun, showTouchedFiles, showTurnStats, showUserTurn, TOOL_DISPLAYS, } from "./tree.js";
|
|
17
17
|
function requireInteractive() {
|
|
18
18
|
if (isInteractive() === false || process.stdout.isTTY !== true) {
|
|
19
19
|
failWith("Ask needs a terminal. Re-run with --print for one JSON turn.", {
|
|
@@ -21,6 +21,11 @@ function requireInteractive() {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Context window of the model local turns run on (`claude-opus-5`, picked by
|
|
26
|
+
* the API when it mints the proxy token), for the share shown after a reply.
|
|
27
|
+
*/
|
|
28
|
+
const CONTEXT_WINDOW_TOKENS = 1_000_000;
|
|
24
29
|
/** Sentinel for `/agent` → Local workspace (no agentUuid). */
|
|
25
30
|
const LOCAL_WORKSPACE = "__local_workspace__";
|
|
26
31
|
async function loadAgent(api, agentUuid) {
|
|
@@ -293,6 +298,26 @@ export async function runAskSession(options) {
|
|
|
293
298
|
const sessionId = uuidv4();
|
|
294
299
|
// "Yes to everything" lasts until the chat is reset, never on disk.
|
|
295
300
|
let approveEveryTool = false;
|
|
301
|
+
// `/tools` and `/reasoning`, for the rest of this process.
|
|
302
|
+
let toolDisplay = "collapsed";
|
|
303
|
+
let reasoningDisplay = "auto-collapsed";
|
|
304
|
+
// Each answers its command with the card to show.
|
|
305
|
+
const setToolDisplay = (value) => {
|
|
306
|
+
const chosen = TOOL_DISPLAYS.find((display) => display === value);
|
|
307
|
+
if (chosen === undefined) {
|
|
308
|
+
return `Tool calls show ${toolDisplay}.\nChange it with /tools ${TOOL_DISPLAYS.join(" | ")}`;
|
|
309
|
+
}
|
|
310
|
+
toolDisplay = chosen;
|
|
311
|
+
return `Tool calls now show ${chosen}.`;
|
|
312
|
+
};
|
|
313
|
+
const setReasoningDisplay = (value) => {
|
|
314
|
+
const chosen = REASONING_DISPLAYS.find((display) => display === value);
|
|
315
|
+
if (chosen === undefined) {
|
|
316
|
+
return `Thinking shows ${reasoningDisplay}.\nChange it with /reasoning ${REASONING_DISPLAYS.join(" | ")}`;
|
|
317
|
+
}
|
|
318
|
+
reasoningDisplay = chosen;
|
|
319
|
+
return `Thinking now shows ${chosen}.`;
|
|
320
|
+
};
|
|
296
321
|
// Typed while the last turn was still answering: a finished line goes
|
|
297
322
|
// straight through as the next question, an unfinished one opens the prompt
|
|
298
323
|
// with it already in place.
|
|
@@ -303,6 +328,17 @@ export async function runAskSession(options) {
|
|
|
303
328
|
if (options.continueChat === true && options.chatUuid !== undefined) {
|
|
304
329
|
chatCreated = await doesChatExist(options.api, options.chatUuid);
|
|
305
330
|
}
|
|
331
|
+
// Claude Code's own stderr, kept off the tree. A retry is worth seeing, so
|
|
332
|
+
// the turn in flight puts it on its spinner; the rest is dropped.
|
|
333
|
+
const bridgeOutput = {
|
|
334
|
+
onRetry: undefined,
|
|
335
|
+
};
|
|
336
|
+
const restoreStderr = interceptBridgeOutput((line) => {
|
|
337
|
+
const retry = describeBridgeRetry(line);
|
|
338
|
+
if (retry !== undefined && bridgeOutput.onRetry !== undefined) {
|
|
339
|
+
bridgeOutput.onRetry(retry);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
306
342
|
try {
|
|
307
343
|
for (;;) {
|
|
308
344
|
const next = await nextQuestion({
|
|
@@ -324,6 +360,12 @@ export async function runAskSession(options) {
|
|
|
324
360
|
showCard(slash.text);
|
|
325
361
|
continue;
|
|
326
362
|
}
|
|
363
|
+
if (slash.kind === "display") {
|
|
364
|
+
showCard(slash.setting === "tools"
|
|
365
|
+
? setToolDisplay(slash.value)
|
|
366
|
+
: setReasoningDisplay(slash.value));
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
327
369
|
if (slash.action === "exit") {
|
|
328
370
|
return "palette";
|
|
329
371
|
}
|
|
@@ -461,6 +503,18 @@ export async function runAskSession(options) {
|
|
|
461
503
|
}
|
|
462
504
|
let spinner;
|
|
463
505
|
let live;
|
|
506
|
+
let reasoning;
|
|
507
|
+
// For the line under the reply. Tool time is taken out of the rate, so
|
|
508
|
+
// a slow test run does not read as a slow model.
|
|
509
|
+
const turnStartedAtMs = Date.now();
|
|
510
|
+
const stats = {
|
|
511
|
+
stepOutputTokens: 0,
|
|
512
|
+
streamOutputTokens: 0,
|
|
513
|
+
credits: 0,
|
|
514
|
+
contextTokens: undefined,
|
|
515
|
+
toolMs: 0,
|
|
516
|
+
toolSinceMs: undefined,
|
|
517
|
+
};
|
|
464
518
|
// A tool interrupting the narration closes the live block, so `live`
|
|
465
519
|
// alone cannot tell whether the turn ever said anything.
|
|
466
520
|
let saidSomething = false;
|
|
@@ -489,6 +543,55 @@ export async function runAskSession(options) {
|
|
|
489
543
|
}
|
|
490
544
|
if (spinner !== undefined) {
|
|
491
545
|
spinner.footer(footer);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (reasoning !== undefined) {
|
|
549
|
+
setReasoningFooter(reasoning, footer);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
// Successful calls of one tool in a row, held back so they print as one
|
|
553
|
+
// line. Anything else that reaches the screen prints them first.
|
|
554
|
+
const toolRun = {
|
|
555
|
+
toolName: "",
|
|
556
|
+
summaries: [],
|
|
557
|
+
};
|
|
558
|
+
const flushToolRun = () => {
|
|
559
|
+
const [only] = toolRun.summaries;
|
|
560
|
+
if (toolRun.summaries.length === 1 && only !== undefined) {
|
|
561
|
+
showToolRun({
|
|
562
|
+
spinner,
|
|
563
|
+
toolName: toolRun.toolName,
|
|
564
|
+
summary: only,
|
|
565
|
+
isError: false,
|
|
566
|
+
output: "",
|
|
567
|
+
display: "collapsed",
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
else if (toolRun.summaries.length > 1) {
|
|
571
|
+
showToolGroup({
|
|
572
|
+
spinner,
|
|
573
|
+
toolName: toolRun.toolName,
|
|
574
|
+
summaries: toolRun.summaries,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
toolRun.summaries = [];
|
|
578
|
+
};
|
|
579
|
+
// Thinking ends when anything else starts: text, a tool, a prompt.
|
|
580
|
+
const closeReasoning = () => {
|
|
581
|
+
if (reasoning !== undefined) {
|
|
582
|
+
endReasoning(reasoning, spinner);
|
|
583
|
+
reasoning = undefined;
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
const trackToolTime = () => {
|
|
587
|
+
const now = Date.now();
|
|
588
|
+
if (activeTools.length > 0 && stats.toolSinceMs === undefined) {
|
|
589
|
+
stats.toolSinceMs = now;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (activeTools.length === 0 && stats.toolSinceMs !== undefined) {
|
|
593
|
+
stats.toolMs += now - stats.toolSinceMs;
|
|
594
|
+
stats.toolSinceMs = undefined;
|
|
492
595
|
}
|
|
493
596
|
};
|
|
494
597
|
const stopSpinner = () => {
|
|
@@ -539,6 +642,7 @@ export async function runAskSession(options) {
|
|
|
539
642
|
else {
|
|
540
643
|
activeTools[at] = tool;
|
|
541
644
|
}
|
|
645
|
+
trackToolTime();
|
|
542
646
|
showActiveToolSpinner();
|
|
543
647
|
};
|
|
544
648
|
const forgetTool = (toolCallId) => {
|
|
@@ -546,6 +650,7 @@ export async function runAskSession(options) {
|
|
|
546
650
|
if (at !== -1) {
|
|
547
651
|
activeTools.splice(at, 1);
|
|
548
652
|
}
|
|
653
|
+
trackToolTime();
|
|
549
654
|
showActiveToolSpinner();
|
|
550
655
|
};
|
|
551
656
|
// Registered before the spinner so our SIGINT handler runs first and
|
|
@@ -562,13 +667,53 @@ export async function runAskSession(options) {
|
|
|
562
667
|
},
|
|
563
668
|
});
|
|
564
669
|
carriedLine = "";
|
|
670
|
+
// Only while a spinner is up: a retry under a streaming reply or an
|
|
671
|
+
// open prompt has nowhere to go that would not break them.
|
|
672
|
+
bridgeOutput.onRetry = (label) => {
|
|
673
|
+
if (spinner !== undefined) {
|
|
674
|
+
spinner.update(label);
|
|
675
|
+
}
|
|
676
|
+
};
|
|
565
677
|
try {
|
|
566
678
|
await harness.streamPrompt(question, {
|
|
567
679
|
abortSignal: cancellation.signal,
|
|
568
680
|
onStall: () => {
|
|
569
681
|
cancellation.abort();
|
|
570
682
|
},
|
|
683
|
+
onReasoningDelta: (delta) => {
|
|
684
|
+
if (reasoningDisplay === "hidden") {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
if (reasoning === undefined) {
|
|
688
|
+
flushToolRun();
|
|
689
|
+
if (live !== undefined) {
|
|
690
|
+
endAssistantTurn(live);
|
|
691
|
+
live = undefined;
|
|
692
|
+
}
|
|
693
|
+
// `collapsed` draws nothing until it ends, so the spinner stays.
|
|
694
|
+
if (reasoningDisplay !== "collapsed") {
|
|
695
|
+
stopSpinner();
|
|
696
|
+
}
|
|
697
|
+
reasoning = beginReasoning(reasoningDisplay);
|
|
698
|
+
paintTyped();
|
|
699
|
+
}
|
|
700
|
+
appendReasoningDelta(reasoning, delta);
|
|
701
|
+
},
|
|
702
|
+
onUsage: (usage) => {
|
|
703
|
+
if (usage.scope === "stream") {
|
|
704
|
+
stats.streamOutputTokens += usage.outputTokens;
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
stats.stepOutputTokens += usage.outputTokens;
|
|
708
|
+
// Billed per call, so priced per call: each rounds up on its own.
|
|
709
|
+
stats.credits += creditsForStep(usage);
|
|
710
|
+
// The last call's prompt plus its answer is what the next one
|
|
711
|
+
// starts from.
|
|
712
|
+
stats.contextTokens = usage.inputTokens + usage.outputTokens;
|
|
713
|
+
},
|
|
571
714
|
onTextDelta: (delta) => {
|
|
715
|
+
flushToolRun();
|
|
716
|
+
closeReasoning();
|
|
572
717
|
if (live === undefined) {
|
|
573
718
|
stopSpinner();
|
|
574
719
|
live = beginAssistantTurn();
|
|
@@ -588,6 +733,16 @@ export async function runAskSession(options) {
|
|
|
588
733
|
// It has no result coming and it never ran, so it is forgotten
|
|
589
734
|
// without a line — the transcript should hold what happened, not
|
|
590
735
|
// what was briefly considered.
|
|
736
|
+
//
|
|
737
|
+
// Every kind closes the live blocks first, not only a start: a
|
|
738
|
+
// finish or a drop brings the spinner back, and a spinner started
|
|
739
|
+
// under painted thinking or text would draw over it and leave the
|
|
740
|
+
// next redraw clearing from the wrong row.
|
|
741
|
+
closeReasoning();
|
|
742
|
+
if (live !== undefined) {
|
|
743
|
+
endAssistantTurn(live);
|
|
744
|
+
live = undefined;
|
|
745
|
+
}
|
|
591
746
|
if (activity.kind === "dropped") {
|
|
592
747
|
forgetTool(activity.toolCallId);
|
|
593
748
|
return;
|
|
@@ -596,19 +751,28 @@ export async function runAskSession(options) {
|
|
|
596
751
|
// Read back before forgetting: only the remembered call knows
|
|
597
752
|
// the input, and `end` carries the name and the outcome alone.
|
|
598
753
|
const finished = activeTools.find((active) => active.toolCallId === activity.toolCallId);
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
toolName
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
754
|
+
const summary = finished === undefined ? "" : finished.summary;
|
|
755
|
+
if (toolDisplay === "collapsed" && activity.isError === false) {
|
|
756
|
+
if (toolRun.toolName !== activity.toolName) {
|
|
757
|
+
flushToolRun();
|
|
758
|
+
toolRun.toolName = activity.toolName;
|
|
759
|
+
}
|
|
760
|
+
toolRun.summaries.push(summary);
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
flushToolRun();
|
|
764
|
+
showToolRun({
|
|
765
|
+
spinner,
|
|
766
|
+
toolName: activity.toolName,
|
|
767
|
+
summary,
|
|
768
|
+
isError: activity.isError,
|
|
769
|
+
output: activity.output,
|
|
770
|
+
display: toolDisplay,
|
|
771
|
+
});
|
|
772
|
+
}
|
|
605
773
|
forgetTool(activity.toolCallId);
|
|
606
774
|
return;
|
|
607
775
|
}
|
|
608
|
-
if (live !== undefined) {
|
|
609
|
-
endAssistantTurn(live);
|
|
610
|
-
live = undefined;
|
|
611
|
-
}
|
|
612
776
|
rememberTool({
|
|
613
777
|
toolCallId: activity.toolCallId,
|
|
614
778
|
toolName: activity.toolName,
|
|
@@ -623,6 +787,8 @@ export async function runAskSession(options) {
|
|
|
623
787
|
},
|
|
624
788
|
onApproval: async (approval) => {
|
|
625
789
|
// Close whatever is on screen: the prompt owns the line next.
|
|
790
|
+
flushToolRun();
|
|
791
|
+
closeReasoning();
|
|
626
792
|
if (live !== undefined) {
|
|
627
793
|
endAssistantTurn(live);
|
|
628
794
|
live = undefined;
|
|
@@ -664,6 +830,8 @@ export async function runAskSession(options) {
|
|
|
664
830
|
return true;
|
|
665
831
|
},
|
|
666
832
|
onUserQuestion: async (input) => {
|
|
833
|
+
flushToolRun();
|
|
834
|
+
closeReasoning();
|
|
667
835
|
if (live !== undefined) {
|
|
668
836
|
endAssistantTurn(live);
|
|
669
837
|
live = undefined;
|
|
@@ -678,6 +846,8 @@ export async function runAskSession(options) {
|
|
|
678
846
|
}
|
|
679
847
|
},
|
|
680
848
|
});
|
|
849
|
+
flushToolRun();
|
|
850
|
+
closeReasoning();
|
|
681
851
|
stopSpinner();
|
|
682
852
|
if (live !== undefined) {
|
|
683
853
|
endAssistantTurn(live);
|
|
@@ -685,10 +855,21 @@ export async function runAskSession(options) {
|
|
|
685
855
|
else if (saidSomething === false) {
|
|
686
856
|
showAssistantTurn("");
|
|
687
857
|
}
|
|
858
|
+
showTurnStats({
|
|
859
|
+
outputTokens: stats.streamOutputTokens > 0
|
|
860
|
+
? stats.streamOutputTokens
|
|
861
|
+
: stats.stepOutputTokens,
|
|
862
|
+
generationMs: Date.now() - turnStartedAtMs - stats.toolMs,
|
|
863
|
+
contextTokens: stats.contextTokens,
|
|
864
|
+
contextWindow: CONTEXT_WINDOW_TOKENS,
|
|
865
|
+
credits: Math.round(stats.credits * 100) / 100,
|
|
866
|
+
});
|
|
688
867
|
showTouchedFiles(touchedFiles, options.dir);
|
|
689
868
|
showNotices(notices);
|
|
690
869
|
}
|
|
691
870
|
catch (error) {
|
|
871
|
+
flushToolRun();
|
|
872
|
+
closeReasoning();
|
|
692
873
|
stopSpinner();
|
|
693
874
|
if (live !== undefined) {
|
|
694
875
|
endAssistantTurn(live);
|
|
@@ -764,6 +945,7 @@ export async function runAskSession(options) {
|
|
|
764
945
|
}
|
|
765
946
|
}
|
|
766
947
|
finally {
|
|
948
|
+
restoreStderr();
|
|
767
949
|
if (harness !== undefined) {
|
|
768
950
|
await harness.close();
|
|
769
951
|
}
|
|
@@ -21,6 +21,22 @@ export declare function showCard(body: string): void;
|
|
|
21
21
|
export declare function showUserTurn(body: string): void;
|
|
22
22
|
export type LiveAssistantTurn = {
|
|
23
23
|
buffer: string;
|
|
24
|
+
/**
|
|
25
|
+
* How much of `buffer` is printed for good. Everything after it is redrawn
|
|
26
|
+
* on each delta, so that a table or a list can settle into shape as it
|
|
27
|
+
* arrives. Only finished paragraphs are committed: a block taller than the
|
|
28
|
+
* screen cannot be redrawn, since the cursor cannot move above the top row.
|
|
29
|
+
*/
|
|
30
|
+
committed: number;
|
|
31
|
+
/**
|
|
32
|
+
* Rows of the unfinished part already printed for good, because it grew
|
|
33
|
+
* taller than the screen. Skipped when that part is drawn again.
|
|
34
|
+
*/
|
|
35
|
+
tailLinesCommitted: number;
|
|
36
|
+
/** Whether the unfinished part opens with a blank row, after earlier ones. */
|
|
37
|
+
tailHasGap: boolean;
|
|
38
|
+
/** Whether the `■` is among the lines printed for good. */
|
|
39
|
+
markerCommitted: boolean;
|
|
24
40
|
paintedLines: number;
|
|
25
41
|
/**
|
|
26
42
|
* The question being typed while this reply streams, drawn under it.
|
|
@@ -43,6 +59,55 @@ export declare function endAssistantTurn(live: LiveAssistantTurn): void;
|
|
|
43
59
|
* Finished assistant turn — same tree as a user step, with `■` instead of `◇`.
|
|
44
60
|
*/
|
|
45
61
|
export declare function showAssistantTurn(body: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* How Claude Code's thinking is drawn, the same choices `@ai-sdk/tui` offers:
|
|
64
|
+
*
|
|
65
|
+
* - `full`: the whole summary stays in the transcript.
|
|
66
|
+
* - `auto-collapsed`: the latest lines show while it thinks, then fold into
|
|
67
|
+
* one "Thought for 4s" line once it moves on.
|
|
68
|
+
* - `collapsed`: only that one line.
|
|
69
|
+
* - `hidden`: nothing beyond the spinner.
|
|
70
|
+
*/
|
|
71
|
+
export declare const REASONING_DISPLAYS: readonly ["full", "auto-collapsed", "collapsed", "hidden"];
|
|
72
|
+
export type ReasoningDisplay = (typeof REASONING_DISPLAYS)[number];
|
|
73
|
+
/**
|
|
74
|
+
* How finished tool calls are drawn: `full` adds the start of each result
|
|
75
|
+
* under its line, `collapsed` keeps one line per call (and the first line of
|
|
76
|
+
* an error), `hidden` leaves only the spinner while they run.
|
|
77
|
+
*/
|
|
78
|
+
export declare const TOOL_DISPLAYS: readonly ["full", "collapsed", "hidden"];
|
|
79
|
+
export type ToolDisplay = (typeof TOOL_DISPLAYS)[number];
|
|
80
|
+
export type LiveReasoning = {
|
|
81
|
+
buffer: string;
|
|
82
|
+
display: ReasoningDisplay;
|
|
83
|
+
startedAtMs: number;
|
|
84
|
+
paintedLines: number;
|
|
85
|
+
/** The question being typed, as on `LiveAssistantTurn`. */
|
|
86
|
+
footer: string;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Open a thinking block. Only the expanded displays draw while it streams;
|
|
90
|
+
* `collapsed` leaves the spinner up and adds its one line at the end.
|
|
91
|
+
*/
|
|
92
|
+
export declare function beginReasoning(display: ReasoningDisplay): LiveReasoning;
|
|
93
|
+
export declare function appendReasoningDelta(live: LiveReasoning, delta: string): void;
|
|
94
|
+
export declare function setReasoningFooter(live: LiveReasoning, footer: string): void;
|
|
95
|
+
/** Close the block, leaving what its display keeps in the transcript. */
|
|
96
|
+
export declare function endReasoning(live: LiveReasoning, spinner: Spinner | undefined): void;
|
|
97
|
+
/**
|
|
98
|
+
* What a turn cost, under the reply: tokens written, how fast they came, how
|
|
99
|
+
* full the context window is, and the credits it was billed.
|
|
100
|
+
*
|
|
101
|
+
* │ 2.4k tokens written · 38 tok/s · 92k of 1M context (9%) · 6.10 credits
|
|
102
|
+
*/
|
|
103
|
+
export declare function showTurnStats(stats: {
|
|
104
|
+
outputTokens: number;
|
|
105
|
+
generationMs: number;
|
|
106
|
+
contextTokens: number | undefined;
|
|
107
|
+
contextWindow: number;
|
|
108
|
+
/** Credits the proxy billed for the turn's model calls. */
|
|
109
|
+
credits: number;
|
|
110
|
+
}): void;
|
|
46
111
|
export declare function describeToolActivity(toolName: string, summary: string): string;
|
|
47
112
|
/**
|
|
48
113
|
* A tool that has finished, left in the transcript.
|
|
@@ -61,6 +126,22 @@ export declare function showToolRun(input: {
|
|
|
61
126
|
toolName: string;
|
|
62
127
|
summary: string;
|
|
63
128
|
isError: boolean;
|
|
129
|
+
output: string;
|
|
130
|
+
display: ToolDisplay;
|
|
131
|
+
}): void;
|
|
132
|
+
/**
|
|
133
|
+
* Several calls of one tool that finished in a row, as one line:
|
|
134
|
+
*
|
|
135
|
+
* ⏺ Read 6 files: run.ts, tree.ts, markdown.ts, …
|
|
136
|
+
*
|
|
137
|
+
* Six `Read` lines say less than this one, and push the reply off screen.
|
|
138
|
+
* Only for successful calls under `collapsed`: a failure keeps its own line
|
|
139
|
+
* and its error, and `full` shows each result.
|
|
140
|
+
*/
|
|
141
|
+
export declare function showToolGroup(input: {
|
|
142
|
+
spinner: Spinner | undefined;
|
|
143
|
+
toolName: string;
|
|
144
|
+
summaries: readonly string[];
|
|
64
145
|
}): void;
|
|
65
146
|
/**
|
|
66
147
|
* A path inside the session directory reads better relative to it; anything
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../src/commands/ask/session/tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../src/commands/ask/session/tree.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AA8B5D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAe9D;AA+CD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAA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