@agi-cli/sdk 0.1.140 → 0.1.142

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/README.md CHANGED
@@ -72,7 +72,7 @@ import {
72
72
  } from '@agi-cli/sdk';
73
73
 
74
74
  // Check available providers
75
- console.log(providerIds); // ['openai', 'anthropic', 'google', 'openrouter', 'opencode', 'solforge']
75
+ console.log(providerIds); // ['openai', 'anthropic', 'google', 'openrouter', 'opencode', 'setu']
76
76
 
77
77
  // Get model information
78
78
  const models = catalog.anthropic.models;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/sdk",
3
- "version": "0.1.140",
3
+ "version": "0.1.142",
4
4
  "description": "AI agent SDK for building intelligent assistants - tree-shakable and comprehensive",
5
5
  "author": "nitishxyz",
6
6
  "license": "MIT",
@@ -90,14 +90,14 @@
90
90
  "typecheck": "tsc --noEmit"
91
91
  },
92
92
  "dependencies": {
93
- "@ai-sdk/anthropic": "^2.0.16",
94
- "@ai-sdk/google": "^2.0.14",
95
- "@ai-sdk/openai": "^2.0.30",
96
- "@ai-sdk/openai-compatible": "^1.0.18",
93
+ "@ai-sdk/anthropic": "^3.0.0",
94
+ "@ai-sdk/google": "^3.0.0",
95
+ "@ai-sdk/openai": "^3.0.0",
96
+ "@ai-sdk/openai-compatible": "^2.0.0",
97
97
  "@openauthjs/openauth": "^0.4.3",
98
98
  "@openrouter/ai-sdk-provider": "^1.2.0",
99
99
  "@solana/web3.js": "^1.95.2",
100
- "ai": "^5.0.43",
100
+ "ai": "^6.0.0",
101
101
  "bs58": "^6.0.0",
102
102
  "bun-pty": "^0.3.2",
103
103
  "diff": "^8.0.2",
@@ -17,6 +17,7 @@ const DEFAULTS: {
17
17
  agent: 'general',
18
18
  provider: 'openai',
19
19
  model: 'gpt-4o-mini',
20
+ toolApproval: 'auto',
20
21
  },
21
22
  providers: {
22
23
  openai: { enabled: true },
@@ -24,9 +25,10 @@ const DEFAULTS: {
24
25
  google: { enabled: true },
25
26
  openrouter: { enabled: false },
26
27
  opencode: { enabled: false },
27
- solforge: { enabled: false },
28
+ setu: { enabled: false },
28
29
  zai: { enabled: false },
29
30
  'zai-coding': { enabled: false },
31
+ moonshot: { enabled: false },
30
32
  },
31
33
  };
32
34
 
@@ -54,20 +54,23 @@ export async function ensureEnv(
54
54
 
55
55
  export async function writeDefaults(
56
56
  scope: Scope,
57
- updates: Partial<{ agent: string; provider: ProviderId; model: string }>,
57
+ updates: Partial<{
58
+ agent: string;
59
+ provider: ProviderId;
60
+ model: string;
61
+ toolApproval: 'auto' | 'dangerous' | 'all';
62
+ }>,
58
63
  projectRoot?: string,
59
64
  ) {
60
65
  const { cfg } = await read(projectRoot);
61
66
  if (scope === 'local') {
62
67
  const next = {
63
- projectRoot: cfg.projectRoot,
64
68
  defaults: {
65
- agent: updates.agent ?? cfg.defaults.agent,
69
+ ...cfg.defaults,
70
+ ...updates,
66
71
  provider: (updates.provider ?? cfg.defaults.provider) as ProviderId,
67
- model: updates.model ?? cfg.defaults.model,
68
72
  },
69
73
  providers: cfg.providers,
70
- paths: cfg.paths,
71
74
  };
72
75
  const path = `${cfg.paths.dataDir}/config.json`;
73
76
  await Bun.write(path, JSON.stringify(next, null, 2));
@@ -77,9 +80,9 @@ export async function writeDefaults(
77
80
  const path = getGlobalConfigPath();
78
81
  const next = {
79
82
  defaults: {
80
- agent: updates.agent ?? cfg.defaults.agent,
83
+ ...cfg.defaults,
84
+ ...updates,
81
85
  provider: (updates.provider ?? cfg.defaults.provider) as ProviderId,
82
- model: updates.model ?? cfg.defaults.model,
83
86
  },
84
87
  providers: cfg.providers,
85
88
  };
@@ -5,7 +5,7 @@ import { createOpenRouter } from '@openrouter/ai-sdk-provider';
5
5
  import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
6
6
  import {
7
7
  catalog,
8
- createSolforgeModel,
8
+ createSetuModel,
9
9
  createOpenAIOAuthModel,
10
10
  } from '../../../providers/src/index.ts';
11
11
  import type { OAuth } from '../../../types/src/index.ts';
@@ -33,9 +33,10 @@ export type ProviderName =
33
33
  | 'google'
34
34
  | 'openrouter'
35
35
  | 'opencode'
36
- | 'solforge'
36
+ | 'setu'
37
37
  | 'zai'
38
- | 'zai-coding';
38
+ | 'zai-coding'
39
+ | 'moonshot';
39
40
 
40
41
  export type ModelConfig = {
41
42
  apiKey?: string;
@@ -151,16 +152,16 @@ export async function resolveModel(
151
152
  return ocOpenAI(resolvedModelId);
152
153
  }
153
154
 
154
- if (provider === 'solforge') {
155
- const privateKey = config.apiKey || process.env.SOLFORGE_PRIVATE_KEY || '';
155
+ if (provider === 'setu') {
156
+ const privateKey = config.apiKey || process.env.SETU_PRIVATE_KEY || '';
156
157
  if (!privateKey) {
157
158
  throw new Error(
158
- 'Solforge provider requires SOLFORGE_PRIVATE_KEY (base58 Solana secret).',
159
+ 'Setu provider requires SETU_PRIVATE_KEY (base58 Solana secret).',
159
160
  );
160
161
  }
161
- const baseURL = config.baseURL || process.env.SOLFORGE_BASE_URL;
162
- const rpcURL = process.env.SOLFORGE_SOLANA_RPC_URL;
163
- return createSolforgeModel(
162
+ const baseURL = config.baseURL || process.env.SETU_BASE_URL;
163
+ const rpcURL = process.env.SETU_SOLANA_RPC_URL;
164
+ return createSetuModel(
164
165
  model,
165
166
  { privateKey },
166
167
  {
@@ -206,6 +207,20 @@ export async function resolveModel(
206
207
  return instance(model);
207
208
  }
208
209
 
210
+ if (provider === 'moonshot') {
211
+ const entry = catalog[provider];
212
+ const apiKey = config.apiKey || process.env.MOONSHOT_API_KEY || '';
213
+ const baseURL =
214
+ config.baseURL || entry?.api || 'https://api.moonshot.ai/v1';
215
+ const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined;
216
+ const instance = createOpenAICompatible({
217
+ name: entry?.label ?? 'Moonshot AI',
218
+ baseURL,
219
+ headers,
220
+ });
221
+ return instance(model);
222
+ }
223
+
209
224
  throw new Error(`Unsupported provider: ${provider}`);
210
225
  }
211
226
 
package/src/index.ts CHANGED
@@ -61,16 +61,16 @@ export {
61
61
  setEnvKey,
62
62
  } from './providers/src/index.ts';
63
63
  export {
64
- createSolforgeFetch,
65
- createSolforgeModel,
66
- fetchSolforgeBalance,
64
+ createSetuFetch,
65
+ createSetuModel,
66
+ fetchSetuBalance,
67
67
  getPublicKeyFromPrivate,
68
68
  fetchSolanaUsdcBalance,
69
69
  } from './providers/src/index.ts';
70
70
  export type {
71
- SolforgeAuth,
72
- SolforgeProviderOptions,
73
- SolforgeBalanceResponse,
71
+ SetuAuth,
72
+ SetuProviderOptions,
73
+ SetuBalanceResponse,
74
74
  SolanaUsdcBalanceResponse,
75
75
  } from './providers/src/index.ts';
76
76
  export {
@@ -104,6 +104,8 @@ export {
104
104
  export type { OpenRouterProviderConfig } from './providers/src/index.ts';
105
105
  export { createOpencodeModel } from './providers/src/index.ts';
106
106
  export type { OpencodeProviderConfig } from './providers/src/index.ts';
107
+ export { createMoonshotModel } from './providers/src/index.ts';
108
+ export type { MoonshotProviderConfig } from './providers/src/index.ts';
107
109
 
108
110
  // =======================
109
111
  // Authentication (from internal auth module)
@@ -1,4 +1,4 @@
1
- You are a coding agent running in the Codex CLI, a terminal-based coding assistant. Codex CLI is an open source project led by OpenAI. You are expected to be precise, safe, and helpful.
1
+ You are a coding agent running in a terminal-based coding assistant. You are expected to be precise, safe, and helpful.
2
2
 
3
3
  Your capabilities:
4
4
 
@@ -6,8 +6,6 @@ Your capabilities:
6
6
  - Communicate with the user by streaming thinking & responses, and by making & updating plans.
7
7
  - Emit function calls to run terminal commands and apply patches. Depending on how this specific run is configured, you can request that these function calls be escalated to the user for approval before running. More on this in the "Sandbox and approvals" section.
8
8
 
9
- Within this context, Codex refers to the open-source agentic coding interface (not the old Codex language model built by OpenAI).
10
-
11
9
  ## Tool Ecosystem
12
10
 
13
11
  You have access to a rich set of specialized tools optimized for coding tasks:
@@ -282,7 +280,7 @@ If completing the user's task requires writing or modifying files, your code and
282
280
 
283
281
  ## Sandbox and approvals
284
282
 
285
- The Codex CLI harness supports several different sandboxing, and approval configurations that the user can choose from.
283
+ The CLI harness supports several different sandboxing, and approval configurations that the user can choose from.
286
284
 
287
285
  Filesystem sandboxing prevents you from editing files without user approval. The options are:
288
286
 
@@ -62,12 +62,12 @@ export async function providerBasePrompt(
62
62
  }
63
63
  }
64
64
 
65
- // 2) Provider-family fallback for openrouter/opencode/solforge using embedded defaults
65
+ // 2) Provider-family fallback for openrouter/opencode/setu using embedded defaults
66
66
  if (
67
67
  isProviderId(id) &&
68
68
  (id === 'openrouter' ||
69
69
  id === 'opencode' ||
70
- id === 'solforge' ||
70
+ id === 'setu' ||
71
71
  id === 'zai' ||
72
72
  id === 'zai-coding') &&
73
73
  modelId
@@ -6,7 +6,7 @@ import type {
6
6
 
7
7
  type CatalogMap = Partial<Record<ProviderId, ProviderCatalogEntry>>;
8
8
 
9
- const SOLFORGE_ID: ProviderId = 'solforge';
9
+ const SETU_ID: ProviderId = 'setu';
10
10
 
11
11
  const isAllowedOpenAIModel = (id: string): boolean => {
12
12
  if (id === 'codex-mini-latest') return true;
@@ -23,7 +23,7 @@ const isAllowedAnthropicModel = (id: string): boolean => {
23
23
  return false;
24
24
  };
25
25
 
26
- const SOLFORGE_SOURCES: Array<{ id: ProviderId; npm: string }> = [
26
+ const SETU_SOURCES: Array<{ id: ProviderId; npm: string }> = [
27
27
  {
28
28
  id: 'openai',
29
29
  npm: '@ai-sdk/openai',
@@ -53,8 +53,8 @@ function cloneModel(model: ModelInfo): ModelInfo {
53
53
  };
54
54
  }
55
55
 
56
- function buildSolforgeEntry(base: CatalogMap): ProviderCatalogEntry | null {
57
- const solforgeModels = SOLFORGE_SOURCES.flatMap(({ id, npm }) => {
56
+ function buildSetuEntry(base: CatalogMap): ProviderCatalogEntry | null {
57
+ const setuModels = SETU_SOURCES.flatMap(({ id, npm }) => {
58
58
  const allModels = base[id]?.models ?? [];
59
59
  const sourceModels = allModels.filter((model) => {
60
60
  if (id === 'openai') return isAllowedOpenAIModel(model.id);
@@ -68,10 +68,10 @@ function buildSolforgeEntry(base: CatalogMap): ProviderCatalogEntry | null {
68
68
  });
69
69
  });
70
70
 
71
- if (!solforgeModels.length) return null;
71
+ if (!setuModels.length) return null;
72
72
 
73
73
  // Prefer OpenAI-family models first so defaults are stable
74
- solforgeModels.sort((a, b) => {
74
+ setuModels.sort((a, b) => {
75
75
  const providerA = a.provider?.npm ?? '';
76
76
  const providerB = b.provider?.npm ?? '';
77
77
  if (providerA === providerB) {
@@ -83,31 +83,31 @@ function buildSolforgeEntry(base: CatalogMap): ProviderCatalogEntry | null {
83
83
  });
84
84
 
85
85
  const defaultModelId = 'codex-mini-latest';
86
- const defaultIdx = solforgeModels.findIndex((m) => m.id === defaultModelId);
86
+ const defaultIdx = setuModels.findIndex((m) => m.id === defaultModelId);
87
87
  if (defaultIdx > 0) {
88
- const [picked] = solforgeModels.splice(defaultIdx, 1);
89
- solforgeModels.unshift(picked);
88
+ const [picked] = setuModels.splice(defaultIdx, 1);
89
+ setuModels.unshift(picked);
90
90
  }
91
91
 
92
92
  return {
93
- id: SOLFORGE_ID,
94
- label: 'Solforge',
95
- env: ['SOLFORGE_PRIVATE_KEY'],
96
- api: 'https://router.solforge.sh/v1',
97
- doc: 'https://router.solforge.sh/docs',
98
- models: solforgeModels,
93
+ id: SETU_ID,
94
+ label: 'Setu',
95
+ env: ['SETU_PRIVATE_KEY'],
96
+ api: 'https://setu.agi.nitish.sh/v1',
97
+ doc: 'https://setu.agi.nitish.sh/docs',
98
+ models: setuModels,
99
99
  };
100
100
  }
101
101
 
102
102
  export function mergeManualCatalog(
103
103
  base: CatalogMap,
104
104
  ): Record<ProviderId, ProviderCatalogEntry> {
105
- const manualEntry = buildSolforgeEntry(base);
105
+ const manualEntry = buildSetuEntry(base);
106
106
  const merged: Record<ProviderId, ProviderCatalogEntry> = {
107
107
  ...(base as Record<ProviderId, ProviderCatalogEntry>),
108
108
  };
109
109
  if (manualEntry) {
110
- merged[SOLFORGE_ID] = manualEntry;
110
+ merged[SETU_ID] = manualEntry;
111
111
  }
112
112
  return merged;
113
113
  }
@@ -3892,6 +3892,34 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
3892
3892
  output: 32800,
3893
3893
  },
3894
3894
  },
3895
+ {
3896
+ id: 'moonshotai/kimi-k2.5',
3897
+ label: 'Kimi K2.5',
3898
+ modalities: {
3899
+ input: ['text', 'image', 'video'],
3900
+ output: ['text'],
3901
+ },
3902
+ toolCall: true,
3903
+ reasoningText: true,
3904
+ attachment: true,
3905
+ temperature: true,
3906
+ knowledge: '2025-01',
3907
+ releaseDate: '2026-01-27',
3908
+ lastUpdated: '2026-01-27',
3909
+ openWeights: true,
3910
+ cost: {
3911
+ input: 0.6,
3912
+ output: 3,
3913
+ cacheRead: 0.1,
3914
+ },
3915
+ limit: {
3916
+ context: 262144,
3917
+ output: 262144,
3918
+ },
3919
+ provider: {
3920
+ npm: '@openrouter/ai-sdk-provider',
3921
+ },
3922
+ },
3895
3923
  {
3896
3924
  id: 'nousresearch/deephermes-3-llama-3-8b-preview',
3897
3925
  label: 'DeepHermes 3 Llama 3 8B Preview',
@@ -6318,6 +6346,56 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
6318
6346
  output: 262144,
6319
6347
  },
6320
6348
  },
6349
+ {
6350
+ id: 'kimi-k2.5',
6351
+ label: 'Kimi K2.5',
6352
+ modalities: {
6353
+ input: ['text'],
6354
+ output: ['text'],
6355
+ },
6356
+ toolCall: true,
6357
+ reasoningText: true,
6358
+ attachment: false,
6359
+ temperature: true,
6360
+ knowledge: '2024-10',
6361
+ releaseDate: '2026-01-27',
6362
+ lastUpdated: '2026-01-27',
6363
+ openWeights: true,
6364
+ cost: {
6365
+ input: 1.2,
6366
+ output: 1.2,
6367
+ cacheRead: 0.6,
6368
+ },
6369
+ limit: {
6370
+ context: 262144,
6371
+ output: 262144,
6372
+ },
6373
+ },
6374
+ {
6375
+ id: 'minimax-m2.1',
6376
+ label: 'MiniMax M2.1',
6377
+ modalities: {
6378
+ input: ['text'],
6379
+ output: ['text'],
6380
+ },
6381
+ toolCall: true,
6382
+ reasoningText: true,
6383
+ attachment: false,
6384
+ temperature: true,
6385
+ knowledge: '2025-01',
6386
+ releaseDate: '2025-12-23',
6387
+ lastUpdated: '2025-12-23',
6388
+ openWeights: true,
6389
+ cost: {
6390
+ input: 0.3,
6391
+ output: 1.2,
6392
+ cacheRead: 0.1,
6393
+ },
6394
+ limit: {
6395
+ context: 204800,
6396
+ output: 131072,
6397
+ },
6398
+ },
6321
6399
  {
6322
6400
  id: 'minimax-m2.1-free',
6323
6401
  label: 'MiniMax M2.1',
@@ -6779,4 +6857,139 @@ export const catalog: Partial<Record<ProviderId, ProviderCatalogEntry>> = {
6779
6857
  api: 'https://api.z.ai/api/coding/paas/v4',
6780
6858
  doc: 'https://docs.z.ai/devpack/overview',
6781
6859
  },
6860
+ moonshot: {
6861
+ id: 'moonshot',
6862
+ models: [
6863
+ {
6864
+ id: 'kimi-k2-0711-preview',
6865
+ label: 'Kimi K2 0711',
6866
+ modalities: {
6867
+ input: ['text'],
6868
+ output: ['text'],
6869
+ },
6870
+ toolCall: true,
6871
+ reasoningText: false,
6872
+ attachment: false,
6873
+ temperature: true,
6874
+ knowledge: '2024-10',
6875
+ releaseDate: '2025-07-14',
6876
+ lastUpdated: '2025-07-14',
6877
+ openWeights: true,
6878
+ cost: {
6879
+ input: 0.6,
6880
+ output: 2.5,
6881
+ cacheRead: 0.15,
6882
+ },
6883
+ limit: {
6884
+ context: 131072,
6885
+ output: 16384,
6886
+ },
6887
+ },
6888
+ {
6889
+ id: 'kimi-k2-0905-preview',
6890
+ label: 'Kimi K2 0905',
6891
+ modalities: {
6892
+ input: ['text'],
6893
+ output: ['text'],
6894
+ },
6895
+ toolCall: true,
6896
+ reasoningText: false,
6897
+ attachment: false,
6898
+ temperature: true,
6899
+ knowledge: '2024-10',
6900
+ releaseDate: '2025-09-05',
6901
+ lastUpdated: '2025-09-05',
6902
+ openWeights: true,
6903
+ cost: {
6904
+ input: 0.6,
6905
+ output: 2.5,
6906
+ cacheRead: 0.15,
6907
+ },
6908
+ limit: {
6909
+ context: 262144,
6910
+ output: 262144,
6911
+ },
6912
+ },
6913
+ {
6914
+ id: 'kimi-k2-thinking',
6915
+ label: 'Kimi K2 Thinking',
6916
+ modalities: {
6917
+ input: ['text'],
6918
+ output: ['text'],
6919
+ },
6920
+ toolCall: true,
6921
+ reasoningText: true,
6922
+ attachment: false,
6923
+ temperature: true,
6924
+ knowledge: '2024-08',
6925
+ releaseDate: '2025-11-06',
6926
+ lastUpdated: '2025-11-06',
6927
+ openWeights: true,
6928
+ cost: {
6929
+ input: 0.6,
6930
+ output: 2.5,
6931
+ cacheRead: 0.15,
6932
+ },
6933
+ limit: {
6934
+ context: 262144,
6935
+ output: 262144,
6936
+ },
6937
+ },
6938
+ {
6939
+ id: 'kimi-k2-thinking-turbo',
6940
+ label: 'Kimi K2 Thinking Turbo',
6941
+ modalities: {
6942
+ input: ['text'],
6943
+ output: ['text'],
6944
+ },
6945
+ toolCall: true,
6946
+ reasoningText: true,
6947
+ attachment: false,
6948
+ temperature: true,
6949
+ knowledge: '2024-08',
6950
+ releaseDate: '2025-11-06',
6951
+ lastUpdated: '2025-11-06',
6952
+ openWeights: true,
6953
+ cost: {
6954
+ input: 1.15,
6955
+ output: 8,
6956
+ cacheRead: 0.15,
6957
+ },
6958
+ limit: {
6959
+ context: 262144,
6960
+ output: 262144,
6961
+ },
6962
+ },
6963
+ {
6964
+ id: 'kimi-k2-turbo-preview',
6965
+ label: 'Kimi K2 Turbo',
6966
+ modalities: {
6967
+ input: ['text'],
6968
+ output: ['text'],
6969
+ },
6970
+ toolCall: true,
6971
+ reasoningText: false,
6972
+ attachment: false,
6973
+ temperature: true,
6974
+ knowledge: '2024-10',
6975
+ releaseDate: '2025-09-05',
6976
+ lastUpdated: '2025-09-05',
6977
+ openWeights: true,
6978
+ cost: {
6979
+ input: 2.4,
6980
+ output: 10,
6981
+ cacheRead: 0.6,
6982
+ },
6983
+ limit: {
6984
+ context: 262144,
6985
+ output: 262144,
6986
+ },
6987
+ },
6988
+ ],
6989
+ label: 'Moonshot AI',
6990
+ env: ['MOONSHOT_API_KEY'],
6991
+ npm: '@ai-sdk/openai-compatible',
6992
+ api: 'https://api.moonshot.ai/v1',
6993
+ doc: 'https://platform.moonshot.ai/docs/api/chat',
6994
+ },
6782
6995
  } as const satisfies Partial<Record<ProviderId, ProviderCatalogEntry>>;
@@ -6,9 +6,10 @@ const ENV_VARS: Record<ProviderId, string> = {
6
6
  google: 'GOOGLE_GENERATIVE_AI_API_KEY',
7
7
  openrouter: 'OPENROUTER_API_KEY',
8
8
  opencode: 'OPENCODE_API_KEY',
9
- solforge: 'SOLFORGE_PRIVATE_KEY',
9
+ setu: 'SETU_PRIVATE_KEY',
10
10
  zai: 'ZAI_API_KEY',
11
11
  'zai-coding': 'ZAI_API_KEY',
12
+ moonshot: 'MOONSHOT_API_KEY',
12
13
  };
13
14
 
14
15
  export function providerEnvVar(provider: ProviderId): string {
@@ -24,19 +24,19 @@ export { validateProviderModel } from './validate.ts';
24
24
  export { estimateModelCostUsd } from './pricing.ts';
25
25
  export { providerEnvVar, readEnvKey, setEnvKey } from './env.ts';
26
26
  export {
27
- createSolforgeFetch,
28
- createSolforgeModel,
29
- fetchSolforgeBalance,
27
+ createSetuFetch,
28
+ createSetuModel,
29
+ fetchSetuBalance,
30
30
  getPublicKeyFromPrivate,
31
31
  fetchSolanaUsdcBalance,
32
- } from './solforge-client.ts';
32
+ } from './setu-client.ts';
33
33
  export type {
34
- SolforgeAuth,
35
- SolforgeProviderOptions,
36
- SolforgePaymentCallbacks,
37
- SolforgeBalanceResponse,
34
+ SetuAuth,
35
+ SetuProviderOptions,
36
+ SetuPaymentCallbacks,
37
+ SetuBalanceResponse,
38
38
  SolanaUsdcBalanceResponse,
39
- } from './solforge-client.ts';
39
+ } from './setu-client.ts';
40
40
  export {
41
41
  createOpenAIOAuthFetch,
42
42
  createOpenAIOAuthModel,
@@ -68,3 +68,5 @@ export {
68
68
  export type { OpenRouterProviderConfig } from './openrouter-client.ts';
69
69
  export { createOpencodeModel } from './opencode-client.ts';
70
70
  export type { OpencodeProviderConfig } from './opencode-client.ts';
71
+ export { createMoonshotModel } from './moonshot-client.ts';
72
+ export type { MoonshotProviderConfig } from './moonshot-client.ts';
@@ -0,0 +1,25 @@
1
+ import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
2
+ import { catalog } from './catalog-merged.ts';
3
+
4
+ export type MoonshotProviderConfig = {
5
+ apiKey?: string;
6
+ baseURL?: string;
7
+ };
8
+
9
+ export function createMoonshotModel(
10
+ model: string,
11
+ config?: MoonshotProviderConfig,
12
+ ) {
13
+ const entry = catalog.moonshot;
14
+ const baseURL = config?.baseURL || entry?.api || 'https://api.moonshot.ai/v1';
15
+ const apiKey = config?.apiKey || process.env.MOONSHOT_API_KEY || '';
16
+ const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined;
17
+
18
+ const instance = createOpenAICompatible({
19
+ name: entry?.label ?? 'Moonshot AI',
20
+ baseURL,
21
+ headers,
22
+ });
23
+
24
+ return instance(model);
25
+ }
@@ -76,7 +76,7 @@ const pricingTable: Record<ProviderName, PricingEntry[]> = {
76
76
  opencode: [
77
77
  // Pricing from catalog entries; leave empty here
78
78
  ],
79
- solforge: [
79
+ setu: [
80
80
  // Pricing from catalog entries; leave empty here
81
81
  ],
82
82
  zai: [
@@ -85,6 +85,9 @@ const pricingTable: Record<ProviderName, PricingEntry[]> = {
85
85
  'zai-coding': [
86
86
  // Pricing from catalog entries; leave empty here
87
87
  ],
88
+ moonshot: [
89
+ // Pricing from catalog entries; leave empty here
90
+ ],
88
91
  };
89
92
 
90
93
  function findPricing(
@@ -37,12 +37,12 @@ function simplifyPaymentError(errMsg: string): string {
37
37
  return short.length < errMsg.length ? `${short}...` : errMsg;
38
38
  }
39
39
 
40
- const DEFAULT_BASE_URL = 'https://router.solforge.sh';
40
+ const DEFAULT_BASE_URL = 'https://setu.agi.nitish.sh';
41
41
  const DEFAULT_RPC_URL = 'https://api.mainnet-beta.solana.com';
42
42
  const DEFAULT_MAX_ATTEMPTS = 3;
43
43
  const DEFAULT_MAX_PAYMENT_ATTEMPTS = 20;
44
44
 
45
- export type SolforgePaymentCallbacks = {
45
+ export type SetuPaymentCallbacks = {
46
46
  onPaymentRequired?: (amountUsd: number) => void;
47
47
  onPaymentSigning?: () => void;
48
48
  onPaymentComplete?: (data: {
@@ -53,19 +53,19 @@ export type SolforgePaymentCallbacks = {
53
53
  onPaymentError?: (error: string) => void;
54
54
  };
55
55
 
56
- export type SolforgeProviderOptions = {
56
+ export type SetuProviderOptions = {
57
57
  baseURL?: string;
58
58
  rpcURL?: string;
59
59
  network?: string;
60
60
  maxRequestAttempts?: number;
61
61
  maxPaymentAttempts?: number;
62
- callbacks?: SolforgePaymentCallbacks;
62
+ callbacks?: SetuPaymentCallbacks;
63
63
  providerNpm?: string;
64
64
  promptCacheKey?: string;
65
65
  promptCacheRetention?: 'in_memory' | '24h';
66
66
  };
67
67
 
68
- export type SolforgeAuth = {
68
+ export type SetuAuth = {
69
69
  privateKey: string;
70
70
  };
71
71
 
@@ -120,7 +120,7 @@ async function acquirePaymentLock(walletAddress: string): Promise<() => void> {
120
120
  paymentQueues.set(walletAddress, entry);
121
121
 
122
122
  if (existing) {
123
- console.log('[Solforge] Waiting for pending payment to complete...');
123
+ console.log('[Setu] Waiting for pending payment to complete...');
124
124
  await existing.promise;
125
125
  }
126
126
 
@@ -132,9 +132,9 @@ async function acquirePaymentLock(walletAddress: string): Promise<() => void> {
132
132
  };
133
133
  }
134
134
 
135
- export function createSolforgeFetch(
136
- auth: SolforgeAuth,
137
- options: SolforgeProviderOptions = {},
135
+ export function createSetuFetch(
136
+ auth: SetuAuth,
137
+ options: SetuProviderOptions = {},
138
138
  ): typeof fetch {
139
139
  const privateKeyBytes = bs58.decode(auth.privateKey);
140
140
  const keypair = Keypair.fromSecretKey(privateKeyBytes);
@@ -196,20 +196,18 @@ export function createSolforgeFetch(
196
196
  const requirement = pickPaymentRequirement(payload);
197
197
  if (!requirement) {
198
198
  callbacks.onPaymentError?.('Unsupported payment requirement');
199
- throw new Error('Solforge: unsupported payment requirement');
199
+ throw new Error('Setu: unsupported payment requirement');
200
200
  }
201
201
  if (attempt >= maxAttempts) {
202
202
  callbacks.onPaymentError?.('Payment failed after multiple attempts');
203
- throw new Error('Solforge: payment failed after multiple attempts');
203
+ throw new Error('Setu: payment failed after multiple attempts');
204
204
  }
205
205
 
206
206
  const currentAttempts = globalPaymentAttempts.get(walletAddress) ?? 0;
207
207
  const remainingPayments = maxPaymentAttempts - currentAttempts;
208
208
  if (remainingPayments <= 0) {
209
209
  callbacks.onPaymentError?.('Maximum payment attempts exceeded');
210
- throw new Error(
211
- 'Solforge: payment failed after maximum payment attempts.',
212
- );
210
+ throw new Error('Setu: payment failed after maximum payment attempts.');
213
211
  }
214
212
 
215
213
  const releaseLock = await acquirePaymentLock(walletAddress);
@@ -237,12 +235,12 @@ export function createSolforgeFetch(
237
235
  }
238
236
  }
239
237
 
240
- throw new Error('Solforge: max attempts exceeded');
238
+ throw new Error('Setu: max attempts exceeded');
241
239
  };
242
240
  }
243
241
 
244
242
  /**
245
- * Create a Solforge-backed AI model.
243
+ * Create a Setu-backed AI model.
246
244
  *
247
245
  * Uses native AI SDK providers:
248
246
  * - OpenAI models → /v1/responses (via @ai-sdk/openai)
@@ -250,21 +248,21 @@ export function createSolforgeFetch(
250
248
  *
251
249
  * Provider is determined by options.providerNpm from catalog.
252
250
  */
253
- export function createSolforgeModel(
251
+ export function createSetuModel(
254
252
  model: string,
255
- auth: SolforgeAuth,
256
- options: SolforgeProviderOptions = {},
253
+ auth: SetuAuth,
254
+ options: SetuProviderOptions = {},
257
255
  ) {
258
256
  const baseURL = `${trimTrailingSlash(
259
257
  options.baseURL ?? DEFAULT_BASE_URL,
260
258
  )}/v1`;
261
- const customFetch = createSolforgeFetch(auth, options);
259
+ const customFetch = createSetuFetch(auth, options);
262
260
  const providerNpm = options.providerNpm ?? '@ai-sdk/openai';
263
261
 
264
262
  if (providerNpm === '@ai-sdk/anthropic') {
265
263
  const anthropic = createAnthropic({
266
264
  baseURL,
267
- apiKey: 'solforge-wallet-auth',
265
+ apiKey: 'setu-wallet-auth',
268
266
  fetch: customFetch,
269
267
  });
270
268
  return anthropic(model);
@@ -273,7 +271,7 @@ export function createSolforgeModel(
273
271
  // Default to OpenAI
274
272
  const openai = createOpenAI({
275
273
  baseURL,
276
- apiKey: 'solforge-wallet-auth',
274
+ apiKey: 'setu-wallet-auth',
277
275
  fetch: customFetch,
278
276
  });
279
277
  return openai.responses(model);
@@ -314,7 +312,7 @@ async function handlePayment(args: {
314
312
  baseFetch: typeof fetch;
315
313
  buildWalletHeaders: () => Record<string, string>;
316
314
  maxAttempts: number;
317
- callbacks: SolforgePaymentCallbacks;
315
+ callbacks: SetuPaymentCallbacks;
318
316
  }): Promise<{ attemptsUsed: number }> {
319
317
  let attempts = 0;
320
318
  while (attempts < args.maxAttempts) {
@@ -334,12 +332,10 @@ async function handlePayment(args: {
334
332
  return { attemptsUsed: attempts };
335
333
  }
336
334
  console.log(
337
- `Solforge balance still negative (${balanceValue.toFixed(8)}). Sending another top-up...`,
335
+ `Setu balance still negative (${balanceValue.toFixed(8)}). Sending another top-up...`,
338
336
  );
339
337
  }
340
- throw new Error(
341
- `Solforge: payment failed after ${attempts} additional top-ups.`,
342
- );
338
+ throw new Error(`Setu: payment failed after ${attempts} additional top-ups.`);
343
339
  }
344
340
 
345
341
  async function processSinglePayment(args: {
@@ -349,7 +345,7 @@ async function processSinglePayment(args: {
349
345
  baseURL: string;
350
346
  baseFetch: typeof fetch;
351
347
  buildWalletHeaders: () => Record<string, string>;
352
- callbacks: SolforgePaymentCallbacks;
348
+ callbacks: SetuPaymentCallbacks;
353
349
  }): Promise<{ attempts: number; balance?: number | string }> {
354
350
  args.callbacks.onPaymentSigning?.();
355
351
 
@@ -360,7 +356,7 @@ async function processSinglePayment(args: {
360
356
  const errMsg = err instanceof Error ? err.message : String(err);
361
357
  const userMsg = `Payment failed: ${simplifyPaymentError(errMsg)}`;
362
358
  args.callbacks.onPaymentError?.(userMsg);
363
- throw new Error(`Solforge: ${userMsg}`);
359
+ throw new Error(`Setu: ${userMsg}`);
364
360
  }
365
361
  const walletHeaders = args.buildWalletHeaders();
366
362
  const headers = {
@@ -382,11 +378,11 @@ async function processSinglePayment(args: {
382
378
  response.status === 400 &&
383
379
  rawBody.toLowerCase().includes('already processed')
384
380
  ) {
385
- console.log('Solforge payment already processed; continuing.');
381
+ console.log('Setu payment already processed; continuing.');
386
382
  return { attempts: 1 };
387
383
  }
388
384
  args.callbacks.onPaymentError?.(`Topup failed: ${response.status}`);
389
- throw new Error(`Solforge topup failed (${response.status}): ${rawBody}`);
385
+ throw new Error(`Setu topup failed (${response.status}): ${rawBody}`);
390
386
  }
391
387
 
392
388
  let parsed: PaymentResponse | undefined;
@@ -411,11 +407,11 @@ async function processSinglePayment(args: {
411
407
  transactionId: parsed.transaction,
412
408
  });
413
409
  console.log(
414
- `Solforge payment complete: +$${amountUsd} (balance: $${newBalance})`,
410
+ `Setu payment complete: +$${amountUsd} (balance: $${newBalance})`,
415
411
  );
416
412
  return { attempts: 1, balance: newBalance };
417
413
  }
418
- console.log('Solforge payment complete.');
414
+ console.log('Setu payment complete.');
419
415
  return { attempts: 1 };
420
416
  }
421
417
 
@@ -452,7 +448,7 @@ async function createPaymentPayload(args: {
452
448
  } as PaymentPayload;
453
449
  }
454
450
 
455
- export type SolforgeBalanceResponse = {
451
+ export type SetuBalanceResponse = {
456
452
  walletAddress: string;
457
453
  balance: number;
458
454
  totalSpent: number;
@@ -462,10 +458,10 @@ export type SolforgeBalanceResponse = {
462
458
  lastRequest?: string;
463
459
  };
464
460
 
465
- export async function fetchSolforgeBalance(
466
- auth: SolforgeAuth,
461
+ export async function fetchSetuBalance(
462
+ auth: SetuAuth,
467
463
  baseURL?: string,
468
- ): Promise<SolforgeBalanceResponse | null> {
464
+ ): Promise<SetuBalanceResponse | null> {
469
465
  try {
470
466
  const privateKeyBytes = bs58.decode(auth.privateKey);
471
467
  const keypair = Keypair.fromSecretKey(privateKeyBytes);
@@ -531,7 +527,7 @@ export type SolanaUsdcBalanceResponse = {
531
527
  };
532
528
 
533
529
  export async function fetchSolanaUsdcBalance(
534
- auth: SolforgeAuth,
530
+ auth: SetuAuth,
535
531
  network: 'mainnet' | 'devnet' = 'mainnet',
536
532
  ): Promise<SolanaUsdcBalanceResponse | null> {
537
533
  try {
@@ -42,7 +42,7 @@ const PREFERRED_FAST_MODELS: Partial<Record<ProviderId, string[]>> = {
42
42
  'google/gemini-2.0-flash-001',
43
43
  ],
44
44
  opencode: ['claude-3-5-haiku', 'gpt-5-nano', 'gemini-3-flash'],
45
- solforge: [
45
+ setu: [
46
46
  'claude-3-5-haiku-latest',
47
47
  'claude-3-5-haiku-20241022',
48
48
  'codex-mini-latest',
@@ -13,10 +13,13 @@ export type ProviderConfig = { enabled: boolean; apiKey?: string };
13
13
  /**
14
14
  * Default settings for the CLI
15
15
  */
16
+ export type ToolApprovalMode = 'auto' | 'dangerous' | 'all';
17
+
16
18
  export type DefaultConfig = {
17
19
  agent: string;
18
20
  provider: ProviderId;
19
21
  model: string;
22
+ toolApproval?: ToolApprovalMode;
20
23
  };
21
24
 
22
25
  /**
@@ -16,4 +16,5 @@ export type {
16
16
  DefaultConfig,
17
17
  PathConfig,
18
18
  AGIConfig,
19
+ ToolApprovalMode,
19
20
  } from './config';
@@ -7,9 +7,10 @@ export type ProviderId =
7
7
  | 'google'
8
8
  | 'openrouter'
9
9
  | 'opencode'
10
- | 'solforge'
10
+ | 'setu'
11
11
  | 'zai'
12
- | 'zai-coding';
12
+ | 'zai-coding'
13
+ | 'moonshot';
13
14
 
14
15
  export type ModelProviderBinding = {
15
16
  id?: string;