@elevasis/ui 2.25.5 → 2.26.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.
Files changed (101) hide show
  1. package/dist/api/index.js +2 -2
  2. package/dist/app/index.css +18 -29
  3. package/dist/app/index.d.ts +118 -64
  4. package/dist/app/index.js +6 -5
  5. package/dist/charts/index.js +6 -5
  6. package/dist/chunk-3MEXPLWT.js +265 -0
  7. package/dist/{chunk-IS53MXE4.js → chunk-4KTLOK7K.js} +1 -1
  8. package/dist/{chunk-KMAXFJPH.js → chunk-CW3UNAF2.js} +5 -409
  9. package/dist/{chunk-HKBEURCV.js → chunk-G26INIF3.js} +1 -1
  10. package/dist/{chunk-NHHCUECV.js → chunk-G66QFZXD.js} +11 -214
  11. package/dist/{chunk-QIW6OCEI.js → chunk-HLFFKKT3.js} +27 -373
  12. package/dist/chunk-JDNEWB5F.js +10 -0
  13. package/dist/{chunk-VMAWXEVG.js → chunk-JKBGDFX2.js} +1136 -828
  14. package/dist/{chunk-MU4VPAMR.js → chunk-JPGX3533.js} +4 -3
  15. package/dist/chunk-KCGGA36K.js +73 -0
  16. package/dist/chunk-KEFWANZY.js +155 -0
  17. package/dist/chunk-LH4GPYDX.js +448 -0
  18. package/dist/{chunk-QNCVK3ZF.js → chunk-LWKZ3BCC.js} +5 -4
  19. package/dist/chunk-OGXKOMUT.js +412 -0
  20. package/dist/chunk-OHXU5WWK.js +3731 -0
  21. package/dist/chunk-ONFKASZI.js +2004 -0
  22. package/dist/{chunk-U36X6NZM.js → chunk-RIFTUOPE.js} +2 -14
  23. package/dist/{chunk-T6INEVX6.js → chunk-SGS4CQ2B.js} +1 -1
  24. package/dist/{chunk-KINQW4JT.js → chunk-UPMX5GJI.js} +5 -5
  25. package/dist/{chunk-N2AP4I5N.js → chunk-UY5I2KOZ.js} +223 -3857
  26. package/dist/{chunk-JMI7L7Y7.js → chunk-W2ZTLH7Y.js} +142 -4
  27. package/dist/{chunk-3KY2GNPE.js → chunk-WUVR4QY6.js} +9 -9
  28. package/dist/{chunk-Q5BEODAT.js → chunk-X2SUMO3P.js} +2 -1
  29. package/dist/{chunk-SNHGSCKH.js → chunk-XBMCDGHA.js} +1 -1
  30. package/dist/{chunk-N55DVMAG.js → chunk-XQQEKWTL.js} +2 -6
  31. package/dist/{chunk-F7JDHS2I.js → chunk-XZSEPJZQ.js} +5 -5
  32. package/dist/{chunk-5BJXMZN4.js → chunk-YHBPR67D.js} +438 -620
  33. package/dist/{chunk-FVKLHLF4.js → chunk-YO2YORW4.js} +4 -4
  34. package/dist/{chunk-TAIX4NO3.js → chunk-ZFLM2YVW.js} +2 -2
  35. package/dist/components/index.css +18 -29
  36. package/dist/components/index.d.ts +211 -383
  37. package/dist/components/index.js +43 -427
  38. package/dist/components/navigation/index.css +28 -39
  39. package/dist/execution/index.d.ts +0 -73
  40. package/dist/features/auth/index.css +28 -39
  41. package/dist/features/crm/index.css +28 -39
  42. package/dist/features/crm/index.d.ts +49 -49
  43. package/dist/features/crm/index.js +14 -14
  44. package/dist/features/dashboard/index.css +28 -39
  45. package/dist/features/dashboard/index.js +18 -15
  46. package/dist/features/delivery/index.css +18 -29
  47. package/dist/features/delivery/index.js +14 -14
  48. package/dist/features/knowledge/index.css +611 -0
  49. package/dist/features/knowledge/index.js +700 -1
  50. package/dist/features/lead-gen/index.css +28 -39
  51. package/dist/features/lead-gen/index.d.ts +212 -166
  52. package/dist/features/lead-gen/index.js +16 -15
  53. package/dist/features/monitoring/index.css +18 -29
  54. package/dist/features/monitoring/index.js +17 -16
  55. package/dist/features/monitoring/requests/index.css +28 -39
  56. package/dist/features/monitoring/requests/index.js +13 -13
  57. package/dist/features/operations/index.css +28 -39
  58. package/dist/features/operations/index.d.ts +16 -98
  59. package/dist/features/operations/index.js +26 -20
  60. package/dist/features/settings/index.css +28 -39
  61. package/dist/features/settings/index.d.ts +1 -0
  62. package/dist/features/settings/index.js +15 -15
  63. package/dist/hooks/delivery/index.css +28 -39
  64. package/dist/hooks/delivery/index.js +2 -2
  65. package/dist/hooks/index.css +18 -29
  66. package/dist/hooks/index.d.ts +180 -377
  67. package/dist/hooks/index.js +13 -13
  68. package/dist/hooks/published.css +18 -29
  69. package/dist/hooks/published.d.ts +180 -377
  70. package/dist/hooks/published.js +13 -13
  71. package/dist/index.css +18 -29
  72. package/dist/index.d.ts +1549 -946
  73. package/dist/index.js +15 -14
  74. package/dist/initialization/index.d.ts +1 -0
  75. package/dist/knowledge/index.d.ts +991 -41
  76. package/dist/knowledge/index.js +5469 -413
  77. package/dist/layout/index.d.ts +2 -0
  78. package/dist/layout/index.js +3 -2
  79. package/dist/organization/index.css +28 -39
  80. package/dist/organization/index.d.ts +1 -0
  81. package/dist/provider/index.css +28 -39
  82. package/dist/provider/index.d.ts +1147 -348
  83. package/dist/provider/index.js +11 -10
  84. package/dist/provider/published.css +28 -39
  85. package/dist/provider/published.d.ts +1146 -347
  86. package/dist/provider/published.js +8 -8
  87. package/dist/test-utils/index.js +2 -2
  88. package/dist/test-utils/setup.js +1 -1
  89. package/dist/theme/index.js +3 -2
  90. package/dist/theme/presets/index.d.ts +97 -0
  91. package/dist/theme/presets/index.js +3 -0
  92. package/dist/types/index.d.ts +71 -126
  93. package/dist/utils/index.js +1 -1
  94. package/dist/vite/index.d.ts +7 -0
  95. package/dist/vite/index.js +10 -0
  96. package/dist/vite-plugin-knowledge/index.d.ts +1 -33
  97. package/dist/vite-plugin-knowledge/index.js +1 -66
  98. package/package.json +46 -33
  99. package/src/knowledge/README.md +8 -8
  100. package/src/theme/presets/README.md +19 -0
  101. /package/dist/{chunk-SGXXJE52.js → chunk-QD4X4H5A.js} +0 -0
@@ -1,10 +1,709 @@
1
+ import { KnowledgeSearchBar, KnowledgeTree, getKnowledgeIconToken, byKind } from '../../chunk-ONFKASZI.js';
2
+ import { CommandViewSidebarContent, OrganizationModelSchema, buildOrganizationGraph, DEFAULT_ORGANIZATION_MODEL_OPERATIONS, DEFAULT_ORGANIZATION_MODEL_STATUSES, DEFAULT_ORGANIZATION_MODEL_GOALS, DEFAULT_ORGANIZATION_MODEL_ROLES, DEFAULT_ORGANIZATION_MODEL_OFFERINGS, DEFAULT_ORGANIZATION_MODEL_CUSTOMERS, DEFAULT_ORGANIZATION_MODEL_IDENTITY, DEFAULT_ORGANIZATION_MODEL_PROJECTS, DEFAULT_ORGANIZATION_MODEL_BRANDING } from '../../chunk-OHXU5WWK.js';
3
+ import '../../chunk-ZTWA5H77.js';
4
+ import { SemanticIcon } from '../../chunk-KEFWANZY.js';
5
+ import '../../chunk-XQQEKWTL.js';
1
6
  import { KNOWLEDGE_FEATURE_ID } from '../../chunk-ECNNI3NT.js';
7
+ import { DEFAULT_ORGANIZATION_MODEL_PROSPECTING } from '../../chunk-4KTLOK7K.js';
8
+ import '../../chunk-CW3UNAF2.js';
9
+ import { SubshellSidebarSection } from '../../chunk-IIMU5YAJ.js';
10
+ import '../../chunk-7M2VOCYN.js';
11
+ import '../../chunk-YHBPR67D.js';
12
+ import '../../chunk-VKMNWHTL.js';
13
+ import '../../chunk-G26INIF3.js';
14
+ import '../../chunk-BRXELOHC.js';
15
+ import '../../chunk-3ZMAGTWF.js';
16
+ import '../../chunk-VMJVQAFZ.js';
17
+ import '../../chunk-JPGX3533.js';
18
+ import '../../chunk-LH4GPYDX.js';
19
+ import '../../chunk-HLFFKKT3.js';
20
+ import '../../chunk-WLOQ4IBG.js';
21
+ import '../../chunk-ZFLM2YVW.js';
22
+ import '../../chunk-RIFTUOPE.js';
23
+ import '../../chunk-3KMDHCAR.js';
24
+ import { DEFAULT_ORGANIZATION_MODEL_SALES } from '../../chunk-W2ZTLH7Y.js';
25
+ import '../../chunk-SZHARWKU.js';
26
+ import { useElevasisFeatures } from '../../chunk-V3HUIZJX.js';
27
+ import '../../chunk-TKAYX2SP.js';
28
+ import '../../chunk-NYBEU5TE.js';
29
+ import '../../chunk-SGS4CQ2B.js';
30
+ import '../../chunk-2IFYDILW.js';
31
+ import { useRouterContext } from '../../chunk-Q7DJKLEN.js';
32
+ import '../../chunk-GESXCQWY.js';
33
+ import '../../chunk-HOIT677G.js';
34
+ import '../../chunk-E565XMTQ.js';
35
+ import '../../chunk-KU7ZDWQ7.js';
36
+ import '../../chunk-DT3QYZVU.js';
37
+ import '../../chunk-RNP5R5I3.js';
38
+ import '../../chunk-QD4X4H5A.js';
39
+ import '../../chunk-KRWALB24.js';
40
+ import '../../chunk-WFTNY755.js';
41
+ import '../../chunk-WKJ47GIW.js';
42
+ import '../../chunk-DD3CCMCZ.js';
43
+ import '../../chunk-XTVZFT7U.js';
44
+ import '../../chunk-5WWZXCS5.js';
45
+ import '../../chunk-BRJ3QZ4E.js';
2
46
  import '../../chunk-I2KLQ2HA.js';
47
+ import { IconBrain, IconCheck, IconCopy } from '@tabler/icons-react';
48
+ import { Stack, Box, SegmentedControl, Text, UnstyledButton, Group, Badge } from '@mantine/core';
49
+ import { useClipboard } from '@mantine/hooks';
50
+ import { useMemo, useState } from 'react';
51
+ import { jsx, jsxs } from 'react/jsx-runtime';
52
+
53
+ // ../core/src/organization-model/defaults.ts
54
+ var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {
55
+ nodes: []
56
+ };
57
+ var DEFAULT_ORGANIZATION_MODEL = {
58
+ version: 1,
59
+ features: [
60
+ {
61
+ id: "dashboard",
62
+ label: "Dashboard",
63
+ enabled: true,
64
+ path: "/",
65
+ icon: "feature.dashboard",
66
+ uiPosition: "sidebar-primary"
67
+ },
68
+ {
69
+ id: "identity",
70
+ label: "Identity",
71
+ description: "Company identity, positioning, and market context",
72
+ enabled: true,
73
+ color: "indigo"
74
+ },
75
+ {
76
+ id: "platform",
77
+ label: "Platform",
78
+ description: "Elevasis platform architecture, capabilities, and implementation patterns",
79
+ enabled: true,
80
+ color: "cyan",
81
+ icon: "feature.platform"
82
+ },
83
+ {
84
+ id: "finance",
85
+ label: "Finance",
86
+ description: "Finance operations, accounting, billing, reconciliation, and tax prep",
87
+ enabled: true,
88
+ color: "green",
89
+ icon: "feature.finance"
90
+ },
91
+ {
92
+ id: "sales",
93
+ label: "Sales",
94
+ description: "Revenue workflows and customer acquisition",
95
+ enabled: true,
96
+ color: "blue",
97
+ icon: "feature.sales",
98
+ uiPosition: "sidebar-primary"
99
+ },
100
+ {
101
+ id: "sales.crm",
102
+ label: "CRM",
103
+ description: "Relationship pipeline and deal management",
104
+ enabled: true,
105
+ color: "blue",
106
+ icon: "feature.crm",
107
+ path: "/crm"
108
+ },
109
+ {
110
+ id: "sales.lead-gen",
111
+ label: "Lead Gen",
112
+ description: "Prospecting, qualification, and outreach preparation",
113
+ enabled: true,
114
+ color: "cyan",
115
+ icon: "feature.lead-gen",
116
+ path: "/lead-gen"
117
+ },
118
+ {
119
+ id: "projects",
120
+ label: "Projects",
121
+ description: "Projects, milestones, and client work execution",
122
+ enabled: true,
123
+ color: "orange",
124
+ icon: "feature.projects",
125
+ path: "/projects",
126
+ uiPosition: "sidebar-primary"
127
+ },
128
+ {
129
+ id: "operations",
130
+ label: "Operations",
131
+ description: "Operational resources, topology, and orchestration visibility",
132
+ enabled: true,
133
+ color: "violet",
134
+ icon: "feature.operations",
135
+ uiPosition: "sidebar-primary"
136
+ },
137
+ {
138
+ id: "knowledge.command-view",
139
+ label: "Command View",
140
+ enabled: true,
141
+ path: "/knowledge/command-view",
142
+ devOnly: true
143
+ },
144
+ {
145
+ id: "operations.overview",
146
+ label: "Overview",
147
+ enabled: true,
148
+ path: "/operations"
149
+ },
150
+ {
151
+ id: "operations.resources",
152
+ label: "Resources",
153
+ enabled: true,
154
+ path: "/operations/resources"
155
+ },
156
+ {
157
+ id: "operations.command-queue",
158
+ label: "Command Queue",
159
+ enabled: true,
160
+ path: "/operations/command-queue"
161
+ },
162
+ {
163
+ id: "operations.sessions",
164
+ label: "Sessions",
165
+ enabled: false,
166
+ path: "/operations/sessions"
167
+ },
168
+ {
169
+ id: "operations.task-scheduler",
170
+ label: "Task Scheduler",
171
+ enabled: true,
172
+ path: "/operations/task-scheduler"
173
+ },
174
+ {
175
+ id: "monitoring",
176
+ label: "Monitoring",
177
+ enabled: true,
178
+ uiPosition: "sidebar-primary"
179
+ },
180
+ {
181
+ id: "monitoring.activity-log",
182
+ label: "Activity Log",
183
+ enabled: true,
184
+ path: "/monitoring/activity-log"
185
+ },
186
+ {
187
+ id: "monitoring.execution-logs",
188
+ label: "Execution Logs",
189
+ enabled: true,
190
+ path: "/monitoring/execution-logs"
191
+ },
192
+ {
193
+ id: "monitoring.execution-health",
194
+ label: "Execution Health",
195
+ enabled: true,
196
+ path: "/monitoring/execution-health"
197
+ },
198
+ {
199
+ id: "monitoring.cost-analytics",
200
+ label: "Cost Analytics",
201
+ enabled: false,
202
+ path: "/monitoring/cost-analytics"
203
+ },
204
+ {
205
+ id: "monitoring.notifications",
206
+ label: "Notifications",
207
+ enabled: true,
208
+ path: "/monitoring/notifications"
209
+ },
210
+ {
211
+ id: "monitoring.submitted-requests",
212
+ label: "Submitted Requests",
213
+ enabled: true,
214
+ path: "/monitoring/requests"
215
+ },
216
+ {
217
+ id: "settings",
218
+ label: "Settings",
219
+ enabled: true,
220
+ icon: "feature.settings",
221
+ uiPosition: "sidebar-bottom"
222
+ },
223
+ {
224
+ id: "settings.account",
225
+ label: "Account",
226
+ enabled: true,
227
+ path: "/settings/account"
228
+ },
229
+ {
230
+ id: "settings.appearance",
231
+ label: "Appearance",
232
+ enabled: true,
233
+ path: "/settings/appearance"
234
+ },
235
+ {
236
+ id: "settings.roles",
237
+ label: "My Roles",
238
+ enabled: true,
239
+ path: "/settings/roles"
240
+ },
241
+ {
242
+ id: "settings.organization",
243
+ label: "Organization",
244
+ enabled: true,
245
+ path: "/settings/organization"
246
+ },
247
+ {
248
+ id: "settings.credentials",
249
+ label: "Credentials",
250
+ enabled: true,
251
+ path: "/settings/credentials"
252
+ },
253
+ {
254
+ id: "settings.api-keys",
255
+ label: "API Keys",
256
+ enabled: true,
257
+ path: "/settings/api-keys"
258
+ },
259
+ {
260
+ id: "settings.webhooks",
261
+ label: "Webhooks",
262
+ enabled: true,
263
+ path: "/settings/webhooks"
264
+ },
265
+ {
266
+ id: "settings.deployments",
267
+ label: "Deployments",
268
+ enabled: true,
269
+ path: "/settings/deployments"
270
+ },
271
+ {
272
+ id: "admin",
273
+ label: "Admin",
274
+ enabled: true,
275
+ path: "/admin",
276
+ icon: "feature.admin",
277
+ uiPosition: "sidebar-bottom",
278
+ requiresAdmin: true
279
+ },
280
+ {
281
+ id: "admin.system-health",
282
+ label: "System Health",
283
+ enabled: true,
284
+ path: "/admin/system-health"
285
+ },
286
+ {
287
+ id: "admin.organizations",
288
+ label: "Organizations",
289
+ enabled: true,
290
+ path: "/admin/organizations"
291
+ },
292
+ {
293
+ id: "admin.users",
294
+ label: "Users",
295
+ enabled: true,
296
+ path: "/admin/users"
297
+ },
298
+ {
299
+ id: "admin.design-showcase",
300
+ label: "Design Showcase",
301
+ enabled: true,
302
+ path: "/admin/design-showcase"
303
+ },
304
+ {
305
+ id: "admin.debug",
306
+ label: "Debug",
307
+ enabled: true,
308
+ path: "/admin/debug"
309
+ },
310
+ {
311
+ id: "archive",
312
+ label: "Archive",
313
+ enabled: true,
314
+ path: "/archive",
315
+ icon: "feature.archive",
316
+ uiPosition: "sidebar-bottom",
317
+ devOnly: true
318
+ },
319
+ {
320
+ id: "archive.agent-chat",
321
+ label: "Agent Chat",
322
+ enabled: true,
323
+ path: "/archive/agent-chat"
324
+ },
325
+ {
326
+ id: "archive.execution-runner",
327
+ label: "Execution Runner",
328
+ enabled: true,
329
+ path: "/archive/execution-runner"
330
+ },
331
+ {
332
+ id: "seo",
333
+ label: "SEO",
334
+ enabled: false,
335
+ path: "/seo"
336
+ },
337
+ {
338
+ id: "knowledge",
339
+ label: "Knowledge",
340
+ description: "Operational knowledge, playbooks, and strategy docs",
341
+ enabled: true,
342
+ color: "teal",
343
+ icon: "feature.knowledge",
344
+ uiPosition: "sidebar-primary"
345
+ },
346
+ {
347
+ id: "knowledge.base",
348
+ label: "Knowledge Base",
349
+ enabled: true,
350
+ path: "/knowledge"
351
+ }
352
+ ],
353
+ branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
354
+ navigation: { surfaces: [], groups: [] },
355
+ sales: DEFAULT_ORGANIZATION_MODEL_SALES,
356
+ prospecting: DEFAULT_ORGANIZATION_MODEL_PROSPECTING,
357
+ projects: DEFAULT_ORGANIZATION_MODEL_PROJECTS,
358
+ identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
359
+ customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
360
+ offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
361
+ roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
362
+ goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
363
+ statuses: DEFAULT_ORGANIZATION_MODEL_STATUSES,
364
+ operations: DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
365
+ knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
366
+ };
367
+ function deepMerge(base, override) {
368
+ {
369
+ return base;
370
+ }
371
+ }
372
+ function resolveOrganizationModel(override, organizationId) {
373
+ const merged = deepMerge(DEFAULT_ORGANIZATION_MODEL);
374
+ const model = OrganizationModelSchema.parse(merged);
375
+ if (!model.sales?.pipelines || model.sales.pipelines.length === 0) {
376
+ const orgLabel = "Organization";
377
+ throw new Error(
378
+ `${orgLabel} has no sales pipeline configuration. This indicates an incomplete provisioning state. Run org provisioning to seed defaults.`
379
+ );
380
+ }
381
+ return model;
382
+ }
383
+ var SEGMENT_DATA = [
384
+ { label: "By Feature", value: "by-feature" },
385
+ { label: "By Kind", value: "by-kind" },
386
+ { label: "Config", value: "config" }
387
+ ];
388
+ var KnowledgeSidebarMiddle = () => {
389
+ const { navigate, currentPath } = useRouterContext();
390
+ const { timeRange = "30d", organizationModel } = useElevasisFeatures();
391
+ if (currentPath.startsWith("/knowledge/command-view")) {
392
+ return /* @__PURE__ */ jsx(CommandViewSidebarContent, { timeRange });
393
+ }
394
+ const orgModel = organizationModel ?? resolveOrganizationModel();
395
+ return /* @__PURE__ */ jsx(KnowledgeBaseSidebarBody, { navigate, currentPath, organizationModel: orgModel });
396
+ };
397
+ function KnowledgeBaseSidebarBody({ navigate, currentPath, organizationModel }) {
398
+ const knowledgeNodes = useMemo(() => organizationModel.knowledge.nodes, [organizationModel]);
399
+ const graph = useMemo(() => buildOrganizationGraph({ organizationModel }), [organizationModel]);
400
+ const [searchResults, setSearchResults] = useState(null);
401
+ const [axis, setAxis] = useState("by-feature");
402
+ const selectedNodeId = useMemo(() => {
403
+ const match = currentPath.match(/^\/knowledge\/([^/]+)/);
404
+ if (!match) return void 0;
405
+ const segment = match[1];
406
+ if (["by-feature", "by-kind", "config", "graph", "command-view"].includes(segment)) return void 0;
407
+ return segment;
408
+ }, [currentPath]);
409
+ const handleSelect = (node) => {
410
+ navigate(`/knowledge/${node.id}`);
411
+ };
412
+ const handleSelectGraphNode = (node) => {
413
+ navigate(`/knowledge/${node.id}`);
414
+ };
415
+ return /* @__PURE__ */ jsxs(Stack, { gap: 0, style: { flex: 1, overflow: "hidden", display: "flex", flexDirection: "column" }, children: [
416
+ /* @__PURE__ */ jsx(SubshellSidebarSection, { icon: IconBrain, label: "Knowledge", withTopBorder: false }),
417
+ /* @__PURE__ */ jsx(Box, { px: "sm", pt: "sm", pb: 0, children: /* @__PURE__ */ jsx(
418
+ SegmentedControl,
419
+ {
420
+ "data-testid": "knowledge-axis-control",
421
+ fullWidth: true,
422
+ size: "xs",
423
+ value: axis,
424
+ onChange: (v) => setAxis(v),
425
+ data: SEGMENT_DATA
426
+ }
427
+ ) }),
428
+ /* @__PURE__ */ jsx(Box, { p: "sm", pb: 0, children: /* @__PURE__ */ jsx(KnowledgeSearchBar, { knowledgeNodes, onResults: setSearchResults }) }),
429
+ /* @__PURE__ */ jsx(Stack, { gap: 0, style: { flex: 1, overflowY: "auto" }, children: searchResults ? /* @__PURE__ */ jsx(SearchResultsList, { searchResults, selectedNodeId, onSelect: handleSelect }) : /* @__PURE__ */ jsx(
430
+ AxisBody,
431
+ {
432
+ axis,
433
+ graph,
434
+ knowledgeNodes,
435
+ selectedNodeId,
436
+ onSelect: handleSelect,
437
+ onSelectGraphNode: handleSelectGraphNode
438
+ }
439
+ ) })
440
+ ] });
441
+ }
442
+ function SearchResultsList({ searchResults, selectedNodeId, onSelect }) {
443
+ if (searchResults.length === 0) {
444
+ return /* @__PURE__ */ jsx(Box, { p: "md", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No results." }) });
445
+ }
446
+ return /* @__PURE__ */ jsx(Stack, { gap: 2, p: "sm", children: searchResults.map((node) => {
447
+ const isActive = node.id === selectedNodeId;
448
+ return /* @__PURE__ */ jsx(NodeButton, { node, isActive, onSelect }, node.id);
449
+ }) });
450
+ }
451
+ function AxisBody({ axis, graph, knowledgeNodes, selectedNodeId, onSelect, onSelectGraphNode }) {
452
+ switch (axis) {
453
+ case "by-feature":
454
+ return /* @__PURE__ */ jsx(
455
+ KnowledgeTree,
456
+ {
457
+ graph,
458
+ knowledgeNodes,
459
+ onSelectNode: onSelect,
460
+ selectedNodeId
461
+ }
462
+ );
463
+ case "by-kind":
464
+ return /* @__PURE__ */ jsx(ByKindBody, { graph, knowledgeNodes, selectedNodeId, onSelect });
465
+ case "config":
466
+ return /* @__PURE__ */ jsx(ConfigBody, { graph, selectedNodeId, onSelect: onSelectGraphNode });
467
+ }
468
+ }
469
+ var KIND_ORDER = ["playbook", "strategy", "reference"];
470
+ var KIND_LABELS = {
471
+ playbook: "Playbook",
472
+ strategy: "Strategy",
473
+ reference: "Reference"
474
+ };
475
+ function ByKindBody({ graph, knowledgeNodes, selectedNodeId, onSelect }) {
476
+ const groups = useMemo(() => {
477
+ return KIND_ORDER.map((kind) => ({
478
+ kind,
479
+ nodes: byKind(graph, kind, knowledgeNodes)
480
+ })).filter((g) => g.nodes.length > 0);
481
+ }, [graph, knowledgeNodes]);
482
+ if (groups.length === 0) {
483
+ return /* @__PURE__ */ jsx(Box, { p: "md", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No knowledge nodes." }) });
484
+ }
485
+ return /* @__PURE__ */ jsx(Stack, { gap: "md", style: { padding: "var(--mantine-spacing-sm)" }, children: groups.map(({ kind, nodes }) => /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
486
+ /* @__PURE__ */ jsx(
487
+ GroupHeader,
488
+ {
489
+ label: KIND_LABELS[kind],
490
+ count: nodes.length,
491
+ command: getKnowledgeReadKindFolderCommand(kind)
492
+ }
493
+ ),
494
+ /* @__PURE__ */ jsx(Stack, { gap: 2, children: nodes.map((node) => /* @__PURE__ */ jsx(NodeButton, { node, isActive: node.id === selectedNodeId, onSelect }, node.id)) })
495
+ ] }, kind)) });
496
+ }
497
+ var CONFIG_KIND_ORDER = ["feature", "resource", "organization", "entity", "surface", "capability"];
498
+ var CONFIG_KIND_LABELS = {
499
+ feature: "Features",
500
+ resource: "Resources",
501
+ organization: "Organizations",
502
+ entity: "Entities",
503
+ surface: "Surfaces",
504
+ capability: "Capabilities"
505
+ };
506
+ function isSelectedConfigNode(selectedNodeId, node) {
507
+ if (!selectedNodeId) return false;
508
+ return selectedNodeId === node.id || selectedNodeId === node.sourceId || selectedNodeId === node.id.split(":")[1];
509
+ }
510
+ function ConfigBody({ graph, selectedNodeId, onSelect }) {
511
+ const groups = useMemo(() => {
512
+ const grouped = /* @__PURE__ */ new Map();
513
+ for (const node of graph.nodes) {
514
+ if (node.kind === "knowledge") continue;
515
+ const nodes = grouped.get(node.kind) ?? [];
516
+ nodes.push(node);
517
+ grouped.set(node.kind, nodes);
518
+ }
519
+ const knownGroups = CONFIG_KIND_ORDER.map((kind) => ({
520
+ kind,
521
+ label: CONFIG_KIND_LABELS[kind],
522
+ nodes: grouped.get(kind)?.sort((a, b) => a.label.localeCompare(b.label)) ?? []
523
+ })).filter((group) => group.nodes.length > 0);
524
+ const unknownGroups = Array.from(grouped.entries()).filter(([kind]) => !CONFIG_KIND_ORDER.includes(kind)).map(([kind, nodes]) => ({
525
+ kind,
526
+ label: CONFIG_KIND_LABELS[kind] ?? kind,
527
+ nodes: nodes.sort((a, b) => a.label.localeCompare(b.label))
528
+ })).sort((a, b) => a.label.localeCompare(b.label));
529
+ return [...knownGroups, ...unknownGroups];
530
+ }, [graph]);
531
+ if (groups.length === 0) {
532
+ return /* @__PURE__ */ jsx(Box, { p: "md", children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "No configuration nodes." }) });
533
+ }
534
+ return /* @__PURE__ */ jsx(Stack, { gap: "md", style: { padding: "var(--mantine-spacing-sm)" }, children: groups.map(({ kind, label, nodes }) => /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
535
+ /* @__PURE__ */ jsx(GroupHeader, { label, count: nodes.length }),
536
+ /* @__PURE__ */ jsx(Stack, { gap: 2, children: nodes.map((node) => /* @__PURE__ */ jsx(
537
+ ConfigNodeButton,
538
+ {
539
+ node,
540
+ isActive: isSelectedConfigNode(selectedNodeId, node),
541
+ onSelect
542
+ },
543
+ node.id
544
+ )) })
545
+ ] }, kind)) });
546
+ }
547
+ function GroupHeader({ label, count, command }) {
548
+ const [hovered, setHovered] = useState(false);
549
+ return /* @__PURE__ */ jsxs(Group, { gap: "xs", onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [
550
+ /* @__PURE__ */ jsx(Text, { size: "xs", fw: 600, tt: "uppercase", c: "dimmed", style: { letterSpacing: "0.05em" }, children: label }),
551
+ /* @__PURE__ */ jsx(TrailingCopySlot, { count, command, label: "Copy group knowledge commands", showCopy: hovered })
552
+ ] });
553
+ }
554
+ function NodeButton({ node, isActive, onSelect }) {
555
+ const [hovered, setHovered] = useState(false);
556
+ return /* @__PURE__ */ jsx(
557
+ UnstyledButton,
558
+ {
559
+ onClick: () => onSelect(node),
560
+ onMouseEnter: () => setHovered(true),
561
+ onMouseLeave: () => setHovered(false),
562
+ style: {
563
+ padding: "6px 10px",
564
+ borderRadius: "var(--mantine-radius-sm)",
565
+ backgroundColor: isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : hovered ? "var(--color-surface-hover)" : "transparent",
566
+ width: "100%",
567
+ textAlign: "left",
568
+ transition: "background-color var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing)"
569
+ },
570
+ children: /* @__PURE__ */ jsx(
571
+ Text,
572
+ {
573
+ size: "sm",
574
+ c: isActive ? "var(--color-primary)" : hovered ? "var(--color-text)" : void 0,
575
+ fw: isActive ? 600 : 400,
576
+ children: /* @__PURE__ */ jsxs(Group, { component: "span", gap: "xs", wrap: "nowrap", children: [
577
+ /* @__PURE__ */ jsx(
578
+ SemanticIcon,
579
+ {
580
+ token: getKnowledgeIconToken(node),
581
+ fallbackKind: node.kind,
582
+ size: 15,
583
+ style: {
584
+ color: isActive ? "var(--color-primary)" : hovered ? "var(--color-text)" : "var(--color-text-subtle)"
585
+ }
586
+ }
587
+ ),
588
+ /* @__PURE__ */ jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: node.title }),
589
+ /* @__PURE__ */ jsx(
590
+ CopyCommandControl,
591
+ {
592
+ command: getKnowledgeReadCommand(node.id),
593
+ label: "Copy knowledge command",
594
+ visible: hovered
595
+ }
596
+ )
597
+ ] })
598
+ }
599
+ )
600
+ }
601
+ );
602
+ }
603
+ function ConfigNodeButton({ node, isActive, onSelect }) {
604
+ return /* @__PURE__ */ jsx(
605
+ UnstyledButton,
606
+ {
607
+ onClick: () => onSelect(node),
608
+ style: {
609
+ padding: "6px 10px",
610
+ borderRadius: "var(--mantine-radius-sm)",
611
+ backgroundColor: isActive ? "color-mix(in srgb, var(--color-primary) 10%, transparent)" : "transparent",
612
+ width: "100%",
613
+ textAlign: "left"
614
+ },
615
+ children: /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
616
+ /* @__PURE__ */ jsx(
617
+ SemanticIcon,
618
+ {
619
+ token: node.icon,
620
+ fallbackKind: node.kind === "feature" ? "feature" : node.kind === "knowledge" ? "knowledge" : "unknown",
621
+ size: 15,
622
+ style: { color: isActive ? "var(--color-primary)" : "var(--color-text-subtle)" }
623
+ }
624
+ ),
625
+ /* @__PURE__ */ jsx(
626
+ Text,
627
+ {
628
+ size: "sm",
629
+ c: isActive ? "var(--color-primary)" : void 0,
630
+ fw: isActive ? 600 : 400,
631
+ style: { flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
632
+ children: node.label
633
+ }
634
+ )
635
+ ] })
636
+ }
637
+ );
638
+ }
639
+ function getKnowledgeReadCommand(nodeId) {
640
+ return `/knowledge read ${nodeId}`;
641
+ }
642
+ function getKnowledgeReadKindFolderCommand(kind) {
643
+ return `/knowledge read-folder kind:${kind}`;
644
+ }
645
+ function CopyCommandControl({ command, label, visible }) {
646
+ const clipboard = useClipboard({ timeout: 1500 });
647
+ return /* @__PURE__ */ jsx(
648
+ "span",
649
+ {
650
+ role: "button",
651
+ tabIndex: 0,
652
+ "aria-label": label,
653
+ onClick: (event) => {
654
+ event.preventDefault();
655
+ event.stopPropagation();
656
+ clipboard.copy(command);
657
+ },
658
+ onKeyDown: (event) => {
659
+ if (event.key !== "Enter" && event.key !== " ") return;
660
+ event.preventDefault();
661
+ event.stopPropagation();
662
+ clipboard.copy(command);
663
+ },
664
+ style: {
665
+ display: "inline-flex",
666
+ alignItems: "center",
667
+ justifyContent: "center",
668
+ width: 22,
669
+ height: 22,
670
+ flexShrink: 0,
671
+ opacity: visible ? 1 : 0,
672
+ pointerEvents: visible ? "auto" : "none",
673
+ color: clipboard.copied ? "var(--color-primary)" : "var(--color-text-subtle)",
674
+ transition: "opacity 120ms ease, color 120ms ease"
675
+ },
676
+ children: clipboard.copied ? /* @__PURE__ */ jsx(IconCheck, { size: 14 }) : /* @__PURE__ */ jsx(IconCopy, { size: 14 })
677
+ }
678
+ );
679
+ }
680
+ function TrailingCopySlot({ count, command, label, showCopy }) {
681
+ return /* @__PURE__ */ jsx(
682
+ "span",
683
+ {
684
+ style: {
685
+ display: "inline-flex",
686
+ alignItems: "center",
687
+ justifyContent: "center",
688
+ width: 32,
689
+ height: 22,
690
+ flexShrink: 0
691
+ },
692
+ children: showCopy && command ? /* @__PURE__ */ jsx(CopyCommandControl, { command, label, visible: true }) : /* @__PURE__ */ jsx(Badge, { size: "xs", variant: "light", color: "gray", children: count })
693
+ }
694
+ );
695
+ }
696
+ var KnowledgeSidebar = () => /* @__PURE__ */ jsx(Stack, { gap: 0, style: { height: "100%", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(KnowledgeSidebarMiddle, {}) });
3
697
 
4
698
  // src/features/knowledge/manifest.ts
699
+ var knowledgeSidebarWidth = 320;
700
+ var defaultSidebarWidth = 250;
5
701
  var knowledgeManifest = {
6
702
  key: "knowledge",
7
- featureId: KNOWLEDGE_FEATURE_ID
703
+ featureId: KNOWLEDGE_FEATURE_ID,
704
+ icon: IconBrain,
705
+ sidebar: KnowledgeSidebar,
706
+ sidebarWidth: ({ currentPath }) => currentPath.startsWith("/knowledge") ? knowledgeSidebarWidth : defaultSidebarWidth
8
707
  };
9
708
 
10
709
  export { knowledgeManifest };