@kelpie/ui 0.15.0 → 0.17.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 (287) hide show
  1. package/dist/api/client.d.ts +6 -5
  2. package/dist/api/client.d.ts.map +1 -1
  3. package/dist/api/client.js +2 -2
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/api/resource.d.ts +4 -4
  6. package/dist/api/resource.d.ts.map +1 -1
  7. package/dist/api/resource.js +4 -5
  8. package/dist/api/resource.js.map +1 -1
  9. package/dist/api/resources/ai.d.ts +16 -0
  10. package/dist/api/resources/ai.d.ts.map +1 -0
  11. package/dist/api/resources/ai.js +93 -0
  12. package/dist/api/resources/ai.js.map +1 -0
  13. package/dist/api/resources/conversions.js +1 -1
  14. package/dist/api/resources/conversions.js.map +1 -1
  15. package/dist/api/resources/members.d.ts +2 -2
  16. package/dist/api/resources/oauth.d.ts +21 -0
  17. package/dist/api/resources/oauth.d.ts.map +1 -0
  18. package/dist/api/resources/oauth.js +74 -0
  19. package/dist/api/resources/oauth.js.map +1 -0
  20. package/dist/api/resources/planItems.d.ts +1 -1
  21. package/dist/api/resources/planItems.d.ts.map +1 -1
  22. package/dist/api/resources/planItems.js +1 -1
  23. package/dist/api/resources/planItems.js.map +1 -1
  24. package/dist/api/resources/session.d.ts +1 -1
  25. package/dist/api/resources/session.d.ts.map +1 -1
  26. package/dist/api/resources/session.js +4 -2
  27. package/dist/api/resources/session.js.map +1 -1
  28. package/dist/api/resources/workspace.d.ts +2 -2
  29. package/dist/api/resources/workspace.js +2 -2
  30. package/dist/app/KelpieApp.d.ts.map +1 -1
  31. package/dist/app/KelpieApp.js +3 -1
  32. package/dist/app/KelpieApp.js.map +1 -1
  33. package/dist/components/ActivitiesPanel.d.ts +7 -4
  34. package/dist/components/ActivitiesPanel.d.ts.map +1 -1
  35. package/dist/components/ActivitiesPanel.js +12 -2
  36. package/dist/components/ActivitiesPanel.js.map +1 -1
  37. package/dist/components/ActivityAction.d.ts +15 -0
  38. package/dist/components/ActivityAction.d.ts.map +1 -0
  39. package/dist/components/ActivityAction.js +20 -0
  40. package/dist/components/ActivityAction.js.map +1 -0
  41. package/dist/components/AgentTasks.d.ts +5 -0
  42. package/dist/components/AgentTasks.d.ts.map +1 -1
  43. package/dist/components/AgentTasks.js +88 -10
  44. package/dist/components/AgentTasks.js.map +1 -1
  45. package/dist/components/ApiKeysPanel.d.ts.map +1 -1
  46. package/dist/components/ApiKeysPanel.js +4 -1
  47. package/dist/components/ApiKeysPanel.js.map +1 -1
  48. package/dist/components/DecisionsPanel.d.ts.map +1 -1
  49. package/dist/components/DecisionsPanel.js +3 -1
  50. package/dist/components/DecisionsPanel.js.map +1 -1
  51. package/dist/components/LinkedText.d.ts +12 -0
  52. package/dist/components/LinkedText.d.ts.map +1 -0
  53. package/dist/components/LinkedText.js +25 -0
  54. package/dist/components/LinkedText.js.map +1 -0
  55. package/dist/components/MarkdownView.d.ts +3 -1
  56. package/dist/components/MarkdownView.d.ts.map +1 -1
  57. package/dist/components/MarkdownView.js +17 -3
  58. package/dist/components/MarkdownView.js.map +1 -1
  59. package/dist/components/NotesPanel.d.ts +2 -1
  60. package/dist/components/NotesPanel.d.ts.map +1 -1
  61. package/dist/components/NotesPanel.js +6 -7
  62. package/dist/components/NotesPanel.js.map +1 -1
  63. package/dist/components/Paginator.d.ts +1 -1
  64. package/dist/components/PlanPanel.d.ts.map +1 -1
  65. package/dist/components/PlanPanel.js +3 -1
  66. package/dist/components/PlanPanel.js.map +1 -1
  67. package/dist/components/RecordLinkTextarea.d.ts +12 -0
  68. package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
  69. package/dist/components/RecordLinkTextarea.js +142 -0
  70. package/dist/components/RecordLinkTextarea.js.map +1 -0
  71. package/dist/components/Shell.js +1 -1
  72. package/dist/components/SummaryBlock.d.ts +1 -1
  73. package/dist/components/SummaryBlock.js +1 -1
  74. package/dist/components/WorkspaceSwitcher.d.ts +2 -1
  75. package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
  76. package/dist/components/WorkspaceSwitcher.js +7 -2
  77. package/dist/components/WorkspaceSwitcher.js.map +1 -1
  78. package/dist/index.d.ts +5 -2
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +6 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/lib/fragmentTarget.d.ts +18 -0
  83. package/dist/lib/fragmentTarget.d.ts.map +1 -0
  84. package/dist/lib/fragmentTarget.js +73 -0
  85. package/dist/lib/fragmentTarget.js.map +1 -0
  86. package/dist/lib/mcpConfig.d.ts +10 -0
  87. package/dist/lib/mcpConfig.d.ts.map +1 -0
  88. package/dist/lib/mcpConfig.js +23 -0
  89. package/dist/lib/mcpConfig.js.map +1 -0
  90. package/dist/lib/money.d.ts +2 -2
  91. package/dist/lib/money.js +2 -2
  92. package/dist/lib/recordLinks.d.ts +17 -0
  93. package/dist/lib/recordLinks.d.ts.map +1 -0
  94. package/dist/lib/recordLinks.js +48 -0
  95. package/dist/lib/recordLinks.js.map +1 -0
  96. package/dist/lib/recordReferences.d.ts +41 -0
  97. package/dist/lib/recordReferences.d.ts.map +1 -0
  98. package/dist/lib/recordReferences.js +92 -0
  99. package/dist/lib/recordReferences.js.map +1 -0
  100. package/dist/modules/ai.d.ts +13 -0
  101. package/dist/modules/ai.d.ts.map +1 -0
  102. package/dist/modules/ai.js +22 -0
  103. package/dist/modules/ai.js.map +1 -0
  104. package/dist/modules/aiRunner.d.ts +3 -0
  105. package/dist/modules/aiRunner.d.ts.map +1 -0
  106. package/dist/modules/aiRunner.js +66 -0
  107. package/dist/modules/aiRunner.js.map +1 -0
  108. package/dist/pages/CompanyDetail.d.ts.map +1 -1
  109. package/dist/pages/CompanyDetail.js +2 -1
  110. package/dist/pages/CompanyDetail.js.map +1 -1
  111. package/dist/pages/DealDetail.d.ts.map +1 -1
  112. package/dist/pages/DealDetail.js +2 -1
  113. package/dist/pages/DealDetail.js.map +1 -1
  114. package/dist/pages/DealsPage.js +1 -1
  115. package/dist/pages/DealsPage.js.map +1 -1
  116. package/dist/pages/DecisionsPage.d.ts.map +1 -1
  117. package/dist/pages/DecisionsPage.js +5 -3
  118. package/dist/pages/DecisionsPage.js.map +1 -1
  119. package/dist/pages/EnquiryDetail.d.ts.map +1 -1
  120. package/dist/pages/EnquiryDetail.js +2 -1
  121. package/dist/pages/EnquiryDetail.js.map +1 -1
  122. package/dist/pages/EventDetail.d.ts.map +1 -1
  123. package/dist/pages/EventDetail.js +2 -1
  124. package/dist/pages/EventDetail.js.map +1 -1
  125. package/dist/pages/FundraisingPage.js +1 -1
  126. package/dist/pages/FundraisingPage.js.map +1 -1
  127. package/dist/pages/OpportunitiesPage.js +1 -1
  128. package/dist/pages/OpportunitiesPage.js.map +1 -1
  129. package/dist/pages/OpportunityDetail.d.ts.map +1 -1
  130. package/dist/pages/OpportunityDetail.js +2 -1
  131. package/dist/pages/OpportunityDetail.js.map +1 -1
  132. package/dist/pages/PartnershipDetail.d.ts.map +1 -1
  133. package/dist/pages/PartnershipDetail.js +2 -1
  134. package/dist/pages/PartnershipDetail.js.map +1 -1
  135. package/dist/pages/PartnershipsPage.js +1 -1
  136. package/dist/pages/PartnershipsPage.js.map +1 -1
  137. package/dist/pages/PersonDetail.d.ts.map +1 -1
  138. package/dist/pages/PersonDetail.js +4 -3
  139. package/dist/pages/PersonDetail.js.map +1 -1
  140. package/dist/pages/RaiseDetail.d.ts.map +1 -1
  141. package/dist/pages/RaiseDetail.js +2 -1
  142. package/dist/pages/RaiseDetail.js.map +1 -1
  143. package/dist/pages/SearchPage.d.ts.map +1 -1
  144. package/dist/pages/SearchPage.js +26 -14
  145. package/dist/pages/SearchPage.js.map +1 -1
  146. package/dist/pages/account/AccountLayout.d.ts.map +1 -1
  147. package/dist/pages/account/AccountLayout.js +2 -1
  148. package/dist/pages/account/AccountLayout.js.map +1 -1
  149. package/dist/pages/account/ConnectedAppsPage.d.ts +7 -0
  150. package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -0
  151. package/dist/pages/account/ConnectedAppsPage.js +32 -0
  152. package/dist/pages/account/ConnectedAppsPage.js.map +1 -0
  153. package/dist/pages/admin/AiPage.d.ts +2 -0
  154. package/dist/pages/admin/AiPage.d.ts.map +1 -0
  155. package/dist/pages/admin/AiPage.js +134 -0
  156. package/dist/pages/admin/AiPage.js.map +1 -0
  157. package/dist/pages/admin/McpPage.d.ts.map +1 -1
  158. package/dist/pages/admin/McpPage.js +7 -15
  159. package/dist/pages/admin/McpPage.js.map +1 -1
  160. package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
  161. package/dist/pages/admin/ModulesPage.js +5 -4
  162. package/dist/pages/admin/ModulesPage.js.map +1 -1
  163. package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
  164. package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
  165. package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
  166. package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
  167. package/dist/pages/auth/AuthLayout.d.ts +1 -1
  168. package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
  169. package/dist/pages/auth/AuthLayout.js +1 -1
  170. package/dist/pages/auth/AuthLayout.js.map +1 -1
  171. package/dist/pages/auth/SignUpPage.d.ts +1 -1
  172. package/dist/pages/auth/SignUpPage.js +1 -1
  173. package/dist/pages/dashboard/attention.d.ts +0 -5
  174. package/dist/pages/dashboard/attention.d.ts.map +1 -1
  175. package/dist/pages/dashboard/attention.js +1 -21
  176. package/dist/pages/dashboard/attention.js.map +1 -1
  177. package/dist/pages/dashboard/sections.d.ts.map +1 -1
  178. package/dist/pages/dashboard/sections.js +6 -3
  179. package/dist/pages/dashboard/sections.js.map +1 -1
  180. package/dist/pages/forms/SubmissionDetail.js +1 -1
  181. package/dist/pages/forms/SubmissionDetail.js.map +1 -1
  182. package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
  183. package/dist/pages/forms/SubmissionsTable.js +4 -3
  184. package/dist/pages/forms/SubmissionsTable.js.map +1 -1
  185. package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
  186. package/dist/pages/handbook/HandbookPage.js +2 -3
  187. package/dist/pages/handbook/HandbookPage.js.map +1 -1
  188. package/dist/pages/hiringDirectory.js +2 -2
  189. package/dist/pages/hiringDirectory.js.map +1 -1
  190. package/dist/pages/oauth/ConsentPage.d.ts +14 -0
  191. package/dist/pages/oauth/ConsentPage.d.ts.map +1 -0
  192. package/dist/pages/oauth/ConsentPage.js +87 -0
  193. package/dist/pages/oauth/ConsentPage.js.map +1 -0
  194. package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
  195. package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
  196. package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
  197. package/dist/pages/onboarding/onboardingModules.d.ts +1 -1
  198. package/dist/pages/onboarding/onboardingRerun.d.ts +10 -1
  199. package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
  200. package/dist/pages/onboarding/onboardingRerun.js +12 -1
  201. package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
  202. package/dist/pages/positionDirectory.js +2 -2
  203. package/dist/pages/positionDirectory.js.map +1 -1
  204. package/dist/registry/context.d.ts +3 -1
  205. package/dist/registry/context.d.ts.map +1 -1
  206. package/dist/registry/context.js +4 -0
  207. package/dist/registry/context.js.map +1 -1
  208. package/dist/registry/contributions.d.ts +39 -1
  209. package/dist/registry/contributions.d.ts.map +1 -1
  210. package/dist/registry/contributions.js +1 -1
  211. package/dist/registry/overridable.d.ts +1 -1
  212. package/dist/registry/registry.d.ts +8 -4
  213. package/dist/registry/registry.d.ts.map +1 -1
  214. package/dist/registry/registry.js +9 -1
  215. package/dist/registry/registry.js.map +1 -1
  216. package/package.json +2 -2
  217. package/src/api/client.ts +7 -6
  218. package/src/api/resource.ts +6 -7
  219. package/src/api/resources/ai.ts +110 -0
  220. package/src/api/resources/conversions.ts +1 -1
  221. package/src/api/resources/members.ts +2 -2
  222. package/src/api/resources/oauth.ts +112 -0
  223. package/src/api/resources/planItems.ts +1 -1
  224. package/src/api/resources/session.ts +4 -2
  225. package/src/api/resources/workspace.ts +4 -4
  226. package/src/app/KelpieApp.tsx +6 -0
  227. package/src/components/ActivitiesPanel.tsx +39 -10
  228. package/src/components/ActivityAction.tsx +33 -0
  229. package/src/components/AgentTasks.tsx +138 -10
  230. package/src/components/ApiKeysPanel.tsx +17 -0
  231. package/src/components/DecisionsPanel.tsx +9 -1
  232. package/src/components/LinkedText.tsx +51 -0
  233. package/src/components/MarkdownView.tsx +37 -7
  234. package/src/components/NotesPanel.tsx +18 -12
  235. package/src/components/Paginator.tsx +1 -1
  236. package/src/components/PlanPanel.tsx +9 -1
  237. package/src/components/RecordLinkTextarea.tsx +257 -0
  238. package/src/components/Shell.tsx +1 -1
  239. package/src/components/SummaryBlock.tsx +1 -1
  240. package/src/components/WorkspaceSwitcher.tsx +15 -1
  241. package/src/index.ts +10 -0
  242. package/src/lib/fragmentTarget.ts +96 -0
  243. package/src/lib/mcpConfig.ts +24 -0
  244. package/src/lib/money.ts +2 -2
  245. package/src/lib/recordLinks.ts +57 -0
  246. package/src/lib/recordReferences.ts +139 -0
  247. package/src/modules/ai.tsx +23 -0
  248. package/src/modules/aiRunner.ts +80 -0
  249. package/src/pages/CompanyDetail.tsx +2 -1
  250. package/src/pages/DealDetail.tsx +2 -1
  251. package/src/pages/DealsPage.tsx +1 -1
  252. package/src/pages/DecisionsPage.tsx +5 -3
  253. package/src/pages/EnquiryDetail.tsx +2 -1
  254. package/src/pages/EventDetail.tsx +2 -1
  255. package/src/pages/FormsPage.tsx +1 -1
  256. package/src/pages/FundraisingPage.tsx +1 -1
  257. package/src/pages/OpportunitiesPage.tsx +1 -1
  258. package/src/pages/OpportunityDetail.tsx +2 -1
  259. package/src/pages/PartnershipDetail.tsx +2 -1
  260. package/src/pages/PartnershipsPage.tsx +1 -1
  261. package/src/pages/PersonDetail.tsx +4 -3
  262. package/src/pages/RaiseDetail.tsx +2 -1
  263. package/src/pages/SearchPage.tsx +30 -15
  264. package/src/pages/account/AccountLayout.tsx +2 -1
  265. package/src/pages/account/ConnectedAppsPage.tsx +131 -0
  266. package/src/pages/admin/AiPage.tsx +353 -0
  267. package/src/pages/admin/McpPage.tsx +48 -27
  268. package/src/pages/admin/ModulesPage.tsx +5 -4
  269. package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
  270. package/src/pages/auth/AuthLayout.tsx +1 -1
  271. package/src/pages/auth/SignUpPage.tsx +1 -1
  272. package/src/pages/dashboard/attention.ts +1 -24
  273. package/src/pages/dashboard/sections.tsx +9 -4
  274. package/src/pages/forms/SubmissionDetail.tsx +1 -1
  275. package/src/pages/forms/SubmissionsTable.tsx +4 -3
  276. package/src/pages/handbook/HandbookPage.tsx +5 -6
  277. package/src/pages/hiringDirectory.ts +2 -2
  278. package/src/pages/oauth/ConsentPage.tsx +219 -0
  279. package/src/pages/onboarding/InvitesStepPage.tsx +1 -1
  280. package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
  281. package/src/pages/onboarding/onboardingModules.ts +1 -1
  282. package/src/pages/onboarding/onboardingRerun.ts +15 -1
  283. package/src/pages/positionDirectory.ts +2 -2
  284. package/src/registry/context.ts +6 -0
  285. package/src/registry/contributions.ts +31 -1
  286. package/src/registry/overridable.ts +1 -1
  287. package/src/registry/registry.ts +21 -3
@@ -23,14 +23,13 @@ import { TimezoneSearch } from '../../components/TimezoneSearch.tsx'
23
23
  /**
24
24
  * Workspace settings, and the one screen that can end a workspace.
25
25
  *
26
- * Ported from the mockup's Workspace page. Two differences, both because there
27
- * is an API behind it now: the slug is editable and can collide, and the danger
28
- * zone deletes for real, so it asks the reader to type the slug rather than
29
- * clicking one button.
26
+ * Ported from the mockup's Workspace page. One difference, because there is an
27
+ * API behind it now: the danger zone deletes for real, so it asks the reader to
28
+ * type the workspace name rather than clicking one button.
30
29
  *
31
30
  * The form saves explicitly instead of per keystroke. Every field here is
32
- * workspace-wide, and the slug appears in URLs, so committing on each character
33
- * would be a stream of half-typed addresses.
31
+ * workspace-wide, so committing on each character would be a stream of
32
+ * half-typed values.
34
33
  */
35
34
 
36
35
  export function WorkspaceSettingsPage(): React.JSX.Element {
@@ -57,7 +56,6 @@ function WorkspaceSettingsForm({
57
56
  const { session } = useSession()
58
57
  const update = useUpdateWorkspace()
59
58
  const [name, setName] = useState(workspace.name)
60
- const [slug, setSlug] = useState(workspace.slug)
61
59
  const [timezone, setTimezone] = useState(workspace.timezone)
62
60
  const [saved, setSaved] = useState(false)
63
61
 
@@ -70,7 +68,6 @@ function WorkspaceSettingsForm({
70
68
  update
71
69
  .runAsync({
72
70
  name: name.trim(),
73
- slug: slug.trim(),
74
71
  timezone,
75
72
  })
76
73
  .then(() => {
@@ -83,7 +80,7 @@ function WorkspaceSettingsForm({
83
80
  <div className="animate-slide-in mx-auto max-w-4xl space-y-8">
84
81
  <PageHeader
85
82
  title="Workspace"
86
- description="Name, address, and timezone."
83
+ description="Name and timezone."
87
84
  />
88
85
 
89
86
  <form onSubmit={save} className="space-y-4">
@@ -99,18 +96,6 @@ function WorkspaceSettingsForm({
99
96
  />
100
97
  </Field>
101
98
 
102
- <Field label="Slug" hint="Lowercase letters, digits, and hyphens. It appears in URLs.">
103
- <input
104
- value={slug}
105
- onChange={(event) => {
106
- setSlug(event.target.value)
107
- }}
108
- required
109
- disabled={!canEdit}
110
- className="w-full max-w-md rounded-md border border-border bg-surface-raised px-3 py-2 font-mono text-[13px] outline-none focus:border-accent focus:ring-2 focus:ring-accent/20 disabled:opacity-60"
111
- />
112
- </Field>
113
-
114
99
  <Field label="Timezone">
115
100
  <div className="max-w-md">
116
101
  <TimezoneSearch
@@ -146,7 +131,7 @@ function WorkspaceSettingsForm({
146
131
 
147
132
  <OwnCompanySection canEdit={canEdit} />
148
133
 
149
- {session?.role === 'owner' && <DangerZone slug={workspace.slug} />}
134
+ {session?.role === 'owner' && <DangerZone name={workspace.name} />}
150
135
  </div>
151
136
  )
152
137
  }
@@ -277,11 +262,11 @@ function OwnCompanySection({ canEdit }: { readonly canEdit: boolean }): React.JS
277
262
  /**
278
263
  * Deleting the workspace, behind the workspace's own name.
279
264
  *
280
- * Owner only, both here and in the API. The typed slug is what the request
265
+ * Owner only, both here and in the API. The typed name is what the request
281
266
  * carries, so this is the same guard on both sides rather than a browser-side
282
267
  * flourish over an endpoint that would have deleted anyway.
283
268
  */
284
- function DangerZone({ slug }: { readonly slug: string }): React.JSX.Element {
269
+ function DangerZone({ name }: { readonly name: string }): React.JSX.Element {
285
270
  const navigate = useNavigate()
286
271
  const remove = useDeleteWorkspace()
287
272
  const [confirmation, setConfirmation] = useState('')
@@ -290,7 +275,7 @@ function DangerZone({ slug }: { readonly slug: string }): React.JSX.Element {
290
275
  event.preventDefault()
291
276
 
292
277
  remove
293
- .runAsync({ slug: confirmation.trim() })
278
+ .runAsync({ name: confirmation.trim() })
294
279
  // Nothing left to render here: the workspace this page describes is gone,
295
280
  // and the account is back to having none.
296
281
  .then(() => navigate('/onboarding/workspace', { replace: true }))
@@ -307,19 +292,19 @@ function DangerZone({ slug }: { readonly slug: string }): React.JSX.Element {
307
292
  <form onSubmit={submit} className="mt-3 flex flex-wrap items-end gap-2">
308
293
  <label className="block">
309
294
  <span className="mb-1.5 block text-[12px] font-medium text-ink">
310
- Type <span className="font-mono">{slug}</span> to confirm
295
+ Type <span className="font-semibold">{name}</span> to confirm
311
296
  </span>
312
297
  <input
313
298
  value={confirmation}
314
299
  onChange={(event) => {
315
300
  setConfirmation(event.target.value)
316
301
  }}
317
- className="w-56 rounded-md border border-border bg-surface-raised px-3 py-1.5 font-mono text-[12px] outline-none focus:border-danger"
302
+ className="w-56 rounded-md border border-border bg-surface-raised px-3 py-1.5 text-[12px] outline-none focus:border-danger"
318
303
  />
319
304
  </label>
320
305
  <button
321
306
  type="submit"
322
- disabled={confirmation.trim() !== slug || remove.isPending}
307
+ disabled={confirmation.trim() !== name || remove.isPending}
323
308
  className="rounded-md border border-danger bg-surface-raised px-3 py-1.5 text-[12px] font-medium text-danger transition hover:bg-danger hover:text-danger-fg disabled:opacity-40 disabled:hover:bg-surface-raised disabled:hover:text-danger"
324
309
  >
325
310
  {remove.isPending ? 'Deleting…' : 'Delete workspace'}
@@ -13,7 +13,7 @@ import { RegionSwitcher } from './RegionSwitcher.tsx'
13
13
  * those steps: a session already exists on this origin.
14
14
  */
15
15
 
16
- /** Onboarding, per `onboarding.md`: workspace, organisation, modules, invites, handbook. */
16
+ /** Onboarding, per `docs/guides/getting-started.md`: workspace, organisation, modules, invites, handbook. */
17
17
  const ONBOARDING_STEPS = [1, 2, 3, 4, 5] as const
18
18
 
19
19
  export type OnboardingStep = (typeof ONBOARDING_STEPS)[number]
@@ -13,7 +13,7 @@ import { AuthMethods } from './AuthMethods.tsx'
13
13
  /**
14
14
  * Creating an account, against `POST /v1/auth/signup`.
15
15
  *
16
- * Signup makes the user and nothing else, per `onboarding.md`, so success
16
+ * Signup makes the user and nothing else, so success
17
17
  * lands on the email-verification screen rather than in the app or the first
18
18
  * onboarding step: the account cannot create a workspace until it verifies.
19
19
  * The response sets the session cookie, which is why that next page can
@@ -9,6 +9,7 @@ import type {
9
9
 
10
10
  import type { ChipTone } from '../../components/Chip.tsx'
11
11
  import { formatDate, formatDay } from '../../lib/dates.ts'
12
+ import { targetHref } from '../../lib/recordLinks.ts'
12
13
 
13
14
  /**
14
15
  * Reading the workspace snapshot as a page: one attention list from the
@@ -20,20 +21,6 @@ import { formatDate, formatDay } from '../../lib/dates.ts'
20
21
  * re-derived it from its own clock would disagree with the totals beside it.
21
22
  */
22
23
 
23
- /** Where each kind of record lives. A Candidate has no page of its own: it is reached through its Role. */
24
- const ROUTES: Readonly<Record<RecordTargetType, string | undefined>> = {
25
- person: '/people',
26
- company: '/companies',
27
- deal: '/deals',
28
- opportunity: '/opportunities',
29
- partnership: '/partnerships',
30
- raise: '/fundraising',
31
- enquiry: '/enquiries',
32
- candidate: undefined,
33
- event: '/events',
34
- attendance: undefined,
35
- }
36
-
37
24
  const TARGET_TYPE_LABELS: Readonly<Record<RecordTargetType, string>> = {
38
25
  person: 'Person',
39
26
  company: 'Company',
@@ -51,16 +38,6 @@ export function targetTypeLabel(targetType: RecordTargetType): string {
51
38
  return TARGET_TYPE_LABELS[targetType]
52
39
  }
53
40
 
54
- /**
55
- * @returns The record's page, or undefined when it has none. A row without a
56
- * link renders as plain text rather than as a link to nowhere.
57
- */
58
- export function targetHref(targetType: RecordTargetType, targetId: string): string | undefined {
59
- const route = ROUTES[targetType]
60
-
61
- return route === undefined ? undefined : `${route}/${targetId}`
62
- }
63
-
64
41
  /** How a target reads when it is named on another record's row. */
65
42
  export function targetDescription(item: {
66
43
  readonly targetType: RecordTargetType
@@ -8,11 +8,14 @@ import type {
8
8
  import type { ReactNode } from 'react'
9
9
  import { Link } from 'react-router'
10
10
 
11
+ import { ActivityAction } from '../../components/ActivityAction.tsx'
11
12
  import { Chip } from '../../components/Chip.tsx'
13
+ import { LinkedText } from '../../components/LinkedText.tsx'
12
14
  import { MarkdownView } from '../../components/MarkdownView.tsx'
13
15
  import { SectionHeader } from '../../components/SectionHeader.tsx'
14
16
  import { formatDate, formatRelativeTime } from '../../lib/dates.ts'
15
- import { targetHref, targetTypeLabel } from './attention.ts'
17
+ import { targetHref } from '../../lib/recordLinks.ts'
18
+ import { targetTypeLabel } from './attention.ts'
16
19
  import type { AttentionRow } from './attention.ts'
17
20
 
18
21
  /**
@@ -169,7 +172,7 @@ export function ActivityFeed({
169
172
  <div className="flex items-baseline justify-between gap-3">
170
173
  <p className="min-w-0 text-[12px] leading-snug text-ink">
171
174
  <span className="font-semibold">{actorNameFor(activity, nameById)}</span>{' '}
172
- <span className="text-ink-muted">{activity.action}</span>
175
+ <ActivityAction action={activity.action} subject={activity.subject} />
173
176
  </p>
174
177
  <time
175
178
  dateTime={activity.createdAt.toISOString()}
@@ -184,7 +187,9 @@ export function ActivityFeed({
184
187
  <TargetLink target={activity} />
185
188
  </p>
186
189
  {activity.detail !== null && (
187
- <p className="text-[11px] leading-snug text-ink-faint">{activity.detail}</p>
190
+ <p className="text-[11px] leading-snug text-ink-faint">
191
+ <LinkedText text={activity.detail} references={activity.references} />
192
+ </p>
188
193
  )}
189
194
  </div>
190
195
  </li>
@@ -230,7 +235,7 @@ export function NotesList({
230
235
  <li key={note.id} className="py-3">
231
236
  <div className="flex items-start justify-between gap-2">
232
237
  <div className="line-clamp-3 min-w-0 flex-1">
233
- <MarkdownView source={note.body} />
238
+ <MarkdownView source={note.body} references={note.references} />
234
239
  </div>
235
240
  {note.pinned && (
236
241
  <span className="shrink-0 text-[10px] font-medium tracking-wide text-accent uppercase">
@@ -18,7 +18,7 @@ import { formatDateTime } from '../../lib/dates.ts'
18
18
  * rather than the forms list.
19
19
  */
20
20
 
21
- /** `api.md`: `?limit=` maxes out at 200. */
21
+ /** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
22
22
  const MAX_PAGE = 200
23
23
 
24
24
  export function SubmissionDetail(): React.JSX.Element {
@@ -17,8 +17,9 @@ import { formatDateTime } from '../../lib/dates.ts'
17
17
  * What has arrived through this form.
18
18
  *
19
19
  * Person and company names are joined client-side against one page each, the
20
- * same way the Decisions page does it: `api.md` has no include-expansion, and
21
- * neither list takes a set of bare ids. A record past those pages is still
20
+ * same way the Decisions page does it: the API has no include-expansion, and
21
+ * neither list filters on its own `?id=` (the repeatable id filters match a
22
+ * foreign key, not the record's id). A record past those pages is still
22
23
  * linked, by its type rather than its name, which beats a raw id.
23
24
  *
24
25
  * A row opens `/forms/:id/submissions/:submissionId`. Inline person/company
@@ -26,7 +27,7 @@ import { formatDateTime } from '../../lib/dates.ts'
26
27
  * also open the submission.
27
28
  */
28
29
 
29
- /** `api.md`: `?limit=` maxes out at 200. */
30
+ /** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
30
31
  const MAX_PAGE = 200
31
32
 
32
33
  export interface SubmissionsTableProps {
@@ -23,6 +23,7 @@ import {
23
23
  import { useMembers } from '../../api/resources/members.ts'
24
24
  import { AgentTasks } from '../../components/AgentTasks.tsx'
25
25
  import { MarkdownView } from '../../components/MarkdownView.tsx'
26
+ import { RecordLinkTextarea } from '../../components/RecordLinkTextarea.tsx'
26
27
  import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
27
28
  import { formatDateTime } from '../../lib/dates.ts'
28
29
  import { INDENT, descendantIds, flattenTree, landingMoves, projectDrop } from './tree.ts'
@@ -482,18 +483,16 @@ function HandbookEditor({
482
483
  </div>
483
484
  )}
484
485
  {editing ? (
485
- <textarea
486
+ <RecordLinkTextarea
486
487
  value={body}
487
- aria-label="Page body"
488
- onChange={(event) => {
489
- setBody(event.target.value)
490
- }}
488
+ ariaLabel="Page body"
489
+ onChange={setBody}
491
490
  className="min-h-[480px] w-full resize-y rounded-md border border-border bg-surface p-4 font-mono text-[13px] leading-relaxed outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"
492
491
  spellCheck
493
492
  />
494
493
  ) : (
495
494
  <div className="animate-slide-in max-w-3xl">
496
- <MarkdownView source={page.body} />
495
+ <MarkdownView source={page.body} references={page.references} />
497
496
  </div>
498
497
  )}
499
498
  </div>
@@ -10,12 +10,12 @@ import { useRoles } from '../api/resources/roles.ts'
10
10
  * The counts and names the hiring pages need beside their own records.
11
11
  *
12
12
  * A candidacy carries two ids and no words, so every page showing one needs a
13
- * second resource to render it. `api.md` has no include-expansion; it has
13
+ * second resource to render it. The API has no include-expansion; it has
14
14
  * repeatable id filters, so each of these asks about exactly the rows on screen:
15
15
  * one extra request for the page rather than one per row.
16
16
  */
17
17
 
18
- /** `api.md`: `?limit=` and an id filter both max out at 200. */
18
+ /** `?limit=` and an id filter both max out at 200 (`docs/agents/api-and-webhooks.md`). */
19
19
  const MAX_PAGE = 200
20
20
 
21
21
  export interface RoleCandidateCounts {
@@ -0,0 +1,219 @@
1
+ import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas'
2
+ import type { ApiKeyScope, OAuthRequest } from '@kelpie/schemas'
3
+ import { useState } from 'react'
4
+ import { Link, Navigate, useParams } from 'react-router'
5
+
6
+ import { useApproveOAuthRequest, useDenyOAuthRequest, useOAuthRequest } from '../../api/resources/oauth.ts'
7
+ import { useSession } from '../../api/resources/session.ts'
8
+ import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
9
+ import { AuthLayout } from '../auth/AuthLayout.tsx'
10
+
11
+ /**
12
+ * Where an MCP client sends a person to approve a connection:
13
+ * `/consent/:requestId`, reached by redirect from `/oauth/authorize`.
14
+ *
15
+ * Outside the session gate, like `/join`: a signed-out person is sent to sign
16
+ * in and brought back here, rather than landing on the dashboard with the
17
+ * request lost.
18
+ *
19
+ * The page shows the client's host as well as its name. A name is whatever the
20
+ * client registered; the host is where the browser will be sent, and is the
21
+ * part a person can check.
22
+ */
23
+ export function ConsentPage(): React.JSX.Element {
24
+ const { requestId = '' } = useParams()
25
+ const { isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession()
26
+
27
+ if (isSignedOut) {
28
+ return <Navigate to={`/login?next=${encodeURIComponent(`/consent/${requestId}`)}`} replace />
29
+ }
30
+
31
+ if (sessionError !== null) {
32
+ return (
33
+ <AuthLayout title="Connect an app">
34
+ <div className="mt-4">
35
+ <ErrorPanel error={sessionError} />
36
+ </div>
37
+ </AuthLayout>
38
+ )
39
+ }
40
+
41
+ if (sessionLoading) {
42
+ return <LoadingPanel />
43
+ }
44
+
45
+ return <ConsentForRequest requestId={requestId} />
46
+ }
47
+
48
+ function ConsentForRequest({ requestId }: { readonly requestId: string }): React.JSX.Element {
49
+ const { request, isLoading, error } = useOAuthRequest(requestId)
50
+
51
+ if (error !== null) {
52
+ return (
53
+ <AuthLayout
54
+ title="This request is no longer valid"
55
+ description="It has expired, or it was already answered. Go back to the app and connect again."
56
+ >
57
+ <div className="mt-4">
58
+ <ErrorPanel error={error} />
59
+ </div>
60
+ </AuthLayout>
61
+ )
62
+ }
63
+
64
+ if (isLoading || request === undefined) {
65
+ return <LoadingPanel label="Loading the request…" />
66
+ }
67
+
68
+ return <ConsentForm request={request} />
69
+ }
70
+
71
+ function ConsentForm({ request }: { readonly request: OAuthRequest }): React.JSX.Element {
72
+ const approve = useApproveOAuthRequest()
73
+ const deny = useDenyOAuthRequest()
74
+ const [workspaceId, setWorkspaceId] = useState(request.workspaces[0]?.id ?? '')
75
+ const [scopes, setScopes] = useState<readonly ApiKeyScope[]>(request.scopes)
76
+ const [leaving, setLeaving] = useState(false)
77
+ const busy = approve.isPending || deny.isPending || leaving
78
+
79
+ function leaveTo(url: string): void {
80
+ // The redirect goes to the client, which may be another site or an app on
81
+ // this computer, so it is a full navigation and not a router one.
82
+ setLeaving(true)
83
+ window.location.assign(url)
84
+ }
85
+
86
+ function toggle(scope: ApiKeyScope): void {
87
+ setScopes((current) => (current.includes(scope) ? current.filter((entry) => entry !== scope) : [...current, scope]))
88
+ }
89
+
90
+ if (request.workspaces.length === 0) {
91
+ return (
92
+ <AuthLayout
93
+ title={`Connect ${request.clientName}`}
94
+ description="A connection is made to one workspace, and this account is not a member of any."
95
+ >
96
+ <p className="mt-4 text-[13px] text-ink-muted">
97
+ <Link to="/onboarding/workspace" className="text-accent hover:underline">
98
+ Create a workspace
99
+ </Link>
100
+ , then go back to the app and connect again.
101
+ </p>
102
+ </AuthLayout>
103
+ )
104
+ }
105
+
106
+ if (leaving) {
107
+ return (
108
+ <AuthLayout title="Returning to the app" description={`Sending you back to ${request.clientHost}.`}>
109
+ <p className="mt-4 text-[13px] text-ink-muted">You can close this tab if it does not move on.</p>
110
+ </AuthLayout>
111
+ )
112
+ }
113
+
114
+ return (
115
+ <AuthLayout
116
+ title={`Connect ${request.clientName}`}
117
+ description="This app wants to use Kelpie as you, through MCP."
118
+ footer={
119
+ <p className="text-[11px] text-ink-faint">
120
+ Remove the connection at any time under Account, Connected apps.
121
+ </p>
122
+ }
123
+ >
124
+ <div className="mt-5 space-y-4">
125
+ <div className="rounded-md border border-border bg-surface px-3 py-2.5">
126
+ <p className="text-[11px] font-medium tracking-wide text-ink-muted uppercase">Sends you back to</p>
127
+ <p className="mt-0.5 font-mono text-[13px] break-all text-ink">{request.clientHost}</p>
128
+ {request.clientUri !== null && (
129
+ <a
130
+ href={request.clientUri}
131
+ target="_blank"
132
+ rel="noreferrer"
133
+ className="mt-1 inline-block text-[12px] text-accent hover:underline"
134
+ >
135
+ About this app
136
+ </a>
137
+ )}
138
+ </div>
139
+
140
+ <label className="block">
141
+ <span className="mb-1.5 block text-[12px] font-medium text-ink">Workspace</span>
142
+ <select
143
+ value={workspaceId}
144
+ onChange={(event) => {
145
+ setWorkspaceId(event.target.value)
146
+ }}
147
+ className="w-full rounded-md border border-border bg-surface px-3 py-2 text-[13px] text-ink outline-none focus:border-accent"
148
+ >
149
+ {request.workspaces.map((workspace) => (
150
+ <option key={workspace.id} value={workspace.id}>
151
+ {workspace.name}
152
+ </option>
153
+ ))}
154
+ </select>
155
+ <span className="mt-1 block text-[11px] text-ink-faint">
156
+ The app sees this workspace only. To use another, connect again.
157
+ </span>
158
+ </label>
159
+
160
+ <fieldset>
161
+ <legend className="mb-1.5 text-[12px] font-medium text-ink">Access</legend>
162
+ <div className="space-y-1.5">
163
+ {request.scopes.map((scope) => (
164
+ <label key={scope} className="flex items-center gap-2 text-[13px] text-ink">
165
+ <input
166
+ type="checkbox"
167
+ checked={scopes.includes(scope)}
168
+ onChange={() => {
169
+ toggle(scope)
170
+ }}
171
+ />
172
+ {API_KEY_SCOPE_LABELS[scope]}
173
+ </label>
174
+ ))}
175
+ </div>
176
+ <p className="mt-1.5 text-[11px] text-ink-faint">
177
+ The app can do no more than your own role allows. Clear an item to give less access.
178
+ </p>
179
+ </fieldset>
180
+
181
+ {approve.error !== null && <ErrorPanel error={approve.error} />}
182
+ {deny.error !== null && <ErrorPanel error={deny.error} />}
183
+
184
+ <div className="flex gap-2">
185
+ <button
186
+ type="button"
187
+ disabled={busy}
188
+ onClick={() => {
189
+ deny
190
+ .runAsync(request.id)
191
+ .then((decision) => {
192
+ leaveTo(decision.redirectUrl)
193
+ })
194
+ .catch(() => undefined)
195
+ }}
196
+ className="flex-1 rounded-md border border-border px-3.5 py-2 text-[12px] font-semibold text-ink transition hover:border-border-strong disabled:opacity-50"
197
+ >
198
+ Deny
199
+ </button>
200
+ <button
201
+ type="button"
202
+ disabled={busy || scopes.length === 0 || workspaceId.length === 0}
203
+ onClick={() => {
204
+ approve
205
+ .runAsync({ requestId: request.id, workspaceId, scopes })
206
+ .then((decision) => {
207
+ leaveTo(decision.redirectUrl)
208
+ })
209
+ .catch(() => undefined)
210
+ }}
211
+ className="flex-1 rounded-md bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-fg transition hover:bg-accent-hover disabled:opacity-50"
212
+ >
213
+ {approve.isPending ? 'Connecting…' : 'Allow'}
214
+ </button>
215
+ </div>
216
+ </div>
217
+ </AuthLayout>
218
+ )
219
+ }
@@ -18,7 +18,7 @@ import { isOnboardingRerun } from './onboardingRerun.ts'
18
18
  * this because it sent nothing. Here a row carries its own outcome, a sent one
19
19
  * is never sent twice, and the step only advances once nothing is outstanding.
20
20
  *
21
- * Skippable, per `onboarding.md`. Admin → Team does the same job later.
21
+ * Skippable, per `docs/guides/getting-started.md`. Admin → Team does the same job later.
22
22
  */
23
23
 
24
24
  interface InviteRow {
@@ -7,7 +7,7 @@ import { ErrorPanel } from '../../components/QueryState.tsx'
7
7
  import { TextField } from '../auth/AuthForm.tsx'
8
8
  import { AuthLayout } from '../auth/AuthLayout.tsx'
9
9
  import { OnboardingNav } from './OnboardingNav.tsx'
10
- import { isOnboardingRerun, ONBOARDING_ORG_PARAM, onboardingPath } from './onboardingRerun.ts'
10
+ import { isNewWorkspace, isOnboardingRerun, ONBOARDING_ORG_PARAM, onboardingPath } from './onboardingRerun.ts'
11
11
 
12
12
  /**
13
13
  * Onboarding step 1: the workspace, against `POST /v1/workspaces`.
@@ -26,15 +26,6 @@ import { isOnboardingRerun, ONBOARDING_ORG_PARAM, onboardingPath } from './onboa
26
26
  * signed out fills in a form whose only possible answer is `401`.
27
27
  */
28
28
 
29
- /** The rule the API enforces: lowercase letters, digits, and hyphens. */
30
- function slugify(name: string): string {
31
- return name
32
- .toLowerCase()
33
- .replace(/[^a-z0-9]+/gu, '-')
34
- .replace(/^-+|-+$/gu, '')
35
- .slice(0, 63)
36
- }
37
-
38
29
  /**
39
30
  * The zone the browser is in.
40
31
  *
@@ -50,32 +41,18 @@ export function WorkspaceStepPage(): React.JSX.Element {
50
41
  const navigate = useNavigate()
51
42
  const [searchParams] = useSearchParams()
52
43
  const rerun = isOnboardingRerun(searchParams)
44
+ const adding = isNewWorkspace(searchParams)
53
45
  const { isSignedOut, session } = useSession()
54
46
  const createWorkspace = useCreateWorkspace()
55
47
  const hasWorkspace = session?.workspaceId !== null && session?.workspaceId !== undefined
56
48
  const [name, setName] = useState('')
57
- const [slug, setSlug] = useState('')
58
- const [slugEdited, setSlugEdited] = useState(false)
59
49
  const [timezone] = useState(browserTimezone)
60
50
 
61
- function changeName(value: string): void {
62
- setName(value)
63
-
64
- if (!slugEdited) {
65
- setSlug(slugify(value))
66
- }
67
- }
68
-
69
- function changeSlug(value: string): void {
70
- setSlugEdited(true)
71
- setSlug(slugify(value))
72
- }
73
-
74
51
  function submit(event: FormEvent): void {
75
52
  event.preventDefault()
76
53
 
77
54
  createWorkspace
78
- .runAsync({ name: name.trim(), slug: slug.trim(), timezone })
55
+ .runAsync({ name: name.trim(), timezone })
79
56
  .then(() => {
80
57
  navigate('/onboarding/organisation', { replace: true })
81
58
  })
@@ -88,11 +65,12 @@ export function WorkspaceStepPage(): React.JSX.Element {
88
65
 
89
66
  /**
90
67
  * Previous on a later step lands here after the workspace already exists.
91
- * Showing the create form again would offer a second POST that this account
92
- * cannot use. Next is the only action that remains. A rerun keeps the flag
93
- * so organisation does not seed handbook pages and the review step is skipped.
68
+ * Showing the create form again would make a second workspace by accident,
69
+ * so Next is the only action. The workspace menu asks for the form on
70
+ * purpose with `?new=1`. A rerun keeps its flag so organisation does not
71
+ * seed handbook pages and the review step is skipped.
94
72
  */
95
- if (hasWorkspace) {
73
+ if (hasWorkspace && !adding) {
96
74
  return (
97
75
  <AuthLayout
98
76
  step={1}
@@ -124,31 +102,29 @@ export function WorkspaceStepPage(): React.JSX.Element {
124
102
  return (
125
103
  <AuthLayout
126
104
  step={1}
127
- title="Create your workspace"
105
+ title={adding ? 'Create a new workspace' : 'Create your workspace'}
128
106
  description="A workspace is your company brain — CRM records, handbook, and team."
129
107
  footer={
130
- <Link to="/login" className="font-medium text-accent hover:underline">
131
- Sign in as somebody else
132
- </Link>
108
+ adding ? (
109
+ <Link to="/dashboard" className="font-medium text-accent hover:underline">
110
+ Cancel
111
+ </Link>
112
+ ) : (
113
+ <Link to="/login" className="font-medium text-accent hover:underline">
114
+ Sign in as somebody else
115
+ </Link>
116
+ )
133
117
  }
134
118
  >
135
119
  <form onSubmit={submit} className="mt-5 space-y-3">
136
120
  <TextField
137
121
  label="Workspace name"
138
122
  value={name}
139
- onChange={changeName}
123
+ onChange={setName}
140
124
  placeholder="Acme Labs"
141
125
  autoComplete="organization"
142
126
  required
143
127
  />
144
- <TextField
145
- label="Slug"
146
- value={slug}
147
- onChange={changeSlug}
148
- hint="Lowercase letters, digits, and hyphens. It appears in URLs."
149
- mono
150
- required
151
- />
152
128
  <p className="text-[11px] text-ink-faint">
153
129
  Timezone: {timezone}. Change it later in Admin → Workspace.
154
130
  </p>
@@ -8,7 +8,7 @@ import type { OrganisationChoiceId } from './handbookTemplates.ts'
8
8
  * what writes the first `workspace_module_settings` rows for these six.
9
9
  *
10
10
  * Labels stay the domain names. Defaults and explanations follow the
11
- * organisation type chosen on the previous step (`onboarding.md`).
11
+ * organisation type chosen on the previous step (`docs/guides/getting-started.md`).
12
12
  */
13
13
 
14
14
  export type OnboardingModuleId =