Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/planService-1

Cockpit server, next. Source: n/a.

Variables#

LOCAL_PROVIDER#

const LOCAL_PROVIDER: "ollama" = 'ollama'

Defined in: ui/server/src/planService.mjs:32

The one model provider a Cockpit step may name (a local Ollama); anything else is refused (COCKPIT_LLM_PROVIDER).


MAX_SEEDS#

const MAX_SEEDS: 50 = 50

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


MAX_STEPS#

const MAX_STEPS: 50 = 50

Defined in: ui/server/src/planService.mjs:33


MAX_TEXT#

const MAX_TEXT: 20000 = 20_000

Defined in: ui/server/src/planService.mjs:34


NOT_OFFERED#

const NOT_OFFERED: Readonly<{ pipeline.run: "Running a raw Context Envelope is not offered in the Cockpit: an envelope is an opaque program of generator steps, not something a plan review can show plainly."; }>

Defined in: ui/server/src/planService.mjs:39

Flows the Cockpit will not run from a browser-supplied plan, with the reason a person can read.


PATH_ARGS#

const PATH_ARGS: Readonly<{ create.controller.bind: string[]; create.page.from: string[]; create.service.openapi: string[]; create.workflow.from: string[]; import.unit: string[]; project.init: string[]; research.workflow: string[]; }>

Defined in: ui/server/src/planService.mjs:45

Which arguments hold a file path, per flow. Every one must be project-relative. The drift guard in planService.test.mjs fails if a flow gains a path-looking argument that is not listed here.

Functions#

checkPlan()#

checkPlan(given, root, blockSettings?): object

Defined in: ui/server/src/planService.mjs:184

validatePlan() + the Cockpit checks + a preview of what each step would run. Pure over (plan, root, block settings).

Parameters#

given

any

root

any

blockSettings?

Returns#

object

errors

errors: object[] = shaped

steps

steps: object[]

touches

touches: object

touches.features

features: string[]

touches.files

files: object[]

valid

valid: boolean


cockpitErrors()#

cockpitErrors(plan, root, options?): any[]

Defined in: ui/server/src/planService.mjs:102

The Cockpit's own checks on top of validatePlan(). Only steps that name a whitelisted flow are examined.

Parameters#

plan

any

root

string

The project root.

options?

: the blocks turned off for this project. When the settings file cannot be read the check fails closed (every step is refused, by name).

blockSettingsUnreadable?

string = null

disabledFlows?

string[] = []

Returns#

any[]


createPlanService()#

createPlanService(o): object

Defined in: ui/server/src/planService.mjs:261

Parameters#

o
getBlockSettings?

(root) => object

: the blocks turned off for the project at root. Read on EVERY check and run (never cached), so turning a block off takes effect at once; a reader that throws is treated as unreadable and fails closed.

getRoot

() => string

the current project's root (never from a request)

onStarted?

(started) => void

: called once a plan that named a note (noteId) has started, to mark that note ran. A failure here never undoes the run (the process exists); it is reported as noteRan: false so the screen can say so.

startPlan

(plan) => object

starts a validated plan; injected so tests can watch that nothing starts on refusal

Returns#

context()

context(): any

Returns

any

impact()

impact(body): any

seeds: unit refs the user picked (explicit). accepted: refs the user confirmed from the proposals; they are recomputed from text here, so they keep their evidence and stay inferred.

Parameters
body

any

Returns

any

propose()

propose(body): any

Proposals only. Nothing is analysed and no model is called: a heuristic text match with evidence.

Parameters
body

any

Returns

any

refactorPreview()

refactorPreview(body): any

— Inspector "Change" tab: a dry-run preview of construct refactor move|rename (never writes), so the tab can show the steps with provenance and a per-file checklist before anything runs. Only move and rename are offered here; extract/wrap have no block yet, which the client already knows from flowCatalogue() (refactor.move/refactor.rename are the only two PLAN_FLOWS entries).

Parameters
body

any

Returns

any

run()

run(body): any

Re-validates, then starts. On ANY error nothing is created and nothing is started.

Parameters
body

any

Returns

any

validate()

validate(body): any

Parameters
body

any

Returns

any


flowCatalogue()#

flowCatalogue(__namedParameters?): object[]

Defined in: ui/server/src/planService.mjs:210

The flow catalogue the review UI adds steps from: every whitelisted flow, its arguments and executors.

Parameters#

__namedParameters?
disabledFlows?

any[] = []

Returns#

object[]


plainMessage()#

plainMessage(e): any

Defined in: ui/server/src/planService.mjs:152

Plain-language text for a named error, shown next to the step. The code stays alongside so a test or a script can match on it; the sentence is what a person reads.

Parameters#

e

any

Returns#

any


readConstraints()#

readConstraints(root): object

Defined in: ui/server/src/planService.mjs:232

Constraints as the project's own architecture.yml states them: layers, active rules, frozen regions.

Parameters#

root

any

Returns#

object

exceptions

exceptions: number

featuresRoot

featuresRoot: string

framework

framework: any

frozen

frozen: any[]

layers

layers: object[]

rules

rules: object[]


unsafePathReason()#

unsafePathReason(root, value): "must be a non-empty path." | "must not contain control characters." | "must be a path inside the project, not a URL." | "must be relative to the project, not an absolute path." | "must use forward slashes." | "must stay inside the project (no "..")." | "must stay inside the project." | "could not be resolved inside the project." | "leads outside the project through a symbolic link."

Defined in: ui/server/src/planService.mjs:62

Returns a plain reason the value is not a safe project-relative path, or null when it is.

Parameters#

root

any

value

any

Returns#

"must be a non-empty path." | "must not contain control characters." | "must be a path inside the project, not a URL." | "must be relative to the project, not an absolute path." | "must use forward slashes." | "must stay inside the project (no "..")." | "must stay inside the project." | "could not be resolved inside the project." | "leads outside the project through a symbolic link."


withExpectedFiles()#

withExpectedFiles(plan, root): any

Defined in: ui/server/src/planService.mjs:166

: declare, for every step the bot will run, the files that step will create, so the approval gate can match what the bot wrote against what the plan said. Only files the step did not already declare are added (a person's own declaration is never replaced), only for flows core derives exactly (expectedFiles), and never for a manual step. Returns the same plan object when there is nothing to add.

Parameters#

plan

any

root

any

Returns#

any