@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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +23 -0
- package/dist/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/stores/InMemoryConversationStore.ts +52 -0
package/dist/index.mjs
CHANGED
|
@@ -3908,8 +3908,46 @@ async function createLocalStoreConfig(options = {}) {
|
|
|
3908
3908
|
checkpoint: SqliteSaver.fromConnString(dbPath)
|
|
3909
3909
|
};
|
|
3910
3910
|
}
|
|
3911
|
+
|
|
3912
|
+
// src/stores/InMemoryConversationStore.ts
|
|
3913
|
+
var isoNow = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
3914
|
+
var InMemoryConversationStore = class {
|
|
3915
|
+
constructor() {
|
|
3916
|
+
this.store = /* @__PURE__ */ new Map();
|
|
3917
|
+
}
|
|
3918
|
+
async getConversation(conversationId) {
|
|
3919
|
+
return this.store.get(conversationId) ?? null;
|
|
3920
|
+
}
|
|
3921
|
+
async createConversation(input) {
|
|
3922
|
+
const now = isoNow();
|
|
3923
|
+
const record = {
|
|
3924
|
+
conversationId: input.conversationId,
|
|
3925
|
+
tenantId: input.tenantId,
|
|
3926
|
+
taskIds: [],
|
|
3927
|
+
contextId: input.contextId,
|
|
3928
|
+
metadata: input.metadata,
|
|
3929
|
+
createdAt: now,
|
|
3930
|
+
updatedAt: now
|
|
3931
|
+
};
|
|
3932
|
+
this.store.set(input.conversationId, record);
|
|
3933
|
+
return record;
|
|
3934
|
+
}
|
|
3935
|
+
async addTaskToConversation(conversationId, taskId) {
|
|
3936
|
+
const record = this.store.get(conversationId);
|
|
3937
|
+
if (!record) {
|
|
3938
|
+
throw new Error(`Conversation not found: ${conversationId}`);
|
|
3939
|
+
}
|
|
3940
|
+
record.taskIds.push(taskId);
|
|
3941
|
+
record.updatedAt = isoNow();
|
|
3942
|
+
return record;
|
|
3943
|
+
}
|
|
3944
|
+
async deleteConversation(conversationId) {
|
|
3945
|
+
this.store.delete(conversationId);
|
|
3946
|
+
}
|
|
3947
|
+
};
|
|
3911
3948
|
export {
|
|
3912
3949
|
DatabaseWrapper,
|
|
3950
|
+
InMemoryConversationStore,
|
|
3913
3951
|
LocalA2AApiKeyStore,
|
|
3914
3952
|
LocalAssistantStore,
|
|
3915
3953
|
LocalChannelBindingStore,
|