@agi-cli/sdk 0.1.140 → 0.1.141

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": "@agi-cli/sdk",
3
- "version": "0.1.140",
3
+ "version": "0.1.141",
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 },
@@ -27,6 +28,7 @@ const DEFAULTS: {
27
28
  solforge: { 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
  };
@@ -35,7 +35,8 @@ export type ProviderName =
35
35
  | 'opencode'
36
36
  | 'solforge'
37
37
  | 'zai'
38
- | 'zai-coding';
38
+ | 'zai-coding'
39
+ | 'moonshot';
39
40
 
40
41
  export type ModelConfig = {
41
42
  apiKey?: string;
@@ -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
@@ -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
 
@@ -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>>;
@@ -9,6 +9,7 @@ const ENV_VARS: Record<ProviderId, string> = {
9
9
  solforge: 'SOLFORGE_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 {
@@ -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
+ }
@@ -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(
@@ -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';
@@ -9,7 +9,8 @@ export type ProviderId =
9
9
  | 'opencode'
10
10
  | 'solforge'
11
11
  | 'zai'
12
- | 'zai-coding';
12
+ | 'zai-coding'
13
+ | 'moonshot';
13
14
 
14
15
  export type ModelProviderBinding = {
15
16
  id?: string;