aieo 0.1.9 → 0.1.11

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 CHANGED
@@ -33,9 +33,13 @@ declare abstract class ConversationStorage {
33
33
  type Provider = "anthropic" | "google" | "openai";
34
34
  declare const PROVIDERS: Provider[];
35
35
  declare function getModel(provider: Provider, apiKey: string): Promise<ai.LanguageModelV1>;
36
- declare function getProviderOptions(provider: Provider): {
36
+ type ThinkingSpeed = "thinking" | "fast";
37
+ declare function getProviderOptions(provider: Provider, thinkingSpeed?: ThinkingSpeed): {
37
38
  anthropic: {
38
39
  thinking: {
40
+ type: "disabled";
41
+ budgetTokens?: undefined;
42
+ } | {
39
43
  type: "enabled";
40
44
  budgetTokens: number;
41
45
  };
@@ -56,9 +60,9 @@ declare function getProviderOptions(provider: Provider): {
56
60
  google?: undefined;
57
61
  };
58
62
 
59
- declare function callModel(provider: Provider, apiKey: string, messages: CoreMessage[], tools?: ToolSet, parser?: (fullResponse: string) => void): Promise<string>;
63
+ declare function callModel(provider: Provider, apiKey: string, messages: CoreMessage[], tools?: ToolSet, parser?: (fullResponse: string) => void, thinkingSpeed?: ThinkingSpeed): Promise<string>;
60
64
 
61
65
  declare const SYSTEM = "You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n";
62
66
  declare const OUTRO = "\nPlease write all the necessary code to fully implement the feature end-to-end. Do not make mock data or example placeholders!!!\n";
63
67
 
64
- export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS, OUTRO, PROVIDERS, type Provider, SYSTEM, callModel, getModel, getProviderOptions };
68
+ export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS, OUTRO, PROVIDERS, type Provider, SYSTEM, type ThinkingSpeed, callModel, getModel, getProviderOptions };
package/dist/index.d.ts CHANGED
@@ -33,9 +33,13 @@ declare abstract class ConversationStorage {
33
33
  type Provider = "anthropic" | "google" | "openai";
34
34
  declare const PROVIDERS: Provider[];
35
35
  declare function getModel(provider: Provider, apiKey: string): Promise<ai.LanguageModelV1>;
36
- declare function getProviderOptions(provider: Provider): {
36
+ type ThinkingSpeed = "thinking" | "fast";
37
+ declare function getProviderOptions(provider: Provider, thinkingSpeed?: ThinkingSpeed): {
37
38
  anthropic: {
38
39
  thinking: {
40
+ type: "disabled";
41
+ budgetTokens?: undefined;
42
+ } | {
39
43
  type: "enabled";
40
44
  budgetTokens: number;
41
45
  };
@@ -56,9 +60,9 @@ declare function getProviderOptions(provider: Provider): {
56
60
  google?: undefined;
57
61
  };
58
62
 
59
- declare function callModel(provider: Provider, apiKey: string, messages: CoreMessage[], tools?: ToolSet, parser?: (fullResponse: string) => void): Promise<string>;
63
+ declare function callModel(provider: Provider, apiKey: string, messages: CoreMessage[], tools?: ToolSet, parser?: (fullResponse: string) => void, thinkingSpeed?: ThinkingSpeed): Promise<string>;
60
64
 
61
65
  declare const SYSTEM = "You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n";
62
66
  declare const OUTRO = "\nPlease write all the necessary code to fully implement the feature end-to-end. Do not make mock data or example placeholders!!!\n";
63
67
 
64
- export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS, OUTRO, PROVIDERS, type Provider, SYSTEM, callModel, getModel, getProviderOptions };
68
+ export { type Conversation, type ConversationData, ConversationStorage, MAX_CONVERSATIONS, OUTRO, PROVIDERS, type Provider, SYSTEM, type ThinkingSpeed, callModel, getModel, getProviderOptions };
package/dist/index.js CHANGED
@@ -190,20 +190,21 @@ async function getModel(provider, apiKey) {
190
190
  throw new Error(`Unsupported provider: ${provider}`);
191
191
  }
192
192
  }
193
- function getProviderOptions(provider) {
193
+ function getProviderOptions(provider, thinkingSpeed) {
194
+ const fast = thinkingSpeed === "fast";
195
+ const budget = fast ? 0 : 24e3;
194
196
  switch (provider) {
195
197
  case "anthropic":
198
+ let thinking = fast ? { type: "disabled" } : { type: "enabled", budgetTokens: budget };
196
199
  return {
197
200
  anthropic: {
198
- thinking: { type: "enabled", budgetTokens: 24e3 }
201
+ thinking
199
202
  }
200
203
  };
201
204
  case "google":
202
205
  return {
203
206
  google: {
204
- thinkingConfig: {
205
- thinkingBudget: 16384
206
- }
207
+ thinkingConfig: { thinkingBudget: budget }
207
208
  }
208
209
  };
209
210
  case "openai":
@@ -217,9 +218,9 @@ function getProviderOptions(provider) {
217
218
 
218
219
  // src/stream.ts
219
220
  var import_ai = require("ai");
220
- async function callModel(provider, apiKey, messages, tools, parser) {
221
+ async function callModel(provider, apiKey, messages, tools, parser, thinkingSpeed) {
221
222
  const model = await getModel(provider, apiKey);
222
- const providerOptions = getProviderOptions(provider);
223
+ const providerOptions = getProviderOptions(provider, thinkingSpeed);
223
224
  console.log(`Calling ${provider} with options:`, providerOptions);
224
225
  const result = (0, import_ai.streamText)({
225
226
  model,
package/dist/index.js.map CHANGED
@@ -1 +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","../src/provider.ts","../src/stream.ts","../src/prompt.ts"],"sourcesContent":["export * from \"./store\";\nexport * from \"./provider\";\nexport * from \"./stream\";\nexport * from \"./prompt\";\n\nexport type { CoreMessage } from \"ai\";\nexport type { Tool, ToolSet } from \"ai\";\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","import { createAnthropic, AnthropicProviderOptions } from \"@ai-sdk/anthropic\";\nimport {\n createGoogleGenerativeAI,\n GoogleGenerativeAIProviderOptions,\n} from \"@ai-sdk/google\";\nimport { createOpenAI, OpenAIResponsesProviderOptions } from \"@ai-sdk/openai\";\n\nexport type Provider = \"anthropic\" | \"google\" | \"openai\";\n\nexport const PROVIDERS: Provider[] = [\"anthropic\", \"google\", \"openai\"];\n\nconst SOTA = {\n anthropic: \"claude-3-7-sonnet-20250219\",\n google: \"gemini-2.5-pro-preview-05-06\",\n openai: \"gpt-4.1\",\n};\n\nexport async function getModel(provider: Provider, apiKey: string) {\n switch (provider) {\n case \"anthropic\":\n const anthropic = createAnthropic({\n apiKey,\n });\n return anthropic(SOTA[provider]);\n case \"google\":\n const google = createGoogleGenerativeAI({\n apiKey,\n });\n return google(SOTA[provider]);\n case \"openai\":\n const openai = createOpenAI({\n apiKey,\n compatibility: \"strict\",\n });\n return openai(SOTA[provider]);\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n\nexport function getProviderOptions(provider: Provider) {\n switch (provider) {\n case \"anthropic\":\n return {\n anthropic: {\n thinking: { type: \"enabled\", budgetTokens: 24000 },\n } satisfies AnthropicProviderOptions,\n };\n case \"google\":\n return {\n google: {\n thinkingConfig: {\n thinkingBudget: 16384,\n },\n } satisfies GoogleGenerativeAIProviderOptions,\n };\n case \"openai\":\n return {\n openai: {} satisfies OpenAIResponsesProviderOptions,\n };\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n","import { CoreMessage, streamText, ToolSet } from \"ai\";\nimport { Provider, getModel, getProviderOptions } from \"./provider\";\n\nexport async function callModel(\n provider: Provider,\n apiKey: string,\n messages: CoreMessage[],\n tools?: ToolSet,\n parser?: (fullResponse: string) => void\n): Promise<string> {\n const model = await getModel(provider, apiKey);\n const providerOptions = getProviderOptions(provider);\n console.log(`Calling ${provider} with options:`, providerOptions);\n const result = streamText({\n model,\n tools,\n messages,\n temperature: 0,\n providerOptions: providerOptions as any,\n });\n let fullResponse = \"\";\n for await (const part of result.fullStream) {\n switch (part.type) {\n case \"error\":\n throw part.error;\n case \"text-delta\":\n if (parser) {\n parser(fullResponse);\n }\n fullResponse += part.textDelta;\n break;\n }\n }\n return fullResponse;\n}\n","export const SYSTEM = `You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n`;\n\nexport const OUTRO = `\nPlease write all the necessary code to fully implement the feature end-to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ACF;AAEO,SAAS,mBAAmB,UAAoB;AACrD,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO;AAAA,QACL,WAAW;AAAA,UACT,UAAU,EAAE,MAAM,WAAW,cAAc,KAAM;AAAA,QACnD;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,QAAQ;AAAA,UACN,gBAAgB;AAAA,YACd,gBAAgB;AAAA,UAClB;AAAA,QACF;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,QAAQ,CAAC;AAAA,MACX;AAAA,IACF;AACE,YAAM,IAAI,MAAM,yBAAyB,QAAQ,EAAE;AAAA,EACvD;AACF;;;AC/DA,gBAAiD;AAGjD,eAAsB,UACpB,UACA,QACA,UACA,OACA,QACiB;AACjB,QAAM,QAAQ,MAAM,SAAS,UAAU,MAAM;AAC7C,QAAM,kBAAkB,mBAAmB,QAAQ;AACnD,UAAQ,IAAI,WAAW,QAAQ,kBAAkB,eAAe;AAChE,QAAM,aAAS,sBAAW;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AACD,MAAI,eAAe;AACnB,mBAAiB,QAAQ,OAAO,YAAY;AAC1C,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,cAAM,KAAK;AAAA,MACb,KAAK;AACH,YAAI,QAAQ;AACV,iBAAO,YAAY;AAAA,QACrB;AACA,wBAAgB,KAAK;AACrB;AAAA,IACJ;AAAA,EACF;AACA,SAAO;AACT;;;AClCO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAef,IAAM,QAAQ;AAAA;AAAA;","names":["import_crypto"]}
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","../src/provider.ts","../src/stream.ts","../src/prompt.ts"],"sourcesContent":["export * from \"./store\";\nexport * from \"./provider\";\nexport * from \"./stream\";\nexport * from \"./prompt\";\n\nexport type { CoreMessage } from \"ai\";\nexport type { Tool, ToolSet } from \"ai\";\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","import { createAnthropic, AnthropicProviderOptions } from \"@ai-sdk/anthropic\";\nimport {\n createGoogleGenerativeAI,\n GoogleGenerativeAIProviderOptions,\n} from \"@ai-sdk/google\";\nimport { createOpenAI, OpenAIResponsesProviderOptions } from \"@ai-sdk/openai\";\n\nexport type Provider = \"anthropic\" | \"google\" | \"openai\";\n\nexport const PROVIDERS: Provider[] = [\"anthropic\", \"google\", \"openai\"];\n\nconst SOTA = {\n anthropic: \"claude-3-7-sonnet-20250219\",\n google: \"gemini-2.5-pro-preview-05-06\",\n openai: \"gpt-4.1\",\n};\n\nexport async function getModel(provider: Provider, apiKey: string) {\n switch (provider) {\n case \"anthropic\":\n const anthropic = createAnthropic({\n apiKey,\n });\n return anthropic(SOTA[provider]);\n case \"google\":\n const google = createGoogleGenerativeAI({\n apiKey,\n });\n return google(SOTA[provider]);\n case \"openai\":\n const openai = createOpenAI({\n apiKey,\n compatibility: \"strict\",\n });\n return openai(SOTA[provider]);\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n\nexport type ThinkingSpeed = \"thinking\" | \"fast\";\n\nexport function getProviderOptions(\n provider: Provider,\n thinkingSpeed?: ThinkingSpeed\n) {\n const fast = thinkingSpeed === \"fast\";\n const budget = fast ? 0 : 24000;\n switch (provider) {\n case \"anthropic\":\n let thinking = fast\n ? { type: \"disabled\" as const }\n : { type: \"enabled\" as const, budgetTokens: budget };\n return {\n anthropic: {\n thinking,\n } satisfies AnthropicProviderOptions,\n };\n case \"google\":\n return {\n google: {\n thinkingConfig: { thinkingBudget: budget },\n } satisfies GoogleGenerativeAIProviderOptions,\n };\n case \"openai\":\n return {\n openai: {} satisfies OpenAIResponsesProviderOptions,\n };\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n","import { CoreMessage, streamText, ToolSet } from \"ai\";\nimport {\n Provider,\n getModel,\n getProviderOptions,\n ThinkingSpeed,\n} from \"./provider\";\n\nexport async function callModel(\n provider: Provider,\n apiKey: string,\n messages: CoreMessage[],\n tools?: ToolSet,\n parser?: (fullResponse: string) => void,\n thinkingSpeed?: ThinkingSpeed\n): Promise<string> {\n const model = await getModel(provider, apiKey);\n const providerOptions = getProviderOptions(provider, thinkingSpeed);\n console.log(`Calling ${provider} with options:`, providerOptions);\n const result = streamText({\n model,\n tools,\n messages,\n temperature: 0,\n providerOptions: providerOptions as any,\n });\n let fullResponse = \"\";\n for await (const part of result.fullStream) {\n switch (part.type) {\n case \"error\":\n throw part.error;\n case \"text-delta\":\n if (parser) {\n parser(fullResponse);\n }\n fullResponse += part.textDelta;\n break;\n }\n }\n return fullResponse;\n}\n","export const SYSTEM = `You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n`;\n\nexport const OUTRO = `\nPlease write all the necessary code to fully implement the feature end-to-end. Do not make mock data or example placeholders!!!\n`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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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AO;AAAA,QACL,QAAQ,CAAC;AAAA,MACX;AAAA,IACF;AACE,YAAM,IAAI,MAAM,yBAAyB,QAAQ,EAAE;AAAA,EACvD;AACF;;;ACvEA,gBAAiD;AAQjD,eAAsB,UACpB,UACA,QACA,UACA,OACA,QACA,eACiB;AACjB,QAAM,QAAQ,MAAM,SAAS,UAAU,MAAM;AAC7C,QAAM,kBAAkB,mBAAmB,UAAU,aAAa;AAClE,UAAQ,IAAI,WAAW,QAAQ,kBAAkB,eAAe;AAChE,QAAM,aAAS,sBAAW;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AACD,MAAI,eAAe;AACnB,mBAAiB,QAAQ,OAAO,YAAY;AAC1C,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,cAAM,KAAK;AAAA,MACb,KAAK;AACH,YAAI,QAAQ;AACV,iBAAO,YAAY;AAAA,QACrB;AACA,wBAAgB,KAAK;AACrB;AAAA,IACJ;AAAA,EACF;AACA,SAAO;AACT;;;ACxCO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAef,IAAM,QAAQ;AAAA;AAAA;","names":["import_crypto"]}
package/dist/index.mjs CHANGED
@@ -159,20 +159,21 @@ async function getModel(provider, apiKey) {
159
159
  throw new Error(`Unsupported provider: ${provider}`);
160
160
  }
161
161
  }
162
- function getProviderOptions(provider) {
162
+ function getProviderOptions(provider, thinkingSpeed) {
163
+ const fast = thinkingSpeed === "fast";
164
+ const budget = fast ? 0 : 24e3;
163
165
  switch (provider) {
164
166
  case "anthropic":
167
+ let thinking = fast ? { type: "disabled" } : { type: "enabled", budgetTokens: budget };
165
168
  return {
166
169
  anthropic: {
167
- thinking: { type: "enabled", budgetTokens: 24e3 }
170
+ thinking
168
171
  }
169
172
  };
170
173
  case "google":
171
174
  return {
172
175
  google: {
173
- thinkingConfig: {
174
- thinkingBudget: 16384
175
- }
176
+ thinkingConfig: { thinkingBudget: budget }
176
177
  }
177
178
  };
178
179
  case "openai":
@@ -186,9 +187,9 @@ function getProviderOptions(provider) {
186
187
 
187
188
  // src/stream.ts
188
189
  import { streamText } from "ai";
189
- async function callModel(provider, apiKey, messages, tools, parser) {
190
+ async function callModel(provider, apiKey, messages, tools, parser, thinkingSpeed) {
190
191
  const model = await getModel(provider, apiKey);
191
- const providerOptions = getProviderOptions(provider);
192
+ const providerOptions = getProviderOptions(provider, thinkingSpeed);
192
193
  console.log(`Calling ${provider} with options:`, providerOptions);
193
194
  const result = streamText({
194
195
  model,
@@ -1 +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","../src/provider.ts","../src/stream.ts","../src/prompt.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","import { createAnthropic, AnthropicProviderOptions } from \"@ai-sdk/anthropic\";\nimport {\n createGoogleGenerativeAI,\n GoogleGenerativeAIProviderOptions,\n} from \"@ai-sdk/google\";\nimport { createOpenAI, OpenAIResponsesProviderOptions } from \"@ai-sdk/openai\";\n\nexport type Provider = \"anthropic\" | \"google\" | \"openai\";\n\nexport const PROVIDERS: Provider[] = [\"anthropic\", \"google\", \"openai\"];\n\nconst SOTA = {\n anthropic: \"claude-3-7-sonnet-20250219\",\n google: \"gemini-2.5-pro-preview-05-06\",\n openai: \"gpt-4.1\",\n};\n\nexport async function getModel(provider: Provider, apiKey: string) {\n switch (provider) {\n case \"anthropic\":\n const anthropic = createAnthropic({\n apiKey,\n });\n return anthropic(SOTA[provider]);\n case \"google\":\n const google = createGoogleGenerativeAI({\n apiKey,\n });\n return google(SOTA[provider]);\n case \"openai\":\n const openai = createOpenAI({\n apiKey,\n compatibility: \"strict\",\n });\n return openai(SOTA[provider]);\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n\nexport function getProviderOptions(provider: Provider) {\n switch (provider) {\n case \"anthropic\":\n return {\n anthropic: {\n thinking: { type: \"enabled\", budgetTokens: 24000 },\n } satisfies AnthropicProviderOptions,\n };\n case \"google\":\n return {\n google: {\n thinkingConfig: {\n thinkingBudget: 16384,\n },\n } satisfies GoogleGenerativeAIProviderOptions,\n };\n case \"openai\":\n return {\n openai: {} satisfies OpenAIResponsesProviderOptions,\n };\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n","import { CoreMessage, streamText, ToolSet } from \"ai\";\nimport { Provider, getModel, getProviderOptions } from \"./provider\";\n\nexport async function callModel(\n provider: Provider,\n apiKey: string,\n messages: CoreMessage[],\n tools?: ToolSet,\n parser?: (fullResponse: string) => void\n): Promise<string> {\n const model = await getModel(provider, apiKey);\n const providerOptions = getProviderOptions(provider);\n console.log(`Calling ${provider} with options:`, providerOptions);\n const result = streamText({\n model,\n tools,\n messages,\n temperature: 0,\n providerOptions: providerOptions as any,\n });\n let fullResponse = \"\";\n for await (const part of result.fullStream) {\n switch (part.type) {\n case \"error\":\n throw part.error;\n case \"text-delta\":\n if (parser) {\n parser(fullResponse);\n }\n fullResponse += part.textDelta;\n break;\n }\n }\n return fullResponse;\n}\n","export const SYSTEM = `You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n`;\n\nexport const OUTRO = `\nPlease write all the necessary code to fully implement the feature end-to-end. Do not make mock data or example placeholders!!!\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,SA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;AAAA,QACF;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,QAAQ,CAAC;AAAA,MACX;AAAA,IACF;AACE,YAAM,IAAI,MAAM,yBAAyB,QAAQ,EAAE;AAAA,EACvD;AACF;;;AC/DA,SAAsB,kBAA2B;AAGjD,eAAsB,UACpB,UACA,QACA,UACA,OACA,QACiB;AACjB,QAAM,QAAQ,MAAM,SAAS,UAAU,MAAM;AAC7C,QAAM,kBAAkB,mBAAmB,QAAQ;AACnD,UAAQ,IAAI,WAAW,QAAQ,kBAAkB,eAAe;AAChE,QAAM,SAAS,WAAW;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF,CAAC;AACD,MAAI,eAAe;AACnB,mBAAiB,QAAQ,OAAO,YAAY;AAC1C,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,cAAM,KAAK;AAAA,MACb,KAAK;AACH,YAAI,QAAQ;AACV,iBAAO,YAAY;AAAA,QACrB;AACA,wBAAgB,KAAK;AACrB;AAAA,IACJ;AAAA,EACF;AACA,SAAO;AACT;;;AClCO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAef,IAAM,QAAQ;AAAA;AAAA;","names":[]}
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","../src/provider.ts","../src/stream.ts","../src/prompt.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","import { createAnthropic, AnthropicProviderOptions } from \"@ai-sdk/anthropic\";\nimport {\n createGoogleGenerativeAI,\n GoogleGenerativeAIProviderOptions,\n} from \"@ai-sdk/google\";\nimport { createOpenAI, OpenAIResponsesProviderOptions } from \"@ai-sdk/openai\";\n\nexport type Provider = \"anthropic\" | \"google\" | \"openai\";\n\nexport const PROVIDERS: Provider[] = [\"anthropic\", \"google\", \"openai\"];\n\nconst SOTA = {\n anthropic: \"claude-3-7-sonnet-20250219\",\n google: \"gemini-2.5-pro-preview-05-06\",\n openai: \"gpt-4.1\",\n};\n\nexport async function getModel(provider: Provider, apiKey: string) {\n switch (provider) {\n case \"anthropic\":\n const anthropic = createAnthropic({\n apiKey,\n });\n return anthropic(SOTA[provider]);\n case \"google\":\n const google = createGoogleGenerativeAI({\n apiKey,\n });\n return google(SOTA[provider]);\n case \"openai\":\n const openai = createOpenAI({\n apiKey,\n compatibility: \"strict\",\n });\n return openai(SOTA[provider]);\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n\nexport type ThinkingSpeed = \"thinking\" | \"fast\";\n\nexport function getProviderOptions(\n provider: Provider,\n thinkingSpeed?: ThinkingSpeed\n) {\n const fast = thinkingSpeed === \"fast\";\n const budget = fast ? 0 : 24000;\n switch (provider) {\n case \"anthropic\":\n let thinking = fast\n ? { type: \"disabled\" as const }\n : { type: \"enabled\" as const, budgetTokens: budget };\n return {\n anthropic: {\n thinking,\n } satisfies AnthropicProviderOptions,\n };\n case \"google\":\n return {\n google: {\n thinkingConfig: { thinkingBudget: budget },\n } satisfies GoogleGenerativeAIProviderOptions,\n };\n case \"openai\":\n return {\n openai: {} satisfies OpenAIResponsesProviderOptions,\n };\n default:\n throw new Error(`Unsupported provider: ${provider}`);\n }\n}\n","import { CoreMessage, streamText, ToolSet } from \"ai\";\nimport {\n Provider,\n getModel,\n getProviderOptions,\n ThinkingSpeed,\n} from \"./provider\";\n\nexport async function callModel(\n provider: Provider,\n apiKey: string,\n messages: CoreMessage[],\n tools?: ToolSet,\n parser?: (fullResponse: string) => void,\n thinkingSpeed?: ThinkingSpeed\n): Promise<string> {\n const model = await getModel(provider, apiKey);\n const providerOptions = getProviderOptions(provider, thinkingSpeed);\n console.log(`Calling ${provider} with options:`, providerOptions);\n const result = streamText({\n model,\n tools,\n messages,\n temperature: 0,\n providerOptions: providerOptions as any,\n });\n let fullResponse = \"\";\n for await (const part of result.fullStream) {\n switch (part.type) {\n case \"error\":\n throw part.error;\n case \"text-delta\":\n if (parser) {\n parser(fullResponse);\n }\n fullResponse += part.textDelta;\n break;\n }\n }\n return fullResponse;\n}\n","export const SYSTEM = `You are an expert dev. You are given a codebase and a task. You need to write the code for the task. You can also suggest changes to the codebase if needed.\n\nAvoid assuming that certain functions are available in the codebase. Don't use to_timestamp or to_date in SQL if you don't see examples of them being used. DO NOT make up functions like a logger or other utils. Only use utility functions that you ABSOLUTELY know exist in the code.\n\nTry to write as simple and straightforward code as possible. Make a real implementation, do NOT do a mockup or add sample data. Assume there is already mock data in the database. If you see snippets of backend code, that means you have access to the backend codebase and can add new backend endpoints or other functionality as needed.\n\nYou will be provided with code snippets to edit or create. Please preserve the EXACT file paths when you make edits. Do not truncate the file paths.\n\nYou may see multiple code snippets from the same file! In that case, please organize the code properly: if you need to add an import statement, do it in the snippet that has other imports in it! Since you won't always be able to see the whole file, try to be careful and avoid adding new code just above a snippet, since you might not know exactly what other code is there.\n\nAlways remember to add correct code that will compile!!! Make sure to properly add function signatures if needed, such as to Go interfaces or Rust traits (if you see those in the code snippets).\n\nIf asked to make further changes after already writing code, use the <content> blocks from your previous edits in order to identify code snippets to replace.\n`;\n\nexport const OUTRO = `\nPlease write all the necessary code to fully implement the feature end-to-end. Do not make mock data or example placeholders!!!\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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,OAAO,YAAY;AAC1C,YAAQ,KAAK,MAAM;AAAA,MACjB,KAAK;AACH,cAAM,KAAK;AAAA,MACb,KAAK;AACH,YAAI,QAAQ;AACV,iBAAO,YAAY;AAAA,QACrB;AACA,wBAAgB,KAAK;AACrB;AAAA,IACJ;AAAA,EACF;AACA,SAAO;AACT;;;ACxCO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAef,IAAM,QAAQ;AAAA;AAAA;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aieo",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",