@cortexkit/opencode-antigravity-auth 3.0.26 → 3.0.28
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/dist/cli.js.map +1 -1
- package/dist/cli.meta.json +2 -2
- package/dist/index.js +670 -201
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +18 -18
- package/dist/server.js +876 -326
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/ga/server/index.d.ts +3 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +89 -6
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +4 -2
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +28 -20
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.js +2 -2
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +139 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +512 -0
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +219 -63
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +1 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +36 -127
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-menu.d.ts +1 -1
- package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-menu.js +4 -2
- package/dist/src/plugin/shared/vault-menu.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +11 -4
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +67 -16
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/types/src/ga/server/index.d.ts +3 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/request-helpers.d.ts +139 -0
- package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-menu.d.ts +1 -1
- package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +11 -4
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
|
-
import { applyAgyNativeGenerationConfig, getAgyNativeModel, isGeminiArgonModel, isRetiredAgyModel, maskSensitiveIdentifier, redactProjectIdText, } from '@cortexkit/antigravity-auth-core';
|
|
2
|
+
import { applyAgyNativeGenerationConfig, getAgyNativeModel, isGeminiArgonModel, isRetiredAgyModel, maskSensitiveIdentifier, redactCredentialError, redactCredentialResponse, redactCredentialText, redactProjectIdText, } from '@cortexkit/antigravity-auth-core';
|
|
3
3
|
import { ANTIGRAVITY_DEFAULT_PROJECT_ID, ANTIGRAVITY_ENDPOINT, CLAUDE_DESCRIPTION_PROMPT, CLAUDE_TOOL_SYSTEM_INSTRUCTION, EMPTY_SCHEMA_PLACEHOLDER_DESCRIPTION, EMPTY_SCHEMA_PLACEHOLDER_NAME, getRandomizedHeaders, SKIP_THOUGHT_SIGNATURE, } from '../constants';
|
|
4
4
|
import { buildAgyAgentRequestMetadata, createAgyRequestSessionContext, orderAgyRequestPayloadInPlace, } from './agy-request-metadata';
|
|
5
5
|
import { cacheSignature, getCachedSignature, } from './cache';
|
|
@@ -11,7 +11,7 @@ import { appendGeminiDumpResponseText, createGeminiDumpResponseTransform, noteGe
|
|
|
11
11
|
import { isCanonicalGoogleOrigin } from "./google-origin.js";
|
|
12
12
|
import { createLogger } from './logger';
|
|
13
13
|
import { detectErrorType } from './recovery';
|
|
14
|
-
import { applyToolPairingFixes, cleanJSONSchemaForAntigravity, deepFilterThinkingBlocks, extractThinkingConfig, extractUsageFromSsePayload, extractUsageMetadata, extractVariantThinkingConfig, fixToolResponseGrouping, injectParameterSignatures, injectToolHardeningInstruction, isThinkingCapableModel, normalizeThinkingConfig, parseAntigravityApiBody, resolveThinkingConfig, rewriteAntigravityPreviewAccessError, transformThinkingParts, validateAndFixClaudeToolPairing, } from './request-helpers';
|
|
14
|
+
import { applyToolPairingFixes, cleanJSONSchemaForAntigravity, collectForwardedHeaders, deepFilterThinkingBlocks, deriveRetryHeaderPairFromMs, extractAntigravityError, extractThinkingConfig, extractUsageFromSsePayload, extractUsageMetadata, extractVariantThinkingConfig, fixToolResponseGrouping, injectParameterSignatures, injectToolHardeningInstruction, isQuotaError, isThinkingCapableModel, normalizeResetDuration, normalizeThinkingConfig, parseAntigravityApiBody, resolveRetryMetadata, resolveThinkingConfig, rewriteAntigravityPreviewAccessError, transformThinkingParts, validateAndFixClaudeToolPairing, } from './request-helpers';
|
|
15
15
|
import { defaultSignatureStore } from './stores/signature-store';
|
|
16
16
|
import { analyzeConversationState, closeToolLoopForThinking, needsThinkingRecovery, } from './thinking-recovery';
|
|
17
17
|
import { appendClaudeThinkingHint, applyGeminiTransforms, buildImageGenerationConfig, computeClaudeMaxOutputTokens, isClaudeModel, isClaudeThinkingModel, isGemini3Model, isImageGenerationModel, resolveAntigravityModel, } from './transform';
|
|
@@ -1914,10 +1914,12 @@ async function transformAntigravityResponseIn(wire, response, streaming, debugCo
|
|
|
1914
1914
|
: undefined;
|
|
1915
1915
|
const cacheSignatures = shouldCacheThinkingSignatures(effectiveModel);
|
|
1916
1916
|
if (!isJsonResponse && !isEventStreamResponse) {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1917
|
+
if (response.ok) {
|
|
1918
|
+
wire.debug.logAntigravityDebugResponse(debugContext, response, {
|
|
1919
|
+
note: 'Non-JSON response (body omitted)',
|
|
1920
|
+
});
|
|
1921
|
+
return response;
|
|
1922
|
+
}
|
|
1921
1923
|
}
|
|
1922
1924
|
// For successful streaming responses, use TransformStream to transform SSE events
|
|
1923
1925
|
// while maintaining real-time streaming (no buffering of entire response).
|
|
@@ -1967,79 +1969,233 @@ async function transformAntigravityResponseIn(wire, response, streaming, debugCo
|
|
|
1967
1969
|
headers,
|
|
1968
1970
|
});
|
|
1969
1971
|
}
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
+
if (!response.ok) {
|
|
1973
|
+
const projectIds = projectId ? [projectId] : undefined;
|
|
1972
1974
|
const headers = new Headers(response.headers);
|
|
1973
|
-
const
|
|
1975
|
+
const initialForwarded = collectForwardedHeaders(headers);
|
|
1976
|
+
if (initialForwarded['retry-after'] !== undefined &&
|
|
1977
|
+
initialForwarded['retry-after-ms'] !== undefined) {
|
|
1978
|
+
headers.set('Retry-After', initialForwarded['retry-after']);
|
|
1979
|
+
headers.set('retry-after', initialForwarded['retry-after']);
|
|
1980
|
+
headers.set('retry-after-ms', initialForwarded['retry-after-ms']);
|
|
1981
|
+
}
|
|
1982
|
+
else {
|
|
1983
|
+
headers.delete('Retry-After');
|
|
1984
|
+
headers.delete('retry-after');
|
|
1985
|
+
headers.delete('retry-after-ms');
|
|
1986
|
+
}
|
|
1987
|
+
let text;
|
|
1988
|
+
try {
|
|
1989
|
+
text = await response.text();
|
|
1990
|
+
}
|
|
1991
|
+
catch (readError) {
|
|
1992
|
+
const sanitizedCause = readError instanceof Error ||
|
|
1993
|
+
(readError !== null && typeof readError === 'object')
|
|
1994
|
+
? redactCredentialError(readError, undefined, projectIds)
|
|
1995
|
+
: undefined;
|
|
1996
|
+
const safeMessage = sanitizedCause
|
|
1997
|
+
? sanitizedCause.message
|
|
1998
|
+
: redactCredentialText(String(readError), undefined, projectIds);
|
|
1999
|
+
const scrubbedStatusText = redactCredentialText(response.statusText, undefined, projectIds);
|
|
2000
|
+
const plainHeaders = {};
|
|
2001
|
+
for (const [key, value] of headers.entries()) {
|
|
2002
|
+
plainHeaders[key] = redactCredentialText(value, undefined, projectIds);
|
|
2003
|
+
}
|
|
2004
|
+
if (initialForwarded['retry-after'] !== undefined &&
|
|
2005
|
+
initialForwarded['retry-after-ms'] !== undefined) {
|
|
2006
|
+
plainHeaders['retry-after'] = initialForwarded['retry-after'];
|
|
2007
|
+
plainHeaders['retry-after-ms'] = initialForwarded['retry-after-ms'];
|
|
2008
|
+
plainHeaders['Retry-After'] = initialForwarded['retry-after'];
|
|
2009
|
+
}
|
|
2010
|
+
const freshError = new Error(`Failed to read response body: ${safeMessage}`, sanitizedCause ? { cause: sanitizedCause } : undefined);
|
|
2011
|
+
Object.assign(freshError, {
|
|
2012
|
+
statusCode: response.status,
|
|
2013
|
+
status: response.status,
|
|
2014
|
+
statusText: scrubbedStatusText,
|
|
2015
|
+
headers: plainHeaders,
|
|
2016
|
+
});
|
|
2017
|
+
throw freshError;
|
|
2018
|
+
}
|
|
1974
2019
|
noteGeminiDumpResponse(dumpContext, response);
|
|
1975
2020
|
appendGeminiDumpResponseText(dumpContext, text);
|
|
1976
|
-
|
|
1977
|
-
|
|
2021
|
+
const createSafeFallback = (bodyContent, contentTypeOverride) => {
|
|
2022
|
+
const fallbackHeaders = new Headers(headers);
|
|
2023
|
+
fallbackHeaders.delete('content-length');
|
|
2024
|
+
if (contentTypeOverride) {
|
|
2025
|
+
fallbackHeaders.set('content-type', contentTypeOverride);
|
|
2026
|
+
}
|
|
2027
|
+
const safeText = redactProjectIdText(bodyContent, projectIds);
|
|
2028
|
+
const fallbackResponse = new Response(safeText, {
|
|
2029
|
+
status: response.status,
|
|
2030
|
+
statusText: response.statusText,
|
|
2031
|
+
headers: fallbackHeaders,
|
|
2032
|
+
});
|
|
2033
|
+
return redactCredentialResponse(fallbackResponse, undefined, safeText, projectIds);
|
|
2034
|
+
};
|
|
2035
|
+
try {
|
|
2036
|
+
let parsedBody = null;
|
|
2037
|
+
let isJson = false;
|
|
2038
|
+
// Try direct JSON parse first
|
|
1978
2039
|
try {
|
|
1979
|
-
|
|
2040
|
+
parsedBody = JSON.parse(text);
|
|
2041
|
+
isJson = true;
|
|
1980
2042
|
}
|
|
1981
2043
|
catch {
|
|
1982
|
-
|
|
2044
|
+
isJson = false;
|
|
1983
2045
|
}
|
|
1984
|
-
//
|
|
1985
|
-
if (
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
if (errorType === 'thinking_block_order') {
|
|
2000
|
-
const recoveryError = new Error('THINKING_RECOVERY_NEEDED');
|
|
2001
|
-
recoveryError.recoveryType = errorType;
|
|
2002
|
-
recoveryError.originalError = errorBody;
|
|
2003
|
-
recoveryError.debugInfo = debugInfo;
|
|
2004
|
-
throw recoveryError;
|
|
2046
|
+
// If SSE failed body, parse JSON first then data: JSON payload
|
|
2047
|
+
if (!isJson && (isEventStreamResponse || text.includes('data:'))) {
|
|
2048
|
+
for (const line of text.split('\n')) {
|
|
2049
|
+
const trimmed = line.trim();
|
|
2050
|
+
if (trimmed.startsWith('data:')) {
|
|
2051
|
+
const payload = trimmed.slice(5).trim();
|
|
2052
|
+
if (payload.length > 0 && payload !== '[DONE]') {
|
|
2053
|
+
try {
|
|
2054
|
+
parsedBody = JSON.parse(payload);
|
|
2055
|
+
isJson = true;
|
|
2056
|
+
break;
|
|
2057
|
+
}
|
|
2058
|
+
catch { }
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2005
2061
|
}
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2062
|
+
}
|
|
2063
|
+
// If malformed JSON on application/json, preserve original diagnostic behavior
|
|
2064
|
+
if (!isJson && isJsonResponse) {
|
|
2065
|
+
parsedBody = {
|
|
2066
|
+
error: {
|
|
2067
|
+
code: response.status,
|
|
2068
|
+
message: text,
|
|
2069
|
+
status: 'UNAVAILABLE',
|
|
2070
|
+
},
|
|
2071
|
+
};
|
|
2072
|
+
isJson = true;
|
|
2073
|
+
}
|
|
2074
|
+
const errorRecord = isJson ? extractAntigravityError(parsedBody) : null;
|
|
2075
|
+
// Resolve shared retry metadata
|
|
2076
|
+
const retryMeta = resolveRetryMetadata({
|
|
2077
|
+
details: errorRecord?.details,
|
|
2078
|
+
message: typeof errorRecord?.message === 'string'
|
|
2079
|
+
? errorRecord.message
|
|
2080
|
+
: undefined,
|
|
2081
|
+
status: response.status,
|
|
2082
|
+
headers,
|
|
2083
|
+
// The transformer renders what the host sees, so it follows the
|
|
2084
|
+
// executor's rule: an upstream zero delay falls through to the
|
|
2085
|
+
// response's own header instead of becoming a zero wait here.
|
|
2086
|
+
allowZero: false,
|
|
2087
|
+
});
|
|
2088
|
+
if (retryMeta !== null) {
|
|
2089
|
+
const pair = deriveRetryHeaderPairFromMs(retryMeta.delayMs);
|
|
2090
|
+
headers.set('Retry-After', pair['retry-after']);
|
|
2091
|
+
headers.set('retry-after', pair['retry-after']);
|
|
2092
|
+
headers.set('retry-after-ms', pair['retry-after-ms']);
|
|
2093
|
+
}
|
|
2094
|
+
else {
|
|
2095
|
+
headers.delete('Retry-After');
|
|
2096
|
+
headers.delete('retry-after');
|
|
2097
|
+
headers.delete('retry-after-ms');
|
|
2098
|
+
}
|
|
2099
|
+
// Determine diagnostic error text for classification across ALL failure formats
|
|
2100
|
+
let diagnosticErrorText = '';
|
|
2101
|
+
if (errorRecord && typeof errorRecord.message === 'string') {
|
|
2102
|
+
diagnosticErrorText = errorRecord.message;
|
|
2103
|
+
}
|
|
2104
|
+
else if (parsedBody &&
|
|
2105
|
+
typeof parsedBody === 'object' &&
|
|
2106
|
+
!Array.isArray(parsedBody)) {
|
|
2107
|
+
const errProp = parsedBody.error;
|
|
2108
|
+
if (typeof errProp === 'string') {
|
|
2109
|
+
diagnosticErrorText = errProp;
|
|
2013
2110
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
errorMessage.includes('tool_result') &&
|
|
2017
|
-
(errorMessage.includes('without') ||
|
|
2018
|
-
errorMessage.includes('immediately after'))) {
|
|
2019
|
-
headers.set('x-antigravity-context-error', 'tool_pairing');
|
|
2111
|
+
else {
|
|
2112
|
+
diagnosticErrorText = text;
|
|
2020
2113
|
}
|
|
2021
|
-
|
|
2114
|
+
}
|
|
2115
|
+
else {
|
|
2116
|
+
diagnosticErrorText = text;
|
|
2117
|
+
}
|
|
2118
|
+
const safeProjectId = maskSensitiveIdentifier(projectId) || 'Unknown';
|
|
2119
|
+
const debugInfo = `\n\n[Debug Info]\nRequested Model: ${requestedModel || 'Unknown'}\nEffective Model: ${effectiveModel || 'Unknown'}\nProject: ${safeProjectId}\nEndpoint: ${endpoint || 'Unknown'}\nStatus: ${response.status}\nRequest ID: ${headers.get('x-request-id') || 'N/A'}${toolDebugMissing !== undefined ? `\nTool Debug Missing: ${toolDebugMissing}` : ''}${toolDebugSummary ? `\nTool Debug Summary: ${toolDebugSummary}` : ''}`;
|
|
2120
|
+
const injectedDebug = debugText ? `\n\n${debugText}` : '';
|
|
2121
|
+
const safeDiagnosticText = redactProjectIdText(diagnosticErrorText, projectIds);
|
|
2122
|
+
const errorType = detectErrorType(safeDiagnosticText);
|
|
2123
|
+
if (errorType === 'thinking_block_order') {
|
|
2124
|
+
const recoveryError = new Error('THINKING_RECOVERY_NEEDED');
|
|
2125
|
+
recoveryError.recoveryType = errorType;
|
|
2126
|
+
recoveryError.originalError = parsedBody ?? safeDiagnosticText;
|
|
2127
|
+
recoveryError.debugInfo = debugInfo;
|
|
2128
|
+
throw recoveryError;
|
|
2129
|
+
}
|
|
2130
|
+
const errorMessageLower = safeDiagnosticText.toLowerCase();
|
|
2131
|
+
if (errorMessageLower.includes('prompt is too long') ||
|
|
2132
|
+
errorMessageLower.includes('context length exceeded') ||
|
|
2133
|
+
errorMessageLower.includes('context_length_exceeded') ||
|
|
2134
|
+
errorMessageLower.includes('maximum context length')) {
|
|
2135
|
+
headers.set('x-antigravity-context-error', 'prompt_too_long');
|
|
2136
|
+
}
|
|
2137
|
+
if (errorMessageLower.includes('tool_use') &&
|
|
2138
|
+
errorMessageLower.includes('tool_result') &&
|
|
2139
|
+
(errorMessageLower.includes('without') ||
|
|
2140
|
+
errorMessageLower.includes('immediately after'))) {
|
|
2141
|
+
headers.set('x-antigravity-context-error', 'tool_pairing');
|
|
2142
|
+
}
|
|
2143
|
+
// Early raw diagnostic branch only for non-JSON non-SSE
|
|
2144
|
+
if (!isJson && !isEventStreamResponse) {
|
|
2145
|
+
return await createSafeFallback(text);
|
|
2146
|
+
}
|
|
2147
|
+
if (!isJson) {
|
|
2148
|
+
// SSE with non-JSON payload or malformed SSE frame
|
|
2149
|
+
return await createSafeFallback(text);
|
|
2150
|
+
}
|
|
2151
|
+
if (errorRecord !== null) {
|
|
2152
|
+
const upstreamErrorMessage = typeof errorRecord.message === 'string' &&
|
|
2153
|
+
errorRecord.message.length > 0
|
|
2154
|
+
? errorRecord.message
|
|
2155
|
+
: 'Unknown error';
|
|
2156
|
+
const rawErrorMessage = redactProjectIdText(upstreamErrorMessage, projectIds);
|
|
2157
|
+
const isQuota = isQuotaError(response.status, upstreamErrorMessage, errorRecord.details);
|
|
2158
|
+
const normalizedErrorMessage = isQuota
|
|
2159
|
+
? normalizeResetDuration(rawErrorMessage)
|
|
2160
|
+
: rawErrorMessage;
|
|
2161
|
+
errorRecord.message = normalizedErrorMessage + debugInfo + injectedDebug;
|
|
2162
|
+
const responseHeaders = new Headers(headers);
|
|
2163
|
+
responseHeaders.delete('content-length');
|
|
2164
|
+
responseHeaders.set('content-type', 'application/json');
|
|
2165
|
+
const finalBody = JSON.stringify(parsedBody);
|
|
2166
|
+
const finalResponse = new Response(finalBody, {
|
|
2022
2167
|
status: response.status,
|
|
2023
2168
|
statusText: response.statusText,
|
|
2024
|
-
headers,
|
|
2169
|
+
headers: responseHeaders,
|
|
2025
2170
|
});
|
|
2171
|
+
return await redactCredentialResponse(finalResponse, undefined, finalBody, projectIds);
|
|
2026
2172
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2173
|
+
// JSON without unwrappable error record (e.g. primitive error, error array, non-error JSON on non-2xx)
|
|
2174
|
+
const responseHeaders = new Headers(headers);
|
|
2175
|
+
responseHeaders.delete('content-length');
|
|
2176
|
+
responseHeaders.set('content-type', 'application/json');
|
|
2177
|
+
const finalBody = JSON.stringify(parsedBody);
|
|
2178
|
+
const finalResponse = new Response(finalBody, {
|
|
2179
|
+
status: response.status,
|
|
2180
|
+
statusText: response.statusText,
|
|
2181
|
+
headers: responseHeaders,
|
|
2182
|
+
});
|
|
2183
|
+
return await redactCredentialResponse(finalResponse, undefined, finalBody, projectIds);
|
|
2184
|
+
}
|
|
2185
|
+
catch (transformError) {
|
|
2186
|
+
if (transformError instanceof Error &&
|
|
2187
|
+
transformError.message === 'THINKING_RECOVERY_NEEDED') {
|
|
2188
|
+
throw transformError;
|
|
2041
2189
|
}
|
|
2190
|
+
return await createSafeFallback(text);
|
|
2042
2191
|
}
|
|
2192
|
+
}
|
|
2193
|
+
const responseFallback = response.clone();
|
|
2194
|
+
try {
|
|
2195
|
+
const headers = new Headers(response.headers);
|
|
2196
|
+
const text = await response.text();
|
|
2197
|
+
noteGeminiDumpResponse(dumpContext, response);
|
|
2198
|
+
appendGeminiDumpResponseText(dumpContext, text);
|
|
2043
2199
|
const init = {
|
|
2044
2200
|
status: response.status,
|
|
2045
2201
|
statusText: response.statusText,
|