invariant.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-tool-bash-persistent`.
  3. * @module @deepseek-ai/dsh-tool-bash-persistent/invariant
  4. */
  5. /* jscpd:ignore-start */
  6. import type { Context } from '@deepseek-ai/cordis'
  7. import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
  8. const PACKAGE_NAME = '@deepseek-ai/dsh-tool-bash-persistent'
  9. /** Cordis companion plugin name. */
  10. export const name = 'tool-bash-persistent-invariant'
  11. /** Service required before the companion can reserve package ownership. */
  12. export const inject = ['invariants']
  13. /**
  14. * No runtime invariant: the adapter's private owner-to-shell cache has no
  15. * observable event or data relation. Lifecycle tests prove its cleanup without
  16. * adding a public API solely for an invariant.
  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 */