@kelpie/ui 0.16.0 → 0.18.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 (258) hide show
  1. package/dist/api/client.d.ts +1 -1
  2. package/dist/api/resources/ai.d.ts +21 -0
  3. package/dist/api/resources/ai.d.ts.map +1 -0
  4. package/dist/api/resources/ai.js +101 -0
  5. package/dist/api/resources/ai.js.map +1 -0
  6. package/dist/api/resources/conversions.js +1 -1
  7. package/dist/api/resources/conversions.js.map +1 -1
  8. package/dist/api/resources/forms.d.ts +8 -0
  9. package/dist/api/resources/forms.d.ts.map +1 -1
  10. package/dist/api/resources/forms.js +39 -0
  11. package/dist/api/resources/forms.js.map +1 -1
  12. package/dist/api/resources/personIntake.d.ts +12 -0
  13. package/dist/api/resources/personIntake.d.ts.map +1 -0
  14. package/dist/api/resources/personIntake.js +54 -0
  15. package/dist/api/resources/personIntake.js.map +1 -0
  16. package/dist/api/resources/session.d.ts.map +1 -1
  17. package/dist/api/resources/session.js +3 -1
  18. package/dist/api/resources/session.js.map +1 -1
  19. package/dist/api/resources/workspace.d.ts +2 -2
  20. package/dist/api/resources/workspace.js +2 -2
  21. package/dist/app/KelpieApp.js +2 -2
  22. package/dist/app/KelpieApp.js.map +1 -1
  23. package/dist/components/ActivitiesPanel.d.ts +7 -4
  24. package/dist/components/ActivitiesPanel.d.ts.map +1 -1
  25. package/dist/components/ActivitiesPanel.js +12 -2
  26. package/dist/components/ActivitiesPanel.js.map +1 -1
  27. package/dist/components/ActivityAction.d.ts +15 -0
  28. package/dist/components/ActivityAction.d.ts.map +1 -0
  29. package/dist/components/ActivityAction.js +20 -0
  30. package/dist/components/ActivityAction.js.map +1 -0
  31. package/dist/components/AgentTasks.d.ts +5 -0
  32. package/dist/components/AgentTasks.d.ts.map +1 -1
  33. package/dist/components/AgentTasks.js +88 -10
  34. package/dist/components/AgentTasks.js.map +1 -1
  35. package/dist/components/DecisionsPanel.d.ts.map +1 -1
  36. package/dist/components/DecisionsPanel.js +3 -1
  37. package/dist/components/DecisionsPanel.js.map +1 -1
  38. package/dist/components/LinkedText.d.ts +12 -0
  39. package/dist/components/LinkedText.d.ts.map +1 -0
  40. package/dist/components/LinkedText.js +25 -0
  41. package/dist/components/LinkedText.js.map +1 -0
  42. package/dist/components/MarkdownView.d.ts +3 -1
  43. package/dist/components/MarkdownView.d.ts.map +1 -1
  44. package/dist/components/MarkdownView.js +17 -3
  45. package/dist/components/MarkdownView.js.map +1 -1
  46. package/dist/components/NotesPanel.d.ts +2 -1
  47. package/dist/components/NotesPanel.d.ts.map +1 -1
  48. package/dist/components/NotesPanel.js +6 -7
  49. package/dist/components/NotesPanel.js.map +1 -1
  50. package/dist/components/PersonIntakeDialog.d.ts +19 -0
  51. package/dist/components/PersonIntakeDialog.d.ts.map +1 -0
  52. package/dist/components/PersonIntakeDialog.js +87 -0
  53. package/dist/components/PersonIntakeDialog.js.map +1 -0
  54. package/dist/components/PlanPanel.d.ts.map +1 -1
  55. package/dist/components/PlanPanel.js +3 -1
  56. package/dist/components/PlanPanel.js.map +1 -1
  57. package/dist/components/RecordLinkTextarea.d.ts +12 -0
  58. package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
  59. package/dist/components/RecordLinkTextarea.js +142 -0
  60. package/dist/components/RecordLinkTextarea.js.map +1 -0
  61. package/dist/components/Shell.js +1 -1
  62. package/dist/components/Shell.js.map +1 -1
  63. package/dist/components/WorkspaceSwitcher.d.ts +2 -1
  64. package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
  65. package/dist/components/WorkspaceSwitcher.js +7 -2
  66. package/dist/components/WorkspaceSwitcher.js.map +1 -1
  67. package/dist/index.d.ts +5 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +6 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/lib/fragmentTarget.d.ts +18 -0
  72. package/dist/lib/fragmentTarget.d.ts.map +1 -0
  73. package/dist/lib/fragmentTarget.js +73 -0
  74. package/dist/lib/fragmentTarget.js.map +1 -0
  75. package/dist/lib/recordLinks.d.ts +17 -0
  76. package/dist/lib/recordLinks.d.ts.map +1 -0
  77. package/dist/lib/recordLinks.js +48 -0
  78. package/dist/lib/recordLinks.js.map +1 -0
  79. package/dist/lib/recordReferences.d.ts +41 -0
  80. package/dist/lib/recordReferences.d.ts.map +1 -0
  81. package/dist/lib/recordReferences.js +92 -0
  82. package/dist/lib/recordReferences.js.map +1 -0
  83. package/dist/modules/PersonIntakeWizard.d.ts +3 -0
  84. package/dist/modules/PersonIntakeWizard.d.ts.map +1 -0
  85. package/dist/modules/PersonIntakeWizard.js +223 -0
  86. package/dist/modules/PersonIntakeWizard.js.map +1 -0
  87. package/dist/modules/ai.d.ts +14 -0
  88. package/dist/modules/ai.d.ts.map +1 -0
  89. package/dist/modules/ai.js +26 -0
  90. package/dist/modules/ai.js.map +1 -0
  91. package/dist/modules/aiRunner.d.ts +3 -0
  92. package/dist/modules/aiRunner.d.ts.map +1 -0
  93. package/dist/modules/aiRunner.js +68 -0
  94. package/dist/modules/aiRunner.js.map +1 -0
  95. package/dist/modules/personIntakeSelection.d.ts +7 -0
  96. package/dist/modules/personIntakeSelection.d.ts.map +1 -0
  97. package/dist/modules/personIntakeSelection.js +21 -0
  98. package/dist/modules/personIntakeSelection.js.map +1 -0
  99. package/dist/pages/CompanyDetail.d.ts.map +1 -1
  100. package/dist/pages/CompanyDetail.js +2 -1
  101. package/dist/pages/CompanyDetail.js.map +1 -1
  102. package/dist/pages/DealDetail.d.ts.map +1 -1
  103. package/dist/pages/DealDetail.js +2 -1
  104. package/dist/pages/DealDetail.js.map +1 -1
  105. package/dist/pages/EnquiryDetail.d.ts.map +1 -1
  106. package/dist/pages/EnquiryDetail.js +2 -1
  107. package/dist/pages/EnquiryDetail.js.map +1 -1
  108. package/dist/pages/EventDetail.d.ts.map +1 -1
  109. package/dist/pages/EventDetail.js +2 -1
  110. package/dist/pages/EventDetail.js.map +1 -1
  111. package/dist/pages/FormsPage.js +4 -4
  112. package/dist/pages/FormsPage.js.map +1 -1
  113. package/dist/pages/OpportunityDetail.d.ts.map +1 -1
  114. package/dist/pages/OpportunityDetail.js +2 -1
  115. package/dist/pages/OpportunityDetail.js.map +1 -1
  116. package/dist/pages/PartnershipDetail.d.ts.map +1 -1
  117. package/dist/pages/PartnershipDetail.js +2 -1
  118. package/dist/pages/PartnershipDetail.js.map +1 -1
  119. package/dist/pages/PeoplePage.d.ts.map +1 -1
  120. package/dist/pages/PeoplePage.js +7 -1
  121. package/dist/pages/PeoplePage.js.map +1 -1
  122. package/dist/pages/PersonDetail.d.ts.map +1 -1
  123. package/dist/pages/PersonDetail.js +2 -1
  124. package/dist/pages/PersonDetail.js.map +1 -1
  125. package/dist/pages/RaiseDetail.d.ts.map +1 -1
  126. package/dist/pages/RaiseDetail.js +2 -1
  127. package/dist/pages/RaiseDetail.js.map +1 -1
  128. package/dist/pages/SearchPage.d.ts.map +1 -1
  129. package/dist/pages/SearchPage.js +26 -14
  130. package/dist/pages/SearchPage.js.map +1 -1
  131. package/dist/pages/admin/AiAdminPage.d.ts +2 -0
  132. package/dist/pages/admin/AiAdminPage.d.ts.map +1 -0
  133. package/dist/pages/admin/AiAdminPage.js +19 -0
  134. package/dist/pages/admin/AiAdminPage.js.map +1 -0
  135. package/dist/pages/admin/AiPage.d.ts +5 -0
  136. package/dist/pages/admin/AiPage.d.ts.map +1 -0
  137. package/dist/pages/admin/AiPage.js +196 -0
  138. package/dist/pages/admin/AiPage.js.map +1 -0
  139. package/dist/pages/admin/McpPage.js +2 -2
  140. package/dist/pages/admin/McpPage.js.map +1 -1
  141. package/dist/pages/admin/McpPanel.d.ts +3 -0
  142. package/dist/pages/admin/McpPanel.d.ts.map +1 -0
  143. package/dist/pages/admin/McpPanel.js +123 -0
  144. package/dist/pages/admin/McpPanel.js.map +1 -0
  145. package/dist/pages/admin/PrivacyPage.js +19 -3
  146. package/dist/pages/admin/PrivacyPage.js.map +1 -1
  147. package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
  148. package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
  149. package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
  150. package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
  151. package/dist/pages/dashboard/attention.d.ts +0 -5
  152. package/dist/pages/dashboard/attention.d.ts.map +1 -1
  153. package/dist/pages/dashboard/attention.js +1 -21
  154. package/dist/pages/dashboard/attention.js.map +1 -1
  155. package/dist/pages/dashboard/sections.d.ts.map +1 -1
  156. package/dist/pages/dashboard/sections.js +6 -3
  157. package/dist/pages/dashboard/sections.js.map +1 -1
  158. package/dist/pages/forms/EmbedPanel.js +5 -2
  159. package/dist/pages/forms/EmbedPanel.js.map +1 -1
  160. package/dist/pages/forms/FieldsEditor.d.ts.map +1 -1
  161. package/dist/pages/forms/FieldsEditor.js +90 -8
  162. package/dist/pages/forms/FieldsEditor.js.map +1 -1
  163. package/dist/pages/forms/FormSettings.d.ts.map +1 -1
  164. package/dist/pages/forms/FormSettings.js +73 -6
  165. package/dist/pages/forms/FormSettings.js.map +1 -1
  166. package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
  167. package/dist/pages/forms/SubmissionDetail.js +2 -1
  168. package/dist/pages/forms/SubmissionDetail.js.map +1 -1
  169. package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
  170. package/dist/pages/forms/SubmissionsTable.js +2 -1
  171. package/dist/pages/forms/SubmissionsTable.js.map +1 -1
  172. package/dist/pages/forms/fieldList.d.ts +2 -2
  173. package/dist/pages/forms/fieldList.d.ts.map +1 -1
  174. package/dist/pages/forms/fieldList.js +38 -10
  175. package/dist/pages/forms/fieldList.js.map +1 -1
  176. package/dist/pages/forms/template.d.ts.map +1 -1
  177. package/dist/pages/forms/template.js +13 -0
  178. package/dist/pages/forms/template.js.map +1 -1
  179. package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
  180. package/dist/pages/handbook/HandbookPage.js +2 -3
  181. package/dist/pages/handbook/HandbookPage.js.map +1 -1
  182. package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
  183. package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
  184. package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
  185. package/dist/pages/onboarding/onboardingRerun.d.ts +9 -0
  186. package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
  187. package/dist/pages/onboarding/onboardingRerun.js +11 -0
  188. package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
  189. package/dist/registry/context.d.ts +7 -1
  190. package/dist/registry/context.d.ts.map +1 -1
  191. package/dist/registry/context.js +12 -0
  192. package/dist/registry/context.js.map +1 -1
  193. package/dist/registry/contributions.d.ts +70 -1
  194. package/dist/registry/contributions.d.ts.map +1 -1
  195. package/dist/registry/registry.d.ts +12 -1
  196. package/dist/registry/registry.d.ts.map +1 -1
  197. package/dist/registry/registry.js +21 -0
  198. package/dist/registry/registry.js.map +1 -1
  199. package/package.json +2 -2
  200. package/src/api/client.ts +1 -1
  201. package/src/api/resources/ai.ts +120 -0
  202. package/src/api/resources/conversions.ts +1 -1
  203. package/src/api/resources/forms.ts +56 -0
  204. package/src/api/resources/personIntake.ts +95 -0
  205. package/src/api/resources/session.ts +3 -1
  206. package/src/api/resources/workspace.ts +4 -4
  207. package/src/app/KelpieApp.tsx +4 -2
  208. package/src/components/ActivitiesPanel.tsx +39 -10
  209. package/src/components/ActivityAction.tsx +33 -0
  210. package/src/components/AgentTasks.tsx +138 -10
  211. package/src/components/DecisionsPanel.tsx +9 -1
  212. package/src/components/LinkedText.tsx +51 -0
  213. package/src/components/MarkdownView.tsx +37 -7
  214. package/src/components/NotesPanel.tsx +18 -12
  215. package/src/components/PersonIntakeDialog.tsx +226 -0
  216. package/src/components/PlanPanel.tsx +9 -1
  217. package/src/components/RecordLinkTextarea.tsx +257 -0
  218. package/src/components/Shell.tsx +1 -1
  219. package/src/components/WorkspaceSwitcher.tsx +15 -1
  220. package/src/index.ts +16 -0
  221. package/src/lib/fragmentTarget.ts +96 -0
  222. package/src/lib/recordLinks.ts +57 -0
  223. package/src/lib/recordReferences.ts +139 -0
  224. package/src/modules/PersonIntakeWizard.tsx +633 -0
  225. package/src/modules/ai.tsx +27 -0
  226. package/src/modules/aiRunner.ts +83 -0
  227. package/src/modules/personIntakeSelection.ts +24 -0
  228. package/src/pages/CompanyDetail.tsx +2 -1
  229. package/src/pages/DealDetail.tsx +2 -1
  230. package/src/pages/EnquiryDetail.tsx +2 -1
  231. package/src/pages/EventDetail.tsx +2 -1
  232. package/src/pages/FormsPage.tsx +4 -4
  233. package/src/pages/OpportunityDetail.tsx +2 -1
  234. package/src/pages/PartnershipDetail.tsx +2 -1
  235. package/src/pages/PeoplePage.tsx +21 -5
  236. package/src/pages/PersonDetail.tsx +2 -1
  237. package/src/pages/RaiseDetail.tsx +2 -1
  238. package/src/pages/SearchPage.tsx +30 -15
  239. package/src/pages/admin/AiAdminPage.tsx +52 -0
  240. package/src/pages/admin/AiPage.tsx +457 -0
  241. package/src/pages/admin/{McpPage.tsx → McpPanel.tsx} +15 -11
  242. package/src/pages/admin/PrivacyPage.tsx +42 -0
  243. package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
  244. package/src/pages/dashboard/attention.ts +1 -24
  245. package/src/pages/dashboard/sections.tsx +9 -4
  246. package/src/pages/forms/EmbedPanel.tsx +5 -1
  247. package/src/pages/forms/FieldsEditor.tsx +204 -15
  248. package/src/pages/forms/FormSettings.tsx +156 -9
  249. package/src/pages/forms/SubmissionDetail.tsx +2 -1
  250. package/src/pages/forms/SubmissionsTable.tsx +2 -1
  251. package/src/pages/forms/fieldList.ts +39 -10
  252. package/src/pages/forms/template.ts +13 -0
  253. package/src/pages/handbook/HandbookPage.tsx +5 -6
  254. package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
  255. package/src/pages/onboarding/onboardingRerun.ts +14 -0
  256. package/src/registry/context.ts +19 -0
  257. package/src/registry/contributions.ts +64 -1
  258. package/src/registry/registry.ts +48 -0
@@ -1,5 +1,5 @@
1
1
  import type { ExtensibleRecordType } from '@kelpie/schemas';
2
- import type { ReactNode } from 'react';
2
+ import type { ComponentType, ReactNode } from 'react';
3
3
  /**
4
4
  * What a UI module may add to the shell.
5
5
  *
@@ -71,6 +71,18 @@ export interface RecordTab {
71
71
  readonly order?: number;
72
72
  readonly render: (context: RecordContext) => ReactNode;
73
73
  }
74
+ /**
75
+ * An admin page whose tabs modules may add to. `ai` is Admin → AI: core owns
76
+ * the page and its MCP tab, and the optional `ai` module adds Kelpie AI's
77
+ * settings and run log.
78
+ */
79
+ export type ExtensibleAdminPage = 'ai';
80
+ export interface AdminTab {
81
+ readonly id: string;
82
+ readonly label: string;
83
+ readonly order?: number;
84
+ readonly render: () => ReactNode;
85
+ }
74
86
  export interface RecordSidebarCard {
75
87
  readonly id: string;
76
88
  readonly order?: number;
@@ -81,4 +93,61 @@ export interface DashboardCard {
81
93
  readonly order?: number;
82
94
  readonly render: () => ReactNode;
83
95
  }
96
+ /**
97
+ * Whether the runner can take a task now, for the workspace the viewer is in.
98
+ * `reason` is a sentence the Agent menu shows on its disabled Run button.
99
+ */
100
+ export type AgentRunnerAvailability = {
101
+ readonly status: 'loading';
102
+ } | {
103
+ readonly status: 'unavailable';
104
+ readonly reason: string;
105
+ } | {
106
+ readonly status: 'ready';
107
+ readonly agentId: string;
108
+ };
109
+ /** Where a dispatched run got to, once core has handed it to the runner's agent. */
110
+ export type AgentRunnerProgress = {
111
+ readonly status: 'running';
112
+ } | {
113
+ readonly status: 'succeeded';
114
+ } | {
115
+ readonly status: 'failed';
116
+ readonly reason: string;
117
+ };
118
+ /**
119
+ * The agent the Agent menu's Run button dispatches to, with no dialog.
120
+ *
121
+ * Core has no model of its own, so with no runner registered Run stays
122
+ * disabled and Preview is the way to reach a registered agent. Both members are
123
+ * React hooks: the menu calls them on every render, so they follow the Rules of
124
+ * Hooks, and `enabled` lets the menu defer the fetch until it opens.
125
+ */
126
+ export interface AgentRunner {
127
+ readonly id: string;
128
+ readonly useAvailability: (options: {
129
+ readonly enabled: boolean;
130
+ }) => AgentRunnerAvailability;
131
+ /** Progress for the core agent run `agentRunId`. `undefined` polls nothing. */
132
+ readonly useProgress: (agentRunId: string | undefined) => AgentRunnerProgress | undefined;
133
+ }
134
+ export interface PersonIntakeWizardProps {
135
+ /** Closes the dialog the wizard sits in. */
136
+ readonly onClose: () => void;
137
+ }
138
+ /**
139
+ * The model-driven wizard behind People's **Add from notes**.
140
+ *
141
+ * Core owns the button and the dialog, and with no provider (or one that is
142
+ * not ready) the dialog offers a copy-prompt for the user's own agent. A
143
+ * provider replaces that with a wizard that identifies, researches and
144
+ * creates. `useAvailability` is a hook, with the runner's shape and rules.
145
+ */
146
+ export interface PersonIntakeProvider {
147
+ readonly id: string;
148
+ readonly useAvailability: (options: {
149
+ readonly enabled: boolean;
150
+ }) => AgentRunnerAvailability;
151
+ readonly Wizard: ComponentType<PersonIntakeWizardProps>;
152
+ }
84
153
  //# sourceMappingURL=contributions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contributions.d.ts","sourceRoot":"","sources":["../../src/registry/contributions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;;;;;GAKG;AAEH,eAAO,MAAM,SAAS,YAAI,SAAS,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;AAEjE,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,QAA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uB,CAAA;IAC7F,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAA;CACxD"}
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { AuthMethod, DashboardCard, ExtensibleRecordType, NavItem, NavSlot, RecordSidebarCard, RecordTab, RouteContribution } from './contributions.ts';
2
+ import type { AdminTab, AgentRunner, AuthMethod, PersonIntakeProvider, DashboardCard, ExtensibleAdminPage, ExtensibleRecordType, NavItem, NavSlot, RecordSidebarCard, RecordTab, RouteContribution } from './contributions.ts';
3
3
  import type { Overridable } from './overridable.ts';
4
4
  /**
5
5
  * The build-time UI extension registry.
@@ -18,9 +18,15 @@ export interface UiModuleContext {
18
18
  route(route: RouteContribution): void;
19
19
  recordTab(objectType: ExtensibleRecordType, tab: RecordTab): void;
20
20
  recordSidebarCard(objectType: ExtensibleRecordType, card: RecordSidebarCard): void;
21
+ /** A tab on an admin page core owns, beside core's own tabs. */
22
+ adminTab(page: ExtensibleAdminPage, tab: AdminTab): void;
21
23
  dashboardCard(card: DashboardCard): void;
22
24
  /** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
23
25
  authMethod(method: AuthMethod): void;
26
+ /** The agent the Agent menu's Run button dispatches to. One per assembly. */
27
+ agentRunner(runner: AgentRunner): void;
28
+ /** The wizard behind People's Add from notes. One per assembly. */
29
+ personIntake(provider: PersonIntakeProvider): void;
24
30
  /** Replaces a core component. Prefer a slot. */
25
31
  override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void;
26
32
  }
@@ -34,8 +40,13 @@ export interface UiExtensions {
34
40
  routes(): readonly RouteContribution[];
35
41
  recordTabs(objectType: ExtensibleRecordType): readonly RecordTab[];
36
42
  recordSidebarCards(objectType: ExtensibleRecordType): readonly RecordSidebarCard[];
43
+ adminTabs(page: ExtensibleAdminPage): readonly AdminTab[];
37
44
  dashboardCards(): readonly DashboardCard[];
38
45
  authMethods(): readonly AuthMethod[];
46
+ /** The registered runner, or `undefined` when no module provides one. */
47
+ agentRunner(): AgentRunner | undefined;
48
+ /** The registered intake wizard, or `undefined` when no module provides one. */
49
+ personIntake(): PersonIntakeProvider | undefined;
39
50
  componentFor<Props>(token: Overridable<Props>): ComponentType<Props>;
40
51
  }
41
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EAClB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAA;AAElE;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACvC,KAAK,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACrC,SAAS,CAAC,UAAU,EAAE,oBAAoB,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAAA;IACjE,iBAAiB,CAAC,UAAU,EAAE,oBAAoB,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClF,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAA;IACxC,2FAA2F;IAC3F,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAA;IACpC,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;CAClF;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,eA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,UAAU,CAAC,UAAU,EAAE,oBAAoB,GAAG,SAAS,SAAS,EAAE,CAAA;IAClE,kBAAkB,CAAC,UAAU,EAAE,oBAAoB,GAAG,SAAS,iBAAiB,EAAE,CAAA;IAClF,SAAS,CAAC,IAAI,EAAE,mBAAmB,GAAG,SAAS,QAAQ,EAAE,CAAA;IACzD,cAAc,IAAI,SAAS,aAAa,EAAE,CAAA;IAC1C,WAAW,IAAI,SAAS,UAAU,EAAE,CAAA;IACpC,yEAAyE;IACzE,WAAW,IAAI,WAAW,GAAG,SAAS,CAAA;IACtC,gFAAgF;IAChF,YAAY,IAAI,oBAAoB,GAAG,SAAS,CAAA;IAChD,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAA;CACrE;AAKD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAEpG;AAeD,gHAAgH;AAChH,qBAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAkGD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,YAAY,CAoC5E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,YAAoC,CAAA"}
@@ -51,6 +51,10 @@ function createModuleContext(module, accumulator, taken) {
51
51
  claim(taken, module.id, `record.sidebar.${objectType}`, card.id);
52
52
  pushInto(accumulator.recordSidebarCards, objectType, card);
53
53
  },
54
+ adminTab(page, tab) {
55
+ claim(taken, module.id, `admin.tabs.${page}`, tab.id);
56
+ pushInto(accumulator.adminTabs, page, tab);
57
+ },
54
58
  dashboardCard(card) {
55
59
  claim(taken, module.id, 'dashboard.cards', card.id);
56
60
  accumulator.dashboardCards.push(card);
@@ -59,6 +63,19 @@ function createModuleContext(module, accumulator, taken) {
59
63
  claim(taken, module.id, 'auth.methods', method.id);
60
64
  accumulator.authMethods.push(method);
61
65
  },
66
+ agentRunner(runner) {
67
+ // One button, one agent: a second runner would silently win or lose.
68
+ if (accumulator.agentRunner !== undefined) {
69
+ throw new UiModuleError(`module "${module.id}" contributes agent runner "${runner.id}", but "${accumulator.agentRunner.id}" is already registered`);
70
+ }
71
+ accumulator.agentRunner = runner;
72
+ },
73
+ personIntake(provider) {
74
+ if (accumulator.personIntake !== undefined) {
75
+ throw new UiModuleError(`module "${module.id}" contributes person intake "${provider.id}", but "${accumulator.personIntake.id}" is already registered`);
76
+ }
77
+ accumulator.personIntake = provider;
78
+ },
62
79
  override(token, component) {
63
80
  if (accumulator.overrides.has(token.key)) {
64
81
  throw new UiModuleError(`module "${module.id}" overrides "${token.key}", which another module already replaced`);
@@ -78,6 +95,7 @@ export function registerUiModules(modules) {
78
95
  routes: [],
79
96
  recordTabs: new Map(),
80
97
  recordSidebarCards: new Map(),
98
+ adminTabs: new Map(),
81
99
  dashboardCards: [],
82
100
  authMethods: [],
83
101
  overrides: createOverrideStore(),
@@ -96,8 +114,11 @@ export function registerUiModules(modules) {
96
114
  routes: () => accumulator.routes,
97
115
  recordTabs: (objectType) => inSlotOrder(accumulator.recordTabs.get(objectType) ?? []),
98
116
  recordSidebarCards: (objectType) => inSlotOrder(accumulator.recordSidebarCards.get(objectType) ?? []),
117
+ adminTabs: (page) => inSlotOrder(accumulator.adminTabs.get(page) ?? []),
99
118
  dashboardCards: () => inSlotOrder(accumulator.dashboardCards),
100
119
  authMethods: () => inSlotOrder(accumulator.authMethods),
120
+ agentRunner: () => accumulator.agentRunner,
121
+ personIntake: () => accumulator.personIntake,
101
122
  componentFor: (token) => accumulator.overrides.get(token),
102
123
  };
103
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],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AAE,CAAC,WAAW,CAAC,WAAW;QAC1C,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY;QAC5C,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;KAC1D,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiB,iBAAiB,CAAC,EAAE,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kelpie/ui",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "React UI for Kelpie: components, pages, API client, and the extension registry an assembly composes modules through.",
5
5
  "keywords": [
6
6
  "kelpie",
@@ -48,7 +48,7 @@
48
48
  "@dnd-kit/core": "^6.3.1",
49
49
  "@dnd-kit/sortable": "^10.0.0",
50
50
  "@dnd-kit/utilities": "^3.2.2",
51
- "@kelpie/schemas": "^0.16.0",
51
+ "@kelpie/schemas": "^0.18.0",
52
52
  "@tanstack/react-query": "^5.101.4",
53
53
  "react-markdown": "^10.1.0",
54
54
  "react-router": "^8.3.0",
package/src/api/client.ts CHANGED
@@ -93,7 +93,7 @@ export interface ApiClient {
93
93
  patchEmpty(path: string, body: unknown): Promise<void>
94
94
  /**
95
95
  * `query` is for a delete that takes a confirmation, which
96
- * `DELETE /v1/workspaces/:id?slug=` is. A `DELETE` body would be the other
96
+ * `DELETE /v1/workspaces/:id?name=` is. A `DELETE` body would be the other
97
97
  * option, and HTTP lets a client drop one.
98
98
  */
99
99
  delete(path: string, query?: QueryParameters): Promise<void>
@@ -0,0 +1,120 @@
1
+ import { AI_SERVICE_LABELS, aiRunSchema, aiSettingsBody, aiSettingsSchema } from '@kelpie/schemas'
2
+ import type { AiRun, AiSettings, AiSettingsInput } from '@kelpie/schemas'
3
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
4
+
5
+ import { ApiError } from '../client.ts'
6
+ import { useApiClient } from '../context.ts'
7
+ import { toError } from '../errors.ts'
8
+ import { createReadOnlyResourceHooks } from '../resource.ts'
9
+ import type { ListOptions, MutationResult, RecordListResult, RecordResult } from '../resource.ts'
10
+ import { asMutationResult } from './mutation.ts'
11
+
12
+ /**
13
+ * `/v1/ai/settings` and `/v1/ai/runs`, from the optional `ai` module.
14
+ *
15
+ * Only an assembly that lists the module serves these paths, so the hooks live
16
+ * here for the module's own page and nothing in core calls them.
17
+ *
18
+ * Saving or disabling adds or removes the "Kelpie AI" agent row, so both
19
+ * invalidate the agent list the Run dialog reads.
20
+ */
21
+
22
+ const SETTINGS_KEY = ['ai_settings'] as const
23
+
24
+ export function useAiSettings(options: ListOptions = {}): RecordResult<AiSettings> {
25
+ const client = useApiClient()
26
+ const enabled = options.enabled ?? true
27
+ const result = useQuery({
28
+ queryKey: SETTINGS_KEY,
29
+ queryFn: () => client.get('/ai/settings', aiSettingsSchema.parse),
30
+ enabled,
31
+ })
32
+
33
+ return {
34
+ record: result.data,
35
+ // A disabled query stays pending forever, which is not the same as loading.
36
+ isLoading: result.isPending && enabled,
37
+ error: toError(result.error),
38
+ isNotFound: result.error instanceof ApiError && result.error.status === 404,
39
+ }
40
+ }
41
+
42
+ /**
43
+ * What to call the install's AI service: "Kelpie AI" on Kelpie Cloud, "Custom
44
+ * provider" on an open source install. Plain "AI" until the settings load.
45
+ */
46
+ export function useAiServiceLabel(): string {
47
+ const { record } = useAiSettings()
48
+
49
+ return record === undefined ? 'AI' : AI_SERVICE_LABELS[record.service]
50
+ }
51
+
52
+ /** Enables AI, or saves a new provider, key or model when it is on already. */
53
+ export function useSaveAiSettings(): MutationResult<AiSettingsInput, AiSettings> {
54
+ const client = useApiClient()
55
+ const cache = useQueryClient()
56
+ const mutation = useMutation({
57
+ mutationFn: (input: AiSettingsInput) => client.post('/ai/settings', aiSettingsBody(input), aiSettingsSchema.parse),
58
+ onSuccess: (settings) => {
59
+ cache.setQueryData(SETTINGS_KEY, settings)
60
+ },
61
+ onSettled: () => {
62
+ void cache.invalidateQueries({ queryKey: ['agents'] })
63
+ },
64
+ })
65
+
66
+ return asMutationResult(mutation)
67
+ }
68
+
69
+ export function useDisableAi(): MutationResult<void, void> {
70
+ const client = useApiClient()
71
+ const cache = useQueryClient()
72
+ const mutation = useMutation({
73
+ mutationFn: () => client.delete('/ai/settings'),
74
+ onSettled: () => {
75
+ void cache.invalidateQueries({ queryKey: SETTINGS_KEY })
76
+ void cache.invalidateQueries({ queryKey: ['agents'] })
77
+ },
78
+ })
79
+
80
+ return asMutationResult(mutation)
81
+ }
82
+
83
+ const runs = createReadOnlyResourceHooks<AiRun>({
84
+ name: 'ai_runs',
85
+ path: '/ai/runs',
86
+ decode: aiRunSchema.parse,
87
+ })
88
+
89
+ export function useAiRuns(options: ListOptions = {}): RecordListResult<AiRun> {
90
+ return runs.useList({}, options)
91
+ }
92
+
93
+ const RUN_POLL_INTERVAL_MS = 1500
94
+
95
+ /**
96
+ * The AI run that core's agent run `agentRunId` started, polled until it
97
+ * settles. `undefined` until the dispatch intake has written it.
98
+ *
99
+ * There is no filter by agent run on `/v1/ai/runs`, so this reads the newest
100
+ * page and picks the row out. A run the menu just dispatched is at the top.
101
+ */
102
+ export function useAiRunForAgentRun(agentRunId: string | undefined): AiRun | undefined {
103
+ const client = useApiClient()
104
+ const result = useQuery({
105
+ queryKey: ['ai_runs', 'by_agent_run', agentRunId ?? ''],
106
+ queryFn: async () => {
107
+ const page = await client.list('/ai/runs', aiRunSchema.parse, {})
108
+
109
+ return page.items.find((run) => run.agentRunId === agentRunId) ?? null
110
+ },
111
+ enabled: agentRunId !== undefined,
112
+ refetchInterval: (query) => {
113
+ const status = query.state.data?.status
114
+
115
+ return status === 'succeeded' || status === 'failed' ? false : RUN_POLL_INTERVAL_MS
116
+ },
117
+ })
118
+
119
+ return result.data ?? undefined
120
+ }
@@ -34,7 +34,7 @@ const DETAIL_PATHS: Readonly<Record<PipelineKind, string>> = {
34
34
  enquiry: '/enquiries',
35
35
  deal: '/deals',
36
36
  opportunity: '/opportunities',
37
- raise: '/raises',
37
+ raise: '/fundraising',
38
38
  partnership: '/partnerships',
39
39
  }
40
40
 
@@ -124,6 +124,62 @@ export function useUpdateFormFields(): MutationResult<UpdateFieldsArguments, For
124
124
  }
125
125
  }
126
126
 
127
+ export interface UpdateSlugArguments {
128
+ readonly id: string
129
+ readonly slug: string
130
+ }
131
+
132
+ /**
133
+ * The shared write behind both slug hooks.
134
+ *
135
+ * Not optimistic: a slug can be refused (`409` when another form in the
136
+ * workspace has it), and the Embed tab must not show a URL that never existed.
137
+ * On success the embed snippets are refetched, because the slug is in every URL
138
+ * they hold.
139
+ */
140
+ function useSlugMutation<Input>(
141
+ write: (input: Input) => Promise<Form>,
142
+ ): MutationResult<Input, Form> {
143
+ const queryClient = useQueryClient()
144
+ const mutation = useMutation({
145
+ mutationFn: write,
146
+ onSuccess: (form) => {
147
+ queryClient.setQueryData(['forms', 'detail', form.id], form)
148
+ void queryClient.invalidateQueries({ queryKey: ['forms', 'embed', form.id] })
149
+ },
150
+ onSettled: () => {
151
+ void queryClient.invalidateQueries({ queryKey: ['forms', 'list'] })
152
+ },
153
+ })
154
+
155
+ return {
156
+ run: (input) => {
157
+ mutation.mutate(input)
158
+ },
159
+ runAsync: (input) => mutation.mutateAsync(input),
160
+ isPending: mutation.isPending,
161
+ error: toError(mutation.error),
162
+ }
163
+ }
164
+
165
+ /** Sets a slug the user chose. Every existing embed of the form stops working. */
166
+ export function useUpdateFormSlug(): MutationResult<UpdateSlugArguments, Form> {
167
+ const client = useApiClient()
168
+
169
+ return useSlugMutation(({ id, slug }: UpdateSlugArguments) =>
170
+ client.patch(`/forms/${id}`, formBody({ slug }), formSchema.parse),
171
+ )
172
+ }
173
+
174
+ /** Replaces the slug with a random one the server makes. Every existing embed stops working. */
175
+ export function useRegenerateFormSlug(): MutationResult<string, Form> {
176
+ const client = useApiClient()
177
+
178
+ return useSlugMutation((id: string) =>
179
+ client.post(`/forms/${id}/regenerate-slug`, {}, formSchema.parse),
180
+ )
181
+ }
182
+
127
183
  /** Deletes the form, and by cascade its fields and its submissions. */
128
184
  export function useDeleteForm(): MutationResult<string, void> {
129
185
  return forms.useRemove()
@@ -0,0 +1,95 @@
1
+ import {
2
+ personIntakeApplyResultSchema,
3
+ personIntakeCandidateBody,
4
+ personIntakeIdentifyResultSchema,
5
+ personIntakeItemBody,
6
+ personIntakeResearchResultSchema,
7
+ } from '@kelpie/schemas'
8
+ import type {
9
+ PersonIntakeApplyResult,
10
+ PersonIntakeCandidate,
11
+ PersonIntakeIdentifyResult,
12
+ PersonIntakeItem,
13
+ PersonIntakeResearchResult,
14
+ } from '@kelpie/schemas'
15
+ import { useMutation, useQueryClient } from '@tanstack/react-query'
16
+
17
+ import { useApiClient } from '../context.ts'
18
+ import type { MutationResult } from '../resource.ts'
19
+ import { asMutationResult } from './mutation.ts'
20
+
21
+ /**
22
+ * `/v1/ai/person-intake/*`, from the optional `ai` module. Only the module's
23
+ * wizard calls these, and only an assembly that lists the module serves them.
24
+ *
25
+ * `identify` and `research` each record an AI run, so both refresh the run
26
+ * log. `apply` can touch every record type the wizard offers, so it refreshes
27
+ * all of them.
28
+ */
29
+
30
+ const RUN_LOG_KEY = ['ai_runs'] as const
31
+
32
+ const WRITTEN_RESOURCES = ['people', 'companies', 'positions', 'notes', 'partnerships', 'deals', 'enquiries'] as const
33
+
34
+ export function useIdentifyPerson(): MutationResult<string, PersonIntakeIdentifyResult> {
35
+ const client = useApiClient()
36
+ const cache = useQueryClient()
37
+ const mutation = useMutation({
38
+ mutationFn: (text: string) =>
39
+ client.post('/ai/person-intake/identify', { text }, personIntakeIdentifyResultSchema.parse),
40
+ onSettled: () => {
41
+ void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
42
+ },
43
+ })
44
+
45
+ return asMutationResult(mutation)
46
+ }
47
+
48
+ export interface ResearchPersonInput {
49
+ readonly text: string
50
+ readonly candidate: PersonIntakeCandidate
51
+ /** The Person to add to, or null to create a new one. */
52
+ readonly existingPersonId: string | null
53
+ }
54
+
55
+ export function useResearchPerson(): MutationResult<ResearchPersonInput, PersonIntakeResearchResult> {
56
+ const client = useApiClient()
57
+ const cache = useQueryClient()
58
+ const mutation = useMutation({
59
+ mutationFn: (input: ResearchPersonInput) =>
60
+ client.post(
61
+ '/ai/person-intake/research',
62
+ {
63
+ text: input.text,
64
+ candidate: personIntakeCandidateBody(input.candidate),
65
+ existing_person_id: input.existingPersonId,
66
+ },
67
+ personIntakeResearchResultSchema.parse,
68
+ ),
69
+ onSettled: () => {
70
+ void cache.invalidateQueries({ queryKey: RUN_LOG_KEY })
71
+ },
72
+ })
73
+
74
+ return asMutationResult(mutation)
75
+ }
76
+
77
+ export function useApplyPersonIntake(): MutationResult<readonly PersonIntakeItem[], PersonIntakeApplyResult> {
78
+ const client = useApiClient()
79
+ const cache = useQueryClient()
80
+ const mutation = useMutation({
81
+ mutationFn: (items: readonly PersonIntakeItem[]) =>
82
+ client.post(
83
+ '/ai/person-intake/apply',
84
+ { items: items.map(personIntakeItemBody) },
85
+ personIntakeApplyResultSchema.parse,
86
+ ),
87
+ onSettled: () => {
88
+ for (const name of WRITTEN_RESOURCES) {
89
+ void cache.invalidateQueries({ queryKey: [name] })
90
+ }
91
+ },
92
+ })
93
+
94
+ return asMutationResult(mutation)
95
+ }
@@ -249,8 +249,10 @@ export function useCreateWorkspace(): MutationResult<CreateWorkspaceInput, Works
249
249
  const mutation = useMutation({
250
250
  mutationFn: (input: CreateWorkspaceInput) =>
251
251
  client.post('/workspaces', createWorkspaceBody(input), workspaceSchema.parse),
252
- // Creating a workspace moves the session into it, so the session is stale.
252
+ // Creating a workspace moves the session into it. For a second workspace
253
+ // the cache holds the first one's records, so drop it all, as a switch does.
253
254
  onSuccess: async () => {
255
+ queryClient.clear()
254
256
  await queryClient.fetchQuery(sessionQuery(client))
255
257
  },
256
258
  })
@@ -59,18 +59,18 @@ export function useUpdateWorkspace(): MutationResult<UpdateWorkspaceInput, Works
59
59
  /**
60
60
  * Deletes the workspace, everything in it, and the caller's way back.
61
61
  *
62
- * The slug goes with the request because the API asks the caller to name what it
62
+ * The name goes with the request because the API asks the caller to name what it
63
63
  * is destroying. Afterwards the whole cache is dropped: every cached list
64
64
  * belongs to a workspace that no longer exists.
65
65
  */
66
- export function useDeleteWorkspace(): MutationResult<{ readonly slug: string }, void> {
66
+ export function useDeleteWorkspace(): MutationResult<{ readonly name: string }, void> {
67
67
  const client = useApiClient()
68
68
  const queryClient = useQueryClient()
69
69
  const { session } = useSession()
70
70
  const workspaceId = session?.workspaceId ?? ''
71
71
  const mutation = useMutation({
72
- mutationFn: ({ slug }: { readonly slug: string }) =>
73
- client.delete(`/workspaces/${workspaceId}`, { slug }),
72
+ mutationFn: ({ name }: { readonly name: string }) =>
73
+ client.delete(`/workspaces/${workspaceId}`, { name }),
74
74
  onSuccess: () => {
75
75
  queryClient.clear()
76
76
  },
@@ -41,11 +41,11 @@ import { PersonalApiKeysPage } from '../pages/account/PersonalApiKeysPage.tsx'
41
41
  import { PreferencesPage } from '../pages/account/PreferencesPage.tsx'
42
42
  import { ProfilePage } from '../pages/account/ProfilePage.tsx'
43
43
  import { SecurityPage } from '../pages/account/SecurityPage.tsx'
44
+ import { AiAdminPage } from '../pages/admin/AiAdminPage.tsx'
44
45
  import { ApiKeysPage } from '../pages/admin/ApiKeysPage.tsx'
45
46
  import { DataPage } from '../pages/admin/DataPage.tsx'
46
47
  import { FieldsPage } from '../pages/admin/FieldsPage.tsx'
47
48
  import { PrivacyPage } from '../pages/admin/PrivacyPage.tsx'
48
- import { McpPage } from '../pages/admin/McpPage.tsx'
49
49
  import { ModulesPage } from '../pages/admin/ModulesPage.tsx'
50
50
  import { TeamPage } from '../pages/admin/TeamPage.tsx'
51
51
  import { WebhooksPage } from '../pages/admin/WebhooksPage.tsx'
@@ -200,7 +200,9 @@ function AppRoutes(): React.JSX.Element {
200
200
  <Route path="admin/privacy" element={<PrivacyPage />} />
201
201
  <Route path="admin/data" element={<DataPage />} />
202
202
  <Route path="admin/api-keys" element={<ApiKeysPage />} />
203
- <Route path="admin/mcp" element={<McpPage />} />
203
+ <Route path="admin/ai" element={<AiAdminPage />} />
204
+ {/* MCP moved to a tab on Admin → AI. */}
205
+ <Route path="admin/mcp" element={<Navigate to="/admin/ai?tab=mcp" replace />} />
204
206
  <Route path="admin/webhooks" element={<WebhooksPage />} />
205
207
  <Route path="admin/modules" element={<ModulesPage />} />
206
208
  {/* The mockup's own shape: /account opens the first tab. */}