@qmediat.io/gemini-code-context-mcp 1.5.2 → 1.7.2
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 +122 -0
- package/README.md +7 -4
- package/dist/gemini/retry.d.ts +28 -0
- package/dist/gemini/retry.d.ts.map +1 -1
- package/dist/gemini/retry.js +71 -1
- package/dist/gemini/retry.js.map +1 -1
- package/dist/manifest/db.d.ts +25 -1
- package/dist/manifest/db.d.ts.map +1 -1
- package/dist/manifest/db.js +37 -3
- package/dist/manifest/db.js.map +1 -1
- package/dist/tools/ask-agentic.tool.d.ts +5 -0
- package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
- package/dist/tools/ask-agentic.tool.js +67 -12
- package/dist/tools/ask-agentic.tool.js.map +1 -1
- package/dist/tools/ask.tool.d.ts +5 -0
- package/dist/tools/ask.tool.d.ts.map +1 -1
- package/dist/tools/ask.tool.js +80 -27
- package/dist/tools/ask.tool.js.map +1 -1
- package/dist/tools/code.tool.d.ts +18 -0
- package/dist/tools/code.tool.d.ts.map +1 -1
- package/dist/tools/code.tool.js +67 -21
- package/dist/tools/code.tool.js.map +1 -1
- package/dist/tools/shared/abort-timeout.d.ts +64 -0
- package/dist/tools/shared/abort-timeout.d.ts.map +1 -0
- package/dist/tools/shared/abort-timeout.js +117 -0
- package/dist/tools/shared/abort-timeout.js.map +1 -0
- package/dist/tools/shared/stream-collector.d.ts +89 -0
- package/dist/tools/shared/stream-collector.d.ts.map +1 -0
- package/dist/tools/shared/stream-collector.js +194 -0
- package/dist/tools/shared/stream-collector.js.map +1 -0
- package/dist/tools/status.tool.d.ts.map +1 -1
- package/dist/tools/status.tool.js +29 -3
- package/dist/tools/status.tool.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterate Gemini's `generateContentStream` AsyncGenerator and accumulate it
|
|
3
|
+
* into a single `CollectedResponse` shaped like the synchronous
|
|
4
|
+
* `generateContent` return — so the call sites in `ask.tool.ts` and
|
|
5
|
+
* `code.tool.ts` keep their downstream parsing unchanged (T20, v1.7.0).
|
|
6
|
+
*
|
|
7
|
+
* Behaviour notes:
|
|
8
|
+
*
|
|
9
|
+
* - **Text concat**: each chunk's `.text` is treated as a delta and joined
|
|
10
|
+
* verbatim. Gemini's text accessor returns the chunk-local string, not a
|
|
11
|
+
* running total — verified empirically via `genai.d.ts` getter.
|
|
12
|
+
*
|
|
13
|
+
* - **`usageMetadata` is final-chunk-only**: Gemini sends `usageMetadata`
|
|
14
|
+
* only on the LAST chunk of a stream (per Google docs and observed
|
|
15
|
+
* telemetry). We always overwrite — last-write-wins is correct semantics
|
|
16
|
+
* even on the off-chance an early chunk includes a partial. If no chunk
|
|
17
|
+
* ever provided usageMetadata, the return is `undefined` and downstream
|
|
18
|
+
* cost accounting falls back to a 0-token estimate. (Callers may choose
|
|
19
|
+
* to log this as a warning — neither this collector nor `ask`/`code`
|
|
20
|
+
* currently does, since it would only fire if Google changed the stream
|
|
21
|
+
* protocol.)
|
|
22
|
+
*
|
|
23
|
+
* - **`candidates` last-write-wins**: finish reasons, safety ratings, and
|
|
24
|
+
* groundingMetadata only become authoritative on the final chunk —
|
|
25
|
+
* earlier chunks may report "STOP_REASON_UNSPECIFIED" mid-stream. We keep
|
|
26
|
+
* the last non-empty `candidates` array.
|
|
27
|
+
*
|
|
28
|
+
* - **Thought chunks (`part.thought === true`)** are forwarded to
|
|
29
|
+
* `onThoughtChunk` immediately as they arrive, but the callback fires
|
|
30
|
+
* at most every `thoughtEmitThrottleMs` ms (default 1500) so the MCP
|
|
31
|
+
* host's UI doesn't get flooded by short bursts. The full thought text
|
|
32
|
+
* is also retained in `thoughtsSummary` (capped at 1200 chars to match
|
|
33
|
+
* the existing `ask` / `code` post-call extraction behaviour) for the
|
|
34
|
+
* final response metadata.
|
|
35
|
+
*
|
|
36
|
+
* - **Abort propagation**: if the supplied `signal` fires mid-stream, we
|
|
37
|
+
* close the generator (`.return?.()`) and re-throw the signal's reason
|
|
38
|
+
* — the SDK's own abortSignal plumbing should also tear down the
|
|
39
|
+
* underlying request, but we re-check defensively in case a chunk is
|
|
40
|
+
* mid-flight when abort fires.
|
|
41
|
+
*
|
|
42
|
+
* - **`withNetworkRetry` wraps the OPENING of the stream** (in the call
|
|
43
|
+
* site, not here). A pre-response failure (DNS blip etc.) → retry opens
|
|
44
|
+
* a fresh stream. A mid-stream failure CANNOT be retried (Gemini's
|
|
45
|
+
* `generateContentStream` doesn't support resume). We propagate
|
|
46
|
+
* mid-stream failures verbatim — caller maps them to UNKNOWN errorCode.
|
|
47
|
+
*
|
|
48
|
+
* - **Stale-cache mid-stream**: if a chunk read throws an error matching
|
|
49
|
+
* `isStaleCacheError`, we still propagate — caller's stale-cache catch
|
|
50
|
+
* branch invalidates and opens a NEW full stream. Discards partial.
|
|
51
|
+
*/
|
|
52
|
+
import type { GenerateContentResponse } from '@google/genai';
|
|
53
|
+
export interface StreamCollectorOptions {
|
|
54
|
+
/** Per-call abort (T19). Threading through here means we drop chunks the
|
|
55
|
+
* moment timeout fires, not after the next one comes through. */
|
|
56
|
+
readonly signal?: AbortSignal;
|
|
57
|
+
/** Called with thought-part text as it arrives, throttled. The text passed
|
|
58
|
+
* is the SAME chunk's thought (not accumulated) — easier for emitters that
|
|
59
|
+
* just want to surface "what is the model thinking RIGHT NOW". */
|
|
60
|
+
readonly onThoughtChunk?: (text: string) => void;
|
|
61
|
+
/** Minimum gap between `onThoughtChunk` emits. Default 1500ms — short
|
|
62
|
+
* enough to feel live, long enough to avoid flooding MCP host throttles. */
|
|
63
|
+
readonly thoughtEmitThrottleMs?: number;
|
|
64
|
+
}
|
|
65
|
+
export interface CollectedResponse {
|
|
66
|
+
/** Concatenated text from all chunks. */
|
|
67
|
+
readonly text: string;
|
|
68
|
+
/** Last non-empty candidates array seen — finish reasons live here. */
|
|
69
|
+
readonly candidates: GenerateContentResponse['candidates'];
|
|
70
|
+
/** Final-chunk usage; undefined if no chunk reported one. */
|
|
71
|
+
readonly usageMetadata: GenerateContentResponse['usageMetadata'];
|
|
72
|
+
/** Concatenated thought text, capped at 1200 chars. Null when none seen. */
|
|
73
|
+
readonly thoughtsSummary: string | null;
|
|
74
|
+
/** Number of chunks consumed. Useful for diagnostics + logging. */
|
|
75
|
+
readonly chunkCount: number;
|
|
76
|
+
/** Wall-clock timestamps for first/last chunk arrival (Date.now() values). */
|
|
77
|
+
readonly firstChunkAt: number | null;
|
|
78
|
+
readonly lastChunkAt: number | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Drive an `AsyncGenerator<GenerateContentResponse>` to completion and
|
|
82
|
+
* collect the deltas into a single response shape.
|
|
83
|
+
*
|
|
84
|
+
* Throws (re-throws really) on:
|
|
85
|
+
* - Abort signal fired before or during iteration → signal.reason
|
|
86
|
+
* - Generator yielding an error → propagated verbatim
|
|
87
|
+
*/
|
|
88
|
+
export declare function collectStream(stream: AsyncGenerator<GenerateContentResponse>, opts?: StreamCollectorOptions): Promise<CollectedResponse>;
|
|
89
|
+
//# sourceMappingURL=stream-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-collector.d.ts","sourceRoot":"","sources":["../../../src/tools/shared/stream-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAK7D,MAAM,WAAW,sBAAsB;IACrC;qEACiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;sEAEkE;IAClE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD;gFAC4E;IAC5E,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAC3D,6DAA6D;IAC7D,QAAQ,CAAC,aAAa,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;IACjE,4EAA4E;IAC5E,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,CAAC,uBAAuB,CAAC,EAC/C,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,iBAAiB,CAAC,CA6I5B"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterate Gemini's `generateContentStream` AsyncGenerator and accumulate it
|
|
3
|
+
* into a single `CollectedResponse` shaped like the synchronous
|
|
4
|
+
* `generateContent` return — so the call sites in `ask.tool.ts` and
|
|
5
|
+
* `code.tool.ts` keep their downstream parsing unchanged (T20, v1.7.0).
|
|
6
|
+
*
|
|
7
|
+
* Behaviour notes:
|
|
8
|
+
*
|
|
9
|
+
* - **Text concat**: each chunk's `.text` is treated as a delta and joined
|
|
10
|
+
* verbatim. Gemini's text accessor returns the chunk-local string, not a
|
|
11
|
+
* running total — verified empirically via `genai.d.ts` getter.
|
|
12
|
+
*
|
|
13
|
+
* - **`usageMetadata` is final-chunk-only**: Gemini sends `usageMetadata`
|
|
14
|
+
* only on the LAST chunk of a stream (per Google docs and observed
|
|
15
|
+
* telemetry). We always overwrite — last-write-wins is correct semantics
|
|
16
|
+
* even on the off-chance an early chunk includes a partial. If no chunk
|
|
17
|
+
* ever provided usageMetadata, the return is `undefined` and downstream
|
|
18
|
+
* cost accounting falls back to a 0-token estimate. (Callers may choose
|
|
19
|
+
* to log this as a warning — neither this collector nor `ask`/`code`
|
|
20
|
+
* currently does, since it would only fire if Google changed the stream
|
|
21
|
+
* protocol.)
|
|
22
|
+
*
|
|
23
|
+
* - **`candidates` last-write-wins**: finish reasons, safety ratings, and
|
|
24
|
+
* groundingMetadata only become authoritative on the final chunk —
|
|
25
|
+
* earlier chunks may report "STOP_REASON_UNSPECIFIED" mid-stream. We keep
|
|
26
|
+
* the last non-empty `candidates` array.
|
|
27
|
+
*
|
|
28
|
+
* - **Thought chunks (`part.thought === true`)** are forwarded to
|
|
29
|
+
* `onThoughtChunk` immediately as they arrive, but the callback fires
|
|
30
|
+
* at most every `thoughtEmitThrottleMs` ms (default 1500) so the MCP
|
|
31
|
+
* host's UI doesn't get flooded by short bursts. The full thought text
|
|
32
|
+
* is also retained in `thoughtsSummary` (capped at 1200 chars to match
|
|
33
|
+
* the existing `ask` / `code` post-call extraction behaviour) for the
|
|
34
|
+
* final response metadata.
|
|
35
|
+
*
|
|
36
|
+
* - **Abort propagation**: if the supplied `signal` fires mid-stream, we
|
|
37
|
+
* close the generator (`.return?.()`) and re-throw the signal's reason
|
|
38
|
+
* — the SDK's own abortSignal plumbing should also tear down the
|
|
39
|
+
* underlying request, but we re-check defensively in case a chunk is
|
|
40
|
+
* mid-flight when abort fires.
|
|
41
|
+
*
|
|
42
|
+
* - **`withNetworkRetry` wraps the OPENING of the stream** (in the call
|
|
43
|
+
* site, not here). A pre-response failure (DNS blip etc.) → retry opens
|
|
44
|
+
* a fresh stream. A mid-stream failure CANNOT be retried (Gemini's
|
|
45
|
+
* `generateContentStream` doesn't support resume). We propagate
|
|
46
|
+
* mid-stream failures verbatim — caller maps them to UNKNOWN errorCode.
|
|
47
|
+
*
|
|
48
|
+
* - **Stale-cache mid-stream**: if a chunk read throws an error matching
|
|
49
|
+
* `isStaleCacheError`, we still propagate — caller's stale-cache catch
|
|
50
|
+
* branch invalidates and opens a NEW full stream. Discards partial.
|
|
51
|
+
*/
|
|
52
|
+
const DEFAULT_THOUGHT_EMIT_THROTTLE_MS = 1500;
|
|
53
|
+
const THOUGHTS_SUMMARY_MAX_CHARS = 1200;
|
|
54
|
+
/**
|
|
55
|
+
* Drive an `AsyncGenerator<GenerateContentResponse>` to completion and
|
|
56
|
+
* collect the deltas into a single response shape.
|
|
57
|
+
*
|
|
58
|
+
* Throws (re-throws really) on:
|
|
59
|
+
* - Abort signal fired before or during iteration → signal.reason
|
|
60
|
+
* - Generator yielding an error → propagated verbatim
|
|
61
|
+
*/
|
|
62
|
+
export async function collectStream(stream, opts = {}) {
|
|
63
|
+
const signal = opts.signal;
|
|
64
|
+
const onThoughtChunk = opts.onThoughtChunk;
|
|
65
|
+
const throttleMs = opts.thoughtEmitThrottleMs ?? DEFAULT_THOUGHT_EMIT_THROTTLE_MS;
|
|
66
|
+
// Pre-flight: never start consuming if abort already fired. Saves the cost
|
|
67
|
+
// of touching the generator at all.
|
|
68
|
+
if (signal?.aborted) {
|
|
69
|
+
void stream.return?.(undefined);
|
|
70
|
+
throw signal.reason instanceof Error
|
|
71
|
+
? signal.reason
|
|
72
|
+
: new DOMException('Operation aborted', 'AbortError');
|
|
73
|
+
}
|
|
74
|
+
const textChunks = [];
|
|
75
|
+
const thoughtChunks = [];
|
|
76
|
+
let lastCandidates;
|
|
77
|
+
let lastUsageMetadata;
|
|
78
|
+
let chunkCount = 0;
|
|
79
|
+
let firstChunkAt = null;
|
|
80
|
+
let lastChunkAt = null;
|
|
81
|
+
let lastThoughtEmitAt = 0;
|
|
82
|
+
// Outer try/finally guarantees the underlying generator gets a `.return()`
|
|
83
|
+
// call on EVERY exit path — happy completion, mid-stream throw, abort
|
|
84
|
+
// propagation. Without this, the previous `void stream.return?.()` calls
|
|
85
|
+
// were "best effort" and could be skipped on uncommon error paths,
|
|
86
|
+
// leaking the underlying SSE connection until GC kicked in.
|
|
87
|
+
let needsCleanup = true;
|
|
88
|
+
try {
|
|
89
|
+
for await (const chunk of stream) {
|
|
90
|
+
// Mid-stream abort check — if signal fired while we were waiting on
|
|
91
|
+
// the next chunk, close the generator and propagate the reason. The
|
|
92
|
+
// SDK's own abortSignal (wired via config.abortSignal) should tear
|
|
93
|
+
// the underlying fetch down, but the for-await loop hands us one
|
|
94
|
+
// more chunk before the abort propagates from the SDK. Without the
|
|
95
|
+
// explicit check, we'd accumulate that extra chunk.
|
|
96
|
+
if (signal?.aborted) {
|
|
97
|
+
throw signal.reason instanceof Error
|
|
98
|
+
? signal.reason
|
|
99
|
+
: new DOMException('Operation aborted', 'AbortError');
|
|
100
|
+
}
|
|
101
|
+
chunkCount += 1;
|
|
102
|
+
const now = Date.now();
|
|
103
|
+
if (firstChunkAt === null)
|
|
104
|
+
firstChunkAt = now;
|
|
105
|
+
lastChunkAt = now;
|
|
106
|
+
// Text concat. `chunk.text` is a getter on GenerateContentResponse
|
|
107
|
+
// that joins parts.text from the first candidate; safe to read even
|
|
108
|
+
// when the chunk only carries thoughts (returns empty string then).
|
|
109
|
+
const chunkText = chunk.text ?? '';
|
|
110
|
+
if (chunkText.length > 0)
|
|
111
|
+
textChunks.push(chunkText);
|
|
112
|
+
// Last non-empty candidates wins. Gemini sends finish reasons +
|
|
113
|
+
// safety ratings authoritatively only on the final chunk.
|
|
114
|
+
if (chunk.candidates && chunk.candidates.length > 0) {
|
|
115
|
+
lastCandidates = chunk.candidates;
|
|
116
|
+
}
|
|
117
|
+
// Thought-part extraction. `parts[i].thought === true` flags an
|
|
118
|
+
// internal-reasoning chunk. Push to summary, throttle emit.
|
|
119
|
+
const candidates = chunk.candidates ?? [];
|
|
120
|
+
for (const cand of candidates) {
|
|
121
|
+
const parts = cand.content?.parts ?? [];
|
|
122
|
+
for (const part of parts) {
|
|
123
|
+
if (part.thought === true && typeof part.text === 'string' && part.text.length > 0) {
|
|
124
|
+
thoughtChunks.push(part.text);
|
|
125
|
+
if (onThoughtChunk && now - lastThoughtEmitAt >= throttleMs) {
|
|
126
|
+
// Re-check abort RIGHT BEFORE invoking the callback. If the
|
|
127
|
+
// signal flipped between the loop-top check and here (e.g.
|
|
128
|
+
// a long-running thought-extraction loop on a chunk with many
|
|
129
|
+
// parts), we don't want to surface a stale "thinking: …"
|
|
130
|
+
// notification AFTER the user has already seen the timeout
|
|
131
|
+
// error — that's confusing UX.
|
|
132
|
+
if (signal?.aborted) {
|
|
133
|
+
throw signal.reason instanceof Error
|
|
134
|
+
? signal.reason
|
|
135
|
+
: new DOMException('Operation aborted', 'AbortError');
|
|
136
|
+
}
|
|
137
|
+
lastThoughtEmitAt = now;
|
|
138
|
+
try {
|
|
139
|
+
onThoughtChunk(part.text);
|
|
140
|
+
}
|
|
141
|
+
catch (cbErr) {
|
|
142
|
+
// Emitter exceptions must not abort the stream — log and
|
|
143
|
+
// keep collecting. The caller's response shape is more
|
|
144
|
+
// important than progress notification fidelity.
|
|
145
|
+
// eslint-disable-next-line no-console -- shared module, no logger dep
|
|
146
|
+
console.warn(`stream-collector: onThoughtChunk threw, suppressed: ${cbErr instanceof Error ? cbErr.message : String(cbErr)}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// usageMetadata appears on the final chunk; keep last-write-wins.
|
|
153
|
+
if (chunk.usageMetadata) {
|
|
154
|
+
lastUsageMetadata = chunk.usageMetadata;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// for-await exited cleanly — generator is exhausted, no cleanup needed.
|
|
158
|
+
needsCleanup = false;
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
// If abort is the cause of the throw, prefer the signal's reason. SDK
|
|
162
|
+
// sometimes throws a generic "fetch failed" because abort tore down
|
|
163
|
+
// the socket — we want the timeout-driven error to surface.
|
|
164
|
+
if (signal?.aborted) {
|
|
165
|
+
throw signal.reason instanceof Error
|
|
166
|
+
? signal.reason
|
|
167
|
+
: new DOMException('Operation aborted', 'AbortError');
|
|
168
|
+
}
|
|
169
|
+
throw err;
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
// Best-effort cleanup of the underlying generator + transport. Awaited
|
|
173
|
+
// detachment is fire-and-forget here — we're already on the way out
|
|
174
|
+
// of the function and any async cleanup error would mask the original
|
|
175
|
+
// throw (or just delay successful completion). The async generator's
|
|
176
|
+
// own try/finally inside the SDK is the actual guarantee; this is
|
|
177
|
+
// belt-and-suspenders.
|
|
178
|
+
if (needsCleanup) {
|
|
179
|
+
void stream.return?.(undefined);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const text = textChunks.join('');
|
|
183
|
+
const thoughtsSummary = thoughtChunks.length > 0 ? thoughtChunks.join('\n').slice(0, THOUGHTS_SUMMARY_MAX_CHARS) : null;
|
|
184
|
+
return {
|
|
185
|
+
text,
|
|
186
|
+
candidates: lastCandidates,
|
|
187
|
+
usageMetadata: lastUsageMetadata,
|
|
188
|
+
thoughtsSummary,
|
|
189
|
+
chunkCount,
|
|
190
|
+
firstChunkAt,
|
|
191
|
+
lastChunkAt,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=stream-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-collector.js","sourceRoot":"","sources":["../../../src/tools/shared/stream-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAC9C,MAAM,0BAA0B,GAAG,IAAI,CAAC;AA+BxC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA+C,EAC/C,OAA+B,EAAE;IAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,MAAM,cAAc,GAAG,I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AAE,CAAC,CAAC;IACjC,MAAM,eAAe,GACnB,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAElG,OAAO;QACL,IAAI;QACJ,UAAU,EAAE,cAAc;QAC1B,aAAa,EAAE,iBAAiB;QAChC,eAAe;QACf,UAAU;QACV,YAAY;QACZ,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.tool.d.ts","sourceRoot":"","sources":["../../src/tools/status.tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAW5D,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"status.tool.d.ts","sourceRoot":"","sources":["../../src/tools/status.tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAW5D,eAAO,MAAM,UAAU,EAAE,cAAc,CAAC,WAAW,CAsHlD,CAAC"}
|
|
@@ -27,9 +27,18 @@ export const statusTool = {
|
|
|
27
27
|
async execute(input, ctx) {
|
|
28
28
|
try {
|
|
29
29
|
const workspaceRoot = resolve(input.workspace ?? process.cwd());
|
|
30
|
+
const now = Date.now();
|
|
30
31
|
const ws = ctx.manifest.getWorkspace(workspaceRoot);
|
|
31
32
|
const files = ctx.manifest.getFiles(workspaceRoot);
|
|
32
33
|
const stats = ctx.manifest.workspaceStats(workspaceRoot);
|
|
34
|
+
const todayTotalMicros = ctx.manifest.todaysCostMicros(now);
|
|
35
|
+
const todayInFlightMicros = ctx.manifest.todaysInFlightReservedMicros(now);
|
|
36
|
+
// D#7 (v1.7.0): split settled vs in-flight so users running `status`
|
|
37
|
+
// mid-call see why total looks higher than completed work would
|
|
38
|
+
// suggest. Total still includes in-flight (so it's a true budget cap
|
|
39
|
+
// proxy), but the breakdown surfaces what's provisional.
|
|
40
|
+
const todaySettledMicros = Math.max(0, todayTotalMicros - todayInFlightMicros);
|
|
41
|
+
const wsSettledMicros = Math.max(0, stats.totalCostMicros - stats.inFlightReservedMicros);
|
|
33
42
|
const models = await listAvailableModels(ctx.client).catch(() => []);
|
|
34
43
|
const structured = {
|
|
35
44
|
workspace: workspaceRoot,
|
|
@@ -41,7 +50,12 @@ export const statusTool = {
|
|
|
41
50
|
dailyBudgetUsd: Number.isFinite(ctx.config.dailyBudgetUsd)
|
|
42
51
|
? ctx.config.dailyBudgetUsd
|
|
43
52
|
: null,
|
|
44
|
-
spentTodayUsd: microsToDollars(
|
|
53
|
+
spentTodayUsd: microsToDollars(todayTotalMicros),
|
|
54
|
+
// D#7: backward-compatible split. `spentTodayUsd` stays as the
|
|
55
|
+
// conservative upper bound (settled + in-flight); new fields show
|
|
56
|
+
// the breakdown.
|
|
57
|
+
spentTodaySettledUsd: microsToDollars(todaySettledMicros),
|
|
58
|
+
inFlightReservedTodayUsd: microsToDollars(todayInFlightMicros),
|
|
45
59
|
availableModels: models.map((m) => ({
|
|
46
60
|
id: m.id,
|
|
47
61
|
inputTokenLimit: m.inputTokenLimit,
|
|
@@ -64,14 +78,26 @@ export const statusTool = {
|
|
|
64
78
|
totalCachedTokens: stats.totalCachedTokens,
|
|
65
79
|
totalUncachedTokens: stats.totalUncachedTokens,
|
|
66
80
|
totalCostUsd: microsToDollars(stats.totalCostMicros),
|
|
81
|
+
// D#7: workspace-scoped split. Same semantics as the daily fields.
|
|
82
|
+
settledCostUsd: microsToDollars(wsSettledMicros),
|
|
83
|
+
inFlightReservedUsd: microsToDollars(stats.inFlightReservedMicros),
|
|
67
84
|
last24hCostUsd: microsToDollars(stats.last24hCostMicros),
|
|
68
85
|
},
|
|
69
86
|
};
|
|
87
|
+
// Render the in-flight delta only when there IS one; mid-call status
|
|
88
|
+
// queries are the only situation where it's non-zero, and showing
|
|
89
|
+
// "$0.0000 in-flight" on every call would just be noise.
|
|
90
|
+
const todayInFlightSuffix = todayInFlightMicros > 0
|
|
91
|
+
? ` (settled $${microsToDollars(todaySettledMicros).toFixed(4)} + $${microsToDollars(todayInFlightMicros).toFixed(4)} in-flight reserved)`
|
|
92
|
+
: '';
|
|
93
|
+
const wsInFlightSuffix = stats.inFlightReservedMicros > 0
|
|
94
|
+
? ` (settled $${microsToDollars(wsSettledMicros).toFixed(4)} + $${microsToDollars(stats.inFlightReservedMicros).toFixed(4)} in-flight reserved)`
|
|
95
|
+
: '';
|
|
70
96
|
const human = [
|
|
71
97
|
`workspace: ${workspaceRoot}`,
|
|
72
98
|
`auth source: ${ctx.config.auth.source} (${ctx.config.auth.keyFingerprint})`,
|
|
73
99
|
`default model: ${ctx.config.defaultModel}`,
|
|
74
|
-
`budget: ${Number.isFinite(ctx.config.dailyBudgetUsd) ? `$${ctx.config.dailyBudgetUsd.toFixed(2)}/day` : 'unlimited'} (today: $${microsToDollars(
|
|
100
|
+
`budget: ${Number.isFinite(ctx.config.dailyBudgetUsd) ? `$${ctx.config.dailyBudgetUsd.toFixed(2)}/day` : 'unlimited'} (today: $${microsToDollars(todayTotalMicros).toFixed(4)}${todayInFlightSuffix})`,
|
|
75
101
|
`available models (${models.length}):`,
|
|
76
102
|
...models
|
|
77
103
|
.slice(0, 8)
|
|
@@ -92,7 +118,7 @@ export const statusTool = {
|
|
|
92
118
|
` calls: ${stats.callCount}`,
|
|
93
119
|
` cached tokens: ${stats.totalCachedTokens.toLocaleString()}`,
|
|
94
120
|
` input tokens: ${stats.totalUncachedTokens.toLocaleString()}`,
|
|
95
|
-
` total cost: $${microsToDollars(stats.totalCostMicros).toFixed(4)}`,
|
|
121
|
+
` total cost: $${microsToDollars(stats.totalCostMicros).toFixed(4)}${wsInFlightSuffix}`,
|
|
96
122
|
` last 24h: $${microsToDollars(stats.last24hCostMicros).toFixed(4)}`,
|
|
97
123
|
].join('\n');
|
|
98
124
|
return textResult(human, structured);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.tool.js","sourceRoot":"","sources":["../../src/tools/status.tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAuB,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;CAC5E,CAAC,CAAC;AAIH,SAAS,SAAS,CAAC,SAAwB;IACzC,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IACnC,MAAM,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,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C;YAEb,OAAO,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;CACF,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.7.2",
|
|
4
4
|
"mcpName": "io.github.qmediat/gemini-code-context-mcp",
|
|
5
5
|
"description": "MCP server that gives Claude Code persistent memory of your codebase, backed by Gemini's 2M-token context. Includes eager `ask`/`code` for cached repo Q&A and `ask_agentic` for agentic file access on repos that exceed the model's input-token limit.",
|
|
6
6
|
"keywords": [
|