Enhance custom agent markdown parsing#314335
Draft
DonJayamanne wants to merge 2 commits intomainfrom
Draft
Conversation
Contributor
Screenshot ChangesBase: Changed (5)Errored (18)Fixtures that failed to render — no screenshot was produced.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds front matter parsing for custom agent .agent.md markdown files in the Agent Host, and wires the parsed metadata into the Copilot SDK custom agent configuration.
Changes:
- Introduces
parseCustomAgentMarkdownto extract supported YAML front matter fields (name,description,tools,infer) and the prompt body. - Updates
toSdkCustomAgentsto map parsed front matter intoCustomAgentConfig(includingdisplayName,description,tools,infer) and use the body asprompt. - Adds/updates unit tests covering front matter parsing and converter behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/copilotPluginConverters.test.ts | Updates converter tests to validate .agent.md front matter mapping and fallbacks. |
| src/vs/platform/agentHost/test/node/copilotAgentMarkdownParser.test.ts | Adds a new test suite covering front matter/body extraction and supported fields. |
| src/vs/platform/agentHost/node/copilot/copilotPluginConverters.ts | Wires the markdown parser into toSdkCustomAgents and maps front matter into SDK configs. |
| src/vs/platform/agentHost/node/copilot/copilotAgentMarkdownParser.ts | New parser implementation for custom agent markdown front matter and body extraction. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 3
| const result = await toSdkCustomAgents(agents, fileService); | ||
|
|
||
| assert.deepStrictEqual(result, [{ | ||
| name: 'plain', |
Comment on lines
+81
to
+86
| const parsed = parseCustomAgentMarkdown(content.value.toString()); | ||
| const headerName = parsed.name?.trim() ? parsed.name : undefined; | ||
| configs.push({ | ||
| name: agent.name, | ||
| prompt: content.value.toString(), | ||
| name: headerName ?? agent.name, | ||
| ...(headerName !== undefined ? { displayName: headerName } : {}), | ||
| ...(parsed.description !== undefined ? { description: parsed.description } : {}), |
Comment on lines
+63
to
+69
| test('treats file with only opening delimiter as no front matter', () => { | ||
| // Unclosed delimiter — no closing '---' found; the whole file is treated as body | ||
| const content = ['---', 'This is just content.'].join('\n'); | ||
| const result = parseCustomAgentMarkdown(content); | ||
| assert.strictEqual(result.body, ''); | ||
| assert.strictEqual(result.name, undefined); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement front matter extraction for custom agent markdown files and update the SDK configuration mapping accordingly. Add tests to verify the new parsing functionality.