@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.
Files changed (102) hide show
  1. package/package.json +6 -2
  2. package/frontend-vue/builder/tests/database-build.test.ts +0 -232
  3. package/frontend-vue/builder/tests/database-connect.test.ts +0 -348
  4. package/frontend-vue/builder/tests/database-display.test.ts +0 -112
  5. package/frontend-vue/builder/tests/database.test.ts +0 -138
  6. package/frontend-vue/builder/tests/enabled.test.ts +0 -17
  7. package/frontend-vue/builder/tests/owner-ui.test.ts +0 -29
  8. package/frontend-vue/builder/tests/stubs/frontend-module.ts +0 -63
  9. package/frontend-vue/builder/vitest.config.ts +0 -21
  10. package/frontend-vue/tests/assistant-actions.test.ts +0 -109
  11. package/frontend-vue/tests/assistant-activity.test.ts +0 -281
  12. package/frontend-vue/tests/backend-boundary.test.ts +0 -130
  13. package/frontend-vue/tests/backoff.test.ts +0 -40
  14. package/frontend-vue/tests/block-health.test.ts +0 -142
  15. package/frontend-vue/tests/channel-client.test.ts +0 -246
  16. package/frontend-vue/tests/chat/block-preview.test.ts +0 -367
  17. package/frontend-vue/tests/chat/block-target.test.ts +0 -133
  18. package/frontend-vue/tests/chat/build-view.test.ts +0 -171
  19. package/frontend-vue/tests/chat/chat-scroll.test.ts +0 -251
  20. package/frontend-vue/tests/chat/conversation-events.test.ts +0 -622
  21. package/frontend-vue/tests/chat/diff-and-keys.test.ts +0 -178
  22. package/frontend-vue/tests/chat/held-card.test.ts +0 -133
  23. package/frontend-vue/tests/chat/markdown-content.test.ts +0 -86
  24. package/frontend-vue/tests/chat/markdown.test.ts +0 -352
  25. package/frontend-vue/tests/chat/provider-notice.test.ts +0 -33
  26. package/frontend-vue/tests/chat/tool-lexicon.test.ts +0 -212
  27. package/frontend-vue/tests/chat/useChatChannel.test.ts +0 -124
  28. package/frontend-vue/tests/chat/useConversation.test.ts +0 -288
  29. package/frontend-vue/tests/chat-panel.test.ts +0 -300
  30. package/frontend-vue/tests/chat-transport.test.ts +0 -94
  31. package/frontend-vue/tests/embedding.test.ts +0 -10
  32. package/frontend-vue/tests/formal/connection-analysis-scenarios.ts +0 -130
  33. package/frontend-vue/tests/formal/connection-analysis-world.ts +0 -497
  34. package/frontend-vue/tests/formal/connection-analysis.test.ts +0 -36
  35. package/frontend-vue/tests/host-commands.test.ts +0 -182
  36. package/frontend-vue/tests/launcher-icon.test.ts +0 -62
  37. package/frontend-vue/tests/launcher-label.test.ts +0 -40
  38. package/frontend-vue/tests/launcher-state.test.ts +0 -215
  39. package/frontend-vue/tests/mockup-fold.test.ts +0 -95
  40. package/frontend-vue/tests/navigation.test.ts +0 -142
  41. package/frontend-vue/tests/onboarding-api.test.ts +0 -29
  42. package/frontend-vue/tests/onboarding-claude.test.ts +0 -144
  43. package/frontend-vue/tests/onboarding-connect-memory.test.ts +0 -126
  44. package/frontend-vue/tests/onboarding-controller-restart.test.ts +0 -134
  45. package/frontend-vue/tests/onboarding-controller.test.ts +0 -307
  46. package/frontend-vue/tests/onboarding-database-driver-install.test.ts +0 -112
  47. package/frontend-vue/tests/onboarding-database-engines.test.ts +0 -142
  48. package/frontend-vue/tests/onboarding-database-new-url.test.ts +0 -174
  49. package/frontend-vue/tests/onboarding-database-reload.test.ts +0 -229
  50. package/frontend-vue/tests/onboarding-database-tabs.test.ts +0 -184
  51. package/frontend-vue/tests/onboarding-database.test.ts +0 -540
  52. package/frontend-vue/tests/onboarding-deep-link.test.ts +0 -51
  53. package/frontend-vue/tests/onboarding-flow.test.ts +0 -204
  54. package/frontend-vue/tests/onboarding-install.test.ts +0 -62
  55. package/frontend-vue/tests/onboarding-mockups.test.ts +0 -86
  56. package/frontend-vue/tests/onboarding-scratch.test.ts +0 -70
  57. package/frontend-vue/tests/onboarding-widget.test.ts +0 -97
  58. package/frontend-vue/tests/palette-assistant.test.ts +0 -241
  59. package/frontend-vue/tests/panel-approvals.test.ts +0 -226
  60. package/frontend-vue/tests/panel-closed-conversation.test.ts +0 -53
  61. package/frontend-vue/tests/panel-mockup-prompt.test.ts +0 -238
  62. package/frontend-vue/tests/panel-modes.test.ts +0 -131
  63. package/frontend-vue/tests/panel-questions.test.ts +0 -151
  64. package/frontend-vue/tests/panel-states.test.ts +0 -252
  65. package/frontend-vue/tests/panel-tools.test.ts +0 -219
  66. package/frontend-vue/tests/session-gate.test.ts +0 -66
  67. package/frontend-vue/tests/sidecar-guest.test.ts +0 -81
  68. package/frontend-vue/tests/sidecar-status.test.ts +0 -117
  69. package/frontend-vue/tests/support/api-error-presenter.ts +0 -30
  70. package/frontend-vue/tests/support/database-connect.ts +0 -129
  71. package/frontend-vue/tests/support/dms-frontend-module.ts +0 -9
  72. package/frontend-vue/tests/support/dms-state.ts +0 -12
  73. package/frontend-vue/tests/support/fake-layout.ts +0 -119
  74. package/frontend-vue/tests/support/i18n.ts +0 -49
  75. package/frontend-vue/tests/support/onboarding-host.ts +0 -104
  76. package/frontend-vue/tests/support/onboarding.ts +0 -176
  77. package/frontend-vue/tests/support/panel-fixtures.ts +0 -155
  78. package/frontend-vue/tests/support/panel-harness.ts +0 -211
  79. package/frontend-vue/tests/support/setup-layout.ts +0 -3
  80. package/frontend-vue/tests/support/stand-ins/DmsBlockPreview.ts +0 -18
  81. package/frontend-vue/tests/support/stand-ins/DmsEmptyState.ts +0 -17
  82. package/frontend-vue/tests/support/stand-ins/DmsSegmentedControl.ts +0 -35
  83. package/frontend-vue/tests/support/stand-ins/DmsStatusPill.ts +0 -7
  84. package/frontend-vue/tests/support/stand-ins/OnboardingModal.ts +0 -13
  85. package/frontend-vue/tests/support/stand-ins/UBadge.ts +0 -7
  86. package/frontend-vue/tests/support/stand-ins/UButton.ts +0 -27
  87. package/frontend-vue/tests/support/stand-ins/UCheckbox.ts +0 -25
  88. package/frontend-vue/tests/support/stand-ins/UDropdownMenu.ts +0 -34
  89. package/frontend-vue/tests/support/stand-ins/UFormField.ts +0 -9
  90. package/frontend-vue/tests/support/stand-ins/UInput.ts +0 -16
  91. package/frontend-vue/tests/support/stand-ins/UKbd.ts +0 -7
  92. package/frontend-vue/tests/support/stand-ins/UModal.ts +0 -20
  93. package/frontend-vue/tests/support/stand-ins/UPopover.ts +0 -9
  94. package/frontend-vue/tests/support/stand-ins/UTabs.ts +0 -31
  95. package/frontend-vue/tests/support/stand-ins/UTextarea.ts +0 -19
  96. package/frontend-vue/tests/support/stubs.ts +0 -28
  97. package/frontend-vue/tests/views/api-data-reads.test.ts +0 -451
  98. package/frontend-vue/tests/views/api-error-presentation.test.ts +0 -89
  99. package/frontend-vue/tests/views/diff-view.test.ts +0 -167
  100. package/frontend-vue/tests/views/use-assistant.test.ts +0 -53
  101. package/frontend-vue/tests/views/view-format.test.ts +0 -59
  102. package/frontend-vue/vitest.config.ts +0 -33
@@ -1,238 +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
- installAssistantPromptListener,
7
- MOCKUP_ASSISTANT_PROMPT_EVENT,
8
- } from "../app/runtime/assistant-prompt";
9
- import {
10
- buttonWithText,
11
- CONVERSATION_ID,
12
- createHarness,
13
- type Harness,
14
- openPanel,
15
- sentOfType,
16
- unmountPanel,
17
- } from "./support/panel-harness";
18
-
19
- const BLOCK = {
20
- mockup: "bikes",
21
- page: "home",
22
- path: "grid.revenue",
23
- type: "ChartCard",
24
- };
25
-
26
- function dispatch(detail: unknown): CustomEvent {
27
- const event = new CustomEvent(MOCKUP_ASSISTANT_PROMPT_EVENT, {
28
- detail,
29
- cancelable: true,
30
- });
31
- window.dispatchEvent(event);
32
- return event;
33
- }
34
-
35
- beforeEach(() => {
36
- localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
37
- });
38
-
39
- afterEach(() => {
40
- unmountPanel();
41
- localStorage.clear();
42
- });
43
-
44
- describe("the mockup editor's prompt event", () => {
45
- it("takes a valid prompt and cancels the event (fails when the editor's copy fallback would still open)", () => {
46
- const onPrompt = vi.fn();
47
- const stop = installAssistantPromptListener(onPrompt);
48
- const event = dispatch({
49
- prompt: "Connect this chart to payments",
50
- block: BLOCK,
51
- source: "connect-data",
52
- });
53
- stop();
54
- expect(event.defaultPrevented).toBe(true);
55
- expect(onPrompt).toHaveBeenCalledWith({
56
- prompt: "Connect this chart to payments",
57
- block: BLOCK,
58
- source: "connect-data",
59
- });
60
- });
61
-
62
- it("takes a build with the mockup's name and no block (fails when build is refused or read as a block prompt)", () => {
63
- const onPrompt = vi.fn();
64
- const stop = installAssistantPromptListener(onPrompt);
65
- const event = dispatch({ prompt: "bikes", source: "build" });
66
- stop();
67
- expect(event.defaultPrevented).toBe(true);
68
- expect(onPrompt).toHaveBeenCalledWith({ prompt: "bikes", source: "build" });
69
- });
70
-
71
- it("leaves a malformed detail to the editor (fails when it is cancelled or taken)", () => {
72
- const onPrompt = vi.fn();
73
- const stop = installAssistantPromptListener(onPrompt);
74
- const unknownSource = dispatch({ prompt: "x", source: "deploy" });
75
- const blockWithoutPath = dispatch({
76
- prompt: "x",
77
- block: { mockup: "bikes", page: "home" },
78
- source: "custom-zone",
79
- });
80
- const buildWithoutName = dispatch({ prompt: "", source: "build" });
81
- stop();
82
- expect(
83
- [unknownSource, blockWithoutPath, buildWithoutName].map(
84
- (event) => event.defaultPrevented,
85
- ),
86
- ).toEqual([false, false, false]);
87
- expect(onPrompt).not.toHaveBeenCalled();
88
- });
89
- });
90
-
91
- describe("a prompt handed to the panel", () => {
92
- it("prefills the composer with the block as context and sends nothing (fails on an auto-send)", async () => {
93
- const harness = createHarness();
94
- const panel = await openPanel(harness);
95
- harness.session.intents.push({
96
- kind: "prompt",
97
- prompt: "Connect this chart to payments",
98
- block: BLOCK,
99
- });
100
- await flushPromises();
101
- const textarea = panel.find("textarea").element as HTMLTextAreaElement;
102
- expect(textarea.value).toBe("Connect this chart to payments");
103
- expect(panel.find(".att.is-block").text()).toContain(
104
- "ChartCard · grid.revenue",
105
- );
106
- expect(sentOfType(harness, "user_message")).toEqual([]);
107
- });
108
-
109
- it("sends the block with the message, once (fails when the block is lost or sticks to the next message)", async () => {
110
- const harness = createHarness();
111
- const panel = await openPanel(harness);
112
- harness.session.intents.push({
113
- kind: "prompt",
114
- prompt: "Connect this chart",
115
- block: BLOCK,
116
- });
117
- await flushPromises();
118
- await panel.find("form.composer").trigger("submit");
119
- await nextTick();
120
- const [sent] = sentOfType(harness, "user_message");
121
- expect(sent.focusBlock).toEqual(BLOCK);
122
- expect(panel.find(".att.is-block").exists()).toBe(false);
123
- });
124
- });
125
-
126
- describe("building into an existing page", () => {
127
- it("takes the page to build into from the event (fails when the target is dropped or a bad one is accepted)", () => {
128
- const onPrompt = vi.fn();
129
- const stop = installAssistantPromptListener(onPrompt);
130
- const event = dispatch({
131
- prompt: "bikes",
132
- source: "build",
133
- target: { pageRef: "/shop/board" },
134
- });
135
- const bad = dispatch({ prompt: "bikes", source: "build", target: {} });
136
- stop();
137
- expect(event.defaultPrevented).toBe(true);
138
- expect(bad.defaultPrevented).toBe(false);
139
- expect(onPrompt).toHaveBeenCalledOnce();
140
- expect(onPrompt).toHaveBeenCalledWith({
141
- prompt: "bikes",
142
- source: "build",
143
- target: { pageRef: "/shop/board" },
144
- });
145
- });
146
-
147
- it("asks the agent to update that page rather than create one (fails when the request reads as a new build)", async () => {
148
- const harness = createHarness();
149
- await openPanel(harness);
150
- harness.session.intents.push({
151
- kind: "build",
152
- mockup: "bikes",
153
- pageRef: "/shop/board",
154
- });
155
- await flushPromises();
156
- const [request] = sentOfType(harness, "user_message");
157
- expect(request.content).toBe(
158
- "Build mockup bikes into the existing page /shop/board with the dms-mockup-build skill. Update that page; do not create a new one.",
159
- );
160
- });
161
- });
162
-
163
- describe("a block sent while a turn runs", () => {
164
- it("goes with the queued follow-up (fails when queueing drops the block the chip promised)", async () => {
165
- const harness = createHarness();
166
- const panel = await openPanel(harness);
167
- harness.session.intents.push({
168
- kind: "prompt",
169
- prompt: "Connect this chart",
170
- block: BLOCK,
171
- });
172
- await flushPromises();
173
- harness.hub.deliver({
174
- conversationId: CONVERSATION_ID,
175
- type: "run_progress",
176
- activity: "thinking",
177
- elapsedMs: 0,
178
- });
179
- await nextTick();
180
- await panel.find("form.composer").trigger("submit");
181
- await nextTick();
182
- const [queued] = sentOfType(harness, "queue_enqueue");
183
- expect(queued.item).toMatchObject({
184
- content: "Connect this chart",
185
- focusBlock: BLOCK,
186
- });
187
- });
188
- });
189
-
190
- describe("a block handed to one conversation", () => {
191
- it("leaves the composer when another conversation opens (fails when the block follows into a build)", async () => {
192
- const harness = createHarness();
193
- const panel = await openPanel(harness);
194
- harness.session.intents.push({
195
- kind: "prompt",
196
- prompt: "Connect this chart",
197
- block: BLOCK,
198
- });
199
- await flushPromises();
200
- harness.session.intents.push({ kind: "build", mockup: "bikes" });
201
- await flushPromises();
202
- expect(panel.find(".att.is-block").exists()).toBe(false);
203
- const [build] = sentOfType(harness, "user_message");
204
- expect(build.focusBlock).toBeUndefined();
205
- });
206
- });
207
-
208
- function lastSentConversation(harness: Harness): string {
209
- const sent = sentOfType(harness, "user_message").at(-1);
210
- if (sent === undefined || typeof sent.conversationId !== "string")
211
- throw new Error("no user message sent");
212
- return sent.conversationId;
213
- }
214
-
215
- describe("building a mockup", () => {
216
- it("starts the build in a new chat and follows it in the dialog until sent to the background (fails when the build is not sent or the dialog cannot be left)", async () => {
217
- const harness = createHarness();
218
- const panel = await openPanel(harness);
219
- harness.session.intents.push({ kind: "build", mockup: "bikes" });
220
- await flushPromises();
221
- const conversationId = lastSentConversation(harness);
222
- expect(conversationId).not.toBe(CONVERSATION_ID);
223
- expect(sentOfType(harness, "user_message")[0].content).toContain("“bikes”");
224
- harness.hub.deliver({
225
- conversationId,
226
- type: "tool_call_start",
227
- callId: "c0",
228
- toolName: "mcp__dms-assistant__builder_create_page",
229
- args: { name: "rentals", displayName: "Rentals", category: "shop" },
230
- });
231
- await nextTick();
232
- const dialog = panel.find(".u-modal");
233
- expect(dialog.text()).toContain("Building “bikes”");
234
- expect(dialog.findAll(".cb-build__step")).toHaveLength(1);
235
- await buttonWithText(dialog, "Run in background").trigger("click");
236
- expect(panel.find(".u-modal").exists()).toBe(false);
237
- });
238
- });
@@ -1,131 +0,0 @@
1
- // @vitest-environment jsdom
2
- import type { VueWrapper } from "@vue/test-utils";
3
- import { afterEach, beforeEach, describe, expect, it } from "vitest";
4
- import { nextTick } from "vue";
5
- import {
6
- CONVERSATION_ID,
7
- createHarness,
8
- deliver,
9
- openPanel,
10
- unmountPanel,
11
- } from "./support/panel-harness";
12
-
13
- beforeEach(() => {
14
- localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
15
- });
16
-
17
- afterEach(() => {
18
- unmountPanel();
19
- localStorage.clear();
20
- });
21
-
22
- const SETTINGS = {
23
- defaultModes: { claude: "auto", codex: "normal" },
24
- thinking: "medium",
25
- generationMode: "safe",
26
- allowLocalSkills: false,
27
- };
28
-
29
- const PROVIDERS = {
30
- claude: { available: true },
31
- codex: { available: true },
32
- };
33
-
34
- function modePill(panel: VueWrapper) {
35
- const pills = panel.findAll(".cb-mode-btn");
36
- return pills[pills.length - 1];
37
- }
38
-
39
- function pickerItems(panel: VueWrapper): string[] {
40
- const menu = modePill(panel).element.closest(".u-dropdown");
41
- return Array.from(menu?.querySelectorAll(".u-dropdown-item") ?? []).map(
42
- (item) => item.textContent?.trim() ?? "",
43
- );
44
- }
45
-
46
- async function useProvider(
47
- harness: ReturnType<typeof createHarness>,
48
- provider: "claude" | "codex",
49
- ): Promise<void> {
50
- deliver(harness, {
51
- type: "settings_update",
52
- settings: { ...SETTINGS, provider },
53
- providers: PROVIDERS,
54
- });
55
- await nextTick();
56
- }
57
-
58
- describe("the approval mode pill", () => {
59
- it("shows Auto review on a fresh Claude chat, without danger styling", async () => {
60
- const harness = createHarness();
61
- const panel = await openPanel(harness);
62
- await useProvider(harness, "claude");
63
- const pill = modePill(panel);
64
- expect(pill.text()).toBe("Auto review");
65
- expect(pickerItems(panel)).toContain("Auto review");
66
- });
67
-
68
- it("reads Ask first on Codex for a chat holding auto, and offers no Auto review", async () => {
69
- const harness = createHarness();
70
- const panel = await openPanel(harness);
71
- await useProvider(harness, "codex");
72
- deliver(harness, {
73
- type: "conversation_mode",
74
- mode: "auto",
75
- generationMode: "safe",
76
- });
77
- await nextTick();
78
- expect(modePill(panel).text()).toBe("Ask first");
79
- expect(pickerItems(panel)).not.toContain("Auto review");
80
- expect(pickerItems(panel)).toContain("Ask first");
81
- });
82
-
83
- it.each(["claude", "codex"] as const)(
84
- "offers no Full auto in the %s mode menu",
85
- async (provider) => {
86
- const harness = createHarness();
87
- const panel = await openPanel(harness);
88
- await useProvider(harness, provider);
89
- const items = pickerItems(panel);
90
- expect(items.length).toBeGreaterThan(0);
91
- expect(items.filter((item) => /full auto/i.test(item))).toEqual([]);
92
- },
93
- );
94
-
95
- it.each([
96
- ["codex", true],
97
- ["claude", false],
98
- ] as const)(
99
- "says Accept edits works as Ask first on %s: %s",
100
- async (provider, worksAsAskFirst) => {
101
- const harness = createHarness();
102
- const panel = await openPanel(harness);
103
- await useProvider(harness, provider);
104
- const acceptEdits = panel
105
- .findAll(".u-dropdown-item")
106
- .find((item) => item.text() === "Accept edits");
107
- const description = acceptEdits?.attributes("data-description") ?? "";
108
- expect(description).not.toBe("");
109
- expect(description.includes("works as Ask first")).toBe(worksAsAskFirst);
110
- },
111
- );
112
-
113
- it("says Auto review is not available, naming the model", async () => {
114
- const harness = createHarness();
115
- const panel = await openPanel(harness);
116
- deliver(harness, {
117
- type: "notice",
118
- notice: {
119
- kind: "auto_unavailable",
120
- model: "claude-haiku-4-5",
121
- timestampMs: Date.now(),
122
- },
123
- });
124
- await nextTick();
125
- const notice = panel.find(".cb-notice");
126
- expect(notice.text()).toContain("Auto review isn't available here.");
127
- expect(notice.text()).toContain(
128
- "claude-haiku-4-5, this plan or a setting doesn't allow it.",
129
- );
130
- });
131
- });
@@ -1,151 +0,0 @@
1
- // @vitest-environment jsdom
2
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import { nextTick } from "vue";
4
- import {
5
- buttonWithText,
6
- CONVERSATION_ID,
7
- createHarness,
8
- deliver,
9
- openPanel,
10
- sendMessage,
11
- sentOfType,
12
- unmountPanel,
13
- } from "./support/panel-harness";
14
- import { keydown } from "./support/panel-fixtures";
15
-
16
- beforeEach(() => {
17
- localStorage.setItem("dms-assistant-conversation-id", CONVERSATION_ID);
18
- });
19
-
20
- afterEach(() => {
21
- unmountPanel();
22
- localStorage.clear();
23
- vi.useRealTimers();
24
- });
25
-
26
- describe("questions, queue and modes", () => {
27
- const QUESTIONS = {
28
- type: "ask_question",
29
- requestId: "q1",
30
- questions: [
31
- {
32
- question: "Where should the page live?",
33
- header: "Placement",
34
- options: [
35
- {
36
- label: "Finance › Overdue invoices",
37
- description: "Next to Invoices",
38
- },
39
- { label: "A tab on Invoices", description: "" },
40
- ],
41
- },
42
- {
43
- question: "Default sort?",
44
- header: "Sort",
45
- options: [
46
- { label: "Days overdue", description: "" },
47
- { label: "Amount", description: "" },
48
- ],
49
- },
50
- ],
51
- };
52
-
53
- it("pages through questions with numbers, Other… and Skip, then keeps the answers", async () => {
54
- const harness = createHarness();
55
- const panel = await openPanel(harness);
56
- deliver(harness, QUESTIONS);
57
- await nextTick();
58
- const dock = panel.find(".cb-ask");
59
- expect(dock.text()).toContain("Question 1 of 2 · Placement");
60
- expect(dock.find(".opt-card.is-selected").text()).toContain("Suggested");
61
- keydown(dock.element, "3");
62
- await nextTick();
63
- await dock.find(".cb-ask__custom").setValue("Under Finance, as a tab");
64
- await buttonWithText(dock.find(".cb-ask__foot"), "Next").trigger("click");
65
- expect(dock.text()).toContain("Question 2 of 2 · Sort");
66
- await buttonWithText(dock, "Skip, you decide").trigger("click");
67
- expect(sentOfType(harness, "question_response")[0]).toEqual({
68
- type: "question_response",
69
- conversationId: CONVERSATION_ID,
70
- requestId: "q1",
71
- answers: ["Under Finance, as a tab", ""],
72
- skipped: [false, true],
73
- });
74
- await nextTick();
75
- const record = panel.find(".cb-answers");
76
- expect(record.text()).toContain("“Under Finance, as a tab”");
77
- expect(record.text()).toContain("Skipped: the assistant decides");
78
- });
79
-
80
- it("edits, reorders and clears the queue", async () => {
81
- const harness = createHarness();
82
- const panel = await openPanel(harness);
83
- deliver(harness, {
84
- type: "queue_state",
85
- items: [
86
- { id: "a", content: "Sort by order count" },
87
- { id: "b", content: "Limit to 3 orders" },
88
- ],
89
- });
90
- await nextTick();
91
- await panel
92
- .find('button[aria-label="Edit queued message"]')
93
- .trigger("click");
94
- await panel.find(".cb-queued__editor").setValue("Sort by revenue");
95
- await buttonWithText(panel.find(".cb-queue"), "Save").trigger("click");
96
- keydown(panel.findAll(".cb-queued__handle")[1].element, "ArrowUp");
97
- await nextTick();
98
- expect(panel.findAll(".cb-queued__txt").map((item) => item.text())).toEqual(
99
- ["Limit to 3 orders", "Sort by revenue"],
100
- );
101
- await buttonWithText(panel.find(".cb-queue"), "Clear").trigger("click");
102
- expect(
103
- harness.sent
104
- .map((msg) => msg.type)
105
- .filter((type) => String(type).startsWith("queue_")),
106
- ).toEqual(["queue_update", "queue_move", "queue_clear"]);
107
- });
108
-
109
- it("sends the chosen mode alone, with nothing that approves for the person", async () => {
110
- const harness = createHarness();
111
- const panel = await openPanel(harness);
112
- await buttonWithText(panel, "Plan only").trigger("click");
113
- expect(sentOfType(harness, "set_conversation_mode")).toEqual([
114
- {
115
- type: "set_conversation_mode",
116
- conversationId: CONVERSATION_ID,
117
- mode: "plan",
118
- },
119
- ]);
120
- });
121
-
122
- it("runs a proposed plan in Ask first", async () => {
123
- const harness = createHarness();
124
- const panel = await openPanel(harness);
125
- await sendMessage(panel, "plan a customer health page");
126
- deliver(harness, {
127
- type: "tool_call_start",
128
- callId: "p1",
129
- toolName: "ExitPlanMode",
130
- args: { plan: "1. Create the page\n2. Add a query" },
131
- });
132
- deliver(harness, {
133
- type: "tool_call_end",
134
- callId: "p1",
135
- status: "success",
136
- result: "",
137
- outcome: "done",
138
- });
139
- deliver(harness, { type: "run_done" });
140
- await nextTick();
141
- const plan = panel.find(".cb-plan");
142
- expect(plan.text()).toContain("Proposed plan · 2 steps");
143
- await buttonWithText(plan, "Run with Ask first").trigger("click");
144
- expect(sentOfType(harness, "set_conversation_mode")[0]).toMatchObject({
145
- mode: "normal",
146
- });
147
- expect(sentOfType(harness, "user_message").at(-1)).toMatchObject({
148
- content: "Go ahead with the plan.",
149
- });
150
- });
151
- });