Files
oc_session/tui.js
T
2026-09-22 20:01:50 +08:00

30 lines
870 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Plugin } from "@opencode/plugin/tui"
export default Plugin.define({
id: "oc-session-all",
setup(context) {
console.log("[oc-session-all] v2 Plugin loaded!")
context.ui.toast.show({
message: "[oc-session-all] v2 loaded! Testing keymap...",
variant: "success",
duration: 3000,
})
// 只注册 command,不注册 binding(方法名是 registerLayer 不是 layer)
context.keymap.registerLayer({
commands: [
{
title: "All Sessions",
value: "sessions.all",
description: "Browse and switch to any session across all projects",
category: "Session Picker",
slash: { name: "sessions-all" },
onSelect: () => {
context.ui.toast.show({ message: "sessions-all triggered!", variant: "info" });
},
},
],
})
},
})