1
0

invariant.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Package-owned invariant companion for `@deepseek-ai/dsh-experimental-code-runtime-python`.
  3. * @module @deepseek-ai/dsh-experimental-code-runtime-python/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-experimental-code-runtime-python'
  9. /** Cordis companion plugin name. */
  10. export const name = 'code-runtime-python-invariant'
  11. /** Service required before the companion can reserve package ownership. */
  12. export const inject = ['invariants']
  13. /**
  14. * No runtime invariant: every relation this backend maintains — frame ordering, budget accounting,
  15. * and process teardown — lives in the CPython subprocess or on the fd-3 wire, so no same-process
  16. * event sequence or mutable data relation is observable from a Cordis listener. `protocol.spec.ts`,
  17. * `protocol-mirror.e2e.ts`, and the real-subprocess `runtime.spec.ts` cover that behavior, matching
  18. * the sibling process-boundary backend `@deepseek-ai/dsh-code-runtime-worker-thread`.
  19. */
  20. const install: InvariantInstaller = () => {}
  21. /**
  22. * Register this package's invariant companion.
  23. * @param ctx - Cordis context carrying the invariant service.
  24. * @returns the installed registration's disposer after setup succeeds.
  25. */
  26. export const apply = (ctx: Context): Promise<() => void> =>
  27. Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
  28. /* jscpd:ignore-end */