@hasna/coders 0.0.7 → 0.0.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 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.7"}`
58432
+ "User-Agent": `coders/${"0.0.9"}`
58433
58433
  };
58434
58434
  if (key.isOAuth) {
58435
58435
  headers["Authorization"] = `Bearer ${key.apiKey}`;
@@ -69802,14 +69802,23 @@ function ToolItem({ tool }) {
69802
69802
  "s)"
69803
69803
  ] })
69804
69804
  ] }),
69805
- 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: [
69806
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
69805
+ tool.status === "done" && resultPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
69806
+ resultPreview.slice(0, 2).map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
69807
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
69808
+ " ",
69809
+ CONN,
69810
+ " "
69811
+ ] }),
69812
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line.slice(0, 100) })
69813
+ ] }, i)),
69814
+ resultPreview.length > 2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
69807
69815
  " ",
69808
69816
  CONN,
69809
- " "
69810
- ] }),
69811
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line })
69812
- ] }, i)) }),
69817
+ " \u2026 +",
69818
+ resultPreview.length - 2,
69819
+ " more (ctrl+o to expand)"
69820
+ ] }) })
69821
+ ] }),
69813
69822
  tool.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
69814
69823
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
69815
69824
  " ",
@@ -69923,6 +69932,8 @@ function App2({ model, mode, initialPrompt }) {
69923
69932
  const [tokens, setTokens] = (0, import_react22.useState)(0);
69924
69933
  const [history, setHistory] = (0, import_react22.useState)([]);
69925
69934
  const [activeTools, setActiveTools] = (0, import_react22.useState)([]);
69935
+ const activeToolsRef = import_react22.default.useRef([]);
69936
+ activeToolsRef.current = activeTools;
69926
69937
  const rows = stdout?.rows ?? 24;
69927
69938
  const [permissionPending, setPermissionPending] = (0, import_react22.useState)(null);
69928
69939
  const requestPermission = (0, import_react22.useCallback)((toolName, summary) => {
@@ -70015,9 +70026,10 @@ function App2({ model, mode, initialPrompt }) {
70015
70026
  );
70016
70027
  setCost((p) => p + c.totalCostUsd);
70017
70028
  setTokens((p) => p + result.usage.totalInputTokens + result.usage.totalOutputTokens);
70018
- const frozenTools = [...activeTools].map(
70029
+ const frozenTools = [...activeToolsRef.current].map(
70019
70030
  (t) => t.status === "running" ? { ...t, status: "done" } : t
70020
70031
  );
70032
+ const verb = VERBS[Math.floor(Math.random() * VERBS.length)];
70021
70033
  setMsgs((p) => [...p, {
70022
70034
  id: `a${Date.now()}`,
70023
70035
  role: "assistant",
@@ -70025,8 +70037,7 @@ function App2({ model, mode, initialPrompt }) {
70025
70037
  timestamp: Date.now(),
70026
70038
  tools: frozenTools.length > 0 ? frozenTools : void 0,
70027
70039
  durationMs: dur,
70028
- durationVerb: VERBS[Math.floor(Math.random() * VERBS.length)]
70029
- // Fixed once at creation
70040
+ durationVerb: verb
70030
70041
  }]);
70031
70042
  setHistory(result.messages.filter((m) => m.role === "user" || m.role === "assistant"));
70032
70043
  setStreaming("");
@@ -70063,46 +70074,35 @@ function App2({ model, mode, initialPrompt }) {
70063
70074
  } else if (key.escape) setInput("");
70064
70075
  else if (!key.ctrl && !key.meta && ch) setInput((p) => p + ch);
70065
70076
  });
70066
- const messageAreaHeight = Math.max(5, rows - 5);
70067
- const visible = msgs.slice(-messageAreaHeight);
70077
+ const maxVisibleMsgs = busy ? 2 : Math.max(3, Math.floor((rows - 6) / 4));
70078
+ const visible = msgs.slice(-maxVisibleMsgs);
70079
+ const recentTools = activeTools.slice(-3);
70080
+ const streamLines = streaming.split("\n");
70081
+ const maxStreamLines = Math.max(3, rows - 15);
70082
+ const truncatedStream = streamLines.length > maxStreamLines ? streamLines.slice(-maxStreamLines).join("\n") : streaming;
70068
70083
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
70069
70084
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, { model, mode }),
70070
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", height: messageAreaHeight, overflow: "hidden", children: [
70085
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, children: [
70071
70086
  visible.map((m) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageView, { msg: m }, m.id)),
70072
- 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)) }),
70073
- busy && streaming && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
70087
+ busy && recentTools.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", children: [
70088
+ activeTools.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
70089
+ " \u2026 +",
70090
+ activeTools.length - 3,
70091
+ " earlier tools"
70092
+ ] }) }),
70093
+ recentTools.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolItem, { tool: t }, t.id))
70094
+ ] }),
70095
+ busy && truncatedStream && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
70074
70096
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: "\u25CF " }),
70075
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: streaming })
70097
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: truncatedStream })
70076
70098
  ] }),
70077
- busy && !streaming && !permissionPending && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
70099
+ busy && !streaming && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { marginTop: 0, children: [
70078
70100
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerDot, {}),
70079
70101
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
70080
70102
  " ",
70081
- activeTools.some((t) => t.status === "running") ? "Working" : "Thinking",
70103
+ recentTools.some((t) => t.status === "running") ? "Working" : "Thinking",
70082
70104
  "..."
70083
70105
  ] })
70084
- ] }),
70085
- permissionPending && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
70086
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
70087
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "yellow", bold: true, children: "? " }),
70088
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Allow " }),
70089
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { bold: true, children: permissionPending.toolName }),
70090
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { dimColor: true, children: [
70091
- ": ",
70092
- permissionPending.summary.slice(0, 80)
70093
- ] })
70094
- ] }),
70095
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box_default, { children: [
70096
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { dimColor: true, children: " " }),
70097
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", bold: true, children: "(y)" }),
70098
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "green", children: "es" }),
70099
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
70100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", bold: true, children: "(n)" }),
70101
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "red", children: "o" }),
70102
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " }),
70103
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "blue", bold: true, children: "(a)" }),
70104
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { color: "blue", children: "lways allow" })
70105
- ] })
70106
70106
  ] })
70107
70107
  ] }),
70108
70108
  /* @__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)) }) }),
@@ -70404,8 +70404,8 @@ async function bootstrap() {
70404
70404
  var VERSION, BUILD_TIME, PACKAGE_NAME2, ISSUES_URL2, startupTimestamps, originalCwd, RESET_TERMINAL, cleanupHandlers, earlyInput, earlyInputCapturing;
70405
70405
  var init_index = __esm({
70406
70406
  "src/cli/index.ts"() {
70407
- VERSION = "0.0.7";
70408
- BUILD_TIME = "2026-03-20T08:00:00.712Z";
70407
+ VERSION = "0.0.9";
70408
+ BUILD_TIME = "2026-03-20T08:10:27.716Z";
70409
70409
  PACKAGE_NAME2 = "@hasna/coders";
70410
70410
  ISSUES_URL2 = "https://github.com/hasnaxyz/open-coders/issues";
70411
70411
  startupTimestamps = {};