staffos 0.1.7 → 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 +56 -14
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -123,36 +123,78 @@ 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
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
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)
|
|
179
|
+
if (process.env.ANTIGRAVITY_AGENT === '1' || process.env.ANTIGRAVITY_PROJECT_ID) {
|
|
180
|
+
return { key: 'gemini-flash', reason: 'ejecutando en entorno Antigravity 2.0' };
|
|
139
181
|
}
|
|
140
182
|
if (process.env.CODEX === 'true' || process.env.CODEX_AGENT) {
|
|
141
|
-
return { key: 'gpt-5.5', reason: '
|
|
183
|
+
return { key: 'gpt-5.5', reason: 'ejecutando en entorno OpenAI Codex' };
|
|
142
184
|
}
|
|
143
185
|
if (process.env.OPENCODE === 'true') {
|
|
144
|
-
return { key: 'gemini-pro', reason: '
|
|
186
|
+
return { key: 'gemini-pro', reason: 'ejecutando en entorno OpenCode' };
|
|
145
187
|
}
|
|
146
188
|
|
|
147
|
-
// Heuristic 2: Directory structures
|
|
148
|
-
if (fs.existsSync(path.join(targetDir, '.
|
|
149
|
-
return { key: 'gemini-
|
|
189
|
+
// Heuristic 2: Directory structures (Fallback if no env var is present)
|
|
190
|
+
if (fs.existsSync(path.join(targetDir, '.gemini')) || fs.existsSync(path.join(targetDir, 'adapters/antigravity'))) {
|
|
191
|
+
return { key: 'gemini-flash', reason: 'directorio de integración de Antigravity 2.0 detectado' };
|
|
150
192
|
}
|
|
151
193
|
if (fs.existsSync(path.join(targetDir, 'adapters/codex')) || fs.existsSync(path.join(targetDir, 'codex.json'))) {
|
|
152
|
-
return { key: 'gpt-5.5', reason: '
|
|
194
|
+
return { key: 'gpt-5.5', reason: 'directorio de integración de Codex detectado' };
|
|
153
195
|
}
|
|
154
|
-
if (fs.existsSync(path.join(targetDir, '.
|
|
155
|
-
return { key: 'gemini-
|
|
196
|
+
if (fs.existsSync(path.join(targetDir, '.opencode')) || fs.existsSync(path.join(targetDir, 'opencode.json')) || fs.existsSync(path.join(targetDir, 'opencode.jsonc'))) {
|
|
197
|
+
return { key: 'gemini-pro', reason: 'directorio de integración de OpenCode detectado' };
|
|
156
198
|
}
|
|
157
199
|
if (fs.existsSync(path.join(targetDir, '.claudecode'))) {
|
|
158
200
|
return { key: 'claude-sonnet', reason: 'directorio .claudecode detectado' };
|