zcodeAgentPresentationSurface.test.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { describe, expect, it } from "vitest";
  2. import { resolveZCodeAgentPresentationSurface } from "../src/zcode-agent/zcodeAgentPresentationSurface.js";
  3. describe("resolveZCodeAgentPresentationSurface", () => {
  4. it("从本地 Desktop Host 的 telemetry runtime surface 推导 Desktop 呈现面", () => {
  5. expect(
  6. resolveZCodeAgentPresentationSurface({
  7. runtimeSurface: "desktop_local_host",
  8. }),
  9. ).toBe("desktop");
  10. });
  11. it("服务端灰度关闭时不注入 Desktop 呈现面", () => {
  12. expect(
  13. resolveZCodeAgentPresentationSurface({
  14. runtimeSurface: "desktop_local_host",
  15. desktopContextPromptEnabled: false,
  16. }),
  17. ).toBeUndefined();
  18. });
  19. it("服务端灰度开启时保留 Desktop 呈现面", () => {
  20. expect(
  21. resolveZCodeAgentPresentationSurface({
  22. serviceAuthorityMode: "desktop-attached-remote",
  23. desktopContextPromptEnabled: true,
  24. }),
  25. ).toBe("desktop");
  26. });
  27. it("从 Desktop-attached remote authority 推导 Desktop 呈现面", () => {
  28. expect(
  29. resolveZCodeAgentPresentationSurface({
  30. serviceAuthorityMode: "desktop-attached-remote",
  31. }),
  32. ).toBe("desktop");
  33. });
  34. it("不把普通 remote runtime 或无宿主事实的 Server 推导成 Desktop", () => {
  35. expect(
  36. resolveZCodeAgentPresentationSurface({
  37. runtimeSurface: "remote_workspace_host",
  38. }),
  39. ).toBeUndefined();
  40. expect(resolveZCodeAgentPresentationSurface({})).toBeUndefined();
  41. });
  42. });