@deepstrike/wasm 0.2.20 → 0.2.21
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.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/memory/in-memory-store.d.ts +19 -0
- package/dist/memory/in-memory-store.js +43 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { OpenAIProvider, QwenProvider, DeepSeekProvider, MiniMaxProvider, KimiPr
|
|
|
14
14
|
export { tool, executeTools } from "./tools/index.js";
|
|
15
15
|
export type { RegisteredTool } from "./tools/index.js";
|
|
16
16
|
export { WorkingMemory } from "./memory/index.js";
|
|
17
|
+
export { InMemoryDreamStore } from "./memory/in-memory-store.js";
|
|
17
18
|
export type { DreamStore, DreamResult, SessionStore, SessionData, SessionMessage, MemoryEntry, CurationResult, CurationStats, } from "./memory/index.js";
|
|
18
19
|
export type { KnowledgeSource } from "./knowledge/index.js";
|
|
19
20
|
export { SinglePassHarness, HarnessLoop } from "./harness/index.js";
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { AnthropicProvider } from "./providers/anthropic.js";
|
|
|
8
8
|
export { OpenAIProvider, QwenProvider, DeepSeekProvider, MiniMaxProvider, KimiProvider } from "./providers/openai.js";
|
|
9
9
|
export { tool, executeTools } from "./tools/index.js";
|
|
10
10
|
export { WorkingMemory } from "./memory/index.js";
|
|
11
|
+
export { InMemoryDreamStore } from "./memory/in-memory-store.js";
|
|
11
12
|
export { SinglePassHarness, HarnessLoop } from "./harness/index.js";
|
|
12
13
|
export { ScheduledPrompt } from "./signals/index.js";
|
|
13
14
|
export { PermissionManager, PermissionMode } from "./safety/index.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `InMemoryDreamStore` — a lightweight `DreamStore` implementation backed by per-agent `Map`s.
|
|
3
|
+
* WASM port of node/src/memory/in-memory-store.ts. See that file for the full design.
|
|
4
|
+
*/
|
|
5
|
+
import type { CurationResult, DreamStore, MemoryEntry, SessionData } from "./index.js";
|
|
6
|
+
export declare class InMemoryDreamStore implements DreamStore {
|
|
7
|
+
private readonly initialMemories;
|
|
8
|
+
private sessions;
|
|
9
|
+
private memories;
|
|
10
|
+
readonly savedSessions: SessionData[];
|
|
11
|
+
constructor(initialMemories?: MemoryEntry[]);
|
|
12
|
+
addSession(agentId: string, session: SessionData): void;
|
|
13
|
+
addMemories(agentId: string, entries: MemoryEntry[]): void;
|
|
14
|
+
loadSessions(agentId: string): Promise<SessionData[]>;
|
|
15
|
+
loadMemories(agentId: string): Promise<MemoryEntry[]>;
|
|
16
|
+
commit(agentId: string, result: CurationResult, existing: MemoryEntry[]): Promise<void>;
|
|
17
|
+
search(agentId: string, _query: string, topK?: number): Promise<MemoryEntry[]>;
|
|
18
|
+
saveSession(data: SessionData): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class InMemoryDreamStore {
|
|
2
|
+
initialMemories;
|
|
3
|
+
sessions = new Map();
|
|
4
|
+
memories = new Map();
|
|
5
|
+
savedSessions = [];
|
|
6
|
+
constructor(initialMemories = []) {
|
|
7
|
+
this.initialMemories = initialMemories;
|
|
8
|
+
}
|
|
9
|
+
addSession(agentId, session) {
|
|
10
|
+
const list = this.sessions.get(agentId) ?? [];
|
|
11
|
+
list.push(session);
|
|
12
|
+
this.sessions.set(agentId, list);
|
|
13
|
+
}
|
|
14
|
+
addMemories(agentId, entries) {
|
|
15
|
+
this.memories.set(agentId, [...(this.memories.get(agentId) ?? []), ...entries]);
|
|
16
|
+
}
|
|
17
|
+
async loadSessions(agentId) {
|
|
18
|
+
return this.sessions.get(agentId) ?? [];
|
|
19
|
+
}
|
|
20
|
+
async loadMemories(agentId) {
|
|
21
|
+
if (this.memories.has(agentId))
|
|
22
|
+
return this.memories.get(agentId);
|
|
23
|
+
if (this.initialMemories.length > 0) {
|
|
24
|
+
this.memories.set(agentId, [...this.initialMemories]);
|
|
25
|
+
return this.memories.get(agentId);
|
|
26
|
+
}
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
async commit(agentId, result, existing) {
|
|
30
|
+
const kept = existing.filter((_, i) => !result.toRemoveIndices.includes(i));
|
|
31
|
+
this.memories.set(agentId, [...kept, ...result.toAdd]);
|
|
32
|
+
}
|
|
33
|
+
async search(agentId, _query, topK = 5) {
|
|
34
|
+
const all = await this.loadMemories(agentId);
|
|
35
|
+
return all.slice(0, topK);
|
|
36
|
+
}
|
|
37
|
+
async saveSession(data) {
|
|
38
|
+
this.savedSessions.push(data);
|
|
39
|
+
const list = this.sessions.get(data.agentId) ?? [];
|
|
40
|
+
list.push(data);
|
|
41
|
+
this.sessions.set(data.agentId, list);
|
|
42
|
+
}
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/wasm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "DeepStrike WASM SDK — browser, Cloudflare Workers, Deno Deploy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "node --experimental-vm-modules node_modules/.bin/jest"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@deepstrike/wasm-kernel": "0.2.
|
|
18
|
+
"@deepstrike/wasm-kernel": "0.2.21"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/jest": "^30.0.0",
|