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): support standalone and iOS simulator verification (#17840)

Innei1b280c131b6a
diff --git a/apps/cli/src/commands/acceptanceRun.ts b/apps/cli/src/commands/acceptanceRun.ts
index f0dbadda764..94f490dfba9 100644
--- a/apps/cli/src/commands/acceptanceRun.ts
+++ b/apps/cli/src/commands/acceptanceRun.ts
@@ -1,4 +1,5 @@
-import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { randomUUID } from 'node:crypto';
+import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { acceptanceSubjectTypes } from '@lobechat/const/verify';
@@ -51,6 +52,15 @@ interface InstallOptions {
skill: string;
}
+const listMaterializedFiles = (directory: string): string[] => {
+ if (!existsSync(directory)) return [];
+
+ return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
+ const entryPath = path.join(directory, entry.name);
+ return entry.isDirectory() ? listMaterializedFiles(entryPath) : [entryPath];
+ });
+};
+
async function installAction(options: InstallOptions): Promise<void> {
const client = await getTrpcClient();
// Pulled live from the server's deployed builtin-skills โ€” always the latest.
@@ -81,13 +91,36 @@ async function installAction(options: InstallOptions): Promise<void> {
written.push(rel);
}
+ // `acceptance update` is an explicit force-refresh of a materialized skill,
+ // not a merge into a hand-maintained directory. Remove files that belonged to
+ // an older bundle so renamed/split references cannot remain discoverable.
+ const removed: string[] = [];
+ if (options.force) {
+ const currentEntries = new Set(entries.map(([rel]) => path.normalize(rel)));
+ for (const file of listMaterializedFiles(skillDir)) {
+ const relativePath = path.relative(skillDir, file);
+ if (currentEntries.has(path.normalize(relativePath))) continue;
+
+ rmSync(file, { force: true });
+ removed.push(relativePath.split(path.sep).join('/'));
+ }
+ }
+
const link = linkHarnessSkills(baseDir, bundle.identifier);
const ignored =
options.gitignore === false
? []
: ensureSkillIgnored(baseDir, bundle.identifier, link.kind === 'linked');
- const result = { dir: skillDir, ignored, link, skill: bundle.identifier, skipped, written };
+ const result = {
+ dir: skillDir,
+ ignored,
+ link,
+ removed,
+ skill: bundle.identifier,
+ skipped,
+ written,
+ };
if (options.json !== undefined) {
outputJson(result, typeof options.json === 'string' ? options.json : undefined);
return;
@@ -95,7 +128,9 @@ async function installAction(options: InstallOptions): Promise<void> {
console.log(
`${pc.green('โœ“')} ${pc.bold(bundle.name)} skill โ†’ ${pc.dim(path.relative(process.cwd(), skillDir) || skillDir)}`,
);
- console.log(` ${written.length} written${skipped.length ? `, ${skipped.length} skipped` : ''}`);
+ console.log(
+ ` ${written.length} written${skipped.length ? `, ${skipped.length} skipped` : ''}${removed.length ? `, ${removed.length} stale removed` : ''}`,
+ );
if (skipped.length > 0) console.log(pc.dim(` (skipped existing โ€” pass --force to overwrite)`));
printWiring(link, ignored);
}
@@ -478,6 +513,7 @@ async function reportGetAction(runId: string, options: { json?: boolean | string
// โ”€โ”€ ingest-report (aggregate convenience over the atomic commands) โ”€โ”€
interface IngestReportOptions {
+ acceptance?: string;
goal?: string;
json?: boolean | string;
open?: boolean;
@@ -555,10 +591,29 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption
// results by `id`, so the report can show a planned item that never ran.
const plan = planFromResult(result);
- // Every agent-testing report belongs to an acceptance. Explicit CLI input
- // wins, then result.json, then the authoring topic echoed by the runtime.
+ const goal = options.goal ?? (typeof result.focus === 'string' ? result.focus : undefined);
+ const title = options.title ?? result.title;
+ // The title is the run's identity in every list surface โ€” an untitled
+ // run renders as a placeholder forever, so say so before it ships.
+ if (!title) {
+ log.warn(
+ 'result.json has no "title" โ€” the run will list as untitled; set result.title (or pass --title)',
+ );
+ }
+
+ const requestedAcceptanceId = options.acceptance?.trim();
+ if (requestedAcceptanceId && (options.subject || result.subject)) {
+ log.error(
+ 'Choose one acceptance target: pass --acceptance <id>, or use --subject/result.json `subject`.',
+ );
+ process.exit(1);
+ }
+
+ // Explicit subject input wins, then result.json, then the authoring topic.
+ // An external repository has none of those, so create a first-class
+ // standalone subject instead of making the caller manufacture a Task ID.
let subject = subjectFromResult(result);
- if (options.subject) {
+ if (!requestedAcceptanceId && options.subject) {
const ref = parseSubjectRef(options.subject);
if (!ref) {
log.error(
@@ -567,30 +622,40 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption
process.exit(1);
}
subject = { ref, requirement: subject?.requirement };
- } else if (result.subject && !subject) {
+ } else if (!requestedAcceptanceId && result.subject && !subject) {
log.error('result.json `subject` is malformed (expected "type:id" or {type,id})');
process.exit(1);
- } else if (!subject) {
+ } else if (!requestedAcceptanceId && !subject) {
const ref = subjectFromEnv();
if (ref) subject = { ref };
}
- if (!subject) {
- log.error(
- 'Acceptance subject is required: run inside a LobeHub topic or pass --subject task:<id> | topic:<id> | document:<id>',
- );
- process.exit(1);
+ if (!requestedAcceptanceId && !subject) {
+ subject = {
+ ref: { subjectId: randomUUID(), subjectType: 'standalone' },
+ };
}
const requirement = options.requirement ?? subject?.requirement;
const client = await getTrpcClient();
- const goal = options.goal ?? (typeof result.focus === 'string' ? result.focus : undefined);
- const title = options.title ?? result.title;
- // The title is the run's identity in every list surface โ€” an untitled
- // run renders as a placeholder forever, so say so before it ships.
- if (!title) {
- log.warn(
- 'result.json has no "title" โ€” the run will list as untitled; set result.title (or pass --title)',
- );
+ let acceptance;
+ if (requestedAcceptanceId) {
+ const bundle = await client.acceptance.getBundle.query({ id: requestedAcceptanceId });
+ acceptance = bundle.acceptance;
+ subject = {
+ ref: {
+ subjectId: acceptance.subjectId,
+ subjectType: acceptance.subjectType,
+ },
+ };
+ } else {
+ acceptance = await client.acceptance.ensure.mutate({
+ requirement,
+ subjectId: subject!.ref.subjectId,
+ subjectType: subject!.ref.subjectType,
+ ...(subject!.ref.subjectType === 'standalone' && (title || goal)
+ ? { title: title || goal }
+ : {}),
+ });
}
// The in-app conversation that ran this harness, if any (env-supplied).
// Strictly the authoring conversation. `--operation` names the Agent Run
@@ -598,11 +663,6 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption
const origin = originFromEnv();
const newRunMetadata = metadataForReport(result, undefined, origin);
- const acceptance = await client.acceptance.ensure.mutate({
- requirement,
- subjectId: subject.ref.subjectId,
- subjectType: subject.ref.subjectType,
- });
if (acceptance.status === 'accepted' || acceptance.status === 'closed') {
log.error(
`Acceptance is already ${acceptance.status}. Reopen it before publishing another round.`,
@@ -740,7 +800,7 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption
pullRequest,
roundIndex,
scenario,
- subject: subject.ref,
+ subject: subject!.ref,
unplanned,
verifyRunId: runId,
},
@@ -764,9 +824,11 @@ async function ingestReportAction(reportDir: string, options: IngestReportOption
if (pullRequest?.url) console.log(`${pc.bold('pr')}: ${pullRequest.url}`);
if (origin?.topicId) console.log(`${pc.bold('origin topic')}: ${origin.topicId}`);
console.log(`${pc.bold('verifyRunId')}: ${runId} ${pc.dim('(immutable snapshot)')}`);
- console.log(
- `${pc.bold('acceptance')}: ${acceptanceId} ${pc.dim(`(${subject.ref.subjectType}:${subject.ref.subjectId})`)}`,
- );
+ const subjectLabel =
+ subject!.ref.subjectType === 'standalone'
+ ? 'standalone'
+ : `${subject!.ref.subjectType}:${subject!.ref.subjectId}`;
+ console.log(`${pc.bold('acceptance')}: ${acceptanceId} ${pc.dim(`(${subjectLabel})`)}`);
if (options.open) {
// The acceptance page is the only link surfaced to users โ€” the raw /verify
// page stays internal. `?r=<roundIndex>` is this round's fixed snapshot.
@@ -871,11 +933,12 @@ function withIngestReportOptions(cmd: Command): Command {
return cmd
.option('--source <source>', 'agent | agent-testing', 'agent-testing')
.option('--operation <id>', 'Link the session to an existing Agent Run')
+ .option('--acceptance <id>', 'Append this round to an existing acceptance')
.option('--title <title>', 'Override the session title')
.option('--goal <goal>', 'The goal/task being verified')
.option(
'--subject <type:id>',
- 'Override the required acceptance subject (defaults to the current LOBEHUB_TOPIC_ID)',
+ 'Attach to a task/topic/document (defaults to the current topic; otherwise standalone)',
)
.option(
'--requirement <text>',
@@ -904,7 +967,9 @@ export function attachAcceptanceRunCommands(acceptance: Command): void {
withInstallOptions(
acceptance
.command('update')
- .description('Re-pull the acceptance skill, overwriting local files and re-wiring harnesses'),
+ .description(
+ 'Re-pull the acceptance skill, replacing its materialized 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 ee781f462d6..ec1b6559f85 100644
--- a/apps/cli/src/commands/verify.test.ts
+++ b/apps/cli/src/commands/verify.test.ts
@@ -601,6 +601,7 @@ describe('verify ingest-report โ€” every run is an immutable acceptance round',
mockTrpcClient.acceptance = {
attachRun: { mutate: vi.fn() },
ensure: { mutate: vi.fn().mockResolvedValue({ id: 'acceptance-1' }) },
+ getBundle: { query: vi.fn() },
};
dir = mkdtempSync(path.join(tmpdir(), 'lh-ingest-'));
@@ -639,6 +640,51 @@ describe('verify ingest-report โ€” every run is an immutable acceptance round',
});
});
+ it('creates a standalone acceptance when an external project has no operation or subject', async () => {
+ delete process.env.LOBEHUB_TOPIC_ID;
+ writeFileSync(
+ path.join(dir, 'result.json'),
+ JSON.stringify({ cases: [], title: 'External delivery verification' }),
+ );
+
+ await run(['ingest-report', dir, '--json']);
+
+ expect(mockTrpcClient.acceptance.ensure.mutate).toHaveBeenCalledWith({
+ requirement: undefined,
+ subjectId: expect.stringMatching(
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
+ ),
+ subjectType: 'standalone',
+ title: 'External delivery verification',
+ });
+ expect(mockTrpcClient.acceptance.attachRun.mutate).toHaveBeenCalledWith({
+ acceptanceId: 'acceptance-1',
+ verifyRunId: 'run-new',
+ });
+ });
+
+ it('appends a re-verification round directly to an existing acceptance', async () => {
+ mockTrpcClient.acceptance.getBundle.query.mockResolvedValue({
+ acceptance: {
+ id: 'acceptance-existing',
+ status: 'delivered',
+ subjectId: 'standalone-subject',
+ subjectType: 'standalone',
+ },
+ });
+
+ await run(['ingest-report', dir, '--acceptance', 'acceptance-existing', '--json']);
+
+ expect(mockTrpcClient.acceptance.getBundle.query).toHaveBeenCalledWith({
+ id: 'acceptance-existing',
+ });
+ expect(mockTrpcClient.acceptance.ensure.mutate).not.toHaveBeenCalled();
+ expect(mockTrpcClient.acceptance.attachRun.mutate).toHaveBeenCalledWith({
+ acceptanceId: 'acceptance-existing',
+ verifyRunId: 'run-new',
+ });
+ });
+
it('passes a non-coding scenario and its context bag through to the run', async () => {
const verify = mockTrpcClient.verify as Record<string, any>;
writeFileSync(
@@ -1021,6 +1067,38 @@ describe('lh acceptance โ€” canonical run tree', () => {
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/acceptance.ts b/apps/server/src/routers/lambda/acceptance.ts
index 8a175a2a9fd..12cdabccc9f 100644
--- a/apps/server/src/routers/lambda/acceptance.ts
+++ b/apps/server/src/routers/lambda/acceptance.ts
@@ -122,12 +122,14 @@ export const acceptanceRouter = router({
requirement: z.string().max(2000).optional(),
subjectId: z.string(),
subjectType: subjectTypeSchema,
+ title: z.string().trim().min(1).max(500).optional(),
}),
)
.mutation(async ({ ctx, input }) => {
try {
return await ctx.acceptanceService.ensureForSubject(input.subjectType, input.subjectId, {
requirement: input.requirement,
+ title: input.title,
});
} catch (error) {
throw new TRPCError({
diff --git a/apps/server/src/services/verify/__tests__/acceptanceDecision.test.ts b/apps/server/src/services/verify/__tests__/acceptanceDecision.test.ts
index 075af307c94..1023ec0f91d 100644
--- a/apps/server/src/services/verify/__tests__/acceptanceDecision.test.ts
+++ b/apps/server/src/services/verify/__tests__/acceptanceDecision.test.ts
@@ -7,6 +7,7 @@ const mocks = vi.hoisted(() => ({
attachToAcceptance: vi.fn(),
findById: vi.fn(),
findRunById: vi.fn(),
+ ensureForSubject: vi.fn(),
listByAcceptance: vi.fn(),
setDecision: vi.fn(),
taskResolve: vi.fn(),
@@ -15,6 +16,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('@/database/models/acceptance', () => ({
AcceptanceModel: vi.fn(() => ({
+ ensureForSubject: mocks.ensureForSubject,
findById: mocks.findById,
updateStatus: mocks.updateStatus,
})),
@@ -52,6 +54,21 @@ describe('AcceptanceService decision gating', () => {
mocks.listByAcceptance.mockResolvedValue([{ id: 'run-1', roundIndex: 1 }]);
});
+ it('creates a standalone acceptance without resolving a LobeHub task, topic, or document', async () => {
+ mocks.ensureForSubject.mockResolvedValue({ id: 'acc-standalone' });
+
+ await service().ensureForSubject('standalone', 'external-delivery-1', {
+ requirement: 'The external delivery works',
+ title: 'External delivery',
+ });
+
+ expect(mocks.taskResolve).not.toHaveBeenCalled();
+ expect(mocks.ensureForSubject).toHaveBeenCalledWith('standalone', 'external-delivery-1', {
+ metadata: { title: 'External delivery' },
+ requirement: 'The external delivery works',
+ });
+ });
+
it.each(['pending', 'planned', 'verifying', 'repairing'])(
'refuses to accept while the round chain is still %s',
async (status) => {
diff --git a/apps/server/src/services/verify/acceptanceService.ts b/apps/server/src/services/verify/acceptanceService.ts
index 0742f958885..5c614f9a6bb 100644
--- a/apps/server/src/services/verify/acceptanceService.ts
+++ b/apps/server/src/services/verify/acceptanceService.ts
@@ -424,6 +424,11 @@ export class AcceptanceService {
subjectType: AcceptanceSubjectType,
subjectId: string,
): Promise<void> => {
+ // Standalone acceptances are the subject themselves. They deliberately do
+ // not require a Task/Topic/Document row, which keeps external repositories
+ // from having to manufacture a LobeHub task before publishing evidence.
+ if (subjectType === 'standalone') return;
+
const found = await this.findSubject(subjectType, subjectId);
if (!found) {
throw new Error(`${subjectType} "${subjectId}" not found in the current workspace`);
@@ -451,6 +456,9 @@ export class AcceptanceService {
);
return doc ? { title: doc.title ?? null } : null;
}
+ case 'standalone': {
+ return null;
+ }
}
};
@@ -458,10 +466,15 @@ export class AcceptanceService {
ensureForSubject = async (
subjectType: AcceptanceSubjectType,
subjectId: string,
- defaults?: { requirement?: string },
+ defaults?: { requirement?: string; title?: string },
): Promise<AcceptanceItem> => {
await this.assertSubjectExists(subjectType, subjectId);
- return this.acceptanceModel.ensureForSubject(subjectType, subjectId, defaults);
+ return this.acceptanceModel.ensureForSubject(subjectType, subjectId, {
+ requirement: defaults?.requirement,
+ ...(subjectType === 'standalone' && defaults?.title
+ ? { metadata: { title: defaults.title } }
+ : {}),
+ });
};
/**
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 8f233a34de5..be7f64abd86 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -200,6 +200,7 @@
"acceptance.status.repairing": "Repair in progress",
"acceptance.status.verifying": "Verification in progress",
"acceptance.subject.document": "Document",
+ "acceptance.subject.standalone": "Standalone",
"acceptance.subject.task": "Task",
"acceptance.subject.topic": "Topic",
"acceptance.surface.other": "Other",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 6286ccd122d..2818310a061 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -200,6 +200,7 @@
"acceptance.status.repairing": "ไฟฎๅค่ฟ›่กŒไธญ",
"acceptance.status.verifying": "้ชŒ่ฏ่ฟ›่กŒไธญ",
"acceptance.subject.document": "ๆ–‡ๆกฃ",
+ "acceptance.subject.standalone": "็‹ฌ็ซ‹้ชŒๆ”ถ",
"acceptance.subject.task": "ไปปๅŠก",
"acceptance.subject.topic": "่ฏ้ข˜",
"acceptance.surface.other": "ๅ…ถไป–",
diff --git a/packages/builtin-skills/src/acceptance/SKILL.md b/packages/builtin-skills/src/acceptance/SKILL.md
index 2ca77f97593..14a4fce04c9 100644
--- a/packages/builtin-skills/src/acceptance/SKILL.md
+++ b/packages/builtin-skills/src/acceptance/SKILL.md
@@ -1,50 +1,72 @@
---
name: acceptance
description: >
- Self-evidence for task delivery verification. When you run a task that has a
- verify plan, this skill is the full operating manual: what to prove, which
- surface to prove it on (CLI / web / desktop), how to drive that surface with
- agent-browser, how to get past auth, and how to submit each artifact with
- `lh acceptance run result submit` so the delivery is judged on real proof โ€” not your
- word that it works. Triggers on 'verify the task', 'collect evidence', 'prove
- it works', 'upload evidence', 'verify plan', 'requiredEvidence', or any run
- that must self-certify its delivery.
+ Self-evidence for delivery verification in any repository, with or without
+ LOBE_OPERATION_ID or a preconfigured verify plan. Discover an existing plan
+ when present; otherwise author checks and publish a standalone acceptance.
+ Pick the proving surface (CLI / web / desktop / iOS Simulator), capture real
+ evidence, and submit it with the lh CLI. Triggers on 'verify the task',
+ 'collect evidence',
+ 'prove it works', 'upload evidence', 'verify plan', 'requiredEvidence', or any
+ run that must self-certify its delivery. Missing LobeHub environment IDs never
+ make this skill inapplicable.
---
# Verify (Builder Self-Evidence)
-You are the **builder** for a task. A separate review step will judge your
-delivery against a **verify plan** โ€” a list of criteria, some of which demand
-**evidence** (a screenshot, a DOM snapshot, CLI outputโ€ฆ). A criterion that
-declares `requiredEvidence` **cannot pass on your text alone**: if the artifact
-is missing, the structural gate marks it `uncertain` and the delivery is held.
+You are the **builder** for a delivery. A separate review step judges it against
+either an existing **verify plan** or checks you author before testing. Some
+criteria demand **evidence** (a screenshot, a DOM snapshot, CLI outputโ€ฆ). A
+criterion that declares `requiredEvidence` **cannot pass on your text alone**:
+if the artifact is missing, the structural gate marks it `uncertain` and the
+delivery is held.
+
+## Applicability invariant
+
+This skill applies whenever the delivery needs real verification. Environment
+IDs select a path; they are not prerequisites:
+
+- `$LOBE_OPERATION_ID` means a verify plan already exists. Discover and satisfy
+ it.
+- No `$LOBE_OPERATION_ID` means you author the checks and publish a structured
+ report round.
+- `$LOBEHUB_TOPIC_ID` or `--subject` groups rounds under an existing LobeHub
+ object.
+- No topic or subject means `lh acceptance run ingest` creates a standalone
+ acceptance automatically.
+
+Never report that this skill is inapplicable merely because
+`$LOBE_OPERATION_ID`, `$LOBEHUB_TOPIC_ID`, or a Task ID is absent. Continue with
+the standalone path.
So while you do the work, capture the proof and submit it. The loop:
```
-discover plan โ†’ pick the surface โ†’ capture evidence per criterion โ†’ submit each โ†’ self-check coverage
+discover or author plan โ†’ pick the surface โ†’ capture evidence โ†’ publish the round โ†’ self-check coverage
```
-Everything here is portable: the hard dependencies are the `lh` CLI (already
-authed in your environment) and, for UI proof, `agent-browser`. No repo scripts,
-no local report directory.
+The skill package is portable, but execution capabilities are surface-specific:
+`agent-browser` serves Web/Electron, while native macOS and iOS Simulator require
+a local macOS display and their platform tools. No repository-specific scripts
+or fixed report directory are required.
## Two entry points โ€” an operation id is NOT required
Every evidence command targets a **verification session** (a round). How you
name that session is a choice, not a prerequisite:
-| You have | Target the round with | Path |
-| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
-| A verify plan (`$LOBE_OPERATION_ID` set) | `--operation "$LOBE_OPERATION_ID"` | This document: discover the plan, satisfy its criteria |
-| No plan โ€” you author the checks | `--run <verifyRunId>` from `lh acceptance run create`, or publish a whole directory with `lh acceptance run ingest` | [references/report.md](references/report.md) |
+| You have | Target the round with | Path |
+| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
+| A verify plan (`$LOBE_OPERATION_ID` set) | `--operation "$LOBE_OPERATION_ID"` | This document: discover the plan, satisfy its criteria |
+| No plan โ€” you author the checks | Publish a whole directory with `lh acceptance run ingest`; it creates the round and, when needed, a standalone acceptance | [references/report.md](references/report.md) |
`--operation` and `--run` are interchangeable on `result submit` and
`result list`; a round created without an operation is simply recorded as
`standalone`. (`evidence list` takes neither โ€” it keys off a positional
`<checkResultId>` you read from `result list`.) **A missing operation id never
means "skip the acceptance"** โ€” it only means you author the plan instead of
-discovering it.
+discovering it. On a later repair round, pass the previously printed
+`--acceptance <acceptanceId>` so the new snapshot joins the same history.
## Rounds are immutable โ€” repair means a NEW round
@@ -64,18 +86,20 @@ the record of this attempt.
- **`lh` is authed.** Confirm with `lh acceptance run list --json` (an empty `[]`
means authed; an auth error means stop and surface it).
-- **A target round.** Either `$LOBE_OPERATION_ID` (provided in the environment or
- named in your task prompt), or a `verifyRunId` you create yourself โ€” see the
- table above.
-- **For UI evidence, `agent-browser` is installed.** `npm i -g agent-browser`
- then `agent-browser install` (downloads Chrome). Full reference:
- [references/agent-browser.md](references/agent-browser.md).
+- **A round path.** Use `$LOBE_OPERATION_ID` when supplied. Otherwise author a
+ structured report; ingest creates both its round and, outside LobeHub, its
+ standalone acceptance.
+- **Install only the UI driver required by the selected surface.** Web/Electron
+ use `agent-browser`; native iOS uses Xcode/`simctl` plus a Simulator HID/AX CLI
+ such as AXe, or the repository's existing UI-test driver. Probe installed tools
+ before adding dependencies, and do not substitute a private agent plugin.
## Step 1 โ€” Discover the plan (what to prove)
> Plan-driven path only. Authoring your own checks instead? Jump to
-> [references/report.md](references/report.md) โ€” Steps 2โ€“4 below still apply,
-> targeting your round with `--run <verifyRunId>`.
+> [references/report.md](references/report.md), then use the relevant surface
+> recipes below to capture its evidence. Publish that authored plan and its
+> cases together with `lh acceptance run ingest`.
One read tells you what to prove:
@@ -99,13 +123,14 @@ this point โ€” that's expected.) Exact shapes:
The criterion's `hint` usually implies the surface. Match the change you made to
the cheapest surface that can actually prove it, and escalate only if needed:
-| What your task changed | Surface | Why | Guide |
-| -------------------------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------- |
-| Backend / CLI / library / data logic | **CLI** | Fastest, text-assertable, zero UI flakiness โ€” upload stdout as `text` | [surfaces/cli.md](surfaces/cli.md) |
-| Web app frontend / styles / interactions | **Web** (agent-browser โ†’ running web app) | The product shape users see; screenshot/DOM the rendered result | [surfaces/web.md](surfaces/web.md) |
-| New/changed API **plus** the UI consuming it | **Web**, full-stack (agent-browser + network capture) | One surface where request/response and rendered result are both observable | [surfaces/web.md](surfaces/web.md#web-full-stack) |
-| Desktop (Electron) app behavior | **Electron** (agent-browser `--cdp`) | Only the real desktop shell exercises desktop-only code paths | [surfaces/electron.md](surfaces/electron.md) |
-| Native macOS app / OS-level behavior agent-browser can't reach | **Native** (Computer Use: osascript + screencapture) | The only way to drive non-Chromium apps and OS chrome (local macOS only) | [surfaces/native.md](surfaces/native.md) |
+| What your task changed | Surface | Why | Guide |
+| -------------------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
+| Backend / CLI / library / data logic | **CLI** | Fastest, text-assertable, zero UI flakiness โ€” upload stdout as `text` | [surfaces/cli.md](surfaces/cli.md) |
+| Web app frontend / styles / interactions | **Web** (agent-browser โ†’ running web app) | The product shape users see; screenshot/DOM the rendered result | [surfaces/web.md](surfaces/web.md) |
+| New/changed API **plus** the UI consuming it | **Web**, full-stack (agent-browser + network capture) | One surface where request/response and rendered result are both observable | [surfaces/web.md](surfaces/web.md#web-full-stack) |
+| Desktop (Electron) app behavior | **Electron** (agent-browser `--cdp`) | Only the real desktop shell exercises desktop-only code paths | [surfaces/electron.md](surfaces/electron.md) |
+| Native macOS app / OS-level behavior agent-browser can't reach | **Native** (Computer Use: osascript + screencapture) | The only way to drive non-Chromium apps and OS chrome (local macOS only) | [surfaces/native.md](surfaces/native.md) |
+| Native iOS app behavior, gestures, or device-size layout | **iOS Simulator** (AXe/native CLI + `simctl`) | Proves the installed iOS binary, native HID input, Accessibility state, and device framebuffer | [surfaces/ios-simulator.md](surfaces/ios-simulator.md) |
Rules of thumb:
@@ -118,24 +143,30 @@ Rules of thumb:
packaged shell, OS integration) โ€” that code path doesn't exist in a plain web
page. Switching conditions per surface: [surfaces/web.md](surfaces/web.md) and
[surfaces/electron.md](surfaces/electron.md).
+- **iOS is not a browser or host-mouse surface.** Use AXe or another installed
+ Simulator HID/Accessibility CLI for taps, long press, swipe, pan, and UI-tree
+ inspection; use `simctl` for lifecycle/framebuffer capture. If the available
+ CLI cannot express the planned touch sequence, mark the case `blocked`.
- **Auth is a gate, scoped to the surface.** If the state under test is behind a
login, authenticate that surface first or every capture lands on the sign-in
- page. Recipes and boundaries: [references/auth.md](references/auth.md).
+ page. Follow the selected surface's Auth section; load
+ [references/auth-web.md](references/auth-web.md) only for a Web session.
## Step 3 โ€” Capture, then submit each artifact
-Capture each required `type` (recipes per surface in
-[references/evidence.md](references/evidence.md)), then submit one artifact per
-call with the criterion's `checkItemId`. `lh acceptance run result submit` resolves your session
-from the operation id, lazily creates/updates the result row, and attaches the
-evidence โ€” one call, no `checkResultId` needed:
+Capture each required `type` with the selected surface guide, then apply the
+shared artifact rules in [references/evidence.md](references/evidence.md) and
+submit one artifact per call with the criterion's `checkItemId`.
+`lh acceptance run result submit` resolves your session from the operation id,
+lazily creates/updates the result row, and attaches the evidence โ€” one call, no
+`checkResultId` needed:
```bash
# CHECK_ITEM_ID is the plan item id for this criterion (from Step 1).
-# file artifact (screenshot / dom / video)
+# file artifact already captured by the selected surface
lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" \
- --type screenshot --file ./proof/login.png --by agent-browser \
- --desc "Logged-in home renders the workspace switcher"
+ --type "$EVIDENCE_TYPE" --file "$ARTIFACT_PATH" --by "$PROVENANCE" \
+ --desc "Observed state after the planned action"
# inline text artifact (stdout / computed value) โ€” no file
lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" \
@@ -184,38 +215,12 @@ This round: https://app.lobehub.com/verify/<verifyRunId>
Coverage: 2/2 criteria, all required evidence uploaded
```
-## Worked example (web criterion, one screenshot)
-
-Plan item: _"Settings page shows the new 'Beta features' toggle"_,
-`requiredEvidence: [{ type: screenshot }]`, `required: true`.
-
-```bash
-OP="$LOBE_OPERATION_ID"
-
-# 1. discover: find this item's checkItemId + required evidence
-lh verify plan state "$OP" --json # โ†’ item id vci_settings, requires screenshot
-
-# 2. surface = web (frontend change). Auth the session if needed (see references/auth.md).
-agent-browser --session app open "http://localhost:3000/settings"
-agent-browser --session app wait --text "Beta features"
-agent-browser --session app screenshot ./proof/settings-beta.png
-
-# 3. submit: creates the result row + attaches the screenshot in one call
-lh acceptance run result submit --operation "$OP" --item vci_settings --type screenshot \
- --file ./proof/settings-beta.png --by agent-browser \
- --desc "Settings page renders the new Beta features toggle"
-# โ†’ report: https://app.lobehub.com/verify/<verifyRunId>
-
-# 4. self-check
-lh acceptance run result list --operation "$OP" --json # โ†’ { checkItemId: vci_settings, id: vcr_77 }
-lh acceptance run evidence list vcr_77 --json # โ†’ one screenshot present โ†’ 1/1 covered
-```
-
## Portability rules
- **Prefer engine-level capture over OS capture.** `agent-browser screenshot` /
`dom` / `eval` render from the browser engine and run headless; `screencapture`
- / osascript are macOS-only and break in the cloud.
+ / osascript are macOS-only and break in the cloud. For iOS Simulator, prefer
+ its own framebuffer via `xcrun simctl io` over host-window capture.
- **Upload as you go, not at the end.** Evidence uploaded mid-run is keyed to the
criterion immediately; a crash near the end doesn't lose your proof.
- **Don't invent evidence.** Only capture the types a criterion declares.
@@ -223,20 +228,16 @@ lh acceptance run evidence list vcr_77 --json # โ†’ one screenshot pres
## Reference map
-```
-verify/
-โ”œโ”€โ”€ SKILL.md # this router: the loop + surface decision + example
-โ”œโ”€โ”€ surfaces/ # per-surface acceptance recipes โ€” pick one per criterion
-โ”‚ โ”œโ”€โ”€ cli.md # backend / CLI surface โ†’ text evidence from command output
-โ”‚ โ”œโ”€โ”€ web.md # web surface (frontend / full-stack) via agent-browser
-โ”‚ โ”œโ”€โ”€ electron.md # desktop surface (Electron) via agent-browser --cdp
-โ”‚ โ””โ”€โ”€ native.md # native macOS app / OS-level surface via Computer Use
-โ””โ”€โ”€ references/ # cross-surface shared knowledge
- โ”œโ”€โ”€ plan-format.md # verify contract: plan shape + checkItemIdโ†”checkResultId join
- โ”œโ”€โ”€ evidence.md # evidence type โ†’ capture recipe; upload; coverage; portability
- โ”œโ”€โ”€ agent-browser.md # full agent-browser CLI reference (any Chromium app)
- โ”œโ”€โ”€ computer-use.md # macOS Computer Use toolkit (osascript + screencapture)
- โ”œโ”€โ”€ recording.md # GIF / MP4 recording for time-based evidence
- โ”œโ”€โ”€ report.md # structured report rounds: result.json schema + `lh acceptance run ingest`
- โ””โ”€โ”€ auth.md # portable auth: session/state/vault/cookie injection + boundaries
-```
+Load detailed references only after selecting the applicable path:
+
+| Need | Reference |
+| ------------------------------------------------------ | ------------------------------------------------------------------- |
+| Existing verify-plan schema and join keys | [plan-format.md](references/plan-format.md) |
+| Shared media, provenance, submission, and safety rules | [evidence.md](references/evidence.md) |
+| Authored structured rounds and `result.json` | [report.md](references/report.md) |
+| Web/Electron Chromium CLI commands | [agent-browser.md](references/agent-browser.md) |
+| Authenticated Web session | [auth-web.md](references/auth-web.md) |
+| Native macOS or OS-owned step | [computer-use.md](references/computer-use.md) |
+| Web/Electron temporal evidence | [recording-cdp.md](references/recording-cdp.md) |
+| iOS Simulator temporal/frame evidence | [recording-ios-simulator.md](references/recording-ios-simulator.md) |
+| Native macOS temporal evidence | [recording-native-macos.md](references/recording-native-macos.md) |
diff --git a/packages/builtin-skills/src/acceptance/index.ts b/packages/builtin-skills/src/acceptance/index.ts
index b1a049c4f9c..9aa412fb0e0 100644
--- a/packages/builtin-skills/src/acceptance/index.ts
+++ b/packages/builtin-skills/src/acceptance/index.ts
@@ -2,15 +2,18 @@ import type { BuiltinSkill } from '@lobechat/types';
import { toResourceMeta } from '../lobehub/helpers';
import agentBrowser from './references/agent-browser.md';
-import auth from './references/auth.md';
+import authWeb from './references/auth-web.md';
import computerUse from './references/computer-use.md';
import evidence from './references/evidence.md';
import planFormat from './references/plan-format.md';
-import recording from './references/recording.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';
@@ -19,14 +22,17 @@ export const AcceptanceIdentifier = 'acceptance';
/**
* Portable builder-side acceptance skill. Unlike the repo-local `agent-testing`
* skill (macOS scripts + local report dirs + LobeHub-specific probes), this one
- * depends only on the `lh` CLI and `agent-browser`, so any external builder
- * (Claude Code / Codex) can run it from a task's working directory: discover the
- * plan โ†’ pick a surface โ†’ capture evidence per criterion โ†’ `lh acceptance run
- * result submit` โ†’ self-check coverage.
+ * keeps its acceptance contract independent of repository-local scripts, so any
+ * external builder (Claude Code / Codex) can run it from a task's working
+ * directory, with or without a LobeHub operation/topic: discover or author the
+ * plan โ†’ pick a surface โ†’ capture evidence per criterion โ†’ publish a round โ†’
+ * self-check coverage. Surface-specific tools remain explicit: agent-browser for
+ * Web/Electron, shell-level native automation for macOS, and an installed
+ * Simulator HID/Accessibility CLI plus Xcode/simctl for iOS.
*
- * The references carry the full operating manual (agent-browser CLI, web vs
- * Electron decision + setup, auth recipes, capture recipes), with all
- * LobeHub-only coupling generalized away.
+ * 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
@@ -36,19 +42,22 @@ export const AcceptanceSkill: BuiltinSkill = {
avatar: 'โœ…',
content,
description:
- 'Self-evidence for task delivery acceptance โ€” discover the verify plan, pick the right surface (CLI / web / desktop), drive it with agent-browser, get past auth, capture portable evidence per criterion, and submit each with `lh acceptance run result submit` so the delivery is judged on real proof.',
+ 'Self-evidence for delivery acceptance in any repository, with or without a LobeHub operation or verify plan โ€” discover or author checks, verify CLI, web, desktop, or iOS Simulator behavior on the correct surface, capture real evidence, and publish a standalone or subject-linked acceptance round.',
identifier: AcceptanceIdentifier,
name: 'acceptance',
resources: toResourceMeta({
'references/agent-browser.md': agentBrowser,
- 'references/auth.md': auth,
+ 'references/auth-web.md': authWeb,
'references/computer-use.md': computerUse,
'references/evidence.md': evidence,
'references/plan-format.md': planFormat,
- 'references/recording.md': recording,
+ '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,
}),
diff --git a/packages/builtin-skills/src/acceptance/references/agent-browser.md b/packages/builtin-skills/src/acceptance/references/agent-browser.md
index 5844e50198f..96c5282b0a7 100644
--- a/packages/builtin-skills/src/acceptance/references/agent-browser.md
+++ b/packages/builtin-skills/src/acceptance/references/agent-browser.md
@@ -1,11 +1,19 @@
# agent-browser CLI reference
Generic reference for the `agent-browser` CLI โ€” automate Chromium-based apps
-(Electron, Chrome, web) via Chrome DevTools Protocol. This is the capture engine
-for all UI evidence in this skill. Per-surface patterns live in
-[../surfaces/web.md](../surfaces/web.md) and
-[../surfaces/electron.md](../surfaces/electron.md); auth recipes in
-[auth.md](./auth.md).
+(Electron, Chrome, web) via Chrome DevTools Protocol. This is the shared driver
+for Web and Electron evidence; native surfaces use their own tools. Per-surface
+setup, authentication, capture, and boundary decisions remain in the selected
+surface guide.
+
+## Contents
+
+- [Core workflow](#core-workflow)
+- [Essential commands](#essential-commands)
+- [Batch execution](#batch-execution)
+- [JavaScript evaluation](#javascript-evaluation-eval)
+- [Connect to an existing browser or app](#connect-to-an-existing-browser--app)
+- [Gotchas](#gotchas)
Install via `npm i -g agent-browser`, `brew install agent-browser`, or
`cargo install agent-browser`. Run `agent-browser install` to download Chrome.
@@ -176,8 +184,8 @@ agent-browser --session site2 open https://site-b.com
agent-browser session list
```
-A named `--session` auto-saves and restores cookies + localStorage, which is the
-basis for the auth recipes in [auth.md](./auth.md).
+A named `--session` auto-saves and restores cookies + localStorage across
+commands.
## Connect to an existing browser / app
diff --git a/packages/builtin-skills/src/acceptance/references/auth-web.md b/packages/builtin-skills/src/acceptance/references/auth-web.md
new file mode 100644
index 00000000000..1c511451b60
--- /dev/null
+++ b/packages/builtin-skills/src/acceptance/references/auth-web.md
@@ -0,0 +1,75 @@
+# Web authentication with agent-browser
+
+Use this reference only when the Web criterion is behind a login gate.
+Authenticate the same named `agent-browser` session that will capture evidence;
+a screenshot from a different browser does not prove the automated session
+reached the state.
+
+This workflow is provider-neutral. Discover the target's actual endpoint, cookie
+domain, and session mechanism before selecting a path.
+
+## Decision flow
+
+1. Open the protected target. If it renders without a login wall, stop here.
+2. Prefer a named session or state file; use credential replay or cookie injection
+ only when required.
+3. Reopen a protected URL and verify that `agent-browser get url` did not return
+ the sign-in route before capturing evidence.
+
+## 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
+
+# Playwright-style storage state.
+agent-browser state save auth.json
+agent-browser state load auth.json
+
+# Encrypted credential vault and form replay.
+echo "$PASSWORD" | agent-browser auth save app \
+ --url https://app.example.com/login --username user --password-stdin
+agent-browser auth login app
+
+# Dedicated persistent browser profile.
+agent-browser --profile ~/.app-profile open https://app.example.com/login
+```
+
+## Programmatic login
+
+If the app exposes a sign-in API, POST credentials, capture the returned cookies,
+convert them to a storage-state file, and load that state into the evidence
+session. Endpoint shape, field names, and cookie names are app-specific; inspect
+them rather than assuming.
+
+## Cookie-injection fallback for local development
+
+1. In a logged-in browser, open DevTools Network, select a same-origin request,
+ and copy the full `Cookie:` request header. Do not use `document.cookie`;
+ HttpOnly session cookies are invisible there.
+2. Build a state file and load it into the named session. Match the cookie domain
+ exactly (`localhost` is not `127.0.0.1`; local domains need no leading dot).
+3. Open a protected URL and verify that the session is not redirected.
+
+| Symptom | Cause | Fix |
+| --------------------------- | ----------------------------------------------------- | ---------------------------------------- |
+| Redirects after injection | `document.cookie` omitted the HttpOnly session | Copy the Network request's cookie header |
+| "no cookies found" | The copied value is not the raw request cookie header | Preserve the header value verbatim |
+| Works briefly, then expires | The session rotated or expired | Acquire and inject a fresh dev session |
+| Works on one host spelling | Cookie domain and target host differ | Use the literal target host |
+
+## Security boundaries
+
+- Restrict cookie injection to local/development targets. Do not move production
+ session cookies into automation state.
+- Treat credentials, cookies, and tokens as secrets. Never place them in logs,
+ evidence, commits, or PR descriptions.
+- Authentication state seeds only the automation session; it does not flow back
+ into the source browser.
+- When the criterion is the sign-in UI itself, drive the real form instead of
+ injecting past it.
+
+Return to the selected Web flow after the authenticated session passes its
+protected-route check.
diff --git a/packages/builtin-skills/src/acceptance/references/auth.md b/packages/builtin-skills/src/acceptance/references/auth.md
deleted file mode 100644
index a24885a5694..00000000000
--- a/packages/builtin-skills/src/acceptance/references/auth.md
+++ /dev/null
@@ -1,106 +0,0 @@
-# Auth โ€” getting past the login gate (portable)
-
-If the state a criterion checks is behind a login, you must authenticate the
-surface **before** capturing โ€” otherwise every screenshot lands on the sign-in
-page and the evidence is worthless. Auth is a gate, but it is **surface-scoped**:
-authenticate only the surface you're proving on, not all of them.
-
-This file is portable to any Chromium-based app. It does not assume any specific
-auth provider, cookie name, or seed script โ€” discover those from the app you are
-verifying.
-
-## Decision flow
-
-1. **Is the target behind auth at all?** Open it; if it renders the state under
- test without a login wall, skip this file.
-2. **Pick the cheapest mechanism that works for the surface** (table below).
-3. **Verify the session is authenticated** before you start capturing: navigate
- to a protected URL and assert you did _not_ get redirected to the sign-in page
- (`agent-browser ... get url` should not be the login route).
-
-## Mechanisms (web / Chrome surface)
-
-`agent-browser` has four built-in ways to carry auth โ€” prefer these over manual
-login, which is unreliable in headless/off-screen windows.
-
-```bash
-# 1. Named session โ€” auto-saves & restores cookies + localStorage across commands
-agent-browser --session app open https://app.example.com/login
-# ... complete login once (or inject state) ...
-agent-browser --session app open https://app.example.com/dashboard # restored
-
-# 2. State file โ€” export/import a Playwright-style storageState
-agent-browser state save auth.json
-agent-browser state load auth.json
-
-# 3. Auth vault โ€” store credentials encrypted, replay the login form
-echo "$PASSWORD" | agent-browser auth save app --url https://app.example.com/login \
- --username user --password-stdin
-agent-browser auth login app
-
-# 4. Persistent profile โ€” a dedicated user-data dir that keeps you logged in
-agent-browser --profile ~/.app-profile open https://app.example.com/login
-```
-
-### Programmatic login (when the app has an email/password endpoint)
-
-If the app exposes a sign-in API, the most reliable headless path is to POST
-credentials, capture the returned cookies, and load them as a state file โ€” no UI
-login needed. Shape (adapt the endpoint + cookie handling to the app):
-
-```bash
-# POST credentials, save the cookie jar, convert to a storageState file,
-# then load it into the agent-browser session and verify you're not on /signin.
-# (endpoint, field names, and cookie names are app-specific โ€” inspect them first)
-```
-
-### Cookie-injection fallback (local dev only)
-
-When headless login isn't available, copy the session cookie out of a browser
-where you're already logged in and inject it:
-
-1. In a logged-in browser, open DevTools โ†’ **Network** tab โ†’ click any
- same-origin request โ†’ **Request Headers** โ†’ copy the full `Cookie:` value.
- It MUST come from a Network request, **not** `document.cookie` โ€” HttpOnly
- session cookies are invisible to `document.cookie`.
-2. Build a state file with those cookies and `agent-browser state load` it (or use
- the session). Match the cookie **domain exactly** โ€” e.g. `localhost`, not
- `127.0.0.1`, and no leading dot for local dev.
-3. Verify: open a protected URL, confirm you're not redirected to sign-in.
-
-Common failure modes:
-
-| Symptom | Cause | Fix |
-| ------------------------------------------ | ------------------------------------------------------- | ---------------------------------------------- |
-| Still redirects to sign-in after injection | Copied from `document.cookie` โ†’ missed HttpOnly session | Re-copy from a Network request's headers |
-| "no cookies found" | Pasted the wrong value | Keep the raw `Cookie:` header verbatim |
-| Works briefly then expires | Session token rotated (logged out elsewhere) | Re-copy and re-inject |
-| Domain mismatch | Cookie domain must match the URL host exactly | Use the literal host, no leading dot for local |
-
-## Desktop (Electron) {#desktop}
-
-A desktop app usually keeps its own persistent login state in its user-data
-directory: **log in once inside the app** and it survives restarts. No injection.
-Once connected over CDP, verify auth by reading the app's own signed-in state
-(eval its global / a protected element) rather than assuming.
-
-## CLI / backend surface
-
-For text evidence from a CLI, the CLI carries its own auth (an API key or a stored
-login). The `lh` CLI you use to upload evidence is already authed; a different
-product CLI under test uses its own mechanism โ€” ensure it's configured before
-capturing its output.
-
-## Boundaries โ€” read before touching cookies
-
-- **Local dev only.** These injection recipes are for local/dev targets. Don't
- inject cookies on production: production cookies are typically
- `Secure; HttpOnly` over HTTPS and must not be copied around.
-- **Treat any cookie/token as a secret.** Never paste it into shared logs, PR
- descriptions, commit messages, or evidence you upload. Evidence artifacts are
- visible to reviewers โ€” a screenshot or text dump must not contain a live token.
-- **Injection is one-way.** It seeds the automation session; it does not flow back
- into your own browser.
-- **Exercising the login UI itself needs a real browser flow.** If the criterion
- is _about_ the sign-in screen, drive a real Chromium with remote debugging
- rather than injecting past it.
diff --git a/packages/builtin-skills/src/acceptance/references/computer-use.md b/packages/builtin-skills/src/acceptance/references/computer-use.md
index 5eefc3d7880..6399ad24032 100644
--- a/packages/builtin-skills/src/acceptance/references/computer-use.md
+++ b/packages/builtin-skills/src/acceptance/references/computer-use.md
@@ -5,15 +5,21 @@ reach, this is the escape hatch: **macOS Computer Use** via `osascript`
(AppleScript) and `screencapture`. Use it to drive native apps, handle OS-level
chrome, and read the screen when no CDP target exists.
-This is the native/OS counterpart of [agent-browser.md](./agent-browser.md). It is
-**macOS-only and not cloud-portable** โ€” prefer CDP automation when both can reach
-the target; reach here only when CDP can't.
+This is the native/OS counterpart of Chromium automation. It is **macOS-only and
+not cloud-portable** โ€” prefer CDP automation when both can reach the target;
+reach here only when CDP cannot.
+
+## Contents
+
+- [When you need it](#when-you-need-it)
+- [Core patterns](#core-patterns)
+- [Capturing as evidence](#capturing-as-evidence)
+- [Gotchas](#gotchas)
## When you need it
- **Native (non-Chromium) app under test** โ€” the thing you're verifying is a native
- macOS app agent-browser can't attach to. Drive it here (see
- [../surfaces/native.md](../surfaces/native.md)).
+ macOS app a Chromium driver cannot attach to. Drive it here.
- **OS-level steps inside a web/Electron flow** โ€” a native file picker, a system
permission prompt, a Save dialog, dock/menu-bar interaction, or a Spotlight/
app-switch the page can't script. Drop to Computer Use for that step, then return
@@ -109,7 +115,7 @@ pbpaste
- A `screencapture` PNG โ†’ `--type screenshot --by cli`.
- For time-based native behavior, OS screen-record to MP4/GIF โ€” see
- [recording.md](./recording.md#path-2--os-screen-recording-macos-local-only).
+ [recording-native-macos.md](./recording-native-macos.md).
- Text read via `pbpaste` โ†’ `--type text --content "$(pbpaste)"`.
## Gotchas
diff --git a/packages/builtin-skills/src/acceptance/references/evidence.md b/packages/builtin-skills/src/acceptance/references/evidence.md
index e7e6f615345..903f9bd6fed 100644
--- a/packages/builtin-skills/src/acceptance/references/evidence.md
+++ b/packages/builtin-skills/src/acceptance/references/evidence.md
@@ -1,101 +1,54 @@
-# Capturing portable evidence
+# Cross-surface evidence contract
-The goal is an artifact a human (and the review agent) can open and believe. Pick
-the lightest capture that proves the criterion, and prefer engine-level capture so
-it works the same locally and headless/cloud. UI capture uses `agent-browser`
-([agent-browser.md](./agent-browser.md)) on the surface you chose
-([web](../surfaces/web.md) / [electron](../surfaces/electron.md); backend/CLI โ†’
-[cli](../surfaces/cli.md)).
+This reference defines the artifact contract shared by every surface. Capture
+commands belong to the selected surface guide; do not load another surface's
+instructions merely to learn how to submit an artifact.
-## Evidence type โ†’ how to capture
+## Evidence media
-### `screenshot` โ€” UI state
+| Type | Use when |
+| -------------- | ------------------------------------------------------------------------------------------------- |
+| `text` | Command output, logs, focused request/response data, or computed assertions prove the criterion |
+| `dom_snapshot` | Structured content is stronger and smaller than pixels |
+| `screenshot` | A settled visual state, layout, or native rendering is the claim |
+| `gif` | A short temporal state should render inline, usually no more than about 10 seconds |
+| `video` | A longer animation, transition, gesture, or multi-step flow needs a player and better compression |
+| `transcript` | A conversation, event stream, or request log is itself the proof |
-Screenshots via CDP (the browser engine) need no real display:
+The declared `requiredEvidence` type is binding. Do not replace a required video
+with a final screenshot or a required DOM snapshot with prose.
-```bash
-# web (named session)
-agent-browser --session app open "<url>"
-agent-browser --session app click @e1 # act, after snapshot -i to get refs
-agent-browser --session app screenshot ./proof/after.png
-
-# desktop (Electron, over CDP)
-agent-browser --cdp 9222 screenshot ./proof/desktop.png
-```
-
-Avoid macOS `screencapture` / osascript unless the criterion is explicitly
-native/local-only โ€” they don't run in the cloud.
-
-### `dom_snapshot` โ€” structure / content proof
-
-When the proof is "this element/text exists with these values", a DOM dump is
-smaller and more assertable than a pixel screenshot:
+## File versus inline content
-```bash
-agent-browser --session app eval "document.querySelector('[data-testid=list]').outerHTML" > ./proof/list.html
-```
-
-Upload as `--type dom_snapshot --file ./proof/list.html`.
-
-### `text` โ€” stdout, logs, computed values
-
-Backend / CLI behavior is best proven by the command output itself โ€” upload inline,
-no file:
+- Use `--file` for binary artifacts and larger text/DOM/transcript files.
+- Use `--content` for short text assertions. Pass exactly one of `--file` and
+ `--content`.
+- Keep the description factual: identify the action, observed state, and relevant
+ target. Do not place the verdict in the description unless explicitly asked.
```bash
-lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" --type text \
- --content "$(your-cli command --json)" \
- --by cli --desc "command reports success after the change"
+# File artifact captured by the selected surface.
+lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" \
+ --type "$EVIDENCE_TYPE" --file "$ARTIFACT_PATH" --by "$PROVENANCE" \
+ --desc "Observed state after the planned action"
+
+# Short text assertion.
+lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" \
+ --type text --content "$ASSERTION_OUTPUT" --by cli \
+ --desc "Machine-readable assertion output"
```
-A network capture (HAR) or a request/response pair from a full-stack run also
-uploads as `text` (`--file ./proof/capture.har` or `--content`).
-
-### `transcript` โ€” conversation / request log
-
-A saved agent conversation, request/response pair, or event log file:
-`--type transcript --file ./proof/run.jsonl`.
-
-### `gif` / `video` โ€” behavior over time
-
-Required whenever a criterion asserts change over time (streaming output, a ticking
-timer, a loadingโ†’loaded transition, an animation, a multi-step flow) โ€” a static
-screenshot cannot prove these. Record a clip and upload `--type gif` / `--type
-video --file โ€ฆ`. Full recipes (portable CDP frame-sequence โ†’ MP4/GIF, OS screen
-recording, GIF-vs-MP4): [recording.md](./recording.md).
-
## Provenance (`--by`)
-Tag how the artifact was produced so the reviewer can weigh it:
-
-- `agent-browser` โ€” captured through agent-browser (screenshots, DOM, eval)
-- `cdp` โ€” captured directly via Chrome DevTools Protocol
-- `cli` โ€” command stdout / computed text
-- `program` โ€” produced by a script or test you ran
-
-## Headless / cloud portability
-
-The decisive constraint per surface is **how a screenshot is captured**: engine-level
-capture (CDP) needs no display; OS-level capture is macOS-only.
-
-| Surface | macOS (local) | Linux / cloud (headless) | Screenshot mechanism |
-| ---------- | ------------- | --------------------------------------------------------------- | ------------------------------------------------ |
-| CLI / text | โœ… | โœ… | n/a โ€” text output |
-| Web | โœ… | โœ… headless Chromium works natively | CDP โ€” no display needed |
-| Electron | โœ… | โš ๏ธ runs but needs a display server: wrap launch with `xvfb-run` | CDP works under Xvfb; OS-window capture does NOT |
-
-Checklist:
-
-- โœ… `agent-browser screenshot` / `eval` (DOM, console) โ€” engine-level, headless-safe
-- โœ… `--type text --content โ€ฆ` โ€” pure text, always works
-- โŒ `screencapture`, osascript, native-app screen recording โ€” macOS-only, not
- cloud-safe
-
-When a run must stay cloud-portable, prefer CDP-based evidence over OS-level
-capture wherever both exist.
+Set `--by` to the producer named by the selected surface guide. Use the direct
+capture source for an unmodified artifact and `program` for a deterministic test,
+script, or media transform. Do not infer provenance from the file extension.
-## Don't leak secrets
+## Artifact safety
-Evidence is visible to reviewers. Never capture a screenshot or text dump that
-contains a live token, cookie, password, or other secret โ€” see
-[auth.md](./auth.md#boundaries--read-before-touching-cookies).
+- Inspect every image, clip, and generated document before citing it.
+- Never upload credentials, cookies, tokens, private user data, unrelated host
+ windows, or notifications.
+- Prefer a focused artifact over an unfiltered log or full-session recording.
+- Retain the raw source when submitting a derived chart, contact sheet, GIF, or
+ edited comparison image.
diff --git a/packages/builtin-skills/src/acceptance/references/recording-cdp.md b/packages/builtin-skills/src/acceptance/references/recording-cdp.md
new file mode 100644
index 00000000000..589d60e6c04
--- /dev/null
+++ b/packages/builtin-skills/src/acceptance/references/recording-cdp.md
@@ -0,0 +1,68 @@
+# Web and Electron recording via CDP
+
+Use this reference only for Web or Electron criteria that assert behavior over
+time: streaming output, loading-to-loaded transitions, timers, animations, or
+multi-step flows. Capture renderer frames through `agent-browser`; do not record
+the host screen.
+
+## Capture a frame sequence
+
+Run the capture loop in a persistent shell while driving the scenario from
+another shell. Choose exactly one capture function for the selected surface:
+
+```bash
+FRAME_DIR=$(mktemp -d)
+
+# Web:
+capture_frame() { agent-browser --session app screenshot "$1"; }
+
+# Electron alternative:
+# capture_frame() { agent-browser --cdp 9222 screenshot "$1"; }
+
+i=0
+while [ "$i" -lt 40 ]; do # about 20 seconds at 0.5 seconds per frame
+ printf -v frame_number "%06d" "$i"
+ capture_frame "$FRAME_DIR/frame_$frame_number.png"
+ i=$((i + 1))
+ sleep 0.5
+done
+```
+
+Use a shorter interval such as `0.25` seconds for quick transitions and a longer
+interval such as `1` second for slow flows. Keep the capture scoped to the
+behavior under review.
+
+## Assemble and validate the clip
+
+```bash
+# MP4
+ffmpeg -y -framerate 2 -i "$FRAME_DIR/frame_%06d.png" \
+ -c:v libx264 -crf 23 -pix_fmt yuv420p ./proof/flow.mp4
+
+# GIF with a generated palette
+ffmpeg -y -framerate 2 -i "$FRAME_DIR/frame_%06d.png" \
+ -vf "scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
+ ./proof/flow.gif
+
+ffprobe -v error \
+ -show_entries format=duration:stream=codec_name,width,height,avg_frame_rate,nb_frames \
+ -of json ./proof/flow.mp4
+```
+
+Inspect the first frame, action frame, transient state, and settled frame before
+citing the artifact. Keep the original frame directory until verification is
+published; it is useful when a reviewer asks about a one-frame defect.
+
+## Boundaries
+
+- CDP frames are headless/cloud-safe and exclude browser or Electron window
+ chrome.
+- A native file picker, permission prompt, menu, or other OS-owned surface is not
+ present in these frames. Follow the selected surface's conditional native-step
+ guidance when that chrome is part of the criterion.
+- Use `--by agent-browser` for the captured frames and `--by program` for the
+ assembled media artifact.
+- `agent-browser` and `ffmpeg`/`ffprobe` are required. Probe them before the run.
+
+Choose `gif` versus `video` and submit the artifact using the shared contract in
+[evidence.md](./evidence.md).
diff --git a/packages/builtin-skills/src/acceptance/references/recording-ios-simulator.md b/packages/builtin-skills/src/acceptance/references/recording-ios-simulator.md
new file mode 100644
index 00000000000..7595625333b
--- /dev/null
+++ b/packages/builtin-skills/src/acceptance/references/recording-ios-simulator.md
@@ -0,0 +1,76 @@
+# iOS Simulator framebuffer recording
+
+Use this reference only for an iOS Simulator criterion that requires temporal
+evidence. Record device pixels directly with `simctl`; this excludes Simulator
+window chrome and is stronger evidence than a host-screen crop. Use an explicit
+UDID when more than one device is booted.
+
+## Record and finalize
+
+```bash
+# Start in a persistent terminal/session and wait until stderr says
+# "Recording started" before driving the scenario.
+xcrun simctl io "$UDID" recordVideo --codec=h264 ./proof/ios-flow.mp4 \
+ 2> ./proof/ios-recording.log
+
+# Drive the scenario with AXe or the repository's existing native CLI/UI tests in
+# parallel. Stop the recorder with SIGINT (Ctrl-C), then wait for finalization.
+```
+
+Do not use SIGKILL: `simctl` must flush in-flight frames and finalize the movie.
+An interrupted recorder command may return a non-zero shell status after a
+successful SIGINT finalization; judge the artifact with `ffprobe`, not that status
+alone.
+
+AXe also exposes `record-video --fps <1-30> --quality <1-100>`, but terminal
+wrappers can intercept SIGINT before AXe writes MP4 metadata. Use it only after a
+short probe file passes `ffprobe`; otherwise retain AXe for input/Accessibility
+and use `simctl` for recording.
+
+## Verify the movie
+
+```bash
+ffprobe -v error \
+ -show_entries format=duration:stream=codec_name,width,height,r_frame_rate,avg_frame_rate,nb_frames \
+ -of json ./proof/ios-flow.mp4
+```
+
+Simulator recordings can be variable-frame-rate. Treat a requested rate as a
+target, not a guarantee; use `avg_frame_rate` and `nb_frames` as the observed
+values.
+
+## Extract every encoded frame
+
+Use this path for one-frame flashes, flicker, or exact transition continuity:
+
+```bash
+FRAME_DIR=$(mktemp -d)
+ffmpeg -i ./proof/ios-flow.mp4 -map 0:v:0 -fps_mode passthrough \
+ "$FRAME_DIR/frame_%06d.png"
+```
+
+Count the generated PNGs and compare the total with `ffprobe`'s `nb_frames`.
+Variable timestamps can produce non-monotonic-DTS warnings from the image muxer;
+the count check determines whether every decoded frame was retained.
+
+## Sample frames and contact sheets
+
+For ordinary UI review, sample at a declared rate and retain the raw video:
+
+```bash
+ffmpeg -i ./proof/ios-flow.mp4 -vf "fps=10" \
+ ./proof/review-frame_%06d.png
+
+ffmpeg -i ./proof/ios-flow.mp4 \
+ -vf "fps=2,scale=360:-1,tile=4x4:padding=8:margin=8" \
+ ./proof/contact_%03d.png
+```
+
+Inspect start, action, transient, and settled states. A contact sheet is a review
+index, not proof of gesture delivery; pair it with the driver action and fresh
+Accessibility/postcondition evidence from
+[the iOS Simulator surface](../surfaces/ios-simulator.md).
+
+Tag the direct recording as `--by cli` and deterministic frame/contact-sheet
+transforms as `--by program`. Submit using the shared contract in
+[evidence.md](./evidence.md).
diff --git a/packages/builtin-skills/src/acceptance/references/recording-native-macos.md b/packages/builtin-skills/src/acceptance/references/recording-native-macos.md
new file mode 100644
index 00000000000..0f4e7642a95
--- /dev/null
+++ b/packages/builtin-skills/src/acceptance/references/recording-native-macos.md
@@ -0,0 +1,40 @@
+# Native macOS screen recording
+
+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.
+
+## Record the host screen
+
+Prefer a fixed duration so the recorder finalizes without an external kill:
+
+```bash
+screencapture -V 15 ./proof/native-flow.mp4
+```
+
+For explicit encoder control, identify the AVFoundation screen device first,
+then record it with `ffmpeg`:
+
+```bash
+ffmpeg -f avfoundation -list_devices true -i ""
+
+# Replace 1 with the discovered screen device index.
+ffmpeg -y -f avfoundation -framerate 30 -i "1:none" -t 15 \
+ -c:v libx264 -crf 23 -pix_fmt yuv420p ./proof/native-flow.mp4
+```
+
+Convert a short clip to GIF when inline playback is important:
+
+```bash
+ffmpeg -y -i ./proof/native-flow.mp4 \
+ -vf "fps=8,scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
+ ./proof/native-flow.gif
+```
+
+Inspect the resulting file before citing it and confirm that no unrelated window,
+notification, or secret entered the host-screen capture. Tag direct
+`screencapture` output as `--by cli` and FFmpeg-derived media as `--by program`.
+
+For input and Accessibility commands, use
+[computer-use.md](./computer-use.md). Choose `gif` versus `video` and submit using
+the shared contract in [evidence.md](./evidence.md).
diff --git a/packages/builtin-skills/src/acceptance/references/recording.md b/packages/builtin-skills/src/acceptance/references/recording.md
deleted file mode 100644
index 8c27caeb2ac..00000000000
--- a/packages/builtin-skills/src/acceptance/references/recording.md
+++ /dev/null
@@ -1,97 +0,0 @@
-# Recording โ€” GIF & MP4 evidence
-
-When a criterion asserts behavior **over time** โ€” streaming output, a loadingโ†’
-loaded transition, a ticking timer, an animation, a multi-step flow โ€” a static
-screenshot can't prove it. Record a clip and upload it as `gif` or `video`
-evidence. This is a first-class capability, not a nice-to-have: time-based claims
-are unverifiable without it.
-
-Two ways to record. **Prefer the CDP frame-sequence path** โ€” it's headless/
-cloud-portable; OS screen recording is macOS-only.
-
-## Path 1 โ€” CDP frame sequence โ†’ MP4/GIF (portable, recommended)
-
-Capture a sequence of `agent-browser` screenshots while the behavior happens, then
-assemble with `ffmpeg`. Works on web (`--session`) and Electron (`--cdp`), and runs
-headless (no display, cloud-safe) because frames come from the browser engine, not
-the OS screen. It also sidesteps the corrupt-MP4-on-kill problem that ffmpeg screen
-capture has.
-
-```bash
-# 1. capture frames while driving the scenario
-FRAMES=$(mktemp -d)
-TARGET="--session app" # or "--cdp 9222" for Electron
-i=0
-# start your scenario in the background or in another step, then:
-while [ $i -lt 40 ]; do # ~20s at 0.5s/frame
- printf -v n "%06d" $i
- agent-browser $TARGET screenshot "$FRAMES/frame_$n.png"
- i=$((i + 1))
- sleep 0.5
-done
-
-# 2a. assemble an MP4 (~2 fps)
-ffmpeg -y -framerate 2 -i "$FRAMES/frame_%06d.png" \
- -c:v libx264 -crf 23 -pix_fmt yuv420p ./proof/flow.mp4
-
-# 2b. or a GIF (good palette = legible inline)
-ffmpeg -y -framerate 2 -i "$FRAMES/frame_%06d.png" \
- -vf "scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
- ./proof/flow.gif
-
-rm -rf "$FRAMES"
-```
-
-Tune the frame interval to the behavior: faster (`0.25s`) for quick animations,
-slower (`1s`) for long flows. Keep the clip scoped โ€” a few seconds of the actual
-behavior, not the whole session.
-
-## Path 2 โ€” OS screen recording (macOS, local only)
-
-When you must capture the real screen โ€” native windows, OS chrome, a non-Chromium
-app driven via [computer-use.md](./computer-use.md) โ€” record at the OS level. This
-is **macOS-only and not cloud-portable**.
-
-```bash
-# built-in: record the screen to MP4 (Ctrl-C / kill to stop; or -V N for N seconds)
-screencapture -v ./proof/demo.mp4
-screencapture -V 15 ./proof/demo.mp4 # fixed 15s capture
-
-# ffmpeg avfoundation (list devices first: ffmpeg -f avfoundation -list_devices true -i "")
-ffmpeg -y -f avfoundation -framerate 30 -i "1:none" -t 15 \
- -c:v libx264 -crf 23 -pix_fmt yuv420p ./proof/demo.mp4
-```
-
-Convert an MP4 to GIF when you need an inline-renderable artifact:
-
-```bash
-ffmpeg -y -i ./proof/demo.mp4 \
- -vf "fps=8,scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
- ./proof/demo.gif
-```
-
-## GIF vs MP4 โ€” which to upload
-
-- **GIF** โ€” short (โ‰ค \~10s) UI behavior that should render inline in the report
- (loading state, a toast, a streamed line appearing). Renders without a player.
-- **MP4** โ€” longer demos or multi-step flows where file size matters and a player
- is acceptable. Larger, but better quality per byte.
-
-## Upload
-
-```bash
-lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" --type gif \
- --file ./proof/flow.gif --by agent-browser \
- --desc "Response streams in token-by-token after send"
-
-lh acceptance run result submit --operation "$LOBE_OPERATION_ID" --item "$CHECK_ITEM_ID" --type video \
- --file ./proof/demo.mp4 --by cdp --desc "End-to-end import flow completes"
-```
-
-## Prerequisites & portability
-
-- **ffmpeg** โ€” `brew install ffmpeg` (or `bun add -g ffmpeg-static`). Needed for
- both paths' assembly/conversion.
-- **agent-browser** โ€” for the CDP frame path ([agent-browser.md](./agent-browser.md)).
-- Path 1 is headless/cloud-safe; Path 2 is macOS-only โ€” see
- [evidence.md](./evidence.md#headless--cloud-portability).
diff --git a/packages/builtin-skills/src/acceptance/references/report.md b/packages/builtin-skills/src/acceptance/references/report.md
index 6052062380a..9e4e9dd0a5b 100644
--- a/packages/builtin-skills/src/acceptance/references/report.md
+++ b/packages/builtin-skills/src/acceptance/references/report.md
@@ -11,22 +11,38 @@ its evidence inline โ€” **images render as figures, before/after pairs render
under tinted comparison bands**. A chat-only summary or a bare markdown report
never gets that rendering; the structured round does.
+## Contents
+
+- [No operation ID needed](#no-operation-id-needed)
+- [Immutable rounds](#rounds-are-immutable)
+- [Directory layout](#directory-layout)
+- [Workflow](#workflow)
+- [result.json schema](#resultjson-schema)
+- [Rules](#rules)
+
Rule of thumb: **plan exists โ†’ per-criterion submit; you author the checks โ†’
structured round ingest.** Never mix both for the same delivery round.
## No operation id needed
-`--operation` is optional on every command in this skill. Without one you have
-two ways to own a round, and both are first-class (the server records them as
-`standalone`):
+`--operation` is optional on every command in this skill. Without one, author
+the checks and use one of these first-class paths:
```bash
-# A. one directory, one command โ€” preferred when you have assets on disk
-lh acceptance run ingest topic:tpc_xxx --json < report-dir > --subject
+REPORT_DIR=./acceptance-report
+
+# A. first external-project round โ€” creates a standalone acceptance automatically
+lh acceptance run ingest "$REPORT_DIR" --json
+
+# Re-verification โ€” append a new immutable round to the same acceptance
+lh acceptance run ingest "$REPORT_DIR" --acceptance "$ACCEPTANCE_ID" --json
+
+# Existing LobeHub subject โ€” group by a Task, Topic, or Document
+lh acceptance run ingest "$REPORT_DIR" --subject topic:tpc_xxx --json
-# B. create the round first, then submit into it with --run
+# B. atomic fallback โ€” create the round first, then submit into it with --run
RUN=$(lh acceptance run create --title "โ€ฆ" --goal "โ€ฆ" --json | jq -r .id)
-lh acceptance run result submit --run "$RUN" --item < checkItemId > โ€ฆ
+lh acceptance run result submit --run "$RUN" --item "$CHECK_ITEM_ID" โ€ฆ
```
Prefer **A**: per-criterion submits without a plan produce checks with no
@@ -39,7 +55,8 @@ re-submit into the previous round to make it look green โ€” publish the
re-verification as the next round. The acceptance
(`/acceptance/<acceptanceId>`) aggregates the rounds in order, so the repair
history is the point, not something to hide. Reuse the same `--subject` across
-rounds; that is what groups them.
+rounds for a LobeHub object, or pass `--acceptance <acceptanceId>` after an
+external project's first standalone round.
## Directory layout
@@ -76,15 +93,17 @@ Any directory works โ€” no repo convention required:
6. **Publish:**
```bash
- lh acceptance run ingest topic:tpc_xxx --source agent-testing --json < report-dir > --subject
+ lh acceptance run ingest "$REPORT_DIR" --source agent-testing --json
```
- Inside a LobeHub topic `--subject` may be omitted (defaults to the current
- topic); outside one it is mandatory (`task:` | `topic:` | `document:`). The
- command creates a new immutable round, uploads cases + evidence + report
- body, and prints `/verify/<verifyRunId>` and `/acceptance/<acceptanceId>` โ€”
- include the full URLs in your final reply. Never update a prior round after
- a fix; publish the re-verification as the next round.
+ Inside a LobeHub topic, the command groups the round under the current topic.
+ Outside one, it creates a standalone acceptance automatically; no Task ID is
+ required. To publish a repair into that same history, add
+ `--acceptance <acceptanceId>` using the ID printed by the first ingest. The
+ command uploads cases + evidence + report body and prints
+ `/verify/<verifyRunId>` and `/acceptance/<acceptanceId>` โ€” include the full
+ URLs in your final reply. Never update a prior round after a fix; publish the
+ re-verification as the next round.
## result.json schema
diff --git a/packages/builtin-skills/src/acceptance/surfaces/cli.md b/packages/builtin-skills/src/acceptance/surfaces/cli.md
index 72aae5cb0c1..6e0e57abe0f 100644
--- a/packages/builtin-skills/src/acceptance/surfaces/cli.md
+++ b/packages/builtin-skills/src/acceptance/surfaces/cli.md
@@ -6,8 +6,8 @@ evidence: a passing assertion or a correct JSON result is harder to fake than a
screenshot, and it runs anywhere (no browser, no display).
Use this surface when your change is verifiable by running something and reading
-what it prints. Escalate to [web.md](./web.md) or [electron.md](./electron.md)
-only when the criterion is actually about rendered UI.
+what it prints. Return to the surface router only when the criterion is actually
+about rendered UI.
## How to verify
@@ -41,7 +41,8 @@ Provenance: `cli` for command stdout, `program` for a script/test you ran. See
The `lh` CLI you upload with is already authed. A _different_ product CLI under
test carries its own auth (API key or stored login) โ€” configure it before
-capturing its output. See [../references/auth.md](../references/auth.md#cli--backend-surface).
+capturing its output, and verify the credential belongs to the intended test
+environment.
## Boundaries
@@ -51,4 +52,4 @@ capturing its output. See [../references/auth.md](../references/auth.md#cli--bac
criterion (or describe them in `--desc`), not a 10k-line log the reviewer must
scan.
- **Never upload secrets.** Strip tokens/keys from output before uploading โ€” see
- [../references/auth.md](../references/auth.md#boundaries--read-before-touching-cookies).
+ [../references/evidence.md](../references/evidence.md#artifact-safety).
diff --git a/packages/builtin-skills/src/acceptance/surfaces/electron.md b/packages/builtin-skills/src/acceptance/surfaces/electron.md
index 793f1d67c42..326ff1a126c 100644
--- a/packages/builtin-skills/src/acceptance/surfaces/electron.md
+++ b/packages/builtin-skills/src/acceptance/surfaces/electron.md
@@ -2,13 +2,12 @@
Use this surface for **desktop-only behavior** โ€” native windows, IPC / main-process
code, tray/menu, auto-update, OS integration, or a packaged-only path. That code
-doesn't exist in a plain web page, so [web.md](./web.md) can't prove it. You drive
-the running app's renderer over CDP with `agent-browser`
+doesn't exist in a plain web page. Drive the running app's renderer over CDP with `agent-browser`
([../references/agent-browser.md](../references/agent-browser.md)).
-For a change that behaves identically in a browser, prefer [web.md](./web.md) โ€”
-it's lighter and cloud-portable. Use Electron only when the criterion calls out
-the desktop shell.
+For a change that behaves identically in a browser, return to the router and use
+the lighter, cloud-portable Web surface. Use Electron only when the criterion
+calls out the desktop shell.
## Setup
@@ -24,8 +23,8 @@ agent-browser --cdp 9222 screenshot ./proof/desktop-state.png
```
3. Auth: a desktop app usually keeps its own persistent login state in its
- user-data dir โ€” log in once in the app and it survives restarts; no injection
- needed (see [../references/auth.md](../references/auth.md#desktop)).
+ user-data dir โ€” log in once in the app and it survives restarts. Verify the
+ signed-in state through the attached renderer before capturing evidence.
## Reading app state
@@ -83,17 +82,20 @@ agent-browser --cdp 9222 eval "JSON.stringify(window.__ERRORS__)" # โ†’ text evi
## Time-based behavior & OS-level steps
- **Behavior over time** needs a clip โ€” record CDP frames into MP4/GIF:
- [../references/recording.md](../references/recording.md).
+ [../references/recording-cdp.md](../references/recording-cdp.md).
- **Native chrome around the app** (file pickers, system dialogs, menu-bar/dock,
permission prompts) lives outside the renderer โ€” drive it with Computer Use:
[../references/computer-use.md](../references/computer-use.md).
## Boundaries โ€” headless / cloud
+Tag renderer artifacts captured by `agent-browser` as `--by agent-browser`; use
+`--by cdp` only for a direct CDP client capture.
+
Electron runs on Linux but has no true headless mode โ€” it needs a display server.
In a headless/cloud environment, wrap the launch with `xvfb-run` (virtual
framebuffer). Everything CDP-based keeps working under Xvfb (connection, snapshots,
eval, `agent-browser screenshot` โ€” captured from the renderer, not the OS screen).
What does NOT work: OS-window capture (`screencapture`), osascript, and native
screen recording โ€” all macOS-only. Keep evidence CDP-based to stay cloud-portable
-(see [../references/evidence.md](../references/evidence.md#headless--cloud-portability)).
+whenever the renderer owns the criterion.
diff --git a/packages/builtin-skills/src/acceptance/surfaces/ios-simulator.md b/packages/builtin-skills/src/acceptance/surfaces/ios-simulator.md
new file mode 100644
index 00000000000..584b7a62a50
--- /dev/null
+++ b/packages/builtin-skills/src/acceptance/surfaces/ios-simulator.md
@@ -0,0 +1,247 @@
+# iOS Simulator surface
+
+Use this surface when a criterion depends on native iOS rendering, navigation,
+gestures, lifecycle, system sheets, or device-size layout. It requires macOS,
+Xcode, and an installed Simulator runtime; it is not cloud-portable.
+
+The required workflow is shell-only: every input and capture step must be
+executable by a general agent through a documented CLI. An agent-specific GUI
+controller or private plugin is not a prerequisite.
+
+## Contents
+
+- [Proof contract](#proof-contract)
+- [Probe and choose a CLI driver](#probe-and-choose-a-cli-driver)
+- [Establish the tested build](#establish-the-tested-build)
+- [Inspect and interact](#inspect-before-acting)
+- [Capture and review evidence](#capture-device-evidence)
+- [Decide the case status](#decide-the-case-status)
+
+## Proof contract
+
+Separate the plan into observable claims before testing:
+
+1. **Build/install/launch** โ€” the current source produced the app now running.
+2. **Static UI state** โ€” the expected controls, content, and layout are visible.
+3. **Behavior over time** โ€” an animation, transition, or multi-step flow occurred.
+4. **Touch semantics** โ€” the intended tap, long press, swipe, or pan was actually
+ delivered before judging the product response.
+5. **Hardware-only behavior** โ€” haptics, thermal behavior, camera input, and
+ real-device performance require a physical device; Simulator cannot prove them.
+
+Record the repository, branch, commit, dirty state, build command, Xcode version,
+Simulator model/runtime/UDID, bundle identifier, and tested time. A screenshot
+from an old install is not evidence for the current source.
+
+## Probe and choose a CLI driver
+
+Prefer a CLI that talks to Simulator Accessibility and HID directly. Probe the
+host rather than assuming one tool is installed:
+
+```bash
+command -v axe
+command -v idb
+command -v idb_companion
+command -v cliclick
+command -v ffmpeg
+command -v ffprobe
+xcrun simctl help io
+```
+
+| Tool | Responsibility in this workflow |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------- |
+| AXe | Accessibility inspection; selector/coordinate tap; touch, swipe, drag, and preset gesture injection; screenshots |
+| `simctl` | Device discovery and lifecycle; app install/launch; logs; authoritative framebuffer screenshots and recording |
+| `ffprobe` | Prove the recorded movie is readable and report its observed duration, dimensions, rate, and frame count |
+| `ffmpeg` | Losslessly enumerate decoded frames, sample review frames, and generate contact sheets |
+| `idb` + `idb_companion` | Optional alternative driver only when both halves are installed and working |
+| `cliclick` | Last-resort host-window click for smoke testing; not proof of native touch semantics |
+
+Driver priority:
+
+1. **AXe** โ€” preferred general-purpose agent driver. It resolves accessibility
+ selectors, injects taps/touch/swipe/drag, describes UI, and captures
+ screenshots. Treat its video recorder as a probe-only fallback to `simctl`.
+2. **The repository's existing XCUITest or documented CLI driver** โ€” use when AXe
+ is absent or the project already owns stronger domain assertions.
+3. **`idb` + `idb_companion` together** โ€” use only when both client and companion
+ are available. `idb_companion` alone is not an interaction CLI.
+4. **`cliclick`** โ€” host-window fallback for a simple click only. It depends on
+ Simulator window geometry and does not independently prove native HID semantics.
+
+If no available driver can express the planned gesture, mark the case `blocked`.
+Do not switch to a private agent plugin or silently downgrade a long press to a
+tap. If AXe must be installed, use its official distribution only after the task
+scope allows installation; otherwise report the missing prerequisite.
+
+```bash
+# Only when AXe is absent and dependency installation is explicitly in scope.
+brew install cameroncooke/axe/axe
+```
+
+The examples below target AXe. Run `axe --version`, `axe --help`, and
+`axe help <subcommand>` first because capabilities may differ by installed
+version.
+
+## Establish the tested build
+
+Resolve one explicit device and keep using its UDID. Avoid `booted` after device
+selection when several Simulators may be running.
+
+```bash
+axe list-simulators
+xcrun simctl list devices booted --json > ./proof/simulator-devices.json
+xcodebuild -version > ./proof/xcode-version.txt
+
+# Build with the repository's canonical command first, then install its product.
+xcrun simctl install "$UDID" "$APP_PATH"
+xcrun simctl launch --terminate-running-process "$UDID" "$BUNDLE_ID"
+```
+
+For a development client, also prove that its Metro/dev-server URL is reachable
+and that the newly built native binary, rather than a stale installation, opened.
+Save the build product path and modification time in the text evidence.
+
+## Inspect before acting
+
+Read the current Accessibility hierarchy before choosing selectors or coordinates:
+
+```bash
+axe describe-ui --udid "$UDID" > ./proof/before-ui.txt
+axe describe-ui --point 220,710 --udid "$UDID"
+```
+
+Prefer `--id` (accessibility identifier), then `--label` plus `--element-type`.
+Use coordinates only when the UI exposes no unambiguous selector. Stable
+identifiers make the same flow reusable across device sizes and reduce accidental
+actions on the wrong control. If selector resolution reports multiple matches or
+an invalid/zero-size frame, inspect the intended control with `--point` and use
+its device coordinates; do not force the ambiguous selector.
+
+## Tap and run multi-step flows
+
+```bash
+# Selector tap with polling and a settle delay.
+axe tap --id photo-info-button --wait-timeout 5 --post-delay 0.5 --udid "$UDID"
+
+# Disambiguated label tap.
+axe tap --label 'Exposure & Metering' --element-type Button --udid "$UDID"
+
+# Coordinate fallback using physical touch down/up.
+axe tap -x 220 -y 710 --tap-style physical --udid "$UDID"
+```
+
+Most AXe HID commands are fire-and-forget: successful dispatch does not prove the
+app processed the event. Always re-read UI or capture the post-state.
+
+Prefer `axe batch` for a fixed multi-step flow so one HID session executes all
+steps. Use selector polling for transitions and refresh the AX cache when screens
+change:
+
+```bash
+axe batch --udid "$UDID" --wait-timeout 5 --ax-cache perStep \
+ --step "tap --id first-photo" \
+ --step "sleep 0.5" \
+ --step "tap --id photo-info-button"
+```
+
+Use discrete commands instead when the next selector/coordinate depends on
+runtime inspection of the previous state.
+
+## Deliver long press, swipe, and drag precisely
+
+AXe exposes the touch primitives that host-mouse automation often lacks:
+
+```bash
+# Long press: explicit touch down, hold, and touch up.
+axe touch -x 220 -y 710 --down --up --delay 0.6 --udid "$UDID"
+
+# Horizontal page swipe with controlled duration.
+axe swipe --start-x 330 --start-y 430 --end-x 70 --end-y 430 \
+ --duration 0.6 --post-delay 0.5 --udid "$UDID"
+
+# Low-level drag with explicit move-event density.
+axe drag --start-x 200 --start-y 350 --end-x 200 --end-y 760 \
+ --duration 0.8 --steps 80 --post-delay 0.5 --udid "$UDID"
+
+# Device-relative common pattern; provide the actual screen dimensions.
+axe gesture scroll-left --screen-width 402 --screen-height 874 \
+ --duration 0.6 --udid "$UDID"
+```
+
+Derive coordinates from `describe-ui` and the selected device, not from a
+screenshot displayed at an unknown host scale. A dispatched gesture is only the
+input half of the proof; verify the expected page identity, count, disclosure,
+or visual state afterward.
+
+## Capture device evidence
+
+Capture clean device pixels with AXe or `simctl`, not a cropped host-window
+screenshot:
+
+```bash
+axe screenshot --udid "$UDID" --output ./proof/after.png
+xcrun simctl io "$UDID" screenshot --type=png ./proof/after-simctl.png
+```
+
+For transitions and multi-step behavior, record the Simulator framebuffer and
+derive every-frame or sampled contact sheets using
+[../references/recording-ios-simulator.md](../references/recording-ios-simulator.md).
+Keep the original MP4; a contact sheet is an index for review, not a replacement
+for temporal evidence. Treat requested recording FPS as a target only: Simulator
+movies may be variable-frame-rate, so verify actual duration, rate, and frame count
+with `ffprobe`.
+
+After each material action, preserve a fresh UI hierarchy as text evidence:
+
+```bash
+axe describe-ui --udid "$UDID" > ./proof/after-ui.txt
+```
+
+For diagnostics, capture a scoped log after the interaction:
+
+```bash
+xcrun simctl spawn "$UDID" log show --style compact --last 5m \
+ --predicate 'process == "YourApp"' > ./proof/runtime.log
+```
+
+Treat runtime warnings precisely: report relevant crashes/assertions, distinguish
+environment noise, and never use the absence of a visible crash as proof that all
+logs are harmless.
+
+## Review UI evidence
+
+- **Static layout:** inspect a full-resolution device screenshot; check clipping,
+ overlap, hierarchy, safe areas, text, selected state, and target identity.
+- **Animation/transition:** inspect the raw MP4 plus extracted start/event/end
+ frames. Extract every encoded frame when timing, flicker, or a one-frame flash
+ is the claim; otherwise use a declared sampling rate and retain the video.
+- **Gesture:** pair the exact AXe command with the postcondition. A final
+ screenshot alone cannot prove which gesture caused it.
+- **Accessibility:** compare the visual state with `describe-ui` before/after.
+ A visually correct control that cannot be identified or activated remains an
+ accessibility concern rather than an unqualified pass.
+- **Performance:** Simulator footage can reveal gross stalls but cannot establish
+ physical-device FPS, thermal, energy, or haptic quality.
+
+## Decide the case status
+
+| Status | Use when |
+| --------- | ----------------------------------------------------------------------------------------------------- |
+| `pass` | The required input was delivered, the expected state was observed, and required evidence was captured |
+| `fail` | The required input was delivered and the product violated the expected behavior |
+| `blocked` | The build/environment/driver could not execute or observe the required condition |
+
+For a blocked case, attach the recording or screenshot, UI hierarchy before/after,
+the attempted command, stderr/exit status, and the missing driver capability. A
+fallback close button, ordinary tap, or static frame may be useful smoke evidence
+but cannot satisfy a different planned gesture.
+
+CLI interactions may mutate live data. Use a test fixture when possible. If an
+exploratory command appends a reaction, message, or other irreversible record,
+disclose the exact side effect in the report.
+
+Publish the artifacts with the plan-driven submit flow or place them under the
+structured report's `assets/` directory and ingest the whole round. Tag direct
+AXe/`simctl` captures as `--by cli`, deterministic UI-test/media-transform output
+as `--by program`, and preserve the device identity in every artifact description.
diff --git a/packages/builtin-skills/src/acceptance/surfaces/native.md b/packages/builtin-skills/src/acceptance/surfaces/native.md
index 1ada1009bb4..92994a72049 100644
--- a/packages/builtin-skills/src/acceptance/surfaces/native.md
+++ b/packages/builtin-skills/src/acceptance/surfaces/native.md
@@ -6,18 +6,19 @@ verify against (Slack/WeChat/โ€ฆ), Finder/system UI, or any OS-level behavior. Y
drive it with macOS Computer Use (osascript + screencapture) โ€” the toolkit is in
[../references/computer-use.md](../references/computer-use.md).
-Prefer the other surfaces when they can reach the target: [web.md](./web.md) /
-[electron.md](./electron.md) for Chromium UIs, [cli.md](./cli.md) for backend.
-Native is the **local-macOS escape hatch** โ€” it is not cloud-portable (needs a real
-display + Accessibility permission), so reach for it only when CDP can't.
+Return to the router when Chromium automation or command output can reach the
+target. Native is the **local-macOS escape hatch** โ€” it is not cloud-portable
+(needs a real display + Accessibility permission), so reach for it only when CDP
+cannot.
## How to verify
1. Activate the app and navigate to the state under test (keystrokes / shortcuts /
clicks โ€” see the toolkit).
2. Drive the action that exercises your change.
-3. Capture proof: a `screencapture` PNG, a screen recording for time-based behavior
- ([../references/recording.md](../references/recording.md#path-2--os-screen-recording-macos-local-only)),
+3. Capture proof: a `screencapture` PNG, a screen recording for time-based
+ behavior
+ ([../references/recording-native-macos.md](../references/recording-native-macos.md)),
or screen text via select-all-copy + `pbpaste`.
```bash
diff --git a/packages/builtin-skills/src/acceptance/surfaces/web.md b/packages/builtin-skills/src/acceptance/surfaces/web.md
index ea8665700dc..3089db32b22 100644
--- a/packages/builtin-skills/src/acceptance/surfaces/web.md
+++ b/packages/builtin-skills/src/acceptance/surfaces/web.md
@@ -6,16 +6,17 @@ sides of a contract in one run. Driven by `agent-browser`
([../references/agent-browser.md](../references/agent-browser.md)).
Use web when the behavior is the same in a normal browser against the app's dev
-server or a deployed URL. If the criterion depends on the desktop shell, use
-[electron.md](./electron.md) instead; if it's backend/CLI, use [cli.md](./cli.md).
+server or a deployed URL. Return to the surface router if the criterion depends
+on the desktop shell or is fully provable through backend/CLI output.
## Setup
1. Have the app reachable at a URL: a local dev server you started (e.g.
`http://localhost:<port>`), or a deployed/preview URL the task targets.
2. If the state under test is behind login, authenticate the agent-browser
- session first โ€” see [../references/auth.md](../references/auth.md). Use a named
- `--session` so cookies persist across commands.
+ session first โ€” see
+ [../references/auth-web.md](../references/auth-web.md). Use a named `--session`
+ so cookies persist across commands.
```bash
SESSION=app
@@ -56,14 +57,16 @@ proves frontend behavior, not backend changes.
## Time-based behavior & OS-level steps
- **Behavior over time** (streaming, loadingโ†’loaded, animation) needs a clip, not a
- screenshot โ€” record it: [../references/recording.md](../references/recording.md).
+ screenshot โ€” record CDP frames:
+ [../references/recording-cdp.md](../references/recording-cdp.md).
- **A native step the page can't script** (file picker, OS permission prompt, Save
dialog) โ€” drop to Computer Use for that step, then return:
[../references/computer-use.md](../references/computer-use.md).
## Boundaries
+- **Provenance:** tag artifacts captured by `agent-browser` as
+ `--by agent-browser`; use `--by cdp` only for a direct CDP client capture.
- **Headless / cloud:** web is cloud-native โ€” headless Chromium and CDP screenshots
- work without a display. Prefer CDP capture over OS-level capture (see
- [../references/evidence.md](../references/evidence.md#headless--cloud-portability)).
+ work without a display. Prefer CDP capture over OS-level capture.
- **HMR breaks refs.** After a hot reload during dev, re-snapshot before interacting.
diff --git a/packages/const/src/verify.ts b/packages/const/src/verify.ts
index 9ab0f3df3e5..340a0f2265e 100644
--- a/packages/const/src/verify.ts
+++ b/packages/const/src/verify.ts
@@ -129,7 +129,7 @@ export const normalizeVerifySurface = (value: string): VerifySurface | null => {
* is not coupled to task-only workflows: a future run can accept a topic,
* document, artifact, release, etc. without another schema reshape.
*/
-export const acceptanceSubjectTypes = ['task', 'topic', 'document'] as const;
+export const acceptanceSubjectTypes = ['task', 'topic', 'document', 'standalone'] as const;
export type AcceptanceSubjectType = (typeof acceptanceSubjectTypes)[number];
/**
diff --git a/packages/database/src/models/__tests__/acceptance.test.ts b/packages/database/src/models/__tests__/acceptance.test.ts
index 0636a312a4b..867c8223408 100644
--- a/packages/database/src/models/__tests__/acceptance.test.ts
+++ b/packages/database/src/models/__tests__/acceptance.test.ts
@@ -67,6 +67,24 @@ describe('AcceptanceModel', () => {
expect(third.requirement).toBe('Review UX polish ships end to end');
});
+ it('keeps the first standalone display title and backfills one when initially absent', async () => {
+ const model = new AcceptanceModel(serverDB, userId);
+ const subjectId = 'standalone-external-delivery';
+
+ const first = await model.ensureForSubject('standalone', subjectId);
+ expect(first.metadata?.title).toBeUndefined();
+
+ const titled = await model.ensureForSubject('standalone', subjectId, {
+ metadata: { title: 'External delivery' },
+ });
+ expect(titled.metadata?.title).toBe('External delivery');
+
+ const unchanged = await model.ensureForSubject('standalone', subjectId, {
+ metadata: { title: 'Replacement title' },
+ });
+ expect(unchanged.metadata?.title).toBe('External delivery');
+ });
+
it('defaults visibility by scope: personal public, workspace private', async () => {
const personal = new AcceptanceModel(serverDB, userId);
const personalRow = await personal.ensureForSubject('topic', topicId);
diff --git a/packages/database/src/models/acceptance.ts b/packages/database/src/models/acceptance.ts
index 41f7a3af984..b7873260669 100644
--- a/packages/database/src/models/acceptance.ts
+++ b/packages/database/src/models/acceptance.ts
@@ -12,7 +12,8 @@ const TERMINAL_ACCEPTANCE_STATUSES = new Set<AcceptanceStatus>(['accepted', 'clo
/**
* Owns the business-level acceptance aggregate (`acceptances`): one row per
- * subject (task / topic / document) carrying the user-facing lifecycle state.
+ * subject (task / topic / document / standalone delivery) carrying the
+ * user-facing lifecycle state.
* The verify rounds chain onto it through `verify_runs.acceptance_id` +
* `round_index`; this model deliberately holds no round pointers โ€” root /
* current / latest-report are all derived from that chain at read time.
@@ -82,7 +83,7 @@ export class AcceptanceModel {
ensureForSubject = async (
subjectType: AcceptanceSubjectType,
subjectId: string,
- defaults?: Partial<Pick<NewAcceptance, 'config' | 'requirement'>>,
+ defaults?: Partial<Pick<NewAcceptance, 'config' | 'metadata' | 'requirement'>>,
): Promise<AcceptanceItem> => {
const existing = await this.findBySubject(subjectType, subjectId);
if (existing) {
@@ -90,12 +91,25 @@ export class AcceptanceModel {
// WITHOUT one (a first ingest that omitted it) accepts the first
// non-empty statement a later round supplies, instead of staying blank
// forever ("ๅฐšๆœช่ฎฐๅฝ•่ฏฅๅฏน่ฑก็š„้ชŒๆ”ถ็›ฎๆ ‡").
- if (!existing.requirement && defaults?.requirement) {
+ const nextRequirement = !existing.requirement ? defaults?.requirement : undefined;
+ const nextTitle =
+ !existing.metadata?.title && typeof defaults?.metadata?.title === 'string'
+ ? defaults.metadata.title
+ : undefined;
+ if (nextRequirement || nextTitle) {
+ const metadata = nextTitle ? { ...existing.metadata, title: nextTitle } : existing.metadata;
await this.db
.update(acceptances)
- .set({ requirement: defaults.requirement })
+ .set({
+ metadata,
+ requirement: nextRequirement ?? existing.requirement,
+ })
.where(eq(acceptances.id, existing.id));
- return { ...existing, requirement: defaults.requirement };
+ return {
+ ...existing,
+ metadata,
+ requirement: nextRequirement ?? existing.requirement,
+ };
}
return existing;
}
diff --git a/packages/database/src/schemas/verify.ts b/packages/database/src/schemas/verify.ts
index c50ec398636..7c5fb89b0c0 100644
--- a/packages/database/src/schemas/verify.ts
+++ b/packages/database/src/schemas/verify.ts
@@ -368,7 +368,8 @@ export const acceptances = pgTable(
/**
* Polymorphic accepted object. No FK on purpose: an acceptance may target task,
- * topic, document, or future subject types without reshaping this aggregate.
+ * topic, document, standalone delivery, or future subject types without
+ * reshaping this aggregate.
* Subject existence/ownership is validated in the service that creates it.
*/
subjectType: text('subject_type', { enum: acceptanceSubjectTypes }).notNull(),
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 360c45e544f..055853d2f27 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -228,6 +228,7 @@ export default {
'acceptance.status.repairing': 'Repair in progress',
'acceptance.status.verifying': 'Verification in progress',
'acceptance.subject.document': 'Document',
+ 'acceptance.subject.standalone': 'Standalone',
'acceptance.subject.task': 'Task',
'acceptance.subject.topic': 'Topic',
'acceptance.tray.addCheck': 'Add tracking item',
diff --git a/packages/types/src/verify.ts b/packages/types/src/verify.ts
index 45be1864b7f..00a1620c783 100644
--- a/packages/types/src/verify.ts
+++ b/packages/types/src/verify.ts
@@ -49,7 +49,7 @@ export type VerifyUserDecision = 'accepted' | 'rejected' | 'overridden';
* is not coupled to task-only workflows: a future run can accept a topic,
* document, artifact, release, etc. without another schema reshape.
*/
-export type AcceptanceSubjectType = 'task' | 'topic' | 'document';
+export type AcceptanceSubjectType = 'task' | 'topic' | 'document' | 'standalone';
/**
* Business-level acceptance state. Check-level and run-level verdicts stay in the
diff --git a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx
index 7bf49872f95..d427b9c08a2 100644
--- a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx
+++ b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/QuotaMenu/QuotaMenu.test.tsx
@@ -736,23 +736,25 @@ describe('ClaudeCodeQuotaMenu', () => {
it('auto-refreshes on the poll cadence while the tab stays visible', async () => {
vi.useFakeTimers({ shouldAdvanceTime: true });
try {
+ Object.defineProperty(document, 'visibilityState', {
+ configurable: true,
+ get: () => 'visible',
+ });
+
mockQuotaService.listAccounts.mockResolvedValue([persistedAccount()]);
mockQuotaService.getWindows.mockResolvedValue([persistedSessionWindow(Date.now() - 60_000)]);
mockService.getClaudeCodeQuota.mockResolvedValue(claudeSnapshot());
render(<ClaudeCodeQuotaMenu />);
- // Fresh persisted data: nothing hits the live API on mountโ€ฆ
expect(await screen.findByText('92%')).toBeTruthy();
expect(mockService.getClaudeCodeQuota).not.toHaveBeenCalled();
- // โ€ฆbut once the 2-minute cadence elapses the snapshot is stale and the
- // scheduled poll revalidates against the live API.
await act(async () => {
- vi.advanceTimersByTime(2 * 60_000 + 500);
+ await vi.advanceTimersByTimeAsync(2 * 60_000 + 500);
});
- await waitFor(() => expect(mockService.getClaudeCodeQuota).toHaveBeenCalledTimes(1));
+ expect(mockService.getClaudeCodeQuota).toHaveBeenCalledTimes(1);
} finally {
vi.useRealTimers();
}