daedalus-cli 3.30.3 → 3.30.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.
- package/CHANGELOG.md +7 -0
- package/dist/commands/enhance.d.ts +1 -1
- package/dist/commands/enhance.d.ts.map +1 -1
- package/dist/commands/enhance.js +24 -2
- package/dist/commands/enhance.js.map +1 -1
- package/dist/commands/enhance.test.js +17 -0
- package/dist/commands/enhance.test.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.30.4](https://github.com/bgill55/daedalus/compare/v3.30.3...v3.30.4) (2026-08-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **enhance:** stop the /prompt enhancer from naming non-existent tools (Rule 8) ([#123](https://github.com/bgill55/daedalus/issues/123)) ([f6a96a3](https://github.com/bgill55/daedalus/commit/f6a96a3f872c83e369286b6c4dc12a33292d53e3))
|
|
7
|
+
|
|
1
8
|
## [3.30.3](https://github.com/bgill55/daedalus/compare/v3.30.2...v3.30.3) (2026-08-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Command, CommandContext } from './types.js';
|
|
2
|
-
export declare const ENHANCE_SYSTEM_PROMPT = "You are an expert prompt engineer for AI coding agents. \nExpand the user's raw or casual request into a crisp, high-yield engineering prompt for Daedalus.\nRules for the generated prompt:\n1. Frame the prompt as a direct action command instructing the agent to perform the task and write out its completed report.\n2. Instruct the agent to inspect relevant files and codebase context using tools before writing.\n3. Require the agent to deliver a fully populated report formatted in Markdown with headers, filled-in comparison tables, and bullet points.\n4. NEVER output empty Markdown templates, empty table rows (e.g. \"| Aspect | | |\"), or bracketed placeholders (e.g. \"[dependency]\", \"[what it does]\"). Instead, write clear instructions ordering the agent to analyze the code and populate those sections with actual findings.\n5. Return ONLY the final enhanced prompt text without meta-commentary, introductory remarks, or surrounding quote marks.\n6. If the user's request already contains tool-call markup (e.g. `<tool_call>`, `<function=...>`), code fences, or XML-like tags, DO NOT copy that structured markup into the output. Rephrase the request as a clean natural-language instruction that a coding agent can act on directly. The enhanced prompt must be plain prose/Markdown an agent can execute \u2014 never raw tool-call XML.\n7. PRESERVE THE USER'S INTENT MODE. If the user's request is a proposal, ideation, brainstorm, design, or discussion ask (e.g. \"come up with ideas\", \"propose\", \"what are some options\", \"brainstorm\", \"think about how to\", \"suggest approaches\", \"architecture review\"), the enhanced prompt MUST remain a proposal/analysis ask. Do NOT reframe it as an implement/build command, and do NOT inject execution-scope deliverables such as \"implement the following\", \"deliver a comprehensive Markdown report with sprint breakdowns and file modifications\", \"manageable sprints\", or \"populate all sections with actual implementation plans\". If the user wants implementation, they will say so \u2014 your job is to make the proposal sharper and more specific, not to expand a question into a build order. Conversely, if the request IS a direct implementation task, keep Rule 1-3 as written.";
|
|
2
|
+
export declare const ENHANCE_SYSTEM_PROMPT = "You are an expert prompt engineer for AI coding agents. \nExpand the user's raw or casual request into a crisp, high-yield engineering prompt for Daedalus.\nRules for the generated prompt:\n1. Frame the prompt as a direct action command instructing the agent to perform the task and write out its completed report.\n2. Instruct the agent to inspect relevant files and codebase context using tools before writing.\n3. Require the agent to deliver a fully populated report formatted in Markdown with headers, filled-in comparison tables, and bullet points.\n4. NEVER output empty Markdown templates, empty table rows (e.g. \"| Aspect | | |\"), or bracketed placeholders (e.g. \"[dependency]\", \"[what it does]\"). Instead, write clear instructions ordering the agent to analyze the code and populate those sections with actual findings.\n5. Return ONLY the final enhanced prompt text without meta-commentary, introductory remarks, or surrounding quote marks.\n6. If the user's request already contains tool-call markup (e.g. `<tool_call>`, `<function=...>`), code fences, or XML-like tags, DO NOT copy that structured markup into the output. Rephrase the request as a clean natural-language instruction that a coding agent can act on directly. The enhanced prompt must be plain prose/Markdown an agent can execute \u2014 never raw tool-call XML.\n7. PRESERVE THE USER'S INTENT MODE. If the user's request is a proposal, ideation, brainstorm, design, or discussion ask (e.g. \"come up with ideas\", \"propose\", \"what are some options\", \"brainstorm\", \"think about how to\", \"suggest approaches\", \"architecture review\"), the enhanced prompt MUST remain a proposal/analysis ask. Do NOT reframe it as an implement/build command, and do NOT inject execution-scope deliverables such as \"implement the following\", \"deliver a comprehensive Markdown report with sprint breakdowns and file modifications\", \"manageable sprints\", or \"populate all sections with actual implementation plans\". If the user wants implementation, they will say so \u2014 your job is to make the proposal sharper and more specific, not to expand a question into a build order. Conversely, if the request IS a direct implementation task, keep Rule 1-3 as written.\n8. DO NOT NAME SPECIFIC TOOL FUNCTIONS. The execution agent selects its own tools from whatever is available in its environment \u2014 you cannot know the exact tool names, and naming non-existent ones (e.g. \"using find_symbol and get_definition to locate files\") makes the agent attempt calls that fail. Instead, describe the ACTION in plain language (\"inspect the relevant source files\", \"search the codebase for usages of X\"). Never write \"using <tool_name> to ...\" or \"via <tool_name>\" clauses.";
|
|
3
3
|
export declare function enhancePrompt(rawPrompt: string, ctx: CommandContext): Promise<string>;
|
|
4
4
|
export declare const enhanceCommand: Command;
|
|
5
5
|
//# sourceMappingURL=enhance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhance.d.ts","sourceRoot":"","sources":["../../src/commands/enhance.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"enhance.d.ts","sourceRoot":"","sources":["../../src/commands/enhance.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,qBAAqB,ssFAU4c,CAAC;AAoD/e,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC3F;AAED,eAAO,MAAM,cAAc,EAAE,OAgE5B,CAAC"}
|
package/dist/commands/enhance.js
CHANGED
|
@@ -12,7 +12,8 @@ Rules for the generated prompt:
|
|
|
12
12
|
4. NEVER output empty Markdown templates, empty table rows (e.g. "| Aspect | | |"), or bracketed placeholders (e.g. "[dependency]", "[what it does]"). Instead, write clear instructions ordering the agent to analyze the code and populate those sections with actual findings.
|
|
13
13
|
5. Return ONLY the final enhanced prompt text without meta-commentary, introductory remarks, or surrounding quote marks.
|
|
14
14
|
6. If the user's request already contains tool-call markup (e.g. \`<tool_call>\`, \`<function=...>\`), code fences, or XML-like tags, DO NOT copy that structured markup into the output. Rephrase the request as a clean natural-language instruction that a coding agent can act on directly. The enhanced prompt must be plain prose/Markdown an agent can execute — never raw tool-call XML.
|
|
15
|
-
7. PRESERVE THE USER'S INTENT MODE. If the user's request is a proposal, ideation, brainstorm, design, or discussion ask (e.g. "come up with ideas", "propose", "what are some options", "brainstorm", "think about how to", "suggest approaches", "architecture review"), the enhanced prompt MUST remain a proposal/analysis ask. Do NOT reframe it as an implement/build command, and do NOT inject execution-scope deliverables such as "implement the following", "deliver a comprehensive Markdown report with sprint breakdowns and file modifications", "manageable sprints", or "populate all sections with actual implementation plans". If the user wants implementation, they will say so — your job is to make the proposal sharper and more specific, not to expand a question into a build order. Conversely, if the request IS a direct implementation task, keep Rule 1-3 as written
|
|
15
|
+
7. PRESERVE THE USER'S INTENT MODE. If the user's request is a proposal, ideation, brainstorm, design, or discussion ask (e.g. "come up with ideas", "propose", "what are some options", "brainstorm", "think about how to", "suggest approaches", "architecture review"), the enhanced prompt MUST remain a proposal/analysis ask. Do NOT reframe it as an implement/build command, and do NOT inject execution-scope deliverables such as "implement the following", "deliver a comprehensive Markdown report with sprint breakdowns and file modifications", "manageable sprints", or "populate all sections with actual implementation plans". If the user wants implementation, they will say so — your job is to make the proposal sharper and more specific, not to expand a question into a build order. Conversely, if the request IS a direct implementation task, keep Rule 1-3 as written.
|
|
16
|
+
8. DO NOT NAME SPECIFIC TOOL FUNCTIONS. The execution agent selects its own tools from whatever is available in its environment — you cannot know the exact tool names, and naming non-existent ones (e.g. "using find_symbol and get_definition to locate files") makes the agent attempt calls that fail. Instead, describe the ACTION in plain language ("inspect the relevant source files", "search the codebase for usages of X"). Never write "using <tool_name> to ..." or "via <tool_name>" clauses.`;
|
|
16
17
|
// Intent-mode markers. If the RAW request contains a proposal/brainstorm marker, the
|
|
17
18
|
// enhanced prompt must stay a proposal and must not be expanded into an implementation
|
|
18
19
|
// mandate. Used by stripModeViolation to defend against an enhancer that ignores Rule 7.
|
|
@@ -21,6 +22,27 @@ const PROPOSAL_INTENT_RE = /\b(ideas?|propose|proposal|brainstorm|suggest (appro
|
|
|
21
22
|
// Global flag: a single enhanced prompt can contain several mandate phrases that must all
|
|
22
23
|
// be stripped (e.g. "implement the following" AND "manageable sprints" AND "specific file modifications").
|
|
23
24
|
const IMPLEMENT_MANDATE_RE = /\b(implement (the )?(following|these|in )|manageable sprints?|sprint breakdown|deliver a comprehensive (markdown )?report|file modifications required|specific file modifications|detailed comparison tables showing current (state|vs)|populate all sections with actual (implementation|analysis)|implementation readiness statement|proceed with implementing)\b/gi;
|
|
25
|
+
// Invented-tool references: the enhancer must not name specific tool functions it cannot
|
|
26
|
+
// know exist (Rule 8). It emits clauses like "using find_symbol and get_definition to
|
|
27
|
+
// locate relevant files" — which make the execution agent attempt non-existent tools.
|
|
28
|
+
// Strip the "using X (and Y) to <action>" / "via X" instruction clauses. Build-agnostic:
|
|
29
|
+
// we don't maintain a tool allowlist (it varies by build/MCP); we just remove the
|
|
30
|
+
// imperative tool-name phrasing and let the agent pick its own tools.
|
|
31
|
+
const INVENTED_TOOL_RE = /\b(?:using\s+[\w_]+(?:\s+and\s+[\w_]+)*|via\s+[\w_]+)\b/gi;
|
|
32
|
+
/**
|
|
33
|
+
* Backstop for Rule 8: removes "using <tool> to <action>" / "via <tool>" clauses the
|
|
34
|
+
* enhancer may still emit, so the execution turn is instructed by ACTION ("inspect the
|
|
35
|
+
* relevant source files") rather than by a possibly-fictional tool name it will fail to call.
|
|
36
|
+
*/
|
|
37
|
+
function stripInventedToolRefs(enhanced) {
|
|
38
|
+
if (!INVENTED_TOOL_RE.test(enhanced))
|
|
39
|
+
return enhanced;
|
|
40
|
+
return enhanced
|
|
41
|
+
.replace(INVENTED_TOOL_RE, '') // drop the invented-tool instruction clauses
|
|
42
|
+
.replace(/\s{2,}/g, ' ') // collapse double spaces left behind
|
|
43
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
44
|
+
.trim();
|
|
45
|
+
}
|
|
24
46
|
/**
|
|
25
47
|
* Backstop for Rule 7: if the raw request is a proposal/ideation ask but the enhancer
|
|
26
48
|
* still expanded it into an implement/build mandate (added sprint breakdowns, "implement
|
|
@@ -59,7 +81,7 @@ export async function enhancePrompt(rawPrompt, ctx) {
|
|
|
59
81
|
// markup so the displayed/enhanced prompt is always plain prose an agent
|
|
60
82
|
// can execute (see bug where /enhance returned <tool_call><function=read_file>).
|
|
61
83
|
const stripped = stripToolCallMarkup(res.trim());
|
|
62
|
-
return stripModeViolation(rawPrompt, stripped);
|
|
84
|
+
return stripInventedToolRefs(stripModeViolation(rawPrompt, stripped));
|
|
63
85
|
}
|
|
64
86
|
}
|
|
65
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhance.js","sourceRoot":"","sources":["../../src/commands/enhance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,MAAM,CAAC,MAAM,qBAAqB,GAAG
|
|
1
|
+
{"version":3,"file":"enhance.js","sourceRoot":"","sources":["../../src/commands/enhance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C,CAAC;oBAC1C,IAAI,GAAG,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC;wBAClC,GAAG,CAAC,cAAc,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;oBACpH,CAAC;oBACD,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;wBACrC,MAAM,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;oBACrE,CAAC;oBACD,aAAa,EAAE,CAAC;gBAClB,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;gBACzD,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -54,6 +54,23 @@ describe('enhanceCommand', () => {
|
|
|
54
54
|
const result = await enhancePrompt('add a health check route and verify the build', mockCtx);
|
|
55
55
|
expect(result).toMatch(/implement the following/i);
|
|
56
56
|
});
|
|
57
|
+
it('strips invented tool-name references (e.g. "using find_symbol and get_definition to ...")', async () => {
|
|
58
|
+
// Regression: the enhancer emitted "using find_symbol and get_definition to locate
|
|
59
|
+
// relevant source files" — tool names that don't exist in this Daedalus build. The
|
|
60
|
+
// execution agent would attempt calls that fail. Rule 8 + stripInventedToolRefs
|
|
61
|
+
// remove the "using X and Y to Z" / "via X" clauses so the agent is instructed by
|
|
62
|
+
// ACTION, not by a fictional tool name.
|
|
63
|
+
const mockCallModel = vi.fn().mockResolvedValue('Analyze PromptVault by using find_symbol and get_definition to locate relevant source files. ' +
|
|
64
|
+
'Cross-reference via grep_tool and summarize the findings in a report.');
|
|
65
|
+
const mockCtx = { callModelWithFallback: mockCallModel };
|
|
66
|
+
const result = await enhancePrompt('suggest UI/UX improvements for PromptVault', mockCtx);
|
|
67
|
+
expect(result).not.toMatch(/find_symbol/);
|
|
68
|
+
expect(result).not.toMatch(/get_definition/);
|
|
69
|
+
expect(result).not.toMatch(/grep_tool/);
|
|
70
|
+
expect(result).not.toMatch(/using\s+[\w_]+/i);
|
|
71
|
+
// Action-based phrasing survives.
|
|
72
|
+
expect(result).toMatch(/locate relevant source files/i);
|
|
73
|
+
});
|
|
57
74
|
it('enhanceCommand asks for prompt if empty and handles user response', async () => {
|
|
58
75
|
const askLineMock = vi.fn()
|
|
59
76
|
.mockResolvedValueOnce('review server.ts') // raw prompt input
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhance.test.js","sourceRoot":"","sources":["../../src/commands/enhance.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8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