@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.
- package/CHANGELOG.md +11 -0
- package/dist/agents/components/chat/ChatConversationSurface.js +2 -2
- package/dist/agents/components/chat/ChatRunHeader.js +3 -5
- package/dist/agents/components/chat/PinnedAgentsSection.js +2 -2
- package/dist/agents/components/context-preview/ContextCompareView.js +5 -12
- package/dist/agents/components/inputs/smart-input/composer/useComposerAgent.js +4 -5
- package/dist/agents/components/run/AgentRunnerPage.js +3 -3
- package/dist/agents/hooks/useAgentModelLabel.js +6 -2
- package/dist/agents/hooks/useAgentRunSurfaceScope.js +3 -4
- package/dist/agents/identity/agent-catalog-lists.d.ts +45 -0
- package/dist/agents/identity/agent-catalog-lists.js +128 -0
- package/dist/agents/identity/agent-identity.d.ts +34 -0
- package/dist/agents/identity/agent-identity.js +127 -0
- package/dist/agents/identity/run-tier-store.d.ts +15 -0
- package/dist/agents/identity/run-tier-store.js +23 -0
- package/dist/agents/redux/agent-definition/list-mirror.d.ts +139 -0
- package/dist/agents/redux/agent-definition/list-mirror.js +157 -0
- package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
- package/dist/agents/redux/agent-definition/slice.d.ts +1 -0
- package/dist/agents/redux/agent-definition/slice.js +1 -0
- package/dist/agents/redux/agent-definition/thunks.d.ts +10 -205
- package/dist/agents/redux/agent-definition/thunks.js +43 -230
- package/dist/agents/redux/agent-filter/selectors.d.ts +9 -0
- package/dist/agents/redux/agent-filter/selectors.js +25 -23
- package/dist/agents/redux/agent-filter/useAgentIdsForFilter.d.ts +6 -0
- package/dist/agents/redux/agent-filter/useAgentIdsForFilter.js +14 -0
- package/dist/agents/redux/conversation-history/selectors.js +2 -3
- package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +2 -2
- package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +2 -2
- package/dist/agents/redux/execution-system/thunks/run-headless-agent-json.js +2 -2
- package/dist/agents/redux/execution-system/utils/output-contract-guard.js +2 -1
- package/dist/agents/types/agent-definition.types.d.ts +8 -18
- package/dist/cx-chat/components/ChatMobileAgentName.js +4 -7
- package/dist/cx-chat/components/ChatSidebarClient.js +2 -2
- package/dist/cx-chat/components/agent/AgentPickerSheet.js +10 -11
- package/dist/cx-chat/hooks/useChatCatalogueInit.js +4 -7
- package/dist/cx-chat/hooks/useInstanceBootstrap.js +4 -5
- package/dist/host/db-types.d.ts +86 -0
- package/dist/window-panels/windows/agents/AgentRunWindow.js +4 -6
- package/dist/window-panels/windows/agents/RunControlsWindow.js +2 -4
- package/package.json +4 -4
|
@@ -19,15 +19,8 @@ import {
|
|
|
19
19
|
} from "@ai-matrx/design-system";
|
|
20
20
|
import { AgentListInlinePicker } from "@ai-matrx/agents/catalog/react";
|
|
21
21
|
import { selectAgentById } from "../../../agents/redux/agent-definition/selectors.js";
|
|
22
|
+
import { readAgentDescription, readAgentName } from "../../../agents/identity/agent-identity.js";
|
|
22
23
|
const CX_CHAT_PICKER_CONSUMER_ID = "cx-chat-agent-picker";
|
|
23
|
-
function toAgentConfig(agent) {
|
|
24
|
-
return {
|
|
25
|
-
promptId: agent.id,
|
|
26
|
-
name: agent.name,
|
|
27
|
-
description: agent.description ?? void 0,
|
|
28
|
-
variableDefaults: agent.variableDefinitions
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
24
|
function AgentPickerSheet({
|
|
32
25
|
open,
|
|
33
26
|
onOpenChange,
|
|
@@ -37,12 +30,18 @@ function AgentPickerSheet({
|
|
|
37
30
|
const isMobile = useIsMobile();
|
|
38
31
|
const store = useAppStore();
|
|
39
32
|
const handleSelect = (agentId) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
33
|
+
const record = selectAgentById(store.getState(), agentId);
|
|
34
|
+
const name = readAgentName(store.getState(), agentId);
|
|
35
|
+
if (!name) {
|
|
42
36
|
toast.error("The selected agent could not be loaded.");
|
|
43
37
|
return;
|
|
44
38
|
}
|
|
45
|
-
onSelect(
|
|
39
|
+
onSelect({
|
|
40
|
+
promptId: agentId,
|
|
41
|
+
name,
|
|
42
|
+
description: readAgentDescription(store.getState(), agentId) ?? void 0,
|
|
43
|
+
variableDefaults: record?.variableDefinitions
|
|
44
|
+
});
|
|
46
45
|
onOpenChange(false);
|
|
47
46
|
};
|
|
48
47
|
const picker = /* @__PURE__ */ jsx(
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { useAppDispatch } from "../../store/hooks.js";
|
|
4
|
-
import {
|
|
5
|
-
initializeChatAgents,
|
|
6
|
-
isChatListStale
|
|
7
|
-
} from "../../agents/redux/agent-definition/thunks.js";
|
|
4
|
+
import { ensureAgentCatalog, isAgentCatalogStale } from "../../agents/identity/agent-identity.js";
|
|
8
5
|
function useChatCatalogueInit() {
|
|
9
6
|
const dispatch = useAppDispatch();
|
|
10
7
|
useEffect(() => {
|
|
11
|
-
|
|
8
|
+
void ensureAgentCatalog();
|
|
12
9
|
}, [dispatch]);
|
|
13
10
|
useEffect(() => {
|
|
14
11
|
const handleVisibility = () => {
|
|
15
|
-
if (document.visibilityState === "visible" &&
|
|
16
|
-
|
|
12
|
+
if (document.visibilityState === "visible" && isAgentCatalogStale()) {
|
|
13
|
+
void ensureAgentCatalog({ force: true });
|
|
17
14
|
}
|
|
18
15
|
};
|
|
19
16
|
document.addEventListener("visibilitychange", handleVisibility);
|
|
@@ -3,8 +3,6 @@ import { useEffect, useRef } from "react";
|
|
|
3
3
|
import { usePathname, useSearchParams, useRouter } from "../../host/navigation.js";
|
|
4
4
|
import { useAppDispatch } from "../../store/hooks.js";
|
|
5
5
|
import {
|
|
6
|
-
initializeChatAgents,
|
|
7
|
-
isChatListStale,
|
|
8
6
|
fetchAgentExecutionMinimal
|
|
9
7
|
} from "../../agents/redux/agent-definition/thunks.js";
|
|
10
8
|
import { launchAgentExecution } from "../../agents/redux/execution-system/thunks/launch-agent-execution.thunk.js";
|
|
@@ -14,6 +12,7 @@ import { toast } from "../../host/notify.js";
|
|
|
14
12
|
import { isNotAuthenticatedError } from "../../host/identity.js";
|
|
15
13
|
import { DEFAULT_AGENT_ID } from "../components/agent/local-agents.js";
|
|
16
14
|
import { replaceAddressWithoutNavigating } from "../../ui/addressWithoutNavigating.js";
|
|
15
|
+
import { ensureAgentCatalog, isAgentCatalogStale } from "../../agents/identity/agent-identity.js";
|
|
17
16
|
function parseChatUrl(pathname, searchParams) {
|
|
18
17
|
const agentPathMatch = pathname.match(/\/demos\/chat\/a\/([^/?]+)/);
|
|
19
18
|
const convPathMatch = pathname.match(/\/demos\/chat\/c\/([^/?]+)/);
|
|
@@ -37,12 +36,12 @@ function useInstanceBootstrap() {
|
|
|
37
36
|
const instanceByAgentId = useRef(/* @__PURE__ */ new Map());
|
|
38
37
|
const lastKey = useRef(null);
|
|
39
38
|
useEffect(() => {
|
|
40
|
-
|
|
39
|
+
void ensureAgentCatalog();
|
|
41
40
|
}, [dispatch]);
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
const handleVisibility = () => {
|
|
44
|
-
if (document.visibilityState === "visible" &&
|
|
45
|
-
|
|
43
|
+
if (document.visibilityState === "visible" && isAgentCatalogStale()) {
|
|
44
|
+
void ensureAgentCatalog({ force: true });
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
document.addEventListener("visibilitychange", handleVisibility);
|
package/dist/host/db-types.d.ts
CHANGED
|
@@ -10527,6 +10527,69 @@ export type ChatDatabase = {
|
|
|
10527
10527
|
};
|
|
10528
10528
|
Relationships: [];
|
|
10529
10529
|
};
|
|
10530
|
+
working_documents: {
|
|
10531
|
+
Row: {
|
|
10532
|
+
content: string;
|
|
10533
|
+
created_at: string;
|
|
10534
|
+
created_by: string | null;
|
|
10535
|
+
custom_fields: Json;
|
|
10536
|
+
deleted_at: string | null;
|
|
10537
|
+
id: string;
|
|
10538
|
+
kind: string;
|
|
10539
|
+
metadata: Json;
|
|
10540
|
+
organization_id: string;
|
|
10541
|
+
published_to_web: boolean;
|
|
10542
|
+
published_to_web_at: string | null;
|
|
10543
|
+
published_to_web_by: string | null;
|
|
10544
|
+
shown_to: Database["platform"]["Enums"]["shown_to"] | null;
|
|
10545
|
+
title: string;
|
|
10546
|
+
updated_at: string;
|
|
10547
|
+
updated_by: string | null;
|
|
10548
|
+
version: number;
|
|
10549
|
+
visibility: Database["platform"]["Enums"]["visibility"];
|
|
10550
|
+
};
|
|
10551
|
+
Insert: {
|
|
10552
|
+
content?: string;
|
|
10553
|
+
created_at?: string;
|
|
10554
|
+
created_by?: string | null;
|
|
10555
|
+
custom_fields?: Json;
|
|
10556
|
+
deleted_at?: string | null;
|
|
10557
|
+
id?: string;
|
|
10558
|
+
kind?: string;
|
|
10559
|
+
metadata?: Json;
|
|
10560
|
+
organization_id: string;
|
|
10561
|
+
published_to_web?: boolean;
|
|
10562
|
+
published_to_web_at?: string | null;
|
|
10563
|
+
published_to_web_by?: string | null;
|
|
10564
|
+
shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
|
|
10565
|
+
title?: string;
|
|
10566
|
+
updated_at?: string;
|
|
10567
|
+
updated_by?: string | null;
|
|
10568
|
+
version?: number;
|
|
10569
|
+
visibility?: Database["platform"]["Enums"]["visibility"];
|
|
10570
|
+
};
|
|
10571
|
+
Update: {
|
|
10572
|
+
content?: string;
|
|
10573
|
+
created_at?: string;
|
|
10574
|
+
created_by?: string | null;
|
|
10575
|
+
custom_fields?: Json;
|
|
10576
|
+
deleted_at?: string | null;
|
|
10577
|
+
id?: string;
|
|
10578
|
+
kind?: string;
|
|
10579
|
+
metadata?: Json;
|
|
10580
|
+
organization_id?: string;
|
|
10581
|
+
published_to_web?: boolean;
|
|
10582
|
+
published_to_web_at?: string | null;
|
|
10583
|
+
published_to_web_by?: string | null;
|
|
10584
|
+
shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
|
|
10585
|
+
title?: string;
|
|
10586
|
+
updated_at?: string;
|
|
10587
|
+
updated_by?: string | null;
|
|
10588
|
+
version?: number;
|
|
10589
|
+
visibility?: Database["platform"]["Enums"]["visibility"];
|
|
10590
|
+
};
|
|
10591
|
+
Relationships: [];
|
|
10592
|
+
};
|
|
10530
10593
|
};
|
|
10531
10594
|
Views: {
|
|
10532
10595
|
[_ in never]: never;
|
|
@@ -30189,6 +30252,20 @@ export type ChatDatabase = {
|
|
|
30189
30252
|
};
|
|
30190
30253
|
Returns: Json;
|
|
30191
30254
|
};
|
|
30255
|
+
entity_usage: {
|
|
30256
|
+
Args: {
|
|
30257
|
+
p_entity: string;
|
|
30258
|
+
p_ids: string[];
|
|
30259
|
+
};
|
|
30260
|
+
Returns: {
|
|
30261
|
+
entity_id: string;
|
|
30262
|
+
failure_count: number;
|
|
30263
|
+
last_used_at: string;
|
|
30264
|
+
run_count: number;
|
|
30265
|
+
success_count: number;
|
|
30266
|
+
total_cost: number;
|
|
30267
|
+
}[];
|
|
30268
|
+
};
|
|
30192
30269
|
extensibility_knob: {
|
|
30193
30270
|
Args: {
|
|
30194
30271
|
p_definition_id?: string;
|
|
@@ -36288,20 +36365,25 @@ export type ChatDatabase = {
|
|
|
36288
36365
|
created_by: string;
|
|
36289
36366
|
custom_fields: Json;
|
|
36290
36367
|
description: string;
|
|
36368
|
+
failure_count: number;
|
|
36291
36369
|
id: string;
|
|
36292
36370
|
is_active: boolean;
|
|
36293
36371
|
is_archived: boolean;
|
|
36294
36372
|
is_favorite: boolean;
|
|
36295
36373
|
is_owner: boolean;
|
|
36374
|
+
last_used_at: string;
|
|
36296
36375
|
model_id: string;
|
|
36297
36376
|
name: string;
|
|
36298
36377
|
offering_id: string;
|
|
36299
36378
|
organization_id: string;
|
|
36300
36379
|
organization_name: string;
|
|
36301
36380
|
owner_email: string;
|
|
36381
|
+
run_count: number;
|
|
36302
36382
|
source_agent_id: string;
|
|
36383
|
+
success_count: number;
|
|
36303
36384
|
tags: string[];
|
|
36304
36385
|
task_id: string;
|
|
36386
|
+
total_cost: number;
|
|
36305
36387
|
total_count: number;
|
|
36306
36388
|
updated_at: string;
|
|
36307
36389
|
version: number;
|
|
@@ -45942,6 +46024,7 @@ export type ChatDatabase = {
|
|
|
45942
46024
|
created_by: string;
|
|
45943
46025
|
custom_fields: Json;
|
|
45944
46026
|
description: string;
|
|
46027
|
+
failure_count: number;
|
|
45945
46028
|
id: string;
|
|
45946
46029
|
is_active: boolean;
|
|
45947
46030
|
is_archived: boolean;
|
|
@@ -45956,11 +46039,14 @@ export type ChatDatabase = {
|
|
|
45956
46039
|
owner_email: string;
|
|
45957
46040
|
run_count: number;
|
|
45958
46041
|
step_count: number;
|
|
46042
|
+
success_count: number;
|
|
45959
46043
|
tags: string[];
|
|
46044
|
+
total_cost: number;
|
|
45960
46045
|
total_count: number;
|
|
45961
46046
|
updated_at: string;
|
|
45962
46047
|
version: number;
|
|
45963
46048
|
visibility: string;
|
|
46049
|
+
workflow_type: string;
|
|
45964
46050
|
}[];
|
|
45965
46051
|
};
|
|
45966
46052
|
wsp_resolve_system_task: {
|
|
@@ -11,8 +11,7 @@ import { CHAT_WINDOWS } from "../../../host/windows.js";
|
|
|
11
11
|
import { useChatManagedWindowCount } from "../../../host/windows-react.js";
|
|
12
12
|
import {
|
|
13
13
|
selectAgentById,
|
|
14
|
-
selectAgentExecutionPayload
|
|
15
|
-
selectAgentName
|
|
14
|
+
selectAgentExecutionPayload
|
|
16
15
|
} from "../../../agents/redux/agent-definition/selectors.js";
|
|
17
16
|
import { fetchAgentExecutionMinimal } from "../../../agents/redux/agent-definition/thunks.js";
|
|
18
17
|
import {
|
|
@@ -55,6 +54,7 @@ import {
|
|
|
55
54
|
import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
|
|
56
55
|
import { selectUserId } from "../../../host/identity.js";
|
|
57
56
|
import { selectOrganizationId } from "../../../host/org.js";
|
|
57
|
+
import { useAgentName } from "../../../agents/identity/agent-identity.js";
|
|
58
58
|
const SOURCE_FEATURE = "agent-runner";
|
|
59
59
|
const AGENT_RUN_SIDEBAR_DEFAULT_SIZE = Math.round(220 * 0.85);
|
|
60
60
|
const AGENT_RUN_WINDOW_POSITIONS = [
|
|
@@ -435,7 +435,7 @@ function AgentRunBodyMenu({
|
|
|
435
435
|
children
|
|
436
436
|
}) {
|
|
437
437
|
const dispatch = useAppDispatch();
|
|
438
|
-
const agentName =
|
|
438
|
+
const agentName = useAgentName(agentId) ?? null;
|
|
439
439
|
const agentSection = buildAgentMenuSection({
|
|
440
440
|
agentId,
|
|
441
441
|
agentName,
|
|
@@ -536,9 +536,7 @@ function AgentRunWindowInner({
|
|
|
536
536
|
const [selectedConversationId, setSelectedConversationId] = useState(initialSelectedConversationId);
|
|
537
537
|
const siblingWindowCount = useChatManagedWindowCount("agent-run-window:");
|
|
538
538
|
const initialPosition = AGENT_RUN_WINDOW_POSITIONS[siblingWindowCount % AGENT_RUN_WINDOW_POSITIONS.length];
|
|
539
|
-
const liveAgentName =
|
|
540
|
-
(state) => agentId ? selectAgentName(state, agentId) ?? null : null
|
|
541
|
-
);
|
|
539
|
+
const liveAgentName = useAgentName(agentId) ?? null;
|
|
542
540
|
const agentName = liveAgentName ?? (agentId && agentId === initialAgentId ? initialAgentName : null) ?? "Agent";
|
|
543
541
|
const surfaceKey = agentId ? `${SOURCE_FEATURE}:${instanceId}:${agentId}` : null;
|
|
544
542
|
const liveConversationId = useLiveConversationId(surfaceKey);
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
} from "../../../agents/components/inputs/resources/attach-resource.js";
|
|
18
18
|
import { useAppSelector } from "../../../store/hooks.js";
|
|
19
19
|
import { selectInstanceAgentId } from "../../../agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
20
|
-
import { selectAgentName } from "../../../agents/redux/agent-definition/selectors.js";
|
|
21
20
|
import { NonEditableContextMenu } from "../../../host/ui-slots.js";
|
|
22
21
|
import { buildAgentMenuSection, agentEntityRef } from "../../../agents/menu/agent-actions.js";
|
|
23
22
|
import { Tile } from "@ai-matrx/design-system/controls";
|
|
23
|
+
import { useAgentName } from "../../../agents/identity/agent-identity.js";
|
|
24
24
|
const OVERLAY_ID = CHAT_WINDOWS.runControlsWindow;
|
|
25
25
|
function RunControlsWindowInner({
|
|
26
26
|
conversationId,
|
|
@@ -41,9 +41,7 @@ function RunControlsWindowInner({
|
|
|
41
41
|
const detachResource = useDetachResource(conversationId);
|
|
42
42
|
const close = () => dispatch(closeOverlay({ overlayId: OVERLAY_ID }));
|
|
43
43
|
const agentId = useAppSelector(selectInstanceAgentId(conversationId));
|
|
44
|
-
const agentName =
|
|
45
|
-
(s) => agentId ? selectAgentName(s, agentId) ?? null : null
|
|
46
|
-
);
|
|
44
|
+
const agentName = useAgentName(agentId) ?? null;
|
|
47
45
|
const agentSection = buildAgentMenuSection({ agentId: agentId ?? "", agentName });
|
|
48
46
|
const handleResourceSelected = async (resource) => {
|
|
49
47
|
return attachResource(resource);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/chat",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "THE one AI Matrx person-to-agent chat system: the full chat (running agents, conversations, tool calls, streaming, context, surfaces, voice) as per-module subpaths @ai-matrx/chat/<domain>/<module> over a host contract (/host, /host/react) whose only required value is a db; plus the kernel compatibility entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) until P28.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -226,15 +226,15 @@
|
|
|
226
226
|
"server-only": "^0.0.1",
|
|
227
227
|
"uuid": "^14.0.2",
|
|
228
228
|
"zod": "^4.6.5",
|
|
229
|
+
"@ai-matrx/agents": "latest",
|
|
229
230
|
"@ai-matrx/alchemy": "latest",
|
|
230
231
|
"@ai-matrx/associations": "latest",
|
|
231
|
-
"@ai-matrx/
|
|
232
|
+
"@ai-matrx/browser-audio": "latest",
|
|
232
233
|
"@ai-matrx/canvas": "latest",
|
|
233
234
|
"@ai-matrx/content-ir": "latest",
|
|
234
|
-
"@ai-matrx/
|
|
235
|
+
"@ai-matrx/data": "latest",
|
|
235
236
|
"@ai-matrx/design-system": "latest",
|
|
236
237
|
"@ai-matrx/diff": "latest",
|
|
237
|
-
"@ai-matrx/data": "latest",
|
|
238
238
|
"@ai-matrx/icons": "latest",
|
|
239
239
|
"@ai-matrx/kit": "latest",
|
|
240
240
|
"@ai-matrx/media": "latest",
|