index.ts 928 B

1234567891011121314151617181920212223242526
  1. /** Web Session-log download command over the host endpoint owned by ApiProxy. */
  2. import type { Context } from '@deepseek-ai/cordis'
  3. import type { CommandResult } from '@deepseek-ai/dsh-commands'
  4. export const name = 'session-log-download'
  5. export const inject = ['commands']
  6. const REQUESTED: CommandResult = {
  7. kind: 'success',
  8. text: 'Session log download requested.',
  9. }
  10. /**
  11. * Register the Web-only `/export` command that the browser download plugin observes.
  12. * @param ctx - Host context carrying the human-command registry.
  13. */
  14. export function apply(ctx: Context): void {
  15. ctx.effect(() => ctx.commands.register({
  16. name: 'export',
  17. description: 'Download this Session log as a ZIP archive',
  18. handler: invocation => Promise.resolve(invocation.rawInput.trim() === ''
  19. ? REQUESTED
  20. : { kind: 'error', text: 'The Web /export command does not accept a path.' }),
  21. }), 'session-log-download: command')
  22. }