@ai-matrx/agents 0.6.1 → 0.7.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 +205 -0
- package/README.md +65 -5
- package/dist/catalog/index.cjs +1344 -0
- package/dist/catalog/index.cjs.map +1 -0
- package/dist/catalog/index.d.cts +857 -0
- package/dist/catalog/index.d.ts +857 -0
- package/dist/catalog/index.js +1321 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/react/index.cjs +2337 -0
- package/dist/catalog/react/index.cjs.map +1 -0
- package/dist/catalog/react/index.d.cts +808 -0
- package/dist/catalog/react/index.d.ts +808 -0
- package/dist/catalog/react/index.js +2340 -0
- package/dist/catalog/react/index.js.map +1 -0
- package/dist/catalog/styles.css +117 -0
- package/package.json +25 -3
|
@@ -0,0 +1,2337 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// catalog/react/index.ts
|
|
23
|
+
var react_exports = {};
|
|
24
|
+
__export(react_exports, {
|
|
25
|
+
AgentCatalogProvider: () => AgentCatalogProvider,
|
|
26
|
+
AgentCategoriesPanel: () => AgentCategoriesPanel,
|
|
27
|
+
AgentDetailCard: () => AgentDetailCard,
|
|
28
|
+
AgentFilterBar: () => AgentFilterBar,
|
|
29
|
+
AgentListContent: () => AgentListContent,
|
|
30
|
+
AgentListDropdown: () => AgentListDropdown,
|
|
31
|
+
AgentListInlinePicker: () => AgentListInlinePicker,
|
|
32
|
+
AgentListTabs: () => AgentListTabs,
|
|
33
|
+
AgentMobileSubView: () => AgentMobileSubView,
|
|
34
|
+
AgentRow: () => AgentRow,
|
|
35
|
+
AgentSortPanel: () => AgentSortPanel,
|
|
36
|
+
AgentTagsPanel: () => AgentTagsPanel,
|
|
37
|
+
CheckRow: () => CheckRow,
|
|
38
|
+
FavoriteAgentButton: () => FavoriteAgentButton,
|
|
39
|
+
FilterChip: () => FilterChip,
|
|
40
|
+
HOVER_GRACE_MS: () => HOVER_GRACE_MS,
|
|
41
|
+
LIST_MAX_HEIGHT: () => LIST_MAX_HEIGHT,
|
|
42
|
+
OptionRow: () => OptionRow,
|
|
43
|
+
PANEL_HEIGHT: () => PANEL_HEIGHT,
|
|
44
|
+
SORT_OPTIONS: () => SORT_OPTIONS,
|
|
45
|
+
SearchInput: () => SearchInput,
|
|
46
|
+
SidePanelHeader: () => SidePanelHeader,
|
|
47
|
+
coerceVisibleTab: () => coerceVisibleTab,
|
|
48
|
+
useAgentCatalog: () => useAgentCatalog,
|
|
49
|
+
useAgentCatalogRows: () => useAgentCatalogRows,
|
|
50
|
+
useAgentCatalogState: () => useAgentCatalogState,
|
|
51
|
+
useAgentCatalogUiPorts: () => useAgentCatalogUiPorts,
|
|
52
|
+
useAgentConsumer: () => useAgentConsumer,
|
|
53
|
+
useAgentListCore: () => useAgentListCore
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(react_exports);
|
|
56
|
+
|
|
57
|
+
// catalog/react/context.tsx
|
|
58
|
+
var import_react = require("react");
|
|
59
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
60
|
+
var AgentCatalogContext = (0, import_react.createContext)(null);
|
|
61
|
+
function AgentCatalogProvider({
|
|
62
|
+
catalog,
|
|
63
|
+
children,
|
|
64
|
+
...ports
|
|
65
|
+
}) {
|
|
66
|
+
const value = (0, import_react.useMemo)(
|
|
67
|
+
() => ({ catalog, ...ports }),
|
|
68
|
+
// The ports are plain values a host declares once; re-binding on identity
|
|
69
|
+
// change is correct and cheap.
|
|
70
|
+
[
|
|
71
|
+
catalog,
|
|
72
|
+
ports.navigate,
|
|
73
|
+
ports.LinkComponent,
|
|
74
|
+
ports.renderModelRef,
|
|
75
|
+
ports.openPeek,
|
|
76
|
+
ports.popoverContainer
|
|
77
|
+
]
|
|
78
|
+
);
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentCatalogContext.Provider, { value, children });
|
|
80
|
+
}
|
|
81
|
+
function useBinding() {
|
|
82
|
+
const binding = (0, import_react.useContext)(AgentCatalogContext);
|
|
83
|
+
if (!binding) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
"@ai-matrx/agents/catalog/react: no <AgentCatalogProvider> is mounted above this component. Create the catalog once with createAgentCatalog({ client, identity }) and mount <AgentCatalogProvider catalog={catalog}> at the top of your tree."
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return binding;
|
|
89
|
+
}
|
|
90
|
+
function useAgentCatalog() {
|
|
91
|
+
return useBinding().catalog;
|
|
92
|
+
}
|
|
93
|
+
function useAgentCatalogUiPorts() {
|
|
94
|
+
const binding = useBinding();
|
|
95
|
+
const navigate = (0, import_react.useCallback)(
|
|
96
|
+
(href) => {
|
|
97
|
+
if (binding.navigate) {
|
|
98
|
+
binding.navigate(href);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (typeof window !== "undefined") window.location.assign(href);
|
|
102
|
+
},
|
|
103
|
+
[binding.navigate]
|
|
104
|
+
);
|
|
105
|
+
return {
|
|
106
|
+
navigate,
|
|
107
|
+
LinkComponent: binding.LinkComponent ?? DefaultLink,
|
|
108
|
+
renderModelRef: binding.renderModelRef ?? defaultRenderModelRef,
|
|
109
|
+
openPeek: binding.openPeek,
|
|
110
|
+
popoverContainer: binding.popoverContainer
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
var DefaultLink = ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { ...props, children });
|
|
114
|
+
var defaultRenderModelRef = ({
|
|
115
|
+
modelId,
|
|
116
|
+
className
|
|
117
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className, children: modelId });
|
|
118
|
+
function useAgentCatalogState(select) {
|
|
119
|
+
const catalog = useAgentCatalog();
|
|
120
|
+
const getSnapshot = (0, import_react.useCallback)(
|
|
121
|
+
() => select(catalog.getState()),
|
|
122
|
+
[catalog, select]
|
|
123
|
+
);
|
|
124
|
+
return (0, import_react.useSyncExternalStore)(catalog.subscribe, getSnapshot, getSnapshot);
|
|
125
|
+
}
|
|
126
|
+
function useAgentCatalogRows() {
|
|
127
|
+
return useAgentCatalogState(selectRows);
|
|
128
|
+
}
|
|
129
|
+
var selectRows = (state) => state.rows;
|
|
130
|
+
|
|
131
|
+
// catalog/react/useAgentConsumer.ts
|
|
132
|
+
var import_react2 = require("react");
|
|
133
|
+
|
|
134
|
+
// catalog/types.ts
|
|
135
|
+
function isMandateAgentId(id) {
|
|
136
|
+
return id.startsWith("mandate:");
|
|
137
|
+
}
|
|
138
|
+
var AGENT_NONE_SENTINEL = "__none__";
|
|
139
|
+
var DEFAULT_AGENT_CONSUMER_STATE = {
|
|
140
|
+
tab: "mine",
|
|
141
|
+
sortBy: "updated-desc",
|
|
142
|
+
searchTerm: "",
|
|
143
|
+
includedCats: [],
|
|
144
|
+
includedTags: [],
|
|
145
|
+
favFilter: "all",
|
|
146
|
+
archFilter: "active",
|
|
147
|
+
accessFilter: "any",
|
|
148
|
+
favoritesFirst: true,
|
|
149
|
+
listPage: 1,
|
|
150
|
+
sharedPage: 1,
|
|
151
|
+
serverMatchedIds: [],
|
|
152
|
+
isServerSearching: false,
|
|
153
|
+
deepSearch: false
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// catalog/react/useAgentConsumer.ts
|
|
157
|
+
var DEBOUNCE_MS = 250;
|
|
158
|
+
var MIN_QUERY_LENGTH = 2;
|
|
159
|
+
function useAgentConsumer(consumerId, options) {
|
|
160
|
+
const catalog = useAgentCatalog();
|
|
161
|
+
const selectConsumer = (0, import_react2.useCallback)(
|
|
162
|
+
(state) => state.consumers[consumerId] ?? DEFAULT_AGENT_CONSUMER_STATE,
|
|
163
|
+
[consumerId]
|
|
164
|
+
);
|
|
165
|
+
const consumer = useAgentCatalogState(selectConsumer);
|
|
166
|
+
const optionsRef = (0, import_react2.useRef)(options);
|
|
167
|
+
optionsRef.current = options;
|
|
168
|
+
(0, import_react2.useEffect)(() => {
|
|
169
|
+
const opts = optionsRef.current;
|
|
170
|
+
catalog.registerConsumer(
|
|
171
|
+
consumerId,
|
|
172
|
+
opts?.initialTab ? { tab: opts.initialTab } : void 0
|
|
173
|
+
);
|
|
174
|
+
return () => {
|
|
175
|
+
if (optionsRef.current?.unregisterOnUnmount) {
|
|
176
|
+
catalog.unregisterConsumer(consumerId);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}, [consumerId, catalog]);
|
|
180
|
+
const setSearchTerm = (0, import_react2.useCallback)(
|
|
181
|
+
(value) => catalog.setConsumerFilter(consumerId, { searchTerm: value }),
|
|
182
|
+
[consumerId, catalog]
|
|
183
|
+
);
|
|
184
|
+
const setDeepSearch = (0, import_react2.useCallback)(
|
|
185
|
+
(value) => catalog.setConsumerFilter(consumerId, { deepSearch: value }),
|
|
186
|
+
[consumerId, catalog]
|
|
187
|
+
);
|
|
188
|
+
const setSortBy = (0, import_react2.useCallback)(
|
|
189
|
+
(value) => catalog.setConsumerFilter(consumerId, { sortBy: value }),
|
|
190
|
+
[consumerId, catalog]
|
|
191
|
+
);
|
|
192
|
+
const setTab = (0, import_react2.useCallback)(
|
|
193
|
+
(value) => catalog.setConsumerFilter(consumerId, { tab: value }),
|
|
194
|
+
[consumerId, catalog]
|
|
195
|
+
);
|
|
196
|
+
const setFavFilter = (0, import_react2.useCallback)(
|
|
197
|
+
(value) => catalog.setConsumerFilter(consumerId, { favFilter: value }),
|
|
198
|
+
[consumerId, catalog]
|
|
199
|
+
);
|
|
200
|
+
const setArchFilter = (0, import_react2.useCallback)(
|
|
201
|
+
(value) => catalog.setConsumerFilter(consumerId, { archFilter: value }),
|
|
202
|
+
[consumerId, catalog]
|
|
203
|
+
);
|
|
204
|
+
const setAccessFilter = (0, import_react2.useCallback)(
|
|
205
|
+
(value) => catalog.setConsumerFilter(consumerId, { accessFilter: value }),
|
|
206
|
+
[consumerId, catalog]
|
|
207
|
+
);
|
|
208
|
+
const toggleCategory = (0, import_react2.useCallback)(
|
|
209
|
+
(cat) => {
|
|
210
|
+
const current = catalog.getConsumer(consumerId).includedCats;
|
|
211
|
+
const next = current.includes(cat) ? current.filter((c) => c !== cat) : [...current, cat];
|
|
212
|
+
catalog.setConsumerFilter(consumerId, { includedCats: next });
|
|
213
|
+
},
|
|
214
|
+
[consumerId, catalog]
|
|
215
|
+
);
|
|
216
|
+
const toggleTag = (0, import_react2.useCallback)(
|
|
217
|
+
(tag) => {
|
|
218
|
+
const current = catalog.getConsumer(consumerId).includedTags;
|
|
219
|
+
const next = current.includes(tag) ? current.filter((t) => t !== tag) : [...current, tag];
|
|
220
|
+
catalog.setConsumerFilter(consumerId, { includedTags: next });
|
|
221
|
+
},
|
|
222
|
+
[consumerId, catalog]
|
|
223
|
+
);
|
|
224
|
+
const setIncludedCats = (0, import_react2.useCallback)(
|
|
225
|
+
(next) => catalog.setConsumerFilter(consumerId, { includedCats: next }),
|
|
226
|
+
[consumerId, catalog]
|
|
227
|
+
);
|
|
228
|
+
const setIncludedTags = (0, import_react2.useCallback)(
|
|
229
|
+
(next) => catalog.setConsumerFilter(consumerId, { includedTags: next }),
|
|
230
|
+
[consumerId, catalog]
|
|
231
|
+
);
|
|
232
|
+
const toggleFavoritesFirst = (0, import_react2.useCallback)(
|
|
233
|
+
() => catalog.setConsumerFilter(consumerId, {
|
|
234
|
+
favoritesFirst: !catalog.getConsumer(consumerId).favoritesFirst
|
|
235
|
+
}),
|
|
236
|
+
[consumerId, catalog]
|
|
237
|
+
);
|
|
238
|
+
const loadMoreList = (0, import_react2.useCallback)(
|
|
239
|
+
() => catalog.setConsumerPage(
|
|
240
|
+
consumerId,
|
|
241
|
+
"list",
|
|
242
|
+
catalog.getConsumer(consumerId).listPage + 1
|
|
243
|
+
),
|
|
244
|
+
[consumerId, catalog]
|
|
245
|
+
);
|
|
246
|
+
const loadMoreShared = (0, import_react2.useCallback)(
|
|
247
|
+
() => catalog.setConsumerPage(
|
|
248
|
+
consumerId,
|
|
249
|
+
"shared",
|
|
250
|
+
catalog.getConsumer(consumerId).sharedPage + 1
|
|
251
|
+
),
|
|
252
|
+
[consumerId, catalog]
|
|
253
|
+
);
|
|
254
|
+
const resetFilters = (0, import_react2.useCallback)(
|
|
255
|
+
() => catalog.resetConsumerFilters(consumerId),
|
|
256
|
+
[consumerId, catalog]
|
|
257
|
+
);
|
|
258
|
+
const [isSearching, setIsSearching] = (0, import_react2.useState)(false);
|
|
259
|
+
const [matchedIds, setMatchedIds] = (0, import_react2.useState)(null);
|
|
260
|
+
const requestSeq = (0, import_react2.useRef)(0);
|
|
261
|
+
const query = consumer.searchTerm;
|
|
262
|
+
const deep = consumer.deepSearch;
|
|
263
|
+
(0, import_react2.useEffect)(() => {
|
|
264
|
+
const q = query.trim();
|
|
265
|
+
if (q.length < MIN_QUERY_LENGTH) {
|
|
266
|
+
setIsSearching(false);
|
|
267
|
+
setMatchedIds(null);
|
|
268
|
+
return void 0;
|
|
269
|
+
}
|
|
270
|
+
const seq = ++requestSeq.current;
|
|
271
|
+
setIsSearching(true);
|
|
272
|
+
const timer = setTimeout(() => {
|
|
273
|
+
void catalog.searchServer(q, deep).then((ids) => {
|
|
274
|
+
if (seq !== requestSeq.current) return;
|
|
275
|
+
setMatchedIds(ids);
|
|
276
|
+
setIsSearching(false);
|
|
277
|
+
}).catch((e) => {
|
|
278
|
+
if (seq !== requestSeq.current) return;
|
|
279
|
+
catalog.errorSink({
|
|
280
|
+
code: "server_search_failed",
|
|
281
|
+
message: `agent search failed: ${e instanceof Error ? e.message : String(e)}`,
|
|
282
|
+
context: { query: q, deep }
|
|
283
|
+
});
|
|
284
|
+
setIsSearching(false);
|
|
285
|
+
});
|
|
286
|
+
}, DEBOUNCE_MS);
|
|
287
|
+
return () => clearTimeout(timer);
|
|
288
|
+
}, [query, deep, catalog]);
|
|
289
|
+
(0, import_react2.useEffect)(() => {
|
|
290
|
+
catalog.setConsumerServerSearch(consumerId, {
|
|
291
|
+
matchedIds: matchedIds ?? [],
|
|
292
|
+
isSearching
|
|
293
|
+
});
|
|
294
|
+
}, [consumerId, catalog, matchedIds, isSearching]);
|
|
295
|
+
const hasActiveFilters = consumer.searchTerm !== "" || consumer.includedCats.length > 0 || consumer.includedTags.length > 0 || consumer.favFilter !== "all" || consumer.archFilter !== "active" || consumer.accessFilter !== "any" || !consumer.favoritesFirst;
|
|
296
|
+
return {
|
|
297
|
+
tab: consumer.tab,
|
|
298
|
+
sortBy: consumer.sortBy,
|
|
299
|
+
searchTerm: consumer.searchTerm,
|
|
300
|
+
includedCats: consumer.includedCats,
|
|
301
|
+
includedTags: consumer.includedTags,
|
|
302
|
+
favFilter: consumer.favFilter,
|
|
303
|
+
archFilter: consumer.archFilter,
|
|
304
|
+
accessFilter: consumer.accessFilter,
|
|
305
|
+
favoritesFirst: consumer.favoritesFirst,
|
|
306
|
+
listPage: consumer.listPage,
|
|
307
|
+
sharedPage: consumer.sharedPage,
|
|
308
|
+
state: consumer,
|
|
309
|
+
hasActiveFilters,
|
|
310
|
+
deepSearch: consumer.deepSearch,
|
|
311
|
+
isServerSearching: consumer.isServerSearching,
|
|
312
|
+
setSearchTerm,
|
|
313
|
+
setDeepSearch,
|
|
314
|
+
setSortBy,
|
|
315
|
+
setTab,
|
|
316
|
+
setFavFilter,
|
|
317
|
+
setArchFilter,
|
|
318
|
+
setAccessFilter,
|
|
319
|
+
toggleCategory,
|
|
320
|
+
toggleTag,
|
|
321
|
+
setIncludedCats,
|
|
322
|
+
setIncludedTags,
|
|
323
|
+
toggleFavoritesFirst,
|
|
324
|
+
loadMoreList,
|
|
325
|
+
loadMoreShared,
|
|
326
|
+
resetFilters
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// catalog/react/useAgentListCore.ts
|
|
331
|
+
var import_react3 = require("react");
|
|
332
|
+
|
|
333
|
+
// catalog/labels.ts
|
|
334
|
+
function agentListEmptyLabel(tab, labels) {
|
|
335
|
+
switch (tab) {
|
|
336
|
+
case "system":
|
|
337
|
+
return labels.emptySystem;
|
|
338
|
+
case "shared":
|
|
339
|
+
return labels.emptyShared;
|
|
340
|
+
default:
|
|
341
|
+
return labels.emptyDefault;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function shouldDefaultAgentListToPublicTab(args) {
|
|
345
|
+
if (!args.userId) return true;
|
|
346
|
+
if (!args.agentsLoaded) return false;
|
|
347
|
+
return args.ownedCount === 0;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// catalog/score.ts
|
|
351
|
+
function computeAgentSearchScore(agent, query) {
|
|
352
|
+
const q = query.trim().toLowerCase();
|
|
353
|
+
if (!q) return 0;
|
|
354
|
+
let score = 0;
|
|
355
|
+
const name = (agent.name ?? "").toLowerCase();
|
|
356
|
+
const desc = (agent.description ?? "").toLowerCase();
|
|
357
|
+
if (name === q) score += 1e4;
|
|
358
|
+
else if (name.startsWith(q)) score += 5e3;
|
|
359
|
+
else if (matchesWholeWord(name, q)) score += 3e3;
|
|
360
|
+
else if (name.includes(q)) score += 2e3;
|
|
361
|
+
if (desc === q) score += 1e3;
|
|
362
|
+
else if (desc.includes(q)) score += 500;
|
|
363
|
+
if (agent.category?.toLowerCase().includes(q)) score += 300;
|
|
364
|
+
if (agent.tags?.some((t) => t.toLowerCase().includes(q))) score += 300;
|
|
365
|
+
if (agent.modelId?.toLowerCase().includes(q)) score += 100;
|
|
366
|
+
if (agent.agentType?.toLowerCase().includes(q)) score += 100;
|
|
367
|
+
if (agent.outputFormat?.toLowerCase().includes(q)) score += 100;
|
|
368
|
+
const id = agent.id.toLowerCase();
|
|
369
|
+
if (id === q) score += 1e5;
|
|
370
|
+
else if (id.includes(q)) score += 5e3;
|
|
371
|
+
if (agent.sharedByEmail?.toLowerCase().includes(q)) score += 200;
|
|
372
|
+
if (score === 0 && q.includes(" ")) {
|
|
373
|
+
const terms = q.split(/\s+/).filter(Boolean);
|
|
374
|
+
let hits = 0;
|
|
375
|
+
let termScore = 0;
|
|
376
|
+
for (const term of terms) {
|
|
377
|
+
const inName = name.includes(term);
|
|
378
|
+
const matched = inName || desc.includes(term) || (agent.category?.toLowerCase().includes(term) ?? false) || (agent.tags?.some((t) => t.toLowerCase().includes(term)) ?? false);
|
|
379
|
+
if (matched) {
|
|
380
|
+
hits += 1;
|
|
381
|
+
termScore += inName ? 400 : 100;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (hits === terms.length) score += termScore;
|
|
385
|
+
}
|
|
386
|
+
return score;
|
|
387
|
+
}
|
|
388
|
+
function matchesWholeWord(haystack, q) {
|
|
389
|
+
const escaped = q.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
390
|
+
return new RegExp(`\\b${escaped}\\b`).test(haystack);
|
|
391
|
+
}
|
|
392
|
+
function agentMatchesSearch(agent, query) {
|
|
393
|
+
return computeAgentSearchScore(agent, query) > 0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// catalog/selectors.ts
|
|
397
|
+
function memoize1(fn) {
|
|
398
|
+
let lastA;
|
|
399
|
+
let last;
|
|
400
|
+
let has = false;
|
|
401
|
+
return (a) => {
|
|
402
|
+
if (!has || lastA !== a) {
|
|
403
|
+
last = fn(a);
|
|
404
|
+
lastA = a;
|
|
405
|
+
has = true;
|
|
406
|
+
}
|
|
407
|
+
return last;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function memoize2(fn) {
|
|
411
|
+
let lastA;
|
|
412
|
+
let lastB;
|
|
413
|
+
let last;
|
|
414
|
+
let has = false;
|
|
415
|
+
return (a, b) => {
|
|
416
|
+
if (!has || lastA !== a || lastB !== b) {
|
|
417
|
+
last = fn(a, b);
|
|
418
|
+
lastA = a;
|
|
419
|
+
lastB = b;
|
|
420
|
+
has = true;
|
|
421
|
+
}
|
|
422
|
+
return last;
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function applyAgentSortComparator(a, b, sortBy) {
|
|
426
|
+
switch (sortBy) {
|
|
427
|
+
case "name-asc":
|
|
428
|
+
return (a.name ?? "").localeCompare(b.name ?? "");
|
|
429
|
+
case "name-desc":
|
|
430
|
+
return (b.name ?? "").localeCompare(a.name ?? "");
|
|
431
|
+
case "created-desc":
|
|
432
|
+
return +new Date(b.createdAt ?? 0) - +new Date(a.createdAt ?? 0);
|
|
433
|
+
case "category-asc":
|
|
434
|
+
return (a.category ?? "").localeCompare(b.category ?? "");
|
|
435
|
+
case "updated-desc":
|
|
436
|
+
default:
|
|
437
|
+
return +new Date(b.updatedAt ?? 0) - +new Date(a.updatedAt ?? 0);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
var selectAllAgentCategories = memoize1(
|
|
441
|
+
(agents) => {
|
|
442
|
+
const cats = /* @__PURE__ */ new Set();
|
|
443
|
+
for (const a of agents) {
|
|
444
|
+
if (a.agentType === "user" && a.category) cats.add(a.category);
|
|
445
|
+
}
|
|
446
|
+
return Array.from(cats).sort();
|
|
447
|
+
}
|
|
448
|
+
);
|
|
449
|
+
var selectAllSystemAgentCategories = memoize1(
|
|
450
|
+
(agents) => {
|
|
451
|
+
const cats = /* @__PURE__ */ new Set();
|
|
452
|
+
for (const a of agents) {
|
|
453
|
+
if (a.agentType === "builtin" && a.category) cats.add(a.category);
|
|
454
|
+
}
|
|
455
|
+
return Array.from(cats).sort();
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
var selectAllAgentTags = memoize1(
|
|
459
|
+
(agents) => {
|
|
460
|
+
const tags = /* @__PURE__ */ new Set();
|
|
461
|
+
for (const a of agents) {
|
|
462
|
+
if (a.agentType === "user") a.tags?.forEach((t) => tags.add(t));
|
|
463
|
+
}
|
|
464
|
+
return Array.from(tags).sort();
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
var selectAllSystemAgentTags = memoize1(
|
|
468
|
+
(agents) => {
|
|
469
|
+
const tags = /* @__PURE__ */ new Set();
|
|
470
|
+
for (const a of agents) {
|
|
471
|
+
if (a.agentType === "builtin") a.tags?.forEach((t) => tags.add(t));
|
|
472
|
+
}
|
|
473
|
+
return Array.from(tags).sort();
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
var selectUserTypeAgents = memoize1(
|
|
477
|
+
(agents) => agents.filter((a) => a.agentType === "user")
|
|
478
|
+
);
|
|
479
|
+
var selectBuiltinTypeAgents = memoize1(
|
|
480
|
+
(agents) => agents.filter((a) => a.agentType === "builtin")
|
|
481
|
+
);
|
|
482
|
+
function sortFilteredAgents(filtered, consumer) {
|
|
483
|
+
const { searchTerm, sortBy, favFilter, favoritesFirst } = consumer;
|
|
484
|
+
if (searchTerm) {
|
|
485
|
+
const scores = /* @__PURE__ */ new Map();
|
|
486
|
+
filtered.forEach((a) => {
|
|
487
|
+
scores.set(a.id, computeAgentSearchScore(a, searchTerm));
|
|
488
|
+
});
|
|
489
|
+
const serverRank = /* @__PURE__ */ new Map();
|
|
490
|
+
consumer.serverMatchedIds.forEach((id, i) => serverRank.set(id, i));
|
|
491
|
+
return [...filtered].sort((a, b) => {
|
|
492
|
+
const sa = scores.get(a.id) ?? 0;
|
|
493
|
+
const sb = scores.get(b.id) ?? 0;
|
|
494
|
+
if (sb !== sa) return sb - sa;
|
|
495
|
+
if (sa === 0) {
|
|
496
|
+
const ra = serverRank.get(a.id);
|
|
497
|
+
const rb = serverRank.get(b.id);
|
|
498
|
+
if (ra !== void 0 && rb !== void 0 && ra !== rb) return ra - rb;
|
|
499
|
+
}
|
|
500
|
+
return applyAgentSortComparator(a, b, sortBy);
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
return [...filtered].sort((a, b) => {
|
|
504
|
+
if (favoritesFirst && favFilter === "all") {
|
|
505
|
+
const aFav = a.isFavorite ? 1 : 0;
|
|
506
|
+
const bFav = b.isFavorite ? 1 : 0;
|
|
507
|
+
if (bFav !== aFav) return bFav - aFav;
|
|
508
|
+
}
|
|
509
|
+
return applyAgentSortComparator(a, b, sortBy);
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
function filterUserTypeAgents(agents, consumer) {
|
|
513
|
+
const {
|
|
514
|
+
searchTerm,
|
|
515
|
+
includedCats,
|
|
516
|
+
includedTags,
|
|
517
|
+
favFilter,
|
|
518
|
+
archFilter,
|
|
519
|
+
accessFilter,
|
|
520
|
+
tab
|
|
521
|
+
} = consumer;
|
|
522
|
+
const serverMatched = new Set(consumer.serverMatchedIds);
|
|
523
|
+
const filtered = agents.filter((agent) => {
|
|
524
|
+
if (tab === "mine" && agent.isOwner !== true) return false;
|
|
525
|
+
if (tab === "shared" && !(agent.isOwner === false && agent.accessLevel != null))
|
|
526
|
+
return false;
|
|
527
|
+
if (archFilter === "active" && agent.isArchived) return false;
|
|
528
|
+
if (archFilter === "archived" && !agent.isArchived) return false;
|
|
529
|
+
if (favFilter === "yes" && !agent.isFavorite) return false;
|
|
530
|
+
if (favFilter === "no" && agent.isFavorite) return false;
|
|
531
|
+
if (accessFilter === "owned" && agent.isOwner !== true) return false;
|
|
532
|
+
if (accessFilter === "shared" && agent.isOwner !== false) return false;
|
|
533
|
+
if (accessFilter === "editable" && agent.accessLevel !== "owner" && agent.accessLevel !== "admin" && agent.accessLevel !== "editor")
|
|
534
|
+
return false;
|
|
535
|
+
if (includedCats.length > 0) {
|
|
536
|
+
const category = agent.category;
|
|
537
|
+
if (!category) {
|
|
538
|
+
if (!includedCats.includes(AGENT_NONE_SENTINEL)) return false;
|
|
539
|
+
} else if (!includedCats.includes(category)) {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (includedTags.length > 0) {
|
|
544
|
+
const isUntagged = !agent.tags?.length;
|
|
545
|
+
if (isUntagged) {
|
|
546
|
+
if (!includedTags.includes(AGENT_NONE_SENTINEL)) return false;
|
|
547
|
+
} else if (!agent.tags?.some((t) => includedTags.includes(t))) {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (searchTerm && !agentMatchesSearch(agent, searchTerm) && !serverMatched.has(agent.id))
|
|
552
|
+
return false;
|
|
553
|
+
return true;
|
|
554
|
+
});
|
|
555
|
+
return sortFilteredAgents(filtered, consumer);
|
|
556
|
+
}
|
|
557
|
+
function filterBuiltinTypeAgents(agents, consumer) {
|
|
558
|
+
const { searchTerm, favFilter, includedCats, includedTags } = consumer;
|
|
559
|
+
const serverMatched = new Set(consumer.serverMatchedIds);
|
|
560
|
+
const filtered = agents.filter((agent) => {
|
|
561
|
+
if (favFilter === "yes" && !agent.isFavorite) return false;
|
|
562
|
+
if (favFilter === "no" && agent.isFavorite) return false;
|
|
563
|
+
if (includedCats.length > 0) {
|
|
564
|
+
const category = agent.category;
|
|
565
|
+
if (!category) {
|
|
566
|
+
if (!includedCats.includes(AGENT_NONE_SENTINEL)) return false;
|
|
567
|
+
} else if (!includedCats.includes(category)) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
if (includedTags.length > 0) {
|
|
572
|
+
const isUntagged = !agent.tags?.length;
|
|
573
|
+
if (isUntagged) {
|
|
574
|
+
if (!includedTags.includes(AGENT_NONE_SENTINEL)) return false;
|
|
575
|
+
} else if (!agent.tags?.some((t) => includedTags.includes(t))) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (searchTerm && !agentMatchesSearch(agent, searchTerm) && !serverMatched.has(agent.id))
|
|
580
|
+
return false;
|
|
581
|
+
return true;
|
|
582
|
+
});
|
|
583
|
+
return sortFilteredAgents(filtered, consumer);
|
|
584
|
+
}
|
|
585
|
+
var makeSelectFilteredAgents = (includeSystemInAll = false) => memoize2(
|
|
586
|
+
(agents, consumer) => {
|
|
587
|
+
const userAgents = selectUserTypeAgents(agents);
|
|
588
|
+
const builtinAgents = selectBuiltinTypeAgents(agents);
|
|
589
|
+
if (consumer.tab === "system") {
|
|
590
|
+
return filterBuiltinTypeAgents(builtinAgents, consumer);
|
|
591
|
+
}
|
|
592
|
+
if (includeSystemInAll && consumer.tab === "all") {
|
|
593
|
+
return [
|
|
594
|
+
...filterUserTypeAgents(userAgents, consumer),
|
|
595
|
+
...filterBuiltinTypeAgents(builtinAgents, consumer)
|
|
596
|
+
];
|
|
597
|
+
}
|
|
598
|
+
return filterUserTypeAgents(userAgents, consumer);
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
var selectTotalUserAgentsCount = memoize1(
|
|
602
|
+
(agents) => selectUserTypeAgents(agents).length
|
|
603
|
+
);
|
|
604
|
+
var selectTotalOwnedAgentsCount = memoize1(
|
|
605
|
+
(agents) => selectUserTypeAgents(agents).filter((a) => a.isOwner === true).length
|
|
606
|
+
);
|
|
607
|
+
var selectTotalSharedAgentsCount = memoize1(
|
|
608
|
+
(agents) => selectUserTypeAgents(agents).filter(
|
|
609
|
+
(a) => a.isOwner === false && a.accessLevel != null
|
|
610
|
+
).length
|
|
611
|
+
);
|
|
612
|
+
var selectTotalBuiltinAgentsCount = memoize1(
|
|
613
|
+
(agents) => selectBuiltinTypeAgents(agents).length
|
|
614
|
+
);
|
|
615
|
+
var selectTotalFavoriteAgentsCount = memoize1(
|
|
616
|
+
(agents) => selectUserTypeAgents(agents).filter((a) => a.isFavorite).length
|
|
617
|
+
);
|
|
618
|
+
|
|
619
|
+
// catalog/react/useAgentListCore.ts
|
|
620
|
+
var HOVER_GRACE_MS = 900;
|
|
621
|
+
function coerceVisibleTab(current, allowed, initialTab) {
|
|
622
|
+
if (allowed.length === 0) return null;
|
|
623
|
+
if (allowed.includes(current)) return null;
|
|
624
|
+
return initialTab && allowed.includes(initialTab) ? initialTab : allowed[0] ?? null;
|
|
625
|
+
}
|
|
626
|
+
var EMPTY_EXCLUDES = [];
|
|
627
|
+
function useAgentListCore({
|
|
628
|
+
consumerId,
|
|
629
|
+
onSelect,
|
|
630
|
+
navigateTo,
|
|
631
|
+
activeAgentIdOverride,
|
|
632
|
+
initialTab,
|
|
633
|
+
includeSystemInAll = false,
|
|
634
|
+
visibleTabs,
|
|
635
|
+
excludeAgentIds = EMPTY_EXCLUDES,
|
|
636
|
+
defaultMandateKey
|
|
637
|
+
}) {
|
|
638
|
+
const catalog = useAgentCatalog();
|
|
639
|
+
const { navigate } = useAgentCatalogUiPorts();
|
|
640
|
+
const hasFetchedRef = (0, import_react3.useRef)(false);
|
|
641
|
+
const [hoveredAgent, setHoveredAgent] = (0, import_react3.useState)(null);
|
|
642
|
+
const hoverLeaveTimerRef = (0, import_react3.useRef)(null);
|
|
643
|
+
const defaultTabAppliedRef = (0, import_react3.useRef)(false);
|
|
644
|
+
const consumer = useAgentConsumer(consumerId, { unregisterOnUnmount: true });
|
|
645
|
+
const rows = useAgentCatalogRows();
|
|
646
|
+
const userId = catalog.getUserIdOrNull();
|
|
647
|
+
const ownedCount = selectTotalOwnedAgentsCount(rows);
|
|
648
|
+
const selectFiltered = (0, import_react3.useMemo)(
|
|
649
|
+
() => makeSelectFilteredAgents(includeSystemInAll),
|
|
650
|
+
[includeSystemInAll]
|
|
651
|
+
);
|
|
652
|
+
const filteredAgents = selectFiltered(rows, consumer.state);
|
|
653
|
+
const excludedAgentIds = (0, import_react3.useMemo)(
|
|
654
|
+
() => new Set(excludeAgentIds),
|
|
655
|
+
[excludeAgentIds]
|
|
656
|
+
);
|
|
657
|
+
const agents = excludedAgentIds.size === 0 ? filteredAgents : filteredAgents.filter((agent) => !excludedAgentIds.has(agent.id));
|
|
658
|
+
const status = useAgentCatalogState(selectStatus);
|
|
659
|
+
const activeAgentId = activeAgentIdOverride ?? null;
|
|
660
|
+
const pinnedAgent = activeAgentId ? catalog.getAgent(activeAgentId) : void 0;
|
|
661
|
+
const onSystemTab = consumer.tab === "system";
|
|
662
|
+
const allCategories = onSystemTab ? selectAllSystemAgentCategories(rows) : selectAllAgentCategories(rows);
|
|
663
|
+
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
|
+
};
|
|
670
|
+
const isLoading = status === "loading";
|
|
671
|
+
const agentsLoaded = status === "succeeded" || status === "failed";
|
|
672
|
+
const ensureLoaded = (0, import_react3.useCallback)(() => {
|
|
673
|
+
if (!hasFetchedRef.current) {
|
|
674
|
+
hasFetchedRef.current = true;
|
|
675
|
+
void catalog.ensureLoaded().catch(() => {
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
}, [catalog]);
|
|
679
|
+
const selectDefaultRow = (0, import_react3.useCallback)(
|
|
680
|
+
(state) => defaultMandateKey ? state.defaultRows[defaultMandateKey] : void 0,
|
|
681
|
+
[defaultMandateKey]
|
|
682
|
+
);
|
|
683
|
+
const defaultRow = useAgentCatalogState(selectDefaultRow);
|
|
684
|
+
(0, import_react3.useEffect)(() => {
|
|
685
|
+
if (!defaultMandateKey) return;
|
|
686
|
+
catalog.ensureDefaultRow(defaultMandateKey);
|
|
687
|
+
}, [catalog, defaultMandateKey]);
|
|
688
|
+
(0, import_react3.useEffect)(() => {
|
|
689
|
+
if (defaultTabAppliedRef.current) return;
|
|
690
|
+
if (initialTab) {
|
|
691
|
+
defaultTabAppliedRef.current = true;
|
|
692
|
+
if (consumer.tab !== initialTab) consumer.setTab(initialTab);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
if (consumer.tab !== "mine") {
|
|
696
|
+
defaultTabAppliedRef.current = true;
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const wantsPublic = shouldDefaultAgentListToPublicTab({
|
|
700
|
+
userId,
|
|
701
|
+
ownedCount,
|
|
702
|
+
agentsLoaded
|
|
703
|
+
});
|
|
704
|
+
if (!wantsPublic) {
|
|
705
|
+
if (!userId || agentsLoaded) {
|
|
706
|
+
defaultTabAppliedRef.current = true;
|
|
707
|
+
}
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
consumer.setTab("system");
|
|
711
|
+
defaultTabAppliedRef.current = true;
|
|
712
|
+
}, [
|
|
713
|
+
userId,
|
|
714
|
+
ownedCount,
|
|
715
|
+
agentsLoaded,
|
|
716
|
+
initialTab,
|
|
717
|
+
consumer.tab,
|
|
718
|
+
consumer.setTab
|
|
719
|
+
]);
|
|
720
|
+
const allowedTabsKey = visibleTabs ? visibleTabs.join(",") : "";
|
|
721
|
+
(0, import_react3.useEffect)(() => {
|
|
722
|
+
if (!allowedTabsKey) return;
|
|
723
|
+
const next = coerceVisibleTab(
|
|
724
|
+
consumer.tab,
|
|
725
|
+
allowedTabsKey.split(","),
|
|
726
|
+
initialTab
|
|
727
|
+
);
|
|
728
|
+
if (next) consumer.setTab(next);
|
|
729
|
+
}, [allowedTabsKey, initialTab, consumer.tab, consumer.setTab]);
|
|
730
|
+
(0, import_react3.useEffect)(() => {
|
|
731
|
+
ensureLoaded();
|
|
732
|
+
}, [ensureLoaded]);
|
|
733
|
+
const handleSelectAgent = (0, import_react3.useCallback)(
|
|
734
|
+
(agent) => {
|
|
735
|
+
if (onSelect) {
|
|
736
|
+
onSelect(agent.id);
|
|
737
|
+
} else if (navigateTo) {
|
|
738
|
+
navigate(navigateTo.replace("{id}", agent.id));
|
|
739
|
+
} else {
|
|
740
|
+
catalog.errorSink({
|
|
741
|
+
code: "select_has_nowhere_to_go",
|
|
742
|
+
message: "an agent was chosen but this picker was given neither onSelect nor navigateTo, so the choice went nowhere.",
|
|
743
|
+
context: { consumerId, agentId: agent.id }
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
[onSelect, navigateTo, navigate, catalog, consumerId]
|
|
748
|
+
);
|
|
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);
|
|
750
|
+
const handleAgentHover = (0, import_react3.useCallback)(
|
|
751
|
+
(agent, panelOpen) => {
|
|
752
|
+
if (panelOpen) return;
|
|
753
|
+
if (hoverLeaveTimerRef.current) {
|
|
754
|
+
clearTimeout(hoverLeaveTimerRef.current);
|
|
755
|
+
hoverLeaveTimerRef.current = null;
|
|
756
|
+
}
|
|
757
|
+
setHoveredAgent(agent);
|
|
758
|
+
},
|
|
759
|
+
[]
|
|
760
|
+
);
|
|
761
|
+
const handleAgentHoverEnd = (0, import_react3.useCallback)(
|
|
762
|
+
(agent, onClear) => {
|
|
763
|
+
if (hoveredAgent?.id === agent.id) {
|
|
764
|
+
hoverLeaveTimerRef.current = setTimeout(() => {
|
|
765
|
+
setHoveredAgent(null);
|
|
766
|
+
onClear();
|
|
767
|
+
}, HOVER_GRACE_MS);
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
[hoveredAgent]
|
|
771
|
+
);
|
|
772
|
+
const handleDetailPanelMouseEnter = (0, import_react3.useCallback)(() => {
|
|
773
|
+
if (hoverLeaveTimerRef.current) {
|
|
774
|
+
clearTimeout(hoverLeaveTimerRef.current);
|
|
775
|
+
hoverLeaveTimerRef.current = null;
|
|
776
|
+
}
|
|
777
|
+
}, []);
|
|
778
|
+
const handleDetailPanelMouseLeave = (0, import_react3.useCallback)((onClear) => {
|
|
779
|
+
hoverLeaveTimerRef.current = setTimeout(() => {
|
|
780
|
+
setHoveredAgent(null);
|
|
781
|
+
onClear();
|
|
782
|
+
}, HOVER_GRACE_MS);
|
|
783
|
+
}, []);
|
|
784
|
+
(0, import_react3.useEffect)(
|
|
785
|
+
() => () => {
|
|
786
|
+
if (hoverLeaveTimerRef.current) clearTimeout(hoverLeaveTimerRef.current);
|
|
787
|
+
},
|
|
788
|
+
[]
|
|
789
|
+
);
|
|
790
|
+
return {
|
|
791
|
+
agents,
|
|
792
|
+
isLoading,
|
|
793
|
+
activeAgentId,
|
|
794
|
+
pinnedAgent: pinnedAgent ?? null,
|
|
795
|
+
defaultRow: defaultRow ?? null,
|
|
796
|
+
allCategories,
|
|
797
|
+
allTags,
|
|
798
|
+
consumer,
|
|
799
|
+
tabCounts,
|
|
800
|
+
activeFilterCount,
|
|
801
|
+
hoveredAgent,
|
|
802
|
+
setHoveredAgent,
|
|
803
|
+
ensureLoaded,
|
|
804
|
+
handleSelectAgent,
|
|
805
|
+
handleAgentHover,
|
|
806
|
+
handleAgentHoverEnd,
|
|
807
|
+
handleDetailPanelMouseEnter,
|
|
808
|
+
handleDetailPanelMouseLeave
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
var selectStatus = (state) => state.status;
|
|
812
|
+
|
|
813
|
+
// catalog/react/AgentListDropdown.tsx
|
|
814
|
+
var import_design_system6 = require("@ai-matrx/design-system");
|
|
815
|
+
var import_react6 = require("react");
|
|
816
|
+
|
|
817
|
+
// catalog/react/primitives.tsx
|
|
818
|
+
var import_design_system = require("@ai-matrx/design-system");
|
|
819
|
+
|
|
820
|
+
// catalog/react/icons.tsx
|
|
821
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
822
|
+
function Svg({ children, ...props }) {
|
|
823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
824
|
+
"svg",
|
|
825
|
+
{
|
|
826
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
827
|
+
viewBox: "0 0 24 24",
|
|
828
|
+
fill: "none",
|
|
829
|
+
stroke: "currentColor",
|
|
830
|
+
strokeWidth: 2,
|
|
831
|
+
strokeLinecap: "round",
|
|
832
|
+
strokeLinejoin: "round",
|
|
833
|
+
"aria-hidden": "true",
|
|
834
|
+
...props,
|
|
835
|
+
children
|
|
836
|
+
}
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
function StarIcon({
|
|
840
|
+
filled = false,
|
|
841
|
+
...props
|
|
842
|
+
}) {
|
|
843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, fill: filled ? "currentColor" : "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M11.5 3.2a.6.6 0 0 1 1 0l2.3 4.7 5.2.8a.6.6 0 0 1 .3 1l-3.8 3.7.9 5.2a.6.6 0 0 1-.9.6L12 16.8l-4.6 2.4a.6.6 0 0 1-.9-.6l.9-5.2-3.8-3.7a.6.6 0 0 1 .3-1l5.2-.8Z" }) });
|
|
844
|
+
}
|
|
845
|
+
function ChevronRightIcon(props) {
|
|
846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 18 6-6-6-6" }) });
|
|
847
|
+
}
|
|
848
|
+
function ChevronDownIcon(props) {
|
|
849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 9 6 6 6-6" }) });
|
|
850
|
+
}
|
|
851
|
+
function SearchIcon(props) {
|
|
852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21 21-4.3-4.3" })
|
|
855
|
+
] });
|
|
856
|
+
}
|
|
857
|
+
function XIcon(props) {
|
|
858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18 6 6 18" }),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 6 12 12" })
|
|
861
|
+
] });
|
|
862
|
+
}
|
|
863
|
+
function CheckIcon(props) {
|
|
864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
865
|
+
}
|
|
866
|
+
function ArrowUpDownIcon(props) {
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21 16-4 4-4-4" }),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M17 20V4" }),
|
|
870
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m3 8 4-4 4 4" }),
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 4v16" })
|
|
872
|
+
] });
|
|
873
|
+
}
|
|
874
|
+
function FolderIcon(props) {
|
|
875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }) });
|
|
876
|
+
}
|
|
877
|
+
function TagIcon(props) {
|
|
878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
|
|
881
|
+
] });
|
|
882
|
+
}
|
|
883
|
+
function RotateCcwIcon(props) {
|
|
884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 3v5h5" })
|
|
887
|
+
] });
|
|
888
|
+
}
|
|
889
|
+
function LoaderIcon(props) {
|
|
890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
891
|
+
}
|
|
892
|
+
function MousePointerClickIcon(props) {
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14 4.1 12 6" }),
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m5.1 8-2.9-.8" }),
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 12-1.9 2" }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.2 2.2 8 5.1" }),
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z" })
|
|
899
|
+
] });
|
|
900
|
+
}
|
|
901
|
+
function UsersIcon(props) {
|
|
902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "9", cy: "7", r: "4" }),
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
|
|
907
|
+
] });
|
|
908
|
+
}
|
|
909
|
+
function ClockIcon(props) {
|
|
910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
912
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 6v6l4 2" })
|
|
913
|
+
] });
|
|
914
|
+
}
|
|
915
|
+
function GlobeIcon(props) {
|
|
916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2 12h20" })
|
|
920
|
+
] });
|
|
921
|
+
}
|
|
922
|
+
function ExternalLinkIcon(props) {
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15 3h6v6" }),
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 14 21 3" }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
927
|
+
] });
|
|
928
|
+
}
|
|
929
|
+
function MessageCircleIcon(props) {
|
|
930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Svg, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }) });
|
|
931
|
+
}
|
|
932
|
+
function RocketIcon(props) {
|
|
933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91 0" }),
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2" }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" })
|
|
938
|
+
] });
|
|
939
|
+
}
|
|
940
|
+
function AlertTriangleIcon(props) {
|
|
941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Svg, { ...props, children: [
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 9v4" }),
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
|
|
945
|
+
] });
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
// catalog/react/primitives.tsx
|
|
949
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
950
|
+
var SearchInput = ({
|
|
951
|
+
ref,
|
|
952
|
+
value,
|
|
953
|
+
onChange,
|
|
954
|
+
placeholder
|
|
955
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1.5 h-7 px-2 rounded-md bg-muted/40 border border-border/50", children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SearchIcon, { className: "w-3 h-3 text-muted-foreground shrink-0" }),
|
|
957
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
958
|
+
"input",
|
|
959
|
+
{
|
|
960
|
+
ref,
|
|
961
|
+
type: "text",
|
|
962
|
+
value,
|
|
963
|
+
onChange: (e) => onChange(e.target.value),
|
|
964
|
+
placeholder,
|
|
965
|
+
className: "flex-1 bg-transparent text-xs text-foreground placeholder:text-muted-foreground/50 outline-none min-w-0",
|
|
966
|
+
style: { fontSize: "16px" }
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
970
|
+
"button",
|
|
971
|
+
{
|
|
972
|
+
type: "button",
|
|
973
|
+
onClick: () => onChange(""),
|
|
974
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
975
|
+
"aria-label": "Clear search",
|
|
976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(XIcon, { className: "w-3 h-3" })
|
|
977
|
+
}
|
|
978
|
+
)
|
|
979
|
+
] });
|
|
980
|
+
function FilterChip({
|
|
981
|
+
icon: Icon,
|
|
982
|
+
label,
|
|
983
|
+
active,
|
|
984
|
+
focused,
|
|
985
|
+
onClick
|
|
986
|
+
}) {
|
|
987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
988
|
+
"button",
|
|
989
|
+
{
|
|
990
|
+
type: "button",
|
|
991
|
+
onClick,
|
|
992
|
+
className: (0, import_design_system.cn)(
|
|
993
|
+
"inline-flex items-center gap-1 h-6 px-1.5 rounded text-[11px] font-medium shrink-0 transition-colors",
|
|
994
|
+
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"
|
|
995
|
+
),
|
|
996
|
+
children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: "w-3 h-3" }),
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: label })
|
|
999
|
+
]
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
function OptionRow({
|
|
1004
|
+
label,
|
|
1005
|
+
selected,
|
|
1006
|
+
onClick
|
|
1007
|
+
}) {
|
|
1008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1009
|
+
"button",
|
|
1010
|
+
{
|
|
1011
|
+
type: "button",
|
|
1012
|
+
onClick,
|
|
1013
|
+
className: (0, import_design_system.cn)(
|
|
1014
|
+
"flex items-center w-full px-3 py-2 text-xs transition-colors",
|
|
1015
|
+
"hover:bg-muted/50 active:bg-muted/70",
|
|
1016
|
+
selected && "text-primary font-medium"
|
|
1017
|
+
),
|
|
1018
|
+
children: [
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "flex-1 text-left", children: label }),
|
|
1020
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, { className: "w-3.5 h-3.5 text-primary shrink-0" })
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
function CheckRow({
|
|
1026
|
+
label,
|
|
1027
|
+
checked,
|
|
1028
|
+
onClick
|
|
1029
|
+
}) {
|
|
1030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1031
|
+
"button",
|
|
1032
|
+
{
|
|
1033
|
+
type: "button",
|
|
1034
|
+
onClick,
|
|
1035
|
+
className: "flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-muted/50 active:bg-muted/70 transition-colors",
|
|
1036
|
+
children: [
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1038
|
+
"div",
|
|
1039
|
+
{
|
|
1040
|
+
className: (0, import_design_system.cn)(
|
|
1041
|
+
"w-3.5 h-3.5 rounded-sm border flex items-center justify-center shrink-0 transition-colors",
|
|
1042
|
+
checked ? "bg-primary border-primary" : "border-muted-foreground/30"
|
|
1043
|
+
),
|
|
1044
|
+
children: checked && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, { className: "w-2.5 h-2.5 text-primary-foreground" })
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "flex-1 text-left truncate", children: label })
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
function SidePanelHeader({
|
|
1053
|
+
title,
|
|
1054
|
+
onClose
|
|
1055
|
+
}) {
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between px-3 py-2 border-b border-border shrink-0", children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-xs font-semibold text-foreground", children: title }),
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1059
|
+
"button",
|
|
1060
|
+
{
|
|
1061
|
+
type: "button",
|
|
1062
|
+
onClick: onClose,
|
|
1063
|
+
className: "w-5 h-5 rounded flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",
|
|
1064
|
+
"aria-label": "Close",
|
|
1065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(XIcon, { className: "w-3.5 h-3.5" })
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] });
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// catalog/react/AgentCategoriesPanel.tsx
|
|
1072
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1073
|
+
function AgentCategoriesPanel({
|
|
1074
|
+
consumer,
|
|
1075
|
+
allCategories,
|
|
1076
|
+
search,
|
|
1077
|
+
setSearch,
|
|
1078
|
+
onClose
|
|
1079
|
+
}) {
|
|
1080
|
+
const filtered = allCategories.filter(
|
|
1081
|
+
(c) => !search || c.toLowerCase().includes(search.toLowerCase())
|
|
1082
|
+
);
|
|
1083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col h-full", children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SidePanelHeader, { title: "Categories", onClose }),
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "px-2 pt-2 pb-1 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1086
|
+
SearchInput,
|
|
1087
|
+
{
|
|
1088
|
+
value: search,
|
|
1089
|
+
onChange: setSearch,
|
|
1090
|
+
placeholder: "Filter categories..."
|
|
1091
|
+
}
|
|
1092
|
+
) }),
|
|
1093
|
+
consumer.includedCats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1094
|
+
"button",
|
|
1095
|
+
{
|
|
1096
|
+
type: "button",
|
|
1097
|
+
onClick: () => consumer.setIncludedCats([]),
|
|
1098
|
+
className: "mx-2 mb-1 h-6 rounded text-[11px] font-medium text-primary hover:bg-muted/50 transition-colors text-left shrink-0",
|
|
1099
|
+
children: [
|
|
1100
|
+
"Clear (",
|
|
1101
|
+
consumer.includedCats.length,
|
|
1102
|
+
")"
|
|
1103
|
+
]
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "overflow-y-auto flex-1", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-xs text-muted-foreground text-center py-6", children: "No categories" }) : filtered.map((cat) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1107
|
+
CheckRow,
|
|
1108
|
+
{
|
|
1109
|
+
label: cat,
|
|
1110
|
+
checked: consumer.includedCats.includes(cat),
|
|
1111
|
+
onClick: () => consumer.toggleCategory(cat)
|
|
1112
|
+
},
|
|
1113
|
+
cat
|
|
1114
|
+
)) })
|
|
1115
|
+
] });
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// catalog/react/AgentDetailCard.tsx
|
|
1119
|
+
var import_design_system3 = require("@ai-matrx/design-system");
|
|
1120
|
+
|
|
1121
|
+
// catalog/react/FavoriteAgentButton.tsx
|
|
1122
|
+
var import_design_system2 = require("@ai-matrx/design-system");
|
|
1123
|
+
var import_react4 = require("react");
|
|
1124
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1125
|
+
function FavoriteAgentButton({
|
|
1126
|
+
id,
|
|
1127
|
+
variant = "card",
|
|
1128
|
+
disabled
|
|
1129
|
+
}) {
|
|
1130
|
+
const catalog = useAgentCatalog();
|
|
1131
|
+
const select = (0, import_react4.useCallback)(
|
|
1132
|
+
(state) => state.byId[id],
|
|
1133
|
+
[id]
|
|
1134
|
+
);
|
|
1135
|
+
const record = useAgentCatalogState(select);
|
|
1136
|
+
const isFavorite = record?.isFavorite ?? false;
|
|
1137
|
+
const isOwner = record?.isOwner ?? true;
|
|
1138
|
+
const handleClick = (e) => {
|
|
1139
|
+
e.stopPropagation();
|
|
1140
|
+
if (disabled || !isOwner) return;
|
|
1141
|
+
void catalog.setFavorite(id, !isFavorite).catch(() => {
|
|
1142
|
+
});
|
|
1143
|
+
};
|
|
1144
|
+
const title = isOwner ? isFavorite ? "Remove from favorites" : "Add to favorites" : "Shared \u2014 cannot favorite";
|
|
1145
|
+
if (variant === "list") {
|
|
1146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1147
|
+
"button",
|
|
1148
|
+
{
|
|
1149
|
+
type: "button",
|
|
1150
|
+
className: (0, import_design_system2.cn)(
|
|
1151
|
+
"flex-shrink-0 p-0.5 rounded transition-all duration-150",
|
|
1152
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1153
|
+
disabled || !isOwner ? "cursor-not-allowed" : "hover:scale-110 cursor-pointer"
|
|
1154
|
+
),
|
|
1155
|
+
onClick: handleClick,
|
|
1156
|
+
disabled: disabled || !isOwner,
|
|
1157
|
+
title,
|
|
1158
|
+
"aria-label": isFavorite ? "Remove from favorites" : "Add to favorites",
|
|
1159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1160
|
+
StarIcon,
|
|
1161
|
+
{
|
|
1162
|
+
filled: isFavorite,
|
|
1163
|
+
className: (0, import_design_system2.cn)(
|
|
1164
|
+
"h-3.5 w-3.5 transition-all duration-150",
|
|
1165
|
+
isFavorite ? "matrx-agent-star-on" : "text-muted-foreground/40 hover:matrx-agent-star-on"
|
|
1166
|
+
)
|
|
1167
|
+
}
|
|
1168
|
+
)
|
|
1169
|
+
}
|
|
1170
|
+
);
|
|
1171
|
+
}
|
|
1172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1173
|
+
"button",
|
|
1174
|
+
{
|
|
1175
|
+
type: "button",
|
|
1176
|
+
className: (0, import_design_system2.cn)(
|
|
1177
|
+
"absolute top-2.5 right-2.5 z-10 p-0.5 rounded transition-all duration-150",
|
|
1178
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1179
|
+
disabled || !isOwner ? "cursor-not-allowed" : "hover:scale-110 cursor-pointer",
|
|
1180
|
+
isFavorite ? "matrx-agent-star-on" : "text-muted-foreground/40 hover:matrx-agent-star-on"
|
|
1181
|
+
),
|
|
1182
|
+
onClick: handleClick,
|
|
1183
|
+
disabled: disabled || !isOwner,
|
|
1184
|
+
title,
|
|
1185
|
+
"aria-label": isFavorite ? "Remove from favorites" : "Add to favorites",
|
|
1186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StarIcon, { filled: isFavorite, className: "w-4 h-4 transition-all duration-150" })
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// catalog/react/AgentDetailCard.tsx
|
|
1192
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1193
|
+
function AgentDetailCard({ agent, onSelect }) {
|
|
1194
|
+
const { LinkComponent, renderModelRef, openPeek } = useAgentCatalogUiPorts();
|
|
1195
|
+
const updatedDate = agent.updatedAt ? new Date(agent.updatedAt) : null;
|
|
1196
|
+
const createdDate = agent.createdAt ? new Date(agent.createdAt) : null;
|
|
1197
|
+
const isDefaultRow = isMandateAgentId(agent.id);
|
|
1198
|
+
const formatDate = (d) => {
|
|
1199
|
+
if (!d) return null;
|
|
1200
|
+
return d.toLocaleDateString(void 0, {
|
|
1201
|
+
month: "short",
|
|
1202
|
+
day: "numeric",
|
|
1203
|
+
year: "numeric"
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col h-full", children: [
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "px-4 pt-4 pb-3", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center shrink-0" }),
|
|
1209
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { className: "text-sm font-semibold text-foreground leading-tight truncate", children: agent.name || "Untitled" }),
|
|
1211
|
+
agent.isFavorite && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center gap-1 mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[11px] matrx-agent-star-on", children: "Pinned to favorites" }) })
|
|
1212
|
+
] }),
|
|
1213
|
+
!isDefaultRow && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FavoriteAgentButton, { id: agent.id, variant: "list" })
|
|
1214
|
+
] }) }),
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "h-px bg-border mx-3" }),
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 overflow-y-auto px-4 py-3 space-y-3", children: [
|
|
1217
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-1", children: "Description" }),
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-foreground/80 leading-relaxed", children: agent.description })
|
|
1220
|
+
] }),
|
|
1221
|
+
agent.category && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FolderIcon, { className: "w-3.5 h-3.5 text-muted-foreground shrink-0" }),
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-foreground/80", children: agent.category })
|
|
1224
|
+
] }),
|
|
1225
|
+
agent.tags && agent.tags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1.5 mb-1.5", children: [
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TagIcon, { className: "w-3.5 h-3.5 text-muted-foreground shrink-0" }),
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-[11px] font-medium text-muted-foreground", children: "Tags" })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-wrap gap-1", children: agent.tags.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1231
|
+
"span",
|
|
1232
|
+
{
|
|
1233
|
+
className: "inline-flex items-center h-5 px-1.5 rounded text-[10px] font-medium bg-muted text-muted-foreground",
|
|
1234
|
+
children: tag
|
|
1235
|
+
},
|
|
1236
|
+
tag
|
|
1237
|
+
)) })
|
|
1238
|
+
] }),
|
|
1239
|
+
agent.accessLevel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1240
|
+
agent.isOwner === false ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UsersIcon, { className: "w-3.5 h-3.5 text-muted-foreground shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GlobeIcon, { className: "w-3.5 h-3.5 text-muted-foreground shrink-0" }),
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
1242
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-xs text-foreground/80 capitalize", children: agent.accessLevel === "owner" ? "You own this" : `Shared \u2014 ${agent.accessLevel}` }),
|
|
1243
|
+
agent.sharedByEmail && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
1244
|
+
"by ",
|
|
1245
|
+
agent.sharedByEmail
|
|
1246
|
+
] })
|
|
1247
|
+
] })
|
|
1248
|
+
] }),
|
|
1249
|
+
agent.modelId && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center gap-2", children: renderModelRef({
|
|
1250
|
+
modelId: agent.modelId,
|
|
1251
|
+
className: "max-w-full text-xs text-foreground/80"
|
|
1252
|
+
}) }),
|
|
1253
|
+
(updatedDate || createdDate) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "pt-1 space-y-1", children: [
|
|
1254
|
+
updatedDate && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1255
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ClockIcon, { className: "w-3.5 h-3.5 text-muted-foreground shrink-0" }),
|
|
1256
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
1257
|
+
"Updated ",
|
|
1258
|
+
formatDate(updatedDate)
|
|
1259
|
+
] })
|
|
1260
|
+
] }),
|
|
1261
|
+
createdDate && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ClockIcon, { className: "w-3.5 h-3.5 text-muted-foreground/50 shrink-0" }),
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "text-[11px] text-muted-foreground/70", children: [
|
|
1264
|
+
"Created ",
|
|
1265
|
+
formatDate(createdDate)
|
|
1266
|
+
] })
|
|
1267
|
+
] })
|
|
1268
|
+
] })
|
|
1269
|
+
] }),
|
|
1270
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "h-px bg-border mx-3 mt-auto" }),
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "px-3 py-2 shrink-0 flex items-center gap-1.5", children: [
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1273
|
+
"button",
|
|
1274
|
+
{
|
|
1275
|
+
type: "button",
|
|
1276
|
+
onClick: onSelect,
|
|
1277
|
+
className: "flex-1 h-7 rounded-md bg-primary text-primary-foreground text-[11px] font-medium hover:bg-primary/90 active:bg-primary/80 transition-colors",
|
|
1278
|
+
children: "Select"
|
|
1279
|
+
}
|
|
1280
|
+
),
|
|
1281
|
+
openPeek && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1282
|
+
"button",
|
|
1283
|
+
{
|
|
1284
|
+
type: "button",
|
|
1285
|
+
onClick: (e) => {
|
|
1286
|
+
e.stopPropagation();
|
|
1287
|
+
openPeek(agent);
|
|
1288
|
+
},
|
|
1289
|
+
title: "Sneak Peek",
|
|
1290
|
+
"aria-label": "Sneak Peek",
|
|
1291
|
+
className: iconButtonClass,
|
|
1292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RocketIcon, { className: "w-3.5 h-3.5" })
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
!isDefaultRow && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1296
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1297
|
+
LinkComponent,
|
|
1298
|
+
{
|
|
1299
|
+
href: `/chat/a/${agent.id}`,
|
|
1300
|
+
onClick: (e) => e.stopPropagation(),
|
|
1301
|
+
title: "Open in chat",
|
|
1302
|
+
"aria-label": "Open in chat",
|
|
1303
|
+
className: iconButtonClass,
|
|
1304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MessageCircleIcon, { className: "w-3.5 h-3.5" })
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1308
|
+
LinkComponent,
|
|
1309
|
+
{
|
|
1310
|
+
href: `/agents/go/${agent.id}`,
|
|
1311
|
+
target: "_blank",
|
|
1312
|
+
rel: "noopener noreferrer",
|
|
1313
|
+
onClick: (e) => e.stopPropagation(),
|
|
1314
|
+
title: "Open in new tab",
|
|
1315
|
+
"aria-label": "Open in new tab",
|
|
1316
|
+
className: (0, import_design_system3.cn)(
|
|
1317
|
+
iconButtonClass,
|
|
1318
|
+
"hover:text-foreground"
|
|
1319
|
+
),
|
|
1320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ExternalLinkIcon, { className: "w-3.5 h-3.5" })
|
|
1321
|
+
}
|
|
1322
|
+
)
|
|
1323
|
+
] })
|
|
1324
|
+
] })
|
|
1325
|
+
] });
|
|
1326
|
+
}
|
|
1327
|
+
var iconButtonClass = "flex items-center justify-center h-7 w-7 rounded-md border border-border bg-background text-muted-foreground hover:text-primary hover:bg-muted/50 transition-colors shrink-0";
|
|
1328
|
+
|
|
1329
|
+
// catalog/react/AgentListContent.tsx
|
|
1330
|
+
var import_react5 = require("react");
|
|
1331
|
+
|
|
1332
|
+
// catalog/react/types.ts
|
|
1333
|
+
var SORT_OPTIONS = [
|
|
1334
|
+
{ value: "updated-desc", label: "Recent" },
|
|
1335
|
+
{ value: "created-desc", label: "Created" },
|
|
1336
|
+
{ value: "name-asc", label: "A \u2192 Z" },
|
|
1337
|
+
{ value: "name-desc", label: "Z \u2192 A" },
|
|
1338
|
+
{ value: "category-asc", label: "Category" }
|
|
1339
|
+
];
|
|
1340
|
+
var PANEL_HEIGHT = "528px";
|
|
1341
|
+
var LIST_MAX_HEIGHT = "min(528px, var(--radix-popper-available-height, 528px))";
|
|
1342
|
+
|
|
1343
|
+
// catalog/react/AgentFilterBar.tsx
|
|
1344
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1345
|
+
function AgentFilterBar({
|
|
1346
|
+
consumer,
|
|
1347
|
+
allCategories,
|
|
1348
|
+
allTags,
|
|
1349
|
+
activeFilterCount,
|
|
1350
|
+
isMobile,
|
|
1351
|
+
rightPanel,
|
|
1352
|
+
onFilterChipClick,
|
|
1353
|
+
onReset
|
|
1354
|
+
}) {
|
|
1355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1 px-2 pb-1.5 overflow-x-auto matrx-agent-scrollbar-none shrink-0", children: [
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1357
|
+
FilterChip,
|
|
1358
|
+
{
|
|
1359
|
+
icon: ArrowUpDownIcon,
|
|
1360
|
+
label: SORT_OPTIONS.find((o) => o.value === consumer.sortBy)?.label ?? "Sort",
|
|
1361
|
+
active: consumer.sortBy !== "updated-desc",
|
|
1362
|
+
focused: !isMobile && rightPanel === "sort",
|
|
1363
|
+
onClick: () => onFilterChipClick("sort")
|
|
1364
|
+
}
|
|
1365
|
+
),
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1367
|
+
FilterChip,
|
|
1368
|
+
{
|
|
1369
|
+
icon: StarIcon,
|
|
1370
|
+
label: consumer.favFilter === "no" ? "No Favs" : "Favs",
|
|
1371
|
+
active: consumer.favFilter !== "all",
|
|
1372
|
+
onClick: () => {
|
|
1373
|
+
const next = consumer.favFilter === "all" ? "yes" : consumer.favFilter === "yes" ? "no" : "all";
|
|
1374
|
+
consumer.setFavFilter(next);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
),
|
|
1378
|
+
allCategories.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1379
|
+
FilterChip,
|
|
1380
|
+
{
|
|
1381
|
+
icon: FolderIcon,
|
|
1382
|
+
label: consumer.includedCats.length > 0 ? `${consumer.includedCats.length}` : "Category",
|
|
1383
|
+
active: consumer.includedCats.length > 0,
|
|
1384
|
+
focused: !isMobile && rightPanel === "categories",
|
|
1385
|
+
onClick: () => onFilterChipClick("categories")
|
|
1386
|
+
}
|
|
1387
|
+
),
|
|
1388
|
+
allTags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1389
|
+
FilterChip,
|
|
1390
|
+
{
|
|
1391
|
+
icon: TagIcon,
|
|
1392
|
+
label: consumer.includedTags.length > 0 ? `${consumer.includedTags.length}` : "Tags",
|
|
1393
|
+
active: consumer.includedTags.length > 0,
|
|
1394
|
+
focused: !isMobile && rightPanel === "tags",
|
|
1395
|
+
onClick: () => onFilterChipClick("tags")
|
|
1396
|
+
}
|
|
1397
|
+
),
|
|
1398
|
+
activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1399
|
+
"button",
|
|
1400
|
+
{
|
|
1401
|
+
type: "button",
|
|
1402
|
+
onClick: onReset,
|
|
1403
|
+
"aria-label": "Reset filters",
|
|
1404
|
+
className: "flex items-center gap-0.5 h-6 px-1.5 rounded text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors shrink-0",
|
|
1405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RotateCcwIcon, { className: "w-3 h-3" })
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
] });
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// catalog/react/AgentListTabs.tsx
|
|
1412
|
+
var import_design_system4 = require("@ai-matrx/design-system");
|
|
1413
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1414
|
+
function AgentListTabs({
|
|
1415
|
+
consumer,
|
|
1416
|
+
tabCounts,
|
|
1417
|
+
systemTabLabel,
|
|
1418
|
+
visibleTabs
|
|
1419
|
+
}) {
|
|
1420
|
+
const { labels } = useAgentCatalog();
|
|
1421
|
+
const tabs = [
|
|
1422
|
+
{ value: "mine", label: "Mine", countKey: "mine" },
|
|
1423
|
+
{ value: "shared", label: "Shared", countKey: "shared" },
|
|
1424
|
+
{ value: "all", label: "All", countKey: "all" },
|
|
1425
|
+
{ value: "system", label: labels.publicTab, countKey: "system" }
|
|
1426
|
+
];
|
|
1427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1428
|
+
"div",
|
|
1429
|
+
{
|
|
1430
|
+
className: "flex items-center gap-0.5 px-2 pb-1 overflow-x-auto matrx-agent-scrollbar-none shrink-0",
|
|
1431
|
+
role: "tablist",
|
|
1432
|
+
"aria-label": "Agent ownership",
|
|
1433
|
+
children: tabs.filter(({ value }) => !visibleTabs || visibleTabs.includes(value)).map(({ value, label: baseLabel, countKey }) => {
|
|
1434
|
+
const label = value === "system" ? systemTabLabel ?? baseLabel : baseLabel;
|
|
1435
|
+
const active = consumer.tab === value;
|
|
1436
|
+
const count = tabCounts[countKey];
|
|
1437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1438
|
+
"button",
|
|
1439
|
+
{
|
|
1440
|
+
type: "button",
|
|
1441
|
+
role: "tab",
|
|
1442
|
+
"aria-selected": active,
|
|
1443
|
+
onClick: () => consumer.setTab(value),
|
|
1444
|
+
className: (0, import_design_system4.cn)(
|
|
1445
|
+
"inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium transition-colors shrink-0",
|
|
1446
|
+
active ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
|
1447
|
+
),
|
|
1448
|
+
children: [
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: label }),
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1451
|
+
"span",
|
|
1452
|
+
{
|
|
1453
|
+
className: (0, import_design_system4.cn)("tabular-nums opacity-70", active && "opacity-90"),
|
|
1454
|
+
children: count
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
]
|
|
1458
|
+
},
|
|
1459
|
+
value
|
|
1460
|
+
);
|
|
1461
|
+
})
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
// catalog/react/AgentRow.tsx
|
|
1467
|
+
var import_design_system5 = require("@ai-matrx/design-system");
|
|
1468
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1469
|
+
function AgentRow({
|
|
1470
|
+
agent,
|
|
1471
|
+
isActive,
|
|
1472
|
+
isHovered,
|
|
1473
|
+
isMobile,
|
|
1474
|
+
href,
|
|
1475
|
+
onClick,
|
|
1476
|
+
onHover,
|
|
1477
|
+
onHoverEnd,
|
|
1478
|
+
onDetailPress
|
|
1479
|
+
}) {
|
|
1480
|
+
const { LinkComponent } = useAgentCatalogUiPorts();
|
|
1481
|
+
const { labels } = useAgentCatalog();
|
|
1482
|
+
const rowHref = href ?? `/agents/go/${agent.id}`;
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1484
|
+
"div",
|
|
1485
|
+
{
|
|
1486
|
+
className: (0, import_design_system5.cn)(
|
|
1487
|
+
"flex items-center w-full text-left transition-colors group",
|
|
1488
|
+
"hover:bg-muted/50 active:bg-muted/70",
|
|
1489
|
+
isActive && "bg-primary/5",
|
|
1490
|
+
!isMobile && isHovered && "bg-muted/40"
|
|
1491
|
+
),
|
|
1492
|
+
onMouseEnter: isMobile ? void 0 : onHover,
|
|
1493
|
+
onMouseLeave: isMobile ? void 0 : onHoverEnd,
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1496
|
+
LinkComponent,
|
|
1497
|
+
{
|
|
1498
|
+
href: rowHref,
|
|
1499
|
+
onClick: (e) => {
|
|
1500
|
+
if (e.metaKey || e.ctrlKey) return;
|
|
1501
|
+
e.preventDefault();
|
|
1502
|
+
onClick();
|
|
1503
|
+
},
|
|
1504
|
+
className: "flex items-center gap-2 flex-1 min-w-0 px-3 py-2",
|
|
1505
|
+
children: [
|
|
1506
|
+
agent.isFavorite && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StarIcon, { filled: true, className: "w-3 h-3 matrx-agent-star-on shrink-0" }),
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1508
|
+
"span",
|
|
1509
|
+
{
|
|
1510
|
+
className: (0, import_design_system5.cn)(
|
|
1511
|
+
"text-[13px] font-medium truncate",
|
|
1512
|
+
isActive ? "text-primary" : "text-foreground"
|
|
1513
|
+
),
|
|
1514
|
+
children: agent.name || "Untitled"
|
|
1515
|
+
}
|
|
1516
|
+
),
|
|
1517
|
+
agent.agentType === "builtin" ? /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.jsx)("span", { className: "text-[9px] text-muted-foreground bg-muted px-1 py-px rounded shrink-0 ml-auto", children: "shared" }) : null
|
|
1518
|
+
]
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1522
|
+
"button",
|
|
1523
|
+
{
|
|
1524
|
+
type: "button",
|
|
1525
|
+
"aria-label": "Show details",
|
|
1526
|
+
onClick: (e) => {
|
|
1527
|
+
e.stopPropagation();
|
|
1528
|
+
onDetailPress();
|
|
1529
|
+
},
|
|
1530
|
+
className: "flex items-center justify-center w-10 h-full shrink-0 text-muted-foreground/40 active:text-muted-foreground",
|
|
1531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronRightIcon, { className: "w-4 h-4" })
|
|
1532
|
+
}
|
|
1533
|
+
)
|
|
1534
|
+
]
|
|
1535
|
+
}
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
// catalog/react/AgentListContent.tsx
|
|
1540
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1541
|
+
function AgentListContent({
|
|
1542
|
+
agents,
|
|
1543
|
+
isLoading,
|
|
1544
|
+
consumer,
|
|
1545
|
+
activeAgentId,
|
|
1546
|
+
allCategories,
|
|
1547
|
+
allTags,
|
|
1548
|
+
inputRef,
|
|
1549
|
+
onSelectAgent,
|
|
1550
|
+
resolveAgentHref,
|
|
1551
|
+
onReset,
|
|
1552
|
+
activeFilterCount,
|
|
1553
|
+
isMobile,
|
|
1554
|
+
hoveredAgent,
|
|
1555
|
+
onAgentHover,
|
|
1556
|
+
onAgentHoverEnd,
|
|
1557
|
+
onDetailPress,
|
|
1558
|
+
onFilterChipClick,
|
|
1559
|
+
rightPanel,
|
|
1560
|
+
tabCounts,
|
|
1561
|
+
visibleTabs,
|
|
1562
|
+
systemTabLabel,
|
|
1563
|
+
pinnedAgent = null,
|
|
1564
|
+
defaultRow = null,
|
|
1565
|
+
listOpen = false
|
|
1566
|
+
}) {
|
|
1567
|
+
const catalog = useAgentCatalog();
|
|
1568
|
+
const listScrollRef = (0, import_react5.useRef)(null);
|
|
1569
|
+
(0, import_react5.useEffect)(() => {
|
|
1570
|
+
if (listOpen && pinnedAgent) {
|
|
1571
|
+
listScrollRef.current?.scrollTo({ top: 0 });
|
|
1572
|
+
}
|
|
1573
|
+
}, [listOpen, pinnedAgent?.id]);
|
|
1574
|
+
const { labels } = catalog;
|
|
1575
|
+
const emptyLabel = agentListEmptyLabel(consumer.tab, labels);
|
|
1576
|
+
const defaultAgent = defaultRow?.row ?? null;
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col h-full", children: [
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-2 pt-2 pb-1 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1579
|
+
SearchInput,
|
|
1580
|
+
{
|
|
1581
|
+
ref: inputRef,
|
|
1582
|
+
value: consumer.searchTerm,
|
|
1583
|
+
onChange: consumer.setSearchTerm,
|
|
1584
|
+
placeholder: labels.searchPlaceholder
|
|
1585
|
+
}
|
|
1586
|
+
) }),
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1588
|
+
AgentListTabs,
|
|
1589
|
+
{
|
|
1590
|
+
consumer,
|
|
1591
|
+
tabCounts,
|
|
1592
|
+
systemTabLabel,
|
|
1593
|
+
visibleTabs
|
|
1594
|
+
}
|
|
1595
|
+
),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1597
|
+
AgentFilterBar,
|
|
1598
|
+
{
|
|
1599
|
+
consumer,
|
|
1600
|
+
allCategories,
|
|
1601
|
+
allTags,
|
|
1602
|
+
activeFilterCount,
|
|
1603
|
+
isMobile,
|
|
1604
|
+
rightPanel,
|
|
1605
|
+
onFilterChipClick,
|
|
1606
|
+
onReset
|
|
1607
|
+
}
|
|
1608
|
+
),
|
|
1609
|
+
defaultRow?.drift && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1610
|
+
"div",
|
|
1611
|
+
{
|
|
1612
|
+
role: "status",
|
|
1613
|
+
className: "matrx-agent-drift-banner mx-2 mb-1.5 flex items-start gap-2 rounded-md px-2 py-1.5 shrink-0",
|
|
1614
|
+
children: [
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertTriangleIcon, { className: "w-3.5 h-3.5 shrink-0 mt-px" }),
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] leading-snug flex-1", children: defaultRow.drift }),
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1618
|
+
"button",
|
|
1619
|
+
{
|
|
1620
|
+
type: "button",
|
|
1621
|
+
"aria-label": "Dismiss",
|
|
1622
|
+
onClick: () => catalog.dismissDefaultRowDrift(defaultRow.mandateKey),
|
|
1623
|
+
className: "shrink-0 opacity-70 hover:opacity-100",
|
|
1624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { className: "w-3 h-3" })
|
|
1625
|
+
}
|
|
1626
|
+
)
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
),
|
|
1630
|
+
defaultRow?.error && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1631
|
+
"div",
|
|
1632
|
+
{
|
|
1633
|
+
role: "alert",
|
|
1634
|
+
className: "matrx-agent-drift-banner mx-2 mb-1.5 flex items-start gap-2 rounded-md px-2 py-1.5 shrink-0",
|
|
1635
|
+
children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertTriangleIcon, { className: "w-3.5 h-3.5 shrink-0 mt-px" }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px] leading-snug flex-1", children: defaultRow.error })
|
|
1638
|
+
]
|
|
1639
|
+
}
|
|
1640
|
+
),
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-px bg-border shrink-0" }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: listScrollRef, className: "overflow-y-auto flex-1 min-h-0", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-center py-8 gap-2 text-muted-foreground", children: [
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoaderIcon, { className: "w-4 h-4 matrx-agent-spin" }),
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs", children: labels.loading })
|
|
1645
|
+
] }) : agents.length === 0 && !pinnedAgent && !defaultAgent ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col items-center py-8 text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs", children: emptyLabel }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "py-0.5", children: [
|
|
1646
|
+
defaultAgent && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 pt-1.5 pb-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Default" }) }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1649
|
+
AgentRow,
|
|
1650
|
+
{
|
|
1651
|
+
agent: defaultAgent,
|
|
1652
|
+
isActive: defaultAgent.id === activeAgentId,
|
|
1653
|
+
isHovered: hoveredAgent?.id === defaultAgent.id,
|
|
1654
|
+
isMobile,
|
|
1655
|
+
onClick: () => onSelectAgent(defaultAgent),
|
|
1656
|
+
href: resolveAgentHref?.(defaultAgent),
|
|
1657
|
+
onHover: () => onAgentHover(defaultAgent),
|
|
1658
|
+
onHoverEnd: () => onAgentHoverEnd(defaultAgent),
|
|
1659
|
+
onDetailPress: () => onDetailPress(defaultAgent)
|
|
1660
|
+
},
|
|
1661
|
+
`default-${defaultAgent.id}`
|
|
1662
|
+
),
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mx-2 my-0.5 h-px bg-border" })
|
|
1664
|
+
] }),
|
|
1665
|
+
pinnedAgent && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-3 pt-1.5 pb-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: labels.currentAgentHeading }) }),
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1668
|
+
AgentRow,
|
|
1669
|
+
{
|
|
1670
|
+
agent: pinnedAgent,
|
|
1671
|
+
isActive: true,
|
|
1672
|
+
isHovered: hoveredAgent?.id === pinnedAgent.id,
|
|
1673
|
+
isMobile,
|
|
1674
|
+
onClick: () => onSelectAgent(pinnedAgent),
|
|
1675
|
+
href: resolveAgentHref?.(pinnedAgent),
|
|
1676
|
+
onHover: () => onAgentHover(pinnedAgent),
|
|
1677
|
+
onHoverEnd: () => onAgentHoverEnd(pinnedAgent),
|
|
1678
|
+
onDetailPress: () => onDetailPress(pinnedAgent)
|
|
1679
|
+
},
|
|
1680
|
+
`pinned-${pinnedAgent.id}`
|
|
1681
|
+
),
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mx-2 my-0.5 h-px bg-border" })
|
|
1683
|
+
] }),
|
|
1684
|
+
agents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1685
|
+
AgentRow,
|
|
1686
|
+
{
|
|
1687
|
+
agent,
|
|
1688
|
+
isActive: agent.id === activeAgentId,
|
|
1689
|
+
isHovered: hoveredAgent?.id === agent.id,
|
|
1690
|
+
isMobile,
|
|
1691
|
+
onClick: () => onSelectAgent(agent),
|
|
1692
|
+
href: resolveAgentHref?.(agent),
|
|
1693
|
+
onHover: () => onAgentHover(agent),
|
|
1694
|
+
onHoverEnd: () => onAgentHoverEnd(agent),
|
|
1695
|
+
onDetailPress: () => onDetailPress(agent)
|
|
1696
|
+
},
|
|
1697
|
+
agent.id
|
|
1698
|
+
)),
|
|
1699
|
+
agents.length === 0 && (pinnedAgent || defaultAgent) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col items-center py-4 text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs", children: emptyLabel }) })
|
|
1700
|
+
] }) }),
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "h-px bg-border shrink-0" }),
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-2.5 py-1.5 shrink-0", children: [
|
|
1703
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: [
|
|
1704
|
+
agents.length,
|
|
1705
|
+
" agent",
|
|
1706
|
+
agents.length !== 1 ? "s" : ""
|
|
1707
|
+
] }),
|
|
1708
|
+
consumer.searchTerm && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1709
|
+
"button",
|
|
1710
|
+
{
|
|
1711
|
+
type: "button",
|
|
1712
|
+
onClick: () => consumer.setSearchTerm(""),
|
|
1713
|
+
className: "text-[10px] text-muted-foreground hover:text-foreground transition-colors",
|
|
1714
|
+
children: "Clear search"
|
|
1715
|
+
}
|
|
1716
|
+
)
|
|
1717
|
+
] })
|
|
1718
|
+
] });
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// catalog/react/AgentMobileSubView.tsx
|
|
1722
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1723
|
+
function AgentMobileSubView({
|
|
1724
|
+
view,
|
|
1725
|
+
consumer,
|
|
1726
|
+
allCategories,
|
|
1727
|
+
allTags,
|
|
1728
|
+
catSearch,
|
|
1729
|
+
setCatSearch,
|
|
1730
|
+
tagSearch,
|
|
1731
|
+
setTagSearch,
|
|
1732
|
+
onBack
|
|
1733
|
+
}) {
|
|
1734
|
+
const title = view === "sort" ? "Sort" : view === "categories" ? "Categories" : "Tags";
|
|
1735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col", children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1737
|
+
"button",
|
|
1738
|
+
{
|
|
1739
|
+
type: "button",
|
|
1740
|
+
onClick: onBack,
|
|
1741
|
+
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",
|
|
1742
|
+
children: [
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
|
|
1744
|
+
title
|
|
1745
|
+
]
|
|
1746
|
+
}
|
|
1747
|
+
),
|
|
1748
|
+
view === "sort" && SORT_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1749
|
+
OptionRow,
|
|
1750
|
+
{
|
|
1751
|
+
label: opt.label,
|
|
1752
|
+
selected: consumer.sortBy === opt.value,
|
|
1753
|
+
onClick: () => {
|
|
1754
|
+
consumer.setSortBy(opt.value);
|
|
1755
|
+
onBack();
|
|
1756
|
+
}
|
|
1757
|
+
},
|
|
1758
|
+
opt.value
|
|
1759
|
+
)),
|
|
1760
|
+
view === "categories" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "px-2 pt-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1762
|
+
SearchInput,
|
|
1763
|
+
{
|
|
1764
|
+
value: catSearch,
|
|
1765
|
+
onChange: setCatSearch,
|
|
1766
|
+
placeholder: "Filter categories..."
|
|
1767
|
+
}
|
|
1768
|
+
) }),
|
|
1769
|
+
consumer.includedCats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1770
|
+
"button",
|
|
1771
|
+
{
|
|
1772
|
+
type: "button",
|
|
1773
|
+
onClick: () => consumer.setIncludedCats([]),
|
|
1774
|
+
className: "mx-2 mb-1 h-6 rounded text-[11px] font-medium text-primary hover:bg-muted/50 transition-colors text-left",
|
|
1775
|
+
children: [
|
|
1776
|
+
"Clear (",
|
|
1777
|
+
consumer.includedCats.length,
|
|
1778
|
+
")"
|
|
1779
|
+
]
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "overflow-y-auto max-h-[300px]", children: allCategories.filter(
|
|
1783
|
+
(c) => !catSearch || c.toLowerCase().includes(catSearch.toLowerCase())
|
|
1784
|
+
).map((cat) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1785
|
+
CheckRow,
|
|
1786
|
+
{
|
|
1787
|
+
label: cat,
|
|
1788
|
+
checked: consumer.includedCats.includes(cat),
|
|
1789
|
+
onClick: () => consumer.toggleCategory(cat)
|
|
1790
|
+
},
|
|
1791
|
+
cat
|
|
1792
|
+
)) })
|
|
1793
|
+
] }),
|
|
1794
|
+
view === "tags" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "px-2 pt-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1796
|
+
SearchInput,
|
|
1797
|
+
{
|
|
1798
|
+
value: tagSearch,
|
|
1799
|
+
onChange: setTagSearch,
|
|
1800
|
+
placeholder: "Filter tags..."
|
|
1801
|
+
}
|
|
1802
|
+
) }),
|
|
1803
|
+
consumer.includedTags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1804
|
+
"button",
|
|
1805
|
+
{
|
|
1806
|
+
type: "button",
|
|
1807
|
+
onClick: () => consumer.setIncludedTags([]),
|
|
1808
|
+
className: "mx-2 mb-1 h-6 rounded text-[11px] font-medium text-primary hover:bg-muted/50 transition-colors text-left",
|
|
1809
|
+
children: [
|
|
1810
|
+
"Clear (",
|
|
1811
|
+
consumer.includedTags.length,
|
|
1812
|
+
")"
|
|
1813
|
+
]
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "overflow-y-auto max-h-[300px]", children: allTags.filter(
|
|
1817
|
+
(t) => !tagSearch || t.toLowerCase().includes(tagSearch.toLowerCase())
|
|
1818
|
+
).map((tag) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1819
|
+
CheckRow,
|
|
1820
|
+
{
|
|
1821
|
+
label: tag,
|
|
1822
|
+
checked: consumer.includedTags.includes(tag),
|
|
1823
|
+
onClick: () => consumer.toggleTag(tag)
|
|
1824
|
+
},
|
|
1825
|
+
tag
|
|
1826
|
+
)) })
|
|
1827
|
+
] })
|
|
1828
|
+
] });
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
// catalog/react/AgentSortPanel.tsx
|
|
1832
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1833
|
+
function AgentSortPanel({ consumer, onClose }) {
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col h-full", children: [
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SidePanelHeader, { title: "Sort By", onClose }),
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "overflow-y-auto flex-1", children: SORT_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1837
|
+
OptionRow,
|
|
1838
|
+
{
|
|
1839
|
+
label: opt.label,
|
|
1840
|
+
selected: consumer.sortBy === opt.value,
|
|
1841
|
+
onClick: () => consumer.setSortBy(opt.value)
|
|
1842
|
+
},
|
|
1843
|
+
opt.value
|
|
1844
|
+
)) })
|
|
1845
|
+
] });
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
// catalog/react/AgentTagsPanel.tsx
|
|
1849
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1850
|
+
function AgentTagsPanel({
|
|
1851
|
+
consumer,
|
|
1852
|
+
allTags,
|
|
1853
|
+
search,
|
|
1854
|
+
setSearch,
|
|
1855
|
+
onClose
|
|
1856
|
+
}) {
|
|
1857
|
+
const filtered = allTags.filter(
|
|
1858
|
+
(t) => !search || t.toLowerCase().includes(search.toLowerCase())
|
|
1859
|
+
);
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-col h-full", children: [
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SidePanelHeader, { title: "Tags", onClose }),
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "px-2 pt-2 pb-1 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1863
|
+
SearchInput,
|
|
1864
|
+
{
|
|
1865
|
+
value: search,
|
|
1866
|
+
onChange: setSearch,
|
|
1867
|
+
placeholder: "Filter tags..."
|
|
1868
|
+
}
|
|
1869
|
+
) }),
|
|
1870
|
+
consumer.includedTags.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1871
|
+
"button",
|
|
1872
|
+
{
|
|
1873
|
+
type: "button",
|
|
1874
|
+
onClick: () => consumer.setIncludedTags([]),
|
|
1875
|
+
className: "mx-2 mb-1 h-6 rounded text-[11px] font-medium text-primary hover:bg-muted/50 transition-colors text-left shrink-0",
|
|
1876
|
+
children: [
|
|
1877
|
+
"Clear (",
|
|
1878
|
+
consumer.includedTags.length,
|
|
1879
|
+
")"
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
),
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "overflow-y-auto flex-1", children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-xs text-muted-foreground text-center py-6", children: "No tags" }) : filtered.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1884
|
+
CheckRow,
|
|
1885
|
+
{
|
|
1886
|
+
label: tag,
|
|
1887
|
+
checked: consumer.includedTags.includes(tag),
|
|
1888
|
+
onClick: () => consumer.toggleTag(tag)
|
|
1889
|
+
},
|
|
1890
|
+
tag
|
|
1891
|
+
)) })
|
|
1892
|
+
] });
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
// catalog/react/AgentListDropdown.tsx
|
|
1896
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1897
|
+
var CONSUMER_ID = "agent-list-dropdown";
|
|
1898
|
+
function AgentListDropdown({
|
|
1899
|
+
onSelect,
|
|
1900
|
+
navigateTo,
|
|
1901
|
+
className,
|
|
1902
|
+
label,
|
|
1903
|
+
triggerSlot,
|
|
1904
|
+
noBorder = false,
|
|
1905
|
+
compact = false,
|
|
1906
|
+
activeAgentId: activeAgentIdProp,
|
|
1907
|
+
contentSide,
|
|
1908
|
+
consumerId = CONSUMER_ID,
|
|
1909
|
+
initialTab,
|
|
1910
|
+
includeSystemInAll = false,
|
|
1911
|
+
visibleTabs,
|
|
1912
|
+
systemTabLabel,
|
|
1913
|
+
resolveAgentHref: resolveAgentHrefProp,
|
|
1914
|
+
showPinnedAgent = true,
|
|
1915
|
+
excludeAgentIds,
|
|
1916
|
+
defaultMandateKey
|
|
1917
|
+
}) {
|
|
1918
|
+
const isMobile = (0, import_design_system6.useIsMobile)();
|
|
1919
|
+
const { labels } = useAgentCatalog();
|
|
1920
|
+
const { popoverContainer } = useAgentCatalogUiPorts();
|
|
1921
|
+
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
1922
|
+
const [rightPanel, setRightPanel] = (0, import_react6.useState)(null);
|
|
1923
|
+
const [catSearch, setCatSearch] = (0, import_react6.useState)("");
|
|
1924
|
+
const [tagSearch, setTagSearch] = (0, import_react6.useState)("");
|
|
1925
|
+
const [mobileDetailAgent, setMobileDetailAgent] = (0, import_react6.useState)(null);
|
|
1926
|
+
const [mobileSubView, setMobileSubView] = (0, import_react6.useState)(null);
|
|
1927
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
1928
|
+
const {
|
|
1929
|
+
agents,
|
|
1930
|
+
isLoading,
|
|
1931
|
+
activeAgentId,
|
|
1932
|
+
pinnedAgent,
|
|
1933
|
+
defaultRow,
|
|
1934
|
+
allCategories,
|
|
1935
|
+
allTags,
|
|
1936
|
+
consumer,
|
|
1937
|
+
tabCounts,
|
|
1938
|
+
activeFilterCount,
|
|
1939
|
+
hoveredAgent,
|
|
1940
|
+
setHoveredAgent,
|
|
1941
|
+
ensureLoaded,
|
|
1942
|
+
handleSelectAgent: coreSelectAgent,
|
|
1943
|
+
handleAgentHover: coreAgentHover,
|
|
1944
|
+
handleAgentHoverEnd: coreAgentHoverEnd,
|
|
1945
|
+
handleDetailPanelMouseEnter,
|
|
1946
|
+
handleDetailPanelMouseLeave: coreDetailMouseLeave
|
|
1947
|
+
} = useAgentListCore({
|
|
1948
|
+
consumerId,
|
|
1949
|
+
...onSelect ? { onSelect } : {},
|
|
1950
|
+
...navigateTo ? { navigateTo } : {},
|
|
1951
|
+
...activeAgentIdProp !== void 0 ? { activeAgentIdOverride: activeAgentIdProp } : {},
|
|
1952
|
+
...initialTab ? { initialTab } : {},
|
|
1953
|
+
includeSystemInAll,
|
|
1954
|
+
// The restriction has to reach the CORE, not just the tab strip — see
|
|
1955
|
+
// `AgentListCoreOptions.visibleTabs`.
|
|
1956
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
1957
|
+
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
1958
|
+
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
1959
|
+
});
|
|
1960
|
+
const displayLabel = label ?? pinnedAgent?.name ?? (activeAgentId ? isLoading ? labels.triggerResolving : labels.triggerUnnameable : labels.triggerFallback);
|
|
1961
|
+
const showAssignedTooltip = Boolean(activeAgentId) && displayLabel.trim().length > 0 && displayLabel !== "Select an agent" && displayLabel !== labels.triggerFallback;
|
|
1962
|
+
const handleOpen = (nextOpen) => {
|
|
1963
|
+
setOpen(nextOpen);
|
|
1964
|
+
if (nextOpen) {
|
|
1965
|
+
ensureLoaded();
|
|
1966
|
+
if (pinnedAgent && !isMobile) {
|
|
1967
|
+
setHoveredAgent(pinnedAgent);
|
|
1968
|
+
setRightPanel("detail");
|
|
1969
|
+
}
|
|
1970
|
+
setTimeout(() => inputRef.current?.focus(), 50);
|
|
1971
|
+
} else {
|
|
1972
|
+
setRightPanel(null);
|
|
1973
|
+
setCatSearch("");
|
|
1974
|
+
setTagSearch("");
|
|
1975
|
+
setMobileDetailAgent(null);
|
|
1976
|
+
setMobileSubView(null);
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
const handleSelectAgent = (agent) => {
|
|
1980
|
+
coreSelectAgent(agent);
|
|
1981
|
+
setOpen(false);
|
|
1982
|
+
};
|
|
1983
|
+
const handleFilterChipClick = (panel) => {
|
|
1984
|
+
if (isMobile) {
|
|
1985
|
+
setMobileSubView(panel);
|
|
1986
|
+
} else {
|
|
1987
|
+
setRightPanel(rightPanel === panel ? null : panel);
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
const handleAgentHover = (0, import_react6.useCallback)(
|
|
1991
|
+
(agent) => {
|
|
1992
|
+
if (isMobile) return;
|
|
1993
|
+
const filterPanelOpen = rightPanel === "sort" || rightPanel === "categories" || rightPanel === "tags";
|
|
1994
|
+
coreAgentHover(agent, filterPanelOpen);
|
|
1995
|
+
if (!filterPanelOpen) setRightPanel("detail");
|
|
1996
|
+
},
|
|
1997
|
+
[isMobile, rightPanel, coreAgentHover]
|
|
1998
|
+
);
|
|
1999
|
+
const handleAgentHoverEnd = (0, import_react6.useCallback)(
|
|
2000
|
+
(agent) => {
|
|
2001
|
+
if (isMobile) return;
|
|
2002
|
+
if (rightPanel !== "detail") return;
|
|
2003
|
+
coreAgentHoverEnd(agent, () => setRightPanel(null));
|
|
2004
|
+
},
|
|
2005
|
+
[isMobile, rightPanel, coreAgentHoverEnd]
|
|
2006
|
+
);
|
|
2007
|
+
const handleDetailPanelMouseLeave = (0, import_react6.useCallback)(() => {
|
|
2008
|
+
coreDetailMouseLeave(() => setRightPanel(null));
|
|
2009
|
+
}, [coreDetailMouseLeave]);
|
|
2010
|
+
const resolveAgentHref = (0, import_react6.useMemo)(() => {
|
|
2011
|
+
if (resolveAgentHrefProp) return resolveAgentHrefProp;
|
|
2012
|
+
if (!navigateTo) return void 0;
|
|
2013
|
+
return (agent) => navigateTo.replace("{id}", agent.id);
|
|
2014
|
+
}, [navigateTo, resolveAgentHrefProp]);
|
|
2015
|
+
const hasRightPanel = rightPanel !== null;
|
|
2016
|
+
const triggerButton = triggerSlot ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2017
|
+
"button",
|
|
2018
|
+
{
|
|
2019
|
+
type: "button",
|
|
2020
|
+
className: (0, import_design_system6.cn)(
|
|
2021
|
+
"inline-flex items-center rounded-md text-xs font-medium transition-colors",
|
|
2022
|
+
"bg-background hover:bg-muted/50 text-foreground/80 hover:text-foreground",
|
|
2023
|
+
compact ? "h-5 gap-1 px-1.5" : "h-7 gap-1.5 px-2.5",
|
|
2024
|
+
!noBorder && "border border-border",
|
|
2025
|
+
className
|
|
2026
|
+
),
|
|
2027
|
+
children: [
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "min-w-0 max-w-[200px] flex-1 truncate text-left", children: displayLabel }),
|
|
2029
|
+
activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex items-center justify-center w-4 h-4 rounded-md bg-primary text-primary-foreground text-[10px]", children: activeFilterCount }),
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronDownIcon, { className: "w-3 h-3 text-muted-foreground/60" })
|
|
2031
|
+
]
|
|
2032
|
+
}
|
|
2033
|
+
);
|
|
2034
|
+
const wrapTrigger = (Trigger) => {
|
|
2035
|
+
if (!showAssignedTooltip) {
|
|
2036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Trigger, { asChild: true, children: triggerButton });
|
|
2037
|
+
}
|
|
2038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system6.Tooltip, { ...open ? { open: false } : {}, children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system6.TooltipTrigger, { asChild: true, children: triggerButton }) }),
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system6.TooltipContent, { side: "bottom", className: "max-w-xs", children: displayLabel })
|
|
2041
|
+
] });
|
|
2042
|
+
};
|
|
2043
|
+
const listPanel = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2044
|
+
AgentListContent,
|
|
2045
|
+
{
|
|
2046
|
+
agents,
|
|
2047
|
+
isLoading,
|
|
2048
|
+
consumer,
|
|
2049
|
+
activeAgentId,
|
|
2050
|
+
allCategories,
|
|
2051
|
+
allTags,
|
|
2052
|
+
inputRef,
|
|
2053
|
+
onSelectAgent: handleSelectAgent,
|
|
2054
|
+
...resolveAgentHref ? { resolveAgentHref } : {},
|
|
2055
|
+
onReset: consumer.resetFilters,
|
|
2056
|
+
activeFilterCount,
|
|
2057
|
+
isMobile,
|
|
2058
|
+
hoveredAgent,
|
|
2059
|
+
onAgentHover: handleAgentHover,
|
|
2060
|
+
onAgentHoverEnd: handleAgentHoverEnd,
|
|
2061
|
+
onDetailPress: setMobileDetailAgent,
|
|
2062
|
+
onFilterChipClick: handleFilterChipClick,
|
|
2063
|
+
rightPanel,
|
|
2064
|
+
tabCounts,
|
|
2065
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2066
|
+
...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
|
|
2067
|
+
systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
|
|
2068
|
+
} : {},
|
|
2069
|
+
pinnedAgent: showPinnedAgent ? pinnedAgent : null,
|
|
2070
|
+
defaultRow,
|
|
2071
|
+
listOpen: open
|
|
2072
|
+
}
|
|
2073
|
+
);
|
|
2074
|
+
if (isMobile) {
|
|
2075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system6.Drawer, { open, onOpenChange: handleOpen, children: [
|
|
2076
|
+
wrapTrigger(import_design_system6.DrawerTrigger),
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system6.DrawerContent, { className: "h-[85dvh]", children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_design_system6.DrawerTitle, { className: "sr-only", children: "Select Agent" }),
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col overflow-hidden flex-1 min-h-0", children: mobileDetailAgent ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col overflow-hidden", children: [
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2081
|
+
"button",
|
|
2082
|
+
{
|
|
2083
|
+
type: "button",
|
|
2084
|
+
onClick: () => setMobileDetailAgent(null),
|
|
2085
|
+
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",
|
|
2086
|
+
children: [
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronRightIcon, { className: "w-4 h-4 rotate-180" }),
|
|
2088
|
+
"Back"
|
|
2089
|
+
]
|
|
2090
|
+
}
|
|
2091
|
+
),
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2093
|
+
AgentDetailCard,
|
|
2094
|
+
{
|
|
2095
|
+
agent: mobileDetailAgent,
|
|
2096
|
+
onSelect: () => handleSelectAgent(mobileDetailAgent)
|
|
2097
|
+
}
|
|
2098
|
+
) })
|
|
2099
|
+
] }) : mobileSubView ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2100
|
+
AgentMobileSubView,
|
|
2101
|
+
{
|
|
2102
|
+
view: mobileSubView,
|
|
2103
|
+
consumer,
|
|
2104
|
+
allCategories,
|
|
2105
|
+
allTags,
|
|
2106
|
+
catSearch,
|
|
2107
|
+
setCatSearch,
|
|
2108
|
+
tagSearch,
|
|
2109
|
+
setTagSearch,
|
|
2110
|
+
onBack: () => {
|
|
2111
|
+
setMobileSubView(null);
|
|
2112
|
+
setCatSearch("");
|
|
2113
|
+
setTagSearch("");
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
) : listPanel })
|
|
2117
|
+
] })
|
|
2118
|
+
] });
|
|
2119
|
+
}
|
|
2120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_design_system6.Popover, { open, onOpenChange: handleOpen, modal: false, children: [
|
|
2121
|
+
wrapTrigger(import_design_system6.PopoverTrigger),
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2123
|
+
import_design_system6.PopoverContent,
|
|
2124
|
+
{
|
|
2125
|
+
...contentSide ? { side: contentSide } : {},
|
|
2126
|
+
align: "start",
|
|
2127
|
+
sideOffset: 4,
|
|
2128
|
+
collisionPadding: 12,
|
|
2129
|
+
sticky: "always",
|
|
2130
|
+
...popoverContainer ? { container: popoverContainer } : {},
|
|
2131
|
+
className: "p-0 overflow-hidden w-[680px]",
|
|
2132
|
+
style: { height: PANEL_HEIGHT, maxHeight: LIST_MAX_HEIGHT },
|
|
2133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex h-full", children: [
|
|
2134
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col min-w-0 w-[340px] shrink-0 border-r border-border", children: listPanel }),
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2136
|
+
"div",
|
|
2137
|
+
{
|
|
2138
|
+
className: "h-full w-[340px] shrink-0 overflow-hidden flex flex-col",
|
|
2139
|
+
onMouseEnter: rightPanel === "detail" ? handleDetailPanelMouseEnter : void 0,
|
|
2140
|
+
onMouseLeave: rightPanel === "detail" ? handleDetailPanelMouseLeave : void 0,
|
|
2141
|
+
children: [
|
|
2142
|
+
rightPanel === "detail" && hoveredAgent && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "h-full matrx-agent-fade-in", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2143
|
+
AgentDetailCard,
|
|
2144
|
+
{
|
|
2145
|
+
agent: hoveredAgent,
|
|
2146
|
+
onSelect: () => handleSelectAgent(hoveredAgent)
|
|
2147
|
+
}
|
|
2148
|
+
) }, hoveredAgent.id),
|
|
2149
|
+
rightPanel === "sort" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2150
|
+
AgentSortPanel,
|
|
2151
|
+
{
|
|
2152
|
+
consumer,
|
|
2153
|
+
onClose: () => setRightPanel(null)
|
|
2154
|
+
}
|
|
2155
|
+
),
|
|
2156
|
+
rightPanel === "categories" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2157
|
+
AgentCategoriesPanel,
|
|
2158
|
+
{
|
|
2159
|
+
consumer,
|
|
2160
|
+
allCategories,
|
|
2161
|
+
search: catSearch,
|
|
2162
|
+
setSearch: setCatSearch,
|
|
2163
|
+
onClose: () => {
|
|
2164
|
+
setRightPanel(null);
|
|
2165
|
+
setCatSearch("");
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
),
|
|
2169
|
+
rightPanel === "tags" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2170
|
+
AgentTagsPanel,
|
|
2171
|
+
{
|
|
2172
|
+
consumer,
|
|
2173
|
+
allTags,
|
|
2174
|
+
search: tagSearch,
|
|
2175
|
+
setSearch: setTagSearch,
|
|
2176
|
+
onClose: () => {
|
|
2177
|
+
setRightPanel(null);
|
|
2178
|
+
setTagSearch("");
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
),
|
|
2182
|
+
!hasRightPanel && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center", children: [
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MousePointerClickIcon, { className: "h-6 w-6 text-muted-foreground/40" }),
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-muted-foreground/70 leading-relaxed", children: labels.hoverHint })
|
|
2185
|
+
] })
|
|
2186
|
+
]
|
|
2187
|
+
}
|
|
2188
|
+
)
|
|
2189
|
+
] })
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2192
|
+
] });
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// catalog/react/AgentListInlinePicker.tsx
|
|
2196
|
+
var import_design_system7 = require("@ai-matrx/design-system");
|
|
2197
|
+
var import_react7 = require("react");
|
|
2198
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2199
|
+
function AgentListInlinePicker({
|
|
2200
|
+
consumerId,
|
|
2201
|
+
onSelect,
|
|
2202
|
+
activeAgentId = null,
|
|
2203
|
+
className,
|
|
2204
|
+
autoFocusSearch = true,
|
|
2205
|
+
initialTab,
|
|
2206
|
+
includeSystemInAll = false,
|
|
2207
|
+
visibleTabs,
|
|
2208
|
+
systemTabLabel,
|
|
2209
|
+
resolveAgentHref,
|
|
2210
|
+
showPinnedAgent = true,
|
|
2211
|
+
excludeAgentIds,
|
|
2212
|
+
defaultMandateKey
|
|
2213
|
+
}) {
|
|
2214
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
2215
|
+
const [catSearch, setCatSearch] = (0, import_react7.useState)("");
|
|
2216
|
+
const [tagSearch, setTagSearch] = (0, import_react7.useState)("");
|
|
2217
|
+
const [mobileDetailAgent, setMobileDetailAgent] = (0, import_react7.useState)(null);
|
|
2218
|
+
const [mobileSubView, setMobileSubView] = (0, import_react7.useState)(null);
|
|
2219
|
+
const {
|
|
2220
|
+
agents,
|
|
2221
|
+
isLoading,
|
|
2222
|
+
allCategories,
|
|
2223
|
+
allTags,
|
|
2224
|
+
consumer,
|
|
2225
|
+
tabCounts,
|
|
2226
|
+
activeFilterCount,
|
|
2227
|
+
hoveredAgent,
|
|
2228
|
+
pinnedAgent,
|
|
2229
|
+
defaultRow,
|
|
2230
|
+
ensureLoaded,
|
|
2231
|
+
handleSelectAgent: coreSelectAgent,
|
|
2232
|
+
handleAgentHover,
|
|
2233
|
+
handleAgentHoverEnd
|
|
2234
|
+
} = useAgentListCore({
|
|
2235
|
+
consumerId,
|
|
2236
|
+
onSelect,
|
|
2237
|
+
activeAgentIdOverride: activeAgentId,
|
|
2238
|
+
...initialTab ? { initialTab } : {},
|
|
2239
|
+
includeSystemInAll,
|
|
2240
|
+
// The restriction has to reach the CORE, not just the tab strip — see
|
|
2241
|
+
// `AgentListCoreOptions.visibleTabs`.
|
|
2242
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2243
|
+
...excludeAgentIds ? { excludeAgentIds } : {},
|
|
2244
|
+
...defaultMandateKey ? { defaultMandateKey } : {}
|
|
2245
|
+
});
|
|
2246
|
+
(0, import_react7.useEffect)(() => {
|
|
2247
|
+
ensureLoaded();
|
|
2248
|
+
if (!autoFocusSearch) return void 0;
|
|
2249
|
+
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
2250
|
+
return () => clearTimeout(timer);
|
|
2251
|
+
}, [ensureLoaded, autoFocusSearch]);
|
|
2252
|
+
const handleSelectAgent = (agent) => {
|
|
2253
|
+
coreSelectAgent(agent);
|
|
2254
|
+
setMobileDetailAgent(null);
|
|
2255
|
+
setMobileSubView(null);
|
|
2256
|
+
};
|
|
2257
|
+
const handleFilterChipClick = (panel) => {
|
|
2258
|
+
setMobileSubView(panel);
|
|
2259
|
+
};
|
|
2260
|
+
const isMobile = true;
|
|
2261
|
+
if (mobileDetailAgent) {
|
|
2262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_design_system7.cn)("flex h-full min-h-0 flex-col", className), children: [
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2264
|
+
"button",
|
|
2265
|
+
{
|
|
2266
|
+
type: "button",
|
|
2267
|
+
onClick: () => setMobileDetailAgent(null),
|
|
2268
|
+
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",
|
|
2269
|
+
children: [
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronRightIcon, { className: "h-4 w-4 rotate-180" }),
|
|
2271
|
+
"Back"
|
|
2272
|
+
]
|
|
2273
|
+
}
|
|
2274
|
+
),
|
|
2275
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2276
|
+
AgentDetailCard,
|
|
2277
|
+
{
|
|
2278
|
+
agent: mobileDetailAgent,
|
|
2279
|
+
onSelect: () => handleSelectAgent(mobileDetailAgent)
|
|
2280
|
+
}
|
|
2281
|
+
) })
|
|
2282
|
+
] });
|
|
2283
|
+
}
|
|
2284
|
+
if (mobileSubView) {
|
|
2285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_design_system7.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2286
|
+
AgentMobileSubView,
|
|
2287
|
+
{
|
|
2288
|
+
view: mobileSubView,
|
|
2289
|
+
consumer,
|
|
2290
|
+
allCategories,
|
|
2291
|
+
allTags,
|
|
2292
|
+
catSearch,
|
|
2293
|
+
setCatSearch,
|
|
2294
|
+
tagSearch,
|
|
2295
|
+
setTagSearch,
|
|
2296
|
+
onBack: () => {
|
|
2297
|
+
setMobileSubView(null);
|
|
2298
|
+
setCatSearch("");
|
|
2299
|
+
setTagSearch("");
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
) });
|
|
2303
|
+
}
|
|
2304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: (0, import_design_system7.cn)("flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2305
|
+
AgentListContent,
|
|
2306
|
+
{
|
|
2307
|
+
agents,
|
|
2308
|
+
isLoading,
|
|
2309
|
+
consumer,
|
|
2310
|
+
activeAgentId,
|
|
2311
|
+
allCategories,
|
|
2312
|
+
allTags,
|
|
2313
|
+
inputRef,
|
|
2314
|
+
onSelectAgent: handleSelectAgent,
|
|
2315
|
+
...resolveAgentHref ? { resolveAgentHref } : {},
|
|
2316
|
+
onReset: consumer.resetFilters,
|
|
2317
|
+
activeFilterCount,
|
|
2318
|
+
isMobile,
|
|
2319
|
+
hoveredAgent,
|
|
2320
|
+
onAgentHover: (agent) => handleAgentHover(agent, false),
|
|
2321
|
+
onAgentHoverEnd: (agent) => handleAgentHoverEnd(agent, () => {
|
|
2322
|
+
}),
|
|
2323
|
+
onDetailPress: setMobileDetailAgent,
|
|
2324
|
+
onFilterChipClick: handleFilterChipClick,
|
|
2325
|
+
rightPanel: null,
|
|
2326
|
+
tabCounts,
|
|
2327
|
+
...visibleTabs ? { visibleTabs } : {},
|
|
2328
|
+
...systemTabLabel ?? (includeSystemInAll ? "System" : void 0) ? {
|
|
2329
|
+
systemTabLabel: systemTabLabel ?? (includeSystemInAll ? "System" : void 0)
|
|
2330
|
+
} : {},
|
|
2331
|
+
pinnedAgent: showPinnedAgent ? pinnedAgent : null,
|
|
2332
|
+
defaultRow,
|
|
2333
|
+
listOpen: true
|
|
2334
|
+
}
|
|
2335
|
+
) });
|
|
2336
|
+
}
|
|
2337
|
+
//# sourceMappingURL=index.cjs.map
|