opencode-miniterm 1.0.17 → 1.0.18

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/bun.lock CHANGED
@@ -5,7 +5,7 @@
5
5
  "": {
6
6
  "name": "opencode-miniterm",
7
7
  "dependencies": {
8
- "@opencode-ai/sdk": "^1.2.24",
8
+ "@opencode-ai/sdk": "^1.2.25",
9
9
  "allmark": "^1.0.2",
10
10
  },
11
11
  "devDependencies": {
@@ -47,11 +47,11 @@
47
47
 
48
48
  "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
49
49
 
50
- "@opencode-ai/sdk": ["@opencode-ai/sdk@1.2.25", "", {}, "sha512-ikuGWob48OM7LTgfXFqGOZKVOqh50FEjvtIBhXGhGowJhifmjZ+xuq/ypP8nPjTwUX73pbu1C3X9ZBWVkCN9mA=="],
50
+ "@opencode-ai/sdk": ["@opencode-ai/sdk@1.2.27", "", {}, "sha512-Wk0o/I+Fo+wE3zgvlJDs8Fb67KlKqX0PrV8dK5adSDkANq6r4Z25zXJg2iOir+a8ntg3rAcpel1OY4FV/TwRUA=="],
51
51
 
52
52
  "@trivago/prettier-plugin-sort-imports": ["@trivago/prettier-plugin-sort-imports@6.0.2", "", { "dependencies": { "@babel/generator": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.0", "javascript-natural-sort": "^0.7.1", "lodash-es": "^4.17.21", "minimatch": "^9.0.0", "parse-imports-exports": "^0.2.4" }, "peerDependencies": { "@vue/compiler-sfc": "3.x", "prettier": "2.x - 3.x", "prettier-plugin-ember-template-tag": ">= 2.0.0", "prettier-plugin-svelte": "3.x", "svelte": "4.x || 5.x" }, "optionalPeers": ["@vue/compiler-sfc", "prettier-plugin-ember-template-tag", "prettier-plugin-svelte", "svelte"] }, "sha512-3DgfkukFyC/sE/VuYjaUUWoFfuVjPK55vOFDsxD56XXynFMCZDYFogH2l/hDfOsQAm1myoU/1xByJ3tWqtulXA=="],
53
53
 
54
- "@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
54
+ "@types/bun": ["@types/bun@1.3.11", "", { "dependencies": { "bun-types": "1.3.11" } }, "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg=="],
55
55
 
56
56
  "@types/node": ["@types/node@25.3.0", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-4K3bqJpXpqfg2XKGK9bpDTc6xO/xoUP/RBWS7AtRMug6zZFaRekiLzjVtAoZMquxoAbzBvy5nxQ7veS5eYzf8A=="],
57
57
 
@@ -77,7 +77,7 @@
77
77
 
78
78
  "brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],
79
79
 
80
- "bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
80
+ "bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="],
81
81
 
82
82
  "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
83
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-miniterm",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "A small front-end terminal UI for OpenCode",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "typescript": "^5"
30
30
  },
31
31
  "dependencies": {
32
- "@opencode-ai/sdk": "^1.2.25",
32
+ "@opencode-ai/sdk": "^1.2.27",
33
33
  "allmark": "^1.0.2"
34
34
  }
35
35
  }
package/src/input.ts CHANGED
@@ -75,12 +75,17 @@ export function renderLine(): void {
75
75
  if (oldInputBuffer[i] !== inputBuffer[i]) {
76
76
  break;
77
77
  }
78
- if (currentCol >= consoleWidth) {
79
- currentCol = 0;
78
+ if (inputBuffer[i] === "\n") {
80
79
  currentRow++;
81
- newWrappedRows++;
80
+ currentCol = 2;
81
+ } else {
82
+ if (currentCol >= consoleWidth) {
83
+ currentCol = 0;
84
+ currentRow++;
85
+ newWrappedRows++;
86
+ }
87
+ currentCol++;
82
88
  }
83
- currentCol++;
84
89
  start++;
85
90
  }
86
91
 
@@ -107,31 +112,48 @@ export function renderLine(): void {
107
112
  // Write the changes from the new input buffer
108
113
  let renderExtent = Math.max(cursorPosition + 1, inputBuffer.length);
109
114
  for (let i = start; i < renderExtent; i++) {
110
- if (currentCol >= consoleWidth) {
115
+ if (i < inputBuffer.length && inputBuffer[i] === "\n") {
111
116
  process.stdout.write("\n");
112
- currentCol = 0;
113
- newWrappedRows++;
114
- }
115
- if (i < inputBuffer.length) {
116
- process.stdout.write(inputBuffer[i]!);
117
+ currentRow++;
118
+ currentCol = 2;
119
+ } else {
120
+ if (currentCol >= consoleWidth) {
121
+ process.stdout.write("\n");
122
+ currentCol = 0;
123
+ newWrappedRows++;
124
+ }
125
+ if (i < inputBuffer.length) {
126
+ process.stdout.write(inputBuffer[i]!);
127
+ }
128
+ currentCol++;
117
129
  }
118
- currentCol++;
119
130
  }
120
131
 
121
132
  // Calculate and move to the cursor's position
122
- let absolutePos = 2 + cursorPosition;
123
- let newCursorRow = Math.floor(absolutePos / consoleWidth);
124
- let newCursorCol = absolutePos % consoleWidth;
133
+ let row = 0;
134
+ let col = 2;
135
+ for (let i = 0; i < cursorPosition; i++) {
136
+ if (i < inputBuffer.length && inputBuffer[i] === "\n") {
137
+ row++;
138
+ col = 2;
139
+ } else {
140
+ col++;
141
+ if (col >= consoleWidth) {
142
+ row++;
143
+ col = 0;
144
+ }
145
+ }
146
+ }
125
147
  process.stdout.write(ansi.CURSOR_HOME);
126
- let rowsToMove = newWrappedRows - newCursorRow;
148
+ let rowsToMove = newWrappedRows - row;
127
149
  if (rowsToMove > 0) {
128
150
  process.stdout.write(ansi.CURSOR_UP(rowsToMove));
129
151
  }
130
- process.stdout.write(ansi.CURSOR_COL(newCursorCol));
152
+ process.stdout.write(ansi.CURSOR_COL(col));
131
153
 
132
154
  oldInputBuffer = inputBuffer;
133
155
  oldWrappedRows = newWrappedRows;
134
- oldCursorRow = newCursorRow;
156
+ oldCursorRow = row;
135
157
  }
136
158
 
137
159
  export async function handleKeyPress(state: State, str: string, key: Key) {
package/src/server.ts CHANGED
@@ -342,6 +342,7 @@ function processDelta(state: State, partID: string, delta: string) {
342
342
 
343
343
  async function processDiff(state: State, diff: FileDiff[]) {
344
344
  const parts: string[] = [];
345
+
345
346
  for (const file of diff) {
346
347
  const newAfter = file.after ?? "";
347
348
  const oldAfter = state.lastFileAfter.get(file.file);
@@ -358,18 +359,19 @@ async function processDiff(state: State, diff: FileDiff[]) {
358
359
  }
359
360
 
360
361
  if (parts.length > 0) {
361
- state.accumulatedResponse.push({ key: "diff", title: "files", text: parts.join("\n") });
362
+ const diffText = parts.join("\n");
363
+ state.accumulatedResponse.push({ key: "diff", title: "files", text: diffText });
362
364
 
363
- const diffText = ansi.stripAnsiCodes(parts.join("\n"));
364
- await writeToLog(`${diffText}\n\n`);
365
+ await writeToLog(`${ansi.stripAnsiCodes(diffText)}\n\n`);
365
366
 
366
367
  render(state);
367
368
  }
368
369
  }
369
370
 
370
371
  async function processTodos(state: State, todos: Todo[]) {
371
- let todoListText = "Todo:\n";
372
+ const parts: string[] = [];
372
373
 
374
+ parts.push("Todo:");
373
375
  for (let todo of todos) {
374
376
  let todoText = "";
375
377
  if (todo.status === "completed") {
@@ -378,13 +380,13 @@ async function processTodos(state: State, todos: Todo[]) {
378
380
  todoText += "- [ ] ";
379
381
  }
380
382
  todoText += todo.content;
381
- todoListText += todoText + "\n";
383
+ parts.push(todoText);
382
384
  }
383
385
 
386
+ const todoListText = parts.join("\n");
384
387
  state.accumulatedResponse.push({ key: "todo", title: "files", text: todoListText });
385
388
 
386
- const cleanTodoText = ansi.stripAnsiCodes(todoListText);
387
- await writeToLog(`${cleanTodoText}\n`);
389
+ await writeToLog(`${ansi.stripAnsiCodes(todoListText)}\n\n`);
388
390
 
389
391
  render(state);
390
392
  }