|
@@ -1,8 +1,8 @@
|
|
|
import { createMemo } from "solid-js"
|
|
import { createMemo } from "solid-js"
|
|
|
import { useNavigate, useParams } from "@solidjs/router"
|
|
import { useNavigate, useParams } from "@solidjs/router"
|
|
|
-import { useCommand } from "@/context/command"
|
|
|
|
|
|
|
+import { useCommand, type CommandOption } from "@/context/command"
|
|
|
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
|
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
|
|
-import { useFile, selectionFromLines, type FileSelection } from "@/context/file"
|
|
|
|
|
|
|
+import { useFile, selectionFromLines, type FileSelection, type SelectedLineRange } from "@/context/file"
|
|
|
import { useLanguage } from "@/context/language"
|
|
import { useLanguage } from "@/context/language"
|
|
|
import { useLayout } from "@/context/layout"
|
|
import { useLayout } from "@/context/layout"
|
|
|
import { useLocal } from "@/context/local"
|
|
import { useLocal } from "@/context/local"
|
|
@@ -22,7 +22,7 @@ import { UserMessage } from "@opencode-ai/sdk/v2"
|
|
|
import { combineCommandSections } from "@/pages/session/helpers"
|
|
import { combineCommandSections } from "@/pages/session/helpers"
|
|
|
import { canAddSelectionContext } from "@/pages/session/session-command-helpers"
|
|
import { canAddSelectionContext } from "@/pages/session/session-command-helpers"
|
|
|
|
|
|
|
|
-export const useSessionCommands = (input: {
|
|
|
|
|
|
|
+export type SessionCommandContext = {
|
|
|
command: ReturnType<typeof useCommand>
|
|
command: ReturnType<typeof useCommand>
|
|
|
dialog: ReturnType<typeof useDialog>
|
|
dialog: ReturnType<typeof useDialog>
|
|
|
file: ReturnType<typeof useFile>
|
|
file: ReturnType<typeof useFile>
|
|
@@ -49,32 +49,48 @@ export const useSessionCommands = (input: {
|
|
|
setActiveMessage: (message: UserMessage | undefined) => void
|
|
setActiveMessage: (message: UserMessage | undefined) => void
|
|
|
addSelectionToContext: (path: string, selection: FileSelection) => void
|
|
addSelectionToContext: (path: string, selection: FileSelection) => void
|
|
|
focusInput: () => void
|
|
focusInput: () => void
|
|
|
-}) => {
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const withCategory = (category: string) => {
|
|
|
|
|
+ return (option: Omit<CommandOption, "category">): CommandOption => ({
|
|
|
|
|
+ ...option,
|
|
|
|
|
+ category,
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export const useSessionCommands = (input: SessionCommandContext) => {
|
|
|
|
|
+ const sessionCommand = withCategory(input.language.t("command.category.session"))
|
|
|
|
|
+ const fileCommand = withCategory(input.language.t("command.category.file"))
|
|
|
|
|
+ const contextCommand = withCategory(input.language.t("command.category.context"))
|
|
|
|
|
+ const viewCommand = withCategory(input.language.t("command.category.view"))
|
|
|
|
|
+ const terminalCommand = withCategory(input.language.t("command.category.terminal"))
|
|
|
|
|
+ const modelCommand = withCategory(input.language.t("command.category.model"))
|
|
|
|
|
+ const mcpCommand = withCategory(input.language.t("command.category.mcp"))
|
|
|
|
|
+ const agentCommand = withCategory(input.language.t("command.category.agent"))
|
|
|
|
|
+ const permissionsCommand = withCategory(input.language.t("command.category.permissions"))
|
|
|
|
|
+
|
|
|
const sessionCommands = createMemo(() => [
|
|
const sessionCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.new",
|
|
id: "session.new",
|
|
|
title: input.language.t("command.session.new"),
|
|
title: input.language.t("command.session.new"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
keybind: "mod+shift+s",
|
|
keybind: "mod+shift+s",
|
|
|
slash: "new",
|
|
slash: "new",
|
|
|
onSelect: () => input.navigate(`/${input.params.dir}/session`),
|
|
onSelect: () => input.navigate(`/${input.params.dir}/session`),
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const fileCommands = createMemo(() => [
|
|
const fileCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ fileCommand({
|
|
|
id: "file.open",
|
|
id: "file.open",
|
|
|
title: input.language.t("command.file.open"),
|
|
title: input.language.t("command.file.open"),
|
|
|
description: input.language.t("palette.search.placeholder"),
|
|
description: input.language.t("palette.search.placeholder"),
|
|
|
- category: input.language.t("command.category.file"),
|
|
|
|
|
keybind: "mod+p",
|
|
keybind: "mod+p",
|
|
|
slash: "open",
|
|
slash: "open",
|
|
|
onSelect: () => input.dialog.show(() => <DialogSelectFile onOpenFile={input.showAllFiles} />),
|
|
onSelect: () => input.dialog.show(() => <DialogSelectFile onOpenFile={input.showAllFiles} />),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ fileCommand({
|
|
|
id: "tab.close",
|
|
id: "tab.close",
|
|
|
title: input.language.t("command.tab.close"),
|
|
title: input.language.t("command.tab.close"),
|
|
|
- category: input.language.t("command.category.file"),
|
|
|
|
|
keybind: "mod+w",
|
|
keybind: "mod+w",
|
|
|
disabled: !input.tabs().active(),
|
|
disabled: !input.tabs().active(),
|
|
|
onSelect: () => {
|
|
onSelect: () => {
|
|
@@ -82,15 +98,14 @@ export const useSessionCommands = (input: {
|
|
|
if (!active) return
|
|
if (!active) return
|
|
|
input.tabs().close(active)
|
|
input.tabs().close(active)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const contextCommands = createMemo(() => [
|
|
const contextCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ contextCommand({
|
|
|
id: "context.addSelection",
|
|
id: "context.addSelection",
|
|
|
title: input.language.t("command.context.addSelection"),
|
|
title: input.language.t("command.context.addSelection"),
|
|
|
description: input.language.t("command.context.addSelection.description"),
|
|
description: input.language.t("command.context.addSelection.description"),
|
|
|
- category: input.language.t("command.category.context"),
|
|
|
|
|
keybind: "mod+shift+l",
|
|
keybind: "mod+shift+l",
|
|
|
disabled: !canAddSelectionContext({
|
|
disabled: !canAddSelectionContext({
|
|
|
active: input.tabs().active(),
|
|
active: input.tabs().active(),
|
|
@@ -103,7 +118,7 @@ export const useSessionCommands = (input: {
|
|
|
const path = input.file.pathFromTab(active)
|
|
const path = input.file.pathFromTab(active)
|
|
|
if (!path) return
|
|
if (!path) return
|
|
|
|
|
|
|
|
- const range = input.file.selectedLines(path)
|
|
|
|
|
|
|
+ const range = input.file.selectedLines(path) as SelectedLineRange | null | undefined
|
|
|
if (!range) {
|
|
if (!range) {
|
|
|
showToast({
|
|
showToast({
|
|
|
title: input.language.t("toast.context.noLineSelection.title"),
|
|
title: input.language.t("toast.context.noLineSelection.title"),
|
|
@@ -114,58 +129,49 @@ export const useSessionCommands = (input: {
|
|
|
|
|
|
|
|
input.addSelectionToContext(path, selectionFromLines(range))
|
|
input.addSelectionToContext(path, selectionFromLines(range))
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const viewCommands = createMemo(() => [
|
|
const viewCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ viewCommand({
|
|
|
id: "terminal.toggle",
|
|
id: "terminal.toggle",
|
|
|
title: input.language.t("command.terminal.toggle"),
|
|
title: input.language.t("command.terminal.toggle"),
|
|
|
- description: "",
|
|
|
|
|
- category: input.language.t("command.category.view"),
|
|
|
|
|
keybind: "ctrl+`",
|
|
keybind: "ctrl+`",
|
|
|
slash: "terminal",
|
|
slash: "terminal",
|
|
|
onSelect: () => input.view().terminal.toggle(),
|
|
onSelect: () => input.view().terminal.toggle(),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ viewCommand({
|
|
|
id: "review.toggle",
|
|
id: "review.toggle",
|
|
|
title: input.language.t("command.review.toggle"),
|
|
title: input.language.t("command.review.toggle"),
|
|
|
- description: "",
|
|
|
|
|
- category: input.language.t("command.category.view"),
|
|
|
|
|
keybind: "mod+shift+r",
|
|
keybind: "mod+shift+r",
|
|
|
onSelect: () => input.view().reviewPanel.toggle(),
|
|
onSelect: () => input.view().reviewPanel.toggle(),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ viewCommand({
|
|
|
id: "fileTree.toggle",
|
|
id: "fileTree.toggle",
|
|
|
title: input.language.t("command.fileTree.toggle"),
|
|
title: input.language.t("command.fileTree.toggle"),
|
|
|
- description: "",
|
|
|
|
|
- category: input.language.t("command.category.view"),
|
|
|
|
|
keybind: "mod+\\",
|
|
keybind: "mod+\\",
|
|
|
onSelect: () => input.layout.fileTree.toggle(),
|
|
onSelect: () => input.layout.fileTree.toggle(),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ viewCommand({
|
|
|
id: "input.focus",
|
|
id: "input.focus",
|
|
|
title: input.language.t("command.input.focus"),
|
|
title: input.language.t("command.input.focus"),
|
|
|
- category: input.language.t("command.category.view"),
|
|
|
|
|
keybind: "ctrl+l",
|
|
keybind: "ctrl+l",
|
|
|
onSelect: () => input.focusInput(),
|
|
onSelect: () => input.focusInput(),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ terminalCommand({
|
|
|
id: "terminal.new",
|
|
id: "terminal.new",
|
|
|
title: input.language.t("command.terminal.new"),
|
|
title: input.language.t("command.terminal.new"),
|
|
|
description: input.language.t("command.terminal.new.description"),
|
|
description: input.language.t("command.terminal.new.description"),
|
|
|
- category: input.language.t("command.category.terminal"),
|
|
|
|
|
keybind: "ctrl+alt+t",
|
|
keybind: "ctrl+alt+t",
|
|
|
onSelect: () => {
|
|
onSelect: () => {
|
|
|
if (input.terminal.all().length > 0) input.terminal.new()
|
|
if (input.terminal.all().length > 0) input.terminal.new()
|
|
|
input.view().terminal.open()
|
|
input.view().terminal.open()
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ viewCommand({
|
|
|
id: "steps.toggle",
|
|
id: "steps.toggle",
|
|
|
title: input.language.t("command.steps.toggle"),
|
|
title: input.language.t("command.steps.toggle"),
|
|
|
description: input.language.t("command.steps.toggle.description"),
|
|
description: input.language.t("command.steps.toggle.description"),
|
|
|
- category: input.language.t("command.category.view"),
|
|
|
|
|
keybind: "mod+e",
|
|
keybind: "mod+e",
|
|
|
slash: "steps",
|
|
slash: "steps",
|
|
|
disabled: !input.params.id,
|
|
disabled: !input.params.id,
|
|
@@ -174,86 +180,78 @@ export const useSessionCommands = (input: {
|
|
|
if (!msg) return
|
|
if (!msg) return
|
|
|
input.setExpanded(msg.id, (open: boolean | undefined) => !open)
|
|
input.setExpanded(msg.id, (open: boolean | undefined) => !open)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const messageCommands = createMemo(() => [
|
|
const messageCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "message.previous",
|
|
id: "message.previous",
|
|
|
title: input.language.t("command.message.previous"),
|
|
title: input.language.t("command.message.previous"),
|
|
|
description: input.language.t("command.message.previous.description"),
|
|
description: input.language.t("command.message.previous.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
keybind: "mod+arrowup",
|
|
keybind: "mod+arrowup",
|
|
|
disabled: !input.params.id,
|
|
disabled: !input.params.id,
|
|
|
onSelect: () => input.navigateMessageByOffset(-1),
|
|
onSelect: () => input.navigateMessageByOffset(-1),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "message.next",
|
|
id: "message.next",
|
|
|
title: input.language.t("command.message.next"),
|
|
title: input.language.t("command.message.next"),
|
|
|
description: input.language.t("command.message.next.description"),
|
|
description: input.language.t("command.message.next.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
keybind: "mod+arrowdown",
|
|
keybind: "mod+arrowdown",
|
|
|
disabled: !input.params.id,
|
|
disabled: !input.params.id,
|
|
|
onSelect: () => input.navigateMessageByOffset(1),
|
|
onSelect: () => input.navigateMessageByOffset(1),
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const agentCommands = createMemo(() => [
|
|
const agentCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ modelCommand({
|
|
|
id: "model.choose",
|
|
id: "model.choose",
|
|
|
title: input.language.t("command.model.choose"),
|
|
title: input.language.t("command.model.choose"),
|
|
|
description: input.language.t("command.model.choose.description"),
|
|
description: input.language.t("command.model.choose.description"),
|
|
|
- category: input.language.t("command.category.model"),
|
|
|
|
|
keybind: "mod+'",
|
|
keybind: "mod+'",
|
|
|
slash: "model",
|
|
slash: "model",
|
|
|
onSelect: () => input.dialog.show(() => <DialogSelectModel />),
|
|
onSelect: () => input.dialog.show(() => <DialogSelectModel />),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ mcpCommand({
|
|
|
id: "mcp.toggle",
|
|
id: "mcp.toggle",
|
|
|
title: input.language.t("command.mcp.toggle"),
|
|
title: input.language.t("command.mcp.toggle"),
|
|
|
description: input.language.t("command.mcp.toggle.description"),
|
|
description: input.language.t("command.mcp.toggle.description"),
|
|
|
- category: input.language.t("command.category.mcp"),
|
|
|
|
|
keybind: "mod+;",
|
|
keybind: "mod+;",
|
|
|
slash: "mcp",
|
|
slash: "mcp",
|
|
|
onSelect: () => input.dialog.show(() => <DialogSelectMcp />),
|
|
onSelect: () => input.dialog.show(() => <DialogSelectMcp />),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ agentCommand({
|
|
|
id: "agent.cycle",
|
|
id: "agent.cycle",
|
|
|
title: input.language.t("command.agent.cycle"),
|
|
title: input.language.t("command.agent.cycle"),
|
|
|
description: input.language.t("command.agent.cycle.description"),
|
|
description: input.language.t("command.agent.cycle.description"),
|
|
|
- category: input.language.t("command.category.agent"),
|
|
|
|
|
keybind: "mod+.",
|
|
keybind: "mod+.",
|
|
|
slash: "agent",
|
|
slash: "agent",
|
|
|
onSelect: () => input.local.agent.move(1),
|
|
onSelect: () => input.local.agent.move(1),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ agentCommand({
|
|
|
id: "agent.cycle.reverse",
|
|
id: "agent.cycle.reverse",
|
|
|
title: input.language.t("command.agent.cycle.reverse"),
|
|
title: input.language.t("command.agent.cycle.reverse"),
|
|
|
description: input.language.t("command.agent.cycle.reverse.description"),
|
|
description: input.language.t("command.agent.cycle.reverse.description"),
|
|
|
- category: input.language.t("command.category.agent"),
|
|
|
|
|
keybind: "shift+mod+.",
|
|
keybind: "shift+mod+.",
|
|
|
onSelect: () => input.local.agent.move(-1),
|
|
onSelect: () => input.local.agent.move(-1),
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ modelCommand({
|
|
|
id: "model.variant.cycle",
|
|
id: "model.variant.cycle",
|
|
|
title: input.language.t("command.model.variant.cycle"),
|
|
title: input.language.t("command.model.variant.cycle"),
|
|
|
description: input.language.t("command.model.variant.cycle.description"),
|
|
description: input.language.t("command.model.variant.cycle.description"),
|
|
|
- category: input.language.t("command.category.model"),
|
|
|
|
|
keybind: "shift+mod+d",
|
|
keybind: "shift+mod+d",
|
|
|
onSelect: () => {
|
|
onSelect: () => {
|
|
|
input.local.model.variant.cycle()
|
|
input.local.model.variant.cycle()
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const permissionCommands = createMemo(() => [
|
|
const permissionCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ permissionsCommand({
|
|
|
id: "permissions.autoaccept",
|
|
id: "permissions.autoaccept",
|
|
|
title:
|
|
title:
|
|
|
input.params.id && input.permission.isAutoAccepting(input.params.id, input.sdk.directory)
|
|
input.params.id && input.permission.isAutoAccepting(input.params.id, input.sdk.directory)
|
|
|
? input.language.t("command.permissions.autoaccept.disable")
|
|
? input.language.t("command.permissions.autoaccept.disable")
|
|
|
: input.language.t("command.permissions.autoaccept.enable"),
|
|
: input.language.t("command.permissions.autoaccept.enable"),
|
|
|
- category: input.language.t("command.category.permissions"),
|
|
|
|
|
keybind: "mod+shift+a",
|
|
keybind: "mod+shift+a",
|
|
|
disabled: !input.params.id || !input.permission.permissionsEnabled(),
|
|
disabled: !input.params.id || !input.permission.permissionsEnabled(),
|
|
|
onSelect: () => {
|
|
onSelect: () => {
|
|
@@ -269,15 +267,14 @@ export const useSessionCommands = (input: {
|
|
|
: input.language.t("toast.permissions.autoaccept.off.description"),
|
|
: input.language.t("toast.permissions.autoaccept.off.description"),
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const sessionActionCommands = createMemo(() => [
|
|
const sessionActionCommands = createMemo(() => [
|
|
|
- {
|
|
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.undo",
|
|
id: "session.undo",
|
|
|
title: input.language.t("command.session.undo"),
|
|
title: input.language.t("command.session.undo"),
|
|
|
description: input.language.t("command.session.undo.description"),
|
|
description: input.language.t("command.session.undo.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "undo",
|
|
slash: "undo",
|
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
|
onSelect: async () => {
|
|
onSelect: async () => {
|
|
@@ -298,12 +295,11 @@ export const useSessionCommands = (input: {
|
|
|
const priorMessage = findLast(input.userMessages(), (x) => x.id < message.id)
|
|
const priorMessage = findLast(input.userMessages(), (x) => x.id < message.id)
|
|
|
input.setActiveMessage(priorMessage)
|
|
input.setActiveMessage(priorMessage)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.redo",
|
|
id: "session.redo",
|
|
|
title: input.language.t("command.session.redo"),
|
|
title: input.language.t("command.session.redo"),
|
|
|
description: input.language.t("command.session.redo.description"),
|
|
description: input.language.t("command.session.redo.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "redo",
|
|
slash: "redo",
|
|
|
disabled: !input.params.id || !input.info()?.revert?.messageID,
|
|
disabled: !input.params.id || !input.info()?.revert?.messageID,
|
|
|
onSelect: async () => {
|
|
onSelect: async () => {
|
|
@@ -323,12 +319,11 @@ export const useSessionCommands = (input: {
|
|
|
const priorMsg = findLast(input.userMessages(), (x) => x.id < nextMessage.id)
|
|
const priorMsg = findLast(input.userMessages(), (x) => x.id < nextMessage.id)
|
|
|
input.setActiveMessage(priorMsg)
|
|
input.setActiveMessage(priorMsg)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.compact",
|
|
id: "session.compact",
|
|
|
title: input.language.t("command.session.compact"),
|
|
title: input.language.t("command.session.compact"),
|
|
|
description: input.language.t("command.session.compact.description"),
|
|
description: input.language.t("command.session.compact.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "compact",
|
|
slash: "compact",
|
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
|
onSelect: async () => {
|
|
onSelect: async () => {
|
|
@@ -348,22 +343,21 @@ export const useSessionCommands = (input: {
|
|
|
providerID: model.provider.id,
|
|
providerID: model.provider.id,
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.fork",
|
|
id: "session.fork",
|
|
|
title: input.language.t("command.session.fork"),
|
|
title: input.language.t("command.session.fork"),
|
|
|
description: input.language.t("command.session.fork.description"),
|
|
description: input.language.t("command.session.fork.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "fork",
|
|
slash: "fork",
|
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
disabled: !input.params.id || input.visibleUserMessages().length === 0,
|
|
|
onSelect: () => input.dialog.show(() => <DialogFork />),
|
|
onSelect: () => input.dialog.show(() => <DialogFork />),
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const shareCommands = createMemo(() => {
|
|
const shareCommands = createMemo(() => {
|
|
|
if (input.sync.data.config.share === "disabled") return []
|
|
if (input.sync.data.config.share === "disabled") return []
|
|
|
return [
|
|
return [
|
|
|
- {
|
|
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.share",
|
|
id: "session.share",
|
|
|
title: input.info()?.share?.url
|
|
title: input.info()?.share?.url
|
|
|
? input.language.t("session.share.copy.copyLink")
|
|
? input.language.t("session.share.copy.copyLink")
|
|
@@ -371,7 +365,6 @@ export const useSessionCommands = (input: {
|
|
|
description: input.info()?.share?.url
|
|
description: input.info()?.share?.url
|
|
|
? input.language.t("toast.session.share.success.description")
|
|
? input.language.t("toast.session.share.success.description")
|
|
|
: input.language.t("command.session.share.description"),
|
|
: input.language.t("command.session.share.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "share",
|
|
slash: "share",
|
|
|
disabled: !input.params.id,
|
|
disabled: !input.params.id,
|
|
|
onSelect: async () => {
|
|
onSelect: async () => {
|
|
@@ -441,12 +434,11 @@ export const useSessionCommands = (input: {
|
|
|
|
|
|
|
|
await copy(url, false)
|
|
await copy(url, false)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ }),
|
|
|
|
|
+ sessionCommand({
|
|
|
id: "session.unshare",
|
|
id: "session.unshare",
|
|
|
title: input.language.t("command.session.unshare"),
|
|
title: input.language.t("command.session.unshare"),
|
|
|
description: input.language.t("command.session.unshare.description"),
|
|
description: input.language.t("command.session.unshare.description"),
|
|
|
- category: input.language.t("command.category.session"),
|
|
|
|
|
slash: "unshare",
|
|
slash: "unshare",
|
|
|
disabled: !input.params.id || !input.info()?.share?.url,
|
|
disabled: !input.params.id || !input.info()?.share?.url,
|
|
|
onSelect: async () => {
|
|
onSelect: async () => {
|
|
@@ -468,7 +460,7 @@ export const useSessionCommands = (input: {
|
|
|
}),
|
|
}),
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|
|
|
- },
|
|
|
|
|
|
|
+ }),
|
|
|
]
|
|
]
|
|
|
})
|
|
})
|
|
|
|
|
|