@hasna/coders 0.0.4 → 0.0.6
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 +101 -29
- package/dist/cli.mjs.map +2 -2
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -58429,7 +58429,7 @@ var init_client = __esm({
|
|
|
58429
58429
|
"Content-Type": "application/json",
|
|
58430
58430
|
"anthropic-version": "2023-06-01",
|
|
58431
58431
|
"anthropic-beta": BETA_HEADERS.join(","),
|
|
58432
|
-
"User-Agent": `coders/${"0.0.
|
|
58432
|
+
"User-Agent": `coders/${"0.0.6"}`
|
|
58433
58433
|
};
|
|
58434
58434
|
if (key.isOAuth) {
|
|
58435
58435
|
headers["Authorization"] = `Bearer ${key.apiKey}`;
|
|
@@ -67468,6 +67468,10 @@ function toolSummary(name, input) {
|
|
|
67468
67468
|
return "";
|
|
67469
67469
|
}
|
|
67470
67470
|
}
|
|
67471
|
+
function SpinnerDot() {
|
|
67472
|
+
const f = useSpinner(true);
|
|
67473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "cyan", children: f });
|
|
67474
|
+
}
|
|
67471
67475
|
function Header({ model, mode }) {
|
|
67472
67476
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginBottom: 1, children: [
|
|
67473
67477
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, color: "cyan", children: "@hasna/coders" }),
|
|
@@ -67483,40 +67487,99 @@ function Header({ model, mode }) {
|
|
|
67483
67487
|
}
|
|
67484
67488
|
function ToolItem({ tool }) {
|
|
67485
67489
|
const f = useSpinner(tool.status === "running");
|
|
67486
|
-
const icon = tool.status === "running" ?
|
|
67490
|
+
const icon = tool.status === "running" ? "\xB7" : tool.status === "error" ? "\u25CF" : "\u25CF";
|
|
67487
67491
|
const color = tool.status === "running" ? "yellow" : tool.status === "error" ? "red" : "green";
|
|
67492
|
+
const toolArgs = tool.summary ? `(${tool.summary.slice(0, 70)})` : "";
|
|
67493
|
+
const resultPreview = tool.result && tool.status === "done" ? formatToolResult(tool.name, tool.result) : null;
|
|
67488
67494
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
67489
67495
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
67490
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67491
|
-
" ",
|
|
67492
|
-
CONN,
|
|
67493
|
-
" "
|
|
67494
|
-
] }),
|
|
67495
67496
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color, children: [
|
|
67496
|
-
icon,
|
|
67497
|
+
tool.status === "running" ? f : icon,
|
|
67497
67498
|
" "
|
|
67498
67499
|
] }),
|
|
67499
67500
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, children: tool.name }),
|
|
67500
|
-
|
|
67501
|
-
" ",
|
|
67502
|
-
tool.summary.slice(0, 60)
|
|
67503
|
-
] }),
|
|
67501
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: toolArgs }),
|
|
67504
67502
|
tool.durationMs != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67505
67503
|
" (",
|
|
67506
67504
|
(tool.durationMs / 1e3).toFixed(1),
|
|
67507
67505
|
"s)"
|
|
67508
67506
|
] })
|
|
67509
67507
|
] }),
|
|
67508
|
+
tool.status === "done" && resultPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", children: resultPreview.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
67509
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67510
|
+
" ",
|
|
67511
|
+
CONN,
|
|
67512
|
+
" "
|
|
67513
|
+
] }),
|
|
67514
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line })
|
|
67515
|
+
] }, i)) }),
|
|
67510
67516
|
tool.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
67511
67517
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67512
|
-
"
|
|
67518
|
+
" ",
|
|
67513
67519
|
CONN,
|
|
67514
67520
|
" "
|
|
67515
67521
|
] }),
|
|
67516
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: tool.error.slice(0,
|
|
67522
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: tool.error.slice(0, 200) })
|
|
67517
67523
|
] })
|
|
67518
67524
|
] });
|
|
67519
67525
|
}
|
|
67526
|
+
function formatToolResult(toolName, result) {
|
|
67527
|
+
const lines = [];
|
|
67528
|
+
if (!result || result === "(no output)") {
|
|
67529
|
+
lines.push("Done");
|
|
67530
|
+
return lines;
|
|
67531
|
+
}
|
|
67532
|
+
switch (toolName) {
|
|
67533
|
+
case "Bash": {
|
|
67534
|
+
const preview = result.split("\n").slice(0, 5);
|
|
67535
|
+
lines.push(...preview);
|
|
67536
|
+
const total = result.split("\n").length;
|
|
67537
|
+
if (total > 5) lines.push(`\u2026 +${total - 5} lines (ctrl+o to expand)`);
|
|
67538
|
+
break;
|
|
67539
|
+
}
|
|
67540
|
+
case "Read": {
|
|
67541
|
+
const numLines = result.split("\n").length;
|
|
67542
|
+
lines.push(`Read ${numLines} lines`);
|
|
67543
|
+
break;
|
|
67544
|
+
}
|
|
67545
|
+
case "Edit": {
|
|
67546
|
+
if (result.includes("Successfully edited")) lines.push(result.split("\n")[0]);
|
|
67547
|
+
else lines.push(result.slice(0, 100));
|
|
67548
|
+
break;
|
|
67549
|
+
}
|
|
67550
|
+
case "Write": {
|
|
67551
|
+
if (result.includes("Created") || result.includes("Updated")) lines.push(result.split("\n")[0]);
|
|
67552
|
+
else lines.push(result.slice(0, 100));
|
|
67553
|
+
break;
|
|
67554
|
+
}
|
|
67555
|
+
case "Glob": {
|
|
67556
|
+
const files = result.split("\n").filter((l) => l.trim());
|
|
67557
|
+
lines.push(`Found ${files.length} files`);
|
|
67558
|
+
if (files.length > 0 && files.length <= 3) lines.push(...files);
|
|
67559
|
+
else if (files.length > 3) {
|
|
67560
|
+
lines.push(...files.slice(0, 3));
|
|
67561
|
+
lines.push(`\u2026 +${files.length - 3} more files`);
|
|
67562
|
+
}
|
|
67563
|
+
break;
|
|
67564
|
+
}
|
|
67565
|
+
case "Grep": {
|
|
67566
|
+
const matches = result.split("\n").filter((l) => l.trim());
|
|
67567
|
+
if (result.includes("No matches")) lines.push("No matches found");
|
|
67568
|
+
else {
|
|
67569
|
+
lines.push(`${matches.length} matches`);
|
|
67570
|
+
if (matches.length <= 3) lines.push(...matches);
|
|
67571
|
+
else {
|
|
67572
|
+
lines.push(...matches.slice(0, 3));
|
|
67573
|
+
lines.push(`\u2026 +${matches.length - 3} more`);
|
|
67574
|
+
}
|
|
67575
|
+
}
|
|
67576
|
+
break;
|
|
67577
|
+
}
|
|
67578
|
+
default:
|
|
67579
|
+
lines.push(result.slice(0, 100));
|
|
67580
|
+
}
|
|
67581
|
+
return lines;
|
|
67582
|
+
}
|
|
67520
67583
|
function MessageView({ msg }) {
|
|
67521
67584
|
if (msg.role === "user") {
|
|
67522
67585
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 1, children: [
|
|
@@ -67530,11 +67593,13 @@ function MessageView({ msg }) {
|
|
|
67530
67593
|
if (msg.role === "system") {
|
|
67531
67594
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: msg.content }) });
|
|
67532
67595
|
}
|
|
67533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop:
|
|
67534
|
-
msg.thinking && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, italic: true, children: "thinking..." }) }),
|
|
67535
|
-
msg.content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: msg.content }),
|
|
67596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop: 0, children: [
|
|
67536
67597
|
msg.tools?.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolItem, { tool: t }, t.id)),
|
|
67537
|
-
msg.
|
|
67598
|
+
msg.content && msg.content !== "(no response)" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
67599
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: "\u25CF " }),
|
|
67600
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: msg.content })
|
|
67601
|
+
] }) }),
|
|
67602
|
+
msg.durationMs != null && msg.durationMs > 1e3 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67538
67603
|
VERBS[Math.floor(Math.random() * VERBS.length)],
|
|
67539
67604
|
" for ",
|
|
67540
67605
|
fmtDur(msg.durationMs)
|
|
@@ -67680,6 +67745,7 @@ function App2({ model, mode, initialPrompt }) {
|
|
|
67680
67745
|
if (initialPrompt) submit(initialPrompt);
|
|
67681
67746
|
}, []);
|
|
67682
67747
|
use_input_default((ch, key) => {
|
|
67748
|
+
if (permissionPending) return;
|
|
67683
67749
|
if (busy) {
|
|
67684
67750
|
if (key.ctrl && ch === "c") {
|
|
67685
67751
|
setBusy(false);
|
|
@@ -67705,14 +67771,18 @@ function App2({ model, mode, initialPrompt }) {
|
|
|
67705
67771
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, { model, mode }),
|
|
67706
67772
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, overflow: "hidden", children: [
|
|
67707
67773
|
visible.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageView, { msg: m }, m.id)),
|
|
67708
|
-
busy && activeTools.
|
|
67709
|
-
busy && streaming && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
67710
|
-
|
|
67711
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
67712
|
-
|
|
67713
|
-
|
|
67714
|
-
|
|
67715
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
67774
|
+
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)) }),
|
|
67775
|
+
busy && streaming && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
|
|
67776
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: "\u25CF " }),
|
|
67777
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: streaming })
|
|
67778
|
+
] }),
|
|
67779
|
+
busy && !streaming && !permissionPending && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
|
|
67780
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerDot, {}),
|
|
67781
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
67782
|
+
" ",
|
|
67783
|
+
activeTools.some((t) => t.status === "running") ? "Working" : "Thinking",
|
|
67784
|
+
"..."
|
|
67785
|
+
] })
|
|
67716
67786
|
] }),
|
|
67717
67787
|
permissionPending && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
67718
67788
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
@@ -67737,14 +67807,16 @@ function App2({ model, mode, initialPrompt }) {
|
|
|
67737
67807
|
] })
|
|
67738
67808
|
] })
|
|
67739
67809
|
] }),
|
|
67810
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(stdout?.columns ?? 80, 120)) }) }),
|
|
67740
67811
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
67741
67812
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color: "cyan", bold: true, children: [
|
|
67742
67813
|
PROMPT,
|
|
67743
67814
|
" "
|
|
67744
67815
|
] }),
|
|
67745
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: input }),
|
|
67816
|
+
input.startsWith("/") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "magenta", children: input }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: input }),
|
|
67746
67817
|
!busy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "gray", children: "\u258E" })
|
|
67747
67818
|
] }),
|
|
67819
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: "\u2500".repeat(Math.min(stdout?.columns ?? 80, 120)) }) }),
|
|
67748
67820
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, { model, mode, cost, tokens })
|
|
67749
67821
|
] });
|
|
67750
67822
|
}
|
|
@@ -68033,8 +68105,8 @@ async function bootstrap() {
|
|
|
68033
68105
|
var VERSION, BUILD_TIME, PACKAGE_NAME2, ISSUES_URL2, startupTimestamps, originalCwd, RESET_TERMINAL, cleanupHandlers, earlyInput, earlyInputCapturing;
|
|
68034
68106
|
var init_index = __esm({
|
|
68035
68107
|
"src/cli/index.ts"() {
|
|
68036
|
-
VERSION = "0.0.
|
|
68037
|
-
BUILD_TIME = "2026-03-20T07:
|
|
68108
|
+
VERSION = "0.0.6";
|
|
68109
|
+
BUILD_TIME = "2026-03-20T07:47:43.689Z";
|
|
68038
68110
|
PACKAGE_NAME2 = "@hasna/coders";
|
|
68039
68111
|
ISSUES_URL2 = "https://github.com/hasnaxyz/open-coders/issues";
|
|
68040
68112
|
startupTimestamps = {};
|