test(agent): pin harness resource formatting

This commit is contained in:
Mario Zechner
2026-05-09 19:55:48 +02:00
parent 401017a3e8
commit f13e6a88ab
5 changed files with 69 additions and 43 deletions

View File

@@ -169,7 +169,7 @@ function errorMessage(error: unknown, fallback: string): string {
return error instanceof Error ? error.message : fallback;
}
/** Parse slash-command arguments using simple shell-style single and double quotes. */
/** Parse an argument string using simple shell-style single and double quotes. */
export function parseCommandArgs(argsString: string): string[] {
const args: string[] = [];
let current = "";

View File

@@ -6,7 +6,7 @@ export function formatSkillsForSystemPrompt(skills: Skill[]): string {
const lines = [
"The following skills provide specialized instructions for specific tasks.",
"Use the read tool to load a skill's file when the task matches its description.",
"Read the full skill file when the task matches its description.",
"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>",

View File

@@ -2,9 +2,14 @@ import type { ImageContent, Model, TextContent } from "@earendil-works/pi-ai";
import type { AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from "../index.js";
import type { Session } from "./session/session.js";
/** Model-visible skill loaded from a `SKILL.md` file or provided by an application. */
/**
* Skill loaded from a `SKILL.md` file or provided by an application.
*
* `name`, `description`, and `filePath` 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.
*/
export interface Skill {
/** Skill command name. */
/** Stable skill name used for lookup and model-visible listings. */
name: string;
/** Short model-visible description of when to use the skill. */
description: string;
@@ -16,19 +21,19 @@ export interface Skill {
disableModelInvocation?: boolean;
}
/** Prompt template that can expand slash-command text before a prompt is sent. */
/** Prompt template that can be formatted into a prompt for explicit invocation. */
export interface PromptTemplate {
/** Slash-command name without the leading `/`. */
/** Stable template name used for lookup or application command routing. */
name: string;
/** Optional description for command lists or autocomplete. */
description?: string;
/** Template content. Argument placeholders are expanded by `formatPromptTemplateInvocation`. */
/** Template content. Argument placeholders are formatted by `formatPromptTemplateInvocation`. */
content: string;
}
/** Resources made available to harness prompt expansion and system-prompt callbacks. */
/** Resources made available to explicit invocation methods and system-prompt callbacks. */
export interface AgentHarnessResources {
/** Prompt templates used to expand `/template args` input. */
/** Prompt templates available for explicit invocation. */
promptTemplates?: PromptTemplate[];
/** Skills available to the model and explicit skill invocation. */
skills?: Skill[];