mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 22:21:37 +00:00
chore: remove --open option (not useful for remote sessions)
This commit is contained in:
@@ -219,12 +219,6 @@ function buildChatCommands(): ChatCommandDefinition[] {
|
|||||||
type: "string",
|
type: "string",
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "open",
|
|
||||||
description: "Open in browser after export",
|
|
||||||
type: "boolean",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
defineChatCommand({
|
defineChatCommand({
|
||||||
|
|||||||
@@ -247,23 +247,15 @@ async function resolveFullSystemPrompt(params: HandleCommandsParams): Promise<{
|
|||||||
return { systemPrompt, tools };
|
return { systemPrompt, tools };
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseExportArgs(commandBodyNormalized: string): { outputPath?: string; open?: boolean } {
|
function parseExportArgs(commandBodyNormalized: string): { outputPath?: string } {
|
||||||
const normalized = commandBodyNormalized.trim();
|
const normalized = commandBodyNormalized.trim();
|
||||||
if (normalized === "/export-session" || normalized === "/export") {
|
if (normalized === "/export-session" || normalized === "/export") {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const args = normalized.replace(/^\/(export-session|export)\s*/, "").trim();
|
const args = normalized.replace(/^\/(export-session|export)\s*/, "").trim();
|
||||||
const parts = args.split(/\s+/);
|
// First non-flag argument is the output path
|
||||||
let outputPath: string | undefined;
|
const outputPath = args.split(/\s+/).find((part) => !part.startsWith("-"));
|
||||||
let open = false;
|
return { outputPath };
|
||||||
for (const part of parts) {
|
|
||||||
if (part === "--open" || part === "-o") {
|
|
||||||
open = true;
|
|
||||||
} else if (!part.startsWith("-") && !outputPath) {
|
|
||||||
outputPath = part;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { outputPath, open };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function buildExportSessionReply(params: HandleCommandsParams): Promise<ReplyPayload> {
|
export async function buildExportSessionReply(params: HandleCommandsParams): Promise<ReplyPayload> {
|
||||||
@@ -339,13 +331,6 @@ export async function buildExportSessionReply(params: HandleCommandsParams): Pro
|
|||||||
// 7. Write file
|
// 7. Write file
|
||||||
fs.writeFileSync(outputPath, html, "utf-8");
|
fs.writeFileSync(outputPath, html, "utf-8");
|
||||||
|
|
||||||
// 8. Optionally open in browser
|
|
||||||
if (args.open) {
|
|
||||||
const { exec } = await import("node:child_process");
|
|
||||||
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
||||||
exec(`${cmd} "${outputPath}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const relativePath = path.relative(params.workspaceDir, outputPath);
|
const relativePath = path.relative(params.workspaceDir, outputPath);
|
||||||
const displayPath = relativePath.startsWith("..") ? outputPath : relativePath;
|
const displayPath = relativePath.startsWith("..") ? outputPath : relativePath;
|
||||||
|
|
||||||
@@ -357,8 +342,6 @@ export async function buildExportSessionReply(params: HandleCommandsParams): Pro
|
|||||||
`📊 Entries: ${entries.length}`,
|
`📊 Entries: ${entries.length}`,
|
||||||
`🧠 System prompt: ${systemPrompt.length.toLocaleString()} chars`,
|
`🧠 System prompt: ${systemPrompt.length.toLocaleString()} chars`,
|
||||||
`🔧 Tools: ${tools.length}`,
|
`🔧 Tools: ${tools.length}`,
|
||||||
"",
|
|
||||||
args.open ? "🌐 Opening in browser..." : `Tip: /export-session --open to auto-open`,
|
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user