opencode-supermemory 0.1.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.
@@ -0,0 +1,18 @@
1
+ import Supermemory from "supermemory";
2
+ import type { MemoryType, ConversationMessage, ConversationIngestResponse } from "../types/index.js";
3
+ export declare class SupermemoryClient {
4
+ private client;
5
+ private getClient;
6
+ searchMemories(query: string, containerTag: string): Promise<Supermemory.Search.SearchMemoriesResponse>;
7
+ getProfile(containerTag: string, query?: string): Promise<Supermemory.ProfileResponse | null>;
8
+ addMemory(content: string, containerTag: string, metadata?: {
9
+ type?: MemoryType;
10
+ tool?: string;
11
+ [key: string]: unknown;
12
+ }): Promise<Supermemory.Memories.MemoryAddResponse | null>;
13
+ forgetMemory(containerTag: string, memoryId?: string): Promise<Supermemory.Memories.MemoryForgetResponse | null>;
14
+ listMemories(containerTag: string, limit?: number): Promise<Supermemory.Memories.MemoryListResponse>;
15
+ ingestConversation(conversationId: string, messages: ConversationMessage[], containerTags: string[], metadata?: Record<string, string | number | boolean>): Promise<ConversationIngestResponse | null>;
16
+ }
17
+ export declare const supermemoryClient: SupermemoryClient;
18
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,mBAAmB,CAAC;AAe3B,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,SAAS;IAUX,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAsBlD,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAmB/C,SAAS,CACb,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE;IAiBnE,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAepD,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,SAAK;IAqB7C,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,aAAa,EAAE,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACnD,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;CAmC9C;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -0,0 +1,91 @@
1
+ interface TokenInfo {
2
+ input: number;
3
+ output: number;
4
+ cache: {
5
+ read: number;
6
+ write: number;
7
+ };
8
+ }
9
+ interface MessageInfo {
10
+ id: string;
11
+ role: string;
12
+ sessionID: string;
13
+ providerID?: string;
14
+ modelID?: string;
15
+ tokens?: TokenInfo;
16
+ summary?: boolean;
17
+ finish?: boolean;
18
+ }
19
+ export interface CompactionOptions {
20
+ threshold?: number;
21
+ getModelLimit?: (providerID: string, modelID: string) => number | undefined;
22
+ }
23
+ export interface CompactionContext {
24
+ directory: string;
25
+ client: {
26
+ session: {
27
+ summarize: (params: {
28
+ path: {
29
+ id: string;
30
+ };
31
+ body: {
32
+ providerID: string;
33
+ modelID: string;
34
+ };
35
+ query: {
36
+ directory: string;
37
+ };
38
+ }) => Promise<unknown>;
39
+ messages: (params: {
40
+ path: {
41
+ id: string;
42
+ };
43
+ query: {
44
+ directory: string;
45
+ };
46
+ }) => Promise<{
47
+ data?: Array<{
48
+ info: MessageInfo;
49
+ }>;
50
+ }>;
51
+ promptAsync: (params: {
52
+ path: {
53
+ id: string;
54
+ };
55
+ body: {
56
+ agent?: string;
57
+ parts: Array<{
58
+ type: string;
59
+ text: string;
60
+ }>;
61
+ };
62
+ query: {
63
+ directory: string;
64
+ };
65
+ }) => Promise<unknown>;
66
+ };
67
+ tui: {
68
+ showToast: (params: {
69
+ body: {
70
+ title: string;
71
+ message: string;
72
+ variant: string;
73
+ duration: number;
74
+ };
75
+ }) => Promise<unknown>;
76
+ };
77
+ };
78
+ }
79
+ export declare function createCompactionHook(ctx: CompactionContext, tags: {
80
+ user: string;
81
+ project: string;
82
+ }, options?: CompactionOptions): {
83
+ event({ event }: {
84
+ event: {
85
+ type: string;
86
+ properties?: unknown;
87
+ };
88
+ }): Promise<void>;
89
+ };
90
+ export {};
91
+ //# sourceMappingURL=compaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/services/compaction.ts"],"names":[],"mappings":"AAsBA,UAAU,SAAS;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxC;AAED,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAeD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7E;AAuLD,MAAM,WAAW,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AAC;oBAAC,QAAQ,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;SAC1H,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACvC,OAAO,CAAC,EAAE,iBAAiB;qBAuNF;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE;EAgE3E"}
@@ -0,0 +1,12 @@
1
+ import type { ProfileResponse } from "supermemory/resources";
2
+ interface MemoryResultMinimal {
3
+ similarity: number;
4
+ memory?: string;
5
+ chunk?: string;
6
+ }
7
+ interface MemoriesResponseMinimal {
8
+ results?: MemoryResultMinimal[];
9
+ }
10
+ export declare function formatContextForPrompt(profile: ProfileResponse | null, userMemories: MemoriesResponseMinimal, projectMemories: MemoriesResponseMinimal): string;
11
+ export {};
12
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,uBAAuB;IAC/B,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,YAAY,EAAE,uBAAuB,EACrC,eAAe,EAAE,uBAAuB,GACvC,MAAM,CA8CR"}
@@ -0,0 +1,2 @@
1
+ export declare function log(message: string, data?: unknown): void;
2
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAQA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,QAMlD"}
@@ -0,0 +1,4 @@
1
+ export declare function containsPrivateTag(content: string): boolean;
2
+ export declare function stripPrivateContent(content: string): string;
3
+ export declare function isFullyPrivate(content: string): boolean;
4
+ //# sourceMappingURL=privacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/services/privacy.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGvD"}
@@ -0,0 +1,8 @@
1
+ export declare function getGitEmail(): string | null;
2
+ export declare function getUserTag(): string;
3
+ export declare function getProjectTag(directory: string): string;
4
+ export declare function getTags(directory: string): {
5
+ user: string;
6
+ project: string;
7
+ };
8
+ //# sourceMappingURL=tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAO3C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAOnC;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAK5E"}
@@ -0,0 +1,33 @@
1
+ export type MemoryScope = "user" | "project";
2
+ export type MemoryType = "project-config" | "architecture" | "error-solution" | "preference" | "learned-pattern" | "conversation";
3
+ export type ConversationRole = "user" | "assistant" | "system" | "tool";
4
+ export type ConversationContentPart = {
5
+ type: "text";
6
+ text: string;
7
+ } | {
8
+ type: "image_url";
9
+ imageUrl: {
10
+ url: string;
11
+ };
12
+ };
13
+ export interface ConversationToolCall {
14
+ id: string;
15
+ type: "function";
16
+ function: {
17
+ name: string;
18
+ arguments: string;
19
+ };
20
+ }
21
+ export interface ConversationMessage {
22
+ role: ConversationRole;
23
+ content: string | ConversationContentPart[];
24
+ name?: string;
25
+ tool_calls?: ConversationToolCall[];
26
+ tool_call_id?: string;
27
+ }
28
+ export interface ConversationIngestResponse {
29
+ id: string;
30
+ conversationId: string;
31
+ status: string;
32
+ }
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,cAAc,CAAC;AAEnB,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "opencode-supermemory",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode plugin that gives coding agents persistent memory using Supermemory",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "opencode-supermemory": "./dist/cli.js"
10
+ },
11
+ "scripts": {
12
+ "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && tsc --emitDeclarationOnly",
13
+ "dev": "tsc --watch",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "opencode",
18
+ "plugin",
19
+ "supermemory",
20
+ "memory",
21
+ "ai",
22
+ "coding-agent"
23
+ ],
24
+ "author": "Supermemory",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/supermemoryai/opencode-supermemory"
29
+ },
30
+ "dependencies": {
31
+ "supermemory": "^4.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@opencode-ai/plugin": "^1.0.191",
35
+ "@types/bun": "latest"
36
+ },
37
+ "peerDependencies": {
38
+ "typescript": "^5.9.3"
39
+ },
40
+ "opencode": {
41
+ "type": "plugin",
42
+ "hooks": [
43
+ "chat.message",
44
+ "event"
45
+ ]
46
+ },
47
+ "files": [
48
+ "dist"
49
+ ]
50
+ }