@mushi-mushi/ux 0.5.1 → 0.6.0
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.
- package/README.md +16 -2
- package/dist/cli.js +4383 -3935
- package/dist/index.d.ts +122 -13
- package/dist/index.js +331 -131
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -267,6 +267,8 @@ interface SessionOptions {
|
|
|
267
267
|
ignore?: readonly string[];
|
|
268
268
|
/** Write policy (guard.ts). Default read-only; fresh-eyes runs may write to the app's own origins (ADR 0053). */
|
|
269
269
|
policy?: GuardPolicy;
|
|
270
|
+
/** Cookies and storage a clean browser starts with (a sign-in done in another session); ignored with a profile. */
|
|
271
|
+
storageState?: Awaited<ReturnType<BrowserContext['storageState']>>;
|
|
270
272
|
}
|
|
271
273
|
declare function openSession(opts?: SessionOptions): Promise<BrowserSession>;
|
|
272
274
|
/**
|
|
@@ -1272,7 +1274,7 @@ interface FreshEyesStep {
|
|
|
1272
1274
|
capped?: boolean;
|
|
1273
1275
|
}
|
|
1274
1276
|
/** Why a session ended without reaching its goal. Measured causes are page facts; the last two are the model's. */
|
|
1275
|
-
type StallReason = 'signup_wall' | 'captcha' | 'external' | 'dead_end' | 'blocked' | 'error' | 'model_gave_up' | 'model_unavailable' | 'out_of_steps';
|
|
1277
|
+
type StallReason = 'signup_wall' | 'captcha' | 'external' | 'dead_end' | 'blocked' | 'error' | 'model_gave_up' | 'model_unavailable' | 'out_of_steps' | 'unverified';
|
|
1276
1278
|
interface FreshEyesSession {
|
|
1277
1279
|
index: number;
|
|
1278
1280
|
outcome: 'reached' | 'stalled';
|
|
@@ -1620,12 +1622,21 @@ declare function sitemapPaths(baseUrl: string): Promise<string[]>;
|
|
|
1620
1622
|
* Facts stay in code (ADR 0039): the model gives each rubric dimension a 1–10
|
|
1621
1623
|
* score and names issues with quoted evidence; the measured settle time and
|
|
1622
1624
|
* the axe counts cap the performance and accessibility scores, the overall
|
|
1623
|
-
* score is computed here from the
|
|
1624
|
-
* the page are filed.
|
|
1625
|
+
* score is computed here from the dimensions that were measured, and only
|
|
1626
|
+
* causes with evidence seen on the page are filed.
|
|
1627
|
+
*
|
|
1628
|
+
* Not measured is left out, never guessed (ADR 0067 corrections, 2026-11-30):
|
|
1629
|
+
* a page with no settle time keeps its speed score out of the overall and
|
|
1630
|
+
* uncapped; a page with no axe run and no screen hierarchy (no controls, no
|
|
1631
|
+
* headings) keeps its accessibility issues but not the score.
|
|
1632
|
+
*
|
|
1633
|
+
* A low number drags the page only with evidence (2026-12-02): a measured
|
|
1634
|
+
* fact that capped it, or a serious finding (high, evidence seen) that a
|
|
1635
|
+
* person has not marked "not a problem" (anchoredDimensions).
|
|
1625
1636
|
*
|
|
1626
1637
|
* No imports, no Deno or Node globals: vitest and Deno both load it as is.
|
|
1627
1638
|
*/
|
|
1628
|
-
declare const UX_SCORECARD_PROMPT_VERSION = "ux-scorecard-2026-
|
|
1639
|
+
declare const UX_SCORECARD_PROMPT_VERSION = "ux-scorecard-2026-12-02.2";
|
|
1629
1640
|
declare const UX_DIMENSIONS: readonly ["clarity", "hierarchy", "consistency", "states", "truthfulness", "copy", "accessibility", "performance"];
|
|
1630
1641
|
type UxDimension = (typeof UX_DIMENSIONS)[number];
|
|
1631
1642
|
type UxSeverity = 'high' | 'medium' | 'low';
|
|
@@ -1669,7 +1680,11 @@ interface UxPageFacts {
|
|
|
1669
1680
|
controls: string[];
|
|
1670
1681
|
/** Visible text early in the load (about 1 s), when it differs: loading and placeholder states. */
|
|
1671
1682
|
earlyText?: string;
|
|
1672
|
-
/**
|
|
1683
|
+
/**
|
|
1684
|
+
* Milliseconds until the page stopped changing; null when it was not
|
|
1685
|
+
* measured (a phone screenshot). A web page still changing at the end of
|
|
1686
|
+
* the wait reports the wait it took, never null.
|
|
1687
|
+
*/
|
|
1673
1688
|
settleMs: number | null;
|
|
1674
1689
|
/** Serious and critical axe results; null when axe could not run on the page. */
|
|
1675
1690
|
axe: {
|
|
@@ -1715,12 +1730,15 @@ interface UxPageScore {
|
|
|
1715
1730
|
issues: UxIssue[];
|
|
1716
1731
|
claims: UxClaim[];
|
|
1717
1732
|
promptVersion: string;
|
|
1733
|
+
/** The model that scored the page, when the scorer knows it. */
|
|
1734
|
+
model?: string;
|
|
1718
1735
|
}
|
|
1719
1736
|
/**
|
|
1720
1737
|
* A page's identity across runs: the path, plus only the query params that
|
|
1721
1738
|
* pick a view (`/team?view=sso` and `/team?view=billing` are two pages; a
|
|
1722
1739
|
* `?project=` or a record id in the query is not a page). Trailing slashes and
|
|
1723
|
-
* the hash are dropped.
|
|
1740
|
+
* the hash are dropped. It always starts with `/` (`01-home` → `/01-home`):
|
|
1741
|
+
* ux_surfaces.path must, and a screen name is not a path (live 2026-11-30).
|
|
1724
1742
|
*/
|
|
1725
1743
|
declare function scorecardPageKey(path: string): string;
|
|
1726
1744
|
interface UxPagePromptContext {
|
|
@@ -1746,16 +1764,73 @@ declare function normText(s: string): string;
|
|
|
1746
1764
|
* fragment of 6+ characters found in the page counts.
|
|
1747
1765
|
*/
|
|
1748
1766
|
declare function evidenceSeenIn(evidence: string, f: Pick<UxPageFacts, 'text' | 'title' | 'controls' | 'headings' | 'earlyText' | 'breadcrumb'>): boolean;
|
|
1749
|
-
/** Pure: the performance score the measured settle time allows. */
|
|
1767
|
+
/** Pure: the performance score the measured settle time allows. Not measured caps nothing (it is left out of the overall instead). */
|
|
1750
1768
|
declare function performanceCap(settleMs: number | null): number;
|
|
1751
1769
|
/** Pure: the accessibility score the measured axe results and sideways scroll allow. */
|
|
1752
1770
|
declare function accessibilityCap(f: Pick<UxPageFacts, 'axe' | 'overflowX'>): number;
|
|
1753
1771
|
/**
|
|
1754
|
-
* Pure: the page's overall score
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1772
|
+
* Pure: the dimensions a page's overall score counts. Performance counts only
|
|
1773
|
+
* with a measured settle time. Accessibility counts with an axe run or a
|
|
1774
|
+
* screen hierarchy (controls or headings read from the screen); from the
|
|
1775
|
+
* pixels alone it is checked by eye only: its issues stay, its score does not
|
|
1776
|
+
* count.
|
|
1777
|
+
*/
|
|
1778
|
+
declare function countedDimensions(f: Pick<UxPageFacts, 'settleMs' | 'axe' | 'controls' | 'headings'>): UxDimension[];
|
|
1779
|
+
/**
|
|
1780
|
+
* Pure: the dimensions whose low score is backed by evidence, so they may
|
|
1781
|
+
* drag the page's overall score down (ADR 0067 corrections, 2026-12-02):
|
|
1782
|
+
*
|
|
1783
|
+
* - a measured fact capped it: a settle time slower than 1.5 s
|
|
1784
|
+
* (performance), serious or critical axe results or a sideways scroll
|
|
1785
|
+
* (accessibility);
|
|
1786
|
+
* - or one of the page's findings in it is high impact with its evidence
|
|
1787
|
+
* seen on the page (what the console calls "serious").
|
|
1788
|
+
*
|
|
1789
|
+
* A low number with neither is the model's unanchored guess. The 21 Nov check
|
|
1790
|
+
* of Mushi's console showed this: axe passed on 72 of 74 pages, yet
|
|
1791
|
+
* accessibility was the weakest dimension on 27 of them, at 5–7 from pixels
|
|
1792
|
+
* alone. Such a number still counts in the mean, but it cannot drag the page.
|
|
1793
|
+
* Callers leave out findings a person marked "not a problem".
|
|
1794
|
+
*/
|
|
1795
|
+
declare function anchoredDimensions(facts: Pick<UxPageFacts, 'settleMs' | 'axe' | 'overflowX'>, issues: ReadonlyArray<Pick<UxIssue, 'dimension' | 'severity' | 'evidenceSeen'>>): UxDimension[];
|
|
1796
|
+
/**
|
|
1797
|
+
* Pure: the page's overall score from the dimensions it counts (all eight
|
|
1798
|
+
* when none are named). A page is as good as its worst evidenced problem lets
|
|
1799
|
+
* it be: 0.5 × mean + 0.5 × the lowest anchored dimension (never above the
|
|
1800
|
+
* mean), rounded to a whole number. With no anchored dimension it is the mean.
|
|
1801
|
+
* `anchored` defaults to every counted dimension (the plain mean-and-min rule).
|
|
1802
|
+
*/
|
|
1803
|
+
declare function overallScore(scores: Record<UxDimension, number>, counted?: readonly UxDimension[], anchored?: readonly UxDimension[]): number;
|
|
1804
|
+
/**
|
|
1805
|
+
* Pure: the model's own numbers with the facts applied: performance and
|
|
1806
|
+
* accessibility capped by what was measured, the overall from the counted
|
|
1807
|
+
* dimensions, dragged only by anchored ones (anchoredDimensions over
|
|
1808
|
+
* `issues`, the findings that count). `raw` is what the model said
|
|
1809
|
+
* (rawScores of a stored score).
|
|
1810
|
+
*/
|
|
1811
|
+
declare function applyFacts(raw: Record<UxDimension, number>, facts: UxPageFacts, issues: ReadonlyArray<Pick<UxIssue, 'dimension' | 'severity' | 'evidenceSeen'>>): {
|
|
1812
|
+
scores: Record<UxDimension, number>;
|
|
1813
|
+
capped: Partial<Record<UxDimension, number>>;
|
|
1814
|
+
overall: number;
|
|
1815
|
+
};
|
|
1816
|
+
/** Pure: what the model said for each dimension, before any fact capped it (NaN where a stored score lacks one). */
|
|
1817
|
+
declare function rawScores(s: Pick<UxPageScore, 'scores' | 'capped'>): Record<UxDimension, number>;
|
|
1818
|
+
/**
|
|
1819
|
+
* Pure: a stored page score read under today's rules (caps and counted
|
|
1820
|
+
* dimensions), from the per-dimension numbers it kept. Stored rows are never
|
|
1821
|
+
* rewritten: a run scored under an older rule shows the corrected score when
|
|
1822
|
+
* it is read. Without the facts it was scored on, or with a dimension
|
|
1823
|
+
* missing, the score stays as stored and says so (`rescored: false`).
|
|
1824
|
+
*
|
|
1825
|
+
* `notCounted` names findings that no longer count (a person marked their
|
|
1826
|
+
* cause "not a problem"): they stay on the page but cannot drag its score.
|
|
1757
1827
|
*/
|
|
1758
|
-
declare function
|
|
1828
|
+
declare function rescorePage(score: UxPageScore, facts: UxPageFacts | undefined, notCounted?: (issue: UxIssue) => boolean): {
|
|
1829
|
+
score: UxPageScore;
|
|
1830
|
+
rescored: boolean;
|
|
1831
|
+
};
|
|
1832
|
+
/** Pure: the typical score of a set of pages: the median, the lower middle one when the count is even (a score some page really has). */
|
|
1833
|
+
declare function typicalScore(overalls: readonly number[]): number | null;
|
|
1759
1834
|
type ParsedPageScore = {
|
|
1760
1835
|
ok: true;
|
|
1761
1836
|
value: UxPageScore;
|
|
@@ -1896,6 +1971,26 @@ declare function scorecardMarkdown(input: {
|
|
|
1896
1971
|
causes: readonly UxCause[];
|
|
1897
1972
|
}): string;
|
|
1898
1973
|
|
|
1974
|
+
/**
|
|
1975
|
+
* Which build a capture folder shows, for `mushi-ux upload` (migration
|
|
1976
|
+
* 20261130233000_ux_run_provenance): `<dir>/build.json`, which the capture
|
|
1977
|
+
* templates write (versionName/versionCode from `dumpsys package`, the OTA
|
|
1978
|
+
* id, the commit), then the --app-version/--build/--ota/--commit flags, then
|
|
1979
|
+
* the CI's GITHUB_SHA. Its own file, without Playwright or pngjs, so it tests
|
|
1980
|
+
* on its own.
|
|
1981
|
+
*/
|
|
1982
|
+
/** Which build the screens show (the server's provenance fields on POST /v1/ux/captures). */
|
|
1983
|
+
interface UploadBuild {
|
|
1984
|
+
appVersion?: string;
|
|
1985
|
+
buildNumber?: string;
|
|
1986
|
+
otaId?: string;
|
|
1987
|
+
commitSha?: string;
|
|
1988
|
+
envUrl?: string;
|
|
1989
|
+
capturedAt?: string;
|
|
1990
|
+
osVersion?: string;
|
|
1991
|
+
deviceModel?: string;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1899
1994
|
/**
|
|
1900
1995
|
* `mushi-ux scorecard`: score every page of a live app against a written
|
|
1901
1996
|
* rubric (ADR 0067), group what is wrong into root causes, and file the top
|
|
@@ -2021,6 +2116,8 @@ interface ScorecardResult {
|
|
|
2021
2116
|
causes: UxCause[];
|
|
2022
2117
|
groupError?: string;
|
|
2023
2118
|
markdown: string;
|
|
2119
|
+
/** Which build the pages show, when the app publishes it (build-info.ts webBuild). */
|
|
2120
|
+
build?: UploadBuild;
|
|
2024
2121
|
}
|
|
2025
2122
|
/** Pure: a scorecard run id in the console's format (yyyymmdd-hhmmss-xxxx). */
|
|
2026
2123
|
declare function scorecardRunId(now: Date, rand?: () => number): string;
|
|
@@ -2041,6 +2138,7 @@ declare function syncScorecard(cfg: SyncConfig, input: {
|
|
|
2041
2138
|
causes?: readonly UxCause[];
|
|
2042
2139
|
cliVersion?: string;
|
|
2043
2140
|
uploaded?: ReadonlyMap<string, string[]>;
|
|
2141
|
+
build?: UploadBuild;
|
|
2044
2142
|
}): Promise<string | null>;
|
|
2045
2143
|
/** Upload every page's screenshots (local scoring: the server scorer uploads as it scores). */
|
|
2046
2144
|
declare function uploadAllShots(cfg: SyncConfig, runId: string, pages: readonly ScorecardPageResult[]): Promise<Map<string, string[]>>;
|
|
@@ -2167,8 +2265,13 @@ declare const UPLOAD_PLATFORMS: readonly ["ios", "android", "flutter", "react_na
|
|
|
2167
2265
|
type UploadPlatform = (typeof UPLOAD_PLATFORMS)[number];
|
|
2168
2266
|
declare const UPLOAD_SOURCES: readonly ["maestro", "adb", "simctl", "sdk", "playwright", "other"];
|
|
2169
2267
|
type UploadSource = (typeof UPLOAD_SOURCES)[number];
|
|
2170
|
-
/** The server's caps (POST /v1/ux/captures). */
|
|
2268
|
+
/** The server's caps (POST /v1/ux/captures): screens in one request. */
|
|
2171
2269
|
declare const UPLOAD_MAX_PAGES = 60;
|
|
2270
|
+
/**
|
|
2271
|
+
* Screens in one check, sent in requests of UPLOAD_MAX_PAGES (the server's
|
|
2272
|
+
* UX_CAPTURES_MAX_RUN_PAGES; the console sends the same parts, 2026-12-04).
|
|
2273
|
+
*/
|
|
2274
|
+
declare const UPLOAD_MAX_RUN_PAGES = 200;
|
|
2172
2275
|
declare const UPLOAD_MAX_PNG_BYTES: number;
|
|
2173
2276
|
interface CapturedScreen {
|
|
2174
2277
|
folder: string;
|
|
@@ -2199,6 +2302,10 @@ interface UploadOptions {
|
|
|
2199
2302
|
file?: boolean;
|
|
2200
2303
|
/** With file: show what would be filed. */
|
|
2201
2304
|
dryRun?: boolean;
|
|
2305
|
+
/** Which build the screens show; a field given here wins over `<dir>/build.json`. */
|
|
2306
|
+
build?: UploadBuild;
|
|
2307
|
+
/** The CI's commit (GITHUB_SHA), used when neither the flags nor build.json name one. */
|
|
2308
|
+
ciCommit?: string;
|
|
2202
2309
|
concurrency?: number;
|
|
2203
2310
|
onProgress?: (msg: string) => void;
|
|
2204
2311
|
fetchImpl?: typeof fetch;
|
|
@@ -2210,6 +2317,8 @@ interface UploadResult {
|
|
|
2210
2317
|
reservedUsd: number | null;
|
|
2211
2318
|
scored: number;
|
|
2212
2319
|
mean: number | null;
|
|
2320
|
+
/** The median page score, a whole number (what the CLI prints). */
|
|
2321
|
+
typical: number | null;
|
|
2213
2322
|
causes: UxCause[];
|
|
2214
2323
|
errors: string[];
|
|
2215
2324
|
filed?: ScorecardFileOutcome;
|
|
@@ -2246,5 +2355,5 @@ interface Verdict {
|
|
|
2246
2355
|
}
|
|
2247
2356
|
declare function decide(input: VerdictInput): Verdict;
|
|
2248
2357
|
|
|
2249
|
-
export { AGENTS, CLIP_LIMITS, DEFAULT_CLIP_VIEWPORT, DEFAULT_JUDGE_MODEL, DEFAULT_SCORECARD_MODEL, DEFAULT_SCORECARD_VIEWPORT, DEFAULT_SETUP_COMMAND, FACTS_SCRIPT, POINTER_PROMPT, UPLOAD_MAX_PAGES, UPLOAD_MAX_PNG_BYTES, UPLOAD_PLATFORMS, UPLOAD_SOURCES, UX_DIMENSIONS, UX_RUBRIC, UX_SCORECARD_LIMITS, UX_SCORECARD_PROMPT_VERSION, UX_SCORE_ANCHORS, VIEWPORTS, accessibilityCap, buildPacket, capFlows, captureFolder, capturePage, captureSurface, causeIsFileable, causeRank, causeReportBody, causeSlug, causeTokens, clampCaps, clipSlug, clipUploadBody, cropTop, cursorCloudAdapter, cursorModel, dHash, decide, discover, effectiveClipCaps, evidenceSeenIn, fetchClipCaps, fileScorecard, findDesignFiles, firstJsonObject, getAgent, groupCauses, groupingPrompt, hammingHex, hasTimeForScreen, httpsRepoUrl, installGuard, isDestructiveLabel, isRequestAllowed, judgeSurface, loadState, localScorer, mergeGrouping, nativeFacts, newRunId, nextRoutePath, nodesToContent, normText, normalizeLink, openSession, overallScore, pageSystemPrompt, pageUserPrompt, parseFlow, parseMaestroHierarchy, parsePageAnswer, parseUiautomator, patternKeyFor, performanceCap, pixelDiff, planFiling, pngSize, probePenalty, quoteArg, reactRouterPaths, readCaptures, readScreens, recordClips, routesFromSource, runDir, runFreshEyes, runProbes, runScorecard, runTerminalSetup, safeShotPath, sameCause, saveState, scorecardContext, scorecardMarkdown, scorecardMarker, scorecardPageKey, scorecardRows, scorecardRunId, screenPath, serverScorer, settle, sitemapPaths, startDashboard, startLoop, startSync, surfaceKey, syncConfigFromEnv, syncScorecard, toSnapshot, topCauses, unshuffle, uploadAllShots, uploadCaptures, uploadClips };
|
|
2358
|
+
export { AGENTS, CLIP_LIMITS, DEFAULT_CLIP_VIEWPORT, DEFAULT_JUDGE_MODEL, DEFAULT_SCORECARD_MODEL, DEFAULT_SCORECARD_VIEWPORT, DEFAULT_SETUP_COMMAND, FACTS_SCRIPT, POINTER_PROMPT, UPLOAD_MAX_PAGES, UPLOAD_MAX_PNG_BYTES, UPLOAD_MAX_RUN_PAGES, UPLOAD_PLATFORMS, UPLOAD_SOURCES, UX_DIMENSIONS, UX_RUBRIC, UX_SCORECARD_LIMITS, UX_SCORECARD_PROMPT_VERSION, UX_SCORE_ANCHORS, VIEWPORTS, accessibilityCap, anchoredDimensions, applyFacts, buildPacket, capFlows, captureFolder, capturePage, captureSurface, causeIsFileable, causeRank, causeReportBody, causeSlug, causeTokens, clampCaps, clipSlug, clipUploadBody, countedDimensions, cropTop, cursorCloudAdapter, cursorModel, dHash, decide, discover, effectiveClipCaps, evidenceSeenIn, fetchClipCaps, fileScorecard, findDesignFiles, firstJsonObject, getAgent, groupCauses, groupingPrompt, hammingHex, hasTimeForScreen, httpsRepoUrl, installGuard, isDestructiveLabel, isRequestAllowed, judgeSurface, loadState, localScorer, mergeGrouping, nativeFacts, newRunId, nextRoutePath, nodesToContent, normText, normalizeLink, openSession, overallScore, pageSystemPrompt, pageUserPrompt, parseFlow, parseMaestroHierarchy, parsePageAnswer, parseUiautomator, patternKeyFor, performanceCap, pixelDiff, planFiling, pngSize, probePenalty, quoteArg, rawScores, reactRouterPaths, readCaptures, readScreens, recordClips, rescorePage, routesFromSource, runDir, runFreshEyes, runProbes, runScorecard, runTerminalSetup, safeShotPath, sameCause, saveState, scorecardContext, scorecardMarkdown, scorecardMarker, scorecardPageKey, scorecardRows, scorecardRunId, screenPath, serverScorer, settle, sitemapPaths, startDashboard, startLoop, startSync, surfaceKey, syncConfigFromEnv, syncScorecard, toSnapshot, topCauses, typicalScore, unshuffle, uploadAllShots, uploadCaptures, uploadClips };
|
|
2250
2359
|
export type { AgentAdapter, AgentName, AgentRunOptions, AllowRule, AxeViolation, BrowserSession, Candidate, Capture, CapturedScreen, ClipFlow, ClipResult, ClipSkip, ClipUploadOutcome, CursorCloudDeps, Dashboard, DiscoverOptions, FreshAction, FreshAsk, FreshEyesFinding, FreshEyesOptions, FreshEyesPersona, FreshEyesResult, FreshEyesSession, FreshEyesStep, GuardPolicy, Identity, IterationRecord, JudgeClaim, JudgeOptions, JudgeVerdict, LayoutIssue, LoopEvent, LoopHandle, LoopOptions, NativeNode, Opinion, OpinionCategory, PacketInput, PageCapture, PageFacts, ParsedPageScore, Phase, PhaseName, ProbeResult, RecordClipsOptions, ReplayStep, RequirementKind, RunState, ScoreVia, ScorecardFileOutcome, ScorecardOptions, ScorecardPageResult, ScorecardResult, ScorecardRow, ScoredPage, Scorer, ServerClipCaps, StallReason, StepOutcome, SuccessCheck, Surface, SurfaceKind, SurfaceState, SurfaceStatus, SyncConfig, SyncHandle, TerminalHandoff, TerminalOptions, TerminalResult, UploadOptions, UploadPlatform, UploadResult, UploadSource, UxCause, UxCausePage, UxClaim, UxDimension, UxFilingPlan, UxIssue, UxPageFacts, UxPagePromptContext, UxPageScore, UxSeverity, Verdict, VerdictInput, Viewport, WriteMode };
|