@ai-matrx/agents 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +108 -0
- package/dist/catalog/index.cjs +51 -12
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +78 -4
- package/dist/catalog/index.d.ts +78 -4
- package/dist/catalog/index.js +51 -12
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +51 -19
- package/dist/catalog/native/index.cjs.map +1 -1
- package/dist/catalog/native/index.d.cts +7 -2
- package/dist/catalog/native/index.d.ts +7 -2
- package/dist/catalog/native/index.js +51 -19
- package/dist/catalog/native/index.js.map +1 -1
- package/dist/catalog/react/index.cjs +55 -22
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +5 -0
- package/dist/catalog/react/index.d.ts +5 -0
- package/dist/catalog/react/index.js +55 -22
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/{orchestra-BWJM2MWP.d.cts → orchestra-CID-rsu8.d.cts} +1 -1
- package/dist/{orchestra-BWJM2MWP.d.ts → orchestra-CID-rsu8.d.ts} +1 -1
- package/package.json +1 -1
package/dist/catalog/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogTransport, c as AgentCatalogStorageLike, d as AgentCatalogErrorSink, R as ResolvedDefaultRow, e as AgentCatalogStorage, M as MandateResolutionVerdict, f as AgentTab, g as AgentCatalogLabels, h as AgentConsumerState, i as AgentSortOption } from '../orchestra-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogTransport, c as AgentCatalogStorageLike, d as AgentCatalogErrorSink, R as ResolvedDefaultRow, e as AgentCatalogStorage, M as MandateResolutionVerdict, f as AgentTab, g as AgentCatalogLabels, h as AgentConsumerState, i as AgentArchFilter, j as AgentSortOption } from '../orchestra-CID-rsu8.cjs';
|
|
2
|
+
export { k as AGENT_NONE_SENTINEL, l as AgentAccessFilter, m as AgentAccessLevel, n as AgentCatalog, o as AgentCatalogAgentType, p as AgentCatalogAsyncStorage, q as AgentCatalogConfig, r as AgentCatalogConfigError, s as AgentCatalogIdentity, t as AgentCatalogNavigate, u as AgentCatalogNotifier, v as AgentCatalogOpenPeek, w as AgentCatalogResolveHref, x as AgentCatalogRpcCall, y as AgentCatalogSchemaReport, z as AgentCatalogState, B as AgentCatalogStatus, C as AgentCatalogTableQuery, D as AgentConsumerPatch, E as AgentFavFilter, F as AgentId, G as AssertAgentCatalogSchemaOptions, H as DEFAULT_AGENT_CATALOG_LABELS, I as DEFAULT_AGENT_CONSUMER_STATE, J as DefaultRowState, O as OrchestraBadge, P as PgErrorLike, K as PgResultLike, S as SORT_OPTIONS, L as asAgentId, N as assertAgentCatalogSchema, Q as createAgentCatalog, T as getRegisteredAgentCatalog, U as isMandateAgentId, V as mandateAgentId, W as orchestraDelegatesLine, X as orchestraDepthLine, Y as orchestraLabel, Z as orchestraModeLabel } from '../orchestra-CID-rsu8.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* catalog/data.ts — @ai-matrx/agents/catalog
|
|
@@ -257,7 +257,18 @@ declare function agentMatchesSearch(agent: AgentSearchable, query: string): bool
|
|
|
257
257
|
* frontend's `selectLiveAgents` filters `isVersion` snapshots out of a store
|
|
258
258
|
* that also holds them. This catalog only ever holds list rows — a version
|
|
259
259
|
* snapshot cannot enter it — so that filter is a no-op here and is not
|
|
260
|
-
* ported.
|
|
260
|
+
* ported.
|
|
261
|
+
*
|
|
262
|
+
* 🚨 TWO DELIBERATE DEPARTURES FROM THE ORIGINAL, both defects the port
|
|
263
|
+
* inherited and 0.9.1 fixes at the class (see CHANGELOG 0.9.1):
|
|
264
|
+
*
|
|
265
|
+
* F1 — every sort now ends on `id` ASC, the same final key `agx_get_list`
|
|
266
|
+
* ends on, so the order of TIED rows is defined by the rows instead of
|
|
267
|
+
* by whichever transport the host used to fetch them.
|
|
268
|
+
* F5 — the tab-badge counts honour the archive filter, so the badge, the
|
|
269
|
+
* footer and the rendered rows are the same number.
|
|
270
|
+
*
|
|
271
|
+
* Everything else below is byte-identical to the original.
|
|
261
272
|
*/
|
|
262
273
|
|
|
263
274
|
declare const AGENT_CARDS_LIMIT_DESKTOP = 8;
|
|
@@ -273,6 +284,31 @@ declare const AGENT_LIST_ITEMS_PER_PAGE = 20;
|
|
|
273
284
|
declare function memoize1<A, R>(fn: (a: A) => R): (a: A) => R;
|
|
274
285
|
declare function memoize2<A, B, R>(fn: (a: A, b: B) => R): (a: A, b: B) => R;
|
|
275
286
|
declare function memoize3<A, B, C, R>(fn: (a: A, b: B, c: C) => R): (a: A, b: B, c: C) => R;
|
|
287
|
+
/**
|
|
288
|
+
* 🚨 THE FINAL TIEBREAKER. `agx_get_list` orders
|
|
289
|
+
* `is_favorite DESC, updated_at DESC, id` — `id` ASCENDING is the unique key
|
|
290
|
+
* that makes the SERVER's order TOTAL. Every sort in this file ends on the
|
|
291
|
+
* same key, so the rendered order is a function of the ROWS and never of the
|
|
292
|
+
* order they happened to arrive in.
|
|
293
|
+
*
|
|
294
|
+
* Why a raw `<` / `>` and not `localeCompare`: Postgres orders `uuid` by its
|
|
295
|
+
* 16 raw bytes. The canonical text form is lowercase hex with dashes at fixed
|
|
296
|
+
* positions, so a codepoint comparison of those strings reproduces the
|
|
297
|
+
* database's order exactly. A locale collator does not — it is free to fold
|
|
298
|
+
* case or ignore punctuation, and would silently diverge from the server on
|
|
299
|
+
* precisely the ties this key exists to settle.
|
|
300
|
+
*/
|
|
301
|
+
declare function compareAgentIds(a: AgentSummary, b: AgentSummary): number;
|
|
302
|
+
/**
|
|
303
|
+
* The chosen sort key, then `id`. TOTAL for every option.
|
|
304
|
+
*
|
|
305
|
+
* Before 0.9.1 each branch below returned 0 for tied rows, which left their
|
|
306
|
+
* relative order to whatever `Array.prototype.sort` had been handed — i.e. to
|
|
307
|
+
* the transport. A host that fetched the RPC in one shot kept the server's
|
|
308
|
+
* favourites-first/`updated_at DESC` order for ties; a host that paged it with
|
|
309
|
+
* `order=id.asc` kept id-ASC. Same rows, same filters, two different screens.
|
|
310
|
+
* The key below is the server's own, so both now render the server's answer.
|
|
311
|
+
*/
|
|
276
312
|
declare function applyAgentSortComparator(a: AgentSummary, b: AgentSummary, sortBy: AgentSortOption): number;
|
|
277
313
|
/** All unique categories across live USER agents, sorted alphabetically. */
|
|
278
314
|
declare const selectAllAgentCategories: (a: readonly AgentSummary[]) => string[];
|
|
@@ -290,6 +326,15 @@ declare const selectAllSystemAgentTags: (a: readonly AgentSummary[]) => string[]
|
|
|
290
326
|
declare const selectUserTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
|
|
291
327
|
/** Builtin/system agents only. For chat pickers and full catalogues. */
|
|
292
328
|
declare const selectBuiltinTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
|
|
329
|
+
/**
|
|
330
|
+
* The ONE ordering rule, and it is TOTAL on every path.
|
|
331
|
+
*
|
|
332
|
+
* searching: score DESC → server rank ASC → sort key → id ASC
|
|
333
|
+
* not searching: favourites first (when asked) → sort key → id ASC
|
|
334
|
+
*
|
|
335
|
+
* `id` ASC is the final key `agx_get_list` itself ends on, so two hosts that
|
|
336
|
+
* fetched the same rows through different transports render the same screen.
|
|
337
|
+
*/
|
|
293
338
|
declare function sortFilteredAgents(filtered: AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
|
|
294
339
|
/** User-type agents — mine / shared / all tabs with full consumer filters. */
|
|
295
340
|
declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
|
|
@@ -339,6 +384,35 @@ declare const makeSelectFilteredAgentsCount: () => (a: readonly AgentSummary[],
|
|
|
339
384
|
declare const makeSelectFilteredBuiltinAgentsCount: () => (a: readonly AgentSummary[], b: AgentConsumerState) => number;
|
|
340
385
|
/** Returns whether a consumer has any non-default filters active. */
|
|
341
386
|
declare function agentConsumerHasActiveFilters(consumer: AgentConsumerState, defaults: AgentConsumerState): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* 🚨 A BADGE COUNTS WHAT THE TAB RENDERS. Nothing else.
|
|
389
|
+
*
|
|
390
|
+
* Before 0.9.1 these five counted every user-type row, archived included,
|
|
391
|
+
* while `filterUserTypeAgents` (archive filter `active`, the default) hid the
|
|
392
|
+
* archived ones. The badge said "Mine 416", the list showed 412 rows and the
|
|
393
|
+
* footer said "412 agents" — one screen, three numbers, one of them a lie
|
|
394
|
+
* about agents the user cannot see or reach from there.
|
|
395
|
+
*
|
|
396
|
+
* `is_archived` is now honoured by the same rule the list uses, so the badge,
|
|
397
|
+
* the footer and the rows agree on every tab and under every archive filter.
|
|
398
|
+
* The system tab is the exception with a reason: `filterBuiltinTypeAgents`
|
|
399
|
+
* applies no archive filter (a builtin belongs to the platform and is never
|
|
400
|
+
* the user's to archive), so its count applies none either — it already
|
|
401
|
+
* counted exactly what it rendered.
|
|
402
|
+
*/
|
|
403
|
+
declare function agentMatchesArchiveFilter(agent: AgentSummary, archFilter: AgentArchFilter): boolean;
|
|
404
|
+
/**
|
|
405
|
+
* The four tab badges for a consumer's CURRENT archive filter — the numbers
|
|
406
|
+
* `useAgentListCore` puts on the tab strip. Flip the archive filter to
|
|
407
|
+
* "archived" and the badges follow the list into the archive.
|
|
408
|
+
*/
|
|
409
|
+
declare const selectAgentTabCounts: (a: readonly AgentSummary[], b: AgentArchFilter) => {
|
|
410
|
+
mine: number;
|
|
411
|
+
shared: number;
|
|
412
|
+
all: number;
|
|
413
|
+
system: number;
|
|
414
|
+
};
|
|
415
|
+
/** Live user-type agents the default (`active`) list renders. */
|
|
342
416
|
declare const selectTotalUserAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
343
417
|
declare const selectTotalOwnedAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
344
418
|
declare const selectTotalSharedAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
@@ -361,4 +435,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
|
|
|
361
435
|
/** @internal Test-only: forget every session-shared value. */
|
|
362
436
|
declare function _resetCatalogGlobalState(): void;
|
|
363
437
|
|
|
364
|
-
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogLabels, AgentCatalogReadError, AgentCatalogStorage, AgentCatalogStorageLike, AgentCatalogTransport, AgentConsumerState, type AgentListPage, type AgentSearchable, type AgentServerSearchResult, AgentSortOption, AgentSummary, AgentTab, MandateDefaultRowError, MandateResolutionVerdict, type ResolveDefaultRowArgs, type ResolveDefaultRowOutcome, ResolvedDefaultRow, _resetCatalogGlobalState, agentConsumerHasActiveFilters, agentListEmptyLabel, agentMatchesSearch, applyAgentSortComparator, computeAgentSearchScore, createMemoryStorage, defaultRowFromResolution, defaultStorage, detectDefaultRowDrift, filterBuiltinTypeAgents, filterUserTypeAgents, makeSelectFilteredAgents, makeSelectFilteredAgentsCount, makeSelectFilteredBuiltinAgents, makeSelectFilteredBuiltinAgentsCount, makeSelectFilteredOwnedAgents, makeSelectFilteredSharedAgents, makeSelectOwnedAgentCards, makeSelectOwnedAgentListItems, makeSelectSharedAgentCards, makeSelectSharedAgentListItems, memoize1, memoize2, memoize3, parseMandateResolution, readAgentCatalogRows, readCachedDefaultRow, readCachedDefaultRowAsync, readSingleAgentRow, resolveDefaultRow, searchAgentsOnServer, selectAllAgentCategories, selectAllAgentTags, selectAllSystemAgentCategories, selectAllSystemAgentTags, selectBuiltinTypeAgents, selectTotalBuiltinAgentsCount, selectTotalFavoriteAgentsCount, selectTotalOwnedAgentsCount, selectTotalSharedAgentsCount, selectTotalUserAgentsCount, selectUserTypeAgents, shouldDefaultAgentListToPublicTab, sortFilteredAgents, toAgentSummary, writeAgentFavorite, writeCachedDefaultRow, writeCachedDefaultRowAsync };
|
|
438
|
+
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentArchFilter, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogLabels, AgentCatalogReadError, AgentCatalogStorage, AgentCatalogStorageLike, AgentCatalogTransport, AgentConsumerState, type AgentListPage, type AgentSearchable, type AgentServerSearchResult, AgentSortOption, AgentSummary, AgentTab, MandateDefaultRowError, MandateResolutionVerdict, type ResolveDefaultRowArgs, type ResolveDefaultRowOutcome, ResolvedDefaultRow, _resetCatalogGlobalState, agentConsumerHasActiveFilters, agentListEmptyLabel, agentMatchesArchiveFilter, agentMatchesSearch, applyAgentSortComparator, compareAgentIds, computeAgentSearchScore, createMemoryStorage, defaultRowFromResolution, defaultStorage, detectDefaultRowDrift, filterBuiltinTypeAgents, filterUserTypeAgents, makeSelectFilteredAgents, makeSelectFilteredAgentsCount, makeSelectFilteredBuiltinAgents, makeSelectFilteredBuiltinAgentsCount, makeSelectFilteredOwnedAgents, makeSelectFilteredSharedAgents, makeSelectOwnedAgentCards, makeSelectOwnedAgentListItems, makeSelectSharedAgentCards, makeSelectSharedAgentListItems, memoize1, memoize2, memoize3, parseMandateResolution, readAgentCatalogRows, readCachedDefaultRow, readCachedDefaultRowAsync, readSingleAgentRow, resolveDefaultRow, searchAgentsOnServer, selectAgentTabCounts, selectAllAgentCategories, selectAllAgentTags, selectAllSystemAgentCategories, selectAllSystemAgentTags, selectBuiltinTypeAgents, selectTotalBuiltinAgentsCount, selectTotalFavoriteAgentsCount, selectTotalOwnedAgentsCount, selectTotalSharedAgentsCount, selectTotalUserAgentsCount, selectUserTypeAgents, shouldDefaultAgentListToPublicTab, sortFilteredAgents, toAgentSummary, writeAgentFavorite, writeCachedDefaultRow, writeCachedDefaultRowAsync };
|
package/dist/catalog/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogTransport, c as AgentCatalogStorageLike, d as AgentCatalogErrorSink, R as ResolvedDefaultRow, e as AgentCatalogStorage, M as MandateResolutionVerdict, f as AgentTab, g as AgentCatalogLabels, h as AgentConsumerState, i as AgentSortOption } from '../orchestra-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogTransport, c as AgentCatalogStorageLike, d as AgentCatalogErrorSink, R as ResolvedDefaultRow, e as AgentCatalogStorage, M as MandateResolutionVerdict, f as AgentTab, g as AgentCatalogLabels, h as AgentConsumerState, i as AgentArchFilter, j as AgentSortOption } from '../orchestra-CID-rsu8.js';
|
|
2
|
+
export { k as AGENT_NONE_SENTINEL, l as AgentAccessFilter, m as AgentAccessLevel, n as AgentCatalog, o as AgentCatalogAgentType, p as AgentCatalogAsyncStorage, q as AgentCatalogConfig, r as AgentCatalogConfigError, s as AgentCatalogIdentity, t as AgentCatalogNavigate, u as AgentCatalogNotifier, v as AgentCatalogOpenPeek, w as AgentCatalogResolveHref, x as AgentCatalogRpcCall, y as AgentCatalogSchemaReport, z as AgentCatalogState, B as AgentCatalogStatus, C as AgentCatalogTableQuery, D as AgentConsumerPatch, E as AgentFavFilter, F as AgentId, G as AssertAgentCatalogSchemaOptions, H as DEFAULT_AGENT_CATALOG_LABELS, I as DEFAULT_AGENT_CONSUMER_STATE, J as DefaultRowState, O as OrchestraBadge, P as PgErrorLike, K as PgResultLike, S as SORT_OPTIONS, L as asAgentId, N as assertAgentCatalogSchema, Q as createAgentCatalog, T as getRegisteredAgentCatalog, U as isMandateAgentId, V as mandateAgentId, W as orchestraDelegatesLine, X as orchestraDepthLine, Y as orchestraLabel, Z as orchestraModeLabel } from '../orchestra-CID-rsu8.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* catalog/data.ts — @ai-matrx/agents/catalog
|
|
@@ -257,7 +257,18 @@ declare function agentMatchesSearch(agent: AgentSearchable, query: string): bool
|
|
|
257
257
|
* frontend's `selectLiveAgents` filters `isVersion` snapshots out of a store
|
|
258
258
|
* that also holds them. This catalog only ever holds list rows — a version
|
|
259
259
|
* snapshot cannot enter it — so that filter is a no-op here and is not
|
|
260
|
-
* ported.
|
|
260
|
+
* ported.
|
|
261
|
+
*
|
|
262
|
+
* 🚨 TWO DELIBERATE DEPARTURES FROM THE ORIGINAL, both defects the port
|
|
263
|
+
* inherited and 0.9.1 fixes at the class (see CHANGELOG 0.9.1):
|
|
264
|
+
*
|
|
265
|
+
* F1 — every sort now ends on `id` ASC, the same final key `agx_get_list`
|
|
266
|
+
* ends on, so the order of TIED rows is defined by the rows instead of
|
|
267
|
+
* by whichever transport the host used to fetch them.
|
|
268
|
+
* F5 — the tab-badge counts honour the archive filter, so the badge, the
|
|
269
|
+
* footer and the rendered rows are the same number.
|
|
270
|
+
*
|
|
271
|
+
* Everything else below is byte-identical to the original.
|
|
261
272
|
*/
|
|
262
273
|
|
|
263
274
|
declare const AGENT_CARDS_LIMIT_DESKTOP = 8;
|
|
@@ -273,6 +284,31 @@ declare const AGENT_LIST_ITEMS_PER_PAGE = 20;
|
|
|
273
284
|
declare function memoize1<A, R>(fn: (a: A) => R): (a: A) => R;
|
|
274
285
|
declare function memoize2<A, B, R>(fn: (a: A, b: B) => R): (a: A, b: B) => R;
|
|
275
286
|
declare function memoize3<A, B, C, R>(fn: (a: A, b: B, c: C) => R): (a: A, b: B, c: C) => R;
|
|
287
|
+
/**
|
|
288
|
+
* 🚨 THE FINAL TIEBREAKER. `agx_get_list` orders
|
|
289
|
+
* `is_favorite DESC, updated_at DESC, id` — `id` ASCENDING is the unique key
|
|
290
|
+
* that makes the SERVER's order TOTAL. Every sort in this file ends on the
|
|
291
|
+
* same key, so the rendered order is a function of the ROWS and never of the
|
|
292
|
+
* order they happened to arrive in.
|
|
293
|
+
*
|
|
294
|
+
* Why a raw `<` / `>` and not `localeCompare`: Postgres orders `uuid` by its
|
|
295
|
+
* 16 raw bytes. The canonical text form is lowercase hex with dashes at fixed
|
|
296
|
+
* positions, so a codepoint comparison of those strings reproduces the
|
|
297
|
+
* database's order exactly. A locale collator does not — it is free to fold
|
|
298
|
+
* case or ignore punctuation, and would silently diverge from the server on
|
|
299
|
+
* precisely the ties this key exists to settle.
|
|
300
|
+
*/
|
|
301
|
+
declare function compareAgentIds(a: AgentSummary, b: AgentSummary): number;
|
|
302
|
+
/**
|
|
303
|
+
* The chosen sort key, then `id`. TOTAL for every option.
|
|
304
|
+
*
|
|
305
|
+
* Before 0.9.1 each branch below returned 0 for tied rows, which left their
|
|
306
|
+
* relative order to whatever `Array.prototype.sort` had been handed — i.e. to
|
|
307
|
+
* the transport. A host that fetched the RPC in one shot kept the server's
|
|
308
|
+
* favourites-first/`updated_at DESC` order for ties; a host that paged it with
|
|
309
|
+
* `order=id.asc` kept id-ASC. Same rows, same filters, two different screens.
|
|
310
|
+
* The key below is the server's own, so both now render the server's answer.
|
|
311
|
+
*/
|
|
276
312
|
declare function applyAgentSortComparator(a: AgentSummary, b: AgentSummary, sortBy: AgentSortOption): number;
|
|
277
313
|
/** All unique categories across live USER agents, sorted alphabetically. */
|
|
278
314
|
declare const selectAllAgentCategories: (a: readonly AgentSummary[]) => string[];
|
|
@@ -290,6 +326,15 @@ declare const selectAllSystemAgentTags: (a: readonly AgentSummary[]) => string[]
|
|
|
290
326
|
declare const selectUserTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
|
|
291
327
|
/** Builtin/system agents only. For chat pickers and full catalogues. */
|
|
292
328
|
declare const selectBuiltinTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
|
|
329
|
+
/**
|
|
330
|
+
* The ONE ordering rule, and it is TOTAL on every path.
|
|
331
|
+
*
|
|
332
|
+
* searching: score DESC → server rank ASC → sort key → id ASC
|
|
333
|
+
* not searching: favourites first (when asked) → sort key → id ASC
|
|
334
|
+
*
|
|
335
|
+
* `id` ASC is the final key `agx_get_list` itself ends on, so two hosts that
|
|
336
|
+
* fetched the same rows through different transports render the same screen.
|
|
337
|
+
*/
|
|
293
338
|
declare function sortFilteredAgents(filtered: AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
|
|
294
339
|
/** User-type agents — mine / shared / all tabs with full consumer filters. */
|
|
295
340
|
declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
|
|
@@ -339,6 +384,35 @@ declare const makeSelectFilteredAgentsCount: () => (a: readonly AgentSummary[],
|
|
|
339
384
|
declare const makeSelectFilteredBuiltinAgentsCount: () => (a: readonly AgentSummary[], b: AgentConsumerState) => number;
|
|
340
385
|
/** Returns whether a consumer has any non-default filters active. */
|
|
341
386
|
declare function agentConsumerHasActiveFilters(consumer: AgentConsumerState, defaults: AgentConsumerState): boolean;
|
|
387
|
+
/**
|
|
388
|
+
* 🚨 A BADGE COUNTS WHAT THE TAB RENDERS. Nothing else.
|
|
389
|
+
*
|
|
390
|
+
* Before 0.9.1 these five counted every user-type row, archived included,
|
|
391
|
+
* while `filterUserTypeAgents` (archive filter `active`, the default) hid the
|
|
392
|
+
* archived ones. The badge said "Mine 416", the list showed 412 rows and the
|
|
393
|
+
* footer said "412 agents" — one screen, three numbers, one of them a lie
|
|
394
|
+
* about agents the user cannot see or reach from there.
|
|
395
|
+
*
|
|
396
|
+
* `is_archived` is now honoured by the same rule the list uses, so the badge,
|
|
397
|
+
* the footer and the rows agree on every tab and under every archive filter.
|
|
398
|
+
* The system tab is the exception with a reason: `filterBuiltinTypeAgents`
|
|
399
|
+
* applies no archive filter (a builtin belongs to the platform and is never
|
|
400
|
+
* the user's to archive), so its count applies none either — it already
|
|
401
|
+
* counted exactly what it rendered.
|
|
402
|
+
*/
|
|
403
|
+
declare function agentMatchesArchiveFilter(agent: AgentSummary, archFilter: AgentArchFilter): boolean;
|
|
404
|
+
/**
|
|
405
|
+
* The four tab badges for a consumer's CURRENT archive filter — the numbers
|
|
406
|
+
* `useAgentListCore` puts on the tab strip. Flip the archive filter to
|
|
407
|
+
* "archived" and the badges follow the list into the archive.
|
|
408
|
+
*/
|
|
409
|
+
declare const selectAgentTabCounts: (a: readonly AgentSummary[], b: AgentArchFilter) => {
|
|
410
|
+
mine: number;
|
|
411
|
+
shared: number;
|
|
412
|
+
all: number;
|
|
413
|
+
system: number;
|
|
414
|
+
};
|
|
415
|
+
/** Live user-type agents the default (`active`) list renders. */
|
|
342
416
|
declare const selectTotalUserAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
343
417
|
declare const selectTotalOwnedAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
344
418
|
declare const selectTotalSharedAgentsCount: (a: readonly AgentSummary[]) => number;
|
|
@@ -361,4 +435,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
|
|
|
361
435
|
/** @internal Test-only: forget every session-shared value. */
|
|
362
436
|
declare function _resetCatalogGlobalState(): void;
|
|
363
437
|
|
|
364
|
-
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogLabels, AgentCatalogReadError, AgentCatalogStorage, AgentCatalogStorageLike, AgentCatalogTransport, AgentConsumerState, type AgentListPage, type AgentSearchable, type AgentServerSearchResult, AgentSortOption, AgentSummary, AgentTab, MandateDefaultRowError, MandateResolutionVerdict, type ResolveDefaultRowArgs, type ResolveDefaultRowOutcome, ResolvedDefaultRow, _resetCatalogGlobalState, agentConsumerHasActiveFilters, agentListEmptyLabel, agentMatchesSearch, applyAgentSortComparator, computeAgentSearchScore, createMemoryStorage, defaultRowFromResolution, defaultStorage, detectDefaultRowDrift, filterBuiltinTypeAgents, filterUserTypeAgents, makeSelectFilteredAgents, makeSelectFilteredAgentsCount, makeSelectFilteredBuiltinAgents, makeSelectFilteredBuiltinAgentsCount, makeSelectFilteredOwnedAgents, makeSelectFilteredSharedAgents, makeSelectOwnedAgentCards, makeSelectOwnedAgentListItems, makeSelectSharedAgentCards, makeSelectSharedAgentListItems, memoize1, memoize2, memoize3, parseMandateResolution, readAgentCatalogRows, readCachedDefaultRow, readCachedDefaultRowAsync, readSingleAgentRow, resolveDefaultRow, searchAgentsOnServer, selectAllAgentCategories, selectAllAgentTags, selectAllSystemAgentCategories, selectAllSystemAgentTags, selectBuiltinTypeAgents, selectTotalBuiltinAgentsCount, selectTotalFavoriteAgentsCount, selectTotalOwnedAgentsCount, selectTotalSharedAgentsCount, selectTotalUserAgentsCount, selectUserTypeAgents, shouldDefaultAgentListToPublicTab, sortFilteredAgents, toAgentSummary, writeAgentFavorite, writeCachedDefaultRow, writeCachedDefaultRowAsync };
|
|
438
|
+
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentArchFilter, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogLabels, AgentCatalogReadError, AgentCatalogStorage, AgentCatalogStorageLike, AgentCatalogTransport, AgentConsumerState, type AgentListPage, type AgentSearchable, type AgentServerSearchResult, AgentSortOption, AgentSummary, AgentTab, MandateDefaultRowError, MandateResolutionVerdict, type ResolveDefaultRowArgs, type ResolveDefaultRowOutcome, ResolvedDefaultRow, _resetCatalogGlobalState, agentConsumerHasActiveFilters, agentListEmptyLabel, agentMatchesArchiveFilter, agentMatchesSearch, applyAgentSortComparator, compareAgentIds, computeAgentSearchScore, createMemoryStorage, defaultRowFromResolution, defaultStorage, detectDefaultRowDrift, filterBuiltinTypeAgents, filterUserTypeAgents, makeSelectFilteredAgents, makeSelectFilteredAgentsCount, makeSelectFilteredBuiltinAgents, makeSelectFilteredBuiltinAgentsCount, makeSelectFilteredOwnedAgents, makeSelectFilteredSharedAgents, makeSelectOwnedAgentCards, makeSelectOwnedAgentListItems, makeSelectSharedAgentCards, makeSelectSharedAgentListItems, memoize1, memoize2, memoize3, parseMandateResolution, readAgentCatalogRows, readCachedDefaultRow, readCachedDefaultRowAsync, readSingleAgentRow, resolveDefaultRow, searchAgentsOnServer, selectAgentTabCounts, selectAllAgentCategories, selectAllAgentTags, selectAllSystemAgentCategories, selectAllSystemAgentTags, selectBuiltinTypeAgents, selectTotalBuiltinAgentsCount, selectTotalFavoriteAgentsCount, selectTotalOwnedAgentsCount, selectTotalSharedAgentsCount, selectTotalUserAgentsCount, selectUserTypeAgents, shouldDefaultAgentListToPublicTab, sortFilteredAgents, toAgentSummary, writeAgentFavorite, writeCachedDefaultRow, writeCachedDefaultRowAsync };
|
package/dist/catalog/index.js
CHANGED
|
@@ -219,8 +219,8 @@ async function readSingleAgentRow(client, agentId) {
|
|
|
219
219
|
}
|
|
220
220
|
return null;
|
|
221
221
|
}
|
|
222
|
-
async function writeAgentFavorite(client, agentId,
|
|
223
|
-
const { error } = await client.schema("agent").from("definition").update({ is_favorite:
|
|
222
|
+
async function writeAgentFavorite(client, agentId, isFavorite2) {
|
|
223
|
+
const { error } = await client.schema("agent").from("definition").update({ is_favorite: isFavorite2 }).eq("id", agentId);
|
|
224
224
|
if (error) {
|
|
225
225
|
throw new AgentCatalogReadError(
|
|
226
226
|
"agent.definition.is_favorite",
|
|
@@ -798,7 +798,7 @@ function createAgentCatalog(config) {
|
|
|
798
798
|
mergeRows(result.rows);
|
|
799
799
|
return result.ids;
|
|
800
800
|
}
|
|
801
|
-
async function setFavorite(agentId,
|
|
801
|
+
async function setFavorite(agentId, isFavorite2) {
|
|
802
802
|
const existing = state.byId[agentId];
|
|
803
803
|
if (!existing) {
|
|
804
804
|
errorSink({
|
|
@@ -807,15 +807,15 @@ function createAgentCatalog(config) {
|
|
|
807
807
|
});
|
|
808
808
|
return;
|
|
809
809
|
}
|
|
810
|
-
mergeRows([{ ...existing, isFavorite }]);
|
|
810
|
+
mergeRows([{ ...existing, isFavorite: isFavorite2 }]);
|
|
811
811
|
try {
|
|
812
|
-
await writeAgentFavorite(client, agentId,
|
|
812
|
+
await writeAgentFavorite(client, agentId, isFavorite2);
|
|
813
813
|
} catch (e) {
|
|
814
814
|
mergeRows([existing]);
|
|
815
815
|
errorSink({
|
|
816
816
|
code: "favorite_write_failed",
|
|
817
817
|
message: `the favorite could not be saved: ${errorMessage(e)}`,
|
|
818
|
-
context: { agentId, isFavorite }
|
|
818
|
+
context: { agentId, isFavorite: isFavorite2 }
|
|
819
819
|
});
|
|
820
820
|
notifier?.({
|
|
821
821
|
level: "error",
|
|
@@ -1094,7 +1094,19 @@ function memoize3(fn) {
|
|
|
1094
1094
|
return last;
|
|
1095
1095
|
};
|
|
1096
1096
|
}
|
|
1097
|
+
function compareAgentIds(a, b) {
|
|
1098
|
+
const idA = a.id ?? "";
|
|
1099
|
+
const idB = b.id ?? "";
|
|
1100
|
+
if (idA < idB) return -1;
|
|
1101
|
+
if (idA > idB) return 1;
|
|
1102
|
+
return 0;
|
|
1103
|
+
}
|
|
1097
1104
|
function applyAgentSortComparator(a, b, sortBy) {
|
|
1105
|
+
const primary = compareAgentSortKey(a, b, sortBy);
|
|
1106
|
+
if (!Number.isFinite(primary) || primary === 0) return compareAgentIds(a, b);
|
|
1107
|
+
return primary;
|
|
1108
|
+
}
|
|
1109
|
+
function compareAgentSortKey(a, b, sortBy) {
|
|
1098
1110
|
switch (sortBy) {
|
|
1099
1111
|
case "name-asc":
|
|
1100
1112
|
return (a.name ?? "").localeCompare(b.name ?? "");
|
|
@@ -1342,22 +1354,46 @@ var makeSelectFilteredBuiltinAgentsCount = () => {
|
|
|
1342
1354
|
function agentConsumerHasActiveFilters(consumer, defaults) {
|
|
1343
1355
|
return consumer.tab !== defaults.tab || consumer.sortBy !== defaults.sortBy || consumer.searchTerm !== "" || consumer.includedCats.length > 0 || consumer.includedTags.length > 0 || consumer.favFilter !== defaults.favFilter || consumer.archFilter !== defaults.archFilter || consumer.accessFilter !== defaults.accessFilter || consumer.favoritesFirst !== defaults.favoritesFirst;
|
|
1344
1356
|
}
|
|
1357
|
+
function agentMatchesArchiveFilter(agent, archFilter) {
|
|
1358
|
+
if (archFilter === "active") return !agent.isArchived;
|
|
1359
|
+
if (archFilter === "archived") return Boolean(agent.isArchived);
|
|
1360
|
+
return true;
|
|
1361
|
+
}
|
|
1362
|
+
function countUserRows(agents, archFilter, predicate) {
|
|
1363
|
+
let n = 0;
|
|
1364
|
+
for (const a of agents) {
|
|
1365
|
+
if (a.agentType !== "user") continue;
|
|
1366
|
+
if (!agentMatchesArchiveFilter(a, archFilter)) continue;
|
|
1367
|
+
if (predicate(a)) n += 1;
|
|
1368
|
+
}
|
|
1369
|
+
return n;
|
|
1370
|
+
}
|
|
1371
|
+
var isOwned = (a) => a.isOwner === true;
|
|
1372
|
+
var isShared = (a) => a.isOwner === false && a.accessLevel != null;
|
|
1373
|
+
var isAny = () => true;
|
|
1374
|
+
var isFavorite = (a) => Boolean(a.isFavorite);
|
|
1375
|
+
var selectAgentTabCounts = memoize2(
|
|
1376
|
+
(agents, archFilter) => ({
|
|
1377
|
+
mine: countUserRows(agents, archFilter, isOwned),
|
|
1378
|
+
shared: countUserRows(agents, archFilter, isShared),
|
|
1379
|
+
all: countUserRows(agents, archFilter, isAny),
|
|
1380
|
+
system: selectBuiltinTypeAgents(agents).length
|
|
1381
|
+
})
|
|
1382
|
+
);
|
|
1345
1383
|
var selectTotalUserAgentsCount = memoize1(
|
|
1346
|
-
(agents) =>
|
|
1384
|
+
(agents) => countUserRows(agents, "active", isAny)
|
|
1347
1385
|
);
|
|
1348
1386
|
var selectTotalOwnedAgentsCount = memoize1(
|
|
1349
|
-
(agents) =>
|
|
1387
|
+
(agents) => countUserRows(agents, "active", isOwned)
|
|
1350
1388
|
);
|
|
1351
1389
|
var selectTotalSharedAgentsCount = memoize1(
|
|
1352
|
-
(agents) =>
|
|
1353
|
-
(a) => a.isOwner === false && a.accessLevel != null
|
|
1354
|
-
).length
|
|
1390
|
+
(agents) => countUserRows(agents, "active", isShared)
|
|
1355
1391
|
);
|
|
1356
1392
|
var selectTotalBuiltinAgentsCount = memoize1(
|
|
1357
1393
|
(agents) => selectBuiltinTypeAgents(agents).length
|
|
1358
1394
|
);
|
|
1359
1395
|
var selectTotalFavoriteAgentsCount = memoize1(
|
|
1360
|
-
(agents) =>
|
|
1396
|
+
(agents) => countUserRows(agents, "active", isFavorite)
|
|
1361
1397
|
);
|
|
1362
1398
|
export {
|
|
1363
1399
|
AGENT_CARDS_LIMIT_DESKTOP,
|
|
@@ -1374,10 +1410,12 @@ export {
|
|
|
1374
1410
|
_resetCatalogGlobalState,
|
|
1375
1411
|
agentConsumerHasActiveFilters,
|
|
1376
1412
|
agentListEmptyLabel,
|
|
1413
|
+
agentMatchesArchiveFilter,
|
|
1377
1414
|
agentMatchesSearch,
|
|
1378
1415
|
applyAgentSortComparator,
|
|
1379
1416
|
asAgentId,
|
|
1380
1417
|
assertAgentCatalogSchema,
|
|
1418
|
+
compareAgentIds,
|
|
1381
1419
|
computeAgentSearchScore,
|
|
1382
1420
|
createAgentCatalog,
|
|
1383
1421
|
createMemoryStorage,
|
|
@@ -1413,6 +1451,7 @@ export {
|
|
|
1413
1451
|
readSingleAgentRow,
|
|
1414
1452
|
resolveDefaultRow,
|
|
1415
1453
|
searchAgentsOnServer,
|
|
1454
|
+
selectAgentTabCounts,
|
|
1416
1455
|
selectAllAgentCategories,
|
|
1417
1456
|
selectAllAgentTags,
|
|
1418
1457
|
selectAllSystemAgentCategories,
|