prompt-language-shell 0.4.4 → 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/services/colors.js +57 -24
- package/dist/ui/Answer.js +5 -5
- package/dist/ui/Command.js +2 -2
- package/dist/ui/Confirm.js +4 -4
- package/dist/ui/Introspect.js +2 -2
- package/dist/ui/Report.js +2 -5
- package/package.json +1 -1
package/dist/services/colors.js
CHANGED
|
@@ -1,41 +1,74 @@
|
|
|
1
1
|
import { FeedbackType, TaskType } from '../types/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base color palette - raw color values with descriptive names.
|
|
4
|
+
* All colors used in the interface are defined here.
|
|
5
|
+
*/
|
|
6
|
+
export const Palette = {
|
|
7
|
+
White: '#ffffff',
|
|
8
|
+
AshGray: '#d0d0d0',
|
|
9
|
+
PaleGreen: '#a8dcbc',
|
|
10
|
+
Gray: '#888888',
|
|
11
|
+
DarkGray: '#666666',
|
|
12
|
+
CharcoalGray: '#282828',
|
|
13
|
+
Green: '#5aaa8a',
|
|
14
|
+
LightGreen: '#65b595',
|
|
15
|
+
BrightGreen: '#22aa22',
|
|
16
|
+
Yellow: '#cccc5c',
|
|
17
|
+
LightYellow: '#d4d47a',
|
|
18
|
+
Orange: '#cc9c5c',
|
|
19
|
+
DarkOrange: '#a85c3f',
|
|
20
|
+
BurntOrange: '#cc7a5c',
|
|
21
|
+
Red: '#cc5c5c',
|
|
22
|
+
Cyan: '#5c9ccc',
|
|
23
|
+
LightCyan: '#5ccccc',
|
|
24
|
+
SteelBlue: '#5c8cbc',
|
|
25
|
+
Purple: '#9c5ccc',
|
|
26
|
+
};
|
|
2
27
|
/**
|
|
3
28
|
* Semantic color palette - colors organized by their purpose/meaning.
|
|
4
|
-
*
|
|
29
|
+
* References Palette colors to maintain consistency.
|
|
5
30
|
*/
|
|
6
31
|
export const Colors = {
|
|
7
32
|
Text: {
|
|
8
|
-
Active:
|
|
9
|
-
Inactive:
|
|
33
|
+
Active: Palette.White,
|
|
34
|
+
Inactive: Palette.AshGray,
|
|
35
|
+
UserQuery: Palette.White,
|
|
36
|
+
},
|
|
37
|
+
Background: {
|
|
38
|
+
UserQuery: Palette.CharcoalGray,
|
|
10
39
|
},
|
|
11
40
|
Action: {
|
|
12
|
-
Execute:
|
|
13
|
-
Discard:
|
|
14
|
-
Select:
|
|
41
|
+
Execute: Palette.Green,
|
|
42
|
+
Discard: Palette.DarkOrange,
|
|
43
|
+
Select: Palette.SteelBlue,
|
|
15
44
|
},
|
|
16
45
|
Status: {
|
|
17
|
-
Success:
|
|
18
|
-
Error:
|
|
19
|
-
Warning:
|
|
20
|
-
Info:
|
|
46
|
+
Success: Palette.BrightGreen,
|
|
47
|
+
Error: Palette.Red,
|
|
48
|
+
Warning: Palette.Orange,
|
|
49
|
+
Info: Palette.Cyan,
|
|
21
50
|
},
|
|
22
51
|
Label: {
|
|
23
|
-
Default: null, //
|
|
24
|
-
Inactive:
|
|
25
|
-
Discarded:
|
|
26
|
-
Skipped:
|
|
52
|
+
Default: null, // calculated in runtime
|
|
53
|
+
Inactive: Palette.Gray,
|
|
54
|
+
Discarded: Palette.DarkGray,
|
|
55
|
+
Skipped: Palette.Yellow,
|
|
27
56
|
},
|
|
28
57
|
Type: {
|
|
29
|
-
Config:
|
|
30
|
-
Plan:
|
|
31
|
-
Execute:
|
|
32
|
-
Answer:
|
|
33
|
-
Introspect:
|
|
34
|
-
Report:
|
|
35
|
-
Define:
|
|
36
|
-
Ignore:
|
|
37
|
-
Select:
|
|
38
|
-
Discard:
|
|
58
|
+
Config: Palette.Cyan,
|
|
59
|
+
Plan: Palette.LightCyan,
|
|
60
|
+
Execute: Palette.Green,
|
|
61
|
+
Answer: Palette.Purple,
|
|
62
|
+
Introspect: Palette.Purple,
|
|
63
|
+
Report: Palette.Orange,
|
|
64
|
+
Define: Palette.Orange,
|
|
65
|
+
Ignore: Palette.BurntOrange,
|
|
66
|
+
Select: Palette.SteelBlue,
|
|
67
|
+
Discard: Palette.DarkOrange,
|
|
68
|
+
},
|
|
69
|
+
Origin: {
|
|
70
|
+
BuiltIn: Palette.Cyan,
|
|
71
|
+
UserProvided: Palette.Green,
|
|
39
72
|
},
|
|
40
73
|
};
|
|
41
74
|
/**
|
package/dist/ui/Answer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import { getTextColor } from '../services/colors.js';
|
|
4
|
+
import { Colors, getTextColor } from '../services/colors.js';
|
|
5
5
|
import { Spinner } from './Spinner.js';
|
|
6
|
-
const
|
|
6
|
+
const MinimumProcessingTime = 400;
|
|
7
7
|
export function Answer({ question, state, service, onError, onComplete, onAborted, }) {
|
|
8
8
|
const done = state?.done ?? false;
|
|
9
9
|
const isCurrent = done === false;
|
|
@@ -33,7 +33,7 @@ export function Answer({ question, state, service, onError, onComplete, onAborte
|
|
|
33
33
|
// Call answer tool
|
|
34
34
|
const result = await svc.processWithTool(question, 'answer');
|
|
35
35
|
const elapsed = Date.now() - startTime;
|
|
36
|
-
const remainingTime = Math.max(0,
|
|
36
|
+
const remainingTime = Math.max(0, MinimumProcessingTime - elapsed);
|
|
37
37
|
await new Promise((resolve) => setTimeout(resolve, remainingTime));
|
|
38
38
|
if (mounted) {
|
|
39
39
|
// Extract answer from result
|
|
@@ -44,7 +44,7 @@ export function Answer({ question, state, service, onError, onComplete, onAborte
|
|
|
44
44
|
}
|
|
45
45
|
catch (err) {
|
|
46
46
|
const elapsed = Date.now() - startTime;
|
|
47
|
-
const remainingTime = Math.max(0,
|
|
47
|
+
const remainingTime = Math.max(0, MinimumProcessingTime - elapsed);
|
|
48
48
|
await new Promise((resolve) => setTimeout(resolve, remainingTime));
|
|
49
49
|
if (mounted) {
|
|
50
50
|
const errorMessage = err instanceof Error ? err.message : 'Unknown error occurred';
|
|
@@ -67,5 +67,5 @@ export function Answer({ question, state, service, onError, onComplete, onAborte
|
|
|
67
67
|
if (done || (!isLoading && !error)) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
|
-
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [isLoading && (_jsxs(Box, { children: [_jsx(Text, { color: getTextColor(isCurrent), children: "Finding answer. " }), _jsx(Spinner, {})] })), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color:
|
|
70
|
+
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [isLoading && (_jsxs(Box, { children: [_jsx(Text, { color: getTextColor(isCurrent), children: "Finding answer. " }), _jsx(Spinner, {})] })), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: Colors.Status.Error, children: ["Error: ", error] }) }))] }));
|
|
71
71
|
}
|
package/dist/ui/Command.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import {
|
|
4
|
+
import { Colors } from '../services/colors.js';
|
|
5
5
|
import { Spinner } from './Spinner.js';
|
|
6
6
|
const MIN_PROCESSING_TIME = 1000; // purely for visual effect
|
|
7
7
|
export function Command({ command, state, service, children, onError, onComplete, onAborted, }) {
|
|
@@ -60,5 +60,5 @@ export function Command({ command, state, service, children, onError, onComplete
|
|
|
60
60
|
};
|
|
61
61
|
}, [command, done, service]);
|
|
62
62
|
const isCurrent = done === false;
|
|
63
|
-
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [_jsxs(Box, { children: [_jsxs(Text, { color:
|
|
63
|
+
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [_jsxs(Box, { paddingX: done ? 1 : 0, marginX: done ? -1 : 0, backgroundColor: done ? Colors.Background.UserQuery : undefined, children: [_jsxs(Text, { color: isCurrent ? Colors.Text.Active : Colors.Text.UserQuery, children: ["> pls ", command] }), isLoading && (_jsxs(_Fragment, { children: [_jsx(Text, { children: " " }), _jsx(Spinner, {})] }))] }), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: Colors.Status.Error, children: ["Error: ", error] }) })), children] }));
|
|
64
64
|
}
|
package/dist/ui/Confirm.js
CHANGED
|
@@ -29,15 +29,15 @@ export function Confirm({ message, state, onConfirmed, onCancelled, }) {
|
|
|
29
29
|
}
|
|
30
30
|
}, { isActive: !done });
|
|
31
31
|
const options = [
|
|
32
|
-
{ label: '
|
|
33
|
-
{ label: '
|
|
32
|
+
{ label: 'yes', value: 'yes', color: Colors.Action.Execute },
|
|
33
|
+
{ label: 'no', value: 'no', color: Colors.Status.Error },
|
|
34
34
|
];
|
|
35
35
|
if (done) {
|
|
36
36
|
// When done, show both the message and user's choice in timeline
|
|
37
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: undefined, children: message }) }), _jsx(Box, { children: _jsxs(Text, { color: Colors.Text.
|
|
37
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: undefined, children: message }) }), _jsx(Box, { paddingX: 1, marginX: -1, alignSelf: "flex-start", backgroundColor: Colors.Background.UserQuery, children: _jsxs(Text, { color: Colors.Text.UserQuery, children: ["> ", options[selectedIndex].label] }) })] }));
|
|
38
38
|
}
|
|
39
39
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: isCurrent ? Colors.Text.Active : Colors.Text.Inactive, children: message }) }), _jsxs(Box, { children: [_jsx(Text, { color: Colors.Action.Select, children: ">" }), _jsx(Text, { children: " " }), _jsx(Box, { children: options.map((option, index) => {
|
|
40
40
|
const isSelected = index === selectedIndex;
|
|
41
|
-
return (_jsx(Box, { marginRight: 2, children: _jsx(Text, { color: isSelected ? option.color : undefined, dimColor: !isSelected,
|
|
41
|
+
return (_jsx(Box, { marginRight: 2, children: _jsx(Text, { color: isSelected ? option.color : undefined, dimColor: !isSelected, children: option.label }) }, option.value));
|
|
42
42
|
}) })] })] }));
|
|
43
43
|
}
|
package/dist/ui/Introspect.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import { getTextColor } from '../services/colors.js';
|
|
4
|
+
import { Colors, getTextColor } from '../services/colors.js';
|
|
5
5
|
import { Spinner } from './Spinner.js';
|
|
6
6
|
const MIN_PROCESSING_TIME = 1000;
|
|
7
7
|
const BUILT_IN_CAPABILITIES = new Set([
|
|
@@ -96,5 +96,5 @@ export function Introspect({ tasks, state, service, children, onError, onComplet
|
|
|
96
96
|
if (!isLoading && !error && !children) {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
|
-
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [isLoading && (_jsxs(Box, { children: [_jsx(Text, { color: getTextColor(isCurrent), children: "Listing capabilities. " }), _jsx(Spinner, {})] })), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color:
|
|
99
|
+
return (_jsxs(Box, { alignSelf: "flex-start", flexDirection: "column", children: [isLoading && (_jsxs(Box, { children: [_jsx(Text, { color: getTextColor(isCurrent), children: "Listing capabilities. " }), _jsx(Spinner, {})] })), error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: Colors.Status.Error, children: ["Error: ", error] }) })), children] }));
|
|
100
100
|
}
|
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 }) {
|