aegiscode 6.5.7 → 6.5.8

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "aegiscode",
3
3
  "productName": "AEGIS Code",
4
- "version": "6.5.7",
5
- "description": "aegiscode \u2014 the command-line version of AEGIS Desktop. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
4
+ "version": "6.5.8",
5
+ "description": "aegiscode — the command-line version of AEGIS Desktop. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
6
6
  "author": {
7
7
  "name": "AEGIS Code",
8
8
  "email": "nborneklint@gmail.com"
package/src/chatflow.js CHANGED
@@ -397,16 +397,46 @@ function joinBits(bits, t) {
397
397
  return line;
398
398
  }
399
399
 
400
+ /** Longest directory a row prints before it is contracted from the front. */
401
+ const DIR_MAX = 40;
402
+
403
+ /**
404
+ * A row's working directory, contracted for display: the home prefix becomes
405
+ * `~`, and a path still too long keeps its tail — the leaf is what identifies
406
+ * the checkout, the ancestors are the part a reader can spare. Returns '' when
407
+ * the host didn't say, so a row never implies a directory it doesn't know.
408
+ */
409
+ function shortDir(dir) {
410
+ let p = String(dir == null ? '' : dir).trim().replace(/\/+$/, '');
411
+ if (!p) return '';
412
+ const home = String(process.env.HOME || process.env.USERPROFILE || '').replace(/\/+$/, '');
413
+ if (home && (p === home || p.startsWith(`${home}/`))) p = `~${p.slice(home.length)}`;
414
+ if (p.length > DIR_MAX) p = `${GLYPH.ellipse}${p.slice(-(DIR_MAX - 1))}`;
415
+ return p;
416
+ }
417
+
400
418
  /** Render one transcript row to span lines. */
401
419
  function rowLines(msg, cols, ctx, now = Date.now()) {
402
420
  const t = themeOf(ctx);
403
421
  const out = [];
404
422
  if (msg.role === 'tool') {
423
+ // One ellipsis per row. The label already ends in one ("Running 1 shell
424
+ // command…") and this appended a second after the seconds, so the row read
425
+ // "Running 1 shell command… · 3s…" — two ellipses on one line. Normalising
426
+ // the label here rather than at the call site means the row stays correct
427
+ // whatever a host puts in `label`.
428
+ const label = String(msg.label || '').replace(/(?:…|\.\.\.)+$/, '');
429
+ // Where it runs. A tool row's args are the command or the path, so without
430
+ // this the transcript cannot answer "where is it working in".
431
+ const where = msg.cwd ? ` · ${shortDir(msg.cwd)}` : '';
405
432
  if (msg.phase === 'run') {
406
433
  const secs = msg.start ? Math.max(1, Math.round((now - msg.start) / 1000)) : 0;
407
- out.push([span(t.white, GLYPH.block), span(t.gray, ` ${msg.label} · ${secs}s…`)]);
434
+ out.push([
435
+ span(t.white, GLYPH.block),
436
+ span(t.gray, ` ${label}${GLYPH.ellipse} · ${secs}s${where}`),
437
+ ]);
408
438
  } else {
409
- out.push([span(t.gray, msg.label)]);
439
+ out.push([span(t.gray, `${label}${where}`)]);
410
440
  }
411
441
  const argsStr =
412
442
  typeof msg.args === 'string'
@@ -911,7 +941,20 @@ async function runSession(host) {
911
941
  // from one that produced nothing at all.
912
942
  reasoning: () => { sawReasoning = true; },
913
943
  tool: (tool) => {
914
- turnTools.push(tool);
944
+ // One entry per tool call, not one per frame. The engine opens a `run`
945
+ // frame before the tool executes and closes it with a `done` frame
946
+ // after (see desktop/lib/local/engine.js), so pushing both made the
947
+ // turn summary report every tool twice. An id-bearing done frame
948
+ // replaces the run frame it closes; frames with no id keep the old
949
+ // push-every-frame behaviour, so a host that reports a tool once is
950
+ // unaffected.
951
+ if (tool && tool.id !== undefined) {
952
+ const at = turnTools.findIndex((x) => x && x.id !== undefined && x.id === tool.id);
953
+ if (at >= 0) turnTools[at] = tool;
954
+ else turnTools.push(tool);
955
+ } else {
956
+ turnTools.push(tool);
957
+ }
915
958
  if (tool.phase === 'run') {
916
959
  const n = ++toolSeq;
917
960
  const prefix = tool.agent ? `${tool.agent} ▸ ` : '';
@@ -946,6 +946,11 @@ function createLocalEngine({ aegis, settings, ollama, providers, tools, promptBu
946
946
  let shell = null;
947
947
  const getShell = () => shell || (shell = new ShellSession({ cwd: envFor(payload).cwd }));
948
948
  const toolCtx = { getShell, signal };
949
+ // The turn's working directory. It rides on every tool frame because a
950
+ // tool row's args are the command or the path — never the directory the
951
+ // command runs in — which left "where is it working in" unanswerable from
952
+ // the transcript.
953
+ const turnCwd = envFor(payload).cwd;
949
954
 
950
955
  try {
951
956
  const cfg = cls === 'aegis' || cls === 'ollama' ? {} : settings.get(cls) || {};
@@ -1207,6 +1212,18 @@ function createLocalEngine({ aegis, settings, ollama, providers, tools, promptBu
1207
1212
  });
1208
1213
 
1209
1214
  for (const call of calls) {
1215
+ // Open the live row BEFORE the tool runs. The CLI paints
1216
+ // `Running N … · 3s` off a `phase: 'run'` frame and ticks it while
1217
+ // the tool is still going; reporting the tool only once, after it
1218
+ // finished, left the transcript showing a spinner verb and nothing
1219
+ // else for the whole exec timeout (120s, up to 600s) — which reads
1220
+ // as a wedged turn rather than a working one.
1221
+ if (onDelta) {
1222
+ onDelta({
1223
+ delta: '',
1224
+ tool: { name: call.name, args: call.args, id: call.id, cwd: turnCwd, phase: 'run' },
1225
+ });
1226
+ }
1210
1227
  const result = call.name === T.SUBAGENT_TOOL
1211
1228
  ? await runSubagent(call.args, {
1212
1229
  cls, model, statedMaxTokens, effort: payload && payload.effort,
@@ -1215,7 +1232,15 @@ function createLocalEngine({ aegis, settings, ollama, providers, tools, promptBu
1215
1232
  : await gatedExecuteTool(call, { toolCtx, rootSessionId, rootOnDelta, signal });
1216
1233
  // A subagent's spend rides back on its tool result (see runSubagent).
1217
1234
  if (result && result.usage) addUsage({ usage: result.usage });
1218
- if (onDelta) onDelta({ delta: '', tool: { name: call.name, args: call.args, ok: result.ok } });
1235
+ // The id is carried on both frames: the CLI pairs them by id first,
1236
+ // precisely so parallel same-name calls don't collapse into one row
1237
+ // with the wrong plural.
1238
+ if (onDelta) {
1239
+ onDelta({
1240
+ delta: '',
1241
+ tool: { name: call.name, args: call.args, ok: result.ok, id: call.id, cwd: turnCwd, phase: 'done' },
1242
+ });
1243
+ }
1219
1244
  history.push({
1220
1245
  role: 'tool',
1221
1246
  tool_call_id: call.id,