prompt-language-shell 0.4.2 → 0.4.6
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/config/ANSWER.md +119 -0
- package/dist/config/PLAN.md +26 -5
- package/dist/handlers/answer.js +28 -0
- package/dist/handlers/command.js +38 -0
- package/dist/handlers/config.js +39 -0
- package/dist/handlers/execution.js +68 -0
- package/dist/handlers/introspect.js +28 -0
- package/dist/handlers/plan.js +82 -0
- package/dist/services/anthropic.js +18 -2
- package/dist/services/colors.js +175 -0
- package/dist/services/components.js +27 -1
- package/dist/services/queue.js +52 -0
- package/dist/services/tool-registry.js +5 -0
- package/dist/tools/answer.tool.js +18 -0
- package/dist/types/types.js +2 -0
- package/dist/ui/Answer.js +71 -0
- package/dist/ui/AnswerDisplay.js +8 -0
- package/dist/ui/Command.js +3 -1
- package/dist/ui/Component.js +14 -2
- package/dist/ui/Config.js +1 -1
- package/dist/ui/Confirm.js +7 -6
- package/dist/ui/Feedback.js +2 -2
- package/dist/ui/Introspect.js +3 -1
- package/dist/ui/Label.js +4 -2
- package/dist/ui/List.js +3 -3
- package/dist/ui/Main.js +35 -232
- package/dist/ui/Plan.js +13 -10
- package/dist/ui/Report.js +2 -5
- package/dist/ui/Separator.js +1 -1
- package/package.json +1 -1
- package/dist/types/colors.js +0 -90
- /package/dist/services/{config.js → configuration.js} +0 -0
package/dist/ui/Main.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useInput } from 'ink';
|
|
4
|
-
import {
|
|
4
|
+
import { FeedbackType } from '../types/types.js';
|
|
5
5
|
import { createAnthropicService, } from '../services/anthropic.js';
|
|
6
|
-
import { getConfigurationRequiredMessage, hasValidAnthropicKey, loadConfig, loadDebugSetting,
|
|
7
|
-
import {
|
|
8
|
-
import { createCommandDefinition,
|
|
6
|
+
import { getConfigurationRequiredMessage, hasValidAnthropicKey, loadConfig, loadDebugSetting, saveDebugSetting, } from '../services/configuration.js';
|
|
7
|
+
import { getCancellationMessage } from '../services/messages.js';
|
|
8
|
+
import { createCommandDefinition, createConfigDefinition, createFeedback, createMessage, createWelcomeDefinition, isStateless, markAsDone, } from '../services/components.js';
|
|
9
9
|
import { exitApp } from '../services/process.js';
|
|
10
|
+
import { createAnswerAbortedHandler, createAnswerCompleteHandler, createAnswerErrorHandler, } from '../handlers/answer.js';
|
|
11
|
+
import { createCommandAbortedHandler, createCommandCompleteHandler, createCommandErrorHandler, } from '../handlers/command.js';
|
|
12
|
+
import { createConfigAbortedHandler, createConfigFinishedHandler, } from '../handlers/config.js';
|
|
13
|
+
import { createExecutionCancelledHandler, createExecutionConfirmedHandler, } from '../handlers/execution.js';
|
|
14
|
+
import { createIntrospectAbortedHandler, createIntrospectCompleteHandler, createIntrospectErrorHandler, } from '../handlers/introspect.js';
|
|
15
|
+
import { createPlanAbortedHandler, createPlanAbortHandlerFactory, createPlanSelectionConfirmedHandler, } from '../handlers/plan.js';
|
|
10
16
|
import { Column } from './Column.js';
|
|
11
17
|
export const Main = ({ app, command }) => {
|
|
12
18
|
// Initialize service from existing config if available
|
|
@@ -52,18 +58,7 @@ export const Main = ({ app, command }) => {
|
|
|
52
58
|
return currentQueue;
|
|
53
59
|
});
|
|
54
60
|
}, [addToTimeline]);
|
|
55
|
-
const handleCommandError = React.useCallback((error) =>
|
|
56
|
-
setQueue((currentQueue) => {
|
|
57
|
-
if (currentQueue.length === 0)
|
|
58
|
-
return currentQueue;
|
|
59
|
-
const [first] = currentQueue;
|
|
60
|
-
if (first.name === ComponentName.Command) {
|
|
61
|
-
addToTimeline(markAsDone(first), createFeedback(FeedbackType.Failed, FeedbackMessages.UnexpectedError, error));
|
|
62
|
-
}
|
|
63
|
-
exitApp(1);
|
|
64
|
-
return [];
|
|
65
|
-
});
|
|
66
|
-
}, [addToTimeline]);
|
|
61
|
+
const handleCommandError = React.useCallback((error) => setQueue(createCommandErrorHandler(addToTimeline)(error)), [addToTimeline]);
|
|
67
62
|
const handleAborted = React.useCallback((operationName) => {
|
|
68
63
|
setQueue((currentQueue) => {
|
|
69
64
|
if (currentQueue.length === 0)
|
|
@@ -76,181 +71,31 @@ export const Main = ({ app, command }) => {
|
|
|
76
71
|
return [];
|
|
77
72
|
});
|
|
78
73
|
}, [addToTimeline]);
|
|
79
|
-
const handleConfigAborted = React.useCallback(()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
handleAborted('Task selection');
|
|
84
|
-
}, [handleAborted]);
|
|
85
|
-
const createPlanAbortHandler = React.useCallback((tasks) => {
|
|
86
|
-
const allIntrospect = tasks.every((task) => task.type === TaskType.Introspect);
|
|
87
|
-
if (allIntrospect) {
|
|
88
|
-
return () => handleAborted('Introspection');
|
|
89
|
-
}
|
|
90
|
-
return handlePlanAborted;
|
|
91
|
-
}, [handleAborted, handlePlanAborted]);
|
|
92
|
-
const handleCommandAborted = React.useCallback(() => {
|
|
93
|
-
handleAborted('Request');
|
|
94
|
-
}, [handleAborted]);
|
|
74
|
+
const handleConfigAborted = React.useCallback(createConfigAbortedHandler(handleAborted), [handleAborted]);
|
|
75
|
+
const handlePlanAborted = React.useCallback(createPlanAbortedHandler(handleAborted), [handleAborted]);
|
|
76
|
+
const createPlanAbortHandler = React.useCallback(createPlanAbortHandlerFactory(handleAborted, handlePlanAborted), [handleAborted, handlePlanAborted]);
|
|
77
|
+
const handleCommandAborted = React.useCallback(createCommandAbortedHandler(handleAborted), [handleAborted]);
|
|
95
78
|
const handleRefinementAborted = React.useCallback(() => {
|
|
96
79
|
handleAborted('Plan refinement');
|
|
97
80
|
}, [handleAborted]);
|
|
98
|
-
const handleIntrospectAborted = React.useCallback(()
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const [first] = currentQueue;
|
|
106
|
-
if (first.name === ComponentName.Introspect) {
|
|
107
|
-
addToTimeline(markAsDone(first), createFeedback(FeedbackType.Failed, FeedbackMessages.UnexpectedError, error));
|
|
108
|
-
}
|
|
109
|
-
exitApp(1);
|
|
110
|
-
return [];
|
|
111
|
-
});
|
|
112
|
-
}, [addToTimeline]);
|
|
113
|
-
const handleIntrospectComplete = React.useCallback((message, capabilities) => {
|
|
114
|
-
setQueue((currentQueue) => {
|
|
115
|
-
if (currentQueue.length === 0)
|
|
116
|
-
return currentQueue;
|
|
117
|
-
const [first] = currentQueue;
|
|
118
|
-
if (first.name === ComponentName.Introspect) {
|
|
119
|
-
// Don't add the Introspect component to timeline (it renders null)
|
|
120
|
-
// Only add the Report component
|
|
121
|
-
addToTimeline(createReportDefinition(message, capabilities));
|
|
122
|
-
}
|
|
123
|
-
exitApp(0);
|
|
124
|
-
return [];
|
|
125
|
-
});
|
|
126
|
-
}, [addToTimeline]);
|
|
127
|
-
const handleExecutionConfirmed = React.useCallback(() => {
|
|
128
|
-
setQueue((currentQueue) => {
|
|
129
|
-
if (currentQueue.length === 0)
|
|
130
|
-
return currentQueue;
|
|
131
|
-
const [first] = currentQueue;
|
|
132
|
-
if (first.name === ComponentName.Confirm) {
|
|
133
|
-
// Find the most recent Plan in timeline to get tasks
|
|
134
|
-
const currentTimeline = timelineRef.current;
|
|
135
|
-
const lastPlanIndex = [...currentTimeline]
|
|
136
|
-
.reverse()
|
|
137
|
-
.findIndex((item) => item.name === ComponentName.Plan);
|
|
138
|
-
const lastPlan = lastPlanIndex >= 0
|
|
139
|
-
? currentTimeline[currentTimeline.length - 1 - lastPlanIndex]
|
|
140
|
-
: null;
|
|
141
|
-
const tasks = lastPlan &&
|
|
142
|
-
lastPlan.name === ComponentName.Plan &&
|
|
143
|
-
'props' in lastPlan &&
|
|
144
|
-
lastPlan.props &&
|
|
145
|
-
'tasks' in lastPlan.props &&
|
|
146
|
-
Array.isArray(lastPlan.props.tasks)
|
|
147
|
-
? lastPlan.props.tasks
|
|
148
|
-
: [];
|
|
149
|
-
const allIntrospect = tasks.every((task) => task.type === TaskType.Introspect);
|
|
150
|
-
if (allIntrospect && tasks.length > 0) {
|
|
151
|
-
// Execute introspection
|
|
152
|
-
addToTimeline(markAsDone(first));
|
|
153
|
-
return [
|
|
154
|
-
createIntrospectDefinition(tasks, service, handleIntrospectError, handleIntrospectComplete, handleIntrospectAborted),
|
|
155
|
-
];
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
// Regular execution - just exit for now
|
|
159
|
-
addToTimeline(markAsDone(first));
|
|
160
|
-
exitApp(0);
|
|
161
|
-
return [];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exitApp(0);
|
|
165
|
-
return [];
|
|
166
|
-
});
|
|
167
|
-
}, [
|
|
81
|
+
const handleIntrospectAborted = React.useCallback(createIntrospectAbortedHandler(handleAborted), [handleAborted]);
|
|
82
|
+
const handleIntrospectError = React.useCallback((error) => setQueue(createIntrospectErrorHandler(addToTimeline)(error)), [addToTimeline]);
|
|
83
|
+
const handleIntrospectComplete = React.useCallback((message, capabilities) => setQueue(createIntrospectCompleteHandler(addToTimeline)(message, capabilities)), [addToTimeline]);
|
|
84
|
+
const handleAnswerAborted = React.useCallback(createAnswerAbortedHandler(handleAborted), [handleAborted]);
|
|
85
|
+
const handleAnswerError = React.useCallback((error) => setQueue(createAnswerErrorHandler(addToTimeline)(error)), [addToTimeline]);
|
|
86
|
+
const handleAnswerComplete = React.useCallback((answer) => setQueue(createAnswerCompleteHandler(addToTimeline)(answer)), [addToTimeline]);
|
|
87
|
+
const handleExecutionConfirmed = React.useCallback(() => setQueue(createExecutionConfirmedHandler(timelineRef, addToTimeline, service, handleIntrospectError, handleIntrospectComplete, handleIntrospectAborted, handleAnswerError, handleAnswerComplete, handleAnswerAborted)()), [
|
|
168
88
|
addToTimeline,
|
|
169
89
|
service,
|
|
170
90
|
handleIntrospectError,
|
|
171
91
|
handleIntrospectComplete,
|
|
172
92
|
handleIntrospectAborted,
|
|
93
|
+
handleAnswerError,
|
|
94
|
+
handleAnswerComplete,
|
|
95
|
+
handleAnswerAborted,
|
|
173
96
|
]);
|
|
174
|
-
const handleExecutionCancelled = React.useCallback(() =>
|
|
175
|
-
|
|
176
|
-
if (currentQueue.length === 0)
|
|
177
|
-
return currentQueue;
|
|
178
|
-
const [first] = currentQueue;
|
|
179
|
-
if (first.name === ComponentName.Confirm) {
|
|
180
|
-
// Find the most recent Plan in timeline to check task types
|
|
181
|
-
const currentTimeline = timelineRef.current;
|
|
182
|
-
const lastPlanIndex = [...currentTimeline]
|
|
183
|
-
.reverse()
|
|
184
|
-
.findIndex((item) => item.name === ComponentName.Plan);
|
|
185
|
-
const lastPlan = lastPlanIndex >= 0
|
|
186
|
-
? currentTimeline[currentTimeline.length - 1 - lastPlanIndex]
|
|
187
|
-
: null;
|
|
188
|
-
const allIntrospect = lastPlan &&
|
|
189
|
-
lastPlan.name === ComponentName.Plan &&
|
|
190
|
-
'props' in lastPlan &&
|
|
191
|
-
lastPlan.props &&
|
|
192
|
-
'tasks' in lastPlan.props &&
|
|
193
|
-
Array.isArray(lastPlan.props.tasks) &&
|
|
194
|
-
lastPlan.props.tasks.every((task) => task.type === TaskType.Introspect);
|
|
195
|
-
const operation = allIntrospect ? 'introspection' : 'execution';
|
|
196
|
-
addToTimeline(markAsDone(first), createFeedback(FeedbackType.Aborted, getCancellationMessage(operation)));
|
|
197
|
-
}
|
|
198
|
-
exitApp(0);
|
|
199
|
-
return [];
|
|
200
|
-
});
|
|
201
|
-
}, [addToTimeline]);
|
|
202
|
-
const handlePlanSelectionConfirmed = React.useCallback(async (selectedTasks) => {
|
|
203
|
-
// Mark current plan as done and add refinement to queue
|
|
204
|
-
let refinementDef = null;
|
|
205
|
-
refinementDef = createRefinement(getRefiningMessage(), handleRefinementAborted);
|
|
206
|
-
setQueue((currentQueue) => {
|
|
207
|
-
if (currentQueue.length === 0)
|
|
208
|
-
return currentQueue;
|
|
209
|
-
const [first] = currentQueue;
|
|
210
|
-
if (first.name === ComponentName.Plan) {
|
|
211
|
-
addToTimeline(markAsDone(first));
|
|
212
|
-
}
|
|
213
|
-
// Add refinement to queue so it becomes the active component
|
|
214
|
-
return [refinementDef];
|
|
215
|
-
});
|
|
216
|
-
// Process refined command in background
|
|
217
|
-
try {
|
|
218
|
-
const refinedCommand = selectedTasks
|
|
219
|
-
.map((task) => {
|
|
220
|
-
const action = task.action.toLowerCase().replace(/,/g, ' -');
|
|
221
|
-
const type = task.type || 'execute';
|
|
222
|
-
return `${action} (type: ${type})`;
|
|
223
|
-
})
|
|
224
|
-
.join(', ');
|
|
225
|
-
const result = await service.processWithTool(refinedCommand, 'plan');
|
|
226
|
-
// Mark refinement as done and move to timeline
|
|
227
|
-
setQueue((currentQueue) => {
|
|
228
|
-
if (currentQueue.length > 0 &&
|
|
229
|
-
currentQueue[0].id === refinementDef.id) {
|
|
230
|
-
addToTimeline(markAsDone(currentQueue[0]));
|
|
231
|
-
}
|
|
232
|
-
return [];
|
|
233
|
-
});
|
|
234
|
-
// Show final execution plan with confirmation
|
|
235
|
-
const planDefinition = createPlanDefinition(result.message, result.tasks, createPlanAbortHandler(result.tasks), undefined);
|
|
236
|
-
const confirmDefinition = createConfirmDefinition(handleExecutionConfirmed, handleExecutionCancelled);
|
|
237
|
-
addToTimeline(planDefinition);
|
|
238
|
-
setQueue([confirmDefinition]);
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
242
|
-
// Mark refinement as done and move to timeline before showing error
|
|
243
|
-
setQueue((currentQueue) => {
|
|
244
|
-
if (currentQueue.length > 0 &&
|
|
245
|
-
currentQueue[0].id === refinementDef.id) {
|
|
246
|
-
addToTimeline(markAsDone(currentQueue[0]));
|
|
247
|
-
}
|
|
248
|
-
return [];
|
|
249
|
-
});
|
|
250
|
-
addToTimeline(createFeedback(FeedbackType.Failed, FeedbackMessages.UnexpectedError, errorMessage));
|
|
251
|
-
exitApp(1);
|
|
252
|
-
}
|
|
253
|
-
}, [
|
|
97
|
+
const handleExecutionCancelled = React.useCallback(() => setQueue(createExecutionCancelledHandler(timelineRef, addToTimeline)()), [addToTimeline]);
|
|
98
|
+
const handlePlanSelectionConfirmed = React.useCallback(createPlanSelectionConfirmedHandler(addToTimeline, service, handleRefinementAborted, createPlanAbortHandler, handleExecutionConfirmed, handleExecutionCancelled, setQueue), [
|
|
254
99
|
addToTimeline,
|
|
255
100
|
service,
|
|
256
101
|
handleRefinementAborted,
|
|
@@ -258,62 +103,20 @@ export const Main = ({ app, command }) => {
|
|
|
258
103
|
handleExecutionConfirmed,
|
|
259
104
|
handleExecutionCancelled,
|
|
260
105
|
]);
|
|
261
|
-
const handleCommandComplete = React.useCallback((message, tasks) =>
|
|
262
|
-
setQueue((currentQueue) => {
|
|
263
|
-
if (currentQueue.length === 0)
|
|
264
|
-
return currentQueue;
|
|
265
|
-
const [first] = currentQueue;
|
|
266
|
-
// Check if tasks contain a Define task that requires user interaction
|
|
267
|
-
const hasDefineTask = tasks.some((task) => task.type === TaskType.Define);
|
|
268
|
-
if (first.name === ComponentName.Command) {
|
|
269
|
-
const planDefinition = createPlanDefinition(message, tasks, createPlanAbortHandler(tasks), hasDefineTask ? handlePlanSelectionConfirmed : undefined);
|
|
270
|
-
if (hasDefineTask) {
|
|
271
|
-
// Don't exit - keep the plan in the queue for interaction
|
|
272
|
-
addToTimeline(markAsDone(first));
|
|
273
|
-
return [planDefinition];
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
// No define task - show plan and confirmation
|
|
277
|
-
const confirmDefinition = createConfirmDefinition(handleExecutionConfirmed, handleExecutionCancelled);
|
|
278
|
-
addToTimeline(markAsDone(first), planDefinition);
|
|
279
|
-
return [confirmDefinition];
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
exitApp(0);
|
|
283
|
-
return [];
|
|
284
|
-
});
|
|
285
|
-
}, [
|
|
106
|
+
const handleCommandComplete = React.useCallback((message, tasks) => setQueue(createCommandCompleteHandler(addToTimeline, createPlanAbortHandler, handlePlanSelectionConfirmed, handleExecutionConfirmed, handleExecutionCancelled)(message, tasks)), [
|
|
286
107
|
addToTimeline,
|
|
287
108
|
createPlanAbortHandler,
|
|
288
109
|
handlePlanSelectionConfirmed,
|
|
289
110
|
handleExecutionConfirmed,
|
|
290
111
|
handleExecutionCancelled,
|
|
291
112
|
]);
|
|
292
|
-
const handleConfigFinished = React.useCallback((config) =>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (currentQueue.length === 0)
|
|
300
|
-
return currentQueue;
|
|
301
|
-
const [first, ...rest] = currentQueue;
|
|
302
|
-
if (first.name === ComponentName.Config) {
|
|
303
|
-
addToTimeline(markAsDone(first), createFeedback(FeedbackType.Succeeded, FeedbackMessages.ConfigurationComplete));
|
|
304
|
-
}
|
|
305
|
-
// Add command to queue if we have one
|
|
306
|
-
if (command) {
|
|
307
|
-
return [
|
|
308
|
-
...rest,
|
|
309
|
-
createCommandDefinition(command, newService, handleCommandError, handleCommandComplete, handleCommandAborted),
|
|
310
|
-
];
|
|
311
|
-
}
|
|
312
|
-
// No command - exit after showing completion message
|
|
313
|
-
exitApp(0);
|
|
314
|
-
return rest;
|
|
315
|
-
});
|
|
316
|
-
}, [addToTimeline, command, handleCommandError, handleCommandComplete]);
|
|
113
|
+
const handleConfigFinished = React.useCallback((config) => setQueue(createConfigFinishedHandler(addToTimeline, command, handleCommandError, handleCommandComplete, handleCommandAborted, setService)(config)), [
|
|
114
|
+
addToTimeline,
|
|
115
|
+
command,
|
|
116
|
+
handleCommandError,
|
|
117
|
+
handleCommandComplete,
|
|
118
|
+
handleCommandAborted,
|
|
119
|
+
]);
|
|
317
120
|
// Initialize queue on mount
|
|
318
121
|
React.useEffect(() => {
|
|
319
122
|
const hasConfig = !!service;
|
package/dist/ui/Plan.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, useInput } from 'ink';
|
|
4
|
-
import { TaskColors } from '../types/colors.js';
|
|
5
4
|
import { TaskType } from '../types/types.js';
|
|
5
|
+
import { getTaskColors } from '../services/colors.js';
|
|
6
6
|
import { Label } from './Label.js';
|
|
7
7
|
import { List } from './List.js';
|
|
8
|
-
function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutSelection = false) {
|
|
8
|
+
function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutSelection = false, isCurrent = false) {
|
|
9
|
+
const taskColors = getTaskColors(task.type, isCurrent);
|
|
9
10
|
const item = {
|
|
10
11
|
description: {
|
|
11
12
|
text: task.action,
|
|
12
|
-
color:
|
|
13
|
+
color: taskColors.description,
|
|
13
14
|
},
|
|
14
|
-
type: { text: task.type, color:
|
|
15
|
+
type: { text: task.type, color: taskColors.type },
|
|
15
16
|
children: [],
|
|
16
17
|
};
|
|
17
18
|
// Mark define tasks with right arrow when no selection has been made
|
|
18
19
|
if (isDefineTaskWithoutSelection) {
|
|
19
20
|
item.marker = ' → ';
|
|
20
|
-
item.markerColor =
|
|
21
|
+
item.markerColor = getTaskColors(TaskType.Plan, isCurrent).type;
|
|
21
22
|
}
|
|
22
23
|
// Add children for Define tasks with options
|
|
23
24
|
if (task.type === TaskType.Define && Array.isArray(task.params?.options)) {
|
|
@@ -29,17 +30,18 @@ function taskToListItem(task, highlightedChildIndex = null, isDefineTaskWithoutS
|
|
|
29
30
|
childType =
|
|
30
31
|
index === highlightedChildIndex ? TaskType.Execute : TaskType.Discard;
|
|
31
32
|
}
|
|
32
|
-
const colors =
|
|
33
|
+
const colors = getTaskColors(childType, isCurrent);
|
|
34
|
+
const planColors = getTaskColors(TaskType.Plan, isCurrent);
|
|
33
35
|
return {
|
|
34
36
|
description: {
|
|
35
37
|
text: String(option),
|
|
36
38
|
color: colors.description,
|
|
37
|
-
highlightedColor:
|
|
39
|
+
highlightedColor: planColors.description,
|
|
38
40
|
},
|
|
39
41
|
type: {
|
|
40
42
|
text: childType,
|
|
41
43
|
color: colors.type,
|
|
42
|
-
highlightedColor:
|
|
44
|
+
highlightedColor: planColors.type,
|
|
43
45
|
},
|
|
44
46
|
};
|
|
45
47
|
});
|
|
@@ -143,6 +145,7 @@ export function Plan({ message, tasks, state, debug = false, onSelectionConfirme
|
|
|
143
145
|
isDone,
|
|
144
146
|
state,
|
|
145
147
|
]);
|
|
148
|
+
const isCurrent = isDone === false;
|
|
146
149
|
const listItems = tasks.map((task, idx) => {
|
|
147
150
|
// Find which define group this task belongs to (if any)
|
|
148
151
|
const defineGroupIndex = defineTaskIndices.indexOf(idx);
|
|
@@ -170,7 +173,7 @@ export function Plan({ message, tasks, state, debug = false, onSelectionConfirme
|
|
|
170
173
|
defineGroupIndex === currentDefineGroupIndex &&
|
|
171
174
|
highlightedIndex === null &&
|
|
172
175
|
!isDone;
|
|
173
|
-
return taskToListItem(task, childIndex, isDefineWithoutSelection);
|
|
176
|
+
return taskToListItem(task, childIndex, isDefineWithoutSelection, isCurrent);
|
|
174
177
|
});
|
|
175
|
-
return (_jsxs(Box, { flexDirection: "column", children: [message && (_jsx(Box, { marginBottom: 1, children: _jsx(Label, { description: message,
|
|
178
|
+
return (_jsxs(Box, { flexDirection: "column", children: [message && (_jsx(Box, { marginBottom: 1, children: _jsx(Label, { description: message, taskType: TaskType.Plan, showType: debug, isCurrent: isCurrent }) })), _jsx(List, { items: listItems, highlightedIndex: currentDefineTaskIndex >= 0 ? highlightedIndex : null, highlightedParentIndex: currentDefineTaskIndex, showType: debug })] }));
|
|
176
179
|
}
|
package/dist/ui/Report.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
|
|
4
|
-
BuiltIn: '#5c9ccc', // blue - for built-in capabilities
|
|
5
|
-
UserDefined: '#5aaa8a', // green - for user-defined skills
|
|
6
|
-
};
|
|
3
|
+
import { Colors } from '../services/colors.js';
|
|
7
4
|
function CapabilityItem({ name, description, isBuiltIn }) {
|
|
8
|
-
const color = isBuiltIn ?
|
|
5
|
+
const color = isBuiltIn ? Colors.Origin.BuiltIn : Colors.Origin.UserProvided;
|
|
9
6
|
return (_jsxs(Box, { children: [_jsx(Text, { children: "- " }), _jsx(Text, { color: color, children: name }), _jsxs(Text, { children: [" - ", description] })] }));
|
|
10
7
|
}
|
|
11
8
|
export function Report({ message, capabilities }) {
|
package/dist/ui/Separator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from 'ink';
|
|
3
|
-
import { Colors } from '../
|
|
3
|
+
import { Colors } from '../services/colors.js';
|
|
4
4
|
export const Separator = ({ color = Colors.Label.Discarded, spaces = 1, }) => {
|
|
5
5
|
const spacing = ' '.repeat(spaces);
|
|
6
6
|
return (_jsxs(Text, { color: color, children: [spacing, "\u203A", spacing] }));
|
package/package.json
CHANGED
package/dist/types/colors.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { FeedbackType, TaskType } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Semantic color palette - colors organized by their purpose/meaning.
|
|
4
|
-
* Prefer adding semantic names here rather than to DescriptiveColors.
|
|
5
|
-
*/
|
|
6
|
-
export const Colors = {
|
|
7
|
-
Action: {
|
|
8
|
-
Execute: '#5aaa8a', // green
|
|
9
|
-
Discard: '#a85c3f', // dark orange
|
|
10
|
-
Select: '#5c8cbc', // steel blue
|
|
11
|
-
},
|
|
12
|
-
Status: {
|
|
13
|
-
Success: '#22aa22', // green
|
|
14
|
-
Error: '#cc5c5c', // red
|
|
15
|
-
Warning: '#cc9c5c', // orange
|
|
16
|
-
Info: '#5c9ccc', // cyan
|
|
17
|
-
},
|
|
18
|
-
Label: {
|
|
19
|
-
Default: '#ffffff', // white
|
|
20
|
-
Inactive: '#888888', // gray
|
|
21
|
-
Discarded: '#666666', // dark gray
|
|
22
|
-
Skipped: '#cccc5c', // yellow
|
|
23
|
-
},
|
|
24
|
-
Type: {
|
|
25
|
-
Config: '#5c9ccc', // cyan
|
|
26
|
-
Plan: '#5ccccc', // magenta
|
|
27
|
-
Execute: '#5aaa8a', // green
|
|
28
|
-
Answer: '#9c5ccc', // purple
|
|
29
|
-
Introspect: '#9c5ccc', // purple
|
|
30
|
-
Report: '#cc9c5c', // orange
|
|
31
|
-
Define: '#cc9c5c', // amber
|
|
32
|
-
Ignore: '#cc7a5c', // dark orange
|
|
33
|
-
Select: '#5c8cbc', // steel blue
|
|
34
|
-
Discard: '#a85c3f', // dark orange
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Task-specific color mappings
|
|
39
|
-
*/
|
|
40
|
-
export const TaskColors = {
|
|
41
|
-
[TaskType.Config]: {
|
|
42
|
-
description: Colors.Label.Default,
|
|
43
|
-
type: Colors.Type.Config,
|
|
44
|
-
},
|
|
45
|
-
[TaskType.Plan]: {
|
|
46
|
-
description: Colors.Label.Default,
|
|
47
|
-
type: Colors.Type.Plan,
|
|
48
|
-
},
|
|
49
|
-
[TaskType.Execute]: {
|
|
50
|
-
description: Colors.Label.Default,
|
|
51
|
-
type: Colors.Type.Execute,
|
|
52
|
-
},
|
|
53
|
-
[TaskType.Answer]: {
|
|
54
|
-
description: Colors.Label.Default,
|
|
55
|
-
type: Colors.Type.Answer,
|
|
56
|
-
},
|
|
57
|
-
[TaskType.Introspect]: {
|
|
58
|
-
description: Colors.Label.Default,
|
|
59
|
-
type: Colors.Type.Introspect,
|
|
60
|
-
},
|
|
61
|
-
[TaskType.Report]: {
|
|
62
|
-
description: Colors.Label.Default,
|
|
63
|
-
type: Colors.Type.Report,
|
|
64
|
-
},
|
|
65
|
-
[TaskType.Define]: {
|
|
66
|
-
description: Colors.Label.Default,
|
|
67
|
-
type: Colors.Type.Define,
|
|
68
|
-
},
|
|
69
|
-
[TaskType.Ignore]: {
|
|
70
|
-
description: Colors.Label.Skipped,
|
|
71
|
-
type: Colors.Type.Ignore,
|
|
72
|
-
},
|
|
73
|
-
[TaskType.Select]: {
|
|
74
|
-
description: Colors.Label.Inactive,
|
|
75
|
-
type: Colors.Type.Select,
|
|
76
|
-
},
|
|
77
|
-
[TaskType.Discard]: {
|
|
78
|
-
description: Colors.Label.Discarded,
|
|
79
|
-
type: Colors.Type.Discard,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Feedback-specific color mappings
|
|
84
|
-
*/
|
|
85
|
-
export const FeedbackColors = {
|
|
86
|
-
[FeedbackType.Info]: Colors.Status.Info,
|
|
87
|
-
[FeedbackType.Succeeded]: Colors.Status.Success,
|
|
88
|
-
[FeedbackType.Aborted]: Colors.Status.Warning,
|
|
89
|
-
[FeedbackType.Failed]: Colors.Status.Error,
|
|
90
|
-
};
|
|
File without changes
|