park-parent.ts 814 B

12345678910111213141516171819202122
  1. /**
  2. * Shared suite helper: keep this package's stand-in parent out of a scripted
  3. * model corpus.
  4. * @module park-parent
  5. */
  6. import type { Context } from '@deepseek-ai/cordis'
  7. import type { SessionId } from '@deepseek-ai/dsh-session'
  8. /**
  9. * Reject every step of the stand-in parent. Each child settlement wakes its
  10. * parent, and these suites size their scripts for child turns only; the tests
  11. * assert on delivery rather than on the parent's own turn.
  12. * @param ctx - the booted test context.
  13. * @param parent - the stand-in parent whose turns must not reach the model.
  14. */
  15. export function parkParent(ctx: Context, parent: { id: SessionId }): void {
  16. ctx.on('agent/pre-step', async ({ agent: subject }, next) => {
  17. if (subject.id !== parent.id) return next()
  18. return { kind: 'reject' as const }
  19. })
  20. }