Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(acceptance): install skills from upstream source (#19793)

AmAzing-35198c8ccb6c
diff --git a/.agents/acceptance/PROJECT.md b/.agents/acceptance/PROJECT.md
index eff085ac478..b010c1eeb54 100644
--- a/.agents/acceptance/PROJECT.md
+++ b/.agents/acceptance/PROJECT.md
@@ -9,8 +9,13 @@ Its two siblings:
- [`PROCESS.md`](./PROCESS.md) β€” the run process (plan gate, execution rules,
publishing, teardown).
- `.agents/skills/acceptance/` β€” the portable skill: what a check, evidence,
- report, and round are. In this repository that path is a symlink onto the
- skill's source, `packages/builtin-skills/src/acceptance/`.
+ report, and round are. This is a committed, generated snapshot of
+ [`lobehub/acceptance`](https://github.com/lobehub/acceptance), the only maintenance
+ source. Update it from the repository's current default branch with
+ `bun apps/cli/src/index.ts acceptance update --json`, then review and commit the
+ downloaded files. The JSON records the exact source commit; publishing a tag
+ or release is not required. Do not hand-edit this installed copy.
+ `.claude/skills` shares `.agents/skills`.
Every script referenced below lives under `.agents/acceptance/scripts/`, including
the generic capture toolchain (`report-init.sh`, `cdp-screenshot.sh`,
diff --git a/.agents/scripts/check/pipelines.ts b/.agents/scripts/check/pipelines.ts
index 6b02a72242d..15468c5600b 100644
--- a/.agents/scripts/check/pipelines.ts
+++ b/.agents/scripts/check/pipelines.ts
@@ -10,7 +10,7 @@ export const lobehubPipelines: PipelineEntry[] = [
{
exts: ['.md'],
tools: [
- ['remark', '--silent', '--output', '--'],
+ ['remark', '--silent', '--silently-ignore', '--output', '--'],
['prettier', '--write'],
],
},
diff --git a/.agents/skills/acceptance b/.agents/skills/acceptance
deleted file mode 120000
index 2ef3aff47d8..00000000000
--- a/.agents/skills/acceptance
+++ /dev/null
@@ -1 +0,0 @@
-../../packages/builtin-skills/src/acceptance
\ No newline at end of file
diff --git a/.agents/skills/acceptance/LICENSE b/.agents/skills/acceptance/LICENSE
new file mode 100644
index 00000000000..261eeb9e9f8
--- /dev/null
+++ b/.agents/skills/acceptance/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/builtin-skills/src/acceptance/SKILL.md b/.agents/skills/acceptance/SKILL.md
similarity index 99%
rename from packages/builtin-skills/src/acceptance/SKILL.md
rename to .agents/skills/acceptance/SKILL.md
index 2062ad897bc..99f8f086dfa 100644
--- a/packages/builtin-skills/src/acceptance/SKILL.md
+++ b/.agents/skills/acceptance/SKILL.md
@@ -1,6 +1,8 @@
---
name: acceptance
-version: 0.4.3
+license: Apache-2.0
+metadata:
+ version: "0.5.0"
description: >
End-to-end verification and self-evidence for a delivery in any repository,
with or without a preconfigured verify plan. Discover an existing plan when
@@ -355,7 +357,7 @@ chat reply.
Write the link as a plain-text line, never inside a fenced or inline code block β€” the
chat client only linkifies plain text, and a code block makes it unclickable:
-Acceptance: <https://app.lobehub.com/acceptance/ACCEPTANCE_ID> (the placeholder is the id ingest printed; it stays inside the URL)
+Acceptance: <https://lobehub.com/acceptance/ACCEPTANCE_ID> (the placeholder is the id ingest printed; it stays inside the URL)
Coverage: 2/2 criteria, all required evidence uploaded
## Portability rules
@@ -383,6 +385,7 @@ For both acceptance-checker handoffs and review output, read
| Evidence media, provenance, submission, safety | [evidence.md](references/evidence.md) |
| Interaction cost overlay | [interaction-cost.md](references/interaction-cost.md) |
| Web/Electron Chromium CLI commands | [agent-browser.md](references/agent-browser.md) |
+| Bundled CDP screenshot and macOS capture preflight | [screenshot-helpers.md](references/screenshot-helpers.md) |
| Authenticated Web session | [auth-web.md](references/auth-web.md) |
| Native macOS / OS-owned step | [computer-use.md](references/computer-use.md) |
| Temporal evidence: Web/Electron, iOS, native | [recording-cdp.md](references/recording-cdp.md), [recording-ios-simulator.md](references/recording-ios-simulator.md), [recording-native-macos.md](references/recording-native-macos.md) |
diff --git a/packages/builtin-skills/src/acceptance/references/acceptance-checker.md b/.agents/skills/acceptance/references/acceptance-checker.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/acceptance-checker.md
rename to .agents/skills/acceptance/references/acceptance-checker.md
diff --git a/packages/builtin-skills/src/acceptance/references/agent-browser.md b/.agents/skills/acceptance/references/agent-browser.md
similarity index 94%
rename from packages/builtin-skills/src/acceptance/references/agent-browser.md
rename to .agents/skills/acceptance/references/agent-browser.md
index 721ce8e6eb2..162437f8da2 100644
--- a/packages/builtin-skills/src/acceptance/references/agent-browser.md
+++ b/.agents/skills/acceptance/references/agent-browser.md
@@ -193,8 +193,18 @@ agent-browser --session site2 open https://site-b.com
agent-browser session list
```
-A named `--session` auto-saves and restores cookies + localStorage across
-commands.
+A named `--session` reuses the same running browser and its cookies + localStorage
+across commands. To save and restore that state across browser restarts, also
+enable `--restore` with a stable session ID:
+
+```bash
+agent-browser --session site1 --restore open https://site-a.com
+```
+
+Use the same session ID and `--restore` on later launches. See
+[auth-web.md](auth-web.md) for manual state files and persistent profiles, and the
+[official session persistence guide](https://agent-browser.dev/sessions#session-persistence)
+for restore behavior.
## Connect to an existing browser / app
diff --git a/packages/builtin-skills/src/acceptance/references/auth-web.md b/.agents/skills/acceptance/references/auth-web.md
similarity index 91%
rename from packages/builtin-skills/src/acceptance/references/auth-web.md
rename to .agents/skills/acceptance/references/auth-web.md
index 1c511451b60..31dedfc1a93 100644
--- a/packages/builtin-skills/src/acceptance/references/auth-web.md
+++ b/.agents/skills/acceptance/references/auth-web.md
@@ -19,10 +19,10 @@ domain, and session mechanism before selecting a path.
## Built-in mechanisms
```bash
-# Named session: persists cookies and localStorage.
-agent-browser --session app open https://app.example.com/login
-# Complete login once, then reuse the same session.
-agent-browser --session app open https://app.example.com/dashboard
+# Named session with --restore: saves cookies and localStorage across browser restarts.
+agent-browser --session app --restore open https://app.example.com/login
+# Complete login once, then reuse the same session ID and --restore.
+agent-browser --session app --restore open https://app.example.com/dashboard
# Playwright-style storage state.
agent-browser state save auth.json
diff --git a/packages/builtin-skills/src/acceptance/references/common-mistakes.md b/.agents/skills/acceptance/references/common-mistakes.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/common-mistakes.md
rename to .agents/skills/acceptance/references/common-mistakes.md
diff --git a/packages/builtin-skills/src/acceptance/references/computer-use.md b/.agents/skills/acceptance/references/computer-use.md
similarity index 95%
rename from packages/builtin-skills/src/acceptance/references/computer-use.md
rename to .agents/skills/acceptance/references/computer-use.md
index 6399ad24032..1f51720ed20 100644
--- a/packages/builtin-skills/src/acceptance/references/computer-use.md
+++ b/.agents/skills/acceptance/references/computer-use.md
@@ -113,6 +113,9 @@ pbpaste
## Capturing as evidence
+Before OS capture, run the bundled [screen-recording preflight](screenshot-helpers.md#macos-screen-recording-preflight).
+Resolve its path from the loaded skill, not from the project's scripts directory.
+
- A `screencapture` PNG β†’ `--type screenshot --by cli`.
- For time-based native behavior, OS screen-record to MP4/GIF β€” see
[recording-native-macos.md](./recording-native-macos.md).
diff --git a/packages/builtin-skills/src/acceptance/references/evidence.md b/.agents/skills/acceptance/references/evidence.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/evidence.md
rename to .agents/skills/acceptance/references/evidence.md
diff --git a/packages/builtin-skills/src/acceptance/references/interaction-cost.md b/.agents/skills/acceptance/references/interaction-cost.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/interaction-cost.md
rename to .agents/skills/acceptance/references/interaction-cost.md
diff --git a/packages/builtin-skills/src/acceptance/references/plan-format.md b/.agents/skills/acceptance/references/plan-format.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/plan-format.md
rename to .agents/skills/acceptance/references/plan-format.md
diff --git a/packages/builtin-skills/src/acceptance/references/probe-mock-patterns.md b/.agents/skills/acceptance/references/probe-mock-patterns.md
similarity index 93%
rename from packages/builtin-skills/src/acceptance/references/probe-mock-patterns.md
rename to .agents/skills/acceptance/references/probe-mock-patterns.md
index 3e7cf9a1684..1beb21811c9 100644
--- a/packages/builtin-skills/src/acceptance/references/probe-mock-patterns.md
+++ b/.agents/skills/acceptance/references/probe-mock-patterns.md
@@ -273,23 +273,28 @@ derive(item))`) captures the value at first render. When a persisted cache hydra
(`Resource temporarily unavailable` / `CDP response channel closed`) while
`eval`/`get url` keep working β€” **not** a display-sleep or permission issue. Reset
with `agent-browser close --all`, or skip the daemon entirely (D6).
-- **D6. WORKS β€” raw-CDP screenshot bypasses the daemon.** `scripts/cdp-screenshot.sh [--port <n>] [--out x.png] [--full] [--check]` opens its own ws to the target, does
+- **D6. WORKS β€” raw-CDP screenshot bypasses the daemon.** The bundled
+ `bash "$SKILL_DIR/scripts/cdp-screenshot.sh" [--port <n>] [--out x.png] [--full] [--check]`
+ opens its own WebSocket to the target, does
one `Page.captureScreenshot`, and closes (\~60ms). Immune to the D5 wedge and
**robust when the display is asleep or the window is minimized/occluded** (the
engine forces a compositor frame). Use it for Electron evidence and as a preflight
- (`--check` β†’ exit 0 iff a real, non-black frame was captured).
+ (`--check` β†’ exit 0 iff a real, non-black frame was measured). Resolve `SKILL_DIR`
+ and check platform/runtime requirements in [screenshot-helpers.md](screenshot-helpers.md);
+ a missing brightness probe returns undetermined, never PASS.
- **D7. OS `screencapture` is BLACK when the display is asleep/locked/screensaver.**
- Distinct from D5/D6: `screencapture` (and `capture-app-window.sh`, osascript grabs)
- captures the physical framebuffer, so an idle-slept display β†’ a uniformly black PNG
- (mean/max = 0). Permission can be fine. Gate with `scripts/check-screen-recording.sh`
+ Distinct from D5/D6: `screencapture` captures the physical framebuffer,
+ so an idle-slept display β†’ a uniformly black PNG
+ (mean/max = 0). Permission can be fine. Gate with the bundled
+ `bash "$SKILL_DIR/scripts/check-screen-recording.sh"`
(checks the permission bit + a real-frame blackness probe) and keep the display
awake for the whole run: `caffeinate -dimsu &`. CDP capture (D6) does not have this
problem.
- **D8. The daemon serializes commands β€” `open` queues behind a screenshot loop.**
- While a recording loop (`record-gif.sh`) is running, `agent-browser open <url>`
- lands late/out of order, and your "during navigation" screenshot can show the
+ While a loop repeatedly takes screenshots through the same `agent-browser`
+ session, `agent-browser open <url>` can run late, and your "during navigation" screenshot can show the
PREVIOUS page (which may look identical to the expected end state β€” a false read).
- **Works**: during any recording loop, navigate with
+ **Works**: while that loop is running, navigate with
`agent-browser eval 'location.href="<url>"'` (fire-and-forget) instead of `open`.
- **D9. A mid-session bundler dependency re-optimize can wedge the renderer
compositor.** Symptom: capture returns black, the app root's `innerText` is 0 while
@@ -371,17 +376,19 @@ unquoted vars` β€” stashing `S="--session x --cdp 9226"` then `agent-browser $S`
you must not kill. Terminate the run, report the exact error, and ask the user to
clean up other processes β€” do not change watch mode, fall back to a static build, or
publish a report from a degraded surface.
-- **E7. The default `lobehub-dev` browser session is shared β€” a parallel run can steal your
- tab.** `agent-browser` sessions are keyed by name, not by workspace, so two runs both using
- `--session lobehub-dev` drive the **same** browser. The other run navigates the tab to _its_
+- **E7. A shared browser session name lets a parallel run steal your tab.**
+ `agent-browser` sessions are keyed by name, not by workspace, so two runs using
+ the same `--session <name>` drive the **same** browser. The other run navigates the tab to _its_
dev server, after which your `eval` reads that page while `screenshot` may still show yours β€”
a screenshot that renders your fixture next to a `document.body.innerText` from the same
moment containing none of its strings, every assertion `false`. It reads like a product bug;
it is two runs sharing one browser. **Works**: give every run its own session name, seed auth
- into it, and confirm the tab is yours before asserting β€” `agent-browser --session <name> tab
-list` must print YOUR port and path. Same applies to ports: a worktree allocates its own
- `SERVER_PORT`/`SPA_PORT`, so re-run `test-env.sh` inside the worktree you are testing rather
- than assuming another checkout's ports.
+ into it, and confirm the tab is yours before asserting β€”
+ `agent-browser --session <name> tab list` must print the expected port and path.
+ Ports can also differ between worktrees. Resolve the tested worktree's ports and
+ URLs using the commands or configuration documented in its
+ `.agents/acceptance/PROJECT.md` (see [project-adapter.md](project-adapter.md)),
+ rather than assuming another checkout's ports.
### B5. βœ… WORKS β€” client-service mock state must survive reloads; persisted SWR cache replays old terminal data under the same key
diff --git a/packages/builtin-skills/src/acceptance/references/project-adapter.md b/.agents/skills/acceptance/references/project-adapter.md
similarity index 98%
rename from packages/builtin-skills/src/acceptance/references/project-adapter.md
rename to .agents/skills/acceptance/references/project-adapter.md
index 4f6551a1e54..06e0a0a09f7 100644
--- a/packages/builtin-skills/src/acceptance/references/project-adapter.md
+++ b/.agents/skills/acceptance/references/project-adapter.md
@@ -28,7 +28,7 @@ skill wins.
```
`.agents/acceptance/` is **committed** (the adapter and the project living logs are
-shared, versioned team assets). The report output directory `.records/` is
+shared, versioned team assets). The report output directory `.acceptances/` is
**gitignored** β€” reports are per-run artifacts, published to LobeHub Acceptance,
not committed.
@@ -150,7 +150,7 @@ When `.agents/acceptance/PROJECT.md` is absent, build it before doing anything e
4. **Write it only after approval**, to `.agents/acceptance/PROJECT.md`. Create
`.agents/acceptance/` if it does not exist.
-`lh acceptance install` only places the skill files; it does no repo exploration.
+Installing the skill only places its files; it does no repo exploration.
The adapter draft needs a model, so the first verification run is what bootstraps
`PROJECT.md`.
diff --git a/packages/builtin-skills/src/acceptance/references/recording-cdp.md b/.agents/skills/acceptance/references/recording-cdp.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/recording-cdp.md
rename to .agents/skills/acceptance/references/recording-cdp.md
diff --git a/packages/builtin-skills/src/acceptance/references/recording-ios-simulator.md b/.agents/skills/acceptance/references/recording-ios-simulator.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/references/recording-ios-simulator.md
rename to .agents/skills/acceptance/references/recording-ios-simulator.md
diff --git a/packages/builtin-skills/src/acceptance/references/recording-native-macos.md b/.agents/skills/acceptance/references/recording-native-macos.md
similarity index 83%
rename from packages/builtin-skills/src/acceptance/references/recording-native-macos.md
rename to .agents/skills/acceptance/references/recording-native-macos.md
index 0f4e7642a95..6df63a85670 100644
--- a/packages/builtin-skills/src/acceptance/references/recording-native-macos.md
+++ b/.agents/skills/acceptance/references/recording-native-macos.md
@@ -4,6 +4,10 @@ Use this reference only when the criterion owns a native macOS window or OS
chrome that CDP cannot observe. It requires a local macOS display and is not
cloud-portable.
+Run the bundled [screen-recording preflight](screenshot-helpers.md#macos-screen-recording-preflight)
+before OS capture. Only a granted permission and a measured non-black frame pass;
+missing tools or an unsupported platform do not establish that recording works.
+
## Record the host screen
Prefer a fixed duration so the recorder finalizes without an external kill:
diff --git a/packages/builtin-skills/src/acceptance/references/report.md b/.agents/skills/acceptance/references/report.md
similarity index 96%
rename from packages/builtin-skills/src/acceptance/references/report.md
rename to .agents/skills/acceptance/references/report.md
index ea321837c44..a816112093b 100644
--- a/packages/builtin-skills/src/acceptance/references/report.md
+++ b/.agents/skills/acceptance/references/report.md
@@ -93,8 +93,8 @@ Three things the shape buys, none of them cosmetic:
- **The tree is git-invisible.** `.acceptances/.gitignore` contains `*`, which
ignores the whole directory including itself, so evidence binaries never land
as untracked noise and the project's own `.gitignore` is never rewritten.
- `lh acceptance install` and `lh acceptance run ingest` both seed that file, so
- the guarantee does not depend on which entry point a run came through.
+ Create that file before writing evidence; a general-purpose skill installer
+ does not seed it. `lh acceptance run ingest` also ensures it exists.
Writing a round somewhere else still works β€” `ingest` takes an explicit path β€”
but then keeping it out of git is on you.
@@ -254,18 +254,27 @@ but its filename fallback does not satisfy the description requirement.
"method": "<cli> task list --tree against a 3-level fixture",
"expected": "root shows 3 nested children at depth 2",
"requiredEvidence": ["text"]
+ },
+ {
+ "id": "2",
+ "title": "candidate model improves average precision",
+ "category": "Model quality",
+ "verifier": "program",
+ "method": "Evaluate the baseline and candidate on the same held-out dataset",
+ "expected": "candidate average precision exceeds the baseline",
+ "requiredEvidence": ["text"]
}
],
"summary": {
- "total": 1,
- "passed": 1,
+ "total": 2,
+ "passed": 2,
"failed": 0,
"blocked": 0,
"verdict": "pass",
- "conclusion": "One-paragraph verdict the page shows under the title."
+ "conclusion": "Both checks passed: the task tree returned the expected hierarchy, and the candidate model improved average precision from 0.742 to 0.796."
},
"surfaces": ["cli"],
- "title": "Verify task tree API"
+ "title": "Verify task hierarchy and model quality"
}
```
diff --git a/.agents/skills/acceptance/references/screenshot-helpers.md b/.agents/skills/acceptance/references/screenshot-helpers.md
new file mode 100644
index 00000000000..58f7b4842ec
--- /dev/null
+++ b/.agents/skills/acceptance/references/screenshot-helpers.md
@@ -0,0 +1,71 @@
+# Bundled screenshot helpers
+
+Resolve `SKILL_DIR` to the absolute directory containing the `SKILL.md` you loaded.
+Installers may use different directories. Helpers resolve siblings relative to
+their own location, so the current working directory does not matter. Invoke
+them with `bash` or `node`: installers need not preserve executable bits.
+
+## CDP screenshots (Chrome / Electron)
+
+Requires **Node.js 22.15 or later** with its built-in WebSocket enabled, and a
+running Chrome/Electron target exposing a local CDP port. No npm packages,
+`node_modules`, LobeHub checkout, or reporting-service login are needed.
+The Bash wrapper works on macOS and Linux; on Windows, invoke the Node helper
+directly or use a Bash environment that can reach the target's localhost port.
+
+```bash
+bash "$SKILL_DIR/scripts/cdp-screenshot.sh" --port 9222 \
+ --target-url 'localhost:3000' --out ./proof/page.png
+
+# Direct portable capture, with one JSON result and no brightness probe:
+node "$SKILL_DIR/scripts/cdp-capture.cjs" --port 9222 \
+ --target-url 'localhost:3000' --out ./proof/full-page.png --full
+```
+
+Use `--target-url <substring>` whenever the CDP instance has multiple pages;
+otherwise the first page target is selected. The result reports `targetUrl` so
+you can check which page was captured. `--timeout <milliseconds>` (default 12000)
+bounds discovery, the WebSocket handshake, and capture together. `--full` captures
+the page's content bounds. Errors exit nonzero; missing/old Node exits 7, capture
+failure exits 5. The script creates the output's parent directories.
+
+The wrapper also attempts a brightness probe using **macOS `sips` and Python 3**
+(standard library only). Ordinary capture can succeed without these tools, but
+explicitly reports that brightness was not measured. A measured black frame exits
+6\. Blackness is a coarse diagnostic; a dark page may legitimately trigger it.
+
+```bash
+# macOS only: exit 0 requires a captured, measured, non-black frame.
+bash "$SKILL_DIR/scripts/cdp-screenshot.sh" --port 9222 \
+ --target-url 'localhost:3000' --check
+```
+
+`--check` exits 2 when brightness cannot be measured, including on platforms
+without `sips`. It deletes only its own temporary screenshot; an explicit `--out`
+is retained. Do not report an unavailable check as passed. A non-black image alone
+does not establish that the right UI rendered: inspect the screenshot separately.
+
+## macOS screen-recording preflight
+
+Use before OS-level `screencapture` or screen recording, not for renderer-only CDP
+capture. Requires a local macOS display, **Python 3**, `screencapture`, `sips`, and
+a working **clang or Swift toolchain with the macOS SDK** for the permission probe
+(normally supplied by Xcode Command Line Tools). There are no Python packages to
+install. The helper queries Screen Recording permission without requesting it or
+changing system settings, then captures a temporary screen frame to measure
+brightness. Temporary images and compiled probes are removed on exit.
+
+```bash
+bash "$SKILL_DIR/scripts/check-screen-recording.sh" --json
+```
+
+| Exit | Meaning |
+| ---- | ------------------------------------------------------------------------------ |
+| 0 | Permission granted **and** a non-black OS frame measured |
+| 2 | Not applicable outside macOS, missing/broken tools, or an undetermined check |
+| 3 | Permission denied; enable Screen Recording for the reported app and restart it |
+| 4 | Permission granted but frame black; wake/unlock the display and retry |
+
+JSON output includes `ok`, `permission`, `capture`, and a remediation message.
+Only exit 0 has `ok: true`; a permission bit alone is never a pass. This is a
+preflight, not proof that a later recording contains the intended window or motion.
diff --git a/.agents/skills/acceptance/scripts/cdp-capture.cjs b/.agents/skills/acceptance/scripts/cdp-capture.cjs
new file mode 100644
index 00000000000..166191eb4c4
--- /dev/null
+++ b/.agents/skills/acceptance/scripts/cdp-capture.cjs
@@ -0,0 +1,125 @@
+#!/usr/bin/env node
+// Raw CDP capture. Requires Node.js >=22.15; no npm packages or project setup.
+const fs = require('node:fs');
+const path = require('node:path');
+const { parseArgs } = require('node:util');
+
+const finish = (result, code) => {
+ console.log(JSON.stringify(result));
+ process.exit(code);
+};
+
+async function capture() {
+ const [major, minor] = process.versions.node.split('.').map(Number);
+ if (major < 22 || (major === 22 && minor < 15) || typeof WebSocket !== 'function') {
+ finish({ ok: false, error: 'Node.js >=22.15 with its built-in WebSocket is required.' }, 7);
+ }
+
+ const { values } = parseArgs({
+ options: {
+ 'port': { type: 'string', default: '9222' },
+ 'out': { type: 'string', default: path.join(require('node:os').tmpdir(), 'cdp-capture.png') },
+ 'full': { type: 'boolean', default: false },
+ 'target-url': { type: 'string' },
+ 'timeout': { type: 'string', default: '12000' },
+ },
+ });
+ const port = Number(values.port);
+ const timeout = Number(values.timeout);
+ if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error('Invalid --port.');
+ if (!Number.isInteger(timeout) || timeout < 1 || timeout > 2147483647) {
+ throw new Error('Invalid --timeout (positive milliseconds required).');
+ }
+
+ // Bound the entire operation, including discovery and the WebSocket handshake.
+ const deadline = setTimeout(
+ () => finish({ ok: false, error: `CDP timeout after ${timeout}ms` }, 5),
+ timeout,
+ );
+ const response = await fetch(`http://127.0.0.1:${port}/json`, {
+ signal: AbortSignal.timeout(timeout),
+ });
+ if (!response.ok) throw new Error(`CDP discovery returned HTTP ${response.status}.`);
+ const targets = await response.json();
+ if (!Array.isArray(targets)) throw new Error('CDP discovery did not return a target list.');
+ const pages = targets.filter((target) => target.type === 'page' && target.webSocketDebuggerUrl);
+ const page = values['target-url']
+ ? pages.find((target) => (target.url || '').includes(values['target-url']))
+ : pages[0];
+ if (!page)
+ throw new Error(
+ 'No page target found' +
+ (values['target-url'] ? ` matching ${JSON.stringify(values['target-url'])}` : '') +
+ '.',
+ );
+
+ const socket = new WebSocket(page.webSocketDebuggerUrl);
+ const pending = new Map();
+ let nextId = 0;
+ let rejectOpen;
+ const ready = new Promise((resolve, reject) => {
+ rejectOpen = reject;
+ socket.addEventListener('open', resolve, { once: true });
+ });
+ const fail = (error) => {
+ rejectOpen(error);
+ for (const { reject } of pending.values()) reject(error);
+ pending.clear();
+ };
+ socket.addEventListener('error', () => fail(new Error('CDP WebSocket connection failed.')));
+ socket.addEventListener('close', () =>
+ fail(new Error('CDP WebSocket closed before capture completed.')),
+ );
+ socket.addEventListener('message', ({ data }) => {
+ try {
+ const message = JSON.parse(data);
+ const request = pending.get(message.id);
+ if (!request) return;
+ pending.delete(message.id);
+ if (message.error) request.reject(new Error(`${request.method}: ${message.error.message}`));
+ else request.resolve(message.result);
+ } catch (error) {
+ fail(new Error(`Invalid CDP response: ${error.message}`));
+ }
+ });
+ const send = (method, params = {}) =>
+ new Promise((resolve, reject) => {
+ const id = ++nextId;
+ pending.set(id, { method, resolve, reject });
+ socket.send(JSON.stringify({ id, method, params }));
+ });
+
+ await ready;
+ let params = { format: 'png' };
+ if (values.full) {
+ const metrics = await send('Page.getLayoutMetrics');
+ const size = metrics.cssContentSize || metrics.contentSize;
+ params = {
+ format: 'png',
+ captureBeyondViewport: true,
+ clip: { x: 0, y: 0, width: Math.ceil(size.width), height: Math.ceil(size.height), scale: 1 },
+ };
+ }
+ const started = Date.now();
+ const screenshot = await send('Page.captureScreenshot', params);
+ const bytes = Buffer.from(screenshot.data || '', 'base64');
+ if (bytes.length < 24 || !bytes.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex'))) {
+ throw new Error('CDP returned an empty or invalid PNG.');
+ }
+ fs.mkdirSync(path.dirname(path.resolve(values.out)), { recursive: true });
+ fs.writeFileSync(values.out, bytes);
+ socket.close();
+ clearTimeout(deadline);
+ finish(
+ {
+ ok: true,
+ bytes: bytes.length,
+ ms: Date.now() - started,
+ targetUrl: page.url,
+ out: values.out,
+ },
+ 0,
+ );
+}
+
+capture().catch((error) => finish({ ok: false, error: error.message }, 5));
diff --git a/.agents/skills/acceptance/scripts/cdp-screenshot.sh b/.agents/skills/acceptance/scripts/cdp-screenshot.sh
new file mode 100644
index 00000000000..a7625cc8e2d
--- /dev/null
+++ b/.agents/skills/acceptance/scripts/cdp-screenshot.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Usage: bash cdp-screenshot.sh [--port 9222] [--out shot.png] [--full]
+# [--target-url substring] [--timeout 12000] [--check]
+# Capture: Node.js >=22.15. Brightness check: macOS sips + Python 3.
+# Exit: 0 captured/passed, 2 check unavailable, 5 capture failed, 6 black, 7 no runtime.
+set -uo pipefail
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+source "$SCRIPT_DIR/image-brightness.sh"
+
+CHECK=0
+OUT=""
+PASS=()
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --check) CHECK=1; shift ;;
+ --out)
+ [ $# -ge 2 ] && [ -n "$2" ] || { echo '[cdp-shot] --out requires a path.' >&2; exit 5; }
+ OUT="$2"; shift 2 ;;
+ --port|--target-url|--timeout)
+ [ $# -ge 2 ] || { echo "[cdp-shot] $1 requires a value." >&2; exit 5; }
+ PASS+=("$1" "$2"); shift 2 ;;
+ --full) PASS+=("$1"); shift ;;
+ *) echo "[cdp-shot] Unknown argument: $1" >&2; exit 5 ;;
+ esac
+done
+command -v node >/dev/null 2>&1 || { echo '[cdp-shot] Node.js >=22.15 is required.' >&2; exit 7; }
+
+# Only an implicit --check output is disposable; never delete a caller's --out.
+if [ -z "$OUT" ]; then
+ if [ "$CHECK" = 1 ]; then
+ capture_dir="$(mktemp -d "${TMPDIR:-/tmp}/acceptance-cdp.XXXXXX")" || exit 5
+ trap 'rm -rf "$capture_dir"' EXIT
+ OUT="$capture_dir/shot.png"
+ else
+ OUT="${TMPDIR:-/tmp}/cdp-capture.png"
+ fi
+fi
+node "$SCRIPT_DIR/cdp-capture.cjs" --out "$OUT" ${PASS[@]+"${PASS[@]}"}
+status=$?
+[ "$status" = 0 ] || exit "$status"
+
+if maximum="$(image_brightness "$OUT")"; then
+ if [ "$maximum" -lt 12 ]; then
+ echo '[cdp-shot] CAPTURED BUT BLACK. Check that the target page has rendered.' >&2
+ exit 6
+ fi
+ echo "[cdp-shot] Non-black frame measured (maxBrightness=$maximum)."
+elif [ "$CHECK" = 1 ]; then
+ echo '[cdp-shot] PREFLIGHT UNDETERMINED: brightness check needs working macOS sips and Python 3; capture alone is not a pass.' >&2
+ exit 2
+else
+ echo '[cdp-shot] Screenshot saved; brightness was not checked (requires macOS sips and Python 3). Inspect the image before citing it.' >&2
+fi
+[ "$CHECK" = 0 ] || echo '[cdp-shot] PREFLIGHT PASS: captured and measured a non-black frame.'
diff --git a/.agents/skills/acceptance/scripts/check-screen-recording.sh b/.agents/skills/acceptance/scripts/check-screen-recording.sh
new file mode 100644
index 00000000000..b583e6e18d7
--- /dev/null
+++ b/.agents/skills/acceptance/scripts/check-screen-recording.sh
@@ -0,0 +1,100 @@
+#!/usr/bin/env bash
+# macOS OS-capture preflight. Usage: bash check-screen-recording.sh [--json]
+# Requires Python 3, sips, screencapture, and clang or swift for the permission probe.
+# Exit: 0 granted + live, 2 undetermined/not applicable, 3 denied, 4 black.
+set -uo pipefail
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+source "$SCRIPT_DIR/image-brightness.sh"
+JSON=0
+for argument in "$@"; do
+ case "$argument" in
+ --json) JSON=1 ;;
+ *) echo "Unknown argument: $argument" >&2; exit 2 ;;
+ esac
+done
+
+platform="$(uname -s)"
+if ! command -v python3 >/dev/null 2>&1; then
+ if [ "$JSON" = 1 ]; then
+ printf '%s\n' '{"ok":false,"permission":"unknown","capture":"unknown","message":"Python 3 is required; no screen-recording check was performed."}'
+ else
+ echo '[screen-recording] UNDETERMINED: Python 3 is required; no check was performed.'
+ fi
+ exit 2
+fi
+
+APP=""
+emit() {
+ if [ "$JSON" = 1 ]; then
+ python3 - "$platform" "$1" "$2" "$3" "$APP" "$5" <<'PY'
+import json, sys
+platform, ok, permission, capture, app, message = sys.argv[1:]
+print(json.dumps(dict(platform=platform, ok=ok == 'true', permission=permission,
+ capture=capture, responsibleApp=app, message=message)))
+PY
+ else
+ echo "[screen-recording] $5"
+ fi
+ exit "$4"
+}
+if [ "$platform" != Darwin ]; then
+ emit false n/a n/a 2 "NOT APPLICABLE on $platform: this preflight checks macOS OS capture only. Use CDP for Chromium targets."
+fi
+
+# TCC attributes Screen Recording to the ancestor app, not necessarily this shell.
+responsible_app() {
+ local pid=$$ ppid comm count
+ for ((count=0; count<12; count++)); do
+ read -r ppid comm < <(ps -o ppid=,comm= -p "$pid" 2>/dev/null) || break
+ [ -n "${ppid:-}" ] || break
+ if [[ "$comm" == *.app/Contents/MacOS/* ]]; then
+ local app="${comm%%.app/*}"
+ echo "${app##*/}.app"; return
+ fi
+ [ "$ppid" -gt 1 ] || break
+ pid=$ppid
+ done
+ echo "${TERM_PROGRAM:-your terminal app}"
+}
+APP="$(responsible_app)"
+probe_dir="$(mktemp -d "${TMPDIR:-/tmp}/acceptance-screen.XXXXXX")" || exit 2
+trap 'rm -rf "$probe_dir"' EXIT
+
+# Query only: never request permission or change TCC settings.
+permission=unknown
+if command -v clang >/dev/null 2>&1; then
+ cat > "$probe_dir/permission.c" <<'C'
+#include <CoreGraphics/CoreGraphics.h>
+#include <stdio.h>
+int main(void) { puts(CGPreflightScreenCaptureAccess() ? "granted" : "denied"); return 0; }
+C
+ if clang -framework CoreGraphics -o "$probe_dir/permission" "$probe_dir/permission.c" 2>/dev/null; then
+ permission="$("$probe_dir/permission" 2>/dev/null)" || permission=unknown
+ fi
+fi
+if [ "$permission" = unknown ] && command -v swift >/dev/null 2>&1; then
+ permission="$(swift - <<'SWIFT' 2>/dev/null
+import CoreGraphics
+print(CGPreflightScreenCaptureAccess() ? "granted" : "denied")
+SWIFT
+)" || permission=unknown
+fi
+case "$permission" in granted|denied) ;; *) permission=unknown ;; esac
+if [ "$permission" = denied ]; then
+ emit false denied unknown 3 "BLOCKED: Screen Recording permission is denied for '$APP'. Enable it in System Settings > Privacy & Security > Screen Recording, then fully quit and reopen '$APP'."
+fi
+if [ "$permission" = unknown ]; then
+ emit false unknown unknown 2 'UNDETERMINED: the permission probe needs a working clang or swift with the macOS SDK. No live-frame check was performed.'
+fi
+
+capture=unknown
+if command -v screencapture >/dev/null 2>&1 && screencapture -x "$probe_dir/shot.png" 2>/dev/null; then
+ if maximum="$(image_brightness "$probe_dir/shot.png")"; then
+ if [ "$maximum" -lt 12 ]; then capture=black; else capture=live; fi
+ fi
+fi
+case "$capture" in
+ live) emit true granted live 0 'PASS: permission granted and a non-black OS frame measured. Inspect actual evidence separately.' ;;
+ black) emit false granted black 4 'BLACK FRAME: permission is granted, but the screen is black. Wake/unlock the display, stop the screensaver, or restart the responsible app and retry.' ;;
+ *) emit false granted unknown 2 'UNDETERMINED: permission is granted, but a live frame could not be measured. Check screencapture, sips, Python 3, and the display. Permission alone is not a pass.' ;;
+esac
diff --git a/.agents/skills/acceptance/scripts/image-brightness.sh b/.agents/skills/acceptance/scripts/image-brightness.sh
new file mode 100644
index 00000000000..f79a44ab3fb
--- /dev/null
+++ b/.agents/skills/acceptance/scripts/image-brightness.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+# Shared macOS brightness probe. Source this file; call image_brightness <PNG>.
+# Prints the brightest RGB channel on a 16x16 grid. Exit 2 = unmeasured.
+image_brightness() (
+ for tool in sips python3; do
+ command -v "$tool" >/dev/null 2>&1 || { echo "Missing $tool for image brightness check." >&2; exit 2; }
+ done
+ probe_dir="$(mktemp -d "${TMPDIR:-/tmp}/acceptance-image.XXXXXX")" || exit 2
+ trap 'rm -rf "$probe_dir"' EXIT
+ sips -z 16 16 "$1" --out "$probe_dir/small.png" >/dev/null 2>&1 || exit 2
+ sips -s format bmp "$probe_dir/small.png" --out "$probe_dir/small.bmp" >/dev/null 2>&1 || exit 2
+ python3 - "$probe_dir/small.bmp" <<'PY'
+import sys
+
+try:
+ data = open(sys.argv[1], 'rb').read()
+ if len(data) < 54 or data[:2] != b'BM':
+ raise ValueError('invalid BMP')
+ offset = int.from_bytes(data[10:14], 'little')
+ width = int.from_bytes(data[18:22], 'little', signed=True)
+ height = abs(int.from_bytes(data[22:26], 'little', signed=True))
+ bpp = int.from_bytes(data[28:30], 'little')
+ compression = int.from_bytes(data[30:34], 'little')
+ stride = ((width * bpp + 31) // 32) * 4
+ if width != 16 or height != 16 or bpp not in (24, 32) or compression not in (0, 3):
+ raise ValueError('unsupported BMP layout')
+ # sips emits BITMAPV5HEADER + BI_BITFIELDS for RGBA screenshots. Accept
+ # its BGR channel masks, excluding alpha from the brightness measurement.
+ if compression == 3 and (bpp != 32 or offset < 66 or
+ data[54:66] != bytes.fromhex('0000ff0000ff0000ff000000')):
+ raise ValueError('unsupported BMP channel masks')
+ if offset < 54 or len(data) < offset + height * stride:
+ raise ValueError('truncated BMP')
+ maximum = max(
+ data[offset + y * stride + x * (bpp // 8) + channel]
+ for y in range(height) for x in range(width) for channel in range(3)
+ )
+ print(maximum)
+except (OSError, ValueError) as error:
+ print(f'Image brightness check unavailable: {error}', file=sys.stderr)
+ sys.exit(2)
+PY
+)
diff --git a/packages/builtin-skills/src/acceptance/surfaces/cli.md b/.agents/skills/acceptance/surfaces/cli.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/surfaces/cli.md
rename to .agents/skills/acceptance/surfaces/cli.md
diff --git a/packages/builtin-skills/src/acceptance/surfaces/electron.md b/.agents/skills/acceptance/surfaces/electron.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/surfaces/electron.md
rename to .agents/skills/acceptance/surfaces/electron.md
diff --git a/packages/builtin-skills/src/acceptance/surfaces/ios-simulator.md b/.agents/skills/acceptance/surfaces/ios-simulator.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/surfaces/ios-simulator.md
rename to .agents/skills/acceptance/surfaces/ios-simulator.md
diff --git a/packages/builtin-skills/src/acceptance/surfaces/native.md b/.agents/skills/acceptance/surfaces/native.md
similarity index 100%
rename from packages/builtin-skills/src/acceptance/surfaces/native.md
rename to .agents/skills/acceptance/surfaces/native.md
diff --git a/packages/builtin-skills/src/acceptance/surfaces/web.md b/.agents/skills/acceptance/surfaces/web.md
similarity index 95%
rename from packages/builtin-skills/src/acceptance/surfaces/web.md
rename to .agents/skills/acceptance/surfaces/web.md
index 3089db32b22..9f48bc31caf 100644
--- a/packages/builtin-skills/src/acceptance/surfaces/web.md
+++ b/.agents/skills/acceptance/surfaces/web.md
@@ -16,7 +16,8 @@ on the desktop shell or is fully provable through backend/CLI output.
2. If the state under test is behind login, authenticate the agent-browser
session first β€” see
[../references/auth-web.md](../references/auth-web.md). Use a named `--session`
- so cookies persist across commands.
+ to reuse cookies across commands in the same running browser. Add `--restore`
+ when authentication must survive browser restarts.
```bash
SESSION=app
diff --git a/.prettierignore b/.prettierignore
index 368957d81f5..03eaf0bf9ad 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -69,3 +69,6 @@ packages/sdk/src/generated/
# generated files (regenerate with `codex app-server generate-ts`)
packages/heterogeneous-agents/src/codex/protocol/generated.ts
+
+# Generated from lobehub/acceptance releases; preserve the upstream bytes.
+.agents/skills/acceptance/**
diff --git a/.remarkignore b/.remarkignore
new file mode 100644
index 00000000000..09818ddab5a
--- /dev/null
+++ b/.remarkignore
@@ -0,0 +1,2 @@
+# Generated from lobehub/acceptance releases; preserve the upstream bytes.
+.agents/skills/acceptance/**
diff --git a/AGENTS.md b/AGENTS.md
index 164d43d706c..4795c5181f4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -15,6 +15,8 @@ Guidelines for using AI coding agents in this opensource LobeHub repository.
`AGENTS.md` owns repository-wide architecture and workflow. Keep detailed implementation rules in skills so they have one source of truth.
+The `acceptance` skill is generated from the default branch of [lobehub/acceptance](https://github.com/lobehub/acceptance). Maintain its source there; update the committed `.agents/skills/acceptance/` copy using `bun apps/cli/src/index.ts acceptance update`. Repository-specific acceptance setup stays in `.agents/acceptance/`.
+
- **React and TSX**: Before editing components, component state, render boundaries, or memoization, read the `react` skill. It owns component selection, styling, state locality, and render-performance rules.
- **Heavy domain features**: When splitting a fat Viewer/Page into reusable pieces (page vs portal vs share vs micro-app), read the `compose-atoms` skill. Split on mountable capabilities, not visual sections, and do not hide unused work behind `readOnly` / `mode` flags.
diff --git a/apps/cli/README.md b/apps/cli/README.md
index eb6cc0fdb8e..de63f3a0962 100644
--- a/apps/cli/README.md
+++ b/apps/cli/README.md
@@ -2,6 +2,38 @@
LobeHub command-line interface.
+## Acceptance skill
+
+The acceptance skill is maintained in [lobehub/acceptance](https://github.com/lobehub/acceptance).
+After signing in, install or update from the repository's default branch:
+
+```bash
+lh login
+lh acceptance install
+lh acceptance update
+```
+
+This selects the same source as `npx skills add lobehub/acceptance --skill acceptance`.
+Changes merged into the default branch are available on the next install or
+update, without a tag, GitHub Release, or skill-version bump. Installed files
+remain unchanged until you run an update.
+
+`install` skips existing files unless `--force` is passed. `update` replaces the
+materialized files in `.agents/skills/acceptance`, removes stale resources, and
+maintains agent links. The server resolves a commit and downloads the entire
+skill from that snapshot before files are changed. `--json` reports the exact
+source commit and the version declared in `SKILL.md`; that version is a label,
+not the selector for default updates.
+
+All CLI versions use the authenticated `verify.getSkillBundle` endpoint. After
+the server adapter is deployed, already-published CLIs follow the default branch
+without upgrading. Creating acceptances and publishing reports use the same login.
+
+To select an existing version tag explicitly, use `lh acceptance update --skill-version 0.5.0` (requires the updated CLI and server), or the equivalent
+[tagged skill source](https://github.com/lobehub/acceptance/tree/v0.5.0/skills/acceptance)
+with `npx skills add`. A later `lh acceptance update` without `--skill-version`
+returns to the current default-branch source.
+
## Local Development
| Task | Command |
diff --git a/apps/cli/src/commands/acceptanceInstall.test.ts b/apps/cli/src/commands/acceptanceInstall.test.ts
new file mode 100644
index 00000000000..42813f290e1
--- /dev/null
+++ b/apps/cli/src/commands/acceptanceInstall.test.ts
@@ -0,0 +1,215 @@
+import { mkdir, mkdtemp, readFile, readlink, rm, writeFile } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+
+import { Command } from 'commander';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { getTrpcClient } from '../api/client';
+import { registerVerifyCommand } from './verify';
+import { registerAcceptanceCommands } from './verifyAcceptance';
+
+vi.mock('../api/client', () => ({ getTrpcClient: vi.fn() }));
+
+const content = '---\nname: acceptance\nmetadata:\n version: "0.5.0"\n---\n# Acceptance\n';
+const bundle = {
+ content,
+ files: {
+ 'LICENSE': 'Apache-2.0',
+ 'references/report.md': '# Reports',
+ 'scripts/capture.cjs': 'console.log("capture");',
+ 'surfaces/cli.md': '# CLI',
+ },
+ identifier: 'acceptance',
+ name: 'acceptance',
+ source: {
+ commit: 'a'.repeat(40),
+ path: 'skills/acceptance',
+ repository: 'lobehub/acceptance',
+ ref: 'HEAD',
+ },
+ version: '0.5.0',
+};
+
+describe('acceptance skill installation', () => {
+ let directory: string;
+ const query = vi.fn();
+
+ const run = async (...args: string[]) => {
+ const program = new Command().version('0.0.55');
+ program.exitOverride();
+ registerAcceptanceCommands(program);
+ await program.parseAsync(['node', 'lh', 'acceptance', ...args, '--dir', directory, '--json']);
+ };
+
+ beforeEach(async () => {
+ directory = await mkdtemp(path.join(tmpdir(), 'acceptance-distribution-'));
+ vi.spyOn(console, 'log').mockImplementation(() => {});
+ query.mockReset().mockResolvedValue(bundle);
+ vi.mocked(getTrpcClient)
+ .mockReset()
+ .mockResolvedValue({
+ verify: { getSkillBundle: { query } },
+ } as unknown as Awaited<ReturnType<typeof getTrpcClient>>);
+ });
+
+ afterEach(async () => {
+ vi.restoreAllMocks();
+ await rm(directory, { force: true, recursive: true });
+ });
+
+ it('installs every source resource through the authenticated server and wires Claude', async () => {
+ await mkdir(path.join(directory, '.claude'));
+
+ await run('install');
+
+ const skillDir = path.join(directory, '.agents/skills/acceptance');
+ expect(await readFile(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe(content);
+ for (const [file, expected] of Object.entries(bundle.files)) {
+ expect(await readFile(path.join(skillDir, file), 'utf8')).toBe(expected);
+ }
+ expect(await readlink(path.join(directory, '.claude/skills'))).toBe('../.agents/skills');
+ expect(getTrpcClient).toHaveBeenCalled();
+ expect(query).toHaveBeenCalledWith({ identifier: 'acceptance' });
+ expect(JSON.parse(vi.mocked(console.log).mock.calls.at(-1)![0] as string)).toMatchObject({
+ skill: 'acceptance',
+ version: '0.5.0',
+ });
+ });
+
+ it('leaves the existing skill and stale resources untouched when an update cannot download', async () => {
+ const skillDir = path.join(directory, '.agents/skills/acceptance');
+ await mkdir(skillDir, { recursive: true });
+ await writeFile(path.join(skillDir, 'SKILL.md'), 'existing skill');
+ await writeFile(path.join(skillDir, 'old.md'), 'existing resource');
+ query.mockRejectedValueOnce(new Error('Download unavailable'));
+
+ await expect(run('update')).rejects.toThrow('Download unavailable');
+
+ expect(await readFile(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe('existing skill');
+ expect(await readFile(path.join(skillDir, 'old.md'), 'utf8')).toBe('existing resource');
+ });
+
+ it('preserves existing files during install, then replaces them and removes stale files on update', async () => {
+ await run('install');
+ const skillDir = path.join(directory, '.agents/skills/acceptance');
+ await writeFile(path.join(skillDir, 'SKILL.md'), 'local copy');
+ await writeFile(path.join(skillDir, 'old.md'), 'stale reference');
+
+ await run('install');
+ expect(await readFile(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe('local copy');
+ expect(JSON.parse(vi.mocked(console.log).mock.calls.at(-1)![0] as string).skipped).toContain(
+ 'SKILL.md',
+ );
+
+ await run('update');
+ expect(await readFile(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe(content);
+ await expect(readFile(path.join(skillDir, 'old.md'))).rejects.toMatchObject({ code: 'ENOENT' });
+ expect(JSON.parse(vi.mocked(console.log).mock.calls.at(-1)![0] as string).removed).toEqual([
+ 'old.md',
+ ]);
+ });
+
+ it.each(['0.5.0', 'v0.5.0'])('supports forcing an install from tag %s', async (version) => {
+ await run('install');
+ const skillPath = path.join(directory, '.agents/skills/acceptance/SKILL.md');
+ await writeFile(skillPath, 'local copy');
+ query.mockResolvedValueOnce({ ...bundle, source: { ...bundle.source, ref: 'v0.5.0' } });
+
+ await run('install', '--force', '--skill-version', version);
+
+ expect(await readFile(skillPath, 'utf8')).toBe(content);
+ expect(query).toHaveBeenLastCalledWith({ identifier: 'acceptance', version: '0.5.0' });
+ });
+
+ it.each(['init', 'install'])('keeps the deprecated verify %s alias working', async (command) => {
+ const program = new Command();
+ registerVerifyCommand(program);
+ await program.parseAsync([
+ 'node',
+ 'lh',
+ 'verify',
+ command,
+ '--skill',
+ 'verify',
+ '--dir',
+ directory,
+ ]);
+ expect(await readFile(path.join(directory, '.agents/skills/acceptance/SKILL.md'), 'utf8')).toBe(
+ content,
+ );
+ expect(getTrpcClient).toHaveBeenCalled();
+ expect(query).toHaveBeenCalledWith({ identifier: 'verify' });
+ });
+
+ it('keeps login required and preserves installed files when authentication fails', async () => {
+ await run('install');
+ vi.mocked(getTrpcClient).mockRejectedValueOnce(new Error('Not authenticated'));
+
+ await expect(run('update')).rejects.toThrow('Not authenticated');
+ expect(await readFile(path.join(directory, '.agents/skills/acceptance/SKILL.md'), 'utf8')).toBe(
+ content,
+ );
+ expect(query).toHaveBeenCalledTimes(1);
+ });
+
+ it('rejects a matching tag whose declared version differs from the requested version', async () => {
+ await run('install');
+ query.mockResolvedValueOnce({
+ ...bundle,
+ source: { ...bundle.source, ref: 'v0.5.0' },
+ version: '0.4.3',
+ });
+
+ await expect(run('update', '--skill-version', 'v0.5.0')).rejects.toThrow(
+ 'Requested acceptance skill 0.5.0 from tag v0.5.0, but the server returned version 0.4.3',
+ );
+ expect(await readFile(path.join(directory, '.agents/skills/acceptance/SKILL.md'), 'utf8')).toBe(
+ content,
+ );
+ });
+
+ it.each([undefined, 'HEAD', 'v0.4.3'])(
+ 'rejects a matching version with source ref %s before changing installed files',
+ async (ref) => {
+ await mkdir(path.join(directory, '.claude'));
+ await run('install');
+ const skillDir = path.join(directory, '.agents/skills/acceptance');
+ await writeFile(path.join(skillDir, 'old.md'), 'keep this resource');
+ query.mockResolvedValueOnce({
+ ...bundle,
+ content: content.replace('# Acceptance', '# Different content with the same version'),
+ files: { 'unexpected.md': 'must not be written' },
+ source: ref === undefined ? undefined : { ...bundle.source, ref },
+ });
+
+ await expect(run('update', '--skill-version', 'v0.5.0')).rejects.toThrow(
+ `from ${ref ?? 'an unknown source'}. Update your server to support skill tag selection.`,
+ );
+
+ expect(await readFile(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe(content);
+ for (const [file, expected] of Object.entries(bundle.files)) {
+ expect(await readFile(path.join(skillDir, file), 'utf8')).toBe(expected);
+ }
+ expect(await readFile(path.join(skillDir, 'old.md'), 'utf8')).toBe('keep this resource');
+ await expect(readFile(path.join(skillDir, 'unexpected.md'))).rejects.toMatchObject({
+ code: 'ENOENT',
+ });
+ expect(await readlink(path.join(directory, '.claude/skills'))).toBe('../.agents/skills');
+ },
+ );
+
+ it('allows an unpinned update from a legacy server without source metadata', async () => {
+ await run('install');
+ const updated = content.replace('# Acceptance', '# Updated default content');
+ const { source: _source, ...legacyBundle } = bundle;
+ query.mockResolvedValueOnce({ ...legacyBundle, content: updated });
+
+ await run('update');
+
+ expect(await readFile(path.join(directory, '.agents/skills/acceptance/SKILL.md'), 'utf8')).toBe(
+ updated,
+ );
+ expect(query).toHaveBeenLastCalledWith({ identifier: 'acceptance' });
+ });
+});
diff --git a/apps/cli/src/commands/acceptanceRun.ts b/apps/cli/src/commands/acceptanceRun.ts
index 412d1377af3..324ebf2e406 100644
--- a/apps/cli/src/commands/acceptanceRun.ts
+++ b/apps/cli/src/commands/acceptanceRun.ts
@@ -54,6 +54,7 @@ interface InstallOptions {
force?: boolean;
json?: boolean | string;
skill: string;
+ skillVersion?: string;
}
const listMaterializedFiles = (directory: string): string[] => {
@@ -67,8 +68,21 @@ const listMaterializedFiles = (directory: string): string[] => {
async function installAction(options: InstallOptions): Promise<void> {
const client = await getTrpcClient();
- // Pulled live from the server's deployed builtin-skills β€” always the latest.
- const bundle = await client.verify.getSkillBundle.query({ identifier: options.skill });
+ const version = options.skillVersion?.replace(/^v/, '');
+ const bundle = await client.verify.getSkillBundle.query({
+ identifier: options.skill,
+ ...(version === undefined ? {} : { version }),
+ });
+ // Older servers ignore the requested version. A matching version label alone
+ // does not prove that the content was resolved from the requested tag.
+ if (
+ version !== undefined &&
+ (bundle.version !== version || bundle.source?.ref !== `v${version}`)
+ ) {
+ throw new Error(
+ `Requested acceptance skill ${version} from tag v${version}, but the server returned version ${bundle.version ?? 'unknown'} from ${bundle.source?.ref ?? 'an unknown source'}. Update your server to support skill tag selection.`,
+ );
+ }
// The acceptance skeleton lands under `.agents/skills/<id>` β€” the harness dir
// the project's own `.agents/acceptance/` adapter sits beside. Invariant: this
@@ -125,6 +139,7 @@ async function installAction(options: InstallOptions): Promise<void> {
removed,
skill: bundle.identifier,
skipped,
+ source: bundle.source,
// Recorded so a caller can tell which version now sits on disk; the
// installed SKILL.md carries the same value in its frontmatter.
version: bundle.version,
@@ -960,6 +975,10 @@ function withInstallOptions(cmd: Command): Command {
return cmd
.option('--dir <path>', 'Target working directory (default: current dir)')
.option('--skill <id>', 'Skill identifier to pull', 'acceptance')
+ .option(
+ '--skill-version <version>',
+ 'Install a specific skill tag (default: latest default-branch source)',
+ )
.option('--force', 'Overwrite existing skill files')
.option('--json [fields]', 'Output JSON');
}
@@ -1070,17 +1089,13 @@ export function attachAcceptanceRunCommands(acceptance: Command): void {
withInstallOptions(
acceptance
.command('install')
- .description(
- 'Install the acceptance skill skeleton into .agents/skills/acceptance (pulled from the server)',
- ),
+ .description('Install the latest acceptance skill source into .agents/skills/acceptance'),
).action(installAction);
withInstallOptions(
acceptance
.command('update')
- .description(
- 'Re-pull the acceptance skill, replacing its materialized files and re-wiring harnesses',
- ),
+ .description('Download the latest skill source, replacing its files and re-wiring harnesses'),
).action((options: InstallOptions) => installAction({ ...options, force: true }));
const run = acceptance
diff --git a/apps/cli/src/commands/verify.test.ts b/apps/cli/src/commands/verify.test.ts
index fd137c5dbd6..0e3246a4c83 100644
--- a/apps/cli/src/commands/verify.test.ts
+++ b/apps/cli/src/commands/verify.test.ts
@@ -1,4 +1,4 @@
-import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
@@ -33,7 +33,6 @@ const { mockTrpcClient } = vi.hoisted(() => ({
createRubric: { mutate: vi.fn() },
deleteRun: { mutate: vi.fn() },
getRubric: { query: vi.fn() },
- getSkillBundle: { query: vi.fn() },
updateRubric: { mutate: vi.fn() },
},
},
@@ -181,74 +180,6 @@ describe('verify evidence upload command', () => {
});
});
-describe('verify init command', () => {
- let consoleSpy: ReturnType<typeof vi.spyOn>;
- let dir: string;
-
- beforeEach(() => {
- consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
- mockGetTrpcClient.mockResolvedValue(mockTrpcClient);
- mockTrpcClient.verify.getSkillBundle.query.mockReset().mockResolvedValue({
- content: '# Acceptance SKILL',
- files: { 'references/plan-format.md': 'plan', 'surfaces/cli.md': 'cli' },
- identifier: 'acceptance',
- name: 'acceptance',
- });
- dir = mkdtempSync(path.join(tmpdir(), 'verify-init-'));
- });
-
- afterEach(() => {
- consoleSpy.mockRestore();
- rmSync(dir, { force: true, recursive: true });
- });
-
- const run = async (args: string[]) => {
- const program = new Command();
- program.exitOverride();
- registerVerifyCommand(program);
- await program.parseAsync(['node', 'lh', 'verify', ...args]);
- };
-
- it('defaults to the acceptance skill and writes it into .agents/skills/acceptance', async () => {
- await run(['init', '--dir', dir]);
-
- expect(mockTrpcClient.verify.getSkillBundle.query).toHaveBeenCalledWith({
- identifier: 'acceptance',
- });
- const skillDir = path.join(dir, '.agents', 'skills', 'acceptance');
- expect(readFileSync(path.join(skillDir, 'SKILL.md'), 'utf8')).toBe('# Acceptance SKILL');
- expect(readFileSync(path.join(skillDir, 'references/plan-format.md'), 'utf8')).toBe('plan');
- expect(readFileSync(path.join(skillDir, 'surfaces/cli.md'), 'utf8')).toBe('cli');
- });
-
- it('skips existing files without --force and overwrites with it', async () => {
- const skillFile = path.join(dir, '.agents', 'skills', 'acceptance', 'SKILL.md');
- await run(['init', '--dir', dir]);
-
- // server now serves updated content
- mockTrpcClient.verify.getSkillBundle.query.mockResolvedValue({
- content: '# Updated SKILL',
- files: {},
- identifier: 'acceptance',
- name: 'acceptance',
- });
-
- await run(['init', '--dir', dir]); // no --force β†’ keep existing
- expect(readFileSync(skillFile, 'utf8')).toBe('# Acceptance SKILL');
-
- await run(['init', '--dir', dir, '--force']); // --force β†’ overwrite
- expect(readFileSync(skillFile, 'utf8')).toBe('# Updated SKILL');
- });
-
- it('reports the written/skipped counts as JSON', async () => {
- await run(['init', '--dir', dir, '--json']);
- const out = JSON.parse(consoleSpy.mock.calls.map((c) => String(c[0])).join(''));
- expect(out.skill).toBe('acceptance');
- expect(out.written).toContain('SKILL.md');
- expect(existsSync(path.join(out.dir, 'SKILL.md'))).toBe(true);
- });
-});
-
describe('reportEvidence β€” comparison normalization', () => {
it('accepts plain string paths', () => {
expect(reportEvidence('assets/a.png')).toEqual([{ path: 'assets/a.png' }]);
@@ -1350,77 +1281,6 @@ describe('lh acceptance β€” canonical run tree', () => {
expect(output.url).toBe('https://app.lobehub.com/verify/run_1');
});
- it('exposes `acceptance install` defaulting to the acceptance skill', async () => {
- const dir = mkdtempSync(path.join(tmpdir(), 'acceptance-install-'));
- mockTrpcClient.verify.getSkillBundle.query.mockReset().mockResolvedValue({
- content: '# Acceptance SKILL',
- files: {},
- identifier: 'acceptance',
- name: 'acceptance',
- });
- await run(['install', '--dir', dir]);
- expect(mockTrpcClient.verify.getSkillBundle.query).toHaveBeenCalledWith({
- identifier: 'acceptance',
- });
- expect(existsSync(path.join(dir, '.agents', 'skills', 'acceptance', 'SKILL.md'))).toBe(true);
- rmSync(dir, { force: true, recursive: true });
- });
-
- it('reports the installed version and leaves it in the SKILL.md on disk', async () => {
- // The version is what a later install compares against, so it has to survive
- // in two places: the JSON result, and the frontmatter of the materialized
- // file (the copy a builder actually reads).
- const dir = mkdtempSync(path.join(tmpdir(), 'acceptance-version-'));
- mockTrpcClient.verify.getSkillBundle.query.mockReset().mockResolvedValue({
- content: '---\nname: acceptance\nversion: 1.0.0\n---\n\n# Acceptance SKILL',
- files: {},
- identifier: 'acceptance',
- name: 'acceptance',
- version: '1.0.0',
- });
-
- await run(['install', '--dir', dir, '--json']);
-
- const printed = JSON.parse(consoleSpy.mock.calls.at(-1)![0] as string);
- expect(printed.version).toBe('1.0.0');
- expect(
- readFileSync(path.join(dir, '.agents', 'skills', 'acceptance', 'SKILL.md'), 'utf8'),
- ).toContain('version: 1.0.0');
- rmSync(dir, { force: true, recursive: true });
- });
-
- it('removes stale materialized resources on `acceptance update`', async () => {
- const dir = mkdtempSync(path.join(tmpdir(), 'acceptance-update-'));
- mockTrpcClient.verify.getSkillBundle.query.mockReset().mockResolvedValueOnce({
- content: '# Acceptance SKILL',
- files: {
- 'references/auth.md': '# Mixed auth',
- 'references/recording.md': '# Mixed recording',
- },
- identifier: 'acceptance',
- name: 'acceptance',
- });
- await run(['install', '--dir', dir]);
-
- mockTrpcClient.verify.getSkillBundle.query.mockResolvedValueOnce({
- content: '# Acceptance SKILL v2',
- files: {
- 'references/auth-web.md': '# Web auth',
- 'references/recording-cdp.md': '# CDP recording',
- },
- identifier: 'acceptance',
- name: 'acceptance',
- });
- await run(['update', '--dir', dir]);
-
- const skillDir = path.join(dir, '.agents', 'skills', 'acceptance');
- expect(existsSync(path.join(skillDir, 'references', 'auth.md'))).toBe(false);
- expect(existsSync(path.join(skillDir, 'references', 'recording.md'))).toBe(false);
- expect(existsSync(path.join(skillDir, 'references', 'auth-web.md'))).toBe(true);
- expect(existsSync(path.join(skillDir, 'references', 'recording-cdp.md'))).toBe(true);
- rmSync(dir, { force: true, recursive: true });
- });
-
it('does NOT attach the run subtree to the deprecated `verify acceptance` alias', async () => {
const program = new Command();
program.exitOverride();
diff --git a/apps/server/src/routers/lambda/__tests__/verify.test.ts b/apps/server/src/routers/lambda/__tests__/verify.test.ts
index 058a18b1b53..1343bcbd7f9 100644
--- a/apps/server/src/routers/lambda/__tests__/verify.test.ts
+++ b/apps/server/src/routers/lambda/__tests__/verify.test.ts
@@ -1,5 +1,6 @@
import { getHTTPStatusCodeFromError } from '@trpc/server/http';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { strToU8, zipSync } from 'fflate';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { createTRPCErrorLogger } from '@/libs/trpc/utils/errorLogger';
import { verifyRouter } from '@/server/routers/lambda/verify';
@@ -103,6 +104,8 @@ const selectRows = <T>(rows: T[]) => ({
});
describe('verifyRouter', () => {
+ afterEach(() => vi.restoreAllMocks());
+
beforeEach(() => {
vi.clearAllMocks();
modelMocks.getServerDB.mockResolvedValue({});
@@ -113,6 +116,78 @@ describe('verifyRouter', () => {
});
});
+ describe('getSkillBundle compatibility', () => {
+ const snapshot = {
+ content: '---\nname: acceptance\nmetadata:\n version: "0.5.0"\n---\n# Acceptance',
+ files: { 'scripts/capture.cjs': 'capture();', 'surfaces/cli.md': '# CLI' },
+ identifier: 'acceptance',
+ name: 'acceptance',
+ source: {
+ commit: 'a'.repeat(40),
+ path: 'skills/acceptance',
+ repository: 'lobehub/acceptance',
+ ref: 'HEAD',
+ },
+ version: '0.5.0',
+ };
+
+ const mockSnapshot = () => {
+ const files = { 'SKILL.md': snapshot.content, ...snapshot.files };
+ const zip = zipSync(
+ Object.fromEntries(
+ Object.entries(files).map(([file, text]) => [
+ `acceptance-${snapshot.source.commit}/skills/acceptance/${file}`,
+ strToU8(text),
+ ]),
+ ),
+ );
+ return vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValueOnce(Response.json({ sha: snapshot.source.commit }))
+ .mockResolvedValueOnce(new Response(new Uint8Array(zip).buffer));
+ };
+
+ it.each(['acceptance', 'verify'])(
+ 'serves the default-branch source to legacy %s callers',
+ async (identifier) => {
+ mockSnapshot();
+ expect(await createCaller().getSkillBundle({ identifier })).toEqual(snapshot);
+ },
+ );
+
+ it('keeps the old authentication requirement and unknown-identifier response', async () => {
+ const fetchSpy = vi.spyOn(globalThis, 'fetch');
+ await expect(
+ createPublicCaller().getSkillBundle({ identifier: 'acceptance' }),
+ ).rejects.toMatchObject({ code: 'UNAUTHORIZED' });
+ await expect(createCaller().getSkillBundle({ identifier: 'unknown' })).rejects.toMatchObject({
+ code: 'NOT_FOUND',
+ });
+ expect(fetchSpy).not.toHaveBeenCalled();
+ });
+
+ it('resolves an explicitly requested tag for newer clients', async () => {
+ const fetchSpy = mockSnapshot();
+
+ expect(
+ await createCaller().getSkillBundle({ identifier: 'acceptance', version: 'v0.5.0' }),
+ ).toEqual({ ...snapshot, source: { ...snapshot.source, ref: 'v0.5.0' } });
+ expect(fetchSpy).toHaveBeenCalledWith(
+ 'https://api.github.com/repos/lobehub/acceptance/commits/v0.5.0',
+ expect.any(Object),
+ );
+ });
+
+ it('does not initialize reporting services to download an authenticated public skill', async () => {
+ mockSnapshot();
+ modelMocks.getServerDB.mockRejectedValueOnce(new Error('Reporting database unavailable'));
+
+ expect(await createCaller().getSkillBundle({ identifier: 'acceptance' })).toEqual(snapshot);
+ expect(modelMocks.getServerDB).not.toHaveBeenCalled();
+ modelMocks.getServerDB.mockReset().mockResolvedValue({});
+ });
+ });
+
describe('generateCriteria', () => {
it('preserves InvalidProviderAPIKey without returning a session-expired HTTP status', async () => {
modelMocks.generateCriteria.mockRejectedValueOnce({ errorType: 'InvalidProviderAPIKey' });
diff --git a/apps/server/src/routers/lambda/verify.ts b/apps/server/src/routers/lambda/verify.ts
index f78e78ce4b5..601f60cc8f4 100644
--- a/apps/server/src/routers/lambda/verify.ts
+++ b/apps/server/src/routers/lambda/verify.ts
@@ -1,4 +1,4 @@
-import { AcceptanceSkill } from '@lobechat/builtin-skills';
+import { fetchAcceptanceSkillBundle } from '@lobechat/builtin-skills/acceptance';
import {
normalizeVerifySurface,
verifyRunScenarios,
@@ -56,21 +56,6 @@ import {
import { assertWorkspaceRowManageable } from './_helpers/assertWorkspaceRowManageable';
-/**
- * Skills that `verify.getSkillBundle` will materialize to a builder's disk via
- * `lh acceptance init`. Keyed by identifier; add future pullable skills here. The
- * portable acceptance skill lives in @lobechat/builtin-skills but is intentionally
- * NOT in its `builtinSkills` runtime array (kept out of the homogeneous agent
- * runtime / tool picker), so it is referenced directly here.
- *
- * The legacy `verify` identifier is kept as an alias so cached callers passing
- * `--skill verify` still resolve during the deprecation window.
- */
-const PULLABLE_SKILLS: Record<string, typeof AcceptanceSkill> = {
- [AcceptanceSkill.identifier]: AcceptanceSkill,
- verify: AcceptanceSkill,
-};
-
const verifierTypeSchema = z.enum(['program', 'agent', 'llm']);
const onFailSchema = z.enum(['manual', 'auto_repair']);
const decisionSchema = z.enum(['accepted', 'rejected', 'overridden']);
@@ -682,31 +667,27 @@ export const verifyRouter = router({
/**
* Serve a pullable skill bundle (`SKILL.md` + inline resource files) by
- * identifier so `lh verify init` can materialize it into a builder's working
- * directory. Dynamic-by-design: the source is the server's deployed
- * `@lobechat/builtin-skills`, so updating the skill + redeploying reaches every
- * builder on the next pull β€” no CLI re-release. Auth-gated (verifyProcedure);
- * returns NOT_FOUND for any identifier not in the pullable registry.
+ * identifier. Keep the authenticated contract and legacy alias while sourcing
+ * all installers from the upstream default branch (or an explicitly selected tag).
*/
- getSkillBundle: verifyProcedure.input(z.object({ identifier: z.string() })).query(({ input }) => {
- const skill = PULLABLE_SKILLS[input.identifier];
- if (!skill)
- throw new TRPCError({
- code: 'NOT_FOUND',
- message: `No pullable skill with identifier "${input.identifier}"`,
- });
- return {
- content: skill.content,
- files: Object.fromEntries(
- Object.entries(skill.resources ?? {}).map(([path, meta]) => [path, meta.content ?? '']),
- ),
- identifier: skill.identifier,
- name: skill.name,
- // The skill's own declared version, so an installer can compare a copy
- // already on disk against the latest bundle.
- version: skill.version,
- };
- }),
+ getSkillBundle: wsCompatProcedure
+ .input(
+ z.object({
+ identifier: z.string(),
+ version: z
+ .string()
+ .regex(/^v?\d+\.\d+\.\d+$/)
+ .optional(),
+ }),
+ )
+ .query(async ({ input }) => {
+ if (input.identifier !== 'acceptance' && input.identifier !== 'verify')
+ throw new TRPCError({
+ code: 'NOT_FOUND',
+ message: `No pullable skill with identifier "${input.identifier}"`,
+ });
+ return fetchAcceptanceSkillBundle(input.version);
+ }),
getVerifyState: verifyProcedure
.input(z.object({ operationId: z.string() }))
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 5e91e08de80..0c93f387847 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -130,6 +130,8 @@ const electronIpcRemoveListenerRestrictedSyntax = {
export default eslint(
{
ignores: [
+ // Generated skill release; maintained in lobehub/acceptance.
+ '.agents/skills/acceptance/**',
// dependencies
'node_modules',
// ci
diff --git a/package.json b/package.json
index f8299877af6..59e4773d4f6 100644
--- a/package.json
+++ b/package.json
@@ -149,7 +149,7 @@
},
"lint-staged": {
"*.md": [
- "remark --silent --output --",
+ "remark --silent --silently-ignore --output --",
"prettier --write --no-error-on-unmatched-pattern"
],
"*.mdx": [
diff --git a/packages/builtin-skills/package.json b/packages/builtin-skills/package.json
index 3435901b01d..a31cc70e3a7 100644
--- a/packages/builtin-skills/package.json
+++ b/packages/builtin-skills/package.json
@@ -5,11 +5,15 @@
"type": "module",
"exports": {
".": "./src/index.ts",
+ "./acceptance": "./src/acceptance/index.ts",
"./manifests": "./src/manifests.ts"
},
"main": "./src/index.ts",
"dependencies": {
- "@lobechat/artifact-template": "workspace:*"
+ "@lobechat/artifact-template": "workspace:*",
+ "fflate": "^0.8.3",
+ "yaml": "^2.9.0",
+ "zod": "^4.4.3"
},
"devDependencies": {
"@lobechat/types": "workspace:*"
diff --git a/packages/builtin-skills/src/acceptance/index.test.ts b/packages/builtin-skills/src/acceptance/index.test.ts
index 6cc57550919..0470b7905f0 100644
--- a/packages/builtin-skills/src/acceptance/index.test.ts
+++ b/packages/builtin-skills/src/acceptance/index.test.ts
@@ -1,80 +1,340 @@
-import { readdirSync, readFileSync } from 'node:fs';
-import path from 'node:path';
-import { fileURLToPath } from 'node:url';
-
-import { describe, expect, it } from 'vitest';
-
-import { AcceptanceSkill } from './index';
-
-const skillDir = path.dirname(fileURLToPath(import.meta.url));
-const readMarkdownBundle = (directory: string): string =>
- readdirSync(directory, { withFileTypes: true })
- .flatMap((entry) => {
- const filePath = path.join(directory, entry.name);
- if (entry.isDirectory()) return readMarkdownBundle(filePath);
- return entry.name.endsWith('.md') ? readFileSync(filePath, 'utf8') : [];
- })
- .join('\n');
-
-const listMarkdown = (directory: string): string[] =>
- readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
- const filePath = path.join(directory, entry.name);
- if (entry.isDirectory()) return listMarkdown(filePath);
- return entry.name.endsWith('.md') ? [path.relative(skillDir, filePath)] : [];
- });
-
-const skillContent = readFileSync(path.join(skillDir, 'SKILL.md'), 'utf8');
-const skillBundle = readMarkdownBundle(skillDir);
-
-describe('AcceptanceSkill', () => {
- it('exposes only the acceptance path in user-facing handoff guidance', () => {
- const internalRunPath = ['', 'verify'].join('/');
-
- expect(skillBundle).not.toContain(internalRunPath);
- expect(skillContent).toContain('/acceptance/<acceptanceId>');
- expect(skillContent).toContain(
- 'Put no images, local paths, local file links, or internal run-page paths',
+import { strToU8, zipSync } from 'fflate';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { fetchAcceptanceSkillBundle as fetchBundle } from './index';
+
+let fetchAcceptanceSkillBundle: typeof fetchBundle;
+
+const commit = 'a'.repeat(40);
+const content = '---\nname: acceptance\nmetadata:\n version: "0.5.0"\n---\n# Acceptance';
+const resources = {
+ 'LICENSE': 'Apache-2.0',
+ 'references/report.md': '\uFEFF# Reports',
+ 'scripts/nested/capture.cjs': 'capture();',
+};
+
+function archive(
+ sha = commit,
+ files: Record<string, string> = { 'SKILL.md': content, ...resources },
+) {
+ const root = `acceptance-${sha}`;
+ const data = zipSync({
+ [`${root}/README.md`]: strToU8('Not a skill resource'),
+ ...Object.fromEntries(
+ Object.entries(files).map(([file, text]) => [
+ `${root}/skills/acceptance/${file}`,
+ strToU8(text),
+ ]),
+ ),
+ });
+ return new Response(new Uint8Array(data).buffer);
+}
+
+function mockSource(sha = commit, files?: Record<string, string>) {
+ return vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValueOnce(Response.json({ sha }))
+ .mockResolvedValueOnce(archive(sha, files));
+}
+
+beforeEach(async () => {
+ vi.resetModules();
+ vi.stubEnv('GITHUB_TOKEN', '');
+ vi.spyOn(globalThis, 'fetch').mockRejectedValue(new Error('Unexpected network request'));
+ ({ fetchAcceptanceSkillBundle } = await import('./index'));
+});
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllEnvs();
+});
+
+describe('fetchAcceptanceSkillBundle', () => {
+ it('downloads the default branch snapshot with every skill resource from one commit', async () => {
+ const fetchSpy = mockSource();
+ expect(await fetchAcceptanceSkillBundle()).toEqual({
+ content,
+ files: resources,
+ identifier: 'acceptance',
+ name: 'acceptance',
+ source: {
+ commit,
+ path: 'skills/acceptance',
+ ref: 'HEAD',
+ repository: 'lobehub/acceptance',
+ },
+ version: '0.5.0',
+ });
+ expect(fetchSpy.mock.calls.map(([url]) => url)).toEqual([
+ 'https://api.github.com/repos/lobehub/acceptance/commits/HEAD',
+ `https://codeload.github.com/lobehub/acceptance/zip/${commit}`,
+ ]);
+ expect(new Headers(fetchSpy.mock.calls[0][1]?.headers).has('Authorization')).toBe(false);
+ });
+
+ it('sends the server token only to the commits API, not to codeload or the bundle', async () => {
+ vi.stubEnv('GITHUB_TOKEN', 'server-test-token');
+ const fetchSpy = mockSource();
+
+ const bundle = await fetchAcceptanceSkillBundle();
+
+ expect(new Headers(fetchSpy.mock.calls[0][1]?.headers).get('Authorization')).toBe(
+ 'Bearer server-test-token',
+ );
+ expect(new Headers(fetchSpy.mock.calls[1][1]?.headers).has('Authorization')).toBe(false);
+ expect(JSON.stringify(bundle)).not.toContain('server-test-token');
+ });
+
+ it('checks HEAD again but reuses the validated snapshot when its SHA is unchanged', async () => {
+ const fetchSpy = mockSource();
+ const first = await fetchAcceptanceSkillBundle();
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha: commit }));
+
+ expect(await fetchAcceptanceSkillBundle()).toEqual(first);
+ expect(fetchSpy.mock.calls.map(([url]) => url)).toEqual([
+ 'https://api.github.com/repos/lobehub/acceptance/commits/HEAD',
+ `https://codeload.github.com/lobehub/acceptance/zip/${commit}`,
+ 'https://api.github.com/repos/lobehub/acceptance/commits/HEAD',
+ ]);
+ });
+
+ it('shares an in-flight archive download without sharing ref resolution or response metadata', async () => {
+ const gate = Promise.withResolvers<void>();
+ const fetchSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (url) => {
+ if (String(url).startsWith('https://api.github.com/')) return Response.json({ sha: commit });
+ await gate.promise;
+ return archive();
+ });
+
+ const first = fetchAcceptanceSkillBundle();
+ const second = fetchAcceptanceSkillBundle('0.5.0');
+ await vi.waitFor(() => {
+ expect(
+ fetchSpy.mock.calls.filter(([url]) => String(url).includes('codeload')),
+ ).not.toHaveLength(0);
+ });
+ gate.resolve();
+ const [head, tag] = await Promise.all([first, second]);
+
+ expect(head.source).toMatchObject({ commit, ref: 'HEAD' });
+ expect(tag.source).toMatchObject({ commit, ref: 'v0.5.0' });
+ expect(head.files).toEqual(resources);
+ expect(tag.files).toEqual(resources);
+ expect(fetchSpy.mock.calls.map(([url]) => url)).toEqual([
+ 'https://api.github.com/repos/lobehub/acceptance/commits/HEAD',
+ 'https://api.github.com/repos/lobehub/acceptance/commits/v0.5.0',
+ `https://codeload.github.com/lobehub/acceptance/zip/${commit}`,
+ ]);
+ });
+
+ it('validates the requested tag even when HEAD already cached the same commit', async () => {
+ const fetchSpy = mockSource();
+ await fetchAcceptanceSkillBundle();
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha: commit }));
+
+ await expect(fetchAcceptanceSkillBundle('0.6.0')).rejects.toThrow('requested version');
+ expect(fetchSpy).toHaveBeenCalledTimes(3);
+ });
+
+ it('never returns a cached snapshot when the fresh HEAD lookup fails', async () => {
+ const fetchSpy = mockSource();
+ await fetchAcceptanceSkillBundle();
+ fetchSpy.mockResolvedValueOnce(new Response('Unavailable', { status: 503 }));
+
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow('503');
+ expect(fetchSpy).toHaveBeenCalledTimes(3);
+ });
+
+ it('bounds the snapshot cache to eight commits', async () => {
+ const fetchSpy = vi.spyOn(globalThis, 'fetch');
+ for (let index = 1; index <= 9; index++) {
+ const sha = index.toString(16).padStart(40, '0');
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha })).mockResolvedValueOnce(archive(sha));
+ expect((await fetchAcceptanceSkillBundle()).source.commit).toBe(sha);
+ }
+ const last = '9'.padStart(40, '0');
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha: last }));
+ expect((await fetchAcceptanceSkillBundle()).source.commit).toBe(last);
+
+ const first = '1'.padStart(40, '0');
+ fetchSpy
+ .mockResolvedValueOnce(Response.json({ sha: first }))
+ .mockResolvedValueOnce(archive(first));
+ expect((await fetchAcceptanceSkillBundle()).source.commit).toBe(first);
+ expect(fetchSpy).toHaveBeenCalledTimes(21);
+ });
+
+ it('takes a new default-branch commit even when the declared skill version is unchanged', async () => {
+ const next = 'b'.repeat(40);
+ const fetchSpy = mockSource();
+ const first = await fetchAcceptanceSkillBundle();
+ fetchSpy
+ .mockResolvedValueOnce(Response.json({ sha: next }))
+ .mockResolvedValueOnce(archive(next, { 'SKILL.md': content, 'new.md': 'unreleased change' }));
+
+ const second = await fetchAcceptanceSkillBundle();
+ expect(second.version).toBe(first.version);
+ expect(second.source.commit).toBe(next);
+ expect(second.files).toEqual({ 'new.md': 'unreleased change' });
+ });
+
+ it('resolves a newer HEAD even while the preceding HEAD snapshot is still downloading', async () => {
+ const next = 'b'.repeat(40);
+ const gate = Promise.withResolvers<void>();
+ let resolutions = 0;
+ const fetchSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (url) => {
+ if (String(url) === 'https://api.github.com/repos/lobehub/acceptance/commits/HEAD') {
+ return Response.json({ sha: resolutions++ === 0 ? commit : next });
+ }
+ if (String(url).endsWith(commit)) {
+ await gate.promise;
+ return archive();
+ }
+ return archive(next, { 'SKILL.md': content, 'new.md': 'new HEAD' });
+ });
+ const first = fetchAcceptanceSkillBundle();
+ try {
+ await vi.waitFor(() => expect(fetchSpy).toHaveBeenCalledTimes(2));
+ const second = await fetchAcceptanceSkillBundle();
+ expect(second.source.commit).toBe(next);
+ expect(second.files).toEqual({ 'new.md': 'new HEAD' });
+ } finally {
+ gate.resolve();
+ }
+ expect((await first).source.commit).toBe(commit);
+ });
+
+ it('allows a development version on the default branch without a stable release', async () => {
+ mockSource(commit, { 'SKILL.md': content.replace('0.5.0', '0.6.0-dev.1') });
+ expect((await fetchAcceptanceSkillBundle()).version).toBe('0.6.0-dev.1');
+ });
+
+ it.each(['0.5.0', 'v0.5.0'])('can select a tag explicitly (%s)', async (version) => {
+ const fetchSpy = mockSource();
+ const bundle = await fetchAcceptanceSkillBundle(version);
+ expect(bundle.source).toMatchObject({ commit, ref: 'v0.5.0' });
+ expect(fetchSpy.mock.calls[0][0]).toBe(
+ 'https://api.github.com/repos/lobehub/acceptance/commits/v0.5.0',
);
});
- it('ships every reference on disk β€” an unregistered file never reaches a builder', () => {
- // The bundle is built from `resources`, not from the directory: a reference
- // added to the folder but not registered here is invisible to every puller
- // while still looking present in the repo.
- const onDisk = listMarkdown(skillDir)
- .filter((file) => file !== 'SKILL.md')
- .sort();
+ it('reports failed source resolution without requesting an archive or release', async () => {
+ const fetchSpy = vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(new Response('Unavailable', { status: 503 }));
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow('503');
+ expect(fetchSpy).toHaveBeenCalledTimes(1);
+ });
+
+ it('reports archive download failures', async () => {
+ vi.spyOn(globalThis, 'fetch')
+ .mockResolvedValueOnce(Response.json({ sha: commit }))
+ .mockResolvedValueOnce(new Response('Unavailable', { status: 404 }));
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow('404');
+ });
+
+ it.each(['download', 'validation'])('does not cache a failed %s', async (failure) => {
+ const fetchSpy = vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValueOnce(Response.json({ sha: commit }))
+ .mockResolvedValueOnce(
+ failure === 'download'
+ ? new Response('Unavailable', { status: 503 })
+ : archive(commit, { 'SKILL.md': content, '../outside': 'unsafe' }),
+ );
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow();
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha: commit })).mockResolvedValueOnce(archive());
- expect(Object.keys(AcceptanceSkill.resources ?? {}).sort()).toEqual(onDisk);
+ expect((await fetchAcceptanceSkillBundle()).files).toEqual(resources);
+ expect(fetchSpy).toHaveBeenCalledTimes(4);
});
- it('carries a version parsed from its own SKILL.md frontmatter', () => {
- // The version must reach the bundle, not just sit in the markdown: an
- // installer compares `bundle.version` against the copy already on disk, and
- // a version only a human can read makes that impossible.
- expect(skillContent).toMatch(/^version: \d+\.\d+\.\d+$/m);
- expect(AcceptanceSkill.version).toMatch(/^\d+\.\d+\.\d+$/);
+ it.each<{ body: string; headers: HeadersInit; message: string; status: number }>([
+ {
+ body: 'API rate limit exceeded',
+ headers: {
+ 'retry-after': '45',
+ 'x-ratelimit-remaining': '0',
+ 'x-ratelimit-reset': '2000000000',
+ },
+ message: 'Retry after 45 seconds.',
+ status: 403,
+ },
+ {
+ body: 'API rate limit exceeded',
+ headers: { 'x-ratelimit-remaining': '0', 'x-ratelimit-reset': '2000000000' },
+ message: 'Retry after 2033-05-18T03:33:20.000Z.',
+ status: 403,
+ },
+ {
+ body: 'You have exceeded a secondary rate limit',
+ headers: {},
+ message: 'Retry after at least 60 seconds.',
+ status: 403,
+ },
+ {
+ body: 'Too many requests',
+ headers: {},
+ message: 'Retry after at least 60 seconds.',
+ status: 429,
+ },
+ {
+ body: 'Too many requests',
+ headers: { 'retry-after': 'Wed, 18 May 2033 03:33:20 GMT' },
+ message: 'Retry after Wed, 18 May 2033 03:33:20 GMT.',
+ status: 429,
+ },
+ ])(
+ 'reports a rate limit with $message without retrying',
+ async ({ body, headers, message, status }) => {
+ const fetchSpy = vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(new Response(body, { headers, status }));
+
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow(
+ `GitHub rate limit exceeded (${status}). ${message}`,
+ );
+ expect(fetchSpy).toHaveBeenCalledTimes(1);
+ },
+ );
+
+ it('does not label a permission-denied 403 as rate limiting', async () => {
+ const fetchSpy = vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(new Response('Forbidden', { status: 403 }));
+
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow(
+ 'Unable to download the acceptance skill (403)',
+ );
+ expect(fetchSpy).toHaveBeenCalledTimes(1);
});
- it('names no host environment variable β€” the skill needs no ambient ids', () => {
- // The skill is portable and runs anywhere. Instructing a builder to read
- // `$LOBEHUB_TOPIC_ID` / `$LOBE_OPERATION_ID` both couples it to one host and
- // invites it to hunt for an id that is absent by design; the CLI resolves
- // subject and origin from its own env without the agent's help.
- expect(skillBundle).not.toMatch(/LOBEHUB_[A-Z_]+/);
- expect(skillBundle).not.toMatch(/LOBE_OPERATION_ID/);
+ it.each(['../outside', '/outside', 'C:/outside', 'references/../../outside', 'a\\b', 'skill.md'])(
+ 'rejects an unsafe resource path: %s',
+ async (file) => {
+ mockSource(commit, { 'SKILL.md': content, [file]: 'unsafe' });
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow('relative paths');
+ },
+ );
+
+ it('rejects missing skill content and mismatched tag versions', async () => {
+ const fetchSpy = mockSource(commit, { 'other.md': '# Other' });
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow('SKILL.md');
+ fetchSpy.mockResolvedValueOnce(Response.json({ sha: commit })).mockResolvedValueOnce(archive());
+ await expect(fetchAcceptanceSkillBundle('0.6.0')).rejects.toThrow('requested version');
});
- it('routes to the project layer before touching an environment', () => {
- expect(skillContent).toContain('.agents/acceptance/');
- expect(skillContent).toContain('PROCESS.md');
- expect(skillContent).toContain('project-adapter.md');
+ it('rejects a malformed commit response before downloading an archive', async () => {
+ const fetchSpy = vi
+ .spyOn(globalThis, 'fetch')
+ .mockResolvedValue(Response.json({ sha: 'HEAD' }));
+ await expect(fetchAcceptanceSkillBundle()).rejects.toThrow();
+ expect(fetchSpy).toHaveBeenCalledTimes(1);
});
- it('keeps the latest evidence and multi-round acceptance contracts', () => {
- expect(skillBundle).toContain('Dual text evidence for non-visual behavior');
- expect(skillContent).toContain('lh acceptance view <acceptanceId | type:id> --json');
- expect(skillContent).toContain("supersedes: ['old-id']");
- expect(skillContent).toContain('--requirement "<one-sentence business goal>"');
+ it('rejects non-version values before requesting a tag', async () => {
+ const fetchSpy = vi.spyOn(globalThis, 'fetch');
+ await expect(fetchAcceptanceSkillBundle('master')).rejects.toThrow('version');
+ expect(fetchSpy).not.toHaveBeenCalled();
});
});
diff --git a/packages/builtin-skills/src/acceptance/index.ts b/packages/builtin-skills/src/acceptance/index.ts
index 94637bb5114..28e534ccd40 100644
--- a/packages/builtin-skills/src/acceptance/index.ts
+++ b/packages/builtin-skills/src/acceptance/index.ts
@@ -1,87 +1,158 @@
-import type { BuiltinSkill } from '@lobechat/types';
+import { unzip } from 'fflate';
+import { z } from 'zod';
-import { readSkillVersion, toResourceMeta } from '../lobehub/helpers';
-import acceptanceChecker from './references/acceptance-checker.md';
-import agentBrowser from './references/agent-browser.md';
-import authWeb from './references/auth-web.md';
-import commonMistakes from './references/common-mistakes.md';
-import computerUse from './references/computer-use.md';
-import evidence from './references/evidence.md';
-import interactionCost from './references/interaction-cost.md';
-import planFormat from './references/plan-format.md';
-import probeMockPatterns from './references/probe-mock-patterns.md';
-import projectAdapter from './references/project-adapter.md';
-import recordingCdp from './references/recording-cdp.md';
-import recordingIosSimulator from './references/recording-ios-simulator.md';
-import recordingNativeMacos from './references/recording-native-macos.md';
-import report from './references/report.md';
-import content from './SKILL.md';
-import cli from './surfaces/cli.md';
-import electron from './surfaces/electron.md';
-import iosSimulator from './surfaces/ios-simulator.md';
-import native from './surfaces/native.md';
-import web from './surfaces/web.md';
+import { readSkillVersion } from '../lobehub/helpers';
export const AcceptanceIdentifier = 'acceptance';
+const repository = 'lobehub/acceptance';
+const skillPath = 'skills/acceptance';
+const commitSchema = z.object({ sha: z.string().regex(/^[a-f\d]{40}$/) });
-/**
- * The single builder-side acceptance skill: discover or author the plan β†’ pick a
- * surface β†’ capture evidence per criterion β†’ publish a round β†’ self-check
- * coverage. It runs from any task's working directory, with or without a LobeHub
- * operation/topic, and depends on no repository-local script. Surface-specific
- * tools stay explicit: agent-browser for Web/Electron, shell-level native
- * automation for macOS, and an installed Simulator HID/Accessibility CLI plus
- * Xcode/simctl for iOS.
- *
- * Everything a specific repository needs on top β€” its start/stop commands, its
- * plan gate and teardown, its own living logs and probe scripts β€” lives in
- * that repository's `.agents/acceptance/` project layer, which SKILL.md reads
- * first. This split replaced the former repo-local `agent-testing` skill: the
- * contract is here, the repository's process is there, and neither restates the
- * other.
- *
- * The references carry the shared contracts and surface-scoped operating
- * manuals. Authentication and recording resources are split by runtime so a
- * selected surface never needs to load another platform's instructions.
- *
- * Resource keys keep the `.md` extension so a disk pull
- * (`.agents/skills/acceptance/references/*.md`) maps 1:1 to real files and the
- * in-SKILL relative links resolve.
- *
- * `version` is read from SKILL.md's own frontmatter rather than declared here,
- * so there is one place to bump and an installed copy on disk always states the
- * version it carries. Bump it whenever a change alters what a builder must DO β€”
- * a new required step, a changed contract or vocabulary, a moved reference β€”
- * not for a typo or a reworded sentence.
- */
-export const AcceptanceSkill: BuiltinSkill = {
- avatar: 'βœ…',
- content,
- description:
- 'End-to-end verification and self-evidence for a delivery in any repository, with or without a LobeHub operation or verify plan β€” discover or author checks, drive CLI, web, desktop, or iOS Simulator on the correct surface, capture visually confirmed evidence, and publish a standalone or subject-linked acceptance round. Reads the repository’s own `.agents/acceptance/` project layer when one exists.',
- identifier: AcceptanceIdentifier,
- name: 'acceptance',
- resources: toResourceMeta({
- 'references/acceptance-checker.md': acceptanceChecker,
- 'references/agent-browser.md': agentBrowser,
- 'references/common-mistakes.md': commonMistakes,
- 'references/auth-web.md': authWeb,
- 'references/computer-use.md': computerUse,
- 'references/evidence.md': evidence,
- 'references/interaction-cost.md': interactionCost,
- 'references/plan-format.md': planFormat,
- 'references/probe-mock-patterns.md': probeMockPatterns,
- 'references/project-adapter.md': projectAdapter,
- 'references/recording-cdp.md': recordingCdp,
- 'references/recording-ios-simulator.md': recordingIosSimulator,
- 'references/recording-native-macos.md': recordingNativeMacos,
- 'references/report.md': report,
- 'surfaces/cli.md': cli,
- 'surfaces/electron.md': electron,
- 'surfaces/ios-simulator.md': iosSimulator,
- 'surfaces/native.md': native,
- 'surfaces/web.md': web,
+const versionSchema = z
+ .string()
+ .regex(/^\d+\.\d+\.\d+$/, 'Expected a stable version such as 0.5.0');
+const resourcePathSchema = z
+ .string()
+ .refine(
+ (file) =>
+ !file.includes('\\') &&
+ !file.includes(':') &&
+ !file.includes('\0') &&
+ file.toLowerCase() !== 'skill.md' &&
+ file.split('/').every((part) => part !== '' && part !== '.' && part !== '..'),
+ 'Skill resources must have relative paths inside the skill directory',
+ );
+
+const bundleSchema = z.object({
+ content: z.string().min(1),
+ files: z.record(resourcePathSchema, z.string()),
+ identifier: z.literal(AcceptanceIdentifier),
+ name: z.literal('acceptance'),
+ source: z.object({
+ commit: z.string().regex(/^[a-f\d]{40}$/),
+ path: z.literal('skills/acceptance'),
+ repository: z.literal('lobehub/acceptance'),
+ ref: z.string(),
}),
- source: 'builtin',
- version: readSkillVersion(content),
-};
+ version: z.string().min(1),
+});
+
+export type AcceptanceSkillBundle = z.infer<typeof bundleSchema>;
+
+const snapshotSchema = bundleSchema.pick({ content: true, files: true, version: true });
+type SkillSnapshot = z.infer<typeof snapshotSchema>;
+
+// Per-process content cache only: mutable refs are always resolved remotely.
+const MAX_CACHED_SNAPSHOTS = 8;
+const snapshots = new Map<string, SkillSnapshot>();
+const pendingSnapshots = new Map<string, Promise<SkillSnapshot>>();
+
+async function download(url: string, headers?: HeadersInit): Promise<Response> {
+ const response = await fetch(url, {
+ cache: 'no-store',
+ headers,
+ signal: AbortSignal.timeout(30_000),
+ });
+ if (!response.ok) {
+ if (response.status === 403 || response.status === 429) {
+ const retryAfter = response.headers.get('retry-after');
+ const remaining = response.headers.get('x-ratelimit-remaining');
+ const reset = response.headers.get('x-ratelimit-reset');
+ const rateLimited =
+ response.status === 429 ||
+ retryAfter ||
+ remaining === '0' ||
+ /secondary rate limit|API rate limit exceeded/i.test(await response.text());
+
+ if (rateLimited) {
+ let advice = 'Retry after at least 60 seconds.';
+ if (retryAfter) {
+ advice = /^\d+$/.test(retryAfter)
+ ? `Retry after ${retryAfter} seconds.`
+ : `Retry after ${retryAfter}.`;
+ } else if (remaining === '0' && reset) {
+ const retryAt = new Date(Number(reset) * 1000);
+ if (Number.isFinite(retryAt.getTime())) advice = `Retry after ${retryAt.toISOString()}.`;
+ }
+ throw new Error(`GitHub rate limit exceeded (${response.status}). ${advice}`);
+ }
+ }
+ throw new Error(`Unable to download the acceptance skill (${response.status}): ${url}`);
+ }
+ return response;
+}
+
+async function downloadSnapshot(sha: string): Promise<SkillSnapshot> {
+ const archiveResponse = await download(`https://codeload.github.com/${repository}/zip/${sha}`);
+ const prefix = `acceptance-${sha}/${skillPath}/`;
+ const archive = new Uint8Array(await archiveResponse.arrayBuffer());
+ const entries = await new Promise<Record<string, Uint8Array>>((resolve, reject) => {
+ unzip(
+ archive,
+ { filter: ({ name }) => name.startsWith(prefix) && !name.endsWith('/') },
+ (error, files) => {
+ if (error) reject(error);
+ else resolve(files);
+ },
+ );
+ });
+ const decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
+ const { 'SKILL.md': content, ...files } = Object.fromEntries(
+ Object.entries(entries).map(([file, data]) => [
+ file.slice(prefix.length),
+ decoder.decode(data),
+ ]),
+ );
+ if (!content) throw new Error('Acceptance source archive is missing SKILL.md');
+
+ // Only validated content can enter the cache or reach an installer.
+ return snapshotSchema.parse({ content, files, version: readSkillVersion(content) });
+}
+
+async function getSnapshot(sha: string): Promise<SkillSnapshot> {
+ const cached = snapshots.get(sha);
+ if (cached) return cached;
+ const pending = pendingSnapshots.get(sha);
+ if (pending) return pending;
+
+ const download = downloadSnapshot(sha);
+ pendingSnapshots.set(sha, download);
+ try {
+ const snapshot = await download;
+ snapshots.set(sha, snapshot);
+ if (snapshots.size > MAX_CACHED_SNAPSHOTS) {
+ const oldest = snapshots.keys().next().value;
+ if (oldest !== undefined) snapshots.delete(oldest);
+ }
+ return snapshot;
+ } finally {
+ pendingSnapshots.delete(sha);
+ }
+}
+
+/** Resolve HEAD/tag on every request, then reuse only that immutable commit's content. */
+export async function fetchAcceptanceSkillBundle(version?: string): Promise<AcceptanceSkillBundle> {
+ const requestedVersion =
+ version === undefined ? undefined : versionSchema.parse(version.replace(/^v/, ''));
+ const ref = requestedVersion ? `v${requestedVersion}` : 'HEAD';
+ const token = process.env.GITHUB_TOKEN;
+ const commitResponse = await download(
+ `https://api.github.com/repos/${repository}/commits/${ref}`,
+ {
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
+ Accept: 'application/vnd.github+json',
+ },
+ );
+ const { sha } = commitSchema.parse(await commitResponse.json());
+ const snapshot = await getSnapshot(sha);
+ if (requestedVersion !== undefined && snapshot.version !== requestedVersion) {
+ throw new Error('Acceptance source does not match the requested version');
+ }
+ return {
+ ...snapshot,
+ files: { ...snapshot.files },
+ identifier: AcceptanceIdentifier,
+ name: 'acceptance',
+ source: { commit: sha, path: skillPath, ref, repository },
+ };
+}
diff --git a/packages/builtin-skills/src/index.ts b/packages/builtin-skills/src/index.ts
index 7d11c1c64bf..437adebce6f 100644
--- a/packages/builtin-skills/src/index.ts
+++ b/packages/builtin-skills/src/index.ts
@@ -27,16 +27,6 @@ export {
type ReactArtifactTemplateOverrides,
} from '@lobechat/artifact-template';
-/**
- * The portable verify skill is distributed to external builders (Claude Code /
- * Codex) by pulling it to disk (`lh acceptance install`), NOT by loading it into the
- * homogeneous agent runtime. So it is exported as a named skill for the pull
- * endpoint to import directly, but deliberately left OUT of `builtinSkills`
- * below β€” keeping it out of every app-layer consumer of that array (server
- * runtime, agentDocumentVfs, tool store / picker).
- */
-export { AcceptanceIdentifier, AcceptanceSkill } from './acceptance';
-
export const builtinSkills: BuiltinSkill[] = [
AgentBrowserSkill,
ArtifactsSkill,
diff --git a/packages/builtin-skills/src/lobehub/helpers.test.ts b/packages/builtin-skills/src/lobehub/helpers.test.ts
index 97d5ca19dd3..d556eea662e 100644
--- a/packages/builtin-skills/src/lobehub/helpers.test.ts
+++ b/packages/builtin-skills/src/lobehub/helpers.test.ts
@@ -5,6 +5,19 @@ import { readSkillVersion } from './helpers';
const skill = (frontmatter: string) => `---\n${frontmatter}\n---\n\n# Body\n`;
describe('readSkillVersion', () => {
+ it('reads metadata.version from an independently distributed Agent Skill', () => {
+ expect(readSkillVersion(skill('name: acceptance\nmetadata:\n version: "0.5.0"'))).toBe(
+ '0.5.0',
+ );
+ expect(readSkillVersion(skill('version: 0.4.3\nmetadata: {version: "0.5.0"}'))).toBe('0.5.0');
+ });
+
+ it('does not confuse a description with nested metadata or accept invalid YAML', () => {
+ expect(
+ readSkillVersion(skill('description: |\n metadata:\n version: "9.0.0"')),
+ ).toBeUndefined();
+ expect(readSkillVersion(skill('metadata: [invalid'))).toBeUndefined();
+ });
it('reads the version declared in the frontmatter', () => {
expect(readSkillVersion(skill('name: acceptance\nversion: 1.2.3'))).toBe('1.2.3');
});
diff --git a/packages/builtin-skills/src/lobehub/helpers.ts b/packages/builtin-skills/src/lobehub/helpers.ts
index d67bd898b21..8c973236293 100644
--- a/packages/builtin-skills/src/lobehub/helpers.ts
+++ b/packages/builtin-skills/src/lobehub/helpers.ts
@@ -1,4 +1,6 @@
import type { SkillResourceMeta } from '@lobechat/types';
+import { parseDocument } from 'yaml';
+import { z } from 'zod';
/**
* Convert a simple path→content map to Record<string, SkillResourceMeta>.
@@ -21,30 +23,19 @@ export const toResourceMeta = (
/** Matches only the leading YAML frontmatter block of a `SKILL.md`. */
const FRONTMATTER_BLOCK = /^---\r?\n([\S\s]*?)\r?\n---/;
-/**
- * Read a skill's declared `version` out of its `SKILL.md` frontmatter.
- *
- * The frontmatter is the single source of truth: the same file is what gets
- * materialized onto a builder's disk, so an installed copy always carries the
- * version it was installed at β€” which is what makes an install-time
- * "your copy is N, latest is M" comparison possible without a side-car marker
- * file that can drift from the content it describes.
- *
- * Deliberately a small regex rather than a YAML parser: this package is imported
- * by the server, the CLI, and the desktop workspace stub, and one scalar field
- * does not justify a parser dependency in all three. The key must sit at column
- * zero, so an indented `version:` inside a block scalar (`description: >`) is
- * correctly ignored.
- */
+const skillVersionSchema = z.object({
+ metadata: z.object({ version: z.string().optional() }).optional(),
+ version: z.string().optional(),
+});
+
+/** Read Agent Skills metadata.version, with support for legacy top-level version. */
export const readSkillVersion = (content: string): string | undefined => {
const block = FRONTMATTER_BLOCK.exec(content)?.[1];
if (!block) return undefined;
- const line = block.split(/\r?\n/).find((entry) => entry.startsWith('version:'));
- const value = line
- ?.slice('version:'.length)
- .trim()
- .replaceAll(/^['"]|['"]$/g, '');
-
- return value || undefined;
+ const document = parseDocument(block);
+ if (document.errors.length > 0) return undefined;
+ const result = skillVersionSchema.safeParse(document.toJS());
+ if (!result.success) return undefined;
+ return (result.data.metadata?.version ?? result.data.version)?.trim() || undefined;
};