echoes-vault-opencode 1.0.16 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +4 -4
  2. package/tui.tsx +122 -0
  3. package/tui.ts +0 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoes-vault-opencode",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "EchoesVault — persistent memory plugin for OpenCode. Obsidian-style knowledge base with daily logs, encyclopedia pages, and session resumption.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -10,13 +10,13 @@
10
10
  "types": "./index.ts"
11
11
  },
12
12
  "./tui": {
13
- "import": "./tui.ts",
14
- "types": "./tui.ts"
13
+ "import": "./tui.tsx",
14
+ "types": "./tui.tsx"
15
15
  }
16
16
  },
17
17
  "files": [
18
18
  "index.ts",
19
- "tui.ts"
19
+ "tui.tsx"
20
20
  ],
21
21
  "keywords": [
22
22
  "opencode",
package/tui.tsx ADDED
@@ -0,0 +1,122 @@
1
+ /** @jsxImportSource @opentui/solid */
2
+ import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui"
3
+
4
+ type VaultState = {
5
+ initialized: boolean
6
+ sessionActive: boolean
7
+ pagesCount: number
8
+ lastSession: string | null
9
+ }
10
+
11
+ const KV = "echoes_vault"
12
+ let vault: VaultState = { initialized: false, sessionActive: false, pagesCount: 0, lastSession: null }
13
+
14
+ const tui: TuiPlugin = async (api) => {
15
+ try {
16
+ const saved = api.kv.get<VaultState>(KV)
17
+ if (saved) vault = saved
18
+
19
+ function save() {
20
+ try { api.kv.set(KV, vault) } catch {}
21
+ }
22
+
23
+ api.event.on("session.created", () => {
24
+ vault.sessionActive = true
25
+ vault.lastSession = new Date().toISOString().slice(0, 10)
26
+ save()
27
+ })
28
+
29
+ api.event.on("session.deleted", () => {
30
+ vault.sessionActive = false
31
+ save()
32
+ })
33
+
34
+ api.event.on("session.idle", () => {
35
+ vault.sessionActive = false
36
+ save()
37
+ })
38
+ } catch (error) {
39
+ console.error("[echoes-vault] event init failed:", error)
40
+ }
41
+
42
+ try {
43
+ api.keymap.registerLayer({
44
+ name: "echoes-vault",
45
+ commands: [
46
+ { title: "EchoesVault: Init Vault", value: "echoes.init" },
47
+ { title: "EchoesVault: Start Session", value: "echoes.start" },
48
+ { title: "EchoesVault: End Session", value: "echoes.end" },
49
+ { title: "EchoesVault: Vault Status", value: "echoes.status" },
50
+ ],
51
+ bindings: [
52
+ { keys: "C-i", command: "echoes.init" },
53
+ { keys: "C-s", command: "echoes.start" },
54
+ { keys: "C-e", command: "echoes.end" },
55
+ { keys: "C-v", command: "echoes.status" },
56
+ ],
57
+ })
58
+ } catch {}
59
+
60
+ api.slots.register({
61
+ slots: {
62
+ sidebar_content({ session_id }: { session_id: string }) {
63
+ const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
64
+ const title = sessionInfo?.title ?? "—"
65
+ const count = vault.pagesCount
66
+ const active = vault.sessionActive
67
+ const last = vault.lastSession
68
+
69
+ return (
70
+ <box flexDirection="column">
71
+ <box border="all" borderStyle="single" paddingX={1} paddingY={0}>
72
+ <text bold>EchoesVault</text>
73
+ </box>
74
+
75
+ <box paddingX={1} paddingY={0}>
76
+ <text color={active ? "green" : "textMuted"}>
77
+ {active ? `Session: ${title}` : last ? `Last: ${last}` : "No session"}
78
+ </text>
79
+ </box>
80
+
81
+ {count > 0 && (
82
+ <box paddingX={1} paddingY={0}>
83
+ <text color="textMuted">{count} pages indexed</text>
84
+ </box>
85
+ )}
86
+
87
+ <box paddingX={1} paddingY={0} marginTop={1}>
88
+ <text bold color="textMuted">Commands</text>
89
+ </box>
90
+
91
+ <box paddingX={1} paddingY={0}>
92
+ <text>/echoes-init</text>
93
+ <text color="textMuted"> Init vault</text>
94
+ </box>
95
+
96
+ <box paddingX={1} paddingY={0}>
97
+ <text>/echoes-start</text>
98
+ <text color="textMuted"> Start session</text>
99
+ </box>
100
+
101
+ <box paddingX={1} paddingY={0}>
102
+ <text>/echoes-end</text>
103
+ <text color="textMuted"> End session</text>
104
+ </box>
105
+
106
+ <box paddingX={1} paddingY={0}>
107
+ <text>/echoes-status</text>
108
+ <text color="textMuted"> Vault status</text>
109
+ </box>
110
+ </box>
111
+ )
112
+ },
113
+ },
114
+ })
115
+ }
116
+
117
+ const plugin: TuiPluginModule & { id: string } = {
118
+ id: "echoes-vault-sidebar",
119
+ tui,
120
+ }
121
+
122
+ export default plugin
package/tui.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { TuiPlugin } from "@opencode-ai/plugin/tui"
2
-
3
- const tui: TuiPlugin = async (api) => {
4
- try {
5
- api.slots.register({
6
- sidebar_content: () => "EchoesVault loaded",
7
- })
8
- } catch (error) {
9
- console.error("[echoes-vault] TUI init failed:", error)
10
- }
11
- }
12
-
13
- export default { tui }