@ultrst-armada/floks 2.0.8 → 2.0.9
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/.krusbl-release-attestation.json +3 -3
- package/package.json +2 -2
- package/packages/canvas-ui/dist/chunk-DAAI7BIG.js +625 -0
- package/packages/canvas-ui/dist/fod/FodAuthorizedRemoteNodes.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/FodModule.authorization.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/FodModule.d.ts +27 -1
- package/packages/canvas-ui/dist/fod/FodPassiveNavigationAdversarial.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/FodRemoteExecution.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/index.d.ts +3 -0
- package/packages/canvas-ui/dist/fod/index.js +25 -3
- package/packages/canvas-ui/dist/fod/remoteAuthorizationFingerprint.d.ts +10 -0
- package/packages/canvas-ui/dist/fod/remoteAuthorizationFingerprint.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/remoteGraphConnections.d.ts +40 -0
- package/packages/canvas-ui/dist/fod/remoteGraphConnections.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/remoteGraphContract.d.ts +37 -0
- package/packages/canvas-ui/dist/fod/remoteGraphContract.test.d.ts +1 -0
- package/packages/canvas-ui/dist/fod/remoteKloksInvocation.d.ts +29 -0
- package/packages/canvas-ui/dist/fod/remoteKloksInvocation.test.d.ts +1 -0
- package/packages/canvas-ui/dist/index.js +30 -8
- package/packages/ui/dist/chunk-5Y2HGI37.js +443 -0
- package/packages/ui/dist/{chunk-XMRSW4TL.js → chunk-6J5J56YO.js} +31 -79
- package/packages/ui/dist/{chunk-KIFQA7L6.js → chunk-CIH4FVXM.js} +22 -34
- package/packages/ui/dist/chunk-F5XUUMSI.js +14 -0
- package/packages/ui/dist/{chunk-MYXPGPI3.js → chunk-KMVDLACR.js} +25 -2
- package/packages/ui/dist/{chunk-FA6GHJKU.js → chunk-SJPSY27C.js} +163 -5
- package/packages/ui/dist/components/ai/chat/AgentChatDock.d.ts +12 -0
- package/packages/ui/dist/components/ai/chat/AgentChatPanel.d.ts +11 -0
- package/packages/ui/dist/components/ai/chat/AgentChatPanel.test.d.ts +1 -0
- package/packages/ui/dist/components/ai/chat/AgentChatTypes.d.ts +39 -0
- package/packages/ui/dist/components/ai/chat/index.d.ts +3 -0
- package/packages/ui/dist/components/ai/index.js +17 -4
- package/packages/ui/dist/components/auth/LuthOidcGate.d.ts +29 -0
- package/packages/ui/dist/components/auth/index.d.ts +1 -0
- package/packages/ui/dist/components/auth/index.js +5 -1
- package/packages/ui/dist/components/base/index.js +4 -2
- package/packages/ui/dist/components/layout/AppShell.d.ts +2 -0
- package/packages/ui/dist/components/layout/index.js +3 -1
- package/packages/ui/dist/index.js +24 -6
- package/packages/ui/package.json +1 -1
- package/packages/canvas-ui/dist/chunk-24JGPSGO.js +0 -162
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseTextarea
|
|
3
|
+
} from "./chunk-F5XUUMSI.js";
|
|
4
|
+
import {
|
|
5
|
+
BaseButton
|
|
6
|
+
} from "./chunk-A2CDQISJ.js";
|
|
7
|
+
|
|
8
|
+
// src/components/ai/chat/DirectChatMessageList.tsx
|
|
9
|
+
import { User, Bot } from "lucide-react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var DirectChatMessageList = ({
|
|
12
|
+
messages,
|
|
13
|
+
isStreaming = false,
|
|
14
|
+
className = ""
|
|
15
|
+
}) => {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-4 p-4 overflow-y-auto font-mono text-xs ${className}`, children: [
|
|
17
|
+
messages.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col items-center justify-center text-center text-slate-400 p-8 space-y-2", children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Bot, { size: 28, className: "opacity-40" }),
|
|
19
|
+
/* @__PURE__ */ jsx("p", { children: "No messages yet. Send a prompt to start conversation." })
|
|
20
|
+
] }) : messages.map((m) => {
|
|
21
|
+
const isUser = m.role === "user";
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: `flex gap-3 ${isUser ? "justify-end" : "justify-start"}`,
|
|
26
|
+
children: [
|
|
27
|
+
!isUser && /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-indigo-50 dark:bg-indigo-950 text-indigo-600 dark:text-indigo-400 flex items-center justify-center shrink-0 mt-0.5", children: /* @__PURE__ */ jsx(Bot, { size: 13 }) }),
|
|
28
|
+
/* @__PURE__ */ jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: `max-w-[80%] rounded-xl p-3 border leading-relaxed ${isUser ? "bg-indigo-600 text-white border-indigo-700" : "bg-white dark:bg-slate-900 text-slate-800 dark:text-slate-200 border-slate-300 dark:border-slate-800 shadow-sm"}`,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap", children: m.content }),
|
|
34
|
+
m.timestamp && /* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: `text-[9px] mt-1 text-right ${isUser ? "text-indigo-200" : "text-slate-400"}`,
|
|
38
|
+
children: m.timestamp
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
isUser && /* @__PURE__ */ jsx("div", { className: "w-6 h-6 rounded-full bg-slate-200 dark:bg-slate-800 text-slate-700 dark:text-slate-300 flex items-center justify-center shrink-0 mt-0.5", children: /* @__PURE__ */ jsx(User, { size: 13 }) })
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
m.id
|
|
48
|
+
);
|
|
49
|
+
}),
|
|
50
|
+
isStreaming && /* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-start items-center text-slate-400 text-[11px]", children: [
|
|
51
|
+
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-ping" }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { children: "Generating response..." })
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/components/ai/chat/AgentChatTypes.ts
|
|
58
|
+
function agentChatLabel(target) {
|
|
59
|
+
return target.alias?.trim() || target.name.trim() || target.id;
|
|
60
|
+
}
|
|
61
|
+
function matchAgentMentions(targets, query) {
|
|
62
|
+
const normalized = query.trim().toLocaleLowerCase();
|
|
63
|
+
return targets.filter(
|
|
64
|
+
(target) => agentChatLabel(target).toLocaleLowerCase().includes(normalized) || target.name.toLocaleLowerCase().includes(normalized)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function selectedAgentIsValid(target, targets) {
|
|
68
|
+
return !!target && targets.some((candidate) => candidate.id === target.id && candidate.kind === target.kind);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/components/ai/chat/AgentChatPanel.tsx
|
|
72
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
73
|
+
import { X, Send } from "lucide-react";
|
|
74
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
75
|
+
function AgentChatPanel({ targets, appAgentId, onInvoke, onCancel, onClose }) {
|
|
76
|
+
const [draft, setDraft] = useState("");
|
|
77
|
+
const [selected, setSelected] = useState(null);
|
|
78
|
+
const [messages, setMessages] = useState([]);
|
|
79
|
+
const [error, setError] = useState("");
|
|
80
|
+
const [busy, setBusy] = useState(false);
|
|
81
|
+
const [continuation, setContinuation] = useState(null);
|
|
82
|
+
const [fieldValues, setFieldValues] = useState({});
|
|
83
|
+
const textarea = useRef(null);
|
|
84
|
+
const nextId = useRef(0);
|
|
85
|
+
const inFlight = useRef(false);
|
|
86
|
+
const requestRevision = useRef(0);
|
|
87
|
+
const controller = useRef(null);
|
|
88
|
+
const currentRequest = useRef(null);
|
|
89
|
+
const targetsRef = useRef(targets);
|
|
90
|
+
const onCancelRef = useRef(onCancel);
|
|
91
|
+
targetsRef.current = targets;
|
|
92
|
+
onCancelRef.current = onCancel;
|
|
93
|
+
useEffect(() => () => {
|
|
94
|
+
const active = currentRequest.current;
|
|
95
|
+
requestRevision.current++;
|
|
96
|
+
controller.current?.abort();
|
|
97
|
+
if (active && onCancelRef.current) {
|
|
98
|
+
void Promise.resolve().then(() => onCancelRef.current?.(active)).catch(() => {
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}, []);
|
|
102
|
+
const sequence = () => `agent-chat-${++nextId.current}`;
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
textarea.current?.focus();
|
|
105
|
+
}, []);
|
|
106
|
+
const mentionAt = draft.lastIndexOf("@");
|
|
107
|
+
const hasMention = mentionAt >= 0 && (mentionAt === 0 || /\s/.test(draft[mentionAt - 1]));
|
|
108
|
+
const mentionQuery = hasMention ? draft.slice(mentionAt + 1) : "";
|
|
109
|
+
const mentionChoices = useMemo(() => {
|
|
110
|
+
if (!hasMention || selected || mentionQuery.includes("@")) return [];
|
|
111
|
+
return matchAgentMentions(targets, mentionQuery).slice(0, 8);
|
|
112
|
+
}, [hasMention, mentionQuery, selected, targets]);
|
|
113
|
+
const appAgent = targets.find((t) => t.kind === "app" && t.id === appAgentId);
|
|
114
|
+
const continuationTarget = continuation && targets.find((t) => t.id === continuation.targetId && t.kind === continuation.targetKind);
|
|
115
|
+
const activeTarget = selected ? selectedAgentIsValid(selected, targets) ? selected : void 0 : continuation ? continuationTarget : appAgent;
|
|
116
|
+
const unavailable = !!selected && !selectedAgentIsValid(selected, targets) || !!continuation && !continuationTarget;
|
|
117
|
+
const hasTypedFields = !!continuation?.fields?.length;
|
|
118
|
+
const canSend = !!onInvoke && !!activeTarget && !unavailable && !busy && (!!draft.trim() || hasTypedFields);
|
|
119
|
+
const addMessage = (role, content) => setMessages((items) => [...items, { id: sequence(), role, content }]);
|
|
120
|
+
const choose = (agent) => {
|
|
121
|
+
const prefix = draft.slice(0, mentionAt);
|
|
122
|
+
setDraft(`${prefix}@${agentChatLabel(agent)} `);
|
|
123
|
+
setSelected(agent);
|
|
124
|
+
setContinuation(null);
|
|
125
|
+
setFieldValues({});
|
|
126
|
+
setError("");
|
|
127
|
+
textarea.current?.focus();
|
|
128
|
+
};
|
|
129
|
+
const cancel = () => {
|
|
130
|
+
const active = currentRequest.current ?? (continuation ? {
|
|
131
|
+
targetId: continuation.targetId,
|
|
132
|
+
targetKind: continuation.targetKind,
|
|
133
|
+
invocationId: continuation.invocationId
|
|
134
|
+
} : null);
|
|
135
|
+
requestRevision.current++;
|
|
136
|
+
controller.current?.abort();
|
|
137
|
+
controller.current = null;
|
|
138
|
+
currentRequest.current = null;
|
|
139
|
+
inFlight.current = false;
|
|
140
|
+
setBusy(false);
|
|
141
|
+
setContinuation(null);
|
|
142
|
+
setFieldValues({});
|
|
143
|
+
if (active && onCancel) {
|
|
144
|
+
void Promise.resolve().then(() => onCancel(active)).catch(() => {
|
|
145
|
+
setError("Unable to confirm remote cancellation.");
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const send = async () => {
|
|
150
|
+
if (!canSend || !activeTarget || !onInvoke || inFlight.current) return;
|
|
151
|
+
const token = selected && `@${agentChatLabel(selected)}`;
|
|
152
|
+
const prompt = token ? draft.replace(token, " ").replace(/ {2,}/g, " ").trim() : draft.trim();
|
|
153
|
+
const count = (draft.match(/(^|\s)@/g) ?? []).length;
|
|
154
|
+
if (count > 1) {
|
|
155
|
+
setError("Choose one agent per message.");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (count > 0 && !selected) {
|
|
159
|
+
setError("Select an agent from the list.");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (unavailable || !targetsRef.current.some((t) => t.id === activeTarget.id && t.kind === activeTarget.kind)) {
|
|
163
|
+
setError("This agent is no longer available. Refresh the authorized agent list.");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const fields = continuation?.fields ?? [];
|
|
167
|
+
const parameters = {};
|
|
168
|
+
for (const field of fields) {
|
|
169
|
+
const raw = fieldValues[field.key];
|
|
170
|
+
if (field.type === "boolean") {
|
|
171
|
+
parameters[field.key] = raw === true;
|
|
172
|
+
} else if (field.type === "number") {
|
|
173
|
+
if (raw === void 0 || raw === "") {
|
|
174
|
+
if (field.required) {
|
|
175
|
+
setError(`Enter ${field.label}.`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const parsed = Number(raw);
|
|
181
|
+
if (!Number.isFinite(parsed)) {
|
|
182
|
+
setError(`${field.label} must be a number.`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
parameters[field.key] = parsed;
|
|
186
|
+
} else {
|
|
187
|
+
const value = typeof raw === "string" ? raw.trim() : "";
|
|
188
|
+
if (!value) {
|
|
189
|
+
if (field.required) {
|
|
190
|
+
setError(`Enter ${field.label}.`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
parameters[field.key] = value;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (!prompt && !fields.length) {
|
|
199
|
+
setError("Enter a message for the agent.");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const resume = continuation?.targetId === activeTarget.id && continuation.targetKind === activeTarget.kind ? continuation.invocationId : void 0;
|
|
203
|
+
const request = {
|
|
204
|
+
targetId: activeTarget.id,
|
|
205
|
+
targetKind: activeTarget.kind,
|
|
206
|
+
prompt,
|
|
207
|
+
...resume ? { resumeInvocationId: resume } : {},
|
|
208
|
+
...fields.length ? { parameters } : {}
|
|
209
|
+
};
|
|
210
|
+
addMessage("user", prompt || "Submitted clarification fields");
|
|
211
|
+
setDraft("");
|
|
212
|
+
setSelected(null);
|
|
213
|
+
setError("");
|
|
214
|
+
inFlight.current = true;
|
|
215
|
+
setBusy(true);
|
|
216
|
+
const revision = ++requestRevision.current;
|
|
217
|
+
const abort = new AbortController();
|
|
218
|
+
controller.current = abort;
|
|
219
|
+
currentRequest.current = {
|
|
220
|
+
targetId: activeTarget.id,
|
|
221
|
+
targetKind: activeTarget.kind,
|
|
222
|
+
...resume ? { invocationId: resume } : {}
|
|
223
|
+
};
|
|
224
|
+
try {
|
|
225
|
+
const reply = await onInvoke(request, { signal: abort.signal });
|
|
226
|
+
if (revision !== requestRevision.current || abort.signal.aborted) return;
|
|
227
|
+
if (!targetsRef.current.some((t) => t.id === activeTarget.id && t.kind === activeTarget.kind)) {
|
|
228
|
+
setContinuation(null);
|
|
229
|
+
setFieldValues({});
|
|
230
|
+
setError("The agent is no longer authorized or available.");
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (reply.kind === "needs_input" && reply.invocationId) {
|
|
234
|
+
const seen = /* @__PURE__ */ new Set();
|
|
235
|
+
const fields2 = (reply.fields ?? []).filter((field) => {
|
|
236
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/.test(field.key) || seen.has(field.key) || !["text", "number", "boolean"].includes(field.type) || !field.label.trim()) return false;
|
|
237
|
+
seen.add(field.key);
|
|
238
|
+
return true;
|
|
239
|
+
}).slice(0, 16);
|
|
240
|
+
setContinuation({
|
|
241
|
+
targetId: activeTarget.id,
|
|
242
|
+
targetKind: activeTarget.kind,
|
|
243
|
+
invocationId: reply.invocationId,
|
|
244
|
+
fields: fields2
|
|
245
|
+
});
|
|
246
|
+
setFieldValues({});
|
|
247
|
+
} else {
|
|
248
|
+
setContinuation(null);
|
|
249
|
+
setFieldValues({});
|
|
250
|
+
}
|
|
251
|
+
if (reply.kind === "failed") setError("Agent request failed or was denied.");
|
|
252
|
+
else addMessage("assistant", reply.text);
|
|
253
|
+
} catch {
|
|
254
|
+
if (revision !== requestRevision.current || abort.signal.aborted) return;
|
|
255
|
+
setContinuation(null);
|
|
256
|
+
setFieldValues({});
|
|
257
|
+
setError("Agent request failed. Check the connection or permissions.");
|
|
258
|
+
} finally {
|
|
259
|
+
if (revision === requestRevision.current) {
|
|
260
|
+
inFlight.current = false;
|
|
261
|
+
controller.current = null;
|
|
262
|
+
currentRequest.current = null;
|
|
263
|
+
setBusy(false);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
return /* @__PURE__ */ jsxs2(
|
|
268
|
+
"section",
|
|
269
|
+
{
|
|
270
|
+
role: "dialog",
|
|
271
|
+
"aria-label": "Agent Chat",
|
|
272
|
+
"aria-modal": "false",
|
|
273
|
+
onKeyDown: (e) => {
|
|
274
|
+
e.stopPropagation();
|
|
275
|
+
if (e.key === "Escape") {
|
|
276
|
+
if (busy) cancel();
|
|
277
|
+
onClose();
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
281
|
+
onWheel: (e) => e.stopPropagation(),
|
|
282
|
+
className: "fixed bottom-10 right-3 z-[1000] flex flex-col overflow-hidden rounded-lg border border-slate-500 bg-white text-slate-900 shadow-2xl dark:bg-slate-950 dark:text-slate-100",
|
|
283
|
+
style: { width: "min(440px, calc(100vw - 24px))", height: "min(560px, calc(100vh - 64px))" },
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsxs2("header", { className: "flex items-center justify-between border-b border-slate-300 px-3 py-2 dark:border-slate-700", children: [
|
|
286
|
+
/* @__PURE__ */ jsx2("strong", { children: "Agent Chat" }),
|
|
287
|
+
/* @__PURE__ */ jsx2(BaseButton, { type: "button", variant: "ghost", title: "Close chat", "aria-label": "Close chat", onClick: () => {
|
|
288
|
+
if (busy) cancel();
|
|
289
|
+
onClose();
|
|
290
|
+
}, children: /* @__PURE__ */ jsx2(X, { size: 16 }) })
|
|
291
|
+
] }),
|
|
292
|
+
/* @__PURE__ */ jsx2(DirectChatMessageList, { messages, isStreaming: busy, className: "flex-1 min-h-0" }),
|
|
293
|
+
!targets.length || !onInvoke ? /* @__PURE__ */ jsx2("p", { role: "status", className: "p-3 text-xs text-slate-500", children: "No agents configured." }) : /* @__PURE__ */ jsxs2("div", { className: "border-t border-slate-300 p-3 dark:border-slate-700", children: [
|
|
294
|
+
unavailable && /* @__PURE__ */ jsx2("p", { role: "alert", className: "mb-2 text-xs text-red-600", children: "The selected agent is unavailable. Refresh your authorized agents." }),
|
|
295
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-2 text-xs", "aria-live": "polite", children: selected ? `To: ${agentChatLabel(selected)}` : appAgent ? `To: ${agentChatLabel(appAgent)}` : "Mention an agent with @" }),
|
|
296
|
+
mentionChoices.length > 0 && /* @__PURE__ */ jsx2("div", { role: "listbox", "aria-label": "Available agents", className: "max-h-32 overflow-y-auto rounded border border-slate-400", children: mentionChoices.map((agent) => /* @__PURE__ */ jsxs2(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
type: "button",
|
|
300
|
+
role: "option",
|
|
301
|
+
"aria-selected": "false",
|
|
302
|
+
onClick: () => choose(agent),
|
|
303
|
+
className: "block w-full px-2 py-1 text-left text-xs hover:bg-slate-200 dark:hover:bg-slate-800",
|
|
304
|
+
children: [
|
|
305
|
+
agentChatLabel(agent),
|
|
306
|
+
" ",
|
|
307
|
+
/* @__PURE__ */ jsxs2("span", { className: "opacity-60", children: [
|
|
308
|
+
"(",
|
|
309
|
+
agent.kind,
|
|
310
|
+
")"
|
|
311
|
+
] })
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
`${agent.kind}:${agent.id}`
|
|
315
|
+
)) }),
|
|
316
|
+
continuation?.fields?.map((field) => /* @__PURE__ */ jsxs2("label", { className: "mb-2 block text-xs", children: [
|
|
317
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
318
|
+
field.label,
|
|
319
|
+
field.required ? " (required)" : ""
|
|
320
|
+
] }),
|
|
321
|
+
field.type === "boolean" ? /* @__PURE__ */ jsx2(
|
|
322
|
+
"input",
|
|
323
|
+
{
|
|
324
|
+
type: "checkbox",
|
|
325
|
+
className: "ml-2",
|
|
326
|
+
checked: fieldValues[field.key] === true,
|
|
327
|
+
disabled: busy || unavailable,
|
|
328
|
+
onChange: (e) => setFieldValues((values) => ({ ...values, [field.key]: e.target.checked }))
|
|
329
|
+
}
|
|
330
|
+
) : /* @__PURE__ */ jsx2(
|
|
331
|
+
"input",
|
|
332
|
+
{
|
|
333
|
+
type: field.type === "number" ? "number" : "text",
|
|
334
|
+
value: String(fieldValues[field.key] ?? ""),
|
|
335
|
+
disabled: busy || unavailable,
|
|
336
|
+
onChange: (e) => setFieldValues((values) => ({ ...values, [field.key]: e.target.value })),
|
|
337
|
+
className: "mt-1 block w-full rounded border border-slate-400 bg-transparent p-2"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] }, field.key)),
|
|
341
|
+
/* @__PURE__ */ jsx2(
|
|
342
|
+
BaseTextarea,
|
|
343
|
+
{
|
|
344
|
+
ref: textarea,
|
|
345
|
+
rows: 2,
|
|
346
|
+
value: draft,
|
|
347
|
+
onChange: (e) => {
|
|
348
|
+
const text = e.target.value;
|
|
349
|
+
setDraft(text);
|
|
350
|
+
if (selected && !text.includes(`@${agentChatLabel(selected)}`)) setSelected(null);
|
|
351
|
+
setError("");
|
|
352
|
+
},
|
|
353
|
+
onKeyDown: (e) => {
|
|
354
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
355
|
+
e.preventDefault();
|
|
356
|
+
void send();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
placeholder: hasTypedFields ? "Optional clarification note" : "Message or @agent",
|
|
360
|
+
disabled: busy || unavailable,
|
|
361
|
+
"aria-label": "Agent message"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
error && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-red-600", children: error }),
|
|
365
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-2 flex justify-end gap-2", children: [
|
|
366
|
+
onCancel && (busy || !!continuation) && /* @__PURE__ */ jsx2(
|
|
367
|
+
BaseButton,
|
|
368
|
+
{
|
|
369
|
+
type: "button",
|
|
370
|
+
variant: "ghost",
|
|
371
|
+
onClick: cancel,
|
|
372
|
+
title: "Cancel agent request",
|
|
373
|
+
"aria-label": "Cancel agent request",
|
|
374
|
+
children: "Cancel"
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ jsxs2(BaseButton, { type: "button", onClick: () => void send(), disabled: !canSend, title: "Send message", "aria-label": "Send message", children: [
|
|
378
|
+
/* @__PURE__ */ jsx2(Send, { size: 14 }),
|
|
379
|
+
" Send"
|
|
380
|
+
] })
|
|
381
|
+
] })
|
|
382
|
+
] })
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/components/ai/chat/AgentChatDock.tsx
|
|
389
|
+
import { useEffect as useEffect2, useId, useState as useState2 } from "react";
|
|
390
|
+
import { createPortal } from "react-dom";
|
|
391
|
+
import { MessageCircle } from "lucide-react";
|
|
392
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
393
|
+
function AgentChatDock(props) {
|
|
394
|
+
const scope = props.scopeKey?.trim() || null;
|
|
395
|
+
const [openedForScope, setOpenedForScope] = useState2(null);
|
|
396
|
+
const panelId = useId();
|
|
397
|
+
const open = openedForScope !== null && openedForScope.scope === scope;
|
|
398
|
+
useEffect2(() => {
|
|
399
|
+
setOpenedForScope(null);
|
|
400
|
+
}, [scope]);
|
|
401
|
+
const active = scope !== null && !!props.onInvoke;
|
|
402
|
+
const targets = active ? props.targets : [];
|
|
403
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
404
|
+
/* @__PURE__ */ jsxs3(
|
|
405
|
+
"button",
|
|
406
|
+
{
|
|
407
|
+
type: "button",
|
|
408
|
+
"aria-label": "Agent Chat",
|
|
409
|
+
"aria-expanded": open,
|
|
410
|
+
"aria-controls": open ? panelId : void 0,
|
|
411
|
+
title: "Agent Chat",
|
|
412
|
+
onClick: () => setOpenedForScope((current) => current?.scope === scope ? null : { scope }),
|
|
413
|
+
className: "inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-slate-200 hover:bg-slate-700",
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ jsx3(MessageCircle, { size: 13 }),
|
|
416
|
+
" Chat"
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
open && typeof document !== "undefined" && createPortal(
|
|
421
|
+
/* @__PURE__ */ jsx3("div", { id: panelId, children: /* @__PURE__ */ jsx3(
|
|
422
|
+
AgentChatPanel,
|
|
423
|
+
{
|
|
424
|
+
targets,
|
|
425
|
+
appAgentId: active ? props.appAgentId : void 0,
|
|
426
|
+
onInvoke: active ? props.onInvoke : void 0,
|
|
427
|
+
onCancel: active ? props.onCancel : void 0,
|
|
428
|
+
onClose: () => setOpenedForScope(null)
|
|
429
|
+
}
|
|
430
|
+
) }, scope ?? "unbound"),
|
|
431
|
+
document.body
|
|
432
|
+
)
|
|
433
|
+
] });
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export {
|
|
437
|
+
DirectChatMessageList,
|
|
438
|
+
agentChatLabel,
|
|
439
|
+
matchAgentMentions,
|
|
440
|
+
selectedAgentIsValid,
|
|
441
|
+
AgentChatPanel,
|
|
442
|
+
AgentChatDock
|
|
443
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BaseSelect
|
|
2
|
+
BaseSelect
|
|
3
|
+
} from "./chunk-CIH4FVXM.js";
|
|
4
|
+
import {
|
|
3
5
|
BaseTextarea
|
|
4
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-F5XUUMSI.js";
|
|
5
7
|
import {
|
|
6
8
|
BaseInput
|
|
7
9
|
} from "./chunk-W42SJGOJ.js";
|
|
@@ -1012,59 +1014,10 @@ var DirectChatHeader = ({
|
|
|
1012
1014
|
] });
|
|
1013
1015
|
};
|
|
1014
1016
|
|
|
1015
|
-
// src/components/ai/chat/DirectChatMessageList.tsx
|
|
1016
|
-
import { User, Bot as Bot2 } from "lucide-react";
|
|
1017
|
-
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1018
|
-
var DirectChatMessageList = ({
|
|
1019
|
-
messages,
|
|
1020
|
-
isStreaming = false,
|
|
1021
|
-
className = ""
|
|
1022
|
-
}) => {
|
|
1023
|
-
return /* @__PURE__ */ jsxs20("div", { className: `space-y-4 p-4 overflow-y-auto font-mono text-xs ${className}`, children: [
|
|
1024
|
-
messages.length === 0 ? /* @__PURE__ */ jsxs20("div", { className: "h-full flex flex-col items-center justify-center text-center text-slate-400 p-8 space-y-2", children: [
|
|
1025
|
-
/* @__PURE__ */ jsx20(Bot2, { size: 28, className: "opacity-40" }),
|
|
1026
|
-
/* @__PURE__ */ jsx20("p", { children: "No messages yet. Send a prompt to start conversation." })
|
|
1027
|
-
] }) : messages.map((m) => {
|
|
1028
|
-
const isUser = m.role === "user";
|
|
1029
|
-
return /* @__PURE__ */ jsxs20(
|
|
1030
|
-
"div",
|
|
1031
|
-
{
|
|
1032
|
-
className: `flex gap-3 ${isUser ? "justify-end" : "justify-start"}`,
|
|
1033
|
-
children: [
|
|
1034
|
-
!isUser && /* @__PURE__ */ jsx20("div", { className: "w-6 h-6 rounded-full bg-indigo-50 dark:bg-indigo-950 text-indigo-600 dark:text-indigo-400 flex items-center justify-center shrink-0 mt-0.5", children: /* @__PURE__ */ jsx20(Bot2, { size: 13 }) }),
|
|
1035
|
-
/* @__PURE__ */ jsxs20(
|
|
1036
|
-
"div",
|
|
1037
|
-
{
|
|
1038
|
-
className: `max-w-[80%] rounded-xl p-3 border leading-relaxed ${isUser ? "bg-indigo-600 text-white border-indigo-700" : "bg-white dark:bg-slate-900 text-slate-800 dark:text-slate-200 border-slate-300 dark:border-slate-800 shadow-sm"}`,
|
|
1039
|
-
children: [
|
|
1040
|
-
/* @__PURE__ */ jsx20("div", { className: "whitespace-pre-wrap", children: m.content }),
|
|
1041
|
-
m.timestamp && /* @__PURE__ */ jsx20(
|
|
1042
|
-
"div",
|
|
1043
|
-
{
|
|
1044
|
-
className: `text-[9px] mt-1 text-right ${isUser ? "text-indigo-200" : "text-slate-400"}`,
|
|
1045
|
-
children: m.timestamp
|
|
1046
|
-
}
|
|
1047
|
-
)
|
|
1048
|
-
]
|
|
1049
|
-
}
|
|
1050
|
-
),
|
|
1051
|
-
isUser && /* @__PURE__ */ jsx20("div", { className: "w-6 h-6 rounded-full bg-slate-200 dark:bg-slate-800 text-slate-700 dark:text-slate-300 flex items-center justify-center shrink-0 mt-0.5", children: /* @__PURE__ */ jsx20(User, { size: 13 }) })
|
|
1052
|
-
]
|
|
1053
|
-
},
|
|
1054
|
-
m.id
|
|
1055
|
-
);
|
|
1056
|
-
}),
|
|
1057
|
-
isStreaming && /* @__PURE__ */ jsxs20("div", { className: "flex gap-3 justify-start items-center text-slate-400 text-[11px]", children: [
|
|
1058
|
-
/* @__PURE__ */ jsx20("div", { className: "w-2 h-2 rounded-full bg-indigo-500 animate-ping" }),
|
|
1059
|
-
/* @__PURE__ */ jsx20("span", { children: "Generating response..." })
|
|
1060
|
-
] })
|
|
1061
|
-
] });
|
|
1062
|
-
};
|
|
1063
|
-
|
|
1064
1017
|
// src/components/ai/chat/DirectChatInput.tsx
|
|
1065
1018
|
import { useState as useState10 } from "react";
|
|
1066
1019
|
import { Bug, Send } from "lucide-react";
|
|
1067
|
-
import { jsx as
|
|
1020
|
+
import { jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1068
1021
|
var DirectChatInput = ({
|
|
1069
1022
|
onSendMessage,
|
|
1070
1023
|
disabled = false,
|
|
@@ -1084,16 +1037,16 @@ var DirectChatInput = ({
|
|
|
1084
1037
|
onSendMessage(content.trim());
|
|
1085
1038
|
setContent("");
|
|
1086
1039
|
};
|
|
1087
|
-
return /* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1040
|
+
return /* @__PURE__ */ jsxs20("div", { className: "p-3 border-t border-slate-300 dark:border-slate-800 bg-white dark:bg-slate-900 font-mono text-xs", children: [
|
|
1041
|
+
/* @__PURE__ */ jsx20("div", { className: "flex items-center justify-between pb-2", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
1089
1042
|
toolsSlot,
|
|
1090
|
-
onReportBug && /* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
1043
|
+
onReportBug && /* @__PURE__ */ jsxs20(BaseButton, { size: "sm", variant: "ghost", onClick: () => content.trim() && onReportBug(content.trim()), disabled: disabled || !content.trim(), title: "Report bug", children: [
|
|
1044
|
+
/* @__PURE__ */ jsx20(Bug, { size: 13 }),
|
|
1092
1045
|
" Report bug"
|
|
1093
1046
|
] })
|
|
1094
1047
|
] }) }),
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-end gap-2", children: [
|
|
1049
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1", children: /* @__PURE__ */ jsx20(
|
|
1097
1050
|
BaseTextarea,
|
|
1098
1051
|
{
|
|
1099
1052
|
value: content,
|
|
@@ -1104,14 +1057,14 @@ var DirectChatInput = ({
|
|
|
1104
1057
|
rows: 2
|
|
1105
1058
|
}
|
|
1106
1059
|
) }),
|
|
1107
|
-
/* @__PURE__ */
|
|
1060
|
+
/* @__PURE__ */ jsx20(
|
|
1108
1061
|
BaseButton,
|
|
1109
1062
|
{
|
|
1110
1063
|
variant: "accent",
|
|
1111
1064
|
onClick: handleSend,
|
|
1112
1065
|
disabled: disabled || !content.trim(),
|
|
1113
1066
|
className: "p-2.5 h-[42px] flex items-center justify-center shrink-0",
|
|
1114
|
-
children: /* @__PURE__ */
|
|
1067
|
+
children: /* @__PURE__ */ jsx20(Send, { size: 15 })
|
|
1115
1068
|
}
|
|
1116
1069
|
)
|
|
1117
1070
|
] })
|
|
@@ -1121,7 +1074,7 @@ var DirectChatInput = ({
|
|
|
1121
1074
|
// src/components/ai/execution-status/TimelineScrubber.tsx
|
|
1122
1075
|
import { useEffect as useEffect2, useRef, useState as useState11 } from "react";
|
|
1123
1076
|
import { Play as Play2, Pause, SkipBack, SkipForward, Clock as Clock2 } from "lucide-react";
|
|
1124
|
-
import { jsx as
|
|
1077
|
+
import { jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1125
1078
|
var TimelineScrubber = ({
|
|
1126
1079
|
logs,
|
|
1127
1080
|
currentIndex,
|
|
@@ -1153,13 +1106,13 @@ var TimelineScrubber = ({
|
|
|
1153
1106
|
if (logs.length === 0) return null;
|
|
1154
1107
|
const currentLog = logs[currentIndex];
|
|
1155
1108
|
const progressPercent = currentIndex / Math.max(1, logs.length - 1) * 100;
|
|
1156
|
-
return /* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1109
|
+
return /* @__PURE__ */ jsxs21("div", { className: "border border-slate-300 dark:border-slate-800 bg-white dark:bg-slate-900 rounded-xl p-3 font-mono text-xs space-y-3 shadow-sm", children: [
|
|
1110
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200 dark:border-slate-800", children: [
|
|
1111
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
|
|
1112
|
+
/* @__PURE__ */ jsx21(Clock2, { size: 14, className: "text-amber-500" }),
|
|
1113
|
+
/* @__PURE__ */ jsx21("span", { className: "font-bold text-slate-800 dark:text-slate-200", children: "TIMELINE RECONSTRUCTION" })
|
|
1161
1114
|
] }),
|
|
1162
|
-
currentLog && /* @__PURE__ */
|
|
1115
|
+
currentLog && /* @__PURE__ */ jsxs21("span", { className: "text-[10px] text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-950/60 border border-amber-300 dark:border-amber-800 rounded px-1.5 py-0.5", children: [
|
|
1163
1116
|
"Frame ",
|
|
1164
1117
|
currentIndex + 1,
|
|
1165
1118
|
"/",
|
|
@@ -1170,15 +1123,15 @@ var TimelineScrubber = ({
|
|
|
1170
1123
|
currentLog.modelId || "N/A"
|
|
1171
1124
|
] })
|
|
1172
1125
|
] }),
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsxs21("div", { className: "relative h-4 flex items-center", children: [
|
|
1127
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute inset-x-0 h-1.5 bg-slate-200 dark:bg-slate-800 rounded-full overflow-hidden", children: /* @__PURE__ */ jsx21(
|
|
1175
1128
|
"div",
|
|
1176
1129
|
{
|
|
1177
1130
|
className: "h-full bg-amber-500 transition-all duration-150",
|
|
1178
1131
|
style: { width: `${progressPercent}%` }
|
|
1179
1132
|
}
|
|
1180
1133
|
) }),
|
|
1181
|
-
/* @__PURE__ */
|
|
1134
|
+
/* @__PURE__ */ jsx21(
|
|
1182
1135
|
"input",
|
|
1183
1136
|
{
|
|
1184
1137
|
type: "range",
|
|
@@ -1192,7 +1145,7 @@ var TimelineScrubber = ({
|
|
|
1192
1145
|
className: "absolute inset-x-0 w-full h-full opacity-0 cursor-pointer z-10"
|
|
1193
1146
|
}
|
|
1194
1147
|
),
|
|
1195
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx21(
|
|
1196
1149
|
"div",
|
|
1197
1150
|
{
|
|
1198
1151
|
className: "absolute w-3 h-3 bg-amber-500 border border-white dark:border-slate-900 rounded-full pointer-events-none transition-all duration-150",
|
|
@@ -1200,8 +1153,8 @@ var TimelineScrubber = ({
|
|
|
1200
1153
|
}
|
|
1201
1154
|
)
|
|
1202
1155
|
] }),
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-center gap-3 pt-1", children: [
|
|
1157
|
+
/* @__PURE__ */ jsx21(
|
|
1205
1158
|
BaseButton,
|
|
1206
1159
|
{
|
|
1207
1160
|
size: "sm",
|
|
@@ -1212,20 +1165,20 @@ var TimelineScrubber = ({
|
|
|
1212
1165
|
},
|
|
1213
1166
|
disabled: currentIndex === 0,
|
|
1214
1167
|
className: "p-1",
|
|
1215
|
-
children: /* @__PURE__ */
|
|
1168
|
+
children: /* @__PURE__ */ jsx21(SkipBack, { size: 13 })
|
|
1216
1169
|
}
|
|
1217
1170
|
),
|
|
1218
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ jsx21(
|
|
1219
1172
|
BaseButton,
|
|
1220
1173
|
{
|
|
1221
1174
|
size: "sm",
|
|
1222
1175
|
variant: "accent",
|
|
1223
1176
|
onClick: () => togglePlay(!isPlaying),
|
|
1224
1177
|
className: "p-1.5",
|
|
1225
|
-
children: isPlaying ? /* @__PURE__ */
|
|
1178
|
+
children: isPlaying ? /* @__PURE__ */ jsx21(Pause, { size: 14 }) : /* @__PURE__ */ jsx21(Play2, { size: 14 })
|
|
1226
1179
|
}
|
|
1227
1180
|
),
|
|
1228
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx21(
|
|
1229
1182
|
BaseButton,
|
|
1230
1183
|
{
|
|
1231
1184
|
size: "sm",
|
|
@@ -1236,7 +1189,7 @@ var TimelineScrubber = ({
|
|
|
1236
1189
|
},
|
|
1237
1190
|
disabled: currentIndex === logs.length - 1,
|
|
1238
1191
|
className: "p-1",
|
|
1239
|
-
children: /* @__PURE__ */
|
|
1192
|
+
children: /* @__PURE__ */ jsx21(SkipForward, { size: 13 })
|
|
1240
1193
|
}
|
|
1241
1194
|
)
|
|
1242
1195
|
] })
|
|
@@ -1264,7 +1217,6 @@ export {
|
|
|
1264
1217
|
EmailProfileRegistrationForm,
|
|
1265
1218
|
AgentExecutionCard,
|
|
1266
1219
|
DirectChatHeader,
|
|
1267
|
-
DirectChatMessageList,
|
|
1268
1220
|
DirectChatInput,
|
|
1269
1221
|
TimelineScrubber
|
|
1270
1222
|
};
|