subagentSettingsReadiness.test.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. import { describe, expect, it } from "vitest";
  2. import { hasCompletedSubagentSettingsLoad } from "#e2e/helpers/subagent-snapshot-wait";
  3. const overview = (pid: number) =>
  4. `[pid:${pid}] [zcode-host] [rpc:call] plugin-management.getPluginsOverview OK (397.9ms)`;
  5. const list = (pid: number) => `[pid:${pid}] [zcode-host] [rpc:call] subagents.list OK (12.1ms)`;
  6. describe("Subagent 设置初始资源刷新屏障", () => {
  7. it("首次列表可见不能代替稍后完成的插件初始化", () => {
  8. expect(hasCompletedSubagentSettingsLoad([list(10), overview(10)])).toBe(false);
  9. });
  10. it("要求同一 Host 在插件初始化之后完成列表刷新", () => {
  11. expect(hasCompletedSubagentSettingsLoad([overview(10), list(20)])).toBe(false);
  12. expect(hasCompletedSubagentSettingsLoad([list(10), overview(10), list(10)])).toBe(true);
  13. });
  14. it("透传的 Main 日志仍按实际 Host 身份配对", () => {
  15. expect(
  16. hasCompletedSubagentSettingsLoad([
  17. `[pid:1] [main] [host-log] ${overview(10)}`,
  18. `[pid:1] [main] [host-log] ${list(20)}`,
  19. ]),
  20. ).toBe(false);
  21. });
  22. });