@qmediat.io/gemini-code-context-mcp 1.21.0 → 1.22.1
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 +91 -1
- package/dist/cache/caching-mode.d.ts +40 -0
- package/dist/cache/caching-mode.d.ts.map +1 -0
- package/dist/cache/caching-mode.js +38 -0
- package/dist/cache/caching-mode.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/gemini/model-registry.d.ts +5 -0
- package/dist/gemini/model-registry.d.ts.map +1 -1
- package/dist/gemini/model-registry.js +70 -20
- package/dist/gemini/model-registry.js.map +1 -1
- package/dist/gemini/model-taxonomy.d.ts.map +1 -1
- package/dist/gemini/model-taxonomy.js +7 -0
- package/dist/gemini/model-taxonomy.js.map +1 -1
- package/dist/gemini/models.d.ts.map +1 -1
- package/dist/gemini/models.js +1 -0
- package/dist/gemini/models.js.map +1 -1
- package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
- package/dist/tools/ask-agentic.tool.js +16 -13
- package/dist/tools/ask-agentic.tool.js.map +1 -1
- package/dist/tools/ask.tool.d.ts.map +1 -1
- package/dist/tools/ask.tool.js +10 -11
- package/dist/tools/ask.tool.js.map +1 -1
- package/dist/tools/code.tool.d.ts.map +1 -1
- package/dist/tools/code.tool.js +11 -15
- package/dist/tools/code.tool.js.map +1 -1
- package/dist/tools/shared/abort-timeout.d.ts +6 -0
- package/dist/tools/shared/abort-timeout.d.ts.map +1 -1
- package/dist/tools/shared/abort-timeout.js +12 -5
- package/dist/tools/shared/abort-timeout.js.map +1 -1
- package/dist/tools/shared/stream-collector.js +1 -1
- package/dist/tools/shared/stream-collector.js.map +1 -1
- package/dist/tools/status.tool.d.ts.map +1 -1
- package/dist/tools/status.tool.js +2 -1
- package/dist/tools/status.tool.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/cost-estimator.d.ts +58 -4
- package/dist/utils/cost-estimator.d.ts.map +1 -1
- package/dist/utils/cost-estimator.js +218 -60
- package/dist/utils/cost-estimator.js.map +1 -1
- package/dist/utils/pricing-overrides.d.ts +10 -0
- package/dist/utils/pricing-overrides.d.ts.map +1 -0
- package/dist/utils/pricing-overrides.js +104 -0
- package/dist/utils/pricing-overrides.js.map +1 -0
- package/package.json +8 -2
|
@@ -1,73 +1,213 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Approximate cost estimator for reporting (not billing authoritative).
|
|
3
3
|
*
|
|
4
|
-
* Rates are per million tokens
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Rates are per million tokens, Standard tier, the rates of Google's pricing page
|
|
5
|
+
* (https://ai.google.dev/gemini-api/docs/pricing, read 2026-10-16) with the dates
|
|
6
|
+
* they take effect. Where the page has a prompt-size tier (≤ 200k / > 200k tokens)
|
|
7
|
+
* the dearer tier is the row: the estimator does not see the prompt's size, so the
|
|
8
|
+
* row stays an upper bound. An unpriced id takes the dearest row of its category.
|
|
9
|
+
* `GEMINI_PRICING_OVERRIDES` (JSON, keyed by model id) replaces a row at run time.
|
|
7
10
|
*/
|
|
11
|
+
import { categorizeModel, costTierOf, isTextGenCategory } from '../gemini/model-taxonomy.js';
|
|
12
|
+
import { parsePricingOverrides } from './pricing-overrides.js';
|
|
13
|
+
const FLASH_3X = {
|
|
14
|
+
inputPerMillion: 0.75,
|
|
15
|
+
outputPerMillion: 3.75,
|
|
16
|
+
cachedInputPerMillion: 0.075,
|
|
17
|
+
next: {
|
|
18
|
+
from: '2027-01-01',
|
|
19
|
+
inputPerMillion: 1.5,
|
|
20
|
+
outputPerMillion: 7.5,
|
|
21
|
+
cachedInputPerMillion: 0.15,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
/** The > 200k-token tier of the 3.x Pro previews (≤ 200k: 2 / 12 / 0.2). */
|
|
25
|
+
const PRO_3X_PREVIEW = {
|
|
26
|
+
inputPerMillion: 4,
|
|
27
|
+
outputPerMillion: 18,
|
|
28
|
+
cachedInputPerMillion: 0.4,
|
|
29
|
+
};
|
|
30
|
+
/** The 3.1 Flash-Lite rates; the page prices the model once, GA and preview ids alike. */
|
|
31
|
+
const FLASH_LITE_31 = {
|
|
32
|
+
inputPerMillion: 0.25,
|
|
33
|
+
outputPerMillion: 1.5,
|
|
34
|
+
cachedInputPerMillion: 0.025,
|
|
35
|
+
};
|
|
8
36
|
const DEFAULT_PRICING = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
37
|
+
'gemini-4-argon': {
|
|
38
|
+
inputPerMillion: 2,
|
|
39
|
+
outputPerMillion: 10,
|
|
40
|
+
cachedInputPerMillion: 0.1,
|
|
41
|
+
next: {
|
|
42
|
+
from: '2026-12-01',
|
|
43
|
+
inputPerMillion: 4,
|
|
44
|
+
outputPerMillion: 20,
|
|
45
|
+
cachedInputPerMillion: 0.2,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
'gemini-3-pro-preview': PRO_3X_PREVIEW,
|
|
49
|
+
'gemini-3.1-pro-preview': PRO_3X_PREVIEW,
|
|
50
|
+
'gemini-3.8-flash': FLASH_3X,
|
|
51
|
+
'gemini-3.7-flash': FLASH_3X,
|
|
52
|
+
'gemini-3.6-flash': FLASH_3X,
|
|
53
|
+
'gemini-3-flash-preview': {
|
|
54
|
+
inputPerMillion: 0.5,
|
|
55
|
+
outputPerMillion: 3,
|
|
56
|
+
cachedInputPerMillion: 0.05,
|
|
57
|
+
},
|
|
58
|
+
// The page lists it as `gemini-3.1-flash-image` (text input / text and thinking output).
|
|
59
|
+
'gemini-3.1-flash-image-preview': { inputPerMillion: 0.5, outputPerMillion: 3 },
|
|
60
|
+
'gemini-3.5-flash-lite': {
|
|
61
|
+
inputPerMillion: 0.3,
|
|
62
|
+
outputPerMillion: 2.5,
|
|
63
|
+
cachedInputPerMillion: 0.03,
|
|
64
|
+
},
|
|
65
|
+
'gemini-3.1-flash-lite': FLASH_LITE_31,
|
|
66
|
+
'gemini-3.1-flash-lite-preview': FLASH_LITE_31,
|
|
67
|
+
// The > 200k-token tier (≤ 200k: 1.25 / 10 / 0.125).
|
|
68
|
+
'gemini-2.5-pro': { inputPerMillion: 2.5, outputPerMillion: 15, cachedInputPerMillion: 0.25 },
|
|
69
|
+
'gemini-2.5-flash': { inputPerMillion: 0.3, outputPerMillion: 2.5, cachedInputPerMillion: 0.03 },
|
|
70
|
+
'gemini-2.5-flash-lite': {
|
|
71
|
+
inputPerMillion: 0.1,
|
|
72
|
+
outputPerMillion: 0.4,
|
|
73
|
+
cachedInputPerMillion: 0.01,
|
|
74
|
+
},
|
|
18
75
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
overrides = {};
|
|
39
|
-
}
|
|
40
|
-
return overrides;
|
|
76
|
+
/**
|
|
77
|
+
* Google's rolling aliases and the versioned id each served on 2026-10-16 (measured
|
|
78
|
+
* by the response's `modelVersion`; re-measure when Google moves them). The target
|
|
79
|
+
* only names the category: Google can move an alias to a dearer model between two
|
|
80
|
+
* measurements, so an alias prices at the dearest rate of its target's category.
|
|
81
|
+
*/
|
|
82
|
+
// Exported for the tests, which check every target is a priced id.
|
|
83
|
+
export const ALIAS_TARGET = {
|
|
84
|
+
'gemini-pro-latest': 'gemini-3.1-pro-preview',
|
|
85
|
+
'gemini-flash-latest': 'gemini-3.8-flash',
|
|
86
|
+
'gemini-flash-lite-latest': 'gemini-3.5-flash-lite',
|
|
87
|
+
};
|
|
88
|
+
/** `record[key]` when `key` is the record's own (never a prototype member such as `constructor`). */
|
|
89
|
+
function own(record, key) {
|
|
90
|
+
return Object.hasOwn(record, key) ? record[key] : undefined;
|
|
91
|
+
}
|
|
92
|
+
/** The ids the table prices (an alias is never one of them). Exported for the tests. */
|
|
93
|
+
export function isPricedId(id) {
|
|
94
|
+
return own(DEFAULT_PRICING, id) !== undefined;
|
|
41
95
|
}
|
|
42
96
|
/**
|
|
43
|
-
* Conservative defaults for models we've never seen — one for each tier
|
|
44
|
-
*
|
|
97
|
+
* Conservative defaults for models we've never seen — one for each cost tier
|
|
98
|
+
* the taxonomy assigns, plus an "unknown premium" fallback that assumes the
|
|
45
99
|
* highest rate we know of. The goal is to over-estimate cost for a brand-new
|
|
46
100
|
* model so a budget-capped user gets blocked at the cap instead of silently
|
|
47
101
|
* overshooting it while we wait for a pricing-table update.
|
|
48
102
|
*/
|
|
49
103
|
const UNKNOWN_PREMIUM_RATE = { inputPerMillion: 10.5, outputPerMillion: 30 };
|
|
50
|
-
const UNKNOWN_PRO_RATE = { inputPerMillion: 3.5, outputPerMillion: 10.5 };
|
|
51
104
|
const UNKNOWN_FLASH_RATE = { inputPerMillion: 0.3, outputPerMillion: 2.5 };
|
|
52
105
|
const UNKNOWN_LITE_RATE = { inputPerMillion: 0.1, outputPerMillion: 0.4 };
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
106
|
+
/**
|
|
107
|
+
* The conservative rate per cost tier, for a model outside the text categories
|
|
108
|
+
* (image, audio, video, agent, unknown): the table prices no such family it could
|
|
109
|
+
* stand for, so a `premium` one gets the highest rate we know of.
|
|
110
|
+
*/
|
|
111
|
+
const UNKNOWN_RATE_BY_TIER = {
|
|
112
|
+
premium: UNKNOWN_PREMIUM_RATE,
|
|
113
|
+
standard: UNKNOWN_FLASH_RATE,
|
|
114
|
+
budget: UNKNOWN_LITE_RATE,
|
|
115
|
+
unknown: UNKNOWN_PREMIUM_RATE,
|
|
116
|
+
};
|
|
117
|
+
/** The cached-input rate a row bills: its own, else the 0.25× input default. */
|
|
118
|
+
function cachedRate(row) {
|
|
119
|
+
return row.cachedInputPerMillion ?? row.inputPerMillion * 0.25;
|
|
120
|
+
}
|
|
121
|
+
/** The UTC calendar date of `at`, `YYYY-MM-DD`. */
|
|
122
|
+
function utcDate(at) {
|
|
123
|
+
return at.toISOString().slice(0, 10);
|
|
124
|
+
}
|
|
125
|
+
/** The highest of two rate sets, per component. */
|
|
126
|
+
function dearerRates(a, b) {
|
|
127
|
+
return {
|
|
128
|
+
inputPerMillion: Math.max(a.inputPerMillion, b.inputPerMillion),
|
|
129
|
+
outputPerMillion: Math.max(a.outputPerMillion, b.outputPerMillion),
|
|
130
|
+
cachedInputPerMillion: Math.max(cachedRate(a), cachedRate(b)),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** The rates of `entry` in force at `at`: its `next` rates from their UTC date on. */
|
|
134
|
+
function ratesAt(entry, at) {
|
|
135
|
+
const next = entry.next;
|
|
136
|
+
if (next === undefined || utcDate(at) < next.from)
|
|
137
|
+
return entry;
|
|
138
|
+
return next;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The dearest rates `entry` bills at `at` or at any later dated change, per component:
|
|
142
|
+
* what a call that may settle at any time from `at` on can cost.
|
|
143
|
+
*/
|
|
144
|
+
function dearestEverRates(entry, at) {
|
|
145
|
+
const next = entry.next;
|
|
146
|
+
if (next === undefined || utcDate(at) >= next.from)
|
|
147
|
+
return ratesAt(entry, at);
|
|
148
|
+
return dearerRates(entry, next);
|
|
149
|
+
}
|
|
150
|
+
/** The rates of `entry` for `moment`. */
|
|
151
|
+
function ratesFor(entry, moment) {
|
|
152
|
+
return moment.onward ? dearestEverRates(entry, moment.at) : ratesAt(entry, moment.at);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The dearest rate `rows` have for `moment` in a text category, per component (the
|
|
156
|
+
* highest input, output and cached rate of its rows): an upper bound for an unpriced
|
|
157
|
+
* model or an alias of that category, or `undefined` for a category no text row prices.
|
|
158
|
+
*/
|
|
159
|
+
function dearestTextRate(category, moment, rows) {
|
|
160
|
+
if (!isTextGenCategory(category))
|
|
161
|
+
return undefined;
|
|
162
|
+
let held;
|
|
163
|
+
for (const [id, entry] of Object.entries(rows)) {
|
|
164
|
+
if (categorizeModel(id) !== category)
|
|
165
|
+
continue;
|
|
166
|
+
const row = ratesFor(entry, moment);
|
|
167
|
+
held = held === undefined ? row : dearerRates(held, row);
|
|
168
|
+
}
|
|
169
|
+
return held;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The row that prices `model`, or `undefined` when its category's bound applies:
|
|
173
|
+
* an override of the id itself; for an alias, its target's override (an alias never
|
|
174
|
+
* prices as a row — neither its own nor its target's); else the id's row.
|
|
175
|
+
*/
|
|
176
|
+
export function pricedRow(model, src) {
|
|
177
|
+
const override = own(src.overrides, model);
|
|
178
|
+
if (override !== undefined)
|
|
179
|
+
return override;
|
|
180
|
+
const target = own(src.aliasTarget, model);
|
|
181
|
+
if (target !== undefined)
|
|
182
|
+
return own(src.overrides, target);
|
|
183
|
+
return own(src.rows, model);
|
|
184
|
+
}
|
|
185
|
+
let loaded = null;
|
|
186
|
+
function loadPricing() {
|
|
187
|
+
if (loaded !== null)
|
|
188
|
+
return loaded;
|
|
189
|
+
const overrides = parsePricingOverrides(process.env.GEMINI_PRICING_OVERRIDES);
|
|
190
|
+
const boundRows = Object.assign(Object.create(null), DEFAULT_PRICING);
|
|
191
|
+
for (const [id, entry] of Object.entries(overrides)) {
|
|
192
|
+
// An alias never prices as a row, so its override never sets a category's bound.
|
|
193
|
+
if (own(ALIAS_TARGET, id) === undefined)
|
|
194
|
+
boundRows[id] = entry;
|
|
195
|
+
}
|
|
196
|
+
loaded = { sources: { overrides, aliasTarget: ALIAS_TARGET, rows: DEFAULT_PRICING }, boundRows };
|
|
197
|
+
return loaded;
|
|
198
|
+
}
|
|
199
|
+
function pricingFor(model, moment) {
|
|
200
|
+
const { sources, boundRows } = loadPricing();
|
|
201
|
+
const row = pricedRow(model, sources);
|
|
202
|
+
if (row)
|
|
203
|
+
return ratesFor(row, moment);
|
|
204
|
+
// An alias or an unpriced text model: the dearest rate of its category (an alias's
|
|
205
|
+
// is its measured target's). Anything else: the conservative rate of its cost tier —
|
|
206
|
+
// a model the taxonomy cannot place gets the premium rate rather than flash: better
|
|
207
|
+
// to block an over-budget user than let a never-seen model undercharge past the cap.
|
|
208
|
+
const categoryId = own(sources.aliasTarget, model) ?? model;
|
|
209
|
+
const bound = dearestTextRate(categorizeModel(categoryId), moment, boundRows);
|
|
210
|
+
return bound ?? UNKNOWN_RATE_BY_TIER[costTierOf(categoryId)];
|
|
71
211
|
}
|
|
72
212
|
/** Google's flex tier is billed at half the standard price for the same model. */
|
|
73
213
|
export const FLEX_PRICE_FACTOR = 0.5;
|
|
@@ -76,10 +216,12 @@ function tierFactor(tier) {
|
|
|
76
216
|
}
|
|
77
217
|
/** Estimated cost in USD (float). Multiply by 1e6 for micros before storing. */
|
|
78
218
|
export function estimateCostUsd(input) {
|
|
79
|
-
|
|
80
|
-
|
|
219
|
+
return costFor(input, { at: input.at ?? new Date(), onward: false });
|
|
220
|
+
}
|
|
221
|
+
function costFor(input, moment) {
|
|
222
|
+
const p = pricingFor(input.model, moment);
|
|
81
223
|
const uncached = (input.uncachedInputTokens / 1_000_000) * p.inputPerMillion;
|
|
82
|
-
const cached = (input.cachedInputTokens / 1_000_000) * cachedRate;
|
|
224
|
+
const cached = (input.cachedInputTokens / 1_000_000) * cachedRate(p);
|
|
83
225
|
const output = (input.outputTokens / 1_000_000) * p.outputPerMillion;
|
|
84
226
|
// Thinking tokens are currently billed as output tokens on Gemini Pro family.
|
|
85
227
|
const thinking = input.thinkingTokens
|
|
@@ -87,6 +229,20 @@ export function estimateCostUsd(input) {
|
|
|
87
229
|
: 0;
|
|
88
230
|
return (uncached + cached + output + thinking) * tierFactor(input.serviceTier);
|
|
89
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* A reservation for a call that may run up to `coverMs` (its timeout; `null`: none):
|
|
234
|
+
* the dearer of the cost at the rates in force at its start and at the end of that
|
|
235
|
+
* window, so a call that crosses a price change settles at or under what it reserved.
|
|
236
|
+
* A call without a timeout reserves at the dearest rate, per component, of every rate
|
|
237
|
+
* in force from its start on.
|
|
238
|
+
*/
|
|
239
|
+
export function estimateReservationUsd(input, coverMs) {
|
|
240
|
+
const start = input.at ?? new Date();
|
|
241
|
+
if (coverMs === null)
|
|
242
|
+
return costFor(input, { at: start, onward: true });
|
|
243
|
+
const end = new Date(start.getTime() + coverMs);
|
|
244
|
+
return Math.max(costFor(input, { at: start, onward: false }), costFor(input, { at: end, onward: false }));
|
|
245
|
+
}
|
|
90
246
|
export function toMicrosUsd(dollars) {
|
|
91
247
|
return Math.round(dollars * 1_000_000);
|
|
92
248
|
}
|
|
@@ -102,14 +258,16 @@ export function toMicrosUsd(dollars) {
|
|
|
102
258
|
export function estimatePreCallCostUsd(input) {
|
|
103
259
|
const workspaceTokens = Math.ceil(Math.max(0, input.workspaceBytes) / 4);
|
|
104
260
|
const promptTokens = Math.ceil(Math.max(0, input.promptChars) / 4);
|
|
105
|
-
|
|
261
|
+
const call = {
|
|
106
262
|
model: input.model,
|
|
107
263
|
serviceTier: input.serviceTier,
|
|
108
264
|
uncachedInputTokens: workspaceTokens + promptTokens + Math.max(0, input.extraInputTokens ?? 0),
|
|
109
265
|
cachedInputTokens: 0,
|
|
110
266
|
outputTokens: Math.max(0, input.expectedOutputTokens),
|
|
267
|
+
at: input.at,
|
|
111
268
|
...(input.thinkingTokens !== undefined ? { thinkingTokens: input.thinkingTokens } : {}),
|
|
112
|
-
}
|
|
269
|
+
};
|
|
270
|
+
return estimateReservationUsd(call, input.coverMs);
|
|
113
271
|
}
|
|
114
272
|
/**
|
|
115
273
|
* Raw conversion: `micros → dollars` as a full-precision float. Sub-cent values
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-estimator.js","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cost-estimator.js","sourceRoot":"","sources":["../../src/utils/cost-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAoB/D,MAAM,QAAQ,GAAiB;IAC7B,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,qBAAqB,EAAE,KAAK;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,eAAe,EAAE,GAAG;QACpB,gBAAgB,EAAE,GAAG;QACrB,qBAAqB,EAAE,IAAI;KAC5B;CACF,CAAC;AAEF,4EAA4E;AAC5E,MAAM,cAAc,GAAiB;IACnC,eAAe,EAAE,CAAC;IAClB,gBAAgB,EAAE,EAAE;IACpB,qBAAqB,EAAE,GAAG;CAC3B,CAAC;AAEF,0FAA0F;AAC1F,MAAM,aAAa,GAAiB;IAClC,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,GAAG;IACrB,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF,MAAM,eAAe,GAA2C;IAC9D,gBAAgB,EAAE;QAChB,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,EAAE;QACpB,qBAAqB,EAAE,GAAG;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,YAAY;YAClB,eAAe,EAAE,CAAC;YAClB,gBAAgB,EAAE,EAAE;YACpB,qBAAqB,EAAE,GAAG;SAC3B;KACF;I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_PRICING_OVERRIDES`: the operator's price rows, validated at load. An entry
|
|
3
|
+
* the estimator could not price with (a rate that is not a finite number ≥ 0, a
|
|
4
|
+
* `next` without a `YYYY-MM-DD` `from` or without all three rates) is dropped with
|
|
5
|
+
* one warning naming the model and the reason; the table's row for it stays.
|
|
6
|
+
*/
|
|
7
|
+
import type { PricingEntry } from './cost-estimator.js';
|
|
8
|
+
/** The valid rows of `raw` (the variable's JSON) by model id; nothing when unset. */
|
|
9
|
+
export declare function parsePricingOverrides(raw: string | undefined): Record<string, PricingEntry>;
|
|
10
|
+
//# sourceMappingURL=pricing-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-overrides.d.ts","sourceRoot":"","sources":["../../src/utils/pricing-overrides.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,qBAAqB,CAAC;AAuE/D,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CA4B3F"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GEMINI_PRICING_OVERRIDES`: the operator's price rows, validated at load. An entry
|
|
3
|
+
* the estimator could not price with (a rate that is not a finite number ≥ 0, a
|
|
4
|
+
* `next` without a `YYYY-MM-DD` `from` or without all three rates) is dropped with
|
|
5
|
+
* one warning naming the model and the reason; the table's row for it stays.
|
|
6
|
+
*/
|
|
7
|
+
import { logger } from './logger.js';
|
|
8
|
+
const UTC_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
9
|
+
const RATE_KEYS = ['inputPerMillion', 'outputPerMillion', 'cachedInputPerMillion'];
|
|
10
|
+
function asFields(value) {
|
|
11
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
12
|
+
return null;
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function isRate(value) {
|
|
16
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
17
|
+
}
|
|
18
|
+
/** `value` is a real UTC calendar day written `YYYY-MM-DD` (`2026-13-01` is not). */
|
|
19
|
+
function isUtcDay(value) {
|
|
20
|
+
if (typeof value !== 'string' || !UTC_DAY.test(value))
|
|
21
|
+
return false;
|
|
22
|
+
const day = new Date(`${value}T00:00:00Z`);
|
|
23
|
+
return !Number.isNaN(day.getTime()) && day.toISOString().slice(0, 10) === value;
|
|
24
|
+
}
|
|
25
|
+
/** Why `value` cannot be a row's `next`, or `null` when it can. */
|
|
26
|
+
function nextProblem(value) {
|
|
27
|
+
const next = asFields(value);
|
|
28
|
+
if (next === null)
|
|
29
|
+
return 'next is not an object';
|
|
30
|
+
if (!isUtcDay(next.from))
|
|
31
|
+
return 'next.from is not a YYYY-MM-DD calendar date';
|
|
32
|
+
const missing = RATE_KEYS.find((key) => !isRate(next[key]));
|
|
33
|
+
return missing === undefined ? null : `next.${missing} is not a finite rate >= 0`;
|
|
34
|
+
}
|
|
35
|
+
/** Why `fields` cannot be a price row, or `null` when it can. */
|
|
36
|
+
function entryProblem(fields) {
|
|
37
|
+
if (!isRate(fields.inputPerMillion))
|
|
38
|
+
return 'inputPerMillion is not a finite rate >= 0';
|
|
39
|
+
if (!isRate(fields.outputPerMillion))
|
|
40
|
+
return 'outputPerMillion is not a finite rate >= 0';
|
|
41
|
+
const cached = fields.cachedInputPerMillion;
|
|
42
|
+
if (cached !== undefined && !isRate(cached))
|
|
43
|
+
return 'cachedInputPerMillion is not a finite rate >= 0';
|
|
44
|
+
return fields.next === undefined ? null : nextProblem(fields.next);
|
|
45
|
+
}
|
|
46
|
+
/** Why `model`'s value `fields` cannot be a price row, or `null` when it can. */
|
|
47
|
+
function rowProblem(model, fields) {
|
|
48
|
+
if (model === '__proto__')
|
|
49
|
+
return 'not a model id';
|
|
50
|
+
return fields === null ? 'not an object' : entryProblem(fields);
|
|
51
|
+
}
|
|
52
|
+
/** A typed copy of a row `entryProblem` accepted. */
|
|
53
|
+
function toEntry(fields) {
|
|
54
|
+
const rates = {
|
|
55
|
+
inputPerMillion: fields.inputPerMillion,
|
|
56
|
+
outputPerMillion: fields.outputPerMillion,
|
|
57
|
+
};
|
|
58
|
+
if (fields.cachedInputPerMillion !== undefined) {
|
|
59
|
+
rates.cachedInputPerMillion = fields.cachedInputPerMillion;
|
|
60
|
+
}
|
|
61
|
+
const next = asFields(fields.next);
|
|
62
|
+
if (next === null)
|
|
63
|
+
return rates;
|
|
64
|
+
return {
|
|
65
|
+
...rates,
|
|
66
|
+
next: {
|
|
67
|
+
from: next.from,
|
|
68
|
+
inputPerMillion: next.inputPerMillion,
|
|
69
|
+
outputPerMillion: next.outputPerMillion,
|
|
70
|
+
cachedInputPerMillion: next.cachedInputPerMillion,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** The valid rows of `raw` (the variable's JSON) by model id; nothing when unset. */
|
|
75
|
+
export function parsePricingOverrides(raw) {
|
|
76
|
+
if (!raw)
|
|
77
|
+
return {};
|
|
78
|
+
let parsed;
|
|
79
|
+
try {
|
|
80
|
+
parsed = JSON.parse(raw);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
logger.warn(`GEMINI_PRICING_OVERRIDES is not JSON and is ignored: ${String(err)}`);
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
const map = asFields(parsed);
|
|
87
|
+
if (map === null) {
|
|
88
|
+
logger.warn('GEMINI_PRICING_OVERRIDES is not a JSON object of model rows and is ignored');
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
// A null-prototype map: a key such as `__proto__` is a plain key, never a setter.
|
|
92
|
+
const rows = Object.create(null);
|
|
93
|
+
for (const [model, value] of Object.entries(map)) {
|
|
94
|
+
const fields = asFields(value);
|
|
95
|
+
const problem = rowProblem(model, fields);
|
|
96
|
+
if (fields === null || problem !== null) {
|
|
97
|
+
logger.warn(`GEMINI_PRICING_OVERRIDES: ${JSON.stringify(model)} dropped (${problem}); the table row stays`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
rows[model] = toEntry(fields);
|
|
101
|
+
}
|
|
102
|
+
return rows;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=pricing-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing-overrides.js","sourceRoot":"","sources":["../../src/utils/pricing-overrides.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AACtC,MAAM,SAAS,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,uBAAuB,CAAU,CAAC;AAI5F,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrF,OAAO,KAAe,CAAC;AACzB,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,qFAAqF;AACrF,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpE,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,YAAY,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAA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iC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CACT,6BAA6B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,OAAO,wBAAwB,CAC/F,CAAC;YACF,SAAS;QACX,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qmediat.io/gemini-code-context-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"mcpName": "io.github.qmediat/gemini-code-context-mcp",
|
|
5
5
|
"description": "MCP server that gives Claude Code and other MCP hosts long-context memory of a codebase through Gemini's 1M-token window: `ask`/`code` send the scanned workspace with implicit caching by default or an explicit Context Cache on request; `ask_agentic` reads files on demand for repos beyond the limit.",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"test:watch": "vitest",
|
|
47
47
|
"test:coverage": "vitest run --coverage",
|
|
48
48
|
"test:integration": "vitest run test/integration",
|
|
49
|
-
"lint": "biome check src test",
|
|
49
|
+
"lint": "biome check src test && eslint . && jscpd --config .jscpd.json && node lint/baseline-ratchet.mjs --duplicates .jscpd-report/jscpd-report.json",
|
|
50
50
|
"format": "biome format --write src test",
|
|
51
51
|
"typecheck": "tsc --noEmit",
|
|
52
52
|
"prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build",
|
|
@@ -60,10 +60,16 @@
|
|
|
60
60
|
"zod-to-json-schema": "^3.24.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
+
"@babel/core": "8.0.6",
|
|
64
|
+
"@babel/eslint-parser": "8.0.6",
|
|
63
65
|
"@biomejs/biome": "^1.9.0",
|
|
66
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
64
67
|
"@types/better-sqlite3": "^9.6.0",
|
|
65
68
|
"@types/node": "^22.20.5",
|
|
66
69
|
"@vitest/coverage-v8": "^5.0.3",
|
|
70
|
+
"@vitest/eslint-plugin": "1.6.27",
|
|
71
|
+
"eslint": "10.12.0",
|
|
72
|
+
"jscpd": "5.3.2",
|
|
67
73
|
"tsx": "^4.19.0",
|
|
68
74
|
"typescript": "^7.0.2",
|
|
69
75
|
"vitest": "^5.0.3"
|