Files
Arvin Xu 7334cca4b9 ♻️ refactor(mecha): assemble the run's skill pool in the shared core (#19667)
* ♻️ refactor(mecha): assemble the run's skill pool in the shared core

`assembleSkillPool(sources, options)` owns the candidate pool
`<available_skills>` is built from and `activateSkill` resolves against:
precedence project > db > agent-skills > builtin on a name collision,
the disabled drop, the share allowlist, and the device-only builtin gate.
`isBuiltinSkillEnabled` moves with it; `src/helpers/skillFilters`
re-exports it with the client's desktop default.

The browser supplies two of the four sources (it scans no project
directory and mounts no agent-document bundles) and, per the alignment
review, stops narrowing the listing in manual skill mode: manual
withholds the discovery tools, it does not hide what exists — the server
semantics.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🐛 fix(mecha): keep unselected skills out of the pool in manual mode

Manual activation mode promises "only user-selected tools and skills are
available to AI", but withholding the two discovery tools does not deliver
it: `activateSkill` ships with the always-on `lobe-skills` tool and
resolves against the skill pool. The shared pool now collapses the
selectable sources to the run's enabled plugin ids in manual mode, so an
unselected skill is neither listed nor activatable. Project and device
skills come from the working directory and can never be picked in the UI,
so the mode does not speak about them and they stay.

This also closes the same hole on the server, which never narrowed at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* 🐛 fix(mecha): keep the builtin skill gate out of the package barrel

`src/helpers/skillFilters` is used by store slices and settings UI. Importing
the gate from the package root pulled the whole agent-runtime graph in behind
it, and a settings test that partially mocks `@lobechat/const` broke on a
manifest it never meant to load. The gate moves to its own leaf module with a
`@lobechat/mecha/builtinSkillGate` subpath export.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 12:11:25 +08:00
..