source-worker.compat.spec.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Keyless runtime smoke for the source-mode workflow worker. The Node
  3. * compatibility matrix runs this WHOLE file, so renaming or removing its test
  4. * cannot turn the runtime proof into a successful zero-match filter.
  5. */
  6. import { expect, it, vi } from 'vitest'
  7. import { Context } from 'cordis'
  8. import type { Agent } from '@deepseek-ai/dsh-agent'
  9. import SubagentService from '@deepseek-ai/dsh-subagent'
  10. import WorkerWorkflowEngine from '../src/index.ts'
  11. import { SessionId } from '@deepseek-ai/dsh-session'
  12. // A fresh thread compiles the source runtime. Leave contention headroom on
  13. // shared CI runners without weakening any engine-level timeout assertion.
  14. vi.setConfig({ testTimeout: 30_000 })
  15. it('runs the default config through the source worker', async () => {
  16. const ctx = new Context()
  17. const subagents = await ctx.plugin(SubagentService)
  18. const engine = await ctx.plugin(WorkerWorkflowEngine, {})
  19. const parent = { id: SessionId('workflow-compat-parent'), options: {} } as unknown as Agent
  20. try {
  21. const run = ctx.workflows.start({
  22. script: 'return 6 * 7',
  23. meta: { name: 'source-worker-compat', description: 'exercise the unbuilt worker entry' },
  24. parent,
  25. })
  26. try {
  27. await expect(run.result).resolves.toMatchObject({ value: 42, stopReason: 'completed', agentsStarted: 0 })
  28. } finally {
  29. await run.dispose()
  30. }
  31. } finally {
  32. await engine.dispose()
  33. await subagents.dispose()
  34. }
  35. })