@hncode/hncode 0.8.2 → 0.8.4
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/bin/hncode +54 -8
- package/package.json +1 -1
- package/src/agent-task.js +14 -12
- package/src/agent.js +1465 -1421
- package/src/animate.js +21 -0
- package/src/colors.js +615 -593
- package/src/config.js +36 -11
- package/src/context-bar.js +280 -277
- package/src/doctor.js +4 -3
- package/src/i18n.js +1438 -1214
- package/src/index.js +822 -730
- package/src/keybindings.js +2 -1
- package/src/markdown.js +37 -10
- package/src/mcp-server.js +409 -0
- package/src/mcp.js +279 -29
- package/src/memory-profile.js +19 -16
- package/src/plan.js +7 -5
- package/src/plugin.js +37 -21
- package/src/registry-browser.js +17 -15
- package/src/rows-tool-result.js +251 -235
- package/src/settings-schema.js +9 -0
- package/src/swarm-progress.js +1 -1
- package/src/tasks-browser.js +28 -28
- package/src/term.js +57 -21
- package/src/text.js +62 -0
- package/src/tools/agent.js +7 -2
- package/src/tools/bash.js +446 -440
- package/src/tools/edit.js +14 -1
- package/src/tui.js +542 -330
package/src/registry-browser.js
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
import { C } from './colors.js';
|
|
29
29
|
import { visualWidth } from './term.js';
|
|
30
|
+
import { uiText } from './i18n.js';
|
|
30
31
|
|
|
31
32
|
const ELLIPSIS = '\u2026';
|
|
32
33
|
const ESC = '\x1b';
|
|
@@ -190,11 +191,11 @@ export function visibleRowsForTab(state, tabId) {
|
|
|
190
191
|
|
|
191
192
|
export function renderRegistryBrowser(state, cols, rows) {
|
|
192
193
|
if (cols < MIN_WIDTH || rows < MIN_HEIGHT) {
|
|
193
|
-
const lines = [fitExactly(C.red +
|
|
194
|
+
const lines = [fitExactly(C.red + uiText(`Terminal too small (need >= ${MIN_WIDTH} x ${MIN_HEIGHT})`) + C.reset, cols)];
|
|
194
195
|
for (let i = 1; i < rows; i++) lines.push(' '.repeat(cols));
|
|
195
196
|
return lines;
|
|
196
197
|
}
|
|
197
|
-
const title = state.kind === 'skills' ? ' Skills' : ' Plugins';
|
|
198
|
+
const title = uiText(state.kind === 'skills' ? ' Skills' : ' Plugins');
|
|
198
199
|
const tabs = state.kind === 'skills' ? SKILL_TABS : PLUGIN_TABS;
|
|
199
200
|
const tabIdx = Math.max(0, tabs.findIndex((t) => t.id === state.tab));
|
|
200
201
|
const tab = tabs[tabIdx] || tabs[0];
|
|
@@ -216,7 +217,7 @@ export function renderRegistryBrowser(state, cols, rows) {
|
|
|
216
217
|
// The key hints stay visible while the fetch runs: the panel is usable during it
|
|
217
218
|
// (the local tabs are already loaded), so replacing the hints with a status message
|
|
218
219
|
// would hide the keys exactly when the user is most likely to press them.
|
|
219
|
-
const hint = ' / search
|
|
220
|
+
const hint = uiText(' / search · Tab switch · ↑↓ select · Enter install/remove · Esc close');
|
|
220
221
|
out.push(fitExactly(C.gray + hint + (state.busy ? C.gray + ` ${state.busy}` : '') + C.reset, cols));
|
|
221
222
|
out.push('');
|
|
222
223
|
// The search field, drawn whenever it is open or has text, so a filtered list always explains itself.
|
|
@@ -233,7 +234,8 @@ export function renderRegistryBrowser(state, cols, rows) {
|
|
|
233
234
|
let col = 0;
|
|
234
235
|
const segs = tabs.map((t) => {
|
|
235
236
|
const n = rowsForTab(state, t.id).length;
|
|
236
|
-
const
|
|
237
|
+
const lbl = uiText(t.label);
|
|
238
|
+
const text = t.id === tab.id ? `[${lbl} (${n})]` : ` ${lbl} (${n}) `;
|
|
237
239
|
const col0 = col;
|
|
238
240
|
col += visWidth(text) + 1; // +1 for the joining space
|
|
239
241
|
return { id: t.id, text, col0, col1: col0 + visWidth(text) - 1 };
|
|
@@ -259,11 +261,11 @@ export function renderRegistryBrowser(state, cols, rows) {
|
|
|
259
261
|
// "Loading" only applies to the tab that is actually waiting on the fetch; a local
|
|
260
262
|
// tab is empty because there is genuinely nothing there, and saying "Loading" for
|
|
261
263
|
// data that is already on screen reads as a stall.
|
|
262
|
-
const msg = (isRemoteTab && state.busy) ? ' Loading
|
|
264
|
+
const msg = (isRemoteTab && state.busy) ? uiText(' Loading…')
|
|
263
265
|
: (isRemoteTab && state.data && state.data.remoteError)
|
|
264
|
-
? ' Could not fetch from the repo: ' + state.data.remoteError
|
|
265
|
-
: isRemoteTab ? ' Nothing published in the repo yet.'
|
|
266
|
-
: ' Nothing here.';
|
|
266
|
+
? uiText(' Could not fetch from the repo: ') + state.data.remoteError
|
|
267
|
+
: isRemoteTab ? uiText(' Nothing published in the repo yet.')
|
|
268
|
+
: uiText(' Nothing here.');
|
|
267
269
|
out.push(C.gray + msg + C.reset);
|
|
268
270
|
}
|
|
269
271
|
// How many LINES each row occupies: its label plus its wrapped description.
|
|
@@ -294,14 +296,14 @@ export function renderRegistryBrowser(state, cols, rows) {
|
|
|
294
296
|
const isSel = i === sel;
|
|
295
297
|
const ptr = isSel ? C.cyan + '\u276f ' + C.reset : ' ';
|
|
296
298
|
const nameStyle = isSel ? (C.cyan + C.bold) : C.white;
|
|
297
|
-
const badge = r.status ? ' ' + statusColor(r.statusTone) + r.status + C.reset : '';
|
|
299
|
+
const badge = r.status ? ' ' + statusColor(r.statusTone) + uiText(r.status) + C.reset : '';
|
|
298
300
|
const dis = r.disabled ? C.gray : '';
|
|
299
301
|
const labelRow = out.length;
|
|
300
302
|
out.push(fitExactly(ptr + nameStyle + dis + r.label + C.reset + badge, cols));
|
|
301
303
|
// The whole label row is a click target: clicking selects the item (and a second click / the footer
|
|
302
304
|
// activates it), mirroring the tasks browser.
|
|
303
305
|
hits.push({ row: labelRow, col0: 0, col1: cols - 1, kind: 'regRow', index: i });
|
|
304
|
-
for (const line of wrapText(r.description, descW)) {
|
|
306
|
+
for (const line of wrapText(uiText(r.description), descW)) {
|
|
305
307
|
out.push(C.gray + ' ' + line + C.reset);
|
|
306
308
|
}
|
|
307
309
|
}
|
|
@@ -329,13 +331,13 @@ export function renderRegistryBrowser(state, cols, rows) {
|
|
|
329
331
|
// does there (and it is the only way to pick up a newer version).
|
|
330
332
|
const cur = all[sel];
|
|
331
333
|
const action = !cur ? ''
|
|
332
|
-
: cur.disabled ? 'Enter does nothing
|
|
334
|
+
: cur.disabled ? uiText('Enter does nothing — this entry has no SKILL.md')
|
|
333
335
|
: cur.action === 'reinstall-skill' || cur.action === 'reinstall-plugin'
|
|
334
|
-
? 'Enter reinstalls ' + cur.name + ' (replaces the local copy)'
|
|
336
|
+
? uiText('Enter reinstalls ') + cur.name + uiText(' (replaces the local copy)')
|
|
335
337
|
: cur.action === 'install-skill' || cur.action === 'install-plugin'
|
|
336
|
-
? 'Enter installs ' + cur.name + ' from the repository'
|
|
337
|
-
: cur.action.startsWith('remove') ? 'Enter removes the local copy of ' + cur.name
|
|
338
|
-
: 'loaded plugin
|
|
338
|
+
? uiText('Enter installs ') + cur.name + uiText(' from the repository')
|
|
339
|
+
: cur.action.startsWith('remove') ? uiText('Enter removes the local copy of ') + cur.name
|
|
340
|
+
: uiText('loaded plugin — switch to the On disk tab to remove it');
|
|
339
341
|
while (out.length < rows - 2) out.push('');
|
|
340
342
|
out.push(fitExactly(C.gray + ' ' + action + C.reset, cols));
|
|
341
343
|
out.push(rule);
|