@adversity/coding-tool-x 3.0.2 → 3.0.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.
- package/CHANGELOG.md +15 -0
- package/dist/web/assets/index-Bpjcdalh.js +14 -0
- package/dist/web/assets/{index-TjhcaFRe.css → index-CB782_71.css} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/config/default.js +2 -9
- package/src/config/model-pricing.js +105 -0
- package/src/server/api/workspaces.js +5 -3
- package/src/server/codex-proxy-server.js +53 -36
- package/src/server/proxy-server.js +2 -13
- package/src/server/services/mcp-client.js +17 -2
- package/src/server/services/model-detector.js +62 -15
- package/src/server/services/workspace-service.js +126 -5
- package/src/server/utils/pricing.js +13 -3
- package/dist/web/assets/index-DfPKAt9R.js +0 -14
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { loadConfig } = require('../../config/loader');
|
|
2
2
|
const DEFAULT_CONFIG = require('../../config/default');
|
|
3
|
+
const { CLAUDE_MODEL_PRICING, CLAUDE_MODEL_ALIASES } = require('../../config/model-pricing');
|
|
3
4
|
|
|
4
5
|
const RATE_KEYS = ['input', 'output', 'cacheCreation', 'cacheRead', 'cached', 'reasoning'];
|
|
5
6
|
|
|
@@ -39,7 +40,7 @@ function resolvePricing(toolKey, modelPricing = {}, defaultPricing = {}) {
|
|
|
39
40
|
function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPricing = {}) {
|
|
40
41
|
const config = getPricingConfig(toolKey);
|
|
41
42
|
|
|
42
|
-
// 1. Check
|
|
43
|
+
// 1. Check user custom config for specific model first
|
|
43
44
|
const modelConfig = config?.models?.[model];
|
|
44
45
|
if (modelConfig && modelConfig.mode === 'custom') {
|
|
45
46
|
const result = { ...hardcodedPricing };
|
|
@@ -51,7 +52,7 @@ function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPrici
|
|
|
51
52
|
return result;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
// 2.
|
|
55
|
+
// 2. Check user custom config for tool-level
|
|
55
56
|
if (config && config.mode === 'custom') {
|
|
56
57
|
const result = { ...hardcodedPricing };
|
|
57
58
|
RATE_KEYS.forEach((key) => {
|
|
@@ -62,7 +63,16 @@ function resolveModelPricing(toolKey, model, hardcodedPricing = {}, defaultPrici
|
|
|
62
63
|
return result;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
// 3. Use hardcoded pricing
|
|
66
|
+
// 3. Use centralized hardcoded pricing for known models (mode: 'auto')
|
|
67
|
+
// Normalize model name using aliases
|
|
68
|
+
const normalizedModel = CLAUDE_MODEL_ALIASES[model] || model;
|
|
69
|
+
const centralizedPricing = CLAUDE_MODEL_PRICING[normalizedModel];
|
|
70
|
+
|
|
71
|
+
if (centralizedPricing) {
|
|
72
|
+
return { ...defaultPricing, ...centralizedPricing };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 4. Fall back to base pricing for unknown models
|
|
66
76
|
return { ...defaultPricing, ...hardcodedPricing };
|
|
67
77
|
}
|
|
68
78
|
|