Line

You are reading docs for v0.8. See latest (v0.9)

ui/server/src/processesService-1

Cockpit server, v0.8. Source: n/a.

Variables#

CONTROL_EVENTS#

const CONTROL_EVENTS: Readonly<{ cancel: "CANCEL"; pause: "PAUSE"; resume: "RESUME"; retry: "RETRY"; }>

Defined in: ui/server/src/processesService.mjs:26

The UI verbs and the machine event each one sends. The client may only name a verb; whether it is legal now is decided by the machine.


LOG_TAIL#

const LOG_TAIL: 500 = 500

Defined in: ui/server/src/processesService.mjs:35

How many log lines a view carries. The record keeps up to 2000; a drawer that repaints on every change does not need to ship all of them each time.

Functions#

createProcessesService()#

createProcessesService(options?): object

Defined in: ui/server/src/processesService.mjs:87

Parameters#

options?
executeStep?

(ctx) => Promise<any> = null

defaults to the real bot runner

getProjectDir

() => string

the project directory the Cockpit is pointed at right now

reviewExecutor?

{ executeStep: Function; } = null

#351: runs review.analyze steps (read-only, no worktree, no branch, never any artifact); every other flow still goes to the bot runner

reviewExecutor.executeStep

Function

stateDir?

string = ...

testRunExecutor?

{ executeStep: Function; } = null

#305: runs test.run steps the same way (read-only, forked worker, never any artifact)

testRunExecutor.executeStep

Function

Returns#

currentRoot

currentRoot: () => any

Returns

any

engine

engine: () => any

The engine for the current project, for a harness that has to start work.

Returns

any

store

store: () => any

Returns

any

artifactDiff()

artifactDiff(id, filePath): { body: { diff?: undefined; error: string; ok: boolean; reason?: undefined; truncated?: undefined; }; status: number; } | { body: { diff: any; error?: undefined; ok: boolean; reason: any; truncated?: undefined; }; status: number; } | { body: { diff: any; error?: undefined; ok: boolean; reason?: undefined; truncated: boolean; }; status: number; }

The unified diff of one recorded artifact, read from the bot's branch. filePath must equal a path recorded on the process; the branch name is derived from the id the store returned, not the client's string.

Parameters
id

any

filePath

any

Returns

{ body: { diff?: undefined; error: string; ok: boolean; reason?: undefined; truncated?: undefined; }; status: number; } | { body: { diff: any; error?: undefined; ok: boolean; reason: any; truncated?: undefined; }; status: number; } | { body: { diff: any; error?: undefined; ok: boolean; reason?: undefined; truncated: boolean; }; status: number; }

control()

control(id, verb): { body: { controls?: undefined; error: string; ok: boolean; process?: undefined; }; status: number; } | { body: { controls: any; error: any; ok: boolean; process?: undefined; }; status: number; } | { body: { controls?: undefined; error?: undefined; ok: boolean; process: { artifacts: any; log: any; logHidden: any; steps: any; summary: any; }; }; status: number; }

Parameters
id

any

verb

any

Returns

{ body: { controls?: undefined; error: string; ok: boolean; process?: undefined; }; status: number; } | { body: { controls: any; error: any; ok: boolean; process?: undefined; }; status: number; } | { body: { controls?: undefined; error?: undefined; ok: boolean; process: { artifacts: any; log: any; logHidden: any; steps: any; summary: any; }; }; status: number; }

decide()

decide(id, __namedParameters): object

#341 — ONE decision on ONE artifact. by is an argument the ROUTER derives from the signed session; nothing in the request body can reach it. diffSha256 is passed through exactly as the client echoed it; it is never computed or defaulted here, so the gate compares it with the diff it re-derives. -> { status, body }

Parameters
id

any

__namedParameters
by

any

diffSha256

any

path

any

verdict

any

Returns

object

body

body: any

status

status: number

detail()

detail(id): { body: { error: string; ok: boolean; process?: undefined; }; status: number; } | { body: { error?: undefined; ok: boolean; process: { artifacts: any; log: any; logHidden: any; steps: any; summary: any; }; }; status: number; }

-> { status, body }

Parameters
id

any

Returns

{ body: { error: string; ok: boolean; process?: undefined; }; status: number; } | { body: { error?: undefined; ok: boolean; process: { artifacts: any; log: any; logHidden: any; steps: any; summary: any; }; }; status: number; }

isCurrent()

isCurrent(record): boolean

Does record belong to the project the Cockpit is looking at?

Parameters
record

any

Returns

boolean

list()

list(): object

Returns

object

problems

problems: any

processes

processes: any

projectRoot

projectRoot: any = entry.root

review()

review(id): object

#341 — the gate's read-only review of one process: per artifact the exact diff, its sha256, the refusals and whether it is applicable. -> { status, body }

Parameters
id

any

Returns

object

body

body: any = review

status

status: number = 200

setExecutor()

setExecutor(fn): void

Swap the executor (tests and the e2e harness). Applies to projects opened afterwards.

Parameters
fn

any

Returns

void

startPlan()

startPlan(plan): { error: any; ok: boolean; processId?: undefined; status: number; } | { error?: undefined; ok: boolean; processId: any; status?: undefined; }

#289 — create a process from a plan the caller has ALREADY validated (planService.run) and start it. The project is the service's own; createProcess() validates the plan once more and throws on a bad one.

Parameters
plan

any

Returns

{ error: any; ok: boolean; processId?: undefined; status: number; } | { error?: undefined; ok: boolean; processId: any; status?: undefined; }

subscribe()

subscribe(fn): () => boolean

Parameters
fn

any

Returns

() => boolean


processView()#

processView(record): object

Defined in: ui/server/src/processesService.mjs:47

A process as the drawer's detail view shows it: the summary (with the machine's own controls), every step, the artifacts as read-only records and the tail of the log. The plan itself and the raw record stay home.

Parameters#

record

any

Returns#

object

artifacts

artifacts: any

log

log: any

logHidden

logHidden: any

steps

steps: any

summary

summary: any


versionedSummary()#

versionedSummary(record): any

Defined in: ui/server/src/processesService.mjs:40

processSummary() plus a version that only ever grows (the record's log sequence, which every state change advances). Responses and socket frames can reach a client out of order; the version lets it keep the newest instead of whichever arrived last.

Parameters#

record

any

Returns#

any