mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-24 10:58:37 +00:00
chore(deadcode): remove unused agent-core prompt formatter
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
@@ -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[];
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user