@invergent/agent-chat-react 2.7.9 → 2.8.1

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
@@ -6446,6 +6446,10 @@ function ChatComposerInner({
6446
6446
  deepResearchEnabled = false,
6447
6447
  researchEnabled = false,
6448
6448
  codeAgentsEnabled = false,
6449
+ loopsEnabled = true,
6450
+ missionsEnabled = true,
6451
+ goalsEnabled = true,
6452
+ compressEnabled = true,
6449
6453
  viewMode = "simple",
6450
6454
  onViewModeChange
6451
6455
  }) {
@@ -6492,22 +6496,38 @@ function ChatComposerInner({
6492
6496
  const builtinCommands = react.useMemo(
6493
6497
  () => {
6494
6498
  const base = [
6495
- { value: "/clear", label: "/clear", description: "Clear conversation" },
6496
- { value: "/compress", label: "/compress", description: "Compress context" },
6497
- { value: "/goal", label: "/goal", description: "Define an outcome goal" },
6498
- { value: "/goal status", label: "/goal status", description: "Show outcome goal status" },
6499
- { value: "/goal pause", label: "/goal pause", description: "Pause automatic goal continuation" },
6500
- { value: "/goal resume", label: "/goal resume", description: "Resume a paused goal" },
6501
- { value: "/goal clear", label: "/goal clear", description: "Clear the current goal" },
6502
- { value: "/mission ", label: "/mission", description: "Start an orchestrated rubric-judged mission" },
6503
- { value: "/mission status", label: "/mission status", description: "Show current mission status" },
6504
- { value: "/mission pause", label: "/mission pause", description: "Pause the mission evaluator" },
6505
- { value: "/mission resume", label: "/mission resume", description: "Resume a paused mission" },
6506
- { value: "/mission cancel", label: "/mission cancel", description: "Cancel the mission" },
6507
- { value: "/loop", label: "/loop", description: "Schedule recurring prompt" },
6508
- { value: "/loop list", label: "/loop list", description: "List active loops" },
6509
- { value: "/loop cancel", label: "/loop cancel", description: "Cancel a loop by ID" }
6499
+ { value: "/clear", label: "/clear", description: "Clear conversation" }
6510
6500
  ];
6501
+ if (compressEnabled) {
6502
+ base.push(
6503
+ { value: "/compress", label: "/compress", description: "Compress context" }
6504
+ );
6505
+ }
6506
+ if (goalsEnabled) {
6507
+ base.push(
6508
+ { value: "/goal", label: "/goal", description: "Define an outcome goal" },
6509
+ { value: "/goal status", label: "/goal status", description: "Show outcome goal status" },
6510
+ { value: "/goal pause", label: "/goal pause", description: "Pause automatic goal continuation" },
6511
+ { value: "/goal resume", label: "/goal resume", description: "Resume a paused goal" },
6512
+ { value: "/goal clear", label: "/goal clear", description: "Clear the current goal" }
6513
+ );
6514
+ }
6515
+ if (missionsEnabled) {
6516
+ base.push(
6517
+ { value: "/mission ", label: "/mission", description: "Start an orchestrated rubric-judged mission" },
6518
+ { value: "/mission status", label: "/mission status", description: "Show current mission status" },
6519
+ { value: "/mission pause", label: "/mission pause", description: "Pause the mission evaluator" },
6520
+ { value: "/mission resume", label: "/mission resume", description: "Resume a paused mission" },
6521
+ { value: "/mission cancel", label: "/mission cancel", description: "Cancel the mission" }
6522
+ );
6523
+ }
6524
+ if (loopsEnabled) {
6525
+ base.push(
6526
+ { value: "/loop", label: "/loop", description: "Schedule recurring prompt" },
6527
+ { value: "/loop list", label: "/loop list", description: "List active loops" },
6528
+ { value: "/loop cancel", label: "/loop cancel", description: "Cancel a loop by ID" }
6529
+ );
6530
+ }
6511
6531
  if (deepResearchEnabled) {
6512
6532
  base.push({
6513
6533
  value: "/deep-research ",
@@ -6533,7 +6553,15 @@ function ChatComposerInner({
6533
6553
  }
6534
6554
  return base;
6535
6555
  },
6536
- [deepResearchEnabled, researchEnabled, codeAgentsEnabled]
6556
+ [
6557
+ compressEnabled,
6558
+ goalsEnabled,
6559
+ missionsEnabled,
6560
+ loopsEnabled,
6561
+ deepResearchEnabled,
6562
+ researchEnabled,
6563
+ codeAgentsEnabled
6564
+ ]
6537
6565
  );
6538
6566
  const scheduledExamples = react.useMemo(
6539
6567
  () => [
@@ -6691,7 +6719,7 @@ function ChatComposerInner({
6691
6719
  ]
6692
6720
  }
6693
6721
  ),
6694
- /* @__PURE__ */ jsxRuntime.jsxs(
6722
+ loopsEnabled && /* @__PURE__ */ jsxRuntime.jsxs(
6695
6723
  Button,
6696
6724
  {
6697
6725
  type: "button",
@@ -10097,6 +10125,10 @@ function ChatThread({
10097
10125
  deepResearchEnabled = false,
10098
10126
  researchEnabled = false,
10099
10127
  codeAgentsEnabled = false,
10128
+ loopsEnabled = true,
10129
+ missionsEnabled = true,
10130
+ goalsEnabled = true,
10131
+ compressEnabled = true,
10100
10132
  researchSources = [],
10101
10133
  hideTurnSummary = false,
10102
10134
  agentId,
@@ -10163,7 +10195,11 @@ function ChatThread({
10163
10195
  onViewModeChange,
10164
10196
  deepResearchEnabled,
10165
10197
  researchEnabled,
10166
- codeAgentsEnabled
10198
+ codeAgentsEnabled,
10199
+ loopsEnabled,
10200
+ missionsEnabled,
10201
+ goalsEnabled,
10202
+ compressEnabled
10167
10203
  }
10168
10204
  ),
10169
10205
  onOpenIntegrations && /* @__PURE__ */ jsxRuntime.jsx(
@@ -12674,6 +12710,10 @@ function AgentChat({
12674
12710
  deepResearchEnabled = false,
12675
12711
  researchEnabled = false,
12676
12712
  codeAgentsEnabled = false,
12713
+ loopsEnabled = true,
12714
+ missionsEnabled = true,
12715
+ goalsEnabled = true,
12716
+ compressEnabled = true,
12677
12717
  onOpenIntegrations,
12678
12718
  onOpenBilling
12679
12719
  }) {
@@ -12827,6 +12867,10 @@ function AgentChat({
12827
12867
  deepResearchEnabled,
12828
12868
  researchEnabled,
12829
12869
  codeAgentsEnabled,
12870
+ loopsEnabled,
12871
+ missionsEnabled,
12872
+ goalsEnabled,
12873
+ compressEnabled,
12830
12874
  researchSources: runtime.researchSources,
12831
12875
  hideTurnSummary,
12832
12876
  agentId,
@@ -16361,10 +16405,20 @@ function fallbackSessionTitle(entry) {
16361
16405
  if (entry.runKind === "scheduled") return "Scheduled run";
16362
16406
  return "New session";
16363
16407
  }
16408
+ function rowStateClass(isActive, isInActiveGroup) {
16409
+ if (isActive) {
16410
+ return "bg-faint/30 dark:bg-[#1e2840] text-foreground border-l-primary";
16411
+ }
16412
+ if (isInActiveGroup) {
16413
+ return "bg-line/70 dark:bg-line/60 text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
16414
+ }
16415
+ return "bg-transparent text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
16416
+ }
16364
16417
  function TreeNodeRow({
16365
16418
  entry,
16366
16419
  depth,
16367
16420
  activeSessionId,
16421
+ activeGroupRootId,
16368
16422
  canStop,
16369
16423
  canDelete,
16370
16424
  onSelect,
@@ -16376,11 +16430,15 @@ function TreeNodeRow({
16376
16430
  const isActive = entry.id === activeSessionId;
16377
16431
  const isRunning = entry.status === "active";
16378
16432
  const isChildSession = entry.parentId != null;
16433
+ const isInActiveGroup = activeGroupRootId !== null && (entry.id === activeGroupRootId || entry.parentId === activeGroupRootId);
16379
16434
  const title = entry.title ?? fallbackSessionTitle(entry);
16380
16435
  const subtitle = [
16381
16436
  formatRunKind(entry.runKind),
16382
16437
  formatSessionTime(entry.updatedAt)
16383
16438
  ].filter(Boolean).join(" \xB7 ");
16439
+ react.useEffect(() => {
16440
+ if (hasChildren) setExpanded(isInActiveGroup);
16441
+ }, [isInActiveGroup, hasChildren]);
16384
16442
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16385
16443
  /* @__PURE__ */ jsxRuntime.jsxs(
16386
16444
  "div",
@@ -16394,7 +16452,7 @@ function TreeNodeRow({
16394
16452
  className: cn(
16395
16453
  "group flex items-center gap-2 w-full py-2 pr-2 text-left cursor-pointer transition-colors border-l-2",
16396
16454
  "min-h-11 md:min-h-0",
16397
- isActive ? "bg-line text-foreground border-l-primary" : "bg-transparent text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent"
16455
+ rowStateClass(isActive, isInActiveGroup)
16398
16456
  ),
16399
16457
  style: { paddingLeft: `${depth * 12 + 12}px` },
16400
16458
  children: [
@@ -16453,6 +16511,7 @@ function TreeNodeRow({
16453
16511
  entry: child,
16454
16512
  depth: depth + 1,
16455
16513
  activeSessionId,
16514
+ activeGroupRootId,
16456
16515
  canStop,
16457
16516
  canDelete,
16458
16517
  onSelect,
@@ -16569,6 +16628,21 @@ function SessionTreePanel({
16569
16628
  return () => clearInterval(id);
16570
16629
  }, [refetch, runningCount]);
16571
16630
  const roots = react.useMemo(() => buildTree(nodes), [nodes]);
16631
+ const activeGroupRootId = react.useMemo(() => {
16632
+ if (!activeSessionId) return null;
16633
+ const parentOf = /* @__PURE__ */ new Map();
16634
+ for (const n of nodes) parentOf.set(n.id, n.parentId ?? null);
16635
+ const visited = /* @__PURE__ */ new Set();
16636
+ let current = activeSessionId;
16637
+ let parent = parentOf.get(current);
16638
+ while (parent != null) {
16639
+ if (visited.has(parent)) break;
16640
+ visited.add(current);
16641
+ current = parent;
16642
+ parent = parentOf.get(current);
16643
+ }
16644
+ return parentOf.has(current) ? current : null;
16645
+ }, [activeSessionId, nodes]);
16572
16646
  const handleSelect = react.useCallback(
16573
16647
  (id) => {
16574
16648
  onSessionSelect?.(id);
@@ -16632,6 +16706,7 @@ function SessionTreePanel({
16632
16706
  entry,
16633
16707
  depth: 0,
16634
16708
  activeSessionId: activeSessionId ?? "",
16709
+ activeGroupRootId,
16635
16710
  canStop: Boolean(adapter.stopSession),
16636
16711
  canDelete: Boolean(adapter.deleteSession),
16637
16712
  onSelect: handleSelect,