From ec4c9bfd95c930291d1bd735fe0204249621e769 Mon Sep 17 00:00:00 2001 From: Facetomyself <[GIT_EMAIL]> Date: Fri, 27 Nov 2026 00:01:58 +0800 Subject: [PATCH 01/11] =?UTF-8?q?refactor(settings):=20=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E6=A1=8C=E9=9D=A2=E6=89=A9=E5=B1=95=E8=A1=8C=E5=92=8C=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E8=AF=A6=E6=83=85=E6=A1=86=E6=9E=B6=20/=20extract=20d?= =?UTF-8?q?esktop=20extension=20rows=20and=20skill=20detail=20frame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../renderer/src/redesign/SettingsPane.tsx | 66 +++++-------------- .../src/redesign/SkillSettingsParts.tsx | 66 +++++++++++++++++++ 2 files changed, 84 insertions(+), 48 deletions(-) create mode 100644 apps/desktop/src/renderer/src/redesign/SkillSettingsParts.tsx diff --git a/apps/desktop/src/renderer/src/redesign/SettingsPane.tsx b/apps/desktop/src/renderer/src/redesign/SettingsPane.tsx index eeb84f59..f1b46af2 100644 --- a/apps/desktop/src/renderer/src/redesign/SettingsPane.tsx +++ b/apps/desktop/src/renderer/src/redesign/SettingsPane.tsx @@ -5,7 +5,6 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { Brain, ChevronLeft, - ChevronRight, Cog, Info, Lock, @@ -31,6 +30,7 @@ import { PersonaFace, parseAvatarSpec } from '../components/humation' import { useTheme } from '../theme/ThemeContext' import { readChatFontSize, saveChatFontSize, type ChatFontSize } from '../theme/chatFontSize' import { SettingsFrame } from './SettingsFrame' +import { ExtensionSettingsRow, SkillSettingsDetail } from './SkillSettingsParts' import { ModelSettings } from '../features/settings/ModelSettings' import { clipName, IS_MAC, AvatarStack, Segmented, Toggle } from './shell-common' @@ -224,37 +224,18 @@ function ExtensionsPane({
{labels.logoutFailure}
} - -Deva {chat.bootstrap.version} ·
Deva {chat.bootstrap.version} ·
{text}
+} + +function Refresh({ disabled, refresh }: { disabled: boolean; refresh: () => void }): React.JSX.Element { + const labels = useCopy() + return +} + +function CatalogList({ controller, state, heading, onOpen, trackRow }: { + controller: SkillLibraryController; state: SkillLibraryState; heading: Ref{labels.inactive}
+{labels.inactive}
+{document.instructions}
+ {!document.instructions && {t('extensions.instructionsEmpty')}}
+ {labels.loading}
+]+data-testid="workbench-skill-instructions"[^>]*>[\s\S]+<img src=/)
+ assert.doesNotMatch(view, /<(?:img|script|a|iframe)\b|href="https:\/\//)
+ assert.match(view, /Web chat does not run skills or their tools/)
+ const native = await read('../renderer/src/redesign/SettingsPane.tsx')
+ assert.match(native, /\('models'\)/)
+ assert.match(settings, /chat\.bootstrap\.capabilities\?\.skillLibrary === true/)
+ assert.match(settings, /event\.nativeEvent\.isTrusted\) setSection\('skills'\)/)
+ assert.match(settings, //)
+ assert.match(settings, /lazy\(\(\) => import\('\.\/skill-library'\)\)/)
+ assert.match(settings, /lazy\(\(\) => import\('\.\/text-workbench'\)\)/)
+ assert.match(await read('first-use.tsx'), /await import\('\.\/desktop-settings'\)/)
+})
From 1ae5a9f4d9e4d4ff785b66e1b3f934798baec051 Mon Sep 17 00:00:00 2001
From: Facetomyself <[GIT_EMAIL]>
Date: Fri, 27 Nov 2026 00:27:00 +0800
Subject: [PATCH 07/11] =?UTF-8?q?test(workbench):=20=E9=AA=8C=E8=AF=81?=
=?UTF-8?q?=E8=B7=A8=E7=99=BB=E5=BD=95=E6=8A=80=E8=83=BD=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E4=B8=8E=E5=AE=B9=E5=99=A8=E9=87=8D=E5=BB=BA=20/=20verify=20sk?=
=?UTF-8?q?ill=20updates=20across=20logins=20and=20recreated=20containers?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/ci.yml | 50 +++
.../container-skill-library-probe.mjs | 191 +++++++++
scripts/workbench/container-skill-library.mjs | 181 ++++++++
.../workbench/e2e-skill-library-browser.mjs | 398 ++++++++++++++++++
.../workbench/e2e-skill-library-fixture.mjs | 103 +++++
scripts/workbench/e2e-skill-library.mjs | 124 ++++++
6 files changed, 1047 insertions(+)
create mode 100644 scripts/workbench/container-skill-library-probe.mjs
create mode 100644 scripts/workbench/container-skill-library.mjs
create mode 100644 scripts/workbench/e2e-skill-library-browser.mjs
create mode 100644 scripts/workbench/e2e-skill-library-fixture.mjs
create mode 100644 scripts/workbench/e2e-skill-library.mjs
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 973f1ccd..0063d18b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -143,6 +143,25 @@ jobs:
if-no-files-found: error
retention-days: 14
+ - name: Verify the native skill library and owner preferences in two sandboxed Chrome logins
+ id: skills_ui
+ if: ${{ !cancelled() && steps.host_tests.outcome == 'success' }}
+ timeout-minutes: 5
+ env:
+ DEVA_QA_SKILLS_CAPTURE: '1'
+ run: node scripts/workbench/e2e-skill-library.mjs
+
+ - name: Publish the verified synthetic skill settings and document views
+ if: ${{ !cancelled() && steps.skills_ui.outcome == 'success' }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: workbench-skill-library
+ path: |
+ test-results/skill-library/skills-list.png
+ test-results/skill-library/skill-detail.png
+ if-no-files-found: error
+ retention-days: 14
+
- name: Select the same installed Chrome for UI and worker
run: bash scripts/workbench/ci-select-chromium.sh
@@ -254,6 +273,37 @@ jobs:
timeout-minutes: 6
run: node scripts/workbench/container-terminal-viewer.mjs
+ packaged-skills:
+ name: Native skill preferences in the production amd64 workbench
+ if: ${{ github.event_name == 'pull_request' && github.head_ref == 'feat/web-workbench-skill-library' }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 14
+ steps:
+ - uses: actions/checkout@v5
+ - uses: actions/setup-node@v5
+ with:
+ node-version: 22
+ package-manager-cache: false
+ - name: Build the native Linux amd64 production image
+ timeout-minutes: 8
+ run: |
+ set -eu
+ test "$(uname -m)" = x86_64
+ docker build --platform linux/amd64 --target runtime -t deva-workbench:skills-verify .
+ docker image inspect -f '{{.Os}}/{{.Architecture}} {{.Id}} {{.Size}} bytes' deva-workbench:skills-verify
+ - name: Verify skill management and model isolation inside the packaged host
+ timeout-minutes: 3
+ run: |
+ set -eu
+ test -f "$PWD/apps/headless/test/skill-library-http.test.mjs"
+ docker run --rm --init --network none --read-only --user 1000:1000 --cap-drop ALL --security-opt no-new-privileges:true \
+ --pids-limit 128 --cpus 2 --memory 512m --tmpfs /tmp:rw,nosuid,nodev,noexec,mode=1777,size=96m \
+ --mount "type=bind,src=$PWD/apps/headless/test/skill-library-http.test.mjs,dst=/opt/deva/apps/headless/ci/skill-library-http.test.mjs,readonly" \
+ --entrypoint node deva-workbench:skills-verify --test /opt/deva/apps/headless/ci/skill-library-http.test.mjs
+ - name: Confirm real saved skill preferences across two distinct production containers
+ timeout-minutes: 3
+ run: node scripts/workbench/container-skill-library.mjs
+
sandbox:
name: Private human browser worker
runs-on: ubuntu-latest
diff --git a/scripts/workbench/container-skill-library-probe.mjs b/scripts/workbench/container-skill-library-probe.mjs
new file mode 100644
index 00000000..f3af6f9c
--- /dev/null
+++ b/scripts/workbench/container-skill-library-probe.mjs
@@ -0,0 +1,191 @@
+// Fixed probe evaluated by `docker exec` as the image user; neither read nor served from a host mount.
+async function probe() {
+ let stage = 'probe-input'
+ function check(ok) { if (!ok) throw Error('verification failed') }
+ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b)
+ try {
+ const { createHash, randomBytes } = await import('node:crypto')
+ const { lstat, mkdir, readFile, readdir, realpath, writeFile } = await import('node:fs/promises')
+ const { setTimeout: delay } = await import('node:timers/promises')
+ const { requestControl } = await import('/opt/deva/apps/headless/src/control/socket.mjs')
+ const [phase] = process.argv.slice(1)
+ const first = phase === 'first'
+ check(first || phase === 'second')
+ const chunks = []; let size = 0
+ for await (const bytes of process.stdin) { size += bytes.length; check(size <= 8192); chunks.push(bytes) }
+ const input = JSON.parse(Buffer.concat(chunks).toString())
+ const digest = bytes => createHash('sha256').update(bytes).digest('hex')
+ const revision = value => typeof value === 'string' && /^[a-f0-9]{64}$/u.test(value)
+ const origin = 'http://127.0.0.1:8787', web = '/opt/deva/web'
+ const id = 'proofreading', description = 'Demo document for the installed skill library.'
+ const instructions = 'Demo text: check punctuation in the selected sentence.'
+ const document = '/data/skills/proofreading/SKILL.md', config = '/data/config.json', persona = '/data/personas/general.md'
+ const fixture = `---\nname: ${id}\ndescription: ${description}\n---\n\n${instructions}\n`
+ const numeric = '"nativeQaMarker":-1.2300e+04'
+ const privateFile = async path => {
+ const info = await lstat(path)
+ check(await realpath(path) === path && info.isFile() && info.uid === 1000 && info.nlink === 1 && (info.mode & 0o077) === 0)
+ return readFile(path)
+ }
+ const http = (path, options) => fetch(origin + path, { redirect: 'error', signal: AbortSignal.timeout(5000), ...options })
+ let cookie, csrf
+ async function api(path, { method = 'GET', body, expected = 200, session = cookie } = {}) {
+ const res = await http('/api/v1/' + path, { method,
+ headers: { ...(session ? { cookie: session } : {}), ...(body === undefined ? {} : {
+ origin, 'content-type': 'application/json', ...(csrf ? { 'x-deva-csrf': csrf } : {}) }) },
+ body: body === undefined ? undefined : JSON.stringify(body) })
+ check(res.status === expected && res.headers.get('content-type') === 'application/json; charset=utf-8')
+ return { payload: await res.json(), cookie: res.headers.get('set-cookie')?.split(';', 1)[0] }
+ }
+
+ stage = 'ready-and-isolation'
+ let ready = false
+ const readyBy = performance.now() + 12_000
+ while (!ready && performance.now() < readyBy) {
+ try { const r = await http('/readyz', { signal: AbortSignal.timeout(750) }); ready = r.status === 200 && (await r.json()).status === 'ready' }
+ catch { /* The default CLI may still be opening the volumes and compiled bundle. */ }
+ if (!ready) await delay(125)
+ }
+ check(ready && process.platform === 'linux' && process.arch === 'x64' && process.getuid() === 1000)
+ check((await readFile('/proc/1/cmdline', 'utf8')) === 'node\0/opt/deva/apps/headless/src/cli.mjs\0serve\0')
+ const status = await readFile('/proc/1/status', 'utf8')
+ check(/^Uid:\s+1000\s+1000\s+1000\s+1000$/m.test(status) && /^NoNewPrivs:\s+1$/m.test(status) &&
+ ['Eff', 'Prm', 'Bnd', 'Amb'].every(key => new RegExp(`^Cap${key}:\\s+0+$`, 'm').test(status)))
+ const mounts = (await readFile('/proc/1/mountinfo', 'utf8')).split('\n').map(line => line.split(' '))
+ check([['/', 'ro'], ['/data', 'rw'], ['/keys', 'ro']].every(([mount, mode]) =>
+ mounts.some(v => v[4] === mount && v[5].split(',').includes(mode))) && same(await readdir('/sys/class/net'), ['lo']))
+ const key = await lstat('/keys/master.key')
+ check(key.isFile() && key.uid === 1000 && key.size === 32 && (key.mode & 0o777) === 0o600)
+
+ let initialConfig
+ if (first) {
+ stage = 'native-fixture'
+ initialConfig = JSON.parse(await privateFile(config))
+ check(!Object.hasOwn(initialConfig, 'skills') && !Object.hasOwn(initialConfig, 'nativeQaMarker'))
+ initialConfig.skills = { enabled: { [id]: false }, roles: {} }
+ await mkdir('/data/skills', { mode: 0o700 })
+ await mkdir('/data/skills/proofreading', { mode: 0o700 })
+ await writeFile(document, fixture, { mode: 0o600, flag: 'wx' })
+ await writeFile(config, JSON.stringify(initialConfig).slice(0, -1) + ',' + numeric + '}\n')
+ initialConfig.nativeQaMarker = -12300
+ }
+
+ stage = 'http-owner-session'
+ const password = first ? randomBytes(24).toString('base64url') : input.password
+ check(typeof password === 'string' && /^[A-Za-z0-9_-]{32}$/u.test(password))
+ const state = await api('auth/state')
+ check(state.payload.claimed === !first)
+ if (!first) check(/^deva-workbench-local=[A-Za-z0-9_-]{43}$/u.test(input.cookie))
+ const stale = await api('skills', { session: first ? undefined : input.cookie, expected: 401 })
+ check(stale.payload.error === 'auth')
+ const auth = first
+ ? await api('auth/claim', { method: 'POST', body: { password, credential: (await requestControl({ runDir: '/run/deva', op: 'claim' })).credential } })
+ : await api('auth/login', { method: 'POST', body: { password } })
+ cookie = auth.cookie; csrf = auth.payload.csrf
+ check(/^deva-workbench-local=[A-Za-z0-9_-]{43}$/u.test(cookie) && cookie !== input.cookie && typeof csrf === 'string' && csrf.length > 0)
+
+ stage = 'catalog-role-and-detail'
+ const noInstructions = payload => {
+ const wire = JSON.stringify(payload)
+ check(!wire.includes(instructions) && !wire.includes('"instructions"') && !wire.includes('/data/') && !wire.includes('nativeQaMarker'))
+ }
+ const boot = (await api('bootstrap')).payload
+ check(boot.capabilities.skillLibrary === true && boot.capabilities.terminalViewer === false &&
+ boot.capabilities.browserPanel === false && boot.capabilities.workspaceFiles === false && !Object.hasOwn(boot, 'skills'))
+ noInstructions(boot)
+ const roster = (await api('skills/-/roles')).payload
+ check(same(roster, { roles: [{ id: 'general', name: 'General', enabled: true }] }))
+ const role = (await api('personas/general')).payload.role
+ check(role.id === 'general' && role.name === 'General' && role.enabled === true && role.protected === true &&
+ role.workspaceId === '' && !Object.hasOwn(role, 'skills') && !Object.hasOwn(role, 'allowedTools') && !JSON.stringify(role).includes(id))
+ const list = async () => {
+ const body = (await api('skills')).payload
+ check(body.execution === 'inactive' && revision(body.revision) && body.skills.every(v => revision(v.revision)))
+ check(body.skills.filter(v => v.source === 'custom').length === 1 && body.skills.some(v => v.source === 'builtin' && !v.canConfigure))
+ noInstructions(body)
+ return body
+ }
+ const selected = async (catalog, enabled, roles) => {
+ const row = catalog.skills.find(v => v.id === id)
+ check(row?.name === id && row.description === description && row.source === 'custom' && row.canConfigure === true &&
+ row.enabled === enabled && same(row.roles, roles))
+ const detail = (await api('skills/' + id)).payload
+ check(detail.execution === 'inactive' && detail.skill.detail === 'document' && detail.skill.instructions === instructions &&
+ same(detail.skill.allowedTools, []) && !JSON.stringify(detail).includes('/data/') &&
+ Object.entries(row).every(([key, value]) => same(detail.skill[key], value)))
+ return detail
+ }
+ const initial = await list()
+ const detail = await selected(initial, !first, first ? null : ['general'])
+
+ let writeRevision
+ if (first) {
+ stage = 'confirmed-preference-patches'
+ const patch = async (before, edit, scope) => {
+ const result = (await api('skills/' + id + '/preferences', { method: 'PATCH', body: { revision: before.revision, ...edit } })).payload
+ check(result.execution === 'inactive' && result.skill.enabled === true && same(result.skill.roles, scope) &&
+ revision(result.skill.revision) && result.skill.revision !== before.revision)
+ noInstructions(result)
+ return result.skill
+ }
+ const enabled = await patch(detail.skill, { enabled: true }, null)
+ writeRevision = (await patch(enabled, { roles: ['general'] }, ['general'])).revision
+ initialConfig.skills = { enabled: { [id]: true }, roles: { [id]: ['general'] } }
+ }
+
+ stage = 'native-bytes-and-fresh-revision'
+ const catalog = await list()
+ const confirmed = await selected(catalog, true, ['general'])
+ if (first) check(catalog.revision !== initial.revision && confirmed.skill.revision === writeRevision)
+ const bytes = await privateFile(config), persisted = JSON.parse(bytes)
+ check(bytes.includes(numeric) && same(persisted.skills, { enabled: { [id]: true }, roles: { [id]: ['general'] } }) &&
+ (!first || same(persisted, initialConfig)))
+ const source = digest(await privateFile(document)), nativeRole = digest(await privateFile(persona))
+ check(source === digest(fixture) && same(await readdir('/data/skills'), [id]) && same(await readdir('/data/skills/proofreading'), ['SKILL.md']))
+ const stable = row => { const { revision: _, ...rest } = row; return rest }
+ const evidence = { config: digest(bytes), source, nativeRole, skills: catalog.skills.map(stable), detail: stable(confirmed.skill), roster }
+ if (!first) {
+ check(same(evidence, input.evidence))
+ const cursor = (await api('skills/-/changes', { method: 'POST', body: { after: catalog.revision, waitMs: 0 } })).payload
+ check(cursor.changed === false && cursor.revision === catalog.revision)
+ }
+
+ if (first) {
+ stage = 'packaged-web-entry-assets'
+ async function asset(path, type) {
+ const res = await http('/' + path)
+ check(res.status === 200 && res.headers.get('content-type') === `${type}; charset=utf-8` && res.headers.get('x-content-type-options') === 'nosniff')
+ const served = Buffer.from(await res.arrayBuffer())
+ check(served.length > 0 && served.equals(await readFile(web + '/' + (path || 'index.html'))))
+ return { text: served.toString(), csp: res.headers.get('content-security-policy') }
+ }
+ const page = await asset('', 'text/html')
+ const policy = page.csp?.split('; ')
+ check(/ policy?.includes(v)))
+ const manifest = JSON.parse(await readFile(web + '/manifest.json', 'utf8'))
+ const scripts = [...page.text.matchAll(/