@burdenoff/microfe-botmanor 2026.1118.3 → 2026.1118.5
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/dist/botlit/pages/AgentDetailPage.js +50 -38
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChatPage.js +76 -36
- package/dist/botlit/pages/ChatPage.js.map +1 -1
- package/dist/botlit/pages/PolicyDetailPage.js +763 -743
- package/dist/botlit/pages/PolicyDetailPage.js.map +1 -1
- package/dist/botlit/utils/policyConfig.d.ts +8 -0
- package/dist/botlit/utils/policyConfig.js +97 -1
- package/dist/botlit/utils/policyConfig.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,70 +1,110 @@
|
|
|
1
1
|
import { PageLayout as e } from "../components/PageLayout.js";
|
|
2
2
|
import { Button as t } from "../components/Button.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useBotlit as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useParams as
|
|
8
|
-
import { WorkflowAssistantPanel as
|
|
3
|
+
import { useAgent as n, useAgents as r } from "../hooks/useAgents.js";
|
|
4
|
+
import { useBotlit as i } from "../providers/BotlitProvider.js";
|
|
5
|
+
import { useState as a } from "react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { useParams as l } from "react-router";
|
|
8
|
+
import { WorkflowAssistantPanel as u } from "@burdenoff/fe-libs/shared/assistant";
|
|
9
9
|
// src/botlit/pages/ChatPage.tsx
|
|
10
|
-
function u() {
|
|
11
|
-
let { workspaceId: e, currentUser: t } = r();
|
|
12
|
-
return /* @__PURE__ */ o(d, {}, `${e}:${t?.id}`);
|
|
13
|
-
}
|
|
14
10
|
function d() {
|
|
15
|
-
let {
|
|
16
|
-
return /* @__PURE__ */
|
|
11
|
+
let { workspaceId: e, currentUser: t } = i();
|
|
12
|
+
return /* @__PURE__ */ s(f, {}, `${e}:${t?.id}`);
|
|
13
|
+
}
|
|
14
|
+
function f() {
|
|
15
|
+
let { agentId: n } = l(), { currentUser: u, workspaceId: d, authToken: f, navigateTo: p } = i(), h = r(), [g, _] = a(""), v = n ?? g, y = h.data?.find((e) => e.id === v && e.status === "ACTIVE");
|
|
16
|
+
return /* @__PURE__ */ s(e, {
|
|
17
17
|
title: y ? `Chat with ${y.name}` : "AI Chat",
|
|
18
18
|
description: "Ask questions grounded in your assistant’s knowledge. Your conversation is saved securely.",
|
|
19
|
-
children: /* @__PURE__ */
|
|
19
|
+
children: /* @__PURE__ */ s("div", {
|
|
20
20
|
className: "mx-auto flex w-full max-w-4xl flex-col gap-4 p-4",
|
|
21
|
-
children: !
|
|
21
|
+
children: !u?.id || !d ? /* @__PURE__ */ s("p", { children: "Sign in and choose a workspace to use an assistant." }) : h.loading ? /* @__PURE__ */ s("p", {
|
|
22
22
|
role: "status",
|
|
23
23
|
children: "Loading assistants…"
|
|
24
|
-
}) : h.error ? /* @__PURE__ */
|
|
24
|
+
}) : h.error ? /* @__PURE__ */ c("div", {
|
|
25
25
|
role: "alert",
|
|
26
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ s("p", { children: "Assistants could not be loaded. Check your access and try again." }), /* @__PURE__ */ s(t, {
|
|
27
27
|
variant: "outline",
|
|
28
28
|
onClick: () => void h.refetch(),
|
|
29
29
|
children: "Reload assistants"
|
|
30
30
|
})]
|
|
31
|
-
}) : /* @__PURE__ */
|
|
31
|
+
}) : /* @__PURE__ */ c(o, { children: [!n && /* @__PURE__ */ c("label", {
|
|
32
32
|
className: "grid gap-2 text-sm font-medium",
|
|
33
|
-
children: ["Assistant", /* @__PURE__ */
|
|
33
|
+
children: ["Assistant", /* @__PURE__ */ c("select", {
|
|
34
34
|
className: "h-10 rounded-md border border-border-default bg-bg-surface px-3",
|
|
35
35
|
value: g,
|
|
36
36
|
onChange: (e) => _(e.target.value),
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ s("option", {
|
|
38
38
|
value: "",
|
|
39
39
|
children: "Choose an assistant"
|
|
40
|
-
}), h.data?.filter((e) => e.status === "ACTIVE").map((e) => /* @__PURE__ */
|
|
40
|
+
}), h.data?.filter((e) => e.status === "ACTIVE").map((e) => /* @__PURE__ */ s("option", {
|
|
41
41
|
value: e.id,
|
|
42
42
|
children: e.name
|
|
43
43
|
}, e.id))]
|
|
44
44
|
})]
|
|
45
|
-
}), y ? /* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
ownerId: d.id,
|
|
55
|
-
title: y.name,
|
|
56
|
-
description: "Answers from this assistant’s configured knowledge."
|
|
57
|
-
}) : /* @__PURE__ */ s("div", {
|
|
45
|
+
}), y ? /* @__PURE__ */ s(m, {
|
|
46
|
+
agentId: y.id,
|
|
47
|
+
agentName: y.name,
|
|
48
|
+
ownerId: u.id,
|
|
49
|
+
workspaceId: d,
|
|
50
|
+
authToken: f,
|
|
51
|
+
onNavigate: p
|
|
52
|
+
}, y.id) : /* @__PURE__ */ c("div", {
|
|
58
53
|
className: "space-y-2",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ s("p", { children: v ? "This assistant is not live, so it cannot hold a saved conversation yet. Activate it, or test it first." : "Choose an assistant to begin." }), v && h.data?.some((e) => e.id === v) && /* @__PURE__ */ s(t, {
|
|
60
55
|
variant: "outline",
|
|
61
|
-
onClick: () =>
|
|
56
|
+
onClick: () => p(`agents/${v}/test`),
|
|
62
57
|
children: "Test this agent"
|
|
63
58
|
})]
|
|
64
59
|
})] })
|
|
65
60
|
})
|
|
66
61
|
});
|
|
67
62
|
}
|
|
68
|
-
|
|
63
|
+
function p(e) {
|
|
64
|
+
let t = e?.assistantRuntime;
|
|
65
|
+
return !!(t && typeof t == "object");
|
|
66
|
+
}
|
|
67
|
+
function m({ agentId: e, agentName: r, ownerId: i, workspaceId: a, authToken: o, onNavigate: l }) {
|
|
68
|
+
let d = n(e);
|
|
69
|
+
return d.loading && !d.data ? /* @__PURE__ */ s("p", {
|
|
70
|
+
role: "status",
|
|
71
|
+
children: "Loading assistant…"
|
|
72
|
+
}) : d.data ? p(d.data.metadata) ? /* @__PURE__ */ s(u, {
|
|
73
|
+
target: {
|
|
74
|
+
kind: "botmanor",
|
|
75
|
+
agentId: e
|
|
76
|
+
},
|
|
77
|
+
context: {
|
|
78
|
+
workspaceId: a,
|
|
79
|
+
authContext: { accessToken: o }
|
|
80
|
+
},
|
|
81
|
+
ownerId: i,
|
|
82
|
+
title: r,
|
|
83
|
+
description: "Answers from this assistant’s configured knowledge."
|
|
84
|
+
}) : /* @__PURE__ */ c("div", {
|
|
85
|
+
role: "status",
|
|
86
|
+
className: "space-y-3",
|
|
87
|
+
children: [/* @__PURE__ */ c("p", { children: [r, " is not set up for saved chats yet. Connect it to its answer workflow on the agent's Assistant setup tab, or test it right away."] }), /* @__PURE__ */ c("div", {
|
|
88
|
+
className: "flex flex-wrap gap-2",
|
|
89
|
+
children: [/* @__PURE__ */ s(t, {
|
|
90
|
+
variant: "outline",
|
|
91
|
+
onClick: () => l(`agents/${e}?tab=assistant`),
|
|
92
|
+
children: "Open Assistant setup"
|
|
93
|
+
}), /* @__PURE__ */ s(t, {
|
|
94
|
+
onClick: () => l(`agents/${e}/test`),
|
|
95
|
+
children: "Test this agent"
|
|
96
|
+
})]
|
|
97
|
+
})]
|
|
98
|
+
}) : /* @__PURE__ */ c("div", {
|
|
99
|
+
role: "alert",
|
|
100
|
+
className: "space-y-2",
|
|
101
|
+
children: [/* @__PURE__ */ s("p", { children: "This assistant could not be loaded. Check your access and try again." }), /* @__PURE__ */ s(t, {
|
|
102
|
+
variant: "outline",
|
|
103
|
+
onClick: () => void d.refetch(),
|
|
104
|
+
children: "Retry"
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export { d as ChatPage };
|
|
69
109
|
|
|
70
110
|
//# sourceMappingURL=ChatPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatPage.js","names":["_Fragment","Fragment$1","ChatPage","useBotlit","ScopedChatPage","workspaceId","currentUser","useParams","agents","useAgents","chosen","setChosen","useState","selectedId","agentId","selected","agent","PageLayout","Button","event","WorkflowAssistantPanel","authToken","
|
|
1
|
+
{"version":3,"file":"ChatPage.js","names":["_Fragment","Fragment$1","ChatPage","useBotlit","ScopedChatPage","workspaceId","currentUser","useParams","agents","useAgents","chosen","setChosen","useState","selectedId","agentId","selected","agent","PageLayout","Button","event","SelectedAssistant","navigateTo","hasAssistantRuntime","runtime","metadata","detail","useAgent","WorkflowAssistantPanel","authToken","agentName","onNavigate"],"sources":["../../../src/botlit/pages/ChatPage.tsx"],"sourcesContent":["/** Authenticated Botmanor agent chat with canonical, owner-scoped workflow history. */\nimport { useState } from 'react';\nimport { useParams } from 'react-router';\nimport { WorkflowAssistantPanel } from '@burdenoff/fe-libs/shared/assistant';\nimport { PageLayout } from '../components/PageLayout';\nimport { Button } from '../components/Button';\nimport { useAgent, useAgents } from '../hooks/useAgents';\nimport { useBotlit } from '../providers/BotlitProvider';\n\nexport function ChatPage() {\n const { workspaceId, currentUser } = useBotlit();\n return <ScopedChatPage key={`${workspaceId}:${currentUser?.id}`} />;\n}\n\nfunction ScopedChatPage() {\n const { agentId } = useParams();\n const { currentUser, workspaceId, authToken, navigateTo } = useBotlit();\n const agents = useAgents();\n const [chosen, setChosen] = useState('');\n const selectedId = agentId ?? chosen;\n const selected = agents.data?.find(\n (agent) => agent.id === selectedId && agent.status === 'ACTIVE'\n );\n return (\n <PageLayout\n title={selected ? `Chat with ${selected.name}` : 'AI Chat'}\n description=\"Ask questions grounded in your assistant’s knowledge. Your conversation is saved securely.\"\n >\n <div className=\"mx-auto flex w-full max-w-4xl flex-col gap-4 p-4\">\n {!currentUser?.id || !workspaceId ? (\n <p>Sign in and choose a workspace to use an assistant.</p>\n ) : agents.loading ? (\n <p role=\"status\">Loading assistants…</p>\n ) : agents.error ? (\n <div role=\"alert\">\n <p>Assistants could not be loaded. Check your access and try again.</p>\n <Button variant=\"outline\" onClick={() => void agents.refetch()}>\n Reload assistants\n </Button>\n </div>\n ) : (\n <>\n {!agentId && (\n <label className=\"grid gap-2 text-sm font-medium\">\n Assistant\n <select\n className=\"h-10 rounded-md border border-border-default bg-bg-surface px-3\"\n value={chosen}\n onChange={(event) => setChosen(event.target.value)}\n >\n <option value=\"\">Choose an assistant</option>\n {agents.data\n ?.filter((agent) => agent.status === 'ACTIVE')\n .map((agent) => (\n <option key={agent.id} value={agent.id}>\n {agent.name}\n </option>\n ))}\n </select>\n </label>\n )}\n {selected ? (\n // Keyed by agent so a newly chosen assistant is always read fresh.\n <SelectedAssistant\n key={selected.id}\n agentId={selected.id}\n agentName={selected.name}\n ownerId={currentUser.id}\n workspaceId={workspaceId}\n authToken={authToken}\n onNavigate={navigateTo}\n />\n ) : (\n <div className=\"space-y-2\">\n <p>\n {selectedId\n ? 'This assistant is not live, so it cannot hold a saved conversation yet. Activate it, or test it first.'\n : 'Choose an assistant to begin.'}\n </p>\n {selectedId && agents.data?.some((agent) => agent.id === selectedId) && (\n <Button variant=\"outline\" onClick={() => navigateTo(`agents/${selectedId}/test`)}>\n Test this agent\n </Button>\n )}\n </div>\n )}\n </>\n )}\n </div>\n </PageLayout>\n );\n}\n\n/** True when the agent's metadata carries a configured assistant runtime. */\nfunction hasAssistantRuntime(metadata: Record<string, unknown> | null | undefined): boolean {\n const runtime = metadata?.assistantRuntime;\n return Boolean(runtime && typeof runtime === 'object');\n}\n\n/**\n * One chosen assistant. Saved chats run through the agent's Fluidgrids answer\n * runtime (set up on its \"Assistant setup\" tab); without it every turn would be\n * refused, so the page says so instead of opening a chat that cannot answer.\n */\nfunction SelectedAssistant({\n agentId,\n agentName,\n ownerId,\n workspaceId,\n authToken,\n onNavigate,\n}: {\n agentId: string;\n agentName: string;\n ownerId: string;\n workspaceId: string;\n authToken?: string;\n onNavigate: (path: string) => void;\n}) {\n const detail = useAgent(agentId);\n if (detail.loading && !detail.data) return <p role=\"status\">Loading assistant…</p>;\n if (!detail.data) {\n return (\n <div role=\"alert\" className=\"space-y-2\">\n <p>This assistant could not be loaded. Check your access and try again.</p>\n <Button variant=\"outline\" onClick={() => void detail.refetch()}>\n Retry\n </Button>\n </div>\n );\n }\n if (!hasAssistantRuntime(detail.data.metadata)) {\n return (\n <div role=\"status\" className=\"space-y-3\">\n <p>\n {agentName} is not set up for saved chats yet. Connect it to its answer workflow on the\n agent's Assistant setup tab, or test it right away.\n </p>\n <div className=\"flex flex-wrap gap-2\">\n <Button variant=\"outline\" onClick={() => onNavigate(`agents/${agentId}?tab=assistant`)}>\n Open Assistant setup\n </Button>\n <Button onClick={() => onNavigate(`agents/${agentId}/test`)}>Test this agent</Button>\n </div>\n </div>\n );\n }\n return (\n <WorkflowAssistantPanel\n target={{ kind: 'botmanor', agentId }}\n context={{ workspaceId, authContext: { accessToken: authToken } }}\n ownerId={ownerId}\n title={agentName}\n description=\"Answers from this assistant’s configured knowledge.\"\n />\n );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgBE,IAAW;CACzB,IAAM,EAAE,gBAAa,mBAAgBC,EAAU;CAC/C,OAAO,kBAACC,GAAD,CAA2D,GAAtC,GAAGC,EAAY,GAAGC,GAAa,IAAO;AACpE;AAEA,SAASF,IAAiB;CACxB,IAAM,EAAE,eAAYG,EAAU,GACxB,EAAE,gBAAa,gBAAa,cAAW,kBAAeJ,EAAU,GAChEK,IAASC,EAAU,GACnB,CAACC,GAAQC,KAAaC,EAAS,EAAE,GACjCC,IAAaC,KAAWJ,GACxBK,IAAWP,EAAO,MAAM,MAC3B,MAAUQ,EAAM,OAAOH,KAAcG,EAAM,WAAW,QACzD;CACA,OACE,kBAACC,GAAD;EACE,OAAOF,IAAW,aAAaA,EAAS,SAAS;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