prompt-language-shell 0.6.0 → 0.6.4
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/CONFIG.md +4 -2
- package/dist/services/anthropic.js +49 -4
- package/dist/services/components.js +27 -17
- package/dist/services/configuration.js +107 -27
- package/dist/services/task-router.js +20 -13
- package/dist/types/components.js +8 -1
- package/dist/ui/Answer.js +4 -2
- package/dist/ui/Command.js +7 -6
- package/dist/ui/Component.js +14 -17
- package/dist/ui/Config.js +45 -47
- package/dist/ui/Confirm.js +6 -7
- package/dist/ui/Execute.js +5 -3
- package/dist/ui/Introspect.js +4 -2
- package/dist/ui/Plan.js +10 -7
- package/dist/ui/Refinement.js +3 -1
- package/dist/ui/Validate.js +4 -3
- package/dist/ui/Workflow.js +129 -56
- package/package.json +1 -1
- package/dist/services/queue.js +0 -52
package/package.json
CHANGED
package/dist/services/queue.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { FeedbackType } from '../types/types.js';
|
|
2
|
-
import { createFeedback } from './components.js';
|
|
3
|
-
import { FeedbackMessages } from './messages.js';
|
|
4
|
-
import { exitApp } from './process.js';
|
|
5
|
-
/**
|
|
6
|
-
* Higher-order function that wraps queue handler logic with common patterns:
|
|
7
|
-
* - Check if queue is empty
|
|
8
|
-
* - Extract first element
|
|
9
|
-
* - Optionally check component name
|
|
10
|
-
* - Execute callback with first element
|
|
11
|
-
* - Return new queue state
|
|
12
|
-
*/
|
|
13
|
-
export function withQueueHandler(componentName, callback, shouldExit = false, exitCode = 0) {
|
|
14
|
-
return (currentQueue) => {
|
|
15
|
-
if (currentQueue.length === 0)
|
|
16
|
-
return currentQueue;
|
|
17
|
-
const [first, ...rest] = currentQueue;
|
|
18
|
-
// If componentName is specified, check if it matches
|
|
19
|
-
if (componentName && first.name !== componentName) {
|
|
20
|
-
if (shouldExit) {
|
|
21
|
-
exitApp(exitCode);
|
|
22
|
-
}
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
// Execute callback with first and rest
|
|
26
|
-
const result = callback(first, rest);
|
|
27
|
-
// Exit if specified
|
|
28
|
-
if (shouldExit) {
|
|
29
|
-
exitApp(exitCode);
|
|
30
|
-
}
|
|
31
|
-
// Return result or empty queue
|
|
32
|
-
return result || [];
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates a generic error handler for a component
|
|
37
|
-
*/
|
|
38
|
-
export function createErrorHandler(componentName, addToTimeline) {
|
|
39
|
-
return (error) => withQueueHandler(componentName, (first) => {
|
|
40
|
-
addToTimeline(first, createFeedback(FeedbackType.Failed, FeedbackMessages.UnexpectedError, error));
|
|
41
|
-
return undefined;
|
|
42
|
-
}, true, 1);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a generic completion handler for a component
|
|
46
|
-
*/
|
|
47
|
-
export function createCompletionHandler(componentName, addToTimeline, onComplete) {
|
|
48
|
-
return withQueueHandler(componentName, (first) => {
|
|
49
|
-
onComplete(first);
|
|
50
|
-
return undefined;
|
|
51
|
-
}, true, 0);
|
|
52
|
-
}
|