@ai-matrx/chat 0.3.23 → 0.3.24

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/agents/components/chat/ChatConversationSurface.js +2 -2
  3. package/dist/agents/components/chat/ChatRunHeader.js +3 -5
  4. package/dist/agents/components/chat/PinnedAgentsSection.js +2 -2
  5. package/dist/agents/components/context-preview/ContextCompareView.js +5 -12
  6. package/dist/agents/components/inputs/smart-input/composer/useComposerAgent.js +4 -5
  7. package/dist/agents/components/run/AgentRunnerPage.js +3 -3
  8. package/dist/agents/hooks/useAgentModelLabel.js +6 -2
  9. package/dist/agents/hooks/useAgentRunSurfaceScope.js +3 -4
  10. package/dist/agents/identity/agent-catalog-lists.d.ts +45 -0
  11. package/dist/agents/identity/agent-catalog-lists.js +128 -0
  12. package/dist/agents/identity/agent-identity.d.ts +34 -0
  13. package/dist/agents/identity/agent-identity.js +127 -0
  14. package/dist/agents/identity/run-tier-store.d.ts +15 -0
  15. package/dist/agents/identity/run-tier-store.js +23 -0
  16. package/dist/agents/redux/agent-definition/list-mirror.d.ts +139 -0
  17. package/dist/agents/redux/agent-definition/list-mirror.js +157 -0
  18. package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
  19. package/dist/agents/redux/agent-definition/slice.d.ts +1 -0
  20. package/dist/agents/redux/agent-definition/slice.js +1 -0
  21. package/dist/agents/redux/agent-definition/thunks.d.ts +10 -205
  22. package/dist/agents/redux/agent-definition/thunks.js +43 -230
  23. package/dist/agents/redux/agent-filter/selectors.d.ts +9 -0
  24. package/dist/agents/redux/agent-filter/selectors.js +25 -23
  25. package/dist/agents/redux/agent-filter/useAgentIdsForFilter.d.ts +6 -0
  26. package/dist/agents/redux/agent-filter/useAgentIdsForFilter.js +14 -0
  27. package/dist/agents/redux/conversation-history/selectors.js +2 -3
  28. package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +2 -2
  29. package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +2 -2
  30. package/dist/agents/redux/execution-system/thunks/run-headless-agent-json.js +2 -2
  31. package/dist/agents/redux/execution-system/utils/output-contract-guard.js +2 -1
  32. package/dist/agents/types/agent-definition.types.d.ts +8 -18
  33. package/dist/cx-chat/components/ChatMobileAgentName.js +4 -7
  34. package/dist/cx-chat/components/ChatSidebarClient.js +2 -2
  35. package/dist/cx-chat/components/agent/AgentPickerSheet.js +10 -11
  36. package/dist/cx-chat/hooks/useChatCatalogueInit.js +4 -7
  37. package/dist/cx-chat/hooks/useInstanceBootstrap.js +4 -5
  38. package/dist/host/db-types.d.ts +86 -0
  39. package/dist/window-panels/windows/agents/AgentRunWindow.js +4 -6
  40. package/dist/window-panels/windows/agents/RunControlsWindow.js +2 -4
  41. package/package.json +4 -4
@@ -0,0 +1,139 @@
1
+ /**
2
+ * DEPRECATED — the agent-list MIRROR (agent core B2). Removed in the next chat
3
+ * release: readers move to `agents/identity/agent-identity.ts` and
4
+ * `agents/identity/agent-catalog-lists.ts`, which read the ONE catalog store.
5
+ * Kept one release so hosts can repoint before the exports disappear.
6
+ */
7
+ import type { ChatDispatch, ChatRootState } from "../../../store/root-state.js";
8
+ /** Thunk form of `overlayAgentFavorites`, for surfaces that seed rows themselves. */
9
+ export declare const overlayAgentFavoritesThunk: import("@reduxjs/toolkit").AsyncThunk<void, readonly string[], {
10
+ extra?: unknown;
11
+ rejectValue?: unknown;
12
+ serializedErrorType?: unknown;
13
+ pendingMeta?: unknown;
14
+ fulfilledMeta?: unknown;
15
+ rejectedMeta?: unknown;
16
+ dispatch: ChatDispatch;
17
+ state: ChatRootState;
18
+ }>;
19
+ /**
20
+ * Hydrates this registry from the ONE agent catalog. The gallery, the agent
21
+ * pages, and every name-resolving surface read `agentDefinition`; the catalog
22
+ * reads the database. This is the seam between them.
23
+ *
24
+ * The catalog's own freshness window and in-flight dedupe make this safe to
25
+ * dispatch on every mount — no thunk-level TTL guard is needed or wanted.
26
+ */
27
+ export declare const fetchAgentsList: import("@reduxjs/toolkit").AsyncThunk<void, void, {
28
+ extra?: unknown;
29
+ rejectValue?: unknown;
30
+ serializedErrorType?: unknown;
31
+ pendingMeta?: unknown;
32
+ fulfilledMeta?: unknown;
33
+ rejectedMeta?: unknown;
34
+ dispatch: ChatDispatch;
35
+ state: ChatRootState;
36
+ }>;
37
+ /**
38
+ * Server-side agent search — the canonical path for finding an agent.
39
+ *
40
+ * WHY THIS EXISTS: the list is paginated. Filtering only what the client has
41
+ * already loaded silently reports "no results" for agents that were simply
42
+ * never fetched. Any paginated collection therefore needs a server search.
43
+ *
44
+ * ADDITIVE BY CONTRACT: results go through `mergeAgentListRows`, the same
45
+ * merge the list fetch uses. Rows are ADDED to the store and existing records
46
+ * are enriched, never replaced or evicted. Local matches keep rendering
47
+ * instantly while this resolves, then server-only matches fold in beneath
48
+ * them — nothing the user is already looking at disappears.
49
+ *
50
+ * Two tiers:
51
+ * deep = false (default) — name, description, category, tags, model, id
52
+ * deep = true — the above PLUS the agent's own prompt content
53
+ *
54
+ * Tier 2 is a strict superset and prompt hits always score below every tier-1
55
+ * field, so enabling it can only append below the obvious matches.
56
+ *
57
+ * Returns the matched ids in server rank order so a caller can preserve
58
+ * server relevance ordering if it wants to.
59
+ */
60
+ export declare const searchAgentsServer: import("@reduxjs/toolkit").AsyncThunk<{
61
+ ids: string[];
62
+ deep: boolean;
63
+ query: string;
64
+ }, {
65
+ query: string;
66
+ deep?: boolean;
67
+ limit?: number;
68
+ }, {
69
+ extra?: unknown;
70
+ rejectValue?: unknown;
71
+ serializedErrorType?: unknown;
72
+ pendingMeta?: unknown;
73
+ fulfilledMeta?: unknown;
74
+ rejectedMeta?: unknown;
75
+ dispatch: ChatDispatch;
76
+ state: ChatRootState;
77
+ }>;
78
+ /**
79
+ * The picker-era name for the same hydration. Kept because ~20 surfaces
80
+ * dispatch it by name; it is `fetchAgentsList` with no status writes, because
81
+ * a picker's own loading state comes from the package now.
82
+ */
83
+ export declare const fetchAgentsListFull: import("@reduxjs/toolkit").AsyncThunk<void, void, {
84
+ extra?: unknown;
85
+ rejectValue?: unknown;
86
+ serializedErrorType?: unknown;
87
+ pendingMeta?: unknown;
88
+ fulfilledMeta?: unknown;
89
+ rejectedMeta?: unknown;
90
+ dispatch: ChatDispatch;
91
+ state: ChatRootState;
92
+ }>;
93
+ /**
94
+ * Makes sure ONE agent's identity (name, description, …) is in this registry.
95
+ *
96
+ * Neither execution fetch (`agx_get_execution_minimal` / `_full`) carries the
97
+ * name, so an agent that no list fetch had loaded launched with a nameless
98
+ * record: every window titled it "Agent" and the empty hero lost its name.
99
+ * The name comes from the same place every name comes from — the ONE catalog —
100
+ * projected through `mergeAgentSummaries`. No-op when the name is present.
101
+ */
102
+ export declare const ensureAgentIdentity: import("@reduxjs/toolkit").AsyncThunk<void, string, {
103
+ extra?: unknown;
104
+ rejectValue?: unknown;
105
+ serializedErrorType?: unknown;
106
+ pendingMeta?: unknown;
107
+ fulfilledMeta?: unknown;
108
+ rejectedMeta?: unknown;
109
+ dispatch: ChatDispatch;
110
+ state: ChatRootState;
111
+ }>;
112
+ /**
113
+ * THE FRESHNESS IS THE PACKAGE'S. `isChatListFresh` and its module-level
114
+ * timestamp are gone: the catalog owns the 15-minute TTL and the 4-hour
115
+ * tab-restore threshold, so there is exactly one answer to "is the list
116
+ * stale" on this platform.
117
+ */
118
+ export declare function isChatListStale(): boolean;
119
+ /**
120
+ * Initializes the agent catalogue for the chat sidebar and hydrates this
121
+ * registry from it. Safe to call on every mount — the catalog's own TTL and
122
+ * shared in-flight promise collapse concurrent mounts to one read.
123
+ *
124
+ * Usage:
125
+ * dispatch(initializeChatAgents()) // skip if fresh
126
+ * dispatch(initializeChatAgents({ force: true })) // always re-read
127
+ */
128
+ export declare const initializeChatAgents: import("@reduxjs/toolkit").AsyncThunk<void, void | {
129
+ force?: boolean;
130
+ }, {
131
+ extra?: unknown;
132
+ rejectValue?: unknown;
133
+ serializedErrorType?: unknown;
134
+ pendingMeta?: unknown;
135
+ fulfilledMeta?: unknown;
136
+ rejectedMeta?: unknown;
137
+ dispatch: ChatDispatch;
138
+ state: ChatRootState;
139
+ }>;
@@ -0,0 +1,157 @@
1
+ import { createAsyncThunk } from "@reduxjs/toolkit";
2
+ import { getAgentCatalog } from "../../../host/ui-slots.js";
3
+ import { readFavoriteIds } from "../../../context/sources/scopes.js";
4
+ import {
5
+ mergePartialAgent,
6
+ setAgentFetchStatus,
7
+ setAgentsStatus,
8
+ setAgentsError
9
+ } from "./slice.js";
10
+ const REGISTRY_ACCESS_LEVELS = [
11
+ "owner",
12
+ "admin",
13
+ "editor",
14
+ "viewer",
15
+ "system"
16
+ ];
17
+ function toRegistryAccessLevel(value) {
18
+ return REGISTRY_ACCESS_LEVELS.find(
19
+ (level) => level === value
20
+ ) ?? null;
21
+ }
22
+ function mergeAgentSummaries(dispatch, rows) {
23
+ for (const row of rows) {
24
+ dispatch(
25
+ mergePartialAgent({
26
+ id: row.id,
27
+ name: row.name ?? void 0,
28
+ description: row.description,
29
+ category: row.category,
30
+ tags: row.tags,
31
+ agentType: row.agentType,
32
+ modelId: row.modelId,
33
+ isActive: row.isActive,
34
+ isArchived: row.isArchived,
35
+ // No `isFavorite`: the catalog row's column is retired — stars are
36
+ // overlaid from platform.user_entity_state by `overlayAgentFavorites`.
37
+ // The registry spells "absent" as `undefined` where the DB row spells
38
+ // it `null`. Five fields differ; this is the vocabulary translation
39
+ // at the seam, not a value change.
40
+ createdBy: row.createdBy ?? void 0,
41
+ organizationId: row.organizationId ?? void 0,
42
+ taskId: row.taskId,
43
+ sourceAgentId: row.sourceAgentId,
44
+ createdAt: row.createdAt ?? void 0,
45
+ updatedAt: row.updatedAt ?? void 0,
46
+ isVersion: false,
47
+ isOwner: row.isOwner,
48
+ // `access_level` is a DB-owned vocabulary the package deliberately
49
+ // leaves open (an unknown level renders as itself). This registry's
50
+ // field is a closed union, so an unrecognised level is stored as
51
+ // `null` — absent, never silently coerced into a wrong level.
52
+ accessLevel: toRegistryAccessLevel(row.accessLevel),
53
+ sharedByEmail: row.sharedByEmail ?? void 0,
54
+ // The class pin; a catalog read that lacks the column leaves it absent.
55
+ ...row.offeringId === void 0 ? {} : { listOfferingPin: row.offeringId }
56
+ })
57
+ );
58
+ dispatch(setAgentFetchStatus({ id: row.id, status: "list" }));
59
+ }
60
+ }
61
+ async function overlayAgentFavorites(dispatch, ids) {
62
+ if (ids.length === 0) return;
63
+ const favorites = await readFavoriteIds("agent", ids);
64
+ if (!favorites) return;
65
+ for (const id of ids) {
66
+ dispatch(mergePartialAgent({ id, isFavorite: favorites.has(id) }));
67
+ }
68
+ }
69
+ const overlayAgentFavoritesThunk = createAsyncThunk("agentDefinition/overlayFavorites", async (ids, { dispatch }) => {
70
+ await overlayAgentFavorites(dispatch, ids);
71
+ });
72
+ const fetchAgentsList = createAsyncThunk(
73
+ "agentDefinition/fetchList",
74
+ async (_, { dispatch }) => {
75
+ dispatch(setAgentsStatus("loading"));
76
+ dispatch(setAgentsError(null));
77
+ const catalog = getAgentCatalog();
78
+ try {
79
+ await catalog.ensureLoaded();
80
+ } catch (e) {
81
+ dispatch(setAgentsError(e instanceof Error ? e.message : String(e)));
82
+ dispatch(setAgentsStatus("failed"));
83
+ throw e;
84
+ }
85
+ const rows = catalog.getState().rows;
86
+ mergeAgentSummaries(dispatch, rows);
87
+ await overlayAgentFavorites(
88
+ dispatch,
89
+ rows.map((r) => r.id)
90
+ );
91
+ dispatch(setAgentsStatus("succeeded"));
92
+ }
93
+ );
94
+ const searchAgentsServer = createAsyncThunk(
95
+ "agentDefinition/searchServer",
96
+ async ({ query, deep = false }, { dispatch }) => {
97
+ const q = query.trim();
98
+ if (!q) return { ids: [], deep, query: q };
99
+ const catalog = getAgentCatalog();
100
+ const ids = await catalog.searchServer(q, deep);
101
+ const state = catalog.getState();
102
+ const hits = ids.map((id) => state.byId[id]).filter((r) => !!r);
103
+ mergeAgentSummaries(dispatch, hits);
104
+ await overlayAgentFavorites(
105
+ dispatch,
106
+ hits.map((r) => r.id)
107
+ );
108
+ return { ids, deep, query: q };
109
+ }
110
+ );
111
+ const fetchAgentsListFull = createAsyncThunk(
112
+ "agentDefinition/fetchListFull",
113
+ async (_, { dispatch }) => {
114
+ const catalog = getAgentCatalog();
115
+ await catalog.ensureLoaded();
116
+ const rows = catalog.getState().rows;
117
+ mergeAgentSummaries(dispatch, rows);
118
+ await overlayAgentFavorites(
119
+ dispatch,
120
+ rows.map((r) => r.id)
121
+ );
122
+ }
123
+ );
124
+ const ensureAgentIdentity = createAsyncThunk(
125
+ "agentDefinition/ensureIdentity",
126
+ async (agentId, { dispatch, getState }) => {
127
+ if (getState().agentDefinition.agents?.[agentId]?.name) return;
128
+ const catalog = getAgentCatalog();
129
+ let row = catalog.getState().byId[agentId];
130
+ if (!row) {
131
+ await catalog.ensureLoaded();
132
+ row = catalog.getState().byId[agentId];
133
+ }
134
+ if (row) {
135
+ mergeAgentSummaries(dispatch, [row]);
136
+ await overlayAgentFavorites(dispatch, [row.id]);
137
+ }
138
+ }
139
+ );
140
+ function isChatListStale() {
141
+ return getAgentCatalog().isStale();
142
+ }
143
+ const initializeChatAgents = createAsyncThunk("agentDefinition/initializeChatAgents", async (arg, { dispatch }) => {
144
+ const force = arg?.force ?? false;
145
+ const catalog = getAgentCatalog();
146
+ await catalog.ensureLoaded(force ? { force: true } : void 0);
147
+ mergeAgentSummaries(dispatch, catalog.getState().rows);
148
+ });
149
+ export {
150
+ ensureAgentIdentity,
151
+ fetchAgentsList,
152
+ fetchAgentsListFull,
153
+ initializeChatAgents,
154
+ isChatListStale,
155
+ overlayAgentFavoritesThunk,
156
+ searchAgentsServer
157
+ };
@@ -3007,7 +3007,7 @@ export declare const selectAgentRunTier: ((state: {
3007
3007
  youtube_videos?: boolean | undefined;
3008
3008
  };
3009
3009
  toolIds: string[];
3010
- counts: import("../../types/agent-definition.types.js").AgentRunCounts | null;
3010
+ counts: import("@ai-matrx/agents/runtime").AgentRunCounts | null;
3011
3011
  }) & {
3012
3012
  clearCache: () => void;
3013
3013
  resultsCount: () => number;
@@ -3037,7 +3037,7 @@ export declare const selectAgentRunTier: ((state: {
3037
3037
  youtube_videos?: boolean | undefined;
3038
3038
  };
3039
3039
  toolIds: string[];
3040
- counts: import("../../types/agent-definition.types.js").AgentRunCounts | null;
3040
+ counts: import("@ai-matrx/agents/runtime").AgentRunCounts | null;
3041
3041
  };
3042
3042
  memoizedResultFunc: ((resultFuncArgs_0: AgentDefinitionRecord | undefined) => {
3043
3043
  isReady: false;
@@ -3063,7 +3063,7 @@ export declare const selectAgentRunTier: ((state: {
3063
3063
  youtube_videos?: boolean | undefined;
3064
3064
  };
3065
3065
  toolIds: string[];
3066
- counts: import("../../types/agent-definition.types.js").AgentRunCounts | null;
3066
+ counts: import("@ai-matrx/agents/runtime").AgentRunCounts | null;
3067
3067
  }) & {
3068
3068
  clearCache: () => void;
3069
3069
  resultsCount: () => number;
@@ -3093,7 +3093,7 @@ export declare const selectAgentRunTier: ((state: {
3093
3093
  youtube_videos?: boolean | undefined;
3094
3094
  };
3095
3095
  toolIds: string[];
3096
- counts: import("../../types/agent-definition.types.js").AgentRunCounts | null;
3096
+ counts: import("@ai-matrx/agents/runtime").AgentRunCounts | null;
3097
3097
  };
3098
3098
  dependencies: [((state: {
3099
3099
  voiceAgent: import("../../../voice-agent/types.js").VoiceAgentState;
@@ -13990,7 +13990,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
13990
13990
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
13991
13991
  modelRegistry: import("../../model-registry/modelRegistrySlice.js").ModelRegistryState;
13992
13992
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
13993
- } & import("../../../store/root-state.js").ChatHostReadSlices, _id: string, field: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("../../types/agent-definition.types.js").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
13993
+ } & import("../../../store/root-state.js").ChatHostReadSlices, _id: string, field: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("@ai-matrx/agents/runtime").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
13994
13994
  name: string;
13995
13995
  description?: string;
13996
13996
  input_schema?: import("@ai-matrx/agents/generated/api-types").components["schemas"]["CustomToolInputSchema"];
@@ -14251,7 +14251,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14251
14251
  resultsCount: () => number;
14252
14252
  resetResultsCount: () => void;
14253
14253
  } & {
14254
- resultFunc: (resultFuncArgs_0: AgentDefinitionRecord | undefined, resultFuncArgs_1: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("../../types/agent-definition.types.js").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14254
+ resultFunc: (resultFuncArgs_0: AgentDefinitionRecord | undefined, resultFuncArgs_1: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("@ai-matrx/agents/runtime").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14255
14255
  name: string;
14256
14256
  description?: string;
14257
14257
  input_schema?: import("@ai-matrx/agents/generated/api-types").components["schemas"]["CustomToolInputSchema"];
@@ -14508,7 +14508,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14508
14508
  file_urls?: boolean | undefined;
14509
14509
  youtube_videos?: boolean | undefined;
14510
14510
  } | undefined;
14511
- memoizedResultFunc: ((resultFuncArgs_0: AgentDefinitionRecord | undefined, resultFuncArgs_1: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("../../types/agent-definition.types.js").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14511
+ memoizedResultFunc: ((resultFuncArgs_0: AgentDefinitionRecord | undefined, resultFuncArgs_1: keyof AgentDefinition) => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("@ai-matrx/agents/runtime").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14512
14512
  name: string;
14513
14513
  description?: string;
14514
14514
  input_schema?: import("@ai-matrx/agents/generated/api-types").components["schemas"]["CustomToolInputSchema"];
@@ -14769,7 +14769,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14769
14769
  resultsCount: () => number;
14770
14770
  resetResultsCount: () => void;
14771
14771
  };
14772
- lastResult: () => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("../../types/agent-definition.types.js").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14772
+ lastResult: () => string | number | boolean | import("../../types/agent-definition.types.js").AgentRunControls | import("@ai-matrx/agents/runtime").AgentRunCounts | string[] | import("../../types/agent-definition.types.js").AgentDefinitionDataIssue[] | import("../../types/agent-message-types.js").AgentDefinitionMessage[] | import("../../types/agent-api-types.js").ContextPolicy[] | import("../../types/agent-definition.types.js").VariableDefinition[] | {
14773
14773
  name: string;
14774
14774
  description?: string;
14775
14775
  input_schema?: import("@ai-matrx/agents/generated/api-types").components["schemas"]["CustomToolInputSchema"];
@@ -1,5 +1,6 @@
1
1
  import { type PayloadAction } from "@reduxjs/toolkit";
2
2
  import type { AgentDefinition, AgentDefinitionRecord, AgentDefinitionSliceState, AgentFetchStatus, LoadedFields } from "../../types/agent-definition.types.js";
3
+ export declare function makeEmptyRecord(id: string): AgentDefinitionRecord;
3
4
  /**
4
5
  * Marks a record as clean. Clears dirty state, field history, and undo stacks.
5
6
  * _loadedFields is NOT cleared — fetched state is cumulative.
@@ -339,6 +339,7 @@ var slice_default = agentDefinitionSlice.reducer;
339
339
  export {
340
340
  agentDefinitionSlice,
341
341
  slice_default as default,
342
+ makeEmptyRecord,
342
343
  markAgentFieldsLoaded,
343
344
  markAgentRecordClean,
344
345
  mergePartialAgent,
@@ -1,20 +1,13 @@
1
1
  /**
2
2
  * Agent Definition — Redux Thunks
3
3
  *
4
- * 🚨 THE LIST IS THE PACKAGE'S (2026-09-08). `@ai-matrx/agents/catalog` owns
5
- * every agent-list read on this platform — `agx_get_list_full`, `agx_search`,
6
- * the freshness window, the in-flight dedupe. The four list thunks below are
7
- * THIN HYDRATORS: they ask the ONE catalog and project its `AgentSummary`
8
- * rows into this registry as `_fetchStatus: "list"` records, so the ~50
9
- * non-picker surfaces that read names / the builtin catalogue / gallery rows
10
- * from `agentDefinition` keep working unchanged. No RPC is issued here, and
11
- * adding one back is a defect (guard: `pnpm check:agent-list-reads`).
4
+ * 🚨 THE LIST IS THE CORE'S, AND ONLY THE CORE'S (agent core B2, 2026-10-07).
5
+ * Chat keeps NO agent-list mirror: every list, name and description reads the
6
+ * `@ai-matrx/agents/catalog` store (`agents/identity/agent-identity.ts`). The
7
+ * run tier, run controls, access level and shared lists are read through the
8
+ * core `createRunTierStore` (`agents/identity/run-tier-store.ts`).
12
9
  *
13
10
  * Read thunks:
14
- * fetchAgentsList — hydrate the registry from the catalog
15
- * fetchAgentsListFull — same; kept as the picker-era name
16
- * fetchSharedAgents — agents shared with me (for "shared" tab)
17
- * fetchSharedAgentsForChat — minimal shared list for chat agent picker
18
11
  * fetchAgentAccessLevel — current user's permission level on an agent
19
12
  * fetchAgentRunTier — TIER 2: what a run needs, never the definition (skips if ready)
20
13
  * fetchAgentExecutionMinimal — the run tier under its pre-P24 name (app callers)
@@ -39,6 +32,7 @@
39
32
  * old agx_check_drift / agx_check_references / agx_accept_version RPCs were
40
33
  * replaced by agx_usage_scan / agx_usage_report / agx_usage_update_to_active.
41
34
  */
35
+ import { type AgentAccessLevelRow } from "@ai-matrx/agents/runtime";
42
36
  import type { ChatDispatch, ChatRootState } from "../../../store/root-state.js";
43
37
  import type { Database } from "../../../host/db-types.js";
44
38
  import { type AIModelRecord } from "../../model-registry/modelRegistrySlice.js";
@@ -59,110 +53,6 @@ export declare function isAvailableToolModel(model: AIModelRecord | undefined):
59
53
  export declare function applyAgentToolDelta(currentTools: readonly string[], addToolIds: readonly string[], removeToolIds: readonly string[]): string[];
60
54
  export declare function sameStringArray(a: readonly string[], b: readonly string[]): boolean;
61
55
  export declare function isToolAssignmentPhantom(current: AgentToolAssignmentRow, base: AgentToolAssignmentRow): boolean;
62
- /** Thunk form of `overlayAgentFavorites`, for surfaces that seed rows themselves. */
63
- export declare const overlayAgentFavoritesThunk: import("@reduxjs/toolkit").AsyncThunk<void, readonly string[], {
64
- extra?: unknown;
65
- rejectValue?: unknown;
66
- serializedErrorType?: unknown;
67
- pendingMeta?: unknown;
68
- fulfilledMeta?: unknown;
69
- rejectedMeta?: unknown;
70
- dispatch: ChatDispatch;
71
- state: ChatRootState;
72
- }>;
73
- /**
74
- * Hydrates this registry from the ONE agent catalog. The gallery, the agent
75
- * pages, and every name-resolving surface read `agentDefinition`; the catalog
76
- * reads the database. This is the seam between them.
77
- *
78
- * The catalog's own freshness window and in-flight dedupe make this safe to
79
- * dispatch on every mount — no thunk-level TTL guard is needed or wanted.
80
- */
81
- export declare const fetchAgentsList: import("@reduxjs/toolkit").AsyncThunk<void, void, {
82
- extra?: unknown;
83
- rejectValue?: unknown;
84
- serializedErrorType?: unknown;
85
- pendingMeta?: unknown;
86
- fulfilledMeta?: unknown;
87
- rejectedMeta?: unknown;
88
- dispatch: ChatDispatch;
89
- state: ChatRootState;
90
- }>;
91
- /**
92
- * Server-side agent search — the canonical path for finding an agent.
93
- *
94
- * WHY THIS EXISTS: the list is paginated. Filtering only what the client has
95
- * already loaded silently reports "no results" for agents that were simply
96
- * never fetched. Any paginated collection therefore needs a server search.
97
- *
98
- * ADDITIVE BY CONTRACT: results go through `mergeAgentListRows`, the same
99
- * merge the list fetch uses. Rows are ADDED to the store and existing records
100
- * are enriched, never replaced or evicted. Local matches keep rendering
101
- * instantly while this resolves, then server-only matches fold in beneath
102
- * them — nothing the user is already looking at disappears.
103
- *
104
- * Two tiers:
105
- * deep = false (default) — name, description, category, tags, model, id
106
- * deep = true — the above PLUS the agent's own prompt content
107
- *
108
- * Tier 2 is a strict superset and prompt hits always score below every tier-1
109
- * field, so enabling it can only append below the obvious matches.
110
- *
111
- * Returns the matched ids in server rank order so a caller can preserve
112
- * server relevance ordering if it wants to.
113
- */
114
- export declare const searchAgentsServer: import("@reduxjs/toolkit").AsyncThunk<{
115
- ids: string[];
116
- deep: boolean;
117
- query: string;
118
- }, {
119
- query: string;
120
- deep?: boolean;
121
- limit?: number;
122
- }, {
123
- extra?: unknown;
124
- rejectValue?: unknown;
125
- serializedErrorType?: unknown;
126
- pendingMeta?: unknown;
127
- fulfilledMeta?: unknown;
128
- rejectedMeta?: unknown;
129
- dispatch: ChatDispatch;
130
- state: ChatRootState;
131
- }>;
132
- /**
133
- * The picker-era name for the same hydration. Kept because ~20 surfaces
134
- * dispatch it by name; it is `fetchAgentsList` with no status writes, because
135
- * a picker's own loading state comes from the package now.
136
- */
137
- export declare const fetchAgentsListFull: import("@reduxjs/toolkit").AsyncThunk<void, void, {
138
- extra?: unknown;
139
- rejectValue?: unknown;
140
- serializedErrorType?: unknown;
141
- pendingMeta?: unknown;
142
- fulfilledMeta?: unknown;
143
- rejectedMeta?: unknown;
144
- dispatch: ChatDispatch;
145
- state: ChatRootState;
146
- }>;
147
- /**
148
- * Makes sure ONE agent's identity (name, description, …) is in this registry.
149
- *
150
- * Neither execution fetch (`agx_get_execution_minimal` / `_full`) carries the
151
- * name, so an agent that no list fetch had loaded launched with a nameless
152
- * record: every window titled it "Agent" and the empty hero lost its name.
153
- * The name comes from the same place every name comes from — the ONE catalog —
154
- * projected through `mergeAgentSummaries`. No-op when the name is present.
155
- */
156
- export declare const ensureAgentIdentity: import("@reduxjs/toolkit").AsyncThunk<void, string, {
157
- extra?: unknown;
158
- rejectValue?: unknown;
159
- serializedErrorType?: unknown;
160
- pendingMeta?: unknown;
161
- fulfilledMeta?: unknown;
162
- rejectedMeta?: unknown;
163
- dispatch: ChatDispatch;
164
- state: ChatRootState;
165
- }>;
166
56
  /**
167
57
  * TIER 2 — THE RUN TIER (PACKAGE-INDEPENDENCE §3, P24). Everything a run needs
168
58
  * and nothing it does not: variables, context rules, the kill switch, the
@@ -227,66 +117,8 @@ export declare const fetchAgentRunControls: import("@reduxjs/toolkit").AsyncThun
227
117
  dispatch: ChatDispatch;
228
118
  state: ChatRootState;
229
119
  }>;
230
- export interface SharedAgentItem {
231
- id: string;
232
- name: string;
233
- description: string | null;
234
- agent_type: "user" | "builtin";
235
- category: string | null;
236
- tags: string[];
237
- owner_id: string | null;
238
- owner_email: string | null;
239
- permission_level: string;
240
- created_at: string;
241
- updated_at: string;
242
- }
243
- export interface SharedAgentForChat {
244
- id: string;
245
- name: string;
246
- permission_level: string;
247
- owner_email: string | null;
248
- }
249
- /**
250
- * Fetches all agents shared with the current user (not owned by them).
251
- *
252
- * @deprecated agx_get_list() now returns both owned and shared agents in one
253
- * call with full access metadata. Prefer fetchAgentsList() instead.
254
- * This thunk is kept for cases where only the shared subset is needed
255
- * (e.g. a targeted refresh of the "Shared with me" tab without re-fetching owned agents).
256
- */
257
- export declare const fetchSharedAgents: import("@reduxjs/toolkit").AsyncThunk<SharedAgentItem[], void, {
258
- extra?: unknown;
259
- rejectValue?: unknown;
260
- serializedErrorType?: unknown;
261
- pendingMeta?: unknown;
262
- fulfilledMeta?: unknown;
263
- rejectedMeta?: unknown;
264
- dispatch: ChatDispatch;
265
- state: ChatRootState;
266
- }>;
267
- /**
268
- * Fetches the minimal shared agent list for the chat agent picker.
269
- * Returns the raw list — lightweight, not stored in slice
270
- * (the picker only needs name + id, no need to hydrate execution fields).
271
- */
272
- export declare const fetchSharedAgentsForChat: import("@reduxjs/toolkit").AsyncThunk<SharedAgentForChat[], void, {
273
- extra?: unknown;
274
- rejectValue?: unknown;
275
- serializedErrorType?: unknown;
276
- pendingMeta?: unknown;
277
- fulfilledMeta?: unknown;
278
- rejectedMeta?: unknown;
279
- dispatch: ChatDispatch;
280
- state: ChatRootState;
281
- }>;
282
- export interface AgentAccessLevel {
283
- agent_id: string;
284
- agent_name: string;
285
- owner_id: string;
286
- owner_email: string;
287
- access_level: "owner" | "admin" | "editor" | "viewer" | "public" | "none";
288
- is_owner: boolean;
289
- }
120
+ export type { SharedAgentItem, SharedAgentForChat } from "@ai-matrx/agents/runtime";
121
+ export type AgentAccessLevel = AgentAccessLevelRow;
290
122
  /**
291
123
  * Returns the current user's permission level on a specific agent.
292
124
  * Also merges the result into the slice so selectors stay consistent.
@@ -294,35 +126,7 @@ export interface AgentAccessLevel {
294
126
  * Use when opening the agent builder, or when the record arrived via a
295
127
  * shortcut/execution RPC (which don't include access metadata).
296
128
  */
297
- export declare const fetchAgentAccessLevel: import("@reduxjs/toolkit").AsyncThunk<AgentAccessLevel, string, {
298
- extra?: unknown;
299
- rejectValue?: unknown;
300
- serializedErrorType?: unknown;
301
- pendingMeta?: unknown;
302
- fulfilledMeta?: unknown;
303
- rejectedMeta?: unknown;
304
- dispatch: ChatDispatch;
305
- state: ChatRootState;
306
- }>;
307
- /**
308
- * THE FRESHNESS IS THE PACKAGE'S. `isChatListFresh` and its module-level
309
- * timestamp are gone: the catalog owns the 15-minute TTL and the 4-hour
310
- * tab-restore threshold, so there is exactly one answer to "is the list
311
- * stale" on this platform.
312
- */
313
- export declare function isChatListStale(): boolean;
314
- /**
315
- * Initializes the agent catalogue for the chat sidebar and hydrates this
316
- * registry from it. Safe to call on every mount — the catalog's own TTL and
317
- * shared in-flight promise collapse concurrent mounts to one read.
318
- *
319
- * Usage:
320
- * dispatch(initializeChatAgents()) // skip if fresh
321
- * dispatch(initializeChatAgents({ force: true })) // always re-read
322
- */
323
- export declare const initializeChatAgents: import("@reduxjs/toolkit").AsyncThunk<void, void | {
324
- force?: boolean;
325
- }, {
129
+ export declare const fetchAgentAccessLevel: import("@reduxjs/toolkit").AsyncThunk<AgentAccessLevelRow, string, {
326
130
  extra?: unknown;
327
131
  rejectValue?: unknown;
328
132
  serializedErrorType?: unknown;
@@ -332,3 +136,4 @@ export declare const initializeChatAgents: import("@reduxjs/toolkit").AsyncThunk
332
136
  dispatch: ChatDispatch;
333
137
  state: ChatRootState;
334
138
  }>;
139
+ export { overlayAgentFavoritesThunk, fetchAgentsList, searchAgentsServer, fetchAgentsListFull, ensureAgentIdentity, isChatListStale, initializeChatAgents, } from "./list-mirror.js";