@axiom-lattice/local-stores 1.0.25 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/local-stores",
3
- "version": "1.0.25",
3
+ "version": "2.0.0",
4
4
  "description": "Local SQLite-based stores for Axiom Lattice framework",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,8 +25,8 @@
25
25
  "@types/sql.js": "^1.4.11",
26
26
  "sql.js": "^1.14.1",
27
27
  "uuid": "^14.0.1",
28
- "@axiom-lattice/core": "2.1.103",
29
- "@axiom-lattice/protocols": "2.1.54"
28
+ "@axiom-lattice/core": "3.0.0",
29
+ "@axiom-lattice/protocols": "3.0.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^20.11.24",
package/src/index.ts CHANGED
@@ -48,3 +48,4 @@ export { LocalSkillStore } from "./stores/LocalSkillStore";
48
48
  export { LocalScheduleStorage } from "./stores/LocalScheduleStorage";
49
49
  export { LocalTaskStore } from "./stores/LocalTaskStore";
50
50
  export { LocalTaskWorkItemStore } from "./stores/LocalTaskWorkItemStore";
51
+ export { InMemoryConversationStore } from "./stores/InMemoryConversationStore";
@@ -0,0 +1,52 @@
1
+ /**
2
+ * InMemoryConversationStore
3
+ *
4
+ * In-memory implementation of IConversationStore. Maps application
5
+ * conversation IDs to A2A task IDs. Not persisted — for production
6
+ * use, swap with a PG-backed implementation.
7
+ */
8
+
9
+ import type {
10
+ IConversationStore,
11
+ ConversationRecord,
12
+ CreateConversationInput,
13
+ } from "@axiom-lattice/protocols";
14
+
15
+ const isoNow = (): string => new Date().toISOString();
16
+
17
+ export class InMemoryConversationStore implements IConversationStore {
18
+ private store = new Map<string, ConversationRecord>();
19
+
20
+ async getConversation(conversationId: string): Promise<ConversationRecord | null> {
21
+ return this.store.get(conversationId) ?? null;
22
+ }
23
+
24
+ async createConversation(input: CreateConversationInput): Promise<ConversationRecord> {
25
+ const now = isoNow();
26
+ const record: ConversationRecord = {
27
+ conversationId: input.conversationId,
28
+ tenantId: input.tenantId,
29
+ taskIds: [],
30
+ contextId: input.contextId,
31
+ metadata: input.metadata,
32
+ createdAt: now,
33
+ updatedAt: now,
34
+ };
35
+ this.store.set(input.conversationId, record);
36
+ return record;
37
+ }
38
+
39
+ async addTaskToConversation(conversationId: string, taskId: string): Promise<ConversationRecord> {
40
+ const record = this.store.get(conversationId);
41
+ if (!record) {
42
+ throw new Error(`Conversation not found: ${conversationId}`);
43
+ }
44
+ record.taskIds.push(taskId);
45
+ record.updatedAt = isoNow();
46
+ return record;
47
+ }
48
+
49
+ async deleteConversation(conversationId: string): Promise<void> {
50
+ this.store.delete(conversationId);
51
+ }
52
+ }