@ai-matrx/agents 0.59.261 → 0.59.262

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 CHANGED
@@ -1,6 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.59.262
4
+ ### no second star read after a catalog or search read (FW-014)
5
+
6
+ - `ensureLoaded()` and `searchServer()` no longer follow each read with `ues_get_bulk('agent', every id)`.
7
+ Every catalog read (`agx_get_list_full`, `agx_search`, `agent.agx_get_by_ids`) already returns
8
+ `is_favorite` computed server-side from `platform.user_entity_state` (`platform.my_favorite`), so
9
+ `toAgentSummary` now reads it. Saves one sequential request uploading every agent id (673 ids for an
10
+ ordinary account, 1,478 for admin) on every picker load and search.
11
+ - Removed: `overlayAgentFavorites` (internal) and the `favorite_read_failed` error code. The favorites
12
+ port's `getBulk` is no longer called by the catalog. Consumer action: none.
13
+
3
14
  ## 0.59.261
15
+
16
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 9a4fd3053c c006aa4394 -- apps/shared/matrx-agents/src`
17
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
18
+
19
+ ## 0.59.260
4
20
  ### the pinned read asks the server for those agents only (FW-015)
5
21
 
6
22
  - `ensureFavoriteRows()` / `readFavoriteAgentRows` now read the starred agents through
@@ -10,6 +26,16 @@
10
26
  - The narrow read needs a client with `schema()` (supabase-js has it); without one the store falls back to the
11
27
  whole catalog and reports `pinned_read_unsupported`, as before. Consumer action: none.
12
28
 
29
+ ## 0.59.259
30
+
31
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 48dc0c53e7 c3bd77d32a -- apps/shared/matrx-agents/src`
32
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
33
+
34
+ ## 0.59.258
35
+
36
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 0a2b8c9356 48dc0c53e7 -- apps/shared/matrx-agents/src`
37
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
38
+
13
39
  ## 0.59.257
14
40
 
15
41
  Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff 76b41cb76b 0a2b8c9356 -- apps/shared/matrx-agents/src`
@@ -239,9 +239,11 @@ function toAgentSummary(raw) {
239
239
  modelId: str(raw["model_id"]),
240
240
  isActive: bool(raw["is_active"]),
241
241
  isArchived: bool(raw["is_archived"]),
242
- // Stars are per-person (platform.user_entity_state) and are overlaid by
243
- // `overlayAgentFavorites` — a list row never carries the caller's star.
244
- isFavorite: false,
242
+ // The caller's star. Every read this module maps (agx_get_list_full,
243
+ // agx_search, agent.agx_get_by_ids) computes it server-side with
244
+ // platform.my_favorite — platform.user_entity_state for auth.uid(), the
245
+ // same table the favorites port reads — so no second read is needed (FW-014).
246
+ isFavorite: bool(raw["is_favorite"]),
245
247
  createdBy: str(raw["created_by"]),
246
248
  organizationId: str(raw["organization_id"]),
247
249
  taskId: str(raw["task_id"]),
@@ -354,29 +356,6 @@ async function readSingleAgentRow(client, agentId) {
354
356
  return null;
355
357
  }
356
358
  var AGENT_FAVORITE_ENTITY_TYPE = "agent";
357
- async function overlayAgentFavorites(favorites, rows, onError) {
358
- if (rows.length === 0) return rows;
359
- let starred = null;
360
- try {
361
- const result = await favorites.getBulk(
362
- AGENT_FAVORITE_ENTITY_TYPE,
363
- rows.map((r) => r.id)
364
- );
365
- if (result.ok) {
366
- starred = new Set(
367
- result.data.items.filter((s) => s.isFavorite).map((s) => s.entityId)
368
- );
369
- } else {
370
- onError(result.error.message);
371
- }
372
- } catch (e) {
373
- onError(e instanceof Error ? e.message : String(e));
374
- }
375
- return rows.map((r) => {
376
- const isFavorite2 = starred?.has(r.id) ?? false;
377
- return r.isFavorite === isFavorite2 ? r : { ...r, isFavorite: isFavorite2 };
378
- });
379
- }
380
359
  async function writeAgentFavorite(favorites, agentId, isFavorite2) {
381
360
  const result = await favorites.setFavorite(
382
361
  AGENT_FAVORITE_ENTITY_TYPE,
@@ -832,13 +811,6 @@ function createAgentCatalog(config) {
832
811
  identity,
833
812
  errorSink
834
813
  }).favorites;
835
- function reportFavoriteReadFailure(message) {
836
- errorSink({
837
- code: "favorite_read_failed",
838
- message: `your starred agents could not be read (${message}); every star is shown unset until the next catalog load`,
839
- context: { catalogId }
840
- });
841
- }
842
814
  const labels = {
843
815
  ...DEFAULT_AGENT_CATALOG_LABELS,
844
816
  ...config.labels ?? {}
@@ -910,11 +882,7 @@ function createAgentCatalog(config) {
910
882
  }
911
883
  publish({ ...state, status: "loading", error: null });
912
884
  try {
913
- const rows = await overlayAgentFavorites(
914
- favorites,
915
- await readAgentCatalogRows(client),
916
- reportFavoriteReadFailure
917
- );
885
+ const rows = await readAgentCatalogRows(client);
918
886
  replaceRows(rows);
919
887
  publish({ ...state, status: "succeeded", error: null, favoriteRowsStatus: "succeeded" });
920
888
  globalState.listFetchedAt.set(catalogId, Date.now());
@@ -1064,13 +1032,7 @@ function createAgentCatalog(config) {
1064
1032
  }
1065
1033
  async function searchServer(query, deep = false) {
1066
1034
  const result = await searchAgentsOnServer(client, { query, deep });
1067
- mergeRows(
1068
- await overlayAgentFavorites(
1069
- favorites,
1070
- result.rows,
1071
- reportFavoriteReadFailure
1072
- )
1073
- );
1035
+ mergeRows(result.rows);
1074
1036
  return result.ids;
1075
1037
  }
1076
1038
  async function setFavorite(agentId, isFavorite2) {
@@ -809,9 +809,10 @@ declare function getRegisteredAgentCatalog(catalogId?: string): AgentCatalog | u
809
809
  * 2. `agx_search(p_query, p_deep, p_limit, p_offset)` — tier-2 server search.
810
810
  * 3. `agx_resolve_agent_address(p_ids)` — the single-agent name read, used
811
811
  * when a mandate's Holder is not in the caller's own catalog.
812
- * 4. The caller's stars: `ues_get_bulk('agent', ids)` through the
813
- * favorites port (`platform.user_entity_state`), overlaid on every row
814
- * set this module returns to the store.
812
+ * 4. The caller's stars arrive ON the rows: every read above computes
813
+ * `is_favorite` server-side from `platform.user_entity_state`
814
+ * (`platform.my_favorite`). There is no second star read (FW-014; the
815
+ * `ues_get_bulk` overlay over every id was retired 2026-10-23).
815
816
  * 5. ONE write: the caller's star, `ues_set` through the same port. The
816
817
  * retired `agent.definition.is_favorite` column is never read or written.
817
818
  * 6. THE PINNED READ (2026-10-09; by-ids 2026-10-23): the caller's starred
@@ -809,9 +809,10 @@ declare function getRegisteredAgentCatalog(catalogId?: string): AgentCatalog | u
809
809
  * 2. `agx_search(p_query, p_deep, p_limit, p_offset)` — tier-2 server search.
810
810
  * 3. `agx_resolve_agent_address(p_ids)` — the single-agent name read, used
811
811
  * when a mandate's Holder is not in the caller's own catalog.
812
- * 4. The caller's stars: `ues_get_bulk('agent', ids)` through the
813
- * favorites port (`platform.user_entity_state`), overlaid on every row
814
- * set this module returns to the store.
812
+ * 4. The caller's stars arrive ON the rows: every read above computes
813
+ * `is_favorite` server-side from `platform.user_entity_state`
814
+ * (`platform.my_favorite`). There is no second star read (FW-014; the
815
+ * `ues_get_bulk` overlay over every id was retired 2026-10-23).
815
816
  * 5. ONE write: the caller's star, `ues_set` through the same port. The
816
817
  * retired `agent.definition.is_favorite` column is never read or written.
817
818
  * 6. THE PINNED READ (2026-10-09; by-ids 2026-10-23): the caller's starred
@@ -133,9 +133,11 @@ function toAgentSummary(raw) {
133
133
  modelId: str(raw["model_id"]),
134
134
  isActive: bool(raw["is_active"]),
135
135
  isArchived: bool(raw["is_archived"]),
136
- // Stars are per-person (platform.user_entity_state) and are overlaid by
137
- // `overlayAgentFavorites` — a list row never carries the caller's star.
138
- isFavorite: false,
136
+ // The caller's star. Every read this module maps (agx_get_list_full,
137
+ // agx_search, agent.agx_get_by_ids) computes it server-side with
138
+ // platform.my_favorite — platform.user_entity_state for auth.uid(), the
139
+ // same table the favorites port reads — so no second read is needed (FW-014).
140
+ isFavorite: bool(raw["is_favorite"]),
139
141
  createdBy: str(raw["created_by"]),
140
142
  organizationId: str(raw["organization_id"]),
141
143
  taskId: str(raw["task_id"]),
@@ -248,29 +250,6 @@ async function readSingleAgentRow(client, agentId) {
248
250
  return null;
249
251
  }
250
252
  var AGENT_FAVORITE_ENTITY_TYPE = "agent";
251
- async function overlayAgentFavorites(favorites, rows, onError) {
252
- if (rows.length === 0) return rows;
253
- let starred = null;
254
- try {
255
- const result = await favorites.getBulk(
256
- AGENT_FAVORITE_ENTITY_TYPE,
257
- rows.map((r) => r.id)
258
- );
259
- if (result.ok) {
260
- starred = new Set(
261
- result.data.items.filter((s) => s.isFavorite).map((s) => s.entityId)
262
- );
263
- } else {
264
- onError(result.error.message);
265
- }
266
- } catch (e) {
267
- onError(e instanceof Error ? e.message : String(e));
268
- }
269
- return rows.map((r) => {
270
- const isFavorite2 = starred?.has(r.id) ?? false;
271
- return r.isFavorite === isFavorite2 ? r : { ...r, isFavorite: isFavorite2 };
272
- });
273
- }
274
253
  async function writeAgentFavorite(favorites, agentId, isFavorite2) {
275
254
  const result = await favorites.setFavorite(
276
255
  AGENT_FAVORITE_ENTITY_TYPE,
@@ -726,13 +705,6 @@ function createAgentCatalog(config) {
726
705
  identity,
727
706
  errorSink
728
707
  }).favorites;
729
- function reportFavoriteReadFailure(message) {
730
- errorSink({
731
- code: "favorite_read_failed",
732
- message: `your starred agents could not be read (${message}); every star is shown unset until the next catalog load`,
733
- context: { catalogId }
734
- });
735
- }
736
708
  const labels = {
737
709
  ...DEFAULT_AGENT_CATALOG_LABELS,
738
710
  ...config.labels ?? {}
@@ -804,11 +776,7 @@ function createAgentCatalog(config) {
804
776
  }
805
777
  publish({ ...state, status: "loading", error: null });
806
778
  try {
807
- const rows = await overlayAgentFavorites(
808
- favorites,
809
- await readAgentCatalogRows(client),
810
- reportFavoriteReadFailure
811
- );
779
+ const rows = await readAgentCatalogRows(client);
812
780
  replaceRows(rows);
813
781
  publish({ ...state, status: "succeeded", error: null, favoriteRowsStatus: "succeeded" });
814
782
  globalState.listFetchedAt.set(catalogId, Date.now());
@@ -958,13 +926,7 @@ function createAgentCatalog(config) {
958
926
  }
959
927
  async function searchServer(query, deep = false) {
960
928
  const result = await searchAgentsOnServer(client, { query, deep });
961
- mergeRows(
962
- await overlayAgentFavorites(
963
- favorites,
964
- result.rows,
965
- reportFavoriteReadFailure
966
- )
967
- );
929
+ mergeRows(result.rows);
968
930
  return result.ids;
969
931
  }
970
932
  async function setFavorite(agentId, isFavorite2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/agents",
3
- "version": "0.59.261",
3
+ "version": "0.59.262",
4
4
  "description": "Portable AI Matrx agent stream protocol, event projection, and safe result-presentation primitives.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -562,5 +562,5 @@
562
562
  "verify:tarball": "node ./scripts/verify-tarball.mjs",
563
563
  "typegen:self-test": "node scripts/typegen/drop-guard.self-test.mjs && node scripts/typegen/check-api-types-fresh.mjs --self-test"
564
564
  },
565
- "gitHead": "c006aa4394ac233c23c923f57d06b49f769037ab"
565
+ "gitHead": "de2b95873473d1fd1878b0e3b06ce75570190a1b"
566
566
  }