echoes-vault-opencode 1.0.14 → 1.0.15

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 +41 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoes-vault-opencode",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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
@@ -1,5 +1,30 @@
1
+ import { createElement, spread } from "@opentui/solid"
1
2
  import type { TuiPlugin } from "@opencode-ai/plugin/tui"
2
3
 
4
+ function h(tag: string, props: Record<string, any> = {}, children: any[] = []) {
5
+ const el = createElement(tag)
6
+ spread(el, props)
7
+ for (const child of children) {
8
+ if (child != null && child !== false) el.add(child)
9
+ }
10
+ return el
11
+ }
12
+
13
+ function t(content: string, props: Record<string, any> = {}) {
14
+ const el = createElement("text")
15
+ el.content = content
16
+ spread(el, props)
17
+ return el
18
+ }
19
+
20
+ function box(props: Record<string, any> = {}, ...children: any[]) {
21
+ return h("box", props, children.flat())
22
+ }
23
+
24
+ function text(content: string, props: Record<string, any> = {}) {
25
+ return t(content, props)
26
+ }
27
+
3
28
  const tui: TuiPlugin = async (api) => {
4
29
  const KV = "echoes_vault"
5
30
 
@@ -42,22 +67,23 @@ const tui: TuiPlugin = async (api) => {
42
67
  const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
43
68
  const title = sessionInfo?.title ?? "—"
44
69
  const count = vault.pagesCount
70
+ const statusLine = vault.sessionActive ? `Session: ${title}` : "Idle"
71
+ const pagesLine = count > 0 ? ` · ${count} pages` : ""
45
72
 
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>
73
+ return box(
74
+ { flexDirection: "column" },
75
+ box(
76
+ { border: "all" as any, borderStyle: "single" as any, paddingX: 1, paddingY: 0 },
77
+ text("EchoesVault"),
78
+ ),
79
+ box(
80
+ { paddingX: 1 },
81
+ text(`${statusLine}${pagesLine}`, { dim: true }),
82
+ ),
83
+ box(
84
+ { paddingX: 1, paddingY: 0 },
85
+ text("/echoes-init /echoes-start /echoes-end /echoes-status", { dim: true }),
86
+ ),
61
87
  )
62
88
  },
63
89
  })