Skip to main content

@flow-state-dev/harness-manager/browser

Interfaces​

ReviewCheck​

One check the phase ran: the shape of commandCheck's result, spelled here so this file imports nothing.

Properties​

command​
command: string;
durationMs​
durationMs: number;
exitCode​
exitCode: number | null;
skipped​
skipped: boolean;
tail​
tail: string;
timedOut​
timedOut: boolean;

ReviewDetail​

A coding run's review: what it committed, and what the judge said. null where the record had nothing readable.

Properties​

added?​
added?: number | null;

Lines added across every file; null when unread.

answer?​
answer?: string | null;

The run's own summary of what it did and why: its final message.

branch​
branch: string | null;

The run's branch.

checks​
checks: ReviewCheck[] | null;

The checks the phase ran before stopping for review (commandCheck), in order: each command, how it ended and the end of its output. null when none ran.

commits​
commits: number | null;

How many commits it made over its base; null when git couldn't count them.

fileCount?​
fileCount?: number | null;

How many files changed, listed or not; null when unread.

files?​
files?: ReviewFile[] | null;

Each file the run changed and its lines; null when they couldn't be read.

goal?​
goal?: string | null;

What was asked: the task's goal. The reader always sets this and the fields below; optional so a review built by hand (a test double) needn't.

judge​
judge:
| {
confidence: number;
reason: string;
verdict: string;
}
| null;

The judge's verdict on the run, or null when no judge read it.

landAttempts?​
landAttempts?: object[];

Every try of the last landing, oldest first: the person's, and each one after a step of the coding session fixing what stopped it. Empty when none failed. Optional, as lands is.

land​
land: ReviewLand;
message​
message: string;
landFailed?​
landFailed?:
| {
land: ReviewLand;
message: string;
}
| null;

The last landing that failed, when the review is asked again for a retry; null otherwise.

lands?​
lands?: ReviewLand[];

The ways an accept can land the run's work on this host: pull-request and merge, sent as the accept's land. Empty when the host can't land, and then a plain accept is the only one. The reader always sets it; optional so a review built by hand (a test double) needn't.

openPullRequest?​
openPullRequest?: ReviewPullRequest | null;

The pull request already open from the run's branch, which a pull-request accept puts the work on rather than opening a second one. null when none is open, or GitHub couldn't say. Optional, as lands is.

pullRequests?​
pullRequests?: ReviewPullRequest[];

The task's pull requests, oldest first: where a person looks at the work.

removed?​
removed?: number | null;

Lines removed across every file; null when unread.

round?​
round?:
| {
commits: number;
subjects: string[];
}
| null;

This round's commits, when the branch had commits before it: how many and their subjects, newest first. null when the round is the whole branch, or they couldn't be read.

subjects​
subjects: string[];

Its commit subjects, newest first.


ReviewFile​

One file the run changed. added/removed are null for a binary file.

Properties​

added​
added: number | null;
path​
path: string;
removed​
removed: number | null;

ReviewPullRequest​

A pull request the task's work is on.

Properties​

number​
number: number;
url​
url: string;

Type Aliases​

CodingBoardTask​

type CodingBoardTask = z.infer<typeof codingTaskSchema>;

One task of the coding board.


CodingBoardView​

type CodingBoardView = ReturnType<typeof codingBoardView>;

The coding board view, as codingBoardView builds it. Import as a type in client code.


FileTouch​

type FileTouch = object;

One path the run's file tools touched. applied is how many of those operations the harness confirmed landed: 0 when every attempt failed, so a view can tell an edit from a try. null on a row recorded before the count was kept.

Properties​

applied​
applied: number | null;
kind​
kind: "created" | "edited" | null;
path​
path: string;

LandedWork​

type LandedWork = z.infer<typeof landedWorkSchema>;

Where an accepted run's work went.


OpenedPullRequest​

type OpenedPullRequest = object;

One pull request the run opened, or found on its branch.

Properties​

number​
number: number | null;
repository​
repository: string | null;
source​
source: "tool" | "branch" | null;
state​
state: string | null;
title​
title: string | null;
url​
url: string;

PlanStep​

type PlanStep = object;

One step of the plan the run recorded.

Properties​

id​
id: string;
status​
status: string | null;
title​
title: string;

RecordedRun​

type RecordedRun = object;

The run to read: the session it ran in and the request that was the run.

Properties​

requestId​
requestId: string;
sessionId​
sessionId: string;

RecordedWork​

type RecordedWork = object;

What a run recorded, per section: its rows, null when the harness records none.

Properties​

files​
files:
| {
rows: FileTouch[];
truncated: boolean;
}
| null;
plan​
plan:
| {
rows: PlanStep[];
truncated: boolean;
}
| null;
pullRequests​
pullRequests:
| {
rows: OpenedPullRequest[];
truncated: boolean;
}
| null;

RecordedWorkClient​

type RecordedWorkClient = object;

The two resource reads this module makes: any Client from @flow-state-dev/client fits.

Properties​

resources​
resources: Pick<ResourcesApi, "getResourceManifest" | "listCollectionResources">;

RecordedWorkView​

type RecordedWorkView = ReturnType<typeof recordedWorkView>;

The recorded work view, as recordedWorkView builds it. Import as a type in client code.


ReviewLand​

type ReviewLand = "pull-request" | "merge";

A way an accept lands a run's work: push and open a pull request, or merge into the person's checkout.

Variables​

CODER_FLOW​

const CODER_FLOW: "coder" = "coder";

The coding worker flow's name, in a leaf module so a page (through ./browser) and the harness kit spell it once: a coding worker's WORKER.md names it in its flow: line.


codingBoardViewRef​

const codingBoardViewRef: () => ViewRef;

A conversation's coding board: useView(codingBoardViewRef(), { sessionId }), at user scope.

Returns​

ViewRef


recordedWorkViewRef​

const recordedWorkViewRef: (flow?) => ViewRef;

A run's plan and pull requests, a session view on the coding worker flow: useView(recordedWorkViewRef(), { requestId }, { sessionId }).

Parameters​

flow?​

string

Returns​

ViewRef


runChangesViewRef​

const runChangesViewRef: (flow?) => ViewRef;

What a run changed, a session view on the coding worker flow (harness-manager's harnessRunChangesView): client.view(runChangesViewRef(), { path }, { sessionId }) answers one file's patch.

Parameters​

flow?​

string

Returns​

ViewRef

Functions​

harnessReadinessViewRef()​

function harnessReadinessViewRef(flow, view?): ViewRef<HarnessReadinessViewDefinition>;

The readiness view a host installed on flow as views: { [view]: harnessReadinessView(readiness) }, for client.view(ref, { refresh }) or useView(ref).

Parameters​

flow​

string

The flow the host installed the view on.

view?​

string

The view's name in that flow's views. Default "readiness".

Returns​

ViewRef<HarnessReadinessViewDefinition>


harnessUsageViewRef()​

function harnessUsageViewRef(): ViewRef<HarnessUsageViewDefinition>;

The usage view, for client.view(ref, {}) or useView(ref). Its answer is { harnesses }.

Returns​

ViewRef<HarnessUsageViewDefinition>


landedOf()​

function landedOf(value):
| {
base: string;
branch: string;
kind: "pull-request";
number: number;
state?: "closed" | "merged";
url: string;
}
| {
branch: string;
checkout: string;
commit: string;
from: string;
kind: "merge";
}
| undefined;

Where an accepted run's work went, from its output's landed, or undefined when it names none readable.

Parameters​

value​

unknown

Returns​

| { base: string; branch: string; kind: "pull-request"; number: number; state?: "closed" | "merged"; url: string; } | { branch: string; checkout: string; commit: string; from: string; kind: "merge"; } | undefined


readRecordedWork()​

function readRecordedWork(client, run): Promise<RecordedWork>;

The plan and files the run recorded, read once. File rows are keyed <request>/<invocation>/<path>, so one prefix read selects everything this request did and nothing an earlier run in the same session did. The plan is the harness conversation's: the run leaves a pointer to it under its own request, and a run from before plans were kept by conversation has its plan under the request, as files are. Pull requests are keyed by the pull request, not the request, since a session keeps one row per pull request across its turns: each row names the request that opened it, and only this run's are kept.

Parameters​

client​

RecordedWorkClient

run​

RecordedRun

Returns​

Promise<RecordedWork>


recheckHarnessUsage()​

function recheckHarnessUsage(client): Promise<{
asked: string[];
}>;

Re-check: ask each harness for a fresh reading of the caller's usage, at most once a minute per person and harness, and store it. Runs in the caller's own write session on the usage flow; no session is named or made here. Resolves to the harnesses that were asked this time (the others were asked under a minute ago). Read the view afterwards for the rows.

Parameters​

client​

Pick<Client, "resource">

Returns​

Promise<{ asked: string[]; }>


reviewDetail()​

function reviewDetail(data): ReviewDetail | null;

A review stop's data as ReviewDetail, or null when it isn't one (not an object, or none of the review's fields readable). A field it can't read is null (or [] for the subjects); it never throws.

Parameters​

data​

unknown

Returns​

ReviewDetail | null

References​

PULL_REQUEST_EVENT​

Re-exports PULL_REQUEST_EVENT


PullRequestRecordResourceState​

Re-exports PullRequestRecordResourceState


pullRequestWait​

Re-exports pullRequestWait


PullRequestWait​

Re-exports PullRequestWait


PullRequestWaitInput​

Re-exports PullRequestWaitInput


readSessionPullRequests​

Re-exports readSessionPullRequests


RUN_REPORT_HEADINGS​

Re-exports RUN_REPORT_HEADINGS


runReport​

Re-exports runReport


RunReport​

Re-exports RunReport


RunReportCheck​

Re-exports RunReportCheck


RunReportCheckStatus​

Re-exports RunReportCheckStatus


SessionPullRequest​

Re-exports SessionPullRequest


shellWord​

Re-exports shellWord


WaitedPullRequest​

Re-exports WaitedPullRequest


workPlace​

Re-exports workPlace


WorkPlace​

Re-exports WorkPlace


WorkPlaceCommands​

Re-exports WorkPlaceCommands


WorkPlaceViewer​

Re-exports WorkPlaceViewer