feat(agent): migrate to pi-agent-core harness and restore robust frontmatter parsing

This commit is contained in:
yiling
2026-05-21 13:14:55 +08:00
parent 2e11748beb
commit 94cea7b713
5 changed files with 94 additions and 80 deletions
+3 -11
View File
@@ -4,9 +4,9 @@ import { s3Service } from '@/services/s3/s3'
import AdmZip from 'adm-zip'
import * as crypto from 'crypto'
import { ulid } from 'ulid'
import { parse } from 'yaml'
import { parseFrontmatter } from '@/utils/frontmatter'
interface SkillFrontmatter {
interface SkillFrontmatter extends Record<string, unknown> {
name?: string
description?: string
}
@@ -258,15 +258,7 @@ export class SkillService {
}
private parseSkillMd(content: string): { name: string; description: string } {
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n([\s\S]*))?$/)
let frontmatter: SkillFrontmatter = {}
if (match) {
try {
frontmatter = parse(match[1])
} catch (e) {
console.error('Failed to parse skill frontmatter', e)
}
}
const { frontmatter } = parseFrontmatter<SkillFrontmatter>(content)
const name = frontmatter.name || 'Unnamed Skill'
const description = frontmatter.description || ''