@invergent/agent-chat-react 2.16.0 → 2.16.2

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/dist/index.cjs CHANGED
@@ -1801,7 +1801,9 @@ var SIMPLE_MODE_HIDDEN_TOOLS = /* @__PURE__ */ new Set([
1801
1801
  // agent accomplished, not *how*. Expert mode still has the full
1802
1802
  // command + output block.
1803
1803
  "terminal",
1804
- "execute_code"
1804
+ "execute_code",
1805
+ // Procedure step markers are bookkeeping for the Studio canvas, not conversation.
1806
+ "skill_step"
1805
1807
  ]);
1806
1808
  function isHiddenSimpleTool(tc) {
1807
1809
  if (SIMPLE_MODE_HIDDEN_TOOLS.has(tc.toolName)) return true;
@@ -5516,7 +5518,12 @@ function cancelledToolLabel(toolName) {
5516
5518
  // Arbor research-mission tools (the /auto-research coordinator loop).
5517
5519
  idea_tree: "Idea tree",
5518
5520
  dispatch_experiments: "Dispatch experiments",
5519
- merge_experiment: "Merge experiment"
5521
+ merge_experiment: "Merge experiment",
5522
+ kb_search_pages: "Knowledge base search",
5523
+ kb_list_pages: "Knowledge base index",
5524
+ kb_read_page: "Knowledge base page",
5525
+ vision_analyze: "Image analysis",
5526
+ skill_step: "Procedure step"
5520
5527
  };
5521
5528
  if (map[toolName]) return map[toolName];
5522
5529
  if (toolName.startsWith("mcp__")) return formatMcpToolLabel(toolName);
@@ -5579,16 +5586,32 @@ function extractToolDetail(tc) {
5579
5586
  return code3 ? truncate3(code3.split("\n")[0] ?? "", 40) : null;
5580
5587
  }
5581
5588
  case "web_search":
5582
- case "web_crawl":
5589
+ case "session_search":
5583
5590
  return stringArg("query");
5591
+ // web_crawl takes a start ``url``, not a query.
5592
+ case "web_crawl":
5584
5593
  case "web_extract": {
5585
5594
  const url = stringArg("url");
5586
- if (!url) return null;
5587
- try {
5588
- return new URL(url).hostname.replace(/^www\./, "");
5589
- } catch {
5590
- return truncate3(url, 40);
5591
- }
5595
+ return url ? hostOf2(url) : null;
5596
+ }
5597
+ case "kb_search_pages": {
5598
+ const query = stringArg("query");
5599
+ return query ? truncate3(query, 60) : null;
5600
+ }
5601
+ case "kb_read_page": {
5602
+ const path = stringArg("path");
5603
+ if (!path) return null;
5604
+ const pages = stringArg("pages");
5605
+ return pages ? `${kbPageName(path)} \xB7 pages ${pages}` : kbPageName(path);
5606
+ }
5607
+ case "vision_analyze": {
5608
+ const image = stringArg("image");
5609
+ return image && !image.startsWith("data:") ? lastPathSegment(image) : null;
5610
+ }
5611
+ case "skill_step": {
5612
+ const step = stringArg("step");
5613
+ const status = stringArg("status");
5614
+ return step && status ? `${step} ${status}` : null;
5592
5615
  }
5593
5616
  case "skill_view":
5594
5617
  case "skill_manage":
@@ -5621,14 +5644,7 @@ function extractToolDetail(tc) {
5621
5644
  const title = stringArg("title");
5622
5645
  if (title) return truncate3(title, 60);
5623
5646
  const url = stringArg("url");
5624
- if (url) {
5625
- try {
5626
- return new URL(url).hostname.replace(/^www\./, "");
5627
- } catch {
5628
- return truncate3(url, 40);
5629
- }
5630
- }
5631
- return null;
5647
+ return url ? hostOf2(url) : null;
5632
5648
  }
5633
5649
  if (action === "retrieve") {
5634
5650
  return stringArg("query");
@@ -5661,6 +5677,34 @@ function lastPathSegment(path) {
5661
5677
  function truncate3(s, max) {
5662
5678
  return s.length > max ? `${s.slice(0, max - 1)}\u2026` : s;
5663
5679
  }
5680
+ function hostOf2(url) {
5681
+ try {
5682
+ return new URL(url).hostname.replace(/^www\./, "") || truncate3(url, 40);
5683
+ } catch {
5684
+ return truncate3(url, 40);
5685
+ }
5686
+ }
5687
+ function kbPageName(path) {
5688
+ return lastPathSegment(path).replace(/\.(md|json)$/, "");
5689
+ }
5690
+ var _PLURAL_LABEL = {
5691
+ read_file: (n) => `Read ${n} files`,
5692
+ write_file: (n) => `Wrote ${n} files`,
5693
+ patch: (n) => `Edited ${n} files`,
5694
+ search_files: (n) => `Ran ${n} file searches`,
5695
+ terminal: (n) => `Ran ${n} commands`,
5696
+ web_search: (n) => `Ran ${n} web searches`,
5697
+ web_extract: (n) => `Fetched ${n} pages`,
5698
+ session_search: (n) => `Ran ${n} session searches`,
5699
+ kb_search_pages: (n) => `Ran ${n} knowledge base searches`,
5700
+ kb_read_page: (n) => `Read ${n} knowledge base pages`,
5701
+ vision_analyze: (n) => `Looked at ${n} images`,
5702
+ consult_expert: (n) => `Consulted ${n} experts`,
5703
+ delegate_task: (n) => `Delegated ${n} tasks`
5704
+ };
5705
+ function sameToolGroupLabel(toolName, count) {
5706
+ return _PLURAL_LABEL[toolName]?.(count) ?? `${cancelledToolLabel(toolName)} \xD7 ${count}`;
5707
+ }
5664
5708
  function toolRowLabel(tc) {
5665
5709
  const detail = extractToolDetail(tc);
5666
5710
  switch (tc.toolName) {
@@ -5684,7 +5728,22 @@ function toolRowLabel(tc) {
5684
5728
  case "web_search":
5685
5729
  return detail ? `Searched the web for "${detail}"` : "Searched the web";
5686
5730
  case "web_crawl":
5687
- return detail ? `Crawled "${detail}"` : "Crawled the web";
5731
+ return detail ? `Crawled ${detail}` : "Crawled a site";
5732
+ case "kb_search_pages": {
5733
+ if (!detail) return "Searched the knowledge base";
5734
+ return stringField(parseArgs(tc.args), "mode") === "documents" ? `Looked up document "${detail}"` : `Searched the knowledge base for "${detail}"`;
5735
+ }
5736
+ case "kb_list_pages":
5737
+ return "Browsed the knowledge base index";
5738
+ case "kb_read_page": {
5739
+ const args = parseArgs(tc.args);
5740
+ const path = stringField(args, "path");
5741
+ if (!path) return "Read a knowledge base page";
5742
+ const pages = stringField(args, "pages");
5743
+ return pages ? `Read ${kbPageName(path)}, pages ${pages}` : `Read ${kbPageName(path)}`;
5744
+ }
5745
+ case "vision_analyze":
5746
+ return detail ? `Looked at ${detail}` : "Looked at an image";
5688
5747
  case "web_extract":
5689
5748
  return detail ? `Fetched ${detail}` : "Fetched a page";
5690
5749
  case "session_search":
@@ -5705,6 +5764,8 @@ function toolRowLabel(tc) {
5705
5764
  return detail ? `Memory ${detail}` : "Updated memory";
5706
5765
  case "todo":
5707
5766
  return detail ? `Todo ${detail}` : "Updated todo list";
5767
+ case "skill_step":
5768
+ return detail ? `Step ${detail}` : "Recorded a procedure step";
5708
5769
  case "run_coding_agent":
5709
5770
  case "code_run": {
5710
5771
  const a = parseArgs(tc.args);
@@ -12475,8 +12536,7 @@ function deriveIterationLabel(message) {
12475
12536
  const firstName = calls[0].toolName;
12476
12537
  const allSame = calls.every((tc) => tc.toolName === firstName);
12477
12538
  if (allSame) {
12478
- const human = cancelledToolLabel(firstName);
12479
- return `${human} \xD7 ${calls.length}`;
12539
+ return sameToolGroupLabel(firstName, calls.length);
12480
12540
  }
12481
12541
  return `Used ${calls.length} tools`;
12482
12542
  }
@@ -12556,7 +12616,11 @@ var _TOOL_ROW_ICON = {
12556
12616
  research_memory: lucideReact.BookOpenIcon,
12557
12617
  research_outline: lucideReact.ListIcon,
12558
12618
  run_coding_agent: lucideReact.BotIcon,
12559
- code_run: lucideReact.BotIcon
12619
+ code_run: lucideReact.BotIcon,
12620
+ kb_search_pages: lucideReact.LibraryIcon,
12621
+ kb_list_pages: lucideReact.LibraryIcon,
12622
+ kb_read_page: lucideReact.LibraryIcon,
12623
+ vision_analyze: lucideReact.EyeIcon
12560
12624
  };
12561
12625
  function _toolRowIcon(toolName) {
12562
12626
  return _TOOL_ROW_ICON[toolName] ?? lucideReact.WrenchIcon;