invariant.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-web-app`.
  3. * @module @deepseek-ai/dsh-web-app/invariant
  4. */
  5. import type { Context } from 'cordis'
  6. import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
  7. const PACKAGE_NAME = '@deepseek-ai/dsh-web-app'
  8. /** Cordis companion plugin name. */
  9. export const name = 'web-app-invariant'
  10. /** Service required before the companion can register. */
  11. export const inject = ['invariants']
  12. /**
  13. * No runtime invariant: every contribution (frontend-static child plugin,
  14. * prompt section, bashEnv registration) is registry-disposed with the fiber,
  15. * and each owning registry's package carries that relation's invariant; the
  16. * package holds no mutable state of its own to audit.
  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))