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.d.cts CHANGED
@@ -32,7 +32,7 @@ declare abstract class ConversationStorage {
32
32
 
33
33
  type Provider = "anthropic" | "google" | "openai" | "claude_code";
34
34
  declare const PROVIDERS: Provider[];
35
- declare function getModel(provider: Provider, apiKey: string, cwd?: string): Promise<_ai_sdk_provider.LanguageModelV2>;
35
+ declare function getModel(provider: Provider, apiKey: string, cwd?: string, executablePath?: string): Promise<_ai_sdk_provider.LanguageModelV2>;
36
36
  type ThinkingSpeed = "thinking" | "fast";
37
37
  declare function getProviderOptions(provider: Provider, thinkingSpeed?: ThinkingSpeed): {
38
38
  anthropic: {
@@ -68,6 +68,7 @@ interface CallModelOptions {
68
68
  parser?: (fullResponse: string) => void;
69
69
  thinkingSpeed?: ThinkingSpeed;
70
70
  cwd?: string;
71
+ executablePath?: string;
71
72
  }
72
73
  declare function callModel(opts: CallModelOptions): Promise<string>;
73
74
 
package/dist/index.d.ts CHANGED
@@ -32,7 +32,7 @@ declare abstract class ConversationStorage {
32
32
 
33
33
  type Provider = "anthropic" | "google" | "openai" | "claude_code";
34
34
  declare const PROVIDERS: Provider[];
35
- declare function getModel(provider: Provider, apiKey: string, cwd?: string): Promise<_ai_sdk_provider.LanguageModelV2>;
35
+ declare function getModel(provider: Provider, apiKey: string, cwd?: string, executablePath?: string): Promise<_ai_sdk_provider.LanguageModelV2>;
36
36
  type ThinkingSpeed = "thinking" | "fast";
37
37
  declare function getProviderOptions(provider: Provider, thinkingSpeed?: ThinkingSpeed): {
38
38
  anthropic: {
@@ -68,6 +68,7 @@ interface CallModelOptions {
68
68
  parser?: (fullResponse: string) => void;
69
69
  thinkingSpeed?: ThinkingSpeed;
70
70
  cwd?: string;
71
+ executablePath?: string;
71
72
  }
72
73
  declare function callModel(opts: CallModelOptions): Promise<string>;
73
74
 
package/dist/index.js CHANGED
@@ -8152,7 +8152,7 @@ var SOTA = {
8152
8152
  openai: "gpt-4.1",
8153
8153
  claude_code: "sonnet"
8154
8154
  };
8155
- async function getModel(provider, apiKey, cwd) {
8155
+ async function getModel(provider, apiKey, cwd, executablePath) {
8156
8156
  switch (provider) {
8157
8157
  case "anthropic":
8158
8158
  const anthropic2 = createAnthropic({
@@ -8170,18 +8170,26 @@ async function getModel(provider, apiKey, cwd) {
8170
8170
  });
8171
8171
  return openai2(SOTA[provider]);
8172
8172
  case "claude_code":
8173
- const customProvider = createClaudeCode({
8174
- defaultSettings: {
8175
- // Skip permission prompts for all operations
8176
- permissionMode: "bypassPermissions",
8177
- // Set working directory for file operations
8178
- cwd
8173
+ try {
8174
+ const customProvider = createClaudeCode({
8175
+ defaultSettings: {
8176
+ pathToClaudeCodeExecutable: executablePath,
8177
+ // Skip permission prompts for all operations
8178
+ permissionMode: "bypassPermissions",
8179
+ // Set working directory for file operations
8180
+ cwd
8181
+ }
8182
+ });
8183
+ if (cwd) {
8184
+ console.log("creating claude code model at", cwd);
8179
8185
  }
8180
- });
8181
- if (cwd) {
8182
- console.log("creating claude code model at", cwd);
8186
+ return customProvider(SOTA[provider]);
8187
+ } catch (error) {
8188
+ console.error("Failed to create Claude Code provider:", error);
8189
+ throw new Error(
8190
+ "Claude Code CLI not available or not properly installed. Make sure Claude Code is installed and accessible in the environment where this code runs."
8191
+ );
8183
8192
  }
8184
- return customProvider(SOTA[provider]);
8185
8193
  default:
8186
8194
  throw new Error(`Unsupported provider: ${provider}`);
8187
8195
  }
@@ -8217,8 +8225,17 @@ function getProviderOptions(provider, thinkingSpeed) {
8217
8225
  // src/stream.ts
8218
8226
  import { streamText } from "ai";
8219
8227
  async function callModel(opts) {
8220
- const { provider, apiKey, messages, tools, parser, thinkingSpeed, cwd } = opts;
8221
- const model = await getModel(provider, apiKey, cwd);
8228
+ const {
8229
+ provider,
8230
+ apiKey,
8231
+ messages,
8232
+ tools,
8233
+ parser,
8234
+ thinkingSpeed,
8235
+ cwd,
8236
+ executablePath
8237
+ } = opts;
8238
+ const model = await getModel(provider, apiKey, cwd, executablePath);
8222
8239
  const providerOptions = getProviderOptions(provider, thinkingSpeed);
8223
8240
  console.log(`Calling ${provider} with options:`, providerOptions);
8224
8241
  const result = streamText({