@open-qa/qa 0.1.0-alpha.4 → 0.1.0-alpha.5

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 (109) hide show
  1. package/THIRD_PARTY.md +5 -0
  2. package/drizzle/0017_provider_notifications.sql +13 -0
  3. package/drizzle/0018_classification_registry.sql +39 -0
  4. package/drizzle/0019_trial_audit.sql +44 -0
  5. package/drizzle/meta/0017_snapshot.json +2092 -0
  6. package/drizzle/meta/0018_snapshot.json +2102 -0
  7. package/drizzle/meta/0019_snapshot.json +2451 -0
  8. package/drizzle/meta/_journal.json +21 -0
  9. package/package.json +12 -7
  10. package/src/access-binding.d.ts +8 -0
  11. package/src/access-binding.js +26 -0
  12. package/src/adapters/classification-write.d.ts +87 -0
  13. package/src/adapters/classification-write.js +64 -0
  14. package/src/adapters/e2b-executor.js +4 -0
  15. package/src/adapters/file-run-store.d.ts +186 -41
  16. package/src/adapters/file-run-store.js +87 -19
  17. package/src/adapters/file-trial-audit.d.ts +280 -0
  18. package/src/adapters/file-trial-audit.js +105 -0
  19. package/src/adapters/pg-classification-store.d.ts +98 -20
  20. package/src/adapters/pg-classification-store.js +84 -44
  21. package/src/adapters/pg-run-store.d.ts +1 -0
  22. package/src/adapters/pg-run-store.js +70 -9
  23. package/src/adapters/run-metadata.d.ts +2 -0
  24. package/src/adapters/run-metadata.js +10 -0
  25. package/src/adapters/secret-manager-credential-resolver.d.ts +1 -1
  26. package/src/attempt-audit.d.ts +363 -0
  27. package/src/attempt-audit.js +253 -0
  28. package/src/audit-command.d.ts +13 -0
  29. package/src/audit-command.js +77 -0
  30. package/src/classification-command.d.ts +14 -9
  31. package/src/classification-command.js +119 -26
  32. package/src/classification-model.d.ts +10 -3
  33. package/src/classification-model.js +40 -24
  34. package/src/classification-notifier.d.ts +4 -3
  35. package/src/classification-notifier.js +26 -6
  36. package/src/classify-runs.d.ts +2 -1
  37. package/src/classify-runs.js +39 -3
  38. package/src/cli-program.js +53 -7
  39. package/src/commands.d.ts +1 -0
  40. package/src/commands.js +2 -0
  41. package/src/db/database.d.ts +7 -0
  42. package/src/db/database.js +15 -0
  43. package/src/db/event-chunks.d.ts +38 -29
  44. package/src/db/flow-status.d.ts +7 -3
  45. package/src/db/flow-status.js +240 -16
  46. package/src/db/queries.d.ts +24 -1
  47. package/src/db/queries.js +22 -0
  48. package/src/db/schema.d.ts +333 -4
  49. package/src/db/schema.js +83 -11
  50. package/src/db/trial-audit.d.ts +526 -0
  51. package/src/db/trial-audit.js +84 -0
  52. package/src/draft-api.d.ts +25 -421
  53. package/src/draft-api.js +10 -3
  54. package/src/engine.d.ts +47 -4
  55. package/src/engine.js +97 -8
  56. package/src/execution-snapshot.d.ts +1 -1
  57. package/src/execution-snapshot.js +22 -17
  58. package/src/export-command.d.ts +6 -0
  59. package/src/export-command.js +106 -0
  60. package/src/flow-check.js +1 -1
  61. package/src/flow-loader.d.ts +72 -6
  62. package/src/flow-loader.js +76 -12
  63. package/src/http-stage-client.d.ts +98 -1
  64. package/src/independent-model.js +53 -6
  65. package/src/judge-review-store.d.ts +13 -0
  66. package/src/judge-review-store.js +58 -0
  67. package/src/local-host-executor.d.ts +3 -1
  68. package/src/local-host-executor.js +2 -0
  69. package/src/quarantine-command.d.ts +5 -1
  70. package/src/quarantine-command.js +56 -13
  71. package/src/remote-command.js +2 -0
  72. package/src/report/browser.js +37 -37
  73. package/src/report/ctrf.d.ts +983 -0
  74. package/src/report/ctrf.js +306 -0
  75. package/src/report/generate.d.ts +1 -1
  76. package/src/report/generate.js +29 -6
  77. package/src/report/load.d.ts +738 -42
  78. package/src/report/load.js +78 -6
  79. package/src/result-notifier.js +1 -1
  80. package/src/result-trace.d.ts +62 -0
  81. package/src/result-trace.js +81 -0
  82. package/src/run-command.d.ts +2 -0
  83. package/src/run-command.js +285 -62
  84. package/src/run-setup-error.d.ts +1 -1
  85. package/src/run-setup-error.js +2 -2
  86. package/src/server/app.js +5 -4
  87. package/src/server/index.d.ts +2 -0
  88. package/src/server/index.js +11 -2
  89. package/src/server/repository.d.ts +166 -29
  90. package/src/server/repository.js +14 -2
  91. package/src/studio-review.js +1 -1
  92. package/src/system-config.d.ts +2 -2
  93. package/src/system-config.js +5 -4
  94. package/src/trial-audit.d.ts +630 -0
  95. package/src/trial-audit.js +272 -0
  96. package/src/visual-baseline.d.ts +4 -0
  97. package/src/visual-baseline.js +42 -0
  98. package/src/webhook-notification.d.ts +15 -0
  99. package/src/webhook-notification.js +61 -0
  100. package/src/worker/execution.d.ts +2 -1
  101. package/src/worker/execution.js +122 -3
  102. package/src/worker/index.d.ts +4 -0
  103. package/src/worker/index.js +10 -1
  104. package/src/worker/quarantine-notifications.js +2 -2
  105. package/src/worker/queue.d.ts +6 -2
  106. package/src/worker/queue.js +80 -19
  107. package/src/worker/result-notifications.d.ts +10 -2
  108. package/src/worker/result-notifications.js +120 -23
  109. package/src/worker/store.js +6 -3
@@ -1,4 +1,4 @@
1
- import { Command } from "commander";
1
+ import { Command, Option } from "commander";
2
2
  import pkg from "../package.json" with { type: "json" };
3
3
  function createCli(overrides = {}) {
4
4
  const cli = new Command().name(Object.keys(pkg.bin)[0] ?? "open-qa").description("open-qa CLI").version(pkg.version).exitOverride();
@@ -38,10 +38,10 @@ function createCli(overrides = {}) {
38
38
  )).draftCommand;
39
39
  process.exitCode = await command(options);
40
40
  });
41
- cli.command("run <path>").option("--accept-estimate", "Accept historical cost estimates above confirmation thresholds").description("Run a flow or suite directory").option("--root <directory>", ".qa configuration directory").option("--target <name>", "Target from config.yaml", "local").option("--runtime <runtime>", "Agent runtime (claude-code|codex)", "claude-code").option("--model-access <mode>", "Local login/env (default login) or remote personal/team").option("--agent-at <placement>", "Agent placement (host|stage); CLI defaults to host").option("--remote", "Queue a published flow ID on qa-server").option("--server <url>", "QA server URL").option("--project <id>", "QA project ID").option("--idempotency-key <key>", "Reuse this key when retrying a remote submission").option("--executor <placement>", "Stage placement (local-host|e2b)", "local-host").option("--headed", "Show the browser").option(
41
+ cli.command("run <path>").option("--run-context <file>", "JSON with CI, build and traceability references").option("--accept-estimate", "Accept historical cost estimates above confirmation thresholds").description("Run a flow or suite directory").option("--root <directory>", ".qa configuration directory").option("--target <name>", "Target from config.yaml", "local").option("--runtime <runtime>", "Agent runtime (claude-code|codex)", "claude-code").option("--model-access <mode>", "Local login/env (default login) or remote personal/team").option("--agent-at <placement>", "Agent placement (host|stage); CLI defaults to host").option("--remote", "Queue a published flow ID on qa-server").option("--server <url>", "QA server URL").option("--project <id>", "QA project ID").option("--idempotency-key <key>", "Reuse this key when retrying a remote submission").option("--executor <placement>", "Stage placement (local-host|e2b)", "local-host").option("--headed", "Show the browser").option(
42
42
  "--replay <mode>",
43
43
  "Disable reading cached steps (off); successful agent steps still update the cache"
44
- ).option("--level <level>", "Override every step to pixel").option("--persona <name>", "Override every user actor persona").option("--tag <tag>", "Select flows containing this tag").option("--retries <count>", "Retry a failed flow (0 or 1)", "1").option("--repeat <count>", "Repeat one flow in fresh stages and leases (1-100)").action(async (path, options) => {
44
+ ).option("--level <level>", "Override every step to pixel").option("--persona <name>", "Override every user actor persona").option("--tag <tag>", "Select flows containing this tag").option("--retries <count>", "Retry a failed flow (0 or 1)", "1").option("--repeat <count>", "Repeat one flow in fresh stages and leases (1-100)").option("--dependent-trials", "Record shared conditions that make repeat trials dependent").action(async (path, options) => {
45
45
  if (options.remote) {
46
46
  if (options.repeat !== void 0)
47
47
  throw new Error("--repeat requires local execution; --remote only queues a batch");
@@ -55,7 +55,8 @@ function createCli(overrides = {}) {
55
55
  process.exitCode = await (overrides.run ?? runCommand)(path, {
56
56
  ...options,
57
57
  retries: Number(options.retries),
58
- ...options.repeat !== void 0 ? { repeat: Number(options.repeat) } : {}
58
+ ...options.repeat !== void 0 ? { repeat: Number(options.repeat) } : {},
59
+ ...options.dependentTrials && { dependentTrials: true }
59
60
  });
60
61
  });
61
62
  cli.command("setup").description("Install Chromium and create a private local QA environment").option("--root <directory>", ".qa configuration directory").option("--env-file <file>", "Import an existing QA credential inventory into a new .env.local").action(async (options) => {
@@ -64,6 +65,9 @@ function createCli(overrides = {}) {
64
65
  cli.command("doctor").description("Check runtime, subscription, browser, target and configured accounts").option("--save", "Save a safe diagnostic summary for Studio").option("--root <directory>", ".qa configuration directory").option("--target <name>", "Target from config.yaml", "local").action(async (options) => {
65
66
  process.exitCode = await (await commands()).doctorCommand(options);
66
67
  });
68
+ cli.command("export <id>").description("Export a QA execution or batch as CTRF JSON").addOption(new Option("--format <format>", "Result format").choices(["ctrf"]).default("ctrf")).option("--batch", "Select a batch ID instead of a run ID").option("--root <directory>", ".qa directory for local runs").option("--postgres", "Read from QA_DATABASE_URL instead of local runs").option("--project <id>", "Project ID (required for PostgreSQL, or use QA_PROJECT_ID)").action(async (id, options) => {
69
+ process.exitCode = await (await commands()).exportCommand(id, options);
70
+ });
67
71
  cli.command("open <run>").description("Open a run report or its directory while the report is pending").option("--root <directory>", ".qa configuration directory").action(async (id, options) => {
68
72
  process.exitCode = await (await commands()).openCommand(id, options);
69
73
  });
@@ -88,7 +92,11 @@ function createCli(overrides = {}) {
88
92
  }
89
93
  const quarantine = cli.command("quarantine").description("Manage PostgreSQL flow quarantine");
90
94
  for (const action of ["list", "release"]) {
91
- quarantine.command(action === "release" ? "release <flow>" : "list").option("--root <directory>", ".qa configuration directory").option("--project <id>", "QA project ID (or QA_PROJECT_ID)").action(async (...args) => {
95
+ const command = quarantine.command(action === "release" ? "release <flow>" : "list").option("--root <directory>", ".qa configuration directory").option("--project <id>", "QA project ID (or QA_PROJECT_ID)");
96
+ if (action === "list") command.option("--flow <key>", "Show audit decisions for a flow");
97
+ else
98
+ command.option("--generation <number>", "Quarantine generation to release").option("--reason <text>", "Optional note for the release audit").option("--group <id>", "Trial group providing release evidence");
99
+ command.action(async (...args) => {
92
100
  const { tsImport } = await import("tsx/esm/api");
93
101
  const { quarantineCommand } = await tsImport(
94
102
  "./quarantine-command.js",
@@ -101,6 +109,28 @@ function createCli(overrides = {}) {
101
109
  );
102
110
  });
103
111
  }
112
+ const trial = cli.command("trial").description("Read the immutable repeat history");
113
+ for (const action of ["list", "show"]) {
114
+ trial.command(action === "show" ? "show <group>" : "list").option("--root <directory>", ".qa configuration directory").option("--project <id>", "QA project ID").option("--postgres", "Read QA PostgreSQL").option("--flow <key>", "Filter groups by flow").action(async (...args) => {
115
+ const { tsImport } = await import("tsx/esm/api");
116
+ const { trialCommand } = await tsImport(
117
+ "./audit-command.js",
118
+ import.meta.url
119
+ );
120
+ process.exitCode = await trialCommand(
121
+ action === "show" ? String(args[0]) : void 0,
122
+ args[action === "show" ? 1 : 0]
123
+ );
124
+ });
125
+ }
126
+ cli.command("judge").description("Review recorded judge evidence").command("review <attempt> <event-seq>").option("--root <directory>", ".qa configuration directory").option("--project <id>", "QA project ID").option("--postgres", "Use QA PostgreSQL").option("--verdict <verdict>", "Human verdict (passed, failed, inconclusive)").option("--reason <text>", "Reason for the human verdict").action(async (attempt, seq, options) => {
127
+ const { tsImport } = await import("tsx/esm/api");
128
+ const { judgeReviewCommand } = await tsImport(
129
+ "./audit-command.js",
130
+ import.meta.url
131
+ );
132
+ process.exitCode = await judgeReviewCommand(attempt, seq, options);
133
+ });
104
134
  for (const action of ["accept", "retire"]) {
105
135
  const command = cli.command(action === "accept" ? "accept [flow]" : "retire <flow>").description(
106
136
  action === "accept" ? "Make a reviewed flow active after watching its first run" : "Retire an active or quarantined flow so it never runs again"
@@ -137,7 +167,7 @@ function createCli(overrides = {}) {
137
167
  });
138
168
  });
139
169
  }
140
- cli.command("classify <run> <category>").description("Record a human failure classification with an audit reason").requiredOption("--reason <reason>", "Reason for correcting the classification").option("--root <directory>", ".qa directory").option("--remote", "Correct a remote run").option("--server <url>", "QA server URL").option("--project <id>", "QA project ID").action(async (run, category, options) => {
170
+ cli.command("classify <run> <category>").description("Record a human failure classification with an audit reason").requiredOption("--reason <reason>", "Reason for correcting the classification").option("--root <directory>", ".qa directory").option("--remote", "Correct a remote run").option("--taxonomy-version <version>", "Require this active taxonomy version").option("--server <url>", "QA server URL").option("--project <id>", "QA project ID").action(async (run, category, options) => {
141
171
  const { tsImport } = await import("tsx/esm/api");
142
172
  const { classifyCommand } = await tsImport(
143
173
  "./classification-command.js",
@@ -145,7 +175,7 @@ function createCli(overrides = {}) {
145
175
  );
146
176
  process.exitCode = await classifyCommand(run, category, options);
147
177
  });
148
- cli.command("classification-eval <labels>").description("Evaluate original predictions against independently labeled runs").option("--root <directory>", ".qa directory").action(async (labels, options) => {
178
+ cli.command("classification-eval <labels>").description("Evaluate original predictions against independently labeled runs").option("--root <directory>", ".qa directory").option("--project <id>", "QA project ID").action(async (labels, options) => {
149
179
  const { tsImport } = await import("tsx/esm/api");
150
180
  const { classificationEvalCommand } = await tsImport(
151
181
  "./classification-command.js",
@@ -153,6 +183,22 @@ function createCli(overrides = {}) {
153
183
  );
154
184
  process.exitCode = await classificationEvalCommand(labels, options);
155
185
  });
186
+ cli.command("classification-import <labels>").description("Import versioned human labels for local runs").option("--root <directory>", ".qa directory").option("--project <id>", "QA project ID").action(async (labels, options) => {
187
+ const { tsImport } = await import("tsx/esm/api");
188
+ const { classificationImportCommand } = await tsImport(
189
+ "./classification-command.js",
190
+ import.meta.url
191
+ );
192
+ process.exitCode = await classificationImportCommand(labels, options);
193
+ });
194
+ cli.command("classification-show <run>").description("Export the failure classification and its audit history as JSON").option("--root <directory>", ".qa directory").option("--remote", "Read a remote run").option("--server <url>", "QA server URL").option("--project <id>", "QA project ID").action(async (run, options) => {
195
+ const { tsImport } = await import("tsx/esm/api");
196
+ const { classificationShowCommand } = await tsImport(
197
+ "./classification-command.js",
198
+ import.meta.url
199
+ );
200
+ process.exitCode = await classificationShowCommand(run, options);
201
+ });
156
202
  cli.command("sandboxes").description("Manage QA-owned E2B sandboxes").command("prune").description("Terminate QA sandboxes for confirmed finished runs in this project").option("--root <directory>", ".qa configuration directory").option("--dry-run", "List cleanup counts without terminating sandboxes").action(async (options) => {
157
203
  const { tsImport } = await import("tsx/esm/api");
158
204
  const { sandboxesPruneCommand } = await tsImport(
package/src/commands.d.ts CHANGED
@@ -2,6 +2,7 @@ export { runCommand } from "./run-command.js";
2
2
  export { setupCommand } from "./setup-command.js";
3
3
  export { doctorCommand } from "./doctor-command.js";
4
4
  export { openCommand } from "./open-command.js";
5
+ export { exportCommand } from "./export-command.js";
5
6
  export { remoteRunCommand, authCommand } from "./remote-command.js";
6
7
  export { watchCommand } from "./watch-command.js";
7
8
  export { demoCommand } from "./demo-command.js";
package/src/commands.js CHANGED
@@ -2,6 +2,7 @@ import { runCommand } from "./run-command.js";
2
2
  import { setupCommand } from "./setup-command.js";
3
3
  import { doctorCommand } from "./doctor-command.js";
4
4
  import { openCommand } from "./open-command.js";
5
+ import { exportCommand } from "./export-command.js";
5
6
  import { remoteRunCommand, authCommand } from "./remote-command.js";
6
7
  import { watchCommand } from "./watch-command.js";
7
8
  import { demoCommand } from "./demo-command.js";
@@ -9,6 +10,7 @@ export {
9
10
  authCommand,
10
11
  demoCommand,
11
12
  doctorCommand,
13
+ exportCommand,
12
14
  openCommand,
13
15
  remoteRunCommand,
14
16
  runCommand,
@@ -1,5 +1,12 @@
1
1
  import { Pool, type PoolClient, type PoolConfig } from "pg";
2
2
  export { publicId } from "../public-id.js";
3
+ export declare const clockMs = "floor(extract(epoch FROM clock_timestamp()) * 1000)::double precision";
4
+ export declare function postgresNow(client: Pool | PoolClient): Promise<number>;
5
+ export declare function postgresAuditContext(client: PoolClient): Promise<{
6
+ host: string;
7
+ dbUser: string;
8
+ at: number;
9
+ }>;
3
10
  export declare function assertPostgresText(value: unknown): void;
4
11
  export type QaDatabaseOptions = Pick<PoolConfig, "max" | "ssl" | "statement_timeout" | "idle_in_transaction_session_timeout">;
5
12
  export declare class QaDatabase {
@@ -1,9 +1,21 @@
1
+ import { hostname } from "node:os";
1
2
  import { fileURLToPath } from "node:url";
2
3
  import { Pool } from "pg";
3
4
  import { drizzle } from "drizzle-orm/node-postgres";
4
5
  import { migrate } from "drizzle-orm/node-postgres/migrator";
5
6
  import { z } from "zod";
6
7
  import { publicId } from "../public-id.js";
8
+ const clockMs = "floor(extract(epoch FROM clock_timestamp()) * 1000)::double precision";
9
+ async function postgresNow(client) {
10
+ const { rows } = await client.query(`SELECT ${clockMs} AS at`);
11
+ return rows[0].at;
12
+ }
13
+ async function postgresAuditContext(client) {
14
+ const { rows } = await client.query(
15
+ `SELECT session_user AS "dbUser", ${clockMs} AS at`
16
+ );
17
+ return { ...rows[0], host: hostname() };
18
+ }
7
19
  function assertPostgresText(value) {
8
20
  if (typeof value === "string" && value.includes("\0"))
9
21
  throw new Error("QA PostgreSQL text and JSON must not contain NUL characters");
@@ -129,7 +141,10 @@ async function migrateQa(db, folder = migrationsFolder) {
129
141
  export {
130
142
  QaDatabase,
131
143
  assertPostgresText,
144
+ clockMs,
132
145
  migrateQa,
133
146
  migrationsFolder,
147
+ postgresAuditContext,
148
+ postgresNow,
134
149
  publicId
135
150
  };
@@ -23,12 +23,12 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
23
23
  events: ({
24
24
  kind: "reviewer_result";
25
25
  result: {
26
- status: "incomplete" | "completed" | "skipped";
26
+ status: "completed" | "incomplete" | "skipped";
27
27
  reason: string;
28
28
  checks: {
29
29
  eventSeqs: number[];
30
30
  shots: string[];
31
- item: "evidence" | "do" | "wait" | "scope" | "other";
31
+ item: "evidence" | "scope" | "do" | "wait" | "other";
32
32
  actor: string;
33
33
  step: string;
34
34
  status: "unknown" | "pass" | "fail";
@@ -50,7 +50,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
50
50
  verdict: "error" | "passed" | "failed" | "inconclusive" | "canceled";
51
51
  seq: number;
52
52
  t: number;
53
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
53
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
54
54
  failureType?: "agent" | undefined;
55
55
  actor?: string | undefined;
56
56
  view?: string | undefined;
@@ -65,7 +65,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
65
65
  cache: "unavailable" | "saved" | "pending";
66
66
  seq: number;
67
67
  t: number;
68
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
68
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
69
69
  runtime?: string | undefined;
70
70
  model?: string | undefined;
71
71
  modelAccess?: "env" | "login" | undefined;
@@ -82,7 +82,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
82
82
  tool: string;
83
83
  seq: number;
84
84
  t: number;
85
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
85
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
86
86
  view?: string | undefined;
87
87
  } | {
88
88
  kind: "together_fired";
@@ -97,7 +97,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
97
97
  maxSkewMs: number;
98
98
  seq: number;
99
99
  t: number;
100
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
100
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
101
101
  actor?: string | undefined;
102
102
  view?: string | undefined;
103
103
  step?: string | undefined;
@@ -108,7 +108,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
108
108
  message: string;
109
109
  seq: number;
110
110
  t: number;
111
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
111
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
112
112
  actor?: string | undefined;
113
113
  view?: string | undefined;
114
114
  step?: string | undefined;
@@ -117,7 +117,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
117
117
  message: string;
118
118
  seq: number;
119
119
  t: number;
120
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
120
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
121
121
  actor?: string | undefined;
122
122
  view?: string | undefined;
123
123
  step?: string | undefined;
@@ -126,7 +126,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
126
126
  phase: "queued" | "provisioning" | "leasing" | "setup" | "running" | "judging" | "cleanup" | "finished";
127
127
  seq: number;
128
128
  t: number;
129
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
129
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
130
130
  runtime?: string | undefined;
131
131
  modelAccess?: "env" | "login" | undefined;
132
132
  agentAt?: "host" | "stage" | undefined;
@@ -144,7 +144,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
144
144
  }[];
145
145
  seq: number;
146
146
  t: number;
147
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
147
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
148
148
  expiresAt?: number | undefined;
149
149
  actor?: string | undefined;
150
150
  view?: string | undefined;
@@ -157,14 +157,14 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
157
157
  url: string;
158
158
  seq: number;
159
159
  t: number;
160
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
160
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
161
161
  step?: string | undefined;
162
162
  } | {
163
163
  kind: "view_closed";
164
164
  view: string;
165
165
  seq: number;
166
166
  t: number;
167
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
167
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
168
168
  actor?: string | undefined;
169
169
  step?: string | undefined;
170
170
  } | {
@@ -174,7 +174,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
174
174
  phase: "agent" | "replaying" | "healing" | "checking";
175
175
  seq: number;
176
176
  t: number;
177
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
177
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
178
178
  view?: string | undefined;
179
179
  } | {
180
180
  kind: "step_started";
@@ -182,7 +182,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
182
182
  step: string;
183
183
  seq: number;
184
184
  t: number;
185
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
185
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
186
186
  view?: string | undefined;
187
187
  } | {
188
188
  kind: "action";
@@ -192,7 +192,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
192
192
  ms: number;
193
193
  seq: number;
194
194
  t: number;
195
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
195
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
196
196
  data?: Record<string, import("zod").JSONType> | undefined;
197
197
  changed?: boolean | undefined;
198
198
  beforeShot?: string | undefined;
@@ -248,6 +248,15 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
248
248
  actor?: string | undefined;
249
249
  view?: string | undefined;
250
250
  step?: string | undefined;
251
+ } | {
252
+ kind: "web_evidence";
253
+ path: string;
254
+ seq: number;
255
+ t: number;
256
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
257
+ actor?: string | undefined;
258
+ view?: string | undefined;
259
+ step?: string | undefined;
251
260
  } | {
252
261
  kind: "expect_result";
253
262
  condition: Record<string, import("zod").JSONType> & {
@@ -260,7 +269,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
260
269
  };
261
270
  seq: number;
262
271
  t: number;
263
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
272
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
264
273
  actor?: string | undefined;
265
274
  view?: string | undefined;
266
275
  step?: string | undefined;
@@ -275,7 +284,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
275
284
  };
276
285
  seq: number;
277
286
  t: number;
278
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
287
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
279
288
  actor?: string | undefined;
280
289
  view?: string | undefined;
281
290
  step?: string | undefined;
@@ -284,7 +293,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
284
293
  text: string;
285
294
  seq: number;
286
295
  t: number;
287
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
296
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
288
297
  actor?: string | undefined;
289
298
  view?: string | undefined;
290
299
  step?: string | undefined;
@@ -294,8 +303,8 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
294
303
  kind: "usage";
295
304
  seq: number;
296
305
  t: number;
297
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
298
- source?: "main" | "heal" | "judge" | "reviewer" | undefined;
306
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
307
+ source?: "heal" | "main" | "judge" | "reviewer" | undefined;
299
308
  billing?: "subscription" | "metered" | undefined;
300
309
  cacheReadTokens?: number | undefined;
301
310
  cacheWriteTokens?: number | undefined;
@@ -310,7 +319,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
310
319
  status: "passed" | "failed";
311
320
  seq: number;
312
321
  t: number;
313
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
322
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
314
323
  reason?: string | undefined;
315
324
  actor?: string | undefined;
316
325
  view?: string | undefined;
@@ -323,7 +332,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
323
332
  }[];
324
333
  seq: number;
325
334
  t: number;
326
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
335
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
327
336
  actor?: string | undefined;
328
337
  view?: string | undefined;
329
338
  step?: string | undefined;
@@ -332,7 +341,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
332
341
  verdict: "error" | "passed" | "failed" | "inconclusive" | "canceled";
333
342
  seq: number;
334
343
  t: number;
335
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
344
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
336
345
  reason?: string | undefined;
337
346
  actor?: string | undefined;
338
347
  view?: string | undefined;
@@ -344,7 +353,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
344
353
  kind: "record_started";
345
354
  seq: number;
346
355
  t: number;
347
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
356
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
348
357
  actor?: string | undefined;
349
358
  step?: string | undefined;
350
359
  } | {
@@ -354,7 +363,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
354
363
  kind: "record_stopped";
355
364
  seq: number;
356
365
  t: number;
357
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
366
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
358
367
  actor?: string | undefined;
359
368
  step?: string | undefined;
360
369
  } | {
@@ -364,7 +373,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
364
373
  text: string;
365
374
  seq: number;
366
375
  t: number;
367
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
376
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
368
377
  actor?: string | undefined;
369
378
  step?: string | undefined;
370
379
  } | {
@@ -373,7 +382,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
373
382
  message: string;
374
383
  seq: number;
375
384
  t: number;
376
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
385
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
377
386
  actor?: string | undefined;
378
387
  step?: string | undefined;
379
388
  } | {
@@ -381,7 +390,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
381
390
  view: string;
382
391
  seq: number;
383
392
  t: number;
384
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
393
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
385
394
  actor?: string | undefined;
386
395
  step?: string | undefined;
387
396
  } | {
@@ -392,7 +401,7 @@ export declare function encodeEvents(input: readonly RunEvent[]): {
392
401
  ms: number;
393
402
  seq: number;
394
403
  t: number;
395
- by: "agent" | "replay" | "program" | "hook" | "conductor" | "system";
404
+ by: "agent" | "program" | "replay" | "hook" | "conductor" | "system";
396
405
  status?: number | undefined;
397
406
  error?: string | undefined;
398
407
  actor?: string | undefined;
@@ -1,12 +1,12 @@
1
1
  import type { PoolClient } from "pg";
2
- import { type FlowLifecycleStore, type FlowStatus, type FlowStatusStore, type RepeatResult } from "@open-qa/qa-engine";
2
+ import { type FlowLifecycleStore, type FlowStatus, type FlowStatusStore, type RepeatResult, type QuarantineRelease, type QuarantineReleaseResult } from "@open-qa/qa-engine";
3
3
  import { QaDatabase } from "./database.js";
4
4
  export declare class PgFlowStatus implements FlowStatusStore, FlowLifecycleStore {
5
5
  private readonly db;
6
6
  private readonly projectId;
7
7
  constructor(db: QaDatabase, projectId: string);
8
8
  get(flow: string): Promise<FlowStatus | undefined>;
9
- list(): Promise<FlowStatus[]>;
9
+ list(flows?: readonly string[], client?: Pick<PoolClient, "query">): Promise<FlowStatus[]>;
10
10
  record(input: Parameters<FlowStatusStore["record"]>[0]): Promise<{
11
11
  quarantined: boolean;
12
12
  status: "review" | "active" | "quarantined" | "draft" | "retired";
@@ -16,7 +16,11 @@ export declare class PgFlowStatus implements FlowStatusStore, FlowLifecycleStore
16
16
  status: "review" | "active" | "quarantined" | "draft" | "retired";
17
17
  }>;
18
18
  saveRepeat(flow: string, result: RepeatResult): Promise<void>;
19
- release(flow: string): Promise<FlowStatus | undefined>;
19
+ quarantineHistory(flow: string): Promise<unknown[]>;
20
+ release(flow: string, input: QuarantineRelease): Promise<QuarantineReleaseResult>;
21
+ autoRelease(flow: string, input: Omit<QuarantineRelease, "actor" | "reason">): Promise<QuarantineReleaseResult>;
22
+ private decideRelease;
23
+ private appendDecision;
20
24
  states(flows: readonly string[]): Promise<Map<string, FlowStatus>>;
21
25
  accept(flow: string, input: {
22
26
  revision: string;