node-plugin.spec.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { Context } from '@deepseek-ai/cordis'
  2. import { afterEach, describe, expect, it } from 'vitest'
  3. import ToolRegistry from '@deepseek-ai/dsh-tools'
  4. import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
  5. import UserInteractionService from '@deepseek-ai/dsh-user-interaction'
  6. import { apply } from '../src/index.ts'
  7. let ctx: Context | undefined
  8. afterEach(async () => {
  9. await ctx?.fiber.dispose()
  10. ctx = undefined
  11. })
  12. describe('ui-question node plugin', () => {
  13. it('mounts no model-facing tool', async () => {
  14. ctx = new Context()
  15. await ctx.plugin(SystemPrompt)
  16. await ctx.plugin(ToolRegistry)
  17. await ctx.plugin(UserInteractionService)
  18. await ctx.plugin({ apply }).await()
  19. // Selecting the Web question FEATURE must not hand every agent the tool.
  20. // `ctx.tools.register` on an unscoped host context files into the global
  21. // layer, which merges into every agent's view regardless of the preset
  22. // that composed it — so a two-tool benchmark preset would really present
  23. // three. The `tool-ask-user` row belongs to the presets that want it.
  24. expect(ctx.tools.get('ask_user_question')).toBeUndefined()
  25. })
  26. })