echoes-vault-opencode 1.0.8 → 1.0.10

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 +2 -3
  2. package/tui.ts +39 -56
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoes-vault-opencode",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
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",
@@ -28,8 +28,7 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@opencode-ai/plugin": ">=1.16.0",
32
- "@opentui/solid": ">=0.3.2"
31
+ "@opencode-ai/plugin": ">=1.16.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@types/node": "^22.0.0",
package/tui.ts CHANGED
@@ -1,5 +1,3 @@
1
- /** @jsxImportSource @opentui/solid */
2
-
3
1
  import type { TuiPlugin } from "@opencode-ai/plugin/tui"
4
2
 
5
3
  const tui: TuiPlugin = async (api) => {
@@ -22,66 +20,51 @@ const tui: TuiPlugin = async (api) => {
22
20
  try {
23
21
  const saved = api.kv.get<VaultState>(KV)
24
22
  if (saved) vault = saved
25
- } catch {}
26
23
 
27
- function save() {
28
- try { api.kv.set(KV, vault) } catch {}
29
- }
24
+ api.event.on("session.created", () => {
25
+ vault.sessionActive = true
26
+ vault.lastSession = new Date().toISOString().slice(0, 10)
27
+ try { api.kv.set(KV, vault) } catch {}
28
+ })
30
29
 
31
- api.event.on("session.created", () => {
32
- vault.sessionActive = true
33
- save()
34
- })
30
+ api.event.on("session.deleted", () => {
31
+ vault.sessionActive = false
32
+ try { api.kv.set(KV, vault) } catch {}
33
+ })
35
34
 
36
- api.event.on("session.deleted", () => {
37
- vault.sessionActive = false
38
- save()
39
- })
35
+ api.event.on("session.idle", () => {
36
+ vault.sessionActive = false
37
+ try { api.kv.set(KV, vault) } catch {}
38
+ })
40
39
 
41
- api.event.on("session.idle", () => {
42
- vault.sessionActive = false
43
- save()
44
- })
40
+ api.slots.register({
41
+ sidebar_content: ({ session_id }: { session_id: string }) => {
42
+ const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
43
+ const title = sessionInfo?.title ?? "—"
44
+ const count = vault.pagesCount
45
45
 
46
- try {
47
- api.keymap.registerLayer({
48
- name: "echoes-vault",
49
- commands: [
50
- { title: "EchoesVault: Init Vault", value: "echoes.init" },
51
- { title: "EchoesVault: Start Session", value: "echoes.start" },
52
- { title: "EchoesVault: End Session", value: "echoes.end" },
53
- { title: "EchoesVault: Vault Status", value: "echoes.status" },
54
- ],
55
- bindings: [
56
- { keys: "C-i", command: "echoes.init" },
57
- { keys: "C-s", command: "echoes.start" },
58
- { keys: "C-e", command: "echoes.end" },
59
- { keys: "C-v", command: "echoes.status" },
60
- ],
46
+ return (
47
+ <Box flexDirection="column">
48
+ <Box border="all" borderStyle="single" paddingX={1} paddingY={0}>
49
+ <Text bold>EchoesVault</Text>
50
+ </Box>
51
+ <Box paddingX={1}>
52
+ <Text dim>
53
+ {vault.sessionActive ? `Session: ${title}` : "Idle"}
54
+ {count > 0 ? ` · ${count} pages` : ""}
55
+ </Text>
56
+ </Box>
57
+ <Box paddingX={1} paddingY={0}>
58
+ <Text dim>/echoes-init /echoes-start /echoes-end /echoes-status</Text>
59
+ </Box>
60
+ </Box>
61
+ )
62
+ },
61
63
  })
62
- } catch {}
63
-
64
- api.slots.register({
65
- sidebar_content: () => (
66
- <Box flexDirection="column">
67
- <Box border="all" borderStyle="single" paddingX={1} paddingY={0}>
68
- <Text bold>EchoesVault</Text>
69
- </Box>
70
- <Box paddingX={1}>
71
- <Text dim>
72
- {vault.sessionActive ? "Active" : vault.lastSession ?? "No session"}
73
- {vault.pagesCount > 0 ? ` · ${vault.pagesCount} pages` : ""}
74
- </Text>
75
- </Box>
76
- <Box paddingX={1} paddingY={0}>
77
- <Text dim>Commands: /echoes-init /echoes-start /echoes-end /echoes-status</Text>
78
- </Box>
79
- <Box paddingX={1} paddingY={0}>
80
- <Text dim>Bindings: C-i C-s C-e C-v</Text>
81
- </Box>
82
- </Box>
83
- ),
84
- })
64
+ } catch (error) {
65
+ console.error("[echoes-vault] TUI init failed:", error)
66
+ try { api.ui.toast({ message: "EchoesVault TUI failed to load", variant: "error" }) } catch {}
67
+ }
85
68
  }
86
69
 
87
70
  export default { tui }