index.ts 1.1 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Function plugin registering the `sessionStats` projection unit: whole-log
  3. * turn/step counts and LLM/tool/first-token/decode wall times served through
  4. * the session-projection seam (registry snapshot, change feed, and every
  5. * projection carrier), so clients render full-session figures that paging and
  6. * compaction cannot change. The plugin owns only the fold; delivery is the
  7. * seam's.
  8. *
  9. * @module @deepseek-ai/dsh-session-stats
  10. */
  11. import type { Context } from '@deepseek-ai/cordis'
  12. import { sessionStatsProjectionDefinition } from './projection.ts'
  13. export type * from './types.ts'
  14. /** Cordis plugin name. */
  15. export const name = 'session-stats'
  16. /** The projection registry is the plugin's whole purpose; without it the fiber stays pending. */
  17. export const inject = ['sessionProjections']
  18. /**
  19. * Register the `sessionStats` unit; the registration is an effect on this
  20. * plugin's fiber, so unloading removes the key.
  21. * @param ctx - registrant context carrying the projection registry.
  22. */
  23. export function apply(ctx: Context): void {
  24. ctx.sessionProjections.register(sessionStatsProjectionDefinition)
  25. }