chore(deadcode): remove unused agent-core prompt formatter

This commit is contained in:
Vincent Koc
2026-06-22 06:17:14 +08:00
parent c21dcfc7c2
commit 328a44695f
5 changed files with 2 additions and 57 deletions

View File

@@ -89,10 +89,6 @@
"types": "./dist/harness/skills.d.ts",
"default": "./dist/harness/skills.js"
},
"./harness/system-prompt": {
"types": "./dist/harness/system-prompt.d.ts",
"default": "./dist/harness/system-prompt.js"
},
"./harness/utils/truncate": {
"types": "./dist/harness/utils/truncate.d.ts",
"default": "./dist/harness/utils/truncate.js"

View File

@@ -1,44 +0,0 @@
// Agent Core module implements system prompt behavior.
import type { Skill } from "./types.js";
/** Format model-visible skill metadata for inclusion in the harness system prompt. */
export function formatSkillsForSystemPrompt(skills: Skill[]): string {
// Hidden skills can still be invoked directly by host code, but should not be
// advertised to the model for autonomous selection.
const visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);
if (visibleSkills.length === 0) {
return "";
}
const lines = [
"The following skills provide specialized instructions for specific tasks.",
"Read the full skill file when the task matches its description.",
"If a skill's <version> differs from a previous turn, re-read its SKILL.md before using it.",
"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.",
"",
"<available_skills>",
];
for (const skill of visibleSkills) {
lines.push(" <skill>");
lines.push(` <name>${escapeXml(skill.name)}</name>`);
lines.push(` <description>${escapeXml(skill.description)}</description>`);
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
if (skill.promptVersion) {
lines.push(` <version>${escapeXml(skill.promptVersion)}</version>`);
}
lines.push(" </skill>");
}
lines.push("</available_skills>");
return lines.join("\n");
}
function escapeXml(value: string): string {
return value
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&apos;");
}

View File

@@ -42,8 +42,8 @@ export function toError(error: unknown): Error {
/**
* Skill loaded from a `SKILL.md` file or provided by an application.
*
* `name`, `description`, `filePath`, and optional `promptVersion` are inserted into the system prompt in an XML-formatted block as suggested by agentskills.io.
* Use {@link formatSkillsForSystemPrompt} to generate the spec-compatible system prompt block.
* `name`, `description`, `filePath`, and optional `promptVersion` are available to host-owned prompt builders and
* direct skill invocation.
*/
export interface Skill {
/** Stable skill name used for lookup and model-visible listings. */
@@ -723,11 +723,6 @@ export type AgentHarnessEventResultMap = {
settled: undefined;
};
/** Options for a prompt submitted through AgentHarness. */
export interface AgentHarnessPromptOptions {
images?: ImageContent[];
}
/** Queued messages removed by an abort operation. */
export interface AbortResult {
clearedSteer: AgentMessage[];

View File

@@ -11,7 +11,6 @@ export * from "./harness/env/kill-tree.js";
export * from "./harness/messages.js";
export * from "./harness/prompt-template-arguments.js";
export * from "./harness/skills.js";
export * from "./harness/system-prompt.js";
export * from "./harness/types.js";
export * from "./harness/session/jsonl-storage.js";
export * from "./harness/session/memory-storage.js";

View File

@@ -351,7 +351,6 @@ function buildAgentCoreDistEntries(): Record<string, string> {
"harness/prompt-template-arguments":
"packages/agent-core/src/harness/prompt-template-arguments.ts",
"harness/skills": "packages/agent-core/src/harness/skills.ts",
"harness/system-prompt": "packages/agent-core/src/harness/system-prompt.ts",
"harness/utils/truncate": "packages/agent-core/src/harness/utils/truncate.ts",
};
}