chat-js 1.0.0-alpha.7 → 1.0.0-alpha.8
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 -4
- package/dist/index.js +433 -658
- package/package.json +1 -1
- package/templates/chat-app/AGENTS.md +1 -1
- package/templates/chat-app/agent/hooks/followup-suggestions.ts +1 -1
- package/templates/chat-app/agent/hooks/projects.ts +1 -1
- package/templates/chat-app/agent/hooks/search.ts +1 -1
- package/templates/chat-app/agent/instructions/projects.ts +1 -1
- package/templates/chat-app/agent/tools/mcp.ts +1 -1
- package/templates/chat-app/app/(auth)/device-login/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/api/files/upload/route.ts +1 -1
- package/templates/chat-app/app/(chat)/chat/{[id] → [chatId]}/page.tsx +4 -4
- package/templates/chat-app/app/(chat)/project/[projectId]/chat/[chatId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/project/[projectId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/[connectorId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/models/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/share/[id]/page.tsx +1 -1
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-conversations/route.ts +2 -2
- package/templates/chat-app/app/api/agent-response-groups/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-response-groups/route.ts +1 -1
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +133 -4
- package/templates/chat-app/app/api/eve/[...path]/route.ts +175 -49
- package/templates/chat-app/app/api/eve-guest/route.ts +1 -1
- package/templates/chat-app/app/api/mcp/oauth/callback/route.ts +1 -1
- package/templates/chat-app/chatjs/core/chat/compose.ts +4 -4
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -6
- package/templates/chat-app/chatjs/core/installation/contracts.ts +0 -7
- package/templates/chat-app/chatjs/generated/installed-auth-ui.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-auth.ts +4 -2
- package/templates/chat-app/chatjs/generated/installed-billing.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +24 -24
- package/templates/chat-app/chatjs/generated/installed-chat.ts +12 -12
- package/templates/chat-app/chatjs/generated/installed-cleanup.ts +4 -4
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +8 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-model-visibility.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-navigation.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-routers.ts +18 -19
- package/templates/chat-app/chatjs/generated/installed-session-profiles.ts +5 -3
- package/templates/chat-app/chatjs/generated/installed-sign-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-signed-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-uploads.ts +2 -2
- package/templates/chat-app/chatjs/plugins/ai-titles/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +7 -9
- package/templates/chat-app/chatjs/plugins/ai-titles/{chatjs.json → plugin.json} +3 -4
- package/templates/chat-app/chatjs/plugins/ai-titles/title-queries.ts +4 -4
- package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/attachment-uploads/plugin.json +16 -0
- package/templates/chat-app/chatjs/plugins/credits/billing.ts +3 -1
- package/templates/chat-app/chatjs/plugins/credits/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/credits/{chatjs.json → plugin.json} +4 -13
- package/templates/chat-app/chatjs/plugins/credits/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/desktop/auth-form.tsx +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/auth-server.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{client-plugin.ts → layout-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/desktop/navigation.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{chatjs.json → plugin.json} +4 -16
- package/templates/chat-app/chatjs/plugins/desktop/sign-out.ts +3 -1
- package/templates/chat-app/chatjs/plugins/feedback/chat-server.ts +13 -0
- package/templates/chat-app/chatjs/plugins/feedback/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/feedback/feedback-actions.tsx +4 -4
- package/templates/chat-app/chatjs/plugins/feedback/feedback-queries.ts +11 -11
- package/templates/chat-app/chatjs/plugins/feedback/feedback-schema.ts +2 -2
- package/templates/chat-app/chatjs/plugins/feedback/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/feedback/router.ts +9 -7
- package/templates/chat-app/chatjs/plugins/feedback/vote-message.ts +3 -6
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/followup-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chatjs.json → plugin.json} +5 -17
- package/templates/chat-app/chatjs/plugins/followup-suggestions/router.ts +8 -9
- package/templates/chat-app/chatjs/plugins/followup-suggestions/suggestions.tsx +2 -7
- package/templates/chat-app/chatjs/plugins/followup-suggestions/use-followups.ts +2 -2
- package/templates/chat-app/chatjs/plugins/guest-chat/cleanup.ts +1 -7
- package/templates/chat-app/chatjs/plugins/guest-chat/guest-auth.ts +1 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/instrumentation.ts +6 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/{chatjs.json → plugin.json} +6 -12
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +3 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +46 -20
- package/templates/chat-app/chatjs/plugins/image-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/image-viewer/plugin.json +11 -0
- package/templates/chat-app/chatjs/plugins/mcp/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/db/encrypted-text.ts +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/mcp/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/mcp/setup.ts +2 -2
- package/templates/chat-app/chatjs/plugins/mcp/{mcp-env.ts → validate-env.ts} +2 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/model-preferences/{use-model-preferences.ts → model-visibility.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/model-preferences/router.ts +5 -1
- package/templates/chat-app/chatjs/plugins/projects/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/projects/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/projects/conversation-hook.ts +1 -1
- package/templates/chat-app/chatjs/plugins/projects/db/project-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/projects/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/projects/router.ts +7 -7
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +3 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/eve-move-project-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +12 -11
- package/templates/chat-app/chatjs/plugins/search/{chat.ts → chat-server.ts} +8 -6
- package/templates/chat-app/chatjs/plugins/search/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/search/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/search/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/search/search-backfill.ts +4 -4
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-queries.ts +13 -13
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-schema.ts +3 -3
- package/templates/chat-app/chatjs/plugins/sharing/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/sharing/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/sharing/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/sharing/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/sharing/ui/chat-contributions.tsx +9 -11
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +6 -6
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-dialog.tsx +9 -9
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/plugin.json +12 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/video-viewer/plugin.json +10 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +2 -2
- package/templates/chat-app/components/chat/chat-composer.tsx +35 -7
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +3 -3
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -1
- package/templates/chat-app/components/chat/chat-sidebar.tsx +3 -6
- package/templates/chat-app/components/chat/chat-transcript.tsx +52 -23
- package/templates/chat-app/components/chat-slots.tsx +1 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +5 -4
- package/templates/chat-app/components/eve/eve-chat-header.tsx +5 -7
- package/templates/chat-app/components/eve/eve-chat-page.tsx +9 -9
- package/templates/chat-app/components/eve/eve-composer.tsx +16 -5
- package/templates/chat-app/components/eve/eve-conversation.tsx +160 -96
- package/templates/chat-app/components/eve/eve-creation-recovery.tsx +21 -2
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +10 -12
- package/templates/chat-app/components/eve/eve-history-list.tsx +3 -8
- package/templates/chat-app/components/eve/eve-logical-context.tsx +1 -0
- package/templates/chat-app/components/eve/eve-logical-navigation.tsx +3 -3
- package/templates/chat-app/components/eve/eve-message-content.tsx +252 -0
- package/templates/chat-app/components/eve/eve-message-part.tsx +13 -58
- package/templates/chat-app/components/eve/eve-pending-input.tsx +82 -5
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +74 -15
- package/templates/chat-app/components/eve/use-eve-composer-draft.ts +64 -26
- package/templates/chat-app/components/eve/use-eve-fork.ts +14 -16
- package/templates/chat-app/components/eve/use-logical-commands.ts +3 -3
- package/templates/chat-app/components/eve/use-new-eve-conversation.tsx +42 -7
- package/templates/chat-app/components/parallel-responses/model-picker.tsx +5 -1
- package/templates/chat-app/components/parallel-responses/responses.tsx +2 -2
- package/templates/chat-app/integrations/routers.ts +1 -1
- package/templates/chat-app/lib/chat-after-create.test.ts +1 -1
- package/templates/chat-app/lib/chat-after-create.ts +1 -1
- package/templates/chat-app/lib/db/eve-creation-failure.ts +3 -3
- package/templates/chat-app/lib/db/eve-current-copy.ts +11 -11
- package/templates/chat-app/lib/db/eve-deletion.ts +19 -19
- package/templates/chat-app/lib/db/eve-dispatch.ts +115 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +4 -4
- package/templates/chat-app/lib/db/eve-files.ts +13 -13
- package/templates/chat-app/lib/db/eve-queries.ts +28 -43
- package/templates/chat-app/lib/db/eve-response-groups.ts +30 -112
- package/templates/chat-app/lib/db/eve-subagents.ts +8 -8
- package/templates/chat-app/lib/db/eve-title.ts +2 -2
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +3 -3
- package/templates/chat-app/lib/db/eve-workspace-turns.ts +37 -5
- package/templates/chat-app/lib/db/eve-workspaces.ts +3 -3
- package/templates/chat-app/lib/db/migrations/0029_branch_identifiers.sql +23 -0
- package/templates/chat-app/lib/db/migrations/meta/0029_snapshot.json +2547 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +7 -0
- package/templates/chat-app/lib/db/schema.ts +19 -25
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +12 -2
- package/templates/chat-app/lib/eve/completed-copy-source.ts +5 -2
- package/templates/chat-app/lib/eve/contracts.test.ts +5 -5
- package/templates/chat-app/lib/eve/contracts.ts +1 -1
- package/templates/chat-app/lib/eve/conversation-scope.test.ts +2 -2
- package/templates/chat-app/lib/eve/conversation-scope.ts +4 -4
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +1 -1
- package/templates/chat-app/lib/eve/create-response-group.test.ts +3 -3
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +3 -3
- package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
- package/templates/chat-app/lib/eve/generated-files.ts +2 -2
- package/templates/chat-app/lib/eve/logical-chat.test.ts +17 -17
- package/templates/chat-app/lib/eve/logical-chat.ts +27 -31
- package/templates/chat-app/lib/eve/logical-response-slots.ts +4 -7
- package/templates/chat-app/lib/eve/message-delivery.ts +1 -0
- package/templates/chat-app/lib/eve/pending-create.test.ts +46 -7
- package/templates/chat-app/lib/eve/pending-create.ts +36 -4
- package/templates/chat-app/lib/eve/persisted-wire-order.test.ts +2 -2
- package/templates/chat-app/lib/eve/prepare-deletion.ts +3 -3
- package/templates/chat-app/lib/eve/purge-local-resources.ts +3 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -2
- package/templates/chat-app/lib/eve/request-policy.ts +1 -0
- package/templates/chat-app/lib/eve/resolve-creation-request.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-contracts.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +12 -12
- package/templates/chat-app/lib/eve/response-group-lineage.ts +21 -24
- package/templates/chat-app/lib/eve/response-group.test.ts +2 -2
- package/templates/chat-app/lib/eve/response-group.ts +1 -1
- package/templates/chat-app/lib/eve/response-model.ts +11 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.test.ts +1 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.ts +3 -3
- package/templates/chat-app/lib/eve/steer-rejected.ts +7 -0
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +27 -0
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +20 -13
- package/templates/chat-app/playwright.config.ts +5 -1
- package/templates/chat-app/scripts/agent-status.ts +6 -19
- package/templates/chat-app/scripts/check-env.ts +75 -56
- package/templates/chat-app/scripts/installed-environment-validation.ts +14 -15
- package/templates/chat-app/trpc/init.ts +2 -0
- package/templates/chat-app/trpc/routers/_app.test.ts +56 -0
- package/templates/chat-app/trpc/routers/_app.ts +12 -11
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -2
- package/templates/chat-app/chatjs/core/installation/plugin.ts +0 -13
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -22
- package/templates/chat-app/chatjs/plugins/credits/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/feedback/chat.ts +0 -13
- package/templates/chat-app/chatjs/plugins/feedback/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/followup-suggestions/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/guest-chat/server-plugin.ts +0 -12
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +0 -17
- package/templates/chat-app/chatjs/plugins/mcp/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/model-preferences/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/projects/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/search/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/sharing/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +0 -18
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +0 -16
- package/templates/chat-app/lib/chat-route.ts +0 -18
- package/templates/chat-app/providers/parse-chat-id-from-pathname.test.ts +0 -126
- package/templates/chat-app/providers/parse-chat-id-from-pathname.ts +0 -51
- /package/templates/chat-app/chatjs/plugins/attachment-uploads/{integration.tsx → uploads.ts} +0 -0
|
@@ -25,18 +25,18 @@ type ShareStep = "info" | "shared";
|
|
|
25
25
|
|
|
26
26
|
/** Runtime-owned link destination; the dialog and visibility controller stay shared. */
|
|
27
27
|
export const SharingEnvironmentContext = createContext<{
|
|
28
|
-
readonly getUrl: (
|
|
28
|
+
readonly getUrl: (branchId: string) => string;
|
|
29
29
|
readonly notice?: string;
|
|
30
|
-
}>({ getUrl: (
|
|
30
|
+
}>({ getUrl: (branchId) => `${globalThis.location.origin}/share/${branchId}` });
|
|
31
31
|
|
|
32
32
|
const ShareDialogView = ({
|
|
33
|
-
|
|
33
|
+
branchId,
|
|
34
34
|
isPublic,
|
|
35
35
|
isPending,
|
|
36
36
|
onClose,
|
|
37
37
|
setVisibility,
|
|
38
38
|
}: {
|
|
39
|
-
readonly
|
|
39
|
+
readonly branchId: string;
|
|
40
40
|
readonly isPublic: boolean;
|
|
41
41
|
readonly isPending: boolean;
|
|
42
42
|
readonly onClose: () => void;
|
|
@@ -67,7 +67,7 @@ const ShareDialogView = ({
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
const handleCopyLink = async (): Promise<void> => {
|
|
70
|
-
const shareUrl = environment.getUrl(
|
|
70
|
+
const shareUrl = environment.getUrl(branchId);
|
|
71
71
|
try {
|
|
72
72
|
await navigator.clipboard.writeText(shareUrl);
|
|
73
73
|
toast.success("Share link copied to clipboard");
|
|
@@ -192,7 +192,7 @@ const ShareDialogView = ({
|
|
|
192
192
|
</label>
|
|
193
193
|
<input
|
|
194
194
|
className="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50"
|
|
195
|
-
value={environment.getUrl(
|
|
195
|
+
value={environment.getUrl(branchId)}
|
|
196
196
|
id="link"
|
|
197
197
|
readOnly
|
|
198
198
|
/>
|
|
@@ -11,27 +11,27 @@ import {
|
|
|
11
11
|
import { useTRPC } from "@/trpc/react";
|
|
12
12
|
|
|
13
13
|
const EveShareDialogContent = ({
|
|
14
|
-
|
|
14
|
+
branchId,
|
|
15
15
|
onClose,
|
|
16
16
|
}: {
|
|
17
|
-
readonly
|
|
17
|
+
readonly branchId: string;
|
|
18
18
|
readonly onClose: () => void;
|
|
19
19
|
}): ReactJSX.Element => {
|
|
20
20
|
const trpc = useTRPC();
|
|
21
21
|
const cache = useQueryClient();
|
|
22
|
-
const query = useQuery(trpc.sharing.get.queryOptions({ id:
|
|
22
|
+
const query = useQuery(trpc.sharing.get.queryOptions({ id: branchId }));
|
|
23
23
|
const mutation = useMutation(trpc.sharing.setVisibility.mutationOptions());
|
|
24
24
|
return (
|
|
25
25
|
<>
|
|
26
26
|
<ShareDialogView
|
|
27
|
-
|
|
27
|
+
branchId={branchId}
|
|
28
28
|
isPending={query.isPending || mutation.isPending || query.isError}
|
|
29
29
|
isPublic={query.data?.visibility === "public"}
|
|
30
30
|
onClose={onClose}
|
|
31
31
|
setVisibility={async (visibility) => {
|
|
32
|
-
await mutation.mutateAsync({ id:
|
|
32
|
+
await mutation.mutateAsync({ id: branchId, visibility });
|
|
33
33
|
await cache.invalidateQueries({
|
|
34
|
-
queryKey: trpc.sharing.get.queryKey({ id:
|
|
34
|
+
queryKey: trpc.sharing.get.queryKey({ id: branchId }),
|
|
35
35
|
});
|
|
36
36
|
}}
|
|
37
37
|
/>
|
|
@@ -41,16 +41,16 @@ const EveShareDialogContent = ({
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const EveShareButton = ({
|
|
44
|
-
|
|
44
|
+
branchId,
|
|
45
45
|
className,
|
|
46
46
|
}: {
|
|
47
|
-
readonly
|
|
47
|
+
readonly branchId: string;
|
|
48
48
|
readonly className?: string;
|
|
49
49
|
}): React.JSX.Element => (
|
|
50
50
|
<ShareButton
|
|
51
51
|
className={className}
|
|
52
52
|
renderContent={(onClose): React.JSX.Element => (
|
|
53
|
-
<EveShareDialogContent
|
|
53
|
+
<EveShareDialogContent branchId={branchId} onClose={onClose} />
|
|
54
54
|
)}
|
|
55
55
|
/>
|
|
56
56
|
);
|
package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts}
RENAMED
|
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
|
|
|
3
3
|
import { ArtifactViewerActions } from "@/components/artifact-actions";
|
|
4
4
|
import { SpreadsheetViewerAction } from "./viewer-action";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const chatUi = definePlugin({
|
|
7
7
|
id: "spreadsheet-viewer",
|
|
8
8
|
slots: [slot(ArtifactViewerActions, SpreadsheetViewerAction)],
|
|
9
9
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractVersion": 3,
|
|
3
|
+
"uiBase": "base",
|
|
4
|
+
"id": "spreadsheet-viewer",
|
|
5
|
+
"kind": "plugin",
|
|
6
|
+
"files": [
|
|
7
|
+
"chatjs/plugins/spreadsheet-viewer/chat-ui.ts",
|
|
8
|
+
"chatjs/plugins/spreadsheet-viewer/viewer-action.tsx",
|
|
9
|
+
"chatjs/plugins/spreadsheet-viewer/load.ts",
|
|
10
|
+
"chatjs/plugins/spreadsheet-viewer/preview.tsx"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
|
|
|
3
3
|
import { ArtifactViewerActions } from "@/components/artifact-actions";
|
|
4
4
|
import { VideoViewerAction } from "./viewer-action";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const chatUi = definePlugin({
|
|
7
7
|
id: "video-viewer",
|
|
8
8
|
slots: [slot(ArtifactViewerActions, VideoViewerAction)],
|
|
9
9
|
});
|
|
@@ -40,14 +40,14 @@ export const import_file = defineTool({
|
|
|
40
40
|
"File import requires the current ChatJS conversation owner's authority."
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
const { ownerId,
|
|
43
|
+
const { ownerId, branchId } = await resolveEveConversationScope(
|
|
44
44
|
current.principalId,
|
|
45
45
|
context.session.id,
|
|
46
46
|
context.abortSignal
|
|
47
47
|
);
|
|
48
48
|
return await withEveConversationFile(
|
|
49
49
|
ownerId,
|
|
50
|
-
|
|
50
|
+
branchId,
|
|
51
51
|
input.fileId,
|
|
52
52
|
async () =>
|
|
53
53
|
await importStoredFile(input, {
|
|
@@ -70,13 +70,31 @@ const ComposerAction = ({
|
|
|
70
70
|
);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
const composerActionStatus = (
|
|
74
|
+
status: ChatStatus,
|
|
75
|
+
allowFollowUp: boolean | undefined,
|
|
76
|
+
hasDraft: boolean
|
|
77
|
+
): ChatStatus =>
|
|
78
|
+
status === "streaming" && allowFollowUp === true && hasDraft
|
|
79
|
+
? "ready"
|
|
80
|
+
: status;
|
|
81
|
+
|
|
82
|
+
const canSubmitDraft = (
|
|
83
|
+
status: ChatStatus,
|
|
84
|
+
hasDraft: boolean,
|
|
85
|
+
draftLength: number
|
|
86
|
+
): boolean =>
|
|
87
|
+
(status === "ready" || status === "error") &&
|
|
88
|
+
hasDraft &&
|
|
89
|
+
draftLength <= MAX_DRAFT_LENGTH;
|
|
90
|
+
|
|
73
91
|
/**
|
|
74
92
|
* A controlled composer for runtimes that own their own submission lifecycle.
|
|
75
93
|
*
|
|
76
94
|
* @param {string} draft Current text controlled by the runtime.
|
|
77
95
|
* @param {(draft: string) => void} onDraftChange Writes text changes back to the runtime.
|
|
78
96
|
* @param {() => void} onSubmit Submits the current draft.
|
|
79
|
-
* @param {boolean} disabled Disables
|
|
97
|
+
* @param {boolean} disabled Disables submission.
|
|
80
98
|
* @param {ChatStatus | undefined} status Runtime-owned status value.
|
|
81
99
|
* @param {(() => void) | undefined} onStop Cancels the active submission.
|
|
82
100
|
* @param {boolean | undefined} stopDisabled Runtime-owned stopDisabled value.
|
|
@@ -85,6 +103,8 @@ const ComposerAction = ({
|
|
|
85
103
|
* @param {ReadonlyReactNode | undefined} attachments Current attached files.
|
|
86
104
|
* @param {boolean | undefined} hasAttachments Runtime-owned hasAttachments value.
|
|
87
105
|
* @param {boolean | undefined} readOnly Runtime-owned readOnly value.
|
|
106
|
+
* @param {boolean | undefined} allowDraftWhileBusy Allows typing during a submission without a Stop action.
|
|
107
|
+
* @param {boolean | undefined} allowSendWhileStreaming Switches Stop to Send when the draft contains text or files.
|
|
88
108
|
* @param {ComponentProps<typeof LexicalChatInput>["onPaste"] | undefined} onPaste Runtime-owned onPaste value.
|
|
89
109
|
* @returns {React.JSX.Element} The composed message interface.
|
|
90
110
|
*/
|
|
@@ -101,6 +121,8 @@ export const ChatComposer = ({
|
|
|
101
121
|
attachments,
|
|
102
122
|
hasAttachments = false,
|
|
103
123
|
readOnly = false,
|
|
124
|
+
allowDraftWhileBusy = false,
|
|
125
|
+
allowSendWhileStreaming,
|
|
104
126
|
onPaste,
|
|
105
127
|
primitives = defaultPrimitives,
|
|
106
128
|
sendIcon,
|
|
@@ -110,6 +132,8 @@ export const ChatComposer = ({
|
|
|
110
132
|
readonly attachments?: ReadonlyReactNode;
|
|
111
133
|
readonly hasAttachments?: boolean;
|
|
112
134
|
readonly readOnly?: boolean;
|
|
135
|
+
readonly allowDraftWhileBusy?: boolean;
|
|
136
|
+
readonly allowSendWhileStreaming?: boolean;
|
|
113
137
|
readonly onPaste?: ComponentProps<typeof LexicalChatInput>["onPaste"];
|
|
114
138
|
readonly draft: string;
|
|
115
139
|
readonly onDraftChange: (draft: string) => void;
|
|
@@ -123,13 +147,17 @@ export const ChatComposer = ({
|
|
|
123
147
|
}): ReactJSX.Element => {
|
|
124
148
|
const isMobile = useIsMobile();
|
|
125
149
|
const busy = status === "submitted" || status === "streaming";
|
|
126
|
-
const
|
|
150
|
+
const hasDraft = Boolean(draft.trim()) || hasAttachments;
|
|
151
|
+
const actionStatus = composerActionStatus(
|
|
152
|
+
status,
|
|
153
|
+
allowSendWhileStreaming,
|
|
154
|
+
hasDraft
|
|
155
|
+
);
|
|
156
|
+
const editorReadOnly = readOnly || (busy && !onStop && !allowDraftWhileBusy);
|
|
127
157
|
const canSend =
|
|
128
158
|
!disabled &&
|
|
129
159
|
!editorReadOnly &&
|
|
130
|
-
|
|
131
|
-
(Boolean(draft.trim()) || hasAttachments) &&
|
|
132
|
-
draft.length <= MAX_DRAFT_LENGTH;
|
|
160
|
+
canSubmitDraft(actionStatus, hasDraft, draft.length);
|
|
133
161
|
const submit = (): void => {
|
|
134
162
|
if (canSend) {
|
|
135
163
|
onSubmit();
|
|
@@ -138,7 +166,7 @@ export const ChatComposer = ({
|
|
|
138
166
|
return (
|
|
139
167
|
<PromptForm
|
|
140
168
|
primitives={primitives}
|
|
141
|
-
editable={!
|
|
169
|
+
editable={!editorReadOnly}
|
|
142
170
|
onSubmit={(event) => {
|
|
143
171
|
event.preventDefault();
|
|
144
172
|
submit();
|
|
@@ -149,7 +177,7 @@ export const ChatComposer = ({
|
|
|
149
177
|
<ComposerAction
|
|
150
178
|
primitives={primitives}
|
|
151
179
|
sendIcon={sendIcon}
|
|
152
|
-
status={status}
|
|
180
|
+
status={canSend ? actionStatus : status}
|
|
153
181
|
onStop={onStop}
|
|
154
182
|
stopDisabled={stopDisabled}
|
|
155
183
|
canSend={canSend}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
/** One transcript and placement contract. Runtime-owned recovery and composer
|
|
21
21
|
* controllers occupy fixed slots; callers cannot replace message rendering. */
|
|
22
22
|
export const ChatConversationScreen = ({
|
|
23
|
-
|
|
23
|
+
branchId,
|
|
24
24
|
welcome = false,
|
|
25
25
|
header,
|
|
26
26
|
transcript,
|
|
@@ -30,7 +30,7 @@ export const ChatConversationScreen = ({
|
|
|
30
30
|
leading,
|
|
31
31
|
trailing,
|
|
32
32
|
}: {
|
|
33
|
-
readonly
|
|
33
|
+
readonly branchId: string;
|
|
34
34
|
readonly welcome?: boolean;
|
|
35
35
|
readonly header?: ReactNode;
|
|
36
36
|
readonly transcript: ComponentProps<typeof ChatTranscript>;
|
|
@@ -49,7 +49,7 @@ export const ChatConversationScreen = ({
|
|
|
49
49
|
</ChatWelcomeView>
|
|
50
50
|
) : (
|
|
51
51
|
<ChatConversationBody>
|
|
52
|
-
<MessageScrollerProvider autoScroll key={
|
|
52
|
+
<MessageScrollerProvider autoScroll key={branchId}>
|
|
53
53
|
<MessageScroller className="flex-1">
|
|
54
54
|
<MessageScrollerViewport preserveScrollOnPrepend>
|
|
55
55
|
<MessageScrollerContent className="mx-auto w-full max-w-3xl p-4">
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { useParams } from "next/navigation";
|
|
3
4
|
import { createContext, useContext } from "react";
|
|
4
5
|
|
|
5
6
|
/** Embed the application without replacing its links or navigation controls. */
|
|
6
7
|
export const ChatNavigationContext = createContext<{
|
|
7
|
-
readonly
|
|
8
|
+
readonly chatId: string | null;
|
|
8
9
|
readonly navigate: (href: string) => void;
|
|
9
10
|
} | null>(null);
|
|
10
11
|
|
|
11
12
|
export const useChatNavigation = () => useContext(ChatNavigationContext);
|
|
13
|
+
|
|
14
|
+
export const useActiveChatId = (): string | null => {
|
|
15
|
+
const embedded = useChatNavigation();
|
|
16
|
+
const params = useParams();
|
|
17
|
+
if (embedded) {
|
|
18
|
+
return embedded.chatId;
|
|
19
|
+
}
|
|
20
|
+
return typeof params?.chatId === "string" ? params.chatId : null;
|
|
21
|
+
};
|
|
@@ -78,7 +78,7 @@ export const ChatSidebar = ({
|
|
|
78
78
|
ownerId,
|
|
79
79
|
history,
|
|
80
80
|
account,
|
|
81
|
-
|
|
81
|
+
chatId,
|
|
82
82
|
onProjectSelect,
|
|
83
83
|
onChatSelect,
|
|
84
84
|
}: {
|
|
@@ -87,7 +87,7 @@ export const ChatSidebar = ({
|
|
|
87
87
|
readonly history: SidebarData | Promise<SidebarData>;
|
|
88
88
|
readonly account: ComponentProps<typeof ChatAccount>;
|
|
89
89
|
readonly onChatSelect?: (id: string) => void;
|
|
90
|
-
readonly
|
|
90
|
+
readonly chatId?: string;
|
|
91
91
|
readonly onProjectSelect?: (id: string) => void;
|
|
92
92
|
}) => (
|
|
93
93
|
<Sidebar
|
|
@@ -117,10 +117,7 @@ export const ChatSidebar = ({
|
|
|
117
117
|
<SidebarSeparator />
|
|
118
118
|
<ScrollArea className="relative flex-1 overflow-y-auto">
|
|
119
119
|
<SidebarContent className="max-w-(--sidebar-width) pr-2 group-data-[collapsible=icon]:hidden">
|
|
120
|
-
<SidebarSections
|
|
121
|
-
conversationId={conversationId}
|
|
122
|
-
onProjectSelect={onProjectSelect}
|
|
123
|
-
/>
|
|
120
|
+
<SidebarSections chatId={chatId} onProjectSelect={onProjectSelect} />
|
|
124
121
|
<Suspense fallback={<HistorySkeleton />}>
|
|
125
122
|
<History data={history} />
|
|
126
123
|
</Suspense>
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { hasText } from "@/components/text-value";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { interactions } from "eve/events";
|
|
6
|
+
import type { Answer, Interaction, SessionView } from "eve/events";
|
|
7
|
+
import React, { useMemo } from "react";
|
|
7
8
|
import type { JSX as ReactJSX, ReactNode } from "react";
|
|
8
9
|
import { toast } from "sonner";
|
|
9
10
|
|
|
@@ -21,7 +22,7 @@ import type {
|
|
|
21
22
|
import type { ReadonlyReactNode } from "@/lib/readonly-react-node";
|
|
22
23
|
|
|
23
24
|
import { EveAttachment } from "../eve/eve-attachment";
|
|
24
|
-
import {
|
|
25
|
+
import { EveMessageContent } from "../eve/eve-message-content";
|
|
25
26
|
import { MessageActions } from "@/components/chat-slots";
|
|
26
27
|
|
|
27
28
|
const messagePartIdentity = (part: ReadonlyEveMessagePart): string => {
|
|
@@ -50,7 +51,7 @@ const messagePartIdentity = (part: ReadonlyEveMessagePart): string => {
|
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
interface ChatTranscriptProps {
|
|
53
|
-
readonly
|
|
54
|
+
readonly branchId?: string;
|
|
54
55
|
readonly messageKey?: (message: ReadonlyEveMessage) => string;
|
|
55
56
|
readonly messages: readonly ReadonlyEveMessage[];
|
|
56
57
|
readonly isReadonly: boolean;
|
|
@@ -77,6 +78,7 @@ interface ChatTranscriptProps {
|
|
|
77
78
|
) => string | undefined;
|
|
78
79
|
readonly disabled: boolean;
|
|
79
80
|
readonly inputDisabled?: boolean;
|
|
81
|
+
readonly view?: SessionView;
|
|
80
82
|
readonly respond: (response: Answer) => void;
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -88,12 +90,13 @@ interface MessageRowProps extends Omit<
|
|
|
88
90
|
readonly userMessage: ReadonlyEveMessage | undefined;
|
|
89
91
|
readonly isLast: boolean;
|
|
90
92
|
readonly actionsDisabled: boolean;
|
|
93
|
+
readonly interactionsByCall: ReadonlyMap<string, readonly Interaction[]>;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
const AssistantFeedback = ({
|
|
94
97
|
message,
|
|
95
98
|
userMessage,
|
|
96
|
-
|
|
99
|
+
branchId,
|
|
97
100
|
disabled,
|
|
98
101
|
actionsDisabled,
|
|
99
102
|
editor,
|
|
@@ -103,16 +106,16 @@ const AssistantFeedback = ({
|
|
|
103
106
|
MessageRowProps,
|
|
104
107
|
| "message"
|
|
105
108
|
| "userMessage"
|
|
106
|
-
| "
|
|
109
|
+
| "branchId"
|
|
107
110
|
| "disabled"
|
|
108
111
|
| "actionsDisabled"
|
|
109
112
|
| "editor"
|
|
110
113
|
| "onRegenerate"
|
|
111
114
|
> & { readonly modelId: string | undefined }): ReactJSX.Element => (
|
|
112
115
|
<>
|
|
113
|
-
{hasText(
|
|
116
|
+
{hasText(branchId) && (
|
|
114
117
|
<MessageActions
|
|
115
|
-
|
|
118
|
+
branchId={branchId}
|
|
116
119
|
disabled={disabled}
|
|
117
120
|
messageId={message.id}
|
|
118
121
|
/>
|
|
@@ -146,7 +149,7 @@ const AssistantFeedback = ({
|
|
|
146
149
|
const EveMessageActions = ({
|
|
147
150
|
message,
|
|
148
151
|
userMessage,
|
|
149
|
-
|
|
152
|
+
branchId,
|
|
150
153
|
isReadonly,
|
|
151
154
|
disabled,
|
|
152
155
|
actionsDisabled,
|
|
@@ -161,7 +164,7 @@ const EveMessageActions = ({
|
|
|
161
164
|
MessageRowProps,
|
|
162
165
|
| "message"
|
|
163
166
|
| "userMessage"
|
|
164
|
-
| "
|
|
167
|
+
| "branchId"
|
|
165
168
|
| "isReadonly"
|
|
166
169
|
| "disabled"
|
|
167
170
|
| "actionsDisabled"
|
|
@@ -214,7 +217,7 @@ const EveMessageActions = ({
|
|
|
214
217
|
<AssistantFeedback
|
|
215
218
|
message={message}
|
|
216
219
|
userMessage={userMessage}
|
|
217
|
-
|
|
220
|
+
branchId={branchId}
|
|
218
221
|
disabled={disabled}
|
|
219
222
|
actionsDisabled={actionsDisabled}
|
|
220
223
|
editor={editor}
|
|
@@ -237,11 +240,13 @@ const EveMessageRow = ({
|
|
|
237
240
|
message,
|
|
238
241
|
userMessage,
|
|
239
242
|
isLast,
|
|
240
|
-
|
|
243
|
+
branchId,
|
|
241
244
|
isReadonly,
|
|
242
245
|
disabled,
|
|
243
246
|
actionsDisabled,
|
|
244
247
|
inputDisabled,
|
|
248
|
+
view,
|
|
249
|
+
interactionsByCall,
|
|
245
250
|
respond,
|
|
246
251
|
onEdit,
|
|
247
252
|
onRegenerate,
|
|
@@ -274,7 +279,7 @@ const EveMessageRow = ({
|
|
|
274
279
|
<EveMessageActions
|
|
275
280
|
message={message}
|
|
276
281
|
userMessage={userMessage}
|
|
277
|
-
|
|
282
|
+
branchId={branchId}
|
|
278
283
|
isReadonly={isReadonly}
|
|
279
284
|
disabled={disabled}
|
|
280
285
|
actionsDisabled={actionsDisabled}
|
|
@@ -319,16 +324,15 @@ const EveMessageRow = ({
|
|
|
319
324
|
actions={actions}
|
|
320
325
|
followUp={isLast && !isReadonly && !actionsDisabled && suggestions}
|
|
321
326
|
>
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
))}
|
|
327
|
+
<EveMessageContent
|
|
328
|
+
inputDisabled={responseDisabled(isReadonly, disabled, inputDisabled)}
|
|
329
|
+
interactionsByCall={interactionsByCall}
|
|
330
|
+
isReadonly={isReadonly}
|
|
331
|
+
messageId={message.id}
|
|
332
|
+
parts={message.parts.map((part) => ({ key: nextPartKey(part), part }))}
|
|
333
|
+
respond={respond}
|
|
334
|
+
view={view}
|
|
335
|
+
/>
|
|
332
336
|
</ChatMessageView>
|
|
333
337
|
);
|
|
334
338
|
};
|
|
@@ -339,8 +343,31 @@ export const ChatTranscript = ({
|
|
|
339
343
|
messageKey,
|
|
340
344
|
disabled,
|
|
341
345
|
actionsDisabled = disabled,
|
|
346
|
+
view,
|
|
342
347
|
...props
|
|
343
348
|
}: ChatTranscriptProps): ReactJSX.Element[] => {
|
|
349
|
+
const interactionsByCall = useMemo(() => {
|
|
350
|
+
const byCall = new Map<string, Interaction[]>();
|
|
351
|
+
if (view !== undefined) {
|
|
352
|
+
for (const interaction of interactions(view)) {
|
|
353
|
+
const callId = interaction.call?.callId;
|
|
354
|
+
const { kind } = interaction.request;
|
|
355
|
+
if (
|
|
356
|
+
callId === undefined ||
|
|
357
|
+
(kind !== "question" && kind !== "approval")
|
|
358
|
+
) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const entries = byCall.get(callId);
|
|
362
|
+
if (entries) {
|
|
363
|
+
entries.push(interaction);
|
|
364
|
+
} else {
|
|
365
|
+
byCall.set(callId, [interaction]);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return byCall;
|
|
370
|
+
}, [view]);
|
|
344
371
|
const precedingUsers: (ReadonlyEveMessage | undefined)[] = [];
|
|
345
372
|
let precedingUser: ReadonlyEveMessage | undefined;
|
|
346
373
|
for (const message of messages) {
|
|
@@ -362,6 +389,8 @@ export const ChatTranscript = ({
|
|
|
362
389
|
isLast={message.id === messages.at(-1)?.id}
|
|
363
390
|
disabled={disabled}
|
|
364
391
|
actionsDisabled={actionsDisabled}
|
|
392
|
+
interactionsByCall={interactionsByCall}
|
|
393
|
+
view={view}
|
|
365
394
|
/>
|
|
366
395
|
</MessageScrollerItem>
|
|
367
396
|
));
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
import type { ComposerControlProps } from "@/components/composer/control";
|
|
9
9
|
|
|
10
10
|
export const SidebarSections = defineSlot<{
|
|
11
|
-
readonly
|
|
11
|
+
readonly chatId?: string;
|
|
12
12
|
readonly allowManagement?: boolean;
|
|
13
13
|
readonly onProjectSelect?: (id: string) => void;
|
|
14
14
|
}>();
|
|
@@ -27,7 +27,7 @@ import { getToolDisplay } from "./tool-display";
|
|
|
27
27
|
import { useIsMobile } from "@/hooks/use-mobile";
|
|
28
28
|
|
|
29
29
|
export const ComposerMenu = (
|
|
30
|
-
props: ComposerControlProps
|
|
30
|
+
props: ComposerControlProps & { readonly toolsDisabled?: boolean }
|
|
31
31
|
): ReactJSX.Element | null => {
|
|
32
32
|
const mobile = useIsMobile();
|
|
33
33
|
const available = useAvailableTools();
|
|
@@ -43,6 +43,7 @@ export const ComposerMenu = (
|
|
|
43
43
|
}) => Component.isAvailable?.(mobile, available) ?? true
|
|
44
44
|
);
|
|
45
45
|
const hasControls = controls.length > 0 || hasAttachments || hasExtensions;
|
|
46
|
+
const toolsDisabled = props.disabled === true || props.toolsDisabled === true;
|
|
46
47
|
if (!hasControls && props.selectedTool === null) {
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
@@ -68,15 +69,15 @@ export const ComposerMenu = (
|
|
|
68
69
|
}: Readonly<Pick<(typeof composerControls)[number], "id">> & {
|
|
69
70
|
readonly Component: React.JSXElementConstructor<ComposerControlProps>;
|
|
70
71
|
}): React.JSX.Element => (
|
|
71
|
-
<Component key={id} {...props} />
|
|
72
|
+
<Component key={id} {...props} disabled={toolsDisabled} />
|
|
72
73
|
)
|
|
73
74
|
)}
|
|
74
|
-
<ComposerExtensions {...props} />
|
|
75
|
+
<ComposerExtensions {...props} disabled={toolsDisabled} />
|
|
75
76
|
{props.selectedTool !== null && (
|
|
76
77
|
<>
|
|
77
78
|
{hasControls && <DropdownMenuSeparator />}
|
|
78
79
|
<DropdownMenuItem
|
|
79
|
-
disabled={
|
|
80
|
+
disabled={toolsDisabled}
|
|
80
81
|
onClick={() => {
|
|
81
82
|
props.onToolChange(null);
|
|
82
83
|
}}
|
|
@@ -33,12 +33,12 @@ import { useEveMetadataMutations } from "./use-eve-metadata-mutations";
|
|
|
33
33
|
|
|
34
34
|
const EveChatHeader = ({
|
|
35
35
|
chatId,
|
|
36
|
-
|
|
36
|
+
branchId,
|
|
37
37
|
fallbackTitle,
|
|
38
38
|
hasMessages,
|
|
39
39
|
}: {
|
|
40
40
|
readonly chatId: string;
|
|
41
|
-
readonly
|
|
41
|
+
readonly branchId: string;
|
|
42
42
|
readonly fallbackTitle: string;
|
|
43
43
|
readonly hasMessages: boolean;
|
|
44
44
|
}): ReactJSX.Element => {
|
|
@@ -70,7 +70,7 @@ const EveChatHeader = ({
|
|
|
70
70
|
actions={
|
|
71
71
|
hasMessages && (
|
|
72
72
|
<ChatHeaderActions
|
|
73
|
-
chat={{ id: chatId, title,
|
|
73
|
+
chat={{ id: chatId, title, branchId, state: "bound" }}
|
|
74
74
|
/>
|
|
75
75
|
)
|
|
76
76
|
}
|
|
@@ -100,9 +100,7 @@ const EveChatHeader = ({
|
|
|
100
100
|
chat={{
|
|
101
101
|
id: chatId,
|
|
102
102
|
title,
|
|
103
|
-
|
|
104
|
-
? conversationId
|
|
105
|
-
: undefined,
|
|
103
|
+
branchId: hasMessages ? branchId : undefined,
|
|
106
104
|
state: "bound",
|
|
107
105
|
}}
|
|
108
106
|
/>
|
|
@@ -119,7 +117,7 @@ const EveChatHeader = ({
|
|
|
119
117
|
}}
|
|
120
118
|
onDelete={() => {
|
|
121
119
|
openDeletion({
|
|
122
|
-
id:
|
|
120
|
+
id: branchId,
|
|
123
121
|
scope: "conversation",
|
|
124
122
|
parentHref: identity.data?.parentHref,
|
|
125
123
|
state: "bound",
|
|
@@ -18,8 +18,8 @@ import { NewEveConversation } from "./new-eve-conversation";
|
|
|
18
18
|
const creationRecoveryScope = (
|
|
19
19
|
selected: Awaited<ReturnType<typeof getEveChatPageConversation>> | undefined
|
|
20
20
|
): CreationScope | undefined => {
|
|
21
|
-
if (hasText(selected?.
|
|
22
|
-
return {
|
|
21
|
+
if (hasText(selected?.parentBranchId)) {
|
|
22
|
+
return { branchId: selected.parentBranchId };
|
|
23
23
|
}
|
|
24
24
|
const context = projectCreationScope(selected?.initialRequest);
|
|
25
25
|
if (context) {
|
|
@@ -29,13 +29,13 @@ const creationRecoveryScope = (
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export const EveChatPage = async ({
|
|
32
|
-
|
|
32
|
+
chatId,
|
|
33
33
|
}: {
|
|
34
|
-
readonly
|
|
34
|
+
readonly chatId?: string;
|
|
35
35
|
}): Promise<ReactJSX.Element> => {
|
|
36
36
|
const principal = await resolveEvePrincipal(await headers());
|
|
37
37
|
if (!principal) {
|
|
38
|
-
if (hasText(
|
|
38
|
+
if (hasText(chatId)) {
|
|
39
39
|
redirect("/");
|
|
40
40
|
}
|
|
41
41
|
if (!SignedOutScreen) {
|
|
@@ -43,13 +43,13 @@ export const EveChatPage = async ({
|
|
|
43
43
|
}
|
|
44
44
|
return <SignedOutScreen />;
|
|
45
45
|
}
|
|
46
|
-
if (hasText(
|
|
46
|
+
if (hasText(chatId) && !z.uuid().safeParse(chatId).success) {
|
|
47
47
|
notFound();
|
|
48
48
|
}
|
|
49
|
-
const selected = hasText(
|
|
50
|
-
? await getEveChatPageConversation(principal.ownerId,
|
|
49
|
+
const selected = hasText(chatId)
|
|
50
|
+
? await getEveChatPageConversation(principal.ownerId, chatId)
|
|
51
51
|
: undefined;
|
|
52
|
-
if (hasText(
|
|
52
|
+
if (hasText(chatId) && !selected) {
|
|
53
53
|
notFound();
|
|
54
54
|
}
|
|
55
55
|
const recoveryScope = creationRecoveryScope(selected);
|