loader-composition.e2e.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { join } from 'node:path'
  2. import { fileURLToPath } from 'node:url'
  3. import { describe, expect, it } from 'vitest'
  4. import {
  5. LOADER_SMOKE_TEST_TIMEOUT_MS,
  6. runLoaderSmoke,
  7. } from '@deepseek-ai/dsh-loader-smoke'
  8. const fixtureDir = fileURLToPath(new URL(
  9. '../../../../examples/acp-agent/tests/fixtures/subagent/subagent-claude-code/',
  10. import.meta.url,
  11. ))
  12. const driver = join(fixtureDir, 'driver.ts')
  13. const configPath = join(fixtureDir, 'cordis.yml')
  14. const repoTsconfig = fileURLToPath(new URL('../../../../tsconfig.json', import.meta.url))
  15. describe('product-provider public Loader composition', () => {
  16. it('loads both opt-in packages, one-shot task tools, and job controls without starting either product', async () => {
  17. const { stdout, stderr } = await runLoaderSmoke({
  18. label: 'product-provider Loader composition',
  19. tempDirPrefix: 'dsh-product-provider-loader-',
  20. binScript: driver,
  21. libBinScript: driver,
  22. configPath,
  23. tsconfigPath: repoTsconfig,
  24. env: {
  25. // Loading either optional package must not probe or start its binary.
  26. PATH: '',
  27. },
  28. })
  29. expect(stderr).toBe('')
  30. expect(JSON.parse(stdout)).toEqual({
  31. registeredProviders: ['codex', 'claude-code'],
  32. providers: [
  33. {
  34. name: 'codex',
  35. capabilities: {
  36. outputSchema: false,
  37. depthLimit: false,
  38. toolFilter: false,
  39. persona: false,
  40. },
  41. inheritsParentContext: false,
  42. },
  43. {
  44. name: 'claude-code',
  45. capabilities: {
  46. outputSchema: false,
  47. depthLimit: false,
  48. toolFilter: false,
  49. persona: false,
  50. },
  51. inheritsParentContext: false,
  52. },
  53. ],
  54. tools: [
  55. {
  56. name: 'subagent_codex',
  57. parameterNames: ['description', 'prompt', 'run_in_background'],
  58. required: ['description', 'prompt'],
  59. },
  60. {
  61. name: 'subagent_claude_code',
  62. parameterNames: ['description', 'prompt', 'run_in_background'],
  63. required: ['description', 'prompt'],
  64. },
  65. ],
  66. jobTools: ['job_kill', 'job_list', 'job_output'],
  67. starts: 0,
  68. })
  69. }, LOADER_SMOKE_TEST_TIMEOUT_MS)
  70. })