edsger 0.28.2 → 0.28.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.
|
@@ -112,7 +112,8 @@ export async function processHumanMessages(messages, featureId, config, verbose)
|
|
|
112
112
|
channelSessions.set(channelId, result.sessionId);
|
|
113
113
|
}
|
|
114
114
|
// If the agent didn't send a message via tools, send the response text
|
|
115
|
-
|
|
115
|
+
const sentViaTool = result.toolsUsed.has('mcp__edsger-chat__send_chat_message');
|
|
116
|
+
if (result.text && !sentViaTool) {
|
|
116
117
|
await sendAiMessage(channelId, result.text, {
|
|
117
118
|
in_response_to: messages[messages.length - 1].id,
|
|
118
119
|
});
|
|
@@ -218,7 +219,9 @@ export async function processPhaseCompletion(featureId, phase, summary, phaseOut
|
|
|
218
219
|
channelSessions.set(channelId, result.sessionId);
|
|
219
220
|
}
|
|
220
221
|
// If the agent didn't send a message via tools, send the raw response
|
|
221
|
-
|
|
222
|
+
const sentMessage = result.toolsUsed.has('mcp__edsger-chat__send_chat_message');
|
|
223
|
+
const sentOptions = result.toolsUsed.has('mcp__edsger-chat__provide_options');
|
|
224
|
+
if (result.text && !sentMessage && !sentOptions) {
|
|
222
225
|
await sendAiMessage(channelId, result.text, {
|
|
223
226
|
phase_completion_suggestion: true,
|
|
224
227
|
phase,
|
|
@@ -297,13 +300,6 @@ async function runChatAgent(systemPrompt, userPrompt, config, resumeSessionId, v
|
|
|
297
300
|
}
|
|
298
301
|
}
|
|
299
302
|
}
|
|
300
|
-
// Annotate response with tool usage for the caller
|
|
301
|
-
if (toolUsed.size > 0) {
|
|
302
|
-
const annotations = Array.from(toolUsed)
|
|
303
|
-
.map((t) => `[tool_used:${t}]`)
|
|
304
|
-
.join('');
|
|
305
|
-
lastAssistantResponse += annotations;
|
|
306
|
-
}
|
|
307
303
|
return {
|
|
308
304
|
text: lastAssistantResponse.trim(),
|
|
309
305
|
sessionId,
|
|
@@ -5,8 +5,13 @@
|
|
|
5
5
|
* 1. CHAT_RESPONSE_PROMPT — responding to human messages
|
|
6
6
|
* 2. NEXT_STEP_ADVISOR_PROMPT — proactive suggestions after phase completion
|
|
7
7
|
*/
|
|
8
|
-
export declare const CHAT_RESPONSE_PROMPT = "You are an AI assistant embedded in Edsger, a software development platform. You are helping a team develop a feature.\n\n## Your Capabilities\nYou can see the feature's current state, user stories, test cases, workflow phases, and code. You have tools to:\n- Modify feature status, execution mode, and workflow phases\n- Create/update user stories and test cases\n- Read and search source code files\n- Send follow-up messages and present options to the user\n- Trigger phase reruns\n\n## How to Respond\n1. **Understand the intent** \u2014 Is this feedback, a question, a request to change something, or just a comment?\n2. **Take action if needed** \u2014 Use the appropriate tools to make changes\n3. **Respond concisely** \u2014 Summarize what you understood and what you did (or why you didn't do anything)\n4. **Ask for clarification** \u2014 If the message is ambiguous, use provide_options to present choices\n\n## Communication Style\n- Respond in the same language the user writes in\n- Be concise but thorough \u2014 no filler text\n- Reference specific items by name (e.g., \"User Story #3: Login flow\")\n- When making changes, always explain what you changed and why\n\n## Important Rules\n- Never make destructive changes without confirmation (deleting stories, resetting phases)\n- For ambiguous feedback, present options rather than guessing\n- If you can't do something, explain why clearly\n";
|
|
9
|
-
export declare const NEXT_STEP_ADVISOR_PROMPT = "You are an AI advisor in Edsger, a software development platform. A workflow phase just completed for a feature you're helping develop.\n\n## Your Job\nAnalyze the completed phase output and the feature's current state, then give a concrete, data-backed suggestion for what to do next.\n\n## Critical Rules\n1. **Reference specific data** \u2014 \"8 user stories generated, 3 involve complex auth logic\" not \"several stories were created\"\n2. **Explain your reasoning** \u2014 \"Because Story #3 involves concurrent editing, I suggest writing test cases first to define edge cases before implementation\"\n3. **Present actionable options** \u2014 Always use the provide_options tool to give 2-4 choices the user can click\n4. **Do NOT follow a fixed phase order** \u2014 Adapt based on:\n - Feature size and complexity\n - What was just produced (quality, coverage, gaps)\n - Previous human feedback in the chat\n - Whether certain phases can be skipped for simple features\n5. **Flag issues proactively** \u2014 If the phase output has gaps, incomplete coverage, or potential problems, call them out\n\n## Context You Receive\n- Feature description, size, and current state\n- The completed phase name and its full output\n- Remaining workflow phases\n- User story and test case counts\n- Code change scope (if applicable)\n- Recent chat history (human feedback)\n\n## Communication Style\n- Respond in the same language as recent chat messages (default to the feature's language context)\n- Be specific and data-driven\n- Structure: brief summary \u2192 reasoning \u2192 options\n";
|
|
8
|
+
export declare const CHAT_RESPONSE_PROMPT = "You are an AI assistant embedded in Edsger, a software development platform. You are helping a team develop a feature.\n\n## Your Capabilities\nYou can see the feature's current state, user stories, test cases, workflow phases, and code. You have tools to:\n- Modify feature status, execution mode, and workflow phases\n- Create/update user stories and test cases\n- Read and search source code files\n- Send follow-up messages and present options to the user\n- Trigger phase reruns\n\n## How to Respond\n1. **Understand the intent** \u2014 Is this feedback, a question, a request to change something, or just a comment?\n2. **Take action if needed** \u2014 Use the appropriate tools to make changes\n3. **Respond concisely** \u2014 Summarize what you understood and what you did (or why you didn't do anything)\n4. **Ask for clarification** \u2014 If the message is ambiguous, use provide_options to present choices\n\n## Communication Style\n- Respond in the same language the user writes in\n- Be concise but thorough \u2014 no filler text\n- Reference specific items by name (e.g., \"User Story #3: Login flow\")\n- When making changes, always explain what you changed and why\n\n## Phase Reference (know what each phase does before suggesting it)\n- **code-implementation**: Writes/updates production code (creates or modifies code)\n- **pr-execution**: Syncs already-written code from dev branch to split PR branches (does NOT write new code)\n- **bug-fixing**: Fixes code bugs and test failures\n- To fix bugs or update code \u2192 suggest **code-implementation** or **bug-fixing**, NOT pr-execution\n\n## Important Rules\n- Never make destructive changes without confirmation (deleting stories, resetting phases)\n- For ambiguous feedback, present options rather than guessing\n- If you can't do something, explain why clearly\n";
|
|
9
|
+
export declare const NEXT_STEP_ADVISOR_PROMPT = "You are an AI advisor in Edsger, a software development platform. A workflow phase just completed for a feature you're helping develop.\n\n## Your Job\nAnalyze the completed phase output and the feature's current state, then give a concrete, data-backed suggestion for what to do next.\n\n## Critical Rules\n1. **Reference specific data** \u2014 \"8 user stories generated, 3 involve complex auth logic\" not \"several stories were created\"\n2. **Explain your reasoning** \u2014 \"Because Story #3 involves concurrent editing, I suggest writing test cases first to define edge cases before implementation\"\n3. **Present actionable options** \u2014 Always use the provide_options tool to give 2-4 choices the user can click\n4. **Do NOT follow a fixed phase order** \u2014 Adapt based on:\n - Feature size and complexity\n - What was just produced (quality, coverage, gaps)\n - Previous human feedback in the chat\n - Whether certain phases can be skipped for simple features\n5. **Flag issues proactively** \u2014 If the phase output has gaps, incomplete coverage, or potential problems, call them out\n\n## Phase Reference (know what each phase does before suggesting it)\n- **code-implementation**: Writes/updates production code (the phase that creates or modifies code)\n- **pr-splitting**: Plans how to split code changes into reviewable PRs\n- **pr-execution**: Syncs already-written code from the dev branch to split PR branches (does NOT write new code)\n- **code-testing**: Writes automated tests for implemented code\n- **functional-testing**: Runs end-to-end tests with Playwright\n- **bug-fixing**: Fixes code bugs and test failures\n- **code-review**: Reviews PR code for issues\n- **code-refine**: Updates code based on PR review feedback\n\n**Important distinctions:**\n- To fix bugs or update code \u2192 use **code-implementation** or **bug-fixing**, NOT pr-execution\n- pr-execution only moves existing code to PR branches \u2014 it never creates or modifies implementation code\n\n## Context You Receive\n- Feature description, size, and current state\n- The completed phase name and its full output\n- Remaining workflow phases (with descriptions)\n- User story and test case counts\n- Code change scope (if applicable)\n- Recent chat history (human feedback)\n\n## Communication Style\n- Respond in the same language as recent chat messages (default to the feature's language context)\n- Be specific and data-driven\n- Structure: brief summary \u2192 reasoning \u2192 options\n";
|
|
10
|
+
/**
|
|
11
|
+
* Phase descriptions so the AI advisor understands what each phase does.
|
|
12
|
+
* This prevents misinterpretation (e.g., thinking pr-execution writes code).
|
|
13
|
+
*/
|
|
14
|
+
export declare const PHASE_DESCRIPTIONS: Record<string, string>;
|
|
10
15
|
/**
|
|
11
16
|
* Build the user message for the next-step advisor based on phase completion context.
|
|
12
17
|
*/
|
|
@@ -27,6 +27,12 @@ You can see the feature's current state, user stories, test cases, workflow phas
|
|
|
27
27
|
- Reference specific items by name (e.g., "User Story #3: Login flow")
|
|
28
28
|
- When making changes, always explain what you changed and why
|
|
29
29
|
|
|
30
|
+
## Phase Reference (know what each phase does before suggesting it)
|
|
31
|
+
- **code-implementation**: Writes/updates production code (creates or modifies code)
|
|
32
|
+
- **pr-execution**: Syncs already-written code from dev branch to split PR branches (does NOT write new code)
|
|
33
|
+
- **bug-fixing**: Fixes code bugs and test failures
|
|
34
|
+
- To fix bugs or update code → suggest **code-implementation** or **bug-fixing**, NOT pr-execution
|
|
35
|
+
|
|
30
36
|
## Important Rules
|
|
31
37
|
- Never make destructive changes without confirmation (deleting stories, resetting phases)
|
|
32
38
|
- For ambiguous feedback, present options rather than guessing
|
|
@@ -48,10 +54,24 @@ Analyze the completed phase output and the feature's current state, then give a
|
|
|
48
54
|
- Whether certain phases can be skipped for simple features
|
|
49
55
|
5. **Flag issues proactively** — If the phase output has gaps, incomplete coverage, or potential problems, call them out
|
|
50
56
|
|
|
57
|
+
## Phase Reference (know what each phase does before suggesting it)
|
|
58
|
+
- **code-implementation**: Writes/updates production code (the phase that creates or modifies code)
|
|
59
|
+
- **pr-splitting**: Plans how to split code changes into reviewable PRs
|
|
60
|
+
- **pr-execution**: Syncs already-written code from the dev branch to split PR branches (does NOT write new code)
|
|
61
|
+
- **code-testing**: Writes automated tests for implemented code
|
|
62
|
+
- **functional-testing**: Runs end-to-end tests with Playwright
|
|
63
|
+
- **bug-fixing**: Fixes code bugs and test failures
|
|
64
|
+
- **code-review**: Reviews PR code for issues
|
|
65
|
+
- **code-refine**: Updates code based on PR review feedback
|
|
66
|
+
|
|
67
|
+
**Important distinctions:**
|
|
68
|
+
- To fix bugs or update code → use **code-implementation** or **bug-fixing**, NOT pr-execution
|
|
69
|
+
- pr-execution only moves existing code to PR branches — it never creates or modifies implementation code
|
|
70
|
+
|
|
51
71
|
## Context You Receive
|
|
52
72
|
- Feature description, size, and current state
|
|
53
73
|
- The completed phase name and its full output
|
|
54
|
-
- Remaining workflow phases
|
|
74
|
+
- Remaining workflow phases (with descriptions)
|
|
55
75
|
- User story and test case counts
|
|
56
76
|
- Code change scope (if applicable)
|
|
57
77
|
- Recent chat history (human feedback)
|
|
@@ -61,6 +81,30 @@ Analyze the completed phase output and the feature's current state, then give a
|
|
|
61
81
|
- Be specific and data-driven
|
|
62
82
|
- Structure: brief summary → reasoning → options
|
|
63
83
|
`;
|
|
84
|
+
/**
|
|
85
|
+
* Phase descriptions so the AI advisor understands what each phase does.
|
|
86
|
+
* This prevents misinterpretation (e.g., thinking pr-execution writes code).
|
|
87
|
+
*/
|
|
88
|
+
export const PHASE_DESCRIPTIONS = {
|
|
89
|
+
'feature-analysis': 'Analyze a feature and generate user stories and test cases',
|
|
90
|
+
'user-stories-analysis': 'Write detailed, professional user stories for the feature',
|
|
91
|
+
'test-cases-analysis': 'Generate comprehensive test cases from user stories',
|
|
92
|
+
'feature-analysis-verification': 'Verify generated user stories and test cases against checklist requirements',
|
|
93
|
+
'technical-design': 'Create detailed technical design and architecture documentation',
|
|
94
|
+
'technical-design-verification': 'Verify technical design satisfies checklist requirements',
|
|
95
|
+
'branch-planning': 'Split implementation into multiple logical branches for incremental delivery',
|
|
96
|
+
'code-implementation': 'Write production-ready code to implement the feature (the phase that actually writes/updates code)',
|
|
97
|
+
'code-implementation-verification': 'Review code implementation against checklist requirements',
|
|
98
|
+
'pr-splitting': 'Analyze code changes and plan how to split them into reviewable PRs',
|
|
99
|
+
'pr-execution': 'Sync code from the dev branch to split PR branches (does NOT write new code — only moves existing changes to PR branches)',
|
|
100
|
+
'code-testing': 'Write automated tests (unit, integration) for the implemented code',
|
|
101
|
+
'functional-testing': 'Run end-to-end functional tests with headless Playwright',
|
|
102
|
+
'code-review': 'Review pull request code for issues, bugs, and quality concerns',
|
|
103
|
+
'code-refine': 'Refine code based on PR review feedback',
|
|
104
|
+
'code-refine-verification': 'Verify refined code addresses all review comments',
|
|
105
|
+
'bug-fixing': 'Analyze test failures and fix underlying code issues',
|
|
106
|
+
autonomous: 'Discover and implement improvements in a time-limited loop',
|
|
107
|
+
};
|
|
64
108
|
/**
|
|
65
109
|
* Build the user message for the next-step advisor based on phase completion context.
|
|
66
110
|
*/
|
|
@@ -75,7 +119,10 @@ export function buildNextStepAdvisorMessage(context) {
|
|
|
75
119
|
`## Current State`,
|
|
76
120
|
`- User stories: ${context.userStoriesCount}`,
|
|
77
121
|
`- Test cases: ${context.testCasesCount}`,
|
|
78
|
-
`- Remaining phases
|
|
122
|
+
`- Remaining phases:`,
|
|
123
|
+
...(context.remainingPhases.length > 0
|
|
124
|
+
? context.remainingPhases.map((p) => ` - ${p}: ${PHASE_DESCRIPTIONS[p] || 'No description available'}`)
|
|
125
|
+
: [' none']),
|
|
79
126
|
];
|
|
80
127
|
if (context.codeChangesScope) {
|
|
81
128
|
parts.push(`- Code changes: ${context.codeChangesScope.files} files, +${context.codeChangesScope.additions}/-${context.codeChangesScope.deletions} lines`);
|
|
@@ -59,8 +59,11 @@ export function createChatMcpServer() {
|
|
|
59
59
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
60
60
|
};
|
|
61
61
|
}),
|
|
62
|
-
tool('update_user_stories', 'Create, update, or delete user stories based on feedback.', {
|
|
62
|
+
tool('update_user_stories', 'Create, update, or delete user stories based on feedback. Always provide a reason explaining why the change is being made.', {
|
|
63
63
|
feature_id: z.string().describe('Feature ID'),
|
|
64
|
+
reason: z
|
|
65
|
+
.string()
|
|
66
|
+
.describe('Why this change is being made — e.g. user feedback, bug found, requirement changed. Required for audit trail.'),
|
|
64
67
|
actions: z.array(z.object({
|
|
65
68
|
action: z.enum(['create', 'update', 'delete']),
|
|
66
69
|
user_story_id: z
|
|
@@ -98,6 +101,7 @@ export function createChatMcpServer() {
|
|
|
98
101
|
await callMcpEndpoint('user_stories/update_status', {
|
|
99
102
|
user_story_id: action.user_story_id,
|
|
100
103
|
status: action.status || 'draft',
|
|
104
|
+
reason: args.reason,
|
|
101
105
|
});
|
|
102
106
|
results.push({ action: 'update', success: true });
|
|
103
107
|
}
|
|
@@ -117,8 +121,11 @@ export function createChatMcpServer() {
|
|
|
117
121
|
],
|
|
118
122
|
};
|
|
119
123
|
}),
|
|
120
|
-
tool('update_test_cases', 'Create, update, or delete test cases based on feedback.', {
|
|
124
|
+
tool('update_test_cases', 'Create, update, or delete test cases based on feedback. Always provide a reason explaining why the change is being made.', {
|
|
121
125
|
feature_id: z.string().describe('Feature ID'),
|
|
126
|
+
reason: z
|
|
127
|
+
.string()
|
|
128
|
+
.describe('Why this change is being made — e.g. user feedback, bug found, requirement changed. Required for audit trail.'),
|
|
122
129
|
actions: z.array(z.object({
|
|
123
130
|
action: z.enum(['create', 'update', 'delete']),
|
|
124
131
|
test_case_id: z
|
|
@@ -156,6 +163,7 @@ export function createChatMcpServer() {
|
|
|
156
163
|
await callMcpEndpoint('test_cases/update_status', {
|
|
157
164
|
test_case_id: action.test_case_id,
|
|
158
165
|
status: 'draft',
|
|
166
|
+
reason: args.reason,
|
|
159
167
|
});
|
|
160
168
|
results.push({ action: 'update', success: true });
|
|
161
169
|
}
|