acp-app.spec.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /** The ACP app bundle's declared profile patch. */
  2. import { readFileSync } from 'node:fs'
  3. import { resolve } from 'node:path'
  4. import { fileURLToPath } from 'node:url'
  5. import * as yaml from 'js-yaml'
  6. import { describe, expect, it } from 'vitest'
  7. import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
  8. describe('dsh-acp-app bundle', () => {
  9. it('declares startup-gated ACP serving without overriding base HMR policy', () => {
  10. const root = fileURLToPath(new URL('..', import.meta.url))
  11. const manifest = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8')) as {
  12. dependencies?: Record<string, string>
  13. dsh?: { bundle?: { patch?: string } }
  14. }
  15. expect(manifest.dsh?.bundle?.patch).toBe('./cordis.patch.yml')
  16. expect(manifest.dependencies).toHaveProperty('@deepseek-ai/dsh-acp')
  17. const patches = yaml.load(
  18. readFileSync(resolve(root, manifest.dsh!.bundle!.patch!), 'utf8'),
  19. { schema: entryListSchema },
  20. ) as Array<{
  21. id?: string
  22. disabled?: boolean
  23. insert?: Array<{ config?: { model?: string; provider?: string }; id?: string; inject?: string[]; name?: string }>
  24. }>
  25. expect(patches.find(patch => patch.id === 'hmr')).toMatchObject({ disabled: true })
  26. expect(patches.find(patch => patch.id === 'session-title-llm')).toMatchObject({ disabled: true })
  27. const rows = patches.flatMap(patch => patch.insert ?? [])
  28. expect(rows.find(row => row.id === 'acp-app-startup')?.name).toBe('@deepseek-ai/dsh-acp-app')
  29. expect(rows.find(row => row.id === 'acp')).toMatchObject({
  30. inject: ['acpAppStartup'],
  31. config: { provider: 'deepseek-official', model: 'deepseek-v4-flash' },
  32. })
  33. })
  34. })