@vibesdotdev/integrations-gemini 0.0.0-stage → 1.0.0-rc.3
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/LICENSE +126 -0
- package/README.md +35 -2
- package/dist/ai/client.consumer.d.ts +9 -0
- package/dist/ai/client.consumer.d.ts.map +1 -0
- package/dist/ai/client.consumer.js +36 -0
- package/dist/ai/client.consumer.js.map +1 -0
- package/dist/ai/client.d.ts +10 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +16 -0
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/cloud.plugin.d.ts +6 -0
- package/dist/ai/cloud.plugin.d.ts.map +1 -0
- package/dist/ai/cloud.plugin.js +110 -0
- package/dist/ai/cloud.plugin.js.map +1 -0
- package/dist/ai/failure.d.ts +26 -0
- package/dist/ai/failure.d.ts.map +1 -0
- package/dist/ai/failure.js +31 -0
- package/dist/ai/failure.js.map +1 -0
- package/dist/ai/index.d.ts +6 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-2-5-flash.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-2-5-pro.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-1-pro-preview.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-5-flash-lite.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-6-flash.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-8-flash.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-8-pro.json +18 -0
- package/dist/ai/metadata/provider-models/gemini/gemini-gemini-3-flash-preview.json +18 -0
- package/dist/ai/metadata/providers/gemini.json +8 -0
- package/dist/ai/provider.consumer.plugin.d.ts +5 -0
- package/dist/ai/provider.consumer.plugin.d.ts.map +1 -0
- package/dist/ai/provider.consumer.plugin.js +60 -0
- package/dist/ai/provider.consumer.plugin.js.map +1 -0
- package/dist/ai/provider.plugin.d.ts +2 -0
- package/dist/ai/provider.plugin.d.ts.map +1 -0
- package/dist/ai/provider.plugin.js +2 -0
- package/dist/ai/provider.plugin.js.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/config.gemini.descriptor.d.ts +4206 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/config.gemini.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/config.gemini.descriptor.js +16 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/config.gemini.descriptor.js.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/schemas/index.d.ts +27 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/schemas/index.d.ts.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/schemas/index.js +21 -0
- package/dist/ai/providers/cloud/frontier/gemini/config/schemas/index.js.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/index.d.ts +5 -0
- package/dist/ai/providers/cloud/frontier/gemini/index.d.ts.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/index.js +4 -0
- package/dist/ai/providers/cloud/frontier/gemini/index.js.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/provider.gemini.descriptor.d.ts +183 -0
- package/dist/ai/providers/cloud/frontier/gemini/provider.gemini.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/cloud/frontier/gemini/provider.gemini.descriptor.js +86 -0
- package/dist/ai/providers/cloud/frontier/gemini/provider.gemini.descriptor.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-failure.d.ts +140 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-failure.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-failure.js +167 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-failure.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.descriptor.d.ts +25 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.descriptor.js +14 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.descriptor.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.impl.d.ts +33 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.impl.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.impl.js +145 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.spec.impl.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.descriptor.d.ts +13 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.descriptor.js +11 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.descriptor.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.impl.consumer.d.ts +33 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.impl.consumer.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.impl.consumer.js +101 -0
- package/dist/ai/providers/gemini/antigravity-server/antigravity-server.transport.impl.consumer.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/client.d.ts +63 -0
- package/dist/ai/providers/gemini/antigravity-server/client.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/client.js +177 -0
- package/dist/ai/providers/gemini/antigravity-server/client.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/connection.d.ts +141 -0
- package/dist/ai/providers/gemini/antigravity-server/connection.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/connection.js +469 -0
- package/dist/ai/providers/gemini/antigravity-server/connection.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/failure-chunk.d.ts +10 -0
- package/dist/ai/providers/gemini/antigravity-server/failure-chunk.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/failure-chunk.js +29 -0
- package/dist/ai/providers/gemini/antigravity-server/failure-chunk.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/index.d.ts +10 -0
- package/dist/ai/providers/gemini/antigravity-server/index.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/index.js +10 -0
- package/dist/ai/providers/gemini/antigravity-server/index.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/protocol.d.ts +114 -0
- package/dist/ai/providers/gemini/antigravity-server/protocol.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/protocol.js +112 -0
- package/dist/ai/providers/gemini/antigravity-server/protocol.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/runtime-execution.d.ts +41 -0
- package/dist/ai/providers/gemini/antigravity-server/runtime-execution.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/runtime-execution.js +145 -0
- package/dist/ai/providers/gemini/antigravity-server/runtime-execution.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/session-records.d.ts +64 -0
- package/dist/ai/providers/gemini/antigravity-server/session-records.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/session-records.js +39 -0
- package/dist/ai/providers/gemini/antigravity-server/session-records.js.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/session.d.ts +31 -0
- package/dist/ai/providers/gemini/antigravity-server/session.d.ts.map +1 -0
- package/dist/ai/providers/gemini/antigravity-server/session.js +153 -0
- package/dist/ai/providers/gemini/antigravity-server/session.js.map +1 -0
- package/dist/ai/providers/gemini/cli-probes.d.ts +75 -0
- package/dist/ai/providers/gemini/cli-probes.d.ts.map +1 -0
- package/dist/ai/providers/gemini/cli-probes.js +121 -0
- package/dist/ai/providers/gemini/cli-probes.js.map +1 -0
- package/dist/ai/providers/gemini/detection/index.d.ts +2 -0
- package/dist/ai/providers/gemini/detection/index.d.ts.map +1 -0
- package/dist/ai/providers/gemini/detection/index.js +2 -0
- package/dist/ai/providers/gemini/detection/index.js.map +1 -0
- package/dist/ai/providers/gemini/detection/system.d.ts +25 -0
- package/dist/ai/providers/gemini/detection/system.d.ts.map +1 -0
- package/dist/ai/providers/gemini/detection/system.js +81 -0
- package/dist/ai/providers/gemini/detection/system.js.map +1 -0
- package/dist/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.d.ts +4 -0
- package/dist/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.js +55 -0
- package/dist/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.js.map +1 -0
- package/dist/ai/providers/gemini/gemini-cli-status.d.ts +42 -0
- package/dist/ai/providers/gemini/gemini-cli-status.d.ts.map +1 -0
- package/dist/ai/providers/gemini/gemini-cli-status.js +134 -0
- package/dist/ai/providers/gemini/gemini-cli-status.js.map +1 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.consumer.d.ts +9 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.consumer.d.ts.map +1 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.consumer.js +60 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.consumer.js.map +1 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.d.ts +22 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.d.ts.map +1 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.js +143 -0
- package/dist/ai/providers/gemini/gemini.provider.impl.js.map +1 -0
- package/dist/ai/providers/gemini/index.d.ts +9 -0
- package/dist/ai/providers/gemini/index.d.ts.map +1 -0
- package/dist/ai/providers/gemini/index.js +7 -0
- package/dist/ai/providers/gemini/index.js.map +1 -0
- package/dist/ai/providers/gemini/recommendations.d.ts +24 -0
- package/dist/ai/providers/gemini/recommendations.d.ts.map +1 -0
- package/dist/ai/providers/gemini/recommendations.js +36 -0
- package/dist/ai/providers/gemini/recommendations.js.map +1 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.descriptor.d.ts +34 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.descriptor.js +23 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.descriptor.js.map +1 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.impl.d.ts +46 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.impl.d.ts.map +1 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.impl.js +165 -0
- package/dist/ai/specs/antigravity-cli-exec/antigravity-cli-exec.spec.impl.js.map +1 -0
- package/dist/ai/specs/cli-response.d.ts +12 -0
- package/dist/ai/specs/cli-response.d.ts.map +1 -0
- package/dist/ai/specs/cli-response.js +36 -0
- package/dist/ai/specs/cli-response.js.map +1 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.descriptor.d.ts +32 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.descriptor.js +21 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.descriptor.js.map +1 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.impl.d.ts +33 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.impl.d.ts.map +1 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.impl.js +84 -0
- package/dist/ai/specs/gemini-cli-exec/gemini-cli-exec.spec.impl.js.map +1 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.descriptor.d.ts +37 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.descriptor.d.ts.map +1 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.descriptor.js +34 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.descriptor.js.map +1 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.impl.d.ts +42 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.impl.d.ts.map +1 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.impl.js +116 -0
- package/dist/ai/specs/gemini-image/gemini-image.spec.impl.js.map +1 -0
- package/dist/external/antigravity/index.d.ts +162 -0
- package/dist/external/antigravity/index.d.ts.map +1 -0
- package/dist/external/antigravity/index.js +7 -0
- package/dist/external/antigravity/index.js.map +1 -0
- package/dist/external/antigravity/manifest.d.ts +6 -0
- package/dist/external/antigravity/manifest.d.ts.map +1 -0
- package/dist/external/antigravity/manifest.js +70 -0
- package/dist/external/antigravity/manifest.js.map +1 -0
- package/dist/external/antigravity-subscription.operation.descriptors.d.ts +61 -0
- package/dist/external/antigravity-subscription.operation.descriptors.d.ts.map +1 -0
- package/dist/external/antigravity-subscription.operation.descriptors.js +26 -0
- package/dist/external/antigravity-subscription.operation.descriptors.js.map +1 -0
- package/dist/external/antigravity-subscription.operations.d.ts +4 -0
- package/dist/external/antigravity-subscription.operations.d.ts.map +1 -0
- package/dist/external/antigravity-subscription.operations.js +49 -0
- package/dist/external/antigravity-subscription.operations.js.map +1 -0
- package/dist/external/external.plugin.d.ts +3 -0
- package/dist/external/external.plugin.d.ts.map +1 -0
- package/dist/external/external.plugin.js +30 -0
- package/dist/external/external.plugin.js.map +1 -0
- package/dist/external/gemini-cli/index.d.ts +162 -0
- package/dist/external/gemini-cli/index.d.ts.map +1 -0
- package/dist/external/gemini-cli/index.js +5 -0
- package/dist/external/gemini-cli/index.js.map +1 -0
- package/dist/external/gemini-cli/manifest.d.ts +10 -0
- package/dist/external/gemini-cli/manifest.d.ts.map +1 -0
- package/dist/external/gemini-cli/manifest.js +80 -0
- package/dist/external/gemini-cli/manifest.js.map +1 -0
- package/dist/external/gemini-presets.d.ts +817 -0
- package/dist/external/gemini-presets.d.ts.map +1 -0
- package/dist/external/gemini-presets.js +59 -0
- package/dist/external/gemini-presets.js.map +1 -0
- package/dist/external/index.d.ts +4 -0
- package/dist/external/index.d.ts.map +1 -0
- package/dist/external/index.js +4 -0
- package/dist/external/index.js.map +1 -0
- package/dist/failure-outcome.d.ts +25 -0
- package/dist/failure-outcome.d.ts.map +1 -0
- package/dist/failure-outcome.js +28 -0
- package/dist/failure-outcome.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/cli.d.ts +97 -0
- package/dist/schemas/cli.d.ts.map +1 -0
- package/dist/schemas/cli.js +51 -0
- package/dist/schemas/cli.js.map +1 -0
- package/dist/schemas/health.d.ts +8 -0
- package/dist/schemas/health.d.ts.map +1 -0
- package/dist/schemas/health.js +6 -0
- package/dist/schemas/health.js.map +1 -0
- package/dist/schemas/imagen.d.ts +31 -0
- package/dist/schemas/imagen.d.ts.map +1 -0
- package/dist/schemas/imagen.js +18 -0
- package/dist/schemas/imagen.js.map +1 -0
- package/dist/schemas/mcp-config.d.ts +13 -0
- package/dist/schemas/mcp-config.d.ts.map +1 -0
- package/dist/schemas/mcp-config.js +13 -0
- package/dist/schemas/mcp-config.js.map +1 -0
- package/package.json +129 -4
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One Antigravity turn over a connection: the user message goes out, the
|
|
3
|
+
* stream-json events come back as `ndjson-record` chunks the spec decodes.
|
|
4
|
+
*
|
|
5
|
+
* The turn is bounded: a deadline the caller declares (`options.timeoutMs`, else
|
|
6
|
+
* {@link ANTIGRAVITY_TURN_LIMITS}), the caller's abort signal, and a cap on the
|
|
7
|
+
* output. An event the session cannot place is a typed failure or a reported
|
|
8
|
+
* diagnostic, never a silent skip. Child text (a failed result's `error`) is only
|
|
9
|
+
* the bounded `cause` of the failure.
|
|
10
|
+
*/
|
|
11
|
+
import { boundedExcerpt } from '@vibesdotdev/external/jsonrpc';
|
|
12
|
+
import * as z from 'zod/v4';
|
|
13
|
+
import { antigravityFailure, childTextCause } from "./antigravity-failure.js";
|
|
14
|
+
import { sessionRecordChunk } from "./session-records.js";
|
|
15
|
+
/** The declared bounds of one turn. */
|
|
16
|
+
export const ANTIGRAVITY_TURN_LIMITS = {
|
|
17
|
+
/** The whole turn, when the caller declares no `timeoutMs`. */
|
|
18
|
+
turnTimeoutMs: 120_000,
|
|
19
|
+
/** Characters of assistant text and thinking one turn may produce. */
|
|
20
|
+
maxOutputChars: 8 * 1024 * 1024
|
|
21
|
+
};
|
|
22
|
+
/** The longest unrecognized step type or tool state a diagnostic keeps, in characters. */
|
|
23
|
+
const MAX_DIAGNOSTIC_CHARS = 64;
|
|
24
|
+
const TurnTimeoutSchema = z.int().min(1).max(2_147_483_647);
|
|
25
|
+
export function createAntigravityServerSessionProgram(body) {
|
|
26
|
+
return (connection, options) => runAntigravityServerSession(connection, body, options);
|
|
27
|
+
}
|
|
28
|
+
async function* runAntigravityServerSession(connection, body, options) {
|
|
29
|
+
const outputTooLarge = () => antigravityFailure('antigravity-output-too-large', { details: { bound: 'maxOutputChars' } });
|
|
30
|
+
let streamedText = '';
|
|
31
|
+
let produced = 0;
|
|
32
|
+
if (options.signal?.aborted)
|
|
33
|
+
throw antigravityFailure('generation-cancelled', { details: { stage: 'before-turn' } });
|
|
34
|
+
const declared = TurnTimeoutSchema.safeParse(options.timeoutMs ?? ANTIGRAVITY_TURN_LIMITS.turnTimeoutMs);
|
|
35
|
+
if (!declared.success)
|
|
36
|
+
throw antigravityFailure('unsupported-option', { details: { fields: ['timeoutMs'] } });
|
|
37
|
+
const timeoutMs = declared.data;
|
|
38
|
+
// Both stop the child (the connection fails typed), so a session blocked on the next event wakes with the failure.
|
|
39
|
+
const stopTimer = options.runtime.lifecycle.timeout(() => {
|
|
40
|
+
connection.abort(antigravityFailure('antigravity-turn-timeout', { details: { deadlineMs: timeoutMs } }));
|
|
41
|
+
}, timeoutMs);
|
|
42
|
+
const onAbort = () => connection.abort(antigravityFailure('generation-cancelled', { details: { stage: 'turn' } }));
|
|
43
|
+
options.signal?.addEventListener('abort', onAbort, { once: true });
|
|
44
|
+
try {
|
|
45
|
+
await connection.sendTurn(body.prompt);
|
|
46
|
+
for await (const event of connection.events()) {
|
|
47
|
+
if (event.event === 'result') {
|
|
48
|
+
const answer = resultOf(event, streamedText, body.model);
|
|
49
|
+
if (answer.lateText !== undefined) {
|
|
50
|
+
yield sessionRecordChunk({ type: 'text-delta', delta: answer.lateText });
|
|
51
|
+
}
|
|
52
|
+
yield sessionRecordChunk({ type: 'result', result: answer.response });
|
|
53
|
+
yield { kind: 'end' };
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const update = event.step_update;
|
|
57
|
+
if (update.step_type === 'agent_response') {
|
|
58
|
+
if (update.text_delta) {
|
|
59
|
+
produced += update.text_delta.length;
|
|
60
|
+
if (produced > ANTIGRAVITY_TURN_LIMITS.maxOutputChars)
|
|
61
|
+
throw outputTooLarge();
|
|
62
|
+
streamedText += update.text_delta;
|
|
63
|
+
yield sessionRecordChunk({ type: 'text-delta', delta: update.text_delta });
|
|
64
|
+
}
|
|
65
|
+
if (update.thinking_delta) {
|
|
66
|
+
produced += update.thinking_delta.length;
|
|
67
|
+
if (produced > ANTIGRAVITY_TURN_LIMITS.maxOutputChars)
|
|
68
|
+
throw outputTooLarge();
|
|
69
|
+
yield sessionRecordChunk({ type: 'thinking-delta', delta: update.thinking_delta });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (update.step_type === 'tool') {
|
|
73
|
+
const toolId = toolIdOf(update);
|
|
74
|
+
if (update.state === 'ACTIVE') {
|
|
75
|
+
const name = update.tool_name ?? update.tool_info?.name ?? 'tool';
|
|
76
|
+
yield sessionRecordChunk({ type: 'tool-call-start', id: toolId, name });
|
|
77
|
+
if (update.tool_info?.parameters) {
|
|
78
|
+
yield sessionRecordChunk({
|
|
79
|
+
type: 'tool-call-arg-delta',
|
|
80
|
+
id: toolId,
|
|
81
|
+
delta: JSON.stringify(update.tool_info.parameters)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (update.state === 'DONE') {
|
|
86
|
+
yield sessionRecordChunk({ type: 'tool-call-end', id: toolId });
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
connection.diagnose({ kind: 'unknown-tool-state', state: diagnosticText(update.state) });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (update.step_type !== 'user_input') {
|
|
93
|
+
// `user_input` is the child echoing the turn this session sent; any other step is reported.
|
|
94
|
+
connection.diagnose({ kind: 'unknown-step', stepType: diagnosticText(update.step_type) });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// The events ended without a result: the connection's own failure says why, else nothing came.
|
|
98
|
+
throw connection.failure ?? antigravityFailure('antigravity-no-result');
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
stopTimer();
|
|
102
|
+
options.signal?.removeEventListener('abort', onAbort);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Reads a result event into the final answer; a failed or empty turn is a typed failure. */
|
|
106
|
+
function resultOf(event, streamedText, model) {
|
|
107
|
+
const result = event.result;
|
|
108
|
+
if (result.status === 'ERROR') {
|
|
109
|
+
// The child's words are the bounded cause, never the message.
|
|
110
|
+
const text = result.error || result.message;
|
|
111
|
+
throw antigravityFailure('antigravity-turn-failed', text ? { cause: childTextCause(text) } : {});
|
|
112
|
+
}
|
|
113
|
+
if (result.status !== 'SUCCESS') {
|
|
114
|
+
throw antigravityFailure('antigravity-protocol-invalid', {
|
|
115
|
+
details: { stage: 'result-status' },
|
|
116
|
+
cause: childTextCause(result.status)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const text = result.response ? result.response : streamedText;
|
|
120
|
+
if (text.length > ANTIGRAVITY_TURN_LIMITS.maxOutputChars) {
|
|
121
|
+
throw antigravityFailure('antigravity-output-too-large', { details: { bound: 'maxOutputChars' } });
|
|
122
|
+
}
|
|
123
|
+
if (text.trim() === '')
|
|
124
|
+
throw antigravityFailure('antigravity-empty-response');
|
|
125
|
+
return {
|
|
126
|
+
response: {
|
|
127
|
+
id: `antigravity.${model ?? 'default'}.${Date.now()}`,
|
|
128
|
+
timestamp: new Date(),
|
|
129
|
+
content: text,
|
|
130
|
+
metadata: {
|
|
131
|
+
modelVersion: model,
|
|
132
|
+
finishReason: 'stop',
|
|
133
|
+
tokensPrompt: result.usage?.input_tokens,
|
|
134
|
+
tokensCompletion: result.usage?.output_tokens,
|
|
135
|
+
tokensUsed: result.usage?.total_tokens,
|
|
136
|
+
conversationId: result.conversation_id
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// A child that answered only in the result (no streamed deltas) still streams its answer once.
|
|
140
|
+
lateText: result.response && streamedText.length === 0 ? result.response : undefined
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** The tool id of a step: the child's own step index. A step without one cannot be told apart from another, so it is refused. */
|
|
144
|
+
function toolIdOf(update) {
|
|
145
|
+
if (update.step_index === undefined) {
|
|
146
|
+
throw antigravityFailure('antigravity-protocol-invalid', { details: { stage: 'tool-step-index' } });
|
|
147
|
+
}
|
|
148
|
+
return String(update.step_index);
|
|
149
|
+
}
|
|
150
|
+
function diagnosticText(value) {
|
|
151
|
+
return value === undefined ? '(missing)' : boundedExcerpt(value).slice(0, MAX_DIAGNOSTIC_CHARS);
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/antigravity-server/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,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AAY;gBACxC,gBAAgB,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa;gBAC7C,UAAU,EAAE,MAAM,CAAC,KAAK,EAAE,YAAY;gBACtC,cAAc,EAAE,MAAM,CAAC,eAAe;aACtC;SACD;QACD,+FAA+F;QAC/F,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KACpF,CAAC;AACH,CAAC;AAED,iIAAiI;AACjI,SAAS,QAAQ,CAAC,MAA6B;IAC9C,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,kBAAkB,CAAC,8BAA8B,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,cAAc,CAAC,KAAyB;IAChD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consumer-host probes for the two Google subscription CLIs. Raw CLI
|
|
3
|
+
* diagnostics never leave this module except as classified failures;
|
|
4
|
+
* no credential files are read.
|
|
5
|
+
*/
|
|
6
|
+
import { composeChildEnv } from '@vibesdotdev/kernel';
|
|
7
|
+
import { type GeminiCliFailure } from './gemini-cli-status.ts';
|
|
8
|
+
/** Minimal `runtime/execution` surface the probes rely on. */
|
|
9
|
+
export interface CliExecution {
|
|
10
|
+
resolveCommand(command: string): Promise<string | null>;
|
|
11
|
+
execute(options: {
|
|
12
|
+
command: string;
|
|
13
|
+
args?: string[];
|
|
14
|
+
cwd?: string;
|
|
15
|
+
env?: Record<string, string>;
|
|
16
|
+
envMode?: 'inherit' | 'replace';
|
|
17
|
+
timeout?: number;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
exitCode: number | null;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
timedOut: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
/** The runtime a probe child's environment is composed from (`composeChildEnv`). */
|
|
26
|
+
export type CliProbeRuntime = Parameters<typeof composeChildEnv>[0];
|
|
27
|
+
/**
|
|
28
|
+
* Every probe runs with `envMode: 'replace'` and the kernel's composed
|
|
29
|
+
* environment (rc02-rc03 C22): the host base set (each CLI's sign-in lives
|
|
30
|
+
* under HOME) plus the names declared here. A probe checks the subscription
|
|
31
|
+
* sign-in, so `GEMINI_API_KEY` is not among its names: an inherited one
|
|
32
|
+
* would make the Gemini CLI authenticate by key and report a healthy
|
|
33
|
+
* subscription that is not there. The Gemini CLI's Code Assist tier check reads the selected Cloud
|
|
34
|
+
* project; both CLIs honour the proxy and CA settings.
|
|
35
|
+
*/
|
|
36
|
+
export declare const GEMINI_CLI_INHERIT_ENV: readonly ["GOOGLE_CLOUD_PROJECT", "HTTPS_PROXY", "HTTP_PROXY", "NO_PROXY", "SSL_CERT_FILE"];
|
|
37
|
+
/**
|
|
38
|
+
* Measured 2026-09-06: Gemini CLI 0.58.0 needs ~4.9s to reach its auth
|
|
39
|
+
* decision and `agy models` ~3.4s, so the 5s default health timeout would
|
|
40
|
+
* report every probe as a timeout. Callers may ask for longer, never shorter.
|
|
41
|
+
*/
|
|
42
|
+
export declare const CLI_PROBE_TIMEOUT_MS = 15000;
|
|
43
|
+
export declare function probeTimeout(requested?: number): number;
|
|
44
|
+
export type GeminiCliProbe = {
|
|
45
|
+
kind: 'unavailable';
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'timeout';
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'healthy';
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'failure';
|
|
52
|
+
failure: GeminiCliFailure;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Headless Gemini CLI probe. The CLI performs its Code Assist tier check
|
|
56
|
+
* before the prompt runs, so an ineligible client fails here without
|
|
57
|
+
* generating; an eligible one answers a one-token prompt.
|
|
58
|
+
*/
|
|
59
|
+
export declare function probeGeminiCli(runtime: CliProbeRuntime, execution: CliExecution | null, timeout: number): Promise<GeminiCliProbe>;
|
|
60
|
+
export type AntigravityCliProbe = {
|
|
61
|
+
kind: 'unavailable';
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'timeout';
|
|
64
|
+
} | {
|
|
65
|
+
kind: 'healthy';
|
|
66
|
+
models: string[];
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'failure';
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
/** Parse `agy models` output (`<id>\t<label>` per line) into wire model ids. */
|
|
72
|
+
export declare function parseAntigravityModels(stdout: string): string[];
|
|
73
|
+
/** `agy models` needs a signed-in account and lists the subscription's models without generating. */
|
|
74
|
+
export declare function probeAntigravityCli(runtime: CliProbeRuntime, execution: CliExecution | null, timeout: number): Promise<AntigravityCliProbe>;
|
|
75
|
+
//# sourceMappingURL=cli-probes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-probes.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/gemini/cli-probes.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAU,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAKN,KAAK,gBAAgB,EACrB,MAAM,wBAAwB,CAAC;AAEhC,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC5B,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD,OAAO,CAAC,OAAO,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC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AAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAO/D;AAED,qGAAqG;AACrG,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,YAAY,GAAG,IAAI,EAC9B,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,mBAAmB,CAAC,CAwB9B"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { GeminiCliResponseSchema } from "../../../schemas/cli.js";
|
|
2
|
+
import { readCliResponse } from "../../specs/cli-response.js";
|
|
3
|
+
import { geminiFailure } from "../../failure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Consumer-host probes for the two Google subscription CLIs. Raw CLI
|
|
6
|
+
* diagnostics never leave this module except as classified failures;
|
|
7
|
+
* no credential files are read.
|
|
8
|
+
*/
|
|
9
|
+
import { composeChildEnv, settle } from '@vibesdotdev/kernel';
|
|
10
|
+
import { ANTIGRAVITY_INHERIT_ENV } from "./antigravity-server/runtime-execution.js";
|
|
11
|
+
import { ANTIGRAVITY_CLI_BINARY, GEMINI_CLI_BINARY, classifyGeminiCliOutput, geminiCliRemedy } from "./gemini-cli-status.js";
|
|
12
|
+
/**
|
|
13
|
+
* Every probe runs with `envMode: 'replace'` and the kernel's composed
|
|
14
|
+
* environment (rc02-rc03 C22): the host base set (each CLI's sign-in lives
|
|
15
|
+
* under HOME) plus the names declared here. A probe checks the subscription
|
|
16
|
+
* sign-in, so `GEMINI_API_KEY` is not among its names: an inherited one
|
|
17
|
+
* would make the Gemini CLI authenticate by key and report a healthy
|
|
18
|
+
* subscription that is not there. The Gemini CLI's Code Assist tier check reads the selected Cloud
|
|
19
|
+
* project; both CLIs honour the proxy and CA settings.
|
|
20
|
+
*/
|
|
21
|
+
export const GEMINI_CLI_INHERIT_ENV = [
|
|
22
|
+
'GOOGLE_CLOUD_PROJECT',
|
|
23
|
+
'HTTPS_PROXY',
|
|
24
|
+
'HTTP_PROXY',
|
|
25
|
+
'NO_PROXY',
|
|
26
|
+
'SSL_CERT_FILE'
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Measured 2026-09-06: Gemini CLI 0.58.0 needs ~4.9s to reach its auth
|
|
30
|
+
* decision and `agy models` ~3.4s, so the 5s default health timeout would
|
|
31
|
+
* report every probe as a timeout. Callers may ask for longer, never shorter.
|
|
32
|
+
*/
|
|
33
|
+
export const CLI_PROBE_TIMEOUT_MS = 15_000;
|
|
34
|
+
export function probeTimeout(requested) {
|
|
35
|
+
return Math.max(requested ?? 0, CLI_PROBE_TIMEOUT_MS);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Headless Gemini CLI probe. The CLI performs its Code Assist tier check
|
|
39
|
+
* before the prompt runs, so an ineligible client fails here without
|
|
40
|
+
* generating; an eligible one answers a one-token prompt.
|
|
41
|
+
*/
|
|
42
|
+
export async function probeGeminiCli(runtime, execution, timeout) {
|
|
43
|
+
if (!execution)
|
|
44
|
+
return { kind: 'unavailable' };
|
|
45
|
+
const located = await settle(() => execution.resolveCommand(GEMINI_CLI_BINARY));
|
|
46
|
+
if (!located.ok)
|
|
47
|
+
throw geminiFailure('gemini-execution-unavailable', located.cause);
|
|
48
|
+
if (!located.value)
|
|
49
|
+
return { kind: 'unavailable' };
|
|
50
|
+
const executed = await settle(() => execution.execute({
|
|
51
|
+
command: GEMINI_CLI_BINARY,
|
|
52
|
+
args: ['--output-format', 'json', '--approval-mode', 'plan', '--prompt', 'Reply with OK'],
|
|
53
|
+
env: composeChildEnv(runtime, {
|
|
54
|
+
env: { GEMINI_CLI_TRUST_WORKSPACE: 'true' },
|
|
55
|
+
inheritEnv: GEMINI_CLI_INHERIT_ENV
|
|
56
|
+
}),
|
|
57
|
+
envMode: 'replace',
|
|
58
|
+
timeout
|
|
59
|
+
}));
|
|
60
|
+
if (!executed.ok)
|
|
61
|
+
throw geminiFailure('gemini-execution-unavailable', executed.cause);
|
|
62
|
+
const result = executed.value;
|
|
63
|
+
if (result.timedOut)
|
|
64
|
+
return { kind: 'timeout' };
|
|
65
|
+
const failure = classifyGeminiCliOutput(`${result.stderr}\n${result.stdout}`);
|
|
66
|
+
if (failure)
|
|
67
|
+
return { kind: 'failure', failure };
|
|
68
|
+
if (result.exitCode === 0) {
|
|
69
|
+
readCliResponse(result.stdout, GeminiCliResponseSchema);
|
|
70
|
+
return { kind: 'healthy' };
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
kind: 'failure',
|
|
74
|
+
failure: {
|
|
75
|
+
code: 'CLI_ERROR',
|
|
76
|
+
message: `Gemini CLI exited with code ${String(result.exitCode)}.`,
|
|
77
|
+
remedy: geminiCliRemedy('CLI_ERROR')
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Parse `agy models` output (`<id>\t<label>` per line) into wire model ids. */
|
|
82
|
+
export function parseAntigravityModels(stdout) {
|
|
83
|
+
return stdout
|
|
84
|
+
.split(/\r?\n/)
|
|
85
|
+
.map((line) => line.trim())
|
|
86
|
+
.filter((line) => line.length > 0 && !/^Fetching/i.test(line))
|
|
87
|
+
.map((line) => line.split(/\t|\s{2,}/)[0]?.trim() ?? '')
|
|
88
|
+
.filter((id) => /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(id));
|
|
89
|
+
}
|
|
90
|
+
/** `agy models` needs a signed-in account and lists the subscription's models without generating. */
|
|
91
|
+
export async function probeAntigravityCli(runtime, execution, timeout) {
|
|
92
|
+
if (!execution)
|
|
93
|
+
return { kind: 'unavailable' };
|
|
94
|
+
const located = await settle(() => execution.resolveCommand(ANTIGRAVITY_CLI_BINARY));
|
|
95
|
+
if (!located.ok)
|
|
96
|
+
throw geminiFailure('gemini-execution-unavailable', located.cause);
|
|
97
|
+
if (!located.value)
|
|
98
|
+
return { kind: 'unavailable' };
|
|
99
|
+
const executed = await settle(() => execution.execute({
|
|
100
|
+
command: ANTIGRAVITY_CLI_BINARY,
|
|
101
|
+
args: ['models'],
|
|
102
|
+
env: composeChildEnv(runtime, { inheritEnv: ANTIGRAVITY_INHERIT_ENV }),
|
|
103
|
+
envMode: 'replace',
|
|
104
|
+
timeout
|
|
105
|
+
}));
|
|
106
|
+
if (!executed.ok)
|
|
107
|
+
throw geminiFailure('gemini-execution-unavailable', executed.cause);
|
|
108
|
+
const result = executed.value;
|
|
109
|
+
if (result.timedOut)
|
|
110
|
+
return { kind: 'timeout' };
|
|
111
|
+
const models = parseAntigravityModels(result.stdout);
|
|
112
|
+
if (result.exitCode === 0 && models.length > 0)
|
|
113
|
+
return { kind: 'healthy', models };
|
|
114
|
+
return {
|
|
115
|
+
kind: 'failure',
|
|
116
|
+
message: result.exitCode === 0
|
|
117
|
+
? 'Antigravity CLI listed no models'
|
|
118
|
+
: `Antigravity CLI exited with code ${String(result.exitCode)}`
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=cli-probes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-probes.js","sourceRoot":"","sources":["../../../../src/ai/providers/gemini/cli-probes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EACN,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EAEf,MAAM,wBAAwB,CAAC;AAkBhC;;;;;;;;GAQG;AACH,M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EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACnF,OAAO;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EACN,MAAM,CAAC,QAAQ,KAAK,CAAC;YACpB,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,oCAAoC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;KACjE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DetectedProvider } from '@vibesdotdev/ai/providers-runtime/client/types';
|
|
2
|
+
import type { RuntimeRef } from '@vibesdotdev/kernel';
|
|
3
|
+
import { type CliExecution, type CliProbeRuntime } from '../cli-probes.ts';
|
|
4
|
+
/** Test seam: detection normally resolves the host execution from the active runtime. */
|
|
5
|
+
export interface GeminiDetectionDependencies {
|
|
6
|
+
execution?: CliExecution | null;
|
|
7
|
+
/** The runtime the probes compose their environment from; defaults to the host's. */
|
|
8
|
+
runtime?: CliProbeRuntime;
|
|
9
|
+
hardware?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Detect Gemini credentials without returning secret material.
|
|
14
|
+
*
|
|
15
|
+
* An environment API key reports `available`. Otherwise the consumer host's
|
|
16
|
+
* Gemini CLI is probed: a client Google has retired from Gemini Code Assist
|
|
17
|
+
* for individuals reports `stopped` under the name
|
|
18
|
+
* "Gemini CLI: subscription moved to Antigravity" with the upstream reason
|
|
19
|
+
* and remedy in its description, so `vibes ai recommend` names the cause
|
|
20
|
+
* instead of omitting the provider. Subscription CLIs that are healthy are
|
|
21
|
+
* not reported as system detections: discovery would materialise them as a
|
|
22
|
+
* system-custodied connection that cannot certify user billing.
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectGeminiSystem(runtime: RuntimeRef, dependencies?: GeminiDetectionDependencies): Promise<DetectedProvider | null>;
|
|
25
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/detection/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAIN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,MAAM,kBAAkB,CAAC;AAE1B,yFAAyF;AACzF,MAAM,WAAW,2BAA2B;IAC3C,SAAS,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAChC,qFAAqF;IACrF,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAQD;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,UAAU,EACnB,YAAY,CAAC,EAAE,2BAA2B,GACxC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsDlC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { getRuntimeExecution } from '@vibesdotdev/kernel/execution';
|
|
2
|
+
import { GEMINI_CLI_MIGRATION_SUMMARY, describeGeminiCliFailure } from "../gemini-cli-status.js";
|
|
3
|
+
import { probeAntigravityCli, probeGeminiCli, probeTimeout } from "../cli-probes.js";
|
|
4
|
+
async function resolveHostExecution(runtime) {
|
|
5
|
+
const hardware = runtime.scope.hardware;
|
|
6
|
+
if (hardware === 'cloud' || !runtime.hasKind('runtime/execution'))
|
|
7
|
+
return { execution: null, hardware };
|
|
8
|
+
return { execution: await getRuntimeExecution(runtime), hardware, runtime };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Detect Gemini credentials without returning secret material.
|
|
12
|
+
*
|
|
13
|
+
* An environment API key reports `available`. Otherwise the consumer host's
|
|
14
|
+
* Gemini CLI is probed: a client Google has retired from Gemini Code Assist
|
|
15
|
+
* for individuals reports `stopped` under the name
|
|
16
|
+
* "Gemini CLI: subscription moved to Antigravity" with the upstream reason
|
|
17
|
+
* and remedy in its description, so `vibes ai recommend` names the cause
|
|
18
|
+
* instead of omitting the provider. Subscription CLIs that are healthy are
|
|
19
|
+
* not reported as system detections: discovery would materialise them as a
|
|
20
|
+
* system-custodied connection that cannot certify user billing.
|
|
21
|
+
*/
|
|
22
|
+
export async function detectGeminiSystem(runtime, dependencies) {
|
|
23
|
+
let envKey;
|
|
24
|
+
for (const key of ["GEMINI_API_KEY", "GOOGLE_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"]) {
|
|
25
|
+
const credential = await runtime.resolveCredential({ source: 'secret', key });
|
|
26
|
+
if (!credential.ok) {
|
|
27
|
+
if (credential.error.reason === 'credential-not-set')
|
|
28
|
+
continue;
|
|
29
|
+
throw credential.error;
|
|
30
|
+
}
|
|
31
|
+
if (credential.value.trim()) {
|
|
32
|
+
envKey = key;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (envKey)
|
|
37
|
+
return {
|
|
38
|
+
providerType: 'gemini', name: 'Google Gemini',
|
|
39
|
+
description: `Credential reference available from ${envKey}`, status: 'available', models: [],
|
|
40
|
+
configuration: {
|
|
41
|
+
authMethod: 'api-key', tokenSource: 'credential',
|
|
42
|
+
apiKey: { source: 'secret', key: envKey },
|
|
43
|
+
baseUrl: 'https://generativelanguage.googleapis.com/v1beta/openai', timeout: 60000
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const host = dependencies?.execution === undefined
|
|
47
|
+
? await resolveHostExecution(runtime)
|
|
48
|
+
: {
|
|
49
|
+
execution: dependencies.execution,
|
|
50
|
+
hardware: dependencies.hardware,
|
|
51
|
+
runtime: dependencies.runtime ?? runtime
|
|
52
|
+
};
|
|
53
|
+
if ((dependencies?.hardware ?? host.hardware) === 'cloud' || !host.execution || !host.runtime)
|
|
54
|
+
return null;
|
|
55
|
+
const timeout = probeTimeout(dependencies?.timeout);
|
|
56
|
+
const probe = await probeGeminiCli(host.runtime, host.execution, timeout);
|
|
57
|
+
if (probe.kind !== 'failure')
|
|
58
|
+
return null;
|
|
59
|
+
const failure = probe.failure;
|
|
60
|
+
if (failure.code === 'UNSUPPORTED_CLIENT') {
|
|
61
|
+
const antigravity = await probeAntigravityCli(host.runtime, host.execution, timeout);
|
|
62
|
+
const next = antigravity.kind === 'healthy'
|
|
63
|
+
? ` Antigravity CLI (agy) is installed and signed in with ${antigravity.models.length} models: set this connection's authMethod to 'antigravity'.`
|
|
64
|
+
: '';
|
|
65
|
+
return {
|
|
66
|
+
providerType: 'gemini',
|
|
67
|
+
name: GEMINI_CLI_MIGRATION_SUMMARY,
|
|
68
|
+
description: `${describeGeminiCliFailure(failure)}${next}`,
|
|
69
|
+
status: 'stopped',
|
|
70
|
+
models: []
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
providerType: 'gemini',
|
|
75
|
+
name: 'Google Gemini CLI',
|
|
76
|
+
description: describeGeminiCliFailure(failure),
|
|
77
|
+
status: 'stopped',
|
|
78
|
+
models: []
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/detection/system.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,m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AAC,CAAC,0DAA0D,WAAW,CAAC,MAAM,CAAC,MAAM,6DAA6D;YAClJ,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACN,YAAY,EAAE,QAAQ;YACtB,IAAI,EAAE,4BAA4B;YAClC,WAAW,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE;YAC1D,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,EAAE;SACV,CAAC;IACH,CAAC;IACD,OAAO;QACN,YAAY,EAAE,QAAQ;QACtB,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,wBAAwB,CAAC,OAAO,CAAC;QAC9C,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,EAAE;KACV,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.providers.gemini.docs.descriptor.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,QAAA,MAAM,UAAU,EAAE,mBAoDjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const descriptor = {
|
|
2
|
+
kind: 'docs/topic', id: 'ai.providers.gemini', title: 'Google Gemini provider',
|
|
3
|
+
summary: 'Use Gemini through the Antigravity CLI, the legacy Gemini CLI, or runtime-resolved API credentials.',
|
|
4
|
+
body: {
|
|
5
|
+
type: 'markdown', sourceType: 'raw',
|
|
6
|
+
source: `# Google Gemini provider
|
|
7
|
+
|
|
8
|
+
\`@vibesdotdev/integrations-gemini\` owns Gemini provider identity, configuration,
|
|
9
|
+
detection, recommendation policy, and Gemini-specific protocol specs. Framework
|
|
10
|
+
retains only provider-neutral AI kinds.
|
|
11
|
+
|
|
12
|
+
The consumer-only CLI variants reuse a local Google sign-in without exposing
|
|
13
|
+
Google account tokens. Cloud runtimes use a \`GEMINI_API_KEY\` credential
|
|
14
|
+
reference. Generation resolves \`ai/generation\`; callers do not construct a
|
|
15
|
+
Google client or import provider internals.
|
|
16
|
+
|
|
17
|
+
## Runtime composition
|
|
18
|
+
|
|
19
|
+
Use \`/ai/cloud.plugin\` for API-key hosts and \`/ai/consumer.plugin\` for CLI
|
|
20
|
+
hosts (\`/ai/plugin\` is the consumer alias). The root exposes connection schemas
|
|
21
|
+
and semantic client helpers. \`getVibesGeminiClient(runtime)\` resolves
|
|
22
|
+
\`runtime/client:gemini\`; each consumer runtime owns and closes its own lazy
|
|
23
|
+
Antigravity transport. Malformed or incomplete responses are typed refusals.
|
|
24
|
+
Antigravity skips approval prompts only for a call declaring both
|
|
25
|
+
\`danger-full-access\` and \`never\`; other policies keep child review.
|
|
26
|
+
|
|
27
|
+
## Auth methods
|
|
28
|
+
|
|
29
|
+
| authMethod | Binary | Status |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| \`antigravity\` | \`agy\` (Google Antigravity CLI) | Current subscription path. \`agy --print\` runs headlessly; Gemini model ids take a \`-low\`/\`-medium\`/\`-high\` suffix or the request's reasoning effort. |
|
|
32
|
+
| \`gemini-cli\` | \`gemini\` (@google/gemini-cli) | Legacy. Google retired Gemini Code Assist for individuals from this client; it reports \`UNSUPPORTED_CLIENT\` and points at https://antigravity.google. |
|
|
33
|
+
| \`api-key\` | none | Works on every host and is the fallback when neither CLI is usable. |
|
|
34
|
+
|
|
35
|
+
## Gemini CLI: subscription moved to Antigravity
|
|
36
|
+
|
|
37
|
+
When the Gemini CLI answers \`IneligibleTierError\` with
|
|
38
|
+
\`reasonCode: 'UNSUPPORTED_CLIENT'\`, health, detection, and generation all
|
|
39
|
+
report the stable typed refusal \`gemini-cli-retired\` with fixed migration guidance,
|
|
40
|
+
never the upstream response text. The remedy is to install the
|
|
41
|
+
Antigravity CLI (\`agy\`), sign in with \`vibes dev external antigravity login\`, and set the connection's
|
|
42
|
+
\`authMethod\` to \`antigravity\`; or set \`authMethod\` to \`api-key\` with a
|
|
43
|
+
\`GEMINI_API_KEY\` credential reference. Antigravity's desktop app exposes no
|
|
44
|
+
generation surface Vibes can use (its language server listens on loopback
|
|
45
|
+
behind a CSRF token and speaks a private protocol); only the CLI is wired.
|
|
46
|
+
|
|
47
|
+
Current model recommendations are maintained from Google's model lifecycle docs:
|
|
48
|
+
https://ai.google.dev/gemini-api/docs/models
|
|
49
|
+
`
|
|
50
|
+
},
|
|
51
|
+
tags: ['ai', 'providers', 'gemini', 'google', 'antigravity'], parent: 'ai.providers', order: 3,
|
|
52
|
+
surfaces: ['cli', 'web', 'in-app'], hardware: ['consumer', 'cloud'], enabled: true
|
|
53
|
+
};
|
|
54
|
+
export default descriptor;
|
|
55
|
+
//# sourceMappingURL=ai.providers.gemini.docs.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.providers.gemini.docs.descriptor.js","sourceRoot":"","sources":["../../../../../src/ai/providers/gemini/docs/ai.providers.gemini.docs.descriptor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAwB;IACvC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,wBAAwB;IAC9E,OAAO,EAAE,qGAAqG;IAC9G,IAAI,EAAE;QACL,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK;QACnC,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CT;KACC;IACD,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC9F,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI;CAClF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini CLI status classification.
|
|
3
|
+
*
|
|
4
|
+
* Google retired Gemini Code Assist for individuals from the Gemini CLI and
|
|
5
|
+
* moved the subscription to the Antigravity suite. The CLI reports that as an
|
|
6
|
+
* `IneligibleTierError` on stderr (Node `util.inspect` output, not JSON):
|
|
7
|
+
*
|
|
8
|
+
* Error authenticating: IneligibleTierError: This client is no longer supported ...
|
|
9
|
+
* at throwIneligibleOrProjectIdError (...)
|
|
10
|
+
* {
|
|
11
|
+
* ineligibleTiers: [
|
|
12
|
+
* { reasonCode: 'UNSUPPORTED_CLIENT', reasonMessage: '...', tierId: 'free-tier', tierName: '...' }
|
|
13
|
+
* ]
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* This module turns that output into a structured failure (reason code,
|
|
17
|
+
* upstream message, migration URL, remedy) so health, detection, and the
|
|
18
|
+
* generation path all surface the same actionable diagnosis. It never reads
|
|
19
|
+
* credential files and never includes raw stack traces in user-facing text.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ANTIGRAVITY_URL = "https://antigravity.google";
|
|
22
|
+
export declare const GEMINI_CLI_BINARY = "gemini";
|
|
23
|
+
export declare const ANTIGRAVITY_CLI_BINARY = "agy";
|
|
24
|
+
export declare const GEMINI_CLI_MIGRATION_SUMMARY = "Gemini CLI: subscription moved to Antigravity";
|
|
25
|
+
export declare const GEMINI_API_KEY_FALLBACK = "set authMethod to 'api-key' with a GEMINI_API_KEY credential reference";
|
|
26
|
+
export declare const ANTIGRAVITY_LOGIN_COMMAND = "vibes dev external antigravity login";
|
|
27
|
+
export declare const ANTIGRAVITY_STATUS_COMMAND = "vibes dev external antigravity status";
|
|
28
|
+
export declare const ANTIGRAVITY_REMEDY = "install the Antigravity CLI (agy, https://antigravity.google), sign in with `vibes dev external antigravity login` (that runs `agy`), and set this connection's authMethod to 'antigravity'";
|
|
29
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
30
|
+
import type { GeminiCliFailure, GeminiCliFailureCode, GeminiCliIneligibleTier } from '../../../schemas/cli.ts';
|
|
31
|
+
export type { GeminiCliFailure, GeminiCliFailureCode, GeminiCliIneligibleTier } from '../../../schemas/cli.ts';
|
|
32
|
+
/** Extract every `ineligibleTiers[]` entry the Gemini CLI printed. */
|
|
33
|
+
export declare function parseGeminiCliIneligibleTiers(output: string): GeminiCliIneligibleTier[];
|
|
34
|
+
export declare function geminiCliRemedy(code: GeminiCliFailureCode): string;
|
|
35
|
+
/**
|
|
36
|
+
* Classify Gemini CLI stderr/stdout (or a transport error message that embeds
|
|
37
|
+
* it). Returns `null` when the output carries no recognisable failure.
|
|
38
|
+
*/
|
|
39
|
+
export declare function classifyGeminiCliOutput(output: string | undefined | null): GeminiCliFailure | null;
|
|
40
|
+
export declare function geminiCliFailure(failure: GeminiCliFailure): CapabilityError;
|
|
41
|
+
export declare function describeGeminiCliFailure(failure: GeminiCliFailure): string;
|
|
42
|
+
//# sourceMappingURL=gemini-cli-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-cli-status.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/gemini/gemini-cli-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,eAAO,MAAM,4BAA4B,kDAAkD,CAAC;AAC5F,eAAO,MAAM,uBAAuB,2EACqC,CAAC;AAC1E,eAAO,MAAM,yBAAyB,yCAAyC,CAAC;AAChF,eAAO,MAAM,0BAA0B,0CAA0C,CAAC;AAClF,eAAO,MAAM,kBAAkB,gMAC+L,CAAC;AAE/N,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAE/G,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAa/G,sEAAsE;AACtE,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAcvF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAclE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,gBAAgB,GAAG,IAAI,CA2ClG;AAWD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAM3E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAE1E"}
|