@ai-matrx/chat 0.3.26 → 0.3.28
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/hooks/useAgentLauncher.js +4 -3
- package/dist/agents/redux/agent-definition/run-tier-record.d.ts +27 -0
- package/dist/agents/redux/agent-definition/run-tier-record.js +95 -0
- package/dist/agents/redux/agent-definition/selectors.d.ts +235 -231
- package/dist/agents/redux/agent-definition/selectors.js +3 -2
- package/dist/agents/redux/agent-definition/thunks.d.ts +2 -2
- package/dist/agents/redux/agent-definition/thunks.js +8 -63
- package/dist/agents/redux/conversation-list/conversation-list.selectors.js +2 -1
- package/dist/agents/redux/conversation-list/conversation-list.thunks.js +2 -1
- package/dist/agents/redux/conversation-list/record-conversation-from-execution.js +2 -1
- package/dist/agents/redux/execution-system/context-rules/request-context.js +8 -3
- package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.js +6 -5
- package/dist/agents/redux/execution-system/thunks/create-instance.thunk.js +3 -2
- package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +3 -2
- package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +4 -4
- package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +2 -1
- package/dist/agents/redux/execution-system/thunks/refresh-surface-scope.thunk.js +3 -2
- package/dist/agents/runtime/generation-job.js +2 -1
- package/dist/agents/runtime/get-model-capabilities.js +2 -1
- package/dist/cx-chat/hooks/useInstanceBootstrap.js +3 -1
- package/dist/host/db-types.d.ts +47 -1
- package/dist/ui/mandates-storage/mandateStorage.d.ts +19 -0
- package/dist/ui/mandates-storage/shortcutStorage.d.ts +38 -0
- package/dist/ui/permission-levels.d.ts +8 -2
- package/dist/ui/permission-levels.js +12 -1
- package/package.json +6 -6
- package/dist/agents/components/shared/AgentDuplicateOutcomeDialog.d.ts +0 -57
- package/dist/agents/components/shared/AgentDuplicateOutcomeDialog.js +0 -188
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const PERMISSION_LEVELS = [
|
|
2
2
|
"viewer",
|
|
3
3
|
"commenter",
|
|
4
|
+
"edit_content",
|
|
4
5
|
"editor",
|
|
5
6
|
"admin"
|
|
6
7
|
];
|
|
@@ -10,16 +11,25 @@ const PERMISSION_LEVEL_RANK = Object.fromEntries(
|
|
|
10
11
|
const PERMISSION_LEVEL_LABELS = {
|
|
11
12
|
viewer: "Can view",
|
|
12
13
|
commenter: "Can comment",
|
|
14
|
+
edit_content: "Can edit content",
|
|
13
15
|
editor: "Can edit",
|
|
14
16
|
admin: "Full access"
|
|
15
17
|
};
|
|
18
|
+
const PERMISSION_LEVEL_HINTS = {
|
|
19
|
+
viewer: "Can open and read it.",
|
|
20
|
+
commenter: "Can read it and leave comments.",
|
|
21
|
+
edit_content: "Can change the content, not the structure or the sharing.",
|
|
22
|
+
editor: "Can change content and structure.",
|
|
23
|
+
admin: "Can change everything and decide who else may."
|
|
24
|
+
};
|
|
16
25
|
const PERMISSION_LEVEL_SHORT_LABELS = {
|
|
17
26
|
viewer: "Viewer",
|
|
18
27
|
commenter: "Commenter",
|
|
28
|
+
edit_content: "Content editor",
|
|
19
29
|
editor: "Editor",
|
|
20
30
|
admin: "Full access"
|
|
21
31
|
};
|
|
22
|
-
const DB_PERMISSION_LEVELS = ["viewer", "commenter", "editor", "admin"];
|
|
32
|
+
const DB_PERMISSION_LEVELS = ["viewer", "commenter", "edit_content", "editor", "admin"];
|
|
23
33
|
const _everyDbLevelIsListed = true;
|
|
24
34
|
void _everyDbLevelIsListed;
|
|
25
35
|
function isPermissionLevel(raw) {
|
|
@@ -55,6 +65,7 @@ function permissionLevelRank(level) {
|
|
|
55
65
|
export {
|
|
56
66
|
DB_PERMISSION_LEVELS,
|
|
57
67
|
PERMISSION_LEVELS,
|
|
68
|
+
PERMISSION_LEVEL_HINTS,
|
|
58
69
|
PERMISSION_LEVEL_LABELS,
|
|
59
70
|
PERMISSION_LEVEL_RANK,
|
|
60
71
|
PERMISSION_LEVEL_SHORT_LABELS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/chat",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.28",
|
|
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,23 +226,23 @@
|
|
|
226
226
|
"server-only": "^0.0.1",
|
|
227
227
|
"uuid": "^14.0.2",
|
|
228
228
|
"zod": "^4.6.5",
|
|
229
|
-
"@ai-matrx/agents": "latest",
|
|
230
|
-
"@ai-matrx/associations": "latest",
|
|
231
229
|
"@ai-matrx/alchemy": "latest",
|
|
230
|
+
"@ai-matrx/associations": "latest",
|
|
232
231
|
"@ai-matrx/browser-audio": "latest",
|
|
233
232
|
"@ai-matrx/canvas": "latest",
|
|
234
233
|
"@ai-matrx/content-ir": "latest",
|
|
234
|
+
"@ai-matrx/agents": "latest",
|
|
235
235
|
"@ai-matrx/content-ir-react": "latest",
|
|
236
236
|
"@ai-matrx/data": "latest",
|
|
237
|
-
"@ai-matrx/design-system": "latest",
|
|
238
237
|
"@ai-matrx/diff": "latest",
|
|
238
|
+
"@ai-matrx/design-system": "latest",
|
|
239
239
|
"@ai-matrx/icons": "latest",
|
|
240
240
|
"@ai-matrx/kit": "latest",
|
|
241
241
|
"@ai-matrx/media": "latest",
|
|
242
242
|
"@ai-matrx/print": "latest",
|
|
243
|
-
"@ai-matrx/records": "latest",
|
|
244
|
-
"@ai-matrx/records-ui": "latest",
|
|
245
243
|
"@ai-matrx/realtime": "latest",
|
|
244
|
+
"@ai-matrx/records-ui": "latest",
|
|
245
|
+
"@ai-matrx/records": "latest",
|
|
246
246
|
"@ai-matrx/tap-target": "latest"
|
|
247
247
|
},
|
|
248
248
|
"devDependencies": {
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/** "choose" = the person picks which version to copy before anything runs. */
|
|
2
|
-
export type DuplicateOutcomeState = "choose" | "loading" | "success" | "error";
|
|
3
|
-
/** The value of the "copy the agent as it is now" choice. */
|
|
4
|
-
export declare const CURRENT_VERSION_CHOICE = "current";
|
|
5
|
-
export interface DuplicateVersionOption {
|
|
6
|
-
versionId: string;
|
|
7
|
-
versionNumber: number;
|
|
8
|
-
changedAt: string;
|
|
9
|
-
changeNote: string | null;
|
|
10
|
-
}
|
|
11
|
-
export interface DuplicateVersionChooser {
|
|
12
|
-
/** The source agent's live version number, shown on the default choice. */
|
|
13
|
-
currentVersion: number | null;
|
|
14
|
-
/** Saved past versions, newest first. */
|
|
15
|
-
versions: DuplicateVersionOption[];
|
|
16
|
-
versionsLoading: boolean;
|
|
17
|
-
/** Set when the version list could not be read — the current version still works. */
|
|
18
|
-
versionsError: string | null;
|
|
19
|
-
/** CURRENT_VERSION_CHOICE or a version id. */
|
|
20
|
-
selected: string;
|
|
21
|
-
onSelectedChange: (value: string) => void;
|
|
22
|
-
onConfirm: () => void;
|
|
23
|
-
}
|
|
24
|
-
export interface AgentDuplicateOutcomeDialogProps {
|
|
25
|
-
open: boolean;
|
|
26
|
-
/** Called when the user dismisses the dialog (X button, escape, or "Stay
|
|
27
|
-
* here"). The dialog is fully controlled — the parent owns lifecycle. */
|
|
28
|
-
onOpenChange: (open: boolean) => void;
|
|
29
|
-
state: DuplicateOutcomeState;
|
|
30
|
-
/** Display name of the new agent (only meaningful in success state). */
|
|
31
|
-
newAgentName?: string;
|
|
32
|
-
/** Path to the new agent — used by both "Open new agent" and "Open in new
|
|
33
|
-
* tab." Defaults to `null` while loading; required in success state. */
|
|
34
|
-
newAgentPath?: string | null;
|
|
35
|
-
/** Optional error message in error state. */
|
|
36
|
-
errorMessage?: string;
|
|
37
|
-
/** Whether the source agent was a builtin/system agent. Tweaks the success
|
|
38
|
-
* copy so admins know the duplicate is also a system agent. */
|
|
39
|
-
asSystem?: boolean;
|
|
40
|
-
/** Required for the "choose" state. */
|
|
41
|
-
chooser?: DuplicateVersionChooser;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Post-duplicate "where would you like to go?" choice surface.
|
|
45
|
-
*
|
|
46
|
-
* Flow:
|
|
47
|
-
* 1. Parent fires the duplicate thunk and immediately mounts this dialog
|
|
48
|
-
* with `state="loading"` so the user sees the in-flight work.
|
|
49
|
-
* 2. On success, the parent flips to `state="success"` and supplies the
|
|
50
|
-
* new agent's id + computed `newAgentPath`. The user picks one of three
|
|
51
|
-
* destinations (open in current tab, open in new tab, stay here).
|
|
52
|
-
* 3. On failure, the parent flips to `state="error"` with a message.
|
|
53
|
-
*
|
|
54
|
-
* Mobile renders as a bottom Drawer (per project mobile rules — never Dialog
|
|
55
|
-
* on mobile); desktop uses a small Dialog (`sm:max-w-md`).
|
|
56
|
-
*/
|
|
57
|
-
export declare function AgentDuplicateOutcomeDialog({ open, onOpenChange, state, newAgentName, newAgentPath, errorMessage, asSystem, chooser, }: AgentDuplicateOutcomeDialogProps): import("react").JSX.Element;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTransition } from "react";
|
|
4
|
-
import { useRouter } from "../../../host/navigation.js";
|
|
5
|
-
import {
|
|
6
|
-
AlertCircle,
|
|
7
|
-
ArrowRight,
|
|
8
|
-
CheckCircle2,
|
|
9
|
-
Copy,
|
|
10
|
-
ExternalLink,
|
|
11
|
-
Loader2
|
|
12
|
-
} from "lucide-react";
|
|
13
|
-
import {
|
|
14
|
-
Dialog,
|
|
15
|
-
DialogContent,
|
|
16
|
-
DialogDescription,
|
|
17
|
-
DialogHeader,
|
|
18
|
-
DialogTitle
|
|
19
|
-
} from "@ai-matrx/design-system";
|
|
20
|
-
import {
|
|
21
|
-
Drawer,
|
|
22
|
-
DrawerContent,
|
|
23
|
-
DrawerDescription,
|
|
24
|
-
DrawerHeader,
|
|
25
|
-
DrawerTitle
|
|
26
|
-
} from "@ai-matrx/design-system";
|
|
27
|
-
import { Alert, AlertDescription } from "@ai-matrx/design-system";
|
|
28
|
-
import { Button } from "@ai-matrx/design-system";
|
|
29
|
-
import { Select } from "@ai-matrx/design-system/controls";
|
|
30
|
-
import { useIsMobile } from "@ai-matrx/kit/media-query";
|
|
31
|
-
const CURRENT_VERSION_CHOICE = "current";
|
|
32
|
-
function AgentDuplicateOutcomeDialog({
|
|
33
|
-
open,
|
|
34
|
-
onOpenChange,
|
|
35
|
-
state,
|
|
36
|
-
newAgentName,
|
|
37
|
-
newAgentPath,
|
|
38
|
-
errorMessage,
|
|
39
|
-
asSystem = false,
|
|
40
|
-
chooser
|
|
41
|
-
}) {
|
|
42
|
-
const isMobile = useIsMobile();
|
|
43
|
-
const router = useRouter();
|
|
44
|
-
const [isNavigating, startTransition] = useTransition();
|
|
45
|
-
const handleGoToAgent = () => {
|
|
46
|
-
if (!newAgentPath) return;
|
|
47
|
-
onOpenChange(false);
|
|
48
|
-
startTransition(() => router.push(newAgentPath));
|
|
49
|
-
};
|
|
50
|
-
const handleOpenInNewTab = () => {
|
|
51
|
-
if (!newAgentPath) return;
|
|
52
|
-
window.open(newAgentPath, "_blank", "noopener,noreferrer");
|
|
53
|
-
onOpenChange(false);
|
|
54
|
-
};
|
|
55
|
-
const handleStayHere = () => {
|
|
56
|
-
onOpenChange(false);
|
|
57
|
-
};
|
|
58
|
-
const titleText = state === "choose" ? "Duplicate agent" : state === "loading" ? "Duplicating agent\u2026" : state === "success" ? asSystem ? "System agent duplicated" : "Agent duplicated" : "Duplicate failed";
|
|
59
|
-
const descriptionText = state === "choose" ? "Pick the version to copy into a new agent." : state === "loading" ? "Creating a copy with all messages, variables, settings, and tools." : state === "success" ? newAgentName ? `"${newAgentName}" is ready. Where would you like to go?` : "The copy is ready. Where would you like to go?" : errorMessage ?? "Something went wrong while duplicating.";
|
|
60
|
-
const body = /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
61
|
-
state === "choose" && chooser && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
Select,
|
|
64
|
-
{
|
|
65
|
-
"aria-label": "Version to copy",
|
|
66
|
-
className: "w-full",
|
|
67
|
-
value: chooser.selected,
|
|
68
|
-
onValueChange: chooser.onSelectedChange,
|
|
69
|
-
options: [
|
|
70
|
-
{
|
|
71
|
-
value: CURRENT_VERSION_CHOICE,
|
|
72
|
-
label: chooser.currentVersion != null ? `Current version (v${chooser.currentVersion})` : "Current version"
|
|
73
|
-
},
|
|
74
|
-
...chooser.versions.filter((v) => v.versionNumber !== chooser.currentVersion).map((v) => ({ value: v.versionId, label: versionOptionLabel(v) }))
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
chooser.versionsLoading && /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
79
|
-
/* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }),
|
|
80
|
-
"Loading versions\u2026"
|
|
81
|
-
] }),
|
|
82
|
-
chooser.versionsError && /* @__PURE__ */ jsxs("p", { className: "text-xs text-destructive", children: [
|
|
83
|
-
"Past versions could not be loaded: ",
|
|
84
|
-
chooser.versionsError
|
|
85
|
-
] }),
|
|
86
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
87
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleStayHere, children: "Cancel" }),
|
|
88
|
-
/* @__PURE__ */ jsxs(Button, { onClick: chooser.onConfirm, children: [
|
|
89
|
-
/* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" }),
|
|
90
|
-
"Duplicate"
|
|
91
|
-
] })
|
|
92
|
-
] })
|
|
93
|
-
] }),
|
|
94
|
-
state === "loading" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 py-6", children: [
|
|
95
|
-
/* @__PURE__ */ jsx(Loader2, { className: "h-10 w-10 animate-spin text-primary" }),
|
|
96
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Please wait\u2026" })
|
|
97
|
-
] }),
|
|
98
|
-
state === "success" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-3 rounded-md bg-success/10 border border-success/20", children: [
|
|
100
|
-
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-success shrink-0" }),
|
|
101
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Copy created successfully." })
|
|
102
|
-
] }),
|
|
103
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
104
|
-
/* @__PURE__ */ jsxs(
|
|
105
|
-
Button,
|
|
106
|
-
{
|
|
107
|
-
size: "lg",
|
|
108
|
-
onClick: handleGoToAgent,
|
|
109
|
-
disabled: !newAgentPath || isNavigating,
|
|
110
|
-
className: "w-full justify-start gap-2",
|
|
111
|
-
children: [
|
|
112
|
-
isNavigating ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4" }),
|
|
113
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: "Open new agent" })
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
newAgentPath ? /* @__PURE__ */ jsxs(
|
|
118
|
-
Button,
|
|
119
|
-
{
|
|
120
|
-
size: "lg",
|
|
121
|
-
variant: "outline",
|
|
122
|
-
onClick: handleOpenInNewTab,
|
|
123
|
-
className: "w-full justify-start gap-2",
|
|
124
|
-
children: [
|
|
125
|
-
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4" }),
|
|
126
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: "Open in new tab" })
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
) : null,
|
|
130
|
-
/* @__PURE__ */ jsxs(
|
|
131
|
-
Button,
|
|
132
|
-
{
|
|
133
|
-
size: "lg",
|
|
134
|
-
variant: "ghost",
|
|
135
|
-
onClick: handleStayHere,
|
|
136
|
-
className: "w-full justify-start gap-2",
|
|
137
|
-
children: [
|
|
138
|
-
/* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" }),
|
|
139
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: "Stay here" })
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
)
|
|
143
|
-
] })
|
|
144
|
-
] }),
|
|
145
|
-
state === "error" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
146
|
-
/* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
147
|
-
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
148
|
-
/* @__PURE__ */ jsx(AlertDescription, { children: errorMessage ?? "Failed to duplicate agent." })
|
|
149
|
-
] }),
|
|
150
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleStayHere, className: "w-full", children: "Close" })
|
|
151
|
-
] })
|
|
152
|
-
] });
|
|
153
|
-
if (isMobile) {
|
|
154
|
-
return /* @__PURE__ */ jsx(Drawer, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DrawerContent, { className: "max-h-[85dvh] pb-safe", children: [
|
|
155
|
-
/* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
156
|
-
/* @__PURE__ */ jsxs(DrawerTitle, { className: "flex items-center gap-2", children: [
|
|
157
|
-
/* @__PURE__ */ jsx(Copy, { className: "h-5 w-5" }),
|
|
158
|
-
titleText
|
|
159
|
-
] }),
|
|
160
|
-
/* @__PURE__ */ jsx(DrawerDescription, { children: descriptionText })
|
|
161
|
-
] }),
|
|
162
|
-
/* @__PURE__ */ jsx("div", { className: "px-4 pb-4", children: body })
|
|
163
|
-
] }) });
|
|
164
|
-
}
|
|
165
|
-
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
|
|
166
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
167
|
-
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
|
|
168
|
-
/* @__PURE__ */ jsx(Copy, { className: "h-5 w-5" }),
|
|
169
|
-
titleText
|
|
170
|
-
] }),
|
|
171
|
-
/* @__PURE__ */ jsx(DialogDescription, { children: descriptionText })
|
|
172
|
-
] }),
|
|
173
|
-
body
|
|
174
|
-
] }) });
|
|
175
|
-
}
|
|
176
|
-
function versionOptionLabel(v) {
|
|
177
|
-
const date = new Date(v.changedAt).toLocaleDateString(void 0, {
|
|
178
|
-
month: "short",
|
|
179
|
-
day: "numeric",
|
|
180
|
-
year: "numeric"
|
|
181
|
-
});
|
|
182
|
-
const note = v.changeNote?.trim();
|
|
183
|
-
return note ? `v${v.versionNumber} \xB7 ${date} \xB7 ${note.length > 40 ? `${note.slice(0, 40)}\u2026` : note}` : `v${v.versionNumber} \xB7 ${date}`;
|
|
184
|
-
}
|
|
185
|
-
export {
|
|
186
|
-
AgentDuplicateOutcomeDialog,
|
|
187
|
-
CURRENT_VERSION_CHOICE
|
|
188
|
-
};
|