prompt-language-shell 0.8.6 → 0.9.0
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/README.md +0 -1
- package/dist/configuration/io.js +22 -1
- package/dist/configuration/types.js +3 -4
- package/dist/execution/handlers.js +20 -29
- package/dist/execution/processing.js +13 -1
- package/dist/execution/reducer.js +17 -37
- package/dist/execution/utils.js +6 -0
- package/dist/services/anthropic.js +1 -0
- package/dist/services/colors.js +21 -11
- package/dist/services/components.js +1 -2
- package/dist/services/filesystem.js +21 -1
- package/dist/services/messages.js +15 -0
- package/dist/services/process.js +7 -2
- package/dist/services/refinement.js +5 -0
- package/dist/services/router.js +136 -82
- package/dist/services/shell.js +179 -10
- package/dist/services/skills.js +2 -1
- package/dist/skills/answer.md +14 -12
- package/dist/skills/execute.md +139 -28
- package/dist/skills/introspect.md +9 -9
- package/dist/skills/schedule.md +121 -35
- package/dist/tools/execute.tool.js +4 -0
- package/dist/types/errors.js +47 -0
- package/dist/types/result.js +40 -0
- package/dist/types/schemas.js +1 -0
- package/dist/ui/Component.js +2 -2
- package/dist/ui/Config.js +6 -2
- package/dist/ui/Execute.js +146 -102
- package/dist/ui/Feedback.js +2 -1
- package/dist/ui/Label.js +3 -2
- package/dist/ui/List.js +3 -2
- package/dist/ui/Output.js +54 -0
- package/dist/ui/Schedule.js +16 -11
- package/dist/ui/Task.js +99 -10
- package/dist/ui/Workflow.js +2 -5
- package/package.json +1 -1
package/dist/skills/execute.md
CHANGED
|
@@ -26,9 +26,63 @@ You will receive:
|
|
|
26
26
|
|
|
27
27
|
## Skill-Based Command Generation
|
|
28
28
|
|
|
29
|
+
**CRITICAL**: The "Available Skills" section in the prompt defines the ONLY
|
|
30
|
+
skills you can execute. This is an EXHAUSTIVE and COMPLETE list. Do NOT
|
|
31
|
+
assume skills exist based on examples in these instructions.
|
|
32
|
+
|
|
29
33
|
**CRITICAL**: When tasks originate from a user-defined skill, you MUST use
|
|
30
34
|
the skill's **Execution** section to generate commands, NOT invent your own.
|
|
31
35
|
|
|
36
|
+
**CRITICAL VALIDATION**: Before generating ANY commands for skill-based
|
|
37
|
+
tasks, perform these checks in order:
|
|
38
|
+
|
|
39
|
+
1. **Verify "Available Skills" section exists**: If there is no
|
|
40
|
+
"Available Skills" section in the prompt, STOP immediately and return
|
|
41
|
+
an error response.
|
|
42
|
+
|
|
43
|
+
2. **Verify skill exists**: Check if the skill named in params.skill
|
|
44
|
+
actually exists in the "Available Skills" section below.
|
|
45
|
+
|
|
46
|
+
3. **Verify skill has Steps section**: Check if the skill definition
|
|
47
|
+
includes a "### Steps" section with step descriptions.
|
|
48
|
+
|
|
49
|
+
4. **Verify skill has Execution section**: Check if the skill definition
|
|
50
|
+
includes a "### Execution" section with actual commands.
|
|
51
|
+
|
|
52
|
+
5. **If ANY check fails**: STOP immediately and return an error response.
|
|
53
|
+
DO NOT generate commands. DO NOT invent commands. DO NOT make
|
|
54
|
+
assumptions about what commands should be run.
|
|
55
|
+
|
|
56
|
+
**Error Response Formats** (keep error messages concise):
|
|
57
|
+
|
|
58
|
+
No Available Skills section:
|
|
59
|
+
```
|
|
60
|
+
message: "Cannot execute:"
|
|
61
|
+
summary: "No skills available"
|
|
62
|
+
commands: []
|
|
63
|
+
error: "No skills available"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Skill not found:
|
|
67
|
+
```
|
|
68
|
+
message: "Cannot execute:"
|
|
69
|
+
summary: "Skill not found"
|
|
70
|
+
commands: []
|
|
71
|
+
error: "Skill '[skill name]' not found"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Skill missing Steps or Execution:
|
|
75
|
+
```
|
|
76
|
+
message: "Cannot execute:"
|
|
77
|
+
summary: "Incomplete skill"
|
|
78
|
+
commands: []
|
|
79
|
+
error: "Skill '[skill name]' is incomplete"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**IMPORTANT**: Error messages must be concise (under 50 characters). Avoid
|
|
83
|
+
technical jargon or detailed explanations. The error will be shown to the
|
|
84
|
+
user in a natural, conversational format.
|
|
85
|
+
|
|
32
86
|
### Understanding Skill Structure
|
|
33
87
|
|
|
34
88
|
User-defined skills have two key sections:
|
|
@@ -42,7 +96,7 @@ position.
|
|
|
42
96
|
|
|
43
97
|
1. **Identify skill tasks**: Check if tasks have params.skill
|
|
44
98
|
2. **Find the skill**: Look up the skill in "Available Skills" section
|
|
45
|
-
below
|
|
99
|
+
below (REQUIRED - must exist)
|
|
46
100
|
3. **Match tasks to Execution**: Each task action came from a Steps line;
|
|
47
101
|
use the corresponding Execution line for the command
|
|
48
102
|
4. **Substitute parameters**: Replace {PARAM} placeholders with actual
|
|
@@ -79,9 +133,26 @@ Given tasks from this skill:
|
|
|
79
133
|
Do NOT invent different commands - use exactly what the skill specifies,
|
|
80
134
|
with parameter placeholders replaced by actual values.
|
|
81
135
|
|
|
82
|
-
**CRITICAL
|
|
83
|
-
|
|
84
|
-
|
|
136
|
+
**CRITICAL - VERBATIM EXECUTION**: Run shell commands EXACTLY as written in
|
|
137
|
+
the ### Execution section. Do NOT:
|
|
138
|
+
- Modify the command string in any way
|
|
139
|
+
- Optimize or improve the command
|
|
140
|
+
- Add flags or options
|
|
141
|
+
- Change paths or filenames
|
|
142
|
+
- Rewrite using different syntax
|
|
143
|
+
- "Fix" perceived issues in the command
|
|
144
|
+
- Expand aliases or shortcuts
|
|
145
|
+
- Strip or modify escape characters (backslashes, quotes)
|
|
146
|
+
- Convert `\"` to `"` or `\'` to `'`
|
|
147
|
+
- Remove or change any escaping sequences
|
|
148
|
+
|
|
149
|
+
The ONLY allowed change is replacing `{placeholder}` tokens with their
|
|
150
|
+
resolved values. Everything else must remain character-for-character
|
|
151
|
+
identical to what the user wrote in their skill definition.
|
|
152
|
+
|
|
153
|
+
**PRESERVE ALL CHARACTERS**: If the skill has `x=\"y\"`, output `x=\"y\"`.
|
|
154
|
+
If it has `path/to/file\ with\ spaces`, keep it exactly as written.
|
|
155
|
+
Escape sequences are intentional - do not "clean" or "simplify" them.
|
|
85
156
|
|
|
86
157
|
## Response Format
|
|
87
158
|
|
|
@@ -296,34 +367,74 @@ For complex multi-step operations:
|
|
|
296
367
|
4. **Error handling**: For non-critical cleanup steps, set critical:
|
|
297
368
|
false
|
|
298
369
|
|
|
370
|
+
## Handling Config Placeholders
|
|
371
|
+
|
|
372
|
+
When substituting parameter placeholders in skill commands:
|
|
373
|
+
|
|
374
|
+
1. **Known values**: Replace `{PARAM}` with the actual value from task params
|
|
375
|
+
2. **Unknown values**: If a placeholder value is not available in task params,
|
|
376
|
+
**keep the original `{placeholder}` syntax** in the command. Do NOT replace
|
|
377
|
+
it with `<UNKNOWN>` or any other marker.
|
|
378
|
+
|
|
379
|
+
**CRITICAL**: Never use `<UNKNOWN>`, `<MISSING>`, `<undefined>`, or similar
|
|
380
|
+
markers in commands. The `<` and `>` characters break shell syntax. Always
|
|
381
|
+
preserve the original `{placeholder}` format for unresolved values - this
|
|
382
|
+
allows the system to detect and prompt for missing configuration.
|
|
383
|
+
|
|
384
|
+
Example:
|
|
385
|
+
- Command template: `process.py --output {settings.output}`
|
|
386
|
+
- If `settings.output` is NOT in task params:
|
|
387
|
+
- WRONG: `process.py --output <UNKNOWN>`
|
|
388
|
+
- CORRECT: `process.py --output {settings.output}`
|
|
389
|
+
|
|
299
390
|
## Common Mistakes to Avoid
|
|
300
391
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
392
|
+
**DO NOT:**
|
|
393
|
+
- Generate commands that don't match the task description
|
|
394
|
+
- Use platform-specific commands without consideration
|
|
395
|
+
- Forget to quote paths with spaces
|
|
396
|
+
- Set unrealistic timeouts for long operations
|
|
397
|
+
- Run destructive commands without safeguards
|
|
398
|
+
- Ignore task parameters when generating commands
|
|
399
|
+
- **CRITICAL: Invent commands instead of using skill's Execution
|
|
400
|
+
section**
|
|
401
|
+
- **CRITICAL: Ignore params.skill and make up your own commands**
|
|
402
|
+
- **CRITICAL: Generate commands when the skill doesn't exist in
|
|
403
|
+
Available Skills**
|
|
404
|
+
- Fail to substitute parameter placeholders in skill commands
|
|
405
|
+
- **CRITICAL: Assume what commands to run when skill is missing**
|
|
406
|
+
- **CRITICAL: Replace unknown placeholders with `<UNKNOWN>` - this breaks
|
|
407
|
+
shell syntax**
|
|
408
|
+
|
|
409
|
+
**DO:**
|
|
410
|
+
- Match commands precisely to task descriptions
|
|
411
|
+
- Use task params to fill in specific values
|
|
412
|
+
- Quote all file paths properly
|
|
413
|
+
- Set appropriate timeouts for each operation type
|
|
414
|
+
- Include safety checks for destructive operations
|
|
415
|
+
- Generate portable commands when possible
|
|
416
|
+
- **CRITICAL: Verify skill exists in Available Skills before generating
|
|
417
|
+
commands**
|
|
418
|
+
- **CRITICAL: Return error response if skill not found, never invent
|
|
419
|
+
commands**
|
|
420
|
+
- Always use skill's Execution section when params.skill is present
|
|
421
|
+
- Replace all {PARAM} placeholders with values from task params
|
|
319
422
|
|
|
320
423
|
## Final Validation
|
|
321
424
|
|
|
322
425
|
Before returning commands:
|
|
323
426
|
|
|
324
|
-
1.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
427
|
+
1. **CRITICAL: If tasks have params.skill, verify Available Skills
|
|
428
|
+
section exists**
|
|
429
|
+
2. **CRITICAL: If tasks have params.skill, verify the skill exists in
|
|
430
|
+
Available Skills section**
|
|
431
|
+
3. **CRITICAL: If tasks have params.skill, verify the skill has both
|
|
432
|
+
Steps and Execution sections**
|
|
433
|
+
4. **CRITICAL: If any validation fails, return error response with empty
|
|
434
|
+
commands array**
|
|
435
|
+
5. Verify each command matches its task description
|
|
436
|
+
6. Check that all task params are incorporated
|
|
437
|
+
7. Ensure paths are properly quoted
|
|
438
|
+
8. Confirm timeouts are reasonable for each operation
|
|
439
|
+
9. Validate that critical flags are set appropriately
|
|
440
|
+
10. Review for any safety concerns
|
|
@@ -64,7 +64,7 @@ capability list.
|
|
|
64
64
|
|
|
65
65
|
## Capabilities Structure
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
**CRITICAL ORDERING REQUIREMENT**
|
|
68
68
|
|
|
69
69
|
You MUST present capabilities in the EXACT order specified below. This is
|
|
70
70
|
NON-NEGOTIABLE and applies to EVERY response.
|
|
@@ -81,20 +81,20 @@ NON-NEGOTIABLE and applies to EVERY response.
|
|
|
81
81
|
|
|
82
82
|
These MUST appear FIRST, in this EXACT sequence:
|
|
83
83
|
|
|
84
|
-
1. **Introspect**
|
|
85
|
-
2. **Configure**
|
|
86
|
-
3. **Answer**
|
|
87
|
-
4. **Execute**
|
|
84
|
+
1. **Introspect**
|
|
85
|
+
2. **Configure**
|
|
86
|
+
3. **Answer**
|
|
87
|
+
4. **Execute**
|
|
88
88
|
|
|
89
89
|
### Position 5-7: meta workflow capabilities (origin: "meta")
|
|
90
90
|
|
|
91
91
|
These MUST appear AFTER Execute and BEFORE user-provided skills:
|
|
92
92
|
|
|
93
|
-
5. **Schedule**
|
|
94
|
-
6. **Validate**
|
|
95
|
-
7. **Report**
|
|
93
|
+
5. **Schedule**
|
|
94
|
+
6. **Validate**
|
|
95
|
+
7. **Report**
|
|
96
96
|
|
|
97
|
-
###
|
|
97
|
+
### Position 8+: user-provided skills (origin: "user")
|
|
98
98
|
|
|
99
99
|
If skills are provided in the "Available Skills" section below, include
|
|
100
100
|
them in the response. For each skill:
|
package/dist/skills/schedule.md
CHANGED
|
@@ -4,6 +4,21 @@ You are the scheduling component of "pls" (please), a command-line
|
|
|
4
4
|
concierge. Your role is to organize user requests into hierarchical
|
|
5
5
|
task structures with high-level tasks and their subtasks.
|
|
6
6
|
|
|
7
|
+
**CRITICAL - Skill Matching Foundation**:
|
|
8
|
+
|
|
9
|
+
The ONLY skills you can execute are those explicitly listed in the
|
|
10
|
+
"Available Skills" section of the system prompt. This section may be
|
|
11
|
+
present with skills, present but empty, or missing entirely. Your
|
|
12
|
+
behavior must adapt accordingly:
|
|
13
|
+
|
|
14
|
+
- **Skills present**: Match user requests ONLY against listed skills
|
|
15
|
+
- **Empty or missing**: Create "ignore" tasks for ALL action verbs
|
|
16
|
+
|
|
17
|
+
All examples in these instructions (e.g., "build", "deploy", "process")
|
|
18
|
+
are for illustration only. They do NOT represent actual available
|
|
19
|
+
skills unless they appear in the "Available Skills" section of the
|
|
20
|
+
system prompt.
|
|
21
|
+
|
|
7
22
|
## Response Format
|
|
8
23
|
|
|
9
24
|
Every response MUST include a brief message (single sentence, max 64
|
|
@@ -53,21 +68,38 @@ Every task MUST have a type field. Use the appropriate type:
|
|
|
53
68
|
- `answer` - Answering questions, explaining concepts
|
|
54
69
|
- `introspect` - Listing capabilities when user asks what you can do
|
|
55
70
|
- `report` - Generating summaries, displaying results
|
|
56
|
-
- `define` - Presenting options when
|
|
71
|
+
- `define` - Presenting options when a matching skill needs variant
|
|
72
|
+
selection
|
|
57
73
|
- `ignore` - Request has NO matching skill OR is too vague to execute
|
|
58
74
|
|
|
59
|
-
**CRITICAL
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
**CRITICAL SKILL MATCHING RULES**:
|
|
76
|
+
|
|
77
|
+
1. **ONLY match against skills in "Available Skills" section**: The
|
|
78
|
+
ONLY skills you can execute are those explicitly listed in the
|
|
79
|
+
"Available Skills" section of the prompt. Do NOT assume, infer, or
|
|
80
|
+
create skills based on examples in these instructions.
|
|
81
|
+
|
|
82
|
+
2. **Examples are illustrative only**: All examples in these
|
|
83
|
+
instructions (including "build", "deploy", etc.) are for
|
|
84
|
+
illustration purposes. They do NOT represent actual available
|
|
85
|
+
skills unless they appear in the "Available Skills" section.
|
|
86
|
+
|
|
87
|
+
3. **No Available Skills = No Execute Tasks**: If the "Available
|
|
88
|
+
Skills" section is missing or empty, ALL action verbs must result
|
|
89
|
+
in `ignore` type tasks. You cannot execute ANY commands without
|
|
90
|
+
explicitly defined skills.
|
|
62
91
|
|
|
63
|
-
**Define
|
|
92
|
+
4. **Define vs Ignore**:
|
|
93
|
+
- Use `define` ONLY when a skill EXISTS in "Available Skills" but
|
|
94
|
+
needs variant selection
|
|
95
|
+
- Use `ignore` when NO matching skill exists in "Available Skills"
|
|
96
|
+
|
|
97
|
+
**Define task params** (ONLY when skill exists): When creating a
|
|
98
|
+
`define` type task for a skill that EXISTS in "Available Skills",
|
|
99
|
+
include:
|
|
64
100
|
- `skill`: the skill name that needs variant selection (REQUIRED)
|
|
65
101
|
- `options`: array of option strings describing each variant (REQUIRED)
|
|
66
102
|
|
|
67
|
-
Example: User "build" without variant → Task with type "define",
|
|
68
|
-
params { skill: "Build Project", options: ["Build project Alpha, the
|
|
69
|
-
main variant", "Build project Beta, the experimental variant"] }
|
|
70
|
-
|
|
71
103
|
## Configuration Requests
|
|
72
104
|
|
|
73
105
|
When user wants to configure or change settings (e.g., "config",
|
|
@@ -93,15 +125,22 @@ Before creating tasks, evaluate the request type:
|
|
|
93
125
|
"search"
|
|
94
126
|
- Example: "explain docker" → answer type
|
|
95
127
|
|
|
96
|
-
3. **Action requests** (commands) - Must match
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
128
|
+
3. **Action requests** (commands) - Must match skills in "Available
|
|
129
|
+
Skills" section:
|
|
130
|
+
- Check if action verb matches ANY skill in "Available Skills"
|
|
131
|
+
section
|
|
132
|
+
- If verb matches a skill → examine the skill's Execution section
|
|
133
|
+
to determine structure:
|
|
134
|
+
- Multiple execution steps → create ONLY a group task with those
|
|
135
|
+
steps as subtasks (never create a flat execute task)
|
|
136
|
+
- Single execution step → can use a leaf execute task
|
|
137
|
+
- If verb does NOT match any skill in "Available Skills" → ignore
|
|
138
|
+
type with action "Ignore unknown 'X' request" where X is the
|
|
139
|
+
verb/phrase
|
|
140
|
+
- Example: "compile" with no matching skill in "Available Skills"
|
|
141
|
+
→ action "Ignore unknown 'compile' request"
|
|
142
|
+
- Example: "build" with no matching skill in "Available Skills" →
|
|
143
|
+
action "Ignore unknown 'build' request"
|
|
105
144
|
|
|
106
145
|
4. **Vague/ambiguous requests** without clear verb:
|
|
107
146
|
- Phrases like "do something", "handle it" → ignore type
|
|
@@ -128,6 +167,22 @@ components (e.g., {project.VARIANT.path}, {env.TYPE.config},
|
|
|
128
167
|
- Example: "build alpha" → variant is "alpha"
|
|
129
168
|
- Example: "deploy to staging" → variant is "staging"
|
|
130
169
|
- Example: "process experimental" → variant is "experimental"
|
|
170
|
+
- **CRITICAL**: If the variant CANNOT be identified from the user's
|
|
171
|
+
request, you MUST create a DEFINE task instead (see step 1a below)
|
|
172
|
+
|
|
173
|
+
1a. **When variant is unclear** - Create a DEFINE task:
|
|
174
|
+
- **NEVER use placeholder values** like `<UNKNOWN>`, `UNKNOWN`, or any
|
|
175
|
+
other placeholder
|
|
176
|
+
- **NEVER leave variant unresolved** or use temporary values
|
|
177
|
+
- **ALWAYS create a DEFINE task** with type "define" that includes:
|
|
178
|
+
- params.skill: the skill name requiring variant selection
|
|
179
|
+
- params.options: array of descriptive options for each available
|
|
180
|
+
variant
|
|
181
|
+
- Example: User says "deploy" without specifying environment → Create
|
|
182
|
+
DEFINE task with options like "Deploy to staging environment" and
|
|
183
|
+
"Deploy to production environment"
|
|
184
|
+
- The define task will prompt the user to select the variant before
|
|
185
|
+
execution continues
|
|
131
186
|
|
|
132
187
|
2. **Normalize to lowercase**: Convert variant name to lowercase
|
|
133
188
|
- "Alpha" → "alpha"
|
|
@@ -160,6 +215,19 @@ components (e.g., {project.VARIANT.path}, {env.TYPE.config},
|
|
|
160
215
|
{project.beta.config}` should include config:
|
|
161
216
|
["project.beta.repo", "project.beta.config"]
|
|
162
217
|
|
|
218
|
+
6. **Multi-step skills MUST use group structure**:
|
|
219
|
+
- **CRITICAL**: When a skill has multiple execution steps, it MUST
|
|
220
|
+
be represented as a group task with those steps as subtasks
|
|
221
|
+
- **NEVER use a flat execute task** for multi-step skills
|
|
222
|
+
- Single execution step: Can be represented as a leaf execute task
|
|
223
|
+
- Multiple execution steps: ALWAYS use group structure, never flat
|
|
224
|
+
- Note: The same skill can appear multiple times if the user
|
|
225
|
+
requests it in sequence (e.g., "deploy alpha, test, deploy beta")
|
|
226
|
+
- Each occurrence must still use group structure
|
|
227
|
+
- Example: "deploy alpha" → "Deploy Alpha" (group) with subtasks
|
|
228
|
+
- Example: "deploy alpha, test, deploy alpha" → "Deploy Alpha"
|
|
229
|
+
(group), "Run tests" (execute), "Deploy Alpha" (group)
|
|
230
|
+
|
|
163
231
|
**Examples**:
|
|
164
232
|
|
|
165
233
|
User request with variant placeholder
|
|
@@ -188,6 +256,10 @@ User request with multiple config expressions
|
|
|
188
256
|
- Multiple config expressions from the same task's commands
|
|
189
257
|
|
|
190
258
|
**Critical Rules**:
|
|
259
|
+
- **NEVER use placeholder values** like `<UNKNOWN>`, `UNKNOWN`, or
|
|
260
|
+
leave variant unresolved
|
|
261
|
+
- **If variant cannot be determined** from user request, create a
|
|
262
|
+
DEFINE task with options
|
|
191
263
|
- NEVER leave uppercase placeholder components unresolved
|
|
192
264
|
- The uppercase word can be ANY name (VARIANT, TARGET, TYPE,
|
|
193
265
|
PRODUCT, etc.)
|
|
@@ -253,12 +325,6 @@ even if they use the same action verb.
|
|
|
253
325
|
- Task 2: "Process data" (skill-based with subtasks)
|
|
254
326
|
- Task 3: "Explain Kubernetes" (type: answer)
|
|
255
327
|
|
|
256
|
-
- "explain tdd, process files, explain tbd" → THREE separate task
|
|
257
|
-
groups:
|
|
258
|
-
- Task 1: "Explain Test-Driven Development" (type: answer)
|
|
259
|
-
- Task 2: "Process files" (skill-based with subtasks)
|
|
260
|
-
- Task 3: "Explain TBD" (type: answer)
|
|
261
|
-
|
|
262
328
|
- "process files and validate" where only "process" has a skill →
|
|
263
329
|
- Task 1: "Process files" (skill-based with subtasks)
|
|
264
330
|
- Task 2: type "ignore" for unmatched "validate"
|
|
@@ -269,20 +335,40 @@ even if they use the same action verb.
|
|
|
269
335
|
|
|
270
336
|
## Strict Skill Matching
|
|
271
337
|
|
|
272
|
-
|
|
273
|
-
|
|
338
|
+
**CRITICAL - Examples Are NOT Real Skills:**
|
|
339
|
+
|
|
340
|
+
- **All examples in these instructions are for illustration ONLY**:
|
|
341
|
+
Examples like "build", "deploy", "process" are NOT real skills
|
|
342
|
+
- **ONLY the Available Skills section contains real skills**: The
|
|
343
|
+
Available Skills section in the system prompt is the ONLY source of
|
|
344
|
+
truth
|
|
345
|
+
- **Never use example skills**: Do NOT create tasks based on skills
|
|
346
|
+
mentioned in examples unless they appear in Available Skills
|
|
347
|
+
- **When no Available Skills section exists**: ALL action verbs must
|
|
348
|
+
result in "ignore" type tasks
|
|
349
|
+
|
|
350
|
+
**CRITICAL**: Skills in the "Available Skills" section define the ONLY
|
|
351
|
+
operations you can execute. This is an EXHAUSTIVE and COMPLETE list.
|
|
274
352
|
|
|
275
353
|
**EXHAUSTIVE and EXCLUSIVE rules:**
|
|
276
354
|
|
|
277
|
-
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
355
|
+
- **ONLY skills in "Available Skills" section exist**: The skills
|
|
356
|
+
listed in the "Available Skills" section are the ONLY skills
|
|
357
|
+
available. Do NOT assume skills exist based on examples in these
|
|
358
|
+
instructions.
|
|
359
|
+
- **Empty or missing "Available Skills" = NO execute tasks**: If there
|
|
360
|
+
is no "Available Skills" section, or if it's empty, you CANNOT
|
|
361
|
+
create ANY execute tasks. ALL action verbs must result in "ignore"
|
|
362
|
+
type tasks.
|
|
363
|
+
- **The list is COMPLETE**: The "Available Skills" list is exhaustive.
|
|
364
|
+
There are no hidden or implicit skills.
|
|
365
|
+
- **No matching skill = ignore task**: If an action verb does NOT have
|
|
366
|
+
a matching skill in "Available Skills", you MUST create an "ignore"
|
|
367
|
+
type task
|
|
368
|
+
- **NO assumptions**: There are NO implicit or assumed operations
|
|
369
|
+
- **NO inference**: DO NOT infer follow-up actions based on context
|
|
370
|
+
- **NO related operations**: DO NOT assume operations even if they
|
|
371
|
+
seem logically related to a matched skill
|
|
286
372
|
|
|
287
373
|
**Common verbs that need skills:**
|
|
288
374
|
|
|
@@ -42,6 +42,10 @@ export const executeTool = {
|
|
|
42
42
|
required: ['description', 'command'],
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
+
error: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Error message when execution cannot proceed. Only include this field when returning an empty commands array due to validation failure (e.g., skill not found, missing Steps/Execution sections). Describes what went wrong.',
|
|
48
|
+
},
|
|
45
49
|
},
|
|
46
50
|
required: ['message', 'summary', 'commands'],
|
|
47
51
|
},
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes for categorization and programmatic handling
|
|
3
|
+
*/
|
|
4
|
+
export var ErrorCode;
|
|
5
|
+
(function (ErrorCode) {
|
|
6
|
+
// User errors - display to user, usually recoverable
|
|
7
|
+
ErrorCode["InvalidInput"] = "INVALID_INPUT";
|
|
8
|
+
ErrorCode["MissingConfig"] = "MISSING_CONFIG";
|
|
9
|
+
ErrorCode["SkillNotFound"] = "SKILL_NOT_FOUND";
|
|
10
|
+
// System errors - log + display, may be recoverable
|
|
11
|
+
ErrorCode["FileReadError"] = "FILE_READ_ERROR";
|
|
12
|
+
ErrorCode["FileWriteError"] = "FILE_WRITE_ERROR";
|
|
13
|
+
ErrorCode["NetworkError"] = "NETWORK_ERROR";
|
|
14
|
+
ErrorCode["ApiError"] = "API_ERROR";
|
|
15
|
+
ErrorCode["ParseError"] = "PARSE_ERROR";
|
|
16
|
+
// Fatal errors - must abort
|
|
17
|
+
ErrorCode["CircularReference"] = "CIRCULAR_REFERENCE";
|
|
18
|
+
ErrorCode["InvalidState"] = "INVALID_STATE";
|
|
19
|
+
ErrorCode["ConfigCorruption"] = "CONFIG_CORRUPTION";
|
|
20
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Base error class with cause chain support
|
|
23
|
+
* Provides consistent error structure throughout the application
|
|
24
|
+
*/
|
|
25
|
+
export class AppError extends Error {
|
|
26
|
+
code;
|
|
27
|
+
cause;
|
|
28
|
+
constructor(message, code, cause) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.code = code;
|
|
31
|
+
this.cause = cause;
|
|
32
|
+
this.name = 'AppError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Type guard for AppError
|
|
37
|
+
*/
|
|
38
|
+
export function isAppError(error) {
|
|
39
|
+
return error instanceof AppError;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Helper to wrap unknown errors with context
|
|
43
|
+
*/
|
|
44
|
+
export function wrapError(error, code, message) {
|
|
45
|
+
const cause = error instanceof Error ? error : undefined;
|
|
46
|
+
return new AppError(message, code, cause);
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a successful result
|
|
3
|
+
*/
|
|
4
|
+
export function ok(value) {
|
|
5
|
+
return { ok: true, value };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create a failed result
|
|
9
|
+
*/
|
|
10
|
+
export function err(error) {
|
|
11
|
+
return { ok: false, error };
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Unwrap a result, throwing if it's an error
|
|
15
|
+
*/
|
|
16
|
+
export function unwrap(result) {
|
|
17
|
+
if (result.ok)
|
|
18
|
+
return result.value;
|
|
19
|
+
throw result.error;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Map the value of a successful result
|
|
23
|
+
*/
|
|
24
|
+
export function mapResult(result, fn) {
|
|
25
|
+
if (result.ok)
|
|
26
|
+
return ok(fn(result.value));
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if a result is successful
|
|
31
|
+
*/
|
|
32
|
+
export function isOk(result) {
|
|
33
|
+
return result.ok;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a result is an error
|
|
37
|
+
*/
|
|
38
|
+
export function isErr(result) {
|
|
39
|
+
return !result.ok;
|
|
40
|
+
}
|
package/dist/types/schemas.js
CHANGED
|
@@ -90,6 +90,7 @@ export const CommandResultSchema = z.object({
|
|
|
90
90
|
tasks: z.array(ScheduledTaskSchema),
|
|
91
91
|
answer: z.string().optional(),
|
|
92
92
|
commands: z.array(ExecuteCommandSchema).optional(),
|
|
93
|
+
error: z.string().optional(),
|
|
93
94
|
debug: z.array(ComponentDefinitionSchema).optional(),
|
|
94
95
|
});
|
|
95
96
|
/**
|
package/dist/ui/Component.js
CHANGED
|
@@ -107,8 +107,8 @@ export const ViewComponent = memo(function ViewComponent({ def, }) {
|
|
|
107
107
|
return (_jsx(ScheduleView, { message: message, tasks: tasks, state: state, status: status }));
|
|
108
108
|
}
|
|
109
109
|
case ComponentName.Execute: {
|
|
110
|
-
const {
|
|
111
|
-
return _jsx(ExecuteView, {
|
|
110
|
+
const { state, status } = def;
|
|
111
|
+
return _jsx(ExecuteView, { state: state, status: status });
|
|
112
112
|
}
|
|
113
113
|
case ComponentName.Answer: {
|
|
114
114
|
const { props: { question }, state, status, } = def;
|
package/dist/ui/Config.js
CHANGED
|
@@ -201,11 +201,15 @@ export function Config(props) {
|
|
|
201
201
|
selectedIndex,
|
|
202
202
|
};
|
|
203
203
|
requestHandlers.onCompleted(finalState);
|
|
204
|
+
// Abort configuration
|
|
204
205
|
if (onAborted) {
|
|
206
|
+
// Let Workflow handler complete and add feedback
|
|
205
207
|
onAborted('configuration');
|
|
206
208
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
else {
|
|
210
|
+
// Fallback: complete with abort feedback directly
|
|
211
|
+
lifecycleHandlers.completeActive(createFeedback(FeedbackType.Aborted, 'Configuration cancelled.'));
|
|
212
|
+
}
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
211
215
|
// Handle selection step navigation
|