aieo 0.1.22 → 0.1.24
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.cjs +55 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +54 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,13 +35,15 @@ __export(index_exports, {
|
|
|
35
35
|
OUTRO: () => OUTRO,
|
|
36
36
|
PROVIDERS: () => PROVIDERS,
|
|
37
37
|
SYSTEM: () => SYSTEM,
|
|
38
|
+
callGenerateObject: () => callGenerateObject,
|
|
38
39
|
callModel: () => callModel,
|
|
40
|
+
getApiKeyForProvider: () => getApiKeyForProvider,
|
|
39
41
|
getModel: () => getModel,
|
|
40
42
|
getProviderOptions: () => getProviderOptions
|
|
41
43
|
});
|
|
42
44
|
module.exports = __toCommonJS(index_exports);
|
|
43
45
|
|
|
44
|
-
//
|
|
46
|
+
// ../../node_modules/uuid/dist/esm/stringify.js
|
|
45
47
|
var byteToHex = [];
|
|
46
48
|
for (let i = 0; i < 256; ++i) {
|
|
47
49
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -50,7 +52,7 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
50
52
|
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();
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
//
|
|
55
|
+
// ../../node_modules/uuid/dist/esm/rng.js
|
|
54
56
|
var import_crypto = require("crypto");
|
|
55
57
|
var rnds8Pool = new Uint8Array(256);
|
|
56
58
|
var poolPtr = rnds8Pool.length;
|
|
@@ -62,11 +64,11 @@ function rng() {
|
|
|
62
64
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
//
|
|
67
|
+
// ../../node_modules/uuid/dist/esm/native.js
|
|
66
68
|
var import_crypto2 = require("crypto");
|
|
67
69
|
var native_default = { randomUUID: import_crypto2.randomUUID };
|
|
68
70
|
|
|
69
|
-
//
|
|
71
|
+
// ../../node_modules/uuid/dist/esm/v4.js
|
|
70
72
|
function v4(options, buf, offset) {
|
|
71
73
|
if (native_default.randomUUID && !buf && !options) {
|
|
72
74
|
return native_default.randomUUID();
|
|
@@ -8192,10 +8194,31 @@ var PROVIDERS = [
|
|
|
8192
8194
|
var SOTA = {
|
|
8193
8195
|
anthropic: "claude-4-sonnet-20250514",
|
|
8194
8196
|
google: "gemini-2.5-pro-preview-05-06",
|
|
8195
|
-
openai: "gpt-
|
|
8197
|
+
openai: "gpt-5",
|
|
8196
8198
|
claude_code: "sonnet"
|
|
8197
8199
|
};
|
|
8198
|
-
|
|
8200
|
+
function getApiKeyForProvider(provider) {
|
|
8201
|
+
let apiKey;
|
|
8202
|
+
switch (provider) {
|
|
8203
|
+
case "anthropic":
|
|
8204
|
+
apiKey = process.env.ANTHROPIC_API_KEY;
|
|
8205
|
+
break;
|
|
8206
|
+
case "google":
|
|
8207
|
+
apiKey = process.env.GOOGLE_API_KEY;
|
|
8208
|
+
break;
|
|
8209
|
+
case "openai":
|
|
8210
|
+
apiKey = process.env.OPENAI_API_KEY;
|
|
8211
|
+
break;
|
|
8212
|
+
case "claude_code":
|
|
8213
|
+
apiKey = process.env.CLAUDE_CODE_API_KEY;
|
|
8214
|
+
break;
|
|
8215
|
+
}
|
|
8216
|
+
if (!apiKey) {
|
|
8217
|
+
throw new Error(`API key not found for provider: ${provider}`);
|
|
8218
|
+
}
|
|
8219
|
+
return apiKey;
|
|
8220
|
+
}
|
|
8221
|
+
async function getModel(provider, apiKey, cwd, executablePath) {
|
|
8199
8222
|
switch (provider) {
|
|
8200
8223
|
case "anthropic":
|
|
8201
8224
|
const anthropic2 = createAnthropic({
|
|
@@ -8216,6 +8239,7 @@ async function getModel(provider, apiKey, cwd) {
|
|
|
8216
8239
|
try {
|
|
8217
8240
|
const customProvider = (0, import_ai_sdk_provider_claude_code.createClaudeCode)({
|
|
8218
8241
|
defaultSettings: {
|
|
8242
|
+
pathToClaudeCodeExecutable: executablePath,
|
|
8219
8243
|
// Skip permission prompts for all operations
|
|
8220
8244
|
permissionMode: "bypassPermissions",
|
|
8221
8245
|
// Set working directory for file operations
|
|
@@ -8228,7 +8252,9 @@ async function getModel(provider, apiKey, cwd) {
|
|
|
8228
8252
|
return customProvider(SOTA[provider]);
|
|
8229
8253
|
} catch (error) {
|
|
8230
8254
|
console.error("Failed to create Claude Code provider:", error);
|
|
8231
|
-
throw new Error(
|
|
8255
|
+
throw new Error(
|
|
8256
|
+
"Claude Code CLI not available or not properly installed. Make sure Claude Code is installed and accessible in the environment where this code runs."
|
|
8257
|
+
);
|
|
8232
8258
|
}
|
|
8233
8259
|
default:
|
|
8234
8260
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
@@ -8265,8 +8291,17 @@ function getProviderOptions(provider, thinkingSpeed) {
|
|
|
8265
8291
|
// src/stream.ts
|
|
8266
8292
|
var import_ai = require("ai");
|
|
8267
8293
|
async function callModel(opts) {
|
|
8268
|
-
const {
|
|
8269
|
-
|
|
8294
|
+
const {
|
|
8295
|
+
provider,
|
|
8296
|
+
apiKey,
|
|
8297
|
+
messages,
|
|
8298
|
+
tools,
|
|
8299
|
+
parser,
|
|
8300
|
+
thinkingSpeed,
|
|
8301
|
+
cwd,
|
|
8302
|
+
executablePath
|
|
8303
|
+
} = opts;
|
|
8304
|
+
const model = await getModel(provider, apiKey, cwd, executablePath);
|
|
8270
8305
|
const providerOptions = getProviderOptions(provider, thinkingSpeed);
|
|
8271
8306
|
console.log(`Calling ${provider} with options:`, providerOptions);
|
|
8272
8307
|
const result = (0, import_ai.streamText)({
|
|
@@ -8291,6 +8326,15 @@ async function callModel(opts) {
|
|
|
8291
8326
|
}
|
|
8292
8327
|
return fullResponse;
|
|
8293
8328
|
}
|
|
8329
|
+
async function callGenerateObject(args) {
|
|
8330
|
+
const model = await getModel(args.provider, args.apiKey);
|
|
8331
|
+
const { object } = await (0, import_ai.generateObject)({
|
|
8332
|
+
model,
|
|
8333
|
+
schema: args.schema,
|
|
8334
|
+
prompt: args.prompt
|
|
8335
|
+
});
|
|
8336
|
+
return object;
|
|
8337
|
+
}
|
|
8294
8338
|
|
|
8295
8339
|
// src/prompt.ts
|
|
8296
8340
|
var 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.
|
|
@@ -8317,7 +8361,9 @@ Please write all the necessary code to fully implement the feature end-to-end. D
|
|
|
8317
8361
|
OUTRO,
|
|
8318
8362
|
PROVIDERS,
|
|
8319
8363
|
SYSTEM,
|
|
8364
|
+
callGenerateObject,
|
|
8320
8365
|
callModel,
|
|
8366
|
+
getApiKeyForProvider,
|
|
8321
8367
|
getModel,
|
|
8322
8368
|
getProviderOptions
|
|
8323
8369
|
});
|