echoes-vault-opencode 1.0.8 → 1.0.9

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.ts +39 -54
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.9",
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.ts CHANGED
@@ -22,66 +22,51 @@ const tui: TuiPlugin = async (api) => {
22
22
  try {
23
23
  const saved = api.kv.get<VaultState>(KV)
24
24
  if (saved) vault = saved
25
- } catch {}
26
25
 
27
- function save() {
28
- try { api.kv.set(KV, vault) } catch {}
29
- }
26
+ api.event.on("session.created", () => {
27
+ vault.sessionActive = true
28
+ vault.lastSession = new Date().toISOString().slice(0, 10)
29
+ try { api.kv.set(KV, vault) } catch {}
30
+ })
30
31
 
31
- api.event.on("session.created", () => {
32
- vault.sessionActive = true
33
- save()
34
- })
32
+ api.event.on("session.deleted", () => {
33
+ vault.sessionActive = false
34
+ try { api.kv.set(KV, vault) } catch {}
35
+ })
35
36
 
36
- api.event.on("session.deleted", () => {
37
- vault.sessionActive = false
38
- save()
39
- })
37
+ api.event.on("session.idle", () => {
38
+ vault.sessionActive = false
39
+ try { api.kv.set(KV, vault) } catch {}
40
+ })
40
41
 
41
- api.event.on("session.idle", () => {
42
- vault.sessionActive = false
43
- save()
44
- })
42
+ api.slots.register({
43
+ sidebar_content: ({ session_id }: { session_id: string }) => {
44
+ const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
45
+ const title = sessionInfo?.title ?? "—"
46
+ const count = vault.pagesCount
45
47
 
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
- ],
48
+ return (
49
+ <Box flexDirection="column">
50
+ <Box border="all" borderStyle="single" paddingX={1} paddingY={0}>
51
+ <Text bold>EchoesVault</Text>
52
+ </Box>
53
+ <Box paddingX={1}>
54
+ <Text dim>
55
+ {vault.sessionActive ? `Session: ${title}` : "Idle"}
56
+ {count > 0 ? ` · ${count} pages` : ""}
57
+ </Text>
58
+ </Box>
59
+ <Box paddingX={1} paddingY={0}>
60
+ <Text dim>/echoes-init /echoes-start /echoes-end /echoes-status</Text>
61
+ </Box>
62
+ </Box>
63
+ )
64
+ },
61
65
  })
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
- })
66
+ } catch (error) {
67
+ console.error("[echoes-vault] TUI init failed:", error)
68
+ try { api.ui.toast({ message: "EchoesVault TUI failed to load", variant: "error" }) } catch {}
69
+ }
85
70
  }
86
71
 
87
72
  export default { tui }