@ryan_nookpi/pi-extension-memory-layer 0.1.0 → 0.2.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/index.ts +3 -3
- package/package.json +4 -4
- package/types.ts +9 -18
- package/ui.ts +2 -2
package/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
2
|
-
import { copyToClipboard } from "@
|
|
3
|
-
import { Text } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { copyToClipboard } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
4
4
|
|
|
5
5
|
import { buildMemoryPrompt } from "./inject.ts";
|
|
6
6
|
import { resolveProjectId } from "./project-id.ts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryan_nookpi/pi-extension-memory-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Long-term memory layer for pi — remember, recall, forget, and browse memories across sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
34
|
+
"@earendil-works/pi-ai": "*",
|
|
35
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
36
|
+
"@earendil-works/pi-tui": "*",
|
|
37
37
|
"@sinclair/typebox": "*"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
package/types.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { StringEnum } from "@mariozechner/pi-ai";
|
|
2
1
|
import { Type } from "@sinclair/typebox";
|
|
3
2
|
|
|
3
|
+
const MemoryScopeSchema = Type.Union([Type.Literal("user"), Type.Literal("project")], {
|
|
4
|
+
description:
|
|
5
|
+
"Storage scope. 'user' for personal profile, global preferences, or cross-project rules. 'project' for repo-specific tech decisions, env, tooling, configs.",
|
|
6
|
+
});
|
|
7
|
+
|
|
4
8
|
// ── Memory Scope ─────────────────────────────────────────────────────────────
|
|
5
9
|
|
|
6
10
|
export type MemoryScope = "user" | "project";
|
|
@@ -12,12 +16,7 @@ export const RememberParams = Type.Object({
|
|
|
12
16
|
description: "Content to remember (the fact, rule, or lesson to store in long-term memory)",
|
|
13
17
|
}),
|
|
14
18
|
title: Type.Optional(Type.String({ description: "Short title/summary for the memory (auto-generated if omitted)" })),
|
|
15
|
-
scope:
|
|
16
|
-
description:
|
|
17
|
-
"Storage scope. 'user' for personal profile, global preferences, or cross-project rules. " +
|
|
18
|
-
"'project' for repo-specific tech decisions, env, tooling, configs. " +
|
|
19
|
-
"Choose based on whether the information applies globally or only to the current project.",
|
|
20
|
-
}),
|
|
19
|
+
scope: MemoryScopeSchema,
|
|
21
20
|
});
|
|
22
21
|
|
|
23
22
|
export const RecallParams = Type.Object({
|
|
@@ -30,11 +29,7 @@ export const RecallParams = Type.Object({
|
|
|
30
29
|
id: Type.Optional(
|
|
31
30
|
Type.String({ description: "Memory entry ID for detail lookup. Returns the full content of a specific memory." }),
|
|
32
31
|
),
|
|
33
|
-
scope: Type.Optional(
|
|
34
|
-
StringEnum(["user", "project"] as const, {
|
|
35
|
-
description: "Optional scope filter for recall results (user|project).",
|
|
36
|
-
}),
|
|
37
|
-
),
|
|
32
|
+
scope: Type.Optional(MemoryScopeSchema),
|
|
38
33
|
});
|
|
39
34
|
|
|
40
35
|
export const ForgetParams = Type.Object(
|
|
@@ -49,17 +44,13 @@ export const ForgetParams = Type.Object(
|
|
|
49
44
|
description:
|
|
50
45
|
"Title of the memory entry to remove. Exact match is preferred; if topic is omitted, it must resolve to a single memory.",
|
|
51
46
|
}),
|
|
52
|
-
scope: Type.Optional(
|
|
53
|
-
StringEnum(["user", "project"] as const, {
|
|
54
|
-
description: "Scope to delete from (user|project). If omitted, searches both and errors on ambiguity.",
|
|
55
|
-
}),
|
|
56
|
-
),
|
|
47
|
+
scope: Type.Optional(MemoryScopeSchema),
|
|
57
48
|
},
|
|
58
49
|
{ description: "Permanently delete a memory entry. This action is irreversible." },
|
|
59
50
|
);
|
|
60
51
|
|
|
61
52
|
export const MemoryListParams = Type.Object({
|
|
62
|
-
scope: Type.Optional(
|
|
53
|
+
scope: Type.Optional(MemoryScopeSchema),
|
|
63
54
|
});
|
|
64
55
|
|
|
65
56
|
// ── Project ID Resolution (unchanged) ────────────────────────────────────────
|
package/ui.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Displays entries as [scope] topic / title.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { DynamicBorder, getMarkdownTheme, type Theme } from "@
|
|
6
|
+
import { DynamicBorder, getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import {
|
|
8
8
|
Container,
|
|
9
9
|
type Focusable,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
type TUI,
|
|
21
21
|
truncateToWidth,
|
|
22
22
|
visibleWidth,
|
|
23
|
-
} from "@
|
|
23
|
+
} from "@earendil-works/pi-tui";
|
|
24
24
|
import type { SearchResult } from "./storage.ts";
|
|
25
25
|
import type { MemoryScope } from "./types.ts";
|
|
26
26
|
|