mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
0406e66369
* fix(ui): keep stable chat rows in insertion order and only sort live tool/stream items by timestamp * fix(ui): keep live rows within current turn * fix(ui): keep current work above queued turns * fix(ui): keep streamed replies above queued turns * fix(ui): preserve reconnecting run order * fix(ui): preserve causal terminal ordering * fix(ui): bound replay rows to owning turns * fix(ui): keep question summaries in owning turns * fix(ui): scope question run ownership to session * fix(ui): restore reconnecting chat run identity * fix(ui): remove unused chatItemTimestamp import in chat-thread-build.ts * fix(ui): correlate question summaries with agent runs Co-authored-by: Peter Lee <li.xialong@xydigit.com> * chore(i18n): refresh native source baseline Co-authored-by: Peter Lee <li.xialong@xydigit.com> * fix(ui): remove unused chatItemTimestamp export and split tool-stream test file --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { Value } from "typebox/value";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
QuestionRecordSchema,
|
|
validateQuestionRequestParams,
|
|
validateQuestionResolveParams,
|
|
validateQuestionWaitAnswerParams,
|
|
} from "./index.js";
|
|
|
|
const question = {
|
|
questionId: "choice",
|
|
header: "Choice",
|
|
question: "Which option?",
|
|
options: [{ label: "One", description: "First" }, { label: "Two" }],
|
|
multiSelect: false,
|
|
isOther: true,
|
|
isSecret: false,
|
|
};
|
|
const answers = { answers: { choice: ["Two"] } };
|
|
|
|
describe("question protocol validators", () => {
|
|
it("validates method params", () => {
|
|
expect(
|
|
validateQuestionRequestParams({
|
|
id: "client-question-id",
|
|
runId: "agent-run-id",
|
|
questions: [question],
|
|
timeoutMs: 100,
|
|
}),
|
|
).toBe(true);
|
|
expect(validateQuestionWaitAnswerParams({ id: "question-uuid", timeoutMs: 50 })).toBe(true);
|
|
expect(validateQuestionResolveParams({ id: "question-uuid", answers })).toBe(true);
|
|
expect(validateQuestionResolveParams({ id: "question-uuid", cancel: true })).toBe(true);
|
|
expect(
|
|
Value.Check(QuestionRecordSchema, {
|
|
id: "client-question-id",
|
|
runId: "agent-run-id",
|
|
questions: [question],
|
|
createdAtMs: 1,
|
|
expiresAtMs: 2,
|
|
status: "pending",
|
|
}),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("enforces the shared question header cap", () => {
|
|
expect(
|
|
validateQuestionRequestParams({
|
|
questions: [{ ...question, header: "longer than twelve" }],
|
|
}),
|
|
).toBe(false);
|
|
expect(validateQuestionRequestParams({ questions: [] })).toBe(false);
|
|
expect(
|
|
validateQuestionRequestParams({ questions: [question, question, question, question] }),
|
|
).toBe(false);
|
|
});
|
|
});
|