Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Skills: a skill created with Skill enabled off is saved off (and keeps its trigger phrases)

Niko1221e6aa6f317f74
diff --git a/apps/host/server/index.mjs b/apps/host/server/index.mjs
index ede15db88..ef9c80c11 100644
--- a/apps/host/server/index.mjs
+++ b/apps/host/server/index.mjs
@@ -1531,12 +1531,22 @@ async function api(req, res, path, method, url) {
const instructions = String(body.body ?? '').trim();
if (!name) throw new Error('Give the skill a name.');
if (!instructions) throw new Error('Write the instructions the assistant should follow.');
+ // The form's own choices are kept: a skill created with "Skill enabled" off stays off (QA F04), and its trigger phrases are saved with it.
+ const triggers = body.triggers === undefined ? [] : skillEdit({ triggers: body.triggers }).triggers;
const id = writeCreatedSkill(CREATED_SKILLS, { name, description: String(body.description ?? '').trim().slice(0, 400), body: instructions.slice(0, 40000) });
+ const newId = `my-${id}`, off = body.enabled === false;
+ if (off || triggers.length) {
+ const saved = store.get();
+ store.update({
+ ...(off ? { skillPreferences: { ...saved.skillPreferences, [newId]: { enabled: false, onlyIn: null } } } : {}),
+ ...(triggers.length ? { skillEdits: { ...saved.skillEdits, [newId]: { ...saved.skillEdits?.[newId], triggers } } } : {}),
+ });
+ }
const before = new Map(skillState.map(s => [s.id, s]));
- skillState = skills().map(s => before.has(s.id) ? { ...s, enabled: before.get(s.id).enabled, onlyIn: before.get(s.id).onlyIn ?? null, useCount: before.get(s.id).useCount, lastUsedAt: before.get(s.id).lastUsedAt } : { ...s, onlyIn: null, useCount: 0, lastUsedAt: null });
+ skillState = skills().map(s => before.has(s.id) ? { ...s, enabled: before.get(s.id).enabled, onlyIn: before.get(s.id).onlyIn ?? null, useCount: before.get(s.id).useCount, lastUsedAt: before.get(s.id).lastUsedAt } : { ...s, enabled: s.id === newId && off ? false : s.enabled, onlyIn: null, useCount: 0, lastUsedAt: null });
syncAgentSkills();
hub.send('skills', skillState);
- return json(res, 201, { id: `my-${id}`, skills: skillState });
+ return json(res, 201, { id: newId, skills: skillState });
} catch (e) { return error(res, 400, e.message); }
}
const skillDelete = /^\/api\/skills\/([^/]+)$/.exec(path);
diff --git a/apps/host/src/screens/Skills.tsx b/apps/host/src/screens/Skills.tsx
index bd192a5cc..1a4c5be92 100644
--- a/apps/host/src/screens/Skills.tsx
+++ b/apps/host/src/screens/Skills.tsx
@@ -55,7 +55,7 @@ export function SkillsScreen() {
if (!editing)
return;
if (!editing.id) {
- await api.post('/api/skills', { name: editing.name.trim(), description: editing.description.trim(), body: editing.body ?? '' });
+ await api.post('/api/skills', { name: editing.name.trim(), description: editing.description.trim(), body: editing.body ?? '', enabled: editing.enabled, triggers: triggers.split(',').map(t => t.trim()).filter(Boolean) });
await loadSkills();
setEditing(null);
return;
diff --git a/apps/host/tests/split-qa2-skills.test.mjs b/apps/host/tests/split-qa2-skills.test.mjs
new file mode 100644
index 000000000..6681be76e
--- /dev/null
+++ b/apps/host/tests/split-qa2-skills.test.mjs
@@ -0,0 +1,47 @@
+// QA report F04: a skill created with "Skill enabled" off stays off, and it keeps its trigger phrases.
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { spawn } from 'node:child_process';
+import { mkdtemp, rm } from 'node:fs/promises';
+import { createServer } from 'node:net';
+import { tmpdir } from 'node:os';
+import { join, resolve } from 'node:path';
+
+const root = resolve(import.meta.dirname, '..');
+
+async function startHost(home) {
+ const socket = createServer(); await new Promise(r => socket.listen(0, '127.0.0.1', r));
+ const port = socket.address().port; await new Promise(r => socket.close(r));
+ const child = spawn(process.execPath, ['server/index.mjs'], { cwd: root, env: { ...process.env, STRATA_HOME: home, STRATA_MODELS_DIR: join(home, 'models'), STRATA_PORT: String(port), STRATA_REAL_ENGINE: '0', STRATA_WORKSPACE: join(home, 'work') }, stdio: 'ignore', windowsHide: true });
+ const base = `http://127.0.0.1:${port}`;
+ const call = async (path, method = 'GET', body) => {
+ const response = await fetch(base + path, { method, headers: body ? { 'Content-Type': 'application/json' } : undefined, body: body ? JSON.stringify(body) : undefined });
+ return { status: response.status, data: await response.json() };
+ };
+ for (let i = 0; i < 100; i++) { try { if ((await call('/api/skills')).status === 200) break; } catch { /* not up yet */ } await new Promise(r => setTimeout(r, 100)); }
+ const stopped = new Promise(r => child.once('exit', r));
+ return { call, stop: async () => { child.kill(); await stopped; } };
+}
+
+test('a skill created with Skill enabled off is saved off, kept after a restart, and an enabled one stays on', { timeout: 60000 }, async () => {
+ const home = await mkdtemp(join(tmpdir(), 'strata-qa2-skill-'));
+ let host = await startHost(home);
+ try {
+ const off = await host.call('/api/skills', 'POST', { name: 'QA disabled creation check', description: 'a', body: 'Harmless test instructions.', enabled: false, triggers: ['qa check', ' ', 'qa check', 'disabled'] });
+ assert.equal(off.status, 201);
+ const row = off.data.skills.find(s => s.id === off.data.id);
+ assert.equal(row.enabled, false, 'the answer to the save already says off');
+ assert.deepEqual(row.triggers, ['qa check', 'disabled']);
+ const on = await host.call('/api/skills', 'POST', { name: 'QA enabled one', description: '', body: 'More instructions.', enabled: true });
+ assert.equal(on.data.skills.find(s => s.id === on.data.id).enabled, true);
+ const plain = await host.call('/api/skills', 'POST', { name: 'QA no flag', body: 'Older callers send no flag.' });
+ assert.equal(plain.data.skills.find(s => s.id === plain.data.id).enabled, true, 'no flag keeps the old behaviour: on');
+ assert.equal((await host.call('/api/skills', 'POST', { name: 'Bad', body: 'x', triggers: 'not a list' })).status, 400);
+ await host.stop();
+ host = await startHost(home);
+ const again = (await host.call('/api/skills')).data;
+ assert.equal(again.find(s => s.id === off.data.id).enabled, false, 'still off after a restart');
+ assert.deepEqual(again.find(s => s.id === off.data.id).triggers, ['qa check', 'disabled']);
+ assert.equal(again.find(s => s.id === on.data.id).enabled, true);
+ } finally { await host.stop(); await rm(home, { recursive: true, force: true, maxRetries: 3 }).catch(() => {}); }
+});