(workspaceId: string)
| 65 | } |
| 66 | |
| 67 | async function createSessionHarness(workspaceId: string): Promise<SessionHarness> { |
| 68 | const { historyService, config, cleanup } = await createTestHistoryService(); |
| 69 | await config.addWorkspace(PROJECT_PATH, { |
| 70 | id: workspaceId, |
| 71 | name: workspaceId, |
| 72 | projectName: "mux-agent-session-goal-test-project", |
| 73 | projectPath: PROJECT_PATH, |
| 74 | runtimeConfig: { type: "local" }, |
| 75 | }); |
| 76 | |
| 77 | const extensionMetadata = new ExtensionMetadataService( |
| 78 | `${config.rootDir}/agent-session-goal-extension-metadata.json` |
| 79 | ); |
| 80 | const analytics = { recordGoalLifecycleEvent: mock(() => undefined) }; |
| 81 | const goalService = new WorkspaceGoalService( |
| 82 | config, |
| 83 | historyService, |
| 84 | extensionMetadata, |
| 85 | analytics |
| 86 | ); |
| 87 | const initStateManager = Object.assign(new EventEmitter(), { |
| 88 | replayInit: mock((_workspaceId: string) => Promise.resolve()), |
| 89 | }) as unknown as InitStateManager; |
| 90 | const backgroundProcessManager = { |
| 91 | cleanup: mock((_workspaceId: string) => Promise.resolve()), |
| 92 | setMessageQueued: mock((_workspaceId: string, _queued: boolean) => undefined), |
| 93 | } as unknown as BackgroundProcessManager; |
| 94 | |
| 95 | const aiService = createAiService(workspaceId); |
| 96 | const session = new AgentSession({ |
| 97 | workspaceId, |
| 98 | config, |
| 99 | historyService, |
| 100 | aiService, |
| 101 | initStateManager, |
| 102 | backgroundProcessManager, |
| 103 | workspaceGoalService: goalService, |
| 104 | }); |
| 105 | |
| 106 | return { historyService, session, goalService, extensionMetadata, aiService, analytics, cleanup }; |
| 107 | } |
| 108 | |
| 109 | describe("AgentSession goal safety hooks", () => { |
| 110 | const cleanups: Array<() => Promise<void>> = []; |
no test coverage detected