qfai 1.7.9 → 1.7.13

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.
Files changed (151) hide show
  1. package/README.md +34 -70
  2. package/assets/init/.qfai/README.md +11 -16
  3. package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +51 -0
  4. package/assets/init/.qfai/assistant/agents/architecture-reviewer.md +57 -0
  5. package/assets/init/.qfai/assistant/agents/backend-engineer.md +40 -31
  6. package/assets/init/.qfai/assistant/agents/completion-reviewer.md +48 -0
  7. package/assets/init/.qfai/assistant/agents/delivery-planner.md +52 -0
  8. package/assets/init/.qfai/assistant/agents/devops-ci-engineer.md +31 -28
  9. package/assets/init/.qfai/assistant/agents/discovery-analyst.md +50 -0
  10. package/assets/init/.qfai/assistant/agents/doc-steward.md +30 -20
  11. package/assets/init/.qfai/assistant/agents/frontend-engineer.md +40 -31
  12. package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +58 -0
  13. package/assets/init/.qfai/assistant/agents/orchestrator.md +19 -2
  14. package/assets/init/.qfai/assistant/agents/product-experience-architect.md +59 -0
  15. package/assets/init/.qfai/assistant/agents/product-surface-reviewer.md +60 -0
  16. package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +53 -48
  17. package/assets/init/.qfai/assistant/agents/qa-strategist.md +49 -0
  18. package/assets/init/.qfai/assistant/agents/requirements-analyst.md +32 -29
  19. package/assets/init/.qfai/assistant/agents/requirements-reviewer.md +48 -0
  20. package/assets/init/.qfai/assistant/agents/solution-architect.md +59 -0
  21. package/assets/init/.qfai/assistant/agents/test-design-analyst.md +64 -0
  22. package/assets/init/.qfai/assistant/instructions/agent-selection.md +64 -50
  23. package/assets/init/.qfai/assistant/instructions/communication.md +17 -0
  24. package/assets/init/.qfai/assistant/instructions/constitution.md +36 -1
  25. package/assets/init/.qfai/assistant/instructions/drift-protocol.md +1 -1
  26. package/assets/init/.qfai/assistant/instructions/requirements-decomposition.md +20 -13
  27. package/assets/init/.qfai/assistant/instructions/workflow.md +2 -1
  28. package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +32 -31
  29. package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +80 -0
  30. package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +21 -15
  31. package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +95 -61
  32. package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +17 -85
  33. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +9 -1
  34. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
  35. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +17 -60
  36. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/04_Sources.md +69 -2
  37. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/06_REQ.md +1 -1
  38. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
  39. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +1 -1
  40. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
  41. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
  42. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
  43. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/13_Deferred.md +1 -1
  44. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +25 -16
  45. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
  46. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/prototyping.yaml +9 -0
  47. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +8 -4
  48. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +11 -7
  49. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +6 -44
  50. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/00_index.md +29 -14
  51. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_implementation_strategy.md +20 -0
  52. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/11_design_taste_interview.md +45 -0
  53. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_design_eval_invariant.md +68 -0
  54. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_design_eval_trend_derived.md +68 -0
  55. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/22_design_eval_product_specific.md +68 -0
  56. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_design_eval_aggregate.md +41 -0
  57. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/24_design_eval_dynamic_overrides.md +28 -0
  58. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/30_option_comparison.md +56 -0
  59. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_selected_anchor_screen.md +42 -0
  60. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +44 -0
  61. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +36 -0
  62. package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +65 -67
  63. package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +171 -279
  64. package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +91 -57
  65. package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +21 -80
  66. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/import-lite.md +1 -1
  67. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +50 -0
  68. package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +23 -3
  69. package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +25 -17
  70. package/assets/init/.qfai/assistant/steering/agent-catalog.yml +194 -0
  71. package/assets/init/.qfai/assistant/steering/agent-routing.yml +176 -0
  72. package/assets/init/.qfai/assistant/steering/cli-ux-guidelines.md +49 -0
  73. package/assets/init/.qfai/assistant/steering/manifest.md +44 -19
  74. package/assets/init/.qfai/assistant/steering/product.md +53 -11
  75. package/assets/init/.qfai/assistant/steering/research-first-protocol.md +58 -0
  76. package/assets/init/.qfai/assistant/steering/review-gate.rules.yml +17 -66
  77. package/assets/init/.qfai/assistant/steering/review-profiles.yml +30 -0
  78. package/assets/init/.qfai/assistant/steering/structure.md +30 -16
  79. package/assets/init/.qfai/assistant/steering/tech.md +37 -21
  80. package/assets/init/.qfai/assistant/steering/ui-definition-protocol.md +54 -0
  81. package/assets/init/.qfai/contracts/README.md +10 -4
  82. package/assets/init/.qfai/contracts/design/README.md +32 -0
  83. package/assets/init/.qfai/contracts/ui/README.md +5 -3
  84. package/assets/init/.qfai/discussion/README.md +52 -5
  85. package/assets/init/.qfai/evidence/README.md +143 -116
  86. package/assets/init/.qfai/report/README.md +1 -1
  87. package/assets/init/.qfai/review/README.md +24 -9
  88. package/assets/init/.qfai/specs/README.md +5 -2
  89. package/assets/init/root/qfai.config.yaml +13 -0
  90. package/assets/uix-rev/comparison-review.md +24 -7
  91. package/assets/uix-rev/contracts-review.md +17 -10
  92. package/assets/uix-rev/scoring-review.md +42 -6
  93. package/assets/uix-rev/strategy-review.md +13 -9
  94. package/dist/cli/index.cjs +15618 -11547
  95. package/dist/cli/index.cjs.map +1 -1
  96. package/dist/cli/index.mjs +15487 -11415
  97. package/dist/cli/index.mjs.map +1 -1
  98. package/dist/index.cjs +10486 -6080
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +766 -198
  101. package/dist/index.d.ts +766 -198
  102. package/dist/index.mjs +10823 -6420
  103. package/dist/index.mjs.map +1 -1
  104. package/package.json +11 -3
  105. package/assets/init/.qfai/assistant/agents/architect-reviewer.md +0 -65
  106. package/assets/init/.qfai/assistant/agents/architect.md +0 -49
  107. package/assets/init/.qfai/assistant/agents/atdd-api-implementer.md +0 -49
  108. package/assets/init/.qfai/assistant/agents/atdd-e2e-implementer.md +0 -48
  109. package/assets/init/.qfai/assistant/agents/atdd-integration-implementer.md +0 -48
  110. package/assets/init/.qfai/assistant/agents/backend-reviewer.md +0 -66
  111. package/assets/init/.qfai/assistant/agents/code-reviewer.md +0 -67
  112. package/assets/init/.qfai/assistant/agents/contract-designer.md +0 -49
  113. package/assets/init/.qfai/assistant/agents/coverage-planner.md +0 -49
  114. package/assets/init/.qfai/assistant/agents/design-owner.md +0 -48
  115. package/assets/init/.qfai/assistant/agents/design-review-lead.md +0 -68
  116. package/assets/init/.qfai/assistant/agents/facilitator.md +0 -48
  117. package/assets/init/.qfai/assistant/agents/frontend-reviewer.md +0 -66
  118. package/assets/init/.qfai/assistant/agents/interviewer.md +0 -45
  119. package/assets/init/.qfai/assistant/agents/option-explorer.md +0 -51
  120. package/assets/init/.qfai/assistant/agents/option-reviewer.md +0 -66
  121. package/assets/init/.qfai/assistant/agents/oq-harvester.md +0 -50
  122. package/assets/init/.qfai/assistant/agents/oq-reviewer.md +0 -70
  123. package/assets/init/.qfai/assistant/agents/planner.md +0 -48
  124. package/assets/init/.qfai/assistant/agents/project-lead.md +0 -47
  125. package/assets/init/.qfai/assistant/agents/prototyping-coverage-auditor.md +0 -46
  126. package/assets/init/.qfai/assistant/agents/qa-engineer.md +0 -47
  127. package/assets/init/.qfai/assistant/agents/qa-lead.md +0 -44
  128. package/assets/init/.qfai/assistant/agents/qa-reviewer.md +0 -66
  129. package/assets/init/.qfai/assistant/agents/researcher.md +0 -47
  130. package/assets/init/.qfai/assistant/agents/reviewer.md +0 -62
  131. package/assets/init/.qfai/assistant/agents/runtime-gatekeeper.md +0 -46
  132. package/assets/init/.qfai/assistant/agents/test-case-owner.md +0 -53
  133. package/assets/init/.qfai/assistant/agents/test-engineer.md +0 -50
  134. package/assets/init/.qfai/assistant/agents/test-volume-estimator.md +0 -48
  135. package/assets/init/.qfai/assistant/agents/ui-ux-reviewer.md +0 -71
  136. package/assets/init/.qfai/assistant/agents/unit-test-scope-enforcer.md +0 -46
  137. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/10_strategy.md +0 -28
  138. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/20_eval_axis_usability.md +0 -31
  139. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/21_eval_axis_consistency.md +0 -31
  140. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/22_eval_axis_accessibility.md +0 -31
  141. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/23_eval_axis_delight.md +0 -56
  142. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/30_comparison.md +0 -45
  143. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/31_anchor.md +0 -27
  144. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_contracts.md +0 -51
  145. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_bundle.md +0 -31
  146. package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/60_critique_loop.md +0 -23
  147. package/assets/init/.qfai/assistant/skills/qfai-prototyping-full-harness/SKILL.md +0 -185
  148. package/assets/init/.qfai/assistant/steering/review-roster.yml +0 -128
  149. package/assets/init/.qfai/evidence/.gitignore +0 -3
  150. package/assets/init/.qfai/report/.gitignore +0 -3
  151. package/assets/init/.qfai/review/.gitignore +0 -5
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ type TestFileScan = {
14
14
  };
15
15
 
16
16
  type IssueSeverity = "info" | "warning" | "error";
17
- type IssueCategory = "compatibility" | "change";
17
+ type IssueCategory = "canonical" | "compatibility" | "change";
18
18
  type IssueLocation = {
19
19
  line: number;
20
20
  column?: number;
@@ -158,11 +158,32 @@ type QfaiUiuxConfig = {
158
158
  audit?: QfaiUiuxAuditConfig;
159
159
  migration?: QfaiUiuxMigrationConfig;
160
160
  };
161
+ type QfaiPrototypingCalibrationConfig = {
162
+ packPath?: string;
163
+ thresholds?: {
164
+ accept?: number;
165
+ refine?: number;
166
+ };
167
+ maxIterations?: number;
168
+ plateauDelta?: number;
169
+ plateauLookback?: number;
170
+ };
171
+ type QfaiPrototypingConfig = {
172
+ calibration?: QfaiPrototypingCalibrationConfig;
173
+ execution?: {
174
+ targetUrl?: string | null;
175
+ browserProvider?: string;
176
+ renderProvider?: string;
177
+ reviewer?: string;
178
+ };
179
+ };
161
180
  type QfaiConfig = {
162
181
  paths: QfaiPaths;
163
182
  validation: QfaiValidationConfig;
164
183
  output: QfaiOutputConfig;
165
184
  uiux?: QfaiUiuxConfig;
185
+ prototyping?: QfaiPrototypingConfig;
186
+ baseBranch?: string;
166
187
  };
167
188
  type ConfigPathKey = keyof QfaiPaths;
168
189
  type ConfigLoadResult = {
@@ -301,241 +322,354 @@ declare function extractAcSpecNumber(acId: string): string | null;
301
322
  declare function extractCaseSpecNumber(caseId: string): string | null;
302
323
  declare function extractScSpecNumber(scId: string): string | null;
303
324
 
304
- type SddPreflightSource = "discussion-pack";
305
- type SddPreflightStatus = "ready" | "blocked";
306
- type RunSddPreflightOptions = {
307
- assumptions?: string[];
325
+ type PrototypingMode = "low-cost" | "standard" | "full-harness";
326
+ type ModeSelectionSource = "explicit-request" | "discussion-recommendation" | "system-default";
327
+ type PrototypingSurface = "web" | "mobile" | "desktop" | "cli" | "mixed" | "non-ui";
328
+ /** @deprecated Legacy surface values — use canonical PrototypingSurface instead */
329
+ type LegacyPrototypingSurface = "web-ui" | "mobile-ui" | "desktop-ui";
330
+ type DiscussionRecommendationSourceSchema = "canonical-namespaced" | "legacy-top-level";
331
+ /**
332
+ * Canonical validated recommendation — all 4 fields required.
333
+ * Parser output uses this same type; fields are always populated
334
+ * because extractRecommendation returns null when any field is missing.
335
+ */
336
+ type DiscussionModeRecommendation = {
337
+ recommendedMode: PrototypingMode;
338
+ rationale: string;
339
+ allowedModes: PrototypingMode[];
340
+ surface: PrototypingSurface;
341
+ updatedAt?: string | undefined;
342
+ sourceSchema?: DiscussionRecommendationSourceSchema | undefined;
343
+ };
344
+ type ModeResolutionInput = {
345
+ explicitMode?: PrototypingMode | undefined;
346
+ discussionRecommendation?: DiscussionModeRecommendation | null | undefined;
347
+ defaultMode?: PrototypingMode | undefined;
348
+ };
349
+ type ModeResolutionResult = {
350
+ requested?: PrototypingMode | undefined;
351
+ effective: PrototypingMode;
352
+ source: ModeSelectionSource;
353
+ rationale: string;
308
354
  };
309
- type SddPreflightResult = {
310
- status: SddPreflightStatus;
311
- source: SddPreflightSource;
312
- selectedInputPath: string | null;
313
- importedReqCount: number | null;
314
- openQuestions: string[];
315
- blockers: string[];
316
- nextCommands: string[];
317
- preflightSummaryPath: string;
355
+ type ResolvedModeSummary = ModeResolutionResult & {
356
+ discussionRecommendation?: DiscussionModeRecommendation | undefined;
357
+ surface?: PrototypingSurface | undefined;
358
+ warnings: string[];
359
+ };
360
+ type PrototypingObligations = {
361
+ requireRuntimeGate: boolean;
362
+ requireUiFidelity: boolean;
363
+ requireRenderBundle: boolean;
364
+ requireBrowserQaBundle: boolean;
365
+ requireFullHarness: boolean;
366
+ };
367
+ type ResolveModeInput = {
368
+ requested?: PrototypingMode | undefined;
369
+ discussionArtifact?: unknown;
370
+ defaultMode?: PrototypingMode | undefined;
371
+ };
372
+ type PrototypingExecutionConfig = {
373
+ targetUrl?: string | null;
374
+ browserProvider?: string;
375
+ renderProvider?: string;
376
+ };
377
+ type UiFidelityStatus = {
378
+ required: boolean;
379
+ status: "completed" | "failed" | "n/a";
380
+ reason?: string;
318
381
  };
319
- declare function runSddPreflight(root: string, config: QfaiConfig, options?: RunSddPreflightOptions): Promise<SddPreflightResult>;
320
382
 
321
- type CrawlStatus = "ok" | "failed";
322
- type UiFidelityAutogenExpected = {
323
- route: string;
324
- uiContractId: string;
325
- labels: string[];
326
- elementIds: string[];
327
- elementPairs: Array<{
328
- id: string;
329
- label: string;
330
- }>;
331
- elementCount: number;
332
- actionIds: string[];
333
- mockPathIds: string[];
334
- navigateTargets: string[];
335
- };
336
- type UiFidelityAutogenCrawlResult = {
337
- route: string;
338
- status: CrawlStatus;
339
- httpStatus: number | null;
340
- labels: string[];
341
- markers: string[];
342
- error?: string;
343
- };
344
- type UiFidelityAutogenMockPathResult = {
345
- route: string;
346
- uiContractId: string;
347
- entries: Array<{
348
- id: string;
349
- status: string;
350
- note?: string;
351
- }>;
352
- };
353
- type UiFidelityLabelCoverage = {
354
- found: string[];
355
- missing: string[];
356
- coverage: number;
383
+ type ParseDiscussionResult = {
384
+ recommendation: DiscussionModeRecommendation | null;
385
+ warnings: string[];
357
386
  };
358
- type UiFidelityGeneratedScreen = {
359
- route: string;
360
- uiContractId: string;
361
- expected: {
362
- elements: number;
363
- actions: number;
364
- labels: string[];
365
- ids: string[];
366
- };
367
- found: {
368
- labels: string[];
369
- markers: string[];
370
- };
371
- missing: {
372
- labels: string[];
373
- markers: string[];
374
- };
375
- coverage: number;
376
- observed: {
377
- elementsPlaced: number;
378
- actionsWired: number;
379
- };
380
- mockPaths: Array<{
381
- id: string;
382
- status: string;
383
- note?: string;
384
- }>;
385
- };
386
- type UiFidelityAutogenResult = {
387
- expected: UiFidelityAutogenExpected[];
388
- crawled: UiFidelityAutogenCrawlResult[];
389
- mockPaths: UiFidelityAutogenMockPathResult[];
390
- screens: UiFidelityGeneratedScreen[];
391
- };
392
- declare function collectExpectedFromContracts(root: string, config: QfaiConfig): Promise<UiFidelityAutogenExpected[]>;
393
- declare function crawlRoutesAndCollectFoundLabels(baseUrl: string, routes: string[]): Promise<UiFidelityAutogenCrawlResult[]>;
394
- declare function runMockPaths(expectedScreens: UiFidelityAutogenExpected[], crawledRoutes: UiFidelityAutogenCrawlResult[]): UiFidelityAutogenMockPathResult[];
395
- declare function computeLabelCoverage(expectedLabels: string[], foundLabelsFromDom: string[]): UiFidelityLabelCoverage;
396
- declare function buildUiFidelityScreens(expectedScreens: UiFidelityAutogenExpected[], crawledRoutes: UiFidelityAutogenCrawlResult[], mockPathResults: UiFidelityAutogenMockPathResult[]): UiFidelityGeneratedScreen[];
397
- declare function autogenerateUiFidelity(root: string, config: QfaiConfig, baseUrl: string, routeHints: string[]): Promise<UiFidelityAutogenResult>;
398
- declare function emitUiFidelity(input: {
399
- evidence: Record<string, unknown>;
400
- toolVersion: string;
401
- command: string;
402
- baseUrl: string;
403
- status: "success" | "failed" | "skipped";
404
- screens?: UiFidelityGeneratedScreen[];
405
- crawled?: UiFidelityAutogenCrawlResult[];
406
- reason?: string;
407
- }): Record<string, unknown>;
408
- declare function extractDomMarkers(html: string): string[];
409
-
410
387
  /**
411
- * Mode resolver for prototyping obligations.
412
- *
413
- * Separates static-first obligations (default) from runtime-heavy checks (opt-in).
414
- * Static-first default ensures prototyping completes without browser/backend installed.
415
- *
416
- * NOTE: v1.7.5 scope is foundation-only. This module defines the obligation
417
- * vocabulary and resolution logic. Wiring into the prototyping command/validator
418
- * evaluation path is deferred to v1.7.6 when the full mode-switching UX is added.
388
+ * Parse a prototyping.yaml file from a discussion pack.
389
+ * Supports both canonical namespaced (`prototyping.*`) and legacy top-level schema.
419
390
  */
420
- type PrototypingMode = "default" | "standard" | "low-cost" | "full-harness";
421
- /** Static obligations that require no runtime infrastructure. */
422
- declare const STATIC_OBLIGATIONS: readonly ["source", "route", "state", "contract-level"];
423
- /** Runtime-heavy checks that require external infrastructure (opt-in only). */
424
- declare const RUNTIME_HEAVY_CHECKS: readonly ["api-non-404", "db-existence", "ui-route-reachability"];
391
+ declare function parseDiscussionModeRecommendation(filePath: string): Promise<DiscussionModeRecommendation | null>;
392
+ declare function parseDiscussionModeRecommendationWithWarnings(filePath: string): Promise<ParseDiscussionResult>;
393
+ declare function parseDiscussionFromObject(parsed: Record<string, unknown>): ParseDiscussionResult;
394
+ declare function resolvePrototypingMode(input: ModeResolutionInput): ModeResolutionResult;
425
395
  /**
426
- * Resolve the active obligation set for a given prototyping mode.
427
- *
428
- * - `"default"` / `"standard"`: static obligations only
429
- * - `"low-cost"`: static obligations (runtime-heavy excluded)
430
- * - `"full-harness"`: static + runtime-heavy obligations
396
+ * Full resolved mode summary with discussion recommendation context and warnings.
431
397
  */
432
- declare function resolveObligations(mode: PrototypingMode): string[];
398
+ declare function summarizeResolvedMode(input: ModeResolutionInput): ResolvedModeSummary;
433
399
  /**
434
- * Resolve obligations with explicit opt-in for runtime-heavy checks.
435
- * Only checks listed in RUNTIME_HEAVY_CHECKS are accepted as opt-ins.
400
+ * Resolve mode from raw input (ResolveModeInput) includes discussion artifact parsing.
436
401
  */
437
- declare function resolveObligationsWithOptIn(mode: PrototypingMode, optIn: string[]): string[];
438
-
439
- type DiscussionRecommendation = {
440
- recommended_mode: string | null;
441
- rationale: string | null;
442
- };
402
+ declare function resolvePrototypingModeFromInput(input: ResolveModeInput): ResolvedModeSummary;
403
+ declare function normalizeSurface(input: unknown): PrototypingSurface | null;
404
+ declare function inferSurfaceFromRecommendationAndEvidence(input: {
405
+ recommendationSurface?: PrototypingSurface | undefined;
406
+ evidenceSurface?: PrototypingSurface | undefined;
407
+ hasUiFidelity?: boolean | undefined;
408
+ hasRenderBundle?: boolean | undefined;
409
+ hasBrowserQaBundle?: boolean | undefined;
410
+ hasUiRoutes?: boolean | undefined;
411
+ hasRuntimeGateUi?: boolean | undefined;
412
+ }): PrototypingSurface;
413
+ declare function derivePrototypingObligations(input: {
414
+ surface: PrototypingSurface;
415
+ effectiveMode: PrototypingMode;
416
+ }): PrototypingObligations;
417
+ declare function isValidPrototypingMode(value: unknown): value is PrototypingMode;
418
+ declare function isValidPrototypingSurface(value: unknown): value is PrototypingSurface;
443
419
  /**
444
- * Read prototyping recommendation from a discussion pack directory.
445
- *
446
- * Looks for `prototyping.yaml` in the given directory and extracts
447
- * `prototyping.recommended_mode` and `prototyping.rationale`.
448
- *
449
- * @param discussionPackDir - Path to the discussion pack directory
450
- * @returns Recommendation with nullable fields; never throws
420
+ * Normalize a surface value: map legacy values to canonical equivalents.
451
421
  */
452
- declare function readDiscussionRecommendation(discussionPackDir: string): Promise<DiscussionRecommendation>;
422
+ declare function normalizePrototypingSurface(value: string): PrototypingSurface;
423
+ declare function isUiBearingSurface(surface: PrototypingSurface): boolean;
424
+ declare function normalizeAllowedModes(modes?: string[]): PrototypingMode[];
453
425
 
454
426
  /**
455
- * Precedence resolver for prototyping mode.
427
+ * Render evidence types WS-C
456
428
  *
457
- * Resolves effective mode from three sources in strict order:
458
- * 1. CLI `--mode` flag (cli-override)
459
- * 2. Discussion artifact `recommended_mode` (discussion-recommendation)
460
- * 3. System default `standard` (default) — per DR-0084
461
- *
462
- * Phase M2 of v1.7.7 Mode Switch UX (spec-0006).
429
+ * Canonical types for the render evidence capture pipeline.
463
430
  */
464
-
465
- type ModeSource = "cli-override" | "discussion-recommendation" | "default";
466
- type ModeResolution = {
467
- effective_mode: PrototypingMode;
468
- mode_source: ModeSource;
469
- recommended_mode: PrototypingMode | null;
470
- rationale: string;
431
+ type RenderCaptureTarget = {
432
+ targetId: string;
433
+ route?: string;
434
+ descriptor?: string;
435
+ viewport: string;
436
+ width?: number;
437
+ height?: number;
438
+ };
439
+ type RenderCaptureAdapter = {
440
+ captureScreenshot(target: RenderCaptureTarget, outputDir: string): Promise<string>;
441
+ captureHtml?(target: RenderCaptureTarget, outputDir: string): Promise<string>;
442
+ };
443
+ type RenderEvidenceEntryResult = {
444
+ capture_id: string;
445
+ target: string;
446
+ status: "captured" | "skipped" | "failed";
447
+ screenshot_path?: string;
448
+ html_path?: string;
449
+ viewport: string;
450
+ reason?: string;
471
451
  };
472
- type PrecedenceInput = {
473
- cliMode: PrototypingMode | null;
474
- discussion: DiscussionRecommendation | null;
452
+ type RenderRunnerResult = {
453
+ entries: RenderEvidenceEntryResult[];
454
+ filesWritten: string[];
455
+ surface?: string;
456
+ mode?: string;
457
+ generatedAt?: string;
458
+ coverageSummary?: {
459
+ total: number;
460
+ captured: number;
461
+ failed: number;
462
+ skipped: number;
463
+ };
475
464
  };
465
+
476
466
  /**
477
- * Resolve the effective prototyping mode from available sources.
467
+ * Critique adapter types for external critique providers.
478
468
  *
479
- * @param input.cliMode - Mode from CLI `--mode` flag, or null if not provided
480
- * @param input.discussion - Discussion recommendation, or null if unavailable
481
- * @returns Mode resolution result with source attribution
469
+ * Provider interface is minimal (BR-0029-0001). Each provider implements
470
+ * `request()` and the adapter wraps it with fail-open semantics (NFR-0002).
482
471
  */
483
- declare function resolvePrecedence(input: PrecedenceInput): ModeResolution;
472
+ type CritiqueInput = {
473
+ output: string;
474
+ context: string;
475
+ iteration: number;
476
+ };
477
+ type CritiqueResponse = {
478
+ scores: Record<string, number>;
479
+ dimensions: string[];
480
+ suggestions: string[];
481
+ };
482
+ type CritiqueProvider = {
483
+ name: string;
484
+ request: (input: CritiqueInput, signal?: AbortSignal) => Promise<CritiqueResponse>;
485
+ };
486
+ type CritiqueResult = {
487
+ failOpen: false;
488
+ response: CritiqueResponse;
489
+ } | {
490
+ failOpen: true;
491
+ response: undefined;
492
+ reason: string;
493
+ };
484
494
 
485
495
  /**
486
- * Mode resolution logger for prototyping.
487
- *
488
- * Formats mode resolution results into structured log entries containing:
489
- * mode_source, recommended_mode, effective_mode, rationale, evidence_expectations.
496
+ * Critique adapter with fail-open semantics (NFR-0002).
490
497
  *
491
- * Phase M3 of v1.7.7 Mode Switch UX (spec-0006).
498
+ * Wraps external critique providers with schema validation,
499
+ * timeout enforcement, and fail-open on any error.
492
500
  */
493
501
 
494
- type ModeLogEntry = {
495
- mode_source: ModeSource;
496
- recommended_mode: PrototypingMode | null;
497
- effective_mode: PrototypingMode;
498
- rationale: string;
499
- evidence_expectations: string;
500
- };
501
- declare const VALID_MODE_SOURCES: ReadonlySet<ModeSource>;
502
+ declare class CritiqueAdapter {
503
+ private provider;
504
+ private timeoutMs;
505
+ constructor(options?: {
506
+ timeoutMs?: number;
507
+ });
508
+ register(provider: CritiqueProvider): void;
509
+ requestCritique(input: CritiqueInput): Promise<CritiqueResult>;
510
+ }
511
+
512
+ type SurfaceType = "web" | "mobile" | "desktop" | "cli" | "mixed" | "non-ui";
513
+ /** Surfaces that bear a user interface — canonical truth for UI-bearing detection. */
514
+ declare const UI_BEARING_SURFACES: Set<SurfaceType>;
515
+ /** Surfaces that do NOT bear a user interface. */
516
+ declare const NON_UI_SURFACES: Set<SurfaceType>;
517
+ /**
518
+ * Synchronous check: given a SurfaceType value, returns true if UI-bearing.
519
+ * Canonical shared helper for classification validator and prototyping mode.
520
+ */
521
+ declare function isUiBearingSurfaceType(surface: SurfaceType): boolean;
522
+
502
523
  /**
503
- * Format a mode resolution into a structured log entry.
524
+ * Browser QA canonical types WS-B
504
525
  *
505
- * @param resolution - The mode resolution result from precedenceResolver
506
- * @returns Structured log entry with evidence expectations mapped by effective mode
526
+ * Defines the 4-phase execution model with truthful status reporting.
507
527
  */
508
- declare function formatModeLog(resolution: ModeResolution): ModeLogEntry;
528
+
529
+ type BrowserQaPhase = "smoke" | "interaction" | "visual" | "accessibility";
530
+ declare const BROWSER_QA_PHASES: readonly BrowserQaPhase[];
531
+ type BrowserQaPhaseStatus = "executed" | "skipped" | "failed";
532
+ type BrowserQaFindingSeverity = "info" | "warning" | "error";
533
+ type BrowserQaFinding = {
534
+ phase: BrowserQaPhase;
535
+ route?: string;
536
+ selector?: string;
537
+ target?: string;
538
+ severity: BrowserQaFindingSeverity;
539
+ message: string;
540
+ repair_hint?: string;
541
+ };
542
+ type BrowserQaPhaseResult = {
543
+ phase: BrowserQaPhase;
544
+ status: BrowserQaPhaseStatus;
545
+ findings: BrowserQaFinding[];
546
+ skippedReason?: string;
547
+ };
548
+ type BrowserQaInput = {
549
+ htmlContent?: string;
550
+ targetUrl?: string;
551
+ routes?: string[];
552
+ surface: SurfaceType;
553
+ required?: boolean;
554
+ executionSource?: "html" | "url" | "none";
555
+ };
556
+ type BrowserQaRunResult = {
557
+ phases: BrowserQaPhaseResult[];
558
+ provider: string;
559
+ timestamp: string;
560
+ };
561
+ type BrowserQaSummary = {
562
+ providerId: string;
563
+ phases: Record<BrowserQaPhase, {
564
+ status: BrowserQaPhaseStatus;
565
+ findingsCount: number;
566
+ }>;
567
+ totalFindings: number;
568
+ skippedReasons: string[];
569
+ };
570
+ interface BrowserQaProvider {
571
+ providerId: string;
572
+ canRun(surface: SurfaceType): boolean;
573
+ runSmoke(input: BrowserQaInput): Promise<BrowserQaPhaseResult>;
574
+ runInteraction(input: BrowserQaInput): Promise<BrowserQaPhaseResult>;
575
+ runVisual(input: BrowserQaInput): Promise<BrowserQaPhaseResult>;
576
+ runAccessibility(input: BrowserQaInput): Promise<BrowserQaPhaseResult>;
577
+ }
509
578
 
510
579
  /**
511
- * Surface adapter for prototyping evidence.
580
+ * Browser provider types.
512
581
  *
513
- * Detects surface type and adapts evidence fields:
514
- * - Non-visual surfaces (CLI, API, library): visual-review = n/a
515
- * - Visual surfaces (web, mobile, desktop): visual-review = collected (when mode allows runtime)
516
- * - Low-cost mode: runtime and visual-review are always n/a (static-only)
582
+ * Provider interface is minimal (DEC-0003). Registration is optional;
583
+ * absence is a valid state with fail-open semantics.
517
584
  *
518
- * Phase M4 of v1.7.7 Mode Switch UX (spec-0006).
585
+ * WS-B: BrowserQaProvider is the canonical interface for 4-phase Browser QA.
586
+ * BrowserProvider is the legacy render-capture provider interface.
519
587
  */
520
- type SurfaceType = "web" | "mobile" | "desktop" | "cli" | "api" | "library";
521
- type EvidenceStatus = "collected" | "n/a";
522
- type SurfaceEvidenceResult = {
523
- visual_review: EvidenceStatus;
524
- static_evidence: EvidenceStatus;
525
- runtime_evidence: EvidenceStatus;
588
+
589
+ type ProviderCapability = "screenshot" | "viewport" | "dom" | "interaction" | "visual" | "accessibility";
590
+ /** Legacy render-capture provider. */
591
+ type BrowserProvider = {
592
+ name: string;
593
+ capabilities: ProviderCapability[];
594
+ captureScreenshot?: () => Promise<string>;
595
+ captureViewport?: () => Promise<{
596
+ width: number;
597
+ height: number;
598
+ }>;
599
+ captureDom?: () => Promise<string>;
600
+ runInteraction?: () => Promise<void>;
601
+ runVisual?: () => Promise<void>;
602
+ runAccessibility?: () => Promise<void>;
526
603
  };
527
- type SurfaceAdapterInput = {
528
- surfaceType: SurfaceType;
529
- effectiveMode: string;
604
+
605
+ type ProviderLookupResult = {
606
+ status: "available";
607
+ provider: BrowserProvider;
608
+ } | {
609
+ status: "skipped";
610
+ provider: undefined;
530
611
  };
612
+
531
613
  /**
532
- * Adapt evidence fields based on surface type and effective mode.
614
+ * Provider registry with optional registration and fail-open semantics.
533
615
  *
534
- * @param input.surfaceType - The project's surface type
535
- * @param input.effectiveMode - The resolved effective prototyping mode
536
- * @returns Evidence field statuses adapted for the surface
616
+ * Registration is synchronous. Lookup returns a discriminated union
617
+ * so callers can handle absence without try/catch.
537
618
  */
538
- declare function adaptSurfaceEvidence(input: SurfaceAdapterInput): SurfaceEvidenceResult;
619
+
620
+ declare class ProviderRegistry {
621
+ private providers;
622
+ register(provider: BrowserProvider): void;
623
+ /** Atomically replace an existing provider registration. */
624
+ replace(provider: BrowserProvider): void;
625
+ get(name: string): BrowserProvider | undefined;
626
+ has(name: string): boolean;
627
+ getOrSkip(name: string): ProviderLookupResult;
628
+ private qaProviders;
629
+ registerQaProvider(provider: BrowserQaProvider): void;
630
+ getQaProvider(name: string): BrowserQaProvider | undefined;
631
+ getFirstQaProvider(): BrowserQaProvider | undefined;
632
+ }
633
+
634
+ type PrototypingExecutionRequest = {
635
+ root: string;
636
+ requestedMode?: PrototypingMode;
637
+ providerRegistry?: ProviderRegistry;
638
+ renderAdapter?: RenderCaptureAdapter;
639
+ browserQaProviderId?: string;
640
+ critiqueAdapter?: CritiqueAdapter;
641
+ renderProviderId?: string;
642
+ targetUrl?: string;
643
+ reviewer?: string;
644
+ };
645
+ type PrototypingExecutionResult = {
646
+ mode: PrototypingMode;
647
+ surface: PrototypingSurface;
648
+ evidencePaths: {
649
+ prototyping: string;
650
+ render: string;
651
+ browserQa: string;
652
+ };
653
+ generatedAt: string;
654
+ };
655
+ declare function runPrototypingExecution(request: PrototypingExecutionRequest): Promise<PrototypingExecutionResult>;
656
+
657
+ type SddPreflightSource = "discussion-pack";
658
+ type SddPreflightStatus = "ready" | "blocked";
659
+ type RunSddPreflightOptions = {
660
+ assumptions?: string[];
661
+ };
662
+ type SddPreflightResult = {
663
+ status: SddPreflightStatus;
664
+ source: SddPreflightSource;
665
+ selectedInputPath: string | null;
666
+ importedReqCount: number | null;
667
+ openQuestions: string[];
668
+ blockers: string[];
669
+ nextCommands: string[];
670
+ preflightSummaryPath: string;
671
+ };
672
+ declare function runSddPreflight(root: string, config: QfaiConfig, options?: RunSddPreflightOptions): Promise<SddPreflightResult>;
539
673
 
540
674
  type ReportSummary = {
541
675
  specs: number;
@@ -692,6 +826,113 @@ type ReportTddCoverageSpec = {
692
826
  type ReportTddCoverage = {
693
827
  specs: ReportTddCoverageSpec[];
694
828
  };
829
+ type ReportSurfaceClassification = {
830
+ primarySurface: string;
831
+ uiBearing: boolean;
832
+ secondarySurfaces?: string[];
833
+ classificationRationale?: string;
834
+ };
835
+ type ReportFullHarnessExecution = {
836
+ mode: "full-harness";
837
+ iterations: number;
838
+ terminationReason: string;
839
+ finalScore: number;
840
+ bestIteration: number;
841
+ renderCaptured: number;
842
+ renderSkipped: number;
843
+ renderFailed: number;
844
+ browserQaPhasesExecuted: number;
845
+ browserQaPhasesSkipped: number;
846
+ browserQaTotalFindings: number;
847
+ };
848
+ type ReportPrototypingSummary = {
849
+ surfaceClassification?: ReportSurfaceClassification;
850
+ fullHarnessExecution?: ReportFullHarnessExecution;
851
+ recommendationArtifact?: {
852
+ status: "valid" | "missing" | "invalid" | "no-pack";
853
+ path?: string;
854
+ };
855
+ mode: {
856
+ requested?: string;
857
+ effective: string;
858
+ source: string;
859
+ rationale: string;
860
+ discussionRecommendation?: string;
861
+ allowedModes?: string[];
862
+ surface: string;
863
+ sourceSchema?: string;
864
+ };
865
+ evidence: {
866
+ specsCoverageStatus: "complete" | "incomplete";
867
+ specsCoverage?: {
868
+ expectedSpecIds: string[];
869
+ observedSpecIds: string[];
870
+ missingSpecIds: string[];
871
+ unexpectedSpecIds: string[];
872
+ };
873
+ runtimeGate: {
874
+ present: boolean;
875
+ required: boolean;
876
+ };
877
+ uiFidelity: {
878
+ present: boolean;
879
+ required: boolean;
880
+ };
881
+ renderBundle: {
882
+ present: boolean;
883
+ required: boolean;
884
+ };
885
+ browserQaBundle: {
886
+ present: boolean;
887
+ required: boolean;
888
+ };
889
+ obligationProfile: string;
890
+ };
891
+ fullHarness?: {
892
+ enabled: boolean;
893
+ available?: boolean;
894
+ runId?: string;
895
+ iterationCount?: number;
896
+ bestIteration?: number;
897
+ terminationReason?: string;
898
+ reviewerSignoffStatus?: string;
899
+ scoringTraceCount?: number;
900
+ };
901
+ render?: {
902
+ status?: string;
903
+ requested?: boolean;
904
+ captured: number;
905
+ skipped: number;
906
+ failed: number;
907
+ malformed: boolean;
908
+ inlinePayloadViolation?: boolean;
909
+ };
910
+ browserQa?: {
911
+ status?: string;
912
+ executed?: boolean;
913
+ findingsBySeverity: Record<"error" | "warning" | "info", number>;
914
+ findingsByCategory?: Record<string, number>;
915
+ summaryAggregates?: {
916
+ totalPassed: number;
917
+ totalFailed: number;
918
+ };
919
+ phaseSummary?: Record<string, {
920
+ passed: number;
921
+ failed: number;
922
+ }>;
923
+ modeMismatch?: boolean;
924
+ };
925
+ calibration?: {
926
+ configPresent: boolean;
927
+ thresholdSummary?: {
928
+ accept: number;
929
+ refine: number;
930
+ };
931
+ scoringTraceAvailable: boolean;
932
+ belowThresholdWarning?: boolean;
933
+ };
934
+ warnings: string[];
935
+ };
695
936
  type ReportData = {
696
937
  tool: "qfai";
697
938
  version: string;
@@ -703,6 +944,7 @@ type ReportData = {
703
944
  traceability: ReportTraceability;
704
945
  testStrategy: ReportTestStrategy;
705
946
  tddCoverage: ReportTddCoverage;
947
+ prototyping?: ReportPrototypingSummary;
706
948
  guardrails: ReportGuardrails;
707
949
  changeType: ReportChangeType;
708
950
  waivers: ReportWaivers;
@@ -738,4 +980,330 @@ declare function validateSpecSplitByCapability(root: string, config: QfaiConfig)
738
980
 
739
981
  declare function validateTraceability(root: string, config: QfaiConfig, phase: ValidationPhase): Promise<Issue[]>;
740
982
 
741
- export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, type DecisionGuardrail, type DecisionGuardrailEntry, type DiscussionRecommendation, type FailOn, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type ModeLogEntry, type ModeResolution, type ModeSource, type OrphanContractsPolicy, type OutputFormat, type PrecedenceInput, type PrototypingMode, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiUiuxMigrationConfig, type QfaiValidationConfig, RUNTIME_HEAVY_CHECKS, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type RunSddPreflightOptions, STATIC_OBLIGATIONS, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type SurfaceAdapterInput, type SurfaceEvidenceResult, type SurfaceType, type TraceabilitySeverity, type UiFidelityAutogenCrawlResult, type UiFidelityAutogenExpected, type UiFidelityAutogenMockPathResult, type UiFidelityAutogenResult, type UiFidelityGeneratedScreen, type UiFidelityLabelCoverage, VALID_MODE_SOURCES, type ValidationCounts, type ValidationOptions, type ValidationPhase, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, adaptSurfaceEvidence, autogenerateUiFidelity, buildUiFidelityScreens, checkDecisionGuardrails, collectExpectedFromContracts, computeLabelCoverage, crawlRoutesAndCollectFoundLabels, createReportData, defaultConfig, emitUiFidelity, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractDomMarkers, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatModeLog, formatReportJson, formatReportMarkdown, getConfigPath, lintSql, loadConfig, loadDecisionGuardrails, normalizeDecisionGuardrails, readDiscussionRecommendation, resolveObligations, resolveObligationsWithOptIn, resolvePath, resolvePrecedence, resolveToolVersion, runMockPaths, runSddPreflight, sortDecisionGuardrails, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateSpecSplitByCapability, validateTraceability };
983
+ /**
984
+ * Browser QA runner — WS-B
985
+ *
986
+ * Orchestrates the canonical 4-phase Browser QA execution model.
987
+ * Provider resolution → phase execution → truthful skip/fail handling.
988
+ */
989
+
990
+ /**
991
+ * Run the canonical 4-phase Browser QA.
992
+ *
993
+ * - provider resolved → delegate to provider methods
994
+ * - no provider → use built-in static analysis phases
995
+ * - non-ui surface → all phases skipped
996
+ */
997
+ declare function runBrowserQaOrchestrated(input: BrowserQaInput, provider?: BrowserQaProvider): Promise<BrowserQaRunResult>;
998
+ /**
999
+ * Summarize a BrowserQaRunResult for report output.
1000
+ */
1001
+ declare function summarizeBrowserQaResult(result: BrowserQaRunResult): BrowserQaSummary;
1002
+
1003
+ /**
1004
+ * Render runner — WS-C
1005
+ *
1006
+ * Executes render capture for a list of targets, producing truthful
1007
+ * evidence entries. No placeholder paths are emitted.
1008
+ */
1009
+
1010
+ /**
1011
+ * Run render capture for all targets.
1012
+ *
1013
+ * - adapter present + capture succeeds → `captured` with real file paths
1014
+ * - adapter present + capture throws → `failed` with reason
1015
+ * - adapter absent → `skipped` with reason
1016
+ */
1017
+ declare function runRenderCapture(targets: RenderCaptureTarget[], outputDir: string, adapter?: RenderCaptureAdapter, options?: {
1018
+ required?: boolean;
1019
+ }): Promise<RenderRunnerResult>;
1020
+
1021
+ type PrototypingSummaryBundle = {
1022
+ surface: PrototypingSurface;
1023
+ specs: Array<{
1024
+ specId: string;
1025
+ declared: {
1026
+ uiRoutes: number;
1027
+ apiEndpoints: number;
1028
+ dbObjects: number;
1029
+ };
1030
+ checked: {
1031
+ uiOk: number;
1032
+ apiNon404: number;
1033
+ dbPresent: number;
1034
+ };
1035
+ missing: {
1036
+ uiRoutes: string[];
1037
+ apiEndpoints: string[];
1038
+ dbObjects: string[];
1039
+ };
1040
+ }>;
1041
+ mode: {
1042
+ requested?: PrototypingMode;
1043
+ effective: PrototypingMode;
1044
+ source: string;
1045
+ rationale: string;
1046
+ };
1047
+ meta: {
1048
+ generatedAt: string;
1049
+ toolVersion: string;
1050
+ commands: string[];
1051
+ generatedBy: string;
1052
+ providerIds: string[];
1053
+ targetUrl?: string;
1054
+ };
1055
+ uiFidelityStatus?: {
1056
+ required: boolean;
1057
+ status: "completed" | "failed" | "n/a";
1058
+ reason?: string;
1059
+ };
1060
+ missingRequiredEvidence?: string[];
1061
+ runtimeGate?: {
1062
+ ui: Array<{
1063
+ route: string;
1064
+ status: number;
1065
+ }>;
1066
+ api: Array<{
1067
+ method: string;
1068
+ path: string;
1069
+ status: number;
1070
+ }>;
1071
+ };
1072
+ uiFidelity?: {
1073
+ mode: "interactive" | "skeleton";
1074
+ screens: Array<unknown>;
1075
+ };
1076
+ fullHarness?: {
1077
+ enabled: true;
1078
+ available: boolean;
1079
+ runId: string;
1080
+ iterationCount: number;
1081
+ bestIteration: number;
1082
+ terminationReason: string;
1083
+ reviewerSignoff: {
1084
+ status: string;
1085
+ reviewer: string;
1086
+ timestamp: string;
1087
+ };
1088
+ scoringTrace: Array<{
1089
+ iteration: number;
1090
+ weightedTotal: number;
1091
+ decision: string;
1092
+ }>;
1093
+ };
1094
+ };
1095
+ declare function writeEvidenceBundles(input: {
1096
+ root: string;
1097
+ render?: {
1098
+ result: RenderRunnerResult;
1099
+ surface: PrototypingSurface;
1100
+ mode: PrototypingMode;
1101
+ generatedAt: string;
1102
+ };
1103
+ browserQa?: {
1104
+ result: BrowserQaRunResult;
1105
+ mode: PrototypingMode;
1106
+ };
1107
+ prototyping: PrototypingSummaryBundle;
1108
+ }): Promise<{
1109
+ prototypingPath: string;
1110
+ renderPath: string;
1111
+ browserQaPath: string;
1112
+ }>;
1113
+
1114
+ type ThresholdConfig = {
1115
+ accept: number;
1116
+ refine: number;
1117
+ };
1118
+ type Decision = "accept" | "refine" | "pivot";
1119
+
1120
+ /**
1121
+ * Full-harness mode types.
1122
+ *
1123
+ * Defines the planner/generator/evaluator loop interfaces
1124
+ * and evidence structures for /qfai-prototyping full-harness mode.
1125
+ */
1126
+
1127
+ type HarnessConfig = {
1128
+ maxIterations: number;
1129
+ thresholds: ThresholdConfig;
1130
+ dimensionWeights?: Record<string, number> | undefined;
1131
+ dimensionFloors?: Record<string, number> | undefined;
1132
+ plateauDelta?: number | undefined;
1133
+ plateauLookback?: number | undefined;
1134
+ };
1135
+ type PlannerStrategy = {
1136
+ approach: string;
1137
+ constraints: string[];
1138
+ budgetGuidance: string;
1139
+ };
1140
+ type GeneratorOutput = {
1141
+ content: string;
1142
+ metadata?: Record<string, unknown> | undefined;
1143
+ };
1144
+ type DimensionScore = {
1145
+ dimension: string;
1146
+ score: number;
1147
+ weight: number;
1148
+ floor?: number | undefined;
1149
+ };
1150
+ type EvaluatorResult = {
1151
+ decision: Decision;
1152
+ weightedTotal: number;
1153
+ dimensionScores: DimensionScore[];
1154
+ feedback?: string | undefined;
1155
+ pivotContext?: string | undefined;
1156
+ };
1157
+ type IterationRecord = {
1158
+ iteration: number;
1159
+ plannerStrategy?: PlannerStrategy | undefined;
1160
+ generatorOutput: GeneratorOutput;
1161
+ evaluatorResult: EvaluatorResult;
1162
+ critiqueResult?: CritiqueResult | undefined;
1163
+ };
1164
+ type LoopStatus = "converged" | "max-iterations" | "plateau";
1165
+ type LoopResult = {
1166
+ status: LoopStatus;
1167
+ finalOutput: GeneratorOutput;
1168
+ finalScore: number;
1169
+ terminationReason: LoopStatus;
1170
+ iterationCount: number;
1171
+ iterations: IterationRecord[];
1172
+ bestIteration: number;
1173
+ };
1174
+ type HarnessEvidence = {
1175
+ runId: string;
1176
+ timestamp: string;
1177
+ status: LoopStatus;
1178
+ iterationCount: number;
1179
+ finalScore: number;
1180
+ terminationReason: LoopStatus;
1181
+ iterations: IterationRecord[];
1182
+ bestIteration: number;
1183
+ };
1184
+ type ReviewSummary = {
1185
+ finalScore: number;
1186
+ recommendation: string;
1187
+ iterationSummary: Array<{
1188
+ iteration: number;
1189
+ score: number;
1190
+ decision: Decision;
1191
+ }>;
1192
+ };
1193
+ type SpecInputs = {
1194
+ specId: string;
1195
+ requirements: string[];
1196
+ constraints?: string[] | undefined;
1197
+ calibrationPackPath?: string | undefined;
1198
+ };
1199
+
1200
+ /**
1201
+ * Harness adapters — WS-D
1202
+ *
1203
+ * Adapter interfaces for connecting the full-harness runtime to
1204
+ * render evidence, Browser QA, critique, and observability subsystems.
1205
+ */
1206
+
1207
+ type HarnessRenderAdapter = {
1208
+ captureEvidence(iteration: number): Promise<RenderRunnerResult>;
1209
+ };
1210
+ type HarnessBrowserQaAdapter = {
1211
+ runQa(iteration: number): Promise<BrowserQaRunResult>;
1212
+ };
1213
+ type HarnessObservabilityAdapter = {
1214
+ recordIteration(data: {
1215
+ iteration: number;
1216
+ score: number;
1217
+ decision: string;
1218
+ terminationReason?: string;
1219
+ }): void;
1220
+ flush(): Promise<void>;
1221
+ };
1222
+ type FullHarnessAdapters = {
1223
+ surface: SurfaceType;
1224
+ render?: HarnessRenderAdapter;
1225
+ browserQa?: HarnessBrowserQaAdapter;
1226
+ observability?: HarnessObservabilityAdapter;
1227
+ };
1228
+
1229
+ /**
1230
+ * Harness result writer — WS-D
1231
+ *
1232
+ * Writes full-harness execution results to a structured output.
1233
+ */
1234
+
1235
+ type FullHarnessOutput = {
1236
+ mode: "full-harness";
1237
+ iterations: number;
1238
+ terminationReason: string;
1239
+ evaluationSummary: {
1240
+ finalScore: number;
1241
+ bestIteration: number;
1242
+ decision: string;
1243
+ };
1244
+ evidenceSummary: {
1245
+ renderCaptured: number;
1246
+ renderSkipped: number;
1247
+ renderFailed: number;
1248
+ };
1249
+ browserQaSummary: {
1250
+ phasesExecuted: number;
1251
+ phasesFailed: number;
1252
+ phasesSkipped: number;
1253
+ totalFindings: number;
1254
+ };
1255
+ calibrationSummary: {
1256
+ thresholds: {
1257
+ accept: number;
1258
+ refine: number;
1259
+ };
1260
+ };
1261
+ observabilityRefs: string[];
1262
+ };
1263
+
1264
+ /**
1265
+ * Harness evidence generator — creates structured evidence and review
1266
+ * summaries from loop results.
1267
+ */
1268
+
1269
+ declare function generateEvidence(result: LoopResult, runId?: string): HarnessEvidence;
1270
+ declare function generateReviewSummary(result: LoopResult): ReviewSummary;
1271
+
1272
+ /**
1273
+ * Full-harness runtime — WS-D
1274
+ *
1275
+ * Production-path entry point for `mode=full-harness`.
1276
+ * Orchestrates the planner → generator → evaluator loop with
1277
+ * render evidence, Browser QA, critique, and observability.
1278
+ */
1279
+
1280
+ type FullHarnessRequest = {
1281
+ inputs: SpecInputs;
1282
+ config?: Partial<HarnessConfig>;
1283
+ adapters?: FullHarnessAdapters;
1284
+ critiqueAdapter?: CritiqueAdapter;
1285
+ };
1286
+ type FullHarnessResult = {
1287
+ loopResult: LoopResult;
1288
+ output: FullHarnessOutput;
1289
+ evidence: ReturnType<typeof generateEvidence>;
1290
+ reviewSummary: ReturnType<typeof generateReviewSummary>;
1291
+ };
1292
+ /**
1293
+ * Run the full-harness mode.
1294
+ *
1295
+ * Termination policy:
1296
+ * - `accept` reached → exit
1297
+ * - `max_iterations` reached → exit
1298
+ * - plateau detected → exit
1299
+ * - hard execution failure → throw
1300
+ */
1301
+ declare function runFullHarness(request: FullHarnessRequest): Promise<FullHarnessResult>;
1302
+
1303
+ declare function createPlaywrightRenderAdapter(input: {
1304
+ targetUrl?: string;
1305
+ }): RenderCaptureAdapter;
1306
+
1307
+ declare function createPlaywrightBrowserQaProvider(): BrowserQaProvider;
1308
+
1309
+ export { type AtddCodeTraceabilityResult, type AtddForbiddenRef, type AtddSpecRefs, type AtddTestKind, type AtddTraceabilityMissing, type AtddTraceabilityScan, type AtddUnknownRef, type AtddUnknownRefKind, BROWSER_QA_PHASES, type ConfigLoadResult, type ConfigPathKey, type ConfigSearchResult, type DecisionGuardrail, type DecisionGuardrailEntry, type DiscussionModeRecommendation, type DiscussionRecommendationSourceSchema, type FailOn, type FullHarnessRequest, type FullHarnessResult, type GuardrailCheckResult, type GuardrailIssue, type GuardrailIssueSeverity, type GuardrailLoadError, type GuardrailLoadResult, type GuardrailType, ID_PREFIXES, type IdFormatPrefix, type IdPrefix, type Issue, type IssueCategory, type IssueLocation, type IssueSeverity, type LegacyPrototypingSurface, type ModeResolutionInput, type ModeResolutionResult, type ModeSelectionSource, NON_UI_SURFACES, type OrphanContractsPolicy, type OutputFormat, type ParseDiscussionResult, type PrototypingExecutionConfig, type PrototypingExecutionRequest, type PrototypingExecutionResult, type PrototypingMode, type PrototypingObligations, type PrototypingSurface, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiPrototypingCalibrationConfig, type QfaiPrototypingConfig, type QfaiUiuxAuditConfig, type QfaiUiuxConfig, type QfaiUiuxMigrationConfig, type QfaiValidationConfig, type ReportChangeType, type ReportChangeTypeSummary, type ReportChangeTypeWarning, type ReportContractCoverage, type ReportData, type ReportDeltaCoverage, type ReportFullHarnessExecution, type ReportGuardrailItem, type ReportGuardrails, type ReportIds, type ReportPrototypingSummary, type ReportRuleFinding, type ReportSpecContractRefs, type ReportSpecCoverage, type ReportSummary, type ReportSurfaceClassification, type ReportTddCoverage, type ReportTddCoverageSpec, type ReportTestStrategy, type ReportTraceability, type ReportWaivers, type ResolveModeInput, type ResolvedModeSummary, type RunSddPreflightOptions, type SddPreflightResult, type SddPreflightSource, type SddPreflightStatus, type TraceabilitySeverity, UI_BEARING_SURFACES, type UiFidelityStatus, type ValidationCounts, type ValidationOptions, type ValidationPhase, type ValidationResult, type ValidationTraceability, type ValidationWaiverAction, type ValidationWaiverDowngradeTo, type ValidationWaiverEntry, type ValidationWaiverMatch, type ValidationWaiverScope, type ValidationWaiverSeverity, type ValidationWaiverSuppressed, type ValidationWaivers, checkDecisionGuardrails, createPlaywrightBrowserQaProvider, createPlaywrightRenderAdapter, createReportData, defaultConfig, derivePrototypingObligations, evaluateAtddCodeTraceability, extractAcSpecNumber, extractAllIds, extractBrSpecNumber, extractCapSpecNumber, extractCaseSpecNumber, extractDecisionGuardrailsFromMarkdown, extractIds, extractInvalidIds, extractScSpecNumber, extractSpecNumber, extractUsSpecNumber, filterDecisionGuardrailsByKeyword, findConfigRoot, formatGuardrailsForLlm, formatReportJson, formatReportMarkdown, getConfigPath, inferSurfaceFromRecommendationAndEvidence, isUiBearingSurface, isUiBearingSurfaceType, isValidPrototypingMode, isValidPrototypingSurface, lintSql, loadConfig, loadDecisionGuardrails, normalizeAllowedModes, normalizeDecisionGuardrails, normalizePrototypingSurface, normalizeSurface, parseDiscussionFromObject, parseDiscussionModeRecommendation, parseDiscussionModeRecommendationWithWarnings, resolvePath, resolvePrototypingMode, resolvePrototypingModeFromInput, resolveToolVersion, runBrowserQaOrchestrated, runFullHarness, runPrototypingExecution, runRenderCapture, runSddPreflight, sortDecisionGuardrails, summarizeBrowserQaResult, summarizeResolvedMode, validateAtddCodeTraceability, validateContracts, validateDefinedIds, validateLayeredTraceability, validateOrphanProhibition, validateProject, validateSpecSplitByCapability, validateTraceability, writeEvidenceBundles };