aieo 0.1.21 → 0.1.23
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 +30 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8195,7 +8195,7 @@ var SOTA = {
|
|
|
8195
8195
|
openai: "gpt-4.1",
|
|
8196
8196
|
claude_code: "sonnet"
|
|
8197
8197
|
};
|
|
8198
|
-
async function getModel(provider, apiKey, cwd) {
|
|
8198
|
+
async function getModel(provider, apiKey, cwd, executablePath) {
|
|
8199
8199
|
switch (provider) {
|
|
8200
8200
|
case "anthropic":
|
|
8201
8201
|
const anthropic2 = createAnthropic({
|
|
@@ -8213,18 +8213,26 @@ async function getModel(provider, apiKey, cwd) {
|
|
|
8213
8213
|
});
|
|
8214
8214
|
return openai2(SOTA[provider]);
|
|
8215
8215
|
case "claude_code":
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8216
|
+
try {
|
|
8217
|
+
const customProvider = (0, import_ai_sdk_provider_claude_code.createClaudeCode)({
|
|
8218
|
+
defaultSettings: {
|
|
8219
|
+
pathToClaudeCodeExecutable: executablePath,
|
|
8220
|
+
// Skip permission prompts for all operations
|
|
8221
|
+
permissionMode: "bypassPermissions",
|
|
8222
|
+
// Set working directory for file operations
|
|
8223
|
+
cwd
|
|
8224
|
+
}
|
|
8225
|
+
});
|
|
8226
|
+
if (cwd) {
|
|
8227
|
+
console.log("creating claude code model at", cwd);
|
|
8222
8228
|
}
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
console.
|
|
8229
|
+
return customProvider(SOTA[provider]);
|
|
8230
|
+
} catch (error) {
|
|
8231
|
+
console.error("Failed to create Claude Code provider:", error);
|
|
8232
|
+
throw new Error(
|
|
8233
|
+
"Claude Code CLI not available or not properly installed. Make sure Claude Code is installed and accessible in the environment where this code runs."
|
|
8234
|
+
);
|
|
8226
8235
|
}
|
|
8227
|
-
return customProvider(SOTA[provider]);
|
|
8228
8236
|
default:
|
|
8229
8237
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
8230
8238
|
}
|
|
@@ -8260,8 +8268,17 @@ function getProviderOptions(provider, thinkingSpeed) {
|
|
|
8260
8268
|
// src/stream.ts
|
|
8261
8269
|
var import_ai = require("ai");
|
|
8262
8270
|
async function callModel(opts) {
|
|
8263
|
-
const {
|
|
8264
|
-
|
|
8271
|
+
const {
|
|
8272
|
+
provider,
|
|
8273
|
+
apiKey,
|
|
8274
|
+
messages,
|
|
8275
|
+
tools,
|
|
8276
|
+
parser,
|
|
8277
|
+
thinkingSpeed,
|
|
8278
|
+
cwd,
|
|
8279
|
+
executablePath
|
|
8280
|
+
} = opts;
|
|
8281
|
+
const model = await getModel(provider, apiKey, cwd, executablePath);
|
|
8265
8282
|
const providerOptions = getProviderOptions(provider, thinkingSpeed);
|
|
8266
8283
|
console.log(`Calling ${provider} with options:`, providerOptions);
|
|
8267
8284
|
const result = (0, import_ai.streamText)({
|