@ihyeon/flow-qa 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,20 +22,24 @@ export const agentHandoffRequestSchema = z.object({
|
|
|
22
22
|
selection: z.object({ caseIds: z.array(idSchema).min(1).max(100), totalCases: z.number().int().min(2).max(100) }).strict().optional(),
|
|
23
23
|
suite: suiteSchema,
|
|
24
24
|
}).strict();
|
|
25
|
+
const observationSchema = z.object({
|
|
26
|
+
stepIndex: z.number().int().min(0).max(99),
|
|
27
|
+
outcome: z.enum(['matched', 'mismatch']),
|
|
28
|
+
detail: safeDetail,
|
|
29
|
+
evidence: evidencePath,
|
|
30
|
+
}).strict();
|
|
31
|
+
const emptyObservations = z.array(observationSchema).length(0);
|
|
32
|
+
const observedAssertions = z.array(observationSchema).min(1).max(100);
|
|
33
|
+
const agentResultCaseSchema = z.discriminatedUnion('status', [
|
|
34
|
+
z.object({ id: idSchema, status: z.literal('unverified'), observations: emptyObservations }).strict(),
|
|
35
|
+
z.object({ id: idSchema, status: z.literal('blocked'), reason: safeDetail, observations: emptyObservations }).strict(),
|
|
36
|
+
z.object({ id: idSchema, status: z.literal('observed-passed'), observations: observedAssertions }).strict(),
|
|
37
|
+
z.object({ id: idSchema, status: z.literal('observed-failed'), observations: observedAssertions }).strict(),
|
|
38
|
+
]);
|
|
25
39
|
export const agentResultSchema = z.object({
|
|
26
40
|
schemaVersion: z.literal('flow-qa/agent-result-1'),
|
|
27
41
|
requestSha256: hash,
|
|
28
|
-
cases: z.array(
|
|
29
|
-
id: idSchema,
|
|
30
|
-
status: z.enum(['unverified', 'blocked', 'observed-passed', 'observed-failed']),
|
|
31
|
-
reason: safeDetail.optional(),
|
|
32
|
-
observations: z.array(z.object({
|
|
33
|
-
stepIndex: z.number().int().min(0).max(99),
|
|
34
|
-
outcome: z.enum(['matched', 'mismatch']),
|
|
35
|
-
detail: safeDetail,
|
|
36
|
-
evidence: evidencePath,
|
|
37
|
-
}).strict()).max(100),
|
|
38
|
-
}).strict()).min(1).max(100),
|
|
42
|
+
cases: z.array(agentResultCaseSchema).min(1).max(100),
|
|
39
43
|
}).strict();
|
|
40
44
|
function within(parent, child) {
|
|
41
45
|
return child.startsWith(`${parent}${path.sep}`);
|
|
@@ -94,7 +98,7 @@ The registered target URL in \`request.json\` has no credentials, query, or frag
|
|
|
94
98
|
|
|
95
99
|
For a web case, execute steps in order: \`open\` navigates to the target origin plus its app-relative path (a leading \`/\` replaces any base URL path, matching the built-in runner); if the first step is not \`open\`, start at the target origin's \`/\`. \`click\` and \`fill\` use the specified role/name, label, text, or test ID; \`act\` is a natural-language browser action within the target; \`assertVisible\` checks the requested visibility; \`assertText\` checks exact or contained text; \`assertUrl\` checks the expected URL; \`assertAgent\` requires a reasoned observation of its stated condition. If a locator, prerequisite, or expected outcome is unclear, mark that case \`blocked\` and explain why. Stop a case on the first mismatch or blocked prerequisite. Do not invent missing setup or mark a step passed from an action alone.
|
|
96
100
|
|
|
97
|
-
Copy \`agent-result.template.json\` to a new \`agent-result.json\` and fill every selected case ID. Keep \`requestSha256\` unchanged. Use \`unverified\` for cases you did not inspect
|
|
101
|
+
Copy \`agent-result.template.json\` to a new \`agent-result.json\` and fill every selected case ID. Keep \`requestSha256\` unchanged. Use \`unverified\` for cases you did not inspect: omit \`reason\` and leave \`observations\` empty. Use \`blocked\` for cases that cannot be evaluated: include a concrete \`reason\` and leave \`observations\` empty. Use \`observed-passed\` only when every assertion was observed to match, and \`observed-failed\` when an assertion mismatch was observed. For either observed status, omit \`reason\` and record the mismatch explanation in the assertion's \`detail\`. List evaluated assertions in step order; for a failure, stop after the first mismatch. For each evaluated assertion, add its zero-based \`stepIndex\`, \`outcome\`, a concrete \`detail\` describing what appeared, and a file path such as \`evidence/TC-001-step-3.png\` or \`evidence/TC-001-step-3.txt\`. Create the referenced screenshot or text note under this folder's \`evidence/\` directory. Redact secrets and personal data before saving evidence. Do not claim a product defect from one observation; describe the observed mismatch and conditions.
|
|
98
102
|
|
|
99
103
|
Run \`flow-qa agent-review <this-folder> <this-folder>/agent-result.json\` on the reviewer's machine to check completeness and evidence references. The review is an agent-supplied analysis, not an engine-verified \`qa-report.json\` or proof that the agent truly executed the case.
|
|
100
104
|
`;
|
|
@@ -152,17 +156,11 @@ function validateAgentResult(request, result) {
|
|
|
152
156
|
if (testCase.questions.length && item.status !== 'blocked' && item.status !== 'unverified')
|
|
153
157
|
throw new Error(`Case ${item.id} has open questions and cannot be reported as observed.`);
|
|
154
158
|
if (item.status === 'blocked') {
|
|
155
|
-
if (!item.reason || item.observations.length)
|
|
156
|
-
throw new Error(`Case ${item.id} needs a block reason and no observations.`);
|
|
157
159
|
continue;
|
|
158
160
|
}
|
|
159
161
|
if (item.status === 'unverified') {
|
|
160
|
-
if (item.reason || item.observations.length)
|
|
161
|
-
throw new Error(`Case ${item.id} is unverified but contains findings.`);
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
|
-
if (item.reason || !item.observations.length)
|
|
165
|
-
throw new Error(`Case ${item.id} needs assertion observations and no block reason.`);
|
|
166
164
|
for (const [observationIndex, observation] of item.observations.entries()) {
|
|
167
165
|
if (observation.stepIndex !== assertionIndexes[observationIndex])
|
|
168
166
|
throw new Error(`Case ${item.id} has an invalid, duplicate, or out-of-order assertion step index.`);
|
|
@@ -178,9 +176,38 @@ function validateAgentResult(request, result) {
|
|
|
178
176
|
function safeLine(value) {
|
|
179
177
|
return value.replace(/[\u0000-\u001f\u007f-\u009f|]/g, ' ').slice(0, 2000);
|
|
180
178
|
}
|
|
181
|
-
function markdownLiteral(value) {
|
|
182
|
-
const
|
|
183
|
-
|
|
179
|
+
function markdownLiteral(value, limit = 2000) {
|
|
180
|
+
const visible = value.slice(0, limit).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\\]/g, (character) => {
|
|
181
|
+
if (character === '\\')
|
|
182
|
+
return '\\\\';
|
|
183
|
+
if (character === '\n')
|
|
184
|
+
return '\\n';
|
|
185
|
+
if (character === '\r')
|
|
186
|
+
return '\\r';
|
|
187
|
+
if (character === '\t')
|
|
188
|
+
return '\\t';
|
|
189
|
+
return `\\u${character.codePointAt(0).toString(16).padStart(4, '0')}`;
|
|
190
|
+
});
|
|
191
|
+
const longestRun = Math.max(0, ...(visible.match(/`+/g) ?? []).map((run) => run.length));
|
|
192
|
+
const fence = '`'.repeat(longestRun + 1);
|
|
193
|
+
const content = visible.startsWith('`') || visible.endsWith('`') ? ` ${visible} ` : visible;
|
|
194
|
+
return `${fence}${content}${fence}`;
|
|
195
|
+
}
|
|
196
|
+
function expectedLocator(locator) {
|
|
197
|
+
if (locator.by === 'role')
|
|
198
|
+
return `role ${markdownLiteral(locator.value)}${locator.name ? ` named ${markdownLiteral(locator.name, 8192)}` : ''}`;
|
|
199
|
+
return `${locator.by} ${markdownLiteral(locator.value, 8192)}`;
|
|
200
|
+
}
|
|
201
|
+
function expectedAssertion(step) {
|
|
202
|
+
if (step.type === 'assertVisible')
|
|
203
|
+
return `${step.visible ? 'visible' : 'hidden'} at ${expectedLocator(step.locator)}`;
|
|
204
|
+
if (step.type === 'assertText')
|
|
205
|
+
return `text ${step.match === 'equals' ? 'equal to' : 'containing'} ${markdownLiteral(step.expected, 8192)} at ${expectedLocator(step.locator)}`;
|
|
206
|
+
if (step.type === 'assertUrl')
|
|
207
|
+
return `URL ${markdownLiteral(step.expected, 8192)}`;
|
|
208
|
+
if (step.type === 'assertAgent')
|
|
209
|
+
return `condition ${markdownLiteral(step.instruction, 8192)}`;
|
|
210
|
+
throw new Error('Agent result refers to a non-assertion step.');
|
|
184
211
|
}
|
|
185
212
|
export async function reviewAgentHandoff(directoryPath, resultPath) {
|
|
186
213
|
const directoryInfo = await lstat(directoryPath);
|
|
@@ -224,12 +251,21 @@ export async function reviewAgentHandoff(directoryPath, resultPath) {
|
|
|
224
251
|
'These findings were supplied by an external agent. File references and structure were checked; execution and authenticity were not verified by Flow QA.', '',
|
|
225
252
|
`Suite: ${safeLine(request.suite.id)} · target: ${safeLine(request.target.name)} · ${result.cases.length} selected case(s)`,
|
|
226
253
|
`Observed passed: ${counts['observed-passed']} · observed failed: ${counts['observed-failed']} · blocked: ${counts.blocked} · unverified: ${counts.unverified}`, '',
|
|
227
|
-
...result.cases.flatMap((item) =>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
254
|
+
...result.cases.flatMap((item, index) => {
|
|
255
|
+
const testCase = request.suite.cases[index];
|
|
256
|
+
return [
|
|
257
|
+
`## ${safeLine(item.id)} — ${safeLine(item.status)}`,
|
|
258
|
+
`Case: ${markdownLiteral(testCase.title, 8192)}`,
|
|
259
|
+
...(item.status === 'blocked' ? [`Reason: ${markdownLiteral(item.reason)}`] : []),
|
|
260
|
+
...item.observations.flatMap((observation) => [
|
|
261
|
+
`- Assertion step ${observation.stepIndex}: ${observation.outcome}`,
|
|
262
|
+
` - Expected: ${expectedAssertion(testCase.steps[observation.stepIndex])}`,
|
|
263
|
+
` - Observed: ${markdownLiteral(observation.detail)}`,
|
|
264
|
+
` - Evidence: ${markdownLiteral(observation.evidence)}`,
|
|
265
|
+
]),
|
|
266
|
+
'',
|
|
267
|
+
];
|
|
268
|
+
}),
|
|
233
269
|
];
|
|
234
270
|
return `${lines.join('\n')}\n`;
|
|
235
271
|
}
|
package/docs/agent-handoff.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[한국어](#한국어) · [English](#english)
|
|
4
4
|
|
|
5
|
+
## 2026-11-18 follow-up finding · 후속 조사
|
|
6
|
+
|
|
7
|
+
The previous independent browser-agent trial produced both failed and passing observations from the same reviewed case. `agent-review` checked the result structure and evidence references, but its summary printed only the agent's observation. A reviewer had to open `request.json` and find the matching step to see what had been expected. The summary should pair each reported assertion with the reviewed expectation and locator, while keeping the agent's observation and evidence reference distinct. The result JSON and its validation rules remain the source record.
|
|
8
|
+
|
|
9
|
+
지난 독립 브라우저 에이전트 검증에서는 동일한 검토 케이스로 실패와 통과를 관찰했습니다. 기존 `agent-review` 요약에는 에이전트의 관찰 내용만 있어 검토자가 `request.json`에서 기대값과 locator를 따로 찾아야 했습니다. 각 assertion의 기대 조건·관찰·증거를 함께 표시하도록 개선하되 결과 JSON과 검증 규칙은 그대로 사용합니다.
|
|
10
|
+
|
|
5
11
|
## English
|
|
6
12
|
|
|
7
13
|
Use an existing, reviewed **web** case suite with a coding agent that has its own browser tools, including Playwright if available. This path creates a portable, readable folder. The agent does not need Flow QA or its `e2e` dependencies installed; the reviewer's Flow QA CLI prepares and checks the folder. The handoff itself does not call a model, open a browser, or run a test.
|
|
@@ -45,6 +51,8 @@ flow-qa agent-review my-qa/.flowqa/handoffs/<directory> my-qa/.flowqa/handoffs/<
|
|
|
45
51
|
|
|
46
52
|
The review requires the same request hash and case IDs in the same order. `observed-passed` requires matching observations for every assertion in step order; `observed-failed` requires a first mismatch after any earlier matching assertions and no later observations. A case with open questions cannot be marked observed. Evidence must be a real, nonempty regular file inside `evidence/`, with an approved extension and at most 10 MB; links and traversal are rejected. The result must be at most 1 MB. These checks make the response reviewable; they do **not** prove that the external agent visited the target or that the screenshot is authentic. The output is labeled **external agent observations** and is never added to Flow QA's engine-backed `qa-report.json` history.
|
|
47
53
|
|
|
54
|
+
The review summary shows each reported assertion's expected condition and locator from the reviewed case beside the agent's observed detail and evidence path. A failed case therefore identifies the first mismatched expectation without a manual lookup in `request.json`. The summary prints case content and observations, so inspect it before sharing.
|
|
55
|
+
|
|
48
56
|
Only the registered target identity is exported. Model connections and their key environment variables are omitted. A target URL with credentials, a query, a fragment, or a token-like path is refused rather than silently redacted. Case content is not masked because that would change the reviewed suite: inspect the URL, case text, and evidence before sharing the folder. The handoff accepts at most 1 MB of case/request JSON, supports web targets only, and does not prepare logins, accounts, or test data.
|
|
49
57
|
|
|
50
58
|
## 한국어
|
|
@@ -63,3 +71,5 @@ flow-qa agent-review my-qa/.flowqa/handoffs/<폴더> my-qa/.flowqa/handoffs/<폴
|
|
|
63
71
|
```
|
|
64
72
|
|
|
65
73
|
검토 명령은 요청 해시·케이스 범위·관찰 상태·증거 파일의 존재와 경로를 확인합니다. 에이전트가 실제로 페이지를 방문했는지, 증거가 진짜인지까지 증명하지 않습니다. 이 결과는 에이전트의 관찰 기록으로만 표시하며 기존 `qa-report.json` 실행 기록에 합치지 않습니다. 모델 설정과 키 환경 변수는 묶음에 넣지 않습니다. 쿼리·인증정보·토큰처럼 보이는 경로가 있는 대상 URL은 거부하고, 케이스 본문은 몰래 마스킹하지 않습니다. 외부 공유 전에 케이스·대상·증거의 민감한 내용을 직접 확인하세요.
|
|
74
|
+
|
|
75
|
+
검토 요약은 각 assertion의 검토된 기대 조건·locator와 에이전트의 관찰 내용·증거 파일 경로를 함께 보여줍니다. 실패한 케이스는 첫 불일치 기대값을 `request.json`에서 따로 찾지 않아도 확인할 수 있습니다. 요약에도 케이스 본문과 관찰 내용이 들어가므로 공유 전에 내용을 확인하세요.
|
package/docs/releases.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Releases and verification
|
|
2
2
|
|
|
3
|
+
## 0.9.3 — show reviewed expectations in external observations
|
|
4
|
+
|
|
5
|
+
The `agent-review` summary now pairs each reported assertion with the case's reviewed expectation and locator, the external agent's observed detail, and its evidence path. The case title appears above its observations. This makes a failed observation identifiable from the summary without finding the matching step in `request.json`. Untrusted text is rendered as Markdown code spans with enough backticks to preserve literal values, including pipes, angle brackets, and backticks; line breaks and control characters are displayed as escapes. The handoff and result JSON contracts and their validation rules are unchanged.
|
|
6
|
+
|
|
7
|
+
The 2026-11-18 follow-up finding and sharing guidance are recorded in the [handoff guide](agent-handoff.md). On Node.js 24.22.1, `npm run check` passed 124 tests, type checking and UI checks; `npm run check:package` passed for an 83-file tarball; and `npm run smoke:package` installed that tarball and passed its browser and synthetic agent-result checks. The compiled CLI also reviewed the existing independent agent's recorded failed and passing handoffs from 2026-11-17, showing the reviewed expectation beside each observation. These checks used local fixtures and existing evidence. Registry publication and remote CI are verified after the main push.
|
|
8
|
+
|
|
9
|
+
## 0.9.2 — copied-skill installation and agent result contract
|
|
10
|
+
|
|
11
|
+
An independent agent used a generated handoff to observe a real browser failure, then returned an observed-failed case with an explanatory `reason`. The exported JSON Schema allowed that field while `agent-review` already rejected it. Generated schemas and prompts now describe the existing per-status rules: observed outcomes put the explanation in assertion observations and omit the blocking reason; blocked and unverified outcomes retain their distinct reason/observation limits. The result schema version and runtime interpretation are unchanged.
|
|
12
|
+
|
|
13
|
+
The portable skill also identifies the scoped npm package `@ihyeon/flow-qa` and local CLI invocation so a new project does not try to install the binary name as an unscoped package. Focused status-contract regression checks, the full 124-test check, type/UI checks, package checks, and installed-package smoke passed locally. Public package and end-to-end evidence are verified separately for this source.
|
|
14
|
+
|
|
3
15
|
## 0.9.1 — portable AI integration guidance
|
|
4
16
|
|
|
5
17
|
The npm package now includes `skills/flow-qa/` with a self-contained integration skill and workflow reference, `docs/ai.md`, and `llms.txt`. A consumer can copy the whole skill folder from the installed package into a project-local agent directory, without global installation or a new model API. Instructions use the installed CLI and distinguish planning, case review, external agent observations, and native runner reports. Runtime behavior and public result formats are unchanged.
|
package/package.json
CHANGED
package/skills/flow-qa/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Use Flow QA to turn a user flow into reviewed cases, run a register
|
|
|
5
5
|
|
|
6
6
|
# Flow QA
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Install the CLI in the current project with `npm install --save-dev @ihyeon/flow-qa` if needed. Invoke the project-local CLI as `npx --no-install flow-qa` (for example, `npx --no-install flow-qa init my-qa`). Read [the workflow reference](references/workflow.md) for actual command forms and the choice between a local run and an external agent handoff. This reference travels with this skill when copied out of the npm package.
|
|
9
9
|
|
|
10
10
|
Before execution, review the flow, proposed cases, target, and side effects with the user when their authorization does not already cover them. Keep unknown expected results in case `questions`; never convert an observation or assumed product behavior into a passing assertion. Verify the selected case IDs and target identity before a run or handoff.
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Flow QA CLI workflow
|
|
2
2
|
|
|
3
|
-
Run `flow-qa --help`
|
|
3
|
+
Install `@ihyeon/flow-qa` in the project with `npm install --save-dev @ihyeon/flow-qa` if needed. Run the local CLI with `npx --no-install flow-qa`; prefix each example below with `npx --no-install` when using a project-local install. Run `npx --no-install flow-qa --help` to inspect the installed version. Paths to flows and cases below are relative to `--workspace`; `flow-qa init my-qa` creates a local example and configuration without replacing existing files.
|
|
4
4
|
|
|
5
5
|
## Design and review
|
|
6
6
|
|
|
@@ -48,3 +48,5 @@ flow-qa agent-review <handoff-directory> <handoff-directory>/agent-result.json
|
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
This review checks request binding, case scope and order, observation structure, and evidence file references. It does not verify visits or evidence authenticity and does not create an engine QA report. Handoff omits model connection settings but does not mask case content; check material before sharing. See `AGENT_PROMPT.md` and `agent-result.schema.json` inside each generated bundle for that bundle's exact contract.
|
|
51
|
+
|
|
52
|
+
For each observed assertion, the review summary pairs the reviewed expectation and locator with the agent's observation and evidence path. Inspect both sides of a mismatch before changing the application or its case.
|