echoes-vault-opencode 1.0.7 → 1.0.8
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 +3 -2
- package/tui.ts +50 -96
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echoes-vault-opencode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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,7 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@opencode-ai/plugin": ">=1.16.0"
|
|
31
|
+
"@opencode-ai/plugin": ">=1.16.0",
|
|
32
|
+
"@opentui/solid": ">=0.3.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/node": "^22.0.0",
|
package/tui.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
|
|
1
3
|
import type { TuiPlugin } from "@opencode-ai/plugin/tui"
|
|
2
4
|
|
|
3
5
|
const tui: TuiPlugin = async (api) => {
|
|
@@ -10,123 +12,75 @@ const tui: TuiPlugin = async (api) => {
|
|
|
10
12
|
lastSession: string | null
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
let vault: VaultState =
|
|
15
|
+
let vault: VaultState = {
|
|
14
16
|
initialized: false,
|
|
15
17
|
sessionActive: false,
|
|
16
18
|
pagesCount: 0,
|
|
17
19
|
lastSession: null,
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
api.kv.
|
|
22
|
-
|
|
22
|
+
try {
|
|
23
|
+
const saved = api.kv.get<VaultState>(KV)
|
|
24
|
+
if (saved) vault = saved
|
|
25
|
+
} catch {}
|
|
23
26
|
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
persist()
|
|
27
|
+
function save() {
|
|
28
|
+
try { api.kv.set(KV, vault) } catch {}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
api.event.on("session.created", () => {
|
|
30
|
-
|
|
32
|
+
vault.sessionActive = true
|
|
33
|
+
save()
|
|
31
34
|
})
|
|
32
35
|
|
|
33
36
|
api.event.on("session.deleted", () => {
|
|
34
|
-
|
|
37
|
+
vault.sessionActive = false
|
|
38
|
+
save()
|
|
35
39
|
})
|
|
36
40
|
|
|
37
41
|
api.event.on("session.idle", () => {
|
|
38
|
-
|
|
42
|
+
vault.sessionActive = false
|
|
43
|
+
save()
|
|
39
44
|
})
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
],
|
|
61
|
+
})
|
|
62
|
+
} catch {}
|
|
56
63
|
|
|
57
64
|
api.slots.register({
|
|
58
|
-
sidebar_content: (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
</
|
|
74
|
-
|
|
75
|
-
<Box paddingX={1}>
|
|
76
|
-
<Text dim>
|
|
77
|
-
{active ? `Session: ${sessionTitle}` : vault.lastSession ? `Last: ${vault.lastSession}` : "No session"}
|
|
78
|
-
{pagesInfo}
|
|
79
|
-
</Text>
|
|
80
|
-
</Box>
|
|
81
|
-
|
|
82
|
-
<Box
|
|
83
|
-
marginTop={0}
|
|
84
|
-
marginBottom={0}
|
|
85
|
-
paddingLeft={1}
|
|
86
|
-
paddingRight={1}
|
|
87
|
-
onMouseDown={() => api.ui.toast({ message: "Use /echoes-init to initialize the vault", variant: "info", duration: 2500 })}
|
|
88
|
-
>
|
|
89
|
-
<Box flexDirection="row" justifyContent="space-between">
|
|
90
|
-
<Text>Init Vault</Text>
|
|
91
|
-
<Text dim>C-i</Text>
|
|
92
|
-
</Box>
|
|
93
|
-
</Box>
|
|
94
|
-
|
|
95
|
-
<Box
|
|
96
|
-
paddingLeft={1}
|
|
97
|
-
paddingRight={1}
|
|
98
|
-
onMouseDown={() => api.ui.toast({ message: "Use /echoes-start to restore context", variant: "info", duration: 2500 })}
|
|
99
|
-
>
|
|
100
|
-
<Box flexDirection="row" justifyContent="space-between">
|
|
101
|
-
<Text>Start Session</Text>
|
|
102
|
-
<Text dim>C-s</Text>
|
|
103
|
-
</Box>
|
|
104
|
-
</Box>
|
|
105
|
-
|
|
106
|
-
<Box
|
|
107
|
-
paddingLeft={1}
|
|
108
|
-
paddingRight={1}
|
|
109
|
-
onMouseDown={() => api.ui.toast({ message: "Use /echoes-end to save session memory", variant: "info", duration: 2500 })}
|
|
110
|
-
>
|
|
111
|
-
<Box flexDirection="row" justifyContent="space-between">
|
|
112
|
-
<Text>End Session</Text>
|
|
113
|
-
<Text dim>C-e</Text>
|
|
114
|
-
</Box>
|
|
115
|
-
</Box>
|
|
116
|
-
|
|
117
|
-
<Box
|
|
118
|
-
paddingLeft={1}
|
|
119
|
-
paddingRight={1}
|
|
120
|
-
onMouseDown={() => api.ui.toast({ message: "Use /echoes-status to check vault health", variant: "info", duration: 2500 })}
|
|
121
|
-
>
|
|
122
|
-
<Box flexDirection="row" justifyContent="space-between">
|
|
123
|
-
<Text>Vault Status</Text>
|
|
124
|
-
<Text dim>C-v</Text>
|
|
125
|
-
</Box>
|
|
126
|
-
</Box>
|
|
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>
|
|
127
81
|
</Box>
|
|
128
|
-
|
|
129
|
-
|
|
82
|
+
</Box>
|
|
83
|
+
),
|
|
130
84
|
})
|
|
131
85
|
}
|
|
132
86
|
|