@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,125 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1792955672127,
9
+ "tag": "0000_qa_core",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1792955700709,
16
+ "tag": "0001_run_health",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1792959916943,
23
+ "tag": "0002_bounded_cleanup",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1792972567937,
30
+ "tag": "0003_step_replay_cache",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1792979278437,
37
+ "tag": "0004_credential_expiry",
38
+ "breakpoints": true
39
+ },
40
+ {
41
+ "idx": 5,
42
+ "version": "7",
43
+ "when": 1792980722707,
44
+ "tag": "0005_server_api",
45
+ "breakpoints": true
46
+ },
47
+ {
48
+ "idx": 6,
49
+ "version": "7",
50
+ "when": 1792980740512,
51
+ "tag": "0006_submission_created",
52
+ "breakpoints": true
53
+ },
54
+ {
55
+ "idx": 7,
56
+ "version": "7",
57
+ "when": 1792987854395,
58
+ "tag": "0007_findings",
59
+ "breakpoints": true
60
+ },
61
+ {
62
+ "idx": 8,
63
+ "version": "7",
64
+ "when": 1793003254588,
65
+ "tag": "0008_classification_labels",
66
+ "breakpoints": true
67
+ },
68
+ {
69
+ "idx": 9,
70
+ "version": "7",
71
+ "when": 1793015746027,
72
+ "tag": "0009_job_queue",
73
+ "breakpoints": true
74
+ },
75
+ {
76
+ "idx": 10,
77
+ "version": "7",
78
+ "when": 1793024449926,
79
+ "tag": "0010_result_notifications",
80
+ "breakpoints": true
81
+ },
82
+ {
83
+ "idx": 11,
84
+ "version": "7",
85
+ "when": 1793027701833,
86
+ "tag": "0011_result_notification_retries",
87
+ "breakpoints": true
88
+ },
89
+ {
90
+ "idx": 12,
91
+ "version": "7",
92
+ "when": 1793032157278,
93
+ "tag": "0012_result_notification_flows",
94
+ "breakpoints": true
95
+ },
96
+ {
97
+ "idx": 13,
98
+ "version": "7",
99
+ "when": 1793034829772,
100
+ "tag": "0013_flow_quarantine",
101
+ "breakpoints": true
102
+ },
103
+ {
104
+ "idx": 14,
105
+ "version": "7",
106
+ "when": 1793039096648,
107
+ "tag": "0014_run_budgets",
108
+ "breakpoints": true
109
+ },
110
+ {
111
+ "idx": 15,
112
+ "version": "7",
113
+ "when": 1794042301843,
114
+ "tag": "0015_flow_lifecycle",
115
+ "breakpoints": true
116
+ },
117
+ {
118
+ "idx": 16,
119
+ "version": "7",
120
+ "when": 1795793990890,
121
+ "tag": "0016_open_qa_classification",
122
+ "breakpoints": true
123
+ }
124
+ ]
125
+ }
package/package.json CHANGED
@@ -1,6 +1,120 @@
1
1
  {
2
2
  "name": "@open-qa/qa",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-alpha.4",
4
+ "type": "module",
5
+ "private": false,
6
+ "license": "Apache-2.0",
7
+ "engines": {
8
+ "node": ">=22.23.4 <23"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "scripts",
13
+ "drizzle",
14
+ "problem-matcher.json",
15
+ "runtime",
16
+ "studio-manifest.json",
17
+ "THIRD_PARTY_NOTICES.md",
18
+ "LICENSE",
19
+ "NOTICE",
20
+ "THIRD_PARTY.md"
21
+ ],
22
+ "exports": {
23
+ "./postgres": {
24
+ "types": "./src/db/index.d.ts",
25
+ "import": "./src/db/index.js",
26
+ "default": "./src/db/index.js"
27
+ },
28
+ "./credentials": {
29
+ "types": "./src/adapters/secret-manager-credential-resolver.d.ts",
30
+ "import": "./src/adapters/secret-manager-credential-resolver.js",
31
+ "default": "./src/adapters/secret-manager-credential-resolver.js"
32
+ },
33
+ "./hooks": {
34
+ "types": "./src/hooks/api.d.ts",
35
+ "import": "./src/hooks/api.js",
36
+ "default": "./src/hooks/api.js"
37
+ },
38
+ "./server": {
39
+ "types": "./src/server/index.d.ts",
40
+ "import": "./src/server/index.js",
41
+ "default": "./src/server/index.js"
42
+ },
43
+ "./gcs": {
44
+ "types": "./src/adapters/gcs/index.d.ts",
45
+ "import": "./src/adapters/gcs/index.js",
46
+ "default": "./src/adapters/gcs/index.js"
47
+ },
48
+ "./worker": {
49
+ "types": "./src/worker/index.d.ts",
50
+ "import": "./src/worker/index.js",
51
+ "default": "./src/worker/index.js"
52
+ },
53
+ "./draft": {
54
+ "types": "./src/draft-api.d.ts",
55
+ "import": "./src/draft-api.js",
56
+ "default": "./src/draft-api.js"
57
+ },
58
+ "./leases": {
59
+ "types": "./src/adapters/fixed-lease-pool.d.ts",
60
+ "import": "./src/adapters/fixed-lease-pool.js",
61
+ "default": "./src/adapters/fixed-lease-pool.js"
62
+ },
63
+ "./operations": {
64
+ "types": "./src/operations-api.d.ts",
65
+ "import": "./src/operations-api.js",
66
+ "default": "./src/operations-api.js"
67
+ },
68
+ "./publication-check": {
69
+ "types": "./src/publication-check.d.ts",
70
+ "import": "./src/publication-check.js",
71
+ "default": "./src/publication-check.js"
72
+ },
73
+ "./flows": {
74
+ "types": "./src/flows-api.d.ts",
75
+ "import": "./src/flows-api.js",
76
+ "default": "./src/flows-api.js"
77
+ }
78
+ },
79
+ "bin": {
80
+ "open-qa": "./src/cli.js"
81
+ },
82
+ "dependencies": {
83
+ "@open-qa/qa-agents": "0.1.0-alpha.4",
84
+ "@open-qa/qa-engine": "0.1.0-alpha.4",
85
+ "@open-qa/qa-inspect": "0.1.0-alpha.4",
86
+ "@open-qa/qa-replay": "0.1.0-alpha.4",
87
+ "@open-qa/qa-stage": "0.1.0-alpha.4",
88
+ "@open-qa/qa-studio": "0.1.0-alpha.4",
89
+ "@libsql/client": "^0.15.0",
90
+ "commander": "^15.0.0",
91
+ "drizzle-orm": "^0.45.2",
92
+ "esbuild": "0.28.2",
93
+ "pg": "^8.23.1",
94
+ "tsx": "^4.21.0",
95
+ "typescript": "^6.0.3",
96
+ "yaml": "^2.9.0",
97
+ "zod": "^4.4.2",
98
+ "hono": "^4.13.13",
99
+ "@hono/node-server": "^1.19.15",
100
+ "jose": "^6.2.12",
101
+ "e2b": "^2.58.0",
102
+ "@google-cloud/storage": "^8.4.0",
103
+ "@types/pg": "^8.23.1"
104
+ },
105
+ "os": [
106
+ "linux"
107
+ ],
108
+ "cpu": [
109
+ "x64"
110
+ ],
111
+ "repository": {
112
+ "type": "git",
113
+ "url": "git+https://github.com/Corvo-hq/open-qa.git"
114
+ },
115
+ "publishConfig": {
116
+ "access": "public",
117
+ "registry": "https://registry.npmjs.org/",
118
+ "provenance": true
119
+ }
120
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "problemMatcher": [
3
+ {
4
+ "owner": "open-qa-error",
5
+ "severity": "error",
6
+ "pattern": [
7
+ {
8
+ "regexp": "^(.+):([0-9]+):([0-9]+) (schema|compile) (.+)$",
9
+ "file": 1,
10
+ "line": 2,
11
+ "column": 3,
12
+ "code": 4,
13
+ "message": 5
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "owner": "open-qa-warning",
19
+ "severity": "warning",
20
+ "pattern": [
21
+ {
22
+ "regexp": "^(.+):([0-9]+):([0-9]+) (story-length|step-intent|prefer-expect|require-expect|smoke-budget) (.+)$",
23
+ "file": 1,
24
+ "line": 2,
25
+ "column": 3,
26
+ "code": 4,
27
+ "message": 5
28
+ }
29
+ ]
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,25 @@
1
+ import type { PoolClient } from "pg";
2
+ import type { Lease, LeasePool, LeaseSpec } from "@open-qa/qa-engine";
3
+ import { type JsonObject } from "@open-qa/qa-engine/protocol";
4
+ import { QaDatabase } from "../db/database.js";
5
+ import { type LeaseFence } from "../db/fencing.js";
6
+ export interface DbLease extends Lease, LeaseFence {
7
+ expiresAt: number;
8
+ }
9
+ export type ResourceResolver = (secretRef: string, signal?: AbortSignal) => Promise<JsonObject>;
10
+ export declare class DbLeasePool implements LeasePool {
11
+ private readonly db;
12
+ private readonly project;
13
+ private readonly owner;
14
+ private readonly resolveResource;
15
+ private readonly authorize?;
16
+ private readonly emptyLeases;
17
+ constructor(db: QaDatabase, project: string, owner: string, resolveResource: ResourceResolver, authorize?: ((client: PoolClient) => Promise<unknown>) | undefined);
18
+ acquire(input: LeaseSpec, signal?: AbortSignal): Promise<DbLease>;
19
+ renew(lease: Lease, ttlMs: number): Promise<DbLease>;
20
+ release(lease: Lease): Promise<void>;
21
+ quarantineExpired(): Promise<number>;
22
+ quarantinedCount(): Promise<number>;
23
+ recover(id: string, stopAndRevoke: () => Promise<void>): Promise<void>;
24
+ private owned;
25
+ }
@@ -0,0 +1,293 @@
1
+ import { StaleLeaseError } from "@open-qa/qa-engine";
2
+ import { randomUUID } from "node:crypto";
3
+ import { setTimeout as delay } from "node:timers/promises";
4
+ import { z } from "zod";
5
+ import { jsonObjectSchema } from "@open-qa/qa-engine/protocol";
6
+ import { publicId, assertPostgresText } from "../db/database.js";
7
+ import { assertFence } from "../db/fencing.js";
8
+ import { lockResources } from "../db/resources.js";
9
+ const duration = z.number().int().positive().max(2147483647);
10
+ const specSchema = z.object({
11
+ runId: publicId,
12
+ actor: z.string().min(1),
13
+ resources: z.array(publicId).max(100),
14
+ requests: z.array(
15
+ z.object({
16
+ actor: z.string().min(1),
17
+ kind: publicId,
18
+ count: z.number().int().positive().max(100).default(1)
19
+ })
20
+ ).max(100).default([]),
21
+ ttlMs: duration.default(36e5),
22
+ timeoutMs: z.number().int().nonnegative().max(2147483647).optional()
23
+ });
24
+ function fence(lease) {
25
+ const parsed = z.object({
26
+ id: z.uuid(),
27
+ owner: z.string().min(1),
28
+ epoch: z.string().regex(/^[1-9][0-9]*$/),
29
+ runId: publicId
30
+ }).safeParse(lease);
31
+ if (!parsed.success) throw new StaleLeaseError();
32
+ return parsed.data;
33
+ }
34
+ class DbLeasePool {
35
+ constructor(db, project, owner, resolveResource, authorize) {
36
+ this.db = db;
37
+ this.project = project;
38
+ this.owner = owner;
39
+ this.resolveResource = resolveResource;
40
+ this.authorize = authorize;
41
+ publicId.parse(project);
42
+ z.string().min(1).parse(owner);
43
+ assertPostgresText(owner);
44
+ }
45
+ db;
46
+ project;
47
+ owner;
48
+ resolveResource;
49
+ authorize;
50
+ emptyLeases = /* @__PURE__ */ new WeakSet();
51
+ async acquire(input, signal) {
52
+ signal?.throwIfAborted();
53
+ const spec = specSchema.parse(input);
54
+ assertPostgresText(spec);
55
+ if (!spec.resources.length && !spec.requests.length) {
56
+ const lease = {
57
+ id: randomUUID(),
58
+ runId: spec.runId,
59
+ actor: spec.actor,
60
+ owner: this.owner,
61
+ epoch: "0",
62
+ expiresAt: Date.now() + spec.ttlMs,
63
+ resources: {},
64
+ allocations: []
65
+ };
66
+ this.emptyLeases.add(lease);
67
+ return lease;
68
+ }
69
+ const deadline = performance.now() + (spec.timeoutMs ?? (spec.requests.length ? 6e5 : 0));
70
+ let backoff = 25;
71
+ for (; ; ) {
72
+ signal?.throwIfAborted();
73
+ const result = await this.db.transaction(async (client) => {
74
+ await this.authorize?.(client);
75
+ if (!await lockResources(client, this.project)) return void 0;
76
+ const { rows: resources } = await client.query(
77
+ `SELECT id,kind,canonical_id AS "canonicalId",secret_ref AS "secretRef" FROM qa.lease_resources WHERE project_id=$1 ORDER BY id`,
78
+ [this.project]
79
+ );
80
+ const { rows: claims } = await client.query(
81
+ "SELECT identity FROM qa.lease_claims WHERE project_id=$1",
82
+ [this.project]
83
+ );
84
+ const held = new Set(claims.map((c) => c.identity));
85
+ const slots = [];
86
+ for (const name of new Set(spec.resources)) {
87
+ const resource = resources.find((r) => r.id === name);
88
+ if (!resource) throw new Error("Requested QA resource is not configured");
89
+ slots.push({ actor: spec.actor, candidates: [resource] });
90
+ }
91
+ for (const request of spec.requests) {
92
+ const candidates = resources.filter((r) => r.kind === request.kind);
93
+ if (new Set(candidates.map((c) => c.canonicalId)).size < request.count)
94
+ throw new Error("Insufficient QA pool capacity");
95
+ for (let i = 0; i < request.count; i++)
96
+ slots.push({ actor: request.actor, kind: request.kind, candidates });
97
+ }
98
+ if (slots.length > 100) throw new Error("Too many QA resource requests");
99
+ slots.sort((a, b) => a.candidates.length - b.candidates.length);
100
+ const matches = /* @__PURE__ */ new Map();
101
+ const choose = (index, visited) => {
102
+ signal?.throwIfAborted();
103
+ for (const r of slots[index].candidates) {
104
+ if (held.has(`name:${r.id}`) || held.has(`canonical:${r.canonicalId}`) || visited.has(r.canonicalId))
105
+ continue;
106
+ visited.add(r.canonicalId);
107
+ const previous = matches.get(r.canonicalId);
108
+ if (!previous || choose(previous.index, visited)) {
109
+ matches.set(r.canonicalId, { index, resource: r });
110
+ return true;
111
+ }
112
+ }
113
+ return false;
114
+ };
115
+ for (let i = 0; i < slots.length; i++) if (!choose(i, /* @__PURE__ */ new Set())) return void 0;
116
+ const selected = [...matches.values()].sort((a, b) => a.index - b.index).map(({ index, resource }) => ({
117
+ assignment: {
118
+ resource: resource.id,
119
+ actor: slots[index].actor,
120
+ ...slots[index].kind ? { kind: slots[index].kind } : {}
121
+ },
122
+ resource
123
+ }));
124
+ signal?.throwIfAborted();
125
+ const id = randomUUID();
126
+ const { rows } = await client.query(
127
+ `INSERT INTO qa.leases(project_id,id,run_id,actor,owner,expires_at,allocations)
128
+ VALUES($1,$2,$3,$4,$5,clock_timestamp()+$6 * interval '1 millisecond',$7) RETURNING *`,
129
+ [
130
+ this.project,
131
+ id,
132
+ spec.runId,
133
+ spec.actor,
134
+ this.owner,
135
+ spec.ttlMs,
136
+ JSON.stringify(selected.map((s) => s.assignment))
137
+ ]
138
+ );
139
+ for (const s of selected)
140
+ for (const key of [`name:${s.resource.id}`, `canonical:${s.resource.canonicalId}`])
141
+ await client.query(
142
+ "INSERT INTO qa.lease_claims(project_id,identity,lease_id) VALUES($1,$2,$3)",
143
+ [this.project, key, id]
144
+ );
145
+ signal?.throwIfAborted();
146
+ return { row: rows[0], selected };
147
+ });
148
+ if (result) {
149
+ const { row, selected } = result;
150
+ const token = {
151
+ id: row.id,
152
+ runId: row.run_id,
153
+ actor: row.actor,
154
+ owner: row.owner,
155
+ epoch: row.epoch,
156
+ expiresAt: row.expires_at.getTime()
157
+ };
158
+ try {
159
+ const resolved = await Promise.all(
160
+ selected.map(async (s) => {
161
+ const value = jsonObjectSchema.safeParse(
162
+ await this.resolveResource(s.resource.secretRef, signal)
163
+ );
164
+ if (!value.success) throw new Error("Invalid resolved QA resource");
165
+ return { ...s.assignment, value: value.data };
166
+ })
167
+ );
168
+ signal?.throwIfAborted();
169
+ await this.db.transaction(async (client) => {
170
+ await this.authorize?.(client);
171
+ await assertFence(client, this.project, token);
172
+ });
173
+ return {
174
+ ...token,
175
+ resources: Object.fromEntries(
176
+ resolved.filter((s) => !s.kind).map((s) => [s.resource, s.value])
177
+ ),
178
+ allocations: resolved.filter((s) => !!s.kind)
179
+ };
180
+ } catch {
181
+ await this.db.transaction(async (client) => {
182
+ const released = await client.query(
183
+ `UPDATE qa.leases SET state='released' WHERE project_id=$1 AND id=$2 AND epoch=$3
184
+ AND state='active' AND expires_at > clock_timestamp() RETURNING id`,
185
+ [this.project, token.id, token.epoch]
186
+ );
187
+ if (released.rowCount)
188
+ await client.query(
189
+ "DELETE FROM qa.lease_claims WHERE project_id=$1 AND lease_id=$2",
190
+ [this.project, token.id]
191
+ );
192
+ });
193
+ throw new Error("QA resource resolution failed or lease expired before delivery");
194
+ }
195
+ }
196
+ if (performance.now() >= deadline)
197
+ throw new Error("lease-timeout: QA resources are leased or quarantined");
198
+ await delay(Math.min(backoff, Math.max(1, deadline - performance.now())), void 0, {
199
+ signal
200
+ });
201
+ backoff = Math.min(backoff * 2, 500);
202
+ }
203
+ }
204
+ async renew(lease, ttlMs) {
205
+ duration.parse(ttlMs);
206
+ if (this.emptyLeases.has(lease)) {
207
+ const renewed = { ...lease, expiresAt: Date.now() + ttlMs };
208
+ this.emptyLeases.add(renewed);
209
+ return renewed;
210
+ }
211
+ const token = this.owned(lease);
212
+ const expiresAt = await this.db.transaction(async (client) => {
213
+ await this.authorize?.(client);
214
+ await assertFence(client, this.project, token);
215
+ const { rows } = await client.query(
216
+ `UPDATE qa.leases SET expires_at=clock_timestamp()+$3 * interval '1 millisecond'
217
+ WHERE project_id=$1 AND id=$2 RETURNING expires_at`,
218
+ [this.project, token.id, ttlMs]
219
+ );
220
+ return rows[0].expires_at.getTime();
221
+ });
222
+ return { ...lease, ...token, expiresAt };
223
+ }
224
+ async release(lease) {
225
+ if (this.emptyLeases.has(lease)) return;
226
+ const token = this.owned(lease);
227
+ await this.db.transaction(async (client) => {
228
+ await this.authorize?.(client);
229
+ const { rows } = await client.query(
230
+ "SELECT * FROM qa.leases WHERE project_id=$1 AND id=$2 FOR UPDATE",
231
+ [this.project, token.id]
232
+ );
233
+ const row = rows[0];
234
+ if (row?.state === "released" && row.owner === token.owner && row.epoch === token.epoch && row.run_id === token.runId)
235
+ return;
236
+ await assertFence(client, this.project, token);
237
+ await client.query("UPDATE qa.leases SET state='released' WHERE project_id=$1 AND id=$2", [
238
+ this.project,
239
+ token.id
240
+ ]);
241
+ await client.query("DELETE FROM qa.lease_claims WHERE project_id=$1 AND lease_id=$2", [
242
+ this.project,
243
+ token.id
244
+ ]);
245
+ });
246
+ }
247
+ async quarantineExpired() {
248
+ const result = await this.db.pool.query(
249
+ `UPDATE qa.leases SET state='quarantined', epoch=nextval('qa.leases_epoch_seq')
250
+ WHERE project_id=$1 AND state='active' AND expires_at <= clock_timestamp()`,
251
+ [this.project]
252
+ );
253
+ return result.rowCount ?? 0;
254
+ }
255
+ async quarantinedCount() {
256
+ const { rows } = await this.db.pool.query(
257
+ "SELECT count(*)::int AS count FROM qa.leases WHERE project_id=$1 AND state='quarantined'",
258
+ [this.project]
259
+ );
260
+ return rows[0].count;
261
+ }
262
+ async recover(id, stopAndRevoke) {
263
+ const token = await this.db.transaction(async (client) => {
264
+ const { rows } = await client.query(
265
+ `UPDATE qa.leases SET epoch=nextval('qa.leases_epoch_seq')
266
+ WHERE project_id=$1 AND id=$2 AND state='quarantined' RETURNING epoch`,
267
+ [this.project, id]
268
+ );
269
+ if (!rows[0]) throw new Error("Lease must be quarantined before recovery");
270
+ return rows[0].epoch;
271
+ });
272
+ await stopAndRevoke();
273
+ await this.db.transaction(async (client) => {
274
+ const result = await client.query(
275
+ `UPDATE qa.leases SET state='released' WHERE project_id=$1 AND id=$2 AND epoch=$3 AND state='quarantined' RETURNING id`,
276
+ [this.project, id, token]
277
+ );
278
+ if (!result.rowCount) throw new Error("Stale lease recovery token");
279
+ await client.query("DELETE FROM qa.lease_claims WHERE project_id=$1 AND lease_id=$2", [
280
+ this.project,
281
+ id
282
+ ]);
283
+ });
284
+ }
285
+ owned(lease) {
286
+ const token = fence(lease);
287
+ if (token.owner !== this.owner) throw new StaleLeaseError();
288
+ return token;
289
+ }
290
+ }
291
+ export {
292
+ DbLeasePool
293
+ };
@@ -0,0 +1,9 @@
1
+ import { type Artifact } from "@open-qa/qa-engine/protocol";
2
+ import type { ArtifactStore } from "@open-qa/qa-engine";
3
+ export declare class DirArtifactStore implements ArtifactStore {
4
+ private readonly qaRoot;
5
+ constructor(qaRoot?: string);
6
+ put(runId: string, artifact: Artifact, data: Uint8Array): Promise<void>;
7
+ signedUrl(runId: string, path: string, _expiresInMs: number): Promise<string>;
8
+ private path;
9
+ }
@@ -0,0 +1,64 @@
1
+ import { join, resolve } from "node:path";
2
+ import { pathToFileURL } from "node:url";
3
+ import { createHash } from "node:crypto";
4
+ import { open } from "node:fs/promises";
5
+ import { artifactSchema } from "@open-qa/qa-engine/protocol";
6
+ import {
7
+ assertRegularFile,
8
+ atomicWrite,
9
+ ensureDirectory,
10
+ noFollowRead,
11
+ runDirectory
12
+ } from "./local-files.js";
13
+ import { FileRunStore } from "./file-run-store.js";
14
+ import { artifactScanSchema } from "../artifact-scan.js";
15
+ class DirArtifactStore {
16
+ qaRoot;
17
+ constructor(qaRoot = ".qa") {
18
+ this.qaRoot = resolve(qaRoot);
19
+ }
20
+ async put(runId, artifact, data) {
21
+ artifactSchema.parse(artifact);
22
+ if (artifact.bytes !== data.byteLength)
23
+ throw new Error("Artifact byte count does not match data");
24
+ const file = await this.path(runId, artifact.path);
25
+ await atomicWrite(file, data);
26
+ }
27
+ async signedUrl(runId, path, _expiresInMs) {
28
+ const file = await this.path(runId, path);
29
+ await assertRegularFile(file);
30
+ const run = await new FileRunStore(this.qaRoot).getRun(runId);
31
+ const scan = artifactScanSchema.safeParse(run?.run.metadata?.artifactScan);
32
+ if (!scan.success || scan.data.status !== "passed" || !scan.data.files[path])
33
+ throw new Error("Artifact sharing blocked: run has no passing secret scan");
34
+ const handle = await open(file, noFollowRead);
35
+ try {
36
+ const hash = createHash("sha256");
37
+ for await (const chunk of handle.createReadStream({ autoClose: false })) hash.update(chunk);
38
+ if (hash.digest("hex") !== scan.data.files[path])
39
+ throw new Error("Artifact sharing blocked: artifact changed after secret scan");
40
+ } finally {
41
+ await handle.close();
42
+ }
43
+ return pathToFileURL(file).href;
44
+ }
45
+ async path(runId, path) {
46
+ const parts = path.split("/");
47
+ if (parts.some((part) => !part || part === "." || part === ".." || part.startsWith(".tmp-")) || /[\\:]/.test(path) || [...path].some((character) => character.charCodeAt(0) < 32))
48
+ throw new Error("Invalid artifact path: use a relative path inside the run directory");
49
+ if (["run.json", "events.ndjson"].includes(parts[0]))
50
+ throw new Error("Artifact path is reserved for the run store");
51
+ let directory = runDirectory(this.qaRoot, runId);
52
+ await ensureDirectory(this.qaRoot);
53
+ await ensureDirectory(join(this.qaRoot, "runs"));
54
+ await ensureDirectory(directory);
55
+ for (const part of parts.slice(0, -1)) {
56
+ directory = join(directory, part);
57
+ await ensureDirectory(directory);
58
+ }
59
+ return join(directory, parts.at(-1));
60
+ }
61
+ }
62
+ export {
63
+ DirArtifactStore
64
+ };
@@ -0,0 +1,7 @@
1
+ import type { AgentProcess } from "@open-qa/qa-agents";
2
+ import type { AgentStartOptions } from "@open-qa/qa-engine";
3
+ import type { Sandbox } from "e2b";
4
+ /** E2B stdout is push-based; cap pending output even when the conductor stops reading. */
5
+ export declare function launchE2bAgent(sandbox: Sandbox, start: AgentStartOptions & {
6
+ runtime?: "pi";
7
+ }, signal?: AbortSignal): Promise<AgentProcess>;