@frockbot/plugin-memory 0.0.0 → 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.
package/src/types.ts ADDED
@@ -0,0 +1,54 @@
1
+ // The optional bindings the derived index consumes, and nothing else.
2
+ //
3
+ // Memory itself needs none of these: facts are Markdown files, read and
4
+ // written through `WorkspaceFilesV1`. Embeddings are derived state over those
5
+ // files, so their bindings are optional throughout — a Bot with no Workers AI
6
+ // binding indexes and searches its Memory lexically.
7
+ import type { MemoryScopeNameV1 } from "@frockbot/kernel-contracts";
8
+
9
+ export const EMBEDDING_MODEL = "@cf/baai/bge-base-en-v1.5";
10
+ export const EMBEDDING_DIMENSIONS = 768;
11
+
12
+ export interface MemoryVector {
13
+ id: string;
14
+ values: number[];
15
+ namespace: string;
16
+ metadata: Record<string, string | number>;
17
+ }
18
+
19
+ export interface MemoryVectorMatch {
20
+ id: string;
21
+ score?: number;
22
+ metadata?: Record<string, unknown>;
23
+ }
24
+
25
+ export interface MemoryVectorIndex {
26
+ upsert(vectors: MemoryVector[]): Promise<unknown>;
27
+ query(
28
+ vector: number[],
29
+ options: {
30
+ topK: number;
31
+ namespace: string;
32
+ returnMetadata: "all";
33
+ },
34
+ ): Promise<{ matches: MemoryVectorMatch[] }>;
35
+ deleteByIds(ids: string[]): Promise<unknown>;
36
+ }
37
+
38
+ export interface MemoryAiBinding {
39
+ run(model: string, input: { text: string[] }): Promise<{ data: number[][] }>;
40
+ }
41
+
42
+ export type EmbedMemory = (texts: string[]) => Promise<number[][]>;
43
+
44
+ /** One search hit: where the text is, never the authority for what it says. */
45
+ export interface MemorySearchResult {
46
+ scope: MemoryScopeNameV1;
47
+ /** `""` for the two unprojected tiers. */
48
+ projectId: string;
49
+ path: string;
50
+ startLine: number;
51
+ endLine: number;
52
+ snippet: string;
53
+ score?: number;
54
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2023",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "allowImportingTsExtensions": true,
7
+ "resolveJsonModule": true,
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true,
11
+ "lib": ["ES2023", "DOM"],
12
+ "types": ["bun"]
13
+ },
14
+ "include": ["src/**/*.ts"]
15
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # @frockbot/plugin-memory
2
-
3
- Placeholder reserving this name. See https://github.com/timoconnellaus/frockbot.