@bike4mind/cli 0.2.12-cli-todo-list.17408 → 0.2.12-fix-backspace-and-format-step-display.17409

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.
Files changed (2) hide show
  1. package/dist/index.js +89 -26
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -866,10 +866,11 @@ function InputPrompt({
866
866
  if (shouldShowCommandAutocomplete && filteredCommands.length > 0) {
867
867
  if (key.upArrow) {
868
868
  setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredCommands.length - 1);
869
+ return;
869
870
  } else if (key.downArrow) {
870
871
  setSelectedIndex((prev) => prev < filteredCommands.length - 1 ? prev + 1 : 0);
872
+ return;
871
873
  }
872
- return;
873
874
  }
874
875
  if (!shouldShowCommandAutocomplete && !fileAutocomplete?.active && history.length > 0) {
875
876
  if (key.upArrow) {
@@ -1348,7 +1349,7 @@ function MessageItem({ message }) {
1348
1349
  const isUser = message.role === "user";
1349
1350
  return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: isUser ? "cyan" : "green" }, isUser ? "\u{1F464} You" : "\u{1F916} Assistant"), isUser && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
1350
1351
  if (step.type === "thought") {
1351
- return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
1352
+ return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content}`));
1352
1353
  }
1353
1354
  if (step.type === "action") {
1354
1355
  const toolName = step.metadata?.toolName || "unknown";
@@ -10835,6 +10836,82 @@ async function loadContextFiles(projectDir) {
10835
10836
  };
10836
10837
  }
10837
10838
 
10839
+ // src/utils/formatStep.ts
10840
+ var MAX_INPUT_LENGTH = 500;
10841
+ var formatStep = (step) => {
10842
+ if (step.type === "action" && step.metadata?.toolInput) {
10843
+ let parsedInput = step.metadata.toolInput;
10844
+ if (typeof parsedInput === "string") {
10845
+ try {
10846
+ parsedInput = JSON.parse(parsedInput);
10847
+ } catch {
10848
+ }
10849
+ }
10850
+ if (step.metadata.toolName === "edit_local_file") {
10851
+ const pathOnly = typeof parsedInput === "object" && parsedInput !== null && "path" in parsedInput ? { path: parsedInput.path } : parsedInput;
10852
+ return {
10853
+ ...step,
10854
+ metadata: {
10855
+ ...step.metadata,
10856
+ toolInput: pathOnly
10857
+ }
10858
+ };
10859
+ }
10860
+ if (step.metadata.toolName === "write_todos") {
10861
+ const todos = typeof parsedInput === "object" && parsedInput !== null && "todos" in parsedInput ? parsedInput.todos : null;
10862
+ const count = Array.isArray(todos) ? todos.length : 0;
10863
+ return {
10864
+ ...step,
10865
+ metadata: {
10866
+ ...step.metadata,
10867
+ toolInput: `${count} todo${count !== 1 ? "s" : ""}`
10868
+ }
10869
+ };
10870
+ }
10871
+ const inputStr = typeof parsedInput === "string" ? parsedInput : JSON.stringify(parsedInput);
10872
+ if (inputStr.length > MAX_INPUT_LENGTH) {
10873
+ const truncatedInput = inputStr.slice(0, MAX_INPUT_LENGTH) + `... (${inputStr.length - MAX_INPUT_LENGTH} more chars)`;
10874
+ return {
10875
+ ...step,
10876
+ metadata: {
10877
+ ...step.metadata,
10878
+ toolInput: truncatedInput
10879
+ }
10880
+ };
10881
+ }
10882
+ }
10883
+ if (step.type === "observation" && step.content) {
10884
+ if (step.metadata?.toolName === "file_read") {
10885
+ const lineCount = step.content.split("\n").length;
10886
+ return {
10887
+ ...step,
10888
+ content: `Read ${lineCount} line${lineCount !== 1 ? "s" : ""}`
10889
+ };
10890
+ }
10891
+ if (step.metadata?.toolName === "grep_search") {
10892
+ const match = step.content.match(/^Found (\d+) file\(s\)/);
10893
+ if (match) {
10894
+ const count = parseInt(match[1], 10);
10895
+ return {
10896
+ ...step,
10897
+ content: `Found ${count} file${count !== 1 ? "s" : ""}`
10898
+ };
10899
+ }
10900
+ }
10901
+ if (step.metadata?.toolName === "glob_files") {
10902
+ const match = step.content.match(/^Found (\d+) file\(s\)/);
10903
+ if (match) {
10904
+ const count = parseInt(match[1], 10);
10905
+ return {
10906
+ ...step,
10907
+ content: `Found ${count} file${count !== 1 ? "s" : ""}`
10908
+ };
10909
+ }
10910
+ }
10911
+ }
10912
+ return step;
10913
+ };
10914
+
10838
10915
  // src/utils/argumentSubstitution.ts
10839
10916
  function substituteArguments(template, args) {
10840
10917
  let result = template;
@@ -11750,7 +11827,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11750
11827
  // package.json
11751
11828
  var package_default = {
11752
11829
  name: "@bike4mind/cli",
11753
- version: "0.2.12-cli-todo-list.17408+244ee96b6",
11830
+ version: "0.2.12-fix-backspace-and-format-step-display.17409+f36a1542c",
11754
11831
  type: "module",
11755
11832
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11756
11833
  license: "UNLICENSED",
@@ -11856,10 +11933,10 @@ var package_default = {
11856
11933
  },
11857
11934
  devDependencies: {
11858
11935
  "@bike4mind/agents": "0.1.0",
11859
- "@bike4mind/common": "2.41.1-cli-todo-list.17408+244ee96b6",
11860
- "@bike4mind/mcp": "1.21.1-cli-todo-list.17408+244ee96b6",
11861
- "@bike4mind/services": "2.36.1-cli-todo-list.17408+244ee96b6",
11862
- "@bike4mind/utils": "2.1.6-cli-todo-list.17408+244ee96b6",
11936
+ "@bike4mind/common": "2.41.1-fix-backspace-and-format-step-display.17409+f36a1542c",
11937
+ "@bike4mind/mcp": "1.21.1-fix-backspace-and-format-step-display.17409+f36a1542c",
11938
+ "@bike4mind/services": "2.36.1-fix-backspace-and-format-step-display.17409+f36a1542c",
11939
+ "@bike4mind/utils": "2.1.6-fix-backspace-and-format-step-display.17409+f36a1542c",
11863
11940
  "@types/better-sqlite3": "^7.6.13",
11864
11941
  "@types/diff": "^5.0.9",
11865
11942
  "@types/jsonwebtoken": "^9.0.4",
@@ -11872,7 +11949,7 @@ var package_default = {
11872
11949
  typescript: "^5.9.3",
11873
11950
  vitest: "^3.2.4"
11874
11951
  },
11875
- gitHead: "244ee96b6f743aeff0513fc84f573050b624d4e7"
11952
+ gitHead: "f36a1542c3c232aada6f291e581a1b10f59c3f94"
11876
11953
  };
11877
11954
 
11878
11955
  // src/config/constants.ts
@@ -12679,26 +12756,12 @@ ${contextResult.mergedContent}` : "";
12679
12756
  const lastIdx = pendingMessages.length - 1;
12680
12757
  if (lastIdx >= 0 && pendingMessages[lastIdx].role === "assistant") {
12681
12758
  const existingSteps = pendingMessages[lastIdx].metadata?.steps || [];
12682
- const MAX_INPUT_LENGTH = 500;
12683
- let truncatedStep = step;
12684
- if (step.type === "action" && step.metadata?.toolInput) {
12685
- const inputStr = typeof step.metadata.toolInput === "string" ? step.metadata.toolInput : JSON.stringify(step.metadata.toolInput);
12686
- if (inputStr.length > MAX_INPUT_LENGTH) {
12687
- const truncatedInput = inputStr.slice(0, MAX_INPUT_LENGTH) + `... (${inputStr.length - MAX_INPUT_LENGTH} more chars)`;
12688
- truncatedStep = {
12689
- ...step,
12690
- metadata: {
12691
- ...step.metadata,
12692
- toolInput: truncatedInput
12693
- }
12694
- };
12695
- }
12696
- }
12759
+ const formattedStep = formatStep(step);
12697
12760
  updatePendingMessage(lastIdx, {
12698
12761
  ...pendingMessages[lastIdx],
12699
12762
  metadata: {
12700
12763
  ...pendingMessages[lastIdx].metadata,
12701
- steps: [...existingSteps, truncatedStep]
12764
+ steps: [...existingSteps, formattedStep]
12702
12765
  }
12703
12766
  });
12704
12767
  }
@@ -12840,7 +12903,7 @@ ${contextResult.mergedContent}` : "";
12840
12903
  content: result.finalAnswer,
12841
12904
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12842
12905
  metadata: {
12843
- steps: result.steps,
12906
+ steps: result.steps.map(formatStep),
12844
12907
  tokenUsage: {
12845
12908
  prompt: 0,
12846
12909
  completion: 0,
@@ -13013,7 +13076,7 @@ ${contextResult.mergedContent}` : "";
13013
13076
  completion: 0,
13014
13077
  total: result.completionInfo.totalTokens
13015
13078
  },
13016
- steps: result.steps,
13079
+ steps: result.steps.map(formatStep),
13017
13080
  // Complete history: thoughts, actions, observations
13018
13081
  permissionDenied
13019
13082
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.12-cli-todo-list.17408+244ee96b6",
3
+ "version": "0.2.12-fix-backspace-and-format-step-display.17409+f36a1542c",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -106,10 +106,10 @@
106
106
  },
107
107
  "devDependencies": {
108
108
  "@bike4mind/agents": "0.1.0",
109
- "@bike4mind/common": "2.41.1-cli-todo-list.17408+244ee96b6",
110
- "@bike4mind/mcp": "1.21.1-cli-todo-list.17408+244ee96b6",
111
- "@bike4mind/services": "2.36.1-cli-todo-list.17408+244ee96b6",
112
- "@bike4mind/utils": "2.1.6-cli-todo-list.17408+244ee96b6",
109
+ "@bike4mind/common": "2.41.1-fix-backspace-and-format-step-display.17409+f36a1542c",
110
+ "@bike4mind/mcp": "1.21.1-fix-backspace-and-format-step-display.17409+f36a1542c",
111
+ "@bike4mind/services": "2.36.1-fix-backspace-and-format-step-display.17409+f36a1542c",
112
+ "@bike4mind/utils": "2.1.6-fix-backspace-and-format-step-display.17409+f36a1542c",
113
113
  "@types/better-sqlite3": "^7.6.13",
114
114
  "@types/diff": "^5.0.9",
115
115
  "@types/jsonwebtoken": "^9.0.4",
@@ -122,5 +122,5 @@
122
122
  "typescript": "^5.9.3",
123
123
  "vitest": "^3.2.4"
124
124
  },
125
- "gitHead": "244ee96b6f743aeff0513fc84f573050b624d4e7"
125
+ "gitHead": "f36a1542c3c232aada6f291e581a1b10f59c3f94"
126
126
  }