steward-cli 0.26.0 → 0.26.1
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 +84 -12
- 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 existsSync19 } from "node:fs";
|
|
41289
41289
|
|
|
41290
41290
|
// src/packages/tui/src/engine/HistoryStore.ts
|
|
41291
41291
|
class HistoryStore {
|
|
@@ -56001,7 +56001,7 @@ import { isIP } from "node:net";
|
|
|
56001
56001
|
// package.json
|
|
56002
56002
|
var package_default = {
|
|
56003
56003
|
name: "steward-cli",
|
|
56004
|
-
version: "0.26.
|
|
56004
|
+
version: "0.26.1",
|
|
56005
56005
|
description: "Interactive AI engineering assistant for the terminal.",
|
|
56006
56006
|
author: "sapirrior",
|
|
56007
56007
|
license: "MIT",
|
|
@@ -59485,6 +59485,77 @@ var clearCommand = {
|
|
|
59485
59485
|
}
|
|
59486
59486
|
};
|
|
59487
59487
|
|
|
59488
|
+
// src/app/commands/copy/index.ts
|
|
59489
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
59490
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
59491
|
+
function extractAssistantText(msg) {
|
|
59492
|
+
if (msg.role !== "assistant")
|
|
59493
|
+
return "";
|
|
59494
|
+
if (typeof msg.content === "string")
|
|
59495
|
+
return msg.content.trim();
|
|
59496
|
+
if (!Array.isArray(msg.content))
|
|
59497
|
+
return "";
|
|
59498
|
+
return msg.content.filter((b) => b?.type === "text" && typeof b.text === "string").map((b) => b.text.trim()).filter(Boolean).join(`
|
|
59499
|
+
|
|
59500
|
+
`);
|
|
59501
|
+
}
|
|
59502
|
+
async function copyToClipboard(text) {
|
|
59503
|
+
const isTermux = Boolean(process.env.TERMUX_VERSION || existsSync17("/data/data/com.termux/files/usr/bin/termux-clipboard-set"));
|
|
59504
|
+
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"];
|
|
59505
|
+
const sendOSC52 = () => {
|
|
59506
|
+
try {
|
|
59507
|
+
process.stdout.write(`\x1B]52;c;${Buffer.from(text, "utf8").toString("base64")}\x07`);
|
|
59508
|
+
return true;
|
|
59509
|
+
} catch {
|
|
59510
|
+
return false;
|
|
59511
|
+
}
|
|
59512
|
+
};
|
|
59513
|
+
return new Promise((resolve) => {
|
|
59514
|
+
let resolved = false;
|
|
59515
|
+
const finish = (ok) => {
|
|
59516
|
+
if (resolved)
|
|
59517
|
+
return;
|
|
59518
|
+
resolved = true;
|
|
59519
|
+
clearTimeout(timer);
|
|
59520
|
+
resolve(ok || sendOSC52());
|
|
59521
|
+
};
|
|
59522
|
+
const timer = setTimeout(() => finish(false), 1200);
|
|
59523
|
+
try {
|
|
59524
|
+
const proc = spawn3(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
59525
|
+
proc.on("error", () => finish(false));
|
|
59526
|
+
proc.on("close", (code) => finish(code === 0));
|
|
59527
|
+
proc.stdin?.on("error", () => finish(false));
|
|
59528
|
+
proc.stdin?.end(text);
|
|
59529
|
+
} catch {
|
|
59530
|
+
finish(false);
|
|
59531
|
+
}
|
|
59532
|
+
});
|
|
59533
|
+
}
|
|
59534
|
+
var copyCommand = {
|
|
59535
|
+
name: "copy",
|
|
59536
|
+
description: "Copies the last AI response to the clipboard",
|
|
59537
|
+
usage: "/copy",
|
|
59538
|
+
async execute(_args, context) {
|
|
59539
|
+
if (context.session.isBusy) {
|
|
59540
|
+
return { handled: true, message: "Cannot copy while the agent is generating a response." };
|
|
59541
|
+
}
|
|
59542
|
+
const history = context.session.getHistory();
|
|
59543
|
+
let targetText = "";
|
|
59544
|
+
for (let i = history.length - 1;i >= 0; i--) {
|
|
59545
|
+
const text = extractAssistantText(history[i]);
|
|
59546
|
+
if (text) {
|
|
59547
|
+
targetText = text;
|
|
59548
|
+
break;
|
|
59549
|
+
}
|
|
59550
|
+
}
|
|
59551
|
+
if (!targetText) {
|
|
59552
|
+
return { handled: true, message: "No previous AI response found to copy." };
|
|
59553
|
+
}
|
|
59554
|
+
await copyToClipboard(targetText);
|
|
59555
|
+
return { handled: true, message: "Copied last AI response to clipboard." };
|
|
59556
|
+
}
|
|
59557
|
+
};
|
|
59558
|
+
|
|
59488
59559
|
// src/app/commands/effort/index.ts
|
|
59489
59560
|
var EFFORT_HELP = `Reasoning Effort Levels:
|
|
59490
59561
|
none : disable reasoning/thinking
|
|
@@ -59954,6 +60025,7 @@ class CommandRegistry {
|
|
|
59954
60025
|
}
|
|
59955
60026
|
}
|
|
59956
60027
|
var builtInCommands = [
|
|
60028
|
+
copyCommand,
|
|
59957
60029
|
rewindCommand,
|
|
59958
60030
|
modelCommand,
|
|
59959
60031
|
loginCommand,
|
|
@@ -64079,13 +64151,13 @@ class UpdateCheckerService {
|
|
|
64079
64151
|
}
|
|
64080
64152
|
}
|
|
64081
64153
|
// src/app/utils/open-url.ts
|
|
64082
|
-
import { spawn as
|
|
64083
|
-
import { existsSync as
|
|
64154
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
64155
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
64084
64156
|
function openUrl(url) {
|
|
64085
64157
|
const platform = process.platform;
|
|
64086
64158
|
try {
|
|
64087
|
-
if (process.env.TERMUX_VERSION ||
|
|
64088
|
-
const child =
|
|
64159
|
+
if (process.env.TERMUX_VERSION || existsSync18("/data/data/com.termux/files/usr/bin/termux-open-url")) {
|
|
64160
|
+
const child = spawn4("termux-open-url", [url], {
|
|
64089
64161
|
detached: true,
|
|
64090
64162
|
stdio: "ignore"
|
|
64091
64163
|
});
|
|
@@ -64093,7 +64165,7 @@ function openUrl(url) {
|
|
|
64093
64165
|
return;
|
|
64094
64166
|
}
|
|
64095
64167
|
if (platform === "win32") {
|
|
64096
|
-
const child =
|
|
64168
|
+
const child = spawn4("cmd.exe", ["/c", "start", '""', url], {
|
|
64097
64169
|
detached: true,
|
|
64098
64170
|
stdio: "ignore"
|
|
64099
64171
|
});
|
|
@@ -64101,14 +64173,14 @@ function openUrl(url) {
|
|
|
64101
64173
|
return;
|
|
64102
64174
|
}
|
|
64103
64175
|
if (platform === "darwin") {
|
|
64104
|
-
const child =
|
|
64176
|
+
const child = spawn4("open", [url], {
|
|
64105
64177
|
detached: true,
|
|
64106
64178
|
stdio: "ignore"
|
|
64107
64179
|
});
|
|
64108
64180
|
child.unref();
|
|
64109
64181
|
return;
|
|
64110
64182
|
}
|
|
64111
|
-
const child =
|
|
64183
|
+
const child = spawn4("xdg-open", [url], {
|
|
64112
64184
|
detached: true,
|
|
64113
64185
|
stdio: "ignore"
|
|
64114
64186
|
});
|
|
@@ -65902,7 +65974,7 @@ async function applyCommandResult(text, cmdResult, ctx) {
|
|
|
65902
65974
|
}
|
|
65903
65975
|
|
|
65904
65976
|
// src/app/utils/bash.ts
|
|
65905
|
-
import { spawn as
|
|
65977
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
65906
65978
|
async function executeDirectBash(options) {
|
|
65907
65979
|
const { command, cwd = process.cwd(), abortSignal, onChunk } = options;
|
|
65908
65980
|
const { shell, args } = getPlatformShell();
|
|
@@ -65915,7 +65987,7 @@ async function executeDirectBash(options) {
|
|
|
65915
65987
|
let output = "";
|
|
65916
65988
|
let isSettled = false;
|
|
65917
65989
|
try {
|
|
65918
|
-
child =
|
|
65990
|
+
child = spawn5(shell, childArgs, {
|
|
65919
65991
|
cwd,
|
|
65920
65992
|
env: process.env,
|
|
65921
65993
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -66134,7 +66206,7 @@ class TUIApp {
|
|
|
66134
66206
|
source: this.session.session.turns.length > 0 ? "resume" : "startup"
|
|
66135
66207
|
});
|
|
66136
66208
|
const logPath = getSessionLogPath(this.session.session.date, this.session.session.id);
|
|
66137
|
-
if (this.session.session.turns.length > 0 ||
|
|
66209
|
+
if (this.session.session.turns.length > 0 || existsSync19(logPath)) {
|
|
66138
66210
|
renderTranscript(this.engine, this.session.session, this.header);
|
|
66139
66211
|
} else {
|
|
66140
66212
|
this.engine.commit("header", this.header.render());
|