@ai-matrx/chat 0.3.24 → 0.3.25

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,5 +1,13 @@
1
1
  # @ai-matrx/chat
2
2
 
3
+ ## 0.3.25 — 2026-10-07
4
+ ### The agent-list mirror is gone (agent core B2, phase C) — guard G3
5
+
6
+ - REMOVED: `fetchAgentsList`, `fetchAgentsListFull`, `initializeChatAgents`, `searchAgentsServer`, `ensureAgentIdentity`, `overlayAgentFavoritesThunk`, `isChatListStale` (`agent-definition/list-mirror`), `agents/route/AgentListHydrator`, the list selectors (`selectLiveAgents`, `selectUserAgents`, `selectBuiltinAgents`, `selectSystemAgents`, `selectActiveAgents`, `selectFavoriteAgents`, `selectOwnedAgents`, `selectSharedWithMeAgents`, `selectEditableAgents`, `selectAgentsByCategory`, `selectAgentsSliceStatus`, `selectAgentsSliceError`, `selectAgentReadyForDisplay`, `selectAgentLineageIndex` / `selectAgentLineage`), `selectAgentName`, `selectAgentDescription`, `makeSelectAgentsForFilter`, `makeSelectAgentIdsForFilter`, and the record's `listOfferingPin`. `selectAllAgentsArray` is renamed `selectAgentRecordsArray` (the records chat holds — run tier, builder, versions — never the list). `AgentLineage` / `AgentLineageRef` now come from `agents/identity/agent-catalog-lists`.
7
+ - `useAgentSummaryRow` binds the catalog store itself (no `@ai-matrx/agents/catalog/react` import), so a host test that mocks the picker module still renders names.
8
+ - G3 `check:one-holder` (in `check:package`, self-tested): the list mirror is a hard ban, the run-tier / list RPCs are read only through the core stores, and chat's `modelRegistry` slice is a shrink-only baseline until B3.
9
+ - Consumer action: use the `agents/identity/*` hooks (0.3.24 lists every replacement).
10
+
3
11
  ## 0.3.24 — 2026-10-07
4
12
  ### Agent identity and lists read the ONE agent catalog; the run tier reads the core store (agent core B2, phase A)
5
13
 
@@ -1,3 +1,18 @@
1
+ /**
2
+ * AGENT IDENTITY — where chat reads one agent's name, description and star (agent core B2).
3
+ *
4
+ * The ONE holder of the agent LIST is the core's agent catalog (`@ai-matrx/agents/catalog`); chat
5
+ * keeps no list mirror. One agent's identity is the agent's own record when it has READ the field
6
+ * (the run tier `agx_get_run_tier` and the builder's full read both carry `name` / `description`,
7
+ * and the builder's unsaved edit lives there), else the catalog row — so an agent the person only
8
+ * saw in a list still has a name, and an agent the list does not include (shared by link, another
9
+ * organization's app) still has one too.
10
+ *
11
+ * useAgentName(id) / useAgentDescription(id) / useAgentIdentity(id) — components
12
+ * useAgentView(id) — the record, completed from the catalog row (derived, no copy)
13
+ * readAgentName / readAgentDescription / readAgentView(state, id) — thunks, callbacks
14
+ * ensureAgentCatalog() / isAgentCatalogStale() — load the list
15
+ */
1
16
  import type { AgentSummary } from "@ai-matrx/agents/catalog";
2
17
  import type { ChatRootState } from "../../store/root-state.js";
3
18
  import type { AgentDefinitionRecord } from "../types/agent-definition.types.js";
@@ -13,7 +28,10 @@ export interface AgentIdentity {
13
28
  /** The catalog row, when the list carries this agent. */
14
29
  summary: AgentSummary | undefined;
15
30
  }
16
- /** One agent's catalog row, loading the catalog when it is missing. */
31
+ /**
32
+ * One agent's catalog row, loading the catalog (then a server search) when it is missing — chat's
33
+ * own binding of the store (the same contract as `@ai-matrx/agents/catalog/react` `useAgentSummary`).
34
+ */
17
35
  export declare function useAgentSummaryRow(agentId: string | null | undefined): AgentSummary | undefined;
18
36
  type MaybeRecord = AgentDefinitionRecord | undefined;
19
37
  /**
@@ -1,8 +1,7 @@
1
1
  "use client";
2
- import { useAgentSummary } from "@ai-matrx/agents/catalog/react";
3
2
  import { getAgentCatalog } from "../../host/ui-slots.js";
4
3
  import { useAppSelector } from "../../store/hooks.js";
5
- import { useMemo } from "react";
4
+ import { useEffect, useMemo, useSyncExternalStore } from "react";
6
5
  import { hasField } from "@ai-matrx/agents/field-flags";
7
6
  import { selectAgentById } from "../redux/agent-definition/selectors.js";
8
7
  import { makeEmptyRecord } from "../redux/agent-definition/slice.js";
@@ -38,8 +37,27 @@ function isAgentCatalogStale() {
38
37
  return false;
39
38
  }
40
39
  }
40
+ const noopSubscribe = () => () => void 0;
41
41
  function useAgentSummaryRow(agentId) {
42
- return useAgentSummary(useCatalog(), agentId);
42
+ const catalog = useCatalog();
43
+ const row = useSyncExternalStore(
44
+ catalog ? catalog.subscribe : noopSubscribe,
45
+ () => catalog && agentId ? catalog.getState().byId[agentId] : void 0,
46
+ () => catalog && agentId ? catalog.getState().byId[agentId] : void 0
47
+ );
48
+ const present = row !== void 0;
49
+ useEffect(() => {
50
+ if (!catalog || !agentId || present) return;
51
+ let cancelled = false;
52
+ void catalog.ensureLoaded().then(() => {
53
+ if (cancelled || catalog.getState().byId[agentId]) return;
54
+ return catalog.searchServer(agentId).then(() => void 0);
55
+ }).catch(() => void 0);
56
+ return () => {
57
+ cancelled = true;
58
+ };
59
+ }, [catalog, agentId, present]);
60
+ return row;
43
61
  }
44
62
  function loaded(record, field) {
45
63
  return !!record?._loadedFields && hasField(record._loadedFields, field);
@@ -79,8 +97,7 @@ function agentViewOf(record, summary) {
79
97
  updatedAt: pick("updatedAt", summary.updatedAt ?? ""),
80
98
  isOwner: base.isOwner ?? summary.isOwner,
81
99
  accessLevel: base.accessLevel ?? toRecordAccessLevel(summary.accessLevel),
82
- sharedByEmail: base.sharedByEmail ?? summary.sharedByEmail,
83
- ...summary.offeringId === void 0 ? {} : { listOfferingPin: summary.offeringId }
100
+ sharedByEmail: base.sharedByEmail ?? summary.sharedByEmail
84
101
  };
85
102
  }
86
103
  function useAgentView(agentId) {
@@ -258,7 +258,7 @@ function dbRowToAgentDefinition(row) {
258
258
  changedAt: null,
259
259
  changeNote: null,
260
260
  // Access metadata not available from a direct row fetch —
261
- // populated separately by fetchAgentsList or fetchAgentAccessLevel
261
+ // populated separately by fetchAgentAccessLevel (the list lives in the catalog)
262
262
  isOwner: null,
263
263
  accessLevel: null,
264
264
  sharedByEmail: null,