centaurus-cli 2.9.0 → 2.9.1
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-adapter.d.ts +8 -0
- package/dist/cli-adapter.d.ts.map +1 -1
- package/dist/cli-adapter.js +224 -16
- package/dist/cli-adapter.js.map +1 -1
- package/dist/config/build-config.d.ts +1 -1
- package/dist/config/build-config.js +1 -1
- package/dist/config/slash-commands.d.ts.map +1 -1
- package/dist/config/slash-commands.js +1 -0
- package/dist/config/slash-commands.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/services/ai-service-client.d.ts +6 -1
- package/dist/services/ai-service-client.d.ts.map +1 -1
- package/dist/services/ai-service-client.js +6 -6
- package/dist/services/ai-service-client.js.map +1 -1
- package/dist/services/api-client.d.ts +11 -0
- package/dist/services/api-client.d.ts.map +1 -1
- package/dist/services/api-client.js +10 -0
- package/dist/services/api-client.js.map +1 -1
- package/dist/services/session-quota-manager.d.ts +101 -0
- package/dist/services/session-quota-manager.d.ts.map +1 -0
- package/dist/services/session-quota-manager.js +242 -0
- package/dist/services/session-quota-manager.js.map +1 -0
- package/dist/tools/command.d.ts.map +1 -1
- package/dist/tools/command.js +14 -3
- package/dist/tools/command.js.map +1 -1
- package/dist/tools/get-diff.d.ts.map +1 -1
- package/dist/tools/get-diff.js +4 -1
- package/dist/tools/get-diff.js.map +1 -1
- package/dist/tools/task-complete.d.ts.map +1 -1
- package/dist/tools/task-complete.js +8 -14
- package/dist/tools/task-complete.js.map +1 -1
- package/dist/ui/components/App.d.ts +2 -0
- package/dist/ui/components/App.d.ts.map +1 -1
- package/dist/ui/components/App.js +39 -2
- package/dist/ui/components/App.js.map +1 -1
- package/dist/ui/components/InputBox.d.ts +2 -0
- package/dist/ui/components/InputBox.d.ts.map +1 -1
- package/dist/ui/components/InputBox.js +19 -1
- package/dist/ui/components/InputBox.js.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -1
- package/dist/ui/components/ToolExecutionMessage.js +45 -0
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
- package/dist/utils/editor-utils.d.ts +3 -3
- package/dist/utils/editor-utils.d.ts.map +1 -1
- package/dist/utils/editor-utils.js +15 -12
- package/dist/utils/editor-utils.js.map +1 -1
- package/dist/utils/input-classifier.d.ts.map +1 -1
- package/dist/utils/input-classifier.js +1 -0
- package/dist/utils/input-classifier.js.map +1 -1
- package/dist/utils/terminal-output.d.ts.map +1 -1
- package/dist/utils/terminal-output.js +198 -171
- package/dist/utils/terminal-output.js.map +1 -1
- package/package.json +1 -1
package/dist/cli-adapter.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class CentaurusCLI {
|
|
|
17
17
|
private onResponseCallback?;
|
|
18
18
|
private onDirectMessageCallback?;
|
|
19
19
|
private onResponseStreamCallback?;
|
|
20
|
+
private onClearStreamedResponse?;
|
|
20
21
|
private onThoughtStreamCallback?;
|
|
21
22
|
private onThoughtCompleteCallback?;
|
|
22
23
|
private onCommandModeChange?;
|
|
@@ -58,10 +59,12 @@ export declare class CentaurusCLI {
|
|
|
58
59
|
private onShowBackgroundTaskCancelPickerCallback?;
|
|
59
60
|
private onBackgroundTaskViewCallback?;
|
|
60
61
|
private onTokenCountUpdate?;
|
|
62
|
+
private onSessionQuotaUpdate?;
|
|
61
63
|
constructor();
|
|
62
64
|
setOnResponseCallback(callback: (message: string) => void): void;
|
|
63
65
|
setOnDirectMessageCallback(callback: (message: string) => void): void;
|
|
64
66
|
setOnResponseStreamCallback(callback: (chunk: string) => void): void;
|
|
67
|
+
setOnClearStreamedResponse(callback: () => void): void;
|
|
65
68
|
setOnThoughtStreamCallback(callback: (thought: string) => void): void;
|
|
66
69
|
setOnThoughtCompleteCallback(callback: (durationSeconds: number) => void): void;
|
|
67
70
|
setOnShowPickerCallback(callback: (options: {
|
|
@@ -113,6 +116,11 @@ export declare class CentaurusCLI {
|
|
|
113
116
|
error?: string;
|
|
114
117
|
}) => void): void;
|
|
115
118
|
setOnTokenCountUpdate(callback: (tokens: number) => void): void;
|
|
119
|
+
setOnSessionQuotaUpdate(callback: (remaining: number, canSend: boolean, timeRemaining: string) => void): void;
|
|
120
|
+
/**
|
|
121
|
+
* Notify UI about session quota status
|
|
122
|
+
*/
|
|
123
|
+
private notifySessionQuotaStatus;
|
|
116
124
|
private initializeMCP;
|
|
117
125
|
writeToShellStdin(input: string): void;
|
|
118
126
|
sendSignalToShell(signal: NodeJS.Signals): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-adapter.d.ts","sourceRoot":"","sources":["../src/cli-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAY/C,OAAO,EAA6L,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAgBjP,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EAAmC,aAAa,EAAwC,MAAM,kCAAkC,CAAC;AACxI,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAyB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-adapter.d.ts","sourceRoot":"","sources":["../src/cli-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAY/C,OAAO,EAA6L,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAgBjP,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EAAmC,aAAa,EAAwC,MAAM,kCAAkC,CAAC;AACxI,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAyB,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGlG,qBAAa,YAAY;IACvB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,YA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AEG;IACH,4BAA4B,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI;IAM3E;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;;OAGG;IACH,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,uBAAuB;IAsC/B;;OAEG;IACH,iBAAiB,IAAI,IAAI;IA6BzB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAyC9B;;;OAGG;IACH,4BAA4B,CAAC,OAAO,EAAE,UAAU,CAAC,kBAAkB,GAAG,SAAS,GAAG,IAAI;IAItF;;OAEG;YACW,0BAA0B;CA6czC"}
|
package/dist/cli-adapter.js
CHANGED
|
@@ -38,6 +38,7 @@ import { conversationLogger, quickLog } from './utils/conversation-logger.js';
|
|
|
38
38
|
import { localChatStorage } from './services/local-chat-storage.js';
|
|
39
39
|
import { logWarning } from './utils/logger.js';
|
|
40
40
|
import { BackgroundTaskManager } from './services/background-task-manager.js';
|
|
41
|
+
import { sessionQuotaManager } from './services/session-quota-manager.js';
|
|
41
42
|
export class CentaurusCLI {
|
|
42
43
|
configManager;
|
|
43
44
|
toolRegistry;
|
|
@@ -51,6 +52,7 @@ export class CentaurusCLI {
|
|
|
51
52
|
onResponseCallback;
|
|
52
53
|
onDirectMessageCallback; // For slash commands - adds directly to history
|
|
53
54
|
onResponseStreamCallback;
|
|
55
|
+
onClearStreamedResponse; // Clear streamed text when task_complete has summary
|
|
54
56
|
onThoughtStreamCallback;
|
|
55
57
|
onThoughtCompleteCallback;
|
|
56
58
|
onCommandModeChange;
|
|
@@ -92,6 +94,7 @@ export class CentaurusCLI {
|
|
|
92
94
|
onShowBackgroundTaskCancelPickerCallback;
|
|
93
95
|
onBackgroundTaskViewCallback;
|
|
94
96
|
onTokenCountUpdate; // Report actual AI context token count to UI
|
|
97
|
+
onSessionQuotaUpdate;
|
|
95
98
|
constructor() {
|
|
96
99
|
this.configManager = new ConfigManager();
|
|
97
100
|
this.toolRegistry = new ToolRegistry();
|
|
@@ -122,6 +125,9 @@ export class CentaurusCLI {
|
|
|
122
125
|
setOnResponseStreamCallback(callback) {
|
|
123
126
|
this.onResponseStreamCallback = callback;
|
|
124
127
|
}
|
|
128
|
+
setOnClearStreamedResponse(callback) {
|
|
129
|
+
this.onClearStreamedResponse = callback;
|
|
130
|
+
}
|
|
125
131
|
setOnThoughtStreamCallback(callback) {
|
|
126
132
|
this.onThoughtStreamCallback = callback;
|
|
127
133
|
}
|
|
@@ -180,6 +186,20 @@ export class CentaurusCLI {
|
|
|
180
186
|
setOnTokenCountUpdate(callback) {
|
|
181
187
|
this.onTokenCountUpdate = callback;
|
|
182
188
|
}
|
|
189
|
+
setOnSessionQuotaUpdate(callback) {
|
|
190
|
+
this.onSessionQuotaUpdate = callback;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Notify UI about session quota status
|
|
194
|
+
*/
|
|
195
|
+
notifySessionQuotaStatus() {
|
|
196
|
+
if (this.onSessionQuotaUpdate) {
|
|
197
|
+
const remaining = sessionQuotaManager.getRemainingMessages();
|
|
198
|
+
const canSend = sessionQuotaManager.canSendMessage();
|
|
199
|
+
const timeRemaining = sessionQuotaManager.getFormattedTimeRemaining();
|
|
200
|
+
this.onSessionQuotaUpdate(remaining, canSend, timeRemaining);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
183
203
|
async initializeMCP() {
|
|
184
204
|
try {
|
|
185
205
|
const mcpConfigManager = new MCPConfigManager();
|
|
@@ -367,6 +387,11 @@ export class CentaurusCLI {
|
|
|
367
387
|
const dockerHandler = new DockerHandler();
|
|
368
388
|
this.contextManager.registerHandler('docker', dockerHandler);
|
|
369
389
|
this.commandDetector.registerHandler(dockerHandler);
|
|
390
|
+
// Fetch rate limits configuration from backend (async, non-blocking)
|
|
391
|
+
// Uses cached values if backend is unreachable
|
|
392
|
+
sessionQuotaManager.fetchConfigFromBackend().catch(() => {
|
|
393
|
+
// Silently fall back to cached/default config
|
|
394
|
+
});
|
|
370
395
|
// Note: No need to initialize AI provider - using backend proxy via aiServiceClient
|
|
371
396
|
}
|
|
372
397
|
/**
|
|
@@ -526,6 +551,17 @@ Press Enter to continue...
|
|
|
526
551
|
if (!apiClient.isAuthenticated()) {
|
|
527
552
|
throw new Error('Authentication required. Please sign in to use AI features.');
|
|
528
553
|
}
|
|
554
|
+
// Check session quota before making any AI request
|
|
555
|
+
if (!sessionQuotaManager.canSendMessage()) {
|
|
556
|
+
const timeRemaining = sessionQuotaManager.getFormattedTimeRemaining();
|
|
557
|
+
const message = `\n⚠️ Session quota reached. You have used all ${sessionQuotaManager.getCurrentConfig().maxMessagesPerSession} messages for this session.\n\nYour quota will reset in ${timeRemaining}.\n\nYou can still use:\n • Slash commands (e.g., /help, /session-limits, /exit)\n • Terminal commands (in Command mode)\n\nUse /session-limits to check your quota status.`;
|
|
558
|
+
if (this.onDirectMessageCallback) {
|
|
559
|
+
this.onDirectMessageCallback(message);
|
|
560
|
+
}
|
|
561
|
+
// Notify UI about quota status
|
|
562
|
+
this.notifySessionQuotaStatus();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
529
565
|
// Cancel any active request when a new message comes in
|
|
530
566
|
// This enables "interrupt and replace" - new message takes priority
|
|
531
567
|
if (this.currentAbortController) {
|
|
@@ -618,6 +654,7 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
618
654
|
let thoughtStartTime = null; // Track when thinking started
|
|
619
655
|
let thoughtContent = ''; // Accumulate thought content during streaming
|
|
620
656
|
let currentTurnThinking = ''; // Persist thinking for the current turn to attach to assistant message
|
|
657
|
+
let currentTurnThinkingSignature = ''; // Persist thinking signature for Claude extended thinking
|
|
621
658
|
// ANTI-LOOP: Track duplicate tool calls to detect infinite loops
|
|
622
659
|
const MAX_DUPLICATE_CALLS = 2; // Max times same operation allowed on same target
|
|
623
660
|
const fileWriteTracker = new Map(); // Track writes per file
|
|
@@ -634,11 +671,31 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
634
671
|
// Multi-turn tool execution loop
|
|
635
672
|
while (turnCount < MAX_TURNS) {
|
|
636
673
|
turnCount++;
|
|
674
|
+
// Track session quota - each AI call in the agent loop counts as 1 message
|
|
675
|
+
sessionQuotaManager.incrementMessageCount();
|
|
676
|
+
this.notifySessionQuotaStatus();
|
|
677
|
+
// Check if session quota is now exhausted after incrementing
|
|
678
|
+
if (!sessionQuotaManager.canSendMessage() && turnCount > 1) {
|
|
679
|
+
// Quota exhausted mid-loop, stop and inform user
|
|
680
|
+
const timeRemaining = sessionQuotaManager.getFormattedTimeRemaining();
|
|
681
|
+
const quotaMessage = `\n\n⚠️ **Session quota reached** during agent execution.\n\nYou have used all ${sessionQuotaManager.getCurrentConfig().maxMessagesPerSession} messages for this session.\nQuota will reset in ${timeRemaining}.\n\nYour current task may be incomplete. You can resume when your quota resets.\n\nUse /session-limits to check your quota status.`;
|
|
682
|
+
if (this.onResponseCallback) {
|
|
683
|
+
this.onResponseCallback(quotaMessage);
|
|
684
|
+
}
|
|
685
|
+
logWarning('Agent loop stopped due to session quota exhaustion');
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
637
688
|
// Refresh environment context to capture any CWD changes from previous turns
|
|
638
689
|
// This is sent to backend which will inject it into the system prompt
|
|
639
690
|
environmentContext = this.getEnvironmentContext();
|
|
640
691
|
let assistantMessage = '';
|
|
641
692
|
let toolCalls = [];
|
|
693
|
+
// REAL-TIME TOOL EXECUTION: Track execution state and results during streaming
|
|
694
|
+
const inStreamToolResults = []; // Results from tools executed during streaming
|
|
695
|
+
const inStreamHandledIds = new Set(); // IDs of tools already executed in-stream
|
|
696
|
+
let toolsExecutedInStream = false; // Flag to indicate tools were executed during stream
|
|
697
|
+
let pendingTextBuffer = ''; // Buffer for text while tool is executing
|
|
698
|
+
let isToolExecuting = false; // Flag to pause text streaming during tool execution
|
|
642
699
|
// DEBUG: Log message history state before AI call
|
|
643
700
|
const messageStats = {
|
|
644
701
|
totalMessages: messages.length,
|
|
@@ -717,6 +774,12 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
717
774
|
}
|
|
718
775
|
continue;
|
|
719
776
|
}
|
|
777
|
+
// Handle thinking_signature chunks (Claude extended thinking)
|
|
778
|
+
if (chunk.type === 'thinking_signature') {
|
|
779
|
+
// Store the signature for this turn - it must be passed back with thinking content
|
|
780
|
+
currentTurnThinkingSignature = chunk.signature;
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
720
783
|
// Handle text chunks
|
|
721
784
|
if (chunk.type === 'text') {
|
|
722
785
|
// If we were thinking and now got text, finalize the thought
|
|
@@ -738,9 +801,16 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
738
801
|
if (filteredContent) {
|
|
739
802
|
assistantMessage += filteredContent;
|
|
740
803
|
conversationLogger.logAITextChunk(filteredContent);
|
|
741
|
-
//
|
|
742
|
-
|
|
743
|
-
|
|
804
|
+
// REAL-TIME TOOL EXECUTION: If a tool is executing, accumulate text
|
|
805
|
+
// This text will be flushed after the tool completes
|
|
806
|
+
if (isToolExecuting) {
|
|
807
|
+
pendingTextBuffer += filteredContent;
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
// Normal streaming - send chunk to UI in real-time
|
|
811
|
+
if (this.onResponseStreamCallback) {
|
|
812
|
+
this.onResponseStreamCallback(filteredContent);
|
|
813
|
+
}
|
|
744
814
|
}
|
|
745
815
|
}
|
|
746
816
|
}
|
|
@@ -749,7 +819,7 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
749
819
|
const toolCall = chunk.toolCall;
|
|
750
820
|
// Debug: Log every tool_call chunk received
|
|
751
821
|
try {
|
|
752
|
-
quickLog(`[${new Date().toISOString()}] [CLI] *** TOOL_CALL CHUNK RECEIVED: ${toolCall?.name || 'unknown'}
|
|
822
|
+
quickLog(`[${new Date().toISOString()}] [CLI] *** TOOL_CALL CHUNK RECEIVED (REAL-TIME): ${toolCall?.name || 'unknown'}\n`);
|
|
753
823
|
}
|
|
754
824
|
catch (e) { }
|
|
755
825
|
conversationLogger.logToolCall(toolCall?.name || 'unknown', toolCall?.id || 'unknown', toolCall?.arguments || {});
|
|
@@ -766,18 +836,88 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
766
836
|
thoughtContent = '';
|
|
767
837
|
}
|
|
768
838
|
toolCalls.push(chunk.toolCall);
|
|
769
|
-
//
|
|
770
|
-
//
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
839
|
+
// SPECIAL TOOLS: Skip in-stream execution for tools that need post-stream handling
|
|
840
|
+
// These tools have special logic (setting flags, clearing state, etc.) that must run post-stream
|
|
841
|
+
const SPECIAL_TOOLS = ['task_complete', 'create_plan', 'mark_task_complete'];
|
|
842
|
+
if (SPECIAL_TOOLS.includes(toolCall.name)) {
|
|
843
|
+
// Just notify UI with pending status, execute in post-stream loop
|
|
844
|
+
if (this.onToolExecutionUpdate) {
|
|
845
|
+
this.onToolExecutionUpdate({
|
|
846
|
+
toolName: toolCall.name,
|
|
847
|
+
status: 'pending',
|
|
848
|
+
arguments: toolCall.arguments
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
continue; // Skip to next chunk, handle this tool in post-stream loop
|
|
852
|
+
}
|
|
853
|
+
// Mark that we're executing a tool (text will accumulate)
|
|
854
|
+
isToolExecuting = true;
|
|
855
|
+
toolsExecutedInStream = true;
|
|
856
|
+
// REAL-TIME EXECUTION: Execute tool immediately during streaming
|
|
857
|
+
// This reduces latency by not waiting for the entire stream to finish
|
|
858
|
+
try {
|
|
859
|
+
// Extract and display reason_text if present (skip for task_complete)
|
|
860
|
+
const reasonText = toolCall.arguments.reason_text;
|
|
861
|
+
if (reasonText && this.onResponseStreamCallback) {
|
|
862
|
+
this.onResponseStreamCallback(reasonText + '\n\n');
|
|
863
|
+
}
|
|
864
|
+
// Show 'executing' status immediately
|
|
865
|
+
this.notifyToolStatus(toolCall.name, 'executing', toolCall.arguments);
|
|
866
|
+
// Log tool execution start
|
|
867
|
+
conversationLogger.logToolExecutionStart(toolCall.name, toolCall.id);
|
|
868
|
+
// Execute the tool (it will request approval if needed via requireApproval callback)
|
|
869
|
+
const result = await this.toolRegistry.execute(toolCall.name, toolCall.arguments, context);
|
|
870
|
+
if (result.success) {
|
|
871
|
+
conversationLogger.logToolResult(toolCall.name, toolCall.id, result.result, true);
|
|
872
|
+
// Notify UI: tool succeeded
|
|
873
|
+
this.notifyToolStatus(toolCall.name, 'completed', toolCall.arguments, result.result);
|
|
874
|
+
// Parse and truncate result for AI
|
|
875
|
+
let parsedResult = result.result;
|
|
876
|
+
if (typeof result.result === 'string') {
|
|
877
|
+
try {
|
|
878
|
+
parsedResult = JSON.parse(result.result);
|
|
879
|
+
}
|
|
880
|
+
catch {
|
|
881
|
+
parsedResult = result.result;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
inStreamToolResults.push({
|
|
885
|
+
tool_call_id: toolCall.id,
|
|
886
|
+
name: toolCall.name,
|
|
887
|
+
result: this.truncateResult(parsedResult),
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
conversationLogger.logToolResult(toolCall.name, toolCall.id, null, false, result.error);
|
|
892
|
+
// Notify UI: tool failed
|
|
893
|
+
this.notifyToolStatus(toolCall.name, 'error', toolCall.arguments, undefined, result.error);
|
|
894
|
+
inStreamToolResults.push({
|
|
895
|
+
tool_call_id: toolCall.id,
|
|
896
|
+
name: toolCall.name,
|
|
897
|
+
result: `Error: ${result.error}`,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
inStreamHandledIds.add(toolCall.id);
|
|
901
|
+
}
|
|
902
|
+
catch (error) {
|
|
903
|
+
conversationLogger.logError(`Tool execution: ${toolCall.name}`, error);
|
|
904
|
+
this.notifyToolStatus(toolCall.name, 'error', toolCall.arguments, undefined, error.message);
|
|
905
|
+
inStreamToolResults.push({
|
|
906
|
+
tool_call_id: toolCall.id,
|
|
907
|
+
name: toolCall.name,
|
|
908
|
+
result: `Error: ${error.message}`,
|
|
776
909
|
});
|
|
910
|
+
inStreamHandledIds.add(toolCall.id);
|
|
911
|
+
}
|
|
912
|
+
// Tool execution complete - flush pending text
|
|
913
|
+
isToolExecuting = false;
|
|
914
|
+
if (pendingTextBuffer && this.onResponseStreamCallback) {
|
|
915
|
+
this.onResponseStreamCallback(pendingTextBuffer);
|
|
916
|
+
pendingTextBuffer = '';
|
|
777
917
|
}
|
|
778
|
-
// Debug: Log after
|
|
918
|
+
// Debug: Log after execution
|
|
779
919
|
try {
|
|
780
|
-
quickLog(`[${new Date().toISOString()}] [CLI] ***
|
|
920
|
+
quickLog(`[${new Date().toISOString()}] [CLI] *** TOOL EXECUTED IN-STREAM: ${toolCall?.name || 'unknown'}\n`);
|
|
781
921
|
}
|
|
782
922
|
catch (e) { }
|
|
783
923
|
}
|
|
@@ -826,18 +966,26 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
826
966
|
// Silently limit tool calls
|
|
827
967
|
toolCalls = toolCalls.slice(0, MAX_TOOL_CALLS_PER_TURN);
|
|
828
968
|
}
|
|
829
|
-
const toolResults = [];
|
|
830
|
-
const handledToolCallIds = new Set(); //
|
|
969
|
+
const toolResults = [...inStreamToolResults]; // Start with in-stream results
|
|
970
|
+
const handledToolCallIds = new Set(); // Only for special tools (create_plan, mark_task_complete)
|
|
831
971
|
let userCancelledOperation = false;
|
|
832
972
|
let taskCompleted = false;
|
|
833
973
|
let taskCompleteSummary = '';
|
|
834
974
|
for (let i = 0; i < toolCalls.length; i++) {
|
|
975
|
+
const toolCall = toolCalls[i];
|
|
976
|
+
// REAL-TIME EXECUTION: Skip tools that were already executed in-stream
|
|
977
|
+
if (inStreamHandledIds.has(toolCall.id)) {
|
|
978
|
+
try {
|
|
979
|
+
quickLog(`[${new Date().toISOString()}] [CLI] *** SKIPPING TOOL (already executed in-stream): ${toolCall.name}\n`);
|
|
980
|
+
}
|
|
981
|
+
catch (e) { }
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
835
984
|
// Debug: Log which tool we're about to execute
|
|
836
985
|
try {
|
|
837
986
|
quickLog(`[${new Date().toISOString()}] [CLI] *** ABOUT TO EXECUTE TOOL [${i + 1}/${toolCalls.length}]: ${toolCalls[i].name}\n`);
|
|
838
987
|
}
|
|
839
988
|
catch (e) { }
|
|
840
|
-
const toolCall = toolCalls[i];
|
|
841
989
|
try {
|
|
842
990
|
// Check if this is task_complete FIRST (before displaying anything)
|
|
843
991
|
if (toolCall.name === 'task_complete') {
|
|
@@ -849,6 +997,11 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
849
997
|
if (taskCompleteSummary) {
|
|
850
998
|
// AI provided a summary - suppress any other text and use the summary
|
|
851
999
|
assistantMessage = '';
|
|
1000
|
+
// IMPORTANT: Clear the already-streamed text from UI before showing summary
|
|
1001
|
+
// This prevents duplicate content (streamed text + summary)
|
|
1002
|
+
if (this.onClearStreamedResponse) {
|
|
1003
|
+
this.onClearStreamedResponse();
|
|
1004
|
+
}
|
|
852
1005
|
// Stream the summary to UI so it's visible
|
|
853
1006
|
if (this.onResponseStreamCallback) {
|
|
854
1007
|
this.onResponseStreamCallback(taskCompleteSummary);
|
|
@@ -898,6 +1051,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
898
1051
|
if (currentTurnThinking) {
|
|
899
1052
|
planAssistantMsg.thinking = currentTurnThinking;
|
|
900
1053
|
}
|
|
1054
|
+
if (currentTurnThinkingSignature) {
|
|
1055
|
+
planAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1056
|
+
}
|
|
901
1057
|
this.conversationHistory.push(planAssistantMsg);
|
|
902
1058
|
// Add plan approval response
|
|
903
1059
|
this.conversationHistory.push({
|
|
@@ -942,6 +1098,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
942
1098
|
if (currentTurnThinking) {
|
|
943
1099
|
planAssistantMsg.thinking = currentTurnThinking;
|
|
944
1100
|
}
|
|
1101
|
+
if (currentTurnThinkingSignature) {
|
|
1102
|
+
planAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1103
|
+
}
|
|
945
1104
|
this.conversationHistory.push(planAssistantMsg);
|
|
946
1105
|
this.conversationHistory.push({
|
|
947
1106
|
role: 'tool',
|
|
@@ -970,6 +1129,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
970
1129
|
if (currentTurnThinking) {
|
|
971
1130
|
errorAssistantMsg.thinking = currentTurnThinking;
|
|
972
1131
|
}
|
|
1132
|
+
if (currentTurnThinkingSignature) {
|
|
1133
|
+
errorAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1134
|
+
}
|
|
973
1135
|
this.conversationHistory.push(errorAssistantMsg);
|
|
974
1136
|
this.conversationHistory.push({
|
|
975
1137
|
role: 'tool',
|
|
@@ -991,6 +1153,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
991
1153
|
if (currentTurnThinking) {
|
|
992
1154
|
resultAssistantMsg.thinking = currentTurnThinking;
|
|
993
1155
|
}
|
|
1156
|
+
if (currentTurnThinkingSignature) {
|
|
1157
|
+
resultAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1158
|
+
}
|
|
994
1159
|
this.conversationHistory.push(resultAssistantMsg);
|
|
995
1160
|
this.conversationHistory.push({
|
|
996
1161
|
role: 'tool',
|
|
@@ -1049,6 +1214,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
1049
1214
|
if (currentTurnThinking) {
|
|
1050
1215
|
nextPhaseAssistantMsg.thinking = currentTurnThinking;
|
|
1051
1216
|
}
|
|
1217
|
+
if (currentTurnThinkingSignature) {
|
|
1218
|
+
nextPhaseAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1219
|
+
}
|
|
1052
1220
|
this.conversationHistory.push(nextPhaseAssistantMsg);
|
|
1053
1221
|
this.conversationHistory.push({
|
|
1054
1222
|
role: 'tool',
|
|
@@ -1291,6 +1459,9 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
1291
1459
|
if (currentTurnThinking) {
|
|
1292
1460
|
cancelledAssistantMsg.thinking = currentTurnThinking;
|
|
1293
1461
|
}
|
|
1462
|
+
if (currentTurnThinkingSignature) {
|
|
1463
|
+
cancelledAssistantMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1464
|
+
}
|
|
1294
1465
|
this.conversationHistory.push(cancelledAssistantMsg);
|
|
1295
1466
|
// Add tool results to history
|
|
1296
1467
|
for (const toolResult of toolResults) {
|
|
@@ -1338,6 +1509,16 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
1338
1509
|
if (currentTurnThinking) {
|
|
1339
1510
|
assistantHistoryMsg.thinking = currentTurnThinking;
|
|
1340
1511
|
}
|
|
1512
|
+
// Include thinking signature from this turn (required for Claude extended thinking)
|
|
1513
|
+
if (currentTurnThinkingSignature) {
|
|
1514
|
+
assistantHistoryMsg.thinkingSignature = currentTurnThinkingSignature;
|
|
1515
|
+
}
|
|
1516
|
+
// Log signature info for debugging multi-turn flows
|
|
1517
|
+
const geminiSigCount = unhandledToolCalls.filter(tc => !!tc.thoughtSignature).length;
|
|
1518
|
+
try {
|
|
1519
|
+
quickLog(`[${new Date().toISOString()}] [CLI] *** STORING ASSISTANT MSG: ${unhandledToolCalls.length} tool_calls, Gemini signatures: ${geminiSigCount}, Claude thinking: ${!!currentTurnThinking}, Claude sig: ${!!currentTurnThinkingSignature}\n`);
|
|
1520
|
+
}
|
|
1521
|
+
catch (e) { }
|
|
1341
1522
|
this.conversationHistory.push(assistantHistoryMsg);
|
|
1342
1523
|
}
|
|
1343
1524
|
// Add tool results to conversation history as tool messages
|
|
@@ -1594,6 +1775,7 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
1594
1775
|
`/mcp - Manage configured MCP servers and tools\n` +
|
|
1595
1776
|
`/docs - Open Centaurus documentation in browser\n` +
|
|
1596
1777
|
`/copy-chat-context - Copy chat as readable text to clipboard\n` +
|
|
1778
|
+
`/session-limits - View session quota usage and limits\n` +
|
|
1597
1779
|
`/quality - Toggle enhanced quality features (thinking protocol, validation)\n` +
|
|
1598
1780
|
`/autonomous - Toggle autonomous mode (Silent Operator with task_complete)\n` +
|
|
1599
1781
|
`/sign-in - Sign in with Google (if not already signed in)\n` +
|
|
@@ -1607,6 +1789,32 @@ DO NOT use write_to_file, edit_file, or execute_command until the plan is approv
|
|
|
1607
1789
|
`Ctrl+Z - Undo last input change\n` +
|
|
1608
1790
|
`Ctrl+A - Select all text`;
|
|
1609
1791
|
break;
|
|
1792
|
+
case 'session-limits': {
|
|
1793
|
+
const config = sessionQuotaManager.getCurrentConfig();
|
|
1794
|
+
const messagesUsed = sessionQuotaManager.getMessagesUsed();
|
|
1795
|
+
const remaining = sessionQuotaManager.getRemainingMessages();
|
|
1796
|
+
const timeRemaining = sessionQuotaManager.getFormattedTimeRemaining();
|
|
1797
|
+
const maxMessages = config.maxMessagesPerSession;
|
|
1798
|
+
// Calculate percentage used (cap at 100% for display)
|
|
1799
|
+
const percentUsed = maxMessages > 0 ? Math.min(100, Math.round((messagesUsed / maxMessages) * 100)) : 0;
|
|
1800
|
+
// Create a visual progress bar (clamp to valid range)
|
|
1801
|
+
const barLength = 20;
|
|
1802
|
+
const filledLength = Math.min(barLength, Math.max(0, Math.round((messagesUsed / maxMessages) * barLength)));
|
|
1803
|
+
const emptyLength = barLength - filledLength;
|
|
1804
|
+
const progressBar = '█'.repeat(filledLength) + '░'.repeat(emptyLength);
|
|
1805
|
+
// Status message based on quota
|
|
1806
|
+
const quotaStatus = remaining <= 0
|
|
1807
|
+
? '\n\n⚠️ Session quota exhausted! AI requests are blocked until reset.'
|
|
1808
|
+
: '';
|
|
1809
|
+
responseMessage = `📊 Session Limits\n\n` +
|
|
1810
|
+
`Plan: free\n` +
|
|
1811
|
+
`Session Window: ${config.sessionDurationMs / (60 * 60 * 1000)} hours\n\n` +
|
|
1812
|
+
`Messages Used: ${messagesUsed} / ${maxMessages} (${percentUsed}%)\n` +
|
|
1813
|
+
`Messages Left: ${Math.max(0, remaining)}\n` +
|
|
1814
|
+
`Progress: [${progressBar}]\n` +
|
|
1815
|
+
`Time Remaining: ${timeRemaining || 'Session not started'}${quotaStatus}`;
|
|
1816
|
+
break;
|
|
1817
|
+
}
|
|
1610
1818
|
case 'init':
|
|
1611
1819
|
try {
|
|
1612
1820
|
// Define the context file names in priority order
|