@thegitai/cli 1.0.0-preview.10 → 1.0.0-preview.11
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/src/api/chat.js +25 -9
- package/dist/src/ui/repl.js +9 -2
- package/package.json +5 -5
package/dist/src/api/chat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { drainBackgroundJobNotifications } from '../background-jobs.js';
|
|
2
2
|
import { createPromptCheckpoint, sanitizeSessionSafetyForServer, } from '../session-safety.js';
|
|
3
|
-
import { applySessionSnapshot, snapshotFromSession, } from '../session-store.js';
|
|
3
|
+
import { applySessionSnapshot, saveSessionState, snapshotFromSession, } from '../session-store.js';
|
|
4
4
|
import { executeLocalToolCall } from '../tool-executor.js';
|
|
5
5
|
import { createTraceContext, normalizeServerUrl, readErrorResponse, } from './http.js';
|
|
6
6
|
import { collectClientEnvironment } from '../client-environment.js';
|
|
@@ -18,11 +18,13 @@ export class ChatTurnFailedError extends Error {
|
|
|
18
18
|
category;
|
|
19
19
|
retryable;
|
|
20
20
|
traceId;
|
|
21
|
-
|
|
21
|
+
partialSnapshot;
|
|
22
|
+
constructor(message, category = 'unknown_error', retryable = false, traceId = '', partialSnapshot) {
|
|
22
23
|
super(traceId ? `${message}\nTrace ID: ${traceId}` : message);
|
|
23
24
|
this.category = category;
|
|
24
25
|
this.retryable = retryable;
|
|
25
26
|
this.traceId = traceId;
|
|
27
|
+
this.partialSnapshot = partialSnapshot;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
export function isTurnCancelledError(error) {
|
|
@@ -102,6 +104,12 @@ export function preserveCancelledTurnInput(session, input) {
|
|
|
102
104
|
userInput: text,
|
|
103
105
|
});
|
|
104
106
|
}
|
|
107
|
+
function appendTurnFailureMarker(session, category) {
|
|
108
|
+
session.history.push({
|
|
109
|
+
role: 'model',
|
|
110
|
+
parts: [{ text: formatTurnFailureMarker(category) }],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
105
113
|
function preserveFailedTurnInput(session, input, category) {
|
|
106
114
|
const text = input.trim();
|
|
107
115
|
if (!text)
|
|
@@ -112,10 +120,7 @@ function preserveFailedTurnInput(session, input, category) {
|
|
|
112
120
|
kind: 'turnStart',
|
|
113
121
|
userInput: text,
|
|
114
122
|
});
|
|
115
|
-
session
|
|
116
|
-
role: 'model',
|
|
117
|
-
parts: [{ text: formatTurnFailureMarker(category) }],
|
|
118
|
-
});
|
|
123
|
+
appendTurnFailureMarker(session, category);
|
|
119
124
|
}
|
|
120
125
|
function historyHasToolCall(session, callId) {
|
|
121
126
|
return session.history.some((entry) => (entry.parts ?? []).some((part) => String(part?.functionCall?.id ?? '') === callId));
|
|
@@ -377,7 +382,7 @@ async function consumeTurnStream({ response, config, projectIndex, session, inpu
|
|
|
377
382
|
if (event.event === 'cancelled') {
|
|
378
383
|
throw new TurnCancelledError(message);
|
|
379
384
|
}
|
|
380
|
-
throw new ChatTurnFailedError(message, typeof event.data?.category === 'string' ? event.data.category : 'unknown_error', Boolean(event.data?.retryable), typeof event.data?.traceId === 'string' ? event.data.traceId : traceId);
|
|
385
|
+
throw new ChatTurnFailedError(message, typeof event.data?.category === 'string' ? event.data.category : 'unknown_error', Boolean(event.data?.retryable), typeof event.data?.traceId === 'string' ? event.data.traceId : traceId, event.data?.snapshot);
|
|
381
386
|
}
|
|
382
387
|
}
|
|
383
388
|
try {
|
|
@@ -494,8 +499,19 @@ export async function sendServerUserMessage({ config, projectIndex, session, inp
|
|
|
494
499
|
? error
|
|
495
500
|
: new TurnCancelledError();
|
|
496
501
|
}
|
|
497
|
-
|
|
498
|
-
|
|
502
|
+
const category = error instanceof ChatTurnFailedError ? error.category : 'unknown_error';
|
|
503
|
+
const partial = error instanceof ChatTurnFailedError ? error.partialSnapshot : undefined;
|
|
504
|
+
if (partial) {
|
|
505
|
+
applySessionSnapshot(session, partial, { preserveAgentMode: true });
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
session.history.length = preTurnHistoryLength;
|
|
509
|
+
preserveFailedTurnInput(session, requestInputBase, category);
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
saveSessionState(session, session.env);
|
|
513
|
+
}
|
|
514
|
+
catch { }
|
|
499
515
|
throw error;
|
|
500
516
|
}
|
|
501
517
|
finally {
|
package/dist/src/ui/repl.js
CHANGED
|
@@ -1073,6 +1073,13 @@ function splitThinkingLines(text) {
|
|
|
1073
1073
|
.map((part) => part.trim())
|
|
1074
1074
|
.filter(Boolean));
|
|
1075
1075
|
}
|
|
1076
|
+
const LIVE_STATUS_PANEL_MAX_CHARS = 72;
|
|
1077
|
+
function liveStatusPanelTitle(status) {
|
|
1078
|
+
const text = String(status ?? '').trim();
|
|
1079
|
+
if (!text || text.includes('\n'))
|
|
1080
|
+
return '';
|
|
1081
|
+
return text.length <= LIVE_STATUS_PANEL_MAX_CHARS ? text : '';
|
|
1082
|
+
}
|
|
1076
1083
|
function thinkingPanelFromStatus(status) {
|
|
1077
1084
|
const rawText = thinkingNoteFromStatus(status);
|
|
1078
1085
|
if (!rawText)
|
|
@@ -2467,8 +2474,8 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2467
2474
|
store.update((current) => ({
|
|
2468
2475
|
...current,
|
|
2469
2476
|
status: message,
|
|
2470
|
-
thinkingTitle: panel
|
|
2471
|
-
thinkingNotes: panel
|
|
2477
|
+
thinkingTitle: panel ? panel.title : liveStatusPanelTitle(message),
|
|
2478
|
+
thinkingNotes: panel ? panel.notes : [],
|
|
2472
2479
|
tokenUsage: formatClientTokenUsage(current.busySince == null ? null : Date.now() - current.busySince, latestUsageSummary),
|
|
2473
2480
|
}));
|
|
2474
2481
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegitai/cli",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.11",
|
|
4
4
|
"description": "TheGitAI is an AI coding agent for your terminal. It indexes your repository, writes and edits files, runs commands, and builds features with you.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@lydell/node-pty-linux-x64": "1.1.0",
|
|
38
38
|
"@lydell/node-pty-win32-arm64": "1.1.0",
|
|
39
39
|
"@lydell/node-pty-win32-x64": "1.1.0",
|
|
40
|
-
"@thegitai/tui-darwin-arm64": "1.0.0-preview.
|
|
41
|
-
"@thegitai/tui-darwin-x64": "1.0.0-preview.
|
|
42
|
-
"@thegitai/tui-linux-x64": "1.0.0-preview.
|
|
43
|
-
"@thegitai/tui-win32-x64": "1.0.0-preview.
|
|
40
|
+
"@thegitai/tui-darwin-arm64": "1.0.0-preview.11",
|
|
41
|
+
"@thegitai/tui-darwin-x64": "1.0.0-preview.11",
|
|
42
|
+
"@thegitai/tui-linux-x64": "1.0.0-preview.11",
|
|
43
|
+
"@thegitai/tui-win32-x64": "1.0.0-preview.11",
|
|
44
44
|
"@vscode/ripgrep": "1.18.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|