@hncode/hncode 0.5.2 → 0.5.5
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/package.json +38 -38
- package/src/agent.js +172 -19
- package/src/cache.js +175 -130
- package/src/clipboard.js +69 -2
- package/src/config.js +10 -3
- package/src/index.js +29 -5
- package/src/keybindings.js +25 -3
- package/src/llm.js +54 -6
- package/src/mcp.js +419 -384
- package/src/plugin.js +95 -10
- package/src/remote.js +307 -289
- package/src/session-hub.js +37 -0
- package/src/settings-schema.js +2 -0
- package/src/shell-safety.js +610 -562
- package/src/swarm-progress.js +1 -1
- package/src/team/mailbox.js +216 -139
- package/src/team/permission.js +121 -0
- package/src/team/protocol.js +167 -0
- package/src/team/runner.js +127 -12
- package/src/team/spawn.js +63 -5
- package/src/team/store.js +31 -4
- package/src/team/tasks.js +15 -2
- package/src/team/team.js +51 -16
- package/src/team-panel.js +418 -20
- package/src/term-caps.js +457 -410
- package/src/term.js +142 -26
- package/src/tool-result.js +50 -2
- package/src/tools/agent.js +464 -436
- package/src/tools/bash.js +53 -14
- package/src/tools/diagnostics.js +13 -0
- package/src/tools/edit.js +727 -577
- package/src/tools/fetch-url.js +118 -5
- package/src/tools/glob.js +5 -3
- package/src/tools/grep.js +19 -5
- package/src/tools/ignore.js +17 -3
- package/src/tools/index.js +17 -3
- package/src/tools/read.js +13 -2
- package/src/tools/shell.js +145 -134
- package/src/tools/tasks.js +214 -141
- package/src/tools/team.js +13 -0
- package/src/tools/utils.js +12 -3
- package/src/tools/web-search.js +85 -34
- package/src/tui.js +2089 -714
- package/src/update.js +38 -3
- package/src/web.js +47 -1
package/src/session-hub.js
CHANGED
|
@@ -128,6 +128,32 @@ function snapshotRow(msg) {
|
|
|
128
128
|
if (Object.keys(a).length) out.toolArgs = a;
|
|
129
129
|
}
|
|
130
130
|
if (Array.isArray(msg.diff)) out.diff = msg.diff.slice(0, 400);
|
|
131
|
+
// The same pieces `formatToolLine` composes, as data rather than as ANSI.
|
|
132
|
+
if (out.role === 'tool') {
|
|
133
|
+
const verb = msg.pending ? 'Using' : 'Used';
|
|
134
|
+
const name = out.toolName || 'tool';
|
|
135
|
+
// The identifying argument, by the same key order the line uses. `toolArgs` above already holds
|
|
136
|
+
// only the short, displayable ones.
|
|
137
|
+
const arg = out.toolArgs
|
|
138
|
+
? (out.toolArgs.command || out.toolArgs.cmd || out.toolArgs.path || out.toolArgs.file_path
|
|
139
|
+
|| out.toolArgs.pattern || out.toolArgs.query || out.toolArgs.url || out.toolArgs.description || '')
|
|
140
|
+
: '';
|
|
141
|
+
const summary = arg ? `${verb} ${name} (${arg})` : `${verb} ${name}`;
|
|
142
|
+
let added = 0;
|
|
143
|
+
let removed = 0;
|
|
144
|
+
if (Array.isArray(msg.diff)) for (const d of msg.diff) {
|
|
145
|
+
if (d && (d.type === 'add' || d.type === '+')) added++;
|
|
146
|
+
else if (d && (d.type === 'del' || d.type === '-')) removed++;
|
|
147
|
+
}
|
|
148
|
+
out.display = {
|
|
149
|
+
verb,
|
|
150
|
+
tool: name,
|
|
151
|
+
arg: arg ? String(arg).slice(0, 400) : '',
|
|
152
|
+
summary,
|
|
153
|
+
status: msg.pending ? 'running' : (msg.failed ? 'failed' : 'done'),
|
|
154
|
+
diff: (added || removed) ? { added, removed } : null,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
131
157
|
if (msg.card && typeof msg.card === 'object') {
|
|
132
158
|
out.card = { phase: msg.card.phase, headline: msg.card.headline, detail: msg.card.detail };
|
|
133
159
|
}
|
|
@@ -235,6 +261,15 @@ export class SessionHub {
|
|
|
235
261
|
* Returns nothing; failures here must never affect rendering.
|
|
236
262
|
*/
|
|
237
263
|
syncChat(chat) {
|
|
264
|
+
// NOBODY IS WATCHING, SO NOTHING IS BUILT.
|
|
265
|
+
//
|
|
266
|
+
// `/web` starts a server, but a browser may never connect — and this ran on every frame regardless,
|
|
267
|
+
// walking the whole transcript to build rows no one would read. Measured on a 300-message transcript:
|
|
268
|
+
// 8.8ms per frame with zero subscribers, which is most of a 60fps budget spent on nothing.
|
|
269
|
+
//
|
|
270
|
+
// The rows are rebuilt from scratch on the next sync after a client connects (it starts with no rows
|
|
271
|
+
// and `_rowFp` empty), so skipping here costs one frame of latency at connect time and nothing else.
|
|
272
|
+
if (this.subscribers.size === 0) return;
|
|
238
273
|
const list = Array.isArray(chat) ? chat : [];
|
|
239
274
|
const seen = new Set();
|
|
240
275
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -256,6 +291,7 @@ export class SessionHub {
|
|
|
256
291
|
this.rows.push(row);
|
|
257
292
|
this._rowById.set(id, row);
|
|
258
293
|
this.emit({ type: 'row', row });
|
|
294
|
+
this._rowFp.set(id, fp);
|
|
259
295
|
} else if (known !== fp) {
|
|
260
296
|
const target = this._rowById.get(id);
|
|
261
297
|
// The WHOLE row's renderable fields, not a text delta.
|
|
@@ -275,6 +311,7 @@ export class SessionHub {
|
|
|
275
311
|
const patch = snapshotRow(msg);
|
|
276
312
|
if (target) Object.assign(target, patch);
|
|
277
313
|
this.emit({ type: 'row_patch', id, patch });
|
|
314
|
+
this._rowFp.set(id, fp);
|
|
278
315
|
}
|
|
279
316
|
}
|
|
280
317
|
// The TUI rebuilds `state.chat` wholesale on /compact and on session resume.
|
package/src/settings-schema.js
CHANGED
|
@@ -79,6 +79,8 @@ export const SETTINGS_SCHEMA = [
|
|
|
79
79
|
ui: { tab: 'appearance', group: 'Display', label: 'Calm mode', hint: 'Fewer decorative flourishes; keeps the information, drops the animation' } },
|
|
80
80
|
{ key: 'reduced_motion', ...bool(false),
|
|
81
81
|
ui: { tab: 'appearance', group: 'Motion', label: 'Reduced motion', hint: 'No sweeps or pulses — for a terminal over a slow link, or a preference' } },
|
|
82
|
+
{ key: 'render_fps', kind: 'int', default: '30',
|
|
83
|
+
ui: { tab: 'appearance', group: 'Performance', label: 'Render FPS', hint: 'How often the screen is repainted. 0 means 1 — a terminal cannot render at zero. Higher is smoother and costs more CPU' } },
|
|
82
84
|
{ key: 'shimmer_edge', ...bool(true),
|
|
83
85
|
ui: { tab: 'appearance', group: 'Motion', label: 'Shimmer edge', hint: 'The travelling highlight on a running tool name' } },
|
|
84
86
|
{ key: 'show_tool_details', ...bool(true),
|