orquesta-cli 0.2.13 → 0.2.14
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/orchestration/plan-executor.js +15 -1
- package/dist/tools/llm/simple/final-response-tool.d.ts +2 -0
- package/dist/tools/llm/simple/final-response-tool.js +18 -15
- package/dist/ui/TodoPanel.d.ts +1 -0
- package/dist/ui/TodoPanel.js +5 -5
- package/dist/ui/components/PlanExecuteApp.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { sessionManager } from '../core/session/session-manager.js';
|
|
|
3
3
|
import { CompactManager, contextTracker, buildCompactedMessages, } from '../core/compact/index.js';
|
|
4
4
|
import { configManager } from '../core/config/config-manager.js';
|
|
5
5
|
import { setTodoWriteCallback, clearTodoCallbacks, } from '../tools/llm/simple/todo-tools.js';
|
|
6
|
-
import { setGetTodosCallback, setFinalResponseCallback, clearFinalResponseCallbacks, } from '../tools/llm/simple/final-response-tool.js';
|
|
6
|
+
import { setGetTodosCallback, setFinalResponseCallback, setMarkTodosCompletedCallback, clearFinalResponseCallbacks, } from '../tools/llm/simple/final-response-tool.js';
|
|
7
7
|
import { setDocsSearchLLMClientGetter, clearDocsSearchLLMClientGetter, } from '../tools/llm/simple/docs-search-agent-tool.js';
|
|
8
8
|
import { emitPlanCreated, emitTodoStart, emitTodoComplete, emitTodoFail, emitCompact, emitAssistantResponse, } from '../tools/llm/simple/file-tools.js';
|
|
9
9
|
import { toolRegistry } from '../tools/registry.js';
|
|
@@ -419,6 +419,20 @@ export class PlanExecutor {
|
|
|
419
419
|
setFinalResponseCallback((message) => {
|
|
420
420
|
emitAssistantResponse(message);
|
|
421
421
|
});
|
|
422
|
+
setMarkTodosCompletedCallback(() => {
|
|
423
|
+
const completed = todosRef.map(t => t.status === 'completed' || t.status === 'failed'
|
|
424
|
+
? t
|
|
425
|
+
: { ...t, status: 'completed' });
|
|
426
|
+
for (const t of completed) {
|
|
427
|
+
const old = todosRef.find(o => o.id === t.id);
|
|
428
|
+
if (old && old.status !== 'completed' && old.status !== 'failed') {
|
|
429
|
+
emitTodoComplete(t.title);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
todosRef = completed;
|
|
433
|
+
updateLocalTodos(completed);
|
|
434
|
+
callbacks.setTodos([...completed]);
|
|
435
|
+
});
|
|
422
436
|
}
|
|
423
437
|
async maybeRunRefiner(llmClient, currentMessages, currentTodos, callbacks) {
|
|
424
438
|
if (!configManager.isRefinerEnabled())
|
|
@@ -3,6 +3,8 @@ import { ToolDefinition } from '../../../types/index.js';
|
|
|
3
3
|
import { TodoItem } from '../../../types/index.js';
|
|
4
4
|
export type GetTodosCallback = () => TodoItem[];
|
|
5
5
|
export type FinalResponseCallback = (message: string) => void;
|
|
6
|
+
export type MarkTodosCompletedCallback = () => void;
|
|
7
|
+
export declare function setMarkTodosCompletedCallback(callback: MarkTodosCompletedCallback): void;
|
|
6
8
|
export declare function setGetTodosCallback(callback: GetTodosCallback): void;
|
|
7
9
|
export declare function setFinalResponseCallback(callback: FinalResponseCallback): void;
|
|
8
10
|
export declare function clearFinalResponseCallbacks(): void;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { logger } from '../../../utils/logger.js';
|
|
2
2
|
let getTodosCallback = null;
|
|
3
3
|
let finalResponseCallback = null;
|
|
4
|
+
let markTodosCompletedCallback = null;
|
|
5
|
+
export function setMarkTodosCompletedCallback(callback) {
|
|
6
|
+
markTodosCompletedCallback = callback;
|
|
7
|
+
}
|
|
4
8
|
export function setGetTodosCallback(callback) {
|
|
5
9
|
logger.flow('Setting getTodos callback for final_response');
|
|
6
10
|
getTodosCallback = callback;
|
|
@@ -13,19 +17,13 @@ export function clearFinalResponseCallbacks() {
|
|
|
13
17
|
logger.flow('Clearing final response callbacks');
|
|
14
18
|
getTodosCallback = null;
|
|
15
19
|
finalResponseCallback = null;
|
|
20
|
+
markTodosCompletedCallback = null;
|
|
16
21
|
}
|
|
17
22
|
function areAllTodosCompleted(todos) {
|
|
18
23
|
if (todos.length === 0)
|
|
19
24
|
return true;
|
|
20
25
|
return todos.every(t => t.status === 'completed' || t.status === 'failed');
|
|
21
26
|
}
|
|
22
|
-
function getIncompleteTodosSummary(todos) {
|
|
23
|
-
const incomplete = todos.filter(t => t.status !== 'completed' && t.status !== 'failed');
|
|
24
|
-
if (incomplete.length === 0)
|
|
25
|
-
return '';
|
|
26
|
-
const list = incomplete.map(t => `- [${t.status}] ${t.title}`).join('\n');
|
|
27
|
-
return `Incomplete TODOs:\n${list}`;
|
|
28
|
-
}
|
|
29
27
|
const FINAL_RESPONSE_DEFINITION = {
|
|
30
28
|
type: 'function',
|
|
31
29
|
function: {
|
|
@@ -76,15 +74,20 @@ async function executeFinalResponse(args) {
|
|
|
76
74
|
}
|
|
77
75
|
const todos = getTodosCallback();
|
|
78
76
|
if (!areAllTodosCompleted(todos)) {
|
|
79
|
-
|
|
80
|
-
logger.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
logger.flow('final_response with incomplete TODOs — auto-completing remaining and delivering');
|
|
78
|
+
logger.debug('Auto-completed TODOs', { count: todos.filter(t => t.status !== 'completed' && t.status !== 'failed').length });
|
|
79
|
+
if (markTodosCompletedCallback) {
|
|
80
|
+
try {
|
|
81
|
+
markTodosCompletedCallback();
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
logger.warn(`markTodosCompleted failed: ${e}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
logger.flow('All TODOs completed - delivering final response');
|
|
86
90
|
}
|
|
87
|
-
logger.flow('All TODOs completed - delivering final response');
|
|
88
91
|
if (finalResponseCallback) {
|
|
89
92
|
finalResponseCallback(message);
|
|
90
93
|
}
|
package/dist/ui/TodoPanel.d.ts
CHANGED
package/dist/ui/TodoPanel.js
CHANGED
|
@@ -70,10 +70,10 @@ export const TodoPanel = React.memo(({ todos, currentTodoId, isProcessing = fals
|
|
|
70
70
|
const isCompleted = todo.status === 'completed';
|
|
71
71
|
return (React.createElement(Box, { key: todo.id, flexDirection: "column" },
|
|
72
72
|
React.createElement(Box, null,
|
|
73
|
-
React.createElement(Box, { width: 2 }, isInProgress ? (React.createElement(Text, { color: "blueBright" },
|
|
73
|
+
React.createElement(Box, { width: 2 }, isInProgress && isProcessing ? (React.createElement(Text, { color: "blueBright" },
|
|
74
74
|
React.createElement(Spinner, { type: "dots2" }))) : (React.createElement(Text, { color: config.color }, config.icon))),
|
|
75
75
|
React.createElement(Text, { color: isCompleted ? 'gray' : isInProgress ? 'white' : 'gray', bold: isInProgress, dimColor: isCompleted, strikethrough: isCompleted }, todo.title),
|
|
76
|
-
isInProgress && (React.createElement(Text, { color: "blueBright" }, " \u2190"))),
|
|
76
|
+
isInProgress && isProcessing && (React.createElement(Text, { color: "blueBright" }, " \u2190"))),
|
|
77
77
|
todo.error && (React.createElement(Box, { marginLeft: 2 },
|
|
78
78
|
React.createElement(Text, { color: "red", dimColor: true },
|
|
79
79
|
"\u26A0 ",
|
|
@@ -100,7 +100,7 @@ export const TodoPanel = React.memo(({ todos, currentTodoId, isProcessing = fals
|
|
|
100
100
|
}
|
|
101
101
|
return true;
|
|
102
102
|
});
|
|
103
|
-
export const TodoStatusBar = React.memo(({ todos, projectName, batutaUsage }) => {
|
|
103
|
+
export const TodoStatusBar = React.memo(({ todos, projectName, batutaUsage, isProcessing = false }) => {
|
|
104
104
|
useEffect(() => {
|
|
105
105
|
logger.debug('TodoStatusBar rendered', { todoCount: todos.length });
|
|
106
106
|
}, [todos.length]);
|
|
@@ -145,8 +145,8 @@ export const TodoStatusBar = React.memo(({ todos, projectName, batutaUsage }) =>
|
|
|
145
145
|
todos.length),
|
|
146
146
|
currentTodo && (React.createElement(React.Fragment, null,
|
|
147
147
|
React.createElement(Text, { color: "white" }, " \u2502 "),
|
|
148
|
-
React.createElement(Text, { color: "blueBright" },
|
|
149
|
-
React.createElement(Spinner, { type: "dots" })),
|
|
148
|
+
isProcessing ? (React.createElement(Text, { color: "blueBright" },
|
|
149
|
+
React.createElement(Spinner, { type: "dots" }))) : (React.createElement(Text, { color: "gray" }, "\u2610")),
|
|
150
150
|
React.createElement(Text, { color: "white" },
|
|
151
151
|
" ",
|
|
152
152
|
currentTodo.title.slice(0, 30),
|
|
@@ -1358,7 +1358,7 @@ export const PlanExecuteApp = ({ llmClient: initialLlmClient, modelInfo }) => {
|
|
|
1358
1358
|
React.createElement(Text, { color: "gray" }, shortenPath(process.cwd())),
|
|
1359
1359
|
(planExecutionState.todos.length > 0 || batutaUsage) && (React.createElement(React.Fragment, null,
|
|
1360
1360
|
React.createElement(Text, { color: "gray" }, " \u2502 "),
|
|
1361
|
-
React.createElement(TodoStatusBar, { todos: planExecutionState.todos, projectName: configManager.getOrquestaConfig()?.projectName, batutaUsage: batutaUsage })))),
|
|
1361
|
+
React.createElement(TodoStatusBar, { todos: planExecutionState.todos, projectName: configManager.getOrquestaConfig()?.projectName, batutaUsage: batutaUsage, isProcessing: isProcessing })))),
|
|
1362
1362
|
React.createElement(Text, { color: "gray", dimColor: true }, "Tab: mode \u2502 /help")))),
|
|
1363
1363
|
showLogFiles && (React.createElement(Box, { marginTop: 0 },
|
|
1364
1364
|
React.createElement(LogBrowser, { onClose: () => setShowLogFiles(false) })))));
|