| 169 | |
| 170 | /** Returns enabled skills the runtime offered the agent beyond those the trial intends. */ |
| 171 | export function unexpectedSkills(events: unknown[], expected: string[]): string[] { |
| 172 | const offered = new Set<string>(); |
| 173 | for (const value of events) { |
| 174 | if (typeof value !== "object" || value === null) continue; |
| 175 | const event = value as Record<string, unknown>; |
| 176 | if (event.type !== "session.skills_loaded") continue; |
| 177 | const skills = (event.data as Record<string, unknown> | undefined)?.skills; |
| 178 | if (!Array.isArray(skills)) continue; |
| 179 | for (const skill of skills) { |
| 180 | if (typeof skill === "object" && skill !== null && (skill as Record<string, unknown>).enabled !== false) { |
| 181 | const name = (skill as Record<string, unknown>).name; |
| 182 | if (typeof name === "string") offered.add(name); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | return [...offered].filter(name => !expected.includes(name)).sort(); |
| 187 | } |