|
2 | 2 | * @vitest-environment node |
3 | 3 | */ |
4 | 4 |
|
5 | | -import { describe, expect, it, vi } from 'vitest' |
6 | | - |
7 | | -/** |
8 | | - * The handler map is a wiring table from tool id to implementation. Only its |
9 | | - * shape is asserted here, so every implementation module it imports is stubbed |
10 | | - * except `workflow/mutations`, which holds the cancellation handler under test |
11 | | - * and loads for real so a renamed or removed export fails at link time. |
12 | | - * Loading the rest reaches the block registry, the executor, and most of |
13 | | - * `lib/`; every stubbed export resolves to a mock function, which is all the |
14 | | - * table needs to bind. |
15 | | - */ |
16 | | -const { stubHandlerModule } = vi.hoisted(() => ({ |
17 | | - stubHandlerModule: () => |
18 | | - new Proxy( |
19 | | - {}, |
20 | | - { |
21 | | - get: (_target, name) => (typeof name === 'string' && name !== 'then' ? vi.fn() : undefined), |
22 | | - has: (_target, name) => typeof name === 'string' && name !== 'then', |
23 | | - } |
24 | | - ), |
25 | | -})) |
26 | | - |
27 | | -vi.mock('@/lib/copilot/tools/handlers/deployment/custom-block', stubHandlerModule) |
28 | | -vi.mock('@/lib/copilot/tools/handlers/deployment/deploy', stubHandlerModule) |
29 | | -vi.mock('@/lib/copilot/tools/handlers/deployment/manage', stubHandlerModule) |
30 | | -vi.mock('@/lib/copilot/tools/handlers/function-execute', stubHandlerModule) |
31 | | -vi.mock('@/lib/copilot/tools/handlers/integration-tools', stubHandlerModule) |
32 | | -vi.mock('@/lib/copilot/tools/handlers/management/connect-slack-bot', stubHandlerModule) |
33 | | -vi.mock('@/lib/copilot/tools/handlers/management/manage-credential', stubHandlerModule) |
34 | | -vi.mock('@/lib/copilot/tools/handlers/management/manage-custom-tool', stubHandlerModule) |
35 | | -vi.mock('@/lib/copilot/tools/handlers/management/manage-mcp-tool', stubHandlerModule) |
36 | | -vi.mock('@/lib/copilot/tools/handlers/management/manage-sandbox', stubHandlerModule) |
37 | | -vi.mock('@/lib/copilot/tools/handlers/management/manage-skill', stubHandlerModule) |
38 | | -vi.mock('@/lib/copilot/tools/handlers/materialize-file', stubHandlerModule) |
39 | | -vi.mock('@/lib/copilot/tools/handlers/oauth', stubHandlerModule) |
40 | | -vi.mock('@/lib/copilot/tools/handlers/resources', stubHandlerModule) |
41 | | -vi.mock('@/lib/copilot/tools/handlers/restore-resource', stubHandlerModule) |
42 | | -vi.mock('@/lib/copilot/tools/handlers/run-code', stubHandlerModule) |
43 | | -vi.mock('@/lib/copilot/tools/handlers/vfs', stubHandlerModule) |
44 | | -vi.mock('@/lib/copilot/tools/handlers/vfs-mutate', stubHandlerModule) |
45 | | -vi.mock('@/lib/copilot/tools/handlers/workflow/queries', stubHandlerModule) |
46 | | - |
47 | | -/** Server-router tools are appended to the map from their own registry, which this test does not cover. */ |
48 | | -vi.mock('@/lib/copilot/tools/server/router', () => ({ getRegisteredServerToolNames: () => [] })) |
49 | | - |
50 | | -import { hasHandler } from '@/lib/copilot/tool-executor/executor' |
51 | | -import { buildHandlerMap } from '@/lib/copilot/tool-executor/handler-map' |
52 | | -import { ensureHandlersRegistered } from '@/lib/copilot/tool-executor/register-handlers' |
| 5 | +import { describe, expect, it } from 'vitest' |
| 6 | +import { hasHandler } from '@/lib/mothership/tool-executor/executor' |
| 7 | +import { ensureHandlersRegistered } from '@/lib/mothership/tool-executor/register-handlers' |
53 | 8 | import { |
54 | 9 | getToolEntry, |
55 | 10 | isSimExecuted, |
56 | 11 | toolRequiresApproval, |
57 | | -} from '@/lib/copilot/tool-executor/router' |
58 | | -import { executeCancelWorkflowRun } from '@/lib/copilot/tools/handlers/workflow/mutations' |
| 12 | +} from '@/lib/mothership/tool-executor/router' |
59 | 13 |
|
60 | 14 | describe('workflow-run cancellation tool routing', () => { |
61 | 15 | it('routes cancellation through Sim with write permission and explicit approval', () => { |
|
0 commit comments