@ai-matrx/agents 0.15.1 → 0.16.19
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 +150 -0
- package/README.md +8 -4
- package/dist/catalog/index.cjs +82 -50
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +21 -10
- package/dist/catalog/index.d.ts +21 -10
- package/dist/catalog/index.js +82 -50
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +2 -3
- package/dist/catalog/native/index.cjs.map +1 -1
- package/dist/catalog/native/index.d.cts +4 -5
- package/dist/catalog/native/index.d.ts +4 -5
- package/dist/catalog/native/index.js +2 -3
- package/dist/catalog/native/index.js.map +1 -1
- package/dist/catalog/react/index.cjs +6 -7
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +2 -9
- package/dist/catalog/react/index.d.ts +2 -9
- package/dist/catalog/react/index.js +6 -7
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/content-transfer/index.cjs +2 -0
- package/dist/content-transfer/index.cjs.map +1 -1
- package/dist/content-transfer/index.js +2 -0
- package/dist/content-transfer/index.js.map +1 -1
- package/dist/content-transfer/react/index.cjs +2 -0
- package/dist/content-transfer/react/index.cjs.map +1 -1
- package/dist/content-transfer/react/index.js +2 -0
- package/dist/content-transfer/react/index.js.map +1 -1
- package/dist/mandates/index.cjs +4 -2
- package/dist/mandates/index.cjs.map +1 -1
- package/dist/mandates/index.d.cts +7 -5
- package/dist/mandates/index.d.ts +7 -5
- package/dist/mandates/index.js +4 -2
- package/dist/mandates/index.js.map +1 -1
- package/dist/{orchestra-BDXdut6Y.d.cts → orchestra-PbGGooqJ.d.cts} +50 -25
- package/dist/{orchestra-BDXdut6Y.d.ts → orchestra-PbGGooqJ.d.ts} +50 -25
- package/mandates/snapshots/keys.0.16.1.json +625 -0
- package/mandates/snapshots/keys.0.16.10.json +625 -0
- package/mandates/snapshots/keys.0.16.11.json +625 -0
- package/mandates/snapshots/keys.0.16.12.json +625 -0
- package/mandates/snapshots/keys.0.16.13.json +625 -0
- package/mandates/snapshots/keys.0.16.14.json +625 -0
- package/mandates/snapshots/keys.0.16.15.json +625 -0
- package/mandates/snapshots/keys.0.16.16.json +625 -0
- package/mandates/snapshots/keys.0.16.17.json +625 -0
- package/mandates/snapshots/keys.0.16.18.json +625 -0
- package/mandates/snapshots/keys.0.16.19.json +627 -0
- package/mandates/snapshots/keys.0.16.2.json +625 -0
- package/mandates/snapshots/keys.0.16.3.json +625 -0
- package/mandates/snapshots/keys.0.16.4.json +625 -0
- package/mandates/snapshots/keys.0.16.5.json +625 -0
- package/mandates/snapshots/keys.0.16.6.json +625 -0
- package/mandates/snapshots/keys.0.16.7.json +625 -0
- package/mandates/snapshots/keys.0.16.8.json +625 -0
- package/mandates/snapshots/keys.0.16.9.json +625 -0
- package/package.json +4 -3
package/dist/catalog/index.d.cts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { A as AgentSummary, a as AgentCatalogClient, b as
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogFavorites, c as AgentCatalogTransport, d as AgentCatalogStorageLike, e as AgentCatalogErrorSink, R as ResolvedDefaultRow, f as AgentCatalogStorage, M as MandateResolutionVerdict, g as AgentArchFilter, h as AgentTab, i as AgentCatalogLabels, j as AgentConsumerState, k as AgentSortOption } from '../orchestra-PbGGooqJ.cjs';
|
|
2
|
+
export { l as AGENT_NONE_SENTINEL, m as ARCHIVE_FILTER_OPTIONS, n as ARCHIVE_FILTER_ORDER, o as AgentAccessFilter, p as AgentAccessLevel, q as AgentArchFilterOption, r as AgentCatalog, s as AgentCatalogAgentType, t as AgentCatalogAsyncStorage, u as AgentCatalogConfig, v as AgentCatalogConfigError, w as AgentCatalogDefaults, x as AgentCatalogIdentity, y as AgentCatalogNavigate, z as AgentCatalogNotifier, B as AgentCatalogOpenPeek, C as AgentCatalogResolveHref, D as AgentCatalogRpcCall, E as AgentCatalogSchemaReport, F as AgentCatalogState, G as AgentCatalogStatus, 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-PbGGooqJ.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* catalog/data.ts — @ai-matrx/agents/catalog
|
|
6
6
|
*
|
|
7
|
-
* Every database call the catalog makes, and nothing else.
|
|
7
|
+
* Every database call the catalog makes, and nothing else. Five of them:
|
|
8
8
|
*
|
|
9
9
|
* 1. `agx_get_list_full()` — the complete catalogue (owned + directly-shared
|
|
10
10
|
* + org-shared user agents, unioned with active builtins).
|
|
11
11
|
* 2. `agx_search(p_query, p_deep, p_limit, p_offset)` — tier-2 server search.
|
|
12
12
|
* 3. `agx_resolve_agent_address(p_ids)` — the single-agent name read, used
|
|
13
13
|
* when a mandate's Holder is not in the caller's own catalogue.
|
|
14
|
-
* 4.
|
|
14
|
+
* 4. The caller's stars: `ues_get_bulk('agent', ids)` through the
|
|
15
|
+
* favorites port (`platform.user_entity_state`), overlaid on every row
|
|
16
|
+
* set this module returns to the store.
|
|
17
|
+
* 5. ONE write: the caller's star, `ues_set` through the same port. The
|
|
18
|
+
* retired `agent.definition.is_favorite` column is never read or written.
|
|
15
19
|
*
|
|
16
20
|
* 🚨 THE LIST READ IS COMPLETE OR IT THROWS. PostgREST caps every response at
|
|
17
21
|
* `db-max-rows` (1000 on Matrx Main) and reports success — matrx-frontend's
|
|
@@ -68,10 +72,11 @@ declare function searchAgentsOnServer(client: AgentCatalogClient, args: {
|
|
|
68
72
|
*/
|
|
69
73
|
declare function readSingleAgentRow(client: AgentCatalogClient, agentId: string): Promise<AgentSummary | null>;
|
|
70
74
|
/**
|
|
71
|
-
* THE ONE WRITE
|
|
72
|
-
*
|
|
75
|
+
* THE ONE WRITE: the caller's star on one agent, in
|
|
76
|
+
* `platform.user_entity_state` through the favorites port. Throws an
|
|
77
|
+
* `AgentCatalogReadError` carrying the refusal in words.
|
|
73
78
|
*/
|
|
74
|
-
declare function writeAgentFavorite(
|
|
79
|
+
declare function writeAgentFavorite(favorites: AgentCatalogFavorites, agentId: string, isFavorite: boolean): Promise<void>;
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* catalog/rows.ts — @ai-matrx/agents/catalog
|
|
@@ -174,8 +179,14 @@ interface ResolveDefaultRowArgs {
|
|
|
174
179
|
client: AgentCatalogClient;
|
|
175
180
|
storage: AgentCatalogStorageLike;
|
|
176
181
|
errorSink: AgentCatalogErrorSink;
|
|
177
|
-
/**
|
|
178
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Look the Holder up in the rows this catalog already holds. May answer
|
|
184
|
+
* asynchronously: the store waits for an in-flight list read before
|
|
185
|
+
* declaring a miss, so a default row never costs a second network read just
|
|
186
|
+
* because the verdict outran the list (the list read now also overlays the
|
|
187
|
+
* caller's stars).
|
|
188
|
+
*/
|
|
189
|
+
lookupRow: (agentId: string) => AgentSummary | undefined | Promise<AgentSummary | undefined>;
|
|
179
190
|
}
|
|
180
191
|
interface ResolveDefaultRowOutcome {
|
|
181
192
|
resolved: ResolvedDefaultRow;
|
|
@@ -491,4 +502,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
|
|
|
491
502
|
/** @internal Test-only: forget every session-shared value. */
|
|
492
503
|
declare function _resetCatalogGlobalState(): void;
|
|
493
504
|
|
|
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 };
|
|
505
|
+
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentArchFilter, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogFavorites, 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 };
|
package/dist/catalog/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { A as AgentSummary, a as AgentCatalogClient, b as
|
|
2
|
-
export {
|
|
1
|
+
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogFavorites, c as AgentCatalogTransport, d as AgentCatalogStorageLike, e as AgentCatalogErrorSink, R as ResolvedDefaultRow, f as AgentCatalogStorage, M as MandateResolutionVerdict, g as AgentArchFilter, h as AgentTab, i as AgentCatalogLabels, j as AgentConsumerState, k as AgentSortOption } from '../orchestra-PbGGooqJ.js';
|
|
2
|
+
export { l as AGENT_NONE_SENTINEL, m as ARCHIVE_FILTER_OPTIONS, n as ARCHIVE_FILTER_ORDER, o as AgentAccessFilter, p as AgentAccessLevel, q as AgentArchFilterOption, r as AgentCatalog, s as AgentCatalogAgentType, t as AgentCatalogAsyncStorage, u as AgentCatalogConfig, v as AgentCatalogConfigError, w as AgentCatalogDefaults, x as AgentCatalogIdentity, y as AgentCatalogNavigate, z as AgentCatalogNotifier, B as AgentCatalogOpenPeek, C as AgentCatalogResolveHref, D as AgentCatalogRpcCall, E as AgentCatalogSchemaReport, F as AgentCatalogState, G as AgentCatalogStatus, 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-PbGGooqJ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* catalog/data.ts — @ai-matrx/agents/catalog
|
|
6
6
|
*
|
|
7
|
-
* Every database call the catalog makes, and nothing else.
|
|
7
|
+
* Every database call the catalog makes, and nothing else. Five of them:
|
|
8
8
|
*
|
|
9
9
|
* 1. `agx_get_list_full()` — the complete catalogue (owned + directly-shared
|
|
10
10
|
* + org-shared user agents, unioned with active builtins).
|
|
11
11
|
* 2. `agx_search(p_query, p_deep, p_limit, p_offset)` — tier-2 server search.
|
|
12
12
|
* 3. `agx_resolve_agent_address(p_ids)` — the single-agent name read, used
|
|
13
13
|
* when a mandate's Holder is not in the caller's own catalogue.
|
|
14
|
-
* 4.
|
|
14
|
+
* 4. The caller's stars: `ues_get_bulk('agent', ids)` through the
|
|
15
|
+
* favorites port (`platform.user_entity_state`), overlaid on every row
|
|
16
|
+
* set this module returns to the store.
|
|
17
|
+
* 5. ONE write: the caller's star, `ues_set` through the same port. The
|
|
18
|
+
* retired `agent.definition.is_favorite` column is never read or written.
|
|
15
19
|
*
|
|
16
20
|
* 🚨 THE LIST READ IS COMPLETE OR IT THROWS. PostgREST caps every response at
|
|
17
21
|
* `db-max-rows` (1000 on Matrx Main) and reports success — matrx-frontend's
|
|
@@ -68,10 +72,11 @@ declare function searchAgentsOnServer(client: AgentCatalogClient, args: {
|
|
|
68
72
|
*/
|
|
69
73
|
declare function readSingleAgentRow(client: AgentCatalogClient, agentId: string): Promise<AgentSummary | null>;
|
|
70
74
|
/**
|
|
71
|
-
* THE ONE WRITE
|
|
72
|
-
*
|
|
75
|
+
* THE ONE WRITE: the caller's star on one agent, in
|
|
76
|
+
* `platform.user_entity_state` through the favorites port. Throws an
|
|
77
|
+
* `AgentCatalogReadError` carrying the refusal in words.
|
|
73
78
|
*/
|
|
74
|
-
declare function writeAgentFavorite(
|
|
79
|
+
declare function writeAgentFavorite(favorites: AgentCatalogFavorites, agentId: string, isFavorite: boolean): Promise<void>;
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* catalog/rows.ts — @ai-matrx/agents/catalog
|
|
@@ -174,8 +179,14 @@ interface ResolveDefaultRowArgs {
|
|
|
174
179
|
client: AgentCatalogClient;
|
|
175
180
|
storage: AgentCatalogStorageLike;
|
|
176
181
|
errorSink: AgentCatalogErrorSink;
|
|
177
|
-
/**
|
|
178
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Look the Holder up in the rows this catalog already holds. May answer
|
|
184
|
+
* asynchronously: the store waits for an in-flight list read before
|
|
185
|
+
* declaring a miss, so a default row never costs a second network read just
|
|
186
|
+
* because the verdict outran the list (the list read now also overlays the
|
|
187
|
+
* caller's stars).
|
|
188
|
+
*/
|
|
189
|
+
lookupRow: (agentId: string) => AgentSummary | undefined | Promise<AgentSummary | undefined>;
|
|
179
190
|
}
|
|
180
191
|
interface ResolveDefaultRowOutcome {
|
|
181
192
|
resolved: ResolvedDefaultRow;
|
|
@@ -491,4 +502,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
|
|
|
491
502
|
/** @internal Test-only: forget every session-shared value. */
|
|
492
503
|
declare function _resetCatalogGlobalState(): void;
|
|
493
504
|
|
|
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 };
|
|
505
|
+
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentArchFilter, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogFavorites, 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 };
|
package/dist/catalog/index.js
CHANGED
|
@@ -80,6 +80,9 @@ var DEFAULT_AGENT_CATALOG_LABELS = {
|
|
|
80
80
|
hoverHint: "Hover an agent to preview its details, or click to select."
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
+
// catalog/store.ts
|
|
84
|
+
import { createAssociationsStore } from "@ai-matrx/associations/core";
|
|
85
|
+
|
|
83
86
|
// catalog/data.ts
|
|
84
87
|
import { readAllRows } from "@ai-matrx/data/db";
|
|
85
88
|
|
|
@@ -129,7 +132,9 @@ function toAgentSummary(raw) {
|
|
|
129
132
|
modelId: str(raw["model_id"]),
|
|
130
133
|
isActive: bool(raw["is_active"]),
|
|
131
134
|
isArchived: bool(raw["is_archived"]),
|
|
132
|
-
|
|
135
|
+
// Stars are per-person (platform.user_entity_state) and are overlaid by
|
|
136
|
+
// `overlayAgentFavorites` — a list row never carries the caller's star.
|
|
137
|
+
isFavorite: false,
|
|
133
138
|
createdBy: str(raw["created_by"]),
|
|
134
139
|
organizationId: str(raw["organization_id"]),
|
|
135
140
|
taskId: str(raw["task_id"]),
|
|
@@ -238,12 +243,40 @@ async function readSingleAgentRow(client, agentId) {
|
|
|
238
243
|
}
|
|
239
244
|
return null;
|
|
240
245
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (
|
|
246
|
+
var AGENT_FAVORITE_ENTITY_TYPE = "agent";
|
|
247
|
+
async function overlayAgentFavorites(favorites, rows, onError) {
|
|
248
|
+
if (rows.length === 0) return rows;
|
|
249
|
+
let starred = null;
|
|
250
|
+
try {
|
|
251
|
+
const result = await favorites.getBulk(
|
|
252
|
+
AGENT_FAVORITE_ENTITY_TYPE,
|
|
253
|
+
rows.map((r) => r.id)
|
|
254
|
+
);
|
|
255
|
+
if (result.ok) {
|
|
256
|
+
starred = new Set(
|
|
257
|
+
result.data.items.filter((s) => s.isFavorite).map((s) => s.entityId)
|
|
258
|
+
);
|
|
259
|
+
} else {
|
|
260
|
+
onError(result.error.message);
|
|
261
|
+
}
|
|
262
|
+
} catch (e) {
|
|
263
|
+
onError(e instanceof Error ? e.message : String(e));
|
|
264
|
+
}
|
|
265
|
+
return rows.map((r) => {
|
|
266
|
+
const isFavorite2 = starred?.has(r.id) ?? false;
|
|
267
|
+
return r.isFavorite === isFavorite2 ? r : { ...r, isFavorite: isFavorite2 };
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
async function writeAgentFavorite(favorites, agentId, isFavorite2) {
|
|
271
|
+
const result = await favorites.setFavorite(
|
|
272
|
+
AGENT_FAVORITE_ENTITY_TYPE,
|
|
273
|
+
agentId,
|
|
274
|
+
isFavorite2
|
|
275
|
+
);
|
|
276
|
+
if (!result.ok) {
|
|
244
277
|
throw new AgentCatalogReadError(
|
|
245
|
-
"
|
|
246
|
-
|
|
278
|
+
"user_entity_state (ues_set)",
|
|
279
|
+
result.error.code ? `${result.error.message} (${result.error.code})` : result.error.message
|
|
247
280
|
);
|
|
248
281
|
}
|
|
249
282
|
}
|
|
@@ -457,7 +490,7 @@ async function resolveDefaultRow(args) {
|
|
|
457
490
|
remedy: `bind the ${verdict.provenance} rung to an agent`
|
|
458
491
|
});
|
|
459
492
|
}
|
|
460
|
-
let holder = lookupRow(holderId);
|
|
493
|
+
let holder = await lookupRow(holderId);
|
|
461
494
|
if (!holder) {
|
|
462
495
|
holder = await readSingleAgentRow(client, holderId) ?? void 0;
|
|
463
496
|
}
|
|
@@ -511,7 +544,9 @@ var SELF_TEST_MISSING_RPC = "agx_this_function_does_not_exist_probe";
|
|
|
511
544
|
var DEMANDED_RPCS = {
|
|
512
545
|
agx_get_list_full: {},
|
|
513
546
|
agx_search: { p_query: "__probe__", p_deep: false, p_limit: 1, p_offset: 0 },
|
|
514
|
-
agx_resolve_agent_address: { p_ids: [BAD_UUID] }
|
|
547
|
+
agx_resolve_agent_address: { p_ids: [BAD_UUID] },
|
|
548
|
+
// The caller's stars. Read-only, and an impossible id touches no row.
|
|
549
|
+
ues_get_bulk: { p_entity_type: "agent", p_entity_ids: [BAD_UUID] }
|
|
515
550
|
};
|
|
516
551
|
function isMissingFunctionError(error) {
|
|
517
552
|
if (!error || typeof error !== "object") return false;
|
|
@@ -519,11 +554,7 @@ function isMissingFunctionError(error) {
|
|
|
519
554
|
return code === "PGRST202" || code === "42883";
|
|
520
555
|
}
|
|
521
556
|
async function assertAgentCatalogSchema(client, options = {}) {
|
|
522
|
-
const {
|
|
523
|
-
selfTest = false,
|
|
524
|
-
throwOnViolation = true,
|
|
525
|
-
probeWrite = true
|
|
526
|
-
} = options;
|
|
557
|
+
const { selfTest = false, throwOnViolation = true } = options;
|
|
527
558
|
const names = Object.keys(DEMANDED_RPCS);
|
|
528
559
|
if (selfTest) names.push(SELF_TEST_MISSING_RPC);
|
|
529
560
|
const missing = [];
|
|
@@ -556,41 +587,22 @@ async function assertAgentCatalogSchema(client, options = {}) {
|
|
|
556
587
|
);
|
|
557
588
|
}
|
|
558
589
|
}
|
|
559
|
-
let favoriteWritable = null;
|
|
560
|
-
if (probeWrite) {
|
|
561
|
-
try {
|
|
562
|
-
const { error } = await client.schema("agent").from("definition").update({ is_favorite: false }).eq("id", BAD_UUID);
|
|
563
|
-
favoriteWritable = !isPermissionRefusal(error);
|
|
564
|
-
} catch (e) {
|
|
565
|
-
unreachable.push({ fn: "agent.definition.is_favorite", error: e });
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
590
|
if (unreachable.length > 0) {
|
|
569
591
|
throw new Error(
|
|
570
592
|
`assertAgentCatalogSchema could not complete: ${unreachable.length} probe call(s) failed to reach the database (${unreachable.map((u) => u.fn).join(", ")}). This is NOT a schema verdict \u2014 fix connectivity and re-run.`
|
|
571
593
|
);
|
|
572
594
|
}
|
|
573
|
-
const ok = missing.length === 0
|
|
595
|
+
const ok = missing.length === 0;
|
|
574
596
|
const report = {
|
|
575
597
|
ok,
|
|
576
598
|
missing,
|
|
577
599
|
unreachable,
|
|
578
600
|
answered,
|
|
579
|
-
favoriteWritable,
|
|
580
601
|
orchestraColumn
|
|
581
602
|
};
|
|
582
603
|
if (!ok && throwOnViolation) {
|
|
583
|
-
const parts = [];
|
|
584
|
-
if (missing.length > 0) {
|
|
585
|
-
parts.push(
|
|
586
|
-
`cannot answer ${missing.length} demanded function(s): ${missing.join(", ")}`
|
|
587
|
-
);
|
|
588
|
-
}
|
|
589
|
-
if (favoriteWritable === false) {
|
|
590
|
-
parts.push("refuses a write to agent.definition.is_favorite");
|
|
591
|
-
}
|
|
592
604
|
throw new Error(
|
|
593
|
-
`DEMANDED SCHEMA VIOLATION: the database this client points at ${
|
|
605
|
+
`DEMANDED SCHEMA VIOLATION: the database this client points at cannot answer ${missing.length} demanded function(s): ${missing.join(", ")}. @ai-matrx/agents/catalog cannot render a correct picker against it \u2014 point the client at Matrx Main, or apply the agx_* migrations.`
|
|
594
606
|
);
|
|
595
607
|
}
|
|
596
608
|
return report;
|
|
@@ -601,11 +613,6 @@ function readsOrchestraColumn(data) {
|
|
|
601
613
|
(row) => typeof row === "object" && row !== null && Object.prototype.hasOwnProperty.call(row, "orchestra")
|
|
602
614
|
);
|
|
603
615
|
}
|
|
604
|
-
function isPermissionRefusal(error) {
|
|
605
|
-
if (!error) return false;
|
|
606
|
-
const code = error.code;
|
|
607
|
-
return code === "42501" || code === "42P01" || code === "PGRST205";
|
|
608
|
-
}
|
|
609
616
|
|
|
610
617
|
// catalog/store.ts
|
|
611
618
|
var LIST_TTL_MS = 15 * 60 * 1e3;
|
|
@@ -642,13 +649,6 @@ function createAgentCatalog(config) {
|
|
|
642
649
|
remedy: "pass `client` (a supabase-js client, or anything with rpc() and schema().from())"
|
|
643
650
|
});
|
|
644
651
|
}
|
|
645
|
-
if (typeof config.client.schema !== "function") {
|
|
646
|
-
throw new AgentCatalogConfigError({
|
|
647
|
-
code: "client_cannot_write",
|
|
648
|
-
message: "the client passed to createAgentCatalog has no schema() \u2014 the favorite write has nowhere to go",
|
|
649
|
-
remedy: "pass a full supabase-js client"
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
652
|
if (!config.identity || typeof config.identity.requireUserId !== "function") {
|
|
653
653
|
throw new AgentCatalogConfigError({
|
|
654
654
|
code: "missing_identity",
|
|
@@ -675,6 +675,21 @@ function createAgentCatalog(config) {
|
|
|
675
675
|
const notifier = config.notifier;
|
|
676
676
|
const storage = config.storage ?? defaultStorage();
|
|
677
677
|
const transport = config.transport;
|
|
678
|
+
const favorites = config.favorites ?? createAssociationsStore({
|
|
679
|
+
// The catalog's client IS a supabase-js client; the associations
|
|
680
|
+
// data-source port is the same `rpc(fn, args)` shape, typed over its
|
|
681
|
+
// own demanded-RPC names.
|
|
682
|
+
dataSource: client,
|
|
683
|
+
identity,
|
|
684
|
+
errorSink
|
|
685
|
+
}).favorites;
|
|
686
|
+
function reportFavoriteReadFailure(message) {
|
|
687
|
+
errorSink({
|
|
688
|
+
code: "favorite_read_failed",
|
|
689
|
+
message: `your starred agents could not be read (${message}); every star is shown unset until the next catalogue load`,
|
|
690
|
+
context: { catalogId }
|
|
691
|
+
});
|
|
692
|
+
}
|
|
678
693
|
const labels = {
|
|
679
694
|
...DEFAULT_AGENT_CATALOG_LABELS,
|
|
680
695
|
...config.labels ?? {}
|
|
@@ -739,7 +754,11 @@ function createAgentCatalog(config) {
|
|
|
739
754
|
async function load() {
|
|
740
755
|
publish({ ...state, status: "loading", error: null });
|
|
741
756
|
try {
|
|
742
|
-
const rows = await
|
|
757
|
+
const rows = await overlayAgentFavorites(
|
|
758
|
+
favorites,
|
|
759
|
+
await readAgentCatalogRows(client),
|
|
760
|
+
reportFavoriteReadFailure
|
|
761
|
+
);
|
|
743
762
|
replaceRows(rows);
|
|
744
763
|
publish({ ...state, status: "succeeded", error: null });
|
|
745
764
|
globalState.listFetchedAt.set(catalogId, Date.now());
|
|
@@ -822,7 +841,13 @@ function createAgentCatalog(config) {
|
|
|
822
841
|
}
|
|
823
842
|
async function searchServer(query, deep = false) {
|
|
824
843
|
const result = await searchAgentsOnServer(client, { query, deep });
|
|
825
|
-
mergeRows(
|
|
844
|
+
mergeRows(
|
|
845
|
+
await overlayAgentFavorites(
|
|
846
|
+
favorites,
|
|
847
|
+
result.rows,
|
|
848
|
+
reportFavoriteReadFailure
|
|
849
|
+
)
|
|
850
|
+
);
|
|
826
851
|
return result.ids;
|
|
827
852
|
}
|
|
828
853
|
async function setFavorite(agentId, isFavorite2) {
|
|
@@ -836,7 +861,7 @@ function createAgentCatalog(config) {
|
|
|
836
861
|
}
|
|
837
862
|
mergeRows([{ ...existing, isFavorite: isFavorite2 }]);
|
|
838
863
|
try {
|
|
839
|
-
await writeAgentFavorite(
|
|
864
|
+
await writeAgentFavorite(favorites, agentId, isFavorite2);
|
|
840
865
|
} catch (e) {
|
|
841
866
|
mergeRows([existing]);
|
|
842
867
|
errorSink({
|
|
@@ -888,7 +913,14 @@ function createAgentCatalog(config) {
|
|
|
888
913
|
client,
|
|
889
914
|
storage,
|
|
890
915
|
errorSink,
|
|
891
|
-
lookupRow: (id) =>
|
|
916
|
+
lookupRow: async (id) => {
|
|
917
|
+
const hit = state.byId[id];
|
|
918
|
+
if (hit) return hit;
|
|
919
|
+
const inFlight = globalState.listInFlight.get(catalogId);
|
|
920
|
+
if (!inFlight) return void 0;
|
|
921
|
+
await inFlight.catch(() => void 0);
|
|
922
|
+
return state.byId[id];
|
|
923
|
+
}
|
|
892
924
|
});
|
|
893
925
|
getCatalogGlobalState().defaultRows.set(
|
|
894
926
|
`${catalogId}::${mandateKey}`,
|