echoes-vault-opencode 1.0.17 → 1.0.19

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 (2) hide show
  1. package/package.json +1 -1
  2. package/tui.tsx +58 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoes-vault-opencode",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
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",
package/tui.tsx CHANGED
@@ -1,23 +1,71 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
2
  import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui"
3
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: true, sessionActive: true, pagesCount: 15, lastSession: "2026-07-03" } // Заглушка для теста визуала
13
+
4
14
  const tui: TuiPlugin = async (api) => {
5
15
  try {
6
- api.slots.register({
7
- order: 10, // Определяет позицию панели (выше или ниже других)
8
- slots: {
9
- sidebar_content() {
10
- // Обязательно оборачиваем текст в тег <text>!
11
- return <text>🚀 EchoesVault loaded and ready!</text>
12
- },
13
- },
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()
14
27
  })
28
+
15
29
  } catch (error) {
16
- console.error("[echoes-vault] TUI init failed:", error)
30
+ console.error("[echoes-vault] event init failed:", error)
17
31
  }
32
+
33
+ // Отрисовка UI
34
+ api.slots.register({
35
+ slots: {
36
+ sidebar_content({ session_id }: { session_id: string }) {
37
+ const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
38
+ const title = sessionInfo?.title ?? "current"
39
+ const count = vault.pagesCount
40
+ const active = vault.sessionActive
41
+
42
+ return (
43
+ <box flexDirection="column" paddingBottom={1}>
44
+ <box flexDirection="column" paddingBottom={1}>
45
+ <text bold>EchoesVault</text>
46
+ <text color={active ? "#4caf50" : "gray"}>
47
+ • {active ? `Active (${title})` : "Disconnected"}
48
+ </text>
49
+ <text color="gray">
50
+ • {count} pages indexed
51
+ </text>
52
+ </box>
53
+ <box flexDirection="column">
54
+ <text bold>Commands</text>
55
+
56
+ <text color="gray"> /echoes-init (Init vault)</text>
57
+ <text color="gray"> /echoes-start (Start session)</text>
58
+ <text color="gray"> /echoes-end (End session)</text>
59
+ <text color="gray"> /echoes-status (Show status)</text>
60
+ </box>
61
+
62
+ </box>
63
+ )
64
+ },
65
+ },
66
+ })
18
67
  }
19
68
 
20
- // OpenCode любит, когда у плагина есть явный ID
21
69
  const plugin: TuiPluginModule & { id: string } = {
22
70
  id: "echoes-vault-sidebar",
23
71
  tui,