aieo 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/dist/index.d.mts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +131 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +29 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CoreMessage } from 'ai';
|
|
2
|
+
|
|
3
|
+
interface Conversation {
|
|
4
|
+
id: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
interface ConversationData {
|
|
9
|
+
id: string;
|
|
10
|
+
summary: string;
|
|
11
|
+
messages: CoreMessage[];
|
|
12
|
+
lastUpdated: number;
|
|
13
|
+
}
|
|
14
|
+
declare const MAX_CONVERSATIONS = 100;
|
|
15
|
+
declare abstract class ConversationStorage {
|
|
16
|
+
abstract currentConversationId(): Promise<string>;
|
|
17
|
+
abstract selectConversation(conversationId: string): Promise<void>;
|
|
18
|
+
abstract listConversations(): Promise<Conversation[]>;
|
|
19
|
+
abstract getConversation(conversationId: string): Promise<ConversationData | null>;
|
|
20
|
+
abstract storeConversationData(conversationId: string, data: ConversationData): Promise<void>;
|
|
21
|
+
abstract deleteConversationData(conversationId: string): Promise<boolean>;
|
|
22
|
+
createConversation(messages: CoreMessage[]): Promise<ConversationData>;
|
|
23
|
+
addMessageToConversation(conversationId: string, message: CoreMessage): Promise<ConversationData>;
|
|
24
|
+
getCurrentConversation(): Promise<ConversationData | null>;
|
|
25
|
+
getLatestConversation(): Promise<ConversationData | null>;
|
|
26
|
+
updateConversationSummary(conversationId: string, summary: string): Promise<ConversationData>;
|
|
27
|
+
private pruneOldConversations;
|
|
28
|
+
protected generateSummary(content: string): string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CoreMessage } from 'ai';
|
|
2
|
+
|
|
3
|
+
interface Conversation {
|
|
4
|
+
id: string;
|
|
5
|
+
summary: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}
|
|
8
|
+
interface ConversationData {
|
|
9
|
+
id: string;
|
|
10
|
+
summary: string;
|
|
11
|
+
messages: CoreMessage[];
|
|
12
|
+
lastUpdated: number;
|
|
13
|
+
}
|
|
14
|
+
declare const MAX_CONVERSATIONS = 100;
|
|
15
|
+
declare abstract class ConversationStorage {
|
|
16
|
+
abstract currentConversationId(): Promise<string>;
|
|
17
|
+
abstract selectConversation(conversationId: string): Promise<void>;
|
|
18
|
+
abstract listConversations(): Promise<Conversation[]>;
|
|
19
|
+
abstract getConversation(conversationId: string): Promise<ConversationData | null>;
|
|
20
|
+
abstract storeConversationData(conversationId: string, data: ConversationData): Promise<void>;
|
|
21
|
+
abstract deleteConversationData(conversationId: string): Promise<boolean>;
|
|
22
|
+
createConversation(messages: CoreMessage[]): Promise<ConversationData>;
|
|
23
|
+
addMessageToConversation(conversationId: string, message: CoreMessage): Promise<ConversationData>;
|
|
24
|
+
getCurrentConversation(): Promise<ConversationData | null>;
|
|
25
|
+
getLatestConversation(): Promise<ConversationData | null>;
|
|
26
|
+
updateConversationSummary(conversationId: string, summary: string): Promise<ConversationData>;
|
|
27
|
+
private pruneOldConversations;
|
|
28
|
+
protected generateSummary(content: string): string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ConversationStorage: () => ConversationStorage,
|
|
24
|
+
MAX_CONVERSATIONS: () => MAX_CONVERSATIONS
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// ../node_modules/uuid/dist/esm/stringify.js
|
|
29
|
+
var byteToHex = [];
|
|
30
|
+
for (let i = 0; i < 256; ++i) {
|
|
31
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
32
|
+
}
|
|
33
|
+
function unsafeStringify(arr, offset = 0) {
|
|
34
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ../node_modules/uuid/dist/esm/rng.js
|
|
38
|
+
var import_crypto = require("crypto");
|
|
39
|
+
var rnds8Pool = new Uint8Array(256);
|
|
40
|
+
var poolPtr = rnds8Pool.length;
|
|
41
|
+
function rng() {
|
|
42
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
43
|
+
(0, import_crypto.randomFillSync)(rnds8Pool);
|
|
44
|
+
poolPtr = 0;
|
|
45
|
+
}
|
|
46
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ../node_modules/uuid/dist/esm/native.js
|
|
50
|
+
var import_crypto2 = require("crypto");
|
|
51
|
+
var native_default = { randomUUID: import_crypto2.randomUUID };
|
|
52
|
+
|
|
53
|
+
// ../node_modules/uuid/dist/esm/v4.js
|
|
54
|
+
function v4(options, buf, offset) {
|
|
55
|
+
if (native_default.randomUUID && !buf && !options) {
|
|
56
|
+
return native_default.randomUUID();
|
|
57
|
+
}
|
|
58
|
+
options = options || {};
|
|
59
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
60
|
+
if (rnds.length < 16) {
|
|
61
|
+
throw new Error("Random bytes length must be >= 16");
|
|
62
|
+
}
|
|
63
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
64
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
65
|
+
if (buf) {
|
|
66
|
+
offset = offset || 0;
|
|
67
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
68
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
69
|
+
}
|
|
70
|
+
for (let i = 0; i < 16; ++i) {
|
|
71
|
+
buf[offset + i] = rnds[i];
|
|
72
|
+
}
|
|
73
|
+
return buf;
|
|
74
|
+
}
|
|
75
|
+
return unsafeStringify(rnds);
|
|
76
|
+
}
|
|
77
|
+
var v4_default = v4;
|
|
78
|
+
|
|
79
|
+
// src/store.ts
|
|
80
|
+
var MAX_CONVERSATIONS = 100;
|
|
81
|
+
var ConversationStorage = class {
|
|
82
|
+
// Shared functionality that works across platforms
|
|
83
|
+
async createConversation(messages) {
|
|
84
|
+
const id = v4_default();
|
|
85
|
+
const initialMessage = messages.find((msg) => msg.role === "user");
|
|
86
|
+
const summary = initialMessage ? this.generateSummary(initialMessage.content) : `New conversation ${(/* @__PURE__ */ new Date()).toLocaleString()}`;
|
|
87
|
+
const conversation = {
|
|
88
|
+
id,
|
|
89
|
+
summary,
|
|
90
|
+
messages,
|
|
91
|
+
lastUpdated: Date.now()
|
|
92
|
+
};
|
|
93
|
+
await this.storeConversationData(id, conversation);
|
|
94
|
+
await this.selectConversation(id);
|
|
95
|
+
await this.pruneOldConversations();
|
|
96
|
+
return conversation;
|
|
97
|
+
}
|
|
98
|
+
async addMessageToConversation(conversationId, message) {
|
|
99
|
+
const conversation = await this.getConversation(conversationId);
|
|
100
|
+
if (!conversation) {
|
|
101
|
+
throw new Error(`Conversation with ID ${conversationId} not found`);
|
|
102
|
+
}
|
|
103
|
+
conversation.messages.push({ ...message });
|
|
104
|
+
conversation.lastUpdated = Date.now();
|
|
105
|
+
await this.storeConversationData(conversationId, conversation);
|
|
106
|
+
return conversation;
|
|
107
|
+
}
|
|
108
|
+
async getCurrentConversation() {
|
|
109
|
+
const currentId = await this.currentConversationId();
|
|
110
|
+
if (!currentId) return null;
|
|
111
|
+
return await this.getConversation(currentId);
|
|
112
|
+
}
|
|
113
|
+
async getLatestConversation() {
|
|
114
|
+
const convos = await this.listConversations();
|
|
115
|
+
if (!convos.length) return null;
|
|
116
|
+
const sortedConvos = [...convos].sort((a, b) => b.timestamp - a.timestamp);
|
|
117
|
+
return await this.getConversation(sortedConvos[0].id);
|
|
118
|
+
}
|
|
119
|
+
async updateConversationSummary(conversationId, summary) {
|
|
120
|
+
const conversation = await this.getConversation(conversationId);
|
|
121
|
+
if (!conversation) {
|
|
122
|
+
throw new Error(`Conversation with ID ${conversationId} not found`);
|
|
123
|
+
}
|
|
124
|
+
conversation.summary = summary;
|
|
125
|
+
conversation.lastUpdated = Date.now();
|
|
126
|
+
await this.storeConversationData(conversationId, conversation);
|
|
127
|
+
return conversation;
|
|
128
|
+
}
|
|
129
|
+
async pruneOldConversations() {
|
|
130
|
+
const conversations = await this.listConversations();
|
|
131
|
+
if (conversations.length <= MAX_CONVERSATIONS) return;
|
|
132
|
+
const sortedConversations = [...conversations].sort(
|
|
133
|
+
(a, b) => a.timestamp - b.timestamp
|
|
134
|
+
);
|
|
135
|
+
const deleteCount = sortedConversations.length - MAX_CONVERSATIONS;
|
|
136
|
+
const conversationsToDelete = sortedConversations.slice(0, deleteCount);
|
|
137
|
+
for (const convo of conversationsToDelete) {
|
|
138
|
+
await this.deleteConversationData(convo.id);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
generateSummary(content) {
|
|
142
|
+
let summary = content.split("\n")[0].trim();
|
|
143
|
+
if (summary.length > 50) {
|
|
144
|
+
summary = summary.substring(0, 47) + "...";
|
|
145
|
+
} else if (summary.length === 0 && content.length > 0) {
|
|
146
|
+
summary = content.substring(0, Math.min(50, content.length));
|
|
147
|
+
if (summary.length === 50) summary = summary + "...";
|
|
148
|
+
} else if (summary.length === 0) {
|
|
149
|
+
summary = `Conversation created on ${(/* @__PURE__ */ new Date()).toLocaleString()}`;
|
|
150
|
+
}
|
|
151
|
+
return summary;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
ConversationStorage,
|
|
157
|
+
MAX_CONVERSATIONS
|
|
158
|
+
});
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../../node_modules/uuid/dist/esm/stringify.js","../../node_modules/uuid/dist/esm/rng.js","../../node_modules/uuid/dist/esm/native.js","../../node_modules/uuid/dist/esm/v4.js","../src/store.ts"],"sourcesContent":["export * from \"./store\";\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","import { randomFillSync } from 'crypto';\nconst rnds8Pool = new Uint8Array(256);\nlet poolPtr = rnds8Pool.length;\nexport default function rng() {\n if (poolPtr > rnds8Pool.length - 16) {\n randomFillSync(rnds8Pool);\n poolPtr = 0;\n }\n return rnds8Pool.slice(poolPtr, (poolPtr += 16));\n}\n","import { randomUUID } from 'crypto';\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { CoreMessage } from \"ai\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport interface Conversation {\n id: string;\n summary: string;\n timestamp: number;\n}\n\nexport interface ConversationData {\n id: string;\n summary: string;\n messages: CoreMessage[];\n lastUpdated: number;\n}\n\nexport const MAX_CONVERSATIONS = 100;\n\nexport abstract class ConversationStorage {\n // Abstract methods to be implemented by platform-specific storage\n abstract currentConversationId(): Promise<string>;\n abstract selectConversation(conversationId: string): Promise<void>;\n abstract listConversations(): Promise<Conversation[]>;\n abstract getConversation(\n conversationId: string\n ): Promise<ConversationData | null>;\n abstract storeConversationData(\n conversationId: string,\n data: ConversationData\n ): Promise<void>;\n abstract deleteConversationData(conversationId: string): Promise<boolean>;\n\n // Shared functionality that works across platforms\n async createConversation(messages: CoreMessage[]): Promise<ConversationData> {\n const id = uuidv4();\n const initialMessage = messages.find((msg) => msg.role === \"user\");\n const summary = initialMessage\n ? this.generateSummary(initialMessage.content as string)\n : `New conversation ${new Date().toLocaleString()}`;\n const conversation: ConversationData = {\n id,\n summary,\n messages,\n lastUpdated: Date.now(),\n };\n await this.storeConversationData(id, conversation);\n await this.selectConversation(id);\n await this.pruneOldConversations();\n return conversation;\n }\n\n async addMessageToConversation(\n conversationId: string,\n message: CoreMessage\n ): Promise<ConversationData> {\n const conversation = await this.getConversation(conversationId);\n if (!conversation) {\n throw new Error(`Conversation with ID ${conversationId} not found`);\n }\n conversation.messages.push({ ...message });\n conversation.lastUpdated = Date.now();\n await this.storeConversationData(conversationId, conversation);\n return conversation;\n }\n\n async getCurrentConversation(): Promise<ConversationData | null> {\n const currentId = await this.currentConversationId();\n if (!currentId) return null;\n return await this.getConversation(currentId);\n }\n\n async getLatestConversation(): Promise<ConversationData | null> {\n const convos = await this.listConversations();\n if (!convos.length) return null;\n // Sort by most recent first\n const sortedConvos = [...convos].sort((a, b) => b.timestamp - a.timestamp);\n return await this.getConversation(sortedConvos[0].id);\n }\n\n async updateConversationSummary(\n conversationId: string,\n summary: string\n ): Promise<ConversationData> {\n const conversation = await this.getConversation(conversationId);\n if (!conversation) {\n throw new Error(`Conversation with ID ${conversationId} not found`);\n }\n conversation.summary = summary;\n conversation.lastUpdated = Date.now();\n await this.storeConversationData(conversationId, conversation);\n return conversation;\n }\n\n private async pruneOldConversations(): Promise<void> {\n const conversations = await this.listConversations();\n if (conversations.length <= MAX_CONVERSATIONS) return;\n // Sort by timestamp (oldest first)\n const sortedConversations = [...conversations].sort(\n (a, b) => a.timestamp - b.timestamp\n );\n // Calculate how many need to be deleted\n const deleteCount = sortedConversations.length - MAX_CONVERSATIONS;\n // Get the conversations to delete (the oldest ones)\n const conversationsToDelete = sortedConversations.slice(0, deleteCount);\n // Delete each conversation\n for (const convo of conversationsToDelete) {\n await this.deleteConversationData(convo.id);\n }\n }\n\n protected generateSummary(content: string): string {\n let summary = content.split(\"\\n\")[0].trim();\n if (summary.length > 50) {\n summary = summary.substring(0, 47) + \"...\";\n } else if (summary.length === 0 && content.length > 0) {\n summary = content.substring(0, Math.min(50, content.length));\n if (summary.length === 50) summary = summary + \"...\";\n } else if (summary.length === 0) {\n summary = `Conversation created on ${new Date().toLocaleString()}`;\n }\n return summary;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAM,YAAY,CAAC;AACnB,SAAS,IAAI,GAAG,IAAI,KAAK,EAAE,GAAG;AAC1B,YAAU,MAAM,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AACpD;AACO,SAAS,gBAAgB,KAAK,SAAS,GAAG;AAC7C,UAAQ,UAAU,IAAI,SAAS,CAAC,CAAC,IAC7B,UAAU,IAAI,SAAS,CAAC,CAAC,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,QAAQ,MAAM,CAAC;AAC3D,UAAI,QAAQ,WAAW,GAAI,WAAU,UAAU;AAAA,IACjD,WAAW,QAAQ,WAAW,GAAG;AAC/B,gBAAU,4BAA2B,oBAAI,KAAK,GAAE,eAAe,CAAC;AAAA,IAClE;AACA,WAAO;AAAA,EACT;AACF;","names":["import_crypto"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// ../node_modules/uuid/dist/esm/stringify.js
|
|
2
|
+
var byteToHex = [];
|
|
3
|
+
for (let i = 0; i < 256; ++i) {
|
|
4
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
5
|
+
}
|
|
6
|
+
function unsafeStringify(arr, offset = 0) {
|
|
7
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// ../node_modules/uuid/dist/esm/rng.js
|
|
11
|
+
import { randomFillSync } from "crypto";
|
|
12
|
+
var rnds8Pool = new Uint8Array(256);
|
|
13
|
+
var poolPtr = rnds8Pool.length;
|
|
14
|
+
function rng() {
|
|
15
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
16
|
+
randomFillSync(rnds8Pool);
|
|
17
|
+
poolPtr = 0;
|
|
18
|
+
}
|
|
19
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ../node_modules/uuid/dist/esm/native.js
|
|
23
|
+
import { randomUUID } from "crypto";
|
|
24
|
+
var native_default = { randomUUID };
|
|
25
|
+
|
|
26
|
+
// ../node_modules/uuid/dist/esm/v4.js
|
|
27
|
+
function v4(options, buf, offset) {
|
|
28
|
+
if (native_default.randomUUID && !buf && !options) {
|
|
29
|
+
return native_default.randomUUID();
|
|
30
|
+
}
|
|
31
|
+
options = options || {};
|
|
32
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
33
|
+
if (rnds.length < 16) {
|
|
34
|
+
throw new Error("Random bytes length must be >= 16");
|
|
35
|
+
}
|
|
36
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
37
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
38
|
+
if (buf) {
|
|
39
|
+
offset = offset || 0;
|
|
40
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
41
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
42
|
+
}
|
|
43
|
+
for (let i = 0; i < 16; ++i) {
|
|
44
|
+
buf[offset + i] = rnds[i];
|
|
45
|
+
}
|
|
46
|
+
return buf;
|
|
47
|
+
}
|
|
48
|
+
return unsafeStringify(rnds);
|
|
49
|
+
}
|
|
50
|
+
var v4_default = v4;
|
|
51
|
+
|
|
52
|
+
// src/store.ts
|
|
53
|
+
var MAX_CONVERSATIONS = 100;
|
|
54
|
+
var ConversationStorage = class {
|
|
55
|
+
// Shared functionality that works across platforms
|
|
56
|
+
async createConversation(messages) {
|
|
57
|
+
const id = v4_default();
|
|
58
|
+
const initialMessage = messages.find((msg) => msg.role === "user");
|
|
59
|
+
const summary = initialMessage ? this.generateSummary(initialMessage.content) : `New conversation ${(/* @__PURE__ */ new Date()).toLocaleString()}`;
|
|
60
|
+
const conversation = {
|
|
61
|
+
id,
|
|
62
|
+
summary,
|
|
63
|
+
messages,
|
|
64
|
+
lastUpdated: Date.now()
|
|
65
|
+
};
|
|
66
|
+
await this.storeConversationData(id, conversation);
|
|
67
|
+
await this.selectConversation(id);
|
|
68
|
+
await this.pruneOldConversations();
|
|
69
|
+
return conversation;
|
|
70
|
+
}
|
|
71
|
+
async addMessageToConversation(conversationId, message) {
|
|
72
|
+
const conversation = await this.getConversation(conversationId);
|
|
73
|
+
if (!conversation) {
|
|
74
|
+
throw new Error(`Conversation with ID ${conversationId} not found`);
|
|
75
|
+
}
|
|
76
|
+
conversation.messages.push({ ...message });
|
|
77
|
+
conversation.lastUpdated = Date.now();
|
|
78
|
+
await this.storeConversationData(conversationId, conversation);
|
|
79
|
+
return conversation;
|
|
80
|
+
}
|
|
81
|
+
async getCurrentConversation() {
|
|
82
|
+
const currentId = await this.currentConversationId();
|
|
83
|
+
if (!currentId) return null;
|
|
84
|
+
return await this.getConversation(currentId);
|
|
85
|
+
}
|
|
86
|
+
async getLatestConversation() {
|
|
87
|
+
const convos = await this.listConversations();
|
|
88
|
+
if (!convos.length) return null;
|
|
89
|
+
const sortedConvos = [...convos].sort((a, b) => b.timestamp - a.timestamp);
|
|
90
|
+
return await this.getConversation(sortedConvos[0].id);
|
|
91
|
+
}
|
|
92
|
+
async updateConversationSummary(conversationId, summary) {
|
|
93
|
+
const conversation = await this.getConversation(conversationId);
|
|
94
|
+
if (!conversation) {
|
|
95
|
+
throw new Error(`Conversation with ID ${conversationId} not found`);
|
|
96
|
+
}
|
|
97
|
+
conversation.summary = summary;
|
|
98
|
+
conversation.lastUpdated = Date.now();
|
|
99
|
+
await this.storeConversationData(conversationId, conversation);
|
|
100
|
+
return conversation;
|
|
101
|
+
}
|
|
102
|
+
async pruneOldConversations() {
|
|
103
|
+
const conversations = await this.listConversations();
|
|
104
|
+
if (conversations.length <= MAX_CONVERSATIONS) return;
|
|
105
|
+
const sortedConversations = [...conversations].sort(
|
|
106
|
+
(a, b) => a.timestamp - b.timestamp
|
|
107
|
+
);
|
|
108
|
+
const deleteCount = sortedConversations.length - MAX_CONVERSATIONS;
|
|
109
|
+
const conversationsToDelete = sortedConversations.slice(0, deleteCount);
|
|
110
|
+
for (const convo of conversationsToDelete) {
|
|
111
|
+
await this.deleteConversationData(convo.id);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
generateSummary(content) {
|
|
115
|
+
let summary = content.split("\n")[0].trim();
|
|
116
|
+
if (summary.length > 50) {
|
|
117
|
+
summary = summary.substring(0, 47) + "...";
|
|
118
|
+
} else if (summary.length === 0 && content.length > 0) {
|
|
119
|
+
summary = content.substring(0, Math.min(50, content.length));
|
|
120
|
+
if (summary.length === 50) summary = summary + "...";
|
|
121
|
+
} else if (summary.length === 0) {
|
|
122
|
+
summary = `Conversation created on ${(/* @__PURE__ */ new Date()).toLocaleString()}`;
|
|
123
|
+
}
|
|
124
|
+
return summary;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
ConversationStorage,
|
|
129
|
+
MAX_CONVERSATIONS
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../node_modules/uuid/dist/esm/stringify.js","../../node_modules/uuid/dist/esm/rng.js","../../node_modules/uuid/dist/esm/native.js","../../node_modules/uuid/dist/esm/v4.js","../src/store.ts"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","import { randomFillSync } from 'crypto';\nconst rnds8Pool = new Uint8Array(256);\nlet poolPtr = rnds8Pool.length;\nexport default function rng() {\n if (poolPtr > rnds8Pool.length - 16) {\n randomFillSync(rnds8Pool);\n poolPtr = 0;\n }\n return rnds8Pool.slice(poolPtr, (poolPtr += 16));\n}\n","import { randomUUID } from 'crypto';\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { CoreMessage } from \"ai\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport interface Conversation {\n id: string;\n summary: string;\n timestamp: number;\n}\n\nexport interface ConversationData {\n id: string;\n summary: string;\n messages: CoreMessage[];\n lastUpdated: number;\n}\n\nexport const MAX_CONVERSATIONS = 100;\n\nexport abstract class ConversationStorage {\n // Abstract methods to be implemented by platform-specific storage\n abstract currentConversationId(): Promise<string>;\n abstract selectConversation(conversationId: string): Promise<void>;\n abstract listConversations(): Promise<Conversation[]>;\n abstract getConversation(\n conversationId: string\n ): Promise<ConversationData | null>;\n abstract storeConversationData(\n conversationId: string,\n data: ConversationData\n ): Promise<void>;\n abstract deleteConversationData(conversationId: string): Promise<boolean>;\n\n // Shared functionality that works across platforms\n async createConversation(messages: CoreMessage[]): Promise<ConversationData> {\n const id = uuidv4();\n const initialMessage = messages.find((msg) => msg.role === \"user\");\n const summary = initialMessage\n ? this.generateSummary(initialMessage.content as string)\n : `New conversation ${new Date().toLocaleString()}`;\n const conversation: ConversationData = {\n id,\n summary,\n messages,\n lastUpdated: Date.now(),\n };\n await this.storeConversationData(id, conversation);\n await this.selectConversation(id);\n await this.pruneOldConversations();\n return conversation;\n }\n\n async addMessageToConversation(\n conversationId: string,\n message: CoreMessage\n ): Promise<ConversationData> {\n const conversation = await this.getConversation(conversationId);\n if (!conversation) {\n throw new Error(`Conversation with ID ${conversationId} not found`);\n }\n conversation.messages.push({ ...message });\n conversation.lastUpdated = Date.now();\n await this.storeConversationData(conversationId, conversation);\n return conversation;\n }\n\n async getCurrentConversation(): Promise<ConversationData | null> {\n const currentId = await this.currentConversationId();\n if (!currentId) return null;\n return await this.getConversation(currentId);\n }\n\n async getLatestConversation(): Promise<ConversationData | null> {\n const convos = await this.listConversations();\n if (!convos.length) return null;\n // Sort by most recent first\n const sortedConvos = [...convos].sort((a, b) => b.timestamp - a.timestamp);\n return await this.getConversation(sortedConvos[0].id);\n }\n\n async updateConversationSummary(\n conversationId: string,\n summary: string\n ): Promise<ConversationData> {\n const conversation = await this.getConversation(conversationId);\n if (!conversation) {\n throw new Error(`Conversation with ID ${conversationId} not found`);\n }\n conversation.summary = summary;\n conversation.lastUpdated = Date.now();\n await this.storeConversationData(conversationId, conversation);\n return conversation;\n }\n\n private async pruneOldConversations(): Promise<void> {\n const conversations = await this.listConversations();\n if (conversations.length <= MAX_CONVERSATIONS) return;\n // Sort by timestamp (oldest first)\n const sortedConversations = [...conversations].sort(\n (a, b) => a.timestamp - b.timestamp\n );\n // Calculate how many need to be deleted\n const deleteCount = sortedConversations.length - MAX_CONVERSATIONS;\n // Get the conversations to delete (the oldest ones)\n const conversationsToDelete = sortedConversations.slice(0, deleteCount);\n // Delete each conversation\n for (const convo of conversationsToDelete) {\n await this.deleteConversationData(convo.id);\n }\n }\n\n protected generateSummary(content: string): string {\n let summary = content.split(\"\\n\")[0].trim();\n if (summary.length > 50) {\n summary = summary.substring(0, 47) + \"...\";\n } else if (summary.length === 0 && content.length > 0) {\n summary = content.substring(0, Math.min(50, content.length));\n if (summary.length === 50) summary = summary + \"...\";\n } else if (summary.length === 0) {\n summary = `Conversation created on ${new Date().toLocaleString()}`;\n }\n return summary;\n }\n}\n"],"mappings":";AACA,IAAM,YAAY,CAAC;AACnB,SAAS,IAAI,GAAG,IAAI,KAAK,EAAE,GAAG;AAC1B,YAAU,MAAM,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AACpD;AACO,SAAS,gBAAgB,KAAK,SAAS,GAAG;AAC7C,UAAQ,UAAU,IAAI,SAAS,CAAC,CAAC,IAC7B,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,MACA,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,MACA,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,MACA,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,UAAU,IAAI,SAAS,CAAC,CAAC,IACzB,MACA,UAAU,IAAI,SAAS,EAAE,CAAC,IAC1B,UAAU,IAAI,SAAS,EAAE,CAAC,IAC1B,UAAU,IAAI,SAAS,EAAE,CAAC,IAC1B,UAAU,IAAI,SAAS,EAAE,CAAC,IAC1B,UAAU,IAAI,SAAS,EAAE,CAAC,IAC1B,UAAU,IAAI,SAAS,EAAE,CAAC,GAAG,YAAY;AACjD;;;AC1BA,SAAS,sBAAsB;AAC/B,IAAM,YAAY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EAEA,MAAc,wBAAuC;AACnD,UAAM,gBAAgB,MAAM,KAAK,kBAAkB;AACnD,QAAI,cAAc,UAAU,kBAAmB;AAE/C,UAAM,sBAAsB,CAAC,GAAG,aAAa,EAAE;AAAA,MAC7C,CAAC,GAAG,MAAM,EAAE,YAAY,EAAE;AAAA,IAC5B;AAEA,UAAM,cAAc,oBAAoB,SAAS;AAEjD,UAAM,wBAAwB,oBAAoB,MAAM,GAAG,WAAW;AAEtE,eAAW,SAAS,uBAAuB;AACzC,YAAM,KAAK,uBAAuB,MAAM,EAAE;AAAA,IAC5C;AAAA,EACF;AAAA,EAEU,gBAAgB,SAAyB;AACjD,QAAI,UAAU,QAAQ,MAAM,IAAI,EAAE,CAAC,EAAE,KAAK;AAC1C,QAAI,QAAQ,SAAS,IAAI;AACvB,gBAAU,QAAQ,UAAU,GAAG,EAAE,IAAI;AAAA,IACvC,WAAW,QAAQ,WAAW,KAAK,QAAQ,SAAS,GAAG;AACrD,gBAAU,QAAQ,UAAU,GAAG,KAAK,IAAI,IAAI,QAAQ,MAAM,CAAC;AAC3D,UAAI,QAAQ,WAAW,GAAI,WAAU,UAAU;AAAA,IACjD,WAAW,QAAQ,WAAW,GAAG;AAC/B,gBAAU,4BAA2B,oBAAI,KAAK,GAAE,eAAe,CAAC;AAAA,IAClE;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aieo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"module": "./dist/index.mjs",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"author": "evanfeenstra",
|
|
11
|
+
"repository": "https://github.com/stakwork/stakgraph",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup",
|
|
14
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"llm",
|
|
18
|
+
"ai-sdk",
|
|
19
|
+
"prompt"
|
|
20
|
+
],
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"description": "typescript ai utils",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"ai": "^4.3.9"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsup": "^8.4.0"
|
|
28
|
+
}
|
|
29
|
+
}
|