@volter-ai-dev/supercode-ui 0.1.17 → 0.1.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/components.mjs CHANGED
@@ -116,6 +116,12 @@ function sourceString(source, keys) {
116
116
  const match = new RegExp(`(?:^|[,{\\s])["']?(?:${names})["']?\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
117
117
  return decodedLiteral(match?.[1]);
118
118
  }
119
+ function assignedString(source, keys) {
120
+ if (!source) return "";
121
+ const names = keys.join("|");
122
+ const match = new RegExp(`\\b(?:${names})\\s*=\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
123
+ return decodedLiteral(match?.[1]);
124
+ }
119
125
  function callArgumentSource(source, open) {
120
126
  let depth = 1;
121
127
  let quote = "";
@@ -257,6 +263,13 @@ function planItems(args) {
257
263
  return [{ label: boundedString(label, 300), status: firstString(value, ["status"]) }];
258
264
  }).slice(0, 12);
259
265
  }
266
+ function agentItems(name, resultText) {
267
+ if (!/list.?agents/i.test(name)) return [];
268
+ return (resultText ?? "").split("\n").flatMap((line) => {
269
+ const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
270
+ return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(" \xB7 "), 180) }] : [];
271
+ }).slice(0, 12);
272
+ }
260
273
  function editPreview(args, resultText, source) {
261
274
  const direct = firstString(args, ["patch", "diff"]);
262
275
  if (direct) return direct;
@@ -274,7 +287,19 @@ function editPreview(args, resultText, source) {
274
287
  }
275
288
  function toolResultEnvelope(resultText) {
276
289
  const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
277
- if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
290
+ if (!match) {
291
+ try {
292
+ const value = JSON.parse(resultText ?? "");
293
+ const object = record(value);
294
+ return {
295
+ preview: typeof value === "string" ? value : firstString(object, ["output", "message", "text", "summary", "result"]) || resultText || "",
296
+ value: object,
297
+ durationMs: null
298
+ };
299
+ } catch {
300
+ return { preview: resultText ?? "", value: null, durationMs: null };
301
+ }
302
+ }
278
303
  const durationMs = Number(match[1]) * 1e3;
279
304
  try {
280
305
  const value = record(JSON.parse(match[2]));
@@ -287,6 +312,15 @@ function toolResultEnvelope(resultText) {
287
312
  return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
288
313
  }
289
314
  }
315
+ function semanticAgentPreview(name, status, outcome) {
316
+ const normalized = name.toLocaleLowerCase();
317
+ if (status === "error") return outcome.preview;
318
+ if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return "Agent is working in the background.";
319
+ if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
320
+ return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? "Agent resumed in the background." : "Message delivered.";
321
+ }
322
+ return outcome.preview;
323
+ }
290
324
  function verificationCommand(command) {
291
325
  let shell = "";
292
326
  let quote = "";
@@ -319,12 +353,13 @@ function verificationCommand(command) {
319
353
  function classifyTool(name, command) {
320
354
  const normalized = name.toLocaleLowerCase();
321
355
  if (/write_stdin|^wait$/.test(normalized)) return "command";
322
- if (/update.?plan|todo|checklist|taskcreate|taskupdate/.test(normalized)) return "plan";
356
+ if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return "plan";
323
357
  if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return "edit";
324
358
  if (/read|view|open_file|list_dir/.test(normalized)) return "read";
359
+ if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return "web";
325
360
  if (/search|find|grep|glob|toolsearch/.test(normalized)) return "search";
326
361
  if (/browser|web|fetch|url/.test(normalized)) return "web";
327
- if (/agent|subagent|sendmessage|delegate|^task$/.test(normalized)) return "agent";
362
+ if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return "agent";
328
363
  if (/test|typecheck|lint|build/.test(normalized)) return "test";
329
364
  if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? "test" : "command";
330
365
  return "other";
@@ -333,9 +368,17 @@ function toolAction(status, category, name, tools) {
333
368
  const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
334
369
  if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
335
370
  const normalized = name.toLocaleLowerCase();
336
- if (/sendmessage/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
337
- if (/kill_command_or_subagent/.test(normalized)) return ["Stopping", "Stopped", "Stop failed"][position];
371
+ if (/send.?message|followup.?task/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
372
+ if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ["Stopping agent", "Stopped agent", "Stop failed"][position];
373
+ if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ["Checking agents", "Checked agents", "Agent check failed"][position];
338
374
  if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ["Waiting for", "Checked", "Check failed"][position];
375
+ if (/web.?search/.test(normalized)) return ["Searching web", "Searched web", "Web search failed"][position];
376
+ if (/web.?fetch|fetch.?url/.test(normalized)) return ["Fetching page", "Fetched page", "Page fetch failed"][position];
377
+ if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ["Loading skill", "Loaded skill", "Skill load failed"][position];
378
+ if (/taskcreate/.test(normalized)) return ["Adding task", "Added task", "Task creation failed"][position];
379
+ if (/taskupdate/.test(normalized)) return ["Updating task", "Updated task", "Task update failed"][position];
380
+ if (/create.?goal/.test(normalized)) return ["Creating goal", "Created goal", "Goal creation failed"][position];
381
+ if (/update.?goal/.test(normalized)) return ["Updating goal", "Updated goal", "Goal update failed"][position];
339
382
  const actions = {
340
383
  read: ["Reading", "Read", "Read failed"],
341
384
  search: ["Searching", "Searched", "Search failed"],
@@ -352,18 +395,21 @@ function createToolPresentation(entry) {
352
395
  const envelope = toolEnvelope(entry);
353
396
  const args = envelope.args;
354
397
  const outcome = toolResultEnvelope(entry.resultText);
398
+ const patchSource = assignedString(envelope.source, ["patch"]) || envelope.source;
355
399
  const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
356
400
  const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
357
- const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
401
+ const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(patchSource);
358
402
  const query = firstString(args, ["query", "pattern"]) || sourceString(envelope.callSource, ["query", "pattern", "q"]);
359
403
  const url = firstString(args, ["url"]) || sourceString(envelope.callSource, ["url", "ref_id"]);
360
- const subject = firstString(args, ["subject", "description", "summary", "task", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "prompt"]);
404
+ const subject = firstString(args, ["subject", "description", "summary", "task", "objective", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "objective", "prompt"]);
405
+ const agentTarget = category === "agent" ? firstString(record(outcome.value), ["command", "name"]) || firstString(args, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) || sourceString(envelope.callSource, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) : "";
406
+ const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name) ? firstString(args, ["skill", "name"]) || sourceString(envelope.callSource, ["skill", "name"]) : "";
361
407
  const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? "background task" : /write_stdin|^wait$/i.test(envelope.name) ? "background command" : "";
362
- const items = planItems(args);
408
+ const items = category === "agent" ? agentItems(envelope.name, outcome.preview) : planItems(args);
363
409
  const taskId = firstString(args, ["taskId", "task_id"]);
364
410
  const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
365
- const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
366
- const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
411
+ const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
412
+ const previewSource = category === "edit" ? editPreview(args, outcome.preview, patchSource) : category === "agent" ? semanticAgentPreview(envelope.name, entry.status ?? "completed", outcome) : outcome.preview;
367
413
  const result = record(entry.resultContent);
368
414
  const metadata = record(entry.metadata);
369
415
  const resultMetadata = record(result?.metadata);
@@ -1200,7 +1246,10 @@ function ToolPreview({ presentation, entry }) {
1200
1246
  presentation.url ? /* @__PURE__ */ jsx4("code", { children: presentation.url }) : null,
1201
1247
  presentation.preview ? /* @__PURE__ */ jsx4("p", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Waiting for the page" : "No page summary returned" })
1202
1248
  ] });
1203
- if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1249
+ if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.items?.length ? /* @__PURE__ */ jsx4("ol", { class: "scui-agent-roster", children: presentation.items.map((item, index) => /* @__PURE__ */ jsxs3("li", { children: [
1250
+ /* @__PURE__ */ jsx4("strong", { children: item.label }),
1251
+ /* @__PURE__ */ jsx4("small", { children: item.status })
1252
+ ] }, `${item.label}:${index}`)) }) : presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1204
1253
  if (presentation.detail === "plan") return /* @__PURE__ */ jsx4("ol", { class: "scui-plan-preview", children: presentation.items?.map((item, index) => /* @__PURE__ */ jsxs3("li", { "data-status": item.status, children: [
1205
1254
  /* @__PURE__ */ jsx4("i", { "aria-hidden": "true" }),
1206
1255
  /* @__PURE__ */ jsx4("span", { children: item.label })
package/controller.mjs CHANGED
@@ -141,6 +141,11 @@ function projectConversationEntry(entry, maxEntryChars) {
141
141
  };
142
142
  projected.presentation = createToolPresentation({
143
143
  ...projected,
144
+ // Presentation is a small semantic projection, so derive it before the raw native
145
+ // envelope is bounded for transport. Large Agent prompts and patches routinely exceed the
146
+ // widget cap; parsing the truncated JSON made their useful description/path disappear.
147
+ arguments: (entry.arguments ?? '').trim(),
148
+ resultText: (entry.resultText ?? '').trim(),
144
149
  resultContent: entry.resultContent,
145
150
  metadata: entry.metadata,
146
151
  });
package/conversation.mjs CHANGED
@@ -102,6 +102,12 @@ function sourceString(source, keys) {
102
102
  const match = new RegExp(`(?:^|[,{\\s])["']?(?:${names})["']?\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
103
103
  return decodedLiteral(match?.[1]);
104
104
  }
105
+ function assignedString(source, keys) {
106
+ if (!source) return "";
107
+ const names = keys.join("|");
108
+ const match = new RegExp(`\\b(?:${names})\\s*=\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
109
+ return decodedLiteral(match?.[1]);
110
+ }
105
111
  function callArgumentSource(source, open) {
106
112
  let depth = 1;
107
113
  let quote = "";
@@ -243,6 +249,13 @@ function planItems(args) {
243
249
  return [{ label: boundedString(label, 300), status: firstString(value, ["status"]) }];
244
250
  }).slice(0, 12);
245
251
  }
252
+ function agentItems(name, resultText) {
253
+ if (!/list.?agents/i.test(name)) return [];
254
+ return (resultText ?? "").split("\n").flatMap((line) => {
255
+ const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
256
+ return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(" \xB7 "), 180) }] : [];
257
+ }).slice(0, 12);
258
+ }
246
259
  function editPreview(args, resultText, source) {
247
260
  const direct = firstString(args, ["patch", "diff"]);
248
261
  if (direct) return direct;
@@ -260,7 +273,19 @@ function editPreview(args, resultText, source) {
260
273
  }
261
274
  function toolResultEnvelope(resultText) {
262
275
  const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
263
- if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
276
+ if (!match) {
277
+ try {
278
+ const value = JSON.parse(resultText ?? "");
279
+ const object = record(value);
280
+ return {
281
+ preview: typeof value === "string" ? value : firstString(object, ["output", "message", "text", "summary", "result"]) || resultText || "",
282
+ value: object,
283
+ durationMs: null
284
+ };
285
+ } catch {
286
+ return { preview: resultText ?? "", value: null, durationMs: null };
287
+ }
288
+ }
264
289
  const durationMs = Number(match[1]) * 1e3;
265
290
  try {
266
291
  const value = record(JSON.parse(match[2]));
@@ -273,6 +298,15 @@ function toolResultEnvelope(resultText) {
273
298
  return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
274
299
  }
275
300
  }
301
+ function semanticAgentPreview(name, status, outcome) {
302
+ const normalized = name.toLocaleLowerCase();
303
+ if (status === "error") return outcome.preview;
304
+ if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return "Agent is working in the background.";
305
+ if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
306
+ return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? "Agent resumed in the background." : "Message delivered.";
307
+ }
308
+ return outcome.preview;
309
+ }
276
310
  function verificationCommand(command) {
277
311
  let shell = "";
278
312
  let quote = "";
@@ -305,12 +339,13 @@ function verificationCommand(command) {
305
339
  function classifyTool(name, command) {
306
340
  const normalized = name.toLocaleLowerCase();
307
341
  if (/write_stdin|^wait$/.test(normalized)) return "command";
308
- if (/update.?plan|todo|checklist|taskcreate|taskupdate/.test(normalized)) return "plan";
342
+ if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return "plan";
309
343
  if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return "edit";
310
344
  if (/read|view|open_file|list_dir/.test(normalized)) return "read";
345
+ if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return "web";
311
346
  if (/search|find|grep|glob|toolsearch/.test(normalized)) return "search";
312
347
  if (/browser|web|fetch|url/.test(normalized)) return "web";
313
- if (/agent|subagent|sendmessage|delegate|^task$/.test(normalized)) return "agent";
348
+ if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return "agent";
314
349
  if (/test|typecheck|lint|build/.test(normalized)) return "test";
315
350
  if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? "test" : "command";
316
351
  return "other";
@@ -319,9 +354,17 @@ function toolAction(status, category, name, tools) {
319
354
  const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
320
355
  if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
321
356
  const normalized = name.toLocaleLowerCase();
322
- if (/sendmessage/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
323
- if (/kill_command_or_subagent/.test(normalized)) return ["Stopping", "Stopped", "Stop failed"][position];
357
+ if (/send.?message|followup.?task/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
358
+ if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ["Stopping agent", "Stopped agent", "Stop failed"][position];
359
+ if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ["Checking agents", "Checked agents", "Agent check failed"][position];
324
360
  if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ["Waiting for", "Checked", "Check failed"][position];
361
+ if (/web.?search/.test(normalized)) return ["Searching web", "Searched web", "Web search failed"][position];
362
+ if (/web.?fetch|fetch.?url/.test(normalized)) return ["Fetching page", "Fetched page", "Page fetch failed"][position];
363
+ if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ["Loading skill", "Loaded skill", "Skill load failed"][position];
364
+ if (/taskcreate/.test(normalized)) return ["Adding task", "Added task", "Task creation failed"][position];
365
+ if (/taskupdate/.test(normalized)) return ["Updating task", "Updated task", "Task update failed"][position];
366
+ if (/create.?goal/.test(normalized)) return ["Creating goal", "Created goal", "Goal creation failed"][position];
367
+ if (/update.?goal/.test(normalized)) return ["Updating goal", "Updated goal", "Goal update failed"][position];
325
368
  const actions = {
326
369
  read: ["Reading", "Read", "Read failed"],
327
370
  search: ["Searching", "Searched", "Search failed"],
@@ -338,18 +381,21 @@ function createToolPresentation(entry) {
338
381
  const envelope = toolEnvelope(entry);
339
382
  const args = envelope.args;
340
383
  const outcome = toolResultEnvelope(entry.resultText);
384
+ const patchSource = assignedString(envelope.source, ["patch"]) || envelope.source;
341
385
  const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
342
386
  const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
343
- const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
387
+ const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(patchSource);
344
388
  const query = firstString(args, ["query", "pattern"]) || sourceString(envelope.callSource, ["query", "pattern", "q"]);
345
389
  const url = firstString(args, ["url"]) || sourceString(envelope.callSource, ["url", "ref_id"]);
346
- const subject = firstString(args, ["subject", "description", "summary", "task", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "prompt"]);
390
+ const subject = firstString(args, ["subject", "description", "summary", "task", "objective", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "objective", "prompt"]);
391
+ const agentTarget = category === "agent" ? firstString(record(outcome.value), ["command", "name"]) || firstString(args, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) || sourceString(envelope.callSource, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) : "";
392
+ const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name) ? firstString(args, ["skill", "name"]) || sourceString(envelope.callSource, ["skill", "name"]) : "";
347
393
  const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? "background task" : /write_stdin|^wait$/i.test(envelope.name) ? "background command" : "";
348
- const items = planItems(args);
394
+ const items = category === "agent" ? agentItems(envelope.name, outcome.preview) : planItems(args);
349
395
  const taskId = firstString(args, ["taskId", "task_id"]);
350
396
  const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
351
- const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
352
- const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
397
+ const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
398
+ const previewSource = category === "edit" ? editPreview(args, outcome.preview, patchSource) : category === "agent" ? semanticAgentPreview(envelope.name, entry.status ?? "completed", outcome) : outcome.preview;
353
399
  const result = record(entry.resultContent);
354
400
  const metadata = record(entry.metadata);
355
401
  const resultMetadata = record(result?.metadata);
@@ -799,7 +845,10 @@ function ToolPreview({ presentation, entry }) {
799
845
  presentation.url ? /* @__PURE__ */ jsx3("code", { children: presentation.url }) : null,
800
846
  presentation.preview ? /* @__PURE__ */ jsx3("p", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx3("small", { children: pending ? "Waiting for the page" : "No page summary returned" })
801
847
  ] });
802
- if (presentation.detail === "agent") return /* @__PURE__ */ jsx3("section", { class: "scui-agent-preview", children: presentation.preview ? /* @__PURE__ */ jsx3("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx3("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
848
+ if (presentation.detail === "agent") return /* @__PURE__ */ jsx3("section", { class: "scui-agent-preview", children: presentation.items?.length ? /* @__PURE__ */ jsx3("ol", { class: "scui-agent-roster", children: presentation.items.map((item, index) => /* @__PURE__ */ jsxs2("li", { children: [
849
+ /* @__PURE__ */ jsx3("strong", { children: item.label }),
850
+ /* @__PURE__ */ jsx3("small", { children: item.status })
851
+ ] }, `${item.label}:${index}`)) }) : presentation.preview ? /* @__PURE__ */ jsx3("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx3("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
803
852
  if (presentation.detail === "plan") return /* @__PURE__ */ jsx3("ol", { class: "scui-plan-preview", children: presentation.items?.map((item, index) => /* @__PURE__ */ jsxs2("li", { "data-status": item.status, children: [
804
853
  /* @__PURE__ */ jsx3("i", { "aria-hidden": "true" }),
805
854
  /* @__PURE__ */ jsx3("span", { children: item.label })
package/core.mjs CHANGED
@@ -131,6 +131,13 @@ function sourceString(source, keys) {
131
131
  return decodedLiteral(match?.[1]);
132
132
  }
133
133
 
134
+ function assignedString(source, keys) {
135
+ if (!source) return '';
136
+ const names = keys.join('|');
137
+ const match = new RegExp(`\\b(?:${names})\\s*=\\s*(\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
138
+ return decodedLiteral(match?.[1]);
139
+ }
140
+
134
141
  function callArgumentSource(source, open) {
135
142
  let depth = 1;
136
143
  let quote = '';
@@ -243,6 +250,14 @@ function planItems(args) {
243
250
  }).slice(0, 12);
244
251
  }
245
252
 
253
+ function agentItems(name, resultText) {
254
+ if (!/list.?agents/i.test(name)) return [];
255
+ return (resultText ?? '').split('\n').flatMap((line) => {
256
+ const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
257
+ return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(' · '), 180) }] : [];
258
+ }).slice(0, 12);
259
+ }
260
+
246
261
  function editPreview(args, resultText, source) {
247
262
  const direct = firstString(args, ['patch', 'diff']);
248
263
  if (direct) return direct;
@@ -261,7 +276,19 @@ function editPreview(args, resultText, source) {
261
276
 
262
277
  function toolResultEnvelope(resultText) {
263
278
  const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? '');
264
- if (!match) return { preview: resultText ?? '', value: null, durationMs: null };
279
+ if (!match) {
280
+ try {
281
+ const value = JSON.parse(resultText ?? '');
282
+ const object = record(value);
283
+ return {
284
+ preview: typeof value === 'string' ? value : firstString(object, ['output', 'message', 'text', 'summary', 'result']) || resultText || '',
285
+ value: object,
286
+ durationMs: null,
287
+ };
288
+ } catch {
289
+ return { preview: resultText ?? '', value: null, durationMs: null };
290
+ }
291
+ }
265
292
  const durationMs = Number(match[1]) * 1_000;
266
293
  try {
267
294
  const value = record(JSON.parse(match[2]));
@@ -275,6 +302,16 @@ function toolResultEnvelope(resultText) {
275
302
  }
276
303
  }
277
304
 
305
+ function semanticAgentPreview(name, status, outcome) {
306
+ const normalized = name.toLocaleLowerCase();
307
+ if (status === 'error') return outcome.preview;
308
+ if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return 'Agent is working in the background.';
309
+ if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
310
+ return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? 'Agent resumed in the background.' : 'Message delivered.';
311
+ }
312
+ return outcome.preview;
313
+ }
314
+
278
315
  function verificationCommand(command) {
279
316
  let shell = '';
280
317
  let quote = '';
@@ -292,12 +329,13 @@ function verificationCommand(command) {
292
329
  function classifyTool(name, command) {
293
330
  const normalized = name.toLocaleLowerCase();
294
331
  if (/write_stdin|^wait$/.test(normalized)) return 'command';
295
- if (/update.?plan|todo|checklist|taskcreate|taskupdate/.test(normalized)) return 'plan';
332
+ if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return 'plan';
296
333
  if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return 'edit';
297
334
  if (/read|view|open_file|list_dir/.test(normalized)) return 'read';
335
+ if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return 'web';
298
336
  if (/search|find|grep|glob|toolsearch/.test(normalized)) return 'search';
299
337
  if (/browser|web|fetch|url/.test(normalized)) return 'web';
300
- if (/agent|subagent|sendmessage|delegate|^task$/.test(normalized)) return 'agent';
338
+ if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return 'agent';
301
339
  if (/test|typecheck|lint|build/.test(normalized)) return 'test';
302
340
  if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? 'test' : 'command';
303
341
  return 'other';
@@ -307,9 +345,17 @@ function toolAction(status, category, name, tools) {
307
345
  const position = status === 'pending' ? 0 : status === 'error' ? 2 : 1;
308
346
  if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
309
347
  const normalized = name.toLocaleLowerCase();
310
- if (/sendmessage/.test(normalized)) return ['Messaging agent', 'Messaged agent', 'Agent message failed'][position];
311
- if (/kill_command_or_subagent/.test(normalized)) return ['Stopping', 'Stopped', 'Stop failed'][position];
348
+ if (/send.?message|followup.?task/.test(normalized)) return ['Messaging agent', 'Messaged agent', 'Agent message failed'][position];
349
+ if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ['Stopping agent', 'Stopped agent', 'Stop failed'][position];
350
+ if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ['Checking agents', 'Checked agents', 'Agent check failed'][position];
312
351
  if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ['Waiting for', 'Checked', 'Check failed'][position];
352
+ if (/web.?search/.test(normalized)) return ['Searching web', 'Searched web', 'Web search failed'][position];
353
+ if (/web.?fetch|fetch.?url/.test(normalized)) return ['Fetching page', 'Fetched page', 'Page fetch failed'][position];
354
+ if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ['Loading skill', 'Loaded skill', 'Skill load failed'][position];
355
+ if (/taskcreate/.test(normalized)) return ['Adding task', 'Added task', 'Task creation failed'][position];
356
+ if (/taskupdate/.test(normalized)) return ['Updating task', 'Updated task', 'Task update failed'][position];
357
+ if (/create.?goal/.test(normalized)) return ['Creating goal', 'Created goal', 'Goal creation failed'][position];
358
+ if (/update.?goal/.test(normalized)) return ['Updating goal', 'Updated goal', 'Goal update failed'][position];
313
359
  const actions = {
314
360
  read: ['Reading', 'Read', 'Read failed'],
315
361
  search: ['Searching', 'Searched', 'Search failed'],
@@ -327,18 +373,25 @@ export function createToolPresentation(entry) {
327
373
  const envelope = toolEnvelope(entry);
328
374
  const args = envelope.args;
329
375
  const outcome = toolResultEnvelope(entry.resultText);
376
+ const patchSource = assignedString(envelope.source, ['patch']) || envelope.source;
330
377
  const command = firstString(args, ['command', 'cmd']) || sourceString(envelope.callSource, ['command', 'cmd']);
331
378
  const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || '');
332
- const path = firstString(args, ['file_path', 'target_file', 'target_directory', 'path']) || sourceString(envelope.callSource, ['file_path', 'target_file', 'target_directory', 'path']) || patchPath(envelope.source);
379
+ const path = firstString(args, ['file_path', 'target_file', 'target_directory', 'path']) || sourceString(envelope.callSource, ['file_path', 'target_file', 'target_directory', 'path']) || patchPath(patchSource);
333
380
  const query = firstString(args, ['query', 'pattern']) || sourceString(envelope.callSource, ['query', 'pattern', 'q']);
334
381
  const url = firstString(args, ['url']) || sourceString(envelope.callSource, ['url', 'ref_id']);
335
- const subject = firstString(args, ['subject', 'description', 'summary', 'task', 'prompt']) || sourceString(envelope.callSource, ['subject', 'description', 'summary', 'task', 'prompt']);
382
+ const subject = firstString(args, ['subject', 'description', 'summary', 'task', 'objective', 'prompt']) || sourceString(envelope.callSource, ['subject', 'description', 'summary', 'task', 'objective', 'prompt']);
383
+ const agentTarget = category === 'agent'
384
+ ? firstString(record(outcome.value), ['command', 'name']) || firstString(args, ['target', 'task_name', 'taskId', 'task_id', 'agentId', 'agent_id', 'resume', 'team_name']) || sourceString(envelope.callSource, ['target', 'task_name', 'taskId', 'task_id', 'agentId', 'agent_id', 'resume', 'team_name'])
385
+ : '';
386
+ const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name)
387
+ ? firstString(args, ['skill', 'name']) || sourceString(envelope.callSource, ['skill', 'name'])
388
+ : '';
336
389
  const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? 'background task' : /write_stdin|^wait$/i.test(envelope.name) ? 'background command' : '';
337
- const items = planItems(args);
390
+ const items = category === 'agent' ? agentItems(envelope.name, outcome.preview) : planItems(args);
338
391
  const taskId = firstString(args, ['taskId', 'task_id']);
339
392
  const planTarget = category === 'plan' ? items.length ? `${items.length} ${items.length === 1 ? 'item' : 'items'}` : taskId ? `task ${taskId}` : '' : '';
340
- const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
341
- const previewSource = category === 'edit' ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
393
+ const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
394
+ const previewSource = category === 'edit' ? editPreview(args, outcome.preview, patchSource) : category === 'agent' ? semanticAgentPreview(envelope.name, entry.status ?? 'completed', outcome) : outcome.preview;
342
395
  const result = record(entry.resultContent);
343
396
  const metadata = record(entry.metadata);
344
397
  const resultMetadata = record(result?.metadata);
package/embed.mjs CHANGED
@@ -119,6 +119,12 @@ function sourceString(source, keys) {
119
119
  const match = new RegExp(`(?:^|[,{\\s])["']?(?:${names})["']?\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
120
120
  return decodedLiteral(match?.[1]);
121
121
  }
122
+ function assignedString(source, keys) {
123
+ if (!source) return "";
124
+ const names = keys.join("|");
125
+ const match = new RegExp(`\\b(?:${names})\\s*=\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
126
+ return decodedLiteral(match?.[1]);
127
+ }
122
128
  function callArgumentSource(source, open) {
123
129
  let depth = 1;
124
130
  let quote = "";
@@ -260,6 +266,13 @@ function planItems(args) {
260
266
  return [{ label: boundedString(label, 300), status: firstString(value, ["status"]) }];
261
267
  }).slice(0, 12);
262
268
  }
269
+ function agentItems(name, resultText) {
270
+ if (!/list.?agents/i.test(name)) return [];
271
+ return (resultText ?? "").split("\n").flatMap((line) => {
272
+ const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
273
+ return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(" \xB7 "), 180) }] : [];
274
+ }).slice(0, 12);
275
+ }
263
276
  function editPreview(args, resultText, source) {
264
277
  const direct = firstString(args, ["patch", "diff"]);
265
278
  if (direct) return direct;
@@ -277,7 +290,19 @@ function editPreview(args, resultText, source) {
277
290
  }
278
291
  function toolResultEnvelope(resultText) {
279
292
  const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
280
- if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
293
+ if (!match) {
294
+ try {
295
+ const value = JSON.parse(resultText ?? "");
296
+ const object = record(value);
297
+ return {
298
+ preview: typeof value === "string" ? value : firstString(object, ["output", "message", "text", "summary", "result"]) || resultText || "",
299
+ value: object,
300
+ durationMs: null
301
+ };
302
+ } catch {
303
+ return { preview: resultText ?? "", value: null, durationMs: null };
304
+ }
305
+ }
281
306
  const durationMs = Number(match[1]) * 1e3;
282
307
  try {
283
308
  const value = record(JSON.parse(match[2]));
@@ -290,6 +315,15 @@ function toolResultEnvelope(resultText) {
290
315
  return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
291
316
  }
292
317
  }
318
+ function semanticAgentPreview(name, status, outcome) {
319
+ const normalized = name.toLocaleLowerCase();
320
+ if (status === "error") return outcome.preview;
321
+ if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return "Agent is working in the background.";
322
+ if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
323
+ return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? "Agent resumed in the background." : "Message delivered.";
324
+ }
325
+ return outcome.preview;
326
+ }
293
327
  function verificationCommand(command) {
294
328
  let shell = "";
295
329
  let quote = "";
@@ -322,12 +356,13 @@ function verificationCommand(command) {
322
356
  function classifyTool(name, command) {
323
357
  const normalized = name.toLocaleLowerCase();
324
358
  if (/write_stdin|^wait$/.test(normalized)) return "command";
325
- if (/update.?plan|todo|checklist|taskcreate|taskupdate/.test(normalized)) return "plan";
359
+ if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return "plan";
326
360
  if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return "edit";
327
361
  if (/read|view|open_file|list_dir/.test(normalized)) return "read";
362
+ if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return "web";
328
363
  if (/search|find|grep|glob|toolsearch/.test(normalized)) return "search";
329
364
  if (/browser|web|fetch|url/.test(normalized)) return "web";
330
- if (/agent|subagent|sendmessage|delegate|^task$/.test(normalized)) return "agent";
365
+ if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return "agent";
331
366
  if (/test|typecheck|lint|build/.test(normalized)) return "test";
332
367
  if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? "test" : "command";
333
368
  return "other";
@@ -336,9 +371,17 @@ function toolAction(status, category, name, tools) {
336
371
  const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
337
372
  if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
338
373
  const normalized = name.toLocaleLowerCase();
339
- if (/sendmessage/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
340
- if (/kill_command_or_subagent/.test(normalized)) return ["Stopping", "Stopped", "Stop failed"][position];
374
+ if (/send.?message|followup.?task/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
375
+ if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ["Stopping agent", "Stopped agent", "Stop failed"][position];
376
+ if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ["Checking agents", "Checked agents", "Agent check failed"][position];
341
377
  if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ["Waiting for", "Checked", "Check failed"][position];
378
+ if (/web.?search/.test(normalized)) return ["Searching web", "Searched web", "Web search failed"][position];
379
+ if (/web.?fetch|fetch.?url/.test(normalized)) return ["Fetching page", "Fetched page", "Page fetch failed"][position];
380
+ if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ["Loading skill", "Loaded skill", "Skill load failed"][position];
381
+ if (/taskcreate/.test(normalized)) return ["Adding task", "Added task", "Task creation failed"][position];
382
+ if (/taskupdate/.test(normalized)) return ["Updating task", "Updated task", "Task update failed"][position];
383
+ if (/create.?goal/.test(normalized)) return ["Creating goal", "Created goal", "Goal creation failed"][position];
384
+ if (/update.?goal/.test(normalized)) return ["Updating goal", "Updated goal", "Goal update failed"][position];
342
385
  const actions = {
343
386
  read: ["Reading", "Read", "Read failed"],
344
387
  search: ["Searching", "Searched", "Search failed"],
@@ -355,18 +398,21 @@ function createToolPresentation(entry) {
355
398
  const envelope = toolEnvelope(entry);
356
399
  const args = envelope.args;
357
400
  const outcome = toolResultEnvelope(entry.resultText);
401
+ const patchSource = assignedString(envelope.source, ["patch"]) || envelope.source;
358
402
  const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
359
403
  const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
360
- const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
404
+ const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(patchSource);
361
405
  const query = firstString(args, ["query", "pattern"]) || sourceString(envelope.callSource, ["query", "pattern", "q"]);
362
406
  const url = firstString(args, ["url"]) || sourceString(envelope.callSource, ["url", "ref_id"]);
363
- const subject = firstString(args, ["subject", "description", "summary", "task", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "prompt"]);
407
+ const subject = firstString(args, ["subject", "description", "summary", "task", "objective", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "objective", "prompt"]);
408
+ const agentTarget = category === "agent" ? firstString(record(outcome.value), ["command", "name"]) || firstString(args, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) || sourceString(envelope.callSource, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) : "";
409
+ const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name) ? firstString(args, ["skill", "name"]) || sourceString(envelope.callSource, ["skill", "name"]) : "";
364
410
  const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? "background task" : /write_stdin|^wait$/i.test(envelope.name) ? "background command" : "";
365
- const items = planItems(args);
411
+ const items = category === "agent" ? agentItems(envelope.name, outcome.preview) : planItems(args);
366
412
  const taskId = firstString(args, ["taskId", "task_id"]);
367
413
  const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
368
- const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
369
- const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
414
+ const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
415
+ const previewSource = category === "edit" ? editPreview(args, outcome.preview, patchSource) : category === "agent" ? semanticAgentPreview(envelope.name, entry.status ?? "completed", outcome) : outcome.preview;
370
416
  const result = record(entry.resultContent);
371
417
  const metadata = record(entry.metadata);
372
418
  const resultMetadata = record(result?.metadata);
@@ -1206,7 +1252,10 @@ function ToolPreview({ presentation, entry }) {
1206
1252
  presentation.url ? /* @__PURE__ */ jsx4("code", { children: presentation.url }) : null,
1207
1253
  presentation.preview ? /* @__PURE__ */ jsx4("p", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Waiting for the page" : "No page summary returned" })
1208
1254
  ] });
1209
- if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1255
+ if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.items?.length ? /* @__PURE__ */ jsx4("ol", { class: "scui-agent-roster", children: presentation.items.map((item, index) => /* @__PURE__ */ jsxs3("li", { children: [
1256
+ /* @__PURE__ */ jsx4("strong", { children: item.label }),
1257
+ /* @__PURE__ */ jsx4("small", { children: item.status })
1258
+ ] }, `${item.label}:${index}`)) }) : presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1210
1259
  if (presentation.detail === "plan") return /* @__PURE__ */ jsx4("ol", { class: "scui-plan-preview", children: presentation.items?.map((item, index) => /* @__PURE__ */ jsxs3("li", { "data-status": item.status, children: [
1211
1260
  /* @__PURE__ */ jsx4("i", { "aria-hidden": "true" }),
1212
1261
  /* @__PURE__ */ jsx4("span", { children: item.label })
package/messenger.mjs CHANGED
@@ -116,6 +116,12 @@ function sourceString(source, keys) {
116
116
  const match = new RegExp(`(?:^|[,{\\s])["']?(?:${names})["']?\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
117
117
  return decodedLiteral(match?.[1]);
118
118
  }
119
+ function assignedString(source, keys) {
120
+ if (!source) return "";
121
+ const names = keys.join("|");
122
+ const match = new RegExp(`\\b(?:${names})\\s*=\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\`(?:\\\\.|[^\`\\\\])*\`)`).exec(source);
123
+ return decodedLiteral(match?.[1]);
124
+ }
119
125
  function callArgumentSource(source, open) {
120
126
  let depth = 1;
121
127
  let quote = "";
@@ -257,6 +263,13 @@ function planItems(args) {
257
263
  return [{ label: boundedString(label, 300), status: firstString(value, ["status"]) }];
258
264
  }).slice(0, 12);
259
265
  }
266
+ function agentItems(name, resultText) {
267
+ if (!/list.?agents/i.test(name)) return [];
268
+ return (resultText ?? "").split("\n").flatMap((line) => {
269
+ const parts = line.trim().split(/\s+·\s+/).filter(Boolean);
270
+ return parts.length > 1 ? [{ label: boundedString(parts[0], 120), status: boundedString(parts.slice(1).join(" \xB7 "), 180) }] : [];
271
+ }).slice(0, 12);
272
+ }
260
273
  function editPreview(args, resultText, source) {
261
274
  const direct = firstString(args, ["patch", "diff"]);
262
275
  if (direct) return direct;
@@ -274,7 +287,19 @@ function editPreview(args, resultText, source) {
274
287
  }
275
288
  function toolResultEnvelope(resultText) {
276
289
  const match = /^Script (?:completed|failed)\r?\nWall time ([0-9.]+) seconds\r?\nOutput:\r?\n([\s\S]*)$/.exec(resultText ?? "");
277
- if (!match) return { preview: resultText ?? "", value: null, durationMs: null };
290
+ if (!match) {
291
+ try {
292
+ const value = JSON.parse(resultText ?? "");
293
+ const object = record(value);
294
+ return {
295
+ preview: typeof value === "string" ? value : firstString(object, ["output", "message", "text", "summary", "result"]) || resultText || "",
296
+ value: object,
297
+ durationMs: null
298
+ };
299
+ } catch {
300
+ return { preview: resultText ?? "", value: null, durationMs: null };
301
+ }
302
+ }
278
303
  const durationMs = Number(match[1]) * 1e3;
279
304
  try {
280
305
  const value = record(JSON.parse(match[2]));
@@ -287,6 +312,15 @@ function toolResultEnvelope(resultText) {
287
312
  return { preview: match[2], value: null, durationMs: Number.isFinite(durationMs) ? durationMs : null };
288
313
  }
289
314
  }
315
+ function semanticAgentPreview(name, status, outcome) {
316
+ const normalized = name.toLocaleLowerCase();
317
+ if (status === "error") return outcome.preview;
318
+ if (/^(?:agent|task)$|spawn.?agent/.test(normalized) && outcome.preview) return "Agent is working in the background.";
319
+ if (/send.?message|followup.?task/.test(normalized) && outcome.preview) {
320
+ return /resumed from transcript|resumedAgentId/i.test(outcome.preview) ? "Agent resumed in the background." : "Message delivered.";
321
+ }
322
+ return outcome.preview;
323
+ }
290
324
  function verificationCommand(command) {
291
325
  let shell = "";
292
326
  let quote = "";
@@ -319,12 +353,13 @@ function verificationCommand(command) {
319
353
  function classifyTool(name, command) {
320
354
  const normalized = name.toLocaleLowerCase();
321
355
  if (/write_stdin|^wait$/.test(normalized)) return "command";
322
- if (/update.?plan|todo|checklist|taskcreate|taskupdate/.test(normalized)) return "plan";
356
+ if (/update.?plan|todo|checklist|taskcreate|taskupdate|create.?goal|update.?goal/.test(normalized)) return "plan";
323
357
  if (/search.?replace|edit|write|patch|replace|create_file|apply_patch/.test(normalized)) return "edit";
324
358
  if (/read|view|open_file|list_dir/.test(normalized)) return "read";
359
+ if (/web.?search|web.?fetch|fetch.?url/.test(normalized)) return "web";
325
360
  if (/search|find|grep|glob|toolsearch/.test(normalized)) return "search";
326
361
  if (/browser|web|fetch|url/.test(normalized)) return "web";
327
- if (/agent|subagent|sendmessage|delegate|^task$/.test(normalized)) return "agent";
362
+ if (/agent|subagent|send.?message|delegate|followup.?task|taskstop|taskoutput|^task$/.test(normalized)) return "agent";
328
363
  if (/test|typecheck|lint|build/.test(normalized)) return "test";
329
364
  if (/terminal|bash|shell|command|exec|write_stdin|^wait$/.test(normalized)) return verificationCommand(command) ? "test" : "command";
330
365
  return "other";
@@ -333,9 +368,17 @@ function toolAction(status, category, name, tools) {
333
368
  const position = status === "pending" ? 0 : status === "error" ? 2 : 1;
334
369
  if (tools.length > 1) return [`Running ${tools.length} actions`, `Ran ${tools.length} actions`, `${tools.length} actions failed`][position];
335
370
  const normalized = name.toLocaleLowerCase();
336
- if (/sendmessage/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
337
- if (/kill_command_or_subagent/.test(normalized)) return ["Stopping", "Stopped", "Stop failed"][position];
371
+ if (/send.?message|followup.?task/.test(normalized)) return ["Messaging agent", "Messaged agent", "Agent message failed"][position];
372
+ if (/taskstop|interrupt.?agent|kill_command_or_subagent/.test(normalized)) return ["Stopping agent", "Stopped agent", "Stop failed"][position];
373
+ if (/list.?agents|taskoutput|wait.?agent/.test(normalized)) return ["Checking agents", "Checked agents", "Agent check failed"][position];
338
374
  if (/get_command_or_subagent_output|write_stdin|^wait$/.test(normalized)) return ["Waiting for", "Checked", "Check failed"][position];
375
+ if (/web.?search/.test(normalized)) return ["Searching web", "Searched web", "Web search failed"][position];
376
+ if (/web.?fetch|fetch.?url/.test(normalized)) return ["Fetching page", "Fetched page", "Page fetch failed"][position];
377
+ if (/^skill$|use.?skill|load.?skill/.test(normalized)) return ["Loading skill", "Loaded skill", "Skill load failed"][position];
378
+ if (/taskcreate/.test(normalized)) return ["Adding task", "Added task", "Task creation failed"][position];
379
+ if (/taskupdate/.test(normalized)) return ["Updating task", "Updated task", "Task update failed"][position];
380
+ if (/create.?goal/.test(normalized)) return ["Creating goal", "Created goal", "Goal creation failed"][position];
381
+ if (/update.?goal/.test(normalized)) return ["Updating goal", "Updated goal", "Goal update failed"][position];
339
382
  const actions = {
340
383
  read: ["Reading", "Read", "Read failed"],
341
384
  search: ["Searching", "Searched", "Search failed"],
@@ -352,18 +395,21 @@ function createToolPresentation(entry) {
352
395
  const envelope = toolEnvelope(entry);
353
396
  const args = envelope.args;
354
397
  const outcome = toolResultEnvelope(entry.resultText);
398
+ const patchSource = assignedString(envelope.source, ["patch"]) || envelope.source;
355
399
  const command = firstString(args, ["command", "cmd"]) || sourceString(envelope.callSource, ["command", "cmd"]);
356
400
  const category = classifyTool(envelope.name, command || envelope.source || entry.arguments || "");
357
- const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(envelope.source);
401
+ const path = firstString(args, ["file_path", "target_file", "target_directory", "path"]) || sourceString(envelope.callSource, ["file_path", "target_file", "target_directory", "path"]) || patchPath(patchSource);
358
402
  const query = firstString(args, ["query", "pattern"]) || sourceString(envelope.callSource, ["query", "pattern", "q"]);
359
403
  const url = firstString(args, ["url"]) || sourceString(envelope.callSource, ["url", "ref_id"]);
360
- const subject = firstString(args, ["subject", "description", "summary", "task", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "prompt"]);
404
+ const subject = firstString(args, ["subject", "description", "summary", "task", "objective", "prompt"]) || sourceString(envelope.callSource, ["subject", "description", "summary", "task", "objective", "prompt"]);
405
+ const agentTarget = category === "agent" ? firstString(record(outcome.value), ["command", "name"]) || firstString(args, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) || sourceString(envelope.callSource, ["target", "task_name", "taskId", "task_id", "agentId", "agent_id", "resume", "team_name"]) : "";
406
+ const skillTarget = /^skill$|use.?skill|load.?skill/i.test(envelope.name) ? firstString(args, ["skill", "name"]) || sourceString(envelope.callSource, ["skill", "name"]) : "";
361
407
  const background = /get_command_or_subagent_output|kill_command_or_subagent/i.test(envelope.name) ? "background task" : /write_stdin|^wait$/i.test(envelope.name) ? "background command" : "";
362
- const items = planItems(args);
408
+ const items = category === "agent" ? agentItems(envelope.name, outcome.preview) : planItems(args);
363
409
  const taskId = firstString(args, ["taskId", "task_id"]);
364
410
  const planTarget = category === "plan" ? items.length ? `${items.length} ${items.length === 1 ? "item" : "items"}` : taskId ? `task ${taskId}` : "" : "";
365
- const target = path || command || query || url || subject || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
366
- const previewSource = category === "edit" ? editPreview(args, outcome.preview, envelope.source) : outcome.preview;
411
+ const target = path || command || query || url || subject || agentTarget || skillTarget || background || planTarget || (envelope.tools.length > 1 ? `${envelope.tools.length} coordinated actions` : toolTarget(entry.arguments));
412
+ const previewSource = category === "edit" ? editPreview(args, outcome.preview, patchSource) : category === "agent" ? semanticAgentPreview(envelope.name, entry.status ?? "completed", outcome) : outcome.preview;
367
413
  const result = record(entry.resultContent);
368
414
  const metadata = record(entry.metadata);
369
415
  const resultMetadata = record(result?.metadata);
@@ -1203,7 +1249,10 @@ function ToolPreview({ presentation, entry }) {
1203
1249
  presentation.url ? /* @__PURE__ */ jsx4("code", { children: presentation.url }) : null,
1204
1250
  presentation.preview ? /* @__PURE__ */ jsx4("p", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Waiting for the page" : "No page summary returned" })
1205
1251
  ] });
1206
- if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1252
+ if (presentation.detail === "agent") return /* @__PURE__ */ jsx4("section", { class: "scui-agent-preview", children: presentation.items?.length ? /* @__PURE__ */ jsx4("ol", { class: "scui-agent-roster", children: presentation.items.map((item, index) => /* @__PURE__ */ jsxs3("li", { children: [
1253
+ /* @__PURE__ */ jsx4("strong", { children: item.label }),
1254
+ /* @__PURE__ */ jsx4("small", { children: item.status })
1255
+ ] }, `${item.label}:${index}`)) }) : presentation.preview ? /* @__PURE__ */ jsx4("pre", { children: stripAnsi(presentation.preview) }) : /* @__PURE__ */ jsx4("small", { children: pending ? "Agent is working" : "No textual handoff returned" }) });
1207
1256
  if (presentation.detail === "plan") return /* @__PURE__ */ jsx4("ol", { class: "scui-plan-preview", children: presentation.items?.map((item, index) => /* @__PURE__ */ jsxs3("li", { "data-status": item.status, children: [
1208
1257
  /* @__PURE__ */ jsx4("i", { "aria-hidden": "true" }),
1209
1258
  /* @__PURE__ */ jsx4("span", { children: item.label })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter-ai-dev/supercode-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "type": "module",
5
5
  "description": "Composable default UI kit for Supercode-powered coding-agent experiences",
6
6
  "exports": {
package/styles.css CHANGED
@@ -158,6 +158,7 @@
158
158
  .scui-code-preview { margin:0; padding:5px 0; overflow:auto; counter-reset:line; color:var(--scui-fg); font:9.5px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; list-style:none }.scui-code-preview li { display:grid; grid-template-columns:31px minmax(max-content,1fr); min-height:15px }.scui-code-preview li > span { padding-right:7px; color:var(--scui-muted); text-align:right; user-select:none }.scui-code-preview code { padding:0 8px; white-space:pre }.scui-code-preview li[data-tone="add"] { background:color-mix(in srgb,var(--scui-success) 11%,transparent) }.scui-code-preview li[data-tone="remove"] { background:color-mix(in srgb,var(--scui-danger) 10%,transparent) }.scui-code-preview li[data-tone="hunk"] { color:var(--scui-accent) }
159
159
  .scui-search-preview header { display:flex; align-items:center; gap:6px; padding:7px 8px; border-bottom:1px solid var(--scui-border) }.scui-search-preview header span { color:var(--scui-muted) }.scui-search-preview header code { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }.scui-search-preview ol { display:grid; margin:0; padding:3px 0; list-style:none }.scui-search-preview li { display:grid; grid-template-columns:minmax(0,auto) auto minmax(70px,1fr); align-items:baseline; gap:5px; padding:3px 8px; border-bottom:1px solid color-mix(in srgb,var(--scui-border) 60%,transparent) }.scui-search-preview li:last-child { border:0 }.scui-search-preview li code { overflow:hidden; color:var(--scui-accent); text-overflow:ellipsis; white-space:nowrap }.scui-search-preview li small { color:var(--scui-muted) }.scui-search-preview li span { min-width:0; overflow:hidden; color:var(--scui-fg); text-overflow:ellipsis; white-space:nowrap }.scui-search-preview p { margin:0; padding:8px; color:var(--scui-muted) }
160
160
  .scui-web-preview,.scui-agent-preview { display:grid; gap:6px; padding:8px }.scui-web-preview > code { overflow:hidden; color:var(--scui-accent); text-overflow:ellipsis; white-space:nowrap }.scui-web-preview p,.scui-agent-preview p { margin:0; color:var(--scui-fg); line-height:1.45 }.scui-web-preview small,.scui-agent-preview small,.scui-tool-empty { padding:8px; color:var(--scui-muted) }
161
+ .scui-agent-roster { display:grid; gap:1px; margin:0; padding:0; list-style:none }.scui-agent-roster li { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; min-height:27px; padding:3px 6px; border-bottom:1px solid var(--scui-border) }.scui-agent-roster li:last-child { border-bottom:0 }.scui-agent-roster strong { min-width:0; overflow:hidden; color:var(--scui-fg); font:10px ui-monospace,SFMono-Regular,Menlo,monospace; text-overflow:ellipsis; white-space:nowrap }.scui-agent-roster small { padding:0; text-align:right; white-space:nowrap }
161
162
  .scui-plan-preview { display:grid; gap:5px; margin:0; padding:8px; list-style:none }.scui-plan-preview li { display:flex; align-items:flex-start; gap:6px; color:var(--scui-fg) }.scui-plan-preview li i { flex:0 0 8px; width:8px; height:8px; margin-top:3px; border:1px solid var(--scui-border-strong); border-radius:50% }.scui-plan-preview li[data-status="completed"] { color:var(--scui-muted); text-decoration:line-through }.scui-plan-preview li[data-status="completed"] i { border-color:var(--scui-success); background:var(--scui-success) }.scui-plan-preview li[data-status="in_progress"] i { border-color:var(--scui-accent); box-shadow:inset 0 0 0 2px var(--scui-bg-raised); background:var(--scui-accent) }
162
163
  .scui-tool-fields { display:grid; gap:5px; margin:0; padding:0 8px 8px }.scui-tool-fields > div { display:grid; grid-template-columns:minmax(65px,auto) 1fr; gap:8px }.scui-tool-fields dt { color:var(--scui-muted) }.scui-tool-fields dd { min-width:0; margin:0; overflow-wrap:anywhere; color:var(--scui-fg) }
163
164
  .scui-tool-actions { display:flex; gap:5px; padding:0 8px }.scui-tool-actions button { padding:3px 6px; border:1px solid var(--scui-border); border-radius:5px; background:transparent; color:var(--scui-muted); cursor:pointer; font:inherit; font-size:9.5px }.scui-tool-actions button:hover { border-color:var(--scui-border-strong); color:var(--scui-fg) }