loader-composition.e2e.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 two named Claude instances, their tools, and Codex 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-safe', 'claude-bypass'],
  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-safe',
  45. capabilities: {
  46. outputSchema: false,
  47. depthLimit: false,
  48. toolFilter: false,
  49. persona: false,
  50. },
  51. inheritsParentContext: false,
  52. },
  53. {
  54. name: 'claude-bypass',
  55. capabilities: {
  56. outputSchema: false,
  57. depthLimit: false,
  58. toolFilter: false,
  59. persona: false,
  60. },
  61. inheritsParentContext: false,
  62. },
  63. ],
  64. tools: [
  65. {
  66. name: 'subagent_codex',
  67. parameterNames: ['description', 'prompt', 'run_in_background'],
  68. required: ['description', 'prompt'],
  69. },
  70. {
  71. name: 'subagent_claude_safe',
  72. parameterNames: ['description', 'prompt', 'run_in_background'],
  73. required: ['description', 'prompt'],
  74. },
  75. {
  76. name: 'subagent_claude_bypass',
  77. parameterNames: ['description', 'prompt', 'run_in_background'],
  78. required: ['description', 'prompt'],
  79. },
  80. ],
  81. jobTools: ['job_kill', 'job_list', 'job_output'],
  82. starts: 0,
  83. })
  84. }, LOADER_SMOKE_TEST_TIMEOUT_MS)
  85. })