fix: ship capability packs and starter skills, report the usable model (UF-066, UF-067)
The SDK reads pack manifests and starter skills next to its own module, which in the bundle is service.js, and no build step copied them there: installed builds showed no packs and no starter skills. build-sidecar now copies both folders next to service.js and Tauri bundles them (UF-066). GET /api/agent/status returned the configured model even when it had no key, so the status bar named Claude while chats ran on the local model. It now resolves the model the way the chat route does (UF-067).
This commit is contained in:
@@ -12,14 +12,19 @@ export interface CapabilityPack {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the directory containing capability pack JSON manifests.
|
||||
* Resolves to the source directory containing .json files.
|
||||
* Get the directory containing capability pack JSON manifests: the package's
|
||||
* src/ when running from src/ or dist/, or the `capability-packs` folder that
|
||||
* scripts/build-sidecar.mjs copies next to the bundled service.js.
|
||||
*/
|
||||
export function getCapabilityPacksDir(): string {
|
||||
// When running from compiled output (dist/), go up to package root then into src/
|
||||
const srcDir = path.resolve(__dirname, '..', '..', 'src', 'capability-packs');
|
||||
if (fs.existsSync(srcDir) && fs.readdirSync(srcDir).some(f => f.endsWith('.json'))) {
|
||||
return srcDir;
|
||||
const candidates = [
|
||||
path.resolve(__dirname, '..', '..', 'src', 'capability-packs'),
|
||||
path.join(__dirname, 'capability-packs'),
|
||||
];
|
||||
for (const dir of candidates) {
|
||||
if (fs.existsSync(dir) && fs.readdirSync(dir).some(f => f.endsWith('.json'))) {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
// Fallback: same directory (running directly from source)
|
||||
return __dirname;
|
||||
|
||||
@@ -5,15 +5,19 @@ import { fileURLToPath } from 'node:url';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
/**
|
||||
* Get the directory containing starter skill files.
|
||||
* Resolves to the source directory containing .md files.
|
||||
* Get the directory containing starter skill files: the package's src/ when
|
||||
* running from src/ or dist/, or the `starter-skills` folder that
|
||||
* scripts/build-sidecar.mjs copies next to the bundled service.js.
|
||||
*/
|
||||
export function getStarterSkillsDir(): string {
|
||||
// When running from compiled output (dist/), go up to package root then into src/
|
||||
// When running from source (src/), we're already in the right place
|
||||
const srcDir = path.resolve(__dirname, '..', '..', 'src', 'starter-skills');
|
||||
if (fs.existsSync(srcDir) && fs.readdirSync(srcDir).some(f => f.endsWith('.md'))) {
|
||||
return srcDir;
|
||||
const candidates = [
|
||||
path.resolve(__dirname, '..', '..', 'src', 'starter-skills'),
|
||||
path.join(__dirname, 'starter-skills'),
|
||||
];
|
||||
for (const dir of candidates) {
|
||||
if (fs.existsSync(dir) && fs.readdirSync(dir).some(f => f.endsWith('.md'))) {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
// Fallback: same directory (running directly from source)
|
||||
return __dirname;
|
||||
|
||||
Reference in New Issue
Block a user