@agi-cli/server 0.1.170 → 0.1.171
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agi-cli/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.171",
|
|
4
4
|
"description": "HTTP API server for AGI CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agi-cli/sdk": "0.1.
|
|
33
|
-
"@agi-cli/database": "0.1.
|
|
32
|
+
"@agi-cli/sdk": "0.1.171",
|
|
33
|
+
"@agi-cli/database": "0.1.171",
|
|
34
34
|
"drizzle-orm": "^0.44.5",
|
|
35
35
|
"hono": "^4.9.9",
|
|
36
36
|
"zod": "^4.1.8"
|
|
@@ -73,17 +73,7 @@ export function createErrorHandler(
|
|
|
73
73
|
(causeError?.message as string) ??
|
|
74
74
|
'';
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
const fullErrorStr = JSON.stringify(err);
|
|
78
|
-
const hasSetuFiatCode =
|
|
79
|
-
fullErrorStr.includes('"code":"SETU_FIAT_SELECTED"') ||
|
|
80
|
-
fullErrorStr.includes("'code':'SETU_FIAT_SELECTED'");
|
|
81
|
-
|
|
82
|
-
// Only match if the error code is SETU_FIAT_SELECTED OR the exact error message
|
|
83
|
-
const isFiatSelected =
|
|
84
|
-
errorCode === 'SETU_FIAT_SELECTED' ||
|
|
85
|
-
errorMessage === 'Setu: fiat payment selected' ||
|
|
86
|
-
hasSetuFiatCode;
|
|
76
|
+
const isFiatSelected = errorCode === 'SETU_FIAT_SELECTED';
|
|
87
77
|
|
|
88
78
|
// Handle fiat payment selected - this is not an error, just a signal to pause
|
|
89
79
|
if (isFiatSelected) {
|
|
@@ -174,6 +164,8 @@ export function createErrorHandler(
|
|
|
174
164
|
fullErrorStrLower.includes('context_length_exceeded') ||
|
|
175
165
|
fullErrorStrLower.includes('request too large') ||
|
|
176
166
|
fullErrorStrLower.includes('exceeds the model') ||
|
|
167
|
+
fullErrorStrLower.includes('exceeds the limit') ||
|
|
168
|
+
fullErrorStrLower.includes('prompt token count') ||
|
|
177
169
|
fullErrorStrLower.includes('context window') ||
|
|
178
170
|
fullErrorStrLower.includes('input is too long') ||
|
|
179
171
|
errorCode === 'context_length_exceeded' ||
|
|
@@ -324,6 +316,9 @@ export function createErrorHandler(
|
|
|
324
316
|
isPromptTooLong && !opts.isCompactCommand
|
|
325
317
|
? `${errorPayload.message}. Context auto-compacted - please retry your message.`
|
|
326
318
|
: errorPayload.message;
|
|
319
|
+
const errorPartType = isPromptTooLong
|
|
320
|
+
? 'context_length_exceeded'
|
|
321
|
+
: errorPayload.type;
|
|
327
322
|
await db.insert(messageParts).values({
|
|
328
323
|
id: errorPartId,
|
|
329
324
|
messageId: opts.assistantMessageId,
|
|
@@ -332,7 +327,8 @@ export function createErrorHandler(
|
|
|
332
327
|
type: 'error',
|
|
333
328
|
content: JSON.stringify({
|
|
334
329
|
message: displayMessage,
|
|
335
|
-
type:
|
|
330
|
+
type: errorPartType,
|
|
331
|
+
errorType: isPromptTooLong ? 'context_length_exceeded' : undefined,
|
|
336
332
|
details: errorPayload.details,
|
|
337
333
|
isAborted: false,
|
|
338
334
|
}),
|
|
@@ -348,7 +344,7 @@ export function createErrorHandler(
|
|
|
348
344
|
.set({
|
|
349
345
|
status: 'error',
|
|
350
346
|
error: displayMessage,
|
|
351
|
-
errorType:
|
|
347
|
+
errorType: errorPartType,
|
|
352
348
|
errorDetails: JSON.stringify({
|
|
353
349
|
...errorPayload.details,
|
|
354
350
|
isApiError,
|
|
@@ -365,7 +361,7 @@ export function createErrorHandler(
|
|
|
365
361
|
messageId: opts.assistantMessageId,
|
|
366
362
|
partId: errorPartId,
|
|
367
363
|
error: displayMessage,
|
|
368
|
-
errorType:
|
|
364
|
+
errorType: errorPartType,
|
|
369
365
|
details: errorPayload.details,
|
|
370
366
|
isAborted: false,
|
|
371
367
|
autoCompacted: isPromptTooLong && !opts.isCompactCommand,
|