@eleboucher/pi-memini 0.6.3 → 0.6.5
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/dist/index.js +588 -583
- package/package.json +4 -4
- package/dist/index.d.ts +0 -67
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eleboucher/pi-memini",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Shared cross-session memory for the Pi coding agent, backed by a memini service.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "
|
|
11
|
-
"test": "npx tsx --test test/helpers.test.ts",
|
|
10
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node20 --external:typebox --external:@earendil-works/pi-coding-agent --alias:@memini/namespace-resolver=../../../packages/namespace-resolver/src/index.ts --outfile=dist/index.js",
|
|
11
|
+
"test": "node --test test/bundle.test.mjs && npx tsx --test test/helpers.test.ts",
|
|
12
12
|
"typecheck": "tsc -p tsconfig.test.json"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@memini/namespace-resolver": "workspace:*",
|
|
16
15
|
"typebox": "^1.1.38"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
18
|
"@earendil-works/pi-coding-agent": "latest",
|
|
20
19
|
"@types/node": "^24.0.0",
|
|
20
|
+
"esbuild": "^0.28.1",
|
|
21
21
|
"tsx": "^4.20.0",
|
|
22
22
|
"typescript": "^5.9.0"
|
|
23
23
|
},
|
package/dist/index.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* memini memory extension for Pi (https://pi.dev).
|
|
3
|
-
*
|
|
4
|
-
* Pi has no built-in MCP, but it has a first-class extension API. This extension
|
|
5
|
-
* wires memory two ways at once:
|
|
6
|
-
*
|
|
7
|
-
* - Automatic (no tool call needed):
|
|
8
|
-
* - before_agent_start: recall memories relevant to the user's prompt and
|
|
9
|
-
* inject them as a persistent context message before the agent runs.
|
|
10
|
-
* - agent_end: capture the completed user/assistant turn into memini as
|
|
11
|
-
* episodic memory.
|
|
12
|
-
* - Explicit tools (the model calls them on demand), modeled on the tool set
|
|
13
|
-
* Claude Code gets from memini's MCP server: memory_recall, memory_list,
|
|
14
|
-
* memory_remember, memory_forget.
|
|
15
|
-
*
|
|
16
|
-
* Talks to memini over REST (/v1/search, /v1/memories), scoped by the
|
|
17
|
-
* X-Memini-Namespace header. Config comes from MEMINI_* env vars; secrets like
|
|
18
|
-
* MEMINI_API_KEY stay in the environment. See ../README.md for the table.
|
|
19
|
-
*/
|
|
20
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
21
|
-
/**
|
|
22
|
-
* intEnv parses a non-negative integer env var and returns `def` when unset or
|
|
23
|
-
* malformed — env values are user input and shouldn't crash a hook.
|
|
24
|
-
*/
|
|
25
|
-
export declare function intEnv(name: string, def: number): number;
|
|
26
|
-
/** floatEnv parses a non-negative float env var; falls back to `def`. */
|
|
27
|
-
export declare function floatEnv(name: string, def: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* labelsEnv parses MEMINI_INJECT_LABELS into a Set of enabled labels.
|
|
30
|
-
* Recognized: "tier", "confidence", "age". Empty/unset returns an empty Set.
|
|
31
|
-
*/
|
|
32
|
-
export declare function labelsEnv(name?: string): Set<string>;
|
|
33
|
-
export declare function sanitizeNamespace(s: string): string;
|
|
34
|
-
export declare function sanitizeNamespacePath(s: string): string;
|
|
35
|
-
export declare function deriveNamespace(cwd: string | undefined): string;
|
|
36
|
-
export interface ResolvedConfig {
|
|
37
|
-
base_url: string;
|
|
38
|
-
namespace: string;
|
|
39
|
-
recall: boolean;
|
|
40
|
-
capture: boolean;
|
|
41
|
-
recall_limit: number;
|
|
42
|
-
recall_max_tokens: number;
|
|
43
|
-
recall_min_score: number;
|
|
44
|
-
timeout_ms: number;
|
|
45
|
-
fallback_on_error: boolean;
|
|
46
|
-
}
|
|
47
|
-
export declare function resolveConfig(env: NodeJS.ProcessEnv, cwd?: string): ResolvedConfig;
|
|
48
|
-
/** approxTokens: ~0.75 tokens/word, floor of 1 for any non-empty line. */
|
|
49
|
-
export declare function approxTokens(text: string): number;
|
|
50
|
-
/**
|
|
51
|
-
* fitByTokens trims a list of pre-formatted strings under `maxTokens`, keeping
|
|
52
|
-
* the head (most relevant first). maxTokens<=0 means unbounded.
|
|
53
|
-
*/
|
|
54
|
-
export declare function fitByTokens(items: string[], maxTokens: number): {
|
|
55
|
-
items: string[];
|
|
56
|
-
tokens: number;
|
|
57
|
-
dropped: number;
|
|
58
|
-
};
|
|
59
|
-
/** truncate to `max` chars with a marker. */
|
|
60
|
-
export declare function truncate(value: string, max: number): string;
|
|
61
|
-
export declare function formatResults(results: any[], limit: number, labels?: Set<string>): string[];
|
|
62
|
-
export declare function createPlaintextBearerAuthGuard(warn: (m: string) => void, env?: NodeJS.ProcessEnv): (baseUrl: string, secret?: string) => void;
|
|
63
|
-
export declare function meminiListPath(args: any): string;
|
|
64
|
-
export declare function extractMessageText(message: any): string;
|
|
65
|
-
export declare function extractLastAssistantText(messages: any[]): string;
|
|
66
|
-
export declare function buildTurnContent(userText: string, assistantText: string): string;
|
|
67
|
-
export default function meminiExtension(pi: ExtensionAPI): void;
|