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:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -63,6 +63,9 @@ scripts/.cache/
|
|||||||
app/src-tauri/resources/node
|
app/src-tauri/resources/node
|
||||||
app/src-tauri/resources/node.exe
|
app/src-tauri/resources/node.exe
|
||||||
app/src-tauri/resources/native/
|
app/src-tauri/resources/native/
|
||||||
|
# Copied from packages/sdk/src by scripts/build-sidecar.mjs
|
||||||
|
app/src-tauri/resources/capability-packs/
|
||||||
|
app/src-tauri/resources/starter-skills/
|
||||||
# D12: the bundled sidecar is generated by scripts/build-sidecar.mjs on every
|
# D12: the bundled sidecar is generated by scripts/build-sidecar.mjs on every
|
||||||
# build path (npm tauri:build*, CI, and the tauri.conf.json beforeBuildCommand
|
# build path (npm tauri:build*, CI, and the tauri.conf.json beforeBuildCommand
|
||||||
# hook). A committed copy goes stale silently — a binary shipping an old server
|
# hook). A committed copy goes stale silently — a binary shipping an old server
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico", "icons/icon.png"],
|
"icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico", "icons/icon.png"],
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"resources": ["resources/*", "resources/native/*", "resources/native/onnxruntime/*", "resources/node_modules/**/*"],
|
"resources": ["resources/*", "resources/capability-packs/*", "resources/starter-skills/*", "resources/native/*", "resources/native/onnxruntime/*", "resources/node_modules/**/*"],
|
||||||
"windows": {
|
"windows": {
|
||||||
"nsis": {
|
"nsis": {
|
||||||
"installerHooks": "nsis/installer.nsi",
|
"installerHooks": "nsis/installer.nsi",
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ Baseline: commit `b20b138` of the main Waggle repository.
|
|||||||
| UF-063 | `/config` and `/preferences` never run `/settings` | Fixed | Agent, commands |
|
| UF-063 | `/config` and `/preferences` never run `/settings` | Fixed | Agent, commands |
|
||||||
| UF-064 | Pins and documents ignore the configured data directory | Fixed | Sidecar |
|
| UF-064 | Pins and documents ignore the configured data directory | Fixed | Sidecar |
|
||||||
| UF-065 | The Windows uninstaller names a "Data & Privacy" settings page that does not exist | Fixed | Desktop, Windows installer |
|
| UF-065 | The Windows uninstaller names a "Data & Privacy" settings page that does not exist | Fixed | Desktop, Windows installer |
|
||||||
|
| UF-066 | Installed builds have no capability packs and no starter skills | Fixed | Sidecar bundle, SDK |
|
||||||
|
| UF-067 | The status bar names a default model that chats cannot use | Fixed | Sidecar, Web UI |
|
||||||
|
|
||||||
## Entries
|
## Entries
|
||||||
|
|
||||||
@@ -655,3 +657,21 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
|
|||||||
- Cause: the copy predates the current Settings layout; the erase action is the "Erase all my data" button on Settings → General.
|
- Cause: the copy predates the current Settings layout; the erase action is the "Erase all my data" button on Settings → General.
|
||||||
- What we did: the message now names Settings > General > Erase all my data.
|
- What we did: the message now names Settings > General > Erase all my data.
|
||||||
- Recommendation: same change in the main project.
|
- Recommendation: same change in the main project.
|
||||||
|
|
||||||
|
### UF-066. Installed builds have no capability packs and no starter skills
|
||||||
|
- Status: Fixed
|
||||||
|
- Found: 2026-11-01
|
||||||
|
- Where: at commit `b20b138`, `packages/sdk/src/capability-packs/index.ts` (`getCapabilityPacksDir`), `packages/sdk/src/starter-skills/index.ts` (`getStarterSkillsDir`), `scripts/build-sidecar.mjs`
|
||||||
|
- Symptom: in the packaged desktop app, Skills Hub → Packs says "No catalog packs found" and no starter skill can be installed; running from source shows five packs and 18 starter skills.
|
||||||
|
- Cause: the SDK reads the pack manifests (`*.json`) and starter skills (`*.md`) from disk next to its own module. esbuild inlines the SDK into `service.js`, so that directory is the resources folder, and no build step copies the files there.
|
||||||
|
- What we did: `build-sidecar.mjs` copies both folders next to `service.js`, the SDK also looks in `<module dir>/capability-packs` and `<module dir>/starter-skills`, and `tauri.conf.json` bundles the two folders.
|
||||||
|
- Recommendation: same change in the main project, or embed the manifests and skills in the bundle as JSON imports.
|
||||||
|
|
||||||
|
### UF-067. The status bar names a default model that chats cannot use
|
||||||
|
- Status: Fixed
|
||||||
|
- Found: 2026-11-01
|
||||||
|
- Where: at commit `b20b138`, `packages/server/src/local/routes/agent.ts` (`GET /api/agent/status`)
|
||||||
|
- Symptom: with no provider key and a local model installed, the status bar says "Default model: Claude Sonnet 4.6" after every restart, while chats answer with the local model.
|
||||||
|
- Cause: the chat route resolves the configured model to a usable one (`resolveUsableModel`), but the status endpoint returns the configured model as is.
|
||||||
|
- What we did: the status endpoint resolves the model the same way, without changing the configured one. A test covers it.
|
||||||
|
- Recommendation: same change in the main project.
|
||||||
|
|||||||
@@ -12,14 +12,19 @@ export interface CapabilityPack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the directory containing capability pack JSON manifests.
|
* Get the directory containing capability pack JSON manifests: the package's
|
||||||
* Resolves to the source directory containing .json files.
|
* 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 {
|
export function getCapabilityPacksDir(): string {
|
||||||
// When running from compiled output (dist/), go up to package root then into src/
|
const candidates = [
|
||||||
const srcDir = path.resolve(__dirname, '..', '..', 'src', 'capability-packs');
|
path.resolve(__dirname, '..', '..', 'src', 'capability-packs'),
|
||||||
if (fs.existsSync(srcDir) && fs.readdirSync(srcDir).some(f => f.endsWith('.json'))) {
|
path.join(__dirname, 'capability-packs'),
|
||||||
return srcDir;
|
];
|
||||||
|
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)
|
// Fallback: same directory (running directly from source)
|
||||||
return __dirname;
|
return __dirname;
|
||||||
|
|||||||
@@ -5,15 +5,19 @@ import { fileURLToPath } from 'node:url';
|
|||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the directory containing starter skill files.
|
* Get the directory containing starter skill files: the package's src/ when
|
||||||
* Resolves to the source directory containing .md files.
|
* 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 {
|
export function getStarterSkillsDir(): string {
|
||||||
// When running from compiled output (dist/), go up to package root then into src/
|
const candidates = [
|
||||||
// When running from source (src/), we're already in the right place
|
path.resolve(__dirname, '..', '..', 'src', 'starter-skills'),
|
||||||
const srcDir = path.resolve(__dirname, '..', '..', 'src', 'starter-skills');
|
path.join(__dirname, 'starter-skills'),
|
||||||
if (fs.existsSync(srcDir) && fs.readdirSync(srcDir).some(f => f.endsWith('.md'))) {
|
];
|
||||||
return srcDir;
|
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)
|
// Fallback: same directory (running directly from source)
|
||||||
return __dirname;
|
return __dirname;
|
||||||
|
|||||||
@@ -32,9 +32,17 @@ export const agentRoutes: FastifyPluginAsync = async (server) => {
|
|||||||
// GET /api/agent/status — agent status including cost stats
|
// GET /api/agent/status — agent status including cost stats
|
||||||
server.get('/api/agent/status', async () => {
|
server.get('/api/agent/status', async () => {
|
||||||
const stats = costTracker.getStats();
|
const stats = costTracker.getStats();
|
||||||
|
// Report the model a chat will run on: chat.ts resolves the configured
|
||||||
|
// model the same way, so without a provider key this is the local model.
|
||||||
|
let model = server.agentState.currentModel;
|
||||||
|
try {
|
||||||
|
model = await resolveUsableModel(server, model);
|
||||||
|
} catch {
|
||||||
|
// Nothing usable yet; show the configured model.
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
running: true,
|
running: true,
|
||||||
model: server.agentState.currentModel,
|
model,
|
||||||
tokensUsed: stats.totalInputTokens + stats.totalOutputTokens,
|
tokensUsed: stats.totalInputTokens + stats.totalOutputTokens,
|
||||||
estimatedCost: stats.estimatedCost,
|
estimatedCost: stats.estimatedCost,
|
||||||
turns: stats.turns,
|
turns: stats.turns,
|
||||||
|
|||||||
@@ -432,6 +432,30 @@ describe('LiteLLM Management API', () => {
|
|||||||
expect(body.model).toBe('ollama/llama3.2:latest');
|
expect(body.model).toBe('ollama/llama3.2:latest');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('GET /api/agent/status reports the model chats will use, not an unusable default (UF-067)', async () => {
|
||||||
|
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||||
|
const url = String(input);
|
||||||
|
if (url.endsWith('/api/tags')) {
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
json: async () => ({ models: [{ name: 'llama3.2:latest', size: 2_000_000_000 }] }),
|
||||||
|
} as Response;
|
||||||
|
}
|
||||||
|
return { ok: false, status: 503 } as Response;
|
||||||
|
});
|
||||||
|
const priorCurrentModel = server.agentState.currentModel;
|
||||||
|
// As after a restart: the configured default has no key and nothing resolved it yet.
|
||||||
|
server.agentState.currentModel = 'claude-sonnet-4-6';
|
||||||
|
try {
|
||||||
|
const res = await injectWithAuth(server, { method: 'GET', url: '/api/agent/status' });
|
||||||
|
expect(res.statusCode).toBe(200);
|
||||||
|
expect(JSON.parse(res.body).model).toBe('ollama/llama3.2:latest');
|
||||||
|
expect(server.agentState.currentModel).toBe('claude-sonnet-4-6');
|
||||||
|
} finally {
|
||||||
|
server.agentState.currentModel = priorCurrentModel;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it('prefers a deterministic credentialed cloud fallback over an unrelated host Ollama model', async () => {
|
it('prefers a deterministic credentialed cloud fallback over an unrelated host Ollama model', async () => {
|
||||||
const runtimePath = path.join(dataDir, 'litellm.runtime.json');
|
const runtimePath = path.join(dataDir, 'litellm.runtime.json');
|
||||||
const priorRuntime = fs.existsSync(runtimePath) ? fs.readFileSync(runtimePath, 'utf-8') : null;
|
const priorRuntime = fs.existsSync(runtimePath) ? fs.readFileSync(runtimePath, 'utf-8') : null;
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ describe('Tauri Production Configuration', () => {
|
|||||||
it('tauri.conf.json bundles resources directory', () => {
|
it('tauri.conf.json bundles resources directory', () => {
|
||||||
const conf = JSON.parse(fs.readFileSync(path.join(TAURI_DIR, 'tauri.conf.json'), 'utf-8'));
|
const conf = JSON.parse(fs.readFileSync(path.join(TAURI_DIR, 'tauri.conf.json'), 'utf-8'));
|
||||||
expect(conf.bundle.resources).toContain('resources/*');
|
expect(conf.bundle.resources).toContain('resources/*');
|
||||||
|
// UF-066: the bundled SDK reads these next to service.js.
|
||||||
|
expect(conf.bundle.resources).toContain('resources/capability-packs/*');
|
||||||
|
expect(conf.bundle.resources).toContain('resources/starter-skills/*');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('tauri.conf.json has correct window settings', () => {
|
it('tauri.conf.json has correct window settings', () => {
|
||||||
@@ -479,6 +482,8 @@ describe('Tauri Production Configuration', () => {
|
|||||||
['package-lock.json', '{"lockfileVersion":3}\n'],
|
['package-lock.json', '{"lockfileVersion":3}\n'],
|
||||||
['package.json', '{"name":"sidecar-tsconfig-fixture","private":true}\n'],
|
['package.json', '{"name":"sidecar-tsconfig-fixture","private":true}\n'],
|
||||||
['packages/marketplace/marketplace.db', 'fixture database'],
|
['packages/marketplace/marketplace.db', 'fixture database'],
|
||||||
|
['packages/sdk/src/capability-packs/research-workflow.json', '{"id":"research-workflow"}\n'],
|
||||||
|
['packages/sdk/src/starter-skills/brainstorm.md', '# Brainstorm\n'],
|
||||||
['packages/server/package.json', '{"name":"@waggle/server"}\n'],
|
['packages/server/package.json', '{"name":"@waggle/server"}\n'],
|
||||||
['packages/server/src/local/service.ts', 'export const fixture = true;\n'],
|
['packages/server/src/local/service.ts', 'export const fixture = true;\n'],
|
||||||
['packages/server/tsconfig.json', '{"extends":"../../tsconfig.base"}\n'],
|
['packages/server/tsconfig.json', '{"extends":"../../tsconfig.base"}\n'],
|
||||||
@@ -566,6 +571,10 @@ describe('Tauri Production Configuration', () => {
|
|||||||
trackedFiles.get('packages/marketplace/marketplace.db')!,
|
trackedFiles.get('packages/marketplace/marketplace.db')!,
|
||||||
);
|
);
|
||||||
expect(fs.readFileSync(marketplaceResourcePath)).toEqual(committedMarketplace);
|
expect(fs.readFileSync(marketplaceResourcePath)).toEqual(committedMarketplace);
|
||||||
|
// UF-066: the SDK reads packs and starter skills next to service.js.
|
||||||
|
const resourcesRoot = path.join(fixtureRoot, 'app', 'src-tauri', 'resources');
|
||||||
|
expect(fs.existsSync(path.join(resourcesRoot, 'capability-packs', 'research-workflow.json'))).toBe(true);
|
||||||
|
expect(fs.existsSync(path.join(resourcesRoot, 'starter-skills', 'brainstorm.md'))).toBe(true);
|
||||||
|
|
||||||
fs.writeFileSync(marketplacePath, 'dirty worktree database');
|
fs.writeFileSync(marketplacePath, 'dirty worktree database');
|
||||||
const dirtyMarketplaceResult = runResult(
|
const dirtyMarketplaceResult = runResult(
|
||||||
|
|||||||
@@ -298,6 +298,20 @@ try {
|
|||||||
fs.rmSync(marketplaceTemp, { force: true });
|
fs.rmSync(marketplaceTemp, { force: true });
|
||||||
}
|
}
|
||||||
console.log('[build-sidecar] Copied canonical marketplace.db');
|
console.log('[build-sidecar] Copied canonical marketplace.db');
|
||||||
|
|
||||||
|
// @waggle/sdk reads its capability packs and starter skills from disk, next
|
||||||
|
// to its own module. In the bundle that module is service.js, so the files
|
||||||
|
// go next to it (getCapabilityPacksDir, getStarterSkillsDir).
|
||||||
|
for (const [name, extension] of [['capability-packs', '.json'], ['starter-skills', '.md']]) {
|
||||||
|
const source = path.join(root, 'packages', 'sdk', 'src', name);
|
||||||
|
const target = path.join(resourcesDir, name);
|
||||||
|
fs.rmSync(target, { recursive: true, force: true });
|
||||||
|
if (!fs.existsSync(source)) continue;
|
||||||
|
fs.mkdirSync(target, { recursive: true });
|
||||||
|
const files = fs.readdirSync(source).filter((file) => file.endsWith(extension));
|
||||||
|
for (const file of files) fs.copyFileSync(path.join(source, file), path.join(target, file));
|
||||||
|
console.log(`[build-sidecar] Copied ${files.length} ${name} files`);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[build-sidecar] Build failed:', err.message);
|
console.error('[build-sidecar] Build failed:', err.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user