1
0

loader-composition.e2e.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 and foreground tools 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'],
  58. required: ['description', 'prompt'],
  59. },
  60. {
  61. name: 'subagent_claude_code',
  62. parameterNames: ['description', 'prompt'],
  63. required: ['description', 'prompt'],
  64. },
  65. ],
  66. starts: 0,
  67. })
  68. }, LOADER_SMOKE_TEST_TIMEOUT_MS)
  69. })