feat(session-export): add command and Header action
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/** Web Session-log download command over the host endpoint owned by ApiProxy. */
|
||||
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import type { CommandResult } from '@deepseek-ai/dsh-commands'
|
||||
|
||||
export const name = 'session-export'
|
||||
export const inject = ['commands']
|
||||
|
||||
const REQUESTED: CommandResult = {
|
||||
kind: 'success',
|
||||
text: 'Session log download requested.',
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Web-only `/export` command that the browser download plugin observes.
|
||||
* @param ctx - Host context carrying the human-command registry.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
ctx.effect(() => ctx.commands.register({
|
||||
name: 'export',
|
||||
description: 'Download this Session log as a ZIP archive',
|
||||
handler: invocation => Promise.resolve(invocation.rawInput.trim() === ''
|
||||
? REQUESTED
|
||||
: { kind: 'error', text: 'The Web /export command does not accept a path.' }),
|
||||
}), 'session-export: command')
|
||||
}
|
||||
Reference in New Issue
Block a user