task-list-session-membership.test.ts 988 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { describe, expect, it } from "vitest";
  2. import { SESSION_TASK_TYPES } from "@zcode/contracts";
  3. import {
  4. TASK_LIST_SESSION_TYPES,
  5. isTaskListSessionType,
  6. } from "../src/zcode-protocol-v4/task-list-session-membership.js";
  7. describe("task-list session membership", () => {
  8. it("只把主任务类型投影进 sessions-index", () => {
  9. expect(TASK_LIST_SESSION_TYPES).toEqual([
  10. "interactive",
  11. "fork",
  12. "workflow_parent",
  13. ]);
  14. expect(
  15. Object.fromEntries(
  16. SESSION_TASK_TYPES.map((taskType) => [
  17. taskType,
  18. isTaskListSessionType(taskType),
  19. ]),
  20. ),
  21. ).toEqual({
  22. fork: true,
  23. interactive: true,
  24. nested_workflow_child: false,
  25. selection_side_chat: false,
  26. subagent_child: false,
  27. workflow_child: false,
  28. workflow_parent: true,
  29. });
  30. });
  31. it("把缺省 taskType 按 legacy interactive 处理", () => {
  32. expect(isTaskListSessionType(undefined)).toBe(true);
  33. });
  34. });