@rvboris/opencode-mempalace 0.2.1 → 0.4.0
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/README.md +137 -96
- package/README.ru.md +136 -95
- package/dist/bridge/mempalace_adapter.py +5 -1
- package/dist/plugin/hooks/event.js +37 -3
- package/dist/plugin/hooks/system.js +2 -0
- package/dist/plugin/index.js +2 -0
- package/dist/plugin/lib/constants.d.ts +5 -0
- package/dist/plugin/lib/constants.js +5 -0
- package/dist/plugin/lib/context.js +1 -1
- package/dist/plugin/lib/status.d.ts +105 -0
- package/dist/plugin/lib/status.js +537 -0
- package/dist/plugin/lib/types.d.ts +2 -2
- package/dist/plugin/lib/types.js +2 -2
- package/dist/plugin/tools/mempalace-memory.js +54 -3
- package/dist/plugin/tools/mempalace-status.d.ts +11 -0
- package/dist/plugin/tools/mempalace-status.js +18 -0
- package/dist/plugin/tui/hud.d.ts +3 -0
- package/dist/plugin/tui/hud.js +54 -0
- package/dist/plugin/tui/index.d.ts +6 -0
- package/dist/plugin/tui/index.js +9 -0
- package/package.json +14 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin";
|
|
2
|
+
import { TOOL_DESCRIPTIONS } from "../lib/constants";
|
|
3
|
+
import { formatStatusSummary, readStatusState } from "../lib/status";
|
|
4
|
+
export const mempalaceStatusTool = () => tool({
|
|
5
|
+
description: TOOL_DESCRIPTIONS.mempalaceStatus,
|
|
6
|
+
args: {
|
|
7
|
+
verbose: tool.schema.boolean().optional().default(true),
|
|
8
|
+
compact: tool.schema.boolean().optional().default(false),
|
|
9
|
+
},
|
|
10
|
+
async execute(args, executionContext) {
|
|
11
|
+
const state = await readStatusState();
|
|
12
|
+
const verbose = args.verbose ?? false;
|
|
13
|
+
return formatStatusSummary(state, executionContext.sessionID, {
|
|
14
|
+
verbose,
|
|
15
|
+
compact: !verbose,
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/solid/jsx-runtime";
|
|
2
|
+
import { createSignal } from "solid-js";
|
|
3
|
+
import { formatSessionHud, readStatusState } from "../lib/status";
|
|
4
|
+
const EMPTY_STATE = {
|
|
5
|
+
version: 2,
|
|
6
|
+
updatedAt: new Date(0).toISOString(),
|
|
7
|
+
counters: {
|
|
8
|
+
retrievalPrompts: 0,
|
|
9
|
+
retrievalSearches: 0,
|
|
10
|
+
retrievalHits: 0,
|
|
11
|
+
autosavesCompleted: 0,
|
|
12
|
+
autosavesSkipped: 0,
|
|
13
|
+
autosavesFailed: 0,
|
|
14
|
+
manualWrites: 0,
|
|
15
|
+
},
|
|
16
|
+
helpedSessionIds: [],
|
|
17
|
+
sessions: {},
|
|
18
|
+
};
|
|
19
|
+
const REFRESH_EVENTS = [
|
|
20
|
+
"message.updated",
|
|
21
|
+
"message.part.updated",
|
|
22
|
+
"session.idle",
|
|
23
|
+
"session.compacted",
|
|
24
|
+
"session.error",
|
|
25
|
+
"session.deleted",
|
|
26
|
+
];
|
|
27
|
+
export const registerStatusHud = async (api) => {
|
|
28
|
+
const [status, setStatus] = createSignal(EMPTY_STATE);
|
|
29
|
+
const refresh = async () => {
|
|
30
|
+
setStatus(await readStatusState());
|
|
31
|
+
};
|
|
32
|
+
await refresh();
|
|
33
|
+
for (const eventType of REFRESH_EVENTS) {
|
|
34
|
+
const dispose = api.event.on(eventType, () => {
|
|
35
|
+
void refresh();
|
|
36
|
+
});
|
|
37
|
+
api.lifecycle.onDispose(dispose);
|
|
38
|
+
}
|
|
39
|
+
api.slots.register({
|
|
40
|
+
slots: {
|
|
41
|
+
session_prompt_right(ctx, props) {
|
|
42
|
+
const label = formatSessionHud(status(), props.session_id);
|
|
43
|
+
const isFailed = label.startsWith("MEM FAILED");
|
|
44
|
+
const isSkipped = label.startsWith("MEM SKIPPED");
|
|
45
|
+
const accent = isFailed
|
|
46
|
+
? ctx.theme.current.error
|
|
47
|
+
: isSkipped
|
|
48
|
+
? ctx.theme.current.warning
|
|
49
|
+
: ctx.theme.current.secondary ?? ctx.theme.current.primary;
|
|
50
|
+
return (_jsxs("text", { fg: ctx.theme.current.textMuted, children: [_jsx("span", { style: { fg: accent }, children: "MEM" }), ` ${label.slice(4)}`] }));
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rvboris/opencode-mempalace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OpenCode plugin for hidden MemPalace retrieval and autosave via a local Python adapter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin/index.js",
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/plugin/index.js",
|
|
11
11
|
"types": "./dist/plugin/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./server": {
|
|
14
|
+
"import": "./dist/plugin/index.js",
|
|
15
|
+
"types": "./dist/plugin/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./tui": {
|
|
18
|
+
"import": "./dist/plugin/tui/index.js",
|
|
19
|
+
"types": "./dist/plugin/tui/index.d.ts"
|
|
12
20
|
}
|
|
13
21
|
},
|
|
14
22
|
"files": [
|
|
@@ -29,6 +37,11 @@
|
|
|
29
37
|
"type": "git",
|
|
30
38
|
"url": "git+https://github.com/rvboris/opencode-mempalace.git"
|
|
31
39
|
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@opentui/core": "^0.1.97",
|
|
42
|
+
"@opentui/solid": "^0.1.97",
|
|
43
|
+
"solid-js": "^1.9.12"
|
|
44
|
+
},
|
|
32
45
|
"peerDependencies": {
|
|
33
46
|
"@opencode-ai/plugin": "^1.4.0"
|
|
34
47
|
},
|