@cargo-ai/cli 1.0.94 → 1.0.95

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.
Files changed (120) hide show
  1. package/build/commands/ai/chat.d.ts.map +1 -1
  2. package/build/commands/ai/chat.js +2 -1
  3. package/build/commands/ai/message.d.ts.map +1 -1
  4. package/build/commands/ai/message.js +2 -1
  5. package/build/commands/ai/release.d.ts.map +1 -1
  6. package/build/commands/ai/release.js +7 -6
  7. package/build/commands/ask/harness/approvals.d.ts +7 -0
  8. package/build/commands/ask/harness/approvals.d.ts.map +1 -0
  9. package/build/commands/ask/harness/approvals.js +82 -0
  10. package/build/commands/ask/harness/artifacts.d.ts.map +1 -0
  11. package/build/commands/ask/harness/claudeConfig.d.ts.map +1 -0
  12. package/build/commands/ask/harness/create.d.ts +59 -0
  13. package/build/commands/ask/harness/create.d.ts.map +1 -0
  14. package/build/commands/ask/harness/create.js +292 -0
  15. package/build/commands/ask/harness/index.d.ts +8 -0
  16. package/build/commands/ask/harness/index.d.ts.map +1 -0
  17. package/build/commands/ask/harness/index.js +7 -0
  18. package/build/commands/ask/harness/ingest.d.ts +25 -0
  19. package/build/commands/ask/harness/ingest.d.ts.map +1 -0
  20. package/build/commands/ask/harness/ingest.js +35 -0
  21. package/build/commands/ask/harness/instructions.d.ts +13 -0
  22. package/build/commands/ask/harness/instructions.d.ts.map +1 -0
  23. package/build/commands/ask/harness/instructions.js +41 -0
  24. package/build/commands/ask/harness/layout.d.ts +23 -0
  25. package/build/commands/ask/harness/layout.d.ts.map +1 -0
  26. package/build/commands/ask/harness/layout.js +32 -0
  27. package/build/commands/ask/harness/mcp.d.ts +25 -0
  28. package/build/commands/ask/harness/mcp.d.ts.map +1 -0
  29. package/build/commands/ask/harness/mcp.js +72 -0
  30. package/build/commands/ask/harness/pnpmShim.d.ts.map +1 -0
  31. package/build/commands/ask/harness/release.d.ts +18 -0
  32. package/build/commands/ask/harness/release.d.ts.map +1 -0
  33. package/build/commands/ask/harness/release.js +117 -0
  34. package/build/commands/ask/harness/sandbox.d.ts +9 -0
  35. package/build/commands/ask/harness/sandbox.d.ts.map +1 -0
  36. package/build/commands/ask/harness/sandbox.js +27 -0
  37. package/build/commands/ask/harness/timing.d.ts +16 -0
  38. package/build/commands/ask/harness/timing.d.ts.map +1 -0
  39. package/build/commands/ask/harness/timing.js +72 -0
  40. package/build/commands/ask/harness/turn.d.ts +145 -0
  41. package/build/commands/ask/harness/turn.d.ts.map +1 -0
  42. package/build/commands/ask/harness/turn.js +626 -0
  43. package/build/commands/ask/harness/usage.d.ts +50 -0
  44. package/build/commands/ask/harness/usage.d.ts.map +1 -0
  45. package/build/commands/ask/harness/usage.js +87 -0
  46. package/build/commands/ask/index.d.ts +9 -0
  47. package/build/commands/ask/index.d.ts.map +1 -1
  48. package/build/commands/ask/index.js +7 -7
  49. package/build/commands/ask/input/completer.d.ts.map +1 -0
  50. package/build/commands/ask/input/index.d.ts +5 -0
  51. package/build/commands/ask/input/index.d.ts.map +1 -0
  52. package/build/commands/ask/input/index.js +4 -0
  53. package/build/commands/ask/input/prompt.d.ts.map +1 -0
  54. package/build/commands/ask/{prompt.js → input/prompt.js} +1 -1
  55. package/build/commands/ask/input/slash.d.ts.map +1 -0
  56. package/build/commands/ask/{slash.js → input/slash.js} +1 -1
  57. package/build/commands/ask/input/typeAhead.d.ts.map +1 -0
  58. package/build/commands/ask/{history.d.ts → persist/history.d.ts} +1 -1
  59. package/build/commands/ask/persist/history.d.ts.map +1 -0
  60. package/build/commands/ask/persist/index.d.ts +4 -0
  61. package/build/commands/ask/persist/index.d.ts.map +1 -0
  62. package/build/commands/ask/persist/index.js +3 -0
  63. package/build/commands/ask/persist/persist.d.ts.map +1 -0
  64. package/build/commands/ask/persist/state.d.ts.map +1 -0
  65. package/build/commands/ask/session/claim.d.ts +56 -0
  66. package/build/commands/ask/session/claim.d.ts.map +1 -0
  67. package/build/commands/ask/session/claim.js +76 -0
  68. package/build/commands/ask/session/index.d.ts +5 -0
  69. package/build/commands/ask/session/index.d.ts.map +1 -0
  70. package/build/commands/ask/session/index.js +4 -0
  71. package/build/commands/ask/session/run.d.ts +36 -0
  72. package/build/commands/ask/session/run.d.ts.map +1 -0
  73. package/build/commands/ask/session/run.js +832 -0
  74. package/build/commands/ask/session/thinking.d.ts.map +1 -0
  75. package/build/commands/ask/session/tree.d.ts +90 -0
  76. package/build/commands/ask/session/tree.d.ts.map +1 -0
  77. package/build/commands/ask/session/tree.js +318 -0
  78. package/package.json +6 -5
  79. package/build/commands/ask/artifacts.d.ts.map +0 -1
  80. package/build/commands/ask/binding.d.ts +0 -13
  81. package/build/commands/ask/binding.d.ts.map +0 -1
  82. package/build/commands/ask/binding.js +0 -19
  83. package/build/commands/ask/claudeConfig.d.ts.map +0 -1
  84. package/build/commands/ask/completer.d.ts.map +0 -1
  85. package/build/commands/ask/history.d.ts.map +0 -1
  86. package/build/commands/ask/localHarness.d.ts +0 -278
  87. package/build/commands/ask/localHarness.d.ts.map +0 -1
  88. package/build/commands/ask/localHarness.js +0 -1300
  89. package/build/commands/ask/messageStream.d.ts +0 -33
  90. package/build/commands/ask/messageStream.d.ts.map +0 -1
  91. package/build/commands/ask/messageStream.js +0 -114
  92. package/build/commands/ask/persist.d.ts.map +0 -1
  93. package/build/commands/ask/pnpmShim.d.ts.map +0 -1
  94. package/build/commands/ask/prompt.d.ts.map +0 -1
  95. package/build/commands/ask/session.d.ts +0 -101
  96. package/build/commands/ask/session.d.ts.map +0 -1
  97. package/build/commands/ask/session.js +0 -1328
  98. package/build/commands/ask/slash.d.ts.map +0 -1
  99. package/build/commands/ask/state.d.ts.map +0 -1
  100. package/build/commands/ask/thinking.d.ts.map +0 -1
  101. package/build/commands/ask/typeAhead.d.ts.map +0 -1
  102. /package/build/commands/ask/{artifacts.d.ts → harness/artifacts.d.ts} +0 -0
  103. /package/build/commands/ask/{artifacts.js → harness/artifacts.js} +0 -0
  104. /package/build/commands/ask/{claudeConfig.d.ts → harness/claudeConfig.d.ts} +0 -0
  105. /package/build/commands/ask/{claudeConfig.js → harness/claudeConfig.js} +0 -0
  106. /package/build/commands/ask/{pnpmShim.d.ts → harness/pnpmShim.d.ts} +0 -0
  107. /package/build/commands/ask/{pnpmShim.js → harness/pnpmShim.js} +0 -0
  108. /package/build/commands/ask/{completer.d.ts → input/completer.d.ts} +0 -0
  109. /package/build/commands/ask/{completer.js → input/completer.js} +0 -0
  110. /package/build/commands/ask/{prompt.d.ts → input/prompt.d.ts} +0 -0
  111. /package/build/commands/ask/{slash.d.ts → input/slash.d.ts} +0 -0
  112. /package/build/commands/ask/{typeAhead.d.ts → input/typeAhead.d.ts} +0 -0
  113. /package/build/commands/ask/{typeAhead.js → input/typeAhead.js} +0 -0
  114. /package/build/commands/ask/{history.js → persist/history.js} +0 -0
  115. /package/build/commands/ask/{persist.d.ts → persist/persist.d.ts} +0 -0
  116. /package/build/commands/ask/{persist.js → persist/persist.js} +0 -0
  117. /package/build/commands/ask/{state.d.ts → persist/state.d.ts} +0 -0
  118. /package/build/commands/ask/{state.js → persist/state.js} +0 -0
  119. /package/build/commands/ask/{thinking.d.ts → session/thinking.d.ts} +0 -0
  120. /package/build/commands/ask/{thinking.js → session/thinking.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinking.d.ts","sourceRoot":"","sources":["../../../../src/commands/ask/session/thinking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAyB/C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAc1D"}
@@ -0,0 +1,90 @@
1
+ import { type Spinner } from "../../runHandler.js";
2
+ import type { LocalToolApproval } from "../harness/index.js";
3
+ /**
4
+ * Greedy wrap on spaces. A word longer than the width keeps its own line
5
+ * rather than being cut mid-token.
6
+ *
7
+ * Exported for tests.
8
+ */
9
+ export declare function wrapLine(text: string, width: number): string[];
10
+ export declare function showStep(label: string, body: string): void;
11
+ /**
12
+ * Slash help / notes — finished step like the palette:
13
+ * ◇ /help
14
+ * │ …
15
+ */
16
+ export declare function showCard(body: string): void;
17
+ /**
18
+ * Finished user turn — message on the diamond, like the palette's
19
+ * `◇ ask hey --continue`. No "You" label.
20
+ */
21
+ export declare function showUserTurn(body: string): void;
22
+ export type LiveAssistantTurn = {
23
+ buffer: string;
24
+ paintedLines: number;
25
+ /**
26
+ * The question being typed while this reply streams, drawn under it.
27
+ *
28
+ * It cannot live on the spinner: the first text delta stops the spinner and
29
+ * opens this block, and raw mode means the terminal is not echoing. Without
30
+ * it here, the one moment type-ahead is most obviously in use — typing over
31
+ * a reply as it arrives — is the one moment nothing appears on screen.
32
+ */
33
+ footer: string;
34
+ };
35
+ /** Rail gap, then an empty marker line ready for deltas. */
36
+ export declare function beginAssistantTurn(): LiveAssistantTurn;
37
+ export declare function appendAssistantDelta(live: LiveAssistantTurn, delta: string): void;
38
+ /** Show, change or remove the question being typed over this reply. */
39
+ export declare function setAssistantFooter(live: LiveAssistantTurn, footer: string): void;
40
+ /** Trailing rail gap before the next user turn / ◆ prompt. */
41
+ export declare function endAssistantTurn(live: LiveAssistantTurn): void;
42
+ /**
43
+ * Finished assistant turn — same tree as a user step, with `■` instead of `◇`.
44
+ */
45
+ export declare function showAssistantTurn(body: string): void;
46
+ export declare function describeToolActivity(toolName: string, summary: string): string;
47
+ /**
48
+ * A tool that has finished, left in the transcript.
49
+ *
50
+ * The spinner shows what is running, but it is one line that is overwritten
51
+ * and then cleared, so once a turn is over there is no record of what it did —
52
+ * only the prose describing it. A turn that read four files and ran two
53
+ * commands should say so afterwards, the way the approval prompt does for the
54
+ * tools it happened to ask about.
55
+ *
56
+ * Written through the spinner's `log` when one is up, which wipes the spinner
57
+ * line, leaves this behind, and lets the next frame redraw underneath.
58
+ */
59
+ export declare function showToolRun(input: {
60
+ spinner: Spinner | undefined;
61
+ toolName: string;
62
+ summary: string;
63
+ isError: boolean;
64
+ }): void;
65
+ /**
66
+ * A path inside the session directory reads better relative to it; anything
67
+ * outside stays absolute so it is obvious the turn left the project.
68
+ *
69
+ * Exported for tests.
70
+ */
71
+ export declare function displayPath(path: string, dir: string): string;
72
+ /**
73
+ * Closing step for a turn that edited the working copy, so a reply that says
74
+ * "done" is backed by the list of files it touched.
75
+ */
76
+ export declare function showTouchedFiles(paths: ReadonlySet<string>, dir: string): void;
77
+ /**
78
+ * Side notes from a turn — a chat-history save that failed, say. They are not
79
+ * part of the reply, so they land after it rather than inside it.
80
+ */
81
+ export declare function showNotices(notices: string[]): void;
82
+ /**
83
+ * Local Claude Code runs against the user's own working copy, so anything
84
+ * beyond a read is confirmed before it happens:
85
+ *
86
+ * ◆ Run Bash: npm test?
87
+ * │ ● Yes …
88
+ */
89
+ export declare function askToolApproval(approval: LocalToolApproval): Promise<"yes" | "always" | "no">;
90
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../../src/commands/ask/session/tree.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA6B7D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAe9D;AA0DD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAM1D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAK3C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA+DF,4DAA4D;AAC5D,wBAAgB,kBAAkB,IAAI,iBAAiB,CAItD;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,GACZ,IAAI,CAeN;AAkBD,uEAAuE;AACvE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,MAAM,GACb,IAAI,CAON;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAK9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIpD;AAaD,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,MAAM,CAYR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,IAAI,CAYP;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,GAAG,EAAE,MAAM,GACV,IAAI,CAWN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAQnD;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,iBAAiB,GAC1B,OAAO,CAAC,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,CAkBlC"}
@@ -0,0 +1,318 @@
1
+ import { isAbsolute, relative } from "node:path";
2
+ import { selectOne } from "@cargo-ai/cdk/cli";
3
+ import { clipToWidth, colors } from "../../runHandler.js";
4
+ /**
5
+ * What an assistant turn is marked with, alongside `◇` for a step and `│` for
6
+ * the rail.
7
+ *
8
+ * A text glyph rather than an emoji, so it takes the same `marker + two
9
+ * spaces` as every other row and the whole tree stays on one left edge. An
10
+ * emoji is two columns wide and needs its own spacing rule to line up, which
11
+ * is one more thing to get wrong every time a line is drawn.
12
+ */
13
+ const ASSISTANT_MARKER = "■";
14
+ /** Completed tool call, so the transcript keeps what was actually run. */
15
+ const TOOL_MARKER = "⏺";
16
+ /**
17
+ * Body width under `◇ ` / `│ ` / `◆ `. Soft wrap without this drops the
18
+ * rail mid-line and the tree looks broken.
19
+ */
20
+ function treeBodyWidth() {
21
+ const columns = process.stderr.columns === undefined ? 80 : process.stderr.columns;
22
+ // Marker + two spaces (`◇ `, `│ `, `◆ `), and one column of margin: a
23
+ // line filling the last cell makes some terminals wrap on their own, and the
24
+ // `\n` after it then lands a row further down than the tree expects.
25
+ return Math.max(24, columns - 4);
26
+ }
27
+ /**
28
+ * Greedy wrap on spaces. A word longer than the width keeps its own line
29
+ * rather than being cut mid-token.
30
+ *
31
+ * Exported for tests.
32
+ */
33
+ export function wrapLine(text, width) {
34
+ const lines = [];
35
+ for (const word of text.split(/\s+/).filter((part) => part.length > 0)) {
36
+ const current = lines[lines.length - 1];
37
+ if (current === undefined || `${current} ${word}`.length > width) {
38
+ lines.push(word);
39
+ continue;
40
+ }
41
+ lines[lines.length - 1] = `${current} ${word}`;
42
+ }
43
+ return lines;
44
+ }
45
+ /** One line under the current ◆/◇, with the │ rail (same indent as clack). */
46
+ function writeRail(body) {
47
+ process.stderr.write(`${colors.dim("│")} ${body}\n`);
48
+ }
49
+ /** Word-wrap onto the │ rail so the terminal never soft-wraps mid-line. */
50
+ function writeRailWrapped(body) {
51
+ // Keep the rail on blank paragraphs so the tree does not break mid-reply.
52
+ if (body === "") {
53
+ writeRail("");
54
+ return;
55
+ }
56
+ const lines = wrapLine(body, treeBodyWidth());
57
+ if (lines.length === 0) {
58
+ writeRail("");
59
+ return;
60
+ }
61
+ for (const line of lines) {
62
+ writeRail(line);
63
+ }
64
+ }
65
+ /**
66
+ * Light cleanup so model markdown does not fight the tree. Keeps the words;
67
+ * drops heading marks, bold markers, and horizontal rules.
68
+ */
69
+ function forTerminal(text) {
70
+ return text
71
+ .replace(/^#{1,6}\s+/gm, "")
72
+ .replace(/\*\*([^*]+)\*\*/g, "$1")
73
+ .replace(/^---+$/gm, "");
74
+ }
75
+ /**
76
+ * A `◇` step: the first line beside the marker, the rest continuing on the
77
+ * rail under it.
78
+ *
79
+ * Wrapped here rather than left to the terminal. A label long enough to reach
80
+ * the edge — a stall notice, an API error — soft-wraps mid-word and starts its
81
+ * next line at column zero, outside the tree, which is how a one-sentence
82
+ * notice ends up looking like the output is corrupted.
83
+ */
84
+ function writeDiamondBlock(body) {
85
+ const lines = body === "" ? [""] : wrapLine(body, treeBodyWidth());
86
+ const first = lines[0] === undefined ? "" : lines[0];
87
+ process.stderr.write(`${colors.dim("◇")} ${first}\n`);
88
+ for (const line of lines.slice(1)) {
89
+ writeRail(line);
90
+ }
91
+ }
92
+ export function showStep(label, body) {
93
+ writeDiamondBlock(label);
94
+ for (const paragraph of body.split("\n")) {
95
+ writeRailWrapped(paragraph);
96
+ }
97
+ }
98
+ /**
99
+ * Slash help / notes — finished step like the palette:
100
+ * ◇ /help
101
+ * │ …
102
+ */
103
+ export function showCard(body) {
104
+ const paragraphs = body.split("\n");
105
+ const title = paragraphs[0] === undefined ? "" : paragraphs[0];
106
+ const rest = paragraphs.slice(1).join("\n");
107
+ showStep(title, rest);
108
+ }
109
+ /**
110
+ * Finished user turn — message on the diamond, like the palette's
111
+ * `◇ ask hey --continue`. No "You" label.
112
+ */
113
+ export function showUserTurn(body) {
114
+ writeDiamondBlock(body);
115
+ }
116
+ /**
117
+ * Display lines for an assistant body. First line is the brick header body;
118
+ * later lines sit on the │ rail. Blank paragraphs keep an empty rail.
119
+ */
120
+ function assistantDisplayLines(body) {
121
+ const paragraphs = forTerminal(body).split("\n");
122
+ const lines = [];
123
+ for (let index = 0; index < paragraphs.length; index += 1) {
124
+ const paragraph = paragraphs[index];
125
+ if (paragraph === undefined) {
126
+ continue;
127
+ }
128
+ if (paragraph === "") {
129
+ lines.push("");
130
+ continue;
131
+ }
132
+ const wrapped = wrapLine(paragraph, treeBodyWidth());
133
+ if (wrapped.length === 0) {
134
+ lines.push("");
135
+ continue;
136
+ }
137
+ for (const line of wrapped) {
138
+ lines.push(line);
139
+ }
140
+ }
141
+ if (lines.length === 0) {
142
+ return [""];
143
+ }
144
+ return lines;
145
+ }
146
+ function writeAssistantLines(lines) {
147
+ const first = lines[0] === undefined ? "" : lines[0];
148
+ process.stderr.write(`${ASSISTANT_MARKER} ${first}\n`);
149
+ for (let index = 1; index < lines.length; index += 1) {
150
+ const line = lines[index];
151
+ if (line !== undefined) {
152
+ writeRail(line);
153
+ }
154
+ }
155
+ }
156
+ function clearPaintedLines(count) {
157
+ if (count <= 0 || process.stderr.isTTY !== true) {
158
+ return;
159
+ }
160
+ process.stderr.write(`\x1B[${String(count)}A\r\x1B[J`);
161
+ }
162
+ /** Rail gap, then an empty marker line ready for deltas. */
163
+ export function beginAssistantTurn() {
164
+ writeRail("");
165
+ process.stderr.write(`${ASSISTANT_MARKER} \n`);
166
+ return { buffer: "", paintedLines: 1, footer: "" };
167
+ }
168
+ export function appendAssistantDelta(live, delta) {
169
+ // A tool between two pieces of narration inserts a paragraph break, so that
170
+ // "Let me look." and what it found do not run together. When the tool also
171
+ // closed the block on screen, that break arrives as the first thing in the
172
+ // *next* block — and renders as an empty rail line under the marker before a
173
+ // word has been said. Kept in the stored answer, where the paragraphs still
174
+ // belong; dropped here, where the block itself is already the separation.
175
+ const text = live.buffer === "" ? delta.replace(/^\n+/, "") : delta;
176
+ if (text === "") {
177
+ return;
178
+ }
179
+ live.buffer += text;
180
+ repaintAssistantTurn(live);
181
+ }
182
+ /** Draw the block again from its buffer, with the typed line under it. */
183
+ function repaintAssistantTurn(live) {
184
+ const lines = assistantDisplayLines(live.buffer);
185
+ clearPaintedLines(live.paintedLines);
186
+ writeAssistantLines(lines);
187
+ live.paintedLines = lines.length;
188
+ if (live.footer !== "") {
189
+ // Clipped for the same reason the spinner's is: it has to occupy exactly
190
+ // one row, or the next repaint clears from the wrong line.
191
+ process.stderr.write(`${colors.dim(clipToWidth(live.footer))}\n`);
192
+ live.paintedLines += 1;
193
+ }
194
+ }
195
+ /** Show, change or remove the question being typed over this reply. */
196
+ export function setAssistantFooter(live, footer) {
197
+ if (live.footer === footer) {
198
+ return;
199
+ }
200
+ live.footer = footer;
201
+ repaintAssistantTurn(live);
202
+ }
203
+ /** Trailing rail gap before the next user turn / ◆ prompt. */
204
+ export function endAssistantTurn(live) {
205
+ // The typed line belongs to whatever draws next — the spinner, or the block
206
+ // after this one. Left here it would be printed twice.
207
+ setAssistantFooter(live, "");
208
+ writeRail("");
209
+ }
210
+ /**
211
+ * Finished assistant turn — same tree as a user step, with `■` instead of `◇`.
212
+ */
213
+ export function showAssistantTurn(body) {
214
+ const live = beginAssistantTurn();
215
+ appendAssistantDelta(live, body);
216
+ endAssistantTurn(live);
217
+ }
218
+ /** Common tool names arrive lowercase (`bash`); natives keep their case. */
219
+ function toolLabel(toolName) {
220
+ if (toolName.length === 0) {
221
+ return "tool";
222
+ }
223
+ return `${toolName.slice(0, 1).toUpperCase()}${toolName.slice(1)}`;
224
+ }
225
+ const ACTIVITY_MAX_LENGTH = 72;
226
+ export function describeToolActivity(toolName, summary) {
227
+ const label = toolLabel(toolName);
228
+ if (summary === "") {
229
+ return label;
230
+ }
231
+ const line = `${label}: ${summary}`;
232
+ return line.length > ACTIVITY_MAX_LENGTH
233
+ ? `${line.slice(0, ACTIVITY_MAX_LENGTH - 1)}…`
234
+ : line;
235
+ }
236
+ /**
237
+ * A tool that has finished, left in the transcript.
238
+ *
239
+ * The spinner shows what is running, but it is one line that is overwritten
240
+ * and then cleared, so once a turn is over there is no record of what it did —
241
+ * only the prose describing it. A turn that read four files and ran two
242
+ * commands should say so afterwards, the way the approval prompt does for the
243
+ * tools it happened to ask about.
244
+ *
245
+ * Written through the spinner's `log` when one is up, which wipes the spinner
246
+ * line, leaves this behind, and lets the next frame redraw underneath.
247
+ */
248
+ export function showToolRun(input) {
249
+ const marker = input.isError === true ? colors.red("✗") : colors.dim(TOOL_MARKER);
250
+ const label = describeToolActivity(input.toolName, input.summary);
251
+ const line = `${marker} ${colors.dim(label)}`;
252
+ if (input.spinner !== undefined) {
253
+ input.spinner.log(line);
254
+ return;
255
+ }
256
+ process.stderr.write(`${line}\n`);
257
+ }
258
+ /**
259
+ * A path inside the session directory reads better relative to it; anything
260
+ * outside stays absolute so it is obvious the turn left the project.
261
+ *
262
+ * Exported for tests.
263
+ */
264
+ export function displayPath(path, dir) {
265
+ const relativePath = relative(dir, path);
266
+ return relativePath === "" ||
267
+ relativePath.startsWith("..") === true ||
268
+ isAbsolute(relativePath) === true
269
+ ? path
270
+ : relativePath;
271
+ }
272
+ /**
273
+ * Closing step for a turn that edited the working copy, so a reply that says
274
+ * "done" is backed by the list of files it touched.
275
+ */
276
+ export function showTouchedFiles(paths, dir) {
277
+ if (paths.size === 0) {
278
+ return;
279
+ }
280
+ const listed = [...paths].map((path) => displayPath(path, dir)).sort();
281
+ showStep(`${String(listed.length)} file${listed.length === 1 ? "" : "s"} changed`, listed.join("\n"));
282
+ }
283
+ /**
284
+ * Side notes from a turn — a chat-history save that failed, say. They are not
285
+ * part of the reply, so they land after it rather than inside it.
286
+ */
287
+ export function showNotices(notices) {
288
+ while (notices.length > 0) {
289
+ const notice = notices.shift();
290
+ if (notice !== undefined) {
291
+ showCard(notice);
292
+ }
293
+ }
294
+ }
295
+ /**
296
+ * Local Claude Code runs against the user's own working copy, so anything
297
+ * beyond a read is confirmed before it happens:
298
+ *
299
+ * ◆ Run Bash: npm test?
300
+ * │ ● Yes …
301
+ */
302
+ export async function askToolApproval(approval) {
303
+ const decision = await selectOne({
304
+ message: approval.summary === ""
305
+ ? `Run ${approval.toolName}?`
306
+ : `Run ${approval.toolName}: ${approval.summary}?`,
307
+ recommended: "yes",
308
+ // Escape here means "not that tool", not "leave the chat" — the turn
309
+ // continues and the model reports what it could not do.
310
+ cancelValue: "no",
311
+ choices: [
312
+ { value: "yes", label: "Yes", hint: "just this once" },
313
+ { value: "always", label: "Yes to everything", hint: "for this chat" },
314
+ { value: "no", label: "No", hint: "tell the model to skip it" },
315
+ ],
316
+ });
317
+ return decision === "always" ? "always" : decision === "no" ? "no" : "yes";
318
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://getcargo.ai",
@@ -67,10 +67,10 @@
67
67
  "dependencies": {
68
68
  "@ai-sdk/harness": "^1.0.95",
69
69
  "@ai-sdk/harness-claude-code": "^1.0.99",
70
- "@cargo-ai/api": "^1.0.81",
70
+ "@cargo-ai/api": "^1.0.83",
71
71
  "@cargo-ai/app-sdk": "^1.0.10",
72
- "@cargo-ai/cdk": "^1.0.80",
73
- "@cargo-ai/types": "^1.0.78",
72
+ "@cargo-ai/cdk": "^1.0.81",
73
+ "@cargo-ai/types": "^1.0.79",
74
74
  "@cargo-ai/utils": "^1.0.30",
75
75
  "@cargo-ai/worker-sdk": "^1.0.17",
76
76
  "@modelcontextprotocol/sdk": "1.29.0",
@@ -78,7 +78,8 @@
78
78
  "ai-sdk-sandbox-local": "^0.1.2",
79
79
  "commander": "^12.1.0",
80
80
  "tsx": "^4.19.2",
81
- "undici": "^7.29.0"
81
+ "undici": "^7.29.0",
82
+ "uuid": "^14.0.0"
82
83
  },
83
84
  "devDependencies": {
84
85
  "@cargo-ai/eslint-config": "*",
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/ask/artifacts.ts"],"names":[],"mappings":"AAwBA,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,IAAI,CAGzE"}
@@ -1,13 +0,0 @@
1
- type RepositoryLike = {
2
- connectorUuid?: string;
3
- repository?: string;
4
- } | null | undefined;
5
- /**
6
- * A usable GitHub workspace: connector + owner/name. Matches
7
- * parseHarnessBinding's required fields, without decrypting env.
8
- *
9
- * Exported for tests.
10
- */
11
- export declare function isBoundRepository(repository: RepositoryLike): boolean;
12
- export {};
13
- //# sourceMappingURL=binding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../src/commands/ask/binding.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GACf;IACE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD,IAAI,GACJ,SAAS,CAAC;AAEd;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAgBrE"}
@@ -1,19 +0,0 @@
1
- /**
2
- * A usable GitHub workspace: connector + owner/name. Matches
3
- * parseHarnessBinding's required fields, without decrypting env.
4
- *
5
- * Exported for tests.
6
- */
7
- export function isBoundRepository(repository) {
8
- if (repository === undefined || repository === null) {
9
- return false;
10
- }
11
- if (repository.connectorUuid === undefined) {
12
- return false;
13
- }
14
- if (repository.repository === undefined) {
15
- return false;
16
- }
17
- const slashIndex = repository.repository.indexOf("/");
18
- return slashIndex > 0 && slashIndex < repository.repository.length - 1;
19
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"claudeConfig.d.ts","sourceRoot":"","sources":["../../../src/commands/ask/claudeConfig.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAa3C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"completer.d.ts","sourceRoot":"","sources":["../../../src/commands/ask/completer.ts"],"names":[],"mappings":"AAYA,gEAAgE;AAChE,eAAO,MAAM,kBAAkB,oEAOrB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;AAEhE,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAgBhE;AAED,sDAAsD;AACtD,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAU5D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CASnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAYxE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,GAAG,SAAS,CAY1E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAwE1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/commands/ask/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AA0BxC;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACnD,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU9B;AAED,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAClC,MAAM,GAAG,SAAS,CA6CpB"}