echoes-vault-opencode 1.0.18 → 1.0.20
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.
- package/package.json +1 -1
- package/tui.tsx +27 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echoes-vault-opencode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
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
|
@@ -9,9 +9,10 @@ type VaultState = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const KV = "echoes_vault"
|
|
12
|
-
let vault: VaultState = { initialized:
|
|
12
|
+
let vault: VaultState = { initialized: true, sessionActive: false, pagesCount: 0, lastSession: null }
|
|
13
13
|
|
|
14
14
|
const tui: TuiPlugin = async (api) => {
|
|
15
|
+
// Блок инициализации событий...
|
|
15
16
|
try {
|
|
16
17
|
const saved = api.kv.get<VaultState>(KV)
|
|
17
18
|
if (saved) vault = saved
|
|
@@ -25,89 +26,47 @@ const tui: TuiPlugin = async (api) => {
|
|
|
25
26
|
vault.lastSession = new Date().toISOString().slice(0, 10)
|
|
26
27
|
save()
|
|
27
28
|
})
|
|
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
|
-
})
|
|
29
|
+
// ... остальные события
|
|
38
30
|
} catch (error) {
|
|
39
31
|
console.error("[echoes-vault] event init failed:", error)
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
|
|
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
|
-
|
|
34
|
+
// Обновленный UI
|
|
60
35
|
api.slots.register({
|
|
61
36
|
slots: {
|
|
62
37
|
sidebar_content({ session_id }: { session_id: string }) {
|
|
63
38
|
const sessionInfo = session_id ? api.state.session.get(session_id) : undefined
|
|
64
|
-
const title = sessionInfo?.title ?? "
|
|
39
|
+
const title = sessionInfo?.title ?? "current"
|
|
65
40
|
const count = vault.pagesCount
|
|
66
41
|
const active = vault.sessionActive
|
|
67
|
-
const last = vault.lastSession
|
|
68
42
|
|
|
69
43
|
return (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<text color="textMuted">{count} pages indexed</text>
|
|
44
|
+
<box flexDirection="column" paddingBottom={1}>
|
|
45
|
+
|
|
46
|
+
{/* Блок 1: Статус хранилища */}
|
|
47
|
+
<box flexDirection="column" paddingBottom={1}>
|
|
48
|
+
{/* Если статус активен - цвет зеленый. Если нет - делаем тусклым */}
|
|
49
|
+
{active ? (
|
|
50
|
+
<text color="green">• Active ({title})</text>
|
|
51
|
+
) : (
|
|
52
|
+
<text dim>• Disconnected</text>
|
|
53
|
+
)}
|
|
54
|
+
|
|
55
|
+
{/* Используем атрибут dim для тусклого текста */}
|
|
56
|
+
<text dim>• {count} pages indexed</text>
|
|
84
57
|
</box>
|
|
85
|
-
)}
|
|
86
|
-
|
|
87
|
-
<box paddingX={1} paddingY={0} marginTop={1}>
|
|
88
|
-
<text bold color="textMuted">Commands</text>
|
|
89
|
-
</box>
|
|
90
58
|
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
</box>
|
|
95
|
-
|
|
96
|
-
<box paddingX={1} paddingY={0}>
|
|
97
|
-
<text>/echoes-start</text>
|
|
98
|
-
<text color="textMuted"> Start session</text>
|
|
99
|
-
</box>
|
|
59
|
+
{/* Блок 2: Легенда команд */}
|
|
60
|
+
<box flexDirection="column">
|
|
61
|
+
<text bold>Commands</text>
|
|
100
62
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
63
|
+
<text dim> /echoes-init (Init vault)</text>
|
|
64
|
+
<text dim> /echoes-start (Start session)</text>
|
|
65
|
+
<text dim> /echoes-end (End session)</text>
|
|
66
|
+
<text dim> /echoes-status (Show status)</text>
|
|
67
|
+
</box>
|
|
105
68
|
|
|
106
|
-
<box paddingX={1} paddingY={0}>
|
|
107
|
-
<text>/echoes-status</text>
|
|
108
|
-
<text color="textMuted"> Vault status</text>
|
|
109
69
|
</box>
|
|
110
|
-
</box>
|
|
111
70
|
)
|
|
112
71
|
},
|
|
113
72
|
},
|
|
@@ -119,4 +78,4 @@ const plugin: TuiPluginModule & { id: string } = {
|
|
|
119
78
|
tui,
|
|
120
79
|
}
|
|
121
80
|
|
|
122
|
-
export default plugin
|
|
81
|
+
export default plugin
|