@hasna/coders 0.1.0 → 0.1.2
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 +31 -55
- package/dist/cli.mjs.map +2 -2
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -58441,7 +58441,7 @@ var init_client = __esm({
|
|
|
58441
58441
|
"Content-Type": "application/json",
|
|
58442
58442
|
"anthropic-version": "2023-06-01",
|
|
58443
58443
|
"anthropic-beta": BETA_HEADERS.join(","),
|
|
58444
|
-
"User-Agent": `coders/${"0.1.
|
|
58444
|
+
"User-Agent": `coders/${"0.1.2"}`
|
|
58445
58445
|
};
|
|
58446
58446
|
if (key.isOAuth) {
|
|
58447
58447
|
headers["Authorization"] = `Bearer ${key.apiKey}`;
|
|
@@ -61880,7 +61880,7 @@ async function runAgentLoop(initialMessages, options2) {
|
|
|
61880
61880
|
const toolUseBlocks = contentBlocks.filter(
|
|
61881
61881
|
(b) => b.type === "tool_use"
|
|
61882
61882
|
);
|
|
61883
|
-
if (toolUseBlocks.length === 0
|
|
61883
|
+
if (toolUseBlocks.length === 0) {
|
|
61884
61884
|
options2.onTurnComplete?.(turnIndex, assistantMessage);
|
|
61885
61885
|
options2.onProgress?.({ type: "turn_end", turnIndex, stopReason });
|
|
61886
61886
|
turnIndex++;
|
|
@@ -62591,6 +62591,9 @@ var init_bash = __esm({
|
|
|
62591
62591
|
};
|
|
62592
62592
|
},
|
|
62593
62593
|
async call(input, context) {
|
|
62594
|
+
if (!input.command || typeof input.command !== "string") {
|
|
62595
|
+
return { data: { stdout: "", stderr: "Error: command is required", exitCode: 1, interrupted: false, durationMs: 0 } };
|
|
62596
|
+
}
|
|
62594
62597
|
const { command, timeout, run_in_background } = input;
|
|
62595
62598
|
const timeoutMs = timeout ?? getDefaultTimeout();
|
|
62596
62599
|
const startTime = performance.now();
|
|
@@ -70284,61 +70287,31 @@ function ToolItem({ tool }) {
|
|
|
70284
70287
|
] });
|
|
70285
70288
|
}
|
|
70286
70289
|
function formatToolResult(toolName, result) {
|
|
70287
|
-
|
|
70288
|
-
|
|
70289
|
-
lines.push("Done");
|
|
70290
|
-
return lines;
|
|
70291
|
-
}
|
|
70290
|
+
if (!result || result === "(no output)") return ["Done"];
|
|
70291
|
+
const totalLines = result.split("\n").length;
|
|
70292
70292
|
switch (toolName) {
|
|
70293
70293
|
case "Bash": {
|
|
70294
|
-
|
|
70295
|
-
|
|
70296
|
-
|
|
70297
|
-
|
|
70298
|
-
break;
|
|
70299
|
-
}
|
|
70300
|
-
case "Read": {
|
|
70301
|
-
const numLines = result.split("\n").length;
|
|
70302
|
-
lines.push(`Read ${numLines} lines`);
|
|
70303
|
-
break;
|
|
70304
|
-
}
|
|
70305
|
-
case "Edit": {
|
|
70306
|
-
if (result.includes("Successfully edited")) lines.push(result.split("\n")[0]);
|
|
70307
|
-
else lines.push(result.slice(0, 100));
|
|
70308
|
-
break;
|
|
70309
|
-
}
|
|
70310
|
-
case "Write": {
|
|
70311
|
-
if (result.includes("Created") || result.includes("Updated")) lines.push(result.split("\n")[0]);
|
|
70312
|
-
else lines.push(result.slice(0, 100));
|
|
70313
|
-
break;
|
|
70314
|
-
}
|
|
70315
|
-
case "Glob": {
|
|
70316
|
-
const files = result.split("\n").filter((l) => l.trim());
|
|
70317
|
-
lines.push(`Found ${files.length} files`);
|
|
70318
|
-
if (files.length > 0 && files.length <= 3) lines.push(...files);
|
|
70319
|
-
else if (files.length > 3) {
|
|
70320
|
-
lines.push(...files.slice(0, 3));
|
|
70321
|
-
lines.push(`\u2026 +${files.length - 3} more files`);
|
|
70322
|
-
}
|
|
70323
|
-
break;
|
|
70324
|
-
}
|
|
70325
|
-
case "Grep": {
|
|
70326
|
-
const matches = result.split("\n").filter((l) => l.trim());
|
|
70327
|
-
if (result.includes("No matches")) lines.push("No matches found");
|
|
70328
|
-
else {
|
|
70329
|
-
lines.push(`${matches.length} matches`);
|
|
70330
|
-
if (matches.length <= 3) lines.push(...matches);
|
|
70331
|
-
else {
|
|
70332
|
-
lines.push(...matches.slice(0, 3));
|
|
70333
|
-
lines.push(`\u2026 +${matches.length - 3} more`);
|
|
70334
|
-
}
|
|
70335
|
-
}
|
|
70336
|
-
break;
|
|
70294
|
+
if (result.includes("Exit code:")) return [result.split("\n").find((l) => l.includes("Exit code:")) ?? "Done"];
|
|
70295
|
+
const firstLine = result.split("\n").find((l) => l.trim()) ?? "Done";
|
|
70296
|
+
if (totalLines > 1) return [`${firstLine.slice(0, 80)}\u2026 +${totalLines - 1} lines`];
|
|
70297
|
+
return [firstLine.slice(0, 100)];
|
|
70337
70298
|
}
|
|
70299
|
+
case "Read":
|
|
70300
|
+
return [`Read ${totalLines} lines`];
|
|
70301
|
+
case "Edit":
|
|
70302
|
+
if (result.includes("Successfully")) return [result.split("\n")[0].slice(0, 100)];
|
|
70303
|
+
if (result.includes("replacement")) return [result.split("\n")[0].slice(0, 100)];
|
|
70304
|
+
return [`Edited (${totalLines} lines changed)`];
|
|
70305
|
+
case "Write":
|
|
70306
|
+
return [result.split("\n")[0].slice(0, 100)];
|
|
70307
|
+
case "Glob":
|
|
70308
|
+
return [`Found ${result.split("\n").filter((l) => l.trim()).length} files`];
|
|
70309
|
+
case "Grep":
|
|
70310
|
+
if (result.includes("No matches")) return ["No matches found"];
|
|
70311
|
+
return [`${result.split("\n").filter((l) => l.trim()).length} matches`];
|
|
70338
70312
|
default:
|
|
70339
|
-
|
|
70313
|
+
return [result.split("\n")[0]?.slice(0, 80) ?? "Done"];
|
|
70340
70314
|
}
|
|
70341
|
-
return lines;
|
|
70342
70315
|
}
|
|
70343
70316
|
function MessageView({ msg }) {
|
|
70344
70317
|
if (msg.role === "user") {
|
|
@@ -70461,11 +70434,14 @@ function App2({ model, mode, initialPrompt }) {
|
|
|
70461
70434
|
permissionContext: permCtx,
|
|
70462
70435
|
maxTurns: 10,
|
|
70463
70436
|
onTextDelta: (text2) => {
|
|
70464
|
-
|
|
70437
|
+
if (activeToolsRef.current.length === 0 || activeToolsRef.current.every((t) => t.status === "done" || t.status === "error")) {
|
|
70438
|
+
setStreaming((prev) => prev + text2);
|
|
70439
|
+
}
|
|
70465
70440
|
},
|
|
70466
70441
|
onThinkingDelta: () => {
|
|
70467
70442
|
},
|
|
70468
70443
|
onToolUseStart: (name, id, toolInput) => {
|
|
70444
|
+
setStreaming("");
|
|
70469
70445
|
onToolStart(id, name, toolSummary(name, toolInput));
|
|
70470
70446
|
},
|
|
70471
70447
|
onToolUseEnd: (name, id, toolResult) => {
|
|
@@ -70902,8 +70878,8 @@ async function bootstrap() {
|
|
|
70902
70878
|
var VERSION, BUILD_TIME, PACKAGE_NAME2, ISSUES_URL2, startupTimestamps, originalCwd, RESET_TERMINAL, cleanupHandlers, earlyInput, earlyInputCapturing;
|
|
70903
70879
|
var init_index = __esm({
|
|
70904
70880
|
"src/cli/index.ts"() {
|
|
70905
|
-
VERSION = "0.1.
|
|
70906
|
-
BUILD_TIME = "2026-03-
|
|
70881
|
+
VERSION = "0.1.2";
|
|
70882
|
+
BUILD_TIME = "2026-03-20T13:23:30.894Z";
|
|
70907
70883
|
PACKAGE_NAME2 = "@hasna/coders";
|
|
70908
70884
|
ISSUES_URL2 = "https://github.com/hasnaxyz/open-coders/issues";
|
|
70909
70885
|
startupTimestamps = {};
|