steward-cli 0.26.1 → 0.28.0
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 +629 -56
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -41285,7 +41285,7 @@ var require_dist = __commonJS(function(exports) {
|
|
|
41285
41285
|
});
|
|
41286
41286
|
|
|
41287
41287
|
// src/app/app.ts
|
|
41288
|
-
import { existsSync as
|
|
41288
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
41289
41289
|
|
|
41290
41290
|
// src/packages/tui/src/engine/HistoryStore.ts
|
|
41291
41291
|
class HistoryStore {
|
|
@@ -42874,8 +42874,8 @@ function resolveThemeColor(color, isBg = false) {
|
|
|
42874
42874
|
if (color === "dim" || color === "ansi(dim)") {
|
|
42875
42875
|
return isBg ? (s) => s : (s) => source_default.dim(s);
|
|
42876
42876
|
}
|
|
42877
|
-
if (color.startsWith("ansi(") && color.endsWith(")")) {
|
|
42878
|
-
const name = color.slice(5, -1).trim();
|
|
42877
|
+
if (color.startsWith("ansi(") && color.endsWith(")") || color.startsWith("ansi:")) {
|
|
42878
|
+
const name = color.startsWith("ansi:") ? color.slice(5).trim() : color.slice(5, -1).trim();
|
|
42879
42879
|
if (name === "reset" || name === "none" || name === "transparent" || name === "default") {
|
|
42880
42880
|
return (s) => s;
|
|
42881
42881
|
}
|
|
@@ -43062,48 +43062,122 @@ var draculaTheme = {
|
|
|
43062
43062
|
default: "rgb(248,248,242)"
|
|
43063
43063
|
}
|
|
43064
43064
|
};
|
|
43065
|
+
var darkDaltonizedTheme = {
|
|
43066
|
+
text: "rgb(255,255,255)",
|
|
43067
|
+
muted: "rgb(153,153,153)",
|
|
43068
|
+
subtle: "rgb(80,80,80)",
|
|
43069
|
+
brand: "rgb(255,153,51)",
|
|
43070
|
+
info: "rgb(153,204,255)",
|
|
43071
|
+
success: "rgb(51,153,255)",
|
|
43072
|
+
warning: "rgb(255,204,0)",
|
|
43073
|
+
error: "rgb(255,102,102)",
|
|
43074
|
+
permission: "rgb(153,204,255)",
|
|
43075
|
+
selected: "rgb(153,204,255)",
|
|
43076
|
+
current: "rgb(255,204,0)",
|
|
43077
|
+
promptBorder: "rgb(136,136,136)",
|
|
43078
|
+
rule: "rgb(102,153,153)",
|
|
43079
|
+
userChevron: "rgb(136,136,136)",
|
|
43080
|
+
userBg: "rgb(55,55,55)",
|
|
43081
|
+
diffAddBg: "rgb(0,68,102)",
|
|
43082
|
+
diffDelBg: "rgb(102,0,0)",
|
|
43083
|
+
diffAddFg: "rgb(0,119,179)",
|
|
43084
|
+
diffDelFg: "rgb(179,0,0)",
|
|
43085
|
+
syntax: {
|
|
43086
|
+
keyword: "rgb(255,178,102)",
|
|
43087
|
+
string: "rgb(153,204,255)",
|
|
43088
|
+
number: "rgb(255,255,102)",
|
|
43089
|
+
literal: "rgb(255,255,102)",
|
|
43090
|
+
comment: "rgb(153,153,153)",
|
|
43091
|
+
function: "rgb(178,102,255)",
|
|
43092
|
+
type: "rgb(255,153,51)",
|
|
43093
|
+
variable: "rgb(255,178,102)",
|
|
43094
|
+
tag: "rgb(102,178,255)",
|
|
43095
|
+
attr: "rgb(153,204,255)",
|
|
43096
|
+
meta: "rgb(178,102,255)",
|
|
43097
|
+
addition: "rgb(102,178,255)",
|
|
43098
|
+
deletion: "rgb(255,102,102)",
|
|
43099
|
+
default: "rgb(255,255,255)"
|
|
43100
|
+
}
|
|
43101
|
+
};
|
|
43102
|
+
var lightDaltonizedTheme = {
|
|
43103
|
+
text: "rgb(0,0,0)",
|
|
43104
|
+
muted: "rgb(102,102,102)",
|
|
43105
|
+
subtle: "rgb(175,175,175)",
|
|
43106
|
+
brand: "rgb(255,153,51)",
|
|
43107
|
+
info: "rgb(51,102,255)",
|
|
43108
|
+
success: "rgb(0,102,153)",
|
|
43109
|
+
warning: "rgb(255,153,0)",
|
|
43110
|
+
error: "rgb(204,0,0)",
|
|
43111
|
+
permission: "rgb(51,102,255)",
|
|
43112
|
+
selected: "rgb(51,102,255)",
|
|
43113
|
+
current: "rgb(255,153,0)",
|
|
43114
|
+
promptBorder: "rgb(153,153,153)",
|
|
43115
|
+
rule: "rgb(51,102,102)",
|
|
43116
|
+
userChevron: "rgb(153,153,153)",
|
|
43117
|
+
userBg: "rgb(220,220,220)",
|
|
43118
|
+
diffAddBg: "rgb(153,204,255)",
|
|
43119
|
+
diffDelBg: "rgb(255,204,204)",
|
|
43120
|
+
diffAddFg: "rgb(51,102,204)",
|
|
43121
|
+
diffDelFg: "rgb(153,51,51)",
|
|
43122
|
+
syntax: {
|
|
43123
|
+
keyword: "rgb(204,0,0)",
|
|
43124
|
+
string: "rgb(0,102,204)",
|
|
43125
|
+
number: "rgb(0,102,204)",
|
|
43126
|
+
literal: "rgb(0,102,204)",
|
|
43127
|
+
comment: "rgb(102,102,102)",
|
|
43128
|
+
function: "rgb(128,0,128)",
|
|
43129
|
+
type: "rgb(255,128,0)",
|
|
43130
|
+
variable: "rgb(255,128,0)",
|
|
43131
|
+
tag: "rgb(0,102,204)",
|
|
43132
|
+
attr: "rgb(0,102,204)",
|
|
43133
|
+
meta: "rgb(128,0,128)",
|
|
43134
|
+
addition: "rgb(0,102,153)",
|
|
43135
|
+
deletion: "rgb(204,0,0)",
|
|
43136
|
+
default: "rgb(0,0,0)"
|
|
43137
|
+
}
|
|
43138
|
+
};
|
|
43065
43139
|
var darkAnsiTheme = {
|
|
43066
|
-
text: "
|
|
43067
|
-
muted: "
|
|
43068
|
-
subtle: "
|
|
43069
|
-
brand: "ansi(
|
|
43070
|
-
info: "ansi(
|
|
43071
|
-
success: "ansi(
|
|
43072
|
-
warning: "ansi(
|
|
43073
|
-
error: "ansi(
|
|
43074
|
-
permission: "ansi(
|
|
43075
|
-
selected: "ansi(
|
|
43076
|
-
current: "ansi(
|
|
43077
|
-
promptBorder: "
|
|
43078
|
-
rule: "
|
|
43079
|
-
userChevron: "
|
|
43140
|
+
text: "ansi(whiteBright)",
|
|
43141
|
+
muted: "ansi(white)",
|
|
43142
|
+
subtle: "ansi(white)",
|
|
43143
|
+
brand: "ansi(redBright)",
|
|
43144
|
+
info: "ansi(blueBright)",
|
|
43145
|
+
success: "ansi(greenBright)",
|
|
43146
|
+
warning: "ansi(yellowBright)",
|
|
43147
|
+
error: "ansi(redBright)",
|
|
43148
|
+
permission: "ansi(blueBright)",
|
|
43149
|
+
selected: "ansi(blueBright)",
|
|
43150
|
+
current: "ansi(yellowBright)",
|
|
43151
|
+
promptBorder: "ansi(white)",
|
|
43152
|
+
rule: "ansi(cyanBright)",
|
|
43153
|
+
userChevron: "ansi(white)",
|
|
43080
43154
|
userBg: "ansi(bgBlackBright)",
|
|
43081
43155
|
diffAddBg: "default",
|
|
43082
43156
|
diffDelBg: "default",
|
|
43083
|
-
diffAddFg: "ansi(
|
|
43084
|
-
diffDelFg: "ansi(
|
|
43157
|
+
diffAddFg: "ansi(greenBright)",
|
|
43158
|
+
diffDelFg: "ansi(redBright)",
|
|
43085
43159
|
syntax: {
|
|
43086
|
-
keyword: "ansi(
|
|
43160
|
+
keyword: "ansi(redBright)",
|
|
43087
43161
|
string: "ansi(cyan)",
|
|
43088
43162
|
number: "ansi(cyan)",
|
|
43089
43163
|
literal: "ansi(cyan)",
|
|
43090
43164
|
comment: "ansi(gray)",
|
|
43091
|
-
function: "ansi(
|
|
43092
|
-
type: "ansi(
|
|
43093
|
-
variable: "ansi(
|
|
43094
|
-
tag: "ansi(
|
|
43165
|
+
function: "ansi(magentaBright)",
|
|
43166
|
+
type: "ansi(yellowBright)",
|
|
43167
|
+
variable: "ansi(yellowBright)",
|
|
43168
|
+
tag: "ansi(greenBright)",
|
|
43095
43169
|
attr: "ansi(cyan)",
|
|
43096
|
-
meta: "ansi(
|
|
43097
|
-
addition: "ansi(
|
|
43098
|
-
deletion: "ansi(
|
|
43099
|
-
default: "ansi(
|
|
43170
|
+
meta: "ansi(blueBright)",
|
|
43171
|
+
addition: "ansi(greenBright)",
|
|
43172
|
+
deletion: "ansi(redBright)",
|
|
43173
|
+
default: "ansi(whiteBright)"
|
|
43100
43174
|
}
|
|
43101
43175
|
};
|
|
43102
43176
|
var lightAnsiTheme = {
|
|
43103
|
-
text: "
|
|
43104
|
-
muted: "
|
|
43105
|
-
subtle: "
|
|
43106
|
-
brand: "ansi(
|
|
43177
|
+
text: "ansi(black)",
|
|
43178
|
+
muted: "ansi(blackBright)",
|
|
43179
|
+
subtle: "ansi(blackBright)",
|
|
43180
|
+
brand: "ansi(redBright)",
|
|
43107
43181
|
info: "ansi(blue)",
|
|
43108
43182
|
success: "ansi(green)",
|
|
43109
43183
|
warning: "ansi(yellow)",
|
|
@@ -43111,14 +43185,14 @@ var lightAnsiTheme = {
|
|
|
43111
43185
|
permission: "ansi(blue)",
|
|
43112
43186
|
selected: "ansi(blue)",
|
|
43113
43187
|
current: "ansi(yellow)",
|
|
43114
|
-
promptBorder: "
|
|
43115
|
-
rule: "
|
|
43116
|
-
userChevron: "
|
|
43188
|
+
promptBorder: "ansi(white)",
|
|
43189
|
+
rule: "ansi(cyan)",
|
|
43190
|
+
userChevron: "ansi(blackBright)",
|
|
43117
43191
|
userBg: "ansi(bgWhiteBright)",
|
|
43118
43192
|
diffAddBg: "default",
|
|
43119
43193
|
diffDelBg: "default",
|
|
43120
|
-
diffAddFg: "ansi(
|
|
43121
|
-
diffDelFg: "ansi(
|
|
43194
|
+
diffAddFg: "ansi(greenBright)",
|
|
43195
|
+
diffDelFg: "ansi(redBright)",
|
|
43122
43196
|
syntax: {
|
|
43123
43197
|
keyword: "ansi(red)",
|
|
43124
43198
|
string: "ansi(blue)",
|
|
@@ -43133,7 +43207,44 @@ var lightAnsiTheme = {
|
|
|
43133
43207
|
meta: "ansi(blue)",
|
|
43134
43208
|
addition: "ansi(green)",
|
|
43135
43209
|
deletion: "ansi(red)",
|
|
43136
|
-
default: "
|
|
43210
|
+
default: "ansi(black)"
|
|
43211
|
+
}
|
|
43212
|
+
};
|
|
43213
|
+
var noColorTheme = {
|
|
43214
|
+
text: "rgb(255,255,255)",
|
|
43215
|
+
muted: "rgb(255,255,255)",
|
|
43216
|
+
subtle: "rgb(255,255,255)",
|
|
43217
|
+
brand: "rgb(255,255,255)",
|
|
43218
|
+
info: "rgb(255,255,255)",
|
|
43219
|
+
success: "rgb(255,255,255)",
|
|
43220
|
+
warning: "rgb(255,255,255)",
|
|
43221
|
+
error: "rgb(255,255,255)",
|
|
43222
|
+
permission: "rgb(255,255,255)",
|
|
43223
|
+
selected: "rgb(255,255,255)",
|
|
43224
|
+
current: "rgb(255,255,255)",
|
|
43225
|
+
promptBorder: "rgb(255,255,255)",
|
|
43226
|
+
rule: "rgb(255,255,255)",
|
|
43227
|
+
userChevron: "rgb(255,255,255)",
|
|
43228
|
+
userBg: "default",
|
|
43229
|
+
diffAddBg: "default",
|
|
43230
|
+
diffDelBg: "default",
|
|
43231
|
+
diffAddFg: "rgb(255,255,255)",
|
|
43232
|
+
diffDelFg: "rgb(255,255,255)",
|
|
43233
|
+
syntax: {
|
|
43234
|
+
keyword: "rgb(255,255,255)",
|
|
43235
|
+
string: "rgb(255,255,255)",
|
|
43236
|
+
number: "rgb(255,255,255)",
|
|
43237
|
+
literal: "rgb(255,255,255)",
|
|
43238
|
+
comment: "rgb(255,255,255)",
|
|
43239
|
+
function: "rgb(255,255,255)",
|
|
43240
|
+
type: "rgb(255,255,255)",
|
|
43241
|
+
variable: "rgb(255,255,255)",
|
|
43242
|
+
tag: "rgb(255,255,255)",
|
|
43243
|
+
attr: "rgb(255,255,255)",
|
|
43244
|
+
meta: "rgb(255,255,255)",
|
|
43245
|
+
addition: "rgb(255,255,255)",
|
|
43246
|
+
deletion: "rgb(255,255,255)",
|
|
43247
|
+
default: "rgb(255,255,255)"
|
|
43137
43248
|
}
|
|
43138
43249
|
};
|
|
43139
43250
|
var builtInThemes = [
|
|
@@ -43151,6 +43262,20 @@ var builtInThemes = [
|
|
|
43151
43262
|
theme: lightTheme,
|
|
43152
43263
|
source: "built-in"
|
|
43153
43264
|
},
|
|
43265
|
+
{
|
|
43266
|
+
name: "dark-daltonized",
|
|
43267
|
+
label: "Dark Daltonized",
|
|
43268
|
+
description: "Color-blind friendly dark theme adjusted for deuteranopia",
|
|
43269
|
+
theme: darkDaltonizedTheme,
|
|
43270
|
+
source: "built-in"
|
|
43271
|
+
},
|
|
43272
|
+
{
|
|
43273
|
+
name: "light-daltonized",
|
|
43274
|
+
label: "Light Daltonized",
|
|
43275
|
+
description: "Color-blind friendly light theme adjusted for deuteranopia",
|
|
43276
|
+
theme: lightDaltonizedTheme,
|
|
43277
|
+
source: "built-in"
|
|
43278
|
+
},
|
|
43154
43279
|
{
|
|
43155
43280
|
name: "dracula",
|
|
43156
43281
|
label: "Dracula",
|
|
@@ -43171,6 +43296,13 @@ var builtInThemes = [
|
|
|
43171
43296
|
description: "16-color ANSI light palette respecting terminal colors",
|
|
43172
43297
|
theme: lightAnsiTheme,
|
|
43173
43298
|
source: "built-in"
|
|
43299
|
+
},
|
|
43300
|
+
{
|
|
43301
|
+
name: "no-color",
|
|
43302
|
+
label: "No Color",
|
|
43303
|
+
description: "Monochrome pure white palette with no color styling",
|
|
43304
|
+
theme: noColorTheme,
|
|
43305
|
+
source: "built-in"
|
|
43174
43306
|
}
|
|
43175
43307
|
];
|
|
43176
43308
|
var registry = new Map;
|
|
@@ -43185,7 +43317,8 @@ function findTheme(query) {
|
|
|
43185
43317
|
const q = query.trim().toLowerCase().replace(/^["']|["']$/g, "");
|
|
43186
43318
|
if (!q)
|
|
43187
43319
|
return;
|
|
43188
|
-
|
|
43320
|
+
const normalizedQ = q.replace(/[\s-_]+/g, "");
|
|
43321
|
+
return listThemes().find((t) => t.name.toLowerCase() === q || t.label.toLowerCase() === q || t.label.toLowerCase().startsWith(q) || t.name.replace(/[\s-_]+/g, "") === normalizedQ || t.label.toLowerCase().replace(/[\s-_]+/g, "") === normalizedQ);
|
|
43189
43322
|
}
|
|
43190
43323
|
function setActiveTheme(name) {
|
|
43191
43324
|
if (registry.has(name)) {
|
|
@@ -56001,7 +56134,7 @@ import { isIP } from "node:net";
|
|
|
56001
56134
|
// package.json
|
|
56002
56135
|
var package_default = {
|
|
56003
56136
|
name: "steward-cli",
|
|
56004
|
-
version: "0.
|
|
56137
|
+
version: "0.28.0",
|
|
56005
56138
|
description: "Interactive AI engineering assistant for the terminal.",
|
|
56006
56139
|
author: "sapirrior",
|
|
56007
56140
|
license: "MIT",
|
|
@@ -59464,6 +59597,19 @@ class AgentSession {
|
|
|
59464
59597
|
}
|
|
59465
59598
|
}
|
|
59466
59599
|
|
|
59600
|
+
// src/app/commands/bug/index.ts
|
|
59601
|
+
var bugCommand = {
|
|
59602
|
+
name: "bug",
|
|
59603
|
+
description: "Report issues or submit feedback to GitHub",
|
|
59604
|
+
usage: "/bug",
|
|
59605
|
+
async execute(_args, _context) {
|
|
59606
|
+
return {
|
|
59607
|
+
handled: true,
|
|
59608
|
+
message: "Report issues or feedback to https://github.com/sapirrior/steward/issues"
|
|
59609
|
+
};
|
|
59610
|
+
}
|
|
59611
|
+
};
|
|
59612
|
+
|
|
59467
59613
|
// src/app/commands/clear/index.ts
|
|
59468
59614
|
var clearCommand = {
|
|
59469
59615
|
name: "clear",
|
|
@@ -59556,6 +59702,427 @@ var copyCommand = {
|
|
|
59556
59702
|
}
|
|
59557
59703
|
};
|
|
59558
59704
|
|
|
59705
|
+
// src/app/commands/export/index.ts
|
|
59706
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
59707
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync10, writeFileSync as writeFileSync4 } from "node:fs";
|
|
59708
|
+
import { dirname as dirname7, isAbsolute as isAbsolute8, resolve as resolve11 } from "node:path";
|
|
59709
|
+
function stripAnsi2(str) {
|
|
59710
|
+
return str.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
|
|
59711
|
+
}
|
|
59712
|
+
function stripLogoFromLine(str) {
|
|
59713
|
+
return str.replace(/^[ ▄▀▙█▟▝▘]{6,8}\s*/, "");
|
|
59714
|
+
}
|
|
59715
|
+
async function copyToClipboard2(text) {
|
|
59716
|
+
const isTermux = Boolean(process.env.TERMUX_VERSION || existsSync18("/data/data/com.termux/files/usr/bin/termux-clipboard-set"));
|
|
59717
|
+
const [cmd, ...args] = isTermux ? ["termux-clipboard-set"] : process.platform === "darwin" ? ["pbcopy"] : process.platform === "win32" ? ["clip.exe"] : process.env.WAYLAND_DISPLAY ? ["wl-copy"] : ["xclip", "-selection", "clipboard"];
|
|
59718
|
+
const sendOSC52 = () => {
|
|
59719
|
+
try {
|
|
59720
|
+
process.stdout.write(`\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`);
|
|
59721
|
+
return true;
|
|
59722
|
+
} catch {
|
|
59723
|
+
return false;
|
|
59724
|
+
}
|
|
59725
|
+
};
|
|
59726
|
+
return new Promise((resolvePromise) => {
|
|
59727
|
+
let resolved = false;
|
|
59728
|
+
const finish = (ok) => {
|
|
59729
|
+
if (resolved)
|
|
59730
|
+
return;
|
|
59731
|
+
resolved = true;
|
|
59732
|
+
clearTimeout(timer);
|
|
59733
|
+
resolvePromise(ok || sendOSC52());
|
|
59734
|
+
};
|
|
59735
|
+
const timer = setTimeout(() => finish(false), 1200);
|
|
59736
|
+
try {
|
|
59737
|
+
const proc = spawn4(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
59738
|
+
proc.on("error", () => finish(false));
|
|
59739
|
+
proc.on("close", (code) => finish(code === 0));
|
|
59740
|
+
proc.stdin?.on("error", () => finish(false));
|
|
59741
|
+
proc.stdin?.end(text);
|
|
59742
|
+
} catch {
|
|
59743
|
+
finish(false);
|
|
59744
|
+
}
|
|
59745
|
+
});
|
|
59746
|
+
}
|
|
59747
|
+
function formatToolArgs(args) {
|
|
59748
|
+
if (!args || typeof args !== "object")
|
|
59749
|
+
return "";
|
|
59750
|
+
if (args.command)
|
|
59751
|
+
return String(args.command);
|
|
59752
|
+
if (args.path || args.filePath || args.targetFile) {
|
|
59753
|
+
return String(args.path || args.filePath || args.targetFile);
|
|
59754
|
+
}
|
|
59755
|
+
if (args.pattern)
|
|
59756
|
+
return String(args.pattern);
|
|
59757
|
+
if (args.url)
|
|
59758
|
+
return String(args.url);
|
|
59759
|
+
if (args.query)
|
|
59760
|
+
return String(args.query);
|
|
59761
|
+
const firstVal = Object.values(args)[0];
|
|
59762
|
+
if (typeof firstVal === "string")
|
|
59763
|
+
return firstVal;
|
|
59764
|
+
return "";
|
|
59765
|
+
}
|
|
59766
|
+
function formatToolOutput(output) {
|
|
59767
|
+
if (output === undefined || output === null)
|
|
59768
|
+
return [];
|
|
59769
|
+
let text = "";
|
|
59770
|
+
if (typeof output === "string") {
|
|
59771
|
+
text = output;
|
|
59772
|
+
} else if (typeof output === "object") {
|
|
59773
|
+
text = output.message || output.output || JSON.stringify(output);
|
|
59774
|
+
} else {
|
|
59775
|
+
text = String(output);
|
|
59776
|
+
}
|
|
59777
|
+
const lines = text.split(/\r?\n/).filter((l) => l.trim().length > 0);
|
|
59778
|
+
if (lines.length === 0)
|
|
59779
|
+
return [];
|
|
59780
|
+
const preview = lines.slice(0, 5);
|
|
59781
|
+
return preview.map((l, idx) => idx === 0 ? ` └ ${l}` : ` ${l}`);
|
|
59782
|
+
}
|
|
59783
|
+
function generateTranscriptFromSession(sessionData, cwd = process.cwd()) {
|
|
59784
|
+
const model = sessionData.model;
|
|
59785
|
+
const modelTag = model ? `${model.provider}/${model.modelId}` : "ai/model";
|
|
59786
|
+
const lines = [`Steward`, `${modelTag} · API Usage Billing`, `${cwd}`, ``];
|
|
59787
|
+
const turns = sessionData.turns ?? [];
|
|
59788
|
+
for (let turnIdx = 0;turnIdx < turns.length; turnIdx++) {
|
|
59789
|
+
const turn = turns[turnIdx];
|
|
59790
|
+
if (turnIdx > 0) {
|
|
59791
|
+
lines.push(``);
|
|
59792
|
+
}
|
|
59793
|
+
const messages = turn.messages ?? [];
|
|
59794
|
+
for (const msg of messages) {
|
|
59795
|
+
if (msg.role === "user") {
|
|
59796
|
+
const text = typeof msg.content === "string" ? msg.content : Array.isArray(msg.content) ? msg.content.map((c) => c.text || "").join(`
|
|
59797
|
+
`) : "";
|
|
59798
|
+
lines.push(`❯ ${text}`);
|
|
59799
|
+
lines.push(``);
|
|
59800
|
+
} else if (msg.role === "assistant") {
|
|
59801
|
+
if (Array.isArray(msg.content)) {
|
|
59802
|
+
for (const block of msg.content) {
|
|
59803
|
+
if (block.type === "thinking" && block.thinking) {
|
|
59804
|
+
lines.push(` Thought for ${Math.max(1, Math.round(block.thinking.length / 500))}s`);
|
|
59805
|
+
lines.push(``);
|
|
59806
|
+
} else if (block.type === "tool-call") {
|
|
59807
|
+
const argPreview = formatToolArgs(block.arguments);
|
|
59808
|
+
lines.push(`● ${block.name}${argPreview ? `(${argPreview})` : "()"}`);
|
|
59809
|
+
} else if (block.type === "text" && block.text) {
|
|
59810
|
+
const textLines = block.text.trim().split(/\r?\n/);
|
|
59811
|
+
for (let i = 0;i < textLines.length; i++) {
|
|
59812
|
+
lines.push(i === 0 ? `● ${textLines[i]}` : ` ${textLines[i]}`);
|
|
59813
|
+
}
|
|
59814
|
+
lines.push(``);
|
|
59815
|
+
}
|
|
59816
|
+
}
|
|
59817
|
+
} else if (typeof msg.content === "string" && msg.content.trim()) {
|
|
59818
|
+
const textLines = msg.content.trim().split(/\r?\n/);
|
|
59819
|
+
for (let i = 0;i < textLines.length; i++) {
|
|
59820
|
+
lines.push(i === 0 ? `● ${textLines[i]}` : ` ${textLines[i]}`);
|
|
59821
|
+
}
|
|
59822
|
+
lines.push(``);
|
|
59823
|
+
}
|
|
59824
|
+
} else if (msg.role === "tool") {
|
|
59825
|
+
if (Array.isArray(msg.content)) {
|
|
59826
|
+
for (const toolRes of msg.content) {
|
|
59827
|
+
const formatted = formatToolOutput(toolRes.output);
|
|
59828
|
+
for (const l of formatted) {
|
|
59829
|
+
lines.push(l);
|
|
59830
|
+
}
|
|
59831
|
+
}
|
|
59832
|
+
lines.push(``);
|
|
59833
|
+
}
|
|
59834
|
+
}
|
|
59835
|
+
}
|
|
59836
|
+
if (turn.timestamp) {
|
|
59837
|
+
const timeStr = new Date(turn.timestamp).toLocaleTimeString([], {
|
|
59838
|
+
hour: "2-digit",
|
|
59839
|
+
minute: "2-digit"
|
|
59840
|
+
});
|
|
59841
|
+
lines.push(`✻ Done · ${timeStr}`);
|
|
59842
|
+
}
|
|
59843
|
+
}
|
|
59844
|
+
return lines.join(`
|
|
59845
|
+
`).trim() + `
|
|
59846
|
+
`;
|
|
59847
|
+
}
|
|
59848
|
+
var exportCommand = {
|
|
59849
|
+
name: "export",
|
|
59850
|
+
description: "Exports the exact 1:1 UI conversation text to the clipboard or a file",
|
|
59851
|
+
usage: "/export [filename]",
|
|
59852
|
+
async execute(args, context) {
|
|
59853
|
+
if (context.session.isBusy) {
|
|
59854
|
+
return { handled: true, message: "Cannot export while the agent is generating a response." };
|
|
59855
|
+
}
|
|
59856
|
+
let transcript = "";
|
|
59857
|
+
if (typeof context.getScreenLines === "function") {
|
|
59858
|
+
const screenLines = context.getScreenLines();
|
|
59859
|
+
if (screenLines && screenLines.length > 0) {
|
|
59860
|
+
transcript = screenLines.map((l) => stripLogoFromLine(stripAnsi2(l))).join(`
|
|
59861
|
+
`).trim() + `
|
|
59862
|
+
`;
|
|
59863
|
+
}
|
|
59864
|
+
}
|
|
59865
|
+
if (!transcript.trim()) {
|
|
59866
|
+
const sessionData = context.session.session;
|
|
59867
|
+
transcript = generateTranscriptFromSession(sessionData, context.cwd || process.cwd());
|
|
59868
|
+
}
|
|
59869
|
+
if (!transcript.trim()) {
|
|
59870
|
+
return { handled: true, message: "No conversation messages found to export." };
|
|
59871
|
+
}
|
|
59872
|
+
const targetArg = args.join(" ").trim();
|
|
59873
|
+
if (!targetArg) {
|
|
59874
|
+
await copyToClipboard2(transcript);
|
|
59875
|
+
return {
|
|
59876
|
+
handled: true,
|
|
59877
|
+
message: "Copied conversation transcript to clipboard."
|
|
59878
|
+
};
|
|
59879
|
+
}
|
|
59880
|
+
try {
|
|
59881
|
+
const cwd = context.cwd || process.cwd();
|
|
59882
|
+
const filePath = isAbsolute8(targetArg) ? targetArg : resolve11(cwd, targetArg);
|
|
59883
|
+
const targetPath = filePath.endsWith(".txt") || filePath.endsWith(".md") ? filePath : `${filePath}.txt`;
|
|
59884
|
+
mkdirSync10(dirname7(targetPath), { recursive: true });
|
|
59885
|
+
writeFileSync4(targetPath, transcript, "utf-8");
|
|
59886
|
+
return {
|
|
59887
|
+
handled: true,
|
|
59888
|
+
message: `Conversation transcript exported to ${targetPath}`
|
|
59889
|
+
};
|
|
59890
|
+
} catch (err) {
|
|
59891
|
+
return {
|
|
59892
|
+
handled: true,
|
|
59893
|
+
message: `Failed to export transcript: ${err instanceof Error ? err.message : String(err)}`
|
|
59894
|
+
};
|
|
59895
|
+
}
|
|
59896
|
+
}
|
|
59897
|
+
};
|
|
59898
|
+
|
|
59899
|
+
// src/app/commands/init/index.ts
|
|
59900
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync11, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
59901
|
+
import { basename, join as join17 } from "node:path";
|
|
59902
|
+
function generateAgentsMd(cwd) {
|
|
59903
|
+
const projectName = basename(cwd);
|
|
59904
|
+
let stack = "General";
|
|
59905
|
+
let commandsSection = "- `make test`: Run test suite";
|
|
59906
|
+
if (existsSync19(join17(cwd, "package.json"))) {
|
|
59907
|
+
try {
|
|
59908
|
+
const pkg = JSON.parse(readFileSync14(join17(cwd, "package.json"), "utf-8"));
|
|
59909
|
+
const scripts = pkg.scripts ? Object.keys(pkg.scripts) : [];
|
|
59910
|
+
stack = "Node.js / TypeScript";
|
|
59911
|
+
if (scripts.length > 0) {
|
|
59912
|
+
commandsSection = scripts.map((s) => `- \`npm run ${s}\` (or \`bun run ${s}\`)`).join(`
|
|
59913
|
+
`);
|
|
59914
|
+
}
|
|
59915
|
+
} catch {
|
|
59916
|
+
stack = "Node.js";
|
|
59917
|
+
}
|
|
59918
|
+
} else if (existsSync19(join17(cwd, "Cargo.toml"))) {
|
|
59919
|
+
stack = "Rust";
|
|
59920
|
+
commandsSection = "- `cargo build`: Build project\n- `cargo test`: Run tests";
|
|
59921
|
+
} else if (existsSync19(join17(cwd, "pyproject.toml")) || existsSync19(join17(cwd, "requirements.txt"))) {
|
|
59922
|
+
stack = "Python";
|
|
59923
|
+
commandsSection = "- `pytest`: Run tests\n- `python main.py`: Run application";
|
|
59924
|
+
} else if (existsSync19(join17(cwd, "go.mod"))) {
|
|
59925
|
+
stack = "Go";
|
|
59926
|
+
commandsSection = "- `go build ./...`: Build packages\n- `go test ./...`: Run test suite";
|
|
59927
|
+
}
|
|
59928
|
+
return `# AGENTS.md
|
|
59929
|
+
|
|
59930
|
+
Operational guidelines and architectural context for AI engineering assistants working in \`${projectName}\`.
|
|
59931
|
+
|
|
59932
|
+
## 1. Project Overview & Tech Stack
|
|
59933
|
+
|
|
59934
|
+
- **Project:** \`${projectName}\`
|
|
59935
|
+
- **Primary Stack:** ${stack}
|
|
59936
|
+
|
|
59937
|
+
## 2. Common Commands
|
|
59938
|
+
|
|
59939
|
+
${commandsSection}
|
|
59940
|
+
|
|
59941
|
+
## 3. Architecture & Guidelines
|
|
59942
|
+
|
|
59943
|
+
- **Code Style:** Follow established project formatting and idioms.
|
|
59944
|
+
- **Verification:** Run relevant tests before finalizing changes.
|
|
59945
|
+
- **Safety:** Verify file paths and permissions before applying destructive edits.
|
|
59946
|
+
`;
|
|
59947
|
+
}
|
|
59948
|
+
var DUMMY_HOOKS_JSON = JSON.stringify({
|
|
59949
|
+
version: 1,
|
|
59950
|
+
hooks: {
|
|
59951
|
+
SessionStart: [
|
|
59952
|
+
{
|
|
59953
|
+
name: "sample-session-start",
|
|
59954
|
+
command: 'echo "Steward session started"',
|
|
59955
|
+
enabled: false,
|
|
59956
|
+
description: "Runs when a session starts or resumes"
|
|
59957
|
+
}
|
|
59958
|
+
],
|
|
59959
|
+
BeforeToolUse: [
|
|
59960
|
+
{
|
|
59961
|
+
name: "sample-tool-guard",
|
|
59962
|
+
command: 'echo "Checking tool call"',
|
|
59963
|
+
matcher: "bash",
|
|
59964
|
+
enabled: false,
|
|
59965
|
+
description: "Runs before specific tool executions"
|
|
59966
|
+
}
|
|
59967
|
+
]
|
|
59968
|
+
}
|
|
59969
|
+
}, null, 2);
|
|
59970
|
+
var initCommand = {
|
|
59971
|
+
name: "init",
|
|
59972
|
+
description: "Initializes project with AGENTS.md, .steward/hooks.json, and .agents/ directory",
|
|
59973
|
+
usage: "/init",
|
|
59974
|
+
async execute(_args, context) {
|
|
59975
|
+
const cwd = context.cwd || process.cwd();
|
|
59976
|
+
const created = [];
|
|
59977
|
+
const skipped = [];
|
|
59978
|
+
try {
|
|
59979
|
+
const agentsMdPath = join17(cwd, "AGENTS.md");
|
|
59980
|
+
if (!existsSync19(agentsMdPath)) {
|
|
59981
|
+
writeFileSync5(agentsMdPath, generateAgentsMd(cwd), "utf-8");
|
|
59982
|
+
created.push("AGENTS.md");
|
|
59983
|
+
} else {
|
|
59984
|
+
skipped.push("AGENTS.md (already exists)");
|
|
59985
|
+
}
|
|
59986
|
+
const stewardDir = join17(cwd, ".steward");
|
|
59987
|
+
if (!existsSync19(stewardDir)) {
|
|
59988
|
+
mkdirSync11(stewardDir, { recursive: true });
|
|
59989
|
+
}
|
|
59990
|
+
const hooksPath = join17(stewardDir, "hooks.json");
|
|
59991
|
+
if (!existsSync19(hooksPath)) {
|
|
59992
|
+
writeFileSync5(hooksPath, DUMMY_HOOKS_JSON, "utf-8");
|
|
59993
|
+
created.push(".steward/hooks.json");
|
|
59994
|
+
} else {
|
|
59995
|
+
skipped.push(".steward/hooks.json (already exists)");
|
|
59996
|
+
}
|
|
59997
|
+
const skillsDir = join17(cwd, ".agents", "skills");
|
|
59998
|
+
if (!existsSync19(skillsDir)) {
|
|
59999
|
+
mkdirSync11(skillsDir, { recursive: true });
|
|
60000
|
+
created.push(".agents/skills/");
|
|
60001
|
+
} else {
|
|
60002
|
+
skipped.push(".agents/skills/ (already exists)");
|
|
60003
|
+
}
|
|
60004
|
+
const summaryParts = [];
|
|
60005
|
+
if (created.length > 0) {
|
|
60006
|
+
summaryParts.push(`Created: ${created.join(", ")}`);
|
|
60007
|
+
}
|
|
60008
|
+
if (skipped.length > 0) {
|
|
60009
|
+
summaryParts.push(`Preserved: ${skipped.join(", ")}`);
|
|
60010
|
+
}
|
|
60011
|
+
return {
|
|
60012
|
+
handled: true,
|
|
60013
|
+
message: `Project initialized successfully!
|
|
60014
|
+
${summaryParts.join(`
|
|
60015
|
+
`)}`
|
|
60016
|
+
};
|
|
60017
|
+
} catch (err) {
|
|
60018
|
+
return {
|
|
60019
|
+
handled: true,
|
|
60020
|
+
message: `Failed to initialize project: ${err instanceof Error ? err.message : String(err)}`
|
|
60021
|
+
};
|
|
60022
|
+
}
|
|
60023
|
+
}
|
|
60024
|
+
};
|
|
60025
|
+
|
|
60026
|
+
// src/app/commands/usage/index.ts
|
|
60027
|
+
function formatNumber(num) {
|
|
60028
|
+
return (num ?? 0).toLocaleString();
|
|
60029
|
+
}
|
|
60030
|
+
function formatDuration(isoDateString) {
|
|
60031
|
+
if (!isoDateString)
|
|
60032
|
+
return "0s";
|
|
60033
|
+
const start = new Date(isoDateString).getTime();
|
|
60034
|
+
if (isNaN(start))
|
|
60035
|
+
return "0s";
|
|
60036
|
+
const elapsedSec = Math.max(0, Math.floor((Date.now() - start) / 1000));
|
|
60037
|
+
const hrs = Math.floor(elapsedSec / 3600);
|
|
60038
|
+
const mins = Math.floor(elapsedSec % 3600 / 60);
|
|
60039
|
+
const secs = elapsedSec % 60;
|
|
60040
|
+
if (hrs > 0)
|
|
60041
|
+
return `${hrs}h ${mins}m ${secs}s`;
|
|
60042
|
+
if (mins > 0)
|
|
60043
|
+
return `${mins}m ${secs}s`;
|
|
60044
|
+
return `${secs}s`;
|
|
60045
|
+
}
|
|
60046
|
+
function estimateUniversalCost(usage, modelId, provider) {
|
|
60047
|
+
const p = provider.toLowerCase();
|
|
60048
|
+
const m = modelId.toLowerCase();
|
|
60049
|
+
if (p === "ollama" || m.includes("local")) {
|
|
60050
|
+
return "$0.00 USD [Local / Offline]";
|
|
60051
|
+
}
|
|
60052
|
+
const isLightweight = m.includes("flash") || m.includes("mini") || m.includes("haiku") || m.includes("8b") || m.includes("deepseek");
|
|
60053
|
+
const inputPerMillion = isLightweight ? 0.15 : 3;
|
|
60054
|
+
const outputPerMillion = isLightweight ? 0.6 : 15;
|
|
60055
|
+
const cachePerMillion = isLightweight ? 0.075 : 0.3;
|
|
60056
|
+
const baseCost = usage.inputTokens * inputPerMillion / 1e6;
|
|
60057
|
+
const outputCost = usage.outputTokens * outputPerMillion / 1e6;
|
|
60058
|
+
const cacheCost = (usage.cacheReadTokens ?? 0) * cachePerMillion / 1e6;
|
|
60059
|
+
const total = baseCost + outputCost + cacheCost;
|
|
60060
|
+
if (total === 0) {
|
|
60061
|
+
return "$0.00 USD [estimated]";
|
|
60062
|
+
}
|
|
60063
|
+
const formatted = total < 0.005 ? "< $0.01" : `$${total.toFixed(2)}`;
|
|
60064
|
+
return `~${formatted} USD [estimated benchmark]`;
|
|
60065
|
+
}
|
|
60066
|
+
var usageCommand = {
|
|
60067
|
+
name: "usage",
|
|
60068
|
+
description: "Displays token usage metrics and statistics for the current session",
|
|
60069
|
+
usage: "/usage",
|
|
60070
|
+
async execute(_args, context) {
|
|
60071
|
+
const sessionData = context.session.session;
|
|
60072
|
+
const model = context.session.getModel();
|
|
60073
|
+
const usage = context.session.getUsage();
|
|
60074
|
+
const turns = sessionData?.turns ?? [];
|
|
60075
|
+
const turnsCount = turns.length;
|
|
60076
|
+
let toolCallsCount = 0;
|
|
60077
|
+
for (const turn of turns) {
|
|
60078
|
+
if (Array.isArray(turn.messages)) {
|
|
60079
|
+
let turnToolCalls = 0;
|
|
60080
|
+
let turnToolMessages = 0;
|
|
60081
|
+
for (const msg of turn.messages) {
|
|
60082
|
+
if (msg.role === "assistant" && Array.isArray(msg.content)) {
|
|
60083
|
+
turnToolCalls += msg.content.filter((c) => c?.type === "tool-call").length;
|
|
60084
|
+
} else if (msg.role === "tool") {
|
|
60085
|
+
turnToolMessages++;
|
|
60086
|
+
}
|
|
60087
|
+
}
|
|
60088
|
+
toolCallsCount += turnToolCalls > 0 ? turnToolCalls : turnToolMessages;
|
|
60089
|
+
}
|
|
60090
|
+
}
|
|
60091
|
+
const duration = formatDuration(sessionData?.createdAt);
|
|
60092
|
+
const costEstimate = estimateUniversalCost(usage, model.modelId, model.provider);
|
|
60093
|
+
const lines = [
|
|
60094
|
+
`Session Usage & Analytics:`,
|
|
60095
|
+
`• Active Model: ${model.modelId} (${model.provider}${model.effort !== "medium" ? `, effort: ${model.effort}` : ""})`,
|
|
60096
|
+
`• Session Duration: ${duration}`,
|
|
60097
|
+
`• Activity: ${formatNumber(turnsCount)} turns (${formatNumber(toolCallsCount)} tool executions)`,
|
|
60098
|
+
``,
|
|
60099
|
+
`Token Breakdown:`,
|
|
60100
|
+
`• Input Tokens: ${formatNumber(usage.inputTokens)}`,
|
|
60101
|
+
`• Output Tokens: ${formatNumber(usage.outputTokens)}`
|
|
60102
|
+
];
|
|
60103
|
+
if (usage.reasoningTokens && usage.reasoningTokens > 0) {
|
|
60104
|
+
lines.push(`• Reasoning Tokens: ${formatNumber(usage.reasoningTokens)}`);
|
|
60105
|
+
}
|
|
60106
|
+
if (usage.cacheReadTokens && usage.cacheReadTokens > 0) {
|
|
60107
|
+
const totalIn = (usage.inputTokens || 0) + (usage.cacheReadTokens || 0);
|
|
60108
|
+
const hitRate = totalIn > 0 ? Math.round(usage.cacheReadTokens / totalIn * 100) : 0;
|
|
60109
|
+
lines.push(`• Cache Read Tokens: ${formatNumber(usage.cacheReadTokens)} (${hitRate}% hit rate)`);
|
|
60110
|
+
}
|
|
60111
|
+
if (usage.cacheWriteTokens && usage.cacheWriteTokens > 0) {
|
|
60112
|
+
lines.push(`• Cache Write Tokens: ${formatNumber(usage.cacheWriteTokens)}`);
|
|
60113
|
+
}
|
|
60114
|
+
lines.push(`• Total Tokens: ${formatNumber(usage.totalTokens)}`);
|
|
60115
|
+
lines.push(``);
|
|
60116
|
+
lines.push(`Estimated Cost:`);
|
|
60117
|
+
lines.push(`• Session Spend: ${costEstimate}`);
|
|
60118
|
+
return {
|
|
60119
|
+
handled: true,
|
|
60120
|
+
message: lines.join(`
|
|
60121
|
+
`)
|
|
60122
|
+
};
|
|
60123
|
+
}
|
|
60124
|
+
};
|
|
60125
|
+
|
|
59559
60126
|
// src/app/commands/effort/index.ts
|
|
59560
60127
|
var EFFORT_HELP = `Reasoning Effort Levels:
|
|
59561
60128
|
none : disable reasoning/thinking
|
|
@@ -60025,7 +60592,11 @@ class CommandRegistry {
|
|
|
60025
60592
|
}
|
|
60026
60593
|
}
|
|
60027
60594
|
var builtInCommands = [
|
|
60595
|
+
bugCommand,
|
|
60596
|
+
initCommand,
|
|
60028
60597
|
copyCommand,
|
|
60598
|
+
exportCommand,
|
|
60599
|
+
usageCommand,
|
|
60029
60600
|
rewindCommand,
|
|
60030
60601
|
modelCommand,
|
|
60031
60602
|
loginCommand,
|
|
@@ -62174,7 +62745,7 @@ var pn = x.lex;
|
|
|
62174
62745
|
|
|
62175
62746
|
// src/packages/tui/src/format/highlight.ts
|
|
62176
62747
|
var import_cli_highlight = __toESM(require_dist(), 1);
|
|
62177
|
-
import { extname, basename } from "node:path";
|
|
62748
|
+
import { extname, basename as basename2 } from "node:path";
|
|
62178
62749
|
var EXTENSION_MAP = {
|
|
62179
62750
|
".ts": "typescript",
|
|
62180
62751
|
".tsx": "typescript",
|
|
@@ -62219,7 +62790,7 @@ var FILENAME_MAP = {
|
|
|
62219
62790
|
function detectLanguageFromPath(filePath) {
|
|
62220
62791
|
if (!filePath)
|
|
62221
62792
|
return;
|
|
62222
|
-
const name =
|
|
62793
|
+
const name = basename2(filePath).toLowerCase();
|
|
62223
62794
|
if (FILENAME_MAP[name])
|
|
62224
62795
|
return FILENAME_MAP[name];
|
|
62225
62796
|
const ext = extname(filePath).toLowerCase();
|
|
@@ -63778,11 +64349,12 @@ function renderToolDetail(detail, targetWidth, expanded = false) {
|
|
|
63778
64349
|
}
|
|
63779
64350
|
|
|
63780
64351
|
// src/app/ui/utils/message-formatter.ts
|
|
63781
|
-
function
|
|
64352
|
+
function formatSlashCommandOutput(content) {
|
|
63782
64353
|
const rawLines = content.split(`
|
|
63783
64354
|
`);
|
|
63784
|
-
return rawLines.map((l, i) => i === 0 ? ` ${c.muted("└ ")}${
|
|
64355
|
+
return rawLines.map((l, i) => i === 0 ? ` ${c.muted("└ ")}${l}` : ` ${l}`);
|
|
63785
64356
|
}
|
|
64357
|
+
var formatSystemMessage = formatSlashCommandOutput;
|
|
63786
64358
|
function formatAssistantMessage(content) {
|
|
63787
64359
|
const lines = [];
|
|
63788
64360
|
if (content) {
|
|
@@ -64151,13 +64723,13 @@ class UpdateCheckerService {
|
|
|
64151
64723
|
}
|
|
64152
64724
|
}
|
|
64153
64725
|
// src/app/utils/open-url.ts
|
|
64154
|
-
import { spawn as
|
|
64155
|
-
import { existsSync as
|
|
64726
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
64727
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
64156
64728
|
function openUrl(url) {
|
|
64157
64729
|
const platform = process.platform;
|
|
64158
64730
|
try {
|
|
64159
|
-
if (process.env.TERMUX_VERSION ||
|
|
64160
|
-
const child =
|
|
64731
|
+
if (process.env.TERMUX_VERSION || existsSync20("/data/data/com.termux/files/usr/bin/termux-open-url")) {
|
|
64732
|
+
const child = spawn5("termux-open-url", [url], {
|
|
64161
64733
|
detached: true,
|
|
64162
64734
|
stdio: "ignore"
|
|
64163
64735
|
});
|
|
@@ -64165,7 +64737,7 @@ function openUrl(url) {
|
|
|
64165
64737
|
return;
|
|
64166
64738
|
}
|
|
64167
64739
|
if (platform === "win32") {
|
|
64168
|
-
const child =
|
|
64740
|
+
const child = spawn5("cmd.exe", ["/c", "start", '""', url], {
|
|
64169
64741
|
detached: true,
|
|
64170
64742
|
stdio: "ignore"
|
|
64171
64743
|
});
|
|
@@ -64173,14 +64745,14 @@ function openUrl(url) {
|
|
|
64173
64745
|
return;
|
|
64174
64746
|
}
|
|
64175
64747
|
if (platform === "darwin") {
|
|
64176
|
-
const child =
|
|
64748
|
+
const child = spawn5("open", [url], {
|
|
64177
64749
|
detached: true,
|
|
64178
64750
|
stdio: "ignore"
|
|
64179
64751
|
});
|
|
64180
64752
|
child.unref();
|
|
64181
64753
|
return;
|
|
64182
64754
|
}
|
|
64183
|
-
const child =
|
|
64755
|
+
const child = spawn5("xdg-open", [url], {
|
|
64184
64756
|
detached: true,
|
|
64185
64757
|
stdio: "ignore"
|
|
64186
64758
|
});
|
|
@@ -65965,7 +66537,7 @@ async function applyCommandResult(text, cmdResult, ctx) {
|
|
|
65965
66537
|
return true;
|
|
65966
66538
|
}
|
|
65967
66539
|
if (cmdResult.message) {
|
|
65968
|
-
ctx.engine.commit("system",
|
|
66540
|
+
ctx.engine.commit("system", formatSlashCommandOutput(cmdResult.message));
|
|
65969
66541
|
}
|
|
65970
66542
|
const updatedModel = ctx.session.getModel();
|
|
65971
66543
|
ctx.header.render();
|
|
@@ -65974,7 +66546,7 @@ async function applyCommandResult(text, cmdResult, ctx) {
|
|
|
65974
66546
|
}
|
|
65975
66547
|
|
|
65976
66548
|
// src/app/utils/bash.ts
|
|
65977
|
-
import { spawn as
|
|
66549
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
65978
66550
|
async function executeDirectBash(options) {
|
|
65979
66551
|
const { command, cwd = process.cwd(), abortSignal, onChunk } = options;
|
|
65980
66552
|
const { shell, args } = getPlatformShell();
|
|
@@ -65987,7 +66559,7 @@ async function executeDirectBash(options) {
|
|
|
65987
66559
|
let output = "";
|
|
65988
66560
|
let isSettled = false;
|
|
65989
66561
|
try {
|
|
65990
|
-
child =
|
|
66562
|
+
child = spawn6(shell, childArgs, {
|
|
65991
66563
|
cwd,
|
|
65992
66564
|
env: process.env,
|
|
65993
66565
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -66206,7 +66778,7 @@ class TUIApp {
|
|
|
66206
66778
|
source: this.session.session.turns.length > 0 ? "resume" : "startup"
|
|
66207
66779
|
});
|
|
66208
66780
|
const logPath = getSessionLogPath(this.session.session.date, this.session.session.id);
|
|
66209
|
-
if (this.session.session.turns.length > 0 ||
|
|
66781
|
+
if (this.session.session.turns.length > 0 || existsSync21(logPath)) {
|
|
66210
66782
|
renderTranscript(this.engine, this.session.session, this.header);
|
|
66211
66783
|
} else {
|
|
66212
66784
|
this.engine.commit("header", this.header.render());
|
|
@@ -66312,7 +66884,8 @@ class TUIApp {
|
|
|
66312
66884
|
if (defaultCommandRegistry.isCommand(text)) {
|
|
66313
66885
|
const cmdResult = await defaultCommandRegistry.execute(text, {
|
|
66314
66886
|
session: this.session,
|
|
66315
|
-
cwd: this.cwd
|
|
66887
|
+
cwd: this.cwd,
|
|
66888
|
+
getScreenLines: () => this.engine.history.getEntries().filter((e) => e.kind !== "logo").flatMap((e) => e.lines)
|
|
66316
66889
|
});
|
|
66317
66890
|
await applyCommandResult(text, cmdResult, {
|
|
66318
66891
|
engine: this.engine,
|