prompt-language-shell 0.4.6 → 0.4.9
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 +66 -0
- package/dist/config/EXECUTE.md +279 -0
- package/dist/config/INTROSPECT.md +29 -14
- package/dist/config/PLAN.md +40 -6
- package/dist/handlers/answer.js +13 -20
- package/dist/handlers/command.js +26 -30
- package/dist/handlers/config.js +44 -12
- package/dist/handlers/execute.js +38 -0
- package/dist/handlers/execution.js +66 -61
- package/dist/handlers/introspect.js +13 -20
- package/dist/handlers/plan.js +33 -36
- package/dist/services/anthropic.js +66 -12
- package/dist/services/colors.js +6 -5
- package/dist/services/components.js +159 -22
- package/dist/services/configuration.js +80 -0
- package/dist/services/keyboard.js +86 -0
- package/dist/services/messages.js +31 -0
- package/dist/services/shell.js +117 -0
- package/dist/services/tool-registry.js +10 -0
- package/dist/services/utils.js +21 -0
- package/dist/tools/config.tool.js +43 -0
- package/dist/tools/execute.tool.js +44 -0
- package/dist/types/handlers.js +1 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/Answer.js +7 -5
- package/dist/ui/Command.js +15 -3
- package/dist/ui/Component.js +7 -1
- package/dist/ui/Config.js +6 -3
- package/dist/ui/Confirm.js +4 -3
- package/dist/ui/Execute.js +217 -0
- package/dist/ui/Introspect.js +20 -7
- package/dist/ui/Main.js +35 -74
- package/dist/ui/Plan.js +2 -1
- package/dist/ui/Refinement.js +2 -1
- package/dist/ui/Report.js +7 -3
- package/dist/ui/Spinner.js +10 -5
- package/package.json +7 -7
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
You are the CONFIG tool for "pls" (please), a professional command-line concierge.
|
|
4
|
+
Your role is to determine which configuration settings the user wants to configure
|
|
5
|
+
based on their query.
|
|
6
|
+
|
|
7
|
+
## Input
|
|
8
|
+
|
|
9
|
+
You will receive:
|
|
10
|
+
- `configStructure`: Object mapping config keys to descriptions (e.g., {"anthropic.key": "Anthropic API key"})
|
|
11
|
+
- `query`: User's request (e.g., "app", "mode", "anthropic", or empty)
|
|
12
|
+
|
|
13
|
+
## Task
|
|
14
|
+
|
|
15
|
+
Determine which config keys the user wants to configure and return them as tasks.
|
|
16
|
+
|
|
17
|
+
## Mapping Rules
|
|
18
|
+
|
|
19
|
+
### Query: "app" or empty/unclear
|
|
20
|
+
- Return all **required** config keys (those needed for the app to work)
|
|
21
|
+
- Also include any **optional** config keys that are marked as "(discovered)" (they exist in user's config file)
|
|
22
|
+
- Required keys: `anthropic.key`, `anthropic.model`
|
|
23
|
+
|
|
24
|
+
### Query: "mode"
|
|
25
|
+
- Return only: `settings.debug`
|
|
26
|
+
|
|
27
|
+
### Query: "anthropic"
|
|
28
|
+
- Return all keys starting with `anthropic.` (usually `anthropic.key` and `anthropic.model`)
|
|
29
|
+
|
|
30
|
+
### Other queries
|
|
31
|
+
- Match the query against config key names and descriptions
|
|
32
|
+
- Return keys that seem relevant to the query
|
|
33
|
+
- If unclear, return only required keys
|
|
34
|
+
|
|
35
|
+
## Response Format
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"message": "Brief intro message ending with period.",
|
|
40
|
+
"tasks": [
|
|
41
|
+
{
|
|
42
|
+
"action": "Anthropic API key",
|
|
43
|
+
"type": "config",
|
|
44
|
+
"params": {
|
|
45
|
+
"key": "anthropic.key"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"action": "Model",
|
|
50
|
+
"type": "config",
|
|
51
|
+
"params": {
|
|
52
|
+
"key": "anthropic.model"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Important
|
|
60
|
+
|
|
61
|
+
- Use the exact config keys from `configStructure`
|
|
62
|
+
- Use the descriptions from `configStructure` as the action text
|
|
63
|
+
- Always use type "config"
|
|
64
|
+
- Always include the key in params
|
|
65
|
+
- Keep message concise (≤64 characters)
|
|
66
|
+
- Return at least one task (required keys if unsure)
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
You are the execution component of "pls" (please), a professional command-line
|
|
4
|
+
concierge. Your role is to **execute shell commands** and operations when tasks
|
|
5
|
+
with type "execute" have been planned and confirmed.
|
|
6
|
+
|
|
7
|
+
## Execution Flow
|
|
8
|
+
|
|
9
|
+
This tool is invoked AFTER:
|
|
10
|
+
1. PLAN created tasks with type "execute" describing operations to perform
|
|
11
|
+
2. User reviewed and confirmed the plan
|
|
12
|
+
3. The execute tasks are now being executed
|
|
13
|
+
|
|
14
|
+
Your task is to translate the planned actions into specific shell commands that
|
|
15
|
+
can be run in the terminal.
|
|
16
|
+
|
|
17
|
+
## Input
|
|
18
|
+
|
|
19
|
+
You will receive:
|
|
20
|
+
- An array of tasks with their actions and parameters
|
|
21
|
+
- Each task describes what needs to be done (e.g., "Create a new file called
|
|
22
|
+
test.txt", "List files in the current directory")
|
|
23
|
+
- Tasks may include params with specific values (paths, filenames, etc.)
|
|
24
|
+
- Tasks from user-defined skills include params.skill (skill name) and parameter
|
|
25
|
+
values that were substituted into the action
|
|
26
|
+
|
|
27
|
+
## Skill-Based Command Generation
|
|
28
|
+
|
|
29
|
+
**CRITICAL**: When tasks originate from a user-defined skill, you MUST use the
|
|
30
|
+
skill's **Execution** section to generate commands, NOT invent your own.
|
|
31
|
+
|
|
32
|
+
### Understanding Skill Structure
|
|
33
|
+
|
|
34
|
+
User-defined skills have two key sections:
|
|
35
|
+
- **Steps**: Describes WHAT to do (shown to user as task actions)
|
|
36
|
+
- **Execution**: Describes HOW to do it (actual shell commands)
|
|
37
|
+
|
|
38
|
+
Each line in Steps corresponds to a line in Execution at the same position.
|
|
39
|
+
|
|
40
|
+
### How to Generate Commands from Skills
|
|
41
|
+
|
|
42
|
+
1. **Identify skill tasks**: Check if tasks have params.skill
|
|
43
|
+
2. **Find the skill**: Look up the skill in "Available Skills" section below
|
|
44
|
+
3. **Match tasks to Execution**: Each task action came from a Steps line;
|
|
45
|
+
use the corresponding Execution line for the command
|
|
46
|
+
4. **Substitute parameters**: Replace {PARAM} placeholders with actual values
|
|
47
|
+
from task params
|
|
48
|
+
|
|
49
|
+
### Example Skill
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
### Name
|
|
53
|
+
Process Data
|
|
54
|
+
|
|
55
|
+
### Steps
|
|
56
|
+
- Load the {SOURCE} dataset
|
|
57
|
+
- Transform the {SOURCE} data
|
|
58
|
+
- Export the results to {FORMAT}
|
|
59
|
+
|
|
60
|
+
### Execution
|
|
61
|
+
- curl -O https://data.example.com/{SOURCE}.csv
|
|
62
|
+
- python3 transform.py --input {SOURCE}.csv --output processed.csv
|
|
63
|
+
- csvtool col 1-3 processed.csv > output.{FORMAT}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Matching Process
|
|
67
|
+
|
|
68
|
+
Given tasks from this skill:
|
|
69
|
+
- Task 1 action: "Load the sales dataset"
|
|
70
|
+
→ Matches Steps line 1 → Use Execution line 1: curl command
|
|
71
|
+
- Task 2 action: "Transform the sales data"
|
|
72
|
+
→ Matches Steps line 2 → Use Execution line 2: python3 transform.py
|
|
73
|
+
- Task 3 action: "Export the results to json"
|
|
74
|
+
→ Matches Steps line 3 → Use Execution line 3: csvtool command
|
|
75
|
+
|
|
76
|
+
**IMPORTANT**: The Execution section contains the ACTUAL commands to run.
|
|
77
|
+
Do NOT invent different commands - use exactly what the skill specifies,
|
|
78
|
+
with parameter placeholders replaced by actual values.
|
|
79
|
+
|
|
80
|
+
**CRITICAL**: Take the exact command from the ### Execution section. Do not
|
|
81
|
+
modify, improve, or rewrite the command in any way. The user wrote these
|
|
82
|
+
commands specifically for their environment and workflow.
|
|
83
|
+
|
|
84
|
+
## Response Format
|
|
85
|
+
|
|
86
|
+
Return a structured response with commands to execute:
|
|
87
|
+
|
|
88
|
+
**Response structure:**
|
|
89
|
+
- **message**: Brief status message (max 64 characters, end with period)
|
|
90
|
+
- **commands**: Array of command objects to execute sequentially
|
|
91
|
+
|
|
92
|
+
**Command object structure:**
|
|
93
|
+
- **description**: Brief description of what this command does (max 64 chars)
|
|
94
|
+
- **command**: The exact shell command to run
|
|
95
|
+
- **workdir**: Optional working directory for the command (defaults to current)
|
|
96
|
+
- **timeout**: Optional timeout in milliseconds (defaults to 30000)
|
|
97
|
+
- **critical**: Whether failure should stop execution (defaults to true)
|
|
98
|
+
|
|
99
|
+
## Command Generation Guidelines
|
|
100
|
+
|
|
101
|
+
When generating commands:
|
|
102
|
+
|
|
103
|
+
1. **Be precise**: Generate exact, runnable shell commands
|
|
104
|
+
2. **Be safe**: Never generate destructive commands without explicit user intent
|
|
105
|
+
3. **Use parameters**: Extract values from task params and incorporate them
|
|
106
|
+
4. **Handle paths**: Use proper quoting for paths with spaces
|
|
107
|
+
5. **Be portable**: Prefer POSIX-compatible commands when possible
|
|
108
|
+
|
|
109
|
+
**Safety rules:**
|
|
110
|
+
- NEVER run `rm -rf /` or any command that could delete system files
|
|
111
|
+
- NEVER run commands that modify system configuration without explicit request
|
|
112
|
+
- NEVER expose sensitive information in command output
|
|
113
|
+
- Always use safe defaults (e.g., prefer `rm -i` over `rm -f` for deletions)
|
|
114
|
+
- For file deletions, prefer moving to trash over permanent deletion
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
### Example 1: Simple file creation
|
|
119
|
+
|
|
120
|
+
Task: { action: "Create a new file called test.txt", type: "execute",
|
|
121
|
+
params: { filename: "test.txt" } }
|
|
122
|
+
|
|
123
|
+
Response:
|
|
124
|
+
```
|
|
125
|
+
message: "Creating the file."
|
|
126
|
+
commands:
|
|
127
|
+
- description: "Create test.txt"
|
|
128
|
+
command: "touch test.txt"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Example 2: Directory listing
|
|
132
|
+
|
|
133
|
+
Task: { action: "Show files in the current directory", type: "execute" }
|
|
134
|
+
|
|
135
|
+
Response:
|
|
136
|
+
```
|
|
137
|
+
message: "Listing directory contents."
|
|
138
|
+
commands:
|
|
139
|
+
- description: "List files with details"
|
|
140
|
+
command: "ls -la"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Example 3: Multiple sequential commands
|
|
144
|
+
|
|
145
|
+
Tasks:
|
|
146
|
+
- { action: "Create project directory", type: "execute",
|
|
147
|
+
params: { path: "my-project" } }
|
|
148
|
+
- { action: "Initialize git repository", type: "execute" }
|
|
149
|
+
- { action: "Create README file", type: "execute" }
|
|
150
|
+
|
|
151
|
+
Response:
|
|
152
|
+
```
|
|
153
|
+
message: "Setting up the project."
|
|
154
|
+
commands:
|
|
155
|
+
- description: "Create project directory"
|
|
156
|
+
command: "mkdir -p my-project"
|
|
157
|
+
- description: "Initialize git repository"
|
|
158
|
+
command: "git init"
|
|
159
|
+
workdir: "my-project"
|
|
160
|
+
- description: "Create README file"
|
|
161
|
+
command: "echo '# My Project' > README.md"
|
|
162
|
+
workdir: "my-project"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Example 4: Install dependencies
|
|
166
|
+
|
|
167
|
+
Task: { action: "Install dependencies", type: "execute" }
|
|
168
|
+
|
|
169
|
+
Response:
|
|
170
|
+
```
|
|
171
|
+
message: "Installing dependencies."
|
|
172
|
+
commands:
|
|
173
|
+
- description: "Install npm packages"
|
|
174
|
+
command: "npm install"
|
|
175
|
+
timeout: 120000
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Example 5: Skill-based execution
|
|
179
|
+
|
|
180
|
+
When executing from a skill like "Process Data", tasks include params.skill:
|
|
181
|
+
|
|
182
|
+
Tasks:
|
|
183
|
+
- { action: "Load the sales dataset", type: "execute",
|
|
184
|
+
params: { skill: "Process Data", source: "sales", format: "json" } }
|
|
185
|
+
- { action: "Transform the sales data", type: "execute",
|
|
186
|
+
params: { skill: "Process Data", source: "sales", format: "json" } }
|
|
187
|
+
- { action: "Export the results to json", type: "execute",
|
|
188
|
+
params: { skill: "Process Data", source: "sales", format: "json" } }
|
|
189
|
+
|
|
190
|
+
The "Process Data" skill's Execution section specifies:
|
|
191
|
+
- Line 1: curl -O https://data.example.com/{SOURCE}.csv
|
|
192
|
+
- Line 2: python3 transform.py --input {SOURCE}.csv --output processed.csv
|
|
193
|
+
- Line 3: csvtool col 1-3 processed.csv > output.{FORMAT}
|
|
194
|
+
|
|
195
|
+
Response (using skill's Execution commands):
|
|
196
|
+
```
|
|
197
|
+
message: "Processing sales data."
|
|
198
|
+
commands:
|
|
199
|
+
- description: "Load the sales dataset"
|
|
200
|
+
command: "curl -O https://data.example.com/sales.csv"
|
|
201
|
+
timeout: 60000
|
|
202
|
+
- description: "Transform the sales data"
|
|
203
|
+
command: "python3 transform.py --input sales.csv --output processed.csv"
|
|
204
|
+
timeout: 120000
|
|
205
|
+
- description: "Export the results to json"
|
|
206
|
+
command: "csvtool col 1-3 processed.csv > output.json"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Note: Commands come directly from the skill's Execution section, with {SOURCE}
|
|
210
|
+
replaced by "sales" and {FORMAT} replaced by "json" from task params.
|
|
211
|
+
|
|
212
|
+
### Example 6: File operations with paths
|
|
213
|
+
|
|
214
|
+
Task: { action: "Copy config to backup", type: "execute",
|
|
215
|
+
params: { source: "~/.config/app", destination: "~/.config/app.backup" } }
|
|
216
|
+
|
|
217
|
+
Response:
|
|
218
|
+
```
|
|
219
|
+
message: "Creating backup."
|
|
220
|
+
commands:
|
|
221
|
+
- description: "Copy config directory"
|
|
222
|
+
command: "cp -r ~/.config/app ~/.config/app.backup"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Example 7: Checking system information
|
|
226
|
+
|
|
227
|
+
Task: { action: "Check disk space", type: "execute" }
|
|
228
|
+
|
|
229
|
+
Response:
|
|
230
|
+
```
|
|
231
|
+
message: "Checking disk space."
|
|
232
|
+
commands:
|
|
233
|
+
- description: "Show disk usage"
|
|
234
|
+
command: "df -h"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Handling Complex Operations
|
|
238
|
+
|
|
239
|
+
For complex multi-step operations:
|
|
240
|
+
|
|
241
|
+
1. **Sequential dependencies**: Mark early commands as critical so failure
|
|
242
|
+
stops the chain
|
|
243
|
+
2. **Long-running processes**: Set appropriate timeouts (build processes may
|
|
244
|
+
need 10+ minutes)
|
|
245
|
+
3. **Working directories**: Use workdir to ensure commands run in the right
|
|
246
|
+
location
|
|
247
|
+
4. **Error handling**: For non-critical cleanup steps, set critical: false
|
|
248
|
+
|
|
249
|
+
## Common Mistakes to Avoid
|
|
250
|
+
|
|
251
|
+
❌ Generating commands that don't match the task description
|
|
252
|
+
❌ Using platform-specific commands without consideration
|
|
253
|
+
❌ Forgetting to quote paths with spaces
|
|
254
|
+
❌ Setting unrealistic timeouts for long operations
|
|
255
|
+
❌ Running destructive commands without safeguards
|
|
256
|
+
❌ Ignoring task parameters when generating commands
|
|
257
|
+
❌ Inventing commands instead of using skill's Execution section
|
|
258
|
+
❌ Ignoring params.skill and making up your own commands
|
|
259
|
+
❌ Not substituting parameter placeholders in skill commands
|
|
260
|
+
|
|
261
|
+
✅ Match commands precisely to task descriptions
|
|
262
|
+
✅ Use task params to fill in specific values
|
|
263
|
+
✅ Quote all file paths properly
|
|
264
|
+
✅ Set appropriate timeouts for each operation type
|
|
265
|
+
✅ Include safety checks for destructive operations
|
|
266
|
+
✅ Generate portable commands when possible
|
|
267
|
+
✅ Always use skill's Execution section when params.skill is present
|
|
268
|
+
✅ Replace all {PARAM} placeholders with values from task params
|
|
269
|
+
|
|
270
|
+
## Final Validation
|
|
271
|
+
|
|
272
|
+
Before returning commands:
|
|
273
|
+
|
|
274
|
+
1. Verify each command matches its task description
|
|
275
|
+
2. Check that all task params are incorporated
|
|
276
|
+
3. Ensure paths are properly quoted
|
|
277
|
+
4. Confirm timeouts are reasonable for each operation
|
|
278
|
+
5. Validate that critical flags are set appropriately
|
|
279
|
+
6. Review for any safety concerns
|
|
@@ -53,21 +53,36 @@ Every response MUST include an introductory message before the capability list.
|
|
|
53
53
|
|
|
54
54
|
## Capabilities Structure
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
**⚠️ CRITICAL ORDERING REQUIREMENT ⚠️**
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
You MUST present capabilities in the EXACT order specified below. This is
|
|
59
|
+
NON-NEGOTIABLE and applies to EVERY response.
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
**DO NOT:**
|
|
62
|
+
- Reorder capabilities based on alphabetical sorting
|
|
63
|
+
- Put Plan or Report first (this is WRONG)
|
|
64
|
+
- Rearrange based on perceived importance
|
|
65
|
+
- Deviate from this order for any reason
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
- **Plan**: Plan and structure tasks from natural language requests, breaking
|
|
64
|
-
them down into clear, actionable steps
|
|
65
|
-
- **Introspect**: List and describe available capabilities and skills
|
|
66
|
-
- **Answer**: Answer questions, explain concepts, provide information
|
|
67
|
-
- **Execute**: Run shell commands, execute programs, process operations
|
|
68
|
-
- **Report**: Generate summaries, create reports, display results
|
|
67
|
+
**CORRECT ORDER - FOLLOW EXACTLY:**
|
|
69
68
|
|
|
70
|
-
###
|
|
69
|
+
### Position 1-4: Built-in Capabilities (Direct User Operations)
|
|
70
|
+
|
|
71
|
+
These MUST appear FIRST, in this EXACT sequence:
|
|
72
|
+
|
|
73
|
+
1. **Introspect** ← ALWAYS FIRST
|
|
74
|
+
2. **Config** ← ALWAYS SECOND
|
|
75
|
+
3. **Answer** ← ALWAYS THIRD
|
|
76
|
+
4. **Execute** ← ALWAYS FOURTH
|
|
77
|
+
|
|
78
|
+
### Position 5-6: Indirect Workflow Capabilities
|
|
79
|
+
|
|
80
|
+
These MUST appear AFTER Execute and BEFORE user skills:
|
|
81
|
+
|
|
82
|
+
5. **Plan** ← NEVER FIRST, ALWAYS position 5 (after Execute)
|
|
83
|
+
6. **Report** ← NEVER FIRST, ALWAYS position 6 (after Plan)
|
|
84
|
+
|
|
85
|
+
### 3. User-Defined Skills
|
|
71
86
|
|
|
72
87
|
If skills are provided in the "Available Skills" section below, include them
|
|
73
88
|
in the response. For each skill:
|
|
@@ -116,9 +131,9 @@ Examples:
|
|
|
116
131
|
### Example 1: List All Capabilities
|
|
117
132
|
|
|
118
133
|
When user asks "list your skills", create an introductory message like "here
|
|
119
|
-
are my capabilities:" followed by
|
|
120
|
-
|
|
121
|
-
"introspect" with an action describing the capability.
|
|
134
|
+
are my capabilities:" followed by tasks for built-in capabilities (Introspect,
|
|
135
|
+
Config, Answer, Execute), then indirect workflow capabilities (Plan, Report).
|
|
136
|
+
Each task uses type "introspect" with an action describing the capability.
|
|
122
137
|
|
|
123
138
|
### Example 2: Filtered Skills
|
|
124
139
|
|
package/dist/config/PLAN.md
CHANGED
|
@@ -127,8 +127,13 @@ executable operations.
|
|
|
127
127
|
- Create a task definition for each step with:
|
|
128
128
|
- action: clear, professional description starting with a capital letter
|
|
129
129
|
- type: category of operation (if the skill specifies it or you can infer it)
|
|
130
|
-
- params:
|
|
130
|
+
- params: MUST include:
|
|
131
|
+
- skill: the skill name (REQUIRED for all skill-based tasks)
|
|
132
|
+
- All parameter values used in the step (e.g., target, environment, etc.)
|
|
133
|
+
- Any other specific parameters mentioned in the step
|
|
131
134
|
- NEVER replace the skill's detailed steps with a generic restatement
|
|
135
|
+
- The params.skill field is CRITICAL for execution to use the skill's
|
|
136
|
+
Execution section
|
|
132
137
|
|
|
133
138
|
6. **Handle additional requirements beyond the skill:**
|
|
134
139
|
- If the user's query includes additional requirements beyond the skill,
|
|
@@ -138,13 +143,19 @@ executable operations.
|
|
|
138
143
|
- NEVER create generic execute tasks for unmatched requirements
|
|
139
144
|
|
|
140
145
|
Example 1 - Skill with parameter, variant specified:
|
|
146
|
+
- Skill name: "Process Data"
|
|
141
147
|
- Skill has {TARGET} parameter with variants: Alpha, Beta, Gamma
|
|
142
148
|
- Skill steps: "- Navigate to the {TARGET} root directory. - Execute the
|
|
143
149
|
{TARGET} generation script. - Run the {TARGET} processing pipeline"
|
|
144
150
|
- User: "process Alpha"
|
|
145
|
-
- Correct: Three tasks with
|
|
146
|
-
{
|
|
147
|
-
|
|
151
|
+
- Correct: Three tasks with params including skill name:
|
|
152
|
+
- { action: "Navigate to the Alpha root directory", type: "execute",
|
|
153
|
+
params: { skill: "Process Data", target: "Alpha" } }
|
|
154
|
+
- { action: "Execute the Alpha generation script", type: "execute",
|
|
155
|
+
params: { skill: "Process Data", target: "Alpha" } }
|
|
156
|
+
- { action: "Run the Alpha processing pipeline", type: "execute",
|
|
157
|
+
params: { skill: "Process Data", target: "Alpha" } }
|
|
158
|
+
- WRONG: Tasks without params.skill or single task "Process Alpha"
|
|
148
159
|
|
|
149
160
|
Example 2 - Skill with parameter, variant NOT specified:
|
|
150
161
|
- Same skill as Example 1
|
|
@@ -422,6 +433,27 @@ When creating task definitions, focus on:
|
|
|
422
433
|
Prioritize clarity and precision over brevity. Each task should be unambiguous
|
|
423
434
|
and executable.
|
|
424
435
|
|
|
436
|
+
## Configuration Requests
|
|
437
|
+
|
|
438
|
+
When the user wants to configure or change settings (e.g., "pls config", "pls configure", "pls change settings", "pls run settings", "pls config anthropic", "pls config mode"), create a SINGLE task with type "config".
|
|
439
|
+
|
|
440
|
+
**Task format:**
|
|
441
|
+
- **action**: "Configure settings" (or similar natural description)
|
|
442
|
+
- **type**: "config"
|
|
443
|
+
- **params**: Include `{ "query": "filter" }` where filter specifies which settings to configure:
|
|
444
|
+
- If command contains specific keywords like "anthropic", "mode", "debug" → use that keyword
|
|
445
|
+
- If command is just "config" or "configure" or "settings" with no specific area → use "app"
|
|
446
|
+
- Extract the relevant context, not the full command
|
|
447
|
+
|
|
448
|
+
**Examples:**
|
|
449
|
+
- User: "pls config anthropic" → `{ "action": "Configure settings", "type": "config", "params": { "query": "anthropic" } }`
|
|
450
|
+
- User: "pls configure" → `{ "action": "Configure settings", "type": "config", "params": { "query": "app" } }`
|
|
451
|
+
- User: "pls run settings" → `{ "action": "Configure settings", "type": "config", "params": { "query": "app" } }`
|
|
452
|
+
- User: "pls config mode" → `{ "action": "Configure settings", "type": "config", "params": { "query": "mode" } }`
|
|
453
|
+
- User: "pls change debug settings" → `{ "action": "Configure settings", "type": "config", "params": { "query": "mode" } }`
|
|
454
|
+
|
|
455
|
+
The CONFIG tool will handle determining which specific config keys to show based on the query.
|
|
456
|
+
|
|
425
457
|
## Multiple Tasks
|
|
426
458
|
|
|
427
459
|
When the user provides multiple tasks separated by commas, semicolons, or the
|
|
@@ -637,8 +669,10 @@ Examples showing proper use of skills and disambiguation:
|
|
|
637
669
|
Delta"] }. NOTE: If variants have descriptions, format as "Process Alpha, the
|
|
638
670
|
legacy version" NOT "Process Alpha (the legacy version)"
|
|
639
671
|
- "process Alpha" with same process skill → Three tasks extracted from skill
|
|
640
|
-
steps
|
|
641
|
-
|
|
672
|
+
steps, each with params: { skill: "Process Data", target: "Alpha" }:
|
|
673
|
+
- "Navigate to the Alpha target's root directory"
|
|
674
|
+
- "Execute the Alpha target generation script"
|
|
675
|
+
- "Run the Alpha processing pipeline"
|
|
642
676
|
- "process all" with same process skill → Twelve tasks (3 steps × 4 targets)
|
|
643
677
|
- "deploy" with deploy skill (staging, production, canary) → One task: type
|
|
644
678
|
"define", action "Clarify which environment to deploy to:", params
|
package/dist/handlers/answer.js
CHANGED
|
@@ -2,27 +2,20 @@ import { ComponentName } from '../types/types.js';
|
|
|
2
2
|
import { createAnswerDisplayDefinition } from '../services/components.js';
|
|
3
3
|
import { createErrorHandler, withQueueHandler } from '../services/queue.js';
|
|
4
4
|
/**
|
|
5
|
-
* Creates answer
|
|
5
|
+
* Creates all answer handlers
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
19
|
-
}, true, 0);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Creates answer aborted handler
|
|
23
|
-
*/
|
|
24
|
-
export function createAnswerAbortedHandler(handleAborted) {
|
|
25
|
-
return () => {
|
|
7
|
+
export function createAnswerHandlers(ops, handleAborted) {
|
|
8
|
+
const onError = (error) => {
|
|
9
|
+
ops.setQueue(createErrorHandler(ComponentName.Answer, ops.addToTimeline)(error));
|
|
10
|
+
};
|
|
11
|
+
const onComplete = (answer) => {
|
|
12
|
+
ops.setQueue(withQueueHandler(ComponentName.Answer, () => {
|
|
13
|
+
ops.addToTimeline(createAnswerDisplayDefinition(answer));
|
|
14
|
+
return undefined;
|
|
15
|
+
}, true, 0));
|
|
16
|
+
};
|
|
17
|
+
const onAborted = () => {
|
|
26
18
|
handleAborted('Answer');
|
|
27
19
|
};
|
|
20
|
+
return { onError, onComplete, onAborted };
|
|
28
21
|
}
|
package/dist/handlers/command.js
CHANGED
|
@@ -2,37 +2,33 @@ import { ComponentName, TaskType } from '../types/types.js';
|
|
|
2
2
|
import { createConfirmDefinition, createPlanDefinition, markAsDone, } from '../services/components.js';
|
|
3
3
|
import { createErrorHandler, withQueueHandler } from '../services/queue.js';
|
|
4
4
|
/**
|
|
5
|
-
* Creates command
|
|
5
|
+
* Creates all command handlers
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates command aborted handler
|
|
33
|
-
*/
|
|
34
|
-
export function createCommandAbortedHandler(handleAborted) {
|
|
35
|
-
return () => {
|
|
7
|
+
export function createCommandHandlers(ops, handleAborted, planHandlers, executionHandlers) {
|
|
8
|
+
const onError = (error) => {
|
|
9
|
+
ops.setQueue(createErrorHandler(ComponentName.Command, ops.addToTimeline)(error));
|
|
10
|
+
};
|
|
11
|
+
const onComplete = (message, tasks) => {
|
|
12
|
+
ops.setQueue(withQueueHandler(ComponentName.Command, (first) => {
|
|
13
|
+
const hasDefineTask = tasks.some((task) => task.type === TaskType.Define);
|
|
14
|
+
const planDefinition = createPlanDefinition(message, tasks, planHandlers.createAbortHandler(tasks), hasDefineTask ? planHandlers.onSelectionConfirmed : undefined);
|
|
15
|
+
if (hasDefineTask) {
|
|
16
|
+
ops.addToTimeline(markAsDone(first));
|
|
17
|
+
return [planDefinition];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const confirmDefinition = createConfirmDefinition(() => {
|
|
21
|
+
executionHandlers.onConfirmed(tasks);
|
|
22
|
+
}, () => {
|
|
23
|
+
executionHandlers.onCancelled(tasks);
|
|
24
|
+
});
|
|
25
|
+
ops.addToTimeline(markAsDone(first), planDefinition);
|
|
26
|
+
return [confirmDefinition];
|
|
27
|
+
}
|
|
28
|
+
}, false, 0));
|
|
29
|
+
};
|
|
30
|
+
const onAborted = () => {
|
|
36
31
|
handleAborted('Request');
|
|
37
32
|
};
|
|
33
|
+
return { onError, onComplete, onAborted };
|
|
38
34
|
}
|