@manta-eu/react 0.1.4 → 0.1.6
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/README.md +4 -8
- package/dist/components/audience-phase-badge/index.d.ts +1 -1
- package/dist/components/audience-phase-badge/index.d.ts.map +1 -1
- package/dist/components/audience-phase-badge/index.js +3 -0
- package/dist/components/authenticated-chat/index.d.ts.map +1 -1
- package/dist/components/authenticated-chat/index.js +0 -5
- package/dist/components/chat/chat-input/index.d.ts +1 -1
- package/dist/components/chat/chat-input/index.d.ts.map +1 -1
- package/dist/components/chat/chat-input/index.js +4 -5
- package/dist/components/chat-view/Chat.d.ts +6 -0
- package/dist/components/chat-view/Chat.d.ts.map +1 -1
- package/dist/components/chat-view/Chat.js +18 -8
- package/dist/components/chat-view/ChatHeaders.d.ts.map +1 -1
- package/dist/components/chat-view/ChatHeaders.js +3 -2
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.d.ts +1 -0
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.d.ts.map +1 -1
- package/dist/components/embedded-chat/EmbeddedDatastorePicker.js +9 -3
- package/dist/components/embedded-chat/index.d.ts.map +1 -1
- package/dist/components/embedded-chat/index.js +1 -8
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +25 -5
- package/dist/components/planning/ActioningView.d.ts.map +1 -1
- package/dist/components/planning/ActioningView.js +11 -6
- package/dist/components/planning/ExecutionSectionItem.d.ts +2 -3
- package/dist/components/planning/ExecutionSectionItem.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSectionItem.js +3 -6
- package/dist/components/planning/ExecutionSections.d.ts +2 -3
- package/dist/components/planning/ExecutionSections.d.ts.map +1 -1
- package/dist/components/planning/ExecutionSections.js +2 -2
- package/dist/components/planning/ManualActionCard.d.ts +3 -4
- package/dist/components/planning/ManualActionCard.d.ts.map +1 -1
- package/dist/components/planning/ManualActionCard.js +24 -6
- package/dist/components/rdf-insights/CampaignChannelMix.js +1 -1
- package/dist/components/rdf-insights/CampaignGrid.d.ts.map +1 -1
- package/dist/components/rdf-insights/CampaignGrid.js +2 -2
- package/dist/components/rdf-insights/DailyPerformance.js +2 -2
- package/dist/components/rdf-insights/KpiDashboard.d.ts +2 -2
- package/dist/components/rdf-insights/KpiDashboard.d.ts.map +1 -1
- package/dist/components/rdf-insights/KpiDashboard.js +33 -53
- package/dist/components/rdf-insights/MetaDailyInsights.js +2 -2
- package/dist/components/rdf-insights/ProductCard.d.ts.map +1 -1
- package/dist/components/rdf-insights/ProductCard.js +1 -1
- package/dist/components/rdf-insights/ProductVariantsTable.js +1 -1
- package/dist/components/rdf-insights/useExtractedInsights.d.ts +1 -1
- package/dist/components/rdf-insights/useExtractedInsights.js +3 -3
- package/dist/components/sidebar/nav-menu.d.ts +2 -0
- package/dist/components/sidebar/nav-menu.d.ts.map +1 -1
- package/dist/components/sidebar/nav-menu.js +11 -6
- package/dist/components/table/index.d.ts +26 -0
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +31 -1
- package/dist/datastore-picker/datastore-picker-rows.d.ts +1 -0
- package/dist/datastore-picker/datastore-picker-rows.d.ts.map +1 -1
- package/dist/datastore-picker/datastore-picker-rows.js +6 -2
- package/dist/explain-fact/DatalogCode.d.ts.map +1 -1
- package/dist/explain-fact/DatalogCode.js +7 -2
- package/dist/explain-fact/FactValue.js +3 -3
- package/dist/explain-fact/proof-tree/ProofTreeFormulaFooter.d.ts.map +1 -1
- package/dist/explain-fact/proof-tree/ProofTreeFormulaFooter.js +2 -1
- package/dist/globals.css +10 -102
- package/dist/graph/createNodeRouter.d.ts.map +1 -1
- package/dist/graph/createNodeRouter.js +3 -0
- package/dist/graph/nodes/BrandFacetRuleView.d.ts.map +1 -1
- package/dist/graph/nodes/BrandFacetRuleView.js +6 -4
- package/dist/graph/nodes/BrandFontFamilyView.d.ts +3 -0
- package/dist/graph/nodes/BrandFontFamilyView.d.ts.map +1 -0
- package/dist/graph/nodes/BrandFontFamilyView.js +56 -0
- package/dist/graph/nodes/BrandFontUploadButton.d.ts +6 -0
- package/dist/graph/nodes/BrandFontUploadButton.d.ts.map +1 -0
- package/dist/graph/nodes/BrandFontUploadButton.js +65 -0
- package/dist/graph/nodes/BrandGuidelinesView.d.ts.map +1 -1
- package/dist/graph/nodes/BrandGuidelinesView.js +2 -6
- package/dist/graph/nodes/GoogleCampaignView.js +2 -2
- package/dist/graph/nodes/brand-font.d.ts +12 -0
- package/dist/graph/nodes/brand-font.d.ts.map +1 -0
- package/dist/graph/nodes/brand-font.js +12 -0
- package/dist/graph/nodes/brand-shared.d.ts +3 -2
- package/dist/graph/nodes/brand-shared.d.ts.map +1 -1
- package/dist/graph/nodes/brand-shared.js +3 -2
- package/dist/hooks/use-action-plans-list.js +1 -1
- package/dist/hooks/use-connection-problems.d.ts +15 -0
- package/dist/hooks/use-connection-problems.d.ts.map +1 -0
- package/dist/hooks/use-connection-problems.js +9 -0
- package/dist/hooks/use-font-face.d.ts +3 -0
- package/dist/hooks/use-font-face.d.ts.map +1 -0
- package/dist/hooks/use-font-face.js +33 -0
- package/dist/hooks/use-graph-refresh-after-turn.d.ts +2 -0
- package/dist/hooks/use-graph-refresh-after-turn.d.ts.map +1 -0
- package/dist/hooks/use-graph-refresh-after-turn.js +12 -0
- package/dist/hooks/use-manual-actions.d.ts +11 -1
- package/dist/hooks/use-manual-actions.d.ts.map +1 -1
- package/dist/hooks/use-manual-actions.js +47 -100
- package/dist/hooks/useAuth.d.ts +6 -1
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +36 -9
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/ldo-ui.d.ts +1 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/lib/activity-changeset.d.ts.map +1 -1
- package/dist/lib/activity-changeset.js +6 -3
- package/dist/lib/datastore-route-table.d.ts +1 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.js +2 -0
- package/dist/lib/manual-actions.js +1 -1
- package/dist/lib/rdf/index.d.ts +4 -2
- package/dist/lib/rdf/index.d.ts.map +1 -1
- package/dist/lib/rdf/index.js +48 -18
- package/dist/lib/rdf/insights.d.ts +6 -1
- package/dist/lib/rdf/insights.d.ts.map +1 -1
- package/dist/lib/rdf/insights.js +15 -3
- package/dist/lib/rdf/types.d.ts +21 -8
- package/dist/lib/rdf/types.d.ts.map +1 -1
- package/dist/lib/tool-icons.d.ts.map +1 -1
- package/dist/lib/tool-icons.js +1 -5
- package/dist/providers/ActiveChatProvider.d.ts.map +1 -1
- package/dist/providers/ActiveChatProvider.js +2 -0
- package/dist/providers/AuthContext.d.ts +1 -1
- package/dist/providers/AuthContext.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateContext.d.ts +0 -1
- package/dist/providers/KnowledgeGraphStateContext.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.js +8 -19
- package/dist/providers/index.d.ts +4 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -1
- package/dist/routes/activity/change-display.js +1 -1
- package/dist/routes/data-explorer/components/record-detail/ActionFormDialog.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/record-detail/ActionFormDialog.js +23 -9
- package/dist/routes/data-explorer/components/record-detail/action-properties.d.ts +2 -4
- package/dist/routes/data-explorer/components/record-detail/action-properties.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/record-detail/action-properties.js +8 -50
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts +4 -2
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts.map +1 -1
- package/dist/routes/datastores/components/DatastoreFormDialog.js +7 -4
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts +3 -1
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts.map +1 -1
- package/dist/routes/datastores/components/DatastoresToolbar.js +18 -5
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.d.ts.map +1 -1
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.js +6 -2
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.d.ts +7 -0
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.d.ts.map +1 -0
- package/dist/routes/datastores/components/ProvisionDatastoreDialog.js +10 -0
- package/dist/routes/datastores/flatten.d.ts +4 -0
- package/dist/routes/datastores/flatten.d.ts.map +1 -1
- package/dist/routes/datastores/flatten.js +11 -0
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts +4 -1
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts.map +1 -1
- package/dist/routes/datastores/hooks/useDatastoreColumns.js +6 -2
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.d.ts +3 -0
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.d.ts.map +1 -0
- package/dist/routes/datastores/hooks/useTenantOrganizationCheck.js +21 -0
- package/dist/routes/datastores/index.d.ts.map +1 -1
- package/dist/routes/datastores/index.js +44 -6
- package/dist/routes/datastores/link-provider.d.ts +11 -0
- package/dist/routes/datastores/link-provider.d.ts.map +1 -0
- package/dist/routes/datastores/link-provider.js +34 -0
- package/dist/routes/integrations/components/connect-forms/types.d.ts +1 -0
- package/dist/routes/integrations/components/connect-forms/types.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.d.ts +4 -1
- package/dist/routes/integrations/connection-view.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.js +39 -6
- package/dist/routes/integrations/types.d.ts +3 -0
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.js +3 -3
- package/dist/routes/memories/components/EmptyStates.d.ts +1 -2
- package/dist/routes/memories/components/EmptyStates.d.ts.map +1 -1
- package/dist/routes/memories/components/EmptyStates.js +2 -2
- package/dist/routes/memories/components/MemoriesPanel.d.ts +1 -1
- package/dist/routes/memories/components/MemoriesPanel.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoriesPanel.js +9 -9
- package/dist/routes/memories/components/MemoryActions.d.ts +1 -1
- package/dist/routes/memories/components/MemoryActions.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryActions.js +4 -4
- package/dist/routes/memories/components/MemoryFields.d.ts +1 -1
- package/dist/routes/memories/components/MemoryFields.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFields.js +2 -2
- package/dist/routes/memories/components/MemoryFormDialog.d.ts +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.d.ts.map +1 -1
- package/dist/routes/memories/components/MemoryFormDialog.js +2 -2
- package/dist/routes/memories/components/TeamPicker.d.ts +1 -1
- package/dist/routes/memories/components/TeamPicker.d.ts.map +1 -1
- package/dist/routes/memories/components/TeamPicker.js +2 -2
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts.map +1 -1
- package/dist/routes/memories/hooks/useMemoryColumns.js +3 -3
- package/dist/routes/memories/index.d.ts.map +1 -1
- package/dist/routes/memories/index.js +21 -21
- package/dist/shacl/shacl-form-types.d.ts +2 -3
- package/dist/shacl/shacl-form-types.d.ts.map +1 -1
- package/dist/shared/graph-derived-queries.d.ts +5 -0
- package/dist/shared/graph-derived-queries.d.ts.map +1 -0
- package/dist/shared/graph-derived-queries.js +28 -0
- package/package.json +8 -10
- package/dist/components/ai-elements/chain-of-thought.d.ts +0 -30
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.js +0 -57
- package/dist/components/context-menu.d.ts +0 -29
- package/dist/components/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu.js +0 -67
- package/dist/components/hover-card.d.ts +0 -6
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card.js +0 -15
- package/dist/components/layouts/ChatHistoryItem.d.ts +0 -9
- package/dist/components/layouts/ChatHistoryItem.d.ts.map +0 -1
- package/dist/components/layouts/ChatHistoryItem.js +0 -7
- package/dist/components/layouts/SectionHeader.d.ts +0 -8
- package/dist/components/layouts/SectionHeader.d.ts.map +0 -1
- package/dist/components/layouts/SectionHeader.js +0 -6
- package/dist/components/orbit-site/Block.d.ts +0 -8
- package/dist/components/orbit-site/Block.d.ts.map +0 -1
- package/dist/components/orbit-site/Block.js +0 -7
- package/dist/components/orbit-site/Inset.d.ts +0 -7
- package/dist/components/orbit-site/Inset.d.ts.map +0 -1
- package/dist/components/orbit-site/Inset.js +0 -6
- package/dist/components/orbit-site/Section.d.ts +0 -7
- package/dist/components/orbit-site/Section.d.ts.map +0 -1
- package/dist/components/orbit-site/Section.js +0 -6
- package/dist/components/orbit-site/ThemeSelector.d.ts +0 -3
- package/dist/components/orbit-site/ThemeSelector.d.ts.map +0 -1
- package/dist/components/orbit-site/ThemeSelector.js +0 -42
- package/dist/components/planning/SampleChanges.d.ts +0 -9
- package/dist/components/planning/SampleChanges.d.ts.map +0 -1
- package/dist/components/planning/SampleChanges.js +0 -117
- package/dist/components/tool-invocation-card/index.d.ts +0 -8
- package/dist/components/tool-invocation-card/index.d.ts.map +0 -1
- package/dist/components/tool-invocation-card/index.js +0 -7
- package/dist/lib/schema-fields.d.ts +0 -2
- package/dist/lib/schema-fields.d.ts.map +0 -1
- package/dist/lib/schema-fields.js +0 -3
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts +0 -7
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts.map +0 -1
- package/dist/routes/memories/components/ConflictTimeoutFooter.js +0 -6
package/README.md
CHANGED
|
@@ -57,12 +57,7 @@ The copilot reads a datastore whose shapes are specific to your deployment, so t
|
|
|
57
57
|
that datastore rather than from this package. `@manta-eu/codegen` fetches them over HTTP:
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
|
-
pnpm manta-codegen generate
|
|
61
|
-
--api-url https://app.hiremanta.com \
|
|
62
|
-
--datastore your-datastore \
|
|
63
|
-
--keycloak-url https://auth.hiremanta.com \
|
|
64
|
-
--keycloak-realm your-realm \
|
|
65
|
-
--out ./.ldkit
|
|
60
|
+
pnpm manta-codegen generate --datastore your-datastore --out ./.ldkit
|
|
66
61
|
```
|
|
67
62
|
|
|
68
63
|
The run writes one file per namespace plus an `index.ts` that re-exports them. Re-run it whenever
|
|
@@ -72,7 +67,8 @@ the device-login and service-account paths.
|
|
|
72
67
|
### 5. Mount the chat
|
|
73
68
|
|
|
74
69
|
`EmbeddedChatProviders` supplies the API client, query cache and graph state; `EmbeddedChat` is the
|
|
75
|
-
copilot itself. Requests carry the session from `mantaBaseUrl`, so the user signs in there.
|
|
70
|
+
copilot itself. Requests carry the session from `mantaBaseUrl`, so the user signs in there. It
|
|
71
|
+
defaults to `https://app.hiremanta.com`.
|
|
76
72
|
|
|
77
73
|
```tsx
|
|
78
74
|
import { EmbeddedChat } from "@manta-eu/react/components/embedded-chat";
|
|
@@ -81,7 +77,7 @@ import "./globals.css";
|
|
|
81
77
|
|
|
82
78
|
export function Copilot() {
|
|
83
79
|
return (
|
|
84
|
-
<EmbeddedChatProviders
|
|
80
|
+
<EmbeddedChatProviders datastoreId="your-datastore">
|
|
85
81
|
<EmbeddedChat
|
|
86
82
|
user={{ id: "…", email: "you@example.com", name: "You" }}
|
|
87
83
|
isOperator={false}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AudiencePhase = "ACTIVE" | "PAUSED" | "DRAFT" | "ARCHIVED" | "ACTIVATING" | "PAUSING" | "PUBLISHING" | "REPUBLISHING" | "PAUSED_REPUBLISHING";
|
|
1
|
+
export type AudiencePhase = "ACTIVE" | "PAUSED" | "DRAFT" | "ARCHIVED" | "ENDED" | "ACTIVATING" | "PAUSING" | "PUBLISHING" | "REPUBLISHING" | "PAUSED_REPUBLISHING";
|
|
2
2
|
export type AudiencePhaseBadgeProps = {
|
|
3
3
|
phase: AudiencePhase;
|
|
4
4
|
headerDetails?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/audience-phase-badge/index.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,UAAU,GACV,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,cAAc,GACd,qBAAqB,CAAC;AAE1B,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/audience-phase-badge/index.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,cAAc,GACd,qBAAqB,CAAC;AAE1B,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAoDF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAMhE"}
|
|
@@ -9,6 +9,7 @@ function getPhaseColorClass(phase, headerDetails) {
|
|
|
9
9
|
.with("PAUSED", () => "bg-transparent text-info-foreground border border-info-foreground")
|
|
10
10
|
.with("DRAFT", () => "bg-transparent text-default-foreground border border-default-foreground")
|
|
11
11
|
.with("ARCHIVED", () => "bg-transparent text-error-foreground border border-error-foreground")
|
|
12
|
+
.with("ENDED", () => "bg-transparent text-muted-foreground border border-muted-foreground")
|
|
12
13
|
.with("PUBLISHING", "REPUBLISHING", "PAUSED_REPUBLISHING", "ACTIVATING", "PAUSING", () => "bg-transparent text-warning-foreground border border-warning-foreground")
|
|
13
14
|
.otherwise(() => "");
|
|
14
15
|
}
|
|
@@ -17,6 +18,7 @@ function getPhaseColorClass(phase, headerDetails) {
|
|
|
17
18
|
.with("PAUSED", () => "bg-muted text-default-foreground border border-muted")
|
|
18
19
|
.with("PUBLISHING", "REPUBLISHING", "PAUSED_REPUBLISHING", "ACTIVATING", "PAUSING", () => "bg-warning text-warning-foreground border border-warning")
|
|
19
20
|
.with("ARCHIVED", () => "bg-error text-error-foreground border border-error")
|
|
21
|
+
.with("ENDED", () => "bg-muted text-muted-foreground border border-muted-border")
|
|
20
22
|
.with("DRAFT", () => "bg-info border border-info text-info-foreground")
|
|
21
23
|
.otherwise(() => "bg-default-foreground text-secondary-foreground border-default-foreground");
|
|
22
24
|
}
|
|
@@ -26,6 +28,7 @@ function getPhaseDisplayName(phase) {
|
|
|
26
28
|
.with("PAUSED", () => "Paused")
|
|
27
29
|
.with("DRAFT", () => "Draft")
|
|
28
30
|
.with("ARCHIVED", () => "Archived")
|
|
31
|
+
.with("ENDED", () => "Ended")
|
|
29
32
|
.with("PUBLISHING", () => "Publishing")
|
|
30
33
|
.with("REPUBLISHING", "PAUSED_REPUBLISHING", () => "Updating")
|
|
31
34
|
.with("ACTIVATING", () => "Activating")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/authenticated-chat/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/authenticated-chat/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAIhF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CA6B9D"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isEmpty } from "ramda";
|
|
3
2
|
import { resolveChatProps } from "#lib/chat-types";
|
|
4
3
|
import { cn } from "#lib/utils";
|
|
5
4
|
import { ChatRoute } from "#routes/chat/index";
|
|
6
5
|
export function AuthenticatedChat(props) {
|
|
7
6
|
const { datastore, user, onLogout, isOperator, canSwitchDatastore, datastores, ...otherProps } = resolveChatProps(props);
|
|
8
|
-
if (isOperator && canSwitchDatastore && isEmpty(datastores)) {
|
|
9
|
-
console.error("AuthenticatedChat: datastores array cannot be empty for operators");
|
|
10
|
-
return (_jsx("div", { className: "flex items-center justify-center min-h-screen", children: _jsxs("div", { className: "text-center space-y-4 max-w-md", children: [_jsx("h2", { className: "typography-large-body-semibold text-error-foreground", children: "Configuration Error" }), _jsx("p", { className: "typography-small text-muted-foreground", children: "No datastores available for operator access. Please contact your administrator." }), onLogout && (_jsx("button", { onClick: onLogout, className: cn("px-4 py-2 rounded-lg transition-colors", "bg-background hover:bg-accent"), children: "Sign Out" }))] }) }));
|
|
11
|
-
}
|
|
12
7
|
if (!user) {
|
|
13
8
|
console.error("AuthenticatedChat: user object is required");
|
|
14
9
|
return (_jsx("div", { className: "flex items-center justify-center min-h-screen", children: _jsxs("div", { className: "text-center space-y-2", children: [_jsx("h2", { className: "typography-large-body-semibold text-error-foreground", children: "Authentication Error" }), _jsx("p", { className: "typography-small text-muted-foreground", children: "Invalid user session. Please sign in again." }), onLogout && (_jsx("button", { onClick: onLogout, className: cn("px-4 py-2 rounded-lg transition-colors", "bg-background hover:bg-accent"), children: "Sign Out" }))] }) }));
|
|
@@ -36,7 +36,7 @@ export type ChatInputSubmitProps = {
|
|
|
36
36
|
isLoading?: boolean;
|
|
37
37
|
isDisabled?: boolean;
|
|
38
38
|
className?: string;
|
|
39
|
-
stopGeneration?: () => void
|
|
39
|
+
stopGeneration?: () => void | Promise<void>;
|
|
40
40
|
};
|
|
41
41
|
export declare function ChatInputSubmit(props: ChatInputSubmitProps): import("react/jsx-runtime").JSX.Element;
|
|
42
42
|
export type ChatInputAttachButtonProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chat-input/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuFF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAMF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkH9C;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAc5D;AAOD,eAAO,MAAM,iBAAiB;gBAJhB,MAAM;eACP,CAAC,EAAE,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI;uDAoD1D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chat-input/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuFF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAMF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkH9C;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAc5D;AAOD,eAAO,MAAM,iBAAiB;gBAJhB,MAAM;eACP,CAAC,EAAE,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI;uDAoD1D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAsC1D;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAmCtE;AA6ED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAIF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,kDA6DpE"}
|
|
@@ -208,11 +208,10 @@ export function ChatInputSubmit(props) {
|
|
|
208
208
|
const value = useChatInputStore((s) => s.value);
|
|
209
209
|
const files = useChatInputStore((s) => s.files);
|
|
210
210
|
const isEmpty = !value.trim() && files.length === 0;
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
return (_jsx(Button, { type: "submit", variant: "primary", size: "sm", icon: isDisabled ? Square : icon, iconOnly: true, "aria-label": ariaLabel, className: cn("mt-auto", className), disabled: isEmpty || disabled || isDisabled, isLoading: isLoading }));
|
|
211
|
+
const pause = stopGeneration ? (_jsx(Button, { type: "button", variant: "tertiary", size: "sm", icon: Pause, iconOnly: true, "aria-label": "Pause generation", className: cn("[&>svg]:size-4", className), disabled: isDisabled, onClick: () => void stopGeneration() })) : null;
|
|
212
|
+
if (pause && isEmpty)
|
|
213
|
+
return pause;
|
|
214
|
+
return (_jsxs(_Fragment, { children: [pause, _jsx(Button, { type: "submit", variant: "primary", size: "sm", icon: isDisabled ? Square : icon, iconOnly: true, "aria-label": ariaLabel, className: cn("mt-auto", className), disabled: isEmpty || disabled || isDisabled, isLoading: isLoading })] }));
|
|
216
215
|
}
|
|
217
216
|
export function ChatInputAttachButton(props) {
|
|
218
217
|
const { className } = props;
|
|
@@ -20,6 +20,10 @@ export type ChatProps = {
|
|
|
20
20
|
renderMenuItems?: (defaults: CopilotMenuDefaults) => ReactNode[];
|
|
21
21
|
};
|
|
22
22
|
export declare function Chat(props: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
type ChatWelcomeContent = {
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle: string;
|
|
26
|
+
};
|
|
23
27
|
export type ChatWelcomeArgs = {
|
|
24
28
|
context?: ChatContext;
|
|
25
29
|
userName?: string | null;
|
|
@@ -27,4 +31,6 @@ export type ChatWelcomeArgs = {
|
|
|
27
31
|
welcomeSubtitle?: string;
|
|
28
32
|
assistantName: string;
|
|
29
33
|
};
|
|
34
|
+
export declare function getChatWelcomeContent(args: ChatWelcomeArgs): ChatWelcomeContent;
|
|
35
|
+
export {};
|
|
30
36
|
//# sourceMappingURL=Chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGxF,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgCvC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYpG,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,SAAS,EAAE,CAAC;CAClE,CAAC;AAuCF,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAKpC;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGxF,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgCvC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAYpG,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,SAAS,EAAE,CAAC;CAClE,CAAC;AAuCF,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAKpC;AAiBD,KAAK,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,eAAe,GAAG,kBAAkB,CAqB/E"}
|
|
@@ -87,15 +87,15 @@ function referenceToFilePart(reference, uploadsUrl) {
|
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
function getChatWelcomeContent(args) {
|
|
90
|
+
export function getChatWelcomeContent(args) {
|
|
91
91
|
return match(args.context)
|
|
92
92
|
.with({ kind: ChatContextKind.RuleEdit }, ({ ruleIri }) => ({
|
|
93
|
-
title:
|
|
94
|
-
subtitle: `Describe the changes you'd like to make to ${getRuleDisplayName(ruleIri)}.
|
|
93
|
+
title: `Refine with ${args.assistantName}`,
|
|
94
|
+
subtitle: `Describe the changes you'd like to make to ${getRuleDisplayName(ruleIri)}. ${args.assistantName} stages them for your review — nothing goes live until you commit.`,
|
|
95
95
|
}))
|
|
96
96
|
.with({ kind: ChatContextKind.RuleCreate }, () => ({
|
|
97
|
-
title:
|
|
98
|
-
subtitle:
|
|
97
|
+
title: `Create a rule with ${args.assistantName}`,
|
|
98
|
+
subtitle: `Describe the rule you want in your own words. ${args.assistantName} drafts it and stages it for your review — nothing goes live until you commit.`,
|
|
99
99
|
}))
|
|
100
100
|
.with({ kind: ChatContextKind.Plan }, ({ planGraphIri }) => ({
|
|
101
101
|
title: extractPlanName(planGraphIri),
|
|
@@ -177,7 +177,7 @@ function ChatContent(props) {
|
|
|
177
177
|
setPendingAssistantTurn(true);
|
|
178
178
|
}, [setActiveTurnKey, setPendingAssistantTurn, turnKeyRef]);
|
|
179
179
|
const handleAgentSubmit = useCallback(async (value, files) => {
|
|
180
|
-
if (status === "streaming") {
|
|
180
|
+
if (status === "submitted" || status === "streaming") {
|
|
181
181
|
await stop?.();
|
|
182
182
|
}
|
|
183
183
|
let fileParts;
|
|
@@ -232,6 +232,14 @@ function ChatContent(props) {
|
|
|
232
232
|
resetChatTurn();
|
|
233
233
|
}
|
|
234
234
|
}, [beginAssistantTurn, chatData?.regenerate, resetChatTurn]);
|
|
235
|
+
const handleStopGeneration = useCallback(async () => {
|
|
236
|
+
try {
|
|
237
|
+
await stop?.();
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
resetChatTurn();
|
|
241
|
+
}
|
|
242
|
+
}, [stop, resetChatTurn]);
|
|
235
243
|
const handleFilesRejected = useCallback((rejected) => {
|
|
236
244
|
for (const { file, reason } of rejected) {
|
|
237
245
|
toast.error(`${file.name}: ${reason}`);
|
|
@@ -250,7 +258,9 @@ function ChatContent(props) {
|
|
|
250
258
|
const turnError = status === "error" ? error : undefined;
|
|
251
259
|
const isAwaitingAssistant = status === "submitted" || status === "streaming";
|
|
252
260
|
const turnInProgress = isAwaitingAssistant || isChatStreaming || isChatRecovering;
|
|
253
|
-
const
|
|
261
|
+
const isChatStarting = hasPendingMessage && !chatData;
|
|
262
|
+
const isComposerBusy = isUploading || isSessionConnecting || isChatStarting || hasPendingQuestionnaire;
|
|
263
|
+
const areStartersDisabled = isComposerBusy || turnInProgress || isResumeProbe;
|
|
254
264
|
const pendingAssistantMessageId = activeTurnKey ?? latestMessage?.id;
|
|
255
265
|
const needsPendingPlaceholder = isAwaitingAssistant && latestMessage?.role !== "assistant";
|
|
256
266
|
const displayMessages = useMemo(() => {
|
|
@@ -291,7 +301,7 @@ function ChatContent(props) {
|
|
|
291
301
|
.with({ ruleEditContext: P.nonNullable }, () => "Describe the change you'd like to make to this rule…")
|
|
292
302
|
.with({ isRuleCreateContext: true }, () => "Describe the rule you'd like to create…")
|
|
293
303
|
.otherwise(() => `Ask me anything about ${datastoreName ?? "your datastore"}...`);
|
|
294
|
-
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled:
|
|
304
|
+
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled: areStartersDisabled })] }) })), hasMessages && (_jsx(MessagesContainer, { messages: displayMessages, toolsUsedInSession: toolsUsedInSession, onAddToolResult: addToolResult || (() => { }), status: status, thinkingSeconds: thinkingSeconds, activeTurnKey: activeTurnKey, compact: isCopilot, animateOnMount: !hasPendingMessage, turnError: turnError, onRetryTurn: () => void handleRetryTurn(), onStartNewChat: startNewChat }))] }), _jsxs("div", { className: cn("sticky bottom-0 z-20 py-2 px-4 space-y-2 w-full bg-base-background", !isCopilot && "max-w-3xl mx-auto", isCopilot && "pb-4"), children: [hasMessages && (_jsx("div", { className: "pointer-events-none absolute -top-10 left-0 right-0 h-10 bg-linear-to-t from-base-background to-transparent" })), _jsx(ConversationScrollButton, { className: "absolute -top-12 left-1/2 -translate-x-1/2 z-30" }), !isEmbedded && latestShowcase && (_jsx(ReviewCta, { title: humanizePlanName(latestShowcase.planName), subtitle: planStatusLabel(latestShowcase.status), className: "plan-badge-border gap-4 px-4 py-2 rounded-full", onClick: () => void handleSelectPlan(latestShowcase.planIri) })), !isEmbedded && isRuleCreateContext && _jsx(StagedRuleCta, { messages: agentMessages }), _jsxs(ChatInput, { initialValue: composerDraft.initialValue, dropTargetRef: dropZoneRef, onSubmit: isComposerBusy ? undefined : composerDraft.onSubmit, onRejected: handleFilesRejected, topContent: _jsx(ChatInputFilePreview, { progress: uploadProgress }), children: [!hasPendingQuestionnaire && _jsx(ChatInputAttachButton, {}), _jsx(ChatInputTextarea, { placeholder: composerPlaceholder, className: "pl-5", autoFocus: shouldAutoFocusInput, disabled: hasPendingQuestionnaire, "data-chat-input": true }), _jsx(ChatInputSubmit, { icon: ArrowUp, "aria-label": "Send", isLoading: isUploading, disabled: isComposerBusy, stopGeneration: turnInProgress && stop ? handleStopGeneration : undefined })] }, composerDraft.key), !isCopilot && (_jsx(ChatInputFooter, { infoText: `${assistantName} can make mistakes.`, version: kg.knowledgeGraphState?.dataVersion?.uniqueId ?? "unknown", circularProgressTooltip: "Context used (tokens)", min: agentState?.contextTokens ?? 0, max: contextWindow, actions: _jsxs(_Fragment, { children: [isOperator && modelPickerOptions.length > 1 && (_jsx(ChatModelPicker, { models: modelPickerOptions, selectedId: selectedModel, onChange: setSelectedModel })), showDebugMessages && _jsx(DebugMessagesButton, { messages: agentMessages })] }) }))] })] }) }) }) }));
|
|
295
305
|
if (isConnectingOrSyncing) {
|
|
296
306
|
return (_jsxs("div", { className: "relative", children: [_jsx(LoadingView, {}), activeChat?.connectionState === "closed" && (_jsx("div", { className: "absolute inset-x-0 top-0 z-20", children: connectionNotice }))] }));
|
|
297
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatHeaders.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/ChatHeaders.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAIjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatHeaders.d.ts","sourceRoot":"","sources":["../../../src/components/chat-view/ChatHeaders.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAIjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAM3D,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA8BxD;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,SAAS,EAAE,CAAC;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAMF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CA+FtD"}
|
|
@@ -10,6 +10,7 @@ import { Button } from "#components/button/index";
|
|
|
10
10
|
import { Dropdown, DropdownContent, DropdownItem, DropdownTrigger } from "#components/dropdown/index";
|
|
11
11
|
import { isDevBuild } from "#lib/build-config";
|
|
12
12
|
import { cn } from "#lib/utils";
|
|
13
|
+
import { useAssistantName } from "#providers/AssistantNameProvider";
|
|
13
14
|
import { useMantaClient } from "#providers/index";
|
|
14
15
|
import { getRuleDisplayName, getRuleHref } from "#routes/rules/components/rules.utils";
|
|
15
16
|
export function RuleEditBanner(props) {
|
|
@@ -17,13 +18,13 @@ export function RuleEditBanner(props) {
|
|
|
17
18
|
const displayName = ruleName ?? getRuleDisplayName(ruleIri);
|
|
18
19
|
return (_jsxs("div", { className: cn("shrink-0 flex h-12 items-center justify-between gap-3 border-b border-default-border bg-base-background px-4", className), children: [_jsxs("span", { className: "typography-small text-muted-foreground truncate", children: ["Editing rule", " ", _jsx(Link, { to: getRuleHref({ ruleIri }), className: "text-default-foreground hover:underline", children: displayName })] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", rounded: "md", iconOnly: true, icon: X, "aria-label": "Exit rule edit", onClick: onExit, className: "text-muted-foreground hover:text-default-foreground" })] }));
|
|
19
20
|
}
|
|
20
|
-
const defaultCopilotTitle = "Manta Co-pilot";
|
|
21
21
|
function defaultCopilotMenuItems(defaults) {
|
|
22
22
|
return [defaults.openInManta, defaults.debugMessages, defaults.clearChat];
|
|
23
23
|
}
|
|
24
24
|
export function CopilotHeader(props) {
|
|
25
25
|
const { isOperator, datastoreId, onClear, onClose, conversationId, messages, isEmbedded, renderMenuItems = defaultCopilotMenuItems, className, title, } = props;
|
|
26
26
|
const { mantaBaseUrl, datastorePath } = useMantaClient();
|
|
27
|
+
const assistantName = useAssistantName();
|
|
27
28
|
const [debugOpen, setDebugOpen] = useState(false);
|
|
28
29
|
const canClear = Boolean(conversationId && isPresent(messages) && onClear);
|
|
29
30
|
const showDebugMessages = isOperator || isDevBuild;
|
|
@@ -38,5 +39,5 @@ export function CopilotHeader(props) {
|
|
|
38
39
|
debugMessages: showDebugMessages ? (_jsx(DropdownItem, { icon: _jsx(Bug, { className: "size-4" }), onClick: () => setDebugOpen(true), children: "Debug messages" }, "debug-messages")) : null,
|
|
39
40
|
clearChat: canClear ? (_jsx(DropdownItem, { icon: _jsx(Trash2, { className: "size-4" }), onClick: onClear, className: "text-error-foreground", children: "Clear chat" }, "clear-chat")) : null,
|
|
40
41
|
}).filter(isPresent);
|
|
41
|
-
return (_jsxs("div", { className: cn("shrink-0 flex h-16 items-center justify-between border-b border-default-border bg-base-background px-6", className), children: [_jsx("span", { className: "typography-small-medium text-default-foreground", children: isPresent(title) ? title :
|
|
42
|
+
return (_jsxs("div", { className: cn("shrink-0 flex h-16 items-center justify-between border-b border-default-border bg-base-background px-6", className), children: [_jsx("span", { className: "typography-small-medium text-default-foreground", children: isPresent(title) ? title : `${assistantName} Co-pilot` }), _jsxs("div", { className: "flex items-center gap-2", children: [isPresent(menuItems) && (_jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", rounded: "md", iconOnly: true, icon: Ellipsis, "aria-label": "Open menu", className: "text-muted-foreground hover:text-default-foreground" }) }), _jsx(DropdownContent, { align: "end", children: menuItems })] })), onClose && (_jsx(Button, { type: "button", variant: "ghost", size: "sm", rounded: "md", iconOnly: true, icon: X, "aria-label": "Close", onClick: onClose, className: "text-muted-foreground hover:text-default-foreground" }))] }), _jsx(DebugMessagesDialog, { messages: messages, open: debugOpen, onOpenChange: setDebugOpen })] }));
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedDatastorePicker.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/EmbeddedDatastorePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmbeddedDatastorePicker.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/EmbeddedDatastorePicker.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CACnD,CAAC;AAGF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,2CA6H1E"}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDatastoreTreeQuery } from "@manta-eu/client";
|
|
2
3
|
import { isPresent } from "@manta-eu/lib/present";
|
|
3
4
|
import { LoaderCircle } from "lucide-react";
|
|
4
5
|
import { useCallback, useMemo, useState } from "react";
|
|
6
|
+
import { Banner } from "#components/banner/index";
|
|
5
7
|
import { SearchInput } from "#components/input/index";
|
|
6
8
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "#components/tooltip/index";
|
|
7
9
|
import { useDatastoreSelection } from "#hooks/useDatastoreSelection";
|
|
8
10
|
import { datastorePickerRows, DatastoreRowContent, datastoreRowIndent, datastoreRowTestIdPrefix, filterDatastoreRows, searchThreshold, } from "#ldo-ui";
|
|
9
11
|
import { cn } from "#lib/utils";
|
|
10
12
|
import { useAssistantName } from "#providers/AssistantNameProvider";
|
|
13
|
+
import { useMantaClient } from "#providers/MantaClientProvider";
|
|
11
14
|
// No sidebar to hang the profile-menu picker off, so an operator picks the tenant before the chat opens.
|
|
12
15
|
export function EmbeddedDatastorePicker(props) {
|
|
13
|
-
const { datastores, canSwitchDatastore, onDatastoreChosen } = props;
|
|
16
|
+
const { datastores, isOperator, canSwitchDatastore, onDatastoreChosen } = props;
|
|
14
17
|
const assistantName = useAssistantName();
|
|
15
18
|
const [search, setSearch] = useState("");
|
|
16
19
|
const { setSelectedDatastore, isSwitching } = useDatastoreSelection({ canSwitchDatastore });
|
|
17
|
-
const
|
|
20
|
+
const { mantaClient } = useMantaClient();
|
|
21
|
+
const { data, isLoading: isLoadingTree, isError: isTreeFailed, refetch: refetchTree, } = useDatastoreTreeQuery(mantaClient, undefined, { enabled: isOperator === true });
|
|
22
|
+
const datastoreTree = data?.datastoreTree;
|
|
23
|
+
const rows = useMemo(() => datastorePickerRows({ isOperator, userDatastores: datastores, datastoreTree }), [datastores, isOperator, datastoreTree]);
|
|
18
24
|
const visibleRows = useMemo(() => filterDatastoreRows(rows, search), [rows, search]);
|
|
19
25
|
const choose = useCallback(async (row) => {
|
|
20
26
|
if (!(await setSelectedDatastore(row.id)))
|
|
21
27
|
return;
|
|
22
28
|
onDatastoreChosen(datastores.find((datastore) => datastore.id === row.id) ?? { id: row.id, name: row.name });
|
|
23
29
|
}, [datastores, setSelectedDatastore, onDatastoreChosen]);
|
|
24
|
-
return (_jsx(TooltipProvider, { delayDuration: 300, children: _jsxs("div", { className: "flex h-full flex-col gap-4 bg-background p-6 text-default-foreground", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("h2", { className: "typography-large-body-semibold leading-none", children: "Select a datastore" }), _jsxs("p", { className: "typography-small text-muted-foreground", children: ["Choose which datastore ", assistantName, " should answer for."] })] }), rows.length > searchThreshold && (_jsx(SearchInput, { autoFocus: true, placeholder: "Search datastores...", value: search, onChange: (event) => setSearch(event.target.value) })), isSwitching && (_jsxs("div", { className: "flex items-center gap-2 typography-caption text-muted-foreground", children: [_jsx(LoaderCircle, { className: "size-4 animate-spin" }), "Switching datastore..."] })), isPresent(visibleRows) ? (_jsx("ul", { className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto", "data-testid": "embedded-datastore-picker", children: visibleRows.map((row) => {
|
|
30
|
+
return (_jsx(TooltipProvider, { delayDuration: 300, children: _jsxs("div", { className: "flex h-full flex-col gap-4 bg-background p-6 text-default-foreground", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("h2", { className: "typography-large-body-semibold leading-none", children: "Select a datastore" }), _jsxs("p", { className: "typography-small text-muted-foreground", children: ["Choose which datastore ", assistantName, " should answer for."] })] }), isLoadingTree && (_jsxs("div", { className: "flex items-center gap-2 typography-caption text-muted-foreground", children: [_jsx(LoaderCircle, { className: "size-4 animate-spin" }), "Loading datastores..."] })), isTreeFailed && (_jsx(Banner, { type: "error", size: "loose", label: "Could not load your datastores", description: "Only the default datastore is listed until they load.", actionLabel: "Retry", onAction: () => void refetchTree(), testId: "embedded-datastore-tree-error", buttonTestId: "embedded-datastore-tree-retry" })), rows.length > searchThreshold && (_jsx(SearchInput, { autoFocus: true, placeholder: "Search datastores...", value: search, onChange: (event) => setSearch(event.target.value) })), isSwitching && (_jsxs("div", { className: "flex items-center gap-2 typography-caption text-muted-foreground", children: [_jsx(LoaderCircle, { className: "size-4 animate-spin" }), "Switching datastore..."] })), isPresent(visibleRows) ? (_jsx("ul", { className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto", "data-testid": "embedded-datastore-picker", children: visibleRows.map((row) => {
|
|
25
31
|
const className = cn("flex w-full items-center gap-2 rounded-sm-v4 p-2 text-left", row.heading
|
|
26
32
|
? "cursor-default"
|
|
27
33
|
: "hover:bg-accent focus-visible:bg-accent focus-visible:outline-none disabled:opacity-60");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/embedded-chat/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,sBAAsB,EAA0C,MAAM,iBAAiB,CAAC;AAOxH,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,wBAAgB,YAAY,CAAC,KAAK,EAAE,sBAAsB,2CAazD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isEmpty } from "ramda";
|
|
3
2
|
import { useState } from "react";
|
|
4
3
|
import { MemoryRouter, useInRouterContext } from "react-router";
|
|
5
4
|
import { Chat } from "../chat-view/index.js";
|
|
@@ -37,14 +36,8 @@ function EmbeddedContent(props) {
|
|
|
37
36
|
onAction: onLogout,
|
|
38
37
|
}) }) }) }));
|
|
39
38
|
}
|
|
40
|
-
if (isOperator && isEmpty(datastores)) {
|
|
41
|
-
return (_jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: _jsx("div", { className: "w-full max-w-md space-y-4", children: _jsx(Banner, { type: "error", size: "loose", label: "Configuration Error", description: "No datastores available for operator access. Please contact your administrator.", ...(onLogout && {
|
|
42
|
-
actionLabel: "Sign Out",
|
|
43
|
-
onAction: onLogout,
|
|
44
|
-
}) }) }) }));
|
|
45
|
-
}
|
|
46
39
|
if (isOperator && !activeDatastore) {
|
|
47
|
-
return (_jsx(EmbeddedDatastorePicker, { datastores: datastores, canSwitchDatastore: canSwitchDatastore, onDatastoreChosen: setChosenDatastore }));
|
|
40
|
+
return (_jsx(EmbeddedDatastorePicker, { datastores: datastores, isOperator: isOperator, canSwitchDatastore: canSwitchDatastore, onDatastoreChosen: setChosenDatastore }));
|
|
48
41
|
}
|
|
49
42
|
return (_jsx(ChatManagerProvider, { datastoreId: activeDatastore?.id, onSelectPlan: onSelectPlan, children: _jsx(KnowledgeGraphStateProvider, { datastoreId: activeDatastore?.id, children: _jsx(KnowledgeGraphStartupGate, { embedded: true, children: _jsx(Chat, { datastore: activeDatastore, user: user, onLogout: onLogout, onCloseAction: onClose, isCopilot: true, isEmbedded: true, isOperator: isOperator, pageContext: props.pageContext, title: props.title, mark: props.mark, initialPrompt: props.initialPrompt, initialDraft: props.initialDraft, welcomeSubtitle: props.welcomeSubtitle, renderMenuItems: props.renderMenuItems }) }) }) }, activeDatastore?.id));
|
|
50
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layouts/Sidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layouts/Sidebar.tsx"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA6BvD,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAmZ1C"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { chatIdToPath } from "@manta-eu/client/shared/index";
|
|
3
3
|
import { realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
4
4
|
import { isPresent } from "@manta-eu/lib/present";
|
|
5
|
-
import { Activity, Brain, ChevronUp, Command, Database, FileCode2, History, PanelLeftIcon, Plug, Plus, Search, Trash2, UserPlus, Waypoints, Zap, } from "lucide-react";
|
|
5
|
+
import { Activity, Brain, ChevronUp, CircleAlert, Command, Database, FileCode2, History, PanelLeftIcon, Plug, Plus, Search, Trash2, UserPlus, Waypoints, Zap, } from "lucide-react";
|
|
6
6
|
import { AnimatePresence, motion } from "motion/react";
|
|
7
7
|
import { use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { Link, useLocation } from "react-router";
|
|
@@ -17,6 +17,7 @@ import { ChannelIcon } from "#components/channel-icon/index";
|
|
|
17
17
|
import { DropdownGroup, DropdownItem } from "#components/dropdown/index";
|
|
18
18
|
import { Popover, PopoverContent, PopoverTrigger } from "#components/popover/index";
|
|
19
19
|
import { Sidebar as BaseSidebar, Initials, NavMenu, NavUser, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "#components/sidebar/index";
|
|
20
|
+
import { useConnectionProblems } from "#hooks/use-connection-problems";
|
|
20
21
|
import { useConversations } from "#hooks/useConversations";
|
|
21
22
|
import { useDeleteChat } from "#hooks/useDeleteChat";
|
|
22
23
|
import { canPickDatastore } from "#ldo-ui";
|
|
@@ -49,7 +50,9 @@ export function Sidebar(props) {
|
|
|
49
50
|
const { pathname } = useLocation();
|
|
50
51
|
const { isKnowledgeGraphUnavailable } = useKnowledgeGraphState();
|
|
51
52
|
const { user, datastore, datastores, isOperator, isSwitching, canSwitchDatastore, onLogout, onDatastoreSelected } = props;
|
|
52
|
-
const
|
|
53
|
+
const authContext = use(AuthContext);
|
|
54
|
+
const canManageTeam = authContext?.canManageTeam ?? false;
|
|
55
|
+
const canManageStreams = authContext?.canManageStreams ?? isOperator ?? false;
|
|
53
56
|
const { state: sidebarState, isMobile, toggleSidebar, setOpenMobile } = useSidebar();
|
|
54
57
|
const isSidebarExpanded = isMobile || sidebarState === "expanded";
|
|
55
58
|
useEffect(() => {
|
|
@@ -60,6 +63,7 @@ export function Sidebar(props) {
|
|
|
60
63
|
const { setOpen } = useCommandContext();
|
|
61
64
|
const { conversations } = useConversations({ limit: 10 });
|
|
62
65
|
const { datastorePath } = useMantaClient();
|
|
66
|
+
const hasConnectionProblems = isPresent(useConnectionProblems());
|
|
63
67
|
const { isApple } = usePlatform();
|
|
64
68
|
const ModifierIcon = isApple ? Command : ChevronUp;
|
|
65
69
|
const navItemTooltip = isKnowledgeGraphUnavailable ? "Available when Manta is ready" : undefined;
|
|
@@ -102,6 +106,8 @@ export function Sidebar(props) {
|
|
|
102
106
|
icon: Plug,
|
|
103
107
|
isActive: pathname.startsWith("/integrations"),
|
|
104
108
|
href: "/integrations",
|
|
109
|
+
badge: hasConnectionProblems && (_jsx(CircleAlert, { className: "size-4 text-error-foreground group-data-[collapsible=icon]:size-2.5" })),
|
|
110
|
+
badgeLabel: "needs attention",
|
|
105
111
|
},
|
|
106
112
|
{
|
|
107
113
|
title: "Rules",
|
|
@@ -116,7 +122,7 @@ export function Sidebar(props) {
|
|
|
116
122
|
isActive: pathname === "/data" || pathname.startsWith("/data/"),
|
|
117
123
|
href: "/data",
|
|
118
124
|
},
|
|
119
|
-
...(
|
|
125
|
+
...(canManageStreams
|
|
120
126
|
? [
|
|
121
127
|
{
|
|
122
128
|
title: "Streams",
|
|
@@ -126,13 +132,27 @@ export function Sidebar(props) {
|
|
|
126
132
|
},
|
|
127
133
|
]
|
|
128
134
|
: []),
|
|
129
|
-
].map((item) => ({ ...item, disabled: isKnowledgeGraphUnavailable, tooltip: navItemTooltip })), [
|
|
135
|
+
].map((item) => ({ ...item, disabled: isKnowledgeGraphUnavailable, tooltip: navItemTooltip })), [
|
|
136
|
+
ModifierIcon,
|
|
137
|
+
startNewChat,
|
|
138
|
+
isKnowledgeGraphUnavailable,
|
|
139
|
+
canManageStreams,
|
|
140
|
+
pathname,
|
|
141
|
+
setOpen,
|
|
142
|
+
navItemTooltip,
|
|
143
|
+
hasConnectionProblems,
|
|
144
|
+
]);
|
|
130
145
|
const userName = isPresent(user?.name) ? user.name : isPresent(user?.email) ? user.email : "User";
|
|
131
146
|
// An operator with no explicit pick is still on the realm default, not a blank name.
|
|
132
147
|
const datastoreName = datastore?.name ?? (isOperator ? realmVocabLabel(realmDatastoreId) : "");
|
|
133
148
|
const chatId = activeConversation?.id;
|
|
134
149
|
const canManageDatastores = enableDatastoreManagement && !!isOperator && !!onDatastoreSelected;
|
|
135
|
-
const showDatastorePicker = canPickDatastore({
|
|
150
|
+
const showDatastorePicker = canPickDatastore({
|
|
151
|
+
canSwitchDatastore,
|
|
152
|
+
canSelect: !!onDatastoreSelected,
|
|
153
|
+
datastores,
|
|
154
|
+
isOperator,
|
|
155
|
+
});
|
|
136
156
|
// Deferred until the menu's close animation finishes, so navigating doesn't cut it short.
|
|
137
157
|
const pendingMenuNavigateRef = useRef(null);
|
|
138
158
|
const handleProfileMenuCloseAutoFocus = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActioningView.d.ts","sourceRoot":"","sources":["../../../src/components/planning/ActioningView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAclF,OAAO,EAA0B,KAAK,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ActioningView.d.ts","sourceRoot":"","sources":["../../../src/components/planning/ActioningView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAclF,OAAO,EAA0B,KAAK,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAmB1G,KAAK,kBAAkB,GAAG;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,GAAG,CAAC;IACtB,gBAAgB,CAAC,EAAE,4BAA4B,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,SAAS,CAAC;CAClC,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAkOtD"}
|
|
@@ -16,11 +16,17 @@ import { UnavailablePlanNotice } from "./UnavailablePlanNotice.js";
|
|
|
16
16
|
import { Loader } from "#components/loader/index";
|
|
17
17
|
import { useActionPlanDetail } from "#hooks/useActionPlanDetail";
|
|
18
18
|
import { useActionPlanExecution } from "#hooks/useActionPlanExecution";
|
|
19
|
-
import { useActionPlanDiff, useActionPlanExecutionProvenance, useManualActions } from "#ldo-ui";
|
|
19
|
+
import { useActionPlanDiff, useActionPlanExecutionProvenance, useManualActions, } from "#ldo-ui";
|
|
20
|
+
import { extractLabel } from "#lib/iri-labels";
|
|
20
21
|
import { getPendingManualActions } from "#lib/manual-actions";
|
|
21
22
|
import { cn } from "#lib/utils";
|
|
22
23
|
import { useMantaClient } from "#providers/MantaClientProvider";
|
|
23
24
|
import { invalidateActionPlanQueries } from "#shared/query-keys";
|
|
25
|
+
const resolutionStatuses = {
|
|
26
|
+
COMPLETED: GQLManualActionResolveStatus.Completed,
|
|
27
|
+
RETRY: GQLManualActionResolveStatus.Retry,
|
|
28
|
+
REJECTED: GQLManualActionResolveStatus.Rejected,
|
|
29
|
+
};
|
|
24
30
|
export function ActioningView(props) {
|
|
25
31
|
const { planGraphIri, diff, isLoading, executionControl, executePromptNonce, datastoreId, userId, hideTopBar = false, chatIri, completedChangesSlot, } = props;
|
|
26
32
|
const planName = extractPlanName(planGraphIri);
|
|
@@ -71,7 +77,7 @@ export function ActioningView(props) {
|
|
|
71
77
|
const { mantaClient } = useMantaClient();
|
|
72
78
|
const resolveManualAction = useResolveManualActionMutation(mantaClient);
|
|
73
79
|
const canResolveManualAction = !!datastoreId && !!userId;
|
|
74
|
-
const handleManualActionResolve = useCallback((subjectIri,
|
|
80
|
+
const handleManualActionResolve = useCallback((subjectIri, resolution) => {
|
|
75
81
|
if (!userId) {
|
|
76
82
|
toast.error("Cannot resolve manual action: missing user context.");
|
|
77
83
|
return;
|
|
@@ -80,7 +86,7 @@ export function ActioningView(props) {
|
|
|
80
86
|
namedGraphIri: planGraphIri,
|
|
81
87
|
subjectIri,
|
|
82
88
|
resolvedBy: userId,
|
|
83
|
-
status:
|
|
89
|
+
status: resolutionStatuses[resolution],
|
|
84
90
|
}, {
|
|
85
91
|
onSuccess: async () => {
|
|
86
92
|
await invalidateActionPlanQueries(queryClient, planGraphIri);
|
|
@@ -91,7 +97,6 @@ export function ActioningView(props) {
|
|
|
91
97
|
},
|
|
92
98
|
});
|
|
93
99
|
}, [userId, planGraphIri, resolveManualAction, queryClient]);
|
|
94
|
-
const handleManualActionSkip = useCallback((subjectIri) => handleManualActionResolve(subjectIri, "REJECTED"), [handleManualActionResolve]);
|
|
95
100
|
const handleExecute = useCallback((nextDryRun) => {
|
|
96
101
|
void execute(nextDryRun);
|
|
97
102
|
}, [execute]);
|
|
@@ -110,7 +115,7 @@ export function ActioningView(props) {
|
|
|
110
115
|
map.set(ma.subjectIri, [
|
|
111
116
|
{
|
|
112
117
|
subjectIri: ma.subjectIri,
|
|
113
|
-
label: ma.subjectLabel || ma.typeName || "Manual action",
|
|
118
|
+
label: (ma.aboutIri && extractLabel(ma.aboutIri)) || ma.subjectLabel || ma.typeName || "Manual action",
|
|
114
119
|
properties: [],
|
|
115
120
|
},
|
|
116
121
|
]);
|
|
@@ -149,5 +154,5 @@ export function ActioningView(props) {
|
|
|
149
154
|
}, [entityTypes, manualActions]);
|
|
150
155
|
const completedChanges = executionStatus === "completed" ? completedChangesSlot : null;
|
|
151
156
|
return (_jsxs("div", { className: cn("flex flex-col", !hideTopBar && "h-full bg-background"), children: [!hideTopBar && (_jsx(ExecutionTopBar, { planName: planName, status: executionStatus, workflowId: workflowId, triggerError: triggerError, onExecute: hasCurrentFacts ? handleExecute : undefined, onRerun: hasCurrentFacts ? handleConfirmRerun : undefined, isExecuteDialogOpen: isExecuteDialogOpen, onExecuteDialogOpenChange: setIsExecuteDialogOpen, isDryRun: isDryRun })), !hideTopBar && isDryRunCompleted && _jsx(DryRunCompleteBanner, {}), _jsx("div", { className: cn(!hideTopBar && "flex-1 overflow-y-auto"), children: _jsxs("div", { className: cn("space-y-6", hideTopBar ? "mx-auto w-full max-w-7xl px-8" : "mx-auto max-w-[960px] px-16 py-8"), children: [!hideTopBar && plan && !plan.hasCurrentFacts && (_jsx(UnavailablePlanNotice, { hasExecutionHistory: plan.hasExecutionHistory })), executionStatus === "failed" && (provenance?.planErrorMessage || triggerError) && (_jsx(FailedBanner, { message: provenance?.planErrorMessage ?? triggerError ?? "Execution failed" })), isLoading && !isPresent(effectiveEntityTypes) && (_jsx("div", { className: "flex items-center justify-center py-12", children: _jsx(Loader, { className: "size-6" }) })), plan && (_jsx(SummaryBar, { plan: plan, executionStatus: executionStatus, startedAtMs: planStartedAtMs, endedAtMs: planEndedAtMs })), completedChanges ??
|
|
152
|
-
(isPresent(effectiveEntityTypes) && (_jsx(ExecutionSections, { entityTypes: effectiveEntityTypes, provenance: provenance ?? null, manualActions: manualActions, manualActionEntities: manualActionEntities, activeStartedAtMs: activeStartedAtMs, onManualActionResolve: handleManualActionResolve,
|
|
157
|
+
(isPresent(effectiveEntityTypes) && (_jsx(ExecutionSections, { entityTypes: effectiveEntityTypes, provenance: provenance ?? null, manualActions: manualActions, manualActionEntities: manualActionEntities, activeStartedAtMs: activeStartedAtMs, onManualActionResolve: handleManualActionResolve, isResolvingManualAction: resolveManualAction.isPending || !canResolveManualAction })))] }) })] }));
|
|
153
158
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EntityTypeEntry } from "./ActionPlanDetailView.js";
|
|
2
2
|
import { type SectionStatus } from "./execution-section-model.js";
|
|
3
3
|
import { type ManualActionEntity } from "./ManualActionCard.js";
|
|
4
|
-
import type { ExecutionProvenanceActivity, ManualAction } from "#ldo-ui";
|
|
4
|
+
import type { ExecutionProvenanceActivity, ManualAction, ManualActionResolution } from "#ldo-ui";
|
|
5
5
|
export type ExecutionSectionItemProps = {
|
|
6
6
|
entry: EntityTypeEntry;
|
|
7
7
|
activities: ExecutionProvenanceActivity[];
|
|
@@ -11,8 +11,7 @@ export type ExecutionSectionItemProps = {
|
|
|
11
11
|
onToggle: () => void;
|
|
12
12
|
manualActions?: ManualAction[];
|
|
13
13
|
manualActionEntities?: Map<string, ManualActionEntity[]>;
|
|
14
|
-
onManualActionResolve?: (subjectIri: string,
|
|
15
|
-
onManualActionSkip?: (subjectIri: string) => void;
|
|
14
|
+
onManualActionResolve?: (subjectIri: string, resolution: ManualActionResolution) => void;
|
|
16
15
|
isResolvingManualAction?: boolean;
|
|
17
16
|
};
|
|
18
17
|
export declare function ExecutionSectionItem(props: ExecutionSectionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExecutionSectionItem.d.ts","sourceRoot":"","sources":["../../../src/components/planning/ExecutionSectionItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAoD,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEjH,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ExecutionSectionItem.d.ts","sourceRoot":"","sources":["../../../src/components/planning/ExecutionSectionItem.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAoD,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAEjH,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,2BAA2B,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAIjG,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACzF,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CAoFpE"}
|
|
@@ -3,7 +3,7 @@ import { humanDuration } from "@manta-eu/lib/humanize";
|
|
|
3
3
|
import { isPresent } from "@manta-eu/lib/present";
|
|
4
4
|
import { AlertCircle, Check, ChevronDown, ClockFading, Loader2 } from "lucide-react";
|
|
5
5
|
import { isNotNil } from "ramda";
|
|
6
|
-
import {
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
7
|
import { match } from "ts-pattern";
|
|
8
8
|
import { resolveStepIcon } from "./action-plan-icons.js";
|
|
9
9
|
import { findResolvedManualActionStatus, parseTimestampMs } from "./execution-section-model.js";
|
|
@@ -12,14 +12,11 @@ import { ManualActionCard } from "./ManualActionCard.js";
|
|
|
12
12
|
import { getPendingManualActions, getResolvedManualActions } from "#lib/manual-actions";
|
|
13
13
|
import { cn } from "#lib/utils";
|
|
14
14
|
export function ExecutionSectionItem(props) {
|
|
15
|
-
const { entry, activities, status, fallbackStartedAtMs = null, isExpanded, onToggle, manualActions = [], manualActionEntities, onManualActionResolve,
|
|
16
|
-
const handleApprove = useCallback((subjectIri) => onManualActionResolve?.(subjectIri, "COMPLETED"), [onManualActionResolve]);
|
|
17
|
-
const handleReject = useCallback((subjectIri) => onManualActionResolve?.(subjectIri, "REJECTED"), [onManualActionResolve]);
|
|
18
|
-
const handleSkip = useCallback((subjectIri) => onManualActionSkip?.(subjectIri), [onManualActionSkip]);
|
|
15
|
+
const { entry, activities, status, fallbackStartedAtMs = null, isExpanded, onToggle, manualActions = [], manualActionEntities, onManualActionResolve, isResolvingManualAction = false, } = props;
|
|
19
16
|
const pendingManualActions = getPendingManualActions(manualActions);
|
|
20
17
|
const resolvedManualActions = getResolvedManualActions(manualActions);
|
|
21
18
|
const hasContent = isPresent(activities) || isPresent(pendingManualActions);
|
|
22
|
-
return (_jsxs("div", { children: [_jsxs("button", { type: "button", onClick: onToggle, className: "flex w-full items-center gap-3 pl-2 pr-3 py-3 text-left transition-colors hover:bg-muted/30", children: [_jsx("div", { className: "flex shrink-0 items-center p-1.5 rounded-lg", children: _jsx(ChevronDown, { className: cn("size-5 shrink-0 text-muted-foreground transition-transform", !isExpanded && "-rotate-90") }) }), _jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-faint", children: resolveStepIcon(entry.typeName, "size-5 text-muted-foreground") }), _jsxs("div", { className: "flex-1 min-w-0 flex flex-col gap-0.5", children: [_jsx("span", { className: cn("typography-small-medium block truncate", status === "pending" ? "text-muted-foreground" : "text-default-foreground"), children: entry.typeName }), entry.description && (_jsx("span", { className: "typography-tiny text-muted-foreground block truncate", children: entry.description }))] }), _jsxs("div", { className: "flex items-center gap-3 shrink-0", children: [_jsx(SectionElapsed, { activities: activities, status: status, estimatedTime: entry.estimatedTime ?? null, fallbackStartedAtMs: fallbackStartedAtMs }), _jsx(SectionStatusIcon, { status: status })] })] }), isExpanded && hasContent && (_jsxs("div", { className: "bg-faint border-t border-default-border py-1.5", children: [activities.map((activity) => (_jsx(ExecutionActivityRow, { activity: activity, manualActionStatus: findResolvedManualActionStatus(activity, resolvedManualActions) }, activity.iri))), pendingManualActions.map((ma) => (_jsx(ManualActionCard, { manualAction: ma, entities: manualActionEntities?.get(ma.subjectIri) ?? [], description: entry.description ?? undefined, isResolving: isResolvingManualAction,
|
|
19
|
+
return (_jsxs("div", { children: [_jsxs("button", { type: "button", onClick: onToggle, className: "flex w-full items-center gap-3 pl-2 pr-3 py-3 text-left transition-colors hover:bg-muted/30", children: [_jsx("div", { className: "flex shrink-0 items-center p-1.5 rounded-lg", children: _jsx(ChevronDown, { className: cn("size-5 shrink-0 text-muted-foreground transition-transform", !isExpanded && "-rotate-90") }) }), _jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-faint", children: resolveStepIcon(entry.typeName, "size-5 text-muted-foreground") }), _jsxs("div", { className: "flex-1 min-w-0 flex flex-col gap-0.5", children: [_jsx("span", { className: cn("typography-small-medium block truncate", status === "pending" ? "text-muted-foreground" : "text-default-foreground"), children: entry.typeName }), entry.description && (_jsx("span", { className: "typography-tiny text-muted-foreground block truncate", children: entry.description }))] }), _jsxs("div", { className: "flex items-center gap-3 shrink-0", children: [_jsx(SectionElapsed, { activities: activities, status: status, estimatedTime: entry.estimatedTime ?? null, fallbackStartedAtMs: fallbackStartedAtMs }), _jsx(SectionStatusIcon, { status: status })] })] }), isExpanded && hasContent && (_jsxs("div", { className: "bg-faint border-t border-default-border py-1.5", children: [activities.map((activity) => (_jsx(ExecutionActivityRow, { activity: activity, manualActionStatus: findResolvedManualActionStatus(activity, resolvedManualActions) }, activity.iri))), pendingManualActions.map((ma) => (_jsx(ManualActionCard, { manualAction: ma, entities: manualActionEntities?.get(ma.subjectIri) ?? [], description: ma.description ?? entry.description ?? undefined, isResolving: isResolvingManualAction, onResolve: (resolution) => onManualActionResolve?.(ma.subjectIri, resolution) }, ma.subjectIri)))] }))] }));
|
|
23
20
|
}
|
|
24
21
|
function SectionStatusIcon(props) {
|
|
25
22
|
return match(props.status)
|