@ephemushroom/opencode-claude-mem 0.7.0 → 0.7.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 +112 -62
- package/dist/capture-status.d.ts +26 -0
- package/dist/cli.js +171 -28
- package/dist/official-sync.d.ts +29 -0
- package/dist/server.d.ts +70 -0
- package/dist/server.js +1299 -0
- package/dist/sidebar-model.d.ts +4 -1
- package/dist/tui.js +171 -29
- package/dist/worker-client.d.ts +28 -1
- package/dist/worker-start.d.ts +46 -0
- package/dist/worker-tools.d.ts +33 -0
- package/package.json +7 -3
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode V2 server plugin: one package entry that brings claude-mem to OpenCode.
|
|
3
|
+
*
|
|
4
|
+
* Capture and context injection stay upstream code: this plugin downloads the official
|
|
5
|
+
* claude-mem OpenCode plugin at the running Worker's version and runs its `setup` with
|
|
6
|
+
* this plugin's context. On top of that it registers the memory tools the official plugin
|
|
7
|
+
* leaves to claude-mem's MCP server, starts the Worker when it is not running, and reports
|
|
8
|
+
* what happened to the sidebar. Loaded from `opencode.json`:
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* { "plugins": ["@ephemushroom/opencode-claude-mem"] }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* `{ "package": "...", "options": { "mcp": true } }` registers claude-mem's MCP server
|
|
15
|
+
* (all of its tools, in a separate process) instead of this plugin's own tools.
|
|
16
|
+
*/
|
|
17
|
+
import { type CaptureStatusWriter } from './capture-status';
|
|
18
|
+
import type { Plugin } from '@opencode/plugin';
|
|
19
|
+
type Cleanup = () => Promise<void> | void;
|
|
20
|
+
/** What a capture pass needs from the host; `Plugin.Context` satisfies it. */
|
|
21
|
+
export interface CaptureContext {
|
|
22
|
+
readonly mcp: Pick<Plugin.Context['mcp'], 'transform'>;
|
|
23
|
+
/** The host's plugins for this checkout; its result is read defensively. */
|
|
24
|
+
readonly plugin: {
|
|
25
|
+
readonly list: () => Promise<unknown>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What the host says about a plugin with the official id: loaded and running, loaded and
|
|
30
|
+
* failed, not among its plugins, or `unknown` while its list is still empty.
|
|
31
|
+
*/
|
|
32
|
+
export type OfficialPluginState = 'active' | 'failed' | 'absent' | 'unknown';
|
|
33
|
+
export declare function officialPluginState(ctx: CaptureContext): Promise<OfficialPluginState>;
|
|
34
|
+
/** One `setup` call: the host runs it once per checkout it serves. */
|
|
35
|
+
export interface CaptureSession {
|
|
36
|
+
readonly ctx: CaptureContext;
|
|
37
|
+
readonly directory: string;
|
|
38
|
+
readonly status: CaptureStatusWriter;
|
|
39
|
+
readonly useMcp: boolean;
|
|
40
|
+
readonly keep: (cleanup: Cleanup) => void;
|
|
41
|
+
readonly disposed: () => boolean;
|
|
42
|
+
/** Something records this checkout's sessions: the copy loaded here, or a standalone one the host confirmed. */
|
|
43
|
+
capturing: boolean;
|
|
44
|
+
mcpRegistered: boolean;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* True when the official plugin exists as a standalone file, the way
|
|
48
|
+
* `npx claude-mem install --ide opencode` leaves it in the config directory, or a project
|
|
49
|
+
* keeps it under `.opencode` in the checkout or a directory above it. OpenCode normally
|
|
50
|
+
* loads that file by itself, and a second copy here would record every prompt and tool
|
|
51
|
+
* call twice. The file alone proves nothing: whether it runs is the host's to say
|
|
52
|
+
* (`officialPluginState`).
|
|
53
|
+
*/
|
|
54
|
+
export declare function standalonePluginInstalled(env: Record<string, string | undefined>, home: string, directory: string): boolean;
|
|
55
|
+
/** claude-mem's MCP server is a Node script; without Node the host binary runs it as Bun. */
|
|
56
|
+
export declare function mcpServerCommand(script: string, node: string | null, host: string): {
|
|
57
|
+
command: string[];
|
|
58
|
+
environment?: Record<string, string>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* One pass over what is still missing: a running Worker, the official files at exactly its
|
|
62
|
+
* version, capture, and the MCP server when asked for. Resolves true when nothing is left
|
|
63
|
+
* to do. Each step is recorded only after it succeeded, so a later pass never repeats it:
|
|
64
|
+
* a second `setup` of the official plugin would record everything twice. Only the first
|
|
65
|
+
* pass starts the Worker; later ones look at what is there, so a Worker that crashes on
|
|
66
|
+
* start is not launched again every minute.
|
|
67
|
+
*/
|
|
68
|
+
export declare function attemptCapture(session: CaptureSession, first: boolean): Promise<boolean>;
|
|
69
|
+
declare const plugin: Plugin.Plugin;
|
|
70
|
+
export default plugin;
|