@momomemory/opencode-momo 0.1.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 +202 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +430 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13914 -0
- package/dist/services/compaction.d.ts +18 -0
- package/dist/services/compaction.d.ts.map +1 -0
- package/dist/services/context.d.ts +17 -0
- package/dist/services/context.d.ts.map +1 -0
- package/dist/services/jsonc.d.ts +7 -0
- package/dist/services/jsonc.d.ts.map +1 -0
- package/dist/services/privacy.d.ts +8 -0
- package/dist/services/privacy.d.ts.map +1 -0
- package/dist/services/tags.d.ts +22 -0
- package/dist/services/tags.d.ts.map +1 -0
- package/dist/test/chat-message.test.d.ts +2 -0
- package/dist/test/chat-message.test.d.ts.map +1 -0
- package/dist/test/cli.test.d.ts +2 -0
- package/dist/test/cli.test.d.ts.map +1 -0
- package/dist/test/config.test.d.ts +2 -0
- package/dist/test/config.test.d.ts.map +1 -0
- package/dist/test/placeholder.test.d.ts +2 -0
- package/dist/test/placeholder.test.d.ts.map +1 -0
- package/dist/test/tags-privacy.test.d.ts +2 -0
- package/dist/test/tags-privacy.test.d.ts.map +1 -0
- package/dist/test/tool.test.d.ts +2 -0
- package/dist/test/tool.test.d.ts.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction logic for ingesting conversation summaries into Momo.
|
|
3
|
+
*
|
|
4
|
+
* Monitors session events and, when OpenCode compacts a session,
|
|
5
|
+
* ingests the summary into Momo for long-term memory.
|
|
6
|
+
*/
|
|
7
|
+
import type { MomoClient } from "@momomemory/sdk";
|
|
8
|
+
import type { Event } from "@opencode-ai/sdk";
|
|
9
|
+
/**
|
|
10
|
+
* Handle events relevant to conversation compaction.
|
|
11
|
+
* - On `session.compacted`: mark that a compaction just happened for a session
|
|
12
|
+
* - On `message.updated`: when a summary message finishes, ingest it into Momo
|
|
13
|
+
* - On `session.deleted`: clean up tracked state
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleCompactionEvent(event: Event, momo: MomoClient, containerTag: string): Promise<void>;
|
|
16
|
+
/** Visible for testing */
|
|
17
|
+
export declare function _resetState(): void;
|
|
18
|
+
//# sourceMappingURL=compaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/services/compaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAoB,MAAM,kBAAkB,CAAC;AAoBhE;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAyDf;AAED,0BAA0B;AAC1B,wBAAgB,WAAW,IAAI,IAAI,CAElC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context formatting for injecting Momo memory into chat sessions.
|
|
3
|
+
*/
|
|
4
|
+
interface MemoryItem {
|
|
5
|
+
content?: string;
|
|
6
|
+
memoryType?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ProfileData {
|
|
11
|
+
summary?: string;
|
|
12
|
+
traits?: string[];
|
|
13
|
+
preferences?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare function formatContextForPrompt(profile: ProfileData | null | undefined, userMemories: MemoryItem[], projectMemories: MemoryItem[]): string;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,UAAU;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACvC,YAAY,EAAE,UAAU,EAAE,EAC1B,eAAe,EAAE,UAAU,EAAE,GAC5B,MAAM,CAyCR"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips comments from JSONC content while respecting string boundaries.
|
|
3
|
+
* Handles // and /* comments, URLs in strings, and escaped quotes.
|
|
4
|
+
* Also removes trailing commas to support more relaxed JSONC format.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stripJsoncComments(content: string): string;
|
|
7
|
+
//# sourceMappingURL=jsonc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/services/jsonc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0E1D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function stripPrivateContent(text: string): string;
|
|
2
|
+
export declare function isFullyPrivate(text: string): boolean;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
stripPrivateContent: typeof stripPrivateContent;
|
|
5
|
+
isFullyPrivate: typeof isFullyPrivate;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
//# 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,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;;;;;AAED,wBAAuD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function simpleHash(input: string): string;
|
|
2
|
+
export declare function userTag(): string;
|
|
3
|
+
export declare function projectTag(directory: string): string;
|
|
4
|
+
export declare function getTags(directory: string): {
|
|
5
|
+
user: string;
|
|
6
|
+
project: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function getTagsWithOverrides(directory: string, overrides?: {
|
|
9
|
+
containerTagUser?: string;
|
|
10
|
+
containerTagProject?: string;
|
|
11
|
+
}): {
|
|
12
|
+
user: string;
|
|
13
|
+
project: string;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: {
|
|
16
|
+
getTags: typeof getTags;
|
|
17
|
+
getTagsWithOverrides: typeof getTagsWithOverrides;
|
|
18
|
+
userTag: typeof userTag;
|
|
19
|
+
projectTag: typeof projectTag;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED,wBAAgB,OAAO,IAAI,MAAM,CAGhC;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAE5E;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAKnC;;;;;;;AAcD,wBAAsE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message.test.d.ts","sourceRoot":"","sources":["../../src/test/chat-message.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.test.d.ts","sourceRoot":"","sources":["../../src/test/cli.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../../src/test/config.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.test.d.ts","sourceRoot":"","sources":["../../src/test/placeholder.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags-privacy.test.d.ts","sourceRoot":"","sources":["../../src/test/tags-privacy.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.test.d.ts","sourceRoot":"","sources":["../../src/test/tool.test.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@momomemory/opencode-momo",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "OpenCode plugin that gives coding agents persistent memory using Momo",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"opencode-momo": "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
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"test": "bun test"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"opencode",
|
|
18
|
+
"plugin",
|
|
19
|
+
"momo",
|
|
20
|
+
"memory",
|
|
21
|
+
"ai",
|
|
22
|
+
"coding-agent"
|
|
23
|
+
],
|
|
24
|
+
"author": "Momo Contributors",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/momomemory/opencode-momo.git"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@opencode-ai/plugin": "^1.1.53",
|
|
32
|
+
"@momomemory/sdk": "^0.2.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/bun": "latest",
|
|
36
|
+
"typescript": "^5.7.3"
|
|
37
|
+
},
|
|
38
|
+
"opencode": {
|
|
39
|
+
"type": "plugin",
|
|
40
|
+
"hooks": [
|
|
41
|
+
"chat.message",
|
|
42
|
+
"event",
|
|
43
|
+
"tool"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist"
|
|
48
|
+
]
|
|
49
|
+
}
|