@ai-matrx/chat 0.5.17 → 0.6.0
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 +12 -0
- package/dist/agents/components/identity-refs/AiIdentityRef.d.ts +33 -0
- package/dist/agents/components/identity-refs/AiIdentityRef.js +138 -0
- package/dist/agents/components/inputs/smart-input/QuicksetPanel.js +5 -9
- package/dist/agents/components/inputs/smart-input/RunSkillPicker.js +1 -1
- package/dist/agents/components/inputs/smart-input/RunToolPicker.js +6 -11
- package/dist/agents/components/inputs/smart-input/ShapeChipsRow.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerEffortPill.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerOutput.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerPlusMenu.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/useComposerAgent.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/useRunControlCounts.d.ts +3 -0
- package/dist/agents/components/inputs/smart-input/composer/useRunControlCounts.js +54 -0
- package/dist/agents/components/model-tiers/ModelTierIdentityList.js +1 -1
- package/dist/agents/components/run-controls/RunConfigOverrides.js +1 -1
- package/dist/agents/components/run-controls/RunInputCapabilities.js +1 -1
- package/dist/agents/components/run-controls/panels/shared.d.ts +0 -2
- package/dist/agents/hooks/useDiffEnrichment.js +3 -6
- package/dist/agents/identity/agent-catalog-lists.js +2 -1
- package/dist/agents/identity/agent-identity.js +2 -1
- package/dist/agents/identity/model-catalog.d.ts +9 -0
- package/dist/agents/identity/model-catalog.js +25 -0
- package/dist/agents/identity/preferred-chat-model.d.ts +9 -0
- package/dist/agents/identity/preferred-chat-model.js +33 -0
- package/dist/agents/identity/settings-store.d.ts +10 -0
- package/dist/agents/identity/settings-store.js +49 -0
- package/dist/agents/identity/skill-catalog.d.ts +27 -0
- package/dist/agents/identity/skill-catalog.js +100 -0
- package/dist/agents/identity/tool-catalog.d.ts +15 -0
- package/dist/agents/identity/tool-catalog.js +67 -0
- package/dist/agents/redux/agent-definition/cache-bust-middleware.d.ts +0 -1
- package/dist/agents/redux/agent-definition/cache-bust-middleware.js +1 -13
- package/dist/agents/redux/agent-definition/selectors.d.ts +12 -546
- package/dist/agents/redux/agent-settings/internal-utils.d.ts +2 -123
- package/dist/agents/redux/agent-settings/internal-utils.js +1 -315
- package/dist/agents/redux/agent-settings/settings-catalogue.d.ts +2 -78
- package/dist/agents/redux/agent-settings/settings-catalogue.js +1 -176
- package/dist/agents/redux/agent-settings/types.d.ts +2 -148
- package/dist/agents/redux/agent-settings/types.js +1 -0
- package/dist/agents/redux/agent-settings/ui-gates.d.ts +2 -54
- package/dist/agents/redux/agent-settings/ui-gates.js +1 -38
- package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +0 -100
- package/dist/agents/redux/agent-shortcuts/selectors.d.ts +0 -294
- package/dist/agents/redux/conversation-history/selectors.d.ts +0 -32
- package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +0 -4
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +0 -108
- package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +0 -28
- package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +0 -10
- package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +0 -6
- package/dist/agents/redux/execution-system/instance-model-overrides/launch-model-overrides.js +1 -1
- package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +0 -16
- package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +0 -10
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +0 -14
- package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +0 -2
- package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +0 -14
- package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +0 -2
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +0 -28
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +1 -1
- package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +13 -2
- package/dist/agents/redux/execution-system/thunks/process-stream.js +2 -5
- package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +2 -1
- package/dist/agents/redux/execution-system/utils/loaded-skill-sources.d.ts +1 -1
- package/dist/agents/redux/execution-system/utils/loaded-skill-sources.js +3 -3
- package/dist/agents/redux/execution-system/utils/required-organization.d.ts +10 -0
- package/dist/agents/redux/execution-system/utils/required-organization.js +6 -1
- package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +0 -2
- package/dist/agents/types/instance.types.d.ts +9 -0
- package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +0 -4
- package/dist/host/ui-slots.d.ts +0 -46
- package/dist/host/ui-slots.js +0 -33
- package/dist/store/create-chat-store.d.ts +0 -4
- package/dist/store/middlewares.d.ts +0 -10
- package/dist/store/slices.d.ts +0 -2
- package/dist/store/slices.js +0 -4
- package/dist/surfaces/redux/selectors.d.ts +0 -4
- package/dist/tool-call-visualization/redux/selectors.d.ts +0 -2
- package/dist/ui/chat-default-model-knob.d.ts +1 -1
- package/dist/ui/chat-default-model-knob.js +1 -1
- package/package.json +9 -9
- package/dist/agents/components/model/AgentModelPanel.d.ts +0 -4
- package/dist/agents/components/model/AgentModelPanel.js +0 -9
- package/dist/agents/redux/agent-settings/agentSettingsSlice.d.ts +0 -1015
- package/dist/agents/redux/agent-settings/agentSettingsSlice.js +0 -659
- package/dist/agents/redux/agent-settings/selectors.d.ts +0 -10057
- package/dist/agents/redux/agent-settings/selectors.js +0 -234
- package/dist/agents/redux/agent-settings/useNormalizedControls.d.ts +0 -8
- package/dist/agents/redux/agent-settings/useNormalizedControls.js +0 -24
- package/dist/agents/redux/tools/tools.selectors.d.ts +0 -529
- package/dist/agents/redux/tools/tools.selectors.js +0 -24
- package/dist/agents/redux/tools/tools.slice.d.ts +0 -12
- package/dist/agents/redux/tools/tools.slice.js +0 -37
- package/dist/agents/redux/tools/tools.thunks.d.ts +0 -125
- package/dist/agents/redux/tools/tools.thunks.js +0 -45
- package/dist/host/defaults/setting-control-input.d.ts +0 -11
- package/dist/host/defaults/setting-control-input.js +0 -91
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-matrx/chat
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/chat/v0.5.18..npm/chat/v0.6.0 -- apps/shared/chat`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.5.18
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/chat/v0.5.17..npm/chat/v0.5.18 -- apps/shared/chat`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
3
15
|
## 0.5.17
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The admin model console deep link. */
|
|
2
|
+
export declare function aiModelHref(modelId: string): string;
|
|
3
|
+
/** The admin tool console deep link. */
|
|
4
|
+
export declare function toolHref(toolId: string): string;
|
|
5
|
+
interface AiIdentityRefCommonProps {
|
|
6
|
+
/** Explicit joined label wins and avoids even a cached lookup. */
|
|
7
|
+
name?: string | null;
|
|
8
|
+
/** Audit/history mode: render the complete raw FK directly below the name. */
|
|
9
|
+
showId?: boolean;
|
|
10
|
+
showIcon?: boolean;
|
|
11
|
+
alwaysShowActions?: boolean;
|
|
12
|
+
openInNewTab?: boolean;
|
|
13
|
+
/** For identity text nested inside another interactive control. */
|
|
14
|
+
disableNavigation?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AiModelRefProps extends AiIdentityRefCommonProps {
|
|
19
|
+
modelId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Naming the model an agent or run USES: a model with several classes is
|
|
22
|
+
* shown with its class ("Qwen3.8 27B · Matrx Lightning"). `offeringId` is the
|
|
23
|
+
* pin; none = the preferred class the server runs.
|
|
24
|
+
*/
|
|
25
|
+
showClass?: boolean;
|
|
26
|
+
offeringId?: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function AiModelRef({ modelId, showClass, offeringId, name, showId, showIcon, alwaysShowActions, openInNewTab, disableNavigation, className, labelClassName, }: AiModelRefProps): import("react").JSX.Element;
|
|
29
|
+
export interface AiToolRefProps extends AiIdentityRefCommonProps {
|
|
30
|
+
toolId: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function AiToolRef({ toolId, name, showId, showIcon, alwaysShowActions, openInNewTab, disableNavigation, className, labelClassName, }: AiToolRefProps): import("react").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { withModelClass, selectModelById, selectModelClassName, selectModelIdentityById, selectModelIdentityLookupStatus } from "@ai-matrx/agents/models";
|
|
5
|
+
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
6
|
+
import { getModelRecords, useModelRecords } from "../../identity/model-catalog.js";
|
|
7
|
+
import { loadToolById, selectToolById, selectToolLookupStatus, useToolCatalog } from "../../identity/tool-catalog.js";
|
|
8
|
+
import { EntityRef } from "../../../host/ui-slots.js";
|
|
9
|
+
import { selectIsSuperAdmin } from "../../../host/identity.js";
|
|
10
|
+
import { useAppSelector } from "../../../store/hooks.js";
|
|
11
|
+
const cn = (...parts) => parts.filter(Boolean).join(" ");
|
|
12
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
13
|
+
const isUuidValue = (value) => typeof value === "string" && UUID.test(value.trim());
|
|
14
|
+
function aiModelHref(modelId) {
|
|
15
|
+
return `/administration/ai/ai-models?model=${encodeURIComponent(modelId)}`;
|
|
16
|
+
}
|
|
17
|
+
function toolHref(toolId) {
|
|
18
|
+
return `/administration/agents/mcp-tools/${encodeURIComponent(toolId)}`;
|
|
19
|
+
}
|
|
20
|
+
function IdentityLabel({ id, name, showId }) {
|
|
21
|
+
return /* @__PURE__ */ jsxs(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: cn(
|
|
25
|
+
"inline-flex min-w-0",
|
|
26
|
+
showId ? "flex-col" : "items-baseline gap-1"
|
|
27
|
+
),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate font-medium", children: name }),
|
|
30
|
+
showId ? /* @__PURE__ */ jsx("span", { className: "select-all break-all font-mono type-meta font-normal text-muted-foreground", children: id }) : null
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function fallbackName(kind, id) {
|
|
36
|
+
return isUuidValue(id) ? `Unknown ${kind}` : humanizeIdentifier(id);
|
|
37
|
+
}
|
|
38
|
+
function AiModelRef({
|
|
39
|
+
modelId,
|
|
40
|
+
showClass = false,
|
|
41
|
+
offeringId,
|
|
42
|
+
name,
|
|
43
|
+
showId = false,
|
|
44
|
+
showIcon = true,
|
|
45
|
+
alwaysShowActions,
|
|
46
|
+
openInNewTab = true,
|
|
47
|
+
disableNavigation = false,
|
|
48
|
+
className,
|
|
49
|
+
labelClassName
|
|
50
|
+
}) {
|
|
51
|
+
const model = useModelRecords((state) => selectModelById(state, modelId));
|
|
52
|
+
const historicalIdentity = useModelRecords(
|
|
53
|
+
(state) => selectModelIdentityById(state, modelId)
|
|
54
|
+
);
|
|
55
|
+
const lookupStatus = useModelRecords(
|
|
56
|
+
(state) => selectModelIdentityLookupStatus(state, modelId)
|
|
57
|
+
);
|
|
58
|
+
const isSuperAdmin = useAppSelector(selectIsSuperAdmin);
|
|
59
|
+
const classStatus = useModelRecords((s) => s.modelClassStatus);
|
|
60
|
+
const modelClass = useModelRecords(
|
|
61
|
+
(s) => showClass ? selectModelClassName(s, modelId, offeringId) : void 0
|
|
62
|
+
);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (showClass && !classStatus) getModelRecords().loadClasses();
|
|
65
|
+
}, [showClass, classStatus]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!name && !model && !historicalIdentity && isUuidValue(modelId) && lookupStatus === "idle") {
|
|
68
|
+
getModelRecords().loadIdentity(modelId);
|
|
69
|
+
}
|
|
70
|
+
}, [historicalIdentity, lookupStatus, model, modelId, name]);
|
|
71
|
+
const baseName = name?.trim() || model?.common_name || model?.name || historicalIdentity?.common_name || historicalIdentity?.name || fallbackName("AI model", modelId);
|
|
72
|
+
const resolvedName = withModelClass(baseName, modelClass);
|
|
73
|
+
const mustShowId = showId || !name && !model && !historicalIdentity && isUuidValue(modelId);
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
EntityRef,
|
|
76
|
+
{
|
|
77
|
+
token: "ai_model",
|
|
78
|
+
id: modelId,
|
|
79
|
+
name: resolvedName,
|
|
80
|
+
href: isSuperAdmin && !disableNavigation ? aiModelHref(modelId) : void 0,
|
|
81
|
+
showIcon,
|
|
82
|
+
disablePeek: disableNavigation,
|
|
83
|
+
disableNewTab: disableNavigation,
|
|
84
|
+
openInNewTab,
|
|
85
|
+
alwaysShowActions,
|
|
86
|
+
wrap: mustShowId,
|
|
87
|
+
className,
|
|
88
|
+
labelClassName,
|
|
89
|
+
children: /* @__PURE__ */ jsx(IdentityLabel, { id: modelId, name: resolvedName, showId: mustShowId })
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function AiToolRef({
|
|
94
|
+
toolId,
|
|
95
|
+
name,
|
|
96
|
+
showId = false,
|
|
97
|
+
showIcon = true,
|
|
98
|
+
alwaysShowActions,
|
|
99
|
+
openInNewTab = true,
|
|
100
|
+
disableNavigation = false,
|
|
101
|
+
className,
|
|
102
|
+
labelClassName
|
|
103
|
+
}) {
|
|
104
|
+
const tool = useToolCatalog((state) => selectToolById(state, toolId));
|
|
105
|
+
const lookupStatus = useToolCatalog((state) => selectToolLookupStatus(state, toolId));
|
|
106
|
+
const isSuperAdmin = useAppSelector(selectIsSuperAdmin);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (!name && !tool && isUuidValue(toolId) && lookupStatus === "idle") {
|
|
109
|
+
void loadToolById(toolId);
|
|
110
|
+
}
|
|
111
|
+
}, [lookupStatus, name, tool, toolId]);
|
|
112
|
+
const resolvedName = name?.trim() || tool?.name || fallbackName("tool", toolId);
|
|
113
|
+
const mustShowId = showId || !name && !tool && isUuidValue(toolId);
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
EntityRef,
|
|
116
|
+
{
|
|
117
|
+
token: "tool",
|
|
118
|
+
id: toolId,
|
|
119
|
+
name: resolvedName,
|
|
120
|
+
href: isSuperAdmin && !disableNavigation ? toolHref(toolId) : void 0,
|
|
121
|
+
showIcon,
|
|
122
|
+
disablePeek: disableNavigation,
|
|
123
|
+
disableNewTab: disableNavigation,
|
|
124
|
+
openInNewTab,
|
|
125
|
+
alwaysShowActions,
|
|
126
|
+
wrap: mustShowId,
|
|
127
|
+
className,
|
|
128
|
+
labelClassName,
|
|
129
|
+
children: /* @__PURE__ */ jsx(IdentityLabel, { id: toolId, name: resolvedName, showId: mustShowId })
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
AiModelRef,
|
|
135
|
+
AiToolRef,
|
|
136
|
+
aiModelHref,
|
|
137
|
+
toolHref
|
|
138
|
+
};
|
|
@@ -42,15 +42,11 @@ import {
|
|
|
42
42
|
selectAgentTools,
|
|
43
43
|
selectAgentRunControlsReady
|
|
44
44
|
} from "../../../redux/agent-definition/selectors.js";
|
|
45
|
-
import {
|
|
46
|
-
selectAllTools,
|
|
47
|
-
selectToolsStatus
|
|
48
|
-
} from "../../../redux/tools/tools.selectors.js";
|
|
49
|
-
import { fetchAvailableTools } from "../../../redux/tools/tools.thunks.js";
|
|
50
45
|
import { fetchAgentRunControls } from "../../../redux/agent-definition/thunks.js";
|
|
51
|
-
import { AiToolRef } from "
|
|
46
|
+
import { AiToolRef } from "../../identity-refs/AiIdentityRef.js";
|
|
52
47
|
import { useTouchOnlyDevice } from "../../../../ui/composer/useTouchOnlyDevice.js";
|
|
53
48
|
import { selectSandboxBySurface } from "../../../../host/prefs.js";
|
|
49
|
+
import { loadAvailableTools, selectAllTools, selectToolsStatus, useToolCatalog } from "../../../identity/tool-catalog.js";
|
|
54
50
|
const EMPTY_LIST = [];
|
|
55
51
|
function Row({ label, children }) {
|
|
56
52
|
return /* @__PURE__ */ jsxs("div", { className: "grid min-h-8 grid-cols-[9rem_minmax(0,1fr)] items-center gap-2", children: [
|
|
@@ -140,8 +136,8 @@ function QuicksetPanel({
|
|
|
140
136
|
const mcpServers = useAppSelector(
|
|
141
137
|
(state) => agentId ? selectAgentMcpServers(state, agentId) : EMPTY_LIST
|
|
142
138
|
);
|
|
143
|
-
const toolCatalog =
|
|
144
|
-
const toolsStatus =
|
|
139
|
+
const toolCatalog = useToolCatalog(selectAllTools);
|
|
140
|
+
const toolsStatus = useToolCatalog(selectToolsStatus);
|
|
145
141
|
const agentReady = useAppSelector(
|
|
146
142
|
(state) => agentId ? selectAgentRunControlsReady(state, agentId) : true
|
|
147
143
|
);
|
|
@@ -156,7 +152,7 @@ function QuicksetPanel({
|
|
|
156
152
|
});
|
|
157
153
|
useEffect(() => {
|
|
158
154
|
if (toolsStatus !== "succeeded" && toolsStatus !== "loading") {
|
|
159
|
-
void
|
|
155
|
+
void loadAvailableTools();
|
|
160
156
|
}
|
|
161
157
|
}, [dispatch, toolsStatus]);
|
|
162
158
|
useEffect(() => {
|
|
@@ -17,7 +17,7 @@ import { fetchAgentRunControls } from "../../../redux/agent-definition/thunks.js
|
|
|
17
17
|
import { selectBuilderAdvancedSettings } from "../../../redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
18
18
|
import { setBuilderAdvancedSettings } from "../../../redux/execution-system/instance-ui-state/instance-ui-state.slice.js";
|
|
19
19
|
import { DEFAULT_BUILDER_ADVANCED_SETTINGS } from "../../../types/instance.types.js";
|
|
20
|
-
import { useSkills } from "
|
|
20
|
+
import { useSkills } from "../../../identity/skill-catalog.js";
|
|
21
21
|
import { ReadFailure } from "../../../../host/ui-slots.js";
|
|
22
22
|
import { filterAndSortBySearch } from "@ai-matrx/kit/search-scoring";
|
|
23
23
|
import {
|
|
@@ -14,13 +14,7 @@ import {
|
|
|
14
14
|
PicksSkeletons,
|
|
15
15
|
PicksSwitchRow
|
|
16
16
|
} from "./RunPicksSurface.js";
|
|
17
|
-
import {
|
|
18
|
-
selectAllTools,
|
|
19
|
-
selectToolsStatus,
|
|
20
|
-
selectToolsError
|
|
21
|
-
} from "../../../redux/tools/tools.selectors.js";
|
|
22
17
|
import { ReadFailure } from "../../../../host/ui-slots.js";
|
|
23
|
-
import { fetchAvailableTools } from "../../../redux/tools/tools.thunks.js";
|
|
24
18
|
import {
|
|
25
19
|
selectAgentError,
|
|
26
20
|
selectAgentTools,
|
|
@@ -44,11 +38,12 @@ import { DEFAULT_BUILDER_ADVANCED_SETTINGS } from "../../../types/instance.types
|
|
|
44
38
|
import { filterAndSortBySearch } from "@ai-matrx/kit/search-scoring";
|
|
45
39
|
import { getToolDisplayName } from "../../../../tool-call-visualization/registry/registry.js";
|
|
46
40
|
import { groupToolCatalog, toolCategoryLabel } from "./run-tool-catalog.js";
|
|
41
|
+
import { loadAvailableTools, selectAllTools, selectToolsError, selectToolsStatus, useToolCatalog } from "../../../identity/tool-catalog.js";
|
|
47
42
|
function RunToolPicker({ conversationId }) {
|
|
48
43
|
const dispatch = useAppDispatch();
|
|
49
|
-
const tools =
|
|
50
|
-
const status =
|
|
51
|
-
const toolsError =
|
|
44
|
+
const tools = useToolCatalog(selectAllTools);
|
|
45
|
+
const status = useToolCatalog(selectToolsStatus);
|
|
46
|
+
const toolsError = useToolCatalog(selectToolsError);
|
|
52
47
|
const agentId = useAppSelector(selectAgentIdFromInstance(conversationId));
|
|
53
48
|
const agentToolIds = useAppSelector(
|
|
54
49
|
(s) => agentId ? selectAgentTools(s, agentId) : void 0
|
|
@@ -92,7 +87,7 @@ function RunToolPicker({ conversationId }) {
|
|
|
92
87
|
const added = new Set(addedList);
|
|
93
88
|
useEffect(() => {
|
|
94
89
|
if (status === "idle") {
|
|
95
|
-
void
|
|
90
|
+
void loadAvailableTools();
|
|
96
91
|
}
|
|
97
92
|
}, [status, dispatch]);
|
|
98
93
|
useEffect(() => {
|
|
@@ -249,7 +244,7 @@ function RunToolPicker({ conversationId }) {
|
|
|
249
244
|
error: toolsError ?? true,
|
|
250
245
|
what: "the tool catalog",
|
|
251
246
|
className: "m-2",
|
|
252
|
-
onRetry: () => void
|
|
247
|
+
onRetry: () => void loadAvailableTools()
|
|
253
248
|
}
|
|
254
249
|
) : void 0,
|
|
255
250
|
addDisabledReason: modelSupportsTools ? void 0 : "Pick a model that supports tools to add any."
|
|
@@ -12,7 +12,7 @@ import { useAppDispatch, useAppSelector } from "../../../../store/hooks.js";
|
|
|
12
12
|
import { selectBuilderAdvancedSettings } from "../../../redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
13
13
|
import { setBuilderAdvancedSettings } from "../../../redux/execution-system/instance-ui-state/instance-ui-state.slice.js";
|
|
14
14
|
import { DEFAULT_BUILDER_ADVANCED_SETTINGS } from "../../../types/instance.types.js";
|
|
15
|
-
import { useSkills } from "
|
|
15
|
+
import { useSkills } from "../../../identity/skill-catalog.js";
|
|
16
16
|
import { SHAPE_CHIP_DEFS } from "./shape-chips.js";
|
|
17
17
|
import { selectedOutputKinds, toggleOutputKind } from "./composer/output-selection.js";
|
|
18
18
|
const CHIP_ICONS = {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resetOverride,
|
|
13
13
|
setOverrides
|
|
14
14
|
} from "../../../../redux/execution-system/instance-model-overrides/instance-model-overrides.slice.js";
|
|
15
|
-
import { useModelFull } from "
|
|
15
|
+
import { useModelFull } from "../../../../identity/model-catalog.js";
|
|
16
16
|
import { resolveModelControls } from "../../../../hooks/useModelControls.js";
|
|
17
17
|
import {
|
|
18
18
|
ComposerMenuDivider,
|
|
@@ -31,7 +31,7 @@ import { useAppDispatch, useAppSelector } from "../../../../../store/hooks.js";
|
|
|
31
31
|
import { selectBuilderAdvancedSettings } from "../../../../redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
32
32
|
import { setBuilderAdvancedSettings } from "../../../../redux/execution-system/instance-ui-state/instance-ui-state.slice.js";
|
|
33
33
|
import { DEFAULT_BUILDER_ADVANCED_SETTINGS } from "../../../../types/instance.types.js";
|
|
34
|
-
import { useSkills } from "
|
|
34
|
+
import { useSkills } from "../../../../identity/skill-catalog.js";
|
|
35
35
|
import { useClippedContentGuard } from "../../../../../host/ui-slots.js";
|
|
36
36
|
import { ComposerMenuDivider, ComposerMenuHelp, ComposerMenuLabel, ComposerMenuRow } from "./ComposerMenu.js";
|
|
37
37
|
import {
|
|
@@ -33,7 +33,7 @@ import { useAppDispatch, useAppSelector } from "../../../../../store/hooks.js";
|
|
|
33
33
|
import { ResourcePickerMenu } from "../../../../../host/ui-slots.js";
|
|
34
34
|
import { flattenResourcePickerItems } from "../../../../../host/ui-slots.js";
|
|
35
35
|
import { useKnowledgeAttachSearch } from "../../../../../host/ui-slots.js";
|
|
36
|
-
import { useRunControlCounts } from "
|
|
36
|
+
import { useRunControlCounts } from "./useRunControlCounts.js";
|
|
37
37
|
import {
|
|
38
38
|
useAttachResource,
|
|
39
39
|
useDetachResource
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
selectModelLabelById,
|
|
14
14
|
selectModelLabelWithClass
|
|
15
15
|
} from "@ai-matrx/agents/models";
|
|
16
|
-
import { useModelOptions } from "
|
|
16
|
+
import { useModelOptions } from "../../../../identity/model-catalog.js";
|
|
17
17
|
import { useModelClassLabels, useModelRecords } from "../../../../identity/model-catalog.js";
|
|
18
18
|
import { useEffectiveClassPin } from "../../../../redux/execution-system/instance-model-overrides/useEffectiveClassPin.js";
|
|
19
19
|
import { ensureAgentCatalog, useAgentName } from "../../../../identity/agent-identity.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { computeRunControlCounts } from "@ai-matrx/agents/runtime";
|
|
4
|
+
import { hasField } from "@ai-matrx/agents/field-flags";
|
|
5
|
+
import { useAppDispatch, useAppSelector } from "../../../../../store/hooks.js";
|
|
6
|
+
import { selectAgentIdFromInstance } from "../../../../redux/execution-system/conversations/conversations.selectors.js";
|
|
7
|
+
import {
|
|
8
|
+
selectAgentById,
|
|
9
|
+
selectAgentCustomTools,
|
|
10
|
+
selectAgentRunTier,
|
|
11
|
+
selectAgentSkillConfig,
|
|
12
|
+
selectAgentTools
|
|
13
|
+
} from "../../../../redux/agent-definition/selectors.js";
|
|
14
|
+
import { fetchAgentRunTier } from "../../../../redux/agent-definition/thunks.js";
|
|
15
|
+
import { selectBuilderAdvancedSettings } from "../../../../redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
16
|
+
import { DEFAULT_BUILDER_ADVANCED_SETTINGS } from "../../../../types/instance.types.js";
|
|
17
|
+
function useRunControlCounts(conversationId) {
|
|
18
|
+
const dispatch = useAppDispatch();
|
|
19
|
+
const agentId = useAppSelector((s) => conversationId ? selectAgentIdFromInstance(conversationId)(s) : void 0);
|
|
20
|
+
const runTierReady = useAppSelector((s) => agentId ? selectAgentRunTier(s, agentId).isReady : false);
|
|
21
|
+
const customToolsKnown = useAppSelector((s) => {
|
|
22
|
+
const record = agentId ? selectAgentById(s, agentId) : void 0;
|
|
23
|
+
return !!record && hasField(record._loadedFields, "customTools");
|
|
24
|
+
});
|
|
25
|
+
const skillConfigKnown = useAppSelector((s) => {
|
|
26
|
+
const record = agentId ? selectAgentById(s, agentId) : void 0;
|
|
27
|
+
return !!record && hasField(record._loadedFields, "skillConfig");
|
|
28
|
+
});
|
|
29
|
+
const runCounts = useAppSelector((s) => agentId ? selectAgentRunTier(s, agentId).counts : null);
|
|
30
|
+
const builtInToolIds = useAppSelector((s) => agentId ? selectAgentTools(s, agentId) : void 0);
|
|
31
|
+
const customTools = useAppSelector((s) => agentId ? selectAgentCustomTools(s, agentId) : void 0);
|
|
32
|
+
const skillConfig = useAppSelector((s) => agentId ? selectAgentSkillConfig(s, agentId) : void 0);
|
|
33
|
+
const settings = useAppSelector((s) => conversationId ? selectBuilderAdvancedSettings(conversationId)(s) : void 0);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (agentId && !runTierReady) void dispatch(fetchAgentRunTier(agentId));
|
|
36
|
+
}, [agentId, runTierReady, dispatch]);
|
|
37
|
+
if (!conversationId) return {};
|
|
38
|
+
const advanced = settings ?? DEFAULT_BUILDER_ADVANCED_SETTINGS;
|
|
39
|
+
return computeRunControlCounts({
|
|
40
|
+
hasAgent: Boolean(agentId),
|
|
41
|
+
runTierReady,
|
|
42
|
+
runCounts,
|
|
43
|
+
builtInToolIds: Array.isArray(builtInToolIds) ? builtInToolIds : [],
|
|
44
|
+
customTools: Array.isArray(customTools) ? customTools : [],
|
|
45
|
+
customToolsKnown,
|
|
46
|
+
skillConfig: skillConfig ?? null,
|
|
47
|
+
skillConfigKnown,
|
|
48
|
+
addedTools: advanced.addedTools ?? [],
|
|
49
|
+
addedSkills: advanced.addedSkills ?? []
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
useRunControlCounts
|
|
54
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { AiModelRef } from "
|
|
3
|
+
import { AiModelRef } from "../identity-refs/AiIdentityRef.js";
|
|
4
4
|
import { cn } from "@ai-matrx/design-system";
|
|
5
5
|
function isRecord(value) {
|
|
6
6
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import {
|
|
30
30
|
buildSettingsRows
|
|
31
31
|
} from "../../redux/agent-settings/settings-catalogue.js";
|
|
32
|
-
import { SettingControlInput } from "
|
|
32
|
+
import { SettingControlInput } from "@ai-matrx/agents/settings/react";
|
|
33
33
|
import { Label, ErrorBox } from "@ai-matrx/design-system";
|
|
34
34
|
import { cn } from "@ai-matrx/design-system";
|
|
35
35
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../ui/tabs.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
|
|
4
|
-
import { InputCapabilitiesEditor } from "
|
|
4
|
+
import { InputCapabilitiesEditor } from "@ai-matrx/agents/settings/react";
|
|
5
5
|
import { selectInputCapabilitiesState } from "../../redux/execution-system/instance-input-capabilities/instance-input-capabilities.selectors.js";
|
|
6
6
|
import {
|
|
7
7
|
resetInputCapabilityOverride,
|
|
@@ -30,7 +30,6 @@ export declare function makeSelectConversationRequests(conversationId: string):
|
|
|
30
30
|
agentShortcut: import("../../../redux/agent-shortcuts/types.js").AgentShortcutSliceState;
|
|
31
31
|
agentShortcutCategory: import("../../../redux/agent-shortcut-categories/types.js").AgentShortcutCategorySliceState;
|
|
32
32
|
surfaceUserState: import("../../../../surfaces/redux/userStateSlice.js").SurfaceUserStateSlice;
|
|
33
|
-
tools: import("../../../redux/tools/tools.slice.js").ToolsSliceState;
|
|
34
33
|
conversations: import("../../../redux/execution-system/conversations/conversations.slice.js").ConversationsState;
|
|
35
34
|
chatIncognito: import("../../../redux/chat/chat-incognito.slice.js").ChatIncognitoState;
|
|
36
35
|
chatRoute: import("../../../redux/chat/chat-route.slice.js").ChatRouteState;
|
|
@@ -62,7 +61,6 @@ export declare function makeSelectConversationRequests(conversationId: string):
|
|
|
62
61
|
agentAssistantMarkdownDraft: import("../../../redux/agent-assistant-markdown-draft.slice.js").AgentAssistantMarkdownDraftState;
|
|
63
62
|
mcp: import("../../../redux/mcp/mcp.slice.js").McpSliceState;
|
|
64
63
|
proposedDirectives: import("../../../redux/proposed-directives/proposedDirectivesSlice.js").ProposedDirectivesState;
|
|
65
|
-
agentSettings: import("../../../redux/agent-settings/types.js").AgentSettingsState;
|
|
66
64
|
conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
|
|
67
65
|
chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
|
|
68
66
|
hostConversations: import("../../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { useAppSelector } from "../../store/hooks.js";
|
|
4
|
-
import {
|
|
5
|
-
selectAllTools,
|
|
6
|
-
selectToolIdentityMap
|
|
7
|
-
} from "../redux/tools/tools.selectors.js";
|
|
8
4
|
import { selectMcpCatalog } from "../redux/mcp/mcp.slice.js";
|
|
9
5
|
import { useModelRecords } from "../identity/model-catalog.js";
|
|
6
|
+
import { selectAllTools, selectToolIdentityMap, useToolCatalog } from "../identity/tool-catalog.js";
|
|
10
7
|
function useDiffEnrichment() {
|
|
11
|
-
const allTools =
|
|
12
|
-
const toolIdentities =
|
|
8
|
+
const allTools = useToolCatalog(selectAllTools);
|
|
9
|
+
const toolIdentities = useToolCatalog(selectToolIdentityMap);
|
|
13
10
|
const mcpCatalog = useAppSelector(selectMcpCatalog);
|
|
14
11
|
const modelEntities = useModelRecords((s) => s.entities);
|
|
15
12
|
const modelIdentities = useModelRecords((s) => s.identityById);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useMemo, useSyncExternalStore } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { getChatHost } from "../../host/configure.js";
|
|
4
|
+
const getAgentCatalog = () => getChatHost().catalog();
|
|
4
5
|
import { ensureAgentCatalog } from "./agent-identity.js";
|
|
5
6
|
const EMPTY_ROWS = [];
|
|
6
7
|
const EMPTY_BY_ID = {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { getChatHost } from "../../host/configure.js";
|
|
3
|
+
const getAgentCatalog = () => getChatHost().catalog();
|
|
3
4
|
import { useAppSelector } from "../../store/hooks.js";
|
|
4
5
|
import { useEffect, useMemo, useSyncExternalStore } from "react";
|
|
5
6
|
import { hasField } from "@ai-matrx/agents/field-flags";
|
|
@@ -35,3 +35,12 @@ export type ModelClassControls = undefined | {
|
|
|
35
35
|
config: ModelClassConfig;
|
|
36
36
|
};
|
|
37
37
|
export declare function useModelClassControls(modelId: string | null | undefined, offeringId: string | null | undefined): ModelClassControls;
|
|
38
|
+
/** The active model options; loads them once (idempotent, shared with every picker). */
|
|
39
|
+
export declare function useModelOptions(): {
|
|
40
|
+
options: import("@ai-matrx/agents/models").ModelOption[];
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
error: string | null;
|
|
43
|
+
isReady: boolean;
|
|
44
|
+
};
|
|
45
|
+
/** One model's FULL record (controls included), or undefined until it has loaded. */
|
|
46
|
+
export declare function useModelFull(modelId: string | null | undefined): ModelRecord | undefined;
|
|
@@ -4,8 +4,11 @@ import {
|
|
|
4
4
|
classConfigKey,
|
|
5
5
|
createModelCatalog,
|
|
6
6
|
EMPTY_MODEL_RECORDS,
|
|
7
|
+
selectActiveModelsReady,
|
|
7
8
|
selectModelById,
|
|
9
|
+
selectModelFullyLoaded,
|
|
8
10
|
selectModelLabelById,
|
|
11
|
+
selectModelOptions,
|
|
9
12
|
selectModelLabelWithClass
|
|
10
13
|
} from "@ai-matrx/agents/models";
|
|
11
14
|
import { useModelRecordsSelector } from "@ai-matrx/agents/models/react";
|
|
@@ -92,14 +95,36 @@ function useModelClassControls(modelId, offeringId) {
|
|
|
92
95
|
if (status === "failed") return { failed: true };
|
|
93
96
|
return { pending: true };
|
|
94
97
|
}
|
|
98
|
+
function useModelOptions() {
|
|
99
|
+
const options = useModelRecords(selectModelOptions);
|
|
100
|
+
const isLoading = useModelRecords((s) => s.isLoading);
|
|
101
|
+
const error = useModelRecords((s) => s.error);
|
|
102
|
+
const isReady = useModelRecords(selectActiveModelsReady);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (chatHostHasDatabase()) void getModelRecords().loadOptions();
|
|
105
|
+
}, []);
|
|
106
|
+
return { options, isLoading, error, isReady };
|
|
107
|
+
}
|
|
108
|
+
function useModelFull(modelId) {
|
|
109
|
+
const record = useModelRecords((s) => selectModelById(s, modelId));
|
|
110
|
+
const isFull = useModelRecords((s) => selectModelFullyLoaded(s, modelId));
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!chatHostHasDatabase()) return;
|
|
113
|
+
void getModelRecords().loadOptions();
|
|
114
|
+
if (modelId && !isFull) void getModelRecords().loadModel(modelId);
|
|
115
|
+
}, [modelId, isFull]);
|
|
116
|
+
return isFull ? record : void 0;
|
|
117
|
+
}
|
|
95
118
|
export {
|
|
96
119
|
getModelCatalog,
|
|
97
120
|
getModelRecords,
|
|
98
121
|
readModelRecords,
|
|
99
122
|
useModelClassControls,
|
|
100
123
|
useModelClassLabels,
|
|
124
|
+
useModelFull,
|
|
101
125
|
useModelLabel,
|
|
102
126
|
useModelLabelWithClass,
|
|
127
|
+
useModelOptions,
|
|
103
128
|
useModelRecord,
|
|
104
129
|
useModelRecords
|
|
105
130
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The person's preferred chat model (agent core B6 — chat resolves it itself; the
|
|
3
|
+
* `resolvePreferredChatModel` host slot is retired). `agents.model_prefs.chat_default_model` and
|
|
4
|
+
* its class companion, through the settings ladder (organization → user → device) of the host's
|
|
5
|
+
* knobs port. Null when nobody set one — the Holder's own model answers. A read failure is
|
|
6
|
+
* announced and answers null: a run never blocks on a preference.
|
|
7
|
+
*/
|
|
8
|
+
import { type PreferredModelChoice } from "@ai-matrx/agents/models";
|
|
9
|
+
export declare function resolvePreferredChatModel(): Promise<PreferredModelChoice | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHAT_DEFAULT_MODEL_KNOB,
|
|
3
|
+
modelClassKnobFor,
|
|
4
|
+
modelClassPinOf,
|
|
5
|
+
resolvePreferredModelChoice
|
|
6
|
+
} from "@ai-matrx/agents/models";
|
|
7
|
+
import { supabase } from "../../host/db.js";
|
|
8
|
+
import { ensureEffectiveKnob } from "../../host/prefs.js";
|
|
9
|
+
import { getActiveOrgId } from "../../host/org.js";
|
|
10
|
+
import { getUserId } from "../../host/identity.js";
|
|
11
|
+
async function resolvePreferredChatModel() {
|
|
12
|
+
try {
|
|
13
|
+
return await resolvePreferredModelChoice(
|
|
14
|
+
{
|
|
15
|
+
client: () => supabase,
|
|
16
|
+
resolveKnob: (fullKey) => ensureEffectiveKnob(getActiveOrgId(), getUserId(), fullKey),
|
|
17
|
+
classKnobFor: modelClassKnobFor,
|
|
18
|
+
classPinOf: (value) => modelClassPinOf(value) ?? null
|
|
19
|
+
},
|
|
20
|
+
CHAT_DEFAULT_MODEL_KNOB,
|
|
21
|
+
"preferredChatModel"
|
|
22
|
+
);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
console.error(
|
|
25
|
+
`[preferredChatModel] ${CHAT_DEFAULT_MODEL_KNOB} could not be resolved \u2014 the Holder's own model answers this run:`,
|
|
26
|
+
error
|
|
27
|
+
);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
resolvePreferredChatModel
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type NormalizedControls, type SettingsStore } from "@ai-matrx/agents/settings";
|
|
2
|
+
export declare function getSettingsStore(): SettingsStore;
|
|
3
|
+
/** One agent's settings entry from the page's store. */
|
|
4
|
+
export declare function useAgentSettingsEntry(agentId: string | null | undefined): import("@ai-matrx/agents/settings").AgentSettingsEntry | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Parsed controls for a settings entry's effective model: the pinned CLASS's controls when a pin
|
|
7
|
+
* is set and loaded (a model's classes run through different APIs), else the model's own. Null
|
|
8
|
+
* until the record (full, with controls) is loaded or when the agent has no entry.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useNormalizedControls(agentId: string): NormalizedControls | null;
|