@ottocode/sdk 0.1.226 → 0.1.228

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/sdk",
3
- "version": "0.1.226",
3
+ "version": "0.1.228",
4
4
  "description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
5
5
  "author": "nitishxyz",
6
6
  "license": "MIT",
@@ -9,7 +9,24 @@ import type { OttoConfig } from '../../types/src/index.ts';
9
9
 
10
10
  export type { OttoConfig } from '../../types/src/index.ts';
11
11
 
12
- const DEFAULTS: { defaults: OttoConfig['defaults'] } = {
12
+ const DEFAULT_PROVIDER_SETTINGS: OttoConfig['providers'] = {
13
+ openai: { enabled: false },
14
+ anthropic: { enabled: false },
15
+ google: { enabled: false },
16
+ openrouter: { enabled: false },
17
+ opencode: { enabled: false },
18
+ copilot: { enabled: false },
19
+ setu: { enabled: true },
20
+ zai: { enabled: false },
21
+ 'zai-coding': { enabled: false },
22
+ moonshot: { enabled: false },
23
+ minimax: { enabled: false },
24
+ };
25
+
26
+ const DEFAULTS: {
27
+ defaults: OttoConfig['defaults'];
28
+ providers: OttoConfig['providers'];
29
+ } = {
13
30
  defaults: {
14
31
  agent: 'build',
15
32
  provider: 'setu',
@@ -18,6 +35,7 @@ const DEFAULTS: { defaults: OttoConfig['defaults'] } = {
18
35
  guidedMode: false,
19
36
  reasoningText: true,
20
37
  },
38
+ providers: DEFAULT_PROVIDER_SETTINGS,
21
39
  };
22
40
 
23
41
  export async function loadConfig(
@@ -42,6 +60,7 @@ export async function loadConfig(
42
60
  return {
43
61
  projectRoot,
44
62
  defaults: merged.defaults as OttoConfig['defaults'],
63
+ providers: merged.providers as OttoConfig['providers'],
45
64
  paths: {
46
65
  dataDir,
47
66
  dbPath,
@@ -65,6 +65,7 @@ export async function writeDefaults(
65
65
  model: string;
66
66
  toolApproval: 'auto' | 'dangerous' | 'all';
67
67
  guidedMode: boolean;
68
+ reasoningText: boolean;
68
69
  theme: string;
69
70
  }>,
70
71
  projectRoot?: string,
@@ -1,15 +1,20 @@
1
+ // @ts-expect-error Bun file asset import
1
2
  import darwinArm64 from 'bun-pty/rust-pty/target/release/librust_pty_arm64.dylib' with {
2
3
  type: 'file',
3
4
  };
5
+ // @ts-expect-error Bun file asset import
4
6
  import darwinX64 from 'bun-pty/rust-pty/target/release/librust_pty.dylib' with {
5
7
  type: 'file',
6
8
  };
9
+ // @ts-expect-error Bun file asset import
7
10
  import linuxArm64 from 'bun-pty/rust-pty/target/release/librust_pty_arm64.so' with {
8
11
  type: 'file',
9
12
  };
13
+ // @ts-expect-error Bun file asset import
10
14
  import linuxX64 from 'bun-pty/rust-pty/target/release/librust_pty.so' with {
11
15
  type: 'file',
12
16
  };
17
+ // @ts-expect-error Bun file asset import
13
18
  import windowsDll from 'bun-pty/rust-pty/target/release/rust_pty.dll' with {
14
19
  type: 'file',
15
20
  };
@@ -16,6 +16,11 @@ type ParsedBody = {
16
16
  [key: string]: unknown;
17
17
  };
18
18
 
19
+ type FetchLike = (
20
+ input: Parameters<typeof fetch>[0],
21
+ init?: Parameters<typeof fetch>[1],
22
+ ) => Promise<Response>;
23
+
19
24
  export function addAnthropicCacheControl(parsed: ParsedBody): ParsedBody {
20
25
  const MAX_SYSTEM_CACHE = 1;
21
26
  const MAX_MESSAGE_CACHE = 1;
@@ -84,8 +89,8 @@ export function addAnthropicCacheControl(parsed: ParsedBody): ParsedBody {
84
89
  return parsed;
85
90
  }
86
91
 
87
- export function createAnthropicCachingFetch(): typeof fetch {
88
- return async (input: RequestInfo | URL, init?: RequestInit) => {
92
+ export function createAnthropicCachingFetch(): FetchLike {
93
+ return async (input, init) => {
89
94
  let body = init?.body;
90
95
  if (body && typeof body === 'string') {
91
96
  try {
@@ -103,8 +108,8 @@ export function createAnthropicCachingFetch(): typeof fetch {
103
108
  export function createConditionalCachingFetch(
104
109
  shouldCache: (model: string) => boolean,
105
110
  model: string,
106
- ): typeof fetch {
107
- return async (input: RequestInfo | URL, init?: RequestInit) => {
111
+ ): FetchLike {
112
+ return async (input, init) => {
108
113
  if (!shouldCache(model)) {
109
114
  return fetch(input, init);
110
115
  }
@@ -3,6 +3,11 @@ import { addAnthropicCacheControl } from './anthropic-caching.ts';
3
3
 
4
4
  const CLAUDE_CLI_VERSION = '1.0.61';
5
5
 
6
+ type FetchLike = (
7
+ input: Parameters<typeof fetch>[0],
8
+ init?: Parameters<typeof fetch>[1],
9
+ ) => Promise<Response>;
10
+
6
11
  export type AnthropicOAuthConfig = {
7
12
  oauth: {
8
13
  access: string;
@@ -42,7 +47,7 @@ function buildOAuthHeaders(accessToken: string): Record<string, string> {
42
47
  }
43
48
 
44
49
  function filterExistingHeaders(
45
- initHeaders: HeadersInit | undefined,
50
+ initHeaders: RequestInit['headers'] | undefined,
46
51
  ): Record<string, string> {
47
52
  const headers: Record<string, string> = {};
48
53
  if (!initHeaders) return headers;
@@ -75,7 +80,7 @@ function filterExistingHeaders(
75
80
 
76
81
  export function createAnthropicOAuthFetch(
77
82
  config: AnthropicOAuthConfig,
78
- ): typeof fetch {
83
+ ): FetchLike {
79
84
  const { oauth, toolNameTransformer } = config;
80
85
 
81
86
  return async (input: string | URL | Request, init?: RequestInit) => {
@@ -150,7 +150,12 @@ function sanitizeCopilotRequestBody(body: string): string {
150
150
  }
151
151
  }
152
152
 
153
- export function createCopilotFetch(config: CopilotOAuthConfig): typeof fetch {
153
+ export function createCopilotFetch(
154
+ config: CopilotOAuthConfig,
155
+ ): (
156
+ input: Parameters<typeof fetch>[0],
157
+ init?: Parameters<typeof fetch>[1],
158
+ ) => Promise<Response> {
154
159
  return async (
155
160
  input: string | URL | Request,
156
161
  init?: RequestInit,
@@ -202,7 +207,7 @@ export function createCopilotModel(model: string, config: CopilotOAuthConfig) {
202
207
  const provider = createOpenAI({
203
208
  apiKey: 'copilot-oauth',
204
209
  baseURL: COPILOT_BASE_URL,
205
- fetch: customFetch,
210
+ fetch: customFetch as typeof fetch,
206
211
  });
207
212
 
208
213
  return needsResponsesApi(model)
@@ -135,8 +135,7 @@ export function createOpenAIOAuthFetch(config: OpenAIOAuthConfig) {
135
135
  const response = await fetch(targetUrl, {
136
136
  ...init,
137
137
  headers,
138
- // biome-ignore lint/suspicious/noTsIgnore: Bun-specific fetch option
139
- // @ts-ignore
138
+ // @ts-expect-error Bun-specific fetch option
140
139
  timeout: false,
141
140
  });
142
141
 
@@ -165,8 +164,7 @@ export function createOpenAIOAuthFetch(config: OpenAIOAuthConfig) {
165
164
  return fetch(targetUrl, {
166
165
  ...init,
167
166
  headers: retryHeaders,
168
- // biome-ignore lint/suspicious/noTsIgnore: Bun-specific fetch option
169
- // @ts-ignore
167
+ // @ts-expect-error Bun-specific fetch option
170
168
  timeout: false,
171
169
  });
172
170
  } catch {
@@ -19,7 +19,10 @@ export function getOpenRouterInstance(
19
19
  const customFetch = model
20
20
  ? createConditionalCachingFetch(isAnthropicModel, model)
21
21
  : undefined;
22
- return createOpenRouter({ apiKey, fetch: customFetch });
22
+ return createOpenRouter({
23
+ apiKey,
24
+ fetch: customFetch as typeof fetch | undefined,
25
+ });
23
26
  }
24
27
 
25
28
  export function createOpenRouterModel(
@@ -88,6 +88,9 @@ const pricingTable: Record<ProviderName, PricingEntry[]> = {
88
88
  moonshot: [
89
89
  // Pricing from catalog entries; leave empty here
90
90
  ],
91
+ minimax: [
92
+ // Pricing from catalog entries; leave empty here
93
+ ],
91
94
  copilot: [],
92
95
  };
93
96
 
package/src/tunnel/qr.ts CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-expect-error No bundled types for qrcode-terminal in all workspace builds
1
2
  import qrcode from 'qrcode-terminal';
2
3
 
3
4
  export function generateQRCode(data: string): Promise<string> {
@@ -0,0 +1,14 @@
1
+ declare module '*.dylib' {
2
+ const filePath: string;
3
+ export default filePath;
4
+ }
5
+
6
+ declare module '*.so' {
7
+ const filePath: string;
8
+ export default filePath;
9
+ }
10
+
11
+ declare module '*.dll' {
12
+ const filePath: string;
13
+ export default filePath;
14
+ }
@@ -1,3 +1,5 @@
1
+ import type { ProviderId } from './provider';
2
+
1
3
  /**
2
4
  * Configuration scope - where settings are stored
3
5
  */
@@ -18,6 +20,14 @@ export type DefaultConfig = {
18
20
  theme?: string;
19
21
  };
20
22
 
23
+ export type ProviderSettings = Record<
24
+ ProviderId,
25
+ {
26
+ enabled: boolean;
27
+ apiKey?: string;
28
+ }
29
+ >;
30
+
21
31
  /**
22
32
  * Path configuration
23
33
  */
@@ -34,6 +44,7 @@ export type PathConfig = {
34
44
  export type OttoConfig = {
35
45
  projectRoot: string;
36
46
  defaults: DefaultConfig;
47
+ providers: ProviderSettings;
37
48
  paths: PathConfig;
38
49
  onboardingComplete?: boolean;
39
50
  };
@@ -16,6 +16,7 @@ export type {
16
16
  Scope,
17
17
  DefaultConfig,
18
18
  PathConfig,
19
+ ProviderSettings,
19
20
  OttoConfig,
20
21
  ToolApprovalMode,
21
22
  } from './config';