zcodeAgentPresentationSurface.test.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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-attached remote authority 推导 Desktop 呈现面", () => {
  20. expect(
  21. resolveZCodeAgentPresentationSurface({
  22. serviceAuthorityMode: "desktop-attached-remote",
  23. }),
  24. ).toBe("desktop");
  25. });
  26. it("不把普通 remote runtime 或无宿主事实的 Server 推导成 Desktop", () => {
  27. expect(
  28. resolveZCodeAgentPresentationSurface({
  29. runtimeSurface: "remote_workspace_host",
  30. }),
  31. ).toBeUndefined();
  32. expect(resolveZCodeAgentPresentationSurface({})).toBeUndefined();
  33. });
  34. });