@kelpie/ui 0.16.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.
- package/dist/api/client.d.ts +1 -1
- package/dist/api/resources/ai.d.ts +16 -0
- package/dist/api/resources/ai.d.ts.map +1 -0
- package/dist/api/resources/ai.js +93 -0
- package/dist/api/resources/ai.js.map +1 -0
- package/dist/api/resources/conversions.js +1 -1
- package/dist/api/resources/conversions.js.map +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +3 -1
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/workspace.d.ts +2 -2
- package/dist/api/resources/workspace.js +2 -2
- package/dist/components/ActivitiesPanel.d.ts +7 -4
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +12 -2
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/ActivityAction.d.ts +15 -0
- package/dist/components/ActivityAction.d.ts.map +1 -0
- package/dist/components/ActivityAction.js +20 -0
- package/dist/components/ActivityAction.js.map +1 -0
- package/dist/components/AgentTasks.d.ts +5 -0
- package/dist/components/AgentTasks.d.ts.map +1 -1
- package/dist/components/AgentTasks.js +88 -10
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +3 -1
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/LinkedText.d.ts +12 -0
- package/dist/components/LinkedText.d.ts.map +1 -0
- package/dist/components/LinkedText.js +25 -0
- package/dist/components/LinkedText.js.map +1 -0
- package/dist/components/MarkdownView.d.ts +3 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +17 -3
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts +2 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +6 -7
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/PlanPanel.d.ts.map +1 -1
- package/dist/components/PlanPanel.js +3 -1
- package/dist/components/PlanPanel.js.map +1 -1
- package/dist/components/RecordLinkTextarea.d.ts +12 -0
- package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
- package/dist/components/RecordLinkTextarea.js +142 -0
- package/dist/components/RecordLinkTextarea.js.map +1 -0
- package/dist/components/WorkspaceSwitcher.d.ts +2 -1
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
- package/dist/components/WorkspaceSwitcher.js +7 -2
- package/dist/components/WorkspaceSwitcher.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/fragmentTarget.d.ts +18 -0
- package/dist/lib/fragmentTarget.d.ts.map +1 -0
- package/dist/lib/fragmentTarget.js +73 -0
- package/dist/lib/fragmentTarget.js.map +1 -0
- package/dist/lib/recordLinks.d.ts +17 -0
- package/dist/lib/recordLinks.d.ts.map +1 -0
- package/dist/lib/recordLinks.js +48 -0
- package/dist/lib/recordLinks.js.map +1 -0
- package/dist/lib/recordReferences.d.ts +41 -0
- package/dist/lib/recordReferences.d.ts.map +1 -0
- package/dist/lib/recordReferences.js +92 -0
- package/dist/lib/recordReferences.js.map +1 -0
- package/dist/modules/ai.d.ts +13 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +22 -0
- package/dist/modules/ai.js.map +1 -0
- package/dist/modules/aiRunner.d.ts +3 -0
- package/dist/modules/aiRunner.d.ts.map +1 -0
- package/dist/modules/aiRunner.js +66 -0
- package/dist/modules/aiRunner.js.map +1 -0
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +2 -1
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +2 -1
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/EnquiryDetail.d.ts.map +1 -1
- package/dist/pages/EnquiryDetail.js +2 -1
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.d.ts.map +1 -1
- package/dist/pages/EventDetail.js +2 -1
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/OpportunityDetail.d.ts.map +1 -1
- package/dist/pages/OpportunityDetail.js +2 -1
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.d.ts.map +1 -1
- package/dist/pages/PartnershipDetail.js +2 -1
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +2 -1
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.d.ts.map +1 -1
- package/dist/pages/RaiseDetail.js +2 -1
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +26 -14
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/admin/AiPage.d.ts +2 -0
- package/dist/pages/admin/AiPage.d.ts.map +1 -0
- package/dist/pages/admin/AiPage.js +134 -0
- package/dist/pages/admin/AiPage.js.map +1 -0
- package/dist/pages/admin/McpPage.js +2 -2
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
- package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
- package/dist/pages/dashboard/attention.d.ts +0 -5
- package/dist/pages/dashboard/attention.d.ts.map +1 -1
- package/dist/pages/dashboard/attention.js +1 -21
- package/dist/pages/dashboard/attention.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +6 -3
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
- package/dist/pages/handbook/HandbookPage.js +2 -3
- package/dist/pages/handbook/HandbookPage.js.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
- package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +9 -0
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +11 -0
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/registry/context.d.ts +3 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +4 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +38 -0
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/registry.d.ts +5 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +8 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +1 -1
- package/src/api/resources/ai.ts +110 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/session.ts +3 -1
- package/src/api/resources/workspace.ts +4 -4
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- package/src/components/DecisionsPanel.tsx +9 -1
- package/src/components/LinkedText.tsx +51 -0
- package/src/components/MarkdownView.tsx +37 -7
- package/src/components/NotesPanel.tsx +18 -12
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +10 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/recordLinks.ts +57 -0
- package/src/lib/recordReferences.ts +139 -0
- package/src/modules/ai.tsx +23 -0
- package/src/modules/aiRunner.ts +80 -0
- package/src/pages/CompanyDetail.tsx +2 -1
- package/src/pages/DealDetail.tsx +2 -1
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PersonDetail.tsx +2 -1
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/admin/AiPage.tsx +353 -0
- package/src/pages/admin/McpPage.tsx +11 -5
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- package/src/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingRerun.ts +14 -0
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +30 -0
- package/src/registry/registry.ts +18 -0
|
@@ -63,8 +63,8 @@ export function McpPage(): React.JSX.Element {
|
|
|
63
63
|
<p className="mt-2 max-w-2xl text-[13px] leading-relaxed text-ink-muted">
|
|
64
64
|
Kelpie is a CRM and a company brain. Every REST operation is also an MCP tool over
|
|
65
65
|
Streamable HTTP, so an agent reads and writes the same records the app does, through the
|
|
66
|
-
same API. Point Claude, Cursor, or any MCP client at this workspace
|
|
67
|
-
AI
|
|
66
|
+
same API. Point Claude, Cursor, or any MCP client at this workspace: bring your own agent.
|
|
67
|
+
An install with the AI module can also run tasks on your own OpenAI or Anthropic key.
|
|
68
68
|
</p>
|
|
69
69
|
<ul className="mt-4 space-y-2 text-[13px] text-ink">
|
|
70
70
|
<li className="flex gap-2">
|
|
@@ -251,9 +251,15 @@ function RegisteredAgents(): React.JSX.Element {
|
|
|
251
251
|
<li key={agent.id} className="flex flex-wrap items-center justify-between gap-3 px-3 py-2.5">
|
|
252
252
|
<div className="min-w-0">
|
|
253
253
|
<div className="text-[13px] font-medium text-ink">{agent.name}</div>
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
{agent.managedBy === null ? (
|
|
255
|
+
<code className="font-mono text-[11px] break-all text-ink-muted">
|
|
256
|
+
{agent.endpoint}
|
|
257
|
+
</code>
|
|
258
|
+
) : (
|
|
259
|
+
// A module-managed agent is dispatched in-process; its stored
|
|
260
|
+
// endpoint is not an address anything calls.
|
|
261
|
+
<span className="text-[11px] text-ink-muted">Runs inside Kelpie ({agent.managedBy} module)</span>
|
|
262
|
+
)}
|
|
257
263
|
</div>
|
|
258
264
|
<div className="flex shrink-0 items-center gap-3 text-[11px] text-ink-faint">
|
|
259
265
|
{agent.hasAuthHeader && <span>Auth header set</span>}
|
|
@@ -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.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
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,
|
|
33
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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({
|
|
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({
|
|
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-
|
|
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
|
|
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() !==
|
|
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'}
|
|
@@ -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
|
|
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
|
-
<
|
|
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">
|
|
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">
|
|
@@ -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
|
-
<
|
|
486
|
+
<RecordLinkTextarea
|
|
486
487
|
value={body}
|
|
487
|
-
|
|
488
|
-
onChange={
|
|
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>
|
|
@@ -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(),
|
|
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
|
|
92
|
-
*
|
|
93
|
-
*
|
|
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=
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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={
|
|
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>
|
|
@@ -19,6 +19,20 @@ export function isOnboardingRerun(searchParams: URLSearchParams): boolean {
|
|
|
19
19
|
return searchParams.get(ONBOARDING_RERUN_PARAM) === ONBOARDING_RERUN_VALUE
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* An account that already has a workspace can add another from the workspace
|
|
24
|
+
* menu. `?new=1` shows the create form on step 1 instead of "ready". The new
|
|
25
|
+
* workspace then walks the whole wizard, handbook seeding included.
|
|
26
|
+
*/
|
|
27
|
+
export const ONBOARDING_NEW_PARAM = 'new'
|
|
28
|
+
|
|
29
|
+
/** Entry URL the workspace menu opens to add a workspace. */
|
|
30
|
+
export const ONBOARDING_NEW_WORKSPACE_ENTRY = `/onboarding/workspace?${ONBOARDING_NEW_PARAM}=1`
|
|
31
|
+
|
|
32
|
+
export function isNewWorkspace(searchParams: URLSearchParams): boolean {
|
|
33
|
+
return searchParams.get(ONBOARDING_NEW_PARAM) === '1'
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
* Keep the rerun flag and the organisation type when moving between onboarding
|
|
24
38
|
* routes. `org` is how the modules step knows which defaults to offer; nothing
|
package/src/registry/context.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { createContext, useContext } from 'react'
|
|
|
2
2
|
import type { ComponentType } from 'react'
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
+
AgentRunner,
|
|
5
6
|
AuthMethod,
|
|
6
7
|
DashboardCard,
|
|
7
8
|
ExtensibleRecordType,
|
|
@@ -59,6 +60,11 @@ export function useAuthMethods(): readonly AuthMethod[] {
|
|
|
59
60
|
return useUiExtensions().authMethods()
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
/** The agent the Agent menu's Run button dispatches to, when a module provides one. */
|
|
64
|
+
export function useAgentRunner(): AgentRunner | undefined {
|
|
65
|
+
return useUiExtensions().agentRunner()
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
/**
|
|
63
69
|
* The component to render for an overridable: a module's replacement, or core's
|
|
64
70
|
* own. Core calls this instead of rendering its component directly.
|
|
@@ -94,3 +94,33 @@ export interface DashboardCard {
|
|
|
94
94
|
readonly render: () => ReactNode
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether the runner can take a task now, for the workspace the viewer is in.
|
|
100
|
+
* `reason` is a sentence the Agent menu shows on its disabled Run button.
|
|
101
|
+
*/
|
|
102
|
+
export type AgentRunnerAvailability =
|
|
103
|
+
| { readonly status: 'loading' }
|
|
104
|
+
| { readonly status: 'unavailable'; readonly reason: string }
|
|
105
|
+
| { readonly status: 'ready'; readonly agentId: string }
|
|
106
|
+
|
|
107
|
+
/** Where a dispatched run got to, once core has handed it to the runner's agent. */
|
|
108
|
+
export type AgentRunnerProgress =
|
|
109
|
+
| { readonly status: 'running' }
|
|
110
|
+
| { readonly status: 'succeeded' }
|
|
111
|
+
| { readonly status: 'failed'; readonly reason: string }
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The agent the Agent menu's Run button dispatches to, with no dialog.
|
|
115
|
+
*
|
|
116
|
+
* Core has no model of its own, so with no runner registered Run stays
|
|
117
|
+
* disabled and Preview is the way to reach a registered agent. Both members are
|
|
118
|
+
* React hooks: the menu calls them on every render, so they follow the Rules of
|
|
119
|
+
* Hooks, and `enabled` lets the menu defer the fetch until it opens.
|
|
120
|
+
*/
|
|
121
|
+
export interface AgentRunner {
|
|
122
|
+
readonly id: string
|
|
123
|
+
readonly useAvailability: (options: { readonly enabled: boolean }) => AgentRunnerAvailability
|
|
124
|
+
/** Progress for the core agent run `agentRunId`. `undefined` polls nothing. */
|
|
125
|
+
readonly useProgress: (agentRunId: string | undefined) => AgentRunnerProgress | undefined
|
|
126
|
+
}
|
package/src/registry/registry.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
AgentRunner,
|
|
4
5
|
AuthMethod,
|
|
5
6
|
DashboardCard,
|
|
6
7
|
ExtensibleRecordType,
|
|
@@ -34,6 +35,8 @@ export interface UiModuleContext {
|
|
|
34
35
|
dashboardCard(card: DashboardCard): void
|
|
35
36
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
36
37
|
authMethod(method: AuthMethod): void
|
|
38
|
+
/** The agent the Agent menu's Run button dispatches to. One per assembly. */
|
|
39
|
+
agentRunner(runner: AgentRunner): void
|
|
37
40
|
/** Replaces a core component. Prefer a slot. */
|
|
38
41
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void
|
|
39
42
|
}
|
|
@@ -51,6 +54,8 @@ export interface UiExtensions {
|
|
|
51
54
|
recordSidebarCards(objectType: ExtensibleRecordType): readonly RecordSidebarCard[]
|
|
52
55
|
dashboardCards(): readonly DashboardCard[]
|
|
53
56
|
authMethods(): readonly AuthMethod[]
|
|
57
|
+
/** The registered runner, or `undefined` when no module provides one. */
|
|
58
|
+
agentRunner(): AgentRunner | undefined
|
|
54
59
|
componentFor<Props>(token: Overridable<Props>): ComponentType<Props>
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -69,6 +74,7 @@ export function inSlotOrder<T extends { readonly order?: number }>(items: readon
|
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
interface Accumulator {
|
|
77
|
+
agentRunner?: AgentRunner
|
|
72
78
|
readonly nav: Map<NavSlot, NavItem[]>
|
|
73
79
|
readonly routes: RouteContribution[]
|
|
74
80
|
readonly recordTabs: Map<ExtensibleRecordType, RecordTab[]>
|
|
@@ -144,6 +150,17 @@ function createModuleContext(
|
|
|
144
150
|
accumulator.authMethods.push(method)
|
|
145
151
|
},
|
|
146
152
|
|
|
153
|
+
agentRunner(runner) {
|
|
154
|
+
// One button, one agent: a second runner would silently win or lose.
|
|
155
|
+
if (accumulator.agentRunner !== undefined) {
|
|
156
|
+
throw new UiModuleError(
|
|
157
|
+
`module "${module.id}" contributes agent runner "${runner.id}", but "${accumulator.agentRunner.id}" is already registered`,
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
accumulator.agentRunner = runner
|
|
162
|
+
},
|
|
163
|
+
|
|
147
164
|
override(token, component) {
|
|
148
165
|
if (accumulator.overrides.has(token.key)) {
|
|
149
166
|
throw new UiModuleError(
|
|
@@ -191,6 +208,7 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
191
208
|
inSlotOrder(accumulator.recordSidebarCards.get(objectType) ?? []),
|
|
192
209
|
dashboardCards: () => inSlotOrder(accumulator.dashboardCards),
|
|
193
210
|
authMethods: () => inSlotOrder(accumulator.authMethods),
|
|
211
|
+
agentRunner: () => accumulator.agentRunner,
|
|
194
212
|
componentFor: (token) => accumulator.overrides.get(token),
|
|
195
213
|
}
|
|
196
214
|
}
|