@antelopejs/dms-assistant 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -17
- package/dist/builder/config.d.ts +1 -0
- package/dist/builder/config.js +9 -0
- package/dist/builder/config.js.map +1 -1
- package/dist/builder/constants/routes.d.ts +1 -0
- package/dist/builder/constants/routes.js +1 -0
- package/dist/builder/constants/routes.js.map +1 -1
- package/dist/builder/index.js +2 -0
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/reload.d.ts +2 -0
- package/dist/builder/reload.js +24 -0
- package/dist/builder/reload.js.map +1 -0
- package/dist/builder/routes/database.d.ts +3 -0
- package/dist/builder/routes/database.js +11 -0
- package/dist/builder/routes/database.js.map +1 -1
- package/dist/constants/i18n.d.ts +1 -1
- package/dist/constants/i18n.js +1 -1
- package/dist/constants/i18n.js.map +1 -1
- package/dist/constants/project-mcp.d.ts +0 -2
- package/dist/constants/project-mcp.js +1 -3
- package/dist/constants/project-mcp.js.map +1 -1
- package/dist/constants/sidecar.d.ts +6 -6
- package/dist/constants/sidecar.js +6 -6
- package/dist/constants/sidecar.js.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/lifecycle/project-mcp-json.js +6 -37
- package/dist/lifecycle/project-mcp-json.js.map +1 -1
- package/dist/lifecycle/sidecar-unavailable-error.js +1 -1
- package/dist/lifecycle/sidecar-unavailable-error.js.map +1 -1
- package/dist/pages/activity/page.js +1 -1
- package/dist/pages/activity/page.js.map +1 -1
- package/dist/pages/changes/page.js +1 -1
- package/dist/pages/changes/page.js.map +1 -1
- package/dist/routes/activity.js +1 -1
- package/dist/routes/activity.js.map +1 -1
- package/dist/vocabulary/enumerations.js +0 -1
- package/dist/vocabulary/enumerations.js.map +1 -1
- package/dist/vocabulary/tools.js +1 -1
- package/dist/vocabulary/tools.js.map +1 -1
- package/frontend-vue/app/chat/components/AnswerRecord.vue +3 -3
- package/frontend-vue/app/chat/components/ApprovalDock.vue +15 -11
- package/frontend-vue/app/chat/components/BlockOutline.vue +10 -10
- package/frontend-vue/app/chat/components/BlockPreviewCard.vue +9 -7
- package/frontend-vue/app/chat/components/BlockPreviewModal.vue +15 -14
- package/frontend-vue/app/chat/components/BlockPreviewThumb.vue +1 -1
- package/frontend-vue/app/chat/components/BuildDialog.vue +16 -13
- package/frontend-vue/app/chat/components/ChangeSetCard.vue +15 -13
- package/frontend-vue/app/chat/components/ChatEmpty.vue +4 -4
- package/frontend-vue/app/chat/components/ChatView.vue +45 -101
- package/frontend-vue/app/chat/components/Composer.vue +42 -34
- package/frontend-vue/app/chat/components/ConnectionBanner.vue +6 -5
- package/frontend-vue/app/chat/components/ConversationDrawer.vue +33 -27
- package/frontend-vue/app/chat/components/DiffView.vue +1 -1
- package/frontend-vue/app/chat/components/FoldBar.vue +34 -28
- package/frontend-vue/app/chat/components/MessageList.vue +10 -10
- package/frontend-vue/app/chat/components/NoticeCard.vue +17 -17
- package/frontend-vue/app/chat/components/PanelHeader.vue +16 -15
- package/frontend-vue/app/chat/components/PermissionCard.vue +11 -11
- package/frontend-vue/app/chat/components/PlanCard.vue +5 -5
- package/frontend-vue/app/chat/components/ProviderNotice.vue +6 -4
- package/frontend-vue/app/chat/components/QuestionDock.vue +13 -10
- package/frontend-vue/app/chat/components/QueueDock.vue +17 -15
- package/frontend-vue/app/chat/components/RulesList.vue +9 -5
- package/frontend-vue/app/chat/components/StepsDock.vue +2 -2
- package/frontend-vue/app/chat/components/ToolCluster.vue +3 -3
- package/frontend-vue/app/chat/components/ToolRow.vue +4 -4
- package/frontend-vue/app/chat/components/TurnErrorCard.vue +5 -5
- package/frontend-vue/app/chat/components/UndoConflictModal.vue +4 -4
- package/frontend-vue/app/chat/components/chat-tokens.css +83 -0
- package/frontend-vue/app/chat/composables/useChatI18n.ts +2 -1
- package/frontend-vue/app/chat/composables/useComposerAttachments.ts +3 -3
- package/frontend-vue/app/chat/constants/conversation.ts +4 -4
- package/frontend-vue/app/chat/constants/protocol.ts +2 -1
- package/frontend-vue/app/chat/constants/run-status.ts +6 -6
- package/frontend-vue/app/chat/types/protocol.ts +0 -7
- package/frontend-vue/app/chat/utils/permission-view.ts +44 -36
- package/frontend-vue/app/chat/utils/status-label.ts +7 -5
- package/frontend-vue/app/chat/utils/suggestions.ts +9 -9
- package/frontend-vue/app/chat/utils/tool-lexicon.ts +4 -4
- package/frontend-vue/app/components/ActivityDetail.vue +15 -13
- package/frontend-vue/app/components/ChangesView.vue +20 -20
- package/frontend-vue/app/components/ChatPanel.vue +31 -31
- package/frontend-vue/app/components/LauncherIcon.vue +44 -38
- package/frontend-vue/app/components/Onboarding.vue +3 -3
- package/frontend-vue/app/components/OnboardingWidget.vue +8 -4
- package/frontend-vue/app/components/PaletteAnswer.vue +27 -23
- package/frontend-vue/app/onboarding/analysis-lead.ts +66 -0
- package/frontend-vue/app/onboarding/connect-database.ts +92 -21
- package/frontend-vue/app/onboarding/connect-memory.ts +204 -0
- package/frontend-vue/app/onboarding/controller.ts +44 -6
- package/frontend-vue/app/onboarding/install.ts +7 -2
- package/frontend-vue/app/onboarding/runtime.ts +4 -4
- package/frontend-vue/app/plugins/ai.client.ts +8 -8
- package/frontend-vue/app/plugins/side-panel.ts +1 -1
- package/frontend-vue/app/runtime/assistant-actions.ts +6 -4
- package/frontend-vue/app/runtime/assistant-commands.ts +31 -16
- package/frontend-vue/app/runtime/assistant-notifications.ts +17 -9
- package/frontend-vue/app/runtime/assistant-session.ts +1 -1
- package/frontend-vue/app/runtime/channel-client.ts +1 -1
- package/frontend-vue/app/runtime/constants.ts +11 -11
- package/frontend-vue/app/runtime/sidecar-status.ts +1 -1
- package/frontend-vue/app/views/ChangeSetPanel.vue +20 -20
- package/frontend-vue/app/views/DecisionLabel.vue +1 -1
- package/frontend-vue/app/views/DiffView.vue +6 -6
- package/frontend-vue/app/views/ResultPill.vue +4 -2
- package/frontend-vue/app/views/RowStepper.vue +3 -3
- package/frontend-vue/app/views/UnavailableState.vue +5 -5
- package/frontend-vue/app/views/composables/useAiData.ts +1 -1
- package/frontend-vue/app/views/composables/useChangeSetActions.ts +13 -5
- package/frontend-vue/app/views/composables/useViewFormat.ts +1 -1
- package/frontend-vue/app/views/constants.ts +0 -1
- package/frontend-vue/app/views/onboarding/OnboardingAi.vue +15 -15
- package/frontend-vue/app/views/onboarding/OnboardingAnalysis.vue +13 -13
- package/frontend-vue/app/views/onboarding/OnboardingClaude.vue +14 -14
- package/frontend-vue/app/views/onboarding/OnboardingCodex.vue +11 -11
- package/frontend-vue/app/views/onboarding/OnboardingConnected.vue +4 -4
- package/frontend-vue/app/views/onboarding/OnboardingContinue.vue +18 -18
- package/frontend-vue/app/views/onboarding/OnboardingDatabase.vue +37 -33
- package/frontend-vue/app/views/onboarding/OnboardingDontShow.vue +1 -1
- package/frontend-vue/app/views/onboarding/OnboardingPaths.vue +7 -7
- package/frontend-vue/app/views/onboarding/OnboardingReady.vue +5 -5
- package/frontend-vue/app/views/onboarding/OnboardingScratch.vue +9 -9
- package/frontend-vue/app/views/onboarding/OnboardingWelcome.vue +11 -11
- package/frontend-vue/app/views/onboarding/login-text.ts +6 -6
- package/frontend-vue/app/views/types.ts +0 -1
- package/frontend-vue/app/views/utils/moment.ts +2 -2
- package/frontend-vue/builder/app/runtime/api.ts +2 -0
- package/frontend-vue/builder/app/runtime/database-build.ts +23 -1
- package/frontend-vue/builder/app/runtime/database-connect.ts +5 -0
- package/frontend-vue/builder/tests/database-connect.test.ts +1 -1
- package/frontend-vue/dms.frontend.ts +2 -2
- package/frontend-vue/i18n/locales/builder-en-GB.json +1 -1
- package/frontend-vue/i18n/locales/builder-fr-FR.json +1 -1
- package/frontend-vue/i18n/locales/{dms-ai-pages-en-GB.json → dms-assistant-pages-en-GB.json} +2 -3
- package/frontend-vue/i18n/locales/{dms-ai-pages-fr-FR.json → dms-assistant-pages-fr-FR.json} +2 -3
- package/frontend-vue/i18n/locales/{dms-ai-panel-en-GB.json → dms-assistant-panel-en-GB.json} +1 -2
- package/frontend-vue/i18n/locales/{dms-ai-panel-fr-FR.json → dms-assistant-panel-fr-FR.json} +1 -2
- package/frontend-vue/i18n/locales/{dms-ai-views-en-GB.json → dms-assistant-views-en-GB.json} +2 -3
- package/frontend-vue/i18n/locales/{dms-ai-views-fr-FR.json → dms-assistant-views-fr-FR.json} +2 -3
- package/frontend-vue/package.json +2 -2
- package/frontend-vue/pnpm-lock.yaml +71 -21
- package/frontend-vue/tests/chat/block-target.test.ts +1 -1
- package/frontend-vue/tests/chat/build-view.test.ts +9 -5
- package/frontend-vue/tests/chat/chat-scroll.test.ts +1 -1
- package/frontend-vue/tests/chat/held-card.test.ts +2 -2
- package/frontend-vue/tests/chat/provider-notice.test.ts +1 -1
- package/frontend-vue/tests/chat/tool-lexicon.test.ts +16 -10
- package/frontend-vue/tests/chat-panel.test.ts +10 -10
- package/frontend-vue/tests/chat-transport.test.ts +1 -1
- package/frontend-vue/tests/launcher-icon.test.ts +1 -1
- package/frontend-vue/tests/launcher-label.test.ts +40 -0
- package/frontend-vue/tests/onboarding-connect-memory.test.ts +126 -0
- package/frontend-vue/tests/onboarding-controller-restart.test.ts +134 -0
- package/frontend-vue/tests/onboarding-controller.test.ts +58 -0
- package/frontend-vue/tests/onboarding-database-engines.test.ts +2 -2
- package/frontend-vue/tests/onboarding-database-new-url.test.ts +174 -0
- package/frontend-vue/tests/onboarding-database-reload.test.ts +229 -0
- package/frontend-vue/tests/onboarding-database-tabs.test.ts +184 -0
- package/frontend-vue/tests/onboarding-database.test.ts +13 -118
- package/frontend-vue/tests/palette-assistant.test.ts +8 -8
- package/frontend-vue/tests/panel-approvals.test.ts +1 -1
- package/frontend-vue/tests/panel-closed-conversation.test.ts +53 -0
- package/frontend-vue/tests/panel-mockup-prompt.test.ts +2 -2
- package/frontend-vue/tests/panel-modes.test.ts +1 -16
- package/frontend-vue/tests/panel-questions.test.ts +1 -1
- package/frontend-vue/tests/panel-states.test.ts +1 -1
- package/frontend-vue/tests/panel-tools.test.ts +2 -2
- package/frontend-vue/tests/sidecar-guest.test.ts +1 -1
- package/frontend-vue/tests/support/api-error-presenter.ts +4 -2
- package/frontend-vue/tests/support/database-connect.ts +129 -0
- package/frontend-vue/tests/support/i18n.ts +1 -1
- package/frontend-vue/tests/support/onboarding-host.ts +1 -0
- package/frontend-vue/tests/support/onboarding.ts +29 -1
- package/frontend-vue/tests/views/api-data-reads.test.ts +7 -3
- package/frontend-vue/tests/views/diff-view.test.ts +4 -2
- package/package.json +5 -8
- package/sidecar/dist/agent/permission-bus.d.ts +1 -0
- package/sidecar/dist/agent/permission-bus.js +1 -0
- package/sidecar/dist/agent/permission-bus.js.map +1 -1
- package/sidecar/dist/agent/question-bus.d.ts +1 -0
- package/sidecar/dist/agent/question-bus.js +3 -0
- package/sidecar/dist/agent/question-bus.js.map +1 -1
- package/sidecar/dist/audit/activity-query.js +0 -1
- package/sidecar/dist/audit/activity-query.js.map +1 -1
- package/sidecar/dist/audit/activity.js +11 -3
- package/sidecar/dist/audit/activity.js.map +1 -1
- package/sidecar/dist/constants/audit.d.ts +1 -1
- package/sidecar/dist/constants/audit.js +0 -1
- package/sidecar/dist/constants/audit.js.map +1 -1
- package/sidecar/dist/constants/chatgpt.d.ts +7 -7
- package/sidecar/dist/constants/chatgpt.js +6 -6
- package/sidecar/dist/constants/chatgpt.js.map +1 -1
- package/sidecar/dist/constants/checkpoints.d.ts +2 -2
- package/sidecar/dist/constants/checkpoints.js +2 -2
- package/sidecar/dist/constants/checkpoints.js.map +1 -1
- package/sidecar/dist/constants/codex.d.ts +9 -9
- package/sidecar/dist/constants/codex.js +8 -8
- package/sidecar/dist/constants/codex.js.map +1 -1
- package/sidecar/dist/constants/daemon.d.ts +2 -2
- package/sidecar/dist/constants/daemon.js +2 -2
- package/sidecar/dist/constants/daemon.js.map +1 -1
- package/sidecar/dist/constants/env.d.ts +1 -1
- package/sidecar/dist/constants/env.js +1 -1
- package/sidecar/dist/constants/env.js.map +1 -1
- package/sidecar/dist/constants/mcp.d.ts +4 -4
- package/sidecar/dist/constants/mcp.js +2 -2
- package/sidecar/dist/constants/mcp.js.map +1 -1
- package/sidecar/dist/constants/paths.d.ts +1 -1
- package/sidecar/dist/constants/paths.js +5 -1
- package/sidecar/dist/constants/paths.js.map +1 -1
- package/sidecar/dist/constants/preview.d.ts +2 -2
- package/sidecar/dist/constants/preview.js +2 -17
- package/sidecar/dist/constants/preview.js.map +1 -1
- package/sidecar/dist/constants/providers.d.ts +2 -2
- package/sidecar/dist/constants/providers.js +2 -2
- package/sidecar/dist/constants/providers.js.map +1 -1
- package/sidecar/dist/constants/settings.d.ts +1 -1
- package/sidecar/dist/constants/settings.js +1 -1
- package/sidecar/dist/constants/settings.js.map +1 -1
- package/sidecar/dist/constants/skills.d.ts +1 -1
- package/sidecar/dist/constants/skills.js +1 -1
- package/sidecar/dist/constants/skills.js.map +1 -1
- package/sidecar/dist/constants/state.d.ts +2 -1
- package/sidecar/dist/constants/state.js +2 -1
- package/sidecar/dist/constants/state.js.map +1 -1
- package/sidecar/dist/constants/tool-titles.d.ts +0 -40
- package/sidecar/dist/constants/tool-titles.js +0 -42
- package/sidecar/dist/constants/tool-titles.js.map +1 -1
- package/sidecar/dist/index.js +5 -6
- package/sidecar/dist/index.js.map +1 -1
- package/sidecar/dist/mcp/tools/preview-blocks.js +24 -19
- package/sidecar/dist/mcp/tools/preview-blocks.js.map +1 -1
- package/sidecar/dist/mcp/types.d.ts +1 -1
- package/sidecar/dist/prompts/agent.js +1 -1
- package/sidecar/dist/prompts/agent.js.map +1 -1
- package/sidecar/dist/protocol/events.d.ts +10 -28
- package/sidecar/dist/protocol/events.js +7 -5
- package/sidecar/dist/protocol/events.js.map +1 -1
- package/sidecar/dist/protocol/preview.js +1 -1
- package/sidecar/dist/protocol/preview.js.map +1 -1
- package/sidecar/dist/providers/codex/permission-profiles.d.ts +1 -1
- package/sidecar/dist/providers/codex/permission-profiles.js +1 -1
- package/sidecar/dist/providers/codex/permission-profiles.js.map +1 -1
- package/sidecar/dist/server/chat-socket-registry.d.ts +1 -0
- package/sidecar/dist/server/chat-socket-registry.js +14 -0
- package/sidecar/dist/server/chat-socket-registry.js.map +1 -1
- package/sidecar/dist/server/host-command-router.d.ts +9 -2
- package/sidecar/dist/server/host-command-router.js +5 -2
- package/sidecar/dist/server/host-command-router.js.map +1 -1
- package/sidecar/dist/server/host-page.d.ts +3 -0
- package/sidecar/dist/server/host-page.js +5 -0
- package/sidecar/dist/server/host-page.js.map +1 -0
- package/sidecar/dist/server/host-socket-registry.d.ts +1 -1
- package/sidecar/dist/server/host-socket-registry.js +6 -6
- package/sidecar/dist/server/host-socket-registry.js.map +1 -1
- package/sidecar/dist/server/routing.js +62 -20
- package/sidecar/dist/server/routing.js.map +1 -1
- package/sidecar/dist/server/turns.js +11 -3
- package/sidecar/dist/server/turns.js.map +1 -1
- package/sidecar/dist/server/ws.js +10 -2
- package/sidecar/dist/server/ws.js.map +1 -1
- package/sidecar/dist/skills/plugin-wrapper.js +1 -1
- package/sidecar/dist/skills/plugin-wrapper.js.map +1 -1
- package/sidecar/dist/state/conversations.d.ts +3 -1
- package/sidecar/dist/state/conversations.js +54 -3
- package/sidecar/dist/state/conversations.js.map +1 -1
- package/sidecar/dist/state/host-state.d.ts +2 -2
- package/sidecar/dist/state/host-state.js +6 -6
- package/sidecar/dist/state/host-state.js.map +1 -1
- package/sidecar/dist/state/settings-store.js +1 -14
- package/sidecar/dist/state/settings-store.js.map +1 -1
- package/sidecar/dist/state/store.d.ts +1 -0
- package/sidecar/dist/state/store.js +16 -9
- package/sidecar/dist/state/store.js.map +1 -1
- package/sidecar/dist/state/stored-schemas.js +0 -4
- package/sidecar/dist/state/stored-schemas.js.map +1 -1
- package/sidecar/dist/state/types.d.ts +2 -5
- package/sidecar/dist/state/types.js.map +1 -1
- package/sidecar/package.json +3 -2
- package/skills/{dms-ai → dms-assistant}/SKILL.md +6 -6
- package/skills/{dms-ai → dms-assistant}/cases.json +13 -13
- package/skills/{dms-ai-code-mode → dms-assistant-code-mode}/SKILL.md +7 -7
- package/skills/{dms-ai-code-mode → dms-assistant-code-mode}/cases.json +11 -11
- package/dist/lifecycle/builder-settings-move.d.ts +0 -1
- package/dist/lifecycle/builder-settings-move.js +0 -182
- package/dist/lifecycle/builder-settings-move.js.map +0 -1
- package/dist/lifecycle/builder-settings-plan.d.ts +0 -59
- package/dist/lifecycle/builder-settings-plan.js +0 -176
- package/dist/lifecycle/builder-settings-plan.js.map +0 -1
- package/dist/lifecycle/builder-settings-text.d.ts +0 -19
- package/dist/lifecycle/builder-settings-text.js +0 -82
- package/dist/lifecycle/builder-settings-text.js.map +0 -1
- package/dist/lifecycle/entry-verdict.d.ts +0 -15
- package/dist/lifecycle/entry-verdict.js +0 -30
- package/dist/lifecycle/entry-verdict.js.map +0 -1
- package/dist/lifecycle/environment-bindings.d.ts +0 -8
- package/dist/lifecycle/environment-bindings.js +0 -154
- package/dist/lifecycle/environment-bindings.js.map +0 -1
- package/dist/lifecycle/legacy-entries.d.ts +0 -8
- package/dist/lifecycle/legacy-entries.js +0 -126
- package/dist/lifecycle/legacy-entries.js.map +0 -1
- package/sidecar/dist/mcp/sketch-refusals.d.ts +0 -2
- package/sidecar/dist/mcp/sketch-refusals.js +0 -6
- package/sidecar/dist/mcp/sketch-refusals.js.map +0 -1
- package/sidecar/dist/state/legacy-tool-names.d.ts +0 -3
- package/sidecar/dist/state/legacy-tool-names.js +0 -34
- package/sidecar/dist/state/legacy-tool-names.js.map +0 -1
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
|
-
import { mount, type VueWrapper } from "@vue/test-utils";
|
|
3
2
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { defineComponent } from "vue";
|
|
5
3
|
import {
|
|
6
4
|
CONNECTABLE_ENGINES,
|
|
7
5
|
connectForm,
|
|
8
|
-
type DatabaseConnect,
|
|
9
6
|
engineNames,
|
|
10
|
-
useDatabaseConnect,
|
|
11
7
|
} from "../app/onboarding/connect-database";
|
|
12
8
|
import { ENGINES } from "../builder/app/runtime/database-connect";
|
|
13
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
analysisWith,
|
|
11
|
+
fakeBuilder,
|
|
12
|
+
LISTED,
|
|
13
|
+
mountConnect,
|
|
14
|
+
PROJECT,
|
|
15
|
+
schemaCheck,
|
|
16
|
+
unmountConnect,
|
|
17
|
+
URL,
|
|
18
|
+
WRITER,
|
|
19
|
+
} from "./support/database-connect";
|
|
14
20
|
|
|
15
21
|
vi.mock("../builder/app/runtime/i18n", async (importOriginal) => ({
|
|
16
22
|
...(await importOriginal<Record<string, unknown>>()),
|
|
@@ -18,38 +24,6 @@ vi.mock("../builder/app/runtime/i18n", async (importOriginal) => ({
|
|
|
18
24
|
params === undefined ? key : `${key} ${JSON.stringify(params)}`,
|
|
19
25
|
}));
|
|
20
26
|
|
|
21
|
-
const URL = "postgres://app:secret@db.example.com/shop";
|
|
22
|
-
|
|
23
|
-
const LISTED = {
|
|
24
|
-
id: "shop",
|
|
25
|
-
engine: "postgresql",
|
|
26
|
-
version: "16",
|
|
27
|
-
database: "shop",
|
|
28
|
-
role: "reader",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const READER = {
|
|
32
|
-
reachable: true,
|
|
33
|
-
latencyMs: 4,
|
|
34
|
-
user: "reader",
|
|
35
|
-
canRead: true,
|
|
36
|
-
canWrite: false,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const WRITER = { ...READER, user: "owner", canWrite: true };
|
|
40
|
-
|
|
41
|
-
const PROJECT = {
|
|
42
|
-
modules: [] as string[],
|
|
43
|
-
self: "dms",
|
|
44
|
-
databasePins: [],
|
|
45
|
-
dmsDatabase: "dms-database",
|
|
46
|
-
ownDatabase: "mongodb",
|
|
47
|
-
interfaceDatabase: "0.3.4",
|
|
48
|
-
drivers: {
|
|
49
|
-
postgres: { package: "@antelopejs/postgres", version: ">=0.2.6 <0.4.0" },
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
27
|
const SCHEMAS_QUESTION = {
|
|
54
28
|
id: "schemas:shop",
|
|
55
29
|
kind: "schemas",
|
|
@@ -61,91 +35,13 @@ const SCHEMAS_QUESTION = {
|
|
|
61
35
|
proposed: null,
|
|
62
36
|
};
|
|
63
37
|
|
|
64
|
-
function analysisWith(open: unknown[]) {
|
|
65
|
-
return {
|
|
66
|
-
id: "job1",
|
|
67
|
-
status: "done",
|
|
68
|
-
progress: {},
|
|
69
|
-
proposal: {
|
|
70
|
-
connection: "shop",
|
|
71
|
-
module: "m",
|
|
72
|
-
database: { engine: "postgresql", role: "reader", writes: "none" },
|
|
73
|
-
resources: [],
|
|
74
|
-
excluded: [],
|
|
75
|
-
open,
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function fakeBuilder(overrides: Record<string, unknown> = {}) {
|
|
81
|
-
let analysis: unknown = null;
|
|
82
|
-
const analyseDatabase = vi.fn(
|
|
83
|
-
async (_connection: string, _module: string, _schemas?: string[]) => ({
|
|
84
|
-
ok: true,
|
|
85
|
-
data: {},
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
const configureProject = vi.fn(
|
|
89
|
-
async (
|
|
90
|
-
_steps: ProjectConfigStep[],
|
|
91
|
-
_dryRun: boolean,
|
|
92
|
-
_variables?: unknown,
|
|
93
|
-
) => ({
|
|
94
|
-
ok: true,
|
|
95
|
-
}),
|
|
96
|
-
);
|
|
97
|
-
const api = {
|
|
98
|
-
checkConnection: vi.fn(async () => READER),
|
|
99
|
-
projectModules: async () => PROJECT,
|
|
100
|
-
configureProject,
|
|
101
|
-
failure: (error: unknown) => ({
|
|
102
|
-
detail: error instanceof Error ? error.message : String(error),
|
|
103
|
-
}),
|
|
104
|
-
databaseConnection: async () => ({ wiring: { variable: "SHOP_URL" } }),
|
|
105
|
-
databaseConnections: async () => [LISTED],
|
|
106
|
-
latestAnalysis: async () =>
|
|
107
|
-
analysis === null ? { ok: false } : { ok: true, data: analysis },
|
|
108
|
-
analyseDatabase,
|
|
109
|
-
...overrides,
|
|
110
|
-
};
|
|
111
|
-
return {
|
|
112
|
-
api,
|
|
113
|
-
analyseDatabase,
|
|
114
|
-
configureProject,
|
|
115
|
-
setAnalysis: (next: unknown) => {
|
|
116
|
-
analysis = next;
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let wrapper: VueWrapper | undefined;
|
|
122
|
-
|
|
123
|
-
function mountConnect(api: unknown): DatabaseConnect {
|
|
124
|
-
let connect: DatabaseConnect | undefined;
|
|
125
|
-
wrapper = mount(
|
|
126
|
-
defineComponent({
|
|
127
|
-
setup() {
|
|
128
|
-
connect = useDatabaseConnect(api as never);
|
|
129
|
-
return () => null;
|
|
130
|
-
},
|
|
131
|
-
}),
|
|
132
|
-
);
|
|
133
|
-
if (connect === undefined) throw new Error("the host did not set up");
|
|
134
|
-
return connect;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function schemaCheck(connect: DatabaseConnect) {
|
|
138
|
-
return connect.checks.value.find((check) => check.key === "schema");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
38
|
function dmsDatabaseConfig(fake: ReturnType<typeof fakeBuilder>) {
|
|
142
39
|
const steps = fake.configureProject.mock.calls[0]?.[0] ?? [];
|
|
143
40
|
return steps.find((step) => step.id === "dms-database")?.entry?.config;
|
|
144
41
|
}
|
|
145
42
|
|
|
146
43
|
afterEach(() => {
|
|
147
|
-
|
|
148
|
-
wrapper = undefined;
|
|
44
|
+
unmountConnect();
|
|
149
45
|
vi.useRealTimers();
|
|
150
46
|
});
|
|
151
47
|
|
|
@@ -595,8 +491,7 @@ describe("an attempt the owner replaced", () => {
|
|
|
595
491
|
const connect = mountConnect(fake.api);
|
|
596
492
|
const run = connect.connect("postgres", URL);
|
|
597
493
|
await vi.waitFor(() => expect(reads).toBe(1));
|
|
598
|
-
|
|
599
|
-
wrapper = undefined;
|
|
494
|
+
unmountConnect();
|
|
600
495
|
answer.resolve({ ok: false });
|
|
601
496
|
await run;
|
|
602
497
|
expect(fake.analyseDatabase).not.toHaveBeenCalled();
|
|
@@ -56,9 +56,9 @@ describe("the assistant's registrations in the dashboard", () => {
|
|
|
56
56
|
const { t } = createTestI18n();
|
|
57
57
|
const panel = assistantSidePanel();
|
|
58
58
|
expect(panel).toMatchObject({
|
|
59
|
-
id: "dms-
|
|
60
|
-
component: "
|
|
61
|
-
ariaLabel: "$
|
|
59
|
+
id: "dms-assistant:assistant",
|
|
60
|
+
component: "DmsAssistantChatPanel",
|
|
61
|
+
ariaLabel: "$dms_assistant.panel.launcher",
|
|
62
62
|
});
|
|
63
63
|
expect(panel.minWidth).toBeLessThan(panel.defaultWidth);
|
|
64
64
|
expect(panel.defaultWidth).toBeLessThan(panel.maxWidth);
|
|
@@ -73,7 +73,7 @@ describe("the assistant's registrations in the dashboard", () => {
|
|
|
73
73
|
const connected = launcherAction(t, "connected");
|
|
74
74
|
expect(connected).toMatchObject({
|
|
75
75
|
icon: "i-ph-sparkle",
|
|
76
|
-
iconComponent: "
|
|
76
|
+
iconComponent: "DmsAssistantLauncherIcon",
|
|
77
77
|
});
|
|
78
78
|
expect(connected.label).toMatch(/^Assistant \(.+K\)$/);
|
|
79
79
|
const labels = (
|
|
@@ -96,10 +96,10 @@ describe("the assistant's registrations in the dashboard", () => {
|
|
|
96
96
|
});
|
|
97
97
|
const assistant = paletteAssistant(t, page);
|
|
98
98
|
expect(assistant).toMatchObject({
|
|
99
|
-
id: "dms-
|
|
100
|
-
answerComponent: "
|
|
101
|
-
label: "$
|
|
102
|
-
placeholder: "$
|
|
99
|
+
id: "dms-assistant:assistant",
|
|
100
|
+
answerComponent: "DmsAssistantPaletteAnswer",
|
|
101
|
+
label: "$dms_assistant.panel.palette.assistant",
|
|
102
|
+
placeholder: "$dms_assistant.panel.palette.placeholder",
|
|
103
103
|
});
|
|
104
104
|
expect(assistant.suggestions().map((item) => item.label)).toEqual([
|
|
105
105
|
"Explain what Sales overview shows",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
3
|
+
import { nextTick } from "vue";
|
|
4
|
+
import {
|
|
5
|
+
CONVERSATION_ID,
|
|
6
|
+
createHarness,
|
|
7
|
+
deliver,
|
|
8
|
+
openPanel,
|
|
9
|
+
unmountPanel,
|
|
10
|
+
} from "./support/panel-harness";
|
|
11
|
+
|
|
12
|
+
const STORAGE_KEY = "dms-assistant-conversation-id";
|
|
13
|
+
const DELETED_NOTICE =
|
|
14
|
+
"This conversation was deleted. Start a new conversation.";
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
localStorage.setItem(STORAGE_KEY, CONVERSATION_ID);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
unmountPanel();
|
|
22
|
+
localStorage.clear();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("a chat panel whose conversation is closed", () => {
|
|
26
|
+
it("starts a new conversation and says why (fails a panel that stays on the closed one)", async () => {
|
|
27
|
+
const harness = createHarness();
|
|
28
|
+
const panel = await openPanel(harness);
|
|
29
|
+
deliver(harness, {
|
|
30
|
+
type: "conversation_closed",
|
|
31
|
+
conversationId: CONVERSATION_ID,
|
|
32
|
+
message: DELETED_NOTICE,
|
|
33
|
+
});
|
|
34
|
+
await nextTick();
|
|
35
|
+
const current = localStorage.getItem(STORAGE_KEY);
|
|
36
|
+
expect(current).not.toBe(CONVERSATION_ID);
|
|
37
|
+
expect(current).not.toBe("");
|
|
38
|
+
expect(panel.text()).toContain(DELETED_NOTICE);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("ignores a notice about another conversation (fails a panel that leaves on any closed id)", async () => {
|
|
42
|
+
const harness = createHarness();
|
|
43
|
+
const panel = await openPanel(harness);
|
|
44
|
+
deliver(harness, {
|
|
45
|
+
type: "conversation_closed",
|
|
46
|
+
conversationId: "conv-elsewhere",
|
|
47
|
+
message: DELETED_NOTICE,
|
|
48
|
+
});
|
|
49
|
+
await nextTick();
|
|
50
|
+
expect(localStorage.getItem(STORAGE_KEY)).toBe(CONVERSATION_ID);
|
|
51
|
+
expect(panel.text()).not.toContain(DELETED_NOTICE);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -33,7 +33,7 @@ function dispatch(detail: unknown): CustomEvent {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
beforeEach(() => {
|
|
36
|
-
localStorage.setItem("dms-
|
|
36
|
+
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
afterEach(() => {
|
|
@@ -225,7 +225,7 @@ describe("building a mockup", () => {
|
|
|
225
225
|
conversationId,
|
|
226
226
|
type: "tool_call_start",
|
|
227
227
|
callId: "c0",
|
|
228
|
-
toolName: "mcp__dms-
|
|
228
|
+
toolName: "mcp__dms-assistant__builder_create_page",
|
|
229
229
|
args: { name: "rentals", displayName: "Rentals", category: "shop" },
|
|
230
230
|
});
|
|
231
231
|
await nextTick();
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./support/panel-harness";
|
|
12
12
|
|
|
13
13
|
beforeEach(() => {
|
|
14
|
-
localStorage.setItem("dms-
|
|
14
|
+
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
afterEach(() => {
|
|
@@ -110,21 +110,6 @@ describe("the approval mode pill", () => {
|
|
|
110
110
|
},
|
|
111
111
|
);
|
|
112
112
|
|
|
113
|
-
it("keeps the pill on the chat's own mode when an older sidecar still sends Full auto", async () => {
|
|
114
|
-
const harness = createHarness();
|
|
115
|
-
const panel = await openPanel(harness);
|
|
116
|
-
await useProvider(harness, "claude");
|
|
117
|
-
deliver(harness, {
|
|
118
|
-
type: "conversation_mode",
|
|
119
|
-
mode: "auto",
|
|
120
|
-
generationMode: "safe",
|
|
121
|
-
fullAuto: { duration: "chat" },
|
|
122
|
-
});
|
|
123
|
-
await nextTick();
|
|
124
|
-
expect(modePill(panel).text()).toBe("Auto review");
|
|
125
|
-
expect(panel.find(".cb-banner-auto").exists()).toBe(false);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
113
|
it("says Auto review is not available, naming the model", async () => {
|
|
129
114
|
const harness = createHarness();
|
|
130
115
|
const panel = await openPanel(harness);
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { keydown } from "./support/panel-fixtures";
|
|
15
15
|
|
|
16
16
|
beforeEach(() => {
|
|
17
|
-
localStorage.setItem("dms-
|
|
17
|
+
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
afterEach(() => {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { DIFF_REQUEST, keydown } from "./support/panel-fixtures";
|
|
16
16
|
|
|
17
17
|
beforeEach(() => {
|
|
18
|
-
localStorage.setItem("dms-
|
|
18
|
+
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
afterEach(() => {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { CHANGE_SET, DIFF_REQUEST } from "./support/panel-fixtures";
|
|
16
16
|
|
|
17
17
|
beforeEach(() => {
|
|
18
|
-
localStorage.setItem("dms-
|
|
18
|
+
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
afterEach(() => {
|
|
@@ -134,7 +134,7 @@ describe("tool rows and change sets", () => {
|
|
|
134
134
|
deliver(harness, {
|
|
135
135
|
type: "tool_call_start",
|
|
136
136
|
callId: "c0",
|
|
137
|
-
toolName: "mcp__dms-
|
|
137
|
+
toolName: "mcp__dms-assistant__builder_add_block",
|
|
138
138
|
args: { name: "Top customers", type: "TopListCard" },
|
|
139
139
|
});
|
|
140
140
|
deliver(harness, {
|
|
@@ -75,7 +75,7 @@ it("withdraws the docked panel when the first probe finds no assistant", async (
|
|
|
75
75
|
await harness.run();
|
|
76
76
|
await vi.waitFor(() =>
|
|
77
77
|
expect(harness.unregisterSidePanel).toHaveBeenCalledWith(
|
|
78
|
-
"dms-
|
|
78
|
+
"dms-assistant:assistant",
|
|
79
79
|
),
|
|
80
80
|
);
|
|
81
81
|
});
|
|
@@ -10,8 +10,10 @@ export function installApiErrorPresenter() {
|
|
|
10
10
|
const messages: Record<string, string> = {
|
|
11
11
|
"error.read_only_demo": "This demo is read-only.",
|
|
12
12
|
"error.500.description": "Something went wrong.",
|
|
13
|
-
"
|
|
14
|
-
|
|
13
|
+
"dms_assistant.views.error.description":
|
|
14
|
+
"Could not load the assistant's data.",
|
|
15
|
+
"dms_assistant.views.unavailable.description":
|
|
16
|
+
"The assistant is not running.",
|
|
15
17
|
};
|
|
16
18
|
vi.stubGlobal("useToast", () => ({ add }));
|
|
17
19
|
vi.stubGlobal("getPluginI18n", () => ({
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { mount, type VueWrapper } from "@vue/test-utils";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import { defineComponent } from "vue";
|
|
4
|
+
import {
|
|
5
|
+
type DatabaseConnect,
|
|
6
|
+
useDatabaseConnect,
|
|
7
|
+
} from "../../app/onboarding/connect-database";
|
|
8
|
+
import type { ConnectMemory } from "../../app/onboarding/connect-memory";
|
|
9
|
+
import type { ProjectConfigStep } from "../../builder/app/runtime/database-types";
|
|
10
|
+
import { memoryConnects } from "./onboarding";
|
|
11
|
+
|
|
12
|
+
export const URL = "postgres://app:secret@db.example.com/shop";
|
|
13
|
+
|
|
14
|
+
export const LISTED = {
|
|
15
|
+
id: "shop",
|
|
16
|
+
engine: "postgresql",
|
|
17
|
+
version: "16",
|
|
18
|
+
database: "shop",
|
|
19
|
+
role: "reader",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const READER = {
|
|
23
|
+
reachable: true,
|
|
24
|
+
latencyMs: 4,
|
|
25
|
+
user: "reader",
|
|
26
|
+
canRead: true,
|
|
27
|
+
canWrite: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WRITER = { ...READER, user: "owner", canWrite: true };
|
|
31
|
+
|
|
32
|
+
export const PROJECT = {
|
|
33
|
+
modules: [] as string[],
|
|
34
|
+
self: "dms",
|
|
35
|
+
databasePins: [],
|
|
36
|
+
dmsDatabase: "dms-database",
|
|
37
|
+
ownDatabase: "mongodb",
|
|
38
|
+
interfaceDatabase: "0.3.4",
|
|
39
|
+
drivers: {
|
|
40
|
+
postgres: { package: "@antelopejs/postgres", version: ">=0.2.6 <0.4.0" },
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function analysisWith(open: unknown[]) {
|
|
45
|
+
return {
|
|
46
|
+
id: "job1",
|
|
47
|
+
status: "done",
|
|
48
|
+
progress: {},
|
|
49
|
+
proposal: {
|
|
50
|
+
connection: "shop",
|
|
51
|
+
module: "m",
|
|
52
|
+
database: { engine: "postgresql", role: "reader", writes: "none" },
|
|
53
|
+
resources: [],
|
|
54
|
+
excluded: [],
|
|
55
|
+
open,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function fakeBuilder(overrides: Record<string, unknown> = {}) {
|
|
61
|
+
let analysis: unknown = null;
|
|
62
|
+
const analyseDatabase = vi.fn(
|
|
63
|
+
async (_connection: string, _module: string, _schemas?: string[]) => ({
|
|
64
|
+
ok: true,
|
|
65
|
+
data: {},
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
const configureProject = vi.fn(
|
|
69
|
+
async (
|
|
70
|
+
_steps: ProjectConfigStep[],
|
|
71
|
+
_dryRun: boolean,
|
|
72
|
+
_variables?: unknown,
|
|
73
|
+
) => ({
|
|
74
|
+
ok: true,
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
const api = {
|
|
78
|
+
checkConnection: vi.fn(async () => READER),
|
|
79
|
+
projectModules: async () => PROJECT,
|
|
80
|
+
configureProject,
|
|
81
|
+
failure: (error: unknown) => ({
|
|
82
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
83
|
+
}),
|
|
84
|
+
databaseConnection: async () => ({ wiring: { variable: "SHOP_URL" } }),
|
|
85
|
+
databaseConnections: async () => [LISTED],
|
|
86
|
+
latestAnalysis: async () =>
|
|
87
|
+
analysis === null ? { ok: false } : { ok: true, data: analysis },
|
|
88
|
+
analyseDatabase,
|
|
89
|
+
reloadDue: async () => ({ due: false }),
|
|
90
|
+
...overrides,
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
api,
|
|
94
|
+
analyseDatabase,
|
|
95
|
+
configureProject,
|
|
96
|
+
setAnalysis: (next: unknown) => {
|
|
97
|
+
analysis = next;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let wrapper: VueWrapper | undefined;
|
|
103
|
+
|
|
104
|
+
export function mountConnect(
|
|
105
|
+
api: unknown,
|
|
106
|
+
memory: ConnectMemory = memoryConnects(),
|
|
107
|
+
): DatabaseConnect {
|
|
108
|
+
let connect: DatabaseConnect | undefined;
|
|
109
|
+
wrapper = mount(
|
|
110
|
+
defineComponent({
|
|
111
|
+
setup() {
|
|
112
|
+
connect = useDatabaseConnect(api as never, memory);
|
|
113
|
+
return () => null;
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
if (connect === undefined) throw new Error("the host did not set up");
|
|
118
|
+
return connect;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function schemaCheck(connect: DatabaseConnect) {
|
|
122
|
+
return connect.checks.value.find((check) => check.key === "schema");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Unmounts the host of the last `mountConnect`, as a closed popup or a reload of the page does. */
|
|
126
|
+
export function unmountConnect(): void {
|
|
127
|
+
wrapper?.unmount();
|
|
128
|
+
wrapper = undefined;
|
|
129
|
+
}
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
ChatI18n,
|
|
4
4
|
TranslateParams,
|
|
5
5
|
} from "../../app/chat/composables/useChatI18n";
|
|
6
|
-
import en from "../../i18n/locales/dms-
|
|
6
|
+
import en from "../../i18n/locales/dms-assistant-panel-en-GB.json";
|
|
7
7
|
|
|
8
8
|
type Messages = Record<string, unknown>;
|
|
9
9
|
|
|
@@ -3,6 +3,11 @@ import { shallowRef } from "vue";
|
|
|
3
3
|
import { CHAT_I18N_KEY } from "../../app/chat/composables/useChatI18n";
|
|
4
4
|
import type { OnboardingApi } from "../../app/onboarding/api";
|
|
5
5
|
import { NO_CONTENT, type ProjectContent } from "../../app/onboarding/content";
|
|
6
|
+
import {
|
|
7
|
+
type ConnectMemory,
|
|
8
|
+
connectMemory,
|
|
9
|
+
type WrittenConnection,
|
|
10
|
+
} from "../../app/onboarding/connect-memory";
|
|
6
11
|
import type {
|
|
7
12
|
OnboardingState,
|
|
8
13
|
ProviderLogin,
|
|
@@ -16,7 +21,7 @@ import type {
|
|
|
16
21
|
PreferenceStore,
|
|
17
22
|
} from "../../app/onboarding/preferences";
|
|
18
23
|
import { ONBOARDING_CONTROLLER_KEY } from "../../app/onboarding/runtime";
|
|
19
|
-
import views from "../../i18n/locales/dms-
|
|
24
|
+
import views from "../../i18n/locales/dms-assistant-views-en-GB.json";
|
|
20
25
|
import { createTestI18n } from "./i18n";
|
|
21
26
|
import { OnboardingModal } from "./stand-ins/OnboardingModal";
|
|
22
27
|
import { UCheckbox } from "./stand-ins/UCheckbox";
|
|
@@ -58,6 +63,27 @@ export function memoryPreferences(
|
|
|
58
63
|
return store;
|
|
59
64
|
}
|
|
60
65
|
|
|
66
|
+
/** The tab's connect memory over a map, as `sessionStorage` keeps it across a reload of the tab. */
|
|
67
|
+
export function memoryConnects(
|
|
68
|
+
initial: WrittenConnection | null = null,
|
|
69
|
+
): ConnectMemory {
|
|
70
|
+
const items = new Map<string, string>();
|
|
71
|
+
const memory = connectMemory(
|
|
72
|
+
() => ({
|
|
73
|
+
getItem: (key) => items.get(key) ?? null,
|
|
74
|
+
setItem: (key, value) => {
|
|
75
|
+
items.set(key, value);
|
|
76
|
+
},
|
|
77
|
+
removeItem: (key) => {
|
|
78
|
+
items.delete(key);
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
() => "owner-1",
|
|
82
|
+
);
|
|
83
|
+
if (initial !== null) memory.write(memory.begin(), initial);
|
|
84
|
+
return memory;
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
export interface OnboardingHarness {
|
|
62
88
|
controller: OnboardingController;
|
|
63
89
|
api: {
|
|
@@ -87,6 +113,7 @@ export interface HarnessOptions {
|
|
|
87
113
|
content?: ProjectContent;
|
|
88
114
|
preferences?: PreferenceStore;
|
|
89
115
|
canConnectDatabase?: boolean;
|
|
116
|
+
connecting?: ConnectMemory;
|
|
90
117
|
}
|
|
91
118
|
|
|
92
119
|
/** A controller over a backend that answers `state` until a test says otherwise. */
|
|
@@ -121,6 +148,7 @@ export function createOnboardingHarness(
|
|
|
121
148
|
readContent: async () => content,
|
|
122
149
|
preferences: options.preferences ?? memoryPreferences(),
|
|
123
150
|
canConnectDatabase: options.canConnectDatabase ?? true,
|
|
151
|
+
connecting: options.connecting ?? memoryConnects(),
|
|
124
152
|
openTab,
|
|
125
153
|
});
|
|
126
154
|
return {
|
|
@@ -346,7 +346,7 @@ describe("changes view", () => {
|
|
|
346
346
|
.findAllComponents({ name: "UButton" })
|
|
347
347
|
.find(
|
|
348
348
|
(button) =>
|
|
349
|
-
button.vm.$attrs.label === "
|
|
349
|
+
button.vm.$attrs.label === "dms_assistant.views.common.load_more",
|
|
350
350
|
);
|
|
351
351
|
loadMoreButton()!.vm.$emit("click");
|
|
352
352
|
await flushPromises();
|
|
@@ -402,7 +402,10 @@ describe("change set panel", () => {
|
|
|
402
402
|
expect(reads).toEqual([{ url: "/ai/changes/cs-1" }]);
|
|
403
403
|
const redo = wrapper
|
|
404
404
|
.findAllComponents({ name: "UButton" })
|
|
405
|
-
.find(
|
|
405
|
+
.find(
|
|
406
|
+
(button) =>
|
|
407
|
+
button.vm.$attrs.label === "dms_assistant.views.changes.redo",
|
|
408
|
+
);
|
|
406
409
|
redo!.vm.$emit("click");
|
|
407
410
|
await flushPromises();
|
|
408
411
|
expect(authFetch).toHaveBeenCalledWith("/ai/changes/cs-1/redo", {
|
|
@@ -434,7 +437,8 @@ describe("change set actions", () => {
|
|
|
434
437
|
wrapper
|
|
435
438
|
.findAllComponents({ name: "UButton" })
|
|
436
439
|
.find(
|
|
437
|
-
(button) =>
|
|
440
|
+
(button) =>
|
|
441
|
+
button.vm.$attrs.label === "dms_assistant.views.changes.redo",
|
|
438
442
|
)!;
|
|
439
443
|
redo().vm.$emit("click");
|
|
440
444
|
await flushPromises();
|
|
@@ -122,7 +122,9 @@ describe("DiffView", () => {
|
|
|
122
122
|
|
|
123
123
|
it("marks a new file and derives its counts from the hunks", () => {
|
|
124
124
|
const wrapper = mountDiff([NEW_FILE]);
|
|
125
|
-
expect(wrapper.get("[data-pill]").text()).toBe(
|
|
125
|
+
expect(wrapper.get("[data-pill]").text()).toBe(
|
|
126
|
+
"dms_assistant.views.diff.new",
|
|
127
|
+
);
|
|
126
128
|
expect(wrapper.get("header").text()).toContain("+1");
|
|
127
129
|
});
|
|
128
130
|
|
|
@@ -159,7 +161,7 @@ describe("DiffView", () => {
|
|
|
159
161
|
isBinary: true,
|
|
160
162
|
},
|
|
161
163
|
]);
|
|
162
|
-
expect(wrapper.text()).toContain("
|
|
164
|
+
expect(wrapper.text()).toContain("dms_assistant.views.diff.binary");
|
|
163
165
|
expect(wrapper.findAll("[data-line-kind]")).toHaveLength(0);
|
|
164
166
|
});
|
|
165
167
|
});
|