screw-bugs 0.1.5 → 0.1.7

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.
@@ -1,5 +1,7 @@
1
1
  import { Schema } from 'effect';
2
+ import { Findings } from './findings.js';
2
3
  import { type JobRecord } from './job.js';
4
+ import { CaseStatus } from './status.js';
3
5
  /**
4
6
  * `run_status` cuts each listed reason to this many characters. A reason with a hint about where
5
7
  * else its text or element is (see `withHint` in core) is kept within it, so the hint shows.
@@ -320,6 +322,10 @@ export declare const CaseLedger: Schema.Struct<{
320
322
  readonly video: Schema.optionalKey<Schema.String>;
321
323
  readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
322
324
  readonly videoProblem: Schema.optionalKey<Schema.String>;
325
+ readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
326
+ readonly fromMs: Schema.Number;
327
+ readonly toMs: Schema.Number;
328
+ }>>>;
323
329
  }>>>;
324
330
  /** The screw-bugs version that ran the job. */
325
331
  readonly version: Schema.optionalKey<Schema.String>;
@@ -839,6 +845,10 @@ export declare const ReportBundle: Schema.Struct<{
839
845
  readonly video: Schema.optionalKey<Schema.String>;
840
846
  readonly videoDurationMs: Schema.optionalKey<Schema.Number>;
841
847
  readonly videoProblem: Schema.optionalKey<Schema.String>;
848
+ readonly still: Schema.optionalKey<Schema.$Array<Schema.Struct<{
849
+ readonly fromMs: Schema.Number;
850
+ readonly toMs: Schema.Number;
851
+ }>>>;
842
852
  }>>>;
843
853
  /** The screw-bugs version that ran the job. */
844
854
  readonly version: Schema.optionalKey<Schema.String>;
@@ -889,6 +899,7 @@ export declare const ReportBundle: Schema.Struct<{
889
899
  readonly did: Schema.optionalKey<Schema.$Array<Schema.String>>;
890
900
  readonly worked: Schema.optionalKey<Schema.$Array<Schema.String>>;
891
901
  readonly didnt: Schema.optionalKey<Schema.$Array<Schema.String>>;
902
+ readonly failed: Schema.optionalKey<Schema.String>;
892
903
  readonly highlights: Schema.optionalKey<Schema.$Array<Schema.Struct<{
893
904
  readonly shot: Schema.NonEmptyString;
894
905
  readonly target: Schema.Struct<{
@@ -1020,3 +1031,30 @@ export declare const findingsRevision: (text: string) => string;
1020
1031
  * the screw-bugs version building it (`generator`); undefined leaves that out.
1021
1032
  */
1022
1033
  export declare const reportBundleOf: (job: JobRecord, ledger: CaseLedger, writeUp?: Pick<ReportBundle, 'findings' | 'marks' | 'annotated' | 'elements' | 'urls'>, version?: string) => ReportBundle;
1034
+ /**
1035
+ * The cases the agent's findings mark failed (`CaseFindings.failed`), by case ID, with what is
1036
+ * wrong. Empty without findings.
1037
+ */
1038
+ export declare const agentFailures: (findings: Findings | undefined) => ReadonlyMap<string, string>;
1039
+ /** A case as results show it: its status there, and what the run's code decided. */
1040
+ export type JudgedCase = CaseEntry & {
1041
+ /** The status the run's code gave it, as `ledger.json` keeps it. */
1042
+ readonly checkStatus: CaseStatus;
1043
+ /** What is wrong, when the agent's findings mark it failed (then `status` is `failed`). */
1044
+ readonly agentFailed?: string;
1045
+ };
1046
+ /**
1047
+ * A case's status as results show it: `failed` when the agent's findings mark it failed, else the
1048
+ * code's. Findings can only turn a case into a failure, never make one pass.
1049
+ */
1050
+ export declare const judgedCase: (entry: CaseEntry, failures: ReadonlyMap<string, string>) => JudgedCase;
1051
+ /** A ledger whose cases have their statuses as results show them (see `judgedLedger`). */
1052
+ export type JudgedLedger = Omit<CaseLedger, 'cases'> & {
1053
+ readonly cases: ReadonlyArray<JudgedCase>;
1054
+ };
1055
+ /**
1056
+ * The ledger as everything that shows results reads it (reports, replies, the CLI): each case's
1057
+ * status after the agent's findings (`judgedCase`). `ledger.json` and `evidence.json` keep the
1058
+ * code's statuses.
1059
+ */
1060
+ export declare const judgedLedger: (ledger: CaseLedger, findings: Findings | undefined) => JudgedLedger;
@@ -223,3 +223,27 @@ export const reportBundleOf = (job, ledger, writeUp = {}, version) => ({
223
223
  ...(ledger.browser !== undefined ? { browser: ledger.browser } : {}),
224
224
  files: { ledger: runFiles.ledger, html: runFiles.html, evidenceDir: runFiles.evidenceDir },
225
225
  });
226
+ /**
227
+ * The cases the agent's findings mark failed (`CaseFindings.failed`), by case ID, with what is
228
+ * wrong. Empty without findings.
229
+ */
230
+ export const agentFailures = (findings) => new Map((findings?.cases ?? []).flatMap((c) => c.failed !== undefined && c.failed.trim() !== '' ? [[c.id, c.failed.trim()]] : []));
231
+ /**
232
+ * A case's status as results show it: `failed` when the agent's findings mark it failed, else the
233
+ * code's. Findings can only turn a case into a failure, never make one pass.
234
+ */
235
+ export const judgedCase = (entry, failures) => {
236
+ const agentFailed = failures.get(entry.id);
237
+ return agentFailed === undefined
238
+ ? { ...entry, checkStatus: entry.status }
239
+ : { ...entry, status: 'failed', checkStatus: entry.status, agentFailed };
240
+ };
241
+ /**
242
+ * The ledger as everything that shows results reads it (reports, replies, the CLI): each case's
243
+ * status after the agent's findings (`judgedCase`). `ledger.json` and `evidence.json` keep the
244
+ * code's statuses.
245
+ */
246
+ export const judgedLedger = (ledger, findings) => {
247
+ const failures = agentFailures(findings);
248
+ return { ...ledger, cases: ledger.cases.map((entry) => judgedCase(entry, failures)) };
249
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screw-bugs",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Local browser QA for coding agents (MCP), people and CI.",
5
5
  "keywords": [
6
6
  "browser",