ui/server/src/processesService-1
Cockpit server, next. Source: n/a.
Variables#
CONTROL_EVENTS#
constCONTROL_EVENTS:Readonly<{cancel:"CANCEL";pause:"PAUSE";resume:"RESUME";retry:"RETRY"; }>
Defined in: ui/server/src/processesService.mjs:38
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#
constLOG_TAIL:500=500
Defined in: ui/server/src/processesService.mjs:47
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:129
Parameters#
options?
adoptIntervalMs?
number = ...
: how often every open project's adoptInterrupted() re-runs, not
only at server start. A killed server is caught at the next open(), but a server that is merely wedged
(an engine-level failure whose own record could not be saved, a store gone unwritable) needs the same
liveness check to run again without a restart. 0 disables the timer (tests that don't care).
clearIntervalFn?
(id) => void = clearInterval
test seam.
executeStep?
(ctx) => Promise<any> = null
defaults to the real bot runner
getBlockSettings?
(root) => object = null
: the blocks turned
off for a project (Features, Blocks tab), read fresh on every start. startPlan refuses a plan that uses one, so the
Git screen's Review analysis and the Tests screen's run, which start their own plans, cannot forget the check.
getProjectDir
() => string
the project directory the Cockpit is pointed at right now
isAlive?
(pid) => boolean = null
forwarded to every adoptInterrupted() call (start-up and
timer alike); test seam so a test can fake a dead pid deterministically instead of racing a real one.
reviewExecutor?
{ executeStep: Function; } = null
: 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
setIntervalFn?
(handler, timeout?, ...arguments) => number = setInterval
test seam.
stateDir?
string = ...
testRunExecutor?
{ executeStep: Function; } = null
: 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
gc
gc: () =>
any
-- the dry-run construct process gc report taken when this project was opened (server start, or
the first request after it): counts and the items found, never re-run per call. Null when no project is
open, or the sweep itself failed (never blocks the Cockpit over a maintenance report).
Returns
any
reAdoptInterrupted
reAdoptInterrupted: () =>
void=reAdoptAll
: fire the periodic re-adoption check right now, instead of waiting adoptIntervalMs — what the
timer does on its own schedule, exposed so a test (or an admin action) can trigger it deterministically.
Re-run adoptInterrupted() on every project already opened this server
run. open() only checks once, the moment a project is first touched
(the comment there says so); this is the same check run again, later,
for a server that is still up but wedged rather than killed.
Returns
void
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; }
close()
close():
void
Stop the periodic re-adoption timer. Harmless to skip (it's unref()d and does not block process
exit), but a test that creates many services in a loop, or a graceful shutdown, can call it to be tidy.
Returns
void
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
— 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
— 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; }
— 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:59
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:52
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