@ai-matrx/agents 0.14.3 → 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.
- package/CHANGELOG.md +28 -0
- package/dist/catalog/react/index.cjs +302 -208
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +49 -1
- package/dist/catalog/react/index.d.ts +49 -1
- package/dist/catalog/react/index.js +303 -209
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/content-transfer/index.cjs.map +1 -1
- package/dist/content-transfer/index.js.map +1 -1
- package/dist/content-transfer/react/index.cjs.map +1 -1
- package/dist/content-transfer/react/index.js.map +1 -1
- package/dist/mandates/index.cjs +2 -2
- package/dist/mandates/index.cjs.map +1 -1
- package/dist/mandates/index.d.cts +4 -4
- package/dist/mandates/index.d.ts +4 -4
- package/dist/mandates/index.js +2 -2
- package/dist/mandates/index.js.map +1 -1
- package/mandates/snapshots/keys.0.15.0.json +625 -0
- 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
|
|
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 {
|
|
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";
|
|
@@ -2162,41 +2166,28 @@ function AgentTagsPanel({
|
|
|
2162
2166
|
] });
|
|
2163
2167
|
}
|
|
2164
2168
|
|
|
2165
|
-
// catalog/react/
|
|
2169
|
+
// catalog/react/AgentListPanel.tsx
|
|
2166
2170
|
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2167
|
-
var
|
|
2168
|
-
function
|
|
2169
|
-
|
|
2170
|
-
navigateTo,
|
|
2171
|
-
className,
|
|
2172
|
-
label,
|
|
2173
|
-
triggerSlot,
|
|
2174
|
-
noBorder = false,
|
|
2175
|
-
compact = false,
|
|
2176
|
-
activeAgentId: activeAgentIdProp,
|
|
2177
|
-
contentSide,
|
|
2178
|
-
consumerId = CONSUMER_ID,
|
|
2179
|
-
initialTab,
|
|
2180
|
-
includeSystemInAll = false,
|
|
2171
|
+
var PANEL_WIDTH = "680px";
|
|
2172
|
+
function AgentListPanelBody({
|
|
2173
|
+
core,
|
|
2181
2174
|
visibleTabs,
|
|
2182
2175
|
systemTabLabel,
|
|
2183
|
-
|
|
2176
|
+
includeSystemInAll = false,
|
|
2177
|
+
resolveAgentHref,
|
|
2184
2178
|
showPinnedAgent = true,
|
|
2185
|
-
|
|
2186
|
-
|
|
2179
|
+
autoFocusSearch = true,
|
|
2180
|
+
onAfterSelect,
|
|
2181
|
+
className
|
|
2187
2182
|
}) {
|
|
2188
2183
|
const isMobile = useIsMobile();
|
|
2189
2184
|
const { labels } = useAgentCatalog();
|
|
2190
|
-
const { popoverContainer } = useAgentCatalogUiPorts();
|
|
2191
|
-
const [open, setOpen] = useState3(false);
|
|
2192
2185
|
const [rightPanel, setRightPanel] = useState3(null);
|
|
2193
2186
|
const [catSearch, setCatSearch] = useState3("");
|
|
2194
2187
|
const [tagSearch, setTagSearch] = useState3("");
|
|
2195
2188
|
const [mobileDetailAgent, setMobileDetailAgent] = useState3(null);
|
|
2196
2189
|
const [mobileSubView, setMobileSubView] = useState3(null);
|
|
2197
2190
|
const inputRef = useRef4(null);
|
|
2198
|
-
const triggerRef = useRef4(null);
|
|
2199
|
-
const [fitHeight, setFitHeight] = useState3(null);
|
|
2200
2191
|
const {
|
|
2201
2192
|
agents,
|
|
2202
2193
|
archivedHiddenCount,
|
|
@@ -2217,43 +2208,26 @@ function AgentListDropdown({
|
|
|
2217
2208
|
handleAgentHoverEnd: coreAgentHoverEnd,
|
|
2218
2209
|
handleDetailPanelMouseEnter,
|
|
2219
2210
|
handleDetailPanelMouseLeave: coreDetailMouseLeave
|
|
2220
|
-
} =
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
|
|
2236
|
-
const handleOpen = (nextOpen) => {
|
|
2237
|
-
setOpen(nextOpen);
|
|
2238
|
-
if (nextOpen) {
|
|
2239
|
-
setFitHeight(contentSide || isMobile ? null : panelHeightBelow(triggerRef.current));
|
|
2240
|
-
ensureLoaded();
|
|
2241
|
-
if (pinnedAgent && !isMobile) {
|
|
2242
|
-
setHoveredAgent(pinnedAgent);
|
|
2243
|
-
setRightPanel("detail");
|
|
2244
|
-
}
|
|
2245
|
-
setTimeout(() => inputRef.current?.focus(), 50);
|
|
2246
|
-
} else {
|
|
2247
|
-
setRightPanel(null);
|
|
2248
|
-
setCatSearch("");
|
|
2249
|
-
setTagSearch("");
|
|
2250
|
-
setMobileDetailAgent(null);
|
|
2251
|
-
setMobileSubView(null);
|
|
2252
|
-
}
|
|
2253
|
-
};
|
|
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]);
|
|
2254
2226
|
const handleSelectAgent = (agent) => {
|
|
2255
2227
|
coreSelectAgent(agent);
|
|
2256
|
-
|
|
2228
|
+
setMobileDetailAgent(null);
|
|
2229
|
+
setMobileSubView(null);
|
|
2230
|
+
onAfterSelect?.(agent);
|
|
2257
2231
|
};
|
|
2258
2232
|
const handleFilterChipClick = (panel) => {
|
|
2259
2233
|
if (isMobile) {
|
|
@@ -2282,39 +2256,7 @@ function AgentListDropdown({
|
|
|
2282
2256
|
const handleDetailPanelMouseLeave = useCallback5(() => {
|
|
2283
2257
|
coreDetailMouseLeave(() => setRightPanel(null));
|
|
2284
2258
|
}, [coreDetailMouseLeave]);
|
|
2285
|
-
const
|
|
2286
|
-
if (resolveAgentHrefProp) return resolveAgentHrefProp;
|
|
2287
|
-
if (!navigateTo) return void 0;
|
|
2288
|
-
return (agent) => navigateTo.replace("{id}", agent.id);
|
|
2289
|
-
}, [navigateTo, resolveAgentHrefProp]);
|
|
2290
|
-
const hasRightPanel = rightPanel !== null;
|
|
2291
|
-
const triggerButton = triggerSlot ?? /* @__PURE__ */ jsxs12(
|
|
2292
|
-
"button",
|
|
2293
|
-
{
|
|
2294
|
-
type: "button",
|
|
2295
|
-
className: cn6(
|
|
2296
|
-
"inline-flex items-center rounded-md text-xs font-medium transition-colors",
|
|
2297
|
-
"bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
|
|
2298
|
-
compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
|
|
2299
|
-
!noBorder && "border border-border",
|
|
2300
|
-
className
|
|
2301
|
-
),
|
|
2302
|
-
children: [
|
|
2303
|
-
/* @__PURE__ */ jsx15("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
|
|
2304
|
-
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 }),
|
|
2305
|
-
/* @__PURE__ */ jsx15(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
|
|
2306
|
-
]
|
|
2307
|
-
}
|
|
2308
|
-
);
|
|
2309
|
-
const wrapTrigger = (Trigger) => {
|
|
2310
|
-
if (!showAssignedTooltip) {
|
|
2311
|
-
return /* @__PURE__ */ jsx15(Trigger, { asChild: true, ref: triggerRef, children: triggerButton });
|
|
2312
|
-
}
|
|
2313
|
-
return /* @__PURE__ */ jsxs12(Tooltip, { ...open ? { open: false } : {}, children: [
|
|
2314
|
-
/* @__PURE__ */ jsx15(Trigger, { asChild: true, ref: triggerRef, children: /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: triggerButton }) }),
|
|
2315
|
-
/* @__PURE__ */ jsx15(TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
|
|
2316
|
-
] });
|
|
2317
|
-
};
|
|
2259
|
+
const effectiveSystemTabLabel = systemTabLabel ?? (includeSystemInAll ? "System" : void 0);
|
|
2318
2260
|
const listPanel = /* @__PURE__ */ jsx15(
|
|
2319
2261
|
AgentListContent,
|
|
2320
2262
|
{
|
|
@@ -2339,63 +2281,268 @@ function AgentListDropdown({
|
|
|
2339
2281
|
tabCounts,
|
|
2340
2282
|
archivedHiddenCount,
|
|
2341
2283
|
...visibleTabs ? { visibleTabs } : {},
|
|
2342
|
-
...
|
|
2343
|
-
systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
|
|
2344
|
-
} : {},
|
|
2284
|
+
...effectiveSystemTabLabel ? { systemTabLabel: effectiveSystemTabLabel } : {},
|
|
2345
2285
|
pinnedAgent: showPinnedAgent ? pinnedAgent : null,
|
|
2346
2286
|
defaultRow,
|
|
2347
|
-
listOpen:
|
|
2287
|
+
listOpen: true
|
|
2348
2288
|
}
|
|
2349
2289
|
);
|
|
2350
2290
|
if (isMobile) {
|
|
2351
|
-
return /* @__PURE__ */
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
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,
|
|
2358
2341
|
{
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
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)
|
|
2366
2351
|
}
|
|
2367
2352
|
),
|
|
2368
|
-
|
|
2369
|
-
|
|
2353
|
+
rightPanel === "categories" && /* @__PURE__ */ jsx15(
|
|
2354
|
+
AgentCategoriesPanel,
|
|
2370
2355
|
{
|
|
2371
|
-
|
|
2372
|
-
|
|
2356
|
+
consumer,
|
|
2357
|
+
allCategories,
|
|
2358
|
+
search: catSearch,
|
|
2359
|
+
setSearch: setCatSearch,
|
|
2360
|
+
onClose: () => {
|
|
2361
|
+
setRightPanel(null);
|
|
2362
|
+
setCatSearch("");
|
|
2363
|
+
}
|
|
2373
2364
|
}
|
|
2374
|
-
)
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
onBack: () => {
|
|
2387
|
-
setMobileSubView(null);
|
|
2388
|
-
setCatSearch("");
|
|
2389
|
-
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
|
+
}
|
|
2390
2377
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
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 })
|
|
2393
2540
|
] })
|
|
2394
2541
|
] });
|
|
2395
2542
|
}
|
|
2396
|
-
return /* @__PURE__ */
|
|
2543
|
+
return /* @__PURE__ */ jsxs13(Popover, { open, onOpenChange: handleOpen, modal: false, children: [
|
|
2397
2544
|
wrapTrigger(PopoverTrigger),
|
|
2398
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ jsx16(
|
|
2399
2546
|
PopoverContent,
|
|
2400
2547
|
{
|
|
2401
2548
|
...contentSide ? { side: contentSide } : fitHeight ? { side: "bottom" } : {},
|
|
@@ -2404,74 +2551,18 @@ function AgentListDropdown({
|
|
|
2404
2551
|
collisionPadding: 12,
|
|
2405
2552
|
sticky: "always",
|
|
2406
2553
|
...popoverContainer ? { container: popoverContainer } : {},
|
|
2407
|
-
className: "p-0 overflow-hidden
|
|
2408
|
-
style: { height: fitHeight ?? PANEL_HEIGHT, maxHeight: fitHeight ?? LIST_MAX_HEIGHT },
|
|
2409
|
-
children:
|
|
2410
|
-
/* @__PURE__ */ jsx15("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
|
|
2411
|
-
/* @__PURE__ */ jsxs12(
|
|
2412
|
-
"div",
|
|
2413
|
-
{
|
|
2414
|
-
className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
|
|
2415
|
-
onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
|
|
2416
|
-
onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
|
|
2417
|
-
children: [
|
|
2418
|
-
rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ jsx15("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ jsx15(
|
|
2419
|
-
AgentDetailCard,
|
|
2420
|
-
{
|
|
2421
|
-
agent: hoveredAgent,
|
|
2422
|
-
onSelect: () => handleSelectAgent(hoveredAgent)
|
|
2423
|
-
}
|
|
2424
|
-
) }, hoveredAgent.id),
|
|
2425
|
-
rightPanel === "sort" && /* @__PURE__ */ jsx15(
|
|
2426
|
-
AgentSortPanel,
|
|
2427
|
-
{
|
|
2428
|
-
consumer,
|
|
2429
|
-
onClose: () => setRightPanel(null)
|
|
2430
|
-
}
|
|
2431
|
-
),
|
|
2432
|
-
rightPanel === "categories" && /* @__PURE__ */ jsx15(
|
|
2433
|
-
AgentCategoriesPanel,
|
|
2434
|
-
{
|
|
2435
|
-
consumer,
|
|
2436
|
-
allCategories,
|
|
2437
|
-
search: catSearch,
|
|
2438
|
-
setSearch: setCatSearch,
|
|
2439
|
-
onClose: () => {
|
|
2440
|
-
setRightPanel(null);
|
|
2441
|
-
setCatSearch("");
|
|
2442
|
-
}
|
|
2443
|
-
}
|
|
2444
|
-
),
|
|
2445
|
-
rightPanel === "tags" && /* @__PURE__ */ jsx15(
|
|
2446
|
-
AgentTagsPanel,
|
|
2447
|
-
{
|
|
2448
|
-
consumer,
|
|
2449
|
-
allTags,
|
|
2450
|
-
search: tagSearch,
|
|
2451
|
-
setSearch: setTagSearch,
|
|
2452
|
-
onClose: () => {
|
|
2453
|
-
setRightPanel(null);
|
|
2454
|
-
setTagSearch("");
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
),
|
|
2458
|
-
!hasRightPanel && /* @__PURE__ */ jsxs12("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
|
|
2459
|
-
/* @__PURE__ */ jsx15(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
|
|
2460
|
-
/* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
|
|
2461
|
-
] })
|
|
2462
|
-
]
|
|
2463
|
-
}
|
|
2464
|
-
)
|
|
2465
|
-
] })
|
|
2554
|
+
className: "p-0 overflow-hidden",
|
|
2555
|
+
style: { width: PANEL_WIDTH, height: fitHeight ?? PANEL_HEIGHT, maxHeight: fitHeight ?? LIST_MAX_HEIGHT },
|
|
2556
|
+
children: body
|
|
2466
2557
|
}
|
|
2467
2558
|
)
|
|
2468
2559
|
] });
|
|
2469
2560
|
}
|
|
2470
2561
|
|
|
2471
2562
|
// catalog/react/AgentListInlinePicker.tsx
|
|
2472
|
-
import { cn as
|
|
2473
|
-
import { useEffect as
|
|
2474
|
-
import { jsx as
|
|
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";
|
|
2475
2566
|
function AgentListInlinePicker({
|
|
2476
2567
|
consumerId,
|
|
2477
2568
|
onSelect,
|
|
@@ -2487,11 +2578,11 @@ function AgentListInlinePicker({
|
|
|
2487
2578
|
excludeAgentIds,
|
|
2488
2579
|
defaultMandateKey
|
|
2489
2580
|
}) {
|
|
2490
|
-
const inputRef =
|
|
2491
|
-
const [catSearch, setCatSearch] =
|
|
2492
|
-
const [tagSearch, setTagSearch] =
|
|
2493
|
-
const [mobileDetailAgent, setMobileDetailAgent] =
|
|
2494
|
-
const [mobileSubView, setMobileSubView] =
|
|
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);
|
|
2495
2586
|
const {
|
|
2496
2587
|
agents,
|
|
2497
2588
|
archivedHiddenCount,
|
|
@@ -2520,7 +2611,7 @@ function AgentListInlinePicker({
|
|
|
2520
2611
|
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
2521
2612
|
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
2522
2613
|
});
|
|
2523
|
-
|
|
2614
|
+
useEffect5(() => {
|
|
2524
2615
|
ensureLoaded();
|
|
2525
2616
|
if (!autoFocusSearch) return void 0;
|
|
2526
2617
|
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
@@ -2536,20 +2627,20 @@ function AgentListInlinePicker({
|
|
|
2536
2627
|
};
|
|
2537
2628
|
const isMobile = true;
|
|
2538
2629
|
if (mobileDetailAgent) {
|
|
2539
|
-
return /* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2630
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: [
|
|
2631
|
+
/* @__PURE__ */ jsxs14(
|
|
2541
2632
|
"button",
|
|
2542
2633
|
{
|
|
2543
2634
|
type: "button",
|
|
2544
2635
|
onClick: () => setMobileDetailAgent(null),
|
|
2545
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",
|
|
2546
2637
|
children: [
|
|
2547
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ jsx17(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
|
|
2548
2639
|
"Back"
|
|
2549
2640
|
]
|
|
2550
2641
|
}
|
|
2551
2642
|
),
|
|
2552
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx17(
|
|
2553
2644
|
AgentDetailCard,
|
|
2554
2645
|
{
|
|
2555
2646
|
agent: mobileDetailAgent,
|
|
@@ -2559,7 +2650,7 @@ function AgentListInlinePicker({
|
|
|
2559
2650
|
] });
|
|
2560
2651
|
}
|
|
2561
2652
|
if (mobileSubView) {
|
|
2562
|
-
return /* @__PURE__ */
|
|
2653
|
+
return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
|
|
2563
2654
|
AgentMobileSubView,
|
|
2564
2655
|
{
|
|
2565
2656
|
view: mobileSubView,
|
|
@@ -2578,7 +2669,7 @@ function AgentListInlinePicker({
|
|
|
2578
2669
|
}
|
|
2579
2670
|
) });
|
|
2580
2671
|
}
|
|
2581
|
-
return /* @__PURE__ */
|
|
2672
|
+
return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
|
|
2582
2673
|
AgentListContent,
|
|
2583
2674
|
{
|
|
2584
2675
|
agents,
|
|
@@ -2620,6 +2711,8 @@ export {
|
|
|
2620
2711
|
AgentListContent,
|
|
2621
2712
|
AgentListDropdown,
|
|
2622
2713
|
AgentListInlinePicker,
|
|
2714
|
+
AgentListPanel,
|
|
2715
|
+
AgentListPanelBody,
|
|
2623
2716
|
AgentListTabs,
|
|
2624
2717
|
AgentMobileSubView,
|
|
2625
2718
|
AgentRow,
|
|
@@ -2633,6 +2726,7 @@ export {
|
|
|
2633
2726
|
Music4Icon,
|
|
2634
2727
|
OptionRow,
|
|
2635
2728
|
PANEL_HEIGHT,
|
|
2729
|
+
PANEL_WIDTH,
|
|
2636
2730
|
SORT_OPTIONS,
|
|
2637
2731
|
SearchInput,
|
|
2638
2732
|
SidePanelHeader,
|