@iaforged/context-code 1.0.90 → 1.0.92
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.
|
@@ -13,7 +13,7 @@ function formatShortcut(shortcut) {
|
|
|
13
13
|
return shortcut.replace(/\+/g, ' + ');
|
|
14
14
|
}
|
|
15
15
|
export function PromptInputHelpMenu(props) {
|
|
16
|
-
const $ = _c(
|
|
16
|
+
const $ = _c(110);
|
|
17
17
|
const { dimColor, fixedWidth, gap, paddingX } = props;
|
|
18
18
|
const t0 = useShortcutDisplay("app:toggleTranscript", "Global", "ctrl+o");
|
|
19
19
|
let t1;
|
|
@@ -70,6 +70,17 @@ export function PromptInputHelpMenu(props) {
|
|
|
70
70
|
t9 = $[9];
|
|
71
71
|
}
|
|
72
72
|
const cycleModeShortcut = t9;
|
|
73
|
+
const tThinking = useShortcutDisplay("chat:thinkingToggle", "Chat", "meta+t");
|
|
74
|
+
let tThinkingFormatted;
|
|
75
|
+
if ($[100] !== tThinking) {
|
|
76
|
+
tThinkingFormatted = formatShortcut(tThinking);
|
|
77
|
+
$[100] = tThinking;
|
|
78
|
+
$[101] = tThinkingFormatted;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
tThinkingFormatted = $[101];
|
|
82
|
+
}
|
|
83
|
+
const thinkingShortcut = tThinkingFormatted;
|
|
73
84
|
const t10 = useShortcutDisplay("chat:modelPicker", "Chat", "alt+p");
|
|
74
85
|
let t11;
|
|
75
86
|
if ($[10] !== t10) {
|
|
@@ -208,7 +219,7 @@ export function PromptInputHelpMenu(props) {
|
|
|
208
219
|
}
|
|
209
220
|
let t30;
|
|
210
221
|
if ($[42] !== cycleModeShortcut || $[43] !== dimColor) {
|
|
211
|
-
t30 = _jsx(Box, { children: _jsxs(Text, { dimColor: dimColor, children: [cycleModeShortcut, " ",
|
|
222
|
+
t30 = _jsx(Box, { children: _jsxs(Text, { dimColor: dimColor, children: [cycleModeShortcut, " ", "external" === 'ant' ? "para alternar modos" : "para alternar entre modo predeterminado, auto-aceptar y plan"] }) });
|
|
212
223
|
$[42] = cycleModeShortcut;
|
|
213
224
|
$[43] = dimColor;
|
|
214
225
|
$[44] = t30;
|
|
@@ -268,6 +279,16 @@ export function PromptInputHelpMenu(props) {
|
|
|
268
279
|
else {
|
|
269
280
|
t35 = $[61];
|
|
270
281
|
}
|
|
282
|
+
let tThinkingElement;
|
|
283
|
+
if ($[102] !== dimColor || $[103] !== thinkingShortcut) {
|
|
284
|
+
tThinkingElement = _jsx(Box, { children: _jsxs(Text, { dimColor: dimColor, children: [thinkingShortcut, " para alternar pensamiento"] }) });
|
|
285
|
+
$[102] = dimColor;
|
|
286
|
+
$[103] = thinkingShortcut;
|
|
287
|
+
$[104] = tThinkingElement;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
tThinkingElement = $[104];
|
|
291
|
+
}
|
|
271
292
|
let t36;
|
|
272
293
|
if ($[62] !== dimColor || $[63] !== undoShortcut) {
|
|
273
294
|
t36 = _jsx(Box, { children: _jsxs(Text, { dimColor: dimColor, children: [undoShortcut, " para deshacer"] }) });
|
|
@@ -347,8 +368,8 @@ export function PromptInputHelpMenu(props) {
|
|
|
347
368
|
t43 = $[83];
|
|
348
369
|
}
|
|
349
370
|
let t44;
|
|
350
|
-
if ($[84] !== t36 || $[85] !== t37 || $[86] !== t38 || $[87] !== t39 || $[88] !== t40 || $[89] !== t41 || $[90] !== t42 || $[91] !== t43) {
|
|
351
|
-
t44 = _jsxs(Box, { flexDirection: "column", children: [t36, t37, t38, t39, t40, t41, t42, t43] });
|
|
371
|
+
if ($[84] !== t36 || $[85] !== t37 || $[86] !== t38 || $[87] !== t39 || $[88] !== t40 || $[89] !== t41 || $[90] !== t42 || $[91] !== t43 || $[105] !== tThinkingElement) {
|
|
372
|
+
t44 = _jsxs(Box, { flexDirection: "column", children: [tThinkingElement, t36, t37, t38, t39, t40, t41, t42, t43] });
|
|
352
373
|
$[84] = t36;
|
|
353
374
|
$[85] = t37;
|
|
354
375
|
$[86] = t38;
|
|
@@ -1250,33 +1250,56 @@ async function createChatCompletionResponse({ messages, systemPrompt, tools, sig
|
|
|
1250
1250
|
temperature: options.temperatureOverride,
|
|
1251
1251
|
});
|
|
1252
1252
|
}
|
|
1253
|
-
const sendRequest = async (bearerToken = getOpenAICompatibleAccessToken(provider) ?? '') => {
|
|
1253
|
+
const sendRequest = async (bearerToken = getOpenAICompatibleAccessToken(provider) ?? '', retryCount = 0) => {
|
|
1254
1254
|
const url = `${getOpenAIBaseUrl(provider)}/chat/completions`;
|
|
1255
|
-
logForDebugging(`[${getOpenAICompatibleProviderLabel(provider)}] chat.completions request model=${options.model} messages=${chatMessages.length} tools=${chatTools.length} endpoint=${url}`);
|
|
1256
|
-
const
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1255
|
+
logForDebugging(`[${getOpenAICompatibleProviderLabel(provider)}] chat.completions request model=${options.model} messages=${chatMessages.length} tools=${chatTools.length} endpoint=${url}${retryCount > 0 ? ` (retry ${retryCount})` : ''}`);
|
|
1256
|
+
const timeoutMs = 120000;
|
|
1257
|
+
const controller = new AbortController();
|
|
1258
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
1259
|
+
const onAbort = () => controller.abort();
|
|
1260
|
+
signal?.addEventListener('abort', onAbort);
|
|
1261
|
+
try {
|
|
1262
|
+
const response = await fetch(url, {
|
|
1263
|
+
method: 'POST',
|
|
1264
|
+
headers: await getOpenAIRequestHeaders(provider),
|
|
1265
|
+
body: jsonStringify(body),
|
|
1266
|
+
signal: controller.signal,
|
|
1267
|
+
});
|
|
1268
|
+
const data = (await readOpenAIResponseBody(response));
|
|
1269
|
+
if (response.status === 504 && retryCount < 1) {
|
|
1270
|
+
logForDebugging(`[${getOpenAICompatibleProviderLabel(provider)}] 504 Gateway Timeout, reintentando...`, { level: 'warn' });
|
|
1271
|
+
return sendRequest(bearerToken, retryCount + 1);
|
|
1272
|
+
}
|
|
1273
|
+
if (response.status === 401) {
|
|
1274
|
+
const refreshedToken = await maybeRecoverOpenAICompatible401(bearerToken, provider);
|
|
1275
|
+
if (refreshedToken) {
|
|
1276
|
+
return sendRequest(refreshedToken, retryCount);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (!response.ok) {
|
|
1280
|
+
logForDebugging(`[${getOpenAICompatibleProviderLabel(provider)}] chat.completions error status=${response.status} model=${options.model} endpoint=${url} body=${(data.error?.message ?? '').replace(/\s+/g, ' ').slice(0, 500)}`, { level: 'error' });
|
|
1281
|
+
throw new Error(buildOpenAIErrorMessage({
|
|
1282
|
+
status: response.status,
|
|
1283
|
+
statusText: response.statusText,
|
|
1284
|
+
url,
|
|
1285
|
+
model: String(options.model),
|
|
1286
|
+
data,
|
|
1287
|
+
}));
|
|
1267
1288
|
}
|
|
1289
|
+
return data;
|
|
1268
1290
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1291
|
+
catch (err) {
|
|
1292
|
+
if (err instanceof Error &&
|
|
1293
|
+
err.name === 'AbortError' &&
|
|
1294
|
+
!signal?.aborted) {
|
|
1295
|
+
throw new Error(`La solicitud expiró tras ${timeoutMs / 1000}s. El servidor tardó demasiado en responder.`);
|
|
1296
|
+
}
|
|
1297
|
+
throw err;
|
|
1298
|
+
}
|
|
1299
|
+
finally {
|
|
1300
|
+
clearTimeout(timeoutId);
|
|
1301
|
+
signal?.removeEventListener('abort', onAbort);
|
|
1278
1302
|
}
|
|
1279
|
-
return data;
|
|
1280
1303
|
};
|
|
1281
1304
|
getOpenAIAccessTokenOrThrow(provider);
|
|
1282
1305
|
return sendRequest();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iaforged/context-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
4
4
|
"description": "Context Code es un asistente de desarrollo para la terminal. Puede revisar tu proyecto, editar archivos, ejecutar comandos y apoyarte en tareas reales de programacion.",
|
|
5
5
|
"author": "Context AI",
|
|
6
6
|
"license": "MIT",
|