@hasna/coders 0.1.7 → 0.1.8
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 +38 -43
- package/dist/cli.mjs.map +3 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -90236,24 +90236,32 @@ function createToolHandlers(mcpHandlers) {
|
|
|
90236
90236
|
}
|
|
90237
90237
|
return builtinHandlers;
|
|
90238
90238
|
}
|
|
90239
|
+
function shortPath(p) {
|
|
90240
|
+
if (!p) return "";
|
|
90241
|
+
const cwd2 = process.cwd();
|
|
90242
|
+
if (p.startsWith(cwd2 + "/")) return p.slice(cwd2.length + 1);
|
|
90243
|
+
if (p.startsWith(cwd2)) return p.slice(cwd2.length) || ".";
|
|
90244
|
+
const segs = p.split("/").filter(Boolean);
|
|
90245
|
+
return segs.length > 2 ? `\u2026/${segs.slice(-2).join("/")}` : p;
|
|
90246
|
+
}
|
|
90239
90247
|
function toolSummary(name, input) {
|
|
90240
90248
|
switch (name) {
|
|
90241
90249
|
case "Bash":
|
|
90242
|
-
return String(input.command ?? "").slice(0,
|
|
90250
|
+
return String(input.command ?? "").slice(0, 60);
|
|
90243
90251
|
case "Read":
|
|
90244
|
-
return String(input.file_path ?? "");
|
|
90252
|
+
return shortPath(String(input.file_path ?? ""));
|
|
90245
90253
|
case "Edit":
|
|
90246
|
-
return String(input.file_path ?? "");
|
|
90254
|
+
return shortPath(String(input.file_path ?? ""));
|
|
90247
90255
|
case "Write":
|
|
90248
|
-
return String(input.file_path ?? "");
|
|
90256
|
+
return shortPath(String(input.file_path ?? ""));
|
|
90249
90257
|
case "Glob":
|
|
90250
90258
|
return String(input.pattern ?? "");
|
|
90251
90259
|
case "Grep":
|
|
90252
90260
|
return String(input.pattern ?? "");
|
|
90253
90261
|
case "Agent":
|
|
90254
|
-
return String(input.description ?? input.prompt ?? "").slice(0,
|
|
90262
|
+
return String(input.description ?? input.prompt ?? "").slice(0, 50);
|
|
90255
90263
|
case "TaskCreate":
|
|
90256
|
-
return String(input.subject ?? "").slice(0,
|
|
90264
|
+
return String(input.subject ?? "").slice(0, 50);
|
|
90257
90265
|
case "TaskGet":
|
|
90258
90266
|
return `#${input.taskId ?? ""}`;
|
|
90259
90267
|
case "TaskList":
|
|
@@ -90263,17 +90271,17 @@ function toolSummary(name, input) {
|
|
|
90263
90271
|
case "AskUserQuestion":
|
|
90264
90272
|
return `${input.questions?.length ?? 0} question(s)`;
|
|
90265
90273
|
case "WebSearch":
|
|
90266
|
-
return String(input.query ?? "").slice(0,
|
|
90274
|
+
return String(input.query ?? "").slice(0, 50);
|
|
90267
90275
|
case "WebFetch":
|
|
90268
|
-
return String(input.url ?? "").slice(0,
|
|
90276
|
+
return String(input.url ?? "").slice(0, 50);
|
|
90269
90277
|
case "LSP":
|
|
90270
|
-
return `${input.operation ?? ""} ${input.filePath ?? ""}`.trim();
|
|
90278
|
+
return `${input.operation ?? ""} ${shortPath(String(input.filePath ?? ""))}`.trim();
|
|
90271
90279
|
case "EnterPlanMode":
|
|
90272
90280
|
return "";
|
|
90273
90281
|
case "ExitPlanMode":
|
|
90274
90282
|
return "";
|
|
90275
90283
|
case "ToolSearch":
|
|
90276
|
-
return String(input.query ?? "").slice(0,
|
|
90284
|
+
return String(input.query ?? "").slice(0, 50);
|
|
90277
90285
|
case "CronCreate":
|
|
90278
90286
|
return String(input.cron ?? "");
|
|
90279
90287
|
case "CronDelete":
|
|
@@ -90285,7 +90293,7 @@ function toolSummary(name, input) {
|
|
|
90285
90293
|
case "ExitWorktree":
|
|
90286
90294
|
return String(input.action ?? "");
|
|
90287
90295
|
case "NotebookEdit":
|
|
90288
|
-
return String(input.notebook_path ?? "");
|
|
90296
|
+
return shortPath(String(input.notebook_path ?? ""));
|
|
90289
90297
|
case "Config":
|
|
90290
90298
|
return String(input.setting ?? "");
|
|
90291
90299
|
case "SendMessage":
|
|
@@ -90300,40 +90308,30 @@ function SpinnerDot() {
|
|
|
90300
90308
|
}
|
|
90301
90309
|
function ToolItem({ tool }) {
|
|
90302
90310
|
const f = useSpinner(tool.status === "running");
|
|
90303
|
-
const icon = tool.status === "running" ?
|
|
90311
|
+
const icon = tool.status === "running" ? f : tool.status === "error" ? "\u25CF" : "\u25CF";
|
|
90304
90312
|
const color = tool.status === "running" ? "yellow" : tool.status === "error" ? "red" : "green";
|
|
90305
|
-
const toolArgs = tool.summary ? `(${tool.summary.slice(0,
|
|
90306
|
-
const
|
|
90313
|
+
const toolArgs = tool.summary ? `(${tool.summary.slice(0, 50)})` : "";
|
|
90314
|
+
const dur = tool.durationMs != null ? ` (${(tool.durationMs / 1e3).toFixed(1)}s)` : "";
|
|
90315
|
+
const resultLine = tool.result && tool.status === "done" ? formatToolResult(tool.name, tool.result)[0] ?? "" : "";
|
|
90307
90316
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
90308
90317
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90309
90318
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { color, children: [
|
|
90310
|
-
|
|
90319
|
+
icon,
|
|
90311
90320
|
" "
|
|
90312
90321
|
] }),
|
|
90313
90322
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, children: tool.name }),
|
|
90314
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
90315
|
-
|
|
90316
|
-
|
|
90317
|
-
(tool.durationMs / 1e3).toFixed(1),
|
|
90318
|
-
"s)"
|
|
90323
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
90324
|
+
toolArgs,
|
|
90325
|
+
dur
|
|
90319
90326
|
] })
|
|
90320
90327
|
] }),
|
|
90321
|
-
|
|
90322
|
-
|
|
90323
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
90324
|
-
" ",
|
|
90325
|
-
CONN,
|
|
90326
|
-
" "
|
|
90327
|
-
] }),
|
|
90328
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line.slice(0, 100) })
|
|
90329
|
-
] }, i)),
|
|
90330
|
-
resultPreview.length > 2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
90328
|
+
resultLine && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90329
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
90331
90330
|
" ",
|
|
90332
90331
|
CONN,
|
|
90333
|
-
"
|
|
90334
|
-
|
|
90335
|
-
|
|
90336
|
-
] }) })
|
|
90332
|
+
" "
|
|
90333
|
+
] }),
|
|
90334
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: resultLine.slice(0, 90) })
|
|
90337
90335
|
] }),
|
|
90338
90336
|
tool.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
|
|
90339
90337
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
|
|
@@ -90341,7 +90339,7 @@ function ToolItem({ tool }) {
|
|
|
90341
90339
|
CONN,
|
|
90342
90340
|
" "
|
|
90343
90341
|
] }),
|
|
90344
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: tool.error.slice(0,
|
|
90342
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: tool.error.slice(0, 90) })
|
|
90345
90343
|
] })
|
|
90346
90344
|
] });
|
|
90347
90345
|
}
|
|
@@ -90352,24 +90350,21 @@ function formatToolResult(toolName, result) {
|
|
|
90352
90350
|
case "Bash": {
|
|
90353
90351
|
if (result.includes("Exit code:")) return [result.split("\n").find((l) => l.includes("Exit code:")) ?? "Done"];
|
|
90354
90352
|
const firstLine = result.split("\n").find((l) => l.trim()) ?? "Done";
|
|
90355
|
-
|
|
90356
|
-
return [firstLine.slice(0, 100)];
|
|
90353
|
+
return totalLines > 1 ? [`${shortPath(firstLine).slice(0, 70)}\u2026 +${totalLines - 1} lines`] : [shortPath(firstLine).slice(0, 80)];
|
|
90357
90354
|
}
|
|
90358
90355
|
case "Read":
|
|
90359
90356
|
return [`Read ${totalLines} lines`];
|
|
90360
90357
|
case "Edit":
|
|
90361
|
-
|
|
90362
|
-
if (result.includes("replacement")) return [result.split("\n")[0].slice(0, 100)];
|
|
90363
|
-
return [`Edited (${totalLines} lines changed)`];
|
|
90358
|
+
return [result.includes("Successfully") ? shortPath(result.split("\n")[0]).slice(0, 80) : `Edited (${totalLines} lines changed)`];
|
|
90364
90359
|
case "Write":
|
|
90365
|
-
return [result.split("\n")
|
|
90360
|
+
return [shortPath(result.split("\n").filter((l) => l.trim()).join(" ")).slice(0, 80)];
|
|
90366
90361
|
case "Glob":
|
|
90367
90362
|
return [`Found ${result.split("\n").filter((l) => l.trim()).length} files`];
|
|
90368
90363
|
case "Grep":
|
|
90369
90364
|
if (result.includes("No matches")) return ["No matches found"];
|
|
90370
90365
|
return [`${result.split("\n").filter((l) => l.trim()).length} matches`];
|
|
90371
90366
|
default:
|
|
90372
|
-
return [result.split("\n")[0]
|
|
90367
|
+
return [shortPath(result.split("\n")[0] ?? "Done").slice(0, 70)];
|
|
90373
90368
|
}
|
|
90374
90369
|
}
|
|
90375
90370
|
function ThinkingBlock({ text }) {
|
|
@@ -93429,7 +93424,7 @@ var VERSION, BUILD_TIME, PACKAGE_NAME, ISSUES_URL, startupTimestamps, originalCw
|
|
|
93429
93424
|
var init_index = __esm({
|
|
93430
93425
|
"src/cli/index.ts"() {
|
|
93431
93426
|
VERSION = "0.1.2";
|
|
93432
|
-
BUILD_TIME = "2026-03-20T18:
|
|
93427
|
+
BUILD_TIME = "2026-03-20T18:36:45.761Z";
|
|
93433
93428
|
PACKAGE_NAME = "@hasna/coders";
|
|
93434
93429
|
ISSUES_URL = "https://github.com/hasnaxyz/open-coders/issues";
|
|
93435
93430
|
startupTimestamps = {};
|