@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,124 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
type ChatChannel,
|
|
4
|
-
createChatChannel,
|
|
5
|
-
} from "../../app/chat/composables/useChatChannel";
|
|
6
|
-
import {
|
|
7
|
-
CHAT_ROLE,
|
|
8
|
-
CLIENT_MESSAGE_TYPES,
|
|
9
|
-
CONNECTION_STATUSES,
|
|
10
|
-
SERVER_EVENT_TYPES,
|
|
11
|
-
} from "../../app/chat/constants/protocol";
|
|
12
|
-
import type { ChannelStatus } from "../../app/runtime/channel-client";
|
|
13
|
-
import { createChatTransport } from "../../app/runtime/chat-transport";
|
|
14
|
-
|
|
15
|
-
const CONVERSATION_ID = "conv-channel-1";
|
|
16
|
-
|
|
17
|
-
const HELLO = {
|
|
18
|
-
type: CLIENT_MESSAGE_TYPES.HELLO,
|
|
19
|
-
role: CHAT_ROLE,
|
|
20
|
-
conversationId: CONVERSATION_ID,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
interface FakeStream {
|
|
24
|
-
sent: unknown[];
|
|
25
|
-
reconnects: number;
|
|
26
|
-
status: ChannelStatus;
|
|
27
|
-
hub: ReturnType<typeof createChatTransport>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/** The dashboard's side: a stream whose status the test drives. */
|
|
31
|
-
function fakeStream(status: ChannelStatus): FakeStream {
|
|
32
|
-
const stream: FakeStream = {
|
|
33
|
-
sent: [],
|
|
34
|
-
reconnects: 0,
|
|
35
|
-
status,
|
|
36
|
-
hub: createChatTransport({
|
|
37
|
-
send: (msg) => {
|
|
38
|
-
if (stream.status !== CONNECTION_STATUSES.CONNECTED) return false;
|
|
39
|
-
stream.sent.push(msg);
|
|
40
|
-
return true;
|
|
41
|
-
},
|
|
42
|
-
reconnect: () => {
|
|
43
|
-
stream.reconnects += 1;
|
|
44
|
-
},
|
|
45
|
-
getStatus: () => stream.status,
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
return stream;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let channel: ChatChannel | undefined;
|
|
52
|
-
|
|
53
|
-
function open(stream: FakeStream): ChatChannel {
|
|
54
|
-
channel = createChatChannel({
|
|
55
|
-
transport: stream.hub.transport,
|
|
56
|
-
getConversationId: () => CONVERSATION_ID,
|
|
57
|
-
});
|
|
58
|
-
channel.start();
|
|
59
|
-
return channel;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
afterEach(() => {
|
|
63
|
-
channel?.stop();
|
|
64
|
-
channel = undefined;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe("the chat's side of the dashboard's stream", () => {
|
|
68
|
-
it("hands the chat every message meant for it, a running turn's progress included", () => {
|
|
69
|
-
const stream = fakeStream(CONNECTION_STATUSES.CONNECTED);
|
|
70
|
-
const received: unknown[] = [];
|
|
71
|
-
open(stream).result.onMessage((msg) => received.push(msg));
|
|
72
|
-
const progress = {
|
|
73
|
-
type: SERVER_EVENT_TYPES.RUN_PROGRESS,
|
|
74
|
-
conversationId: CONVERSATION_ID,
|
|
75
|
-
activity: "tool",
|
|
76
|
-
detail: "Write",
|
|
77
|
-
elapsedMs: 5_000,
|
|
78
|
-
idleMs: 0,
|
|
79
|
-
};
|
|
80
|
-
stream.hub.deliver(progress);
|
|
81
|
-
expect(received).toEqual([progress]);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("says hello with its conversation when it attaches and on every new connection", () => {
|
|
85
|
-
const stream = fakeStream(CONNECTION_STATUSES.CONNECTED);
|
|
86
|
-
open(stream);
|
|
87
|
-
stream.hub.announceReady();
|
|
88
|
-
expect(stream.sent).toEqual([HELLO, HELLO]);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("tells the chat a message did not leave while the stream is down", () => {
|
|
92
|
-
const stream = fakeStream(CONNECTION_STATUSES.RECONNECTING);
|
|
93
|
-
const { result } = open(stream);
|
|
94
|
-
expect(result.isConnected.value).toBe(false);
|
|
95
|
-
expect(result.send({ type: CLIENT_MESSAGE_TYPES.INTERRUPT_TURN })).toBe(
|
|
96
|
-
false,
|
|
97
|
-
);
|
|
98
|
-
stream.status = CONNECTION_STATUSES.CONNECTED;
|
|
99
|
-
stream.hub.announceStatus(CONNECTION_STATUSES.CONNECTED);
|
|
100
|
-
expect(result.isConnected.value).toBe(true);
|
|
101
|
-
expect(result.send({ type: CLIENT_MESSAGE_TYPES.INTERRUPT_TURN })).toBe(
|
|
102
|
-
true,
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("reconnects the dashboard's stream when the chat asks, as the stalled-run notice does", () => {
|
|
107
|
-
const stream = fakeStream(CONNECTION_STATUSES.CONNECTED);
|
|
108
|
-
open(stream).result.reconnect();
|
|
109
|
-
expect(stream.reconnects).toBe(1);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it("hands nothing over and sends nothing once stopped", () => {
|
|
113
|
-
const stream = fakeStream(CONNECTION_STATUSES.CONNECTED);
|
|
114
|
-
const received: unknown[] = [];
|
|
115
|
-
const opened = open(stream);
|
|
116
|
-
opened.result.onMessage((msg) => received.push(msg));
|
|
117
|
-
opened.stop();
|
|
118
|
-
stream.hub.deliver({ type: SERVER_EVENT_TYPES.RUN_DONE });
|
|
119
|
-
expect(received).toEqual([]);
|
|
120
|
-
expect(opened.result.send({ type: CLIENT_MESSAGE_TYPES.HELLO })).toBe(
|
|
121
|
-
false,
|
|
122
|
-
);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import { useConversation } from "../../app/chat/composables/useConversation";
|
|
4
|
-
import {
|
|
5
|
-
LOCAL_ERROR_KEYS,
|
|
6
|
-
MESSAGE_ROLES,
|
|
7
|
-
TOOL_STATUS,
|
|
8
|
-
} from "../../app/chat/constants/conversation";
|
|
9
|
-
import {
|
|
10
|
-
CLIENT_MESSAGE_TYPES,
|
|
11
|
-
SERVER_EVENT_TYPES,
|
|
12
|
-
} from "../../app/chat/constants/protocol";
|
|
13
|
-
import {
|
|
14
|
-
ACTIVITY_KINDS,
|
|
15
|
-
QUIET_NOTICE_AFTER_MS,
|
|
16
|
-
} from "../../app/chat/constants/run-status";
|
|
17
|
-
import type {
|
|
18
|
-
RunProgress,
|
|
19
|
-
ToolCallMessage,
|
|
20
|
-
} from "../../app/chat/types/conversation";
|
|
21
|
-
import type { PendingAttachment } from "../../app/chat/utils/attachments";
|
|
22
|
-
import { isAgentQuiet } from "../../app/chat/utils/run-status";
|
|
23
|
-
import { toolRowState } from "../../app/chat/utils/tool-state";
|
|
24
|
-
|
|
25
|
-
const CONVERSATION_ID = "conv-chat-1";
|
|
26
|
-
const FILE_DATA = "PGh0bWw+PC9odG1sPg==";
|
|
27
|
-
|
|
28
|
-
interface Harness {
|
|
29
|
-
conversation: ReturnType<typeof useConversation>;
|
|
30
|
-
sent: Record<string, unknown>[];
|
|
31
|
-
receive: (event: Record<string, unknown>) => void;
|
|
32
|
-
setConnected: (isConnected: boolean) => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function harness(): Harness {
|
|
36
|
-
const sent: Record<string, unknown>[] = [];
|
|
37
|
-
let isConnected = true;
|
|
38
|
-
let deliver: (msg: unknown) => void = () => {};
|
|
39
|
-
const conversation = useConversation({
|
|
40
|
-
activeId: ref(CONVERSATION_ID),
|
|
41
|
-
send: (msg) => {
|
|
42
|
-
if (!isConnected) return false;
|
|
43
|
-
sent.push(msg as Record<string, unknown>);
|
|
44
|
-
return true;
|
|
45
|
-
},
|
|
46
|
-
onMessage: (handler) => {
|
|
47
|
-
deliver = handler;
|
|
48
|
-
return () => {};
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
conversation,
|
|
53
|
-
sent,
|
|
54
|
-
receive: (event) => deliver({ conversationId: CONVERSATION_ID, ...event }),
|
|
55
|
-
setConnected: (value) => {
|
|
56
|
-
isConnected = value;
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function attachment(): PendingAttachment {
|
|
62
|
-
return {
|
|
63
|
-
id: "att-1",
|
|
64
|
-
name: "OP_Manager_v176.html",
|
|
65
|
-
mimeType: "text/html",
|
|
66
|
-
size: 13,
|
|
67
|
-
data: FILE_DATA,
|
|
68
|
-
dataUrl: `data:text/html;base64,${FILE_DATA}`,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function startToolCall(h: Harness): void {
|
|
73
|
-
h.receive({
|
|
74
|
-
type: SERVER_EVENT_TYPES.TOOL_CALL_START,
|
|
75
|
-
callId: "call-1",
|
|
76
|
-
toolName: "Bash",
|
|
77
|
-
args: { command: "pnpm dev" },
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
describe("a run that fails reaches the user", () => {
|
|
82
|
-
it("ends the run with the reason, and leaves no tool running", () => {
|
|
83
|
-
const h = harness();
|
|
84
|
-
h.conversation.sendUserMessage("reproduire sans casser le design", [
|
|
85
|
-
attachment(),
|
|
86
|
-
]);
|
|
87
|
-
startToolCall(h);
|
|
88
|
-
h.receive({
|
|
89
|
-
type: SERVER_EVENT_TYPES.RUN_ERROR,
|
|
90
|
-
error: "The agent stopped before finishing its answer.",
|
|
91
|
-
});
|
|
92
|
-
const messages = h.conversation.messages.value;
|
|
93
|
-
expect(h.conversation.isRunning.value).toBe(false);
|
|
94
|
-
expect(messages.at(-1)).toMatchObject({
|
|
95
|
-
role: MESSAGE_ROLES.ERROR,
|
|
96
|
-
content: "The agent stopped before finishing its answer.",
|
|
97
|
-
});
|
|
98
|
-
expect(messages.find((m) => m.role === MESSAGE_ROLES.TOOL)).toMatchObject({
|
|
99
|
-
status: TOOL_STATUS.ERROR,
|
|
100
|
-
outcome: "stopped",
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("says a message was not sent instead of waiting for an answer", () => {
|
|
105
|
-
const h = harness();
|
|
106
|
-
h.setConnected(false);
|
|
107
|
-
h.conversation.sendUserMessage("reproduire sans casser le design");
|
|
108
|
-
expect(h.conversation.isRunning.value).toBe(false);
|
|
109
|
-
expect(h.conversation.messages.value.at(-1)).toMatchObject({
|
|
110
|
-
role: MESSAGE_ROLES.ERROR,
|
|
111
|
-
contentKey: LOCAL_ERROR_KEYS.NOT_SENT,
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("asks the sidecar to run a failed turn again", () => {
|
|
116
|
-
const h = harness();
|
|
117
|
-
h.conversation.sendUserMessage("reproduire sans casser le design", [
|
|
118
|
-
attachment(),
|
|
119
|
-
]);
|
|
120
|
-
h.receive({ type: SERVER_EVENT_TYPES.RUN_ERROR, error: "API Error: 529" });
|
|
121
|
-
h.conversation.retry();
|
|
122
|
-
expect(
|
|
123
|
-
h.sent.filter((msg) => msg.type === CLIENT_MESSAGE_TYPES.USER_MESSAGE),
|
|
124
|
-
).toHaveLength(1);
|
|
125
|
-
expect(h.sent.at(-1)).toEqual({
|
|
126
|
-
type: CLIENT_MESSAGE_TYPES.RETRY_TURN,
|
|
127
|
-
conversationId: CONVERSATION_ID,
|
|
128
|
-
});
|
|
129
|
-
expect(h.conversation.isRunning.value).toBe(true);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("resends a message that never left, with its file", () => {
|
|
133
|
-
const h = harness();
|
|
134
|
-
h.setConnected(false);
|
|
135
|
-
h.conversation.sendUserMessage("reproduire", [attachment()]);
|
|
136
|
-
h.setConnected(true);
|
|
137
|
-
h.conversation.retry();
|
|
138
|
-
expect(h.sent.at(-1)).toMatchObject({
|
|
139
|
-
type: CLIENT_MESSAGE_TYPES.USER_MESSAGE,
|
|
140
|
-
content: "reproduire",
|
|
141
|
-
attachments: [{ name: "OP_Manager_v176.html", data: FILE_DATA }],
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it("shows an unsent message once, even after a retry", () => {
|
|
146
|
-
const h = harness();
|
|
147
|
-
h.setConnected(false);
|
|
148
|
-
h.conversation.sendUserMessage("reproduire sans casser le design");
|
|
149
|
-
h.setConnected(true);
|
|
150
|
-
h.conversation.retry();
|
|
151
|
-
const bubbles = h.conversation.messages.value.filter(
|
|
152
|
-
(msg) => msg.role === MESSAGE_ROLES.USER,
|
|
153
|
-
);
|
|
154
|
-
expect(bubbles).toHaveLength(1);
|
|
155
|
-
expect(bubbles[0]).not.toHaveProperty("isUnsent");
|
|
156
|
-
expect(h.sent).toHaveLength(1);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("offers no retry for a failure the same request cannot get past", () => {
|
|
160
|
-
const h = harness();
|
|
161
|
-
h.conversation.sendUserMessage("go");
|
|
162
|
-
h.receive({
|
|
163
|
-
type: SERVER_EVENT_TYPES.RUN_ERROR,
|
|
164
|
-
error: "The conversation no longer fits in the model's context.",
|
|
165
|
-
isRetryable: false,
|
|
166
|
-
});
|
|
167
|
-
h.receive({
|
|
168
|
-
type: SERVER_EVENT_TYPES.CONVERSATION_SNAPSHOT,
|
|
169
|
-
messages: [
|
|
170
|
-
{ role: "user", content: "go", timestampMs: 1 },
|
|
171
|
-
{
|
|
172
|
-
role: "error",
|
|
173
|
-
content: "The conversation no longer fits in the model's context.",
|
|
174
|
-
isRetryable: false,
|
|
175
|
-
timestampMs: 2,
|
|
176
|
-
},
|
|
177
|
-
{ role: "error", content: "API Error: 529", timestampMs: 3 },
|
|
178
|
-
],
|
|
179
|
-
});
|
|
180
|
-
const [, tooLong, overloaded] = h.conversation.messages.value;
|
|
181
|
-
expect(tooLong).toMatchObject({ isRetryable: false });
|
|
182
|
-
expect(overloaded).toMatchObject({ isRetryable: true });
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it("asks for the files again when an unsent message lost them", () => {
|
|
186
|
-
const h = harness();
|
|
187
|
-
h.setConnected(false);
|
|
188
|
-
h.conversation.sendUserMessage("reproduire", [attachment()]);
|
|
189
|
-
const unsent = h.conversation.messages.value[0];
|
|
190
|
-
if (unsent.role !== MESSAGE_ROLES.USER) throw new Error("no user message");
|
|
191
|
-
unsent.attachments = [{ name: "a.html", mimeType: "text/html", size: 1 }];
|
|
192
|
-
h.setConnected(true);
|
|
193
|
-
h.conversation.retry();
|
|
194
|
-
expect(h.sent).toEqual([]);
|
|
195
|
-
expect(h.conversation.messages.value.at(-1)).toMatchObject({
|
|
196
|
-
contentKey: LOCAL_ERROR_KEYS.RETRY_NEEDS_FILES,
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it("shows a stored error, and a tool left open as stopped after a reload", () => {
|
|
201
|
-
const h = harness();
|
|
202
|
-
h.receive({
|
|
203
|
-
type: SERVER_EVENT_TYPES.CONVERSATION_SNAPSHOT,
|
|
204
|
-
messages: [
|
|
205
|
-
{ role: "user", content: "go", timestampMs: 1 },
|
|
206
|
-
{
|
|
207
|
-
role: "tool_use",
|
|
208
|
-
content: "{}",
|
|
209
|
-
toolName: "Bash",
|
|
210
|
-
callId: "call-1",
|
|
211
|
-
timestampMs: 2,
|
|
212
|
-
},
|
|
213
|
-
{ role: "error", content: "The run was stopped.", timestampMs: 3 },
|
|
214
|
-
],
|
|
215
|
-
});
|
|
216
|
-
const [, tool, error] = h.conversation.messages.value;
|
|
217
|
-
expect(toolRowState(tool as ToolCallMessage, false, null)).toBe("stopped");
|
|
218
|
-
expect(error).toMatchObject({
|
|
219
|
-
role: MESSAGE_ROLES.ERROR,
|
|
220
|
-
content: "The run was stopped.",
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it("lets the run go when Stop cannot reach the assistant", () => {
|
|
225
|
-
const h = harness();
|
|
226
|
-
h.conversation.sendUserMessage("go");
|
|
227
|
-
h.setConnected(false);
|
|
228
|
-
h.conversation.interrupt();
|
|
229
|
-
expect(h.conversation.isRunning.value).toBe(false);
|
|
230
|
-
expect(h.conversation.messages.value.at(-1)).toMatchObject({
|
|
231
|
-
contentKey: LOCAL_ERROR_KEYS.STOP_NOT_DELIVERED,
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
describe("a run that keeps working shows it", () => {
|
|
237
|
-
it("keeps what the agent reports, and when it last heard from the sidecar", () => {
|
|
238
|
-
const h = harness();
|
|
239
|
-
h.conversation.sendUserMessage("go");
|
|
240
|
-
const before = h.conversation.lastEventAtMs.value;
|
|
241
|
-
h.receive({
|
|
242
|
-
type: SERVER_EVENT_TYPES.RUN_PROGRESS,
|
|
243
|
-
activity: "writing",
|
|
244
|
-
detail: "Write",
|
|
245
|
-
elapsedMs: 42_000,
|
|
246
|
-
idleMs: 1_000,
|
|
247
|
-
});
|
|
248
|
-
expect(h.conversation.isTurnInFlight.value).toBe(true);
|
|
249
|
-
expect(h.conversation.progress.value).toMatchObject({
|
|
250
|
-
activity: "writing",
|
|
251
|
-
detail: "Write",
|
|
252
|
-
elapsedMs: 42_000,
|
|
253
|
-
});
|
|
254
|
-
expect(h.conversation.lastEventAtMs.value).toBeGreaterThanOrEqual(before);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it("forgets the progress once the run is over", () => {
|
|
258
|
-
const h = harness();
|
|
259
|
-
h.conversation.sendUserMessage("go");
|
|
260
|
-
h.receive({
|
|
261
|
-
type: SERVER_EVENT_TYPES.RUN_PROGRESS,
|
|
262
|
-
activity: "thinking",
|
|
263
|
-
elapsedMs: 0,
|
|
264
|
-
idleMs: 0,
|
|
265
|
-
});
|
|
266
|
-
h.receive({ type: SERVER_EVENT_TYPES.RUN_DONE });
|
|
267
|
-
expect(h.conversation.progress.value).toBeNull();
|
|
268
|
-
expect(h.conversation.isTurnInFlight.value).toBe(false);
|
|
269
|
-
expect(h.conversation.isRunning.value).toBe(false);
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe("a quiet agent is only called out when silence is unexpected", () => {
|
|
274
|
-
const quietFor = (activity: RunProgress["activity"]): RunProgress => ({
|
|
275
|
-
activity,
|
|
276
|
-
elapsedMs: QUIET_NOTICE_AFTER_MS,
|
|
277
|
-
idleMs: QUIET_NOTICE_AFTER_MS,
|
|
278
|
-
receivedAtMs: 0,
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it("says so while the model is thinking", () => {
|
|
282
|
-
expect(isAgentQuiet(quietFor(ACTIVITY_KINDS.THINKING), 0)).toBe(true);
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it("stays silent while a tool runs without output", () => {
|
|
286
|
-
expect(isAgentQuiet(quietFor(ACTIVITY_KINDS.TOOL), 0)).toBe(false);
|
|
287
|
-
});
|
|
288
|
-
});
|