invariant.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-native-command`.
  3. * @module @deepseek-ai/dsh-native-command/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-native-command'
  9. /** Cordis companion plugin name. */
  10. export const name = 'native-command-invariant'
  11. /** Service required before the companion can reserve package ownership. */
  12. export const inject = ['invariants']
  13. /**
  14. * No runtime invariant: each run is one stateless child-process round trip
  15. * with no owned event stream or mutable runtime data; behavior is enforced by
  16. * unit tests.
  17. */
  18. const install: InvariantInstaller = () => {}
  19. /**
  20. * Register this package's invariant companion.
  21. * @param ctx - Cordis context carrying the invariant service.
  22. * @returns the installed registration's disposer after setup succeeds.
  23. */
  24. export const apply = (ctx: Context): Promise<() => void> =>
  25. Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
  26. /* jscpd:ignore-end */