@oxecli/oxe 1.0.35 → 1.0.36
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/cli.js +17 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -42,6 +42,20 @@ export class CLI {
|
|
|
42
42
|
const style = status === "failed" ? "\x1b[31m" : "\x1b[32m";
|
|
43
43
|
process.stdout.write(`${style}${truncateEllipsis(String(text), max_action_chars, "text")}\x1b[0m\n`);
|
|
44
44
|
}
|
|
45
|
+
printAssistantBlock(text) {
|
|
46
|
+
const rendered = aiMarkdown(text);
|
|
47
|
+
process.stdout.write(rendered);
|
|
48
|
+
if (!text.endsWith("\n"))
|
|
49
|
+
process.stdout.write("\n");
|
|
50
|
+
}
|
|
51
|
+
printFooterAfter(text, footer) {
|
|
52
|
+
const trailing = text.match(/\n*$/)?.[0].length ?? 0;
|
|
53
|
+
if (trailing < 2)
|
|
54
|
+
process.stdout.write("\n".repeat(2 - trailing));
|
|
55
|
+
process.stdout.write(aiMarkdown(footer));
|
|
56
|
+
if (!footer.endsWith("\n"))
|
|
57
|
+
process.stdout.write("\n");
|
|
58
|
+
}
|
|
45
59
|
async showHelp() {
|
|
46
60
|
// Mirror Python's `_show_help`: a bordered table panel with the command
|
|
47
61
|
// column bold (with `<arg>` placeholders cyan) and descriptions dim, inside
|
|
@@ -143,13 +157,12 @@ export class CLI {
|
|
|
143
157
|
process.stdout.write(`\x1b[1m❯\x1b[0m ${userDisplayText(payload, r["paste_spans"])}\n`);
|
|
144
158
|
}
|
|
145
159
|
else if (kind === "assistant") {
|
|
146
|
-
|
|
160
|
+
this.printAssistantBlock(payload);
|
|
147
161
|
let footer = String(r["footer"] ?? "").trim();
|
|
148
162
|
if (footer) {
|
|
149
163
|
if (!footer.startsWith("("))
|
|
150
164
|
footer = `(${footer})`;
|
|
151
|
-
|
|
152
|
-
process.stdout.write("\n" + aiMarkdown(footer) + "\n");
|
|
165
|
+
this.printFooterAfter(payload, footer);
|
|
153
166
|
}
|
|
154
167
|
}
|
|
155
168
|
else {
|
|
@@ -175,7 +188,7 @@ export class CLI {
|
|
|
175
188
|
process.stdout.write(`\x1b[1m❯\x1b[0m ${userDisplayText(text, e["paste_spans"])}\n`);
|
|
176
189
|
}
|
|
177
190
|
else if (typ === "assistant") {
|
|
178
|
-
|
|
191
|
+
this.printAssistantBlock(text);
|
|
179
192
|
}
|
|
180
193
|
else if (typ === "tool") {
|
|
181
194
|
this.printToolEntry(e["started"], text, e["status"] ?? "");
|