@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.js CHANGED
@@ -1588,7 +1588,9 @@ var SIMPLE_MODE_HIDDEN_TOOLS = /* @__PURE__ */ new Set([
1588
1588
  // agent accomplished, not *how*. Expert mode still has the full
1589
1589
  // command + output block.
1590
1590
  "terminal",
1591
- "execute_code"
1591
+ "execute_code",
1592
+ // Procedure step markers are bookkeeping for the Studio canvas, not conversation.
1593
+ "skill_step"
1592
1594
  ]);
1593
1595
  function isHiddenSimpleTool(tc) {
1594
1596
  if (SIMPLE_MODE_HIDDEN_TOOLS.has(tc.toolName)) return true;
@@ -5255,7 +5257,12 @@ function cancelledToolLabel(toolName) {
5255
5257
  // Arbor research-mission tools (the /auto-research coordinator loop).
5256
5258
  idea_tree: "Idea tree",
5257
5259
  dispatch_experiments: "Dispatch experiments",
5258
- merge_experiment: "Merge experiment"
5260
+ merge_experiment: "Merge experiment",
5261
+ kb_search_pages: "Knowledge base search",
5262
+ kb_list_pages: "Knowledge base index",
5263
+ kb_read_page: "Knowledge base page",
5264
+ vision_analyze: "Image analysis",
5265
+ skill_step: "Procedure step"
5259
5266
  };
5260
5267
  if (map[toolName]) return map[toolName];
5261
5268
  if (toolName.startsWith("mcp__")) return formatMcpToolLabel(toolName);
@@ -5318,16 +5325,32 @@ function extractToolDetail(tc) {
5318
5325
  return code3 ? truncate3(code3.split("\n")[0] ?? "", 40) : null;
5319
5326
  }
5320
5327
  case "web_search":
5321
- case "web_crawl":
5328
+ case "session_search":
5322
5329
  return stringArg("query");
5330
+ // web_crawl takes a start ``url``, not a query.
5331
+ case "web_crawl":
5323
5332
  case "web_extract": {
5324
5333
  const url = stringArg("url");
5325
- if (!url) return null;
5326
- try {
5327
- return new URL(url).hostname.replace(/^www\./, "");
5328
- } catch {
5329
- return truncate3(url, 40);
5330
- }
5334
+ return url ? hostOf2(url) : null;
5335
+ }
5336
+ case "kb_search_pages": {
5337
+ const query = stringArg("query");
5338
+ return query ? truncate3(query, 60) : null;
5339
+ }
5340
+ case "kb_read_page": {
5341
+ const path = stringArg("path");
5342
+ if (!path) return null;
5343
+ const pages = stringArg("pages");
5344
+ return pages ? `${kbPageName(path)} \xB7 pages ${pages}` : kbPageName(path);
5345
+ }
5346
+ case "vision_analyze": {
5347
+ const image = stringArg("image");
5348
+ return image && !image.startsWith("data:") ? lastPathSegment(image) : null;
5349
+ }
5350
+ case "skill_step": {
5351
+ const step = stringArg("step");
5352
+ const status = stringArg("status");
5353
+ return step && status ? `${step} ${status}` : null;
5331
5354
  }
5332
5355
  case "skill_view":
5333
5356
  case "skill_manage":
@@ -5360,14 +5383,7 @@ function extractToolDetail(tc) {
5360
5383
  const title = stringArg("title");
5361
5384
  if (title) return truncate3(title, 60);
5362
5385
  const url = stringArg("url");
5363
- if (url) {
5364
- try {
5365
- return new URL(url).hostname.replace(/^www\./, "");
5366
- } catch {
5367
- return truncate3(url, 40);
5368
- }
5369
- }
5370
- return null;
5386
+ return url ? hostOf2(url) : null;
5371
5387
  }
5372
5388
  if (action === "retrieve") {
5373
5389
  return stringArg("query");
@@ -5400,6 +5416,34 @@ function lastPathSegment(path) {
5400
5416
  function truncate3(s, max) {
5401
5417
  return s.length > max ? `${s.slice(0, max - 1)}\u2026` : s;
5402
5418
  }
5419
+ function hostOf2(url) {
5420
+ try {
5421
+ return new URL(url).hostname.replace(/^www\./, "") || truncate3(url, 40);
5422
+ } catch {
5423
+ return truncate3(url, 40);
5424
+ }
5425
+ }
5426
+ function kbPageName(path) {
5427
+ return lastPathSegment(path).replace(/\.(md|json)$/, "");
5428
+ }
5429
+ var _PLURAL_LABEL = {
5430
+ read_file: (n) => `Read ${n} files`,
5431
+ write_file: (n) => `Wrote ${n} files`,
5432
+ patch: (n) => `Edited ${n} files`,
5433
+ search_files: (n) => `Ran ${n} file searches`,
5434
+ terminal: (n) => `Ran ${n} commands`,
5435
+ web_search: (n) => `Ran ${n} web searches`,
5436
+ web_extract: (n) => `Fetched ${n} pages`,
5437
+ session_search: (n) => `Ran ${n} session searches`,
5438
+ kb_search_pages: (n) => `Ran ${n} knowledge base searches`,
5439
+ kb_read_page: (n) => `Read ${n} knowledge base pages`,
5440
+ vision_analyze: (n) => `Looked at ${n} images`,
5441
+ consult_expert: (n) => `Consulted ${n} experts`,
5442
+ delegate_task: (n) => `Delegated ${n} tasks`
5443
+ };
5444
+ function sameToolGroupLabel(toolName, count) {
5445
+ return _PLURAL_LABEL[toolName]?.(count) ?? `${cancelledToolLabel(toolName)} \xD7 ${count}`;
5446
+ }
5403
5447
  function toolRowLabel(tc) {
5404
5448
  const detail = extractToolDetail(tc);
5405
5449
  switch (tc.toolName) {
@@ -5423,7 +5467,22 @@ function toolRowLabel(tc) {
5423
5467
  case "web_search":
5424
5468
  return detail ? `Searched the web for "${detail}"` : "Searched the web";
5425
5469
  case "web_crawl":
5426
- return detail ? `Crawled "${detail}"` : "Crawled the web";
5470
+ return detail ? `Crawled ${detail}` : "Crawled a site";
5471
+ case "kb_search_pages": {
5472
+ if (!detail) return "Searched the knowledge base";
5473
+ return stringField(parseArgs(tc.args), "mode") === "documents" ? `Looked up document "${detail}"` : `Searched the knowledge base for "${detail}"`;
5474
+ }
5475
+ case "kb_list_pages":
5476
+ return "Browsed the knowledge base index";
5477
+ case "kb_read_page": {
5478
+ const args = parseArgs(tc.args);
5479
+ const path = stringField(args, "path");
5480
+ if (!path) return "Read a knowledge base page";
5481
+ const pages = stringField(args, "pages");
5482
+ return pages ? `Read ${kbPageName(path)}, pages ${pages}` : `Read ${kbPageName(path)}`;
5483
+ }
5484
+ case "vision_analyze":
5485
+ return detail ? `Looked at ${detail}` : "Looked at an image";
5427
5486
  case "web_extract":
5428
5487
  return detail ? `Fetched ${detail}` : "Fetched a page";
5429
5488
  case "session_search":
@@ -5444,6 +5503,8 @@ function toolRowLabel(tc) {
5444
5503
  return detail ? `Memory ${detail}` : "Updated memory";
5445
5504
  case "todo":
5446
5505
  return detail ? `Todo ${detail}` : "Updated todo list";
5506
+ case "skill_step":
5507
+ return detail ? `Step ${detail}` : "Recorded a procedure step";
5447
5508
  case "run_coding_agent":
5448
5509
  case "code_run": {
5449
5510
  const a = parseArgs(tc.args);
@@ -12156,8 +12217,7 @@ function deriveIterationLabel(message) {
12156
12217
  const firstName = calls[0].toolName;
12157
12218
  const allSame = calls.every((tc) => tc.toolName === firstName);
12158
12219
  if (allSame) {
12159
- const human = cancelledToolLabel(firstName);
12160
- return `${human} \xD7 ${calls.length}`;
12220
+ return sameToolGroupLabel(firstName, calls.length);
12161
12221
  }
12162
12222
  return `Used ${calls.length} tools`;
12163
12223
  }
@@ -12237,7 +12297,11 @@ var _TOOL_ROW_ICON = {
12237
12297
  research_memory: BookOpenIcon,
12238
12298
  research_outline: ListIcon,
12239
12299
  run_coding_agent: BotIcon,
12240
- code_run: BotIcon
12300
+ code_run: BotIcon,
12301
+ kb_search_pages: LibraryIcon,
12302
+ kb_list_pages: LibraryIcon,
12303
+ kb_read_page: LibraryIcon,
12304
+ vision_analyze: EyeIcon
12241
12305
  };
12242
12306
  function _toolRowIcon(toolName) {
12243
12307
  return _TOOL_ROW_ICON[toolName] ?? WrenchIcon;