@mrevanzak/witness 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/witness.mjs +116 -171
- package/package.json +2 -1
package/dist/bin/witness.mjs
CHANGED
|
@@ -4594,7 +4594,8 @@ var verify = Effect26.fn("verify")(function* (opts) {
|
|
|
4594
4594
|
prefix: repo.prefix,
|
|
4595
4595
|
repo: repo.root,
|
|
4596
4596
|
runDir: run2.dir,
|
|
4597
|
-
sha: repo.sha
|
|
4597
|
+
sha: repo.sha,
|
|
4598
|
+
title: reportTitle(opts.task)
|
|
4598
4599
|
});
|
|
4599
4600
|
const single = (o) => ({ ...o, before: Option19.none() });
|
|
4600
4601
|
const [diff, files, readme] = yield* Effect26.all(
|
|
@@ -5200,7 +5201,7 @@ var renderRun = Effect27.fn("renderRun")(function* (runDirIn, opts = {}) {
|
|
|
5200
5201
|
});
|
|
5201
5202
|
|
|
5202
5203
|
// src/main.ts
|
|
5203
|
-
import { Config as Config6, Console as Console7, Effect as Effect38, Layer as Layer11, Option as
|
|
5204
|
+
import { Config as Config6, Console as Console7, Effect as Effect38, Layer as Layer11, Option as Option30, Path as Path15, Schema as Schema28 } from "effect";
|
|
5204
5205
|
import { Argument, Command, Flag as Flag2 } from "effect/cli";
|
|
5205
5206
|
import { FetchHttpClient } from "effect/http";
|
|
5206
5207
|
import { ChildProcess as ChildProcess9, ChildProcessSpawner as ChildProcessSpawner9 } from "effect/process";
|
|
@@ -5208,7 +5209,7 @@ import { ChildProcess as ChildProcess9, ChildProcessSpawner as ChildProcessSpawn
|
|
|
5208
5209
|
// package.json
|
|
5209
5210
|
var package_default = {
|
|
5210
5211
|
name: "@mrevanzak/witness",
|
|
5211
|
-
version: "1.0
|
|
5212
|
+
version: "1.1.0",
|
|
5212
5213
|
description: "Independent, recorded QA for code changes: boots the app in a fresh Linux desktop, checks the change, and hands back a verdict, stills and video",
|
|
5213
5214
|
keywords: [
|
|
5214
5215
|
"qa",
|
|
@@ -5241,6 +5242,7 @@ var package_default = {
|
|
|
5241
5242
|
dependencies: {
|
|
5242
5243
|
"@anthropic-ai/sdk": "0.135.0",
|
|
5243
5244
|
"@effect/platform-node": "4.0.5",
|
|
5245
|
+
"@effect/platform-node-shared": "4.0.5",
|
|
5244
5246
|
"@remotion/bundler": "4.0.532",
|
|
5245
5247
|
"@remotion/google-fonts": "4.0.532",
|
|
5246
5248
|
"@remotion/renderer": "4.0.532",
|
|
@@ -5544,7 +5546,7 @@ var readFacts = Effect29.fn("readFacts")(function* (dir) {
|
|
|
5544
5546
|
});
|
|
5545
5547
|
var EVIDENCE_CHOICES = [
|
|
5546
5548
|
{
|
|
5547
|
-
description: "Stills and the video are uploaded into the PR description (or a comment on someone else's PR). Needs
|
|
5549
|
+
description: "Stills and the video are uploaded into the PR description (or a comment on someone else's PR). Needs gh 2.99 or later.",
|
|
5548
5550
|
title: "GitHub PR",
|
|
5549
5551
|
value: "pr"
|
|
5550
5552
|
},
|
|
@@ -5750,7 +5752,7 @@ var LIVE_PAGE = `<!doctype html>
|
|
|
5750
5752
|
}
|
|
5751
5753
|
const d = e.data || {};
|
|
5752
5754
|
if (PHASES[e.event]) $("phase").textContent = PHASES[e.event] + (e.event === "boot.setup" && d.cmd ? " \xB7 " + d.cmd : "");
|
|
5753
|
-
if (e.event === "run.start") { if (!runDir) { $("meta").textContent = (d.sha || "").slice(0, 7) + " \xB7 " + d.mode; mode = d.mode; runDir = d.runDir || ""; } }
|
|
5755
|
+
if (e.event === "run.start") { if (d.title) document.title = d.title + " \xB7 Witness live"; if (!runDir) { $("meta").textContent = (d.sha || "").slice(0, 7) + " \xB7 " + d.mode; mode = d.mode; runDir = d.runDir || ""; } }
|
|
5754
5756
|
// A before/after run checks the base commit, then the change, in two computers.
|
|
5755
5757
|
if (e.event === "state.start") {
|
|
5756
5758
|
side = d.state;
|
|
@@ -5912,11 +5914,13 @@ var startLive = Effect30.fn("startLive")(function* (onTakeover) {
|
|
|
5912
5914
|
});
|
|
5913
5915
|
|
|
5914
5916
|
// src/publish.ts
|
|
5915
|
-
import { Console as Console3, Effect as Effect31, FileSystem as FileSystem11,
|
|
5917
|
+
import { Console as Console3, Effect as Effect31, FileSystem as FileSystem11, Path as Path10, Schema as Schema24 } from "effect";
|
|
5916
5918
|
import { ChildProcess as ChildProcess8, ChildProcessSpawner as ChildProcessSpawner8 } from "effect/process";
|
|
5917
5919
|
var START = "<!-- witness:start -->";
|
|
5918
5920
|
var END = "<!-- witness:end -->";
|
|
5919
5921
|
var MEDIA = /\.\/[A-Za-z0-9._/-]+\.(?:jpe?g|png|gif|mp4|mov|webm)/g;
|
|
5922
|
+
var VIDEO_LINE = /^(\.\/[A-Za-z0-9._/-]+\.(?:mp4|mov|webm))$/gm;
|
|
5923
|
+
var MAX_ATTACH = 50;
|
|
5920
5924
|
var PublishError = class extends Schema24.TaggedError()("PublishError", { message: Schema24.String }) {
|
|
5921
5925
|
};
|
|
5922
5926
|
var placeSection = (body, section) => {
|
|
@@ -5946,34 +5950,7 @@ ${trimmed.slice(footer)}
|
|
|
5946
5950
|
`;
|
|
5947
5951
|
};
|
|
5948
5952
|
var referencedMedia = (markdown) => [...new Set(markdown.match(MEDIA) ?? [])];
|
|
5949
|
-
var
|
|
5950
|
-
const space = await taskSpace(${JSON.stringify(space)});
|
|
5951
|
-
const page = await space.newPage();
|
|
5952
|
-
const BOX = '#new_comment_field, textarea[name="comment[body]"]';
|
|
5953
|
-
const urls = () => page.evaluate((sel) => [...(document.querySelector(sel)?.value ?? "").matchAll(/https:\\/\\/github\\.com\\/user-attachments\\/assets\\/[0-9a-fA-F-]+/g)].map((m) => m[0]), BOX);
|
|
5954
|
-
const clear = () => page.evaluate((sel) => { const t = document.querySelector(sel); if (t) { t.value = ""; t.dispatchEvent(new Event("input", { bubbles: true })); } }, BOX);
|
|
5955
|
-
try {
|
|
5956
|
-
await page.goto(${JSON.stringify(prUrl)}, { timeout: 60000 });
|
|
5957
|
-
await page.waitForFunction((sel) => !!document.querySelector(sel), BOX, { timeout: 30000 });
|
|
5958
|
-
await clear();
|
|
5959
|
-
const out = {};
|
|
5960
|
-
for (const file of ${JSON.stringify(files)}) {
|
|
5961
|
-
const before = (await urls()).length;
|
|
5962
|
-
const chooser = page.waitForFileChooser({ timeout: 10000 });
|
|
5963
|
-
await page.click('loc=role:button[name*="Paste, drop, or click"]', { label: "attach a file to the comment box" });
|
|
5964
|
-
await (await chooser).setFiles(file);
|
|
5965
|
-
let found = [];
|
|
5966
|
-
for (let i = 0; i < 120 && found.length <= before; i++) { await page.waitForTimeout(500); found = await urls(); }
|
|
5967
|
-
if (found.length <= before) throw new Error("no attachment URL for " + file);
|
|
5968
|
-
out[file] = found[found.length - 1];
|
|
5969
|
-
}
|
|
5970
|
-
await clear();
|
|
5971
|
-
console.log("UPLOADED " + JSON.stringify(out));
|
|
5972
|
-
} finally {
|
|
5973
|
-
await page.close().catch(() => {});
|
|
5974
|
-
}
|
|
5975
|
-
`;
|
|
5976
|
-
var Uploaded = Schema24.Record(Schema24.String, Schema24.String);
|
|
5953
|
+
var embedVideos = (markdown) => markdown.replace(VIDEO_LINE, "");
|
|
5977
5954
|
var publish = Effect31.fn("publish")(function* (o) {
|
|
5978
5955
|
const fs = yield* FileSystem11.FileSystem;
|
|
5979
5956
|
const path = yield* Path10.Path;
|
|
@@ -5985,13 +5962,18 @@ var publish = Effect31.fn("publish")(function* (o) {
|
|
|
5985
5962
|
);
|
|
5986
5963
|
const report2 = path.resolve(o.report);
|
|
5987
5964
|
const base = path.dirname(report2);
|
|
5988
|
-
|
|
5965
|
+
const md = embedVideos(yield* fs.readFileString(report2));
|
|
5989
5966
|
const files = referencedMedia(md).map((ref) => ({ abs: path.join(base, ref), ref }));
|
|
5990
5967
|
for (const f of files) {
|
|
5991
5968
|
if (!(yield* fs.exists(f.abs))) {
|
|
5992
5969
|
return yield* new PublishError({ message: `report references a missing file: ${f.ref}` });
|
|
5993
5970
|
}
|
|
5994
5971
|
}
|
|
5972
|
+
if (files.length > MAX_ATTACH) {
|
|
5973
|
+
return yield* new PublishError({
|
|
5974
|
+
message: `gh attaches at most ${MAX_ATTACH} files; the report has ${files.length}`
|
|
5975
|
+
});
|
|
5976
|
+
}
|
|
5995
5977
|
let mode = o.mode;
|
|
5996
5978
|
if (mode === "auto") {
|
|
5997
5979
|
const author = yield* gh(["pr", "view", o.pr, "--json", "author", "-q", ".author.login"]);
|
|
@@ -6001,70 +5983,37 @@ var publish = Effect31.fn("publish")(function* (o) {
|
|
|
6001
5983
|
}
|
|
6002
5984
|
if (o.dryRun) {
|
|
6003
5985
|
return yield* Console3.log(
|
|
6004
|
-
`dry run: would
|
|
5986
|
+
`dry run: would attach ${files.length} file(s) and update the ${mode}:
|
|
6005
5987
|
${files.map((f) => ` ${f.ref}`).join("\n")}`
|
|
6006
5988
|
);
|
|
6007
5989
|
}
|
|
6008
|
-
const
|
|
6009
|
-
let urls = (yield* fs.exists(cache)) ? yield* Schema24.decodeUnknownEffect(Schema24.fromJsonString(Uploaded))(yield* fs.readFileString(cache)) : {};
|
|
6010
|
-
const todo = files.filter((f) => !urls[f.abs]);
|
|
6011
|
-
if (todo.length) {
|
|
6012
|
-
if (Option24.isNone(o.egoSpace)) {
|
|
6013
|
-
return yield* new PublishError({
|
|
6014
|
-
message: "--ego-space <id> is required to upload (an Ego task space signed in to GitHub)"
|
|
6015
|
-
});
|
|
6016
|
-
}
|
|
6017
|
-
const prUrl = yield* gh(["pr", "view", o.pr, "--json", "url", "-q", ".url"]);
|
|
6018
|
-
const script = uploadScript(
|
|
6019
|
-
o.egoSpace.value,
|
|
6020
|
-
prUrl,
|
|
6021
|
-
todo.map((f) => f.abs)
|
|
6022
|
-
);
|
|
6023
|
-
const output = yield* spawner.string(
|
|
6024
|
-
ChildProcess8.make("ego-browser", ["nodejs"], {
|
|
6025
|
-
stdin: { stream: Stream6.make(new TextEncoder().encode(script)) }
|
|
6026
|
-
})
|
|
6027
|
-
).pipe(Effect31.mapError((e) => new PublishError({ message: `ego-browser: ${e.message}` })));
|
|
6028
|
-
const line = output.split("\n").find((l) => l.startsWith("UPLOADED "));
|
|
6029
|
-
if (!line) {
|
|
6030
|
-
return yield* new PublishError({ message: `upload produced no URLs:
|
|
6031
|
-
${output.slice(-1500)}` });
|
|
6032
|
-
}
|
|
6033
|
-
urls = {
|
|
6034
|
-
...urls,
|
|
6035
|
-
...yield* Schema24.decodeUnknownEffect(Schema24.fromJsonString(Uploaded))(line.slice("UPLOADED ".length))
|
|
6036
|
-
};
|
|
6037
|
-
yield* fs.writeFileString(cache, JSON.stringify(urls, null, 2));
|
|
6038
|
-
}
|
|
6039
|
-
for (const f of files) {
|
|
6040
|
-
md = md.split(f.ref).join(urls[f.abs] ?? f.ref);
|
|
6041
|
-
}
|
|
6042
|
-
const section = path.join(base, "pr-section.md");
|
|
6043
|
-
yield* fs.writeFileString(section, md);
|
|
5990
|
+
const attach = files.flatMap((f) => ["--attach", f.abs]);
|
|
6044
5991
|
if (mode === "comment") {
|
|
6045
|
-
|
|
5992
|
+
const section = path.join(base, "pr-section.md");
|
|
5993
|
+
yield* fs.writeFileString(section, md);
|
|
5994
|
+
yield* gh(["pr", "comment", o.pr, "--body-file", section, ...attach]);
|
|
6046
5995
|
return yield* Console3.log(`commented on PR #${o.pr}`);
|
|
6047
5996
|
}
|
|
6048
5997
|
const before = yield* gh(["pr", "view", o.pr, "--json", "body", "-q", ".body"]);
|
|
6049
5998
|
yield* fs.writeFileString(path.join(base, "pr-body.before.md"), before);
|
|
6050
5999
|
yield* fs.writeFileString(path.join(base, "pr-body.after.md"), placeSection(before, md));
|
|
6051
|
-
yield* gh(["pr", "edit", o.pr, "--body-file", path.join(base, "pr-body.after.md")]);
|
|
6000
|
+
yield* gh(["pr", "edit", o.pr, "--body-file", path.join(base, "pr-body.after.md"), ...attach]);
|
|
6052
6001
|
yield* Console3.log(`updated the description of PR #${o.pr} (previous body in pr-body.before.md)`);
|
|
6053
6002
|
});
|
|
6054
6003
|
|
|
6055
6004
|
// src/report.ts
|
|
6056
|
-
import { Effect as Effect32, FileSystem as FileSystem12, Option as
|
|
6005
|
+
import { Effect as Effect32, FileSystem as FileSystem12, Option as Option24, Path as Path11, Schema as Schema25 } from "effect";
|
|
6057
6006
|
var ReportError = class extends Schema25.TaggedError()("ReportError", { message: Schema25.String }) {
|
|
6058
6007
|
};
|
|
6059
6008
|
var noReportOptions = {
|
|
6060
|
-
intro:
|
|
6009
|
+
intro: Option24.none(),
|
|
6061
6010
|
notes: [],
|
|
6062
|
-
pr:
|
|
6063
|
-
preview:
|
|
6064
|
-
repo:
|
|
6065
|
-
title:
|
|
6011
|
+
pr: Option24.none(),
|
|
6012
|
+
preview: Option24.none(),
|
|
6013
|
+
repo: Option24.none(),
|
|
6014
|
+
title: Option24.none()
|
|
6066
6015
|
};
|
|
6067
|
-
var nonEmpty = (s) => s ?
|
|
6016
|
+
var nonEmpty = (s) => s ? Option24.some(s) : Option24.none();
|
|
6068
6017
|
var sectionOf = Effect32.fnUntraced(function* (run2, label, media) {
|
|
6069
6018
|
const path = yield* Path11.Path;
|
|
6070
6019
|
if (!isVerdict(run2.result)) {
|
|
@@ -6077,18 +6026,18 @@ var sectionOf = Effect32.fnUntraced(function* (run2, label, media) {
|
|
|
6077
6026
|
const cut = yield* readRenderedCut(run2.dir).pipe(Effect32.mapError((e) => new ReportError({ message: e.message })));
|
|
6078
6027
|
return new ReportSection({
|
|
6079
6028
|
label,
|
|
6080
|
-
seek:
|
|
6029
|
+
seek: Option24.match(cut, { onNone: () => ({}), onSome: (c) => c.seek }),
|
|
6081
6030
|
sha: run2.info.sha,
|
|
6082
6031
|
stills: evidenceStills(run2).map(
|
|
6083
6032
|
(s) => new ReportStill({ ...s, file: add(s.file, `${label}-${path.basename(s.file)}`) })
|
|
6084
6033
|
),
|
|
6085
6034
|
verdict: run2.result,
|
|
6086
|
-
...
|
|
6035
|
+
...Option24.match(run2.media.polished, {
|
|
6087
6036
|
onNone: () => ({}),
|
|
6088
6037
|
onSome: (f) => ({ video: add(f, `${label}-video.mp4`) })
|
|
6089
6038
|
}),
|
|
6090
|
-
...
|
|
6091
|
-
...
|
|
6039
|
+
...Option24.match(run2.media.gif, { onNone: () => ({}), onSome: (f) => ({ gif: add(f, `${label}-preview.gif`) }) }),
|
|
6040
|
+
...Option24.match(run2.media.captions, {
|
|
6092
6041
|
onNone: () => ({}),
|
|
6093
6042
|
onSome: (f) => ({ captions: add(f, `${label}-captions.vtt`) })
|
|
6094
6043
|
})
|
|
@@ -6100,31 +6049,31 @@ var buildReport = Effect32.fn("buildReport")(function* (pair, o) {
|
|
|
6100
6049
|
const sides = pairSides(pair);
|
|
6101
6050
|
const sections = yield* Effect32.forEach([...sides].reverse(), (s) => sectionOf(s.run, s.label, media));
|
|
6102
6051
|
const after = pair.after;
|
|
6103
|
-
const walks = sides.flatMap((s) =>
|
|
6052
|
+
const walks = sides.flatMap((s) => Option24.toArray(s.run.walk)).reverse();
|
|
6104
6053
|
const shortSha = (r) => r.info.sha.slice(0, 7);
|
|
6105
|
-
const defaultPreview =
|
|
6054
|
+
const defaultPreview = Option24.match(pair.before, {
|
|
6106
6055
|
onNone: () => `production build of \`${shortSha(after)}\` in a fresh Witness computer (run \`${path.basename(after.dir)}\`).`,
|
|
6107
6056
|
onSome: (b) => `before = ${shortSha(b)}; after = ${shortSha(after)}`
|
|
6108
6057
|
});
|
|
6109
|
-
const verdictNotes =
|
|
6058
|
+
const verdictNotes = Option24.isNone(after.walk) && isVerdict(after.result) ? Option24.toArray(nonEmpty(after.result.notes)) : [];
|
|
6110
6059
|
const manifest = new ReportManifest({
|
|
6111
6060
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6112
|
-
intro:
|
|
6061
|
+
intro: Option24.getOrElse(o.intro, () => Option24.match(after.walk, { onNone: () => "", onSome: (w) => w.intro })),
|
|
6113
6062
|
notes: [.../* @__PURE__ */ new Set([...walks.flatMap((w) => w.notes), ...verdictNotes, ...pair.notes, ...o.notes])],
|
|
6114
|
-
preview:
|
|
6115
|
-
|
|
6063
|
+
preview: Option24.getOrElse(
|
|
6064
|
+
Option24.orElse(o.preview, () => Option24.firstSomeOf(walks.map((w) => nonEmpty(w.preview)))),
|
|
6116
6065
|
() => defaultPreview
|
|
6117
6066
|
),
|
|
6118
6067
|
sections: [sections[0], ...sections.slice(1)],
|
|
6119
|
-
title:
|
|
6120
|
-
...
|
|
6121
|
-
|
|
6068
|
+
title: Option24.getOrElse(o.title, () => reportTitle(after.info.task)),
|
|
6069
|
+
...Option24.match(
|
|
6070
|
+
Option24.orElse(o.repo, () => Option24.some(path.basename(after.info.repo))),
|
|
6122
6071
|
{
|
|
6123
6072
|
onNone: () => ({}),
|
|
6124
6073
|
onSome: (repo) => ({ repo })
|
|
6125
6074
|
}
|
|
6126
6075
|
),
|
|
6127
|
-
...
|
|
6076
|
+
...Option24.match(o.pr, { onNone: () => ({}), onSome: (pr) => ({ pr }) })
|
|
6128
6077
|
});
|
|
6129
6078
|
return { manifest, media };
|
|
6130
6079
|
});
|
|
@@ -6227,7 +6176,7 @@ var writeReport = Effect32.fn("writeReport")(function* (pair, outDir, o) {
|
|
|
6227
6176
|
});
|
|
6228
6177
|
|
|
6229
6178
|
// src/runs.ts
|
|
6230
|
-
import { Effect as Effect33, FileSystem as FileSystem13, Option as
|
|
6179
|
+
import { Effect as Effect33, FileSystem as FileSystem13, Option as Option25, Path as Path12 } from "effect";
|
|
6231
6180
|
import { Flag } from "effect/cli";
|
|
6232
6181
|
var runsDirFlag = Flag.String("runs-dir").pipe(
|
|
6233
6182
|
Flag.withDescription("Where run folders are (default: .witness/runs at the current git root)"),
|
|
@@ -6238,7 +6187,7 @@ var witnessHome = Effect33.fnUntraced(function* (dir) {
|
|
|
6238
6187
|
const path = yield* Path12.Path;
|
|
6239
6188
|
const root = yield* Git.use((g) => g.toplevel(dir)).pipe(Effect33.option);
|
|
6240
6189
|
const home = path.join(
|
|
6241
|
-
|
|
6190
|
+
Option25.getOrElse(root, () => dir),
|
|
6242
6191
|
".witness"
|
|
6243
6192
|
);
|
|
6244
6193
|
yield* fs.makeDirectory(home, { recursive: true });
|
|
@@ -6250,7 +6199,7 @@ var witnessHome = Effect33.fnUntraced(function* (dir) {
|
|
|
6250
6199
|
});
|
|
6251
6200
|
var runsDirFor = Effect33.fnUntraced(function* (flag) {
|
|
6252
6201
|
const path = yield* Path12.Path;
|
|
6253
|
-
if (
|
|
6202
|
+
if (Option25.isSome(flag)) {
|
|
6254
6203
|
return path.resolve(flag.value);
|
|
6255
6204
|
}
|
|
6256
6205
|
return path.join(yield* witnessHome(path.resolve(".")), "runs");
|
|
@@ -6266,12 +6215,12 @@ import {
|
|
|
6266
6215
|
Deferred,
|
|
6267
6216
|
Effect as Effect36,
|
|
6268
6217
|
FileSystem as FileSystem14,
|
|
6269
|
-
Option as
|
|
6218
|
+
Option as Option28,
|
|
6270
6219
|
Path as Path13,
|
|
6271
6220
|
Ref as Ref6,
|
|
6272
6221
|
Schema as Schema27,
|
|
6273
6222
|
Semaphore,
|
|
6274
|
-
Stream as
|
|
6223
|
+
Stream as Stream6,
|
|
6275
6224
|
SubscriptionRef
|
|
6276
6225
|
} from "effect";
|
|
6277
6226
|
import {
|
|
@@ -6284,7 +6233,7 @@ import {
|
|
|
6284
6233
|
} from "effect/http";
|
|
6285
6234
|
|
|
6286
6235
|
// src/session-actions.ts
|
|
6287
|
-
import { Effect as Effect34, Option as
|
|
6236
|
+
import { Effect as Effect34, Option as Option26, Schema as Schema26 } from "effect";
|
|
6288
6237
|
var bad = (message) => Effect34.fail(new ActionFailed({ message }));
|
|
6289
6238
|
var need = (action, args, i, name) => args[i] === void 0 ? bad(`${action}: missing <${name}>`) : Effect34.succeed(args[i]);
|
|
6290
6239
|
var int2 = (action, args, i, name) => need(action, args, i, name).pipe(
|
|
@@ -6305,14 +6254,14 @@ var ACTION_SPECS = {
|
|
|
6305
6254
|
const x = yield* int2("click", args, 0, "x");
|
|
6306
6255
|
const y = yield* int2("click", args, 1, "y");
|
|
6307
6256
|
return [
|
|
6308
|
-
ToolCall.Click({ button: "click", label:
|
|
6257
|
+
ToolCall.Click({ button: "click", label: Option26.getOrElse(label, () => `Click at (${x}, ${y})`), x, y })
|
|
6309
6258
|
];
|
|
6310
6259
|
}),
|
|
6311
6260
|
usage: "click <x> <y>"
|
|
6312
6261
|
},
|
|
6313
6262
|
"click-ref": {
|
|
6314
6263
|
parse: (args, label) => need("click-ref", args, 0, "ref").pipe(
|
|
6315
|
-
Effect34.map((ref) => [ToolCall.ClickRef({ label:
|
|
6264
|
+
Effect34.map((ref) => [ToolCall.ClickRef({ label: Option26.getOrElse(label, () => ""), ref })])
|
|
6316
6265
|
),
|
|
6317
6266
|
usage: "click-ref <ref>"
|
|
6318
6267
|
},
|
|
@@ -6320,7 +6269,7 @@ var ACTION_SPECS = {
|
|
|
6320
6269
|
parse: (args, label) => text2(
|
|
6321
6270
|
"click-text",
|
|
6322
6271
|
"text",
|
|
6323
|
-
(t) => ToolCall.ClickText({ label:
|
|
6272
|
+
(t) => ToolCall.ClickText({ label: Option26.getOrElse(label, () => `Click "${t.slice(0, 40)}"`), text: t })
|
|
6324
6273
|
)(args, label),
|
|
6325
6274
|
usage: "click-text <text>"
|
|
6326
6275
|
},
|
|
@@ -6351,7 +6300,7 @@ var ACTION_SPECS = {
|
|
|
6351
6300
|
if (!notes) {
|
|
6352
6301
|
return yield* bad("end: missing <notes> (what you did and saw)");
|
|
6353
6302
|
}
|
|
6354
|
-
return [ToolCall.End({ forced:
|
|
6303
|
+
return [ToolCall.End({ forced: Option26.none(), id, notes, status })];
|
|
6355
6304
|
}),
|
|
6356
6305
|
usage: "end <id> pass|fail|blocked <notes>"
|
|
6357
6306
|
},
|
|
@@ -6360,7 +6309,7 @@ var ACTION_SPECS = {
|
|
|
6360
6309
|
intro: { parse: text2("intro", "line", (line) => ToolCall.Intro({ line })), usage: "intro <line>" },
|
|
6361
6310
|
key: {
|
|
6362
6311
|
parse: (args, label) => need("key", args, 0, "combo").pipe(
|
|
6363
|
-
Effect34.map((combo) => [ToolCall.Key({ combo, label:
|
|
6312
|
+
Effect34.map((combo) => [ToolCall.Key({ combo, label: Option26.getOrElse(label, () => `Press ${combo}`) })])
|
|
6364
6313
|
),
|
|
6365
6314
|
usage: "key <combo>"
|
|
6366
6315
|
},
|
|
@@ -6370,7 +6319,7 @@ var ACTION_SPECS = {
|
|
|
6370
6319
|
},
|
|
6371
6320
|
navigate: {
|
|
6372
6321
|
parse: (args, label) => need("navigate", args, 0, "url").pipe(
|
|
6373
|
-
Effect34.map((url) => [ToolCall.Navigate({ label:
|
|
6322
|
+
Effect34.map((url) => [ToolCall.Navigate({ label: Option26.getOrElse(label, () => `Open ${url}`), url })])
|
|
6374
6323
|
),
|
|
6375
6324
|
usage: "navigate <url>"
|
|
6376
6325
|
},
|
|
@@ -6379,9 +6328,9 @@ var ACTION_SPECS = {
|
|
|
6379
6328
|
scroll: {
|
|
6380
6329
|
parse: (args, label) => Effect34.gen(function* () {
|
|
6381
6330
|
const dy = yield* int2("scroll", args, 0, "dy");
|
|
6382
|
-
const at = args.length >= 3 ?
|
|
6331
|
+
const at = args.length >= 3 ? Option26.some({ x: yield* int2("scroll", args, 1, "x"), y: yield* int2("scroll", args, 2, "y") }) : Option26.none();
|
|
6383
6332
|
return [
|
|
6384
|
-
ToolCall.Scroll({ at, dy, label:
|
|
6333
|
+
ToolCall.Scroll({ at, dy, label: Option26.getOrElse(label, () => dy > 0 ? "Scroll down" : "Scroll up") })
|
|
6385
6334
|
];
|
|
6386
6335
|
}),
|
|
6387
6336
|
usage: "scroll <dy> [x y]"
|
|
@@ -6401,12 +6350,12 @@ var ACTION_SPECS = {
|
|
|
6401
6350
|
},
|
|
6402
6351
|
type: {
|
|
6403
6352
|
parse: (args, label) => one(
|
|
6404
|
-
ToolCall.Type({ label:
|
|
6353
|
+
ToolCall.Type({ label: Option26.getOrElse(label, () => `Type "${rest(args).slice(0, 30)}"`), text: rest(args) })
|
|
6405
6354
|
),
|
|
6406
6355
|
usage: "type <text>"
|
|
6407
6356
|
},
|
|
6408
6357
|
"type-secret": {
|
|
6409
|
-
parse: (_args, label) => one(ToolCall.TypeSecret({ label:
|
|
6358
|
+
parse: (_args, label) => one(ToolCall.TypeSecret({ label: Option26.getOrElse(label, () => "Type the password") })),
|
|
6410
6359
|
usage: "type-secret"
|
|
6411
6360
|
},
|
|
6412
6361
|
wait: {
|
|
@@ -6417,7 +6366,7 @@ var ACTION_SPECS = {
|
|
|
6417
6366
|
var ACTIONS = Object.keys(ACTION_SPECS);
|
|
6418
6367
|
|
|
6419
6368
|
// src/verdict-text.ts
|
|
6420
|
-
import { Console as Console4, Effect as Effect35, Option as
|
|
6369
|
+
import { Console as Console4, Effect as Effect35, Option as Option27 } from "effect";
|
|
6421
6370
|
var printVerdict = Effect35.fnUntraced(function* (heading, v) {
|
|
6422
6371
|
if (!isVerdict(v)) {
|
|
6423
6372
|
yield* Console4.log(`${heading}BLOCKED (${v.reason}): ${v.notes}`);
|
|
@@ -6431,7 +6380,7 @@ ${v.log_tail}`);
|
|
|
6431
6380
|
${heading}${v.overall.toUpperCase()}`);
|
|
6432
6381
|
for (const c of v.criteria) {
|
|
6433
6382
|
yield* Console4.log(
|
|
6434
|
-
` ${c.id} ${c.status.padEnd(7)} ${c.description}${
|
|
6383
|
+
` ${c.id} ${c.status.padEnd(7)} ${c.description}${Option27.match(c.video_ts, { onNone: () => "", onSome: ([a, b]) => ` [${a}s-${b}s]` })}`
|
|
6435
6384
|
);
|
|
6436
6385
|
}
|
|
6437
6386
|
if (v.usage.usd > 0) {
|
|
@@ -6473,10 +6422,10 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6473
6422
|
const fs = yield* FileSystem14.FileSystem;
|
|
6474
6423
|
const path = yield* Path13.Path;
|
|
6475
6424
|
const status = yield* SubscriptionRef.make({ _tag: "Booting", seq: 0 });
|
|
6476
|
-
const current = yield* Ref6.make(
|
|
6425
|
+
const current = yield* Ref6.make(Option28.none());
|
|
6477
6426
|
const lock = yield* Semaphore.make(1);
|
|
6478
6427
|
const shotNo = yield* Ref6.make(0);
|
|
6479
|
-
const humanSince = yield* Ref6.make(
|
|
6428
|
+
const humanSince = yield* Ref6.make(Option28.none());
|
|
6480
6429
|
const setStatus = (next) => SubscriptionRef.update(status, (s) => next(s.seq + 1));
|
|
6481
6430
|
const look = (data) => Effect36.gen(function* () {
|
|
6482
6431
|
const n = yield* Ref6.updateAndGet(shotNo, (x) => x + 1);
|
|
@@ -6487,13 +6436,13 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6487
6436
|
return file;
|
|
6488
6437
|
});
|
|
6489
6438
|
const act2 = (req) => Effect36.gen(function* () {
|
|
6490
|
-
if (
|
|
6439
|
+
if (Option28.isSome(yield* Ref6.get(humanSince))) {
|
|
6491
6440
|
return yield* bad(
|
|
6492
6441
|
"a person has taken over the computer in the live view; wait until they hand it back, then `witness act shot` to see where they left it"
|
|
6493
6442
|
);
|
|
6494
6443
|
}
|
|
6495
6444
|
const side = yield* Ref6.get(current);
|
|
6496
|
-
if (
|
|
6445
|
+
if (Option28.isNone(side)) {
|
|
6497
6446
|
return yield* bad("no side is ready yet (the app is booting); try again in a moment");
|
|
6498
6447
|
}
|
|
6499
6448
|
const { done, lastAt, recorder } = side.value;
|
|
@@ -6502,13 +6451,13 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6502
6451
|
yield* Deferred.succeed(done, void 0);
|
|
6503
6452
|
return { ok: true, text: "finishing" };
|
|
6504
6453
|
}
|
|
6505
|
-
const calls = yield* ACTION_SPECS[req.action].parse(req.args,
|
|
6454
|
+
const calls = yield* ACTION_SPECS[req.action].parse(req.args, Option28.fromUndefinedOr(req.label));
|
|
6506
6455
|
const texts = [];
|
|
6507
6456
|
let shot;
|
|
6508
6457
|
for (const call of calls) {
|
|
6509
6458
|
const r = yield* recorder.perform(call);
|
|
6510
6459
|
texts.push(r.text);
|
|
6511
|
-
if (
|
|
6460
|
+
if (Option28.isSome(r.screen)) {
|
|
6512
6461
|
shot = yield* look(r.screen.value.data).pipe(Effect36.mapError((e) => new ActionFailed({ message: e.message })));
|
|
6513
6462
|
}
|
|
6514
6463
|
}
|
|
@@ -6520,9 +6469,9 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6520
6469
|
);
|
|
6521
6470
|
const takeover = (human) => Effect36.gen(function* () {
|
|
6522
6471
|
const at = yield* Clock6.currentTimeMillis;
|
|
6523
|
-
const since = yield* Ref6.getAndSet(humanSince, human ?
|
|
6472
|
+
const since = yield* Ref6.getAndSet(humanSince, human ? Option28.some(at) : Option28.none());
|
|
6524
6473
|
const side = yield* Ref6.get(current);
|
|
6525
|
-
if (
|
|
6474
|
+
if (Option28.isNone(side) || Option28.isSome(since) === human) {
|
|
6526
6475
|
return;
|
|
6527
6476
|
}
|
|
6528
6477
|
yield* Ref6.set(side.value.lastAt, at);
|
|
@@ -6532,7 +6481,7 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6532
6481
|
return;
|
|
6533
6482
|
}
|
|
6534
6483
|
yield* recorder.perform(ToolCall.Caption({ label: "The person handed control back" }));
|
|
6535
|
-
const secs = Math.round((at -
|
|
6484
|
+
const secs = Math.round((at - Option28.getOrElse(since, () => at)) / 1e3);
|
|
6536
6485
|
yield* recorder.perform(
|
|
6537
6486
|
ToolCall.Note({
|
|
6538
6487
|
line: `A person took over the computer from the live view for ${secs} s; the steps between "A person took over the computer" and "The person handed control back" are theirs.`
|
|
@@ -6554,7 +6503,7 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6554
6503
|
return yield* unauthorized;
|
|
6555
6504
|
}
|
|
6556
6505
|
const body = yield* HttpServerRequest2.schemaBodyJson(ActRequest2).pipe(Effect36.option);
|
|
6557
|
-
return yield*
|
|
6506
|
+
return yield* Option28.match(body, {
|
|
6558
6507
|
onNone: () => HttpServerResponse2.json({ error: "bad request", ok: false }, { status: 400 }),
|
|
6559
6508
|
onSome: (b) => act2(b).pipe(Effect36.flatMap((r) => HttpServerResponse2.json(r)))
|
|
6560
6509
|
});
|
|
@@ -6573,11 +6522,11 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6573
6522
|
);
|
|
6574
6523
|
const since = query.since ?? -1;
|
|
6575
6524
|
const next = yield* SubscriptionRef.changes(status).pipe(
|
|
6576
|
-
|
|
6577
|
-
|
|
6525
|
+
Stream6.filter((s) => s.seq > since),
|
|
6526
|
+
Stream6.runHead,
|
|
6578
6527
|
Effect36.timeout("20 seconds"),
|
|
6579
|
-
Effect36.catchTag("TimeoutError", () => Effect36.succeed(
|
|
6580
|
-
Effect36.flatMap(
|
|
6528
|
+
Effect36.catchTag("TimeoutError", () => Effect36.succeed(Option28.none())),
|
|
6529
|
+
Effect36.flatMap(Option28.match({ onNone: () => SubscriptionRef.get(status), onSome: Effect36.succeed }))
|
|
6581
6530
|
);
|
|
6582
6531
|
return yield* HttpServerResponse2.json(Schema27.encodeSync(SessionStatus)(next));
|
|
6583
6532
|
}).pipe(Effect36.orDie)
|
|
@@ -6593,7 +6542,7 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6593
6542
|
const recorder = yield* Recorder;
|
|
6594
6543
|
const done = yield* Deferred.make();
|
|
6595
6544
|
const lastAt = yield* Ref6.make(yield* Clock6.currentTimeMillis);
|
|
6596
|
-
yield* Ref6.set(current,
|
|
6545
|
+
yield* Ref6.set(current, Option28.some({ done, lastAt, recorder }));
|
|
6597
6546
|
yield* setStatus((seq) => ({
|
|
6598
6547
|
_tag: "Ready",
|
|
6599
6548
|
carried: side.carried.map((c) => c.id),
|
|
@@ -6601,9 +6550,9 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6601
6550
|
screen: recorder.screenText,
|
|
6602
6551
|
seq,
|
|
6603
6552
|
sha: side.sha,
|
|
6604
|
-
side:
|
|
6553
|
+
side: Option28.getOrElse(side.state, () => "single")
|
|
6605
6554
|
}));
|
|
6606
|
-
yield* Console5.log(`session ready: ${
|
|
6555
|
+
yield* Console5.log(`session ready: ${runDir}`);
|
|
6607
6556
|
const idle = Effect36.gen(function* () {
|
|
6608
6557
|
for (; ; ) {
|
|
6609
6558
|
yield* Effect36.sleep("5 seconds");
|
|
@@ -6615,7 +6564,7 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6615
6564
|
yield* Effect36.raceFirst(Deferred.await(done), idle);
|
|
6616
6565
|
}).pipe(
|
|
6617
6566
|
Effect36.ensuring(
|
|
6618
|
-
Ref6.set(current,
|
|
6567
|
+
Ref6.set(current, Option28.none()).pipe(Effect36.andThen(setStatus((seq) => ({ _tag: "Booting", seq }))))
|
|
6619
6568
|
)
|
|
6620
6569
|
);
|
|
6621
6570
|
return {
|
|
@@ -6628,7 +6577,7 @@ var sessionHost = Effect36.fnUntraced(function* (runDir, idleMs) {
|
|
|
6628
6577
|
var findSession = Effect36.fnUntraced(function* (run2, runsDir) {
|
|
6629
6578
|
const fs = yield* FileSystem14.FileSystem;
|
|
6630
6579
|
const path = yield* Path13.Path;
|
|
6631
|
-
if (
|
|
6580
|
+
if (Option28.isSome(run2)) {
|
|
6632
6581
|
return path.resolve(run2.value);
|
|
6633
6582
|
}
|
|
6634
6583
|
const root = path.resolve(runsDir);
|
|
@@ -6707,14 +6656,14 @@ var followSession = Effect36.fnUntraced(function* (runDir, client, since, ended)
|
|
|
6707
6656
|
if (s._tag === "Booting") {
|
|
6708
6657
|
continue;
|
|
6709
6658
|
}
|
|
6710
|
-
if (
|
|
6659
|
+
if (Option28.isSome(ended)) {
|
|
6711
6660
|
yield* verdictIn(ended.value.runDir);
|
|
6712
6661
|
}
|
|
6713
6662
|
if (s._tag === "Ready") {
|
|
6714
6663
|
yield* Console5.log(readyText(s));
|
|
6715
6664
|
return 0;
|
|
6716
6665
|
}
|
|
6717
|
-
if (
|
|
6666
|
+
if (Option28.exists(ended, (e) => e.side !== "before")) {
|
|
6718
6667
|
return exitCodeOf(yield* requireRunFile(runDir, RUN_FILES.verdict, VerdictFile));
|
|
6719
6668
|
}
|
|
6720
6669
|
return yield* verdictIn(runDir);
|
|
@@ -6727,7 +6676,7 @@ var act = Effect36.fn("act")(function* (opts) {
|
|
|
6727
6676
|
const res = yield* client.act({
|
|
6728
6677
|
action: opts.action,
|
|
6729
6678
|
args: opts.args,
|
|
6730
|
-
...
|
|
6679
|
+
...Option28.match(opts.label, { onNone: () => ({}), onSome: (label) => ({ label }) })
|
|
6731
6680
|
});
|
|
6732
6681
|
if (!res.ok) {
|
|
6733
6682
|
yield* Console5.error(`error: ${res.error ?? "unknown"}`);
|
|
@@ -6742,8 +6691,8 @@ var act = Effect36.fn("act")(function* (opts) {
|
|
|
6742
6691
|
if (!before) {
|
|
6743
6692
|
return 0;
|
|
6744
6693
|
}
|
|
6745
|
-
const ended = before._tag === "Ready" ?
|
|
6746
|
-
if (
|
|
6694
|
+
const ended = before._tag === "Ready" ? Option28.some(before) : Option28.none();
|
|
6695
|
+
if (Option28.exists(ended, (e) => e.side === "before")) {
|
|
6747
6696
|
yield* Console5.log(`
|
|
6748
6697
|
recording the base commit, then booting the change (log: ${runDir}/session.log)`);
|
|
6749
6698
|
}
|
|
@@ -6789,19 +6738,19 @@ booting (log: ${logFile})`);
|
|
|
6789
6738
|
yield* Effect36.sleep("500 millis");
|
|
6790
6739
|
}
|
|
6791
6740
|
const client = yield* connect(dir);
|
|
6792
|
-
const watched = followSession(dir, client, 0,
|
|
6741
|
+
const watched = followSession(dir, client, 0, Option28.none()).pipe(
|
|
6793
6742
|
Effect36.raceFirst(Effect36.forever(follow.pipe(Effect36.andThen(Effect36.sleep("500 millis")))))
|
|
6794
6743
|
);
|
|
6795
6744
|
return yield* watched.pipe(Effect36.tap(() => follow));
|
|
6796
6745
|
});
|
|
6797
6746
|
|
|
6798
6747
|
// src/upload.ts
|
|
6799
|
-
import { Config as Config5, Console as Console6, Effect as Effect37, FileSystem as FileSystem15, Option as
|
|
6748
|
+
import { Config as Config5, Console as Console6, Effect as Effect37, FileSystem as FileSystem15, Option as Option29, Path as Path14, Redacted as Redacted3 } from "effect";
|
|
6800
6749
|
import { HttpClient as HttpClient4, HttpClientRequest as HttpClientRequest3 } from "effect/http";
|
|
6801
6750
|
import { HttpApiClient as HttpApiClient2, HttpApiMiddleware as HttpApiMiddleware3 } from "effect/http-api";
|
|
6802
6751
|
var warnAboutRender = Effect37.fnUntraced(function* (dir) {
|
|
6803
6752
|
const cut = yield* readRenderedCut(dir);
|
|
6804
|
-
if (
|
|
6753
|
+
if (Option29.isNone(cut)) {
|
|
6805
6754
|
yield* Console6.error(
|
|
6806
6755
|
`warning: ${dir} has no render/rendered.json (not rendered, or by an older witness), so the page cannot seek to each criterion; render it with \`witness render --layout hosted\``
|
|
6807
6756
|
);
|
|
@@ -6936,15 +6885,15 @@ var runModeOf = Effect38.fnUntraced(function* (f) {
|
|
|
6936
6885
|
const chosen = [
|
|
6937
6886
|
f.bootOnly && "--boot-only",
|
|
6938
6887
|
f.session && "--session",
|
|
6939
|
-
|
|
6888
|
+
Option30.isSome(f.walkthrough) && "--walkthrough"
|
|
6940
6889
|
];
|
|
6941
6890
|
if (chosen.filter(Boolean).length > 1) {
|
|
6942
6891
|
return yield* usage(`${chosen.filter(Boolean).join(" and ")} are different modes; pick one`);
|
|
6943
6892
|
}
|
|
6944
6893
|
const onlyFor = (flag, given, mode, ok) => given && !ok ? usage(`${flag} only applies to ${mode}`) : Effect38.void;
|
|
6945
|
-
yield* onlyFor("--slow-mo",
|
|
6946
|
-
yield* onlyFor("--spec-timeout",
|
|
6947
|
-
yield* onlyFor("--session-idle",
|
|
6894
|
+
yield* onlyFor("--slow-mo", Option30.isSome(f.slowMo), "--walkthrough", Option30.isSome(f.walkthrough));
|
|
6895
|
+
yield* onlyFor("--spec-timeout", Option30.isSome(f.specTimeout), "--walkthrough", Option30.isSome(f.walkthrough));
|
|
6896
|
+
yield* onlyFor("--session-idle", Option30.isSome(f.sessionIdle), "--session", f.session);
|
|
6948
6897
|
if (f.session && (f.keep || f.parallel)) {
|
|
6949
6898
|
return yield* usage(
|
|
6950
6899
|
"--session cannot be combined with --keep or --parallel (a session checks the base commit, then the change)"
|
|
@@ -6953,24 +6902,24 @@ var runModeOf = Effect38.fnUntraced(function* (f) {
|
|
|
6953
6902
|
if (f.bootOnly) {
|
|
6954
6903
|
return { _tag: "BootOnly" };
|
|
6955
6904
|
}
|
|
6956
|
-
const task =
|
|
6957
|
-
if (
|
|
6905
|
+
const task = Option30.orElse(f.task, () => f.taskFile);
|
|
6906
|
+
if (Option30.isNone(task)) {
|
|
6958
6907
|
return yield* usage("--task or --task-file is required (or --boot-only)");
|
|
6959
6908
|
}
|
|
6960
6909
|
if (f.session) {
|
|
6961
6910
|
return {
|
|
6962
6911
|
_tag: "Session",
|
|
6963
|
-
idleMs:
|
|
6912
|
+
idleMs: Option30.getOrElse(f.sessionIdle, () => 900) * 1e3,
|
|
6964
6913
|
task: task.value
|
|
6965
6914
|
};
|
|
6966
6915
|
}
|
|
6967
|
-
if (
|
|
6916
|
+
if (Option30.isSome(f.walkthrough)) {
|
|
6968
6917
|
return {
|
|
6969
6918
|
_tag: "Spec",
|
|
6970
6919
|
file: path.resolve(f.walkthrough.value),
|
|
6971
6920
|
options: {
|
|
6972
|
-
slowMo:
|
|
6973
|
-
timeoutMs:
|
|
6921
|
+
slowMo: Option30.getOrElse(f.slowMo, () => 400),
|
|
6922
|
+
timeoutMs: Option30.getOrElse(f.specTimeout, () => 900) * 1e3
|
|
6974
6923
|
},
|
|
6975
6924
|
task: task.value
|
|
6976
6925
|
};
|
|
@@ -7017,15 +6966,15 @@ var run = Command.make(
|
|
|
7017
6966
|
const path = yield* Path15.Path;
|
|
7018
6967
|
const mode = yield* runModeOf(f);
|
|
7019
6968
|
const runsDir = yield* runsDirFor(f.runsDir);
|
|
7020
|
-
const daemonRunId =
|
|
7021
|
-
if (mode._tag === "Session" &&
|
|
6969
|
+
const daemonRunId = Option30.fromUndefinedOr(process.env[DAEMON_ENV]);
|
|
6970
|
+
if (mode._tag === "Session" && Option30.isNone(daemonRunId)) {
|
|
7022
6971
|
return yield* setExit(yield* launchSession(runsDir));
|
|
7023
6972
|
}
|
|
7024
6973
|
yield* ComputerProvider.use((p) => p.cleanupOrphans).pipe(Effect38.ignore);
|
|
7025
6974
|
const prepared = mode._tag === "Session" ? yield* sessionHost(
|
|
7026
6975
|
path.resolve(
|
|
7027
6976
|
runsDir,
|
|
7028
|
-
|
|
6977
|
+
Option30.getOrElse(daemonRunId, () => "")
|
|
7029
6978
|
),
|
|
7030
6979
|
mode.idleMs
|
|
7031
6980
|
).pipe(
|
|
@@ -7036,7 +6985,7 @@ var run = Command.make(
|
|
|
7036
6985
|
}))
|
|
7037
6986
|
) : { finished: Effect38.void, mode: verifyModeOf(mode), takeover: void 0 };
|
|
7038
6987
|
const verifyMode = prepared.mode;
|
|
7039
|
-
const live = f.live ?
|
|
6988
|
+
const live = f.live ? Option30.some(yield* openLive(prepared.takeover)) : Option30.none();
|
|
7040
6989
|
const outcome2 = yield* verify({
|
|
7041
6990
|
base: f.base,
|
|
7042
6991
|
configPath: f.config,
|
|
@@ -7049,7 +6998,7 @@ var run = Command.make(
|
|
|
7049
6998
|
parallel: f.parallel,
|
|
7050
6999
|
ref: f.ref,
|
|
7051
7000
|
repo: f.repo,
|
|
7052
|
-
services:
|
|
7001
|
+
services: Option30.match(f.services, {
|
|
7053
7002
|
onNone: () => [],
|
|
7054
7003
|
onSome: (s) => s.split(",").map((x) => x.trim()).filter(Boolean)
|
|
7055
7004
|
}),
|
|
@@ -7059,17 +7008,17 @@ var run = Command.make(
|
|
|
7059
7008
|
Effect38.provide(
|
|
7060
7009
|
runLayer(
|
|
7061
7010
|
runsDir,
|
|
7062
|
-
|
|
7063
|
-
|
|
7011
|
+
Option30.getOrUndefined(daemonRunId),
|
|
7012
|
+
Option30.match(live, { onNone: () => void 0, onSome: (l) => l.publish })
|
|
7064
7013
|
).pipe(Layer11.provideMerge(modelFor(verifyMode)))
|
|
7065
7014
|
)
|
|
7066
7015
|
);
|
|
7067
7016
|
yield* prepared.finished;
|
|
7068
|
-
if (
|
|
7017
|
+
if (Option30.isSome(outcome2.before)) {
|
|
7069
7018
|
yield* printOutcome(outcome2.before.value, "before (base commit): ");
|
|
7070
7019
|
yield* Console7.log("");
|
|
7071
7020
|
}
|
|
7072
|
-
yield* printOutcome(outcome2,
|
|
7021
|
+
yield* printOutcome(outcome2, Option30.isSome(outcome2.before) ? "after (the change): " : "");
|
|
7073
7022
|
yield* Console7.log(`run dir: ${outcome2.runDir}`);
|
|
7074
7023
|
yield* setExit(exitCodeOfResult(outcome2.result));
|
|
7075
7024
|
}, Effect38.scoped)
|
|
@@ -7078,7 +7027,7 @@ var headerOf = (label, sides, flag) => {
|
|
|
7078
7027
|
if (sides === 1) {
|
|
7079
7028
|
return flag;
|
|
7080
7029
|
}
|
|
7081
|
-
return label === "after" ?
|
|
7030
|
+
return label === "after" ? Option30.orElse(flag, () => Option30.some(label)) : Option30.some(label);
|
|
7082
7031
|
};
|
|
7083
7032
|
var render = Command.make(
|
|
7084
7033
|
"render",
|
|
@@ -7107,15 +7056,15 @@ var render = Command.make(
|
|
|
7107
7056
|
for (const { label, run: side } of sides) {
|
|
7108
7057
|
const header = headerOf(label, sides.length, f.label);
|
|
7109
7058
|
const r = yield* renderRun(side.dir, {
|
|
7110
|
-
animate:
|
|
7111
|
-
label:
|
|
7112
|
-
layout:
|
|
7059
|
+
animate: Option30.getOrUndefined(f.animation),
|
|
7060
|
+
label: Option30.getOrUndefined(header),
|
|
7061
|
+
layout: Option30.getOrUndefined(f.layout)
|
|
7113
7062
|
});
|
|
7114
7063
|
yield* Console7.log(
|
|
7115
7064
|
[
|
|
7116
7065
|
`${r.polished} (${r.durationSec.toFixed(1)} s, ${r.layout} layout${r.animate ? "" : ", no animation"})`,
|
|
7117
7066
|
r.gif,
|
|
7118
|
-
...
|
|
7067
|
+
...Option30.toArray(r.captions)
|
|
7119
7068
|
].join("\n")
|
|
7120
7069
|
);
|
|
7121
7070
|
}
|
|
@@ -7153,7 +7102,7 @@ var compare = Command.make(
|
|
|
7153
7102
|
...noReportOptions,
|
|
7154
7103
|
bundle: true,
|
|
7155
7104
|
intro: f.intro,
|
|
7156
|
-
notes:
|
|
7105
|
+
notes: Option30.toArray(f.note),
|
|
7157
7106
|
preview: f.preview
|
|
7158
7107
|
})
|
|
7159
7108
|
);
|
|
@@ -7179,10 +7128,6 @@ var publishCmd = Command.make(
|
|
|
7179
7128
|
"publish",
|
|
7180
7129
|
{
|
|
7181
7130
|
dryRun: Flag2.Boolean("dry-run").pipe(Flag2.withDefault(false)),
|
|
7182
|
-
egoSpace: Flag2.String("ego-space").pipe(
|
|
7183
|
-
Flag2.withDescription("Ego task space signed in to GitHub (uploads media)"),
|
|
7184
|
-
Flag2.optional
|
|
7185
|
-
),
|
|
7186
7131
|
mode: Flag2.Literals("mode", ["auto", "description", "comment"]).pipe(Flag2.withDefault("auto")),
|
|
7187
7132
|
pr: Flag2.String("pr").pipe(Flag2.withDescription("PR number")),
|
|
7188
7133
|
repo: Flag2.String("repo").pipe(Flag2.withDefault(".")),
|
|
@@ -7207,7 +7152,7 @@ var uploadCmd = Command.make(
|
|
|
7207
7152
|
const pair = second === void 0 ? yield* loadRunPair(first) : yield* pairRuns(first, second);
|
|
7208
7153
|
yield* upload(pair, {
|
|
7209
7154
|
...noReportOptions,
|
|
7210
|
-
notes:
|
|
7155
|
+
notes: Option30.toArray(f.note),
|
|
7211
7156
|
pr: f.pr,
|
|
7212
7157
|
preview: f.preview,
|
|
7213
7158
|
repo: f.repoName,
|
|
@@ -7263,7 +7208,7 @@ var imageCmd = Command.make(
|
|
|
7263
7208
|
)
|
|
7264
7209
|
},
|
|
7265
7210
|
Effect38.fn(function* (f) {
|
|
7266
|
-
yield* buildImage(
|
|
7211
|
+
yield* buildImage(Option30.getOrUndefined(f.tag));
|
|
7267
7212
|
})
|
|
7268
7213
|
).pipe(Command.withDescription("Build the computer image runs boot (needs Docker)"));
|
|
7269
7214
|
var witness = Command.make("witness").pipe(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrevanzak/witness",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Independent, recorded QA for code changes: boots the app in a fresh Linux desktop, checks the change, and hands back a verdict, stills and video",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"qa",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@anthropic-ai/sdk": "0.135.0",
|
|
30
30
|
"@effect/platform-node": "4.0.5",
|
|
31
|
+
"@effect/platform-node-shared": "4.0.5",
|
|
31
32
|
"@remotion/bundler": "4.0.532",
|
|
32
33
|
"@remotion/google-fonts": "4.0.532",
|
|
33
34
|
"@remotion/renderer": "4.0.532",
|