pi-codebuddy-sdk 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-codebuddy-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "CodeBuddy Agent SDK provider for Pi — native tool execution, 29+ models, thinking controls, session pool",
5
5
  "author": "slahser",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -54,7 +54,7 @@ async function discoverModels(): Promise<ProviderModelConfig[]> {
54
54
  ),
55
55
  ]);
56
56
  if (models && models.length > 0) {
57
- return models.map((m) => {
57
+ let mapped = models.map((m) => {
58
58
  const caps = detectCapabilities(m.id);
59
59
  return {
60
60
  id: m.id,
@@ -66,6 +66,15 @@ async function discoverModels(): Promise<ProviderModelConfig[]> {
66
66
  maxTokens: caps.maxTokens,
67
67
  };
68
68
  });
69
+ // Sort Hunyuan first — this model is the fallback when quota is constrained.
70
+ // Pi auto-selects the first model, so this prevents "CLI process stdout closed"
71
+ // errors from models without token quota.
72
+ mapped.sort((a, b) => {
73
+ const aHy = a.id.includes('hy') || a.name.includes('Hunyuan') ? 0 : 1;
74
+ const bHy = b.id.includes('hy') || b.name.includes('Hunyuan') ? 0 : 1;
75
+ return aHy - bHy;
76
+ });
77
+ return mapped;
69
78
  }
70
79
  } catch (e) {
71
80
  // Discovery failed — SDK not installed, CLI missing, or network issue.