@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.
- package/dist/api/client.d.ts +6 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +2 -2
- package/dist/api/client.js.map +1 -1
- package/dist/api/resource.d.ts +4 -4
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +4 -5
- package/dist/api/resource.js.map +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/members.d.ts +2 -2
- package/dist/api/resources/oauth.d.ts +21 -0
- package/dist/api/resources/oauth.d.ts.map +1 -0
- package/dist/api/resources/oauth.js +74 -0
- package/dist/api/resources/oauth.js.map +1 -0
- package/dist/api/resources/planItems.d.ts +1 -1
- package/dist/api/resources/planItems.d.ts.map +1 -1
- package/dist/api/resources/planItems.js +1 -1
- package/dist/api/resources/planItems.js.map +1 -1
- package/dist/api/resources/session.d.ts +1 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +4 -2
- 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/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +3 -1
- package/dist/app/KelpieApp.js.map +1 -1
- 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/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +4 -1
- package/dist/components/ApiKeysPanel.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/Paginator.d.ts +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/Shell.js +1 -1
- package/dist/components/SummaryBlock.d.ts +1 -1
- package/dist/components/SummaryBlock.js +1 -1
- 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/mcpConfig.d.ts +10 -0
- package/dist/lib/mcpConfig.d.ts.map +1 -0
- package/dist/lib/mcpConfig.js +23 -0
- package/dist/lib/mcpConfig.js.map +1 -0
- package/dist/lib/money.d.ts +2 -2
- package/dist/lib/money.js +2 -2
- 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/DealsPage.js +1 -1
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +5 -3
- package/dist/pages/DecisionsPage.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/FundraisingPage.js +1 -1
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.js +1 -1
- package/dist/pages/OpportunitiesPage.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/PartnershipsPage.js +1 -1
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +4 -3
- 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/account/AccountLayout.d.ts.map +1 -1
- package/dist/pages/account/AccountLayout.js +2 -1
- package/dist/pages/account/AccountLayout.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +7 -0
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -0
- package/dist/pages/account/ConnectedAppsPage.js +32 -0
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -0
- 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.d.ts.map +1 -1
- package/dist/pages/admin/McpPage.js +7 -15
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
- package/dist/pages/admin/ModulesPage.js +5 -4
- package/dist/pages/admin/ModulesPage.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/auth/AuthLayout.d.ts +1 -1
- package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
- package/dist/pages/auth/AuthLayout.js +1 -1
- package/dist/pages/auth/AuthLayout.js.map +1 -1
- package/dist/pages/auth/SignUpPage.d.ts +1 -1
- package/dist/pages/auth/SignUpPage.js +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/forms/SubmissionDetail.js +1 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +4 -3
- package/dist/pages/forms/SubmissionsTable.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/hiringDirectory.js +2 -2
- package/dist/pages/hiringDirectory.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts +14 -0
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -0
- package/dist/pages/oauth/ConsentPage.js +87 -0
- package/dist/pages/oauth/ConsentPage.js.map +1 -0
- 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/onboardingModules.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +10 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +12 -1
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/pages/positionDirectory.js +2 -2
- package/dist/pages/positionDirectory.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 +39 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/contributions.js +1 -1
- package/dist/registry/overridable.d.ts +1 -1
- package/dist/registry/registry.d.ts +8 -4
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +9 -1
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +7 -6
- package/src/api/resource.ts +6 -7
- package/src/api/resources/ai.ts +110 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/members.ts +2 -2
- package/src/api/resources/oauth.ts +112 -0
- package/src/api/resources/planItems.ts +1 -1
- package/src/api/resources/session.ts +4 -2
- package/src/api/resources/workspace.ts +4 -4
- package/src/app/KelpieApp.tsx +6 -0
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- package/src/components/ApiKeysPanel.tsx +17 -0
- 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/Paginator.tsx +1 -1
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/Shell.tsx +1 -1
- package/src/components/SummaryBlock.tsx +1 -1
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +10 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/mcpConfig.ts +24 -0
- package/src/lib/money.ts +2 -2
- 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/DealsPage.tsx +1 -1
- package/src/pages/DecisionsPage.tsx +5 -3
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/FormsPage.tsx +1 -1
- package/src/pages/FundraisingPage.tsx +1 -1
- package/src/pages/OpportunitiesPage.tsx +1 -1
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PartnershipsPage.tsx +1 -1
- package/src/pages/PersonDetail.tsx +4 -3
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/account/AccountLayout.tsx +2 -1
- package/src/pages/account/ConnectedAppsPage.tsx +131 -0
- package/src/pages/admin/AiPage.tsx +353 -0
- package/src/pages/admin/McpPage.tsx +48 -27
- package/src/pages/admin/ModulesPage.tsx +5 -4
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/auth/AuthLayout.tsx +1 -1
- package/src/pages/auth/SignUpPage.tsx +1 -1
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- package/src/pages/forms/SubmissionDetail.tsx +1 -1
- package/src/pages/forms/SubmissionsTable.tsx +4 -3
- package/src/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/hiringDirectory.ts +2 -2
- package/src/pages/oauth/ConsentPage.tsx +219 -0
- package/src/pages/onboarding/InvitesStepPage.tsx +1 -1
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingModules.ts +1 -1
- package/src/pages/onboarding/onboardingRerun.ts +15 -1
- package/src/pages/positionDirectory.ts +2 -2
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +31 -1
- package/src/registry/overridable.ts +1 -1
- package/src/registry/registry.ts +21 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensibleRecordType } from '@kelpie/schemas';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
/**
|
|
4
|
-
* What a UI module may add to the shell
|
|
4
|
+
* What a UI module may add to the shell.
|
|
5
5
|
*
|
|
6
6
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
7
7
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -81,4 +81,42 @@ export interface DashboardCard {
|
|
|
81
81
|
readonly order?: number;
|
|
82
82
|
readonly render: () => ReactNode;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether the runner can take a task now, for the workspace the viewer is in.
|
|
86
|
+
* `reason` is a sentence the Agent menu shows on its disabled Run button.
|
|
87
|
+
*/
|
|
88
|
+
export type AgentRunnerAvailability = {
|
|
89
|
+
readonly status: 'loading';
|
|
90
|
+
} | {
|
|
91
|
+
readonly status: 'unavailable';
|
|
92
|
+
readonly reason: string;
|
|
93
|
+
} | {
|
|
94
|
+
readonly status: 'ready';
|
|
95
|
+
readonly agentId: string;
|
|
96
|
+
};
|
|
97
|
+
/** Where a dispatched run got to, once core has handed it to the runner's agent. */
|
|
98
|
+
export type AgentRunnerProgress = {
|
|
99
|
+
readonly status: 'running';
|
|
100
|
+
} | {
|
|
101
|
+
readonly status: 'succeeded';
|
|
102
|
+
} | {
|
|
103
|
+
readonly status: 'failed';
|
|
104
|
+
readonly reason: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The agent the Agent menu's Run button dispatches to, with no dialog.
|
|
108
|
+
*
|
|
109
|
+
* Core has no model of its own, so with no runner registered Run stays
|
|
110
|
+
* disabled and Preview is the way to reach a registered agent. Both members are
|
|
111
|
+
* React hooks: the menu calls them on every render, so they follow the Rules of
|
|
112
|
+
* Hooks, and `enabled` lets the menu defer the fetch until it opens.
|
|
113
|
+
*/
|
|
114
|
+
export interface AgentRunner {
|
|
115
|
+
readonly id: string;
|
|
116
|
+
readonly useAvailability: (options: {
|
|
117
|
+
readonly enabled: boolean;
|
|
118
|
+
}) => AgentRunnerAvailability;
|
|
119
|
+
/** Progress for the core agent run `agentRunId`. `undefined` polls nothing. */
|
|
120
|
+
readonly useProgress: (agentRunId: string | undefined) => AgentRunnerProgress | undefined;
|
|
121
|
+
}
|
|
84
122
|
//# 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,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,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E,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,uBAAuB,CAAA;IAC7F,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,KAAK,mBAAmB,GAAG,SAAS,CAAA;CAC1F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a UI module may add to the shell
|
|
2
|
+
* What a UI module may add to the shell.
|
|
3
3
|
*
|
|
4
4
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
5
5
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* The override escape hatch
|
|
3
|
+
* The override escape hatch: a module replaces a core
|
|
4
4
|
* component outright. Prefer a slot; this is for the cases a slot cannot reach.
|
|
5
5
|
*
|
|
6
6
|
* A core component is replaceable only if it hands out a token, and the token
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { AuthMethod, DashboardCard, ExtensibleRecordType, NavItem, NavSlot, RecordSidebarCard, RecordTab, RouteContribution } from './contributions.ts';
|
|
2
|
+
import type { AgentRunner, AuthMethod, DashboardCard, ExtensibleRecordType, NavItem, NavSlot, RecordSidebarCard, RecordTab, RouteContribution } from './contributions.ts';
|
|
3
3
|
import type { Overridable } from './overridable.ts';
|
|
4
4
|
/**
|
|
5
|
-
* The build-time UI extension registry
|
|
5
|
+
* The build-time UI extension registry.
|
|
6
6
|
*
|
|
7
7
|
* Composition is build-time, like the server runtime: an assembly lists its UI
|
|
8
8
|
* modules and this collects what they contribute. Nothing is loaded at runtime,
|
|
@@ -21,7 +21,9 @@ export interface UiModuleContext {
|
|
|
21
21
|
dashboardCard(card: DashboardCard): void;
|
|
22
22
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
23
23
|
authMethod(method: AuthMethod): void;
|
|
24
|
-
/**
|
|
24
|
+
/** The agent the Agent menu's Run button dispatches to. One per assembly. */
|
|
25
|
+
agentRunner(runner: AgentRunner): void;
|
|
26
|
+
/** Replaces a core component. Prefer a slot. */
|
|
25
27
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void;
|
|
26
28
|
}
|
|
27
29
|
export interface UiModule {
|
|
@@ -36,6 +38,8 @@ export interface UiExtensions {
|
|
|
36
38
|
recordSidebarCards(objectType: ExtensibleRecordType): readonly RecordSidebarCard[];
|
|
37
39
|
dashboardCards(): readonly DashboardCard[];
|
|
38
40
|
authMethods(): readonly AuthMethod[];
|
|
41
|
+
/** The registered runner, or `undefined` when no module provides one. */
|
|
42
|
+
agentRunner(): AgentRunner | undefined;
|
|
39
43
|
componentFor<Props>(token: Overridable<Props>): ComponentType<Props>;
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
@@ -63,7 +67,7 @@ export declare function registerUiModules(modules: readonly UiModule[]): UiExten
|
|
|
63
67
|
* tree without a provider sees.
|
|
64
68
|
*
|
|
65
69
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
66
|
-
* the state
|
|
70
|
+
* the state core pages are required to look finished in.
|
|
67
71
|
*/
|
|
68
72
|
export declare const NO_UI_MODULES: UiExtensions;
|
|
69
73
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -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;AAE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AAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,CAEpG;AAaD,gHAAgH;AAChH,qBAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAmFD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,YAAY,CAiC5E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,YAAoC,CAAA"}
|
|
@@ -59,6 +59,13 @@ function createModuleContext(module, accumulator, taken) {
|
|
|
59
59
|
claim(taken, module.id, 'auth.methods', method.id);
|
|
60
60
|
accumulator.authMethods.push(method);
|
|
61
61
|
},
|
|
62
|
+
agentRunner(runner) {
|
|
63
|
+
// One button, one agent: a second runner would silently win or lose.
|
|
64
|
+
if (accumulator.agentRunner !== undefined) {
|
|
65
|
+
throw new UiModuleError(`module "${module.id}" contributes agent runner "${runner.id}", but "${accumulator.agentRunner.id}" is already registered`);
|
|
66
|
+
}
|
|
67
|
+
accumulator.agentRunner = runner;
|
|
68
|
+
},
|
|
62
69
|
override(token, component) {
|
|
63
70
|
if (accumulator.overrides.has(token.key)) {
|
|
64
71
|
throw new UiModuleError(`module "${module.id}" overrides "${token.key}", which another module already replaced`);
|
|
@@ -98,6 +105,7 @@ export function registerUiModules(modules) {
|
|
|
98
105
|
recordSidebarCards: (objectType) => inSlotOrder(accumulator.recordSidebarCards.get(objectType) ?? []),
|
|
99
106
|
dashboardCards: () => inSlotOrder(accumulator.dashboardCards),
|
|
100
107
|
authMethods: () => inSlotOrder(accumulator.authMethods),
|
|
108
|
+
agentRunner: () => accumulator.agentRunner,
|
|
101
109
|
componentFor: (token) => accumulator.overrides.get(token),
|
|
102
110
|
};
|
|
103
111
|
}
|
|
@@ -106,7 +114,7 @@ export function registerUiModules(modules) {
|
|
|
106
114
|
* tree without a provider sees.
|
|
107
115
|
*
|
|
108
116
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
109
|
-
* the state
|
|
117
|
+
* the state core pages are required to look finished in.
|
|
110
118
|
*/
|
|
111
119
|
export const NO_UI_MODULES = registerUiModules([]);
|
|
112
120
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAgDtD,4FAA4F;AAC5F,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAwC,KAAmB;IACpF,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAA;AACjG,CAAC;AAaD,gHAAgH;AAChH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAED,SAAS,KAAK,CAAC,KAAkB,EAAE,QAAgB,EAAE,IAAY,EAAE,EAAU;IAC3E,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,EAAE,EAAE,CAAA;IAE5B,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,aAAa,CAAC,WAAW,QAAQ,iBAAiB,IAAI,KAAK,EAAE,2BAA2B,CAAC,CAAA;IACrG,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAI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CAAC;QACvD,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW;QAC1C,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.
|
|
3
|
+
"version": "0.17.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.
|
|
51
|
+
"@kelpie/schemas": "^0.17.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client for the public `/v1` API. The UI is one more API consumer, exactly like
|
|
3
|
-
* an agent, so this file encodes only what
|
|
3
|
+
* an agent, so this file encodes only what the API documents: the list envelope,
|
|
4
4
|
* the error shape, and the write verbs.
|
|
5
5
|
*
|
|
6
6
|
* Responses are untrusted input. Every method takes a `Decoder` and returns what
|
|
@@ -40,7 +40,7 @@ export class ApiError extends Error {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** A cursor page: `{ data, next_cursor }` from `api.md`. */
|
|
43
|
+
/** A cursor page: `{ data, next_cursor }` from `docs/agents/api-and-webhooks.md`. */
|
|
44
44
|
export interface Page<T> {
|
|
45
45
|
readonly items: readonly T[]
|
|
46
46
|
readonly nextCursor: string | null
|
|
@@ -48,7 +48,8 @@ export interface Page<T> {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Query string values. An array becomes a repeated parameter, which is how
|
|
51
|
-
*
|
|
51
|
+
* the API names a set of ids: `?person_id=per_1&person_id=per_2`
|
|
52
|
+
* (`docs/agents/api-and-webhooks.md`).
|
|
52
53
|
*/
|
|
53
54
|
export type QueryParameters = Readonly<
|
|
54
55
|
Record<string, string | number | boolean | readonly string[] | undefined>
|
|
@@ -78,7 +79,7 @@ export interface ApiClient {
|
|
|
78
79
|
*/
|
|
79
80
|
postForm<T>(path: string, form: FormData, decode: Decoder<T>): Promise<T>
|
|
80
81
|
/**
|
|
81
|
-
* A `POST` whose success carries no body.
|
|
82
|
+
* A `POST` whose success carries no body. Resource writes return
|
|
82
83
|
* the resulting object, but the session endpoints have nothing to return:
|
|
83
84
|
* logout answers `204`, and a password reset request answers `202`.
|
|
84
85
|
*/
|
|
@@ -92,7 +93,7 @@ export interface ApiClient {
|
|
|
92
93
|
patchEmpty(path: string, body: unknown): Promise<void>
|
|
93
94
|
/**
|
|
94
95
|
* `query` is for a delete that takes a confirmation, which
|
|
95
|
-
* `DELETE /v1/workspaces/:id?
|
|
96
|
+
* `DELETE /v1/workspaces/:id?name=` is. A `DELETE` body would be the other
|
|
96
97
|
* option, and HTTP lets a client drop one.
|
|
97
98
|
*/
|
|
98
99
|
delete(path: string, query?: QueryParameters): Promise<void>
|
|
@@ -287,7 +288,7 @@ export function createApiClient(options: ApiClientOptions): ApiClient {
|
|
|
287
288
|
delete: async (path, query) => {
|
|
288
289
|
const response = await request('DELETE', buildUrl(options.baseUrl, path, query))
|
|
289
290
|
|
|
290
|
-
// Stricter than `response.ok`:
|
|
291
|
+
// Stricter than `response.ok`: a successful delete is `204`,
|
|
291
292
|
// and anything else means the server is not doing what it documents.
|
|
292
293
|
if (response.status !== 204) {
|
|
293
294
|
throw await readEmptyError(response)
|
package/src/api/resource.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { toError } from './errors.ts'
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* The default page size when a caller does not name one via `query.limit`.
|
|
31
|
-
* Matches the `/v1` default
|
|
31
|
+
* Matches the `/v1` default.
|
|
32
32
|
*/
|
|
33
33
|
export const DEFAULT_PAGE_SIZE = 50
|
|
34
34
|
|
|
@@ -50,7 +50,7 @@ export interface Paged {
|
|
|
50
50
|
readonly nextPage: () => void
|
|
51
51
|
/**
|
|
52
52
|
* Changes the API `?limit=` and returns the reader to page 1. The API caps
|
|
53
|
-
* `?limit=` at 200 (`api.md`); a larger value is coerced by the server, not
|
|
53
|
+
* `?limit=` at 200 (`docs/agents/api-and-webhooks.md`); a larger value is coerced by the server, not
|
|
54
54
|
* refused by this hook.
|
|
55
55
|
*/
|
|
56
56
|
readonly setPageSize: (size: number) => void
|
|
@@ -70,7 +70,7 @@ export interface RecordResult<TRecord> {
|
|
|
70
70
|
readonly record: TRecord | undefined
|
|
71
71
|
readonly isLoading: boolean
|
|
72
72
|
readonly error: Error | null
|
|
73
|
-
/** The record is not in this workspace, which
|
|
73
|
+
/** The record is not in this workspace, which the API makes indistinguishable from not existing. */
|
|
74
74
|
readonly isNotFound: boolean
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -160,9 +160,8 @@ function keysFor(name: string): ResourceKeys {
|
|
|
160
160
|
/**
|
|
161
161
|
* Applies a partial update to a record.
|
|
162
162
|
*
|
|
163
|
-
* `undefined` means "not sent" and `null` means "clear this field",
|
|
164
|
-
*
|
|
165
|
-
* overwrite it.
|
|
163
|
+
* `undefined` means "not sent" and `null` means "clear this field", so an
|
|
164
|
+
* undefined value must leave the existing one alone rather than overwrite it.
|
|
166
165
|
*/
|
|
167
166
|
function mergeDefined<TRecord extends object>(record: TRecord, changes: Partial<TRecord>): TRecord {
|
|
168
167
|
const merged = { ...record }
|
|
@@ -235,7 +234,7 @@ export interface PagedListInput<TRecord> {
|
|
|
235
234
|
* and the three custom collections whose paths carry a parent id
|
|
236
235
|
* (`useFormSubmissions`, `useListMembers`, `useWebhookDeliveries`).
|
|
237
236
|
*
|
|
238
|
-
* The API is cursor-only
|
|
237
|
+
* The API is cursor-only, so pages are fetched forward. Already
|
|
239
238
|
* fetched pages stay cached in `useInfiniteQuery`, and `pageIndex` selects
|
|
240
239
|
* which one is on screen — so going back to a visited page is instant and
|
|
241
240
|
* going forward past the fetched set kicks off exactly one new request.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { 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
|
+
/** Enables AI, or saves a new provider, key or model when it is on already. */
|
|
43
|
+
export function useSaveAiSettings(): MutationResult<AiSettingsInput, AiSettings> {
|
|
44
|
+
const client = useApiClient()
|
|
45
|
+
const cache = useQueryClient()
|
|
46
|
+
const mutation = useMutation({
|
|
47
|
+
mutationFn: (input: AiSettingsInput) => client.post('/ai/settings', aiSettingsBody(input), aiSettingsSchema.parse),
|
|
48
|
+
onSuccess: (settings) => {
|
|
49
|
+
cache.setQueryData(SETTINGS_KEY, settings)
|
|
50
|
+
},
|
|
51
|
+
onSettled: () => {
|
|
52
|
+
void cache.invalidateQueries({ queryKey: ['agents'] })
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return asMutationResult(mutation)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function useDisableAi(): MutationResult<void, void> {
|
|
60
|
+
const client = useApiClient()
|
|
61
|
+
const cache = useQueryClient()
|
|
62
|
+
const mutation = useMutation({
|
|
63
|
+
mutationFn: () => client.delete('/ai/settings'),
|
|
64
|
+
onSettled: () => {
|
|
65
|
+
void cache.invalidateQueries({ queryKey: SETTINGS_KEY })
|
|
66
|
+
void cache.invalidateQueries({ queryKey: ['agents'] })
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
return asMutationResult(mutation)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const runs = createReadOnlyResourceHooks<AiRun>({
|
|
74
|
+
name: 'ai_runs',
|
|
75
|
+
path: '/ai/runs',
|
|
76
|
+
decode: aiRunSchema.parse,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
export function useAiRuns(options: ListOptions = {}): RecordListResult<AiRun> {
|
|
80
|
+
return runs.useList({}, options)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const RUN_POLL_INTERVAL_MS = 1500
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The AI run that core's agent run `agentRunId` started, polled until it
|
|
87
|
+
* settles. `undefined` until the dispatch intake has written it.
|
|
88
|
+
*
|
|
89
|
+
* There is no filter by agent run on `/v1/ai/runs`, so this reads the newest
|
|
90
|
+
* page and picks the row out. A run the menu just dispatched is at the top.
|
|
91
|
+
*/
|
|
92
|
+
export function useAiRunForAgentRun(agentRunId: string | undefined): AiRun | undefined {
|
|
93
|
+
const client = useApiClient()
|
|
94
|
+
const result = useQuery({
|
|
95
|
+
queryKey: ['ai_runs', 'by_agent_run', agentRunId ?? ''],
|
|
96
|
+
queryFn: async () => {
|
|
97
|
+
const page = await client.list('/ai/runs', aiRunSchema.parse, {})
|
|
98
|
+
|
|
99
|
+
return page.items.find((run) => run.agentRunId === agentRunId) ?? null
|
|
100
|
+
},
|
|
101
|
+
enabled: agentRunId !== undefined,
|
|
102
|
+
refetchInterval: (query) => {
|
|
103
|
+
const status = query.state.data?.status
|
|
104
|
+
|
|
105
|
+
return status === 'succeeded' || status === 'failed' ? false : RUN_POLL_INTERVAL_MS
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
return result.data ?? undefined
|
|
110
|
+
}
|
|
@@ -15,8 +15,8 @@ import { useSession } from './session.ts'
|
|
|
15
15
|
* endpoint answers the whole team in one page rather than a cursor list.
|
|
16
16
|
*
|
|
17
17
|
* Notes carry an `author_id` and activities an `actor_member_id`, both workspace
|
|
18
|
-
* member ids.
|
|
19
|
-
* against this list. One request per page, not one per row.
|
|
18
|
+
* member ids. The API has no include-expansion (`docs/api-reference.md`), so
|
|
19
|
+
* the panel showing them joins against this list. One request per page, not one per row.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
export interface MemberDirectory {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
approveOAuthRequestBody,
|
|
3
|
+
oauthDecisionSchema,
|
|
4
|
+
oauthGrantSchema,
|
|
5
|
+
oauthRequestSchema,
|
|
6
|
+
} from '@kelpie/schemas'
|
|
7
|
+
import type { ApproveOAuthRequestInput, OAuthDecision, OAuthGrant, OAuthRequest } from '@kelpie/schemas'
|
|
8
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
9
|
+
|
|
10
|
+
import { useApiClient } from '../context.ts'
|
|
11
|
+
import { toError } from '../errors.ts'
|
|
12
|
+
import type { MutationResult } from '../resource.ts'
|
|
13
|
+
import { asMutationResult } from './mutation.ts'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `/v1/oauth`: the consent page an MCP client sends a person to, and the
|
|
17
|
+
* "Connected apps" list. Session only; the server refuses a bearer credential.
|
|
18
|
+
*
|
|
19
|
+
* Not workspace-scoped. A request asks which workspace to connect, and the
|
|
20
|
+
* list covers every workspace the person belongs to.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const GRANTS_KEY = ['oauth', 'grants'] as const
|
|
24
|
+
|
|
25
|
+
function requestKey(id: string): readonly unknown[] {
|
|
26
|
+
return ['oauth', 'requests', id]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OAuthRequestState {
|
|
30
|
+
readonly request: OAuthRequest | undefined
|
|
31
|
+
readonly isLoading: boolean
|
|
32
|
+
readonly error: Error | null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useOAuthRequest(id: string): OAuthRequestState {
|
|
36
|
+
const client = useApiClient()
|
|
37
|
+
const result = useQuery({
|
|
38
|
+
queryKey: requestKey(id),
|
|
39
|
+
queryFn: () => client.get(`/oauth/requests/${id}`, oauthRequestSchema.parse),
|
|
40
|
+
// A request is answered once. Refetching after that would show "expired"
|
|
41
|
+
// over the page that is already on its way back to the client.
|
|
42
|
+
retry: false,
|
|
43
|
+
refetchOnWindowFocus: false,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
request: result.data,
|
|
48
|
+
isLoading: result.isPending,
|
|
49
|
+
error: toError(result.error),
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ApproveOAuthRequestVariables extends ApproveOAuthRequestInput {
|
|
54
|
+
readonly requestId: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function useApproveOAuthRequest(): MutationResult<ApproveOAuthRequestVariables, OAuthDecision> {
|
|
58
|
+
const client = useApiClient()
|
|
59
|
+
const queryClient = useQueryClient()
|
|
60
|
+
const mutation = useMutation({
|
|
61
|
+
mutationFn: ({ requestId, ...input }: ApproveOAuthRequestVariables) =>
|
|
62
|
+
client.post(`/oauth/requests/${requestId}/approve`, approveOAuthRequestBody(input), oauthDecisionSchema.parse),
|
|
63
|
+
onSuccess: async () => {
|
|
64
|
+
await queryClient.invalidateQueries({ queryKey: GRANTS_KEY })
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return asMutationResult(mutation)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function useDenyOAuthRequest(): MutationResult<string, OAuthDecision> {
|
|
72
|
+
const client = useApiClient()
|
|
73
|
+
const mutation = useMutation({
|
|
74
|
+
mutationFn: (requestId: string) =>
|
|
75
|
+
client.post(`/oauth/requests/${requestId}/deny`, {}, oauthDecisionSchema.parse),
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return asMutationResult(mutation)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface OAuthGrantsState {
|
|
82
|
+
readonly grants: readonly OAuthGrant[]
|
|
83
|
+
readonly isLoading: boolean
|
|
84
|
+
readonly error: Error | null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function useOAuthGrants(): OAuthGrantsState {
|
|
88
|
+
const client = useApiClient()
|
|
89
|
+
const result = useQuery({
|
|
90
|
+
queryKey: GRANTS_KEY,
|
|
91
|
+
queryFn: () => client.list('/oauth/grants', oauthGrantSchema.parse),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
grants: result.data?.items ?? [],
|
|
96
|
+
isLoading: result.isPending,
|
|
97
|
+
error: toError(result.error),
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function useRevokeOAuthGrant(): MutationResult<string, void> {
|
|
102
|
+
const client = useApiClient()
|
|
103
|
+
const queryClient = useQueryClient()
|
|
104
|
+
const mutation = useMutation({
|
|
105
|
+
mutationFn: (id: string) => client.delete(`/oauth/grants/${id}`),
|
|
106
|
+
onSuccess: async () => {
|
|
107
|
+
await queryClient.invalidateQueries({ queryKey: GRANTS_KEY })
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return asMutationResult(mutation)
|
|
112
|
+
}
|
|
@@ -31,7 +31,7 @@ const planItems = createResourceHooks<PlanItem, CreatePlanItemInput, PlanItemInp
|
|
|
31
31
|
updateBody: planItemBody,
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
/** The `?limit=` ceiling from `api.md`. A caller asking for a bounded set may ask for all of it. */
|
|
34
|
+
/** The `?limit=` ceiling from `docs/agents/api-and-webhooks.md`. A caller asking for a bounded set may ask for all of it. */
|
|
35
35
|
export const MAX_PAGE_SIZE = 200
|
|
36
36
|
|
|
37
37
|
export interface PlanItemFilters {
|
|
@@ -240,7 +240,7 @@ export function useAcceptInvite(): MutationResult<{ readonly token: string }, Wo
|
|
|
240
240
|
/**
|
|
241
241
|
* Creates the account's first workspace.
|
|
242
242
|
*
|
|
243
|
-
* Signup makes an account and nothing else
|
|
243
|
+
* Signup makes an account and nothing else, so without this a
|
|
244
244
|
* new account reaches the app and gets `403` from every CRM endpoint.
|
|
245
245
|
*/
|
|
246
246
|
export function useCreateWorkspace(): MutationResult<CreateWorkspaceInput, Workspace> {
|
|
@@ -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
|
|
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
|
|
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
|
|
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: ({
|
|
73
|
-
client.delete(`/workspaces/${workspaceId}`, {
|
|
72
|
+
mutationFn: ({ name }: { readonly name: string }) =>
|
|
73
|
+
client.delete(`/workspaces/${workspaceId}`, { name }),
|
|
74
74
|
onSuccess: () => {
|
|
75
75
|
queryClient.clear()
|
|
76
76
|
},
|
package/src/app/KelpieApp.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import { RaiseDetail } from '../pages/RaiseDetail.tsx'
|
|
|
36
36
|
import { RaiseStageSettingsPage } from '../pages/RaiseStageSettingsPage.tsx'
|
|
37
37
|
import { RoleDetail } from '../pages/RoleDetail.tsx'
|
|
38
38
|
import { AccountLayout } from '../pages/account/AccountLayout.tsx'
|
|
39
|
+
import { ConnectedAppsPage } from '../pages/account/ConnectedAppsPage.tsx'
|
|
39
40
|
import { PersonalApiKeysPage } from '../pages/account/PersonalApiKeysPage.tsx'
|
|
40
41
|
import { PreferencesPage } from '../pages/account/PreferencesPage.tsx'
|
|
41
42
|
import { ProfilePage } from '../pages/account/ProfilePage.tsx'
|
|
@@ -51,6 +52,7 @@ import { WebhooksPage } from '../pages/admin/WebhooksPage.tsx'
|
|
|
51
52
|
import { WorkspaceSettingsPage } from '../pages/admin/WorkspaceSettingsPage.tsx'
|
|
52
53
|
import { ForgotPasswordPage } from '../pages/auth/ForgotPasswordPage.tsx'
|
|
53
54
|
import { JoinPage } from '../pages/auth/JoinPage.tsx'
|
|
55
|
+
import { ConsentPage } from '../pages/oauth/ConsentPage.tsx'
|
|
54
56
|
import { ResetPasswordPage } from '../pages/auth/ResetPasswordPage.tsx'
|
|
55
57
|
import { SignInPage } from '../pages/auth/SignInPage.tsx'
|
|
56
58
|
import { SignUpPage } from '../pages/auth/SignUpPage.tsx'
|
|
@@ -137,6 +139,9 @@ function AppRoutes(): React.JSX.Element {
|
|
|
137
139
|
verification pages, all of which are what the gate sends an account
|
|
138
140
|
with no workspace to. */}
|
|
139
141
|
<Route path="/join" element={<JoinPage />} />
|
|
142
|
+
{/* An MCP client's OAuth consent. Handles its own sign-in redirect, as
|
|
143
|
+
/join does, so the request survives it. */}
|
|
144
|
+
<Route path="/consent/:requestId" element={<ConsentPage />} />
|
|
140
145
|
<Route path="/onboarding/workspace" element={<WorkspaceStepPage />} />
|
|
141
146
|
<Route path="/verify-email" element={<VerifyEmailConfirmPage />} />
|
|
142
147
|
<Route path="/verify-email/pending" element={<VerifyEmailPendingPage />} />
|
|
@@ -205,6 +210,7 @@ function AppRoutes(): React.JSX.Element {
|
|
|
205
210
|
<Route path="security" element={<SecurityPage />} />
|
|
206
211
|
<Route path="preferences" element={<PreferencesPage />} />
|
|
207
212
|
<Route path="api-keys" element={<PersonalApiKeysPage />} />
|
|
213
|
+
<Route path="connected-apps" element={<ConnectedAppsPage />} />
|
|
208
214
|
{accountRoutes.map((route) => (
|
|
209
215
|
<Route
|
|
210
216
|
key={route.path}
|