Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import path from 'node:path';
import type { PiRuntimeCommand } from '../../types/pi-runtime-capabilities.js';
/**
* Return the exact explicit --skill directory proven by pinned Pi provenance.
* Pi v0.83 reports explicit local skills as `temporary` for Cindy's staged
* launch snapshots; direct `--skill` paths report `project` on Windows and
* `temporary` on macOS. Both values are accepted because the runtime
* provenance is path-scoped; accepting either independently still lets
* malformed data mark the wrong discovered project skill as loaded.
*/
export function piExplicitSkillRuntimePath(command: PiRuntimeCommand): string | null {
const baseDir = command.sourceInfo.baseDir;
const skillFile = command.sourceInfo.path;
if (
command.source !== 'skill'
|| (command.sourceInfo.scope !== 'temporary' && command.sourceInfo.scope !== 'project')
|| command.sourceInfo.source !== 'local'
|| typeof baseDir !== 'string'
|| typeof skillFile !== 'string'
|| baseDir.includes('\0')
|| skillFile.includes('\0')
|| path.resolve(path.dirname(skillFile)) !== path.resolve(baseDir)
) return null;
if (path.basename(skillFile).toLowerCase() === 'skill.md') return baseDir;
return path.extname(skillFile) === '.md' ? skillFile : null;
}