@ai-matrx/agents 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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-BWJM2MWP.cjs';
2
- export { j as AGENT_NONE_SENTINEL, k as AgentAccessFilter, l as AgentAccessLevel, m as AgentArchFilter, 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-BWJM2MWP.cjs';
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 AgentArchFilter, g as AgentTab, h as AgentCatalogLabels, i as AgentConsumerState, j as AgentSortOption } from '../orchestra-DljbEiks.cjs';
2
+ export { k as AGENT_NONE_SENTINEL, l as ARCHIVE_FILTER_OPTIONS, m as ARCHIVE_FILTER_ORDER, n as AgentAccessFilter, o as AgentAccessLevel, p as AgentArchFilterOption, q as AgentCatalog, r as AgentCatalogAgentType, s as AgentCatalogAsyncStorage, t as AgentCatalogConfig, u as AgentCatalogConfigError, v as AgentCatalogDefaults, w as AgentCatalogIdentity, x as AgentCatalogNavigate, y as AgentCatalogNotifier, z as AgentCatalogOpenPeek, B as AgentCatalogResolveHref, C as AgentCatalogRpcCall, D as AgentCatalogSchemaReport, E as AgentCatalogState, F as AgentCatalogStatus, G as AgentCatalogTableQuery, H as AgentConsumerPatch, I as AgentFavFilter, J as AgentId, K as AssertAgentCatalogSchemaOptions, L as DEFAULT_AGENT_CATALOG_LABELS, N as DEFAULT_AGENT_CONSUMER_STATE, O as DefaultRowState, P as OrchestraBadge, Q as PgErrorLike, S as PgResultLike, T as SORT_OPTIONS, U as asAgentId, V as assertAgentCatalogSchema, W as createAgentCatalog, X as getRegisteredAgentCatalog, Y as isAgentArchFilter, Z as isMandateAgentId, _ as mandateAgentId, $ as nextArchFilter, a0 as orchestraDelegatesLine, a1 as orchestraDepthLine, a2 as orchestraLabel, a3 as orchestraModeLabel } from '../orchestra-DljbEiks.cjs';
3
3
 
4
4
  /**
5
5
  * catalog/data.ts — @ai-matrx/agents/catalog
@@ -206,6 +206,36 @@ declare function shouldDefaultAgentListToPublicTab(args: {
206
206
  ownedCount: number;
207
207
  agentsLoaded: boolean;
208
208
  }): boolean;
209
+ /** What the filter-bar chip reads in each state. */
210
+ declare function agentArchiveFilterChipLabel(archFilter: AgentArchFilter): string;
211
+ /** The platform's words for the state — menus, aria-labels, help text. */
212
+ declare function agentArchiveFilterStateLabel(archFilter: AgentArchFilter): string;
213
+ /**
214
+ * The accessible name of the ONE control, always naming the state it is IN
215
+ * and the state one click moves it to. A control whose label does not say
216
+ * what it currently does is the "dead or dishonest" shape the platform bans.
217
+ */
218
+ declare function agentArchiveFilterControlLabel(archFilter: AgentArchFilter): string;
219
+ /**
220
+ * THE FOOTER. It counts exactly what the list rendered and, whenever archived
221
+ * rows are involved, says so — hidden ones included.
222
+ *
223
+ * hide archived, nothing archived behind it → "412 agents"
224
+ * hide archived, 4 archived behind it → "412 agents · 4 archived hidden"
225
+ * show all → "416 agents · archived shown"
226
+ * archived only → "4 archived shown"
227
+ */
228
+ declare function agentListFooterLabel(args: {
229
+ /** Rows actually rendered. */
230
+ count: number;
231
+ archFilter: AgentArchFilter;
232
+ /**
233
+ * Rows this view WOULD render if the filter were flipped to "archived only"
234
+ * — exactly what the default state is keeping off the screen. Only ever
235
+ * read in the `active` state.
236
+ */
237
+ archivedHiddenCount: number;
238
+ }): string;
209
239
 
210
240
  /**
211
241
  * The structural shape a record needs to be searchable. Every field except
@@ -257,7 +287,18 @@ declare function agentMatchesSearch(agent: AgentSearchable, query: string): bool
257
287
  * frontend's `selectLiveAgents` filters `isVersion` snapshots out of a store
258
288
  * that also holds them. This catalog only ever holds list rows — a version
259
289
  * snapshot cannot enter it — so that filter is a no-op here and is not
260
- * ported. Every ordering, tie-break and count below is byte-identical.
290
+ * ported.
291
+ *
292
+ * 🚨 TWO DELIBERATE DEPARTURES FROM THE ORIGINAL, both defects the port
293
+ * inherited and 0.9.1 fixes at the class (see CHANGELOG 0.9.1):
294
+ *
295
+ * F1 — every sort now ends on `id` ASC, the same final key `agx_get_list`
296
+ * ends on, so the order of TIED rows is defined by the rows instead of
297
+ * by whichever transport the host used to fetch them.
298
+ * F5 — the tab-badge counts honour the archive filter, so the badge, the
299
+ * footer and the rendered rows are the same number.
300
+ *
301
+ * Everything else below is byte-identical to the original.
261
302
  */
262
303
 
263
304
  declare const AGENT_CARDS_LIMIT_DESKTOP = 8;
@@ -273,6 +314,31 @@ declare const AGENT_LIST_ITEMS_PER_PAGE = 20;
273
314
  declare function memoize1<A, R>(fn: (a: A) => R): (a: A) => R;
274
315
  declare function memoize2<A, B, R>(fn: (a: A, b: B) => R): (a: A, b: B) => R;
275
316
  declare function memoize3<A, B, C, R>(fn: (a: A, b: B, c: C) => R): (a: A, b: B, c: C) => R;
317
+ /**
318
+ * 🚨 THE FINAL TIEBREAKER. `agx_get_list` orders
319
+ * `is_favorite DESC, updated_at DESC, id` — `id` ASCENDING is the unique key
320
+ * that makes the SERVER's order TOTAL. Every sort in this file ends on the
321
+ * same key, so the rendered order is a function of the ROWS and never of the
322
+ * order they happened to arrive in.
323
+ *
324
+ * Why a raw `<` / `>` and not `localeCompare`: Postgres orders `uuid` by its
325
+ * 16 raw bytes. The canonical text form is lowercase hex with dashes at fixed
326
+ * positions, so a codepoint comparison of those strings reproduces the
327
+ * database's order exactly. A locale collator does not — it is free to fold
328
+ * case or ignore punctuation, and would silently diverge from the server on
329
+ * precisely the ties this key exists to settle.
330
+ */
331
+ declare function compareAgentIds(a: AgentSummary, b: AgentSummary): number;
332
+ /**
333
+ * The chosen sort key, then `id`. TOTAL for every option.
334
+ *
335
+ * Before 0.9.1 each branch below returned 0 for tied rows, which left their
336
+ * relative order to whatever `Array.prototype.sort` had been handed — i.e. to
337
+ * the transport. A host that fetched the RPC in one shot kept the server's
338
+ * favourites-first/`updated_at DESC` order for ties; a host that paged it with
339
+ * `order=id.asc` kept id-ASC. Same rows, same filters, two different screens.
340
+ * The key below is the server's own, so both now render the server's answer.
341
+ */
276
342
  declare function applyAgentSortComparator(a: AgentSummary, b: AgentSummary, sortBy: AgentSortOption): number;
277
343
  /** All unique categories across live USER agents, sorted alphabetically. */
278
344
  declare const selectAllAgentCategories: (a: readonly AgentSummary[]) => string[];
@@ -290,6 +356,15 @@ declare const selectAllSystemAgentTags: (a: readonly AgentSummary[]) => string[]
290
356
  declare const selectUserTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
291
357
  /** Builtin/system agents only. For chat pickers and full catalogues. */
292
358
  declare const selectBuiltinTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
359
+ /**
360
+ * The ONE ordering rule, and it is TOTAL on every path.
361
+ *
362
+ * searching: score DESC → server rank ASC → sort key → id ASC
363
+ * not searching: favourites first (when asked) → sort key → id ASC
364
+ *
365
+ * `id` ASC is the final key `agx_get_list` itself ends on, so two hosts that
366
+ * fetched the same rows through different transports render the same screen.
367
+ */
293
368
  declare function sortFilteredAgents(filtered: AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
294
369
  /** User-type agents — mine / shared / all tabs with full consumer filters. */
295
370
  declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
@@ -297,10 +372,27 @@ declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer:
297
372
  * Builtin/system agents (tab === "system").
298
373
  *
299
374
  * Gets the SAME filter surface every other tab has — search, favorites,
300
- * category, tags, sort. Ownership/archive/access filters are meaningless here
301
- * (a builtin is always active and belongs to the platform), so those are the
302
- * only ones skipped. A picker that offers less on one tab than another is the
303
- * exact half-built shape this list exists to prevent.
375
+ * category, tags, sort, AND THE ARCHIVE FILTER. Only the ownership/access
376
+ * filters are skipped, because a builtin has no owner to filter on. A picker
377
+ * that offers less on one tab than another is the exact half-built shape this
378
+ * list exists to prevent.
379
+ *
380
+ * 🚨 0.9.2 — THE BUILTIN ARCHIVE EXEMPTION IS GONE, AND IT IS NOW ILLEGAL.
381
+ *
382
+ * Until 0.9.1 this function applied no archive filter, on the theory that "a
383
+ * builtin belongs to the platform and is never the user's to archive". The
384
+ * database disagreed: `Foundry Planner`
385
+ * (`001b22f6-fa4d-40c6-a1a4-8575d4d04379`) is an ARCHIVED builtin, and it
386
+ * rendered at Public index 216 and was pickable — while Mine / Shared / All
387
+ * hid their archived rows. One picker, two rules, and a person could choose a
388
+ * retired agent from the one tab that did not obey.
389
+ *
390
+ * THE ARCHIVED-ITEMS LAW (`common-docs/policies/archived-items.md`, Arman
391
+ * 2026-09-09) closed the question for every entity at once: "everything should
392
+ * have an archive filter, and the default should always hide archived… all
393
+ * archived items should always be treated the same." Clause 4 makes it a
394
+ * class, not an instance — so there is no per-tab, per-entity or per-surface
395
+ * exemption left to grant, here or anywhere.
304
396
  */
305
397
  declare function filterBuiltinTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
306
398
  /** Factory: owned user-type agents with consumer filters applied (ignores tab). */
@@ -339,9 +431,47 @@ declare const makeSelectFilteredAgentsCount: () => (a: readonly AgentSummary[],
339
431
  declare const makeSelectFilteredBuiltinAgentsCount: () => (a: readonly AgentSummary[], b: AgentConsumerState) => number;
340
432
  /** Returns whether a consumer has any non-default filters active. */
341
433
  declare function agentConsumerHasActiveFilters(consumer: AgentConsumerState, defaults: AgentConsumerState): boolean;
434
+ /**
435
+ * 🚨 A BADGE COUNTS WHAT THE TAB RENDERS. Nothing else.
436
+ *
437
+ * Before 0.9.1 these five counted every user-type row, archived included,
438
+ * while `filterUserTypeAgents` (archive filter `active`, the default) hid the
439
+ * archived ones. The badge said "Mine 416", the list showed 412 rows and the
440
+ * footer said "412 agents" — one screen, three numbers, one of them a lie
441
+ * about agents the user cannot see or reach from there.
442
+ *
443
+ * `is_archived` is now honoured by the same rule the list uses, so the badge,
444
+ * the footer and the rows agree on every tab and under every archive filter.
445
+ *
446
+ * 🚨 0.9.2 — AND THERE IS NO LONGER AN EXCEPTION. The system tab used to be
447
+ * one ("a builtin is never the user's to archive"), which was false in the
448
+ * database and illegal under THE ARCHIVED-ITEMS LAW. Its badge now counts
449
+ * under the same archive rule its rows render under, so `Foundry Planner`
450
+ * leaves the Public badge and the Public list together, or returns to both
451
+ * together — never one without the other.
452
+ */
453
+ declare function agentMatchesArchiveFilter(agent: AgentSummary, archFilter: AgentArchFilter): boolean;
454
+ /**
455
+ * The four tab badges for a consumer's CURRENT archive filter — the numbers
456
+ * `useAgentListCore` puts on the tab strip. Flip the archive filter to
457
+ * "archived" and the badges follow the list into the archive.
458
+ */
459
+ declare const selectAgentTabCounts: (a: readonly AgentSummary[], b: AgentArchFilter) => {
460
+ mine: number;
461
+ shared: number;
462
+ all: number;
463
+ system: number;
464
+ };
465
+ /** Live user-type agents the default (`active`) list renders. */
342
466
  declare const selectTotalUserAgentsCount: (a: readonly AgentSummary[]) => number;
343
467
  declare const selectTotalOwnedAgentsCount: (a: readonly AgentSummary[]) => number;
344
468
  declare const selectTotalSharedAgentsCount: (a: readonly AgentSummary[]) => number;
469
+ /**
470
+ * Live builtin agents the DEFAULT (`active`) list renders — archived builtins
471
+ * excluded, exactly like every other "total" beside it. Before 0.9.2 this
472
+ * counted archived builtins too, which is how an archived `Foundry Planner`
473
+ * reached the Public badge.
474
+ */
345
475
  declare const selectTotalBuiltinAgentsCount: (a: readonly AgentSummary[]) => number;
346
476
  declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => number;
347
477
 
@@ -361,4 +491,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
361
491
  /** @internal Test-only: forget every session-shared value. */
362
492
  declare function _resetCatalogGlobalState(): void;
363
493
 
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 };
494
+ 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, agentArchiveFilterChipLabel, agentArchiveFilterControlLabel, agentArchiveFilterStateLabel, agentConsumerHasActiveFilters, agentListEmptyLabel, agentListFooterLabel, 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 };
@@ -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-BWJM2MWP.js';
2
- export { j as AGENT_NONE_SENTINEL, k as AgentAccessFilter, l as AgentAccessLevel, m as AgentArchFilter, 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-BWJM2MWP.js';
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 AgentArchFilter, g as AgentTab, h as AgentCatalogLabels, i as AgentConsumerState, j as AgentSortOption } from '../orchestra-DljbEiks.js';
2
+ export { k as AGENT_NONE_SENTINEL, l as ARCHIVE_FILTER_OPTIONS, m as ARCHIVE_FILTER_ORDER, n as AgentAccessFilter, o as AgentAccessLevel, p as AgentArchFilterOption, q as AgentCatalog, r as AgentCatalogAgentType, s as AgentCatalogAsyncStorage, t as AgentCatalogConfig, u as AgentCatalogConfigError, v as AgentCatalogDefaults, w as AgentCatalogIdentity, x as AgentCatalogNavigate, y as AgentCatalogNotifier, z as AgentCatalogOpenPeek, B as AgentCatalogResolveHref, C as AgentCatalogRpcCall, D as AgentCatalogSchemaReport, E as AgentCatalogState, F as AgentCatalogStatus, G as AgentCatalogTableQuery, H as AgentConsumerPatch, I as AgentFavFilter, J as AgentId, K as AssertAgentCatalogSchemaOptions, L as DEFAULT_AGENT_CATALOG_LABELS, N as DEFAULT_AGENT_CONSUMER_STATE, O as DefaultRowState, P as OrchestraBadge, Q as PgErrorLike, S as PgResultLike, T as SORT_OPTIONS, U as asAgentId, V as assertAgentCatalogSchema, W as createAgentCatalog, X as getRegisteredAgentCatalog, Y as isAgentArchFilter, Z as isMandateAgentId, _ as mandateAgentId, $ as nextArchFilter, a0 as orchestraDelegatesLine, a1 as orchestraDepthLine, a2 as orchestraLabel, a3 as orchestraModeLabel } from '../orchestra-DljbEiks.js';
3
3
 
4
4
  /**
5
5
  * catalog/data.ts — @ai-matrx/agents/catalog
@@ -206,6 +206,36 @@ declare function shouldDefaultAgentListToPublicTab(args: {
206
206
  ownedCount: number;
207
207
  agentsLoaded: boolean;
208
208
  }): boolean;
209
+ /** What the filter-bar chip reads in each state. */
210
+ declare function agentArchiveFilterChipLabel(archFilter: AgentArchFilter): string;
211
+ /** The platform's words for the state — menus, aria-labels, help text. */
212
+ declare function agentArchiveFilterStateLabel(archFilter: AgentArchFilter): string;
213
+ /**
214
+ * The accessible name of the ONE control, always naming the state it is IN
215
+ * and the state one click moves it to. A control whose label does not say
216
+ * what it currently does is the "dead or dishonest" shape the platform bans.
217
+ */
218
+ declare function agentArchiveFilterControlLabel(archFilter: AgentArchFilter): string;
219
+ /**
220
+ * THE FOOTER. It counts exactly what the list rendered and, whenever archived
221
+ * rows are involved, says so — hidden ones included.
222
+ *
223
+ * hide archived, nothing archived behind it → "412 agents"
224
+ * hide archived, 4 archived behind it → "412 agents · 4 archived hidden"
225
+ * show all → "416 agents · archived shown"
226
+ * archived only → "4 archived shown"
227
+ */
228
+ declare function agentListFooterLabel(args: {
229
+ /** Rows actually rendered. */
230
+ count: number;
231
+ archFilter: AgentArchFilter;
232
+ /**
233
+ * Rows this view WOULD render if the filter were flipped to "archived only"
234
+ * — exactly what the default state is keeping off the screen. Only ever
235
+ * read in the `active` state.
236
+ */
237
+ archivedHiddenCount: number;
238
+ }): string;
209
239
 
210
240
  /**
211
241
  * The structural shape a record needs to be searchable. Every field except
@@ -257,7 +287,18 @@ declare function agentMatchesSearch(agent: AgentSearchable, query: string): bool
257
287
  * frontend's `selectLiveAgents` filters `isVersion` snapshots out of a store
258
288
  * that also holds them. This catalog only ever holds list rows — a version
259
289
  * snapshot cannot enter it — so that filter is a no-op here and is not
260
- * ported. Every ordering, tie-break and count below is byte-identical.
290
+ * ported.
291
+ *
292
+ * 🚨 TWO DELIBERATE DEPARTURES FROM THE ORIGINAL, both defects the port
293
+ * inherited and 0.9.1 fixes at the class (see CHANGELOG 0.9.1):
294
+ *
295
+ * F1 — every sort now ends on `id` ASC, the same final key `agx_get_list`
296
+ * ends on, so the order of TIED rows is defined by the rows instead of
297
+ * by whichever transport the host used to fetch them.
298
+ * F5 — the tab-badge counts honour the archive filter, so the badge, the
299
+ * footer and the rendered rows are the same number.
300
+ *
301
+ * Everything else below is byte-identical to the original.
261
302
  */
262
303
 
263
304
  declare const AGENT_CARDS_LIMIT_DESKTOP = 8;
@@ -273,6 +314,31 @@ declare const AGENT_LIST_ITEMS_PER_PAGE = 20;
273
314
  declare function memoize1<A, R>(fn: (a: A) => R): (a: A) => R;
274
315
  declare function memoize2<A, B, R>(fn: (a: A, b: B) => R): (a: A, b: B) => R;
275
316
  declare function memoize3<A, B, C, R>(fn: (a: A, b: B, c: C) => R): (a: A, b: B, c: C) => R;
317
+ /**
318
+ * 🚨 THE FINAL TIEBREAKER. `agx_get_list` orders
319
+ * `is_favorite DESC, updated_at DESC, id` — `id` ASCENDING is the unique key
320
+ * that makes the SERVER's order TOTAL. Every sort in this file ends on the
321
+ * same key, so the rendered order is a function of the ROWS and never of the
322
+ * order they happened to arrive in.
323
+ *
324
+ * Why a raw `<` / `>` and not `localeCompare`: Postgres orders `uuid` by its
325
+ * 16 raw bytes. The canonical text form is lowercase hex with dashes at fixed
326
+ * positions, so a codepoint comparison of those strings reproduces the
327
+ * database's order exactly. A locale collator does not — it is free to fold
328
+ * case or ignore punctuation, and would silently diverge from the server on
329
+ * precisely the ties this key exists to settle.
330
+ */
331
+ declare function compareAgentIds(a: AgentSummary, b: AgentSummary): number;
332
+ /**
333
+ * The chosen sort key, then `id`. TOTAL for every option.
334
+ *
335
+ * Before 0.9.1 each branch below returned 0 for tied rows, which left their
336
+ * relative order to whatever `Array.prototype.sort` had been handed — i.e. to
337
+ * the transport. A host that fetched the RPC in one shot kept the server's
338
+ * favourites-first/`updated_at DESC` order for ties; a host that paged it with
339
+ * `order=id.asc` kept id-ASC. Same rows, same filters, two different screens.
340
+ * The key below is the server's own, so both now render the server's answer.
341
+ */
276
342
  declare function applyAgentSortComparator(a: AgentSummary, b: AgentSummary, sortBy: AgentSortOption): number;
277
343
  /** All unique categories across live USER agents, sorted alphabetically. */
278
344
  declare const selectAllAgentCategories: (a: readonly AgentSummary[]) => string[];
@@ -290,6 +356,15 @@ declare const selectAllSystemAgentTags: (a: readonly AgentSummary[]) => string[]
290
356
  declare const selectUserTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
291
357
  /** Builtin/system agents only. For chat pickers and full catalogues. */
292
358
  declare const selectBuiltinTypeAgents: (a: readonly AgentSummary[]) => AgentSummary[];
359
+ /**
360
+ * The ONE ordering rule, and it is TOTAL on every path.
361
+ *
362
+ * searching: score DESC → server rank ASC → sort key → id ASC
363
+ * not searching: favourites first (when asked) → sort key → id ASC
364
+ *
365
+ * `id` ASC is the final key `agx_get_list` itself ends on, so two hosts that
366
+ * fetched the same rows through different transports render the same screen.
367
+ */
293
368
  declare function sortFilteredAgents(filtered: AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
294
369
  /** User-type agents — mine / shared / all tabs with full consumer filters. */
295
370
  declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
@@ -297,10 +372,27 @@ declare function filterUserTypeAgents(agents: readonly AgentSummary[], consumer:
297
372
  * Builtin/system agents (tab === "system").
298
373
  *
299
374
  * Gets the SAME filter surface every other tab has — search, favorites,
300
- * category, tags, sort. Ownership/archive/access filters are meaningless here
301
- * (a builtin is always active and belongs to the platform), so those are the
302
- * only ones skipped. A picker that offers less on one tab than another is the
303
- * exact half-built shape this list exists to prevent.
375
+ * category, tags, sort, AND THE ARCHIVE FILTER. Only the ownership/access
376
+ * filters are skipped, because a builtin has no owner to filter on. A picker
377
+ * that offers less on one tab than another is the exact half-built shape this
378
+ * list exists to prevent.
379
+ *
380
+ * 🚨 0.9.2 — THE BUILTIN ARCHIVE EXEMPTION IS GONE, AND IT IS NOW ILLEGAL.
381
+ *
382
+ * Until 0.9.1 this function applied no archive filter, on the theory that "a
383
+ * builtin belongs to the platform and is never the user's to archive". The
384
+ * database disagreed: `Foundry Planner`
385
+ * (`001b22f6-fa4d-40c6-a1a4-8575d4d04379`) is an ARCHIVED builtin, and it
386
+ * rendered at Public index 216 and was pickable — while Mine / Shared / All
387
+ * hid their archived rows. One picker, two rules, and a person could choose a
388
+ * retired agent from the one tab that did not obey.
389
+ *
390
+ * THE ARCHIVED-ITEMS LAW (`common-docs/policies/archived-items.md`, Arman
391
+ * 2026-09-09) closed the question for every entity at once: "everything should
392
+ * have an archive filter, and the default should always hide archived… all
393
+ * archived items should always be treated the same." Clause 4 makes it a
394
+ * class, not an instance — so there is no per-tab, per-entity or per-surface
395
+ * exemption left to grant, here or anywhere.
304
396
  */
305
397
  declare function filterBuiltinTypeAgents(agents: readonly AgentSummary[], consumer: AgentConsumerState): AgentSummary[];
306
398
  /** Factory: owned user-type agents with consumer filters applied (ignores tab). */
@@ -339,9 +431,47 @@ declare const makeSelectFilteredAgentsCount: () => (a: readonly AgentSummary[],
339
431
  declare const makeSelectFilteredBuiltinAgentsCount: () => (a: readonly AgentSummary[], b: AgentConsumerState) => number;
340
432
  /** Returns whether a consumer has any non-default filters active. */
341
433
  declare function agentConsumerHasActiveFilters(consumer: AgentConsumerState, defaults: AgentConsumerState): boolean;
434
+ /**
435
+ * 🚨 A BADGE COUNTS WHAT THE TAB RENDERS. Nothing else.
436
+ *
437
+ * Before 0.9.1 these five counted every user-type row, archived included,
438
+ * while `filterUserTypeAgents` (archive filter `active`, the default) hid the
439
+ * archived ones. The badge said "Mine 416", the list showed 412 rows and the
440
+ * footer said "412 agents" — one screen, three numbers, one of them a lie
441
+ * about agents the user cannot see or reach from there.
442
+ *
443
+ * `is_archived` is now honoured by the same rule the list uses, so the badge,
444
+ * the footer and the rows agree on every tab and under every archive filter.
445
+ *
446
+ * 🚨 0.9.2 — AND THERE IS NO LONGER AN EXCEPTION. The system tab used to be
447
+ * one ("a builtin is never the user's to archive"), which was false in the
448
+ * database and illegal under THE ARCHIVED-ITEMS LAW. Its badge now counts
449
+ * under the same archive rule its rows render under, so `Foundry Planner`
450
+ * leaves the Public badge and the Public list together, or returns to both
451
+ * together — never one without the other.
452
+ */
453
+ declare function agentMatchesArchiveFilter(agent: AgentSummary, archFilter: AgentArchFilter): boolean;
454
+ /**
455
+ * The four tab badges for a consumer's CURRENT archive filter — the numbers
456
+ * `useAgentListCore` puts on the tab strip. Flip the archive filter to
457
+ * "archived" and the badges follow the list into the archive.
458
+ */
459
+ declare const selectAgentTabCounts: (a: readonly AgentSummary[], b: AgentArchFilter) => {
460
+ mine: number;
461
+ shared: number;
462
+ all: number;
463
+ system: number;
464
+ };
465
+ /** Live user-type agents the default (`active`) list renders. */
342
466
  declare const selectTotalUserAgentsCount: (a: readonly AgentSummary[]) => number;
343
467
  declare const selectTotalOwnedAgentsCount: (a: readonly AgentSummary[]) => number;
344
468
  declare const selectTotalSharedAgentsCount: (a: readonly AgentSummary[]) => number;
469
+ /**
470
+ * Live builtin agents the DEFAULT (`active`) list renders — archived builtins
471
+ * excluded, exactly like every other "total" beside it. Before 0.9.2 this
472
+ * counted archived builtins too, which is how an archived `Foundry Planner`
473
+ * reached the Public badge.
474
+ */
345
475
  declare const selectTotalBuiltinAgentsCount: (a: readonly AgentSummary[]) => number;
346
476
  declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => number;
347
477
 
@@ -361,4 +491,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
361
491
  /** @internal Test-only: forget every session-shared value. */
362
492
  declare function _resetCatalogGlobalState(): void;
363
493
 
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 };
494
+ 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, agentArchiveFilterChipLabel, agentArchiveFilterControlLabel, agentArchiveFilterStateLabel, agentConsumerHasActiveFilters, agentListEmptyLabel, agentListFooterLabel, 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 };