@ai-matrx/agents 0.14.0 → 0.15.0

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/catalog/index.cjs +1 -0
  3. package/dist/catalog/index.cjs.map +1 -1
  4. package/dist/catalog/index.d.cts +2 -2
  5. package/dist/catalog/index.d.ts +2 -2
  6. package/dist/catalog/index.js +1 -0
  7. package/dist/catalog/index.js.map +1 -1
  8. package/dist/catalog/native/index.cjs +16 -0
  9. package/dist/catalog/native/index.cjs.map +1 -1
  10. package/dist/catalog/native/index.d.cts +2 -2
  11. package/dist/catalog/native/index.d.ts +2 -2
  12. package/dist/catalog/native/index.js +16 -0
  13. package/dist/catalog/native/index.js.map +1 -1
  14. package/dist/catalog/react/index.cjs +322 -207
  15. package/dist/catalog/react/index.cjs.map +1 -1
  16. package/dist/catalog/react/index.d.cts +75 -1
  17. package/dist/catalog/react/index.d.ts +75 -1
  18. package/dist/catalog/react/index.js +323 -208
  19. package/dist/catalog/react/index.js.map +1 -1
  20. package/dist/content-transfer/index.cjs +2 -0
  21. package/dist/content-transfer/index.cjs.map +1 -1
  22. package/dist/content-transfer/index.js +2 -0
  23. package/dist/content-transfer/index.js.map +1 -1
  24. package/dist/content-transfer/react/index.cjs +2 -0
  25. package/dist/content-transfer/react/index.cjs.map +1 -1
  26. package/dist/content-transfer/react/index.js +2 -0
  27. package/dist/content-transfer/react/index.js.map +1 -1
  28. package/dist/mandates/index.cjs +8 -2
  29. package/dist/mandates/index.cjs.map +1 -1
  30. package/dist/mandates/index.d.cts +8 -5
  31. package/dist/mandates/index.d.ts +8 -5
  32. package/dist/mandates/index.js +8 -2
  33. package/dist/mandates/index.js.map +1 -1
  34. package/dist/{orchestra-CVil7T5Y.d.cts → orchestra-BDXdut6Y.d.cts} +6 -0
  35. package/dist/{orchestra-CVil7T5Y.d.ts → orchestra-BDXdut6Y.d.ts} +6 -0
  36. package/mandates/snapshots/keys.0.14.3.json +625 -0
  37. package/mandates/snapshots/keys.0.15.0.json +625 -0
  38. package/package.json +3 -3
@@ -905,7 +905,7 @@ var selectStatus = (state) => state.status;
905
905
 
906
906
  // catalog/react/AgentListDropdown.tsx
907
907
  import {
908
- cn as cn6,
908
+ cn as cn7,
909
909
  Drawer,
910
910
  DrawerContent,
911
911
  DrawerTitle,
@@ -916,9 +916,13 @@ import {
916
916
  Tooltip,
917
917
  TooltipContent,
918
918
  TooltipTrigger,
919
- useIsMobile
919
+ useIsMobile as useIsMobile2
920
920
  } from "@ai-matrx/design-system";
921
- import { useCallback as useCallback5, useMemo as useMemo4, useRef as useRef4, useState as useState3 } from "react";
921
+ import { useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
922
+
923
+ // catalog/react/AgentListPanel.tsx
924
+ import { cn as cn6, useIsMobile } from "@ai-matrx/design-system";
925
+ import { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef4, useState as useState3 } from "react";
922
926
 
923
927
  // catalog/react/primitives.tsx
924
928
  import { cn } from "@ai-matrx/design-system";
@@ -1549,6 +1553,15 @@ import { useEffect as useEffect3, useRef as useRef3 } from "react";
1549
1553
  // catalog/react/types.ts
1550
1554
  var PANEL_HEIGHT = "528px";
1551
1555
  var LIST_MAX_HEIGHT = "min(528px, var(--radix-popper-available-height, 528px))";
1556
+ function panelHeightBelow(trigger, options = {}) {
1557
+ if (!trigger || typeof window === "undefined") return null;
1558
+ const full = options.full ?? 528;
1559
+ const minUsable = options.minUsable ?? 300;
1560
+ const gap = options.gap ?? 16;
1561
+ const below = window.innerHeight - trigger.getBoundingClientRect().bottom - gap;
1562
+ if (below >= full) return null;
1563
+ return below >= minUsable ? `${Math.floor(below)}px` : null;
1564
+ }
1552
1565
 
1553
1566
  // catalog/react/AgentFilterBar.tsx
1554
1567
  import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -1747,7 +1760,15 @@ function AgentRow({
1747
1760
  ]
1748
1761
  }
1749
1762
  ),
1750
- agent.agentType === "builtin" ? /* @__PURE__ */ jsx10("span", { className: "text-[9px] font-medium text-primary bg-primary/10 px-1 py-px rounded shrink-0 ml-auto", children: labels.systemBadge }) : agent.isOwner === false ? /* @__PURE__ */ jsx10("span", { className: "text-[9px] text-muted-foreground bg-muted px-1 py-px rounded shrink-0 ml-auto", children: "shared" }) : null
1763
+ agent.isArchived ? /* @__PURE__ */ jsx10(
1764
+ "span",
1765
+ {
1766
+ "data-testid": `agent-archived-badge-${agent.id}`,
1767
+ className: "text-[9px] font-medium text-muted-foreground bg-muted px-1 py-px rounded shrink-0 ml-auto",
1768
+ children: labels.archivedBadge
1769
+ }
1770
+ ) : null,
1771
+ agent.agentType === "builtin" ? /* @__PURE__ */ jsx10("span", { className: cn5("text-[9px] font-medium text-primary bg-primary/10 px-1 py-px rounded shrink-0", !agent.isArchived && "ml-auto"), children: labels.systemBadge }) : agent.isOwner === false ? /* @__PURE__ */ jsx10("span", { className: cn5("text-[9px] text-muted-foreground bg-muted px-1 py-px rounded shrink-0", !agent.isArchived && "ml-auto"), children: "shared" }) : null
1751
1772
  ]
1752
1773
  }
1753
1774
  ),
@@ -2145,33 +2166,22 @@ function AgentTagsPanel({
2145
2166
  ] });
2146
2167
  }
2147
2168
 
2148
- // catalog/react/AgentListDropdown.tsx
2169
+ // catalog/react/AgentListPanel.tsx
2149
2170
  import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2150
- var CONSUMER_ID = "agent-list-dropdown";
2151
- function AgentListDropdown({
2152
- onSelect,
2153
- navigateTo,
2154
- className,
2155
- label,
2156
- triggerSlot,
2157
- noBorder = false,
2158
- compact = false,
2159
- activeAgentId: activeAgentIdProp,
2160
- contentSide,
2161
- consumerId = CONSUMER_ID,
2162
- initialTab,
2163
- includeSystemInAll = false,
2171
+ var PANEL_WIDTH = "680px";
2172
+ function AgentListPanelBody({
2173
+ core,
2164
2174
  visibleTabs,
2165
2175
  systemTabLabel,
2166
- resolveAgentHref: resolveAgentHrefProp,
2176
+ includeSystemInAll = false,
2177
+ resolveAgentHref,
2167
2178
  showPinnedAgent = true,
2168
- excludeAgentIds,
2169
- defaultMandateKey
2179
+ autoFocusSearch = true,
2180
+ onAfterSelect,
2181
+ className
2170
2182
  }) {
2171
2183
  const isMobile = useIsMobile();
2172
2184
  const { labels } = useAgentCatalog();
2173
- const { popoverContainer } = useAgentCatalogUiPorts();
2174
- const [open, setOpen] = useState3(false);
2175
2185
  const [rightPanel, setRightPanel] = useState3(null);
2176
2186
  const [catSearch, setCatSearch] = useState3("");
2177
2187
  const [tagSearch, setTagSearch] = useState3("");
@@ -2198,42 +2208,26 @@ function AgentListDropdown({
2198
2208
  handleAgentHoverEnd: coreAgentHoverEnd,
2199
2209
  handleDetailPanelMouseEnter,
2200
2210
  handleDetailPanelMouseLeave: coreDetailMouseLeave
2201
- } = useAgentListCore({
2202
- consumerId,
2203
- ...onSelect ? { onSelect } : {},
2204
- ...navigateTo ? { navigateTo } : {},
2205
- ...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
2206
- ...initialTab ? { initialTab } : {},
2207
- includeSystemInAll,
2208
- // The restriction has to reach the CORE, not just the tab strip — see
2209
- // `AgentListCoreOptions.visibleTabs`.
2210
- ...visibleTabs ? { visibleTabs } : {},
2211
- ...excludeAgentIds ? { excludeAgentIds } : {},
2212
- ...defaultMandateKey ? { defaultMandateKey } : {}
2213
- });
2214
- const activeDefaultRow = defaultRow?.row?.id === activeAgentId ? defaultRow.row : null;
2215
- const displayLabel = label ?? pinnedAgent?.name ?? activeDefaultRow?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
2216
- const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
2217
- const handleOpen = (nextOpen) => {
2218
- setOpen(nextOpen);
2219
- if (nextOpen) {
2220
- ensureLoaded();
2221
- if (pinnedAgent && !isMobile) {
2222
- setHoveredAgent(pinnedAgent);
2223
- setRightPanel("detail");
2224
- }
2225
- setTimeout(() => inputRef.current?.focus(), 50);
2226
- } else {
2227
- setRightPanel(null);
2228
- setCatSearch("");
2229
- setTagSearch("");
2230
- setMobileDetailAgent(null);
2231
- setMobileSubView(null);
2232
- }
2233
- };
2211
+ } = core;
2212
+ useEffect4(() => {
2213
+ ensureLoaded();
2214
+ if (!autoFocusSearch) return void 0;
2215
+ const timer = setTimeout(() => inputRef.current?.focus(), 50);
2216
+ return () => clearTimeout(timer);
2217
+ }, [ensureLoaded, autoFocusSearch]);
2218
+ const pinnedPreviewedRef = useRef4(false);
2219
+ useEffect4(() => {
2220
+ if (pinnedPreviewedRef.current || isMobile || !pinnedAgent) return;
2221
+ pinnedPreviewedRef.current = true;
2222
+ if (rightPanel !== null) return;
2223
+ setHoveredAgent(pinnedAgent);
2224
+ setRightPanel("detail");
2225
+ }, [pinnedAgent, isMobile, rightPanel, setHoveredAgent]);
2234
2226
  const handleSelectAgent = (agent) => {
2235
2227
  coreSelectAgent(agent);
2236
- setOpen(false);
2228
+ setMobileDetailAgent(null);
2229
+ setMobileSubView(null);
2230
+ onAfterSelect?.(agent);
2237
2231
  };
2238
2232
  const handleFilterChipClick = (panel) => {
2239
2233
  if (isMobile) {
@@ -2262,39 +2256,7 @@ function AgentListDropdown({
2262
2256
  const handleDetailPanelMouseLeave = useCallback5(() => {
2263
2257
  coreDetailMouseLeave(() => setRightPanel(null));
2264
2258
  }, [coreDetailMouseLeave]);
2265
- const resolveAgentHref = useMemo4(() => {
2266
- if (resolveAgentHrefProp) return resolveAgentHrefProp;
2267
- if (!navigateTo) return void 0;
2268
- return (agent) => navigateTo.replace("{id}", agent.id);
2269
- }, [navigateTo, resolveAgentHrefProp]);
2270
- const hasRightPanel = rightPanel !== null;
2271
- const triggerButton = triggerSlot ?? /* @__PURE__ */ jsxs12(
2272
- "button",
2273
- {
2274
- type: "button",
2275
- className: cn6(
2276
- "inline-flex items-center rounded-md text-xs font-medium transition-colors",
2277
- "bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
2278
- compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
2279
- !noBorder && "border border-border",
2280
- className
2281
- ),
2282
- children: [
2283
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
2284
- activeFilterCount > 0 && /* @__PURE__ */ jsx15("span", { className: "flex items-center justify-center w-4 h-4 rounded-md bg-primary text-primary-foreground text-[10px]", children: activeFilterCount }),
2285
- /* @__PURE__ */ jsx15(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
2286
- ]
2287
- }
2288
- );
2289
- const wrapTrigger = (Trigger) => {
2290
- if (!showAssignedTooltip) {
2291
- return /* @__PURE__ */ jsx15(Trigger, { asChild: true, children: triggerButton });
2292
- }
2293
- return /* @__PURE__ */ jsxs12(Tooltip, { ...open ? { open: false } : {}, children: [
2294
- /* @__PURE__ */ jsx15(Trigger, { asChild: true, children: /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: triggerButton }) }),
2295
- /* @__PURE__ */ jsx15(TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
2296
- ] });
2297
- };
2259
+ const effectiveSystemTabLabel = systemTabLabel ?? (includeSystemInAll ? "System" : void 0);
2298
2260
  const listPanel = /* @__PURE__ */ jsx15(
2299
2261
  AgentListContent,
2300
2262
  {
@@ -2319,139 +2281,288 @@ function AgentListDropdown({
2319
2281
  tabCounts,
2320
2282
  archivedHiddenCount,
2321
2283
  ...visibleTabs ? { visibleTabs } : {},
2322
- ...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
2323
- systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
2324
- } : {},
2284
+ ...effectiveSystemTabLabel ? { systemTabLabel: effectiveSystemTabLabel } : {},
2325
2285
  pinnedAgent: showPinnedAgent ? pinnedAgent : null,
2326
2286
  defaultRow,
2327
- listOpen: open
2287
+ listOpen: true
2328
2288
  }
2329
2289
  );
2330
2290
  if (isMobile) {
2331
- return /* @__PURE__ */ jsxs12(Drawer, { open, onOpenChange: handleOpen, children: [
2332
- wrapTrigger(DrawerTrigger),
2333
- /* @__PURE__ */ jsxs12(DrawerContent, { className: "h-[85dvh]", children: [
2334
- /* @__PURE__ */ jsx15(DrawerTitle, { className: "sr-only", children: "Select Agent" }),
2335
- /* @__PURE__ */ jsx15("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: mobileDetailAgent ? /* @__PURE__ */ jsxs12("div", { className: "flex flex-col overflow-hidden", children: [
2336
- /* @__PURE__ */ jsxs12(
2337
- "button",
2291
+ return /* @__PURE__ */ jsx15("div", { className: cn6("flex min-h-0 flex-1 flex-col overflow-hidden", className), children: mobileDetailAgent ? /* @__PURE__ */ jsxs12("div", { className: "flex flex-col overflow-hidden", children: [
2292
+ /* @__PURE__ */ jsxs12(
2293
+ "button",
2294
+ {
2295
+ type: "button",
2296
+ onClick: () => setMobileDetailAgent(null),
2297
+ className: "flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium text-primary hover:bg-muted/30 transition-colors border-b border-border shrink-0",
2298
+ children: [
2299
+ /* @__PURE__ */ jsx15(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
2300
+ "Back"
2301
+ ]
2302
+ }
2303
+ ),
2304
+ /* @__PURE__ */ jsx15("div", { className: "overflow-y-auto", children: /* @__PURE__ */ jsx15(
2305
+ AgentDetailCard,
2306
+ {
2307
+ agent: mobileDetailAgent,
2308
+ onSelect: () => handleSelectAgent(mobileDetailAgent)
2309
+ }
2310
+ ) })
2311
+ ] }) : mobileSubView ? /* @__PURE__ */ jsx15(
2312
+ AgentMobileSubView,
2313
+ {
2314
+ view: mobileSubView,
2315
+ consumer,
2316
+ allCategories,
2317
+ allTags,
2318
+ catSearch,
2319
+ setCatSearch,
2320
+ tagSearch,
2321
+ setTagSearch,
2322
+ onBack: () => {
2323
+ setMobileSubView(null);
2324
+ setCatSearch("");
2325
+ setTagSearch("");
2326
+ }
2327
+ }
2328
+ ) : listPanel });
2329
+ }
2330
+ return /* @__PURE__ */ jsxs12("div", { className: cn6("flex h-full", className), children: [
2331
+ /* @__PURE__ */ jsx15("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
2332
+ /* @__PURE__ */ jsxs12(
2333
+ "div",
2334
+ {
2335
+ className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
2336
+ onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
2337
+ onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
2338
+ children: [
2339
+ rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ jsx15("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ jsx15(
2340
+ AgentDetailCard,
2338
2341
  {
2339
- type: "button",
2340
- onClick: () => setMobileDetailAgent(null),
2341
- className: "flex items-center gap-1.5 px-3 py-2.5 text-sm font-medium text-primary hover:bg-muted/30 transition-colors border-b border-border shrink-0",
2342
- children: [
2343
- /* @__PURE__ */ jsx15(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
2344
- "Back"
2345
- ]
2342
+ agent: hoveredAgent,
2343
+ onSelect: () => handleSelectAgent(hoveredAgent)
2344
+ }
2345
+ ) }, hoveredAgent.id),
2346
+ rightPanel === "sort" && /* @__PURE__ */ jsx15(
2347
+ AgentSortPanel,
2348
+ {
2349
+ consumer,
2350
+ onClose: () => setRightPanel(null)
2346
2351
  }
2347
2352
  ),
2348
- /* @__PURE__ */ jsx15("div", { className: "overflow-y-auto", children: /* @__PURE__ */ jsx15(
2349
- AgentDetailCard,
2353
+ rightPanel === "categories" && /* @__PURE__ */ jsx15(
2354
+ AgentCategoriesPanel,
2350
2355
  {
2351
- agent: mobileDetailAgent,
2352
- onSelect: () => handleSelectAgent(mobileDetailAgent)
2356
+ consumer,
2357
+ allCategories,
2358
+ search: catSearch,
2359
+ setSearch: setCatSearch,
2360
+ onClose: () => {
2361
+ setRightPanel(null);
2362
+ setCatSearch("");
2363
+ }
2353
2364
  }
2354
- ) })
2355
- ] }) : mobileSubView ? /* @__PURE__ */ jsx15(
2356
- AgentMobileSubView,
2357
- {
2358
- view: mobileSubView,
2359
- consumer,
2360
- allCategories,
2361
- allTags,
2362
- catSearch,
2363
- setCatSearch,
2364
- tagSearch,
2365
- setTagSearch,
2366
- onBack: () => {
2367
- setMobileSubView(null);
2368
- setCatSearch("");
2369
- setTagSearch("");
2365
+ ),
2366
+ rightPanel === "tags" && /* @__PURE__ */ jsx15(
2367
+ AgentTagsPanel,
2368
+ {
2369
+ consumer,
2370
+ allTags,
2371
+ search: tagSearch,
2372
+ setSearch: setTagSearch,
2373
+ onClose: () => {
2374
+ setRightPanel(null);
2375
+ setTagSearch("");
2376
+ }
2370
2377
  }
2371
- }
2372
- ) : listPanel })
2378
+ ),
2379
+ rightPanel === null && /* @__PURE__ */ jsxs12("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
2380
+ /* @__PURE__ */ jsx15(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
2381
+ /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
2382
+ ] })
2383
+ ]
2384
+ }
2385
+ )
2386
+ ] });
2387
+ }
2388
+ function AgentListPanel({
2389
+ consumerId,
2390
+ onSelect,
2391
+ navigateTo,
2392
+ activeAgentId,
2393
+ initialTab,
2394
+ includeSystemInAll = false,
2395
+ visibleTabs,
2396
+ excludeAgentIds,
2397
+ defaultMandateKey,
2398
+ resolveAgentHref: resolveAgentHrefProp,
2399
+ className,
2400
+ ...display
2401
+ }) {
2402
+ const isMobile = useIsMobile();
2403
+ const core = useAgentListCore({
2404
+ consumerId,
2405
+ ...onSelect ? { onSelect } : {},
2406
+ ...navigateTo ? { navigateTo } : {},
2407
+ ...activeAgentId !== void 0 ? { activeAgentIdOverride: activeAgentId } : {},
2408
+ ...initialTab ? { initialTab } : {},
2409
+ includeSystemInAll,
2410
+ ...visibleTabs ? { visibleTabs } : {},
2411
+ ...excludeAgentIds ? { excludeAgentIds } : {},
2412
+ ...defaultMandateKey ? { defaultMandateKey } : {}
2413
+ });
2414
+ const resolveAgentHref = useMemo4(() => {
2415
+ if (resolveAgentHrefProp) return resolveAgentHrefProp;
2416
+ if (!navigateTo) return void 0;
2417
+ return (agent) => navigateTo.replace("{id}", agent.id);
2418
+ }, [navigateTo, resolveAgentHrefProp]);
2419
+ return /* @__PURE__ */ jsx15(
2420
+ "div",
2421
+ {
2422
+ className: cn6("flex min-h-0 flex-col overflow-hidden", isMobile && "h-full w-full", className),
2423
+ style: isMobile ? void 0 : { width: PANEL_WIDTH, height: PANEL_HEIGHT },
2424
+ children: /* @__PURE__ */ jsx15(
2425
+ AgentListPanelBody,
2426
+ {
2427
+ core,
2428
+ includeSystemInAll,
2429
+ ...visibleTabs ? { visibleTabs } : {},
2430
+ ...resolveAgentHref ? { resolveAgentHref } : {},
2431
+ ...display
2432
+ }
2433
+ )
2434
+ }
2435
+ );
2436
+ }
2437
+
2438
+ // catalog/react/AgentListDropdown.tsx
2439
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
2440
+ var CONSUMER_ID = "agent-list-dropdown";
2441
+ function AgentListDropdown({
2442
+ onSelect,
2443
+ navigateTo,
2444
+ className,
2445
+ label,
2446
+ triggerSlot,
2447
+ noBorder = false,
2448
+ compact = false,
2449
+ activeAgentId: activeAgentIdProp,
2450
+ contentSide,
2451
+ consumerId = CONSUMER_ID,
2452
+ initialTab,
2453
+ includeSystemInAll = false,
2454
+ visibleTabs,
2455
+ systemTabLabel,
2456
+ resolveAgentHref: resolveAgentHrefProp,
2457
+ showPinnedAgent = true,
2458
+ excludeAgentIds,
2459
+ defaultMandateKey
2460
+ }) {
2461
+ const isMobile = useIsMobile2();
2462
+ const { labels } = useAgentCatalog();
2463
+ const { popoverContainer } = useAgentCatalogUiPorts();
2464
+ const [open, setOpen] = useState4(false);
2465
+ const triggerRef = useRef5(null);
2466
+ const [fitHeight, setFitHeight] = useState4(null);
2467
+ const core = useAgentListCore({
2468
+ consumerId,
2469
+ ...onSelect ? { onSelect } : {},
2470
+ ...navigateTo ? { navigateTo } : {},
2471
+ ...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
2472
+ ...initialTab ? { initialTab } : {},
2473
+ includeSystemInAll,
2474
+ // The restriction has to reach the CORE, not just the tab strip — see
2475
+ // `AgentListCoreOptions.visibleTabs`.
2476
+ ...visibleTabs ? { visibleTabs } : {},
2477
+ ...excludeAgentIds ? { excludeAgentIds } : {},
2478
+ ...defaultMandateKey ? { defaultMandateKey } : {}
2479
+ });
2480
+ const { pinnedAgent, defaultRow, activeAgentId, isLoading, activeFilterCount } = core;
2481
+ const activeDefaultRow = defaultRow?.row?.id === activeAgentId ? defaultRow.row : null;
2482
+ const displayLabel = label ?? pinnedAgent?.name ?? activeDefaultRow?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
2483
+ const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
2484
+ const handleOpen = (nextOpen) => {
2485
+ setOpen(nextOpen);
2486
+ if (nextOpen) {
2487
+ setFitHeight(contentSide || isMobile ? null : panelHeightBelow(triggerRef.current));
2488
+ }
2489
+ };
2490
+ const resolveAgentHref = useMemo5(() => {
2491
+ if (resolveAgentHrefProp) return resolveAgentHrefProp;
2492
+ if (!navigateTo) return void 0;
2493
+ return (agent) => navigateTo.replace("{id}", agent.id);
2494
+ }, [navigateTo, resolveAgentHrefProp]);
2495
+ const triggerButton = triggerSlot ?? /* @__PURE__ */ jsxs13(
2496
+ "button",
2497
+ {
2498
+ type: "button",
2499
+ className: cn7(
2500
+ "inline-flex items-center rounded-md text-xs font-medium transition-colors",
2501
+ "bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
2502
+ compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
2503
+ !noBorder && "border border-border",
2504
+ className
2505
+ ),
2506
+ children: [
2507
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
2508
+ activeFilterCount > 0 && /* @__PURE__ */ jsx16("span", { className: "flex items-center justify-center w-4 h-4 rounded-md bg-primary text-primary-foreground text-[10px]", children: activeFilterCount }),
2509
+ /* @__PURE__ */ jsx16(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
2510
+ ]
2511
+ }
2512
+ );
2513
+ const wrapTrigger = (Trigger) => {
2514
+ if (!showAssignedTooltip) {
2515
+ return /* @__PURE__ */ jsx16(Trigger, { asChild: true, ref: triggerRef, children: triggerButton });
2516
+ }
2517
+ return /* @__PURE__ */ jsxs13(Tooltip, { ...open ? { open: false } : {}, children: [
2518
+ /* @__PURE__ */ jsx16(Trigger, { asChild: true, ref: triggerRef, children: /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: triggerButton }) }),
2519
+ /* @__PURE__ */ jsx16(TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
2520
+ ] });
2521
+ };
2522
+ const body = /* @__PURE__ */ jsx16(
2523
+ AgentListPanelBody,
2524
+ {
2525
+ core,
2526
+ includeSystemInAll,
2527
+ showPinnedAgent,
2528
+ onAfterSelect: () => setOpen(false),
2529
+ ...visibleTabs ? { visibleTabs } : {},
2530
+ ...systemTabLabel ? { systemTabLabel } : {},
2531
+ ...resolveAgentHref ? { resolveAgentHref } : {}
2532
+ }
2533
+ );
2534
+ if (isMobile) {
2535
+ return /* @__PURE__ */ jsxs13(Drawer, { open, onOpenChange: handleOpen, children: [
2536
+ wrapTrigger(DrawerTrigger),
2537
+ /* @__PURE__ */ jsxs13(DrawerContent, { className: "h-[85dvh]", children: [
2538
+ /* @__PURE__ */ jsx16(DrawerTitle, { className: "sr-only", children: "Select Agent" }),
2539
+ /* @__PURE__ */ jsx16("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: body })
2373
2540
  ] })
2374
2541
  ] });
2375
2542
  }
2376
- return /* @__PURE__ */ jsxs12(Popover, { open, onOpenChange: handleOpen, modal: false, children: [
2543
+ return /* @__PURE__ */ jsxs13(Popover, { open, onOpenChange: handleOpen, modal: false, children: [
2377
2544
  wrapTrigger(PopoverTrigger),
2378
- /* @__PURE__ */ jsx15(
2545
+ /* @__PURE__ */ jsx16(
2379
2546
  PopoverContent,
2380
2547
  {
2381
- ...contentSide ? { side: contentSide } : {},
2548
+ ...contentSide ? { side: contentSide } : fitHeight ? { side: "bottom" } : {},
2382
2549
  align: "start",
2383
2550
  sideOffset: 4,
2384
2551
  collisionPadding: 12,
2385
2552
  sticky: "always",
2386
2553
  ...popoverContainer ? { container: popoverContainer } : {},
2387
- className: "p-0 overflow-hidden w-[680px]",
2388
- style: { height: PANEL_HEIGHT, maxHeight: LIST_MAX_HEIGHT },
2389
- children: /* @__PURE__ */ jsxs12("div", { className: "flex h-full", children: [
2390
- /* @__PURE__ */ jsx15("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
2391
- /* @__PURE__ */ jsxs12(
2392
- "div",
2393
- {
2394
- className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
2395
- onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
2396
- onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
2397
- children: [
2398
- rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ jsx15("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ jsx15(
2399
- AgentDetailCard,
2400
- {
2401
- agent: hoveredAgent,
2402
- onSelect: () => handleSelectAgent(hoveredAgent)
2403
- }
2404
- ) }, hoveredAgent.id),
2405
- rightPanel === "sort" && /* @__PURE__ */ jsx15(
2406
- AgentSortPanel,
2407
- {
2408
- consumer,
2409
- onClose: () => setRightPanel(null)
2410
- }
2411
- ),
2412
- rightPanel === "categories" && /* @__PURE__ */ jsx15(
2413
- AgentCategoriesPanel,
2414
- {
2415
- consumer,
2416
- allCategories,
2417
- search: catSearch,
2418
- setSearch: setCatSearch,
2419
- onClose: () => {
2420
- setRightPanel(null);
2421
- setCatSearch("");
2422
- }
2423
- }
2424
- ),
2425
- rightPanel === "tags" && /* @__PURE__ */ jsx15(
2426
- AgentTagsPanel,
2427
- {
2428
- consumer,
2429
- allTags,
2430
- search: tagSearch,
2431
- setSearch: setTagSearch,
2432
- onClose: () => {
2433
- setRightPanel(null);
2434
- setTagSearch("");
2435
- }
2436
- }
2437
- ),
2438
- !hasRightPanel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
2439
- /* @__PURE__ */ jsx15(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
2440
- /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
2441
- ] })
2442
- ]
2443
- }
2444
- )
2445
- ] })
2554
+ className: "p-0 overflow-hidden",
2555
+ style: { width: PANEL_WIDTH, height: fitHeight ?? PANEL_HEIGHT, maxHeight: fitHeight ?? LIST_MAX_HEIGHT },
2556
+ children: body
2446
2557
  }
2447
2558
  )
2448
2559
  ] });
2449
2560
  }
2450
2561
 
2451
2562
  // catalog/react/AgentListInlinePicker.tsx
2452
- import { cn as cn7 } from "@ai-matrx/design-system";
2453
- import { useEffect as useEffect4, useRef as useRef5, useState as useState4 } from "react";
2454
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
2563
+ import { cn as cn8 } from "@ai-matrx/design-system";
2564
+ import { useEffect as useEffect5, useRef as useRef6, useState as useState5 } from "react";
2565
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
2455
2566
  function AgentListInlinePicker({
2456
2567
  consumerId,
2457
2568
  onSelect,
@@ -2467,11 +2578,11 @@ function AgentListInlinePicker({
2467
2578
  excludeAgentIds,
2468
2579
  defaultMandateKey
2469
2580
  }) {
2470
- const inputRef = useRef5(null);
2471
- const [catSearch, setCatSearch] = useState4("");
2472
- const [tagSearch, setTagSearch] = useState4("");
2473
- const [mobileDetailAgent, setMobileDetailAgent] = useState4(null);
2474
- const [mobileSubView, setMobileSubView] = useState4(null);
2581
+ const inputRef = useRef6(null);
2582
+ const [catSearch, setCatSearch] = useState5("");
2583
+ const [tagSearch, setTagSearch] = useState5("");
2584
+ const [mobileDetailAgent, setMobileDetailAgent] = useState5(null);
2585
+ const [mobileSubView, setMobileSubView] = useState5(null);
2475
2586
  const {
2476
2587
  agents,
2477
2588
  archivedHiddenCount,
@@ -2500,7 +2611,7 @@ function AgentListInlinePicker({
2500
2611
  ...excludeAgentIds ? { excludeAgentIds } : {},
2501
2612
  ...defaultMandateKey ? { defaultMandateKey } : {}
2502
2613
  });
2503
- useEffect4(() => {
2614
+ useEffect5(() => {
2504
2615
  ensureLoaded();
2505
2616
  if (!autoFocusSearch) return void 0;
2506
2617
  const timer = setTimeout(() => inputRef.current?.focus(), 50);
@@ -2516,20 +2627,20 @@ function AgentListInlinePicker({
2516
2627
  };
2517
2628
  const isMobile = true;
2518
2629
  if (mobileDetailAgent) {
2519
- return /* @__PURE__ */ jsxs13("div", { className: cn7("flex h-full min-h-0 flex-col", className), children: [
2520
- /* @__PURE__ */ jsxs13(
2630
+ return /* @__PURE__ */ jsxs14("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: [
2631
+ /* @__PURE__ */ jsxs14(
2521
2632
  "button",
2522
2633
  {
2523
2634
  type: "button",
2524
2635
  onClick: () => setMobileDetailAgent(null),
2525
2636
  className: "flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-muted/30",
2526
2637
  children: [
2527
- /* @__PURE__ */ jsx16(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
2638
+ /* @__PURE__ */ jsx17(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
2528
2639
  "Back"
2529
2640
  ]
2530
2641
  }
2531
2642
  ),
2532
- /* @__PURE__ */ jsx16("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx16(
2643
+ /* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx17(
2533
2644
  AgentDetailCard,
2534
2645
  {
2535
2646
  agent: mobileDetailAgent,
@@ -2539,7 +2650,7 @@ function AgentListInlinePicker({
2539
2650
  ] });
2540
2651
  }
2541
2652
  if (mobileSubView) {
2542
- return /* @__PURE__ */ jsx16("div", { className: cn7("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx16(
2653
+ return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
2543
2654
  AgentMobileSubView,
2544
2655
  {
2545
2656
  view: mobileSubView,
@@ -2558,7 +2669,7 @@ function AgentListInlinePicker({
2558
2669
  }
2559
2670
  ) });
2560
2671
  }
2561
- return /* @__PURE__ */ jsx16("div", { className: cn7("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx16(
2672
+ return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
2562
2673
  AgentListContent,
2563
2674
  {
2564
2675
  agents,
@@ -2600,6 +2711,8 @@ export {
2600
2711
  AgentListContent,
2601
2712
  AgentListDropdown,
2602
2713
  AgentListInlinePicker,
2714
+ AgentListPanel,
2715
+ AgentListPanelBody,
2603
2716
  AgentListTabs,
2604
2717
  AgentMobileSubView,
2605
2718
  AgentRow,
@@ -2613,6 +2726,7 @@ export {
2613
2726
  Music4Icon,
2614
2727
  OptionRow,
2615
2728
  PANEL_HEIGHT,
2729
+ PANEL_WIDTH,
2616
2730
  SORT_OPTIONS,
2617
2731
  SearchInput,
2618
2732
  SidePanelHeader,
@@ -2621,6 +2735,7 @@ export {
2621
2735
  orchestraDepthLine,
2622
2736
  orchestraLabel,
2623
2737
  orchestraModeLabel,
2738
+ panelHeightBelow,
2624
2739
  useAgentCatalog,
2625
2740
  useAgentCatalogRows,
2626
2741
  useAgentCatalogState,