@open-qa/qa 0.0.0-stage → 0.1.0-alpha.4

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 (313) hide show
  1. package/LICENSE +204 -0
  2. package/NOTICE +7 -0
  3. package/THIRD_PARTY.md +12 -0
  4. package/THIRD_PARTY_NOTICES.md +11 -0
  5. package/drizzle/0000_qa_core.sql +158 -0
  6. package/drizzle/0001_run_health.sql +3 -0
  7. package/drizzle/0002_bounded_cleanup.sql +5 -0
  8. package/drizzle/0003_step_replay_cache.sql +9 -0
  9. package/drizzle/0004_credential_expiry.sql +1 -0
  10. package/drizzle/0005_server_api.sql +19 -0
  11. package/drizzle/0006_submission_created.sql +3 -0
  12. package/drizzle/0007_findings.sql +19 -0
  13. package/drizzle/0008_classification_labels.sql +14 -0
  14. package/drizzle/0009_job_queue.sql +20 -0
  15. package/drizzle/0010_result_notifications.sql +13 -0
  16. package/drizzle/0011_result_notification_retries.sql +5 -0
  17. package/drizzle/0012_result_notification_flows.sql +44 -0
  18. package/drizzle/0013_flow_quarantine.sql +35 -0
  19. package/drizzle/0014_run_budgets.sql +2 -0
  20. package/drizzle/0015_flow_lifecycle.sql +9 -0
  21. package/drizzle/0016_open_qa_classification.sql +28 -0
  22. package/drizzle/meta/0000_snapshot.json +1002 -0
  23. package/drizzle/meta/0001_snapshot.json +1021 -0
  24. package/drizzle/meta/0002_snapshot.json +1027 -0
  25. package/drizzle/meta/0003_snapshot.json +1081 -0
  26. package/drizzle/meta/0004_snapshot.json +1087 -0
  27. package/drizzle/meta/0005_snapshot.json +1210 -0
  28. package/drizzle/meta/0006_snapshot.json +1244 -0
  29. package/drizzle/meta/0007_snapshot.json +1353 -0
  30. package/drizzle/meta/0008_snapshot.json +1435 -0
  31. package/drizzle/meta/0009_snapshot.json +1587 -0
  32. package/drizzle/meta/0010_snapshot.json +1675 -0
  33. package/drizzle/meta/0011_snapshot.json +1692 -0
  34. package/drizzle/meta/0012_snapshot.json +1818 -0
  35. package/drizzle/meta/0013_snapshot.json +2016 -0
  36. package/drizzle/meta/0014_snapshot.json +2028 -0
  37. package/drizzle/meta/0015_snapshot.json +2064 -0
  38. package/drizzle/meta/0016_snapshot.json +2076 -0
  39. package/drizzle/meta/_journal.json +125 -0
  40. package/package.json +118 -4
  41. package/problem-matcher.json +32 -0
  42. package/src/adapters/db-lease-pool.d.ts +25 -0
  43. package/src/adapters/db-lease-pool.js +293 -0
  44. package/src/adapters/dir-artifact-store.d.ts +9 -0
  45. package/src/adapters/dir-artifact-store.js +64 -0
  46. package/src/adapters/e2b-agent.d.ts +7 -0
  47. package/src/adapters/e2b-agent.js +94 -0
  48. package/src/adapters/e2b-artifacts.d.ts +3 -0
  49. package/src/adapters/e2b-artifacts.js +66 -0
  50. package/src/adapters/e2b-bounded.d.ts +1 -0
  51. package/src/adapters/e2b-bounded.js +19 -0
  52. package/src/adapters/e2b-client.d.ts +33 -0
  53. package/src/adapters/e2b-client.js +114 -0
  54. package/src/adapters/e2b-executor.d.ts +26 -0
  55. package/src/adapters/e2b-executor.js +194 -0
  56. package/src/adapters/e2b-lifetime.d.ts +20 -0
  57. package/src/adapters/e2b-lifetime.js +73 -0
  58. package/src/adapters/e2b-prune.d.ts +13 -0
  59. package/src/adapters/e2b-prune.js +42 -0
  60. package/src/adapters/file-replay-cache.d.ts +14 -0
  61. package/src/adapters/file-replay-cache.js +120 -0
  62. package/src/adapters/file-run-store.d.ts +175 -0
  63. package/src/adapters/file-run-store.js +280 -0
  64. package/src/adapters/fixed-lease-pool.d.ts +10 -0
  65. package/src/adapters/fixed-lease-pool.js +237 -0
  66. package/src/adapters/gcs/artifact-store.d.ts +49 -0
  67. package/src/adapters/gcs/artifact-store.js +247 -0
  68. package/src/adapters/gcs/client.d.ts +22 -0
  69. package/src/adapters/gcs/client.js +106 -0
  70. package/src/adapters/gcs/download.d.ts +9 -0
  71. package/src/adapters/gcs/download.js +43 -0
  72. package/src/adapters/gcs/index.d.ts +8 -0
  73. package/src/adapters/gcs/index.js +23 -0
  74. package/src/adapters/gcs/periodic-flush.d.ts +5 -0
  75. package/src/adapters/gcs/periodic-flush.js +16 -0
  76. package/src/adapters/gcs/pg-catalog.d.ts +16 -0
  77. package/src/adapters/gcs/pg-catalog.js +149 -0
  78. package/src/adapters/gcs/replay-completeness.d.ts +1 -0
  79. package/src/adapters/gcs/replay-completeness.js +65 -0
  80. package/src/adapters/gcs/scan-upload.d.ts +10 -0
  81. package/src/adapters/gcs/scan-upload.js +26 -0
  82. package/src/adapters/index.d.ts +5 -0
  83. package/src/adapters/index.js +12 -0
  84. package/src/adapters/lease-transaction.d.ts +2 -0
  85. package/src/adapters/lease-transaction.js +61 -0
  86. package/src/adapters/local-credential-resolver.d.ts +5 -0
  87. package/src/adapters/local-credential-resolver.js +15 -0
  88. package/src/adapters/local-env.d.ts +1 -0
  89. package/src/adapters/local-env.js +37 -0
  90. package/src/adapters/local-files.d.ts +17 -0
  91. package/src/adapters/local-files.js +150 -0
  92. package/src/adapters/pg-classification-store.d.ts +58 -0
  93. package/src/adapters/pg-classification-store.js +112 -0
  94. package/src/adapters/pg-replay-cache.d.ts +16 -0
  95. package/src/adapters/pg-replay-cache.js +111 -0
  96. package/src/adapters/pg-run-store.d.ts +58 -0
  97. package/src/adapters/pg-run-store.js +399 -0
  98. package/src/adapters/resource-pools.d.ts +2 -0
  99. package/src/adapters/resource-pools.js +28 -0
  100. package/src/adapters/secret-manager-credential-resolver.d.ts +44 -0
  101. package/src/adapters/secret-manager-credential-resolver.js +102 -0
  102. package/src/artifact-scan.d.ts +21 -0
  103. package/src/artifact-scan.js +139 -0
  104. package/src/budget-confirmation.d.ts +23 -0
  105. package/src/budget-confirmation.js +43 -0
  106. package/src/cache-command.d.ts +7 -0
  107. package/src/cache-command.js +107 -0
  108. package/src/classification-command.d.ts +14 -0
  109. package/src/classification-command.js +72 -0
  110. package/src/classification-diff.d.ts +10 -0
  111. package/src/classification-diff.js +47 -0
  112. package/src/classification-model.d.ts +17 -0
  113. package/src/classification-model.js +51 -0
  114. package/src/classification-notifier.d.ts +21 -0
  115. package/src/classification-notifier.js +34 -0
  116. package/src/classify-runs.d.ts +31 -0
  117. package/src/classify-runs.js +138 -0
  118. package/src/cli-program.d.ts +9 -0
  119. package/src/cli-program.js +172 -0
  120. package/src/cli.d.ts +2 -0
  121. package/src/cli.js +12 -0
  122. package/src/commands.d.ts +7 -0
  123. package/src/commands.js +17 -0
  124. package/src/credential-references.d.ts +24 -0
  125. package/src/credential-references.js +33 -0
  126. package/src/db/commands.d.ts +1 -0
  127. package/src/db/commands.js +34 -0
  128. package/src/db/credentials.d.ts +16 -0
  129. package/src/db/credentials.js +73 -0
  130. package/src/db/database.d.ts +12 -0
  131. package/src/db/database.js +135 -0
  132. package/src/db/event-chunks.d.ts +405 -0
  133. package/src/db/event-chunks.js +74 -0
  134. package/src/db/fencing.d.ts +8 -0
  135. package/src/db/fencing.js +16 -0
  136. package/src/db/flow-status.d.ts +41 -0
  137. package/src/db/flow-status.js +208 -0
  138. package/src/db/index.d.ts +12 -0
  139. package/src/db/index.js +24 -0
  140. package/src/db/queries.d.ts +73 -0
  141. package/src/db/queries.js +122 -0
  142. package/src/db/resources.d.ts +14 -0
  143. package/src/db/resources.js +61 -0
  144. package/src/db/schema.d.ts +3532 -0
  145. package/src/db/schema.js +501 -0
  146. package/src/demo-command.d.ts +1 -0
  147. package/src/demo-command.js +50 -0
  148. package/src/doctor-command.d.ts +15 -0
  149. package/src/doctor-command.js +275 -0
  150. package/src/doctor-summary.d.ts +2 -0
  151. package/src/doctor-summary.js +31 -0
  152. package/src/draft-api.d.ts +460 -0
  153. package/src/draft-api.js +333 -0
  154. package/src/draft-command.d.ts +10 -0
  155. package/src/draft-command.js +73 -0
  156. package/src/draft-hooks.d.ts +3 -0
  157. package/src/draft-hooks.js +33 -0
  158. package/src/draft-pages.d.ts +11 -0
  159. package/src/draft-pages.js +82 -0
  160. package/src/engine.d.ts +105 -0
  161. package/src/engine.js +323 -0
  162. package/src/execution-snapshot.d.ts +21 -0
  163. package/src/execution-snapshot.js +141 -0
  164. package/src/flow-check.d.ts +9 -0
  165. package/src/flow-check.js +68 -0
  166. package/src/flow-lifecycle.d.ts +6 -0
  167. package/src/flow-lifecycle.js +61 -0
  168. package/src/flow-lint.d.ts +8 -0
  169. package/src/flow-lint.js +73 -0
  170. package/src/flow-loader.d.ts +219 -0
  171. package/src/flow-loader.js +236 -0
  172. package/src/flow-source.d.ts +2 -0
  173. package/src/flow-source.js +6 -0
  174. package/src/flows-api.d.ts +1 -0
  175. package/src/flows-api.js +12 -0
  176. package/src/heal-notification.d.ts +16 -0
  177. package/src/heal-notification.js +62 -0
  178. package/src/hooks/api.d.ts +29 -0
  179. package/src/hooks/api.js +15 -0
  180. package/src/hooks/consumer.d.ts +18 -0
  181. package/src/hooks/consumer.js +98 -0
  182. package/src/hooks/loader.d.ts +6 -0
  183. package/src/hooks/loader.js +28 -0
  184. package/src/hooks/registry.d.ts +22 -0
  185. package/src/hooks/registry.js +23 -0
  186. package/src/hooks/runner.d.ts +19 -0
  187. package/src/hooks/runner.js +279 -0
  188. package/src/hooks/session-cache.d.ts +16 -0
  189. package/src/hooks/session-cache.js +42 -0
  190. package/src/hooks/session-store.d.ts +20 -0
  191. package/src/hooks/session-store.js +95 -0
  192. package/src/hooks/worker.d.ts +1 -0
  193. package/src/hooks/worker.js +84 -0
  194. package/src/http-stage-client.d.ts +367 -0
  195. package/src/http-stage-client.js +190 -0
  196. package/src/independent-model.d.ts +22 -0
  197. package/src/independent-model.js +215 -0
  198. package/src/lifecycle-command.d.ts +15 -0
  199. package/src/lifecycle-command.js +190 -0
  200. package/src/local-command.d.ts +3 -0
  201. package/src/local-command.js +27 -0
  202. package/src/local-host-executor.d.ts +38 -0
  203. package/src/local-host-executor.js +196 -0
  204. package/src/open-command.d.ts +7 -0
  205. package/src/open-command.js +39 -0
  206. package/src/operations-api.d.ts +2 -0
  207. package/src/operations-api.js +6 -0
  208. package/src/personas.d.ts +2 -0
  209. package/src/personas.js +61 -0
  210. package/src/program-runner.d.ts +3 -0
  211. package/src/program-runner.js +263 -0
  212. package/src/program-sandbox.py +75 -0
  213. package/src/program-scratch.d.ts +2 -0
  214. package/src/program-scratch.js +48 -0
  215. package/src/program-worker.mjs +101 -0
  216. package/src/public-id.d.ts +2 -0
  217. package/src/public-id.js +5 -0
  218. package/src/public-report-url.d.ts +1 -0
  219. package/src/public-report-url.js +18 -0
  220. package/src/publication-check.d.ts +1 -0
  221. package/src/publication-check.js +31 -0
  222. package/src/quarantine-command.d.ts +9 -0
  223. package/src/quarantine-command.js +69 -0
  224. package/src/remote-command.d.ts +30 -0
  225. package/src/remote-command.js +156 -0
  226. package/src/replay-image.d.ts +1 -0
  227. package/src/replay-image.js +35 -0
  228. package/src/report/assets.d.ts +1 -0
  229. package/src/report/assets.js +5 -0
  230. package/src/report/browser.css +414 -0
  231. package/src/report/browser.d.ts +1 -0
  232. package/src/report/browser.js +219 -0
  233. package/src/report/data.d.ts +1 -0
  234. package/src/report/data.js +4 -0
  235. package/src/report/generate.d.ts +1 -0
  236. package/src/report/generate.js +54 -0
  237. package/src/report/load.d.ts +870 -0
  238. package/src/report/load.js +139 -0
  239. package/src/report/resource-table.d.ts +2 -0
  240. package/src/report/resource-table.js +4 -0
  241. package/src/report/status-icon.d.ts +2 -0
  242. package/src/report/status-icon.js +20 -0
  243. package/src/report/style.css +413 -0
  244. package/src/result-notifier.d.ts +121 -0
  245. package/src/result-notifier.js +230 -0
  246. package/src/result-transports.d.ts +12 -0
  247. package/src/result-transports.js +150 -0
  248. package/src/run-command.d.ts +32 -0
  249. package/src/run-command.js +493 -0
  250. package/src/run-setup-error.d.ts +11 -0
  251. package/src/run-setup-error.js +18 -0
  252. package/src/sandboxes-command.d.ts +9 -0
  253. package/src/sandboxes-command.js +29 -0
  254. package/src/screen-proxy.d.ts +5 -0
  255. package/src/screen-proxy.js +79 -0
  256. package/src/screen-url.d.ts +18 -0
  257. package/src/screen-url.js +54 -0
  258. package/src/server/app.d.ts +29 -0
  259. package/src/server/app.js +350 -0
  260. package/src/server/auth.d.ts +33 -0
  261. package/src/server/auth.js +113 -0
  262. package/src/server/credentials.d.ts +30 -0
  263. package/src/server/credentials.js +77 -0
  264. package/src/server/errors.d.ts +9 -0
  265. package/src/server/errors.js +26 -0
  266. package/src/server/index.d.ts +35 -0
  267. package/src/server/index.js +96 -0
  268. package/src/server/maintenance.d.ts +13 -0
  269. package/src/server/maintenance.js +54 -0
  270. package/src/server/repository.d.ts +534 -0
  271. package/src/server/repository.js +219 -0
  272. package/src/setup-command.d.ts +10 -0
  273. package/src/setup-command.js +52 -0
  274. package/src/stage-environment.d.ts +1 -0
  275. package/src/stage-environment.js +35 -0
  276. package/src/stage-supervisor.mjs +95 -0
  277. package/src/studio-command.d.ts +7 -0
  278. package/src/studio-command.js +47 -0
  279. package/src/studio-control.d.ts +5 -0
  280. package/src/studio-control.js +207 -0
  281. package/src/studio-review.d.ts +24 -0
  282. package/src/studio-review.js +64 -0
  283. package/src/studio-worker.d.ts +1 -0
  284. package/src/studio-worker.js +48 -0
  285. package/src/system-config.d.ts +7 -0
  286. package/src/system-config.js +70 -0
  287. package/src/terminal-reporter.d.ts +13 -0
  288. package/src/terminal-reporter.js +93 -0
  289. package/src/vendor/gmail.d.ts +45 -0
  290. package/src/vendor/gmail.js +193 -0
  291. package/src/watch-command.d.ts +16 -0
  292. package/src/watch-command.js +93 -0
  293. package/src/watch-state.d.ts +4 -0
  294. package/src/watch-state.js +53 -0
  295. package/src/worker/execution-error.d.ts +5 -0
  296. package/src/worker/execution-error.js +10 -0
  297. package/src/worker/execution.d.ts +24 -0
  298. package/src/worker/execution.js +190 -0
  299. package/src/worker/index.d.ts +8 -0
  300. package/src/worker/index.js +40 -0
  301. package/src/worker/prune.d.ts +3 -0
  302. package/src/worker/prune.js +22 -0
  303. package/src/worker/quarantine-notifications.d.ts +8 -0
  304. package/src/worker/quarantine-notifications.js +89 -0
  305. package/src/worker/queue.d.ts +65 -0
  306. package/src/worker/queue.js +438 -0
  307. package/src/worker/result-notifications.d.ts +28 -0
  308. package/src/worker/result-notifications.js +347 -0
  309. package/src/worker/store.d.ts +4 -0
  310. package/src/worker/store.js +46 -0
  311. package/src/worker/worker.d.ts +21 -0
  312. package/src/worker/worker.js +140 -0
  313. package/README.md +0 -3
@@ -0,0 +1,139 @@
1
+ import { readExecutionSnapshot } from "@open-qa/qa-engine/protocol";
2
+ import { createHash } from "node:crypto";
3
+ import { runEventSchema } from "@open-qa/qa-engine/protocol";
4
+ import { viewTimeline } from "@open-qa/qa-replay";
5
+ import {
6
+ readHealShot,
7
+ FileRunReader,
8
+ ReplayReader,
9
+ hasCode,
10
+ ArtifactReader
11
+ } from "@open-qa/qa-inspect/server";
12
+ import { assetMime, embeddedAssets } from "./assets.js";
13
+ const hash = (bytes) => createHash("sha256").update(bytes).digest("hex");
14
+ function lines(bytes) {
15
+ return bytes.toString("utf8").split("\n").filter(Boolean).map((line) => JSON.parse(line));
16
+ }
17
+ async function loadReport(root, runId) {
18
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(runId)) throw new Error("Invalid run ID");
19
+ const reader = new FileRunReader(root);
20
+ const artifacts = new ArtifactReader(root);
21
+ const file = (directory2, path, maxBytes) => artifacts.read(`${directory2}/${path}`, maxBytes);
22
+ const directory = `runs/${runId}`;
23
+ let events;
24
+ let committed = false;
25
+ let result = null;
26
+ let executionSnapshot = readExecutionSnapshot(void 0);
27
+ try {
28
+ const metadata = JSON.parse(
29
+ (await file(directory, "run.json", 1024 * 1024)).toString("utf8")
30
+ );
31
+ const run = metadata && typeof metadata === "object" && "run" in metadata ? metadata.run : void 0;
32
+ const values = run && typeof run === "object" && "metadata" in run ? run.metadata : void 0;
33
+ if (metadata && typeof metadata === "object" && "eventIndex" in metadata) {
34
+ committed = true;
35
+ }
36
+ executionSnapshot = readExecutionSnapshot(
37
+ values && typeof values === "object" && "executionSnapshot" in values ? values.executionSnapshot : void 0
38
+ );
39
+ } catch (error) {
40
+ if (!hasCode(error, "ENOENT")) throw new Error("Could not read execution snapshot");
41
+ }
42
+ if (committed) {
43
+ const stored = await reader.readRun(runId);
44
+ events = stored.projection.events;
45
+ result = stored.result;
46
+ } else {
47
+ try {
48
+ events = lines(await file(directory, "events.ndjson")).map(
49
+ (row) => runEventSchema.parse(row)
50
+ );
51
+ } catch {
52
+ throw new Error("Could not read QA run events");
53
+ }
54
+ }
55
+ let resources = {};
56
+ const replay = { manifest: null, views: [], warnings: [] };
57
+ const stage = `${directory}/stage`;
58
+ const healShots = {};
59
+ let shotBytes = 0;
60
+ for (const event of events) {
61
+ if (event.kind !== "heal_result") continue;
62
+ for (const path of [event.beforeShot, event.shot]) {
63
+ if (!path || healShots[path]) continue;
64
+ if (!/^shots\/[a-zA-Z0-9_-]+\.png$/.test(path)) continue;
65
+ try {
66
+ const bytes = await readHealShot(root, runId, path);
67
+ if (shotBytes + bytes.length > 32 * 1024 * 1024) throw new Error("Invalid screenshot");
68
+ shotBytes += bytes.length;
69
+ healShots[path] = `data:image/png;base64,${bytes.toString("base64")}`;
70
+ } catch {
71
+ replay.warnings.push("Self-heal screenshot unavailable.");
72
+ }
73
+ }
74
+ }
75
+ const replayReader = new ReplayReader(root, `runs/${runId}/stage/`);
76
+ const manifest = await replayReader.manifest();
77
+ if (!manifest) {
78
+ replay.warnings.push("No replay was recorded for this run.");
79
+ return { events, replay, resources, healShots, executionSnapshot, result };
80
+ }
81
+ replay.manifest = manifest;
82
+ replay.warnings.push(...manifest.warnings);
83
+ const assets = await replayReader.assets();
84
+ const files = /* @__PURE__ */ new Map();
85
+ for (const asset of Object.values(assets)) {
86
+ if (!assetMime.test(asset.mime)) throw new Error("Unsupported replay asset type");
87
+ const bytes = files.get(asset.hash) ?? await file(stage, `assets/${asset.hash}`);
88
+ if (bytes.length !== asset.bytes || hash(bytes) !== asset.hash)
89
+ throw new Error("Replay asset integrity check failed");
90
+ files.set(asset.hash, bytes);
91
+ }
92
+ const embedded = embeddedAssets(assets, files);
93
+ resources = embedded.resources;
94
+ let stageEvents;
95
+ try {
96
+ stageEvents = lines(await file(stage, "events.ndjson")).map((row) => runEventSchema.parse(row));
97
+ } catch {
98
+ throw new Error("Could not read replay events");
99
+ }
100
+ for (const view of manifest.views) {
101
+ try {
102
+ if (!/^views\/[^/]+\/index\.json$/.test(view.index))
103
+ throw new Error("Invalid replay index path");
104
+ const { index } = await replayReader.index(view.view);
105
+ if (index.view !== view.view) throw new Error("Replay view does not match index");
106
+ const anchor = (rows) => rows.find((event) => event.kind === "record_started" && event.view === view.view);
107
+ const runAnchor = anchor(events), stageAnchor = anchor(stageEvents);
108
+ const offset = runAnchor && stageAnchor ? runAnchor.t - stageAnchor.t : 0;
109
+ if (!runAnchor || !stageAnchor)
110
+ replay.warnings.push(`Clock anchor missing for ${view.view}; using stage time.`);
111
+ const blocks = {};
112
+ let base;
113
+ for (const block of index.blocks) {
114
+ if (!/^\d+\.ndjson\.gz$/.test(block.path)) throw new Error("Invalid replay block path");
115
+ blocks[block.path] = (await replayReader.block(view.view, block.path)).map((row) => {
116
+ if (row.event.type === 4 && row.event.data && typeof row.event.data === "object" && "href" in row.event.data && typeof row.event.data.href === "string")
117
+ base = row.event.data.href;
118
+ return { ...row, event: embedded.rewrite(row.event, base) };
119
+ });
120
+ }
121
+ replay.views.push({
122
+ index,
123
+ blocks,
124
+ offset,
125
+ viewport: view.viewport,
126
+ timeline: viewTimeline(events, view.view)
127
+ });
128
+ for (const segment of view.segments)
129
+ if (segment.missing.length)
130
+ replay.warnings.push(`${view.view}: ${segment.missing.join(", ")}`);
131
+ } catch {
132
+ replay.warnings.push(`${view.view}: Recording unavailable.`);
133
+ }
134
+ }
135
+ return { events, replay, resources, healShots, executionSnapshot, result };
136
+ }
137
+ export {
138
+ loadReport
139
+ };
@@ -0,0 +1,2 @@
1
+ export { materializeResources } from "@open-qa/qa-replay/resources";
2
+ export type { ReportAssets } from "@open-qa/qa-replay/resources";
@@ -0,0 +1,4 @@
1
+ import { materializeResources } from "@open-qa/qa-replay/resources";
2
+ export {
3
+ materializeResources
4
+ };
@@ -0,0 +1,2 @@
1
+ import { QA_STATUS } from "@open-qa/qa-inspect/vocabulary";
2
+ export declare function statusIcon(status: (typeof QA_STATUS)[keyof typeof QA_STATUS]): HTMLSpanElement;
@@ -0,0 +1,20 @@
1
+ const paths = {
2
+ clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
3
+ dot: '<circle cx="12" cy="12" r="2" fill="currentColor"/>',
4
+ check: '<path d="m5 12 4 4L19 6"/>',
5
+ "circle-x": '<circle cx="12" cy="12" r="10"/><path d="m9 9 6 6m0-6-6 6"/>',
6
+ "circle-help": '<circle cx="12" cy="12" r="10"/><path d="M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3m.1 4h.01"/>',
7
+ "circle-stop": '<circle cx="12" cy="12" r="10"/><rect x="9" y="9" width="6" height="6" rx="1"/>',
8
+ circle: '<circle cx="12" cy="12" r="10"/>',
9
+ "circle-alert": '<circle cx="12" cy="12" r="10"/><path d="M12 8v4m0 4h.01"/>'
10
+ };
11
+ function statusIcon(status) {
12
+ const icon = document.createElement("span");
13
+ icon.className = `status-icon ${status.tone}`;
14
+ icon.setAttribute("aria-hidden", "true");
15
+ icon.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${paths[status.icon]}</svg>`;
16
+ return icon;
17
+ }
18
+ export {
19
+ statusIcon
20
+ };
@@ -0,0 +1,413 @@
1
+ :root {
2
+ color-scheme: light dark;
3
+ --canvas: #f5f7fa;
4
+ --surface: #ffffff;
5
+ --surface-2: #f8fafc;
6
+ --fg: #1b2639;
7
+ --fg-2: #334155;
8
+ --fg-3: #59677c;
9
+ --border: #dce2e9;
10
+ --info: #4556db;
11
+ --selection: #eef0ff;
12
+ --danger: #b42338;
13
+ --success: #17663f;
14
+ --warning: #7a5400;
15
+ --warning-surface: #fff5da;
16
+ font-family:
17
+ ui-sans-serif,
18
+ system-ui,
19
+ -apple-system,
20
+ sans-serif;
21
+ color: var(--fg);
22
+ background: var(--canvas);
23
+ }
24
+ * {
25
+ box-sizing: border-box;
26
+ }
27
+ body {
28
+ margin: 0;
29
+ }
30
+ main {
31
+ max-width: 1560px;
32
+ margin: auto;
33
+ padding: 30px 36px;
34
+ }
35
+ header,
36
+ .section-heading,
37
+ .controls {
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: space-between;
41
+ gap: 14px;
42
+ }
43
+ header {
44
+ padding-bottom: 26px;
45
+ border-bottom: 1px solid var(--border);
46
+ }
47
+ .brand {
48
+ font-weight: 800;
49
+ letter-spacing: 0.1em;
50
+ }
51
+ .brand span,
52
+ .offline {
53
+ font-size: 12px;
54
+ color: var(--fg-3);
55
+ font-weight: 500;
56
+ }
57
+ .summary {
58
+ display: flex;
59
+ justify-content: space-between;
60
+ align-items: center;
61
+ gap: 32px;
62
+ padding: 30px 0;
63
+ }
64
+ .eyebrow {
65
+ font-size: 11px;
66
+ letter-spacing: 0.14em;
67
+ color: var(--fg-3);
68
+ }
69
+ h1 {
70
+ font-size: 34px;
71
+ margin: 4px 0;
72
+ }
73
+ h2 {
74
+ font-size: 14px;
75
+ margin: 0 0 14px;
76
+ }
77
+ p {
78
+ font-size: 13px;
79
+ line-height: 1.6;
80
+ }
81
+ #deadlock {
82
+ margin: 0;
83
+ padding-left: 18px;
84
+ font-size: 13px;
85
+ line-height: 1.6;
86
+ color: var(--danger);
87
+ }
88
+ .status-icon.danger {
89
+ color: var(--danger);
90
+ }
91
+ .status-icon.success {
92
+ color: var(--success);
93
+ }
94
+ #metrics {
95
+ display: grid;
96
+ grid-template-columns: repeat(3, minmax(110px, 1fr));
97
+ gap: 20px 32px;
98
+ }
99
+ #metrics span {
100
+ display: block;
101
+ color: var(--fg-3);
102
+ font-size: 11px;
103
+ margin-bottom: 5px;
104
+ }
105
+ #metrics strong {
106
+ font-size: 13px;
107
+ font-weight: 600;
108
+ }
109
+ #warnings {
110
+ padding: 12px 16px;
111
+ margin-bottom: 20px;
112
+ background: var(--warning-surface);
113
+ color: var(--warning);
114
+ font-size: 12px;
115
+ border-radius: 8px;
116
+ }
117
+ .workspace {
118
+ display: grid;
119
+ grid-template-columns: minmax(0, 2.4fr) minmax(280px, 1fr);
120
+ gap: 20px;
121
+ }
122
+ .playback,
123
+ aside,
124
+ .panels section {
125
+ background: var(--surface);
126
+ border: 1px solid var(--border);
127
+ border-radius: 10px;
128
+ padding: 18px;
129
+ min-width: 0;
130
+ }
131
+ #screen {
132
+ background: var(--surface-2);
133
+ position: relative;
134
+ overflow: hidden;
135
+ min-height: 160px;
136
+ border: 1px solid var(--border);
137
+ border-radius: 6px;
138
+ color: var(--fg-3);
139
+ }
140
+ .replayer-wrapper {
141
+ position: relative;
142
+ }
143
+ iframe {
144
+ border: 0;
145
+ }
146
+ .controls {
147
+ padding: 16px 0 22px;
148
+ font-size: 12px;
149
+ }
150
+ #scrubber {
151
+ flex: 1;
152
+ accent-color: var(--info);
153
+ min-width: 40px;
154
+ }
155
+ #time {
156
+ white-space: nowrap;
157
+ font-variant-numeric: tabular-nums;
158
+ }
159
+ button,
160
+ select {
161
+ font: inherit;
162
+ cursor: pointer;
163
+ border: 1px solid var(--border);
164
+ border-radius: 5px;
165
+ padding: 7px 10px;
166
+ color: var(--fg-2);
167
+ background: var(--surface);
168
+ }
169
+ button:hover {
170
+ background: var(--selection);
171
+ border-color: var(--info);
172
+ }
173
+ button:focus-visible,
174
+ select:focus-visible,
175
+ input:focus-visible {
176
+ outline: 2px solid var(--info);
177
+ outline-offset: 2px;
178
+ }
179
+ #play {
180
+ background: var(--info);
181
+ color: white;
182
+ min-width: 64px;
183
+ }
184
+ #timeline {
185
+ max-height: 150px;
186
+ overflow: auto;
187
+ display: flex;
188
+ flex-wrap: wrap;
189
+ gap: 6px;
190
+ }
191
+ #timeline .event {
192
+ width: auto;
193
+ max-width: 300px;
194
+ font-size: 11px;
195
+ overflow: hidden;
196
+ text-overflow: ellipsis;
197
+ white-space: nowrap;
198
+ }
199
+ .step {
200
+ border-left: 3px solid var(--border);
201
+ background: var(--surface-2);
202
+ padding: 12px;
203
+ margin-bottom: 12px;
204
+ color: var(--fg-2);
205
+ }
206
+ .step.current {
207
+ box-shadow: 0 0 0 2px var(--info);
208
+ }
209
+ summary {
210
+ cursor: pointer;
211
+ }
212
+ .step p {
213
+ margin: 8px 0;
214
+ }
215
+ pre {
216
+ white-space: pre-wrap;
217
+ overflow-wrap: anywhere;
218
+ font-size: 11px;
219
+ line-height: 1.6;
220
+ max-height: 240px;
221
+ overflow: auto;
222
+ }
223
+ .panels {
224
+ display: grid;
225
+ grid-template-columns: 1.2fr 1fr 1fr;
226
+ gap: 20px;
227
+ margin-top: 20px;
228
+ }
229
+ .event-panel {
230
+ height: 240px;
231
+ overflow: auto;
232
+ }
233
+ .event {
234
+ display: block;
235
+ width: 100%;
236
+ text-align: left;
237
+ white-space: pre-wrap;
238
+ overflow-wrap: anywhere;
239
+ font-size: 11px;
240
+ line-height: 1.6;
241
+ margin-bottom: 6px;
242
+ }
243
+ .event.current {
244
+ border-color: var(--info);
245
+ background: var(--selection);
246
+ }
247
+ .future {
248
+ opacity: 0.55;
249
+ }
250
+ .empty,
251
+ footer {
252
+ color: var(--fg-3);
253
+ font-size: 11px;
254
+ }
255
+ footer {
256
+ padding: 20px 0;
257
+ }
258
+ [hidden] {
259
+ display: none !important;
260
+ }
261
+ @media (max-width: 950px) {
262
+ main {
263
+ padding: 18px;
264
+ }
265
+ .workspace,
266
+ .panels {
267
+ grid-template-columns: 1fr;
268
+ }
269
+ .summary {
270
+ align-items: start;
271
+ flex-direction: column;
272
+ }
273
+ .controls {
274
+ flex-wrap: wrap;
275
+ }
276
+ }
277
+
278
+ .step button {
279
+ min-height: 44px;
280
+ }
281
+ #warnings {
282
+ white-space: pre-line;
283
+ }
284
+
285
+ .status-icon {
286
+ color: var(--fg-3);
287
+ display: inline-flex;
288
+ vertical-align: middle;
289
+ }
290
+ .status-icon svg {
291
+ width: 18px;
292
+ height: 18px;
293
+ }
294
+ h1 .status-icon svg {
295
+ width: 28px;
296
+ height: 28px;
297
+ }
298
+ .status-icon.info {
299
+ color: var(--info);
300
+ }
301
+ button,
302
+ select {
303
+ min-height: 44px;
304
+ }
305
+ button:disabled {
306
+ cursor: default;
307
+ opacity: 0.6;
308
+ }
309
+ .step > div > button {
310
+ width: 100%;
311
+ text-align: left;
312
+ border: 0;
313
+ background: transparent;
314
+ font-weight: 600;
315
+ }
316
+ .step > button {
317
+ margin-right: 4px;
318
+ }
319
+ #metrics strong {
320
+ overflow-wrap: anywhere;
321
+ }
322
+ @media (max-width: 450px) {
323
+ #metrics {
324
+ grid-template-columns: repeat(2, minmax(0, 1fr));
325
+ gap: 16px;
326
+ width: 100%;
327
+ }
328
+ .brand {
329
+ letter-spacing: normal;
330
+ }
331
+ header {
332
+ gap: 8px;
333
+ }
334
+ }
335
+ @media (prefers-color-scheme: dark) {
336
+ :root {
337
+ --canvas: #101318;
338
+ --surface: #171b22;
339
+ --surface-2: #1e242d;
340
+ --fg: #edf0f5;
341
+ --fg-2: #ced4de;
342
+ --fg-3: #a6b0c0;
343
+ --border: #394353;
344
+ --info: #a6b0ff;
345
+ --selection: #272e49;
346
+ --danger: #ff9cac;
347
+ --success: #5fb98a;
348
+ --warning: #f2cb75;
349
+ --warning-surface: #342a15;
350
+ }
351
+ #play {
352
+ background: #4556db;
353
+ color: #fff;
354
+ }
355
+ }
356
+
357
+ .actor-row {
358
+ min-width: 0;
359
+ }
360
+ #screen {
361
+ display: grid;
362
+ grid-template-columns: repeat(2, minmax(0, 1fr));
363
+ gap: 16px;
364
+ }
365
+ .actor-row-wide,
366
+ #screen > :only-child {
367
+ grid-column: 1 / -1;
368
+ }
369
+ .view-grid {
370
+ display: grid;
371
+ grid-template-columns: repeat(2, minmax(0, 1fr));
372
+ gap: 16px;
373
+ }
374
+ .view-cell {
375
+ min-width: 0;
376
+ overflow: hidden;
377
+ }
378
+ .view-grid:has(> :only-child) {
379
+ grid-template-columns: minmax(0, 1fr);
380
+ }
381
+ .view-surface {
382
+ min-width: 0;
383
+ overflow: hidden;
384
+ }
385
+ @media (max-width: 767px) {
386
+ #screen,
387
+ .view-grid {
388
+ grid-template-columns: minmax(0, 1fr);
389
+ }
390
+ #focus-view {
391
+ display: none;
392
+ }
393
+ }
394
+
395
+ .reviewer {
396
+ margin: 20px 0;
397
+ padding: 20px;
398
+ border: 1px solid var(--border, #ddd);
399
+ border-radius: 12px;
400
+ overflow-wrap: anywhere;
401
+ }
402
+ .reviewer article {
403
+ border-top: 1px solid var(--border, #ddd);
404
+ padding: 8px 0;
405
+ }
406
+ .reviewer pre {
407
+ max-height: 320px;
408
+ overflow: auto;
409
+ white-space: pre-wrap;
410
+ }
411
+ .reviewer button {
412
+ margin: 4px;
413
+ }
@@ -0,0 +1,121 @@
1
+ import { z } from "zod";
2
+ import type { BatchSummary, Notifier } from "@open-qa/qa-engine";
3
+ export declare const resultContextSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ source: z.ZodLiteral<"staging">;
5
+ target: z.ZodLiteral<"staging">;
6
+ checkContext: z.ZodOptional<z.ZodString>;
7
+ repository: z.ZodString;
8
+ commit: z.ZodString;
9
+ }, z.core.$strict>, z.ZodObject<{
10
+ source: z.ZodLiteral<"pr-label">;
11
+ pullRequest: z.ZodNumber;
12
+ checkContext: z.ZodOptional<z.ZodString>;
13
+ repository: z.ZodString;
14
+ commit: z.ZodString;
15
+ target: z.ZodString;
16
+ }, z.core.$strict>, z.ZodObject<{
17
+ source: z.ZodLiteral<"new-flow">;
18
+ pullRequest: z.ZodNumber;
19
+ checkContext: z.ZodOptional<z.ZodString>;
20
+ repository: z.ZodString;
21
+ commit: z.ZodString;
22
+ target: z.ZodString;
23
+ }, z.core.$strict>, z.ZodObject<{
24
+ source: z.ZodLiteral<"nightly">;
25
+ checkContext: z.ZodOptional<z.ZodString>;
26
+ repository: z.ZodString;
27
+ commit: z.ZodString;
28
+ target: z.ZodString;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ source: z.ZodLiteral<"remote">;
31
+ checkContext: z.ZodOptional<z.ZodString>;
32
+ repository: z.ZodString;
33
+ commit: z.ZodString;
34
+ target: z.ZodString;
35
+ }, z.core.$strict>], "source">;
36
+ export type ResultContext = z.infer<typeof resultContextSchema>;
37
+ export type ResultChannel = "commit" | "pr" | "discord";
38
+ export type QaComment = {
39
+ id: number;
40
+ body: string;
41
+ appId: number | null;
42
+ };
43
+ type Pr = {
44
+ repository: string;
45
+ pullRequest: number;
46
+ };
47
+ export interface ResultTransports {
48
+ github: {
49
+ appId: number;
50
+ status(input: {
51
+ repository: string;
52
+ sha: string;
53
+ context: string;
54
+ state: "success" | "failure" | "error";
55
+ description: string;
56
+ targetUrl?: string;
57
+ }, signal: AbortSignal): Promise<void>;
58
+ comments(input: Pr & {
59
+ page: number;
60
+ }, signal: AbortSignal): Promise<{
61
+ comments: QaComment[];
62
+ nextPage?: number;
63
+ }>;
64
+ createComment(input: Pr & {
65
+ body: string;
66
+ }, signal: AbortSignal): Promise<void>;
67
+ updateComment(input: Pr & {
68
+ id: number;
69
+ body: string;
70
+ }, signal: AbortSignal): Promise<void>;
71
+ };
72
+ discord: {
73
+ send(input: {
74
+ content: string;
75
+ allowedMentions: {
76
+ parse: [];
77
+ };
78
+ }, signal: AbortSignal): Promise<void>;
79
+ };
80
+ }
81
+ export interface ResultPresentation {
82
+ publicOrigins?: readonly string[];
83
+ details?: Readonly<Record<string, {
84
+ flow: string;
85
+ replayUrl?: string;
86
+ }>>;
87
+ }
88
+ export declare function resultChannels(context: ResultContext): ResultChannel[];
89
+ export declare function resultMarker(projectId: string, source: "pr-label" | "new-flow", flow?: string): string;
90
+ declare abstract class ResultAdapter implements Notifier {
91
+ notify(summary: BatchSummary): Promise<void>;
92
+ protected abstract deliver(summary: BatchSummary, signal: AbortSignal): Promise<void>;
93
+ }
94
+ export declare class GitHubCommitStatusNotifier extends ResultAdapter {
95
+ private readonly context;
96
+ private readonly transport;
97
+ private readonly options;
98
+ constructor(context: ResultContext, transport: ResultTransports["github"], options?: ResultPresentation);
99
+ protected deliver(summary: BatchSummary, signal: AbortSignal): Promise<void>;
100
+ }
101
+ export declare class GitHubPrCommentNotifier extends ResultAdapter {
102
+ private readonly projectId;
103
+ private readonly context;
104
+ private readonly transport;
105
+ private readonly options;
106
+ constructor(projectId: string, context: Extract<ResultContext, {
107
+ pullRequest: number;
108
+ }>, transport: ResultTransports["github"], options?: ResultPresentation);
109
+ notify(summary: BatchSummary): Promise<void>;
110
+ protected deliver(summary: BatchSummary, signal: AbortSignal): Promise<void>;
111
+ private upsert;
112
+ }
113
+ export declare class DiscordResultNotifier extends ResultAdapter {
114
+ private readonly context;
115
+ private readonly transport;
116
+ private readonly options;
117
+ constructor(context: ResultContext, transport: ResultTransports["discord"], options?: ResultPresentation);
118
+ protected deliver(summary: BatchSummary, signal: AbortSignal): Promise<void>;
119
+ }
120
+ export declare function resultNotifiers(projectId: string, context: ResultContext, transports: ResultTransports, options?: ResultPresentation): Partial<Record<ResultChannel, Notifier>>;
121
+ export {};