@phi-code-admin/phi-code 0.60.3 → 0.60.5

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.
@@ -37,6 +37,38 @@ interface RoutingConfig {
37
37
  default: { model: string; agent: string | null };
38
38
  }
39
39
 
40
+ // ─── Model Database ─────────────────────────────────────────────────────
41
+
42
+ const MODEL_DB: Record<string, { contextWindow: number; maxTokens: number; reasoning: boolean }> = {
43
+ // Alibaba / DashScope
44
+ "qwen3.5-plus": { contextWindow: 1000000, maxTokens: 16384, reasoning: true },
45
+ "qwen3-max-2026-01-23": { contextWindow: 262144, maxTokens: 16384, reasoning: true },
46
+ "qwen3-coder-plus": { contextWindow: 1000000, maxTokens: 16384, reasoning: true },
47
+ "qwen3-coder-next": { contextWindow: 1000000, maxTokens: 16384, reasoning: true },
48
+ "kimi-k2.5": { contextWindow: 262144, maxTokens: 16384, reasoning: true },
49
+ "glm-5": { contextWindow: 200000, maxTokens: 128000, reasoning: true },
50
+ "glm-4.7": { contextWindow: 200000, maxTokens: 128000, reasoning: true },
51
+ "MiniMax-M2.5": { contextWindow: 1000000, maxTokens: 16384, reasoning: true },
52
+ // OpenAI
53
+ "gpt-4o": { contextWindow: 128000, maxTokens: 16384, reasoning: false },
54
+ "gpt-4o-mini": { contextWindow: 128000, maxTokens: 16384, reasoning: false },
55
+ "o1": { contextWindow: 200000, maxTokens: 100000, reasoning: true },
56
+ "o3-mini": { contextWindow: 200000, maxTokens: 100000, reasoning: true },
57
+ // Anthropic
58
+ "claude-sonnet-4-20250514": { contextWindow: 200000, maxTokens: 64000, reasoning: true },
59
+ "claude-3-5-haiku-20241022": { contextWindow: 200000, maxTokens: 8192, reasoning: false },
60
+ // Google
61
+ "gemini-2.5-pro": { contextWindow: 1000000, maxTokens: 65536, reasoning: true },
62
+ "gemini-2.5-flash": { contextWindow: 1000000, maxTokens: 65536, reasoning: true },
63
+ // Groq
64
+ "llama-3.3-70b-versatile": { contextWindow: 128000, maxTokens: 32768, reasoning: false },
65
+ "mixtral-8x7b-32768": { contextWindow: 32768, maxTokens: 4096, reasoning: false },
66
+ };
67
+
68
+ function getModelSpec(id: string): { contextWindow: number; maxTokens: number; reasoning: boolean } {
69
+ return MODEL_DB[id] || { contextWindow: 128000, maxTokens: 16384, reasoning: true };
70
+ }
71
+
40
72
  // ─── Provider Detection ──────────────────────────────────────────────────
41
73
 
42
74
  function detectProviders(): DetectedProvider[] {
@@ -698,14 +730,17 @@ _Edit this file to customize Phi Code's behavior for your project._
698
730
  baseUrl: chosen.baseUrl,
699
731
  api: "openai-completions",
700
732
  apiKey: apiKey.trim(),
701
- models: chosen.models.map((id: string) => ({
702
- id,
703
- name: id,
704
- reasoning: true,
705
- input: ["text"],
706
- contextWindow: 131072,
707
- maxTokens: 16384,
708
- })),
733
+ models: chosen.models.map((id: string) => {
734
+ const spec = getModelSpec(id);
735
+ return {
736
+ id,
737
+ name: id,
738
+ reasoning: spec.reasoning,
739
+ input: ["text"],
740
+ contextWindow: spec.contextWindow,
741
+ maxTokens: spec.maxTokens,
742
+ };
743
+ }),
709
744
  };
710
745
 
711
746
  await writeFile(modelsJsonPath, JSON.stringify(modelsConfig, null, 2), "utf-8");
@@ -913,10 +948,13 @@ For persistence, set environment variables:
913
948
  baseUrl: providerDef.baseUrl,
914
949
  api: "openai-completions",
915
950
  apiKey: key,
916
- models: providerDef.models.map((id: string) => ({
917
- id, name: id, reasoning: true, input: ["text"],
918
- contextWindow: 131072, maxTokens: 16384,
919
- })),
951
+ models: providerDef.models.map((id: string) => {
952
+ const spec = getModelSpec(id);
953
+ return {
954
+ id, name: id, reasoning: spec.reasoning, input: ["text"],
955
+ contextWindow: spec.contextWindow, maxTokens: spec.maxTokens,
956
+ };
957
+ }),
920
958
  };
921
959
  writeFileSync(modelsJsonPath, JSON.stringify(modelsConfig, null, 2), "utf-8");
922
960
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.60.3",
3
+ "version": "0.60.5",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {