@ai-matrx/agents 0.9.0 → 0.9.2
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 +196 -1
- package/dist/catalog/index.cjs +128 -25
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +138 -8
- package/dist/catalog/index.d.ts +138 -8
- package/dist/catalog/index.js +128 -25
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +194 -70
- package/dist/catalog/native/index.cjs.map +1 -1
- package/dist/catalog/native/index.d.cts +49 -5
- package/dist/catalog/native/index.d.ts +49 -5
- package/dist/catalog/native/index.js +194 -70
- package/dist/catalog/native/index.js.map +1 -1
- package/dist/catalog/react/index.cjs +205 -71
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +77 -4
- package/dist/catalog/react/index.d.ts +77 -4
- package/dist/catalog/react/index.js +205 -71
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/{orchestra-BWJM2MWP.d.cts → orchestra-DljbEiks.d.cts} +75 -2
- package/dist/{orchestra-BWJM2MWP.d.ts → orchestra-DljbEiks.d.ts} +75 -2
- package/package.json +1 -1
|
@@ -117,53 +117,27 @@ function AgentCatalogProvider({
|
|
|
117
117
|
|
|
118
118
|
// catalog/shared/useAgentConsumer.ts
|
|
119
119
|
import { useCallback as useCallback2, useEffect, useRef, useState } from "react";
|
|
120
|
-
|
|
121
|
-
// catalog/types.ts
|
|
122
|
-
function isMandateAgentId(id) {
|
|
123
|
-
return id.startsWith("mandate:");
|
|
124
|
-
}
|
|
125
|
-
var SORT_OPTIONS = [
|
|
126
|
-
{ value: "updated-desc", label: "Recent" },
|
|
127
|
-
{ value: "created-desc", label: "Created" },
|
|
128
|
-
{ value: "name-asc", label: "A \u2192 Z" },
|
|
129
|
-
{ value: "name-desc", label: "Z \u2192 A" },
|
|
130
|
-
{ value: "category-asc", label: "Category" }
|
|
131
|
-
];
|
|
132
|
-
var AGENT_NONE_SENTINEL = "__none__";
|
|
133
|
-
var DEFAULT_AGENT_CONSUMER_STATE = {
|
|
134
|
-
tab: "mine",
|
|
135
|
-
sortBy: "updated-desc",
|
|
136
|
-
searchTerm: "",
|
|
137
|
-
includedCats: [],
|
|
138
|
-
includedTags: [],
|
|
139
|
-
favFilter: "all",
|
|
140
|
-
archFilter: "active",
|
|
141
|
-
accessFilter: "any",
|
|
142
|
-
favoritesFirst: true,
|
|
143
|
-
listPage: 1,
|
|
144
|
-
sharedPage: 1,
|
|
145
|
-
serverMatchedIds: [],
|
|
146
|
-
isServerSearching: false,
|
|
147
|
-
deepSearch: false
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// catalog/shared/useAgentConsumer.ts
|
|
151
120
|
var DEBOUNCE_MS = 250;
|
|
152
121
|
var MIN_QUERY_LENGTH = 2;
|
|
153
122
|
function useAgentConsumer(consumerId, options) {
|
|
154
123
|
const catalog = useAgentCatalog();
|
|
124
|
+
const defaults = catalog.consumerDefaults;
|
|
155
125
|
const selectConsumer = useCallback2(
|
|
156
|
-
(state) => state.consumers[consumerId] ??
|
|
157
|
-
[consumerId]
|
|
126
|
+
(state) => state.consumers[consumerId] ?? defaults,
|
|
127
|
+
[consumerId, defaults]
|
|
158
128
|
);
|
|
159
129
|
const consumer = useAgentCatalogState(selectConsumer);
|
|
160
130
|
const optionsRef = useRef(options);
|
|
161
131
|
optionsRef.current = options;
|
|
162
132
|
useEffect(() => {
|
|
163
133
|
const opts = optionsRef.current;
|
|
134
|
+
const initial = {
|
|
135
|
+
...opts?.initialTab ? { tab: opts.initialTab } : {},
|
|
136
|
+
...opts?.initialArchFilter ? { archFilter: opts.initialArchFilter } : {}
|
|
137
|
+
};
|
|
164
138
|
catalog.registerConsumer(
|
|
165
139
|
consumerId,
|
|
166
|
-
|
|
140
|
+
Object.keys(initial).length > 0 ? initial : void 0
|
|
167
141
|
);
|
|
168
142
|
return () => {
|
|
169
143
|
if (optionsRef.current?.unregisterOnUnmount) {
|
|
@@ -286,7 +260,10 @@ function useAgentConsumer(consumerId, options) {
|
|
|
286
260
|
isSearching
|
|
287
261
|
});
|
|
288
262
|
}, [consumerId, catalog, matchedIds, isSearching]);
|
|
289
|
-
const hasActiveFilters = consumer.searchTerm !== "" || consumer.includedCats.length > 0 || consumer.includedTags.length > 0 || consumer.favFilter !== "all" ||
|
|
263
|
+
const hasActiveFilters = consumer.searchTerm !== "" || consumer.includedCats.length > 0 || consumer.includedTags.length > 0 || consumer.favFilter !== "all" || // The archive filter is compared to THIS CATALOG'S default, not to the
|
|
264
|
+
// hardcoded platform one: a host that legitimately defaults to "show all"
|
|
265
|
+
// must not have the reset control permanently lit.
|
|
266
|
+
consumer.archFilter !== defaults.archFilter || consumer.accessFilter !== "any" || !consumer.favoritesFirst;
|
|
290
267
|
return {
|
|
291
268
|
tab: consumer.tab,
|
|
292
269
|
sortBy: consumer.sortBy,
|
|
@@ -295,6 +272,7 @@ function useAgentConsumer(consumerId, options) {
|
|
|
295
272
|
includedTags: consumer.includedTags,
|
|
296
273
|
favFilter: consumer.favFilter,
|
|
297
274
|
archFilter: consumer.archFilter,
|
|
275
|
+
archFilterDefault: defaults.archFilter,
|
|
298
276
|
accessFilter: consumer.accessFilter,
|
|
299
277
|
favoritesFirst: consumer.favoritesFirst,
|
|
300
278
|
listPage: consumer.listPage,
|
|
@@ -330,6 +308,34 @@ import {
|
|
|
330
308
|
useState as useState2
|
|
331
309
|
} from "react";
|
|
332
310
|
|
|
311
|
+
// catalog/types.ts
|
|
312
|
+
function isMandateAgentId(id) {
|
|
313
|
+
return id.startsWith("mandate:");
|
|
314
|
+
}
|
|
315
|
+
var SORT_OPTIONS = [
|
|
316
|
+
{ value: "updated-desc", label: "Recent" },
|
|
317
|
+
{ value: "created-desc", label: "Created" },
|
|
318
|
+
{ value: "name-asc", label: "A \u2192 Z" },
|
|
319
|
+
{ value: "name-desc", label: "Z \u2192 A" },
|
|
320
|
+
{ value: "category-asc", label: "Category" }
|
|
321
|
+
];
|
|
322
|
+
var ARCHIVE_FILTER_ORDER = [
|
|
323
|
+
"active",
|
|
324
|
+
"both",
|
|
325
|
+
"archived"
|
|
326
|
+
];
|
|
327
|
+
var ARCHIVE_FILTER_OPTIONS = [
|
|
328
|
+
{ value: "active", label: "Hide archived", chip: "Archive" },
|
|
329
|
+
{ value: "both", label: "Show all", chip: "All + archived" },
|
|
330
|
+
{ value: "archived", label: "Archived only", chip: "Archived only" }
|
|
331
|
+
];
|
|
332
|
+
function nextArchFilter(current) {
|
|
333
|
+
const index = ARCHIVE_FILTER_ORDER.indexOf(current);
|
|
334
|
+
if (index < 0) return ARCHIVE_FILTER_ORDER[0];
|
|
335
|
+
return ARCHIVE_FILTER_ORDER[(index + 1) % ARCHIVE_FILTER_ORDER.length];
|
|
336
|
+
}
|
|
337
|
+
var AGENT_NONE_SENTINEL = "__none__";
|
|
338
|
+
|
|
333
339
|
// catalog/labels.ts
|
|
334
340
|
function agentListEmptyLabel(tab, labels) {
|
|
335
341
|
switch (tab) {
|
|
@@ -346,6 +352,26 @@ function shouldDefaultAgentListToPublicTab(args) {
|
|
|
346
352
|
if (!args.agentsLoaded) return false;
|
|
347
353
|
return args.ownedCount === 0;
|
|
348
354
|
}
|
|
355
|
+
function agentArchiveFilterChipLabel(archFilter) {
|
|
356
|
+
return ARCHIVE_FILTER_OPTIONS.find((o) => o.value === archFilter)?.chip ?? "Archive";
|
|
357
|
+
}
|
|
358
|
+
function agentArchiveFilterStateLabel(archFilter) {
|
|
359
|
+
return ARCHIVE_FILTER_OPTIONS.find((o) => o.value === archFilter)?.label ?? "Hide archived";
|
|
360
|
+
}
|
|
361
|
+
function agentArchiveFilterControlLabel(archFilter) {
|
|
362
|
+
return `Archive filter: ${agentArchiveFilterStateLabel(
|
|
363
|
+
archFilter
|
|
364
|
+
).toLowerCase()}. Click for ${agentArchiveFilterStateLabel(
|
|
365
|
+
nextArchFilter(archFilter)
|
|
366
|
+
).toLowerCase()}`;
|
|
367
|
+
}
|
|
368
|
+
function agentListFooterLabel(args) {
|
|
369
|
+
const { count, archFilter, archivedHiddenCount } = args;
|
|
370
|
+
if (archFilter === "archived") return `${count} archived shown`;
|
|
371
|
+
const base = `${count} agent${count !== 1 ? "s" : ""}`;
|
|
372
|
+
if (archFilter === "both") return `${base} \xB7 archived shown`;
|
|
373
|
+
return archivedHiddenCount > 0 ? `${base} \xB7 ${archivedHiddenCount} archived hidden` : base;
|
|
374
|
+
}
|
|
349
375
|
|
|
350
376
|
// catalog/score.ts
|
|
351
377
|
function computeAgentSearchScore(agent, query) {
|
|
@@ -422,7 +448,19 @@ function memoize2(fn) {
|
|
|
422
448
|
return last;
|
|
423
449
|
};
|
|
424
450
|
}
|
|
451
|
+
function compareAgentIds(a, b) {
|
|
452
|
+
const idA = a.id ?? "";
|
|
453
|
+
const idB = b.id ?? "";
|
|
454
|
+
if (idA < idB) return -1;
|
|
455
|
+
if (idA > idB) return 1;
|
|
456
|
+
return 0;
|
|
457
|
+
}
|
|
425
458
|
function applyAgentSortComparator(a, b, sortBy) {
|
|
459
|
+
const primary = compareAgentSortKey(a, b, sortBy);
|
|
460
|
+
if (!Number.isFinite(primary) || primary === 0) return compareAgentIds(a, b);
|
|
461
|
+
return primary;
|
|
462
|
+
}
|
|
463
|
+
function compareAgentSortKey(a, b, sortBy) {
|
|
426
464
|
switch (sortBy) {
|
|
427
465
|
case "name-asc":
|
|
428
466
|
return (a.name ?? "").localeCompare(b.name ?? "");
|
|
@@ -524,8 +562,7 @@ function filterUserTypeAgents(agents, consumer) {
|
|
|
524
562
|
if (tab === "mine" && agent.isOwner !== true) return false;
|
|
525
563
|
if (tab === "shared" && !(agent.isOwner === false && agent.accessLevel != null))
|
|
526
564
|
return false;
|
|
527
|
-
if (archFilter
|
|
528
|
-
if (archFilter === "archived" && !agent.isArchived) return false;
|
|
565
|
+
if (!agentMatchesArchiveFilter(agent, archFilter)) return false;
|
|
529
566
|
if (favFilter === "yes" && !agent.isFavorite) return false;
|
|
530
567
|
if (favFilter === "no" && agent.isFavorite) return false;
|
|
531
568
|
if (accessFilter === "owned" && agent.isOwner !== true) return false;
|
|
@@ -555,9 +592,10 @@ function filterUserTypeAgents(agents, consumer) {
|
|
|
555
592
|
return sortFilteredAgents(filtered, consumer);
|
|
556
593
|
}
|
|
557
594
|
function filterBuiltinTypeAgents(agents, consumer) {
|
|
558
|
-
const { searchTerm, favFilter, includedCats, includedTags } = consumer;
|
|
595
|
+
const { searchTerm, favFilter, archFilter, includedCats, includedTags } = consumer;
|
|
559
596
|
const serverMatched = new Set(consumer.serverMatchedIds);
|
|
560
597
|
const filtered = agents.filter((agent) => {
|
|
598
|
+
if (!agentMatchesArchiveFilter(agent, archFilter)) return false;
|
|
561
599
|
if (favFilter === "yes" && !agent.isFavorite) return false;
|
|
562
600
|
if (favFilter === "no" && agent.isFavorite) return false;
|
|
563
601
|
if (includedCats.length > 0) {
|
|
@@ -598,22 +636,55 @@ var makeSelectFilteredAgents = (includeSystemInAll = false) => memoize2(
|
|
|
598
636
|
return filterUserTypeAgents(userAgents, consumer);
|
|
599
637
|
}
|
|
600
638
|
);
|
|
639
|
+
function agentMatchesArchiveFilter(agent, archFilter) {
|
|
640
|
+
if (archFilter === "active") return !agent.isArchived;
|
|
641
|
+
if (archFilter === "archived") return Boolean(agent.isArchived);
|
|
642
|
+
return true;
|
|
643
|
+
}
|
|
644
|
+
function countBuiltinRows(agents, archFilter) {
|
|
645
|
+
let n = 0;
|
|
646
|
+
for (const a of agents) {
|
|
647
|
+
if (a.agentType !== "builtin") continue;
|
|
648
|
+
if (!agentMatchesArchiveFilter(a, archFilter)) continue;
|
|
649
|
+
n += 1;
|
|
650
|
+
}
|
|
651
|
+
return n;
|
|
652
|
+
}
|
|
653
|
+
function countUserRows(agents, archFilter, predicate) {
|
|
654
|
+
let n = 0;
|
|
655
|
+
for (const a of agents) {
|
|
656
|
+
if (a.agentType !== "user") continue;
|
|
657
|
+
if (!agentMatchesArchiveFilter(a, archFilter)) continue;
|
|
658
|
+
if (predicate(a)) n += 1;
|
|
659
|
+
}
|
|
660
|
+
return n;
|
|
661
|
+
}
|
|
662
|
+
var isOwned = (a) => a.isOwner === true;
|
|
663
|
+
var isShared = (a) => a.isOwner === false && a.accessLevel != null;
|
|
664
|
+
var isAny = () => true;
|
|
665
|
+
var isFavorite = (a) => Boolean(a.isFavorite);
|
|
666
|
+
var selectAgentTabCounts = memoize2(
|
|
667
|
+
(agents, archFilter) => ({
|
|
668
|
+
mine: countUserRows(agents, archFilter, isOwned),
|
|
669
|
+
shared: countUserRows(agents, archFilter, isShared),
|
|
670
|
+
all: countUserRows(agents, archFilter, isAny),
|
|
671
|
+
system: countBuiltinRows(agents, archFilter)
|
|
672
|
+
})
|
|
673
|
+
);
|
|
601
674
|
var selectTotalUserAgentsCount = memoize1(
|
|
602
|
-
(agents) =>
|
|
675
|
+
(agents) => countUserRows(agents, "active", isAny)
|
|
603
676
|
);
|
|
604
677
|
var selectTotalOwnedAgentsCount = memoize1(
|
|
605
|
-
(agents) =>
|
|
678
|
+
(agents) => countUserRows(agents, "active", isOwned)
|
|
606
679
|
);
|
|
607
680
|
var selectTotalSharedAgentsCount = memoize1(
|
|
608
|
-
(agents) =>
|
|
609
|
-
(a) => a.isOwner === false && a.accessLevel != null
|
|
610
|
-
).length
|
|
681
|
+
(agents) => countUserRows(agents, "active", isShared)
|
|
611
682
|
);
|
|
612
683
|
var selectTotalBuiltinAgentsCount = memoize1(
|
|
613
|
-
(agents) =>
|
|
684
|
+
(agents) => countBuiltinRows(agents, "active")
|
|
614
685
|
);
|
|
615
686
|
var selectTotalFavoriteAgentsCount = memoize1(
|
|
616
|
-
(agents) =>
|
|
687
|
+
(agents) => countUserRows(agents, "active", isFavorite)
|
|
617
688
|
);
|
|
618
689
|
|
|
619
690
|
// catalog/shared/useAgentListCore.ts
|
|
@@ -632,6 +703,7 @@ function useAgentListCore({
|
|
|
632
703
|
initialTab,
|
|
633
704
|
includeSystemInAll = false,
|
|
634
705
|
visibleTabs,
|
|
706
|
+
initialArchFilter,
|
|
635
707
|
excludeAgentIds = EMPTY_EXCLUDES,
|
|
636
708
|
defaultMandateKey
|
|
637
709
|
}) {
|
|
@@ -641,10 +713,14 @@ function useAgentListCore({
|
|
|
641
713
|
const [hoveredAgent, setHoveredAgent] = useState2(null);
|
|
642
714
|
const hoverLeaveTimerRef = useRef2(null);
|
|
643
715
|
const defaultTabAppliedRef = useRef2(false);
|
|
644
|
-
const consumer = useAgentConsumer(consumerId, {
|
|
716
|
+
const consumer = useAgentConsumer(consumerId, {
|
|
717
|
+
unregisterOnUnmount: true,
|
|
718
|
+
...initialArchFilter ? { initialArchFilter } : {}
|
|
719
|
+
});
|
|
645
720
|
const rows = useAgentCatalogRows();
|
|
646
721
|
const userId = catalog.getUserIdOrNull();
|
|
647
|
-
const
|
|
722
|
+
const tabCountsForFilter = selectAgentTabCounts(rows, consumer.state.archFilter);
|
|
723
|
+
const ownedCount = tabCountsForFilter.mine;
|
|
648
724
|
const selectFiltered = useMemo3(
|
|
649
725
|
() => makeSelectFilteredAgents(includeSystemInAll),
|
|
650
726
|
[includeSystemInAll]
|
|
@@ -654,19 +730,27 @@ function useAgentListCore({
|
|
|
654
730
|
() => new Set(excludeAgentIds),
|
|
655
731
|
[excludeAgentIds]
|
|
656
732
|
);
|
|
657
|
-
const
|
|
733
|
+
const applyExcludes = useCallback3(
|
|
734
|
+
(list) => excludedAgentIds.size === 0 ? list : list.filter((agent) => !excludedAgentIds.has(agent.id)),
|
|
735
|
+
[excludedAgentIds]
|
|
736
|
+
);
|
|
737
|
+
const agents = applyExcludes(filteredAgents);
|
|
738
|
+
const selectArchivedProbe = useMemo3(
|
|
739
|
+
() => makeSelectFilteredAgents(includeSystemInAll),
|
|
740
|
+
[includeSystemInAll]
|
|
741
|
+
);
|
|
742
|
+
const archiveProbeState = useMemo3(
|
|
743
|
+
() => ({ ...consumer.state, archFilter: "archived" }),
|
|
744
|
+
[consumer.state]
|
|
745
|
+
);
|
|
746
|
+
const archivedHiddenCount = consumer.archFilter === "active" ? applyExcludes(selectArchivedProbe(rows, archiveProbeState)).length : 0;
|
|
658
747
|
const status = useAgentCatalogState(selectStatus);
|
|
659
748
|
const activeAgentId = activeAgentIdOverride ?? null;
|
|
660
749
|
const pinnedAgent = activeAgentId ? catalog.getAgent(activeAgentId) : void 0;
|
|
661
750
|
const onSystemTab = consumer.tab === "system";
|
|
662
751
|
const allCategories = onSystemTab ? selectAllSystemAgentCategories(rows) : selectAllAgentCategories(rows);
|
|
663
752
|
const allTags = onSystemTab ? selectAllSystemAgentTags(rows) : selectAllAgentTags(rows);
|
|
664
|
-
const tabCounts =
|
|
665
|
-
mine: ownedCount,
|
|
666
|
-
shared: selectTotalSharedAgentsCount(rows),
|
|
667
|
-
all: selectTotalUserAgentsCount(rows),
|
|
668
|
-
system: selectTotalBuiltinAgentsCount(rows)
|
|
669
|
-
};
|
|
753
|
+
const tabCounts = tabCountsForFilter;
|
|
670
754
|
const isLoading = status === "loading";
|
|
671
755
|
const agentsLoaded = status === "succeeded" || status === "failed";
|
|
672
756
|
const ensureLoaded = useCallback3(() => {
|
|
@@ -746,7 +830,9 @@ function useAgentListCore({
|
|
|
746
830
|
},
|
|
747
831
|
[onSelect, navigateTo, navigate, catalog, consumerId]
|
|
748
832
|
);
|
|
749
|
-
const activeFilterCount = (consumer.sortBy !== "updated-desc" ? 1 : 0) + (consumer.includedCats.length > 0 ? 1 : 0) + (consumer.includedTags.length > 0 ? 1 : 0) + (consumer.favFilter !== "all" ? 1 : 0)
|
|
833
|
+
const activeFilterCount = (consumer.sortBy !== "updated-desc" ? 1 : 0) + (consumer.includedCats.length > 0 ? 1 : 0) + (consumer.includedTags.length > 0 ? 1 : 0) + (consumer.favFilter !== "all" ? 1 : 0) + // The archive filter counts like every other filter, so a list showing
|
|
834
|
+
// archived rows offers the reset control that puts them away again.
|
|
835
|
+
(consumer.archFilter !== consumer.archFilterDefault ? 1 : 0);
|
|
750
836
|
const handleAgentHover = useCallback3(
|
|
751
837
|
(agent, panelOpen) => {
|
|
752
838
|
if (panelOpen) return;
|
|
@@ -787,8 +873,15 @@ function useAgentListCore({
|
|
|
787
873
|
},
|
|
788
874
|
[]
|
|
789
875
|
);
|
|
876
|
+
const footerLabel = agentListFooterLabel({
|
|
877
|
+
count: agents.length,
|
|
878
|
+
archFilter: consumer.archFilter,
|
|
879
|
+
archivedHiddenCount
|
|
880
|
+
});
|
|
790
881
|
return {
|
|
791
882
|
agents,
|
|
883
|
+
archivedHiddenCount,
|
|
884
|
+
footerLabel,
|
|
792
885
|
isLoading,
|
|
793
886
|
activeAgentId,
|
|
794
887
|
pinnedAgent: pinnedAgent ?? null,
|
|
@@ -918,6 +1011,18 @@ var SHAPES = {
|
|
|
918
1011
|
"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"
|
|
919
1012
|
]
|
|
920
1013
|
},
|
|
1014
|
+
/**
|
|
1015
|
+
* THE ARCHIVE GLYPH (Lucide `archive`) — the ONE mark of the platform
|
|
1016
|
+
* archive filter, drawn identically in every Matrx client so the control a
|
|
1017
|
+
* person learns on one surface is recognisable on all of them.
|
|
1018
|
+
*/
|
|
1019
|
+
archive: {
|
|
1020
|
+
paths: [
|
|
1021
|
+
"M3 3h18a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z",
|
|
1022
|
+
"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",
|
|
1023
|
+
"M10 12h4"
|
|
1024
|
+
]
|
|
1025
|
+
},
|
|
921
1026
|
circleCheck: {
|
|
922
1027
|
paths: ["m9 12 2 2 4-4"],
|
|
923
1028
|
circles: [{ cx: 12, cy: 12, r: 10 }]
|
|
@@ -988,6 +1093,7 @@ var ArrowUpDownIcon = makeIcon("arrowUpDown");
|
|
|
988
1093
|
var FolderIcon = makeIcon("folder");
|
|
989
1094
|
var TagIcon = makeIcon("tag");
|
|
990
1095
|
var RotateCcwIcon = makeIcon("rotateCcw");
|
|
1096
|
+
var ArchiveIcon = makeIcon("archive");
|
|
991
1097
|
var LoaderIcon = makeIcon("loader");
|
|
992
1098
|
var UsersIcon = makeIcon("users");
|
|
993
1099
|
var ClockIcon = makeIcon("clock");
|
|
@@ -1045,13 +1151,17 @@ function FilterChip({
|
|
|
1045
1151
|
label,
|
|
1046
1152
|
active,
|
|
1047
1153
|
focused,
|
|
1048
|
-
onClick
|
|
1154
|
+
onClick,
|
|
1155
|
+
ariaLabel,
|
|
1156
|
+
testId
|
|
1049
1157
|
}) {
|
|
1050
1158
|
return /* @__PURE__ */ jsxs2(
|
|
1051
1159
|
"button",
|
|
1052
1160
|
{
|
|
1053
1161
|
type: "button",
|
|
1054
1162
|
onClick,
|
|
1163
|
+
...ariaLabel ? { "aria-label": ariaLabel } : {},
|
|
1164
|
+
...testId ? { "data-testid": testId } : {},
|
|
1055
1165
|
className: cn(
|
|
1056
1166
|
"inline-flex items-center gap-1 h-6 px-1.5 rounded text-[11px] font-medium shrink-0 transition-colors",
|
|
1057
1167
|
focused ? "bg-primary/15 text-primary border border-primary/30 ring-1 ring-primary/20" : active ? "bg-primary/10 text-primary border border-primary/20" : "text-muted-foreground hover:text-foreground hover:bg-muted/50 border border-transparent"
|
|
@@ -1196,15 +1306,15 @@ function FavoriteAgentButton({
|
|
|
1196
1306
|
[id]
|
|
1197
1307
|
);
|
|
1198
1308
|
const record = useAgentCatalogState(select);
|
|
1199
|
-
const
|
|
1309
|
+
const isFavorite2 = record?.isFavorite ?? false;
|
|
1200
1310
|
const isOwner = record?.isOwner ?? true;
|
|
1201
1311
|
const handleClick = (e) => {
|
|
1202
1312
|
e.stopPropagation();
|
|
1203
1313
|
if (disabled || !isOwner) return;
|
|
1204
|
-
void catalog.setFavorite(id, !
|
|
1314
|
+
void catalog.setFavorite(id, !isFavorite2).catch(() => {
|
|
1205
1315
|
});
|
|
1206
1316
|
};
|
|
1207
|
-
const title = isOwner ?
|
|
1317
|
+
const title = isOwner ? isFavorite2 ? "Remove from favorites" : "Add to favorites" : "Shared \u2014 cannot favorite";
|
|
1208
1318
|
if (variant === "list") {
|
|
1209
1319
|
return /* @__PURE__ */ jsx6(
|
|
1210
1320
|
"button",
|
|
@@ -1218,14 +1328,14 @@ function FavoriteAgentButton({
|
|
|
1218
1328
|
onClick: handleClick,
|
|
1219
1329
|
disabled: disabled || !isOwner,
|
|
1220
1330
|
title,
|
|
1221
|
-
"aria-label":
|
|
1331
|
+
"aria-label": isFavorite2 ? "Remove from favorites" : "Add to favorites",
|
|
1222
1332
|
children: /* @__PURE__ */ jsx6(
|
|
1223
1333
|
StarIcon,
|
|
1224
1334
|
{
|
|
1225
|
-
filled:
|
|
1335
|
+
filled: isFavorite2,
|
|
1226
1336
|
className: cn2(
|
|
1227
1337
|
"h-3.5 w-3.5 transition-all duration-150",
|
|
1228
|
-
|
|
1338
|
+
isFavorite2 ? "matrx-agent-star-on" : "text-muted-foreground/40 hover:matrx-agent-star-on"
|
|
1229
1339
|
)
|
|
1230
1340
|
}
|
|
1231
1341
|
)
|
|
@@ -1240,13 +1350,13 @@ function FavoriteAgentButton({
|
|
|
1240
1350
|
"absolute top-2.5 right-2.5 z-10 p-0.5 rounded transition-all duration-150",
|
|
1241
1351
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1242
1352
|
disabled || !isOwner ? "cursor-not-allowed" : "hover:scale-110 cursor-pointer",
|
|
1243
|
-
|
|
1353
|
+
isFavorite2 ? "matrx-agent-star-on" : "text-muted-foreground/40 hover:matrx-agent-star-on"
|
|
1244
1354
|
),
|
|
1245
1355
|
onClick: handleClick,
|
|
1246
1356
|
disabled: disabled || !isOwner,
|
|
1247
1357
|
title,
|
|
1248
|
-
"aria-label":
|
|
1249
|
-
children: /* @__PURE__ */ jsx6(StarIcon, { filled:
|
|
1358
|
+
"aria-label": isFavorite2 ? "Remove from favorites" : "Add to favorites",
|
|
1359
|
+
children: /* @__PURE__ */ jsx6(StarIcon, { filled: isFavorite2, className: "w-4 h-4 transition-all duration-150" })
|
|
1250
1360
|
}
|
|
1251
1361
|
);
|
|
1252
1362
|
}
|
|
@@ -1474,6 +1584,17 @@ function AgentFilterBar({
|
|
|
1474
1584
|
}
|
|
1475
1585
|
}
|
|
1476
1586
|
),
|
|
1587
|
+
/* @__PURE__ */ jsx8(
|
|
1588
|
+
FilterChip,
|
|
1589
|
+
{
|
|
1590
|
+
icon: ArchiveIcon,
|
|
1591
|
+
label: agentArchiveFilterChipLabel(consumer.archFilter),
|
|
1592
|
+
active: consumer.archFilter !== consumer.archFilterDefault,
|
|
1593
|
+
ariaLabel: agentArchiveFilterControlLabel(consumer.archFilter),
|
|
1594
|
+
testId: "agent-archive-filter",
|
|
1595
|
+
onClick: () => consumer.setArchFilter(nextArchFilter(consumer.archFilter))
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1477
1598
|
allCategories.length > 0 && /* @__PURE__ */ jsx8(
|
|
1478
1599
|
FilterChip,
|
|
1479
1600
|
{
|
|
@@ -1582,6 +1703,7 @@ function AgentRow({
|
|
|
1582
1703
|
return /* @__PURE__ */ jsxs7(
|
|
1583
1704
|
"div",
|
|
1584
1705
|
{
|
|
1706
|
+
"data-testid": `agent-row-${agent.id}`,
|
|
1585
1707
|
className: cn5(
|
|
1586
1708
|
"flex items-center w-full text-left transition-colors group",
|
|
1587
1709
|
"hover:bg-muted/50 active:bg-muted/70",
|
|
@@ -1672,7 +1794,8 @@ function AgentListContent({
|
|
|
1672
1794
|
systemTabLabel,
|
|
1673
1795
|
pinnedAgent = null,
|
|
1674
1796
|
defaultRow = null,
|
|
1675
|
-
listOpen = false
|
|
1797
|
+
listOpen = false,
|
|
1798
|
+
archivedHiddenCount = 0
|
|
1676
1799
|
}) {
|
|
1677
1800
|
const catalog = useAgentCatalog();
|
|
1678
1801
|
const listScrollRef = useRef3(null);
|
|
@@ -1810,11 +1933,18 @@ function AgentListContent({
|
|
|
1810
1933
|
] }) }),
|
|
1811
1934
|
/* @__PURE__ */ jsx11("div", { className: "h-px bg-border shrink-0" }),
|
|
1812
1935
|
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between px-2.5 py-1.5 shrink-0", children: [
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1936
|
+
/* @__PURE__ */ jsx11(
|
|
1937
|
+
"span",
|
|
1938
|
+
{
|
|
1939
|
+
"data-testid": "agent-list-footer",
|
|
1940
|
+
className: "text-[10px] text-muted-foreground tabular-nums",
|
|
1941
|
+
children: agentListFooterLabel({
|
|
1942
|
+
count: agents.length,
|
|
1943
|
+
archFilter: consumer.archFilter,
|
|
1944
|
+
archivedHiddenCount
|
|
1945
|
+
})
|
|
1946
|
+
}
|
|
1947
|
+
),
|
|
1818
1948
|
consumer.searchTerm && /* @__PURE__ */ jsx11(
|
|
1819
1949
|
"button",
|
|
1820
1950
|
{
|
|
@@ -2037,6 +2167,7 @@ function AgentListDropdown({
|
|
|
2037
2167
|
const inputRef = useRef4(null);
|
|
2038
2168
|
const {
|
|
2039
2169
|
agents,
|
|
2170
|
+
archivedHiddenCount,
|
|
2040
2171
|
isLoading,
|
|
2041
2172
|
activeAgentId,
|
|
2042
2173
|
pinnedAgent,
|
|
@@ -2172,6 +2303,7 @@ function AgentListDropdown({
|
|
|
2172
2303
|
onFilterChipClick: handleFilterChipClick,
|
|
2173
2304
|
rightPanel,
|
|
2174
2305
|
tabCounts,
|
|
2306
|
+
archivedHiddenCount,
|
|
2175
2307
|
...visibleTabs ? { visibleTabs } : {},
|
|
2176
2308
|
...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
|
|
2177
2309
|
systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
|
|
@@ -2328,6 +2460,7 @@ function AgentListInlinePicker({
|
|
|
2328
2460
|
const [mobileSubView, setMobileSubView] = useState4(null);
|
|
2329
2461
|
const {
|
|
2330
2462
|
agents,
|
|
2463
|
+
archivedHiddenCount,
|
|
2331
2464
|
isLoading,
|
|
2332
2465
|
allCategories,
|
|
2333
2466
|
allTags,
|
|
@@ -2434,6 +2567,7 @@ function AgentListInlinePicker({
|
|
|
2434
2567
|
onFilterChipClick: handleFilterChipClick,
|
|
2435
2568
|
rightPanel: null,
|
|
2436
2569
|
tabCounts,
|
|
2570
|
+
archivedHiddenCount,
|
|
2437
2571
|
...visibleTabs ? { visibleTabs } : {},
|
|
2438
2572
|
...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
|
|
2439
2573
|
systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
|