invariant.ts 1.1 KB

12345678910111213141516171819202122232425262728
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-base`.
  3. * @module @deepseek-ai/dsh-base/invariant
  4. */
  5. import type { Context } from '@deepseek-ai/cordis'
  6. import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
  7. const PACKAGE_NAME = '@deepseek-ai/dsh-base'
  8. /** Cordis companion plugin name. */
  9. export const name = 'base-bundle-invariant'
  10. /** Service required before the companion can register. */
  11. export const inject = ['invariants']
  12. // No runtime invariant: the package is a static patch-list carrier (a YAML
  13. // document of loader rows owned by other packages); it mounts no service,
  14. // emits no events, and owns no mutable relation to check. Each inserted row's
  15. // own package carries that row's invariants.
  16. const install: InvariantInstaller = () => {}
  17. /**
  18. * Register this package's invariant companion.
  19. * @param ctx - Cordis context carrying the invariant service.
  20. * @returns the installed registration's disposer after setup succeeds.
  21. */
  22. export const apply = (ctx: Context): Promise<() => void> =>
  23. Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))