@hasna/coders 0.1.8 → 0.1.9
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.mjs +39 -30
- package/dist/cli.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -62587,29 +62587,40 @@ function renderBlockquote(token) {
|
|
|
62587
62587
|
}
|
|
62588
62588
|
function renderTable(token, maxWidth) {
|
|
62589
62589
|
const lines = [];
|
|
62590
|
-
const
|
|
62590
|
+
const stripMd = (s) => s.replace(/\*\*(.+?)\*\*/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
|
|
62591
|
+
const colWidths = token.header.map((h) => stripMd(h.text).length);
|
|
62591
62592
|
for (const row of token.rows) {
|
|
62592
62593
|
for (let i = 0; i < row.length; i++) {
|
|
62593
|
-
colWidths[i] = Math.max(colWidths[i] ?? 0, row[i].text.length);
|
|
62594
|
+
colWidths[i] = Math.max(colWidths[i] ?? 0, stripMd(row[i].text).length);
|
|
62594
62595
|
}
|
|
62595
62596
|
}
|
|
62596
|
-
const
|
|
62597
|
-
|
|
62598
|
-
|
|
62597
|
+
const overhead = colWidths.length * 3 + 1;
|
|
62598
|
+
const maxTable = maxWidth - 4;
|
|
62599
|
+
const totalWidth = colWidths.reduce((a, b) => a + b, 0) + overhead;
|
|
62600
|
+
if (totalWidth > maxTable) {
|
|
62601
|
+
const available = maxTable - overhead;
|
|
62602
|
+
const total = colWidths.reduce((a, b) => a + b, 0);
|
|
62599
62603
|
for (let i = 0; i < colWidths.length; i++) {
|
|
62600
|
-
colWidths[i] = Math.max(
|
|
62604
|
+
colWidths[i] = Math.max(4, Math.floor(colWidths[i] / total * available));
|
|
62601
62605
|
}
|
|
62602
62606
|
}
|
|
62603
|
-
const headerLine = token.header.map((h, i) =>
|
|
62607
|
+
const headerLine = token.header.map((h, i) => padRendered(renderInline(h.text), stripMd(h.text), colWidths[i])).join(` ${FG_GRAY}\u2502${FG_DEFAULT} `);
|
|
62604
62608
|
lines.push(`${BOLD}${headerLine}${BOLD_OFF}`);
|
|
62605
62609
|
const sepLine = colWidths.map((w) => "\u2500".repeat(w)).join(`\u2500\u253C\u2500`);
|
|
62606
62610
|
lines.push(`${FG_GRAY}${sepLine}${FG_DEFAULT}`);
|
|
62607
62611
|
for (const row of token.rows) {
|
|
62608
|
-
const rowLine = row.map((cell, i) =>
|
|
62612
|
+
const rowLine = row.map((cell, i) => padRendered(renderInline(cell.text), stripMd(cell.text), colWidths[i])).join(` ${FG_GRAY}\u2502${FG_DEFAULT} `);
|
|
62609
62613
|
lines.push(rowLine);
|
|
62610
62614
|
}
|
|
62611
62615
|
return lines;
|
|
62612
62616
|
}
|
|
62617
|
+
function padRendered(rendered, plain, width) {
|
|
62618
|
+
if (plain.length >= width) {
|
|
62619
|
+
const truncPlain = plain.slice(0, width - 1) + "\u2026";
|
|
62620
|
+
return renderInline(truncPlain);
|
|
62621
|
+
}
|
|
62622
|
+
return rendered + " ".repeat(width - plain.length);
|
|
62623
|
+
}
|
|
62613
62624
|
function renderInline(text) {
|
|
62614
62625
|
return renderInlineWithRestore(text, "");
|
|
62615
62626
|
}
|
|
@@ -62641,10 +62652,6 @@ function highlightSyntax(line, lang) {
|
|
|
62641
62652
|
result = result.replace(/\b(\d+\.?\d*)\b/g, `${FG_YELLOW}$1${FG_DEFAULT}`);
|
|
62642
62653
|
return result;
|
|
62643
62654
|
}
|
|
62644
|
-
function pad(text, width) {
|
|
62645
|
-
if (text.length >= width) return text.slice(0, width);
|
|
62646
|
-
return text + " ".repeat(width - text.length);
|
|
62647
|
-
}
|
|
62648
62655
|
var ESC2, RESET, BOLD, BOLD_OFF, DIM, DIM_OFF, ITALIC, ITALIC_OFF, UNDERLINE, UNDERLINE_OFF, STRIKETHROUGH, STRIKE_OFF, FG_CYAN, FG_YELLOW, FG_GREEN, FG_BLUE, FG_MAGENTA, FG_GRAY, FG_DEFAULT, BG_GRAY, BG_DEFAULT;
|
|
62649
62656
|
var init_markdown = __esm({
|
|
62650
62657
|
"src/ui/components/markdown.tsx"() {
|
|
@@ -65026,7 +65033,7 @@ var require_fill_range = __commonJS({
|
|
|
65026
65033
|
}
|
|
65027
65034
|
return options2.stringify === true;
|
|
65028
65035
|
};
|
|
65029
|
-
var
|
|
65036
|
+
var pad = (input, maxLength, toNumber) => {
|
|
65030
65037
|
if (maxLength > 0) {
|
|
65031
65038
|
let dash = input[0] === "-" ? "-" : "";
|
|
65032
65039
|
if (dash) input = input.slice(1);
|
|
@@ -65128,7 +65135,7 @@ var require_fill_range = __commonJS({
|
|
|
65128
65135
|
if (options2.toRegex === true && step > 1) {
|
|
65129
65136
|
push(a);
|
|
65130
65137
|
} else {
|
|
65131
|
-
range.push(
|
|
65138
|
+
range.push(pad(format(a, index), maxLen, toNumber));
|
|
65132
65139
|
}
|
|
65133
65140
|
a = descending ? a - step : a + step;
|
|
65134
65141
|
index++;
|
|
@@ -90246,8 +90253,12 @@ function shortPath(p) {
|
|
|
90246
90253
|
}
|
|
90247
90254
|
function toolSummary(name, input) {
|
|
90248
90255
|
switch (name) {
|
|
90249
|
-
case "Bash":
|
|
90250
|
-
|
|
90256
|
+
case "Bash": {
|
|
90257
|
+
let cmd = String(input.command ?? "");
|
|
90258
|
+
const cwd2 = process.cwd();
|
|
90259
|
+
if (cwd2 && cmd.includes(cwd2)) cmd = cmd.replaceAll(cwd2, ".");
|
|
90260
|
+
return cmd.slice(0, 60);
|
|
90261
|
+
}
|
|
90251
90262
|
case "Read":
|
|
90252
90263
|
return shortPath(String(input.file_path ?? ""));
|
|
90253
90264
|
case "Edit":
|
|
@@ -90308,18 +90319,18 @@ function SpinnerDot() {
|
|
|
90308
90319
|
}
|
|
90309
90320
|
function ToolItem({ tool }) {
|
|
90310
90321
|
const f = useSpinner(tool.status === "running");
|
|
90311
|
-
const icon = tool.status === "running" ? f :
|
|
90312
|
-
const color = tool.status === "running" ? "
|
|
90313
|
-
const toolArgs = tool.summary ? `
|
|
90322
|
+
const icon = tool.status === "running" ? f : "\u25CF";
|
|
90323
|
+
const color = tool.status === "running" ? "cyan" : tool.status === "error" ? "red" : "cyan";
|
|
90324
|
+
const toolArgs = tool.summary ? ` ${tool.summary.slice(0, 50)}` : "";
|
|
90314
90325
|
const dur = tool.durationMs != null ? ` (${(tool.durationMs / 1e3).toFixed(1)}s)` : "";
|
|
90315
90326
|
const resultLine = tool.result && tool.status === "done" ? formatToolResult(tool.name, tool.result)[0] ?? "" : "";
|
|
90316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
90327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop: 0, children: [
|
|
90317
90328
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90318
90329
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color, children: [
|
|
90319
90330
|
icon,
|
|
90320
90331
|
" "
|
|
90321
90332
|
] }),
|
|
90322
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, children: tool.name }),
|
|
90333
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color, children: tool.name }),
|
|
90323
90334
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
90324
90335
|
toolArgs,
|
|
90325
90336
|
dur
|
|
@@ -90331,7 +90342,7 @@ function ToolItem({ tool }) {
|
|
|
90331
90342
|
CONN,
|
|
90332
90343
|
" "
|
|
90333
90344
|
] }),
|
|
90334
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: resultLine.slice(0, 90) })
|
|
90345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: resultLine.slice(0, 90) })
|
|
90335
90346
|
] }),
|
|
90336
90347
|
tool.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90337
90348
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
@@ -90896,11 +90907,12 @@ function App2({ model, mode, dangerouslySkipPermissions, initialPrompt, resumedS
|
|
|
90896
90907
|
else if (!key.ctrl && !key.meta && ch) setInput((p) => p + ch);
|
|
90897
90908
|
});
|
|
90898
90909
|
const cols = stdout?.columns ?? 80;
|
|
90899
|
-
const
|
|
90910
|
+
const pad = 2;
|
|
90911
|
+
const sep = "\u2500".repeat(Math.min(cols - pad, 120));
|
|
90900
90912
|
const hasRunningTools = activeTools.some((t) => t.status === "running");
|
|
90901
90913
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
90902
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Static, { items: msgs, children: (msg) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageView, { msg }) }, msg.id) }),
|
|
90903
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
90914
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Static, { items: msgs, children: (msg) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageView, { msg }) }, msg.id) }),
|
|
90915
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, children: [
|
|
90904
90916
|
busy && activeTools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", children: activeTools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolItem, { tool: t }, t.id)) }),
|
|
90905
90917
|
busy && thinkingText && !streaming && activeTools.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
90906
90918
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
@@ -90914,10 +90926,7 @@ function App2({ model, mode, dangerouslySkipPermissions, initialPrompt, resumedS
|
|
|
90914
90926
|
line.slice(0, 120)
|
|
90915
90927
|
] }) }, i))
|
|
90916
90928
|
] }),
|
|
90917
|
-
busy && streaming && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
90918
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: "\u25CF " }),
|
|
90919
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: streaming.split("\n").filter((l) => l.trim()).slice(-3).join("\n").slice(-200) })
|
|
90920
|
-
] }),
|
|
90929
|
+
busy && streaming && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: streaming.split("\n").filter((l) => l.trim()).slice(-3).join("\n").slice(-200) }) }),
|
|
90921
90930
|
busy && !streaming && !thinkingText && activeTools.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90922
90931
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerDot, {}),
|
|
90923
90932
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: " Thinking..." })
|
|
@@ -93424,7 +93433,7 @@ var VERSION, BUILD_TIME, PACKAGE_NAME, ISSUES_URL, startupTimestamps, originalCw
|
|
|
93424
93433
|
var init_index = __esm({
|
|
93425
93434
|
"src/cli/index.ts"() {
|
|
93426
93435
|
VERSION = "0.1.2";
|
|
93427
|
-
BUILD_TIME = "2026-03-20T18:
|
|
93436
|
+
BUILD_TIME = "2026-03-20T18:42:45.981Z";
|
|
93428
93437
|
PACKAGE_NAME = "@hasna/coders";
|
|
93429
93438
|
ISSUES_URL = "https://github.com/hasnaxyz/open-coders/issues";
|
|
93430
93439
|
startupTimestamps = {};
|