mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:44:31 +00:00
feat: add /export-session command
Export current session to HTML file with full system prompt included. Uses pi-coding-agent templates for consistent rendering. Features: - Exports session entries + full system prompt + tools - Saves to workspace by default, or custom path - Optional --open flag to open in browser - Reuses pi-mono export-html templates Usage: /export-session # Export to workspace /export-session ~/export # Export to custom path /export-session --open # Export and open in browser
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
buildHelpMessage,
|
||||
} from "../status.js";
|
||||
import { buildContextReply } from "./commands-context-report.js";
|
||||
import { buildExportSessionReply } from "./commands-export-session.js";
|
||||
import { buildStatusReply } from "./commands-status.js";
|
||||
|
||||
export const handleHelpCommand: CommandHandler = async (params, allowTextCommands) => {
|
||||
@@ -168,6 +169,28 @@ export const handleContextCommand: CommandHandler = async (params, allowTextComm
|
||||
return { shouldContinue: false, reply: await buildContextReply(params) };
|
||||
};
|
||||
|
||||
export const handleExportSessionCommand: CommandHandler = async (params, allowTextCommands) => {
|
||||
if (!allowTextCommands) {
|
||||
return null;
|
||||
}
|
||||
const normalized = params.command.commandBodyNormalized;
|
||||
if (
|
||||
normalized !== "/export-session" &&
|
||||
!normalized.startsWith("/export-session ") &&
|
||||
normalized !== "/export" &&
|
||||
!normalized.startsWith("/export ")
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (!params.command.isAuthorizedSender) {
|
||||
logVerbose(
|
||||
`Ignoring /export-session from unauthorized sender: ${params.command.senderId || "<unknown>"}`,
|
||||
);
|
||||
return { shouldContinue: false };
|
||||
}
|
||||
return { shouldContinue: false, reply: await buildExportSessionReply(params) };
|
||||
};
|
||||
|
||||
export const handleWhoamiCommand: CommandHandler = async (params, allowTextCommands) => {
|
||||
if (!allowTextCommands) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user