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
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ These instructions apply to this application directory.
|
|
|
8
8
|
- Keep shadcn primitives in `components/ui`; its config is `components.json`.
|
|
9
9
|
- EVE is the only chat runtime. Browser commands enter through `app/api/eve/[...path]/route.ts`; agent hooks and tools live in `agent/`.
|
|
10
10
|
- Keep core tables in `lib/db/schema.ts`; installable plugins own their schema and query modules. Declare plugin schemas in their manifests so `chatjs/generated/installed-database.ts` composes the installed selection.
|
|
11
|
-
- Core routers compose in `trpc/routers/_app.ts`.
|
|
11
|
+
- Core routers compose in `trpc/routers/_app.ts`. Plugin `router.ts` files export a namespaced tRPC `router`. Sync registers the entry point from its owned file path.
|
|
12
12
|
- Edit plugin implementations in `packages/registry/src/plugins/<id>/src`, run root `bun dev`, and save to update the installed reference copies automatically. Installed registry files in this reference app are disposable registry-mirror output; local edits are overwritten. Use `bun demo:sync` for one-shot regeneration and `bun demo:check` for verification. Keep framework entrypoints thin.
|
|
13
13
|
|
|
14
14
|
## Commands
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: followup-suggestions. Ownership: chatjs/plugins/followup-suggestions/
|
|
1
|
+
// ChatJS source: followup-suggestions. Ownership: chatjs/plugins/followup-suggestions/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/followup-suggestions/followup-hook";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: projects. Ownership: chatjs/plugins/projects/
|
|
1
|
+
// ChatJS source: projects. Ownership: chatjs/plugins/projects/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/projects/conversation-hook";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: search. Ownership: chatjs/plugins/search/
|
|
1
|
+
// ChatJS source: search. Ownership: chatjs/plugins/search/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/search/search-hook";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: projects. Ownership: chatjs/plugins/projects/
|
|
1
|
+
// ChatJS source: projects. Ownership: chatjs/plugins/projects/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/projects/instructions";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/
|
|
1
|
+
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/plugin.json.
|
|
2
2
|
export { mcpTools as default } from "@/chatjs/plugins/mcp/runtime/agent-tools";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: desktop. Ownership: chatjs/plugins/desktop/
|
|
1
|
+
// ChatJS source: desktop. Ownership: chatjs/plugins/desktop/plugin.json.
|
|
2
2
|
export { default, metadata } from "@/chatjs/plugins/desktop/device-login-route";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: attachment-uploads. Ownership: chatjs/plugins/attachment-uploads/
|
|
1
|
+
// ChatJS source: attachment-uploads. Ownership: chatjs/plugins/attachment-uploads/plugin.json.
|
|
2
2
|
export { POST } from "@/chatjs/plugins/attachment-uploads/routes/upload";
|
|
@@ -8,12 +8,12 @@ const ConversationPage = async ({
|
|
|
8
8
|
}: {
|
|
9
9
|
readonly params: Readonly<
|
|
10
10
|
Promise<{
|
|
11
|
-
readonly
|
|
11
|
+
readonly chatId: string;
|
|
12
12
|
}>
|
|
13
13
|
>;
|
|
14
14
|
}): Promise<React.JSX.Element> => {
|
|
15
|
-
const
|
|
16
|
-
return <EveChatPage
|
|
15
|
+
const { chatId } = await params;
|
|
16
|
+
return <EveChatPage chatId={chatId} />;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const ChatPageRoute = ({
|
|
@@ -21,7 +21,7 @@ const ChatPageRoute = ({
|
|
|
21
21
|
}: {
|
|
22
22
|
readonly params: Readonly<
|
|
23
23
|
Promise<{
|
|
24
|
-
readonly
|
|
24
|
+
readonly chatId: string;
|
|
25
25
|
}>
|
|
26
26
|
>;
|
|
27
27
|
}): React.JSX.Element => (
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: projects. Ownership: chatjs/plugins/projects/
|
|
1
|
+
// ChatJS source: projects. Ownership: chatjs/plugins/projects/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/projects/routes/project-chat-page";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: projects. Ownership: chatjs/plugins/projects/
|
|
1
|
+
// ChatJS source: projects. Ownership: chatjs/plugins/projects/plugin.json.
|
|
2
2
|
export { default } from "@/chatjs/plugins/projects/routes/project-page";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/
|
|
1
|
+
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/plugin.json.
|
|
2
2
|
import { ConnectorDetailsPage } from "@/chatjs/plugins/mcp/routes/connector-page";
|
|
3
3
|
|
|
4
4
|
const Page = (props: { readonly params: Promise<{ connectorId: string }> }) => (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/
|
|
1
|
+
// ChatJS source: mcp. Ownership: chatjs/plugins/mcp/plugin.json.
|
|
2
2
|
import { ConnectorsSettingsPage } from "@/chatjs/plugins/mcp/routes/connectors-page";
|
|
3
3
|
|
|
4
4
|
const Page = () => <ConnectorsSettingsPage />;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// ChatJS source: model-preferences. Ownership: chatjs/plugins/model-preferences/
|
|
1
|
+
// ChatJS source: model-preferences. Ownership: chatjs/plugins/model-preferences/plugin.json.
|
|
2
2
|
export { ModelsSettingsPage as default } from "@/chatjs/plugins/model-preferences/models-page";
|
|
@@ -93,22 +93,22 @@ test("defers root plugin work until after the creation response", async () => {
|
|
|
93
93
|
const [[afterResponseCallback]] = mocks.after.mock.calls;
|
|
94
94
|
await afterResponseCallback();
|
|
95
95
|
expect(mocks.afterCreate).toHaveBeenCalledWith({
|
|
96
|
-
|
|
96
|
+
branchId: "00000000-0000-4000-8000-000000000002",
|
|
97
97
|
message: "hello",
|
|
98
98
|
ownerId: "account",
|
|
99
99
|
});
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
test("runs the branch callback after returning the bound session", async () => {
|
|
103
|
-
const
|
|
103
|
+
const branchId = "00000000-0000-4000-8000-000000000002";
|
|
104
104
|
mocks.create.mockResolvedValue(
|
|
105
|
-
Response.json({ id:
|
|
105
|
+
Response.json({ id: branchId, sessionId: "branch-session" })
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
const response = await POST(
|
|
109
109
|
request({
|
|
110
110
|
...input,
|
|
111
|
-
fork: {
|
|
111
|
+
fork: { branchId: "00000000-0000-4000-8000-000000000003" },
|
|
112
112
|
})
|
|
113
113
|
);
|
|
114
114
|
|
|
@@ -118,7 +118,7 @@ test("runs the branch callback after returning the bound session", async () => {
|
|
|
118
118
|
await afterResponseCallback();
|
|
119
119
|
expect(mocks.afterBranch).toHaveBeenCalledExactlyOnceWith({
|
|
120
120
|
ownerId: "account",
|
|
121
|
-
|
|
121
|
+
branchId,
|
|
122
122
|
sessionId: "branch-session",
|
|
123
123
|
});
|
|
124
124
|
expect(mocks.afterCreate).not.toHaveBeenCalled();
|
|
@@ -46,13 +46,13 @@ export const POST = async (
|
|
|
46
46
|
if (input.data.fork) {
|
|
47
47
|
await chat.afterBranch({
|
|
48
48
|
ownerId: principal.ownerId,
|
|
49
|
-
|
|
49
|
+
branchId: binding.data.id,
|
|
50
50
|
sessionId: binding.data.sessionId,
|
|
51
51
|
});
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
await runChatAfterCreate({
|
|
55
|
-
|
|
55
|
+
branchId: binding.data.id,
|
|
56
56
|
message: input.data.message,
|
|
57
57
|
ownerId: principal.ownerId,
|
|
58
58
|
});
|
|
@@ -82,14 +82,14 @@ test("schedules one plugin work for an initial comparison chat", async () => {
|
|
|
82
82
|
mocks.create.mockResolvedValue({
|
|
83
83
|
candidates: [
|
|
84
84
|
{
|
|
85
|
-
|
|
85
|
+
branchId: "00000000-0000-4000-8000-000000000002",
|
|
86
86
|
modelId: "a",
|
|
87
87
|
operationId: input.operationId,
|
|
88
88
|
sessionId: "session-a",
|
|
89
89
|
state: "bound",
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
|
|
92
|
+
branchId: "00000000-0000-4000-8000-000000000003",
|
|
93
93
|
modelId: "b",
|
|
94
94
|
operationId: "00000000-0000-4000-8000-000000000004",
|
|
95
95
|
sessionId: "session-b",
|
|
@@ -106,7 +106,7 @@ test("schedules one plugin work for an initial comparison chat", async () => {
|
|
|
106
106
|
const [[afterResponseCallback]] = mocks.after.mock.calls;
|
|
107
107
|
await afterResponseCallback();
|
|
108
108
|
expect(mocks.afterCreate).toHaveBeenCalledWith({
|
|
109
|
-
|
|
109
|
+
branchId: "00000000-0000-4000-8000-000000000002",
|
|
110
110
|
message: "Compare",
|
|
111
111
|
ownerId: "owner",
|
|
112
112
|
});
|
|
@@ -116,7 +116,7 @@ test("does not retitle a forked comparison chat", async () => {
|
|
|
116
116
|
mocks.create.mockResolvedValue({
|
|
117
117
|
candidates: [
|
|
118
118
|
{
|
|
119
|
-
|
|
119
|
+
branchId: "00000000-0000-4000-8000-000000000002",
|
|
120
120
|
modelId: "a",
|
|
121
121
|
operationId: input.operationId,
|
|
122
122
|
sessionId: "session-a",
|
|
@@ -132,7 +132,7 @@ test("does not retitle a forked comparison chat", async () => {
|
|
|
132
132
|
...input,
|
|
133
133
|
fork: {
|
|
134
134
|
beforeTurnId: "turn_0",
|
|
135
|
-
|
|
135
|
+
branchId: "00000000-0000-4000-8000-000000000005",
|
|
136
136
|
},
|
|
137
137
|
forkKind: "comparison",
|
|
138
138
|
}),
|
|
@@ -31,7 +31,7 @@ const scheduleResponseGroupContributions = (
|
|
|
31
31
|
if (source?.state === "bound") {
|
|
32
32
|
after(async () => {
|
|
33
33
|
await runChatAfterCreate({
|
|
34
|
-
|
|
34
|
+
branchId: source.branchId,
|
|
35
35
|
message: input.data.message,
|
|
36
36
|
ownerId: principal.ownerId,
|
|
37
37
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/* oxlint-disable eslint/max-classes-per-file -- Independent native client and dispatch error doubles. */
|
|
1
2
|
import { beforeEach, expect, test, vi } from "vitest";
|
|
3
|
+
import type * as EveClient from "eve/client";
|
|
2
4
|
|
|
3
5
|
import { EVE_MESSAGE_OPERATION_HEADER } from "@/lib/eve/message-delivery";
|
|
4
6
|
import { EveUsageReconciliationBusyError } from "@/lib/eve/usage-reconciliation-busy";
|
|
@@ -24,14 +26,25 @@ const mocks = vi.hoisted(() => ({
|
|
|
24
26
|
principal: vi.fn(),
|
|
25
27
|
reconcile: vi.fn(),
|
|
26
28
|
referenceFiles: vi.fn(),
|
|
29
|
+
snapshot: vi.fn(),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
vi.mock("eve/client", async (original) => ({
|
|
33
|
+
...(await original<typeof EveClient>()),
|
|
34
|
+
Client: class {
|
|
35
|
+
sessions = { attach: () => ({ snapshot: mocks.snapshot }) };
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
vi.mock("@/lib/eve/connection-options", () => ({
|
|
39
|
+
getEveConnectionOptions: () => ({}),
|
|
27
40
|
}));
|
|
28
41
|
|
|
29
42
|
vi.mock("@/lib/db/eve-dispatch", () => ({
|
|
30
43
|
dispatchEveOnce: async (
|
|
31
|
-
|
|
44
|
+
input: unknown,
|
|
32
45
|
dispatch: () => Promise<{ sessionId: string; deliveryId: string }>
|
|
33
46
|
) => {
|
|
34
|
-
mocks.dispatch();
|
|
47
|
+
mocks.dispatch(input);
|
|
35
48
|
return await dispatch();
|
|
36
49
|
},
|
|
37
50
|
EveDispatchUnknownError: class extends Error {},
|
|
@@ -61,12 +74,17 @@ vi.mock("@/lib/eve/reconcile-usage", () => ({
|
|
|
61
74
|
vi.mock("@/lib/eve/server", () => ({ eveRequest: mocks.eveRequest }));
|
|
62
75
|
|
|
63
76
|
const operationId = "00000000-0000-4000-8000-000000000001";
|
|
64
|
-
const request = (
|
|
77
|
+
const request = (
|
|
78
|
+
headers: Readonly<Record<string, string>> = {},
|
|
79
|
+
turnPolicy?: string,
|
|
80
|
+
message: unknown = "original"
|
|
81
|
+
): Request =>
|
|
65
82
|
new Request("http://localhost:3790/api/eve/v1/session/native", {
|
|
66
83
|
body: JSON.stringify({
|
|
67
|
-
message
|
|
84
|
+
message,
|
|
68
85
|
modelId: "model",
|
|
69
86
|
selectedTool: "generateImage",
|
|
87
|
+
turnPolicy,
|
|
70
88
|
}),
|
|
71
89
|
headers: {
|
|
72
90
|
"content-type": "application/json",
|
|
@@ -108,6 +126,31 @@ test("requires a message operation ID before dispatch", async () => {
|
|
|
108
126
|
expect(mocks.eveRequest).not.toHaveBeenCalled();
|
|
109
127
|
});
|
|
110
128
|
|
|
129
|
+
test("forwards steering through admission for the exact native session", async () => {
|
|
130
|
+
const response = await POST(
|
|
131
|
+
request({ [EVE_MESSAGE_OPERATION_HEADER]: operationId }, "steer"),
|
|
132
|
+
{ params: Promise.resolve({ path: ["v1", "session", "native"] }) }
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect(response.status).toBe(200);
|
|
136
|
+
expect(mocks.canSpend).toHaveBeenCalledExactlyOnceWith("owner");
|
|
137
|
+
expect(mocks.dispatch.mock.calls[0]?.[0]).toMatchObject({
|
|
138
|
+
steerSessionId: "native",
|
|
139
|
+
intent: { turnPolicy: "steer" },
|
|
140
|
+
});
|
|
141
|
+
expect(mocks.eveRequest.mock.calls[0]?.slice(0, 3)).toEqual([
|
|
142
|
+
"owner",
|
|
143
|
+
"/eve/chat/v1/session/native",
|
|
144
|
+
expect.objectContaining({
|
|
145
|
+
body: JSON.stringify({ message: "prepared", turnPolicy: "steer" }),
|
|
146
|
+
}),
|
|
147
|
+
]);
|
|
148
|
+
expect(mocks.eveRequest.mock.calls[0]?.slice(3)).toEqual([
|
|
149
|
+
undefined,
|
|
150
|
+
undefined,
|
|
151
|
+
]);
|
|
152
|
+
});
|
|
153
|
+
|
|
111
154
|
test("keeps app correlation out of the native message body", async () => {
|
|
112
155
|
const response = await POST(
|
|
113
156
|
request({ [EVE_MESSAGE_OPERATION_HEADER]: operationId }),
|
|
@@ -129,6 +172,92 @@ test("keeps app correlation out of the native message body", async () => {
|
|
|
129
172
|
);
|
|
130
173
|
});
|
|
131
174
|
|
|
175
|
+
test("validates steer attachments against the active model", async () => {
|
|
176
|
+
const events: EveClient.SessionStreamEvent[] = [
|
|
177
|
+
{
|
|
178
|
+
type: "session.started",
|
|
179
|
+
data: {},
|
|
180
|
+
meta: {
|
|
181
|
+
at: "2026-11-23T00:00:00Z",
|
|
182
|
+
position: { line: 0, index: 0 },
|
|
183
|
+
endOfLine: true,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: "turn.started",
|
|
188
|
+
data: {
|
|
189
|
+
turnId: "turn-1",
|
|
190
|
+
follows: null,
|
|
191
|
+
cause: { deliveryId: "initial" },
|
|
192
|
+
},
|
|
193
|
+
meta: {
|
|
194
|
+
at: "2026-11-23T00:00:00Z",
|
|
195
|
+
position: { line: 1, index: 0 },
|
|
196
|
+
endOfLine: true,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: "model.started",
|
|
201
|
+
data: { modelId: "openai/gpt-5-mini", runId: "run-1", attempt: 0 },
|
|
202
|
+
scope: { turnId: "turn-1", runId: "run-1" },
|
|
203
|
+
meta: {
|
|
204
|
+
at: "2026-11-23T00:00:00Z",
|
|
205
|
+
position: { line: 2, index: 0 },
|
|
206
|
+
endOfLine: true,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
];
|
|
210
|
+
mocks.snapshot.mockResolvedValue({ events });
|
|
211
|
+
const file = {
|
|
212
|
+
type: "file",
|
|
213
|
+
data: "/api/files/abcdefghijklmnopqrstuvwx.pdf",
|
|
214
|
+
filename: "invoice.pdf",
|
|
215
|
+
mediaType: "application/pdf",
|
|
216
|
+
};
|
|
217
|
+
const headers = { [EVE_MESSAGE_OPERATION_HEADER]: operationId };
|
|
218
|
+
const context = {
|
|
219
|
+
params: Promise.resolve({ path: ["v1", "session", "native"] }),
|
|
220
|
+
};
|
|
221
|
+
const accepted = await POST(request(headers, "steer", [file]), context);
|
|
222
|
+
expect(accepted.status).toBe(200);
|
|
223
|
+
expect(mocks.prepare).toHaveBeenCalledExactlyOnceWith(
|
|
224
|
+
[file],
|
|
225
|
+
"openai/gpt-5-mini"
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
mocks.snapshot.mockResolvedValue({ events: events.slice(0, 2) });
|
|
229
|
+
const rejected = await POST(request(headers, "steer", [file]), context);
|
|
230
|
+
expect(rejected.status).toBe(HTTP_STATUS.badRequest);
|
|
231
|
+
expect(await rejected.json()).toMatchObject({
|
|
232
|
+
error: "Wait for the active model before sending attachments.",
|
|
233
|
+
});
|
|
234
|
+
expect(mocks.eveRequest).toHaveBeenCalledTimes(1);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
test("relays a definite native steer refusal as a rejected message", async () => {
|
|
238
|
+
mocks.eveRequest.mockResolvedValue(
|
|
239
|
+
Response.json(
|
|
240
|
+
{
|
|
241
|
+
ok: false,
|
|
242
|
+
code: "session_not_active",
|
|
243
|
+
error: "The session is no longer active.",
|
|
244
|
+
},
|
|
245
|
+
{ status: 409 }
|
|
246
|
+
)
|
|
247
|
+
);
|
|
248
|
+
const response = await POST(
|
|
249
|
+
request({ [EVE_MESSAGE_OPERATION_HEADER]: operationId }, "steer"),
|
|
250
|
+
{
|
|
251
|
+
params: Promise.resolve({ path: ["v1", "session", "native"] }),
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
expect(response.status).toBe(HTTP_STATUS.badRequest);
|
|
255
|
+
expect(await response.json()).toMatchObject({
|
|
256
|
+
code: "chatjs_command_rejected",
|
|
257
|
+
error: "The session is no longer active.",
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
132
261
|
test("keeps a busy admission retryable without dispatching or rejecting its message", async () => {
|
|
133
262
|
mocks.reconcile.mockRejectedValue(new EveUsageReconciliationBusyError());
|
|
134
263
|
const response = await POST(
|