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
|
@@ -57,6 +57,8 @@ interface ComposerCapabilities {
|
|
|
57
57
|
};
|
|
58
58
|
readonly selectedTool: UiToolName | null;
|
|
59
59
|
readonly onToolChange: Dispatch<SetStateAction<UiToolName | null>>;
|
|
60
|
+
readonly turnOptionsLocked?: boolean;
|
|
61
|
+
readonly attachmentModelPending?: boolean;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
type ComposerProps = Omit<
|
|
@@ -75,6 +77,8 @@ const CapableComposer = ({
|
|
|
75
77
|
modelPicker,
|
|
76
78
|
selectedTool,
|
|
77
79
|
onToolChange,
|
|
80
|
+
turnOptionsLocked,
|
|
81
|
+
attachmentModelPending,
|
|
78
82
|
...props
|
|
79
83
|
}: ComposerProps & ComposerCapabilities): ReactJSX.Element => {
|
|
80
84
|
const selected = useDefaultModel();
|
|
@@ -84,11 +88,15 @@ const CapableComposer = ({
|
|
|
84
88
|
);
|
|
85
89
|
const unsupported =
|
|
86
90
|
!(props.readOnly === true) &&
|
|
87
|
-
|
|
91
|
+
(attachmentModelPending === true
|
|
92
|
+
? files.attachments.length > 0
|
|
93
|
+
: unsupportedAttachments(models, files.attachments));
|
|
88
94
|
const available = useAvailableTools();
|
|
89
|
-
const unavailableTool =
|
|
95
|
+
const unavailableTool =
|
|
96
|
+
turnOptionsLocked !== true && isUnavailableTool(selectedTool, available);
|
|
90
97
|
const locked = props.disabled || files.uploadQueue.length > 0;
|
|
91
98
|
const uploadLocked = locked || props.readOnly;
|
|
99
|
+
const optionsLocked = uploadLocked === true || turnOptionsLocked === true;
|
|
92
100
|
const removeAttachment = (attachment: { readonly url: string }): void => {
|
|
93
101
|
files.setAttachments((current: readonly Readonly<DraftAttachment>[]) =>
|
|
94
102
|
current.filter((file) => file.url !== attachment.url)
|
|
@@ -125,6 +133,7 @@ const CapableComposer = ({
|
|
|
125
133
|
<>
|
|
126
134
|
<ComposerMenu
|
|
127
135
|
disabled={uploadLocked}
|
|
136
|
+
toolsDisabled={optionsLocked}
|
|
128
137
|
selectedModelId={models[0]?.id ?? ""}
|
|
129
138
|
selectedTool={selectedTool}
|
|
130
139
|
onToolChange={onToolChange}
|
|
@@ -132,12 +141,12 @@ const CapableComposer = ({
|
|
|
132
141
|
/>
|
|
133
142
|
<ActiveTool
|
|
134
143
|
selectedTool={selectedTool}
|
|
135
|
-
disabled={
|
|
144
|
+
disabled={optionsLocked}
|
|
136
145
|
onClear={() => {
|
|
137
146
|
onToolChange(null);
|
|
138
147
|
}}
|
|
139
148
|
/>
|
|
140
|
-
<fieldset className="min-w-0" disabled={
|
|
149
|
+
<fieldset className="min-w-0" disabled={optionsLocked}>
|
|
141
150
|
{modelPicker ?? <EveModelPicker />}
|
|
142
151
|
</fieldset>
|
|
143
152
|
</>
|
|
@@ -151,7 +160,9 @@ const CapableComposer = ({
|
|
|
151
160
|
)}
|
|
152
161
|
{unsupported && (
|
|
153
162
|
<p className="text-destructive text-sm" role="alert">
|
|
154
|
-
|
|
163
|
+
{attachmentModelPending === true
|
|
164
|
+
? "Wait for the active model before sending attachments."
|
|
165
|
+
: "The selected model does not support all attached files."}
|
|
155
166
|
</p>
|
|
156
167
|
)}
|
|
157
168
|
</div>
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import { SessionNotActiveError } from "eve/client";
|
|
3
|
+
import {
|
|
4
|
+
activeTurn,
|
|
5
|
+
failure,
|
|
6
|
+
openInteractions,
|
|
7
|
+
session,
|
|
8
|
+
turn,
|
|
9
|
+
turns,
|
|
10
|
+
} from "eve/events";
|
|
11
|
+
import type { Answer, SessionView } from "eve/events";
|
|
3
12
|
|
|
4
13
|
import { useEveDeliveryReceipt } from "./use-eve-delivery-receipt";
|
|
5
14
|
|
|
@@ -26,12 +35,19 @@ import { isEveAdmissionBusy } from "@/lib/eve/admission-retry";
|
|
|
26
35
|
import { isEveCommandRejection } from "@/lib/eve/command-rejection";
|
|
27
36
|
import type { DraftAttachment } from "@/lib/eve/draft";
|
|
28
37
|
import { draftMessage, restoreDraft } from "@/lib/eve/draft";
|
|
29
|
-
import type {
|
|
38
|
+
import type {
|
|
39
|
+
LogicalChat,
|
|
40
|
+
LogicalChatSnapshot,
|
|
41
|
+
NativeChatAgent,
|
|
42
|
+
} from "@/lib/eve/logical-chat";
|
|
30
43
|
import { logicalResponseSlots } from "@/lib/eve/logical-response-slots";
|
|
31
44
|
import type { ActivePendingEveMessage } from "@/lib/eve/message-delivery";
|
|
32
45
|
import { EVE_MESSAGE_OPERATION_HEADER } from "@/lib/eve/message-delivery";
|
|
33
46
|
import type { ReadonlyEveMessage } from "@/lib/eve/readonly-message-types";
|
|
34
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
activeResponseModel,
|
|
49
|
+
responseModelReferences,
|
|
50
|
+
} from "@/lib/eve/response-model";
|
|
35
51
|
import { sendCommand } from "@/lib/eve/send-command";
|
|
36
52
|
import {
|
|
37
53
|
useDefaultModel,
|
|
@@ -56,27 +72,50 @@ import { useEveFork } from "./use-eve-fork";
|
|
|
56
72
|
import { useEveMessageDelivery } from "./use-eve-message-delivery";
|
|
57
73
|
import { useLogicalCommands } from "./use-logical-commands";
|
|
58
74
|
|
|
59
|
-
const settledError = (
|
|
60
|
-
event: SessionStreamEvent | undefined
|
|
61
|
-
): string | undefined => {
|
|
62
|
-
if (event?.type !== "turn.settled") {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
return event.data.error?.message;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
75
|
const composerStatus = (
|
|
69
|
-
status: string
|
|
76
|
+
status: string,
|
|
77
|
+
turnOpen = false
|
|
70
78
|
): "submitted" | "streaming" | "ready" => {
|
|
71
79
|
if (status === "resuming") {
|
|
72
80
|
return "submitted";
|
|
73
81
|
}
|
|
74
|
-
if (status === "busy") {
|
|
82
|
+
if (status === "busy" || turnOpen) {
|
|
75
83
|
return "streaming";
|
|
76
84
|
}
|
|
77
85
|
return "ready";
|
|
78
86
|
};
|
|
79
87
|
|
|
88
|
+
const recordedError = (view: SessionView): string | undefined => {
|
|
89
|
+
const latestTurn = turns(view).at(-1);
|
|
90
|
+
return latestTurn?.status === "running"
|
|
91
|
+
? undefined
|
|
92
|
+
: failure(view, latestTurn?.turnId)?.message;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const isInactive = (error: Error | undefined): boolean =>
|
|
96
|
+
SessionNotActiveError.is(error) && error.code === "session_not_active";
|
|
97
|
+
|
|
98
|
+
const interactionControls = (
|
|
99
|
+
agent: Pick<NativeChatAgent, "view" | "error" | "status">,
|
|
100
|
+
commandFailure: Error | undefined,
|
|
101
|
+
cancelPending: boolean
|
|
102
|
+
) => {
|
|
103
|
+
const { view, status, error } = agent;
|
|
104
|
+
const sessionEnded =
|
|
105
|
+
session(view).status === "ended" ||
|
|
106
|
+
isInactive(error) ||
|
|
107
|
+
isInactive(commandFailure);
|
|
108
|
+
return {
|
|
109
|
+
turnOpen: !sessionEnded && activeTurn(view) !== undefined,
|
|
110
|
+
hasApproval:
|
|
111
|
+
!sessionEnded &&
|
|
112
|
+
openInteractions(view).some(
|
|
113
|
+
({ turnId }) => turn(view, turnId)?.outcome !== "cancelled"
|
|
114
|
+
),
|
|
115
|
+
inputDisabled: status === "resuming" || cancelPending || sessionEnded,
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
80
119
|
const sameComposerDraft = (
|
|
81
120
|
draft: {
|
|
82
121
|
readonly text: string;
|
|
@@ -95,20 +134,17 @@ const sameComposerDraft = (
|
|
|
95
134
|
|
|
96
135
|
const useConversationInput = (
|
|
97
136
|
ownerId: string,
|
|
98
|
-
|
|
137
|
+
branchId: string,
|
|
99
138
|
draftScopeId?: string
|
|
100
139
|
) => {
|
|
101
140
|
const changeModel = useModelChange();
|
|
102
141
|
const [selection, setSelection] = useState<SelectedModelValue>();
|
|
103
142
|
const selectedModel = useDefaultModel();
|
|
104
|
-
const composerDraft = useEveComposerDraft(
|
|
105
|
-
ownerId,
|
|
106
|
-
draftScopeId ?? conversationId
|
|
107
|
-
);
|
|
143
|
+
const composerDraft = useEveComposerDraft(ownerId, draftScopeId ?? branchId);
|
|
108
144
|
const files = useEveAttachments(composerDraft);
|
|
109
145
|
const fork = useEveFork(
|
|
110
146
|
ownerId,
|
|
111
|
-
|
|
147
|
+
branchId,
|
|
112
148
|
(message, selectedTool, clearComposer) => {
|
|
113
149
|
const sent = restoreDraft(message);
|
|
114
150
|
if (
|
|
@@ -147,9 +183,9 @@ const useConversationInput = (
|
|
|
147
183
|
const composerModelIds = (
|
|
148
184
|
selected: readonly string[],
|
|
149
185
|
retained: readonly string[] | undefined,
|
|
150
|
-
|
|
186
|
+
visibleModelId: string | undefined
|
|
151
187
|
): readonly string[] =>
|
|
152
|
-
|
|
188
|
+
hasText(visibleModelId) ? [visibleModelId] : (retained ?? selected);
|
|
153
189
|
|
|
154
190
|
const retainedToolSelection = (
|
|
155
191
|
comparison: { selectedTool?: UiToolName } | undefined,
|
|
@@ -185,11 +221,6 @@ const conversationStatus = (
|
|
|
185
221
|
return label;
|
|
186
222
|
};
|
|
187
223
|
|
|
188
|
-
const isAnswerDisabled = (
|
|
189
|
-
status: string | undefined,
|
|
190
|
-
commandPending: boolean
|
|
191
|
-
): boolean => commandPending || status === "busy" || status === "resuming";
|
|
192
|
-
|
|
193
224
|
const isExecutionBusy = (status: string | undefined): boolean =>
|
|
194
225
|
status === "busy" || status === "resuming";
|
|
195
226
|
|
|
@@ -197,7 +228,7 @@ const selectedConversationMessages = (
|
|
|
197
228
|
messages: readonly ReadonlyEveMessage[],
|
|
198
229
|
controller: Readonly<Pick<LogicalChat, "logicalId">>,
|
|
199
230
|
snapshot: Readonly<Pick<LogicalChatSnapshot, "cursorId" | "nodes">>,
|
|
200
|
-
|
|
231
|
+
branchId: string
|
|
201
232
|
): readonly ReadonlyEveMessage[] => {
|
|
202
233
|
const selectedPath = new Set<string>();
|
|
203
234
|
let selectedNode = hasText(snapshot.cursorId)
|
|
@@ -217,14 +248,14 @@ const selectedConversationMessages = (
|
|
|
217
248
|
) {
|
|
218
249
|
return false;
|
|
219
250
|
}
|
|
220
|
-
const logicalId = controller.logicalId(
|
|
251
|
+
const logicalId = controller.logicalId(branchId, message.id);
|
|
221
252
|
return (
|
|
222
253
|
!hasText(snapshot.cursorId) ||
|
|
223
254
|
(hasText(logicalId) && selectedPath.has(logicalId))
|
|
224
255
|
);
|
|
225
256
|
})
|
|
226
257
|
.map((message) => {
|
|
227
|
-
const id = controller.logicalId(
|
|
258
|
+
const id = controller.logicalId(branchId, message.id);
|
|
228
259
|
const canonical =
|
|
229
260
|
typeof id === "string" && id !== ""
|
|
230
261
|
? snapshot.nodes.get(id)?.message
|
|
@@ -399,14 +430,24 @@ const conversationActionLocks = ({
|
|
|
399
430
|
fork.locked || Boolean(editingMessageId) || Boolean(pendingMessage),
|
|
400
431
|
});
|
|
401
432
|
|
|
433
|
+
const showComposerReconnect = (
|
|
434
|
+
message: string | undefined,
|
|
435
|
+
pendingRejection: string | undefined,
|
|
436
|
+
commandError: Error | undefined
|
|
437
|
+
): boolean =>
|
|
438
|
+
hasText(message) &&
|
|
439
|
+
!hasText(pendingRejection) &&
|
|
440
|
+
!isEveCommandRejection(commandError);
|
|
441
|
+
|
|
402
442
|
const EveConversationComposer = ({
|
|
403
443
|
input,
|
|
404
444
|
pendingMessage,
|
|
405
445
|
status,
|
|
446
|
+
turnOpen,
|
|
447
|
+
activeModelId,
|
|
406
448
|
busy,
|
|
407
449
|
commandPending,
|
|
408
450
|
cancelPending,
|
|
409
|
-
hasApproval,
|
|
410
451
|
displayedError,
|
|
411
452
|
commandFailure,
|
|
412
453
|
agentError,
|
|
@@ -417,10 +458,11 @@ const EveConversationComposer = ({
|
|
|
417
458
|
readonly input: ReturnType<typeof useConversationInput>;
|
|
418
459
|
readonly pendingMessage: ReturnType<typeof useEveMessageDelivery>["pending"];
|
|
419
460
|
readonly status: ReturnType<typeof useEveAgent>["status"];
|
|
461
|
+
readonly turnOpen: boolean;
|
|
462
|
+
readonly activeModelId: string | undefined;
|
|
420
463
|
readonly busy: boolean;
|
|
421
464
|
readonly commandPending: boolean;
|
|
422
465
|
readonly cancelPending: boolean;
|
|
423
|
-
readonly hasApproval: boolean;
|
|
424
466
|
readonly displayedError: string | undefined;
|
|
425
467
|
readonly commandFailure: Error | undefined;
|
|
426
468
|
readonly agentError: Error | undefined;
|
|
@@ -429,11 +471,14 @@ const EveConversationComposer = ({
|
|
|
429
471
|
readonly onReconnect: () => void;
|
|
430
472
|
}): ReactJSX.Element => {
|
|
431
473
|
const { composerDraft, files, modelSelection, comparison, fork } = input;
|
|
474
|
+
const statusForComposer = composerStatus(status, turnOpen);
|
|
475
|
+
const steering = statusForComposer === "streaming";
|
|
476
|
+
const visibleModelId = steering ? activeModelId : pendingMessage?.modelId;
|
|
432
477
|
const handleSelectedToolChange = composerDraft.setSelectedTool;
|
|
433
478
|
const handleDraftChange = composerDraft.setText;
|
|
434
479
|
return (
|
|
435
480
|
<>
|
|
436
|
-
{input.modelIds.length > 1 && (
|
|
481
|
+
{!steering && input.modelIds.length > 1 && (
|
|
437
482
|
<p className="text-muted-foreground mb-2 text-xs">
|
|
438
483
|
Each model receives its own conversation history in the shared
|
|
439
484
|
workspace. Turns run one at a time; changes to workspace files are
|
|
@@ -441,13 +486,13 @@ const EveConversationComposer = ({
|
|
|
441
486
|
</p>
|
|
442
487
|
)}
|
|
443
488
|
<EveComposer
|
|
444
|
-
status={
|
|
489
|
+
status={statusForComposer}
|
|
490
|
+
allowSendWhileStreaming
|
|
445
491
|
disabled={
|
|
446
492
|
!composerDraft.loaded ||
|
|
447
|
-
busy ||
|
|
493
|
+
(busy && !steering) ||
|
|
448
494
|
commandPending ||
|
|
449
495
|
cancelPending ||
|
|
450
|
-
hasApproval ||
|
|
451
496
|
Boolean(pendingMessage) ||
|
|
452
497
|
fork.locked
|
|
453
498
|
}
|
|
@@ -455,6 +500,8 @@ const EveConversationComposer = ({
|
|
|
455
500
|
capabilities={{
|
|
456
501
|
files,
|
|
457
502
|
onToolChange: handleSelectedToolChange,
|
|
503
|
+
turnOptionsLocked: statusForComposer !== "ready",
|
|
504
|
+
attachmentModelPending: steering && !hasText(activeModelId),
|
|
458
505
|
selectedTool: retainedToolSelection(
|
|
459
506
|
comparison,
|
|
460
507
|
pendingMessage,
|
|
@@ -464,13 +511,13 @@ const EveConversationComposer = ({
|
|
|
464
511
|
modelIds={composerModelIds(
|
|
465
512
|
input.modelIds,
|
|
466
513
|
comparison?.modelIds,
|
|
467
|
-
|
|
514
|
+
visibleModelId
|
|
468
515
|
)}
|
|
469
516
|
modelPicker={
|
|
470
517
|
<ParallelResponseModelPicker
|
|
471
518
|
disabled={Boolean(pendingMessage)}
|
|
472
519
|
modelSelection={modelSelection}
|
|
473
|
-
retainedModelId={
|
|
520
|
+
retainedModelId={visibleModelId}
|
|
474
521
|
retainedModelIds={comparison?.modelIds}
|
|
475
522
|
/>
|
|
476
523
|
}
|
|
@@ -480,19 +527,21 @@ const EveConversationComposer = ({
|
|
|
480
527
|
readOnly={Boolean(comparison)}
|
|
481
528
|
stopDisabled={cancelPending || status === "resuming"}
|
|
482
529
|
/>
|
|
483
|
-
{
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
530
|
+
{showComposerReconnect(
|
|
531
|
+
displayedError,
|
|
532
|
+
pendingMessage?.rejection,
|
|
533
|
+
commandFailure ?? agentError
|
|
534
|
+
) && (
|
|
535
|
+
<Button
|
|
536
|
+
disabled={busy || commandPending || cancelPending}
|
|
537
|
+
onClick={onReconnect}
|
|
538
|
+
size="sm"
|
|
539
|
+
type="button"
|
|
540
|
+
variant="ghost"
|
|
541
|
+
>
|
|
542
|
+
Reconnect
|
|
543
|
+
</Button>
|
|
544
|
+
)}
|
|
496
545
|
</>
|
|
497
546
|
);
|
|
498
547
|
};
|
|
@@ -501,34 +550,34 @@ const EveConversationComposer = ({
|
|
|
501
550
|
|
|
502
551
|
const EveConversation = ({
|
|
503
552
|
sessionId,
|
|
504
|
-
|
|
553
|
+
branchId,
|
|
505
554
|
ownerId,
|
|
506
555
|
header,
|
|
507
556
|
draftScopeId,
|
|
508
557
|
initialMessage,
|
|
509
558
|
}: {
|
|
510
559
|
sessionId: string;
|
|
511
|
-
|
|
560
|
+
branchId: string;
|
|
512
561
|
ownerId: string;
|
|
513
562
|
header: ReactNode;
|
|
514
563
|
readonly initialMessage?: Parameters<typeof restoreDraft>[0];
|
|
515
564
|
draftScopeId?: string;
|
|
516
565
|
}): ReactJSX.Element => {
|
|
517
566
|
const [, startEventAction] = React.useTransition();
|
|
518
|
-
const input = useConversationInput(ownerId,
|
|
567
|
+
const input = useConversationInput(ownerId, branchId, draftScopeId);
|
|
519
568
|
const { fork, composerDraft, files, comparison, modelIds } = input;
|
|
520
569
|
const delivery = useEveMessageDelivery(sessionId);
|
|
521
570
|
const pendingMessage = delivery.pending;
|
|
522
571
|
const { controller, snapshot } = useLogicalChat();
|
|
523
|
-
const command = useLogicalCommands(controller.commands,
|
|
572
|
+
const command = useLogicalCommands(controller.commands, branchId);
|
|
524
573
|
const commandFailure = command.failure;
|
|
525
574
|
const commandPending = command.pending;
|
|
526
575
|
const cancelPending = command.cancelling;
|
|
527
|
-
const setCommandFailure = (
|
|
528
|
-
controller.commands.update(
|
|
576
|
+
const setCommandFailure = (error?: Error): void => {
|
|
577
|
+
controller.commands.update(branchId, { failure: error });
|
|
529
578
|
};
|
|
530
579
|
const { text: draft, setText: setDraft } = composerDraft;
|
|
531
|
-
const agent = snapshot.agents.get(
|
|
580
|
+
const agent = snapshot.agents.get(branchId);
|
|
532
581
|
if (!agent) {
|
|
533
582
|
throw new Error("Native observer is not ready.");
|
|
534
583
|
}
|
|
@@ -537,25 +586,24 @@ const EveConversation = ({
|
|
|
537
586
|
pendingMessage,
|
|
538
587
|
delivery.accept
|
|
539
588
|
);
|
|
540
|
-
const latestTurn = agent.events.findLast(
|
|
541
|
-
(event) => event.type === "turn.started" || event.type === "turn.settled"
|
|
542
|
-
);
|
|
543
|
-
const durableError = settledError(latestTurn);
|
|
544
589
|
const displayedError =
|
|
545
|
-
commandFailure?.message ??
|
|
590
|
+
commandFailure?.message ??
|
|
591
|
+
agent.error?.message ??
|
|
592
|
+
recordedError(agent.view);
|
|
546
593
|
// Failed provisional messages are retained in the recovery panel below.
|
|
547
594
|
// They must not look like accepted transcript entries or survive a retry twice.
|
|
548
595
|
const messages = selectedConversationMessages(
|
|
549
596
|
agent.messages,
|
|
550
597
|
controller,
|
|
551
598
|
snapshot,
|
|
552
|
-
|
|
599
|
+
branchId
|
|
553
600
|
);
|
|
554
601
|
const lastMessage = messages.at(-1);
|
|
555
602
|
const editingMessageId =
|
|
556
603
|
fork.editingMessageId ??
|
|
557
604
|
messages.find((message) => message.id === fork.editingBoundary)?.id;
|
|
558
605
|
const responseModels = responseModelReferences(agent.events);
|
|
606
|
+
const activeModelId = activeResponseModel(agent.view, responseModels);
|
|
559
607
|
const modelForMessage = (
|
|
560
608
|
message: Readonly<Pick<(typeof messages)[number], "metadata">>
|
|
561
609
|
): string | undefined => {
|
|
@@ -573,15 +621,29 @@ const EveConversation = ({
|
|
|
573
621
|
return undefined;
|
|
574
622
|
};
|
|
575
623
|
const busy = isExecutionBusy(agent.status);
|
|
576
|
-
const hasApproval =
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
(part.type === "interaction" && part.status === "open")
|
|
581
|
-
)
|
|
624
|
+
const { hasApproval, inputDisabled, turnOpen } = interactionControls(
|
|
625
|
+
agent,
|
|
626
|
+
commandFailure,
|
|
627
|
+
cancelPending
|
|
582
628
|
);
|
|
629
|
+
const steering = composerStatus(agent.status, turnOpen) === "streaming";
|
|
630
|
+
const respond = async (response: Answer): Promise<void> => {
|
|
631
|
+
if (inputDisabled) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
setCommandFailure(undefined);
|
|
635
|
+
try {
|
|
636
|
+
await agent.respond([response]);
|
|
637
|
+
} catch (error) {
|
|
638
|
+
setCommandFailure(
|
|
639
|
+
error instanceof Error
|
|
640
|
+
? error
|
|
641
|
+
: new Error("Could not submit your response.")
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
};
|
|
583
645
|
const run = async (action: () => Promise<unknown>): Promise<void> => {
|
|
584
|
-
if (!controller.commands.claim(
|
|
646
|
+
if (!controller.commands.claim(branchId)) {
|
|
585
647
|
return;
|
|
586
648
|
}
|
|
587
649
|
setCommandFailure(undefined);
|
|
@@ -599,7 +661,7 @@ const EveConversation = ({
|
|
|
599
661
|
}
|
|
600
662
|
},
|
|
601
663
|
() => {
|
|
602
|
-
controller.commands.update(
|
|
664
|
+
controller.commands.update(branchId, { pending: false });
|
|
603
665
|
}
|
|
604
666
|
);
|
|
605
667
|
};
|
|
@@ -607,16 +669,16 @@ const EveConversation = ({
|
|
|
607
669
|
action: () => Promise<void>,
|
|
608
670
|
operationId?: string
|
|
609
671
|
): Promise<void> => {
|
|
610
|
-
const { cancellation } = controller.commands.get(
|
|
672
|
+
const { cancellation } = controller.commands.get(branchId);
|
|
611
673
|
await sendCommand(
|
|
612
674
|
action,
|
|
613
675
|
agent.resume,
|
|
614
676
|
cancellation > 0,
|
|
615
|
-
() => controller.getSnapshot().agents.get(
|
|
677
|
+
() => controller.getSnapshot().agents.get(branchId)?.error,
|
|
616
678
|
() => !hasText(operationId) || delivery.hasAcknowledged(operationId)
|
|
617
679
|
);
|
|
618
|
-
if (controller.commands.get(
|
|
619
|
-
controller.commands.update(
|
|
680
|
+
if (controller.commands.get(branchId).cancellation === cancellation) {
|
|
681
|
+
controller.commands.update(branchId, { cancellation: 0 });
|
|
620
682
|
}
|
|
621
683
|
};
|
|
622
684
|
const sendPendingMessage = async (
|
|
@@ -625,6 +687,7 @@ const EveConversation = ({
|
|
|
625
687
|
try {
|
|
626
688
|
await send(async () => {
|
|
627
689
|
await agent.send(draftMessage(pending.message, pending.attachments), {
|
|
690
|
+
turnPolicy: pending.turnPolicy,
|
|
628
691
|
headers: {
|
|
629
692
|
[EVE_MESSAGE_OPERATION_HEADER]: pending.operationId,
|
|
630
693
|
...(hasText(pending.modelId)
|
|
@@ -650,14 +713,16 @@ const EveConversation = ({
|
|
|
650
713
|
attachments: readonly Readonly<DraftAttachment>[],
|
|
651
714
|
modelId: string,
|
|
652
715
|
clearComposer: boolean,
|
|
653
|
-
selectedTool?: UiToolName
|
|
716
|
+
selectedTool?: UiToolName,
|
|
717
|
+
turnPolicy?: ActivePendingEveMessage["turnPolicy"]
|
|
654
718
|
): Promise<void> => {
|
|
655
|
-
controller.selectBranch(
|
|
719
|
+
controller.selectBranch(branchId);
|
|
656
720
|
const pending = delivery.begin({
|
|
657
721
|
attachments,
|
|
658
722
|
message: message.trim(),
|
|
659
723
|
modelId,
|
|
660
724
|
selectedTool,
|
|
725
|
+
turnPolicy,
|
|
661
726
|
});
|
|
662
727
|
if (clearComposer) {
|
|
663
728
|
setDraft("");
|
|
@@ -693,7 +758,7 @@ const EveConversation = ({
|
|
|
693
758
|
);
|
|
694
759
|
};
|
|
695
760
|
const cancel = async (): Promise<void> => {
|
|
696
|
-
await cancelExecution(
|
|
761
|
+
await cancelExecution(branchId);
|
|
697
762
|
};
|
|
698
763
|
const handleEditSubmit = fork.submit;
|
|
699
764
|
const statusLabel = conversationStatus(
|
|
@@ -713,15 +778,16 @@ const EveConversation = ({
|
|
|
713
778
|
});
|
|
714
779
|
return (
|
|
715
780
|
<ChatConversationScreen
|
|
716
|
-
|
|
781
|
+
branchId={branchId}
|
|
717
782
|
header={header}
|
|
718
783
|
transcript={{
|
|
719
784
|
actionsDisabled: actionLocks.transcript,
|
|
720
|
-
|
|
785
|
+
branchId,
|
|
721
786
|
disabled: busy || commandPending,
|
|
722
|
-
inputDisabled
|
|
787
|
+
inputDisabled,
|
|
723
788
|
isReadonly: false,
|
|
724
789
|
messages,
|
|
790
|
+
view: agent.view,
|
|
725
791
|
editor: hasText(editingMessageId)
|
|
726
792
|
? {
|
|
727
793
|
content: (
|
|
@@ -747,20 +813,20 @@ const EveConversation = ({
|
|
|
747
813
|
modelForMessage,
|
|
748
814
|
renderVersions: (message): React.JSX.Element => (
|
|
749
815
|
<EveLogicalVersions
|
|
750
|
-
|
|
816
|
+
branchId={branchId}
|
|
751
817
|
messageId={message.id}
|
|
752
818
|
disabled={actionLocks.navigation}
|
|
753
819
|
/>
|
|
754
820
|
),
|
|
755
821
|
renderResponses: (message): React.JSX.Element => (
|
|
756
822
|
<MessageResponses
|
|
757
|
-
|
|
823
|
+
branchId={branchId}
|
|
758
824
|
messageId={message.id}
|
|
759
825
|
disabled={actionLocks.navigation}
|
|
760
826
|
/>
|
|
761
827
|
),
|
|
762
828
|
messageKey: (message) =>
|
|
763
|
-
controller.logicalId(
|
|
829
|
+
controller.logicalId(branchId, message.id) ??
|
|
764
830
|
`${sessionId}:${message.id}`,
|
|
765
831
|
onEdit: (message) => {
|
|
766
832
|
const following = messages.slice(messages.indexOf(message) + 1);
|
|
@@ -770,7 +836,7 @@ const EveConversation = ({
|
|
|
770
836
|
const response = following
|
|
771
837
|
.slice(0, nextUser === -1 ? following.length : nextUser)
|
|
772
838
|
.find((candidate) => candidate.role === "assistant");
|
|
773
|
-
const logicalId = controller.logicalId(
|
|
839
|
+
const logicalId = controller.logicalId(branchId, message.id);
|
|
774
840
|
const group = hasText(logicalId)
|
|
775
841
|
? logicalResponseSlots(snapshot, logicalId)
|
|
776
842
|
: undefined;
|
|
@@ -799,7 +865,7 @@ const EveConversation = ({
|
|
|
799
865
|
suggestions: (
|
|
800
866
|
<ChatSuggestions
|
|
801
867
|
sessionId={sessionId}
|
|
802
|
-
|
|
868
|
+
branchId={branchId}
|
|
803
869
|
events={agent.events}
|
|
804
870
|
lastMessage={lastMessage}
|
|
805
871
|
disabled={actionLocks.transcript}
|
|
@@ -825,11 +891,7 @@ const EveConversation = ({
|
|
|
825
891
|
),
|
|
826
892
|
respond: (response) => {
|
|
827
893
|
startEventAction(async () => {
|
|
828
|
-
await
|
|
829
|
-
await send(async () => {
|
|
830
|
-
await agent.respond([response]);
|
|
831
|
-
});
|
|
832
|
-
});
|
|
894
|
+
await respond(response);
|
|
833
895
|
});
|
|
834
896
|
},
|
|
835
897
|
}}
|
|
@@ -883,10 +945,11 @@ const EveConversation = ({
|
|
|
883
945
|
input={input}
|
|
884
946
|
pendingMessage={pendingMessage}
|
|
885
947
|
status={agent.status}
|
|
948
|
+
turnOpen={turnOpen}
|
|
949
|
+
activeModelId={activeModelId}
|
|
886
950
|
busy={busy}
|
|
887
951
|
commandPending={commandPending}
|
|
888
952
|
cancelPending={cancelPending}
|
|
889
|
-
hasApproval={hasApproval}
|
|
890
953
|
displayedError={displayedError}
|
|
891
954
|
commandFailure={commandFailure}
|
|
892
955
|
agentError={agent.error}
|
|
@@ -896,7 +959,7 @@ const EveConversation = ({
|
|
|
896
959
|
|
|
897
960
|
onSubmit={() => {
|
|
898
961
|
void run(async () => {
|
|
899
|
-
await (modelIds.length > 1
|
|
962
|
+
await (!steering && modelIds.length > 1
|
|
900
963
|
? fork.compare(
|
|
901
964
|
draftMessage(draft, files.attachments),
|
|
902
965
|
modelIds,
|
|
@@ -905,9 +968,10 @@ const EveConversation = ({
|
|
|
905
968
|
: submitMessage(
|
|
906
969
|
draft,
|
|
907
970
|
files.attachments,
|
|
908
|
-
modelIds[0],
|
|
971
|
+
steering ? (activeModelId ?? modelIds[0]) : modelIds[0],
|
|
909
972
|
true,
|
|
910
|
-
composerDraft.selectedTool ?? undefined
|
|
973
|
+
composerDraft.selectedTool ?? undefined,
|
|
974
|
+
steering ? "steer" : undefined
|
|
911
975
|
));
|
|
912
976
|
});
|
|
913
977
|
}}
|