invariant.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-code-runtime-worker`.
  3. * @module @deepseek-ai/dsh-code-runtime-worker/invariant
  4. */
  5. /* jscpd:ignore-start */
  6. import type { Context } from 'cordis'
  7. import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
  8. const PACKAGE_NAME = '@deepseek-ai/dsh-code-runtime-worker'
  9. /** Cordis companion plugin name. */
  10. export const name = 'code-runtime-worker-invariant'
  11. /** Service required before the companion can reserve package ownership. */
  12. export const inject = ['invariants']
  13. /**
  14. * No runtime invariant: this process-boundary implementation exposes no same-process event relation;
  15. * worker protocol and built-worker tests cover it.
  16. */
  17. const install: InvariantInstaller = () => {}
  18. /**
  19. * Register this package's invariant companion.
  20. * @param ctx - Cordis context carrying the invariant service.
  21. * @returns the installed registration's disposer after setup succeeds.
  22. */
  23. export const apply = (ctx: Context): Promise<() => void> =>
  24. Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
  25. /* jscpd:ignore-end */