staffos 0.1.8 → 0.1.9
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/bin/cli.js +46 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -123,17 +123,59 @@ function getFilesRecursive(dir, fileList = []) {
|
|
|
123
123
|
|
|
124
124
|
// Model Pricing Registry (2026 Standard Rates per 1M tokens)
|
|
125
125
|
const modelsPricing = {
|
|
126
|
-
'claude-sonnet': { name: 'Claude 4.8 Sonnet', input: 3.00, output: 15.00 },
|
|
127
|
-
'claude-opus': { name: 'Claude 4.8 Opus', input: 15.00, output: 75.00 },
|
|
126
|
+
'claude-sonnet': { name: 'Claude 4.8 / 4.6 Sonnet', input: 3.00, output: 15.00 },
|
|
127
|
+
'claude-opus': { name: 'Claude 4.8 / 4.7 Opus', input: 15.00, output: 75.00 },
|
|
128
128
|
'gemini-pro': { name: 'Gemini 3.1 Pro (OpenCode)', input: 2.00, output: 12.00 },
|
|
129
129
|
'gemini-flash': { name: 'Gemini 3.5 Flash (Antigravity 2.0)', input: 0.075, output: 0.30 },
|
|
130
|
-
'gpt-5.5': { name: 'GPT 5.5 (Codex)', input: 5.00, output: 30.00 },
|
|
130
|
+
'gpt-5.5': { name: 'GPT 5.5 / 5.4 (Codex)', input: 5.00, output: 30.00 },
|
|
131
131
|
'local': { name: 'Modelos Locales (Ollama/DeepSeek)', input: 0.00, output: 0.00 }
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
// Parse active configuration files
|
|
135
|
+
function detectModelFromConfigFile() {
|
|
136
|
+
// 1. Check staffos.json config override
|
|
137
|
+
const staffosPath = path.join(targetDir, 'staffos.json');
|
|
138
|
+
if (fs.existsSync(staffosPath)) {
|
|
139
|
+
try {
|
|
140
|
+
const config = JSON.parse(fs.readFileSync(staffosPath, 'utf8'));
|
|
141
|
+
if (config.model) {
|
|
142
|
+
const m = config.model.toLowerCase();
|
|
143
|
+
if (modelsPricing[m]) {
|
|
144
|
+
return { key: m, reason: 'configuración de staffos.json especificada' };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (e) {}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 2. Check opencode.json config settings
|
|
151
|
+
const opencodePath = path.join(targetDir, 'opencode.json');
|
|
152
|
+
if (fs.existsSync(opencodePath)) {
|
|
153
|
+
try {
|
|
154
|
+
const config = JSON.parse(fs.readFileSync(opencodePath, 'utf8'));
|
|
155
|
+
const model = config.model || (config.agent && config.agent.model);
|
|
156
|
+
if (model && typeof model === 'string') {
|
|
157
|
+
const m = model.toLowerCase();
|
|
158
|
+
if (m.includes('gemini-3.1-pro') || m.includes('gemini-pro')) return { key: 'gemini-pro', reason: 'detectado en opencode.json' };
|
|
159
|
+
if (m.includes('gemini-3.5-flash') || m.includes('gemini-flash')) return { key: 'gemini-flash', reason: 'detectado en opencode.json' };
|
|
160
|
+
if (m.includes('gpt-5') || m.includes('gpt-5.4') || m.includes('gpt-5.5')) return { key: 'gpt-5.5', reason: 'detectado en opencode.json' };
|
|
161
|
+
if (m.includes('claude-4.6') || m.includes('claude-4.8') || m.includes('sonnet')) return { key: 'claude-sonnet', reason: 'detectado en opencode.json' };
|
|
162
|
+
if (m.includes('opus')) return { key: 'claude-opus', reason: 'detectado en opencode.json' };
|
|
163
|
+
}
|
|
164
|
+
} catch (e) {}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
134
170
|
// Auto-detect the active AI environment
|
|
135
171
|
function detectActiveAI() {
|
|
136
|
-
//
|
|
172
|
+
// Check config files first (since they explicitly override workspace defaults)
|
|
173
|
+
const fileConfig = detectModelFromConfigFile();
|
|
174
|
+
if (fileConfig) {
|
|
175
|
+
return fileConfig;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Heuristic 1: Active Runtime Environment Variables (High Priority)
|
|
137
179
|
if (process.env.ANTIGRAVITY_AGENT === '1' || process.env.ANTIGRAVITY_PROJECT_ID) {
|
|
138
180
|
return { key: 'gemini-flash', reason: 'ejecutando en entorno Antigravity 2.0' };
|
|
139
181
|
}
|