@opvs-ai/cli 0.22.0 → 0.24.1
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 +73 -0
- package/claude-plugin/.claude-plugin/marketplace.json +14 -0
- package/claude-plugin/.claude-plugin/plugin.json +9 -0
- package/claude-plugin/.mcp.json +8 -0
- package/claude-plugin/README.md +24 -0
- package/claude-plugin/hooks/hooks.json +50 -0
- package/claude-plugin/skills/remember/SKILL.md +31 -0
- package/claude-plugin/skills/remember/scripts/remember.mjs +121 -0
- package/dist/.build-stamp.json +5 -5
- package/dist/commands/code-graph.d.ts +17 -0
- package/dist/commands/code-graph.js +64 -0
- package/dist/commands/code-graph.js.map +1 -0
- package/dist/commands/code.d.ts +13 -3
- package/dist/commands/code.js +191 -3
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/memory-capture.d.ts +76 -0
- package/dist/commands/memory-capture.js +562 -0
- package/dist/commands/memory-capture.js.map +1 -0
- package/dist/commands/memory-hook.d.ts +21 -0
- package/dist/commands/memory-hook.js +138 -0
- package/dist/commands/memory-hook.js.map +1 -0
- package/dist/commands/memory-install.d.ts +17 -0
- package/dist/commands/memory-install.js +349 -0
- package/dist/commands/memory-install.js.map +1 -0
- package/dist/commands/memory-lessons.d.ts +8 -0
- package/dist/commands/memory-lessons.js +135 -0
- package/dist/commands/memory-lessons.js.map +1 -0
- package/dist/commands/memory.d.ts +24 -0
- package/dist/commands/memory.js +239 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/myMail.d.ts +3 -0
- package/dist/commands/myMail.js +119 -0
- package/dist/commands/myMail.js.map +1 -0
- package/dist/commands/orgChart.d.ts +3 -0
- package/dist/commands/orgChart.js +88 -0
- package/dist/commands/orgChart.js.map +1 -0
- package/dist/commands/tasks.js +45 -3
- package/dist/commands/tasks.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/redact.d.ts +16 -0
- package/dist/lib/redact.js +92 -0
- package/dist/lib/redact.js.map +1 -0
- package/package.json +3 -1
- package/runtime-plugins/cline/opvs-memory.ts +99 -0
- package/runtime-plugins/opencode/opvs-memory.ts +94 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// OPVS_MEMORY_PLUGIN_MANAGED: installed by `opvs memory install opencode`.
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
const TIMEOUT_MS = 2_000;
|
|
5
|
+
|
|
6
|
+
type HookChild = {
|
|
7
|
+
stdin: {
|
|
8
|
+
end(input: string): unknown;
|
|
9
|
+
once?(event: "error", listener: () => void): unknown;
|
|
10
|
+
} | null;
|
|
11
|
+
once(event: "error" | "close", listener: () => void): unknown;
|
|
12
|
+
kill?(signal?: NodeJS.Signals): unknown;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type SpawnHook = (
|
|
16
|
+
command: string,
|
|
17
|
+
args: string[],
|
|
18
|
+
options: { stdio: ["pipe", "ignore", "ignore"]; timeout: number; windowsHide: boolean },
|
|
19
|
+
) => HookChild;
|
|
20
|
+
|
|
21
|
+
function object(value: unknown): Record<string, unknown> | null {
|
|
22
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
23
|
+
? value as Record<string, unknown>
|
|
24
|
+
: null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function forward(hook: "post-tool" | "stop" | "session-end", event: unknown): Promise<void> {
|
|
28
|
+
try {
|
|
29
|
+
const input = JSON.stringify(event) ?? "null";
|
|
30
|
+
await new Promise<void>((resolve) => {
|
|
31
|
+
let child: HookChild;
|
|
32
|
+
try {
|
|
33
|
+
child = (spawn as unknown as SpawnHook)(
|
|
34
|
+
"opvs",
|
|
35
|
+
["memory", "hook", hook, "--runtime", "opencode"],
|
|
36
|
+
{ stdio: ["pipe", "ignore", "ignore"], timeout: TIMEOUT_MS, windowsHide: true },
|
|
37
|
+
);
|
|
38
|
+
} catch {
|
|
39
|
+
resolve();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let settled = false;
|
|
44
|
+
const timer = setTimeout(() => {
|
|
45
|
+
try {
|
|
46
|
+
child.kill?.("SIGKILL");
|
|
47
|
+
} catch {
|
|
48
|
+
// A hook process that already exited needs no further cleanup.
|
|
49
|
+
}
|
|
50
|
+
finish();
|
|
51
|
+
}, TIMEOUT_MS);
|
|
52
|
+
timer.unref?.();
|
|
53
|
+
|
|
54
|
+
const finish = (): void => {
|
|
55
|
+
if (settled) return;
|
|
56
|
+
settled = true;
|
|
57
|
+
clearTimeout(timer);
|
|
58
|
+
resolve();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
child.once("error", finish);
|
|
63
|
+
child.once("close", finish);
|
|
64
|
+
child.stdin?.once?.("error", finish);
|
|
65
|
+
if (!child.stdin) finish();
|
|
66
|
+
else child.stdin.end(input);
|
|
67
|
+
} catch {
|
|
68
|
+
try {
|
|
69
|
+
child.kill?.("SIGKILL");
|
|
70
|
+
} catch {
|
|
71
|
+
// Never let runtime hook cleanup break the host session.
|
|
72
|
+
}
|
|
73
|
+
finish();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
77
|
+
// Memory capture is optional and must never break an OpenCode session.
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const OpvsMemoryPlugin = async () => ({
|
|
82
|
+
"tool.execute.after": async (event: unknown): Promise<undefined> => {
|
|
83
|
+
await forward("post-tool", event);
|
|
84
|
+
return undefined;
|
|
85
|
+
},
|
|
86
|
+
event: async (input: unknown): Promise<undefined> => {
|
|
87
|
+
const envelope = object(input);
|
|
88
|
+
const event = envelope?.event ?? input;
|
|
89
|
+
const type = object(event)?.type;
|
|
90
|
+
if (type === "session.idle") await forward("stop", event);
|
|
91
|
+
else if (type === "session.deleted") await forward("session-end", event);
|
|
92
|
+
return undefined;
|
|
93
|
+
},
|
|
94
|
+
});
|