48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import type { CreateRunInput } from "../../common/types.js";
|
|
import { MemoryAgentRunStore } from "../../mgr/store.js";
|
|
import type { SelfTestCase } from "../harness.js";
|
|
|
|
const selfTest: SelfTestCase = () => {
|
|
const store = new MemoryAgentRunStore();
|
|
const run = store.createRun(runInput());
|
|
const submittedAt = "2026-07-20T01:13:07.699Z";
|
|
const command = store.createCommand(run.id, {
|
|
type: "turn",
|
|
idempotencyKey: "user-submitted-at",
|
|
payload: {
|
|
prompt: "hi",
|
|
traceId: "trc_user_submitted_at",
|
|
userMessageId: "msg_user_submitted_at",
|
|
submittedAt,
|
|
},
|
|
});
|
|
const event = store.listEvents(run.id, 0, 10)
|
|
.find((candidate) => candidate.type === "user_message" && candidate.payload.commandId === command.id);
|
|
|
|
assert.equal(event?.payload.submittedAt, submittedAt);
|
|
return { name: "user-submitted-at", tests: ["command-user-message-preserves-submitted-at"] };
|
|
};
|
|
|
|
function runInput(): CreateRunInput {
|
|
return {
|
|
tenantId: "hwlab",
|
|
projectId: "pikasTech/HWLAB",
|
|
workspaceRef: { kind: "host-path", path: "/tmp/agentrun-user-submitted-at" },
|
|
sessionRef: { sessionId: "ses_user_submitted_at", metadata: { hwlabSessionId: "ses_user_submitted_at" } },
|
|
resourceBundleRef: null,
|
|
providerId: "NC01",
|
|
backendProfile: "gpt-pika",
|
|
executionPolicy: {
|
|
sandbox: "danger-full-access",
|
|
approval: "never",
|
|
timeoutMs: 60_000,
|
|
network: "enabled",
|
|
secretScope: { allowCredentialEcho: false, providerCredentials: [] },
|
|
},
|
|
traceSink: null,
|
|
};
|
|
}
|
|
|
|
export default selfTest;
|