@burdenoff/microfe-botmanor 2026.1203.1 → 2026.1203.3
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/components/DashboardUsagePanel.js +2 -2
- package/dist/botlit/components/DashboardUsagePanel.js.map +1 -1
- package/dist/botlit/hooks/useAgents.d.ts +5 -0
- package/dist/botlit/hooks/useAgents.js +8 -0
- package/dist/botlit/hooks/useAgents.js.map +1 -1
- package/dist/botlit/pages/AgentBuilderPage.js +508 -460
- package/dist/botlit/pages/AgentBuilderPage.js.map +1 -1
- package/dist/botlit/utils/agentSettings.d.ts +4 -1
- package/dist/botlit/utils/agentSettings.js +30 -28
- package/dist/botlit/utils/agentSettings.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +4 -0
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +12 -0
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utils/pageContext.d.ts +50 -0
- package/dist/utils/pageContext.js +191 -0
- package/dist/utils/pageContext.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@
|
|
|
3
3
|
* @module @burdenoff/microfe-botmanor
|
|
4
4
|
*/
|
|
5
5
|
export * from './botlit';
|
|
6
|
+
export { describeCurrentPage, gatherPageContext, isBotmanorChatRoute, resolveBotmanorEntityContext, type BotmanorEntityContext, type BotmanorEntityType, type BotmanorPageContext, } from './utils/pageContext';
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ import { cn as S } from "./botlit/utils/cn.js";
|
|
|
10
10
|
import { formatDate as C, formatRelativeTime as w } from "./botlit/utils/formatters.js";
|
|
11
11
|
import { BOTMANOR_TOUR_ANCHORS as T, BOTMANOR_TOUR_MODULE_ID as E, BOTMANOR_TOUR_PRODUCT_ID as D, BOTMANOR_TOUR_ROUTES as O, botmanorTourRoutes as k, resolveBotmanorTourPageId as A } from "./botlit/tours/tourRoutes.js";
|
|
12
12
|
import "./botlit/index.js";
|
|
13
|
-
|
|
13
|
+
import { describeCurrentPage as j, gatherPageContext as M, isBotmanorChatRoute as N, resolveBotmanorEntityContext as P } from "./utils/pageContext.js";
|
|
14
|
+
export { T as BOTMANOR_TOUR_ANCHORS, E as BOTMANOR_TOUR_MODULE_ID, D as BOTMANOR_TOUR_PRODUCT_ID, O as BOTMANOR_TOUR_ROUTES, t as BotlitProvider, e as BotmanorRoot, k as botmanorTourRoutes, S as cn, j as describeCurrentPage, C as formatDate, w as formatRelativeTime, M as gatherPageContext, N as isBotmanorChatRoute, P as resolveBotmanorEntityContext, A as resolveBotmanorTourPageId, l as useAgent, u as useAgents, i as useBot, n as useBotlit, r as useBotlitStore, a as useBots, v as useConfigureLLMProvider, d as useCreateAgent, o as useCreateBot, m as useCreateKnowledgeBase, b as useCreateMCPServer, f as useDeleteAgent, s as useDeleteBot, h as useKnowledgeBase, g as useKnowledgeBases, _ as useKnowledgeDocuments, y as useLLMProviders, x as useMCPServers, p as useUpdateAgent, c as useUpdateBot };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BotManor pageContext builder for the shared AI Assistant (BOFF-3788).
|
|
3
|
+
*
|
|
4
|
+
* Emits strictly the agent's allow-listed keys (`currentUrl`, `currentPage`,
|
|
5
|
+
* `entityType`, `entityId`, `platform`, `version`, `viewportSize`). Never
|
|
6
|
+
* emits `activeUrl`, `userAgent`, `timestamp`, or secrets.
|
|
7
|
+
*/
|
|
8
|
+
export type BotmanorEntityType = 'botApp' | 'agent' | 'knowledgeBase' | 'retrievalProfile' | 'mcpConnection' | 'a2aAgent' | 'channelConnector' | 'policy' | 'skill' | 'promptTemplate' | 'execution' | 'bucket' | 'storePackage';
|
|
9
|
+
export type BotmanorEntityContext = {
|
|
10
|
+
entityType: BotmanorEntityType | null;
|
|
11
|
+
entityId: string | null;
|
|
12
|
+
currentPage: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Type alias (not interface) so it remains assignable to fe-libs' `PageContext`
|
|
16
|
+
* index signature without TS2322.
|
|
17
|
+
*/
|
|
18
|
+
export type BotmanorPageContext = {
|
|
19
|
+
currentUrl: string;
|
|
20
|
+
currentPage: string;
|
|
21
|
+
entityType?: BotmanorEntityType;
|
|
22
|
+
entityId?: string;
|
|
23
|
+
platform: 'web';
|
|
24
|
+
version: string;
|
|
25
|
+
viewportSize: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* True when the user is on BotManor's own agent chat surface, where the
|
|
29
|
+
* floating platform Assistant FAB should stay out of the composer's way.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isBotmanorChatRoute(pathname: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a BotManor route into its innermost entity (`entityType`, `entityId`)
|
|
34
|
+
* and a concise `currentPage` label. Nested routes resolve the innermost entity
|
|
35
|
+
* (e.g. `/botmanor/bots/:botId/agents/:agentId` -> `agent` / `:agentId`).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveBotmanorEntityContext(pathname: string): BotmanorEntityContext;
|
|
38
|
+
/** Human-readable label for the Assistant panel header ("Context: ..."). */
|
|
39
|
+
export declare function describeCurrentPage(pathname?: string): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Gather the allow-listed `PageContext` sent with every AI Assistant turn.
|
|
42
|
+
* Emits ONLY: `currentUrl`, `currentPage`, optional `entityType` & `entityId`,
|
|
43
|
+
* `platform`, `version`, `viewportSize`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function gatherPageContext(override?: {
|
|
46
|
+
href?: string;
|
|
47
|
+
pathname?: string;
|
|
48
|
+
innerWidth?: number;
|
|
49
|
+
innerHeight?: number;
|
|
50
|
+
}): BotmanorPageContext;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// src/utils/pageContext.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"new",
|
|
4
|
+
"register",
|
|
5
|
+
"routes",
|
|
6
|
+
"approvals",
|
|
7
|
+
"installed",
|
|
8
|
+
"publish"
|
|
9
|
+
]);
|
|
10
|
+
function t(e) {
|
|
11
|
+
try {
|
|
12
|
+
return decodeURIComponent(e);
|
|
13
|
+
} catch {
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function n(e) {
|
|
18
|
+
let t = e.split(/[?#]/)[0] || "/", n = (t.length > 1 ? t.replace(/\/+$/, "") : t).replace(/^\/(?:botmanor|botlit)(?=\/|$)/, "");
|
|
19
|
+
return n === "" ? "/" : n;
|
|
20
|
+
}
|
|
21
|
+
function r(e) {
|
|
22
|
+
let t = n(e);
|
|
23
|
+
return t === "/chat" || /^\/chat\/[^/]+$/.test(t) || /^\/agents\/[^/]+\/chat$/.test(t) || /^\/bots\/[^/]+\/agents\/[^/]+\/chat$/.test(t);
|
|
24
|
+
}
|
|
25
|
+
function i(r) {
|
|
26
|
+
let i = n(r), a = i.match(/^\/bots\/([^/]+)\/agents\/([^/]+)(?:\/(edit|chat|test))?$/);
|
|
27
|
+
if (a && !e.has(a[2])) {
|
|
28
|
+
let e = t(a[1]), n = t(a[2]), r = a[3];
|
|
29
|
+
return {
|
|
30
|
+
entityType: "agent",
|
|
31
|
+
entityId: n,
|
|
32
|
+
currentPage: `${r === "edit" ? "Edit Bot Agent" : r === "chat" ? "Bot Agent Chat" : "Bot Agent Detail"} (bot:${e})`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
let o = i.match(/^\/bots\/([^/]+)\/knowledge\/([^/]+)$/);
|
|
36
|
+
if (o && !e.has(o[2])) {
|
|
37
|
+
let e = t(o[1]);
|
|
38
|
+
return {
|
|
39
|
+
entityType: "knowledgeBase",
|
|
40
|
+
entityId: t(o[2]),
|
|
41
|
+
currentPage: `Bot Knowledge Base (bot:${e})`
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
let s = i.match(/^\/store\/package\/(.+)$/);
|
|
45
|
+
if (s && s[1]) return {
|
|
46
|
+
entityType: "storePackage",
|
|
47
|
+
entityId: t(s[1]),
|
|
48
|
+
currentPage: "Store Package Detail"
|
|
49
|
+
};
|
|
50
|
+
for (let { regex: n, entityType: r, pageLabel: a } of [
|
|
51
|
+
{
|
|
52
|
+
regex: /^\/bots\/([^/]+)(?:\/(?:edit|agents|knowledge))?$/,
|
|
53
|
+
entityType: "botApp",
|
|
54
|
+
pageLabel: "Bot Detail"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
regex: /^\/agents\/([^/]+)(?:\/(?:edit|test|chat))?$/,
|
|
58
|
+
entityType: "agent",
|
|
59
|
+
pageLabel: "Agent Detail"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
regex: /^\/chat\/([^/]+)$/,
|
|
63
|
+
entityType: "agent",
|
|
64
|
+
pageLabel: "Agent Chat"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
regex: /^\/knowledge\/([^/]+)$/,
|
|
68
|
+
entityType: "knowledgeBase",
|
|
69
|
+
pageLabel: "Knowledge Base Detail"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
regex: /^\/retrieval-profiles\/([^/]+)$/,
|
|
73
|
+
entityType: "retrievalProfile",
|
|
74
|
+
pageLabel: "Retrieval Profile Detail"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
regex: /^\/mcp\/([^/]+)$/,
|
|
78
|
+
entityType: "mcpConnection",
|
|
79
|
+
pageLabel: "MCP Server Detail"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
regex: /^\/a2a\/([^/]+)$/,
|
|
83
|
+
entityType: "a2aAgent",
|
|
84
|
+
pageLabel: "A2A Agent Detail"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
regex: /^\/channels\/([^/]+)$/,
|
|
88
|
+
entityType: "channelConnector",
|
|
89
|
+
pageLabel: "Channel Detail"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
regex: /^\/policies\/([^/]+)$/,
|
|
93
|
+
entityType: "policy",
|
|
94
|
+
pageLabel: "Policy Detail"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
regex: /^\/skills\/([^/]+)$/,
|
|
98
|
+
entityType: "skill",
|
|
99
|
+
pageLabel: "Skill Detail"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
regex: /^\/prompt-templates\/([^/]+)$/,
|
|
103
|
+
entityType: "promptTemplate",
|
|
104
|
+
pageLabel: "Prompt Template Detail"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
regex: /^\/executions\/([^/]+)$/,
|
|
108
|
+
entityType: "execution",
|
|
109
|
+
pageLabel: "Execution Detail"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
regex: /^\/buckets\/([^/]+)$/,
|
|
113
|
+
entityType: "bucket",
|
|
114
|
+
pageLabel: "Bucket Detail"
|
|
115
|
+
}
|
|
116
|
+
]) {
|
|
117
|
+
let o = i.match(n);
|
|
118
|
+
if (o && o[1] && !e.has(o[1])) return {
|
|
119
|
+
entityType: r,
|
|
120
|
+
entityId: t(o[1]),
|
|
121
|
+
currentPage: a
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
for (let [e, t] of [
|
|
125
|
+
[/^\/$/, "Dashboard"],
|
|
126
|
+
[/^\/bots\/new$/, "New Bot"],
|
|
127
|
+
[/^\/bots$/, "Bots"],
|
|
128
|
+
[/^\/agents\/new$/, "New Agent"],
|
|
129
|
+
[/^\/agents\/approvals$/, "Agent Approvals"],
|
|
130
|
+
[/^\/agents$/, "Agents"],
|
|
131
|
+
[/^\/approvals$/, "Tool Approvals"],
|
|
132
|
+
[/^\/knowledge\/new$/, "New Knowledge Base"],
|
|
133
|
+
[/^\/knowledge$/, "Knowledge Bases"],
|
|
134
|
+
[/^\/retrieval-profiles\/new$/, "New Retrieval Profile"],
|
|
135
|
+
[/^\/retrieval-profiles$/, "Retrieval Profiles"],
|
|
136
|
+
[/^\/mcp\/new$/, "New MCP Server"],
|
|
137
|
+
[/^\/mcp$/, "MCP Servers"],
|
|
138
|
+
[/^\/a2a\/register$/, "Register A2A Agent"],
|
|
139
|
+
[/^\/a2a$/, "A2A Registry"],
|
|
140
|
+
[/^\/channels\/new$/, "New Channel"],
|
|
141
|
+
[/^\/channels\/routes$/, "Channel Routes"],
|
|
142
|
+
[/^\/channels$/, "Channels"],
|
|
143
|
+
[/^\/policies\/new$/, "New Policy"],
|
|
144
|
+
[/^\/policies$/, "Policies"],
|
|
145
|
+
[/^\/skills\/new$/, "New Skill"],
|
|
146
|
+
[/^\/skills$/, "Skills"],
|
|
147
|
+
[/^\/prompt-templates\/new$/, "New Prompt Template"],
|
|
148
|
+
[/^\/prompt-templates$/, "Prompt Templates"],
|
|
149
|
+
[/^\/prompts$/, "Prompt Studio"],
|
|
150
|
+
[/^\/executions$/, "Executions"],
|
|
151
|
+
[/^\/ai$/, "AI Operations"],
|
|
152
|
+
[/^\/handoffs$/, "Human Handoffs"],
|
|
153
|
+
[/^\/buckets\/new$/, "New Bucket"],
|
|
154
|
+
[/^\/buckets$/, "Buckets"],
|
|
155
|
+
[/^\/store\/installed$/, "Installed Packages"],
|
|
156
|
+
[/^\/store\/publish$/, "Publish to Store"],
|
|
157
|
+
[/^\/store$/, "Store"],
|
|
158
|
+
[/^\/chat$/, "Bot Chat"],
|
|
159
|
+
[/^\/settings$/, "BotManor Settings"]
|
|
160
|
+
]) if (e.test(i)) return {
|
|
161
|
+
entityType: null,
|
|
162
|
+
entityId: null,
|
|
163
|
+
currentPage: t
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
entityType: null,
|
|
167
|
+
entityId: null,
|
|
168
|
+
currentPage: "BotManor"
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function a(e) {
|
|
172
|
+
let t = e ?? (typeof window < "u" ? window.location.pathname : null);
|
|
173
|
+
return t ? i(t).currentPage : null;
|
|
174
|
+
}
|
|
175
|
+
function o(e) {
|
|
176
|
+
let t = e?.pathname ?? (typeof window < "u" ? window.location.pathname : "/"), n = e?.href ?? (typeof window < "u" ? window.location.href : ""), r = `${e?.innerWidth ?? (typeof window < "u" ? window.innerWidth : 0)}x${e?.innerHeight ?? (typeof window < "u" ? window.innerHeight : 0)}`, a = i(t);
|
|
177
|
+
return {
|
|
178
|
+
currentUrl: n,
|
|
179
|
+
currentPage: a.currentPage,
|
|
180
|
+
...a.entityType && a.entityId ? {
|
|
181
|
+
entityType: a.entityType,
|
|
182
|
+
entityId: a.entityId
|
|
183
|
+
} : {},
|
|
184
|
+
platform: "web",
|
|
185
|
+
version: "1.0.0",
|
|
186
|
+
viewportSize: r
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export { a as describeCurrentPage, o as gatherPageContext, r as isBotmanorChatRoute, i as resolveBotmanorEntityContext };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=pageContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageContext.js","names":["RESERVED_SEGMENTS","decodeSegment","raw","stripProductPrefix","clean","pathname","stripped","isBotmanorChatRoute","sub","resolveBotmanorEntityContext","botAgentMatch","botId","agentId","leaf","botKbMatch","storePkgMatch","match","regex","pageLabel","pattern","label","describeCurrentPage","path","gatherPageContext","override","currentUrl","viewportSize","resolved"],"sources":["../../src/utils/pageContext.ts"],"sourcesContent":["/**\n * BotManor pageContext builder for the shared AI Assistant (BOFF-3788).\n *\n * Emits strictly the agent's allow-listed keys (`currentUrl`, `currentPage`,\n * `entityType`, `entityId`, `platform`, `version`, `viewportSize`). Never\n * emits `activeUrl`, `userAgent`, `timestamp`, or secrets.\n */\n\nexport type BotmanorEntityType =\n | 'botApp'\n | 'agent'\n | 'knowledgeBase'\n | 'retrievalProfile'\n | 'mcpConnection'\n | 'a2aAgent'\n | 'channelConnector'\n | 'policy'\n | 'skill'\n | 'promptTemplate'\n | 'execution'\n | 'bucket'\n | 'storePackage';\n\nexport type BotmanorEntityContext = {\n entityType: BotmanorEntityType | null;\n entityId: string | null;\n currentPage: string;\n};\n\n/**\n * Type alias (not interface) so it remains assignable to fe-libs' `PageContext`\n * index signature without TS2322.\n */\nexport type BotmanorPageContext = {\n currentUrl: string;\n currentPage: string;\n entityType?: BotmanorEntityType;\n entityId?: string;\n platform: 'web';\n version: string;\n viewportSize: string;\n};\n\nconst RESERVED_SEGMENTS = new Set([\n 'new',\n 'register',\n 'routes',\n 'approvals',\n 'installed',\n 'publish',\n]);\n\nfunction decodeSegment(raw: string): string {\n try {\n return decodeURIComponent(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * Strip the `/botmanor` or legacy `/botlit` mount prefix and normalize trailing slashes.\n */\nfunction stripProductPrefix(pathname: string): string {\n const clean = pathname.split(/[?#]/)[0] || '/';\n const withoutTrailing = clean.length > 1 ? clean.replace(/\\/+$/, '') : clean;\n const stripped = withoutTrailing.replace(/^\\/(?:botmanor|botlit)(?=\\/|$)/, '');\n return stripped === '' ? '/' : stripped;\n}\n\n/**\n * True when the user is on BotManor's own agent chat surface, where the\n * floating platform Assistant FAB should stay out of the composer's way.\n */\nexport function isBotmanorChatRoute(pathname: string): boolean {\n const sub = stripProductPrefix(pathname);\n return (\n sub === '/chat' ||\n /^\\/chat\\/[^/]+$/.test(sub) ||\n /^\\/agents\\/[^/]+\\/chat$/.test(sub) ||\n /^\\/bots\\/[^/]+\\/agents\\/[^/]+\\/chat$/.test(sub)\n );\n}\n\n/**\n * Resolve a BotManor route into its innermost entity (`entityType`, `entityId`)\n * and a concise `currentPage` label. Nested routes resolve the innermost entity\n * (e.g. `/botmanor/bots/:botId/agents/:agentId` -> `agent` / `:agentId`).\n */\nexport function resolveBotmanorEntityContext(pathname: string): BotmanorEntityContext {\n const sub = stripProductPrefix(pathname);\n\n // Nested routes first so innermost entity always wins.\n const botAgentMatch = sub.match(/^\\/bots\\/([^/]+)\\/agents\\/([^/]+)(?:\\/(edit|chat|test))?$/);\n if (botAgentMatch && !RESERVED_SEGMENTS.has(botAgentMatch[2])) {\n const botId = decodeSegment(botAgentMatch[1]);\n const agentId = decodeSegment(botAgentMatch[2]);\n const leaf = botAgentMatch[3];\n const pageLabel =\n leaf === 'edit' ? 'Edit Bot Agent' : leaf === 'chat' ? 'Bot Agent Chat' : 'Bot Agent Detail';\n return {\n entityType: 'agent',\n entityId: agentId,\n currentPage: `${pageLabel} (bot:${botId})`,\n };\n }\n\n const botKbMatch = sub.match(/^\\/bots\\/([^/]+)\\/knowledge\\/([^/]+)$/);\n if (botKbMatch && !RESERVED_SEGMENTS.has(botKbMatch[2])) {\n const botId = decodeSegment(botKbMatch[1]);\n return {\n entityType: 'knowledgeBase',\n entityId: decodeSegment(botKbMatch[2]),\n currentPage: `Bot Knowledge Base (bot:${botId})`,\n };\n }\n\n const storePkgMatch = sub.match(/^\\/store\\/package\\/(.+)$/);\n if (storePkgMatch && storePkgMatch[1]) {\n return {\n entityType: 'storePackage',\n entityId: decodeSegment(storePkgMatch[1]),\n currentPage: 'Store Package Detail',\n };\n }\n\n const directPatterns: ReadonlyArray<{\n regex: RegExp;\n entityType: BotmanorEntityType;\n pageLabel: string;\n }> = [\n {\n regex: /^\\/bots\\/([^/]+)(?:\\/(?:edit|agents|knowledge))?$/,\n entityType: 'botApp',\n pageLabel: 'Bot Detail',\n },\n {\n regex: /^\\/agents\\/([^/]+)(?:\\/(?:edit|test|chat))?$/,\n entityType: 'agent',\n pageLabel: 'Agent Detail',\n },\n { regex: /^\\/chat\\/([^/]+)$/, entityType: 'agent', pageLabel: 'Agent Chat' },\n {\n regex: /^\\/knowledge\\/([^/]+)$/,\n entityType: 'knowledgeBase',\n pageLabel: 'Knowledge Base Detail',\n },\n {\n regex: /^\\/retrieval-profiles\\/([^/]+)$/,\n entityType: 'retrievalProfile',\n pageLabel: 'Retrieval Profile Detail',\n },\n { regex: /^\\/mcp\\/([^/]+)$/, entityType: 'mcpConnection', pageLabel: 'MCP Server Detail' },\n { regex: /^\\/a2a\\/([^/]+)$/, entityType: 'a2aAgent', pageLabel: 'A2A Agent Detail' },\n { regex: /^\\/channels\\/([^/]+)$/, entityType: 'channelConnector', pageLabel: 'Channel Detail' },\n { regex: /^\\/policies\\/([^/]+)$/, entityType: 'policy', pageLabel: 'Policy Detail' },\n { regex: /^\\/skills\\/([^/]+)$/, entityType: 'skill', pageLabel: 'Skill Detail' },\n {\n regex: /^\\/prompt-templates\\/([^/]+)$/,\n entityType: 'promptTemplate',\n pageLabel: 'Prompt Template Detail',\n },\n { regex: /^\\/executions\\/([^/]+)$/, entityType: 'execution', pageLabel: 'Execution Detail' },\n { regex: /^\\/buckets\\/([^/]+)$/, entityType: 'bucket', pageLabel: 'Bucket Detail' },\n ];\n\n for (const { regex, entityType, pageLabel } of directPatterns) {\n const match = sub.match(regex);\n if (match && match[1] && !RESERVED_SEGMENTS.has(match[1])) {\n return {\n entityType,\n entityId: decodeSegment(match[1]),\n currentPage: pageLabel,\n };\n }\n }\n\n const staticPages: ReadonlyArray<[RegExp, string]> = [\n [/^\\/$/, 'Dashboard'],\n [/^\\/bots\\/new$/, 'New Bot'],\n [/^\\/bots$/, 'Bots'],\n [/^\\/agents\\/new$/, 'New Agent'],\n [/^\\/agents\\/approvals$/, 'Agent Approvals'],\n [/^\\/agents$/, 'Agents'],\n [/^\\/approvals$/, 'Tool Approvals'],\n [/^\\/knowledge\\/new$/, 'New Knowledge Base'],\n [/^\\/knowledge$/, 'Knowledge Bases'],\n [/^\\/retrieval-profiles\\/new$/, 'New Retrieval Profile'],\n [/^\\/retrieval-profiles$/, 'Retrieval Profiles'],\n [/^\\/mcp\\/new$/, 'New MCP Server'],\n [/^\\/mcp$/, 'MCP Servers'],\n [/^\\/a2a\\/register$/, 'Register A2A Agent'],\n [/^\\/a2a$/, 'A2A Registry'],\n [/^\\/channels\\/new$/, 'New Channel'],\n [/^\\/channels\\/routes$/, 'Channel Routes'],\n [/^\\/channels$/, 'Channels'],\n [/^\\/policies\\/new$/, 'New Policy'],\n [/^\\/policies$/, 'Policies'],\n [/^\\/skills\\/new$/, 'New Skill'],\n [/^\\/skills$/, 'Skills'],\n [/^\\/prompt-templates\\/new$/, 'New Prompt Template'],\n [/^\\/prompt-templates$/, 'Prompt Templates'],\n [/^\\/prompts$/, 'Prompt Studio'],\n [/^\\/executions$/, 'Executions'],\n [/^\\/ai$/, 'AI Operations'],\n [/^\\/handoffs$/, 'Human Handoffs'],\n [/^\\/buckets\\/new$/, 'New Bucket'],\n [/^\\/buckets$/, 'Buckets'],\n [/^\\/store\\/installed$/, 'Installed Packages'],\n [/^\\/store\\/publish$/, 'Publish to Store'],\n [/^\\/store$/, 'Store'],\n [/^\\/chat$/, 'Bot Chat'],\n [/^\\/settings$/, 'BotManor Settings'],\n ];\n\n for (const [pattern, label] of staticPages) {\n if (pattern.test(sub)) {\n return { entityType: null, entityId: null, currentPage: label };\n }\n }\n\n return { entityType: null, entityId: null, currentPage: 'BotManor' };\n}\n\n/** Human-readable label for the Assistant panel header (\"Context: ...\"). */\nexport function describeCurrentPage(pathname?: string): string | null {\n const path = pathname ?? (typeof window !== 'undefined' ? window.location.pathname : null);\n if (!path) return null;\n return resolveBotmanorEntityContext(path).currentPage;\n}\n\n/**\n * Gather the allow-listed `PageContext` sent with every AI Assistant turn.\n * Emits ONLY: `currentUrl`, `currentPage`, optional `entityType` & `entityId`,\n * `platform`, `version`, `viewportSize`.\n */\nexport function gatherPageContext(override?: {\n href?: string;\n pathname?: string;\n innerWidth?: number;\n innerHeight?: number;\n}): BotmanorPageContext {\n const pathname =\n override?.pathname ?? (typeof window !== 'undefined' ? window.location.pathname : '/');\n const currentUrl = override?.href ?? (typeof window !== 'undefined' ? window.location.href : '');\n const width = override?.innerWidth ?? (typeof window !== 'undefined' ? window.innerWidth : 0);\n const height = override?.innerHeight ?? (typeof window !== 'undefined' ? window.innerHeight : 0);\n const viewportSize = `${width}x${height}`;\n const resolved = resolveBotmanorEntityContext(pathname);\n\n return {\n currentUrl,\n currentPage: resolved.currentPage,\n ...(resolved.entityType && resolved.entityId\n ? { entityType: resolved.entityType, entityId: resolved.entityId }\n : {}),\n platform: 'web',\n version: '1.0.0',\n viewportSize,\n };\n}\n"],"mappings":";AA2CA,IAAMA,oBAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAASC,EAAc,GAAqB;CAC1C,IAAI;EACF,OAAO,mBAAmBC,CAAG;CAC/B,QAAQ;EACN,OAAOA;CACT;AACF;AAKA,SAASC,EAAmB,GAA0B;CACpD,IAAMC,IAAQC,EAAS,MAAM,MAAM,CAAC,CAAC,MAAM,KAErCC,KADkBF,EAAM,SAAS,IAAIA,EAAM,QAAQ,QAAQ,EAAE,IAAIA,EAAA,CACtC,QAAQ,kCAAkC,EAAE;CAC7E,OAAOE,MAAa,KAAK,MAAMA;AACjC;AAMA,SAAgBC,EAAoB,GAA2B;CAC7D,IAAMC,IAAML,EAAmBE,CAAQ;CACvC,OACEG,MAAQ,WACR,kBAAkB,KAAKA,CAAG,KAC1B,0BAA0B,KAAKA,CAAG,KAClC,uCAAuC,KAAKA,CAAG;AAEnD;AAOA,SAAgBC,EAA6B,GAAyC;CACpF,IAAMD,IAAML,EAAmBE,CAAQ,GAGjCK,IAAgBF,EAAI,MAAM,2DAA2D;CAC3F,IAAIE,KAAiB,CAACV,EAAkB,IAAIU,EAAc,EAAE,GAAG;EAC7D,IAAMC,IAAQV,EAAcS,EAAc,EAAE,GACtCE,IAAUX,EAAcS,EAAc,EAAE,GACxCG,IAAOH,EAAc;EAG3B,OAAO;GACL,YAAY;GACZ,UAAUE;GACV,aAAa,GAJbC,MAAS,SAAS,mBAAmBA,MAAS,SAAS,mBAAmB,mBAIhD,QAAQF,EAAM;EAC1C;CACF;CAEA,IAAMG,IAAaN,EAAI,MAAM,uCAAuC;CACpE,IAAIM,KAAc,CAACd,EAAkB,IAAIc,EAAW,EAAE,GAAG;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