prompt-language-shell 0.6.8 → 0.7.2
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/index.js +2 -1
- package/dist/services/anthropic.js +21 -2
- package/dist/services/colors.js +30 -0
- package/dist/services/components.js +11 -0
- package/dist/services/configuration.js +23 -5
- package/dist/services/logger.js +64 -0
- package/dist/services/messages.js +2 -2
- package/dist/services/refinement.js +4 -0
- package/dist/services/registry.js +2 -2
- package/dist/services/router.js +2 -4
- package/dist/services/skills.js +1 -2
- package/dist/skills/answer.md +10 -9
- package/dist/skills/{config.md → configure.md} +19 -12
- package/dist/skills/execute.md +91 -53
- package/dist/skills/introspect.md +63 -47
- package/dist/skills/plan.md +426 -339
- package/dist/skills/validate.md +36 -20
- package/dist/tools/{config.tool.js → configure.tool.js} +7 -7
- package/dist/types/types.js +2 -1
- package/dist/ui/Command.js +7 -3
- package/dist/ui/Component.js +3 -0
- package/dist/ui/Config.js +24 -5
- package/dist/ui/Debug.js +8 -0
- package/dist/ui/Introspect.js +3 -2
- package/dist/ui/Label.js +4 -3
- package/dist/ui/Main.js +28 -9
- package/dist/ui/Plan.js +8 -7
- package/dist/ui/Validate.js +2 -2
- package/dist/ui/Workflow.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { existsSync, readFileSync } from 'fs';
|
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { render } from 'ink';
|
|
7
|
+
import { DebugLevel } from './services/configuration.js';
|
|
7
8
|
import { Main } from './ui/Main.js';
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = dirname(__filename);
|
|
@@ -20,7 +21,7 @@ const app = {
|
|
|
20
21
|
version: packageJson.version,
|
|
21
22
|
description: packageJson.description,
|
|
22
23
|
isDev,
|
|
23
|
-
|
|
24
|
+
debug: DebugLevel.None,
|
|
24
25
|
};
|
|
25
26
|
// Get command from command-line arguments
|
|
26
27
|
const args = process.argv.slice(2);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import { getAvailableConfigStructure, getConfiguredKeys, } from './configuration.js';
|
|
3
|
+
import { logPrompt, logResponse } from './logger.js';
|
|
3
4
|
import { formatSkillsForPrompt, loadSkillsWithValidation } from './skills.js';
|
|
4
5
|
import { toolRegistry } from './registry.js';
|
|
5
6
|
/**
|
|
@@ -67,10 +68,10 @@ export class AnthropicService {
|
|
|
67
68
|
systemPrompt += skillsSection;
|
|
68
69
|
}
|
|
69
70
|
// Add config structure for config tool only
|
|
70
|
-
if (toolName === '
|
|
71
|
+
if (toolName === 'configure') {
|
|
71
72
|
const configStructure = getAvailableConfigStructure();
|
|
72
73
|
const configuredKeys = getConfiguredKeys();
|
|
73
|
-
const configSection = '\n
|
|
74
|
+
const configSection = '\n## Available Configuration\n\n' +
|
|
74
75
|
'Config structure (key: description):\n' +
|
|
75
76
|
JSON.stringify(configStructure, null, 2) +
|
|
76
77
|
'\n\nConfigured keys (keys that exist in config file):\n' +
|
|
@@ -85,7 +86,15 @@ export class AnthropicService {
|
|
|
85
86
|
name: 'web_search',
|
|
86
87
|
});
|
|
87
88
|
}
|
|
89
|
+
// Collect debug components
|
|
90
|
+
const debug = [];
|
|
91
|
+
// Log prompt at Verbose level
|
|
92
|
+
const promptDebug = logPrompt(toolName, command, systemPrompt);
|
|
93
|
+
if (promptDebug) {
|
|
94
|
+
debug.push(promptDebug);
|
|
95
|
+
}
|
|
88
96
|
// Call API with tool
|
|
97
|
+
const startTime = Date.now();
|
|
89
98
|
const response = await this.client.messages.create({
|
|
90
99
|
model: this.model,
|
|
91
100
|
max_tokens: 1024,
|
|
@@ -99,6 +108,12 @@ export class AnthropicService {
|
|
|
99
108
|
},
|
|
100
109
|
],
|
|
101
110
|
});
|
|
111
|
+
const duration = Date.now() - startTime;
|
|
112
|
+
// Log response at Verbose level
|
|
113
|
+
const responseDebug = logResponse(toolName, response, duration);
|
|
114
|
+
if (responseDebug) {
|
|
115
|
+
debug.push(responseDebug);
|
|
116
|
+
}
|
|
102
117
|
// Check for truncation
|
|
103
118
|
if (response.stop_reason === 'max_tokens') {
|
|
104
119
|
throw new Error('Response was truncated due to length. Please simplify your request or break it into smaller parts.');
|
|
@@ -113,6 +128,7 @@ export class AnthropicService {
|
|
|
113
128
|
message: '',
|
|
114
129
|
tasks: [],
|
|
115
130
|
answer: cleanAnswerText(textContent.text),
|
|
131
|
+
debug,
|
|
116
132
|
};
|
|
117
133
|
}
|
|
118
134
|
}
|
|
@@ -143,6 +159,7 @@ export class AnthropicService {
|
|
|
143
159
|
message: input.message,
|
|
144
160
|
tasks: [],
|
|
145
161
|
commands: input.commands,
|
|
162
|
+
debug,
|
|
146
163
|
};
|
|
147
164
|
}
|
|
148
165
|
// Handle answer tool response
|
|
@@ -157,6 +174,7 @@ export class AnthropicService {
|
|
|
157
174
|
message: '',
|
|
158
175
|
tasks: [],
|
|
159
176
|
answer: cleanAnswerText(input.answer),
|
|
177
|
+
debug,
|
|
160
178
|
};
|
|
161
179
|
}
|
|
162
180
|
// Handle plan and introspect tool responses
|
|
@@ -175,6 +193,7 @@ export class AnthropicService {
|
|
|
175
193
|
return {
|
|
176
194
|
message: input.message,
|
|
177
195
|
tasks: input.tasks,
|
|
196
|
+
debug,
|
|
178
197
|
};
|
|
179
198
|
}
|
|
180
199
|
}
|
package/dist/services/colors.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FeedbackType, TaskType } from '../types/types.js';
|
|
2
|
+
import { DebugLevel } from './configuration.js';
|
|
2
3
|
/**
|
|
3
4
|
* Base color palette - raw color values with descriptive names.
|
|
4
5
|
* All colors used in the interface are defined here.
|
|
@@ -174,3 +175,32 @@ export function getFeedbackColor(type, isCurrent) {
|
|
|
174
175
|
export function getTextColor(isCurrent) {
|
|
175
176
|
return isCurrent ? Colors.Text.Active : Colors.Text.Inactive;
|
|
176
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Verbose task type labels - two-word descriptions that start with the same
|
|
180
|
+
* keyword as the short version
|
|
181
|
+
*/
|
|
182
|
+
const verboseTaskTypeLabels = {
|
|
183
|
+
[TaskType.Config]: 'configure option',
|
|
184
|
+
[TaskType.Plan]: 'plan tasks',
|
|
185
|
+
[TaskType.Execute]: 'execute command',
|
|
186
|
+
[TaskType.Answer]: 'answer question',
|
|
187
|
+
[TaskType.Introspect]: 'introspect capabilities',
|
|
188
|
+
[TaskType.Report]: 'report results',
|
|
189
|
+
[TaskType.Define]: 'define options',
|
|
190
|
+
[TaskType.Ignore]: 'ignore request',
|
|
191
|
+
[TaskType.Select]: 'select option',
|
|
192
|
+
[TaskType.Discard]: 'discard option',
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Get task type label based on debug level.
|
|
196
|
+
*
|
|
197
|
+
* Returns:
|
|
198
|
+
* - Verbose label (2 words) in verbose mode
|
|
199
|
+
* - Short label (1 word) in info mode or when debug is off
|
|
200
|
+
*/
|
|
201
|
+
export function getTaskTypeLabel(type, debug) {
|
|
202
|
+
if (debug === DebugLevel.Verbose) {
|
|
203
|
+
return verboseTaskTypeLabels[type];
|
|
204
|
+
}
|
|
205
|
+
return type;
|
|
206
|
+
}
|
|
@@ -252,6 +252,17 @@ export function createMessage(text) {
|
|
|
252
252
|
},
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
+
export function createDebugDefinition(title, content, color) {
|
|
256
|
+
return {
|
|
257
|
+
id: randomUUID(),
|
|
258
|
+
name: ComponentName.Debug,
|
|
259
|
+
props: {
|
|
260
|
+
title,
|
|
261
|
+
content,
|
|
262
|
+
color,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
255
266
|
export function createRefinement(text, onAborted) {
|
|
256
267
|
return {
|
|
257
268
|
id: randomUUID(),
|
|
@@ -9,6 +9,13 @@ export var AnthropicModel;
|
|
|
9
9
|
AnthropicModel["Opus"] = "claude-opus-4-1";
|
|
10
10
|
})(AnthropicModel || (AnthropicModel = {}));
|
|
11
11
|
export const SUPPORTED_MODELS = Object.values(AnthropicModel);
|
|
12
|
+
export var DebugLevel;
|
|
13
|
+
(function (DebugLevel) {
|
|
14
|
+
DebugLevel["None"] = "none";
|
|
15
|
+
DebugLevel["Info"] = "info";
|
|
16
|
+
DebugLevel["Verbose"] = "verbose";
|
|
17
|
+
})(DebugLevel || (DebugLevel = {}));
|
|
18
|
+
export const SUPPORTED_DEBUG_LEVELS = Object.values(DebugLevel);
|
|
12
19
|
export var ConfigDefinitionType;
|
|
13
20
|
(function (ConfigDefinitionType) {
|
|
14
21
|
ConfigDefinitionType["RegExp"] = "regexp";
|
|
@@ -62,8 +69,17 @@ function validateConfig(parsed) {
|
|
|
62
69
|
if (config.settings && typeof config.settings === 'object') {
|
|
63
70
|
const settings = config.settings;
|
|
64
71
|
validatedConfig.settings = {};
|
|
65
|
-
if ('debug' in settings
|
|
66
|
-
|
|
72
|
+
if ('debug' in settings) {
|
|
73
|
+
// Handle migration from boolean to enum
|
|
74
|
+
if (typeof settings.debug === 'boolean') {
|
|
75
|
+
validatedConfig.settings.debug = settings.debug
|
|
76
|
+
? DebugLevel.Info
|
|
77
|
+
: DebugLevel.None;
|
|
78
|
+
}
|
|
79
|
+
else if (typeof settings.debug === 'string' &&
|
|
80
|
+
SUPPORTED_DEBUG_LEVELS.includes(settings.debug)) {
|
|
81
|
+
validatedConfig.settings.debug = settings.debug;
|
|
82
|
+
}
|
|
67
83
|
}
|
|
68
84
|
}
|
|
69
85
|
return validatedConfig;
|
|
@@ -139,10 +155,10 @@ export function saveDebugSetting(debug) {
|
|
|
139
155
|
export function loadDebugSetting() {
|
|
140
156
|
try {
|
|
141
157
|
const config = loadConfig();
|
|
142
|
-
return config.settings?.debug ??
|
|
158
|
+
return config.settings?.debug ?? DebugLevel.None;
|
|
143
159
|
}
|
|
144
160
|
catch {
|
|
145
|
-
return
|
|
161
|
+
return DebugLevel.None;
|
|
146
162
|
}
|
|
147
163
|
}
|
|
148
164
|
/**
|
|
@@ -193,8 +209,10 @@ const coreConfigSchema = {
|
|
|
193
209
|
description: 'Anthropic model',
|
|
194
210
|
},
|
|
195
211
|
'settings.debug': {
|
|
196
|
-
type: ConfigDefinitionType.
|
|
212
|
+
type: ConfigDefinitionType.Enum,
|
|
197
213
|
required: false,
|
|
214
|
+
values: SUPPORTED_DEBUG_LEVELS,
|
|
215
|
+
default: DebugLevel.None,
|
|
198
216
|
description: 'Debug mode',
|
|
199
217
|
},
|
|
200
218
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createDebugDefinition } from './components.js';
|
|
2
|
+
import { DebugLevel, loadDebugSetting } from './configuration.js';
|
|
3
|
+
import { Palette } from './colors.js';
|
|
4
|
+
/**
|
|
5
|
+
* Debug logger for the application
|
|
6
|
+
* Logs information based on the current debug level setting
|
|
7
|
+
*/
|
|
8
|
+
let currentDebugLevel = DebugLevel.None;
|
|
9
|
+
/**
|
|
10
|
+
* Initialize the logger with the current debug level from config
|
|
11
|
+
*/
|
|
12
|
+
export function initializeLogger() {
|
|
13
|
+
currentDebugLevel = loadDebugSetting();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Set the debug level (used for testing or runtime changes)
|
|
17
|
+
*/
|
|
18
|
+
export function setDebugLevel(debug) {
|
|
19
|
+
currentDebugLevel = debug;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the current debug level
|
|
23
|
+
*/
|
|
24
|
+
export function getDebugLevel() {
|
|
25
|
+
return currentDebugLevel;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create debug component for system prompts sent to the LLM
|
|
29
|
+
* Only creates at Verbose level
|
|
30
|
+
*/
|
|
31
|
+
export function logPrompt(toolName, command, instructions) {
|
|
32
|
+
if (currentDebugLevel !== DebugLevel.Verbose) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const content = [
|
|
36
|
+
'',
|
|
37
|
+
`Tool: ${toolName}`,
|
|
38
|
+
`Command: ${command}`,
|
|
39
|
+
'',
|
|
40
|
+
instructions,
|
|
41
|
+
].join('\n');
|
|
42
|
+
// Calculate stats for the instructions
|
|
43
|
+
const lines = instructions.split('\n').length;
|
|
44
|
+
const bytes = Buffer.byteLength(instructions, 'utf-8');
|
|
45
|
+
const title = `SYSTEM PROMPT (${String(lines)} lines, ${String(bytes)} bytes)`;
|
|
46
|
+
return createDebugDefinition(title, content, Palette.Gray);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create debug component for LLM responses received
|
|
50
|
+
* Only creates at Verbose level
|
|
51
|
+
*/
|
|
52
|
+
export function logResponse(toolName, response, durationMs) {
|
|
53
|
+
if (currentDebugLevel !== DebugLevel.Verbose) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const content = [
|
|
57
|
+
'',
|
|
58
|
+
`Tool: ${toolName}`,
|
|
59
|
+
'',
|
|
60
|
+
JSON.stringify(response, null, 2),
|
|
61
|
+
].join('\n');
|
|
62
|
+
const title = `LLM RESPONSE (${String(durationMs)} ms)`;
|
|
63
|
+
return createDebugDefinition(title, content, Palette.AshGray);
|
|
64
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadDebugSetting } from './configuration.js';
|
|
1
|
+
import { DebugLevel, loadDebugSetting } from './configuration.js';
|
|
2
2
|
export { formatDuration } from './utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns a natural language confirmation message for plan execution.
|
|
@@ -96,7 +96,7 @@ export const FeedbackMessages = {
|
|
|
96
96
|
*/
|
|
97
97
|
export function formatErrorMessage(error) {
|
|
98
98
|
const rawMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
99
|
-
if (loadDebugSetting()) {
|
|
99
|
+
if (loadDebugSetting() !== DebugLevel.None) {
|
|
100
100
|
return rawMessage;
|
|
101
101
|
}
|
|
102
102
|
// Try to extract message from Anthropic API error format
|
|
@@ -24,6 +24,10 @@ export async function handleRefinement(selectedTasks, service, originalCommand,
|
|
|
24
24
|
const refinedResult = await service.processWithTool(refinedCommand, 'plan');
|
|
25
25
|
// Complete the Refinement component
|
|
26
26
|
handlers.completeActive();
|
|
27
|
+
// Add debug components to timeline if present
|
|
28
|
+
if (refinedResult.debug && refinedResult.debug.length > 0) {
|
|
29
|
+
handlers.addToTimeline(...refinedResult.debug);
|
|
30
|
+
}
|
|
27
31
|
// Route refined tasks to appropriate components
|
|
28
32
|
routeTasksWithConfirm(refinedResult.tasks, refinedResult.message, service, originalCommand, handlers, false // No DEFINE tasks in refined result
|
|
29
33
|
);
|
|
@@ -34,14 +34,14 @@ class ToolRegistry {
|
|
|
34
34
|
export const toolRegistry = new ToolRegistry();
|
|
35
35
|
// Register built-in tools
|
|
36
36
|
import { answerTool } from '../tools/answer.tool.js';
|
|
37
|
-
import {
|
|
37
|
+
import { configureTool } from '../tools/configure.tool.js';
|
|
38
38
|
import { executeTool } from '../tools/execute.tool.js';
|
|
39
39
|
import { introspectTool } from '../tools/introspect.tool.js';
|
|
40
40
|
import { planTool } from '../tools/plan.tool.js';
|
|
41
41
|
import { validateTool } from '../tools/validate.tool.js';
|
|
42
42
|
const tools = {
|
|
43
43
|
answer: answerTool,
|
|
44
|
-
|
|
44
|
+
configure: configureTool,
|
|
45
45
|
execute: executeTool,
|
|
46
46
|
introspect: introspectTool,
|
|
47
47
|
plan: planTool,
|
package/dist/services/router.js
CHANGED
|
@@ -102,7 +102,7 @@ function executeTasksAfterConfirm(tasks, service, userRequest, handlers) {
|
|
|
102
102
|
.map((task) => task.params?.key)
|
|
103
103
|
.filter((key) => key !== undefined);
|
|
104
104
|
handlers.addToQueue(createConfigDefinitionWithKeys(configKeys, (config) => {
|
|
105
|
-
// Save config
|
|
105
|
+
// Save config - Config component will handle completion and feedback
|
|
106
106
|
try {
|
|
107
107
|
// Convert flat dotted keys to nested structure grouped by section
|
|
108
108
|
const configBySection = unflattenConfig(config);
|
|
@@ -110,14 +110,12 @@ function executeTasksAfterConfirm(tasks, service, userRequest, handlers) {
|
|
|
110
110
|
for (const [section, sectionConfig] of Object.entries(configBySection)) {
|
|
111
111
|
saveConfig(section, sectionConfig);
|
|
112
112
|
}
|
|
113
|
-
handlers.completeActive();
|
|
114
|
-
handlers.addToQueue(createFeedback(FeedbackType.Succeeded, 'Configuration updated successfully.'));
|
|
115
113
|
}
|
|
116
114
|
catch (error) {
|
|
117
115
|
const errorMessage = error instanceof Error
|
|
118
116
|
? error.message
|
|
119
117
|
: 'Failed to save configuration';
|
|
120
|
-
|
|
118
|
+
throw new Error(errorMessage);
|
|
121
119
|
}
|
|
122
120
|
}, (operation) => {
|
|
123
121
|
handlers.onAborted(operation);
|
package/dist/services/skills.js
CHANGED
|
@@ -131,7 +131,6 @@ export function formatSkillsForPrompt(skills) {
|
|
|
131
131
|
return '';
|
|
132
132
|
}
|
|
133
133
|
const header = `
|
|
134
|
-
|
|
135
134
|
## Available Skills
|
|
136
135
|
|
|
137
136
|
The following skills define domain-specific workflows. When the user's
|
|
@@ -147,7 +146,7 @@ brackets for additional information. Use commas instead. For example:
|
|
|
147
146
|
- WRONG: "Build project Alpha (the legacy version)"
|
|
148
147
|
|
|
149
148
|
`;
|
|
150
|
-
const skillsContent = skills.join('\n\n');
|
|
149
|
+
const skillsContent = skills.map((s) => s.trim()).join('\n\n');
|
|
151
150
|
return header + skillsContent;
|
|
152
151
|
}
|
|
153
152
|
/**
|
package/dist/skills/answer.md
CHANGED
|
@@ -5,9 +5,9 @@ command-line concierge. Your role is to **answer questions** and provide
|
|
|
5
5
|
up-to-date information when a task with type "answer" has been planned and
|
|
6
6
|
confirmed.
|
|
7
7
|
|
|
8
|
-
**IMPORTANT**: Use web search to find current, accurate information. This
|
|
9
|
-
is designed for quick answers from the terminal without needing to open a
|
|
10
|
-
browser. Always search for the latest data rather than relying solely on
|
|
8
|
+
**IMPORTANT**: Use web search to find current, accurate information. This
|
|
9
|
+
tool is designed for quick answers from the terminal without needing to open a
|
|
10
|
+
web browser. Always search for the latest data rather than relying solely on
|
|
11
11
|
training data.
|
|
12
12
|
|
|
13
13
|
## Execution Flow
|
|
@@ -60,11 +60,11 @@ TypeScript code compiles to JavaScript and runs anywhere JavaScript runs.
|
|
|
60
60
|
|
|
61
61
|
Bad answer (too verbose):
|
|
62
62
|
```
|
|
63
|
-
TypeScript is a strongly typed programming language that builds on
|
|
64
|
-
giving you better tooling at any scale. TypeScript adds
|
|
65
|
-
JavaScript to support a tighter integration with your
|
|
66
|
-
early in development by checking types. TypeScript
|
|
67
|
-
which runs anywhere.
|
|
63
|
+
TypeScript is a strongly typed programming language that builds on
|
|
64
|
+
JavaScript, giving you better tooling at any scale. TypeScript adds
|
|
65
|
+
additional syntax to JavaScript to support a tighter integration with your
|
|
66
|
+
editor. It catches errors early in development by checking types. TypeScript
|
|
67
|
+
code converts to JavaScript which runs anywhere.
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
### Example 2: Technical explanation
|
|
@@ -101,7 +101,8 @@ They enable cleaner, more reusable component logic.
|
|
|
101
101
|
|
|
102
102
|
## Guidelines
|
|
103
103
|
|
|
104
|
-
1. **Be direct**: Answer the question immediately, don't introduce your
|
|
104
|
+
1. **Be direct**: Answer the question immediately, don't introduce your
|
|
105
|
+
answer
|
|
105
106
|
2. **Be accurate**: Provide correct, factual information
|
|
106
107
|
3. **Be concise**: Respect the 4-line, 80-character constraints strictly
|
|
107
108
|
4. **Be helpful**: Focus on what the user needs to know
|
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
## Overview
|
|
2
2
|
|
|
3
|
-
You are the CONFIG tool for "pls" (please), a professional command-line
|
|
4
|
-
Your role is to determine which configuration settings the user
|
|
5
|
-
based on their query.
|
|
3
|
+
You are the CONFIG tool for "pls" (please), a professional command-line
|
|
4
|
+
concierge. Your role is to determine which configuration settings the user
|
|
5
|
+
wants to configure based on their query.
|
|
6
6
|
|
|
7
7
|
## Input
|
|
8
8
|
|
|
9
9
|
You will receive:
|
|
10
|
-
- `configStructure`: Object mapping config keys to descriptions (e.g.,
|
|
11
|
-
|
|
10
|
+
- `configStructure`: Object mapping config keys to descriptions (e.g.,
|
|
11
|
+
{"anthropic.key": "Anthropic API key", "settings.debug": "Debug mode
|
|
12
|
+
(optional)"})
|
|
13
|
+
- `configuredKeys`: Array of keys that exist in the user's config file
|
|
14
|
+
(e.g., ["anthropic.key", "anthropic.model", "settings.debug"])
|
|
12
15
|
- `query`: User's request (e.g., "app", "mode", "anthropic", or empty)
|
|
13
16
|
|
|
14
17
|
## Task
|
|
15
18
|
|
|
16
|
-
Determine which config keys the user wants to configure and return them
|
|
19
|
+
Determine which config keys the user wants to configure and return them
|
|
20
|
+
as tasks.
|
|
17
21
|
|
|
18
22
|
## Mapping Rules
|
|
19
23
|
|
|
20
24
|
### Query: "app" or empty/unclear
|
|
21
25
|
- Return all **required** config keys (those needed for the app to work)
|
|
22
|
-
- Also include any keys marked as "(optional)" that appear in
|
|
23
|
-
|
|
26
|
+
- Also include any keys marked as "(optional)" that appear in
|
|
27
|
+
`configuredKeys` (optional settings that exist in user's config file)
|
|
28
|
+
- Also include any keys marked as "(discovered)" (they exist in user's
|
|
29
|
+
config file but aren't in schema)
|
|
24
30
|
- Required keys: `anthropic.key`, `anthropic.model`
|
|
25
31
|
|
|
26
32
|
### Query: "mode"
|
|
27
33
|
- Return only: `settings.debug`
|
|
28
34
|
|
|
29
35
|
### Query: "anthropic"
|
|
30
|
-
- Return all keys starting with `anthropic.` (usually `anthropic.key` and
|
|
36
|
+
- Return all keys starting with `anthropic.` (usually `anthropic.key` and
|
|
37
|
+
`anthropic.model`)
|
|
31
38
|
|
|
32
39
|
### Other queries
|
|
33
40
|
- Match the query against config key names and descriptions
|
|
@@ -42,14 +49,14 @@ Determine which config keys the user wants to configure and return them as tasks
|
|
|
42
49
|
"tasks": [
|
|
43
50
|
{
|
|
44
51
|
"action": "Anthropic API key",
|
|
45
|
-
"type": "
|
|
52
|
+
"type": "configure",
|
|
46
53
|
"params": {
|
|
47
54
|
"key": "anthropic.key"
|
|
48
55
|
}
|
|
49
56
|
},
|
|
50
57
|
{
|
|
51
58
|
"action": "Model",
|
|
52
|
-
"type": "
|
|
59
|
+
"type": "configure",
|
|
53
60
|
"params": {
|
|
54
61
|
"key": "anthropic.model"
|
|
55
62
|
}
|
|
@@ -62,7 +69,7 @@ Determine which config keys the user wants to configure and return them as tasks
|
|
|
62
69
|
|
|
63
70
|
- Use the exact config keys from `configStructure`
|
|
64
71
|
- Use the descriptions from `configStructure` as the action text
|
|
65
|
-
- Always use type "
|
|
72
|
+
- Always use type "configure"
|
|
66
73
|
- Always include the key in params
|
|
67
74
|
- Keep message concise (≤64 characters)
|
|
68
75
|
- Return at least one task (required keys if unsure)
|