@ai-matrx/agents 0.14.3 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/catalog/react/index.cjs +303 -208
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +56 -1
- package/dist/catalog/react/index.d.ts +56 -1
- package/dist/catalog/react/index.js +304 -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/mandates/snapshots/keys.0.15.1.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,269 @@ 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-[340px] flex-1 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
|
+
fill = false,
|
|
2401
|
+
...display
|
|
2402
|
+
}) {
|
|
2403
|
+
const isMobile = useIsMobile();
|
|
2404
|
+
const core = useAgentListCore({
|
|
2405
|
+
consumerId,
|
|
2406
|
+
...onSelect ? { onSelect } : {},
|
|
2407
|
+
...navigateTo ? { navigateTo } : {},
|
|
2408
|
+
...activeAgentId !== void 0 ? { activeAgentIdOverride: activeAgentId } : {},
|
|
2409
|
+
...initialTab ? { initialTab } : {},
|
|
2410
|
+
includeSystemInAll,
|
|
2411
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2412
|
+
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
2413
|
+
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
2414
|
+
});
|
|
2415
|
+
const resolveAgentHref = useMemo4(() => {
|
|
2416
|
+
if (resolveAgentHrefProp) return resolveAgentHrefProp;
|
|
2417
|
+
if (!navigateTo) return void 0;
|
|
2418
|
+
return (agent) => navigateTo.replace("{id}", agent.id);
|
|
2419
|
+
}, [navigateTo, resolveAgentHrefProp]);
|
|
2420
|
+
return /* @__PURE__ */ jsx15(
|
|
2421
|
+
"div",
|
|
2422
|
+
{
|
|
2423
|
+
className: cn6("flex min-h-0 flex-col overflow-hidden", (isMobile || fill) && "h-full w-full", className),
|
|
2424
|
+
style: isMobile || fill ? void 0 : { width: PANEL_WIDTH, height: PANEL_HEIGHT },
|
|
2425
|
+
children: /* @__PURE__ */ jsx15(
|
|
2426
|
+
AgentListPanelBody,
|
|
2427
|
+
{
|
|
2428
|
+
core,
|
|
2429
|
+
includeSystemInAll,
|
|
2430
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2431
|
+
...resolveAgentHref ? { resolveAgentHref } : {},
|
|
2432
|
+
...display
|
|
2433
|
+
}
|
|
2434
|
+
)
|
|
2435
|
+
}
|
|
2436
|
+
);
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
// catalog/react/AgentListDropdown.tsx
|
|
2440
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2441
|
+
var CONSUMER_ID = "agent-list-dropdown";
|
|
2442
|
+
function AgentListDropdown({
|
|
2443
|
+
onSelect,
|
|
2444
|
+
navigateTo,
|
|
2445
|
+
className,
|
|
2446
|
+
label,
|
|
2447
|
+
triggerSlot,
|
|
2448
|
+
noBorder = false,
|
|
2449
|
+
compact = false,
|
|
2450
|
+
activeAgentId: activeAgentIdProp,
|
|
2451
|
+
contentSide,
|
|
2452
|
+
consumerId = CONSUMER_ID,
|
|
2453
|
+
initialTab,
|
|
2454
|
+
includeSystemInAll = false,
|
|
2455
|
+
visibleTabs,
|
|
2456
|
+
systemTabLabel,
|
|
2457
|
+
resolveAgentHref: resolveAgentHrefProp,
|
|
2458
|
+
showPinnedAgent = true,
|
|
2459
|
+
excludeAgentIds,
|
|
2460
|
+
defaultMandateKey
|
|
2461
|
+
}) {
|
|
2462
|
+
const isMobile = useIsMobile2();
|
|
2463
|
+
const { labels } = useAgentCatalog();
|
|
2464
|
+
const { popoverContainer } = useAgentCatalogUiPorts();
|
|
2465
|
+
const [open, setOpen] = useState4(false);
|
|
2466
|
+
const triggerRef = useRef5(null);
|
|
2467
|
+
const [fitHeight, setFitHeight] = useState4(null);
|
|
2468
|
+
const core = useAgentListCore({
|
|
2469
|
+
consumerId,
|
|
2470
|
+
...onSelect ? { onSelect } : {},
|
|
2471
|
+
...navigateTo ? { navigateTo } : {},
|
|
2472
|
+
...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
|
|
2473
|
+
...initialTab ? { initialTab } : {},
|
|
2474
|
+
includeSystemInAll,
|
|
2475
|
+
// The restriction has to reach the CORE, not just the tab strip — see
|
|
2476
|
+
// `AgentListCoreOptions.visibleTabs`.
|
|
2477
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2478
|
+
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
2479
|
+
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
2480
|
+
});
|
|
2481
|
+
const { pinnedAgent, defaultRow, activeAgentId, isLoading, activeFilterCount } = core;
|
|
2482
|
+
const activeDefaultRow = defaultRow?.row?.id === activeAgentId ? defaultRow.row : null;
|
|
2483
|
+
const displayLabel = label ?? pinnedAgent?.name ?? activeDefaultRow?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
|
|
2484
|
+
const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
|
|
2485
|
+
const handleOpen = (nextOpen) => {
|
|
2486
|
+
setOpen(nextOpen);
|
|
2487
|
+
if (nextOpen) {
|
|
2488
|
+
setFitHeight(contentSide || isMobile ? null : panelHeightBelow(triggerRef.current));
|
|
2489
|
+
}
|
|
2490
|
+
};
|
|
2491
|
+
const resolveAgentHref = useMemo5(() => {
|
|
2492
|
+
if (resolveAgentHrefProp) return resolveAgentHrefProp;
|
|
2493
|
+
if (!navigateTo) return void 0;
|
|
2494
|
+
return (agent) => navigateTo.replace("{id}", agent.id);
|
|
2495
|
+
}, [navigateTo, resolveAgentHrefProp]);
|
|
2496
|
+
const triggerButton = triggerSlot ?? /* @__PURE__ */ jsxs13(
|
|
2497
|
+
"button",
|
|
2498
|
+
{
|
|
2499
|
+
type: "button",
|
|
2500
|
+
className: cn7(
|
|
2501
|
+
"inline-flex items-center rounded-md text-xs font-medium transition-colors",
|
|
2502
|
+
"bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
|
|
2503
|
+
compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
|
|
2504
|
+
!noBorder && "border border-border",
|
|
2505
|
+
className
|
|
2506
|
+
),
|
|
2507
|
+
children: [
|
|
2508
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
|
|
2509
|
+
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 }),
|
|
2510
|
+
/* @__PURE__ */ jsx16(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
|
|
2511
|
+
]
|
|
2512
|
+
}
|
|
2513
|
+
);
|
|
2514
|
+
const wrapTrigger = (Trigger) => {
|
|
2515
|
+
if (!showAssignedTooltip) {
|
|
2516
|
+
return /* @__PURE__ */ jsx16(Trigger, { asChild: true, ref: triggerRef, children: triggerButton });
|
|
2517
|
+
}
|
|
2518
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { ...open ? { open: false } : {}, children: [
|
|
2519
|
+
/* @__PURE__ */ jsx16(Trigger, { asChild: true, ref: triggerRef, children: /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: triggerButton }) }),
|
|
2520
|
+
/* @__PURE__ */ jsx16(TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
|
|
2521
|
+
] });
|
|
2522
|
+
};
|
|
2523
|
+
const body = /* @__PURE__ */ jsx16(
|
|
2524
|
+
AgentListPanelBody,
|
|
2525
|
+
{
|
|
2526
|
+
core,
|
|
2527
|
+
includeSystemInAll,
|
|
2528
|
+
showPinnedAgent,
|
|
2529
|
+
onAfterSelect: () => setOpen(false),
|
|
2530
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2531
|
+
...systemTabLabel ? { systemTabLabel } : {},
|
|
2532
|
+
...resolveAgentHref ? { resolveAgentHref } : {}
|
|
2533
|
+
}
|
|
2534
|
+
);
|
|
2535
|
+
if (isMobile) {
|
|
2536
|
+
return /* @__PURE__ */ jsxs13(Drawer, { open, onOpenChange: handleOpen, children: [
|
|
2537
|
+
wrapTrigger(DrawerTrigger),
|
|
2538
|
+
/* @__PURE__ */ jsxs13(DrawerContent, { className: "h-[85dvh]", children: [
|
|
2539
|
+
/* @__PURE__ */ jsx16(DrawerTitle, { className: "sr-only", children: "Select Agent" }),
|
|
2540
|
+
/* @__PURE__ */ jsx16("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: body })
|
|
2393
2541
|
] })
|
|
2394
2542
|
] });
|
|
2395
2543
|
}
|
|
2396
|
-
return /* @__PURE__ */
|
|
2544
|
+
return /* @__PURE__ */ jsxs13(Popover, { open, onOpenChange: handleOpen, modal: false, children: [
|
|
2397
2545
|
wrapTrigger(PopoverTrigger),
|
|
2398
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx16(
|
|
2399
2547
|
PopoverContent,
|
|
2400
2548
|
{
|
|
2401
2549
|
...contentSide ? { side: contentSide } : fitHeight ? { side: "bottom" } : {},
|
|
@@ -2404,74 +2552,18 @@ function AgentListDropdown({
|
|
|
2404
2552
|
collisionPadding: 12,
|
|
2405
2553
|
sticky: "always",
|
|
2406
2554
|
...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
|
-
] })
|
|
2555
|
+
className: "p-0 overflow-hidden",
|
|
2556
|
+
style: { width: PANEL_WIDTH, height: fitHeight ?? PANEL_HEIGHT, maxHeight: fitHeight ?? LIST_MAX_HEIGHT },
|
|
2557
|
+
children: body
|
|
2466
2558
|
}
|
|
2467
2559
|
)
|
|
2468
2560
|
] });
|
|
2469
2561
|
}
|
|
2470
2562
|
|
|
2471
2563
|
// catalog/react/AgentListInlinePicker.tsx
|
|
2472
|
-
import { cn as
|
|
2473
|
-
import { useEffect as
|
|
2474
|
-
import { jsx as
|
|
2564
|
+
import { cn as cn8 } from "@ai-matrx/design-system";
|
|
2565
|
+
import { useEffect as useEffect5, useRef as useRef6, useState as useState5 } from "react";
|
|
2566
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2475
2567
|
function AgentListInlinePicker({
|
|
2476
2568
|
consumerId,
|
|
2477
2569
|
onSelect,
|
|
@@ -2487,11 +2579,11 @@ function AgentListInlinePicker({
|
|
|
2487
2579
|
excludeAgentIds,
|
|
2488
2580
|
defaultMandateKey
|
|
2489
2581
|
}) {
|
|
2490
|
-
const inputRef =
|
|
2491
|
-
const [catSearch, setCatSearch] =
|
|
2492
|
-
const [tagSearch, setTagSearch] =
|
|
2493
|
-
const [mobileDetailAgent, setMobileDetailAgent] =
|
|
2494
|
-
const [mobileSubView, setMobileSubView] =
|
|
2582
|
+
const inputRef = useRef6(null);
|
|
2583
|
+
const [catSearch, setCatSearch] = useState5("");
|
|
2584
|
+
const [tagSearch, setTagSearch] = useState5("");
|
|
2585
|
+
const [mobileDetailAgent, setMobileDetailAgent] = useState5(null);
|
|
2586
|
+
const [mobileSubView, setMobileSubView] = useState5(null);
|
|
2495
2587
|
const {
|
|
2496
2588
|
agents,
|
|
2497
2589
|
archivedHiddenCount,
|
|
@@ -2520,7 +2612,7 @@ function AgentListInlinePicker({
|
|
|
2520
2612
|
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
2521
2613
|
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
2522
2614
|
});
|
|
2523
|
-
|
|
2615
|
+
useEffect5(() => {
|
|
2524
2616
|
ensureLoaded();
|
|
2525
2617
|
if (!autoFocusSearch) return void 0;
|
|
2526
2618
|
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
@@ -2536,20 +2628,20 @@ function AgentListInlinePicker({
|
|
|
2536
2628
|
};
|
|
2537
2629
|
const isMobile = true;
|
|
2538
2630
|
if (mobileDetailAgent) {
|
|
2539
|
-
return /* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2631
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: [
|
|
2632
|
+
/* @__PURE__ */ jsxs14(
|
|
2541
2633
|
"button",
|
|
2542
2634
|
{
|
|
2543
2635
|
type: "button",
|
|
2544
2636
|
onClick: () => setMobileDetailAgent(null),
|
|
2545
2637
|
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
2638
|
children: [
|
|
2547
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx17(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
|
|
2548
2640
|
"Back"
|
|
2549
2641
|
]
|
|
2550
2642
|
}
|
|
2551
2643
|
),
|
|
2552
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx17(
|
|
2553
2645
|
AgentDetailCard,
|
|
2554
2646
|
{
|
|
2555
2647
|
agent: mobileDetailAgent,
|
|
@@ -2559,7 +2651,7 @@ function AgentListInlinePicker({
|
|
|
2559
2651
|
] });
|
|
2560
2652
|
}
|
|
2561
2653
|
if (mobileSubView) {
|
|
2562
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
|
|
2563
2655
|
AgentMobileSubView,
|
|
2564
2656
|
{
|
|
2565
2657
|
view: mobileSubView,
|
|
@@ -2578,7 +2670,7 @@ function AgentListInlinePicker({
|
|
|
2578
2670
|
}
|
|
2579
2671
|
) });
|
|
2580
2672
|
}
|
|
2581
|
-
return /* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ jsx17("div", { className: cn8("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx17(
|
|
2582
2674
|
AgentListContent,
|
|
2583
2675
|
{
|
|
2584
2676
|
agents,
|
|
@@ -2620,6 +2712,8 @@ export {
|
|
|
2620
2712
|
AgentListContent,
|
|
2621
2713
|
AgentListDropdown,
|
|
2622
2714
|
AgentListInlinePicker,
|
|
2715
|
+
AgentListPanel,
|
|
2716
|
+
AgentListPanelBody,
|
|
2623
2717
|
AgentListTabs,
|
|
2624
2718
|
AgentMobileSubView,
|
|
2625
2719
|
AgentRow,
|
|
@@ -2633,6 +2727,7 @@ export {
|
|
|
2633
2727
|
Music4Icon,
|
|
2634
2728
|
OptionRow,
|
|
2635
2729
|
PANEL_HEIGHT,
|
|
2730
|
+
PANEL_WIDTH,
|
|
2636
2731
|
SORT_OPTIONS,
|
|
2637
2732
|
SearchInput,
|
|
2638
2733
|
SidePanelHeader,
|