@standardagents/code 0.6.0 → 0.6.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/index.js +46 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -796,13 +796,7 @@ var Bridge = class {
|
|
|
796
796
|
this.hooks.onStatus?.(callKey, null);
|
|
797
797
|
}
|
|
798
798
|
if (result.ok) {
|
|
799
|
-
const display
|
|
800
|
-
let detail;
|
|
801
|
-
if (req.tool === "edit_file") {
|
|
802
|
-
detail = diffLines(String(req.args.old_string ?? ""), String(req.args.new_string ?? ""));
|
|
803
|
-
} else if (req.tool === "write_file") {
|
|
804
|
-
detail = newFileLines(String(req.args.content ?? ""));
|
|
805
|
-
}
|
|
799
|
+
const { display, detail } = activityPresentation(req, summary);
|
|
806
800
|
this.hooks.onActivity(`\u2713 ${display}${detailSuffix(req.tool, result.result)}`, detail);
|
|
807
801
|
this.respond(req, true, result.result ?? "");
|
|
808
802
|
} else {
|
|
@@ -820,6 +814,35 @@ function permissionKey(req) {
|
|
|
820
814
|
if (action === "list_tools") return `mcp:${server}/list`;
|
|
821
815
|
return `mcp:${server}/${String(a.tool || "?")}`;
|
|
822
816
|
}
|
|
817
|
+
var DIM2 = "\x1B[2m";
|
|
818
|
+
var RESET2 = "\x1B[0m";
|
|
819
|
+
function activityPresentation(req, summary) {
|
|
820
|
+
const a = req.args;
|
|
821
|
+
const cols2 = Math.max(40, process.stdout.columns || 80);
|
|
822
|
+
if (req.tool === "bash") {
|
|
823
|
+
return { display: `bash: ${highlightBash(oneLineCommand(String(a.command ?? ""), cols2 - 20))}` };
|
|
824
|
+
}
|
|
825
|
+
if (req.tool === "edit_file") {
|
|
826
|
+
return { display: summary, detail: diffLines(String(a.old_string ?? ""), String(a.new_string ?? "")) };
|
|
827
|
+
}
|
|
828
|
+
if (req.tool === "write_file") {
|
|
829
|
+
return { display: summary, detail: newFileLines(String(a.content ?? "")) };
|
|
830
|
+
}
|
|
831
|
+
if (req.tool === "background_process") {
|
|
832
|
+
const action = String(a.action || "list");
|
|
833
|
+
const id = a.id ? ` ${String(a.id)}` : "";
|
|
834
|
+
const display = action === "start" ? "bg start" : `bg ${action}${id}`;
|
|
835
|
+
const detail = [];
|
|
836
|
+
if (action === "start" && a.command) {
|
|
837
|
+
detail.push(` ${DIM2}${oneLineCommand(String(a.command), cols2 - 8)}${RESET2}`);
|
|
838
|
+
}
|
|
839
|
+
if (typeof a.description === "string" && a.description.trim()) {
|
|
840
|
+
detail.push(` ${DIM2}${oneLineCommand(a.description, cols2 - 8)}${RESET2}`);
|
|
841
|
+
}
|
|
842
|
+
return { display, detail: detail.length ? detail : void 0 };
|
|
843
|
+
}
|
|
844
|
+
return { display: summary };
|
|
845
|
+
}
|
|
823
846
|
function describe(req) {
|
|
824
847
|
const a = req.args;
|
|
825
848
|
switch (req.tool) {
|
|
@@ -846,6 +869,12 @@ function describe(req) {
|
|
|
846
869
|
return `skill ${a.skill}: run ${a.entry}`;
|
|
847
870
|
case "bash":
|
|
848
871
|
return `bash: ${oneLineCommand(String(a.command ?? ""), 80)}`;
|
|
872
|
+
case "background_process": {
|
|
873
|
+
const action = String(a.action || "list");
|
|
874
|
+
if (action === "start") return `bg start: ${oneLineCommand(String(a.command ?? ""), 80)}`;
|
|
875
|
+
if (action === "list") return "bg list";
|
|
876
|
+
return `bg ${action}${a.id ? ` ${String(a.id)}` : ""}`;
|
|
877
|
+
}
|
|
849
878
|
default:
|
|
850
879
|
return `${req.tool} ${JSON.stringify(a).slice(0, 80)}`;
|
|
851
880
|
}
|
|
@@ -1889,7 +1918,7 @@ var LAZY_MS = 320;
|
|
|
1889
1918
|
var LAZY_PERIOD = 200;
|
|
1890
1919
|
var FAST_PERIOD = 70;
|
|
1891
1920
|
var BOLD = "\x1B[1m";
|
|
1892
|
-
var
|
|
1921
|
+
var DIM3 = "\x1B[2m";
|
|
1893
1922
|
var OFF = "\x1B[22m";
|
|
1894
1923
|
function glyphAt(slot, bucket) {
|
|
1895
1924
|
let h = (slot + 1) * 2654435761 ^ (bucket + 1) * 40503;
|
|
@@ -1961,7 +1990,7 @@ var WordMill = class {
|
|
|
1961
1990
|
} else if (t < s.land) {
|
|
1962
1991
|
const age = t - s.start;
|
|
1963
1992
|
const period = age < LAZY_MS ? LAZY_PERIOD : FAST_PERIOD;
|
|
1964
|
-
out += `${
|
|
1993
|
+
out += `${DIM3}${glyphAt(i, Math.floor(t / period))}${OFF}`;
|
|
1965
1994
|
} else {
|
|
1966
1995
|
const ch = target[i];
|
|
1967
1996
|
if (ch) out += `${BOLD}${ch}${OFF}`;
|
|
@@ -3053,7 +3082,8 @@ var Tui = class _Tui {
|
|
|
3053
3082
|
const t = s.length > max ? s.slice(0, Math.max(0, max - 1)) + "\u2026" : s;
|
|
3054
3083
|
return wrap ? `${lead}${wrap}${t}${C.reset}` : `${lead}${t}`;
|
|
3055
3084
|
};
|
|
3056
|
-
const
|
|
3085
|
+
const leakedMarkup = /<\/?[||]DSML[||]|^\s*\[\/?SESSION\]\s*<?\s*$/;
|
|
3086
|
+
const realLines = (text) => text.replace(/\r/g, "").split("\n").filter((l) => l.trim() !== "" && !leakedMarkup.test(l));
|
|
3057
3087
|
if (this.streamResponse) {
|
|
3058
3088
|
const all = realLines(this.streamResponse);
|
|
3059
3089
|
const shown = all.slice(-20);
|
|
@@ -3501,7 +3531,7 @@ function appendHistory(store, threadId, history, text) {
|
|
|
3501
3531
|
var ESC = "\x1B[";
|
|
3502
3532
|
var R = ESC + "0m";
|
|
3503
3533
|
var BOLD2 = ESC + "1m";
|
|
3504
|
-
var
|
|
3534
|
+
var DIM4 = ESC + "2m";
|
|
3505
3535
|
var ITAL = ESC + "3m";
|
|
3506
3536
|
var UNDER = ESC + "4m";
|
|
3507
3537
|
var TEAL = ESC + "38;5;37m";
|
|
@@ -3523,11 +3553,11 @@ function inline(s) {
|
|
|
3523
3553
|
});
|
|
3524
3554
|
s = s.replace(
|
|
3525
3555
|
/\[([^\]]+)\]\(([^)\s]+)\)/g,
|
|
3526
|
-
(_, text, url) => `${CYAN}${UNDER}${text}${R} ${
|
|
3556
|
+
(_, text, url) => `${CYAN}${UNDER}${text}${R} ${DIM4}${url}${R}`
|
|
3527
3557
|
);
|
|
3528
3558
|
s = s.replace(/\*\*([^*]+)\*\*/g, (_, t) => `${BOLD2}${t}${R}`);
|
|
3529
3559
|
s = s.replace(/\*([^*\n]+)\*/g, (_, t) => `${ITAL}${t}${R}`);
|
|
3530
|
-
s = s.replace(/~~([^~]+)~~/g, (_, t) => `${
|
|
3560
|
+
s = s.replace(/~~([^~]+)~~/g, (_, t) => `${DIM4}${t}${R}`);
|
|
3531
3561
|
s = s.replace(/\x00(\d+)\x00/g, (_, i) => `${TEAL}${codes[+i].replace(/ /g, String.fromCharCode(160))}${R}`);
|
|
3532
3562
|
return s;
|
|
3533
3563
|
}
|
|
@@ -3632,7 +3662,7 @@ function renderMarkdown(src, cols2 = 80) {
|
|
|
3632
3662
|
const quote = line.match(/^\s*>\s?(.*)$/);
|
|
3633
3663
|
if (quote) {
|
|
3634
3664
|
for (const ln of wrapStyled(inline(quote[1]), Math.max(8, cols2 - 2))) {
|
|
3635
|
-
out.push(`${GRAY}\u2502${R} ${
|
|
3665
|
+
out.push(`${GRAY}\u2502${R} ${DIM4}${ln}${R}`);
|
|
3636
3666
|
}
|
|
3637
3667
|
i++;
|
|
3638
3668
|
continue;
|
|
@@ -4098,7 +4128,7 @@ var REGISTRY_URL = `https://registry.npmjs.org/${encodeURIComponent(PKG_NAME)}`;
|
|
|
4098
4128
|
var CACHE_REL_DIR = ".config/standardagents-cli";
|
|
4099
4129
|
var CACHE_FILE = "update-check.json";
|
|
4100
4130
|
var STATE_FILE = "auto-update.json";
|
|
4101
|
-
var CACHE_TTL_MS = 1e3 * 60 * 60 *
|
|
4131
|
+
var CACHE_TTL_MS = 1e3 * 60 * 60 * 6;
|
|
4102
4132
|
var CHECK_TIMEOUT_MS = 4e3;
|
|
4103
4133
|
var IN_FLIGHT_TTL_MS = 15 * 60 * 1e3;
|
|
4104
4134
|
function cacheDir() {
|
|
@@ -4708,6 +4738,7 @@ ${c.dim}Press Control-C again to exit${c.reset}
|
|
|
4708
4738
|
await runInteractive(tui, api, threadId, projectDir, machine, resumed, historySeed);
|
|
4709
4739
|
historySeed = threadId;
|
|
4710
4740
|
threadId = await api.createThread(AGENT_ID, tags);
|
|
4741
|
+
await api.kvSet(threadId, "lease_supersedes", historySeed);
|
|
4711
4742
|
resumed = false;
|
|
4712
4743
|
}
|
|
4713
4744
|
}
|