更新tui.js

This commit is contained in:
ypshidifu
2026-09-22 20:01:50 +08:00
parent 9f17ac9936
commit 39efb3aa0f
2 changed files with 29 additions and 1 deletions
-1
View File
@@ -1,5 +1,4 @@
node_modules/
*.js
!tui-plugins/oc-session-all-debug.js
!tui-plugins/oc-session-all.js
src/
+29
View File
@@ -0,0 +1,29 @@
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" });
},
},
],
})
},
})