@antelopejs/dms-assistant 0.2.7-next.444.g0da96b6 → 0.2.7
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/package.json +6 -2
- package/frontend-vue/builder/tests/database-build.test.ts +0 -232
- package/frontend-vue/builder/tests/database-connect.test.ts +0 -348
- package/frontend-vue/builder/tests/database-display.test.ts +0 -112
- package/frontend-vue/builder/tests/database.test.ts +0 -138
- package/frontend-vue/builder/tests/enabled.test.ts +0 -17
- package/frontend-vue/builder/tests/owner-ui.test.ts +0 -29
- package/frontend-vue/builder/tests/stubs/frontend-module.ts +0 -63
- package/frontend-vue/builder/vitest.config.ts +0 -21
- package/frontend-vue/tests/assistant-actions.test.ts +0 -109
- package/frontend-vue/tests/assistant-activity.test.ts +0 -281
- package/frontend-vue/tests/backend-boundary.test.ts +0 -130
- package/frontend-vue/tests/backoff.test.ts +0 -40
- package/frontend-vue/tests/block-health.test.ts +0 -142
- package/frontend-vue/tests/channel-client.test.ts +0 -246
- package/frontend-vue/tests/chat/block-preview.test.ts +0 -367
- package/frontend-vue/tests/chat/block-target.test.ts +0 -133
- package/frontend-vue/tests/chat/build-view.test.ts +0 -171
- package/frontend-vue/tests/chat/chat-scroll.test.ts +0 -251
- package/frontend-vue/tests/chat/conversation-events.test.ts +0 -622
- package/frontend-vue/tests/chat/diff-and-keys.test.ts +0 -178
- package/frontend-vue/tests/chat/held-card.test.ts +0 -133
- package/frontend-vue/tests/chat/markdown-content.test.ts +0 -86
- package/frontend-vue/tests/chat/markdown.test.ts +0 -352
- package/frontend-vue/tests/chat/provider-notice.test.ts +0 -33
- package/frontend-vue/tests/chat/tool-lexicon.test.ts +0 -212
- package/frontend-vue/tests/chat/useChatChannel.test.ts +0 -124
- package/frontend-vue/tests/chat/useConversation.test.ts +0 -288
- package/frontend-vue/tests/chat-panel.test.ts +0 -300
- package/frontend-vue/tests/chat-transport.test.ts +0 -94
- package/frontend-vue/tests/embedding.test.ts +0 -10
- package/frontend-vue/tests/formal/connection-analysis-scenarios.ts +0 -130
- package/frontend-vue/tests/formal/connection-analysis-world.ts +0 -497
- package/frontend-vue/tests/formal/connection-analysis.test.ts +0 -36
- package/frontend-vue/tests/host-commands.test.ts +0 -182
- package/frontend-vue/tests/launcher-icon.test.ts +0 -62
- package/frontend-vue/tests/launcher-label.test.ts +0 -40
- package/frontend-vue/tests/launcher-state.test.ts +0 -215
- package/frontend-vue/tests/mockup-fold.test.ts +0 -95
- package/frontend-vue/tests/navigation.test.ts +0 -142
- package/frontend-vue/tests/onboarding-api.test.ts +0 -29
- package/frontend-vue/tests/onboarding-claude.test.ts +0 -144
- package/frontend-vue/tests/onboarding-connect-memory.test.ts +0 -126
- package/frontend-vue/tests/onboarding-controller-restart.test.ts +0 -134
- package/frontend-vue/tests/onboarding-controller.test.ts +0 -307
- package/frontend-vue/tests/onboarding-database-driver-install.test.ts +0 -112
- package/frontend-vue/tests/onboarding-database-engines.test.ts +0 -142
- package/frontend-vue/tests/onboarding-database-new-url.test.ts +0 -174
- package/frontend-vue/tests/onboarding-database-reload.test.ts +0 -229
- package/frontend-vue/tests/onboarding-database-tabs.test.ts +0 -184
- package/frontend-vue/tests/onboarding-database.test.ts +0 -540
- package/frontend-vue/tests/onboarding-deep-link.test.ts +0 -51
- package/frontend-vue/tests/onboarding-flow.test.ts +0 -204
- package/frontend-vue/tests/onboarding-install.test.ts +0 -62
- package/frontend-vue/tests/onboarding-mockups.test.ts +0 -86
- package/frontend-vue/tests/onboarding-scratch.test.ts +0 -70
- package/frontend-vue/tests/onboarding-widget.test.ts +0 -97
- package/frontend-vue/tests/palette-assistant.test.ts +0 -241
- package/frontend-vue/tests/panel-approvals.test.ts +0 -226
- package/frontend-vue/tests/panel-closed-conversation.test.ts +0 -53
- package/frontend-vue/tests/panel-mockup-prompt.test.ts +0 -238
- package/frontend-vue/tests/panel-modes.test.ts +0 -131
- package/frontend-vue/tests/panel-questions.test.ts +0 -151
- package/frontend-vue/tests/panel-states.test.ts +0 -252
- package/frontend-vue/tests/panel-tools.test.ts +0 -219
- package/frontend-vue/tests/session-gate.test.ts +0 -66
- package/frontend-vue/tests/sidecar-guest.test.ts +0 -81
- package/frontend-vue/tests/sidecar-status.test.ts +0 -117
- package/frontend-vue/tests/support/api-error-presenter.ts +0 -30
- package/frontend-vue/tests/support/database-connect.ts +0 -129
- package/frontend-vue/tests/support/dms-frontend-module.ts +0 -9
- package/frontend-vue/tests/support/dms-state.ts +0 -12
- package/frontend-vue/tests/support/fake-layout.ts +0 -119
- package/frontend-vue/tests/support/i18n.ts +0 -49
- package/frontend-vue/tests/support/onboarding-host.ts +0 -104
- package/frontend-vue/tests/support/onboarding.ts +0 -176
- package/frontend-vue/tests/support/panel-fixtures.ts +0 -155
- package/frontend-vue/tests/support/panel-harness.ts +0 -211
- package/frontend-vue/tests/support/setup-layout.ts +0 -3
- package/frontend-vue/tests/support/stand-ins/DmsBlockPreview.ts +0 -18
- package/frontend-vue/tests/support/stand-ins/DmsEmptyState.ts +0 -17
- package/frontend-vue/tests/support/stand-ins/DmsSegmentedControl.ts +0 -35
- package/frontend-vue/tests/support/stand-ins/DmsStatusPill.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/OnboardingModal.ts +0 -13
- package/frontend-vue/tests/support/stand-ins/UBadge.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/UButton.ts +0 -27
- package/frontend-vue/tests/support/stand-ins/UCheckbox.ts +0 -25
- package/frontend-vue/tests/support/stand-ins/UDropdownMenu.ts +0 -34
- package/frontend-vue/tests/support/stand-ins/UFormField.ts +0 -9
- package/frontend-vue/tests/support/stand-ins/UInput.ts +0 -16
- package/frontend-vue/tests/support/stand-ins/UKbd.ts +0 -7
- package/frontend-vue/tests/support/stand-ins/UModal.ts +0 -20
- package/frontend-vue/tests/support/stand-ins/UPopover.ts +0 -9
- package/frontend-vue/tests/support/stand-ins/UTabs.ts +0 -31
- package/frontend-vue/tests/support/stand-ins/UTextarea.ts +0 -19
- package/frontend-vue/tests/support/stubs.ts +0 -28
- package/frontend-vue/tests/views/api-data-reads.test.ts +0 -451
- package/frontend-vue/tests/views/api-error-presentation.test.ts +0 -89
- package/frontend-vue/tests/views/diff-view.test.ts +0 -167
- package/frontend-vue/tests/views/use-assistant.test.ts +0 -53
- package/frontend-vue/tests/views/view-format.test.ts +0 -59
- package/frontend-vue/vitest.config.ts +0 -33
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { flushPromises } from "@vue/test-utils";
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { nextTick } from "vue";
|
|
5
|
-
import {
|
|
6
|
-
buttonWithText,
|
|
7
|
-
CONVERSATION_ID,
|
|
8
|
-
createHarness,
|
|
9
|
-
deliver,
|
|
10
|
-
openPanel,
|
|
11
|
-
sendMessage,
|
|
12
|
-
sentOfType,
|
|
13
|
-
unmountPanel,
|
|
14
|
-
} from "./support/panel-harness";
|
|
15
|
-
import { DIFF_REQUEST, keydown } from "./support/panel-fixtures";
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
unmountPanel();
|
|
23
|
-
localStorage.clear();
|
|
24
|
-
vi.useRealTimers();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe("the panel's header and empty chat", () => {
|
|
28
|
-
it("invites a first request about the page on screen", async () => {
|
|
29
|
-
const harness = createHarness();
|
|
30
|
-
const panel = await openPanel(harness);
|
|
31
|
-
expect(panel.find(".cb-empty h3").text()).toBe(
|
|
32
|
-
"What should we change on Sales overview?",
|
|
33
|
-
);
|
|
34
|
-
await buttonWithText(panel.find(".cb-suggest"), "Add a chart").trigger(
|
|
35
|
-
"click",
|
|
36
|
-
);
|
|
37
|
-
expect((panel.find("textarea").element as HTMLTextAreaElement).value).toBe(
|
|
38
|
-
"Add a chart to Sales overview",
|
|
39
|
-
);
|
|
40
|
-
expect(panel.find(".att.is-page").text()).toContain("sales/overview");
|
|
41
|
-
expect(panel.find(".cb__status").text()).toBe("Ready · Claude Code");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("says it works with the turn's clock, then waits for the user", async () => {
|
|
45
|
-
const harness = createHarness();
|
|
46
|
-
const panel = await openPanel(harness);
|
|
47
|
-
await sendMessage(panel, "go");
|
|
48
|
-
deliver(harness, {
|
|
49
|
-
type: "run_progress",
|
|
50
|
-
activity: "tool",
|
|
51
|
-
elapsedMs: 14_000,
|
|
52
|
-
idleMs: 0,
|
|
53
|
-
});
|
|
54
|
-
await nextTick();
|
|
55
|
-
expect(panel.find(".cb__status").text()).toContain("Working · 0:14");
|
|
56
|
-
deliver(harness, DIFF_REQUEST);
|
|
57
|
-
await nextTick();
|
|
58
|
-
expect(panel.find(".cb__status").text()).toContain(
|
|
59
|
-
"Waiting for you · 1 request",
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("stamps a message with the page unless its chip was removed", async () => {
|
|
64
|
-
const harness = createHarness();
|
|
65
|
-
const panel = await openPanel(harness);
|
|
66
|
-
await panel
|
|
67
|
-
.find('button[aria-label="Remove page context"]')
|
|
68
|
-
.trigger("click");
|
|
69
|
-
await sendMessage(panel, "explain");
|
|
70
|
-
expect(sentOfType(harness, "user_message")[0]).toMatchObject({
|
|
71
|
-
content: "explain",
|
|
72
|
-
includePageContext: false,
|
|
73
|
-
});
|
|
74
|
-
expect(panel.find(".cb-user__meta").text()).toContain("sales/overview");
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe("notices and errors", () => {
|
|
79
|
-
it("shows an auto-fix turn that can be stopped", async () => {
|
|
80
|
-
const harness = createHarness();
|
|
81
|
-
const panel = await openPanel(harness);
|
|
82
|
-
await sendMessage(panel, "go");
|
|
83
|
-
deliver(harness, {
|
|
84
|
-
type: "notice",
|
|
85
|
-
notice: {
|
|
86
|
-
kind: "autofix",
|
|
87
|
-
attempt: 1,
|
|
88
|
-
maxAttempts: 2,
|
|
89
|
-
errors: ["TS2339 in top-customers.ts"],
|
|
90
|
-
timestampMs: Date.now(),
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
await nextTick();
|
|
94
|
-
const notice = panel.find(".cb-notice");
|
|
95
|
-
expect(notice.text()).toContain("Auto-fix turn 1 of 2.");
|
|
96
|
-
await buttonWithText(notice, "Show error").trigger("click");
|
|
97
|
-
expect(notice.text()).toContain("TS2339");
|
|
98
|
-
await buttonWithText(notice, "Stop auto-fix").trigger("click");
|
|
99
|
-
expect(sentOfType(harness, "stop_autofix")).toHaveLength(1);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("says the agent can't run, with no fallback, and points to the settings", async () => {
|
|
103
|
-
const harness = createHarness();
|
|
104
|
-
const panel = await openPanel(harness);
|
|
105
|
-
deliver(harness, {
|
|
106
|
-
type: "settings_update",
|
|
107
|
-
settings: {
|
|
108
|
-
provider: "codex",
|
|
109
|
-
defaultModes: { claude: "auto", codex: "normal" },
|
|
110
|
-
thinking: "medium",
|
|
111
|
-
generationMode: "safe",
|
|
112
|
-
allowLocalSkills: false,
|
|
113
|
-
},
|
|
114
|
-
providers: {
|
|
115
|
-
claude: { available: true },
|
|
116
|
-
codex: { available: false, reason: "Sign in with ChatGPT." },
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
await nextTick();
|
|
120
|
-
const notice = panel.find(".cb-provider");
|
|
121
|
-
expect(notice.text()).toContain("Codex can't run.");
|
|
122
|
-
expect(panel.find("textarea").attributes("disabled")).toBeDefined();
|
|
123
|
-
await buttonWithText(notice, "Open settings").trigger("click");
|
|
124
|
-
expect(harness.navigate).toHaveBeenCalledWith("/modules/ai/settings");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("stops the turn with Esc", async () => {
|
|
128
|
-
const harness = createHarness();
|
|
129
|
-
const panel = await openPanel(harness);
|
|
130
|
-
await sendMessage(panel, "go");
|
|
131
|
-
keydown(panel.find("textarea").element, "Escape");
|
|
132
|
-
expect(sentOfType(harness, "interrupt_turn")).toHaveLength(1);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe("the history drawer", () => {
|
|
137
|
-
const HOUR_MS = 3_600_000;
|
|
138
|
-
const NOON_MS = new Date(2026, 5, 15, 12, 0, 0).getTime();
|
|
139
|
-
const LIST = {
|
|
140
|
-
type: "conversation_list",
|
|
141
|
-
conversations: [
|
|
142
|
-
{
|
|
143
|
-
id: "c-run",
|
|
144
|
-
title: "Add top customers",
|
|
145
|
-
createdAtMs: 1,
|
|
146
|
-
updatedAtMs: NOON_MS,
|
|
147
|
-
messageCount: 4,
|
|
148
|
-
isRunning: true,
|
|
149
|
-
filesChanged: 2,
|
|
150
|
-
totalTokens: 9_600,
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
id: "c-old",
|
|
154
|
-
title: "Why is order pending?",
|
|
155
|
-
createdAtMs: 1,
|
|
156
|
-
updatedAtMs: NOON_MS - HOUR_MS,
|
|
157
|
-
messageCount: 2,
|
|
158
|
-
filesChanged: 0,
|
|
159
|
-
filesUndone: 1,
|
|
160
|
-
totalTokens: 1_300,
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
beforeEach(() => {
|
|
166
|
-
vi.useFakeTimers({ toFake: ["Date"] });
|
|
167
|
-
vi.setSystemTime(NOON_MS);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it("opens with ⌘J, pins the running chat, and switches chats", async () => {
|
|
171
|
-
const harness = createHarness();
|
|
172
|
-
const panel = await openPanel(harness);
|
|
173
|
-
document.dispatchEvent(
|
|
174
|
-
new KeyboardEvent("keydown", { key: "j", metaKey: true }),
|
|
175
|
-
);
|
|
176
|
-
deliver(harness, LIST);
|
|
177
|
-
await nextTick();
|
|
178
|
-
const drawer = panel.find(".cb-drawer");
|
|
179
|
-
expect(
|
|
180
|
-
drawer.findAll(".cb-drawer__group").map((group) => group.text()),
|
|
181
|
-
).toEqual(["Active · 1", "Today"]);
|
|
182
|
-
expect(drawer.text()).toContain("9.6k tok");
|
|
183
|
-
expect(drawer.text()).toContain("1 file undone");
|
|
184
|
-
await buttonWithText(drawer, "Why is order pending?").trigger("click");
|
|
185
|
-
expect(sentOfType(harness, "leave_conversation")).toEqual([]);
|
|
186
|
-
expect(sentOfType(harness, "hello").at(-1)).toMatchObject({
|
|
187
|
-
conversationId: "c-old",
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it("deletes after 8 seconds unless undone, and asks first for a running chat", async () => {
|
|
192
|
-
vi.useFakeTimers();
|
|
193
|
-
vi.setSystemTime(NOON_MS);
|
|
194
|
-
const harness = createHarness();
|
|
195
|
-
const panel = await openPanel(harness);
|
|
196
|
-
document.dispatchEvent(
|
|
197
|
-
new KeyboardEvent("keydown", { key: "j", ctrlKey: true }),
|
|
198
|
-
);
|
|
199
|
-
deliver(harness, LIST);
|
|
200
|
-
await nextTick();
|
|
201
|
-
await panel
|
|
202
|
-
.findAll('button[aria-label="Delete conversation"]')[1]
|
|
203
|
-
.trigger("click");
|
|
204
|
-
expect(panel.find(".cb-toast").text()).toContain(
|
|
205
|
-
"Deleted “Why is order pending?”",
|
|
206
|
-
);
|
|
207
|
-
await buttonWithText(panel.find(".cb-toast"), "Undo").trigger("click");
|
|
208
|
-
await vi.advanceTimersByTimeAsync(9_000);
|
|
209
|
-
expect(sentOfType(harness, "delete_conversation")).toEqual([]);
|
|
210
|
-
await panel
|
|
211
|
-
.findAll('button[aria-label="Delete conversation"]')[1]
|
|
212
|
-
.trigger("click");
|
|
213
|
-
await vi.advanceTimersByTimeAsync(9_000);
|
|
214
|
-
expect(sentOfType(harness, "delete_conversation")).toEqual([
|
|
215
|
-
{ type: "delete_conversation", conversationId: "c-old" },
|
|
216
|
-
]);
|
|
217
|
-
await panel
|
|
218
|
-
.findAll('button[aria-label="Delete conversation"]')[0]
|
|
219
|
-
.trigger("click");
|
|
220
|
-
await buttonWithText(panel.find(".u-modal"), "Stop and delete").trigger(
|
|
221
|
-
"click",
|
|
222
|
-
);
|
|
223
|
-
expect(sentOfType(harness, "interrupt_turn")).toEqual([
|
|
224
|
-
{ type: "interrupt_turn", conversationId: "c-run" },
|
|
225
|
-
]);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
describe("the dashboard can open the panel on a chat", () => {
|
|
230
|
-
it("starts a new chat with a prefilled composer", async () => {
|
|
231
|
-
const harness = createHarness();
|
|
232
|
-
const panel = await openPanel(harness);
|
|
233
|
-
harness.session.startConversation("Add a refund chart");
|
|
234
|
-
await flushPromises();
|
|
235
|
-
expect((panel.find("textarea").element as HTMLTextAreaElement).value).toBe(
|
|
236
|
-
"Add a refund chart",
|
|
237
|
-
);
|
|
238
|
-
expect(sentOfType(harness, "hello").at(-1)?.conversationId).not.toBe(
|
|
239
|
-
CONVERSATION_ID,
|
|
240
|
-
);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("opens a stored chat", async () => {
|
|
244
|
-
const harness = createHarness();
|
|
245
|
-
await openPanel(harness);
|
|
246
|
-
harness.session.openConversation("c-42");
|
|
247
|
-
await nextTick();
|
|
248
|
-
expect(sentOfType(harness, "hello").at(-1)).toMatchObject({
|
|
249
|
-
conversationId: "c-42",
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
});
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { flushPromises } from "@vue/test-utils";
|
|
3
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { nextTick } from "vue";
|
|
5
|
-
import {
|
|
6
|
-
buttonWithText,
|
|
7
|
-
CONVERSATION_ID,
|
|
8
|
-
createHarness,
|
|
9
|
-
deliver,
|
|
10
|
-
openPanel,
|
|
11
|
-
sendMessage,
|
|
12
|
-
sentOfType,
|
|
13
|
-
unmountPanel,
|
|
14
|
-
} from "./support/panel-harness";
|
|
15
|
-
import { CHANGE_SET, DIFF_REQUEST } from "./support/panel-fixtures";
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
unmountPanel();
|
|
23
|
-
localStorage.clear();
|
|
24
|
-
vi.useRealTimers();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe("tool rows and change sets", () => {
|
|
28
|
-
it("draws each call with the lexicon's words and its state", async () => {
|
|
29
|
-
const harness = createHarness();
|
|
30
|
-
const panel = await openPanel(harness);
|
|
31
|
-
await sendMessage(panel, "go");
|
|
32
|
-
deliver(harness, {
|
|
33
|
-
type: "tool_call_start",
|
|
34
|
-
callId: "c0",
|
|
35
|
-
toolName: "Read",
|
|
36
|
-
args: { file_path: "/a/customer.form.ts" },
|
|
37
|
-
});
|
|
38
|
-
deliver(harness, {
|
|
39
|
-
type: "tool_call_end",
|
|
40
|
-
callId: "c0",
|
|
41
|
-
status: "success",
|
|
42
|
-
result: "",
|
|
43
|
-
outcome: "done",
|
|
44
|
-
});
|
|
45
|
-
deliver(harness, {
|
|
46
|
-
type: "tool_call_start",
|
|
47
|
-
callId: "c9",
|
|
48
|
-
toolName: "Bash",
|
|
49
|
-
args: { command: "pnpm add dayjs" },
|
|
50
|
-
});
|
|
51
|
-
deliver(harness, {
|
|
52
|
-
type: "tool_call_end",
|
|
53
|
-
callId: "c9",
|
|
54
|
-
status: "error",
|
|
55
|
-
result: "",
|
|
56
|
-
outcome: "denied",
|
|
57
|
-
});
|
|
58
|
-
deliver(harness, {
|
|
59
|
-
type: "tool_call_start",
|
|
60
|
-
callId: "c1",
|
|
61
|
-
toolName: "Edit",
|
|
62
|
-
args: { file_path: "/repo/crm/customers/customer.form.ts" },
|
|
63
|
-
});
|
|
64
|
-
deliver(harness, DIFF_REQUEST);
|
|
65
|
-
await nextTick();
|
|
66
|
-
const rows = panel.findAll(".cb-tool");
|
|
67
|
-
expect(
|
|
68
|
-
rows.map((row) => row.classes().find((name) => name.startsWith("is-"))),
|
|
69
|
-
).toEqual(["is-done", "is-denied", "is-waiting"]);
|
|
70
|
-
expect(rows[0].text()).toContain("Read file");
|
|
71
|
-
expect(rows[0].text()).toContain("customer.form.ts");
|
|
72
|
-
expect(rows[2].text()).toContain("1 of 1 · below");
|
|
73
|
-
expect(panel.find(".cb-tools__head").text()).toContain("3 steps");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("draws a call the DMS held as a held step, not a failed one (fails a row that reads the held call's error status)", async () => {
|
|
77
|
-
const harness = createHarness();
|
|
78
|
-
const panel = await openPanel(harness);
|
|
79
|
-
await sendMessage(panel, "go");
|
|
80
|
-
deliver(harness, {
|
|
81
|
-
type: "tool_call_start",
|
|
82
|
-
callId: "c0",
|
|
83
|
-
toolName: "mcp__dms__builder_delete_page",
|
|
84
|
-
args: { pageRef: "/home" },
|
|
85
|
-
});
|
|
86
|
-
deliver(harness, {
|
|
87
|
-
type: "tool_call_end",
|
|
88
|
-
callId: "c0",
|
|
89
|
-
status: "error",
|
|
90
|
-
result: "builder_delete_page was not run: no one has confirmed it yet.",
|
|
91
|
-
outcome: "held",
|
|
92
|
-
});
|
|
93
|
-
deliver(harness, { type: "run_done" });
|
|
94
|
-
await nextTick();
|
|
95
|
-
const row = panel.find(".cb-tool");
|
|
96
|
-
expect(row.classes()).toContain("is-held");
|
|
97
|
-
expect(row.text()).toContain("held until you confirm");
|
|
98
|
-
expect(panel.find(".cb-tools").text()).not.toContain("failed");
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("tones a group whose repeat the person declined as declined, not failed (fails a header that reads the person's denial as a failure)", async () => {
|
|
102
|
-
const harness = createHarness();
|
|
103
|
-
const panel = await openPanel(harness);
|
|
104
|
-
await sendMessage(panel, "go");
|
|
105
|
-
const call = {
|
|
106
|
-
toolName: "mcp__dms__builder_delete_page",
|
|
107
|
-
args: { pageRef: "/home" },
|
|
108
|
-
};
|
|
109
|
-
deliver(harness, { type: "tool_call_start", callId: "c0", ...call });
|
|
110
|
-
deliver(harness, {
|
|
111
|
-
type: "tool_call_end",
|
|
112
|
-
callId: "c0",
|
|
113
|
-
status: "error",
|
|
114
|
-
result: "builder_delete_page was not run: no one has confirmed it yet.",
|
|
115
|
-
outcome: "held",
|
|
116
|
-
});
|
|
117
|
-
deliver(harness, { type: "tool_call_start", callId: "c1", ...call });
|
|
118
|
-
deliver(harness, {
|
|
119
|
-
type: "tool_call_end",
|
|
120
|
-
callId: "c1",
|
|
121
|
-
status: "error",
|
|
122
|
-
result: "Permission denied by user.",
|
|
123
|
-
outcome: "denied",
|
|
124
|
-
});
|
|
125
|
-
deliver(harness, { type: "run_done" });
|
|
126
|
-
await nextTick();
|
|
127
|
-
expect(panel.find(".cb-tools").attributes("data-tone")).toBe("denied");
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("shows the raw JSON of a call on demand", async () => {
|
|
131
|
-
const harness = createHarness();
|
|
132
|
-
const panel = await openPanel(harness);
|
|
133
|
-
await sendMessage(panel, "go");
|
|
134
|
-
deliver(harness, {
|
|
135
|
-
type: "tool_call_start",
|
|
136
|
-
callId: "c0",
|
|
137
|
-
toolName: "mcp__dms-assistant__builder_add_block",
|
|
138
|
-
args: { name: "Top customers", type: "TopListCard" },
|
|
139
|
-
});
|
|
140
|
-
deliver(harness, {
|
|
141
|
-
type: "tool_call_end",
|
|
142
|
-
callId: "c0",
|
|
143
|
-
status: "success",
|
|
144
|
-
result: "ok",
|
|
145
|
-
outcome: "done",
|
|
146
|
-
});
|
|
147
|
-
await nextTick();
|
|
148
|
-
await panel.find(".cb-tool").trigger("click");
|
|
149
|
-
expect(panel.find(".cb-kv").text()).toContain("TopListCard");
|
|
150
|
-
await buttonWithText(panel, "Raw JSON").trigger("click");
|
|
151
|
-
expect(panel.find(".cb-raw").text()).toContain('"type": "TopListCard"');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("ends a turn with its change set: undo, review, then redo", async () => {
|
|
155
|
-
const harness = createHarness();
|
|
156
|
-
const panel = await openPanel(harness);
|
|
157
|
-
await sendMessage(panel, "go");
|
|
158
|
-
deliver(harness, { type: "change_set", changeSet: CHANGE_SET });
|
|
159
|
-
deliver(harness, { type: "run_done" });
|
|
160
|
-
await nextTick();
|
|
161
|
-
const card = panel.find(".cb-change");
|
|
162
|
-
expect(card.text()).toContain("Change applied · #14");
|
|
163
|
-
expect(card.text()).toContain("2 files changed · 2 Builder operations");
|
|
164
|
-
expect(card.text()).toContain("new");
|
|
165
|
-
await buttonWithText(card, "Review diff").trigger("click");
|
|
166
|
-
expect(harness.navigate).toHaveBeenCalledWith(
|
|
167
|
-
"/modules/ai/changes?set=cs-14",
|
|
168
|
-
);
|
|
169
|
-
await buttonWithText(card, "Undo").trigger("click");
|
|
170
|
-
await flushPromises();
|
|
171
|
-
expect(sentOfType(harness, "change_set_action")).toEqual([
|
|
172
|
-
{
|
|
173
|
-
type: "change_set_action",
|
|
174
|
-
conversationId: CONVERSATION_ID,
|
|
175
|
-
changeSetId: "cs-14",
|
|
176
|
-
action: "undo",
|
|
177
|
-
},
|
|
178
|
-
]);
|
|
179
|
-
deliver(harness, {
|
|
180
|
-
type: "change_set",
|
|
181
|
-
changeSet: { ...CHANGE_SET, state: "undone", stateChangedBy: "Camille" },
|
|
182
|
-
});
|
|
183
|
-
await nextTick();
|
|
184
|
-
expect(panel.find(".cb-change").text()).toContain(
|
|
185
|
-
"Undone · checkpoint 14 restored",
|
|
186
|
-
);
|
|
187
|
-
expect(panel.find(".cb-change").text()).toContain("by Camille");
|
|
188
|
-
await buttonWithText(panel.find(".cb-change"), "Redo").trigger("click");
|
|
189
|
-
expect(sentOfType(harness, "change_set_action").at(-1)).toMatchObject({
|
|
190
|
-
action: "redo",
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it("asks before undoing a set later ones build on", async () => {
|
|
195
|
-
const harness = createHarness();
|
|
196
|
-
vi.mocked(harness.api.get).mockResolvedValueOnce({
|
|
197
|
-
conflicts: [
|
|
198
|
-
{
|
|
199
|
-
changeSetId: "cs-15",
|
|
200
|
-
number: 15,
|
|
201
|
-
title: "Refund rate",
|
|
202
|
-
files: ["sales/overview.page.ts"],
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
});
|
|
206
|
-
const panel = await openPanel(harness);
|
|
207
|
-
deliver(harness, { type: "change_set", changeSet: CHANGE_SET });
|
|
208
|
-
await nextTick();
|
|
209
|
-
await buttonWithText(panel.find(".cb-change"), "Undo").trigger("click");
|
|
210
|
-
await flushPromises();
|
|
211
|
-
expect(panel.find(".u-modal").text()).toContain("#15 Refund rate");
|
|
212
|
-
await buttonWithText(panel.find(".u-modal"), "Undo them together").trigger(
|
|
213
|
-
"click",
|
|
214
|
-
);
|
|
215
|
-
expect(sentOfType(harness, "change_set_action")[0]).toMatchObject({
|
|
216
|
-
includeLater: true,
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { nextTick, ref, watch } from "vue";
|
|
2
|
-
import { describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { runWhenLoggedIn } from "../app/runtime/session-gate";
|
|
4
|
-
|
|
5
|
-
describe("session gate", () => {
|
|
6
|
-
it("starts immediately when the session is already hydrated", () => {
|
|
7
|
-
const start = vi.fn();
|
|
8
|
-
runWhenLoggedIn(() => true, start);
|
|
9
|
-
expect(start).toHaveBeenCalledTimes(1);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("starts once the session appears, and only once", async () => {
|
|
13
|
-
const loggedIn = ref(false);
|
|
14
|
-
const start = vi.fn();
|
|
15
|
-
runWhenLoggedIn(() => loggedIn.value, start);
|
|
16
|
-
expect(start).not.toHaveBeenCalled();
|
|
17
|
-
|
|
18
|
-
loggedIn.value = true;
|
|
19
|
-
await nextTick();
|
|
20
|
-
expect(start).toHaveBeenCalledTimes(1);
|
|
21
|
-
|
|
22
|
-
loggedIn.value = false;
|
|
23
|
-
await nextTick();
|
|
24
|
-
loggedIn.value = true;
|
|
25
|
-
await nextTick();
|
|
26
|
-
expect(start).toHaveBeenCalledTimes(1);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("starts in the new session scope after login watchers settle", async () => {
|
|
30
|
-
const loggedIn = ref(false);
|
|
31
|
-
const session = ref("guest");
|
|
32
|
-
let scope = session.value;
|
|
33
|
-
let probe: AbortController | undefined;
|
|
34
|
-
let probeScope: string | undefined;
|
|
35
|
-
runWhenLoggedIn(
|
|
36
|
-
() => loggedIn.value,
|
|
37
|
-
() => {
|
|
38
|
-
probeScope = scope;
|
|
39
|
-
probe = new AbortController();
|
|
40
|
-
},
|
|
41
|
-
);
|
|
42
|
-
// DMS hydrates the user before the session. Its scope watcher clears
|
|
43
|
-
// outstanding reads, including an AI probe started in the old scope.
|
|
44
|
-
const stopScope = watch(session, (next) => {
|
|
45
|
-
probe?.abort();
|
|
46
|
-
scope = next;
|
|
47
|
-
});
|
|
48
|
-
loggedIn.value = true;
|
|
49
|
-
session.value = "owner";
|
|
50
|
-
await nextTick();
|
|
51
|
-
stopScope();
|
|
52
|
-
expect(probeScope).toBe("owner");
|
|
53
|
-
expect(probe?.signal.aborted).toBe(false);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("never starts once the gate is stopped", async () => {
|
|
57
|
-
const loggedIn = ref(false);
|
|
58
|
-
const start = vi.fn();
|
|
59
|
-
const stop = runWhenLoggedIn(() => loggedIn.value, start);
|
|
60
|
-
|
|
61
|
-
stop();
|
|
62
|
-
loggedIn.value = true;
|
|
63
|
-
await nextTick();
|
|
64
|
-
expect(start).not.toHaveBeenCalled();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { afterEach, expect, it, vi } from "vitest";
|
|
2
|
-
import { nextTick, ref, type Ref } from "vue";
|
|
3
|
-
import { assistantPlugin } from "../app/plugins/ai.client";
|
|
4
|
-
|
|
5
|
-
const plugin = assistantPlugin({ builderEnabled: false });
|
|
6
|
-
|
|
7
|
-
vi.mock("#dms/frontend-module", () => ({
|
|
8
|
-
defineDmsPlugin: (definition: unknown) => definition,
|
|
9
|
-
useDmsRouter: () => ({ push: vi.fn() }),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
interface PluginHarness {
|
|
13
|
-
useAuthFetch: ReturnType<typeof vi.fn>;
|
|
14
|
-
unregisterSidePanel: ReturnType<typeof vi.fn>;
|
|
15
|
-
run: () => void | Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// A first probe reporting a disabled sidecar stops the startup right after the
|
|
19
|
-
// authenticated fetch, which is all these tests need to observe.
|
|
20
|
-
function disabledSidecarRead() {
|
|
21
|
-
return {
|
|
22
|
-
data: ref({ disabled: true }),
|
|
23
|
-
error: ref(null),
|
|
24
|
-
pending: ref(false),
|
|
25
|
-
execute: async () => undefined,
|
|
26
|
-
refresh: async () => undefined,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function loadPlugin(loggedIn: Ref<boolean>): PluginHarness {
|
|
31
|
-
const useAuthFetch = vi.fn(() => ({ $authFetch: vi.fn() }));
|
|
32
|
-
const unregisterSidePanel = vi.fn();
|
|
33
|
-
vi.stubGlobal("useDmsUserSession", () => ({ loggedIn }));
|
|
34
|
-
vi.stubGlobal("useAuthFetch", useAuthFetch);
|
|
35
|
-
vi.stubGlobal("useToast", () => ({ add: vi.fn() }));
|
|
36
|
-
vi.stubGlobal("useDevReload", () => ({ awaitRoute: vi.fn() }));
|
|
37
|
-
vi.stubGlobal("useApiData", disabledSidecarRead);
|
|
38
|
-
vi.stubGlobal("unregisterSidePanel", unregisterSidePanel);
|
|
39
|
-
return {
|
|
40
|
-
useAuthFetch,
|
|
41
|
-
unregisterSidePanel,
|
|
42
|
-
run: () =>
|
|
43
|
-
plugin({
|
|
44
|
-
vueApp: { onUnmount: vi.fn(), provide: vi.fn() },
|
|
45
|
-
$i18n: { t: (key: string) => key, locale: ref("en-GB") },
|
|
46
|
-
hook: vi.fn(),
|
|
47
|
-
runWithContext: (callback: () => unknown) => callback(),
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
afterEach(() => {
|
|
53
|
-
vi.unstubAllGlobals();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("does not invoke authenticated fetching or inject the assistant for a guest", async () => {
|
|
57
|
-
const harness = loadPlugin(ref(false));
|
|
58
|
-
await harness.run();
|
|
59
|
-
expect(harness.useAuthFetch).not.toHaveBeenCalled();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("starts the assistant when a guest signs in without reloading the page", async () => {
|
|
63
|
-
const loggedIn = ref(false);
|
|
64
|
-
const harness = loadPlugin(loggedIn);
|
|
65
|
-
await harness.run();
|
|
66
|
-
expect(harness.useAuthFetch).not.toHaveBeenCalled();
|
|
67
|
-
|
|
68
|
-
loggedIn.value = true;
|
|
69
|
-
await nextTick();
|
|
70
|
-
expect(harness.useAuthFetch).toHaveBeenCalledTimes(1);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("withdraws the docked panel when the first probe finds no assistant", async () => {
|
|
74
|
-
const harness = loadPlugin(ref(true));
|
|
75
|
-
await harness.run();
|
|
76
|
-
await vi.waitFor(() =>
|
|
77
|
-
expect(harness.unregisterSidePanel).toHaveBeenCalledWith(
|
|
78
|
-
"dms-assistant:assistant",
|
|
79
|
-
),
|
|
80
|
-
);
|
|
81
|
-
});
|