Files
open-design/e2e/lib/vitest/messages.ts
PerishFireandGitHub 976edaf38e test: harden e2e smoke and release reports (#1140)
* test: harden e2e inspect specs

* test: wire e2e release reports

* chore: bump packaged beta base to 0.6.1

* test: run release smoke vitest directly

* test: add suite-owned tools-dev lifecycle

* ci: harden stable release packaging

* fix(release,e2e): gate stable signing on verify and harden suite cleanup

- restore `needs: [metadata, verify]` on the stable release `build_mac`,
  `build_mac_intel`, `build_win`, and `build_linux` jobs so Apple
  signing/notarization and Windows release builds cannot run before
  pnpm guard, typecheck, and layout checks complete on the metadata commit.
- in `runToolsDevSuite`, drop the `started` flag and always attempt
  `stopToolsDevWeb` in `finally`; record stop errors in diagnostics, and
  when the test body succeeded, escalate the stop failure to the suite
  result and rethrow — so orphan daemon/web processes from an interrupted
  `startToolsDevWeb` or a broken shutdown can no longer pass silently.

Addresses PR #1140 review feedback from lefarcen and mrcfps.
2026-05-11 13:11:16 +08:00

43 lines
1.2 KiB
TypeScript

import { requestJson } from './http.ts';
export type E2eChatMessage = {
agentId?: string | null;
agentName?: string;
content: string;
createdAt?: number;
endedAt?: number;
events?: unknown[];
id: string;
producedFiles?: unknown[];
role: 'assistant' | 'user';
runId?: string;
runStatus?: 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled';
startedAt?: number;
telemetryFinalized?: boolean;
};
export async function saveMessage(
baseUrl: string,
projectId: string,
conversationId: string,
message: E2eChatMessage,
): Promise<E2eChatMessage> {
return await requestJson<E2eChatMessage>(
baseUrl,
`/api/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(conversationId)}/messages/${encodeURIComponent(message.id)}`,
{ body: message, method: 'PUT' },
);
}
export async function listMessages(
baseUrl: string,
projectId: string,
conversationId: string,
): Promise<E2eChatMessage[]> {
const response = await requestJson<{ messages: E2eChatMessage[] }>(
baseUrl,
`/api/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(conversationId)}/messages`,
);
return response.messages;
}