@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
@@ -29,6 +29,8 @@ __export(react_exports, {
29
29
  AgentListContent: () => AgentListContent,
30
30
  AgentListDropdown: () => AgentListDropdown,
31
31
  AgentListInlinePicker: () => AgentListInlinePicker,
32
+ AgentListPanel: () => AgentListPanel,
33
+ AgentListPanelBody: () => AgentListPanelBody,
32
34
  AgentListTabs: () => AgentListTabs,
33
35
  AgentMobileSubView: () => AgentMobileSubView,
34
36
  AgentRow: () => AgentRow,
@@ -42,6 +44,7 @@ __export(react_exports, {
42
44
  Music4Icon: () => Music4Icon,
43
45
  OptionRow: () => OptionRow,
44
46
  PANEL_HEIGHT: () => PANEL_HEIGHT,
47
+ PANEL_WIDTH: () => PANEL_WIDTH,
45
48
  SORT_OPTIONS: () => SORT_OPTIONS,
46
49
  SearchInput: () => SearchInput,
47
50
  SidePanelHeader: () => SidePanelHeader,
@@ -50,6 +53,7 @@ __export(react_exports, {
50
53
  orchestraDepthLine: () => orchestraDepthLine,
51
54
  orchestraLabel: () => orchestraLabel,
52
55
  orchestraModeLabel: () => orchestraModeLabel,
56
+ panelHeightBelow: () => panelHeightBelow,
53
57
  useAgentCatalog: () => useAgentCatalog,
54
58
  useAgentCatalogRows: () => useAgentCatalogRows,
55
59
  useAgentCatalogState: () => useAgentCatalogState,
@@ -950,6 +954,10 @@ function useAgentListCore({
950
954
  var selectStatus = (state) => state.status;
951
955
 
952
956
  // catalog/react/AgentListDropdown.tsx
957
+ var import_design_system8 = require("@ai-matrx/design-system");
958
+ var import_react8 = require("react");
959
+
960
+ // catalog/react/AgentListPanel.tsx
953
961
  var import_design_system7 = require("@ai-matrx/design-system");
954
962
  var import_react7 = require("react");
955
963
 
@@ -1582,6 +1590,15 @@ var import_react6 = require("react");
1582
1590
  // catalog/react/types.ts
1583
1591
  var PANEL_HEIGHT = "528px";
1584
1592
  var LIST_MAX_HEIGHT = "min(528px, var(--radix-popper-available-height, 528px))";
1593
+ function panelHeightBelow(trigger, options = {}) {
1594
+ if (!trigger || typeof window === "undefined") return null;
1595
+ const full = options.full ?? 528;
1596
+ const minUsable = options.minUsable ?? 300;
1597
+ const gap = options.gap ?? 16;
1598
+ const below = window.innerHeight - trigger.getBoundingClientRect().bottom - gap;
1599
+ if (below >= full) return null;
1600
+ return below >= minUsable ? `${Math.floor(below)}px` : null;
1601
+ }
1585
1602
 
1586
1603
  // catalog/react/AgentFilterBar.tsx
1587
1604
  var import_jsx_runtime8 = require("react/jsx-runtime");
@@ -1780,7 +1797,15 @@ function AgentRow({
1780
1797
  ]
1781
1798
  }
1782
1799
  ),
1783
- agent.agentType === "builtin" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[9px] text-muted-foreground bg-muted px-1 py-px rounded shrink-0 ml-auto", children: "shared" }) : null
1800
+ agent.isArchived ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1801
+ "span",
1802
+ {
1803
+ "data-testid": `agent-archived-badge-${agent.id}`,
1804
+ className: "text-[9px] font-medium text-muted-foreground bg-muted px-1 py-px rounded shrink-0 ml-auto",
1805
+ children: labels.archivedBadge
1806
+ }
1807
+ ) : null,
1808
+ agent.agentType === "builtin" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: (0, import_design_system5.cn)("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__ */ (0, import_jsx_runtime10.jsx)("span", { className: (0, import_design_system5.cn)("text-[9px] text-muted-foreground bg-muted px-1 py-px rounded shrink-0", !agent.isArchived && "ml-auto"), children: "shared" }) : null
1784
1809
  ]
1785
1810
  }
1786
1811
  ),
@@ -2178,33 +2203,22 @@ function AgentTagsPanel({
2178
2203
  ] });
2179
2204
  }
2180
2205
 
2181
- // catalog/react/AgentListDropdown.tsx
2206
+ // catalog/react/AgentListPanel.tsx
2182
2207
  var import_jsx_runtime15 = require("react/jsx-runtime");
2183
- var CONSUMER_ID = "agent-list-dropdown";
2184
- function AgentListDropdown({
2185
- onSelect,
2186
- navigateTo,
2187
- className,
2188
- label,
2189
- triggerSlot,
2190
- noBorder = false,
2191
- compact = false,
2192
- activeAgentId: activeAgentIdProp,
2193
- contentSide,
2194
- consumerId = CONSUMER_ID,
2195
- initialTab,
2196
- includeSystemInAll = false,
2208
+ var PANEL_WIDTH = "680px";
2209
+ function AgentListPanelBody({
2210
+ core,
2197
2211
  visibleTabs,
2198
2212
  systemTabLabel,
2199
- resolveAgentHref: resolveAgentHrefProp,
2213
+ includeSystemInAll = false,
2214
+ resolveAgentHref,
2200
2215
  showPinnedAgent = true,
2201
- excludeAgentIds,
2202
- defaultMandateKey
2216
+ autoFocusSearch = true,
2217
+ onAfterSelect,
2218
+ className
2203
2219
  }) {
2204
2220
  const isMobile = (0, import_design_system7.useIsMobile)();
2205
2221
  const { labels } = useAgentCatalog();
2206
- const { popoverContainer } = useAgentCatalogUiPorts();
2207
- const [open, setOpen] = (0, import_react7.useState)(false);
2208
2222
  const [rightPanel, setRightPanel] = (0, import_react7.useState)(null);
2209
2223
  const [catSearch, setCatSearch] = (0, import_react7.useState)("");
2210
2224
  const [tagSearch, setTagSearch] = (0, import_react7.useState)("");
@@ -2231,42 +2245,26 @@ function AgentListDropdown({
2231
2245
  handleAgentHoverEnd: coreAgentHoverEnd,
2232
2246
  handleDetailPanelMouseEnter,
2233
2247
  handleDetailPanelMouseLeave: coreDetailMouseLeave
2234
- } = useAgentListCore({
2235
- consumerId,
2236
- ...onSelect ? { onSelect } : {},
2237
- ...navigateTo ? { navigateTo } : {},
2238
- ...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
2239
- ...initialTab ? { initialTab } : {},
2240
- includeSystemInAll,
2241
- // The restriction has to reach the CORE, not just the tab strip — see
2242
- // `AgentListCoreOptions.visibleTabs`.
2243
- ...visibleTabs ? { visibleTabs } : {},
2244
- ...excludeAgentIds ? { excludeAgentIds } : {},
2245
- ...defaultMandateKey ? { defaultMandateKey } : {}
2246
- });
2247
- const activeDefaultRow = defaultRow?.row?.id === activeAgentId ? defaultRow.row : null;
2248
- const displayLabel = label ?? pinnedAgent?.name ?? activeDefaultRow?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
2249
- const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
2250
- const handleOpen = (nextOpen) => {
2251
- setOpen(nextOpen);
2252
- if (nextOpen) {
2253
- ensureLoaded();
2254
- if (pinnedAgent && !isMobile) {
2255
- setHoveredAgent(pinnedAgent);
2256
- setRightPanel("detail");
2257
- }
2258
- setTimeout(() => inputRef.current?.focus(), 50);
2259
- } else {
2260
- setRightPanel(null);
2261
- setCatSearch("");
2262
- setTagSearch("");
2263
- setMobileDetailAgent(null);
2264
- setMobileSubView(null);
2265
- }
2266
- };
2248
+ } = core;
2249
+ (0, import_react7.useEffect)(() => {
2250
+ ensureLoaded();
2251
+ if (!autoFocusSearch) return void 0;
2252
+ const timer = setTimeout(() => inputRef.current?.focus(), 50);
2253
+ return () => clearTimeout(timer);
2254
+ }, [ensureLoaded, autoFocusSearch]);
2255
+ const pinnedPreviewedRef = (0, import_react7.useRef)(false);
2256
+ (0, import_react7.useEffect)(() => {
2257
+ if (pinnedPreviewedRef.current || isMobile || !pinnedAgent) return;
2258
+ pinnedPreviewedRef.current = true;
2259
+ if (rightPanel !== null) return;
2260
+ setHoveredAgent(pinnedAgent);
2261
+ setRightPanel("detail");
2262
+ }, [pinnedAgent, isMobile, rightPanel, setHoveredAgent]);
2267
2263
  const handleSelectAgent = (agent) => {
2268
2264
  coreSelectAgent(agent);
2269
- setOpen(false);
2265
+ setMobileDetailAgent(null);
2266
+ setMobileSubView(null);
2267
+ onAfterSelect?.(agent);
2270
2268
  };
2271
2269
  const handleFilterChipClick = (panel) => {
2272
2270
  if (isMobile) {
@@ -2295,39 +2293,7 @@ function AgentListDropdown({
2295
2293
  const handleDetailPanelMouseLeave = (0, import_react7.useCallback)(() => {
2296
2294
  coreDetailMouseLeave(() => setRightPanel(null));
2297
2295
  }, [coreDetailMouseLeave]);
2298
- const resolveAgentHref = (0, import_react7.useMemo)(() => {
2299
- if (resolveAgentHrefProp) return resolveAgentHrefProp;
2300
- if (!navigateTo) return void 0;
2301
- return (agent) => navigateTo.replace("{id}", agent.id);
2302
- }, [navigateTo, resolveAgentHrefProp]);
2303
- const hasRightPanel = rightPanel !== null;
2304
- const triggerButton = triggerSlot ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2305
- "button",
2306
- {
2307
- type: "button",
2308
- className: (0, import_design_system7.cn)(
2309
- "inline-flex items-center rounded-md text-xs font-medium transition-colors",
2310
- "bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
2311
- compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
2312
- !noBorder && "border border-border",
2313
- className
2314
- ),
2315
- children: [
2316
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
2317
- activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex items-center justify-center w-4 h-4 rounded-md bg-primary text-primary-foreground text-[10px]", children: activeFilterCount }),
2318
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
2319
- ]
2320
- }
2321
- );
2322
- const wrapTrigger = (Trigger) => {
2323
- if (!showAssignedTooltip) {
2324
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trigger, { asChild: true, children: triggerButton });
2325
- }
2326
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system7.Tooltip, { ...open ? { open: false } : {}, children: [
2327
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system7.TooltipTrigger, { asChild: true, children: triggerButton }) }),
2328
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system7.TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
2329
- ] });
2330
- };
2296
+ const effectiveSystemTabLabel = systemTabLabel ?? (includeSystemInAll ? "System" : void 0);
2331
2297
  const listPanel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2332
2298
  AgentListContent,
2333
2299
  {
@@ -2352,139 +2318,288 @@ function AgentListDropdown({
2352
2318
  tabCounts,
2353
2319
  archivedHiddenCount,
2354
2320
  ...visibleTabs ? { visibleTabs } : {},
2355
- ...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
2356
- systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
2357
- } : {},
2321
+ ...effectiveSystemTabLabel ? { systemTabLabel: effectiveSystemTabLabel } : {},
2358
2322
  pinnedAgent: showPinnedAgent ? pinnedAgent : null,
2359
2323
  defaultRow,
2360
- listOpen: open
2324
+ listOpen: true
2361
2325
  }
2362
2326
  );
2363
2327
  if (isMobile) {
2364
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system7.Drawer, { open, onOpenChange: handleOpen, children: [
2365
- wrapTrigger(import_design_system7.DrawerTrigger),
2366
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system7.DrawerContent, { className: "h-[85dvh]", children: [
2367
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_design_system7.DrawerTitle, { className: "sr-only", children: "Select Agent" }),
2368
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: mobileDetailAgent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col overflow-hidden", children: [
2369
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2370
- "button",
2328
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_design_system7.cn)("flex min-h-0 flex-1 flex-col overflow-hidden", className), children: mobileDetailAgent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col overflow-hidden", children: [
2329
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2330
+ "button",
2331
+ {
2332
+ type: "button",
2333
+ onClick: () => setMobileDetailAgent(null),
2334
+ 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",
2335
+ children: [
2336
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
2337
+ "Back"
2338
+ ]
2339
+ }
2340
+ ),
2341
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2342
+ AgentDetailCard,
2343
+ {
2344
+ agent: mobileDetailAgent,
2345
+ onSelect: () => handleSelectAgent(mobileDetailAgent)
2346
+ }
2347
+ ) })
2348
+ ] }) : mobileSubView ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2349
+ AgentMobileSubView,
2350
+ {
2351
+ view: mobileSubView,
2352
+ consumer,
2353
+ allCategories,
2354
+ allTags,
2355
+ catSearch,
2356
+ setCatSearch,
2357
+ tagSearch,
2358
+ setTagSearch,
2359
+ onBack: () => {
2360
+ setMobileSubView(null);
2361
+ setCatSearch("");
2362
+ setTagSearch("");
2363
+ }
2364
+ }
2365
+ ) : listPanel });
2366
+ }
2367
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_design_system7.cn)("flex h-full", className), children: [
2368
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
2369
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2370
+ "div",
2371
+ {
2372
+ className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
2373
+ onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
2374
+ onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
2375
+ children: [
2376
+ rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2377
+ AgentDetailCard,
2371
2378
  {
2372
- type: "button",
2373
- onClick: () => setMobileDetailAgent(null),
2374
- 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",
2375
- children: [
2376
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
2377
- "Back"
2378
- ]
2379
+ agent: hoveredAgent,
2380
+ onSelect: () => handleSelectAgent(hoveredAgent)
2381
+ }
2382
+ ) }, hoveredAgent.id),
2383
+ rightPanel === "sort" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2384
+ AgentSortPanel,
2385
+ {
2386
+ consumer,
2387
+ onClose: () => setRightPanel(null)
2379
2388
  }
2380
2389
  ),
2381
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2382
- AgentDetailCard,
2390
+ rightPanel === "categories" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2391
+ AgentCategoriesPanel,
2383
2392
  {
2384
- agent: mobileDetailAgent,
2385
- onSelect: () => handleSelectAgent(mobileDetailAgent)
2393
+ consumer,
2394
+ allCategories,
2395
+ search: catSearch,
2396
+ setSearch: setCatSearch,
2397
+ onClose: () => {
2398
+ setRightPanel(null);
2399
+ setCatSearch("");
2400
+ }
2386
2401
  }
2387
- ) })
2388
- ] }) : mobileSubView ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2389
- AgentMobileSubView,
2390
- {
2391
- view: mobileSubView,
2392
- consumer,
2393
- allCategories,
2394
- allTags,
2395
- catSearch,
2396
- setCatSearch,
2397
- tagSearch,
2398
- setTagSearch,
2399
- onBack: () => {
2400
- setMobileSubView(null);
2401
- setCatSearch("");
2402
- setTagSearch("");
2402
+ ),
2403
+ rightPanel === "tags" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2404
+ AgentTagsPanel,
2405
+ {
2406
+ consumer,
2407
+ allTags,
2408
+ search: tagSearch,
2409
+ setSearch: setTagSearch,
2410
+ onClose: () => {
2411
+ setRightPanel(null);
2412
+ setTagSearch("");
2413
+ }
2403
2414
  }
2404
- }
2405
- ) : listPanel })
2415
+ ),
2416
+ rightPanel === null && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
2417
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
2418
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
2419
+ ] })
2420
+ ]
2421
+ }
2422
+ )
2423
+ ] });
2424
+ }
2425
+ function AgentListPanel({
2426
+ consumerId,
2427
+ onSelect,
2428
+ navigateTo,
2429
+ activeAgentId,
2430
+ initialTab,
2431
+ includeSystemInAll = false,
2432
+ visibleTabs,
2433
+ excludeAgentIds,
2434
+ defaultMandateKey,
2435
+ resolveAgentHref: resolveAgentHrefProp,
2436
+ className,
2437
+ ...display
2438
+ }) {
2439
+ const isMobile = (0, import_design_system7.useIsMobile)();
2440
+ const core = useAgentListCore({
2441
+ consumerId,
2442
+ ...onSelect ? { onSelect } : {},
2443
+ ...navigateTo ? { navigateTo } : {},
2444
+ ...activeAgentId !== void 0 ? { activeAgentIdOverride: activeAgentId } : {},
2445
+ ...initialTab ? { initialTab } : {},
2446
+ includeSystemInAll,
2447
+ ...visibleTabs ? { visibleTabs } : {},
2448
+ ...excludeAgentIds ? { excludeAgentIds } : {},
2449
+ ...defaultMandateKey ? { defaultMandateKey } : {}
2450
+ });
2451
+ const resolveAgentHref = (0, import_react7.useMemo)(() => {
2452
+ if (resolveAgentHrefProp) return resolveAgentHrefProp;
2453
+ if (!navigateTo) return void 0;
2454
+ return (agent) => navigateTo.replace("{id}", agent.id);
2455
+ }, [navigateTo, resolveAgentHrefProp]);
2456
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2457
+ "div",
2458
+ {
2459
+ className: (0, import_design_system7.cn)("flex min-h-0 flex-col overflow-hidden", isMobile && "h-full w-full", className),
2460
+ style: isMobile ? void 0 : { width: PANEL_WIDTH, height: PANEL_HEIGHT },
2461
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2462
+ AgentListPanelBody,
2463
+ {
2464
+ core,
2465
+ includeSystemInAll,
2466
+ ...visibleTabs ? { visibleTabs } : {},
2467
+ ...resolveAgentHref ? { resolveAgentHref } : {},
2468
+ ...display
2469
+ }
2470
+ )
2471
+ }
2472
+ );
2473
+ }
2474
+
2475
+ // catalog/react/AgentListDropdown.tsx
2476
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2477
+ var CONSUMER_ID = "agent-list-dropdown";
2478
+ function AgentListDropdown({
2479
+ onSelect,
2480
+ navigateTo,
2481
+ className,
2482
+ label,
2483
+ triggerSlot,
2484
+ noBorder = false,
2485
+ compact = false,
2486
+ activeAgentId: activeAgentIdProp,
2487
+ contentSide,
2488
+ consumerId = CONSUMER_ID,
2489
+ initialTab,
2490
+ includeSystemInAll = false,
2491
+ visibleTabs,
2492
+ systemTabLabel,
2493
+ resolveAgentHref: resolveAgentHrefProp,
2494
+ showPinnedAgent = true,
2495
+ excludeAgentIds,
2496
+ defaultMandateKey
2497
+ }) {
2498
+ const isMobile = (0, import_design_system8.useIsMobile)();
2499
+ const { labels } = useAgentCatalog();
2500
+ const { popoverContainer } = useAgentCatalogUiPorts();
2501
+ const [open, setOpen] = (0, import_react8.useState)(false);
2502
+ const triggerRef = (0, import_react8.useRef)(null);
2503
+ const [fitHeight, setFitHeight] = (0, import_react8.useState)(null);
2504
+ const core = useAgentListCore({
2505
+ consumerId,
2506
+ ...onSelect ? { onSelect } : {},
2507
+ ...navigateTo ? { navigateTo } : {},
2508
+ ...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
2509
+ ...initialTab ? { initialTab } : {},
2510
+ includeSystemInAll,
2511
+ // The restriction has to reach the CORE, not just the tab strip — see
2512
+ // `AgentListCoreOptions.visibleTabs`.
2513
+ ...visibleTabs ? { visibleTabs } : {},
2514
+ ...excludeAgentIds ? { excludeAgentIds } : {},
2515
+ ...defaultMandateKey ? { defaultMandateKey } : {}
2516
+ });
2517
+ const { pinnedAgent, defaultRow, activeAgentId, isLoading, activeFilterCount } = core;
2518
+ const activeDefaultRow = defaultRow?.row?.id === activeAgentId ? defaultRow.row : null;
2519
+ const displayLabel = label ?? pinnedAgent?.name ?? activeDefaultRow?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
2520
+ const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
2521
+ const handleOpen = (nextOpen) => {
2522
+ setOpen(nextOpen);
2523
+ if (nextOpen) {
2524
+ setFitHeight(contentSide || isMobile ? null : panelHeightBelow(triggerRef.current));
2525
+ }
2526
+ };
2527
+ const resolveAgentHref = (0, import_react8.useMemo)(() => {
2528
+ if (resolveAgentHrefProp) return resolveAgentHrefProp;
2529
+ if (!navigateTo) return void 0;
2530
+ return (agent) => navigateTo.replace("{id}", agent.id);
2531
+ }, [navigateTo, resolveAgentHrefProp]);
2532
+ const triggerButton = triggerSlot ?? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2533
+ "button",
2534
+ {
2535
+ type: "button",
2536
+ className: (0, import_design_system8.cn)(
2537
+ "inline-flex items-center rounded-md text-xs font-medium transition-colors",
2538
+ "bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
2539
+ compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
2540
+ !noBorder && "border border-border",
2541
+ className
2542
+ ),
2543
+ children: [
2544
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
2545
+ activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex items-center justify-center w-4 h-4 rounded-md bg-primary text-primary-foreground text-[10px]", children: activeFilterCount }),
2546
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
2547
+ ]
2548
+ }
2549
+ );
2550
+ const wrapTrigger = (Trigger) => {
2551
+ if (!showAssignedTooltip) {
2552
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trigger, { asChild: true, ref: triggerRef, children: triggerButton });
2553
+ }
2554
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system8.Tooltip, { ...open ? { open: false } : {}, children: [
2555
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trigger, { asChild: true, ref: triggerRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system8.TooltipTrigger, { asChild: true, children: triggerButton }) }),
2556
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system8.TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
2557
+ ] });
2558
+ };
2559
+ const body = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2560
+ AgentListPanelBody,
2561
+ {
2562
+ core,
2563
+ includeSystemInAll,
2564
+ showPinnedAgent,
2565
+ onAfterSelect: () => setOpen(false),
2566
+ ...visibleTabs ? { visibleTabs } : {},
2567
+ ...systemTabLabel ? { systemTabLabel } : {},
2568
+ ...resolveAgentHref ? { resolveAgentHref } : {}
2569
+ }
2570
+ );
2571
+ if (isMobile) {
2572
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system8.Drawer, { open, onOpenChange: handleOpen, children: [
2573
+ wrapTrigger(import_design_system8.DrawerTrigger),
2574
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system8.DrawerContent, { className: "h-[85dvh]", children: [
2575
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system8.DrawerTitle, { className: "sr-only", children: "Select Agent" }),
2576
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: body })
2406
2577
  ] })
2407
2578
  ] });
2408
2579
  }
2409
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_design_system7.Popover, { open, onOpenChange: handleOpen, modal: false, children: [
2410
- wrapTrigger(import_design_system7.PopoverTrigger),
2411
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2412
- import_design_system7.PopoverContent,
2580
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_design_system8.Popover, { open, onOpenChange: handleOpen, modal: false, children: [
2581
+ wrapTrigger(import_design_system8.PopoverTrigger),
2582
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2583
+ import_design_system8.PopoverContent,
2413
2584
  {
2414
- ...contentSide ? { side: contentSide } : {},
2585
+ ...contentSide ? { side: contentSide } : fitHeight ? { side: "bottom" } : {},
2415
2586
  align: "start",
2416
2587
  sideOffset: 4,
2417
2588
  collisionPadding: 12,
2418
2589
  sticky: "always",
2419
2590
  ...popoverContainer ? { container: popoverContainer } : {},
2420
- className: "p-0 overflow-hidden w-[680px]",
2421
- style: { height: PANEL_HEIGHT, maxHeight: LIST_MAX_HEIGHT },
2422
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex h-full", children: [
2423
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
2424
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2425
- "div",
2426
- {
2427
- className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
2428
- onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
2429
- onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
2430
- children: [
2431
- rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2432
- AgentDetailCard,
2433
- {
2434
- agent: hoveredAgent,
2435
- onSelect: () => handleSelectAgent(hoveredAgent)
2436
- }
2437
- ) }, hoveredAgent.id),
2438
- rightPanel === "sort" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2439
- AgentSortPanel,
2440
- {
2441
- consumer,
2442
- onClose: () => setRightPanel(null)
2443
- }
2444
- ),
2445
- rightPanel === "categories" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2446
- AgentCategoriesPanel,
2447
- {
2448
- consumer,
2449
- allCategories,
2450
- search: catSearch,
2451
- setSearch: setCatSearch,
2452
- onClose: () => {
2453
- setRightPanel(null);
2454
- setCatSearch("");
2455
- }
2456
- }
2457
- ),
2458
- rightPanel === "tags" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2459
- AgentTagsPanel,
2460
- {
2461
- consumer,
2462
- allTags,
2463
- search: tagSearch,
2464
- setSearch: setTagSearch,
2465
- onClose: () => {
2466
- setRightPanel(null);
2467
- setTagSearch("");
2468
- }
2469
- }
2470
- ),
2471
- !hasRightPanel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
2472
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
2473
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
2474
- ] })
2475
- ]
2476
- }
2477
- )
2478
- ] })
2591
+ className: "p-0 overflow-hidden",
2592
+ style: { width: PANEL_WIDTH, height: fitHeight ?? PANEL_HEIGHT, maxHeight: fitHeight ?? LIST_MAX_HEIGHT },
2593
+ children: body
2479
2594
  }
2480
2595
  )
2481
2596
  ] });
2482
2597
  }
2483
2598
 
2484
2599
  // catalog/react/AgentListInlinePicker.tsx
2485
- var import_design_system8 = require("@ai-matrx/design-system");
2486
- var import_react8 = require("react");
2487
- var import_jsx_runtime16 = require("react/jsx-runtime");
2600
+ var import_design_system9 = require("@ai-matrx/design-system");
2601
+ var import_react9 = require("react");
2602
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2488
2603
  function AgentListInlinePicker({
2489
2604
  consumerId,
2490
2605
  onSelect,
@@ -2500,11 +2615,11 @@ function AgentListInlinePicker({
2500
2615
  excludeAgentIds,
2501
2616
  defaultMandateKey
2502
2617
  }) {
2503
- const inputRef = (0, import_react8.useRef)(null);
2504
- const [catSearch, setCatSearch] = (0, import_react8.useState)("");
2505
- const [tagSearch, setTagSearch] = (0, import_react8.useState)("");
2506
- const [mobileDetailAgent, setMobileDetailAgent] = (0, import_react8.useState)(null);
2507
- const [mobileSubView, setMobileSubView] = (0, import_react8.useState)(null);
2618
+ const inputRef = (0, import_react9.useRef)(null);
2619
+ const [catSearch, setCatSearch] = (0, import_react9.useState)("");
2620
+ const [tagSearch, setTagSearch] = (0, import_react9.useState)("");
2621
+ const [mobileDetailAgent, setMobileDetailAgent] = (0, import_react9.useState)(null);
2622
+ const [mobileSubView, setMobileSubView] = (0, import_react9.useState)(null);
2508
2623
  const {
2509
2624
  agents,
2510
2625
  archivedHiddenCount,
@@ -2533,7 +2648,7 @@ function AgentListInlinePicker({
2533
2648
  ...excludeAgentIds ? { excludeAgentIds } : {},
2534
2649
  ...defaultMandateKey ? { defaultMandateKey } : {}
2535
2650
  });
2536
- (0, import_react8.useEffect)(() => {
2651
+ (0, import_react9.useEffect)(() => {
2537
2652
  ensureLoaded();
2538
2653
  if (!autoFocusSearch) return void 0;
2539
2654
  const timer = setTimeout(() => inputRef.current?.focus(), 50);
@@ -2549,20 +2664,20 @@ function AgentListInlinePicker({
2549
2664
  };
2550
2665
  const isMobile = true;
2551
2666
  if (mobileDetailAgent) {
2552
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: (0, import_design_system8.cn)("flex h-full min-h-0 flex-col", className), children: [
2553
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2667
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_design_system9.cn)("flex h-full min-h-0 flex-col", className), children: [
2668
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2554
2669
  "button",
2555
2670
  {
2556
2671
  type: "button",
2557
2672
  onClick: () => setMobileDetailAgent(null),
2558
2673
  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",
2559
2674
  children: [
2560
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
2675
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
2561
2676
  "Back"
2562
2677
  ]
2563
2678
  }
2564
2679
  ),
2565
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2680
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2566
2681
  AgentDetailCard,
2567
2682
  {
2568
2683
  agent: mobileDetailAgent,
@@ -2572,7 +2687,7 @@ function AgentListInlinePicker({
2572
2687
  ] });
2573
2688
  }
2574
2689
  if (mobileSubView) {
2575
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_design_system8.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2690
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_design_system9.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2576
2691
  AgentMobileSubView,
2577
2692
  {
2578
2693
  view: mobileSubView,
@@ -2591,7 +2706,7 @@ function AgentListInlinePicker({
2591
2706
  }
2592
2707
  ) });
2593
2708
  }
2594
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_design_system8.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2709
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_design_system9.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2595
2710
  AgentListContent,
2596
2711
  {
2597
2712
  agents,