Skill harness interface and repair retry (#53)
CI / ci (push) Successful in 1m31s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #53.
This commit is contained in:
2026-10-05 07:55:34 -04:00
committed by approver_agent
parent 8adbd2d7c2
commit 55c15b1b3a
3 changed files with 432 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
package harness
import (
"encoding/json"
"errors"
"strings"
"code.cubecraftlabs.com/Maniacs_Mansion/Meal-Quest/internal/ai/llm"
)
// echoSkill is the trivial test skill: it asks the model to repeat a word.
type echoSkill struct{}
type echoInput struct{ Word string }
type echoOutput struct {
Echo string `json:"echo"`
}
var _ Skill[echoInput, echoOutput] = echoSkill{}
func (echoSkill) Name() string { return "echo" }
func (echoSkill) Version() int { return 1 }
func (echoSkill) Render(in echoInput) (Prompt, error) {
if in.Word == "" {
return Prompt{}, errors.New("no word to echo")
}
return Prompt{System: "You repeat words.", User: "Repeat: " + in.Word}, nil
}
func (echoSkill) Schema() llm.JSONSchema {
return llm.JSONSchema{Name: "echo", Schema: json.RawMessage(
`{"type":"object","properties":{"echo":{"type":"string"}},"required":["echo"],"additionalProperties":false}`)}
}
func (echoSkill) Validate(out echoOutput) []string {
if out.Echo == "" {
return []string{"echo must not be empty"}
}
if out.Echo != strings.ToLower(out.Echo) {
return []string{"echo must be lower case"}
}
return nil
}
func (echoSkill) PostProcess(out echoOutput) (echoOutput, error) {
out.Echo = strings.TrimSpace(out.Echo)
return out, nil
}