Every route that serves a workbench refuses one that does not run — its own switch or the
Agent-wide one is off — with 409 workbench_disabled: its pages, the page runtime, its API,
a reload. Listing, history, rollback (source only), export and removal still work.
API
@Interface()
export abstract class Workbenches {
abstract list(projectId: string, agentId: string): Promise<WorkbenchInfo[]>;
abstract one(
projectId: string,
agentId: string,
workbenchId: string,
): Promise<WorkbenchInfo | null>;
abstract agentEnabled(projectId: string, agentId: string): Promise<boolean>;
abstract describe(
projectId: string,
agentId: string,
workbenchId: string,
): Promise<WorkbenchInfo>;
abstract reload(
projectId: string,
agentId: string,
workbenchId: string,
by?: VersionAuthor,
): Promise<WorkbenchInfo>;
abstract reloadIfEnabled(
projectId: string,
agentId: string,
workbenchId: string,
by?: VersionAuthor,
): Promise<WorkbenchInfo>;
abstract setEnabled(
projectId: string,
agentId: string,
workbenchId: string,
enabled: boolean,
by?: VersionAuthor,
): Promise<WorkbenchInfo>;
abstract setAgentEnabled(
projectId: string,
agentId: string,
enabled: boolean,
): Promise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>;
abstract dispatch(
projectId: string,
agentId: string,
workbenchId: string,
request: WorkbenchRequest,
): Promise<WorkbenchResponse>;
abstract uiFile(
projectId: string,
agentId: string,
workbenchId: string,
rel: string,
): Promise<WorkbenchUiFile | null>;
abstract uiRuntimeFile(
projectId: string,
agentId: string,
workbenchId: string,
rel: string,
): Promise<WorkbenchUiRuntimeFile | null>;
abstract exists(projectId: string, agentId: string, workbenchId: string): Promise<boolean>;
abstract iconSvg(
projectId: string,
agentId: string,
workbenchId: string,
): Promise<WorkbenchTabIcon | null>;
abstract history(
projectId: string,
agentId: string,
workbenchId: string,
): Promise<WorkbenchVersion[]>;
abstract rollback(
projectId: string,
agentId: string,
workbenchId: string,
revision: string,
by?: VersionAuthor,
): Promise<WorkbenchInfo>;
abstract remove(
projectId: string,
agentId: string,
workbenchId: string,
by?: VersionAuthor,
): Promise<void>;
abstract appCenter(
projectId: string,
hidden?: boolean,
unavailable?: AppCenterUnavailable,
): Promise<AppCenterShortcut[]>;
abstract appCenterIcon(
projectId: string,
agentId: string,
workbenchId: string,
): Promise<IconImage | null>;
abstract sidebar(projectId: string, agentId: string): Promise<AppCenterShortcut[]>;
abstract setSidebar(
projectId: string,
agentId: string,
workbenchId: string,
show: boolean,
): Promise<WorkbenchInfo>;
abstract setAppCenter(
projectId: string,
agentId: string,
workbenchId: string,
show: boolean,
by?: VersionAuthor,
): Promise<WorkbenchInfo>;
abstract releaseAgent(projectId: string, agentId: string): Promise<void>;
abstract whileReleased<T>(projectId: string, agentId: string, work: () => Promise<T>): Promise<T>;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (23)
list
list(projectId: string, agentId: string): Promise<WorkbenchInfo[]>Every workbench of the Agent, disabled ones included; the ones that run are loaded when stale.
stringstringPromise<WorkbenchInfo[]>one
one(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo | null>One workbench as list gives it, loaded when it runs and is stale; null when the
Agent has no such workbench. The Agent's other workbenches are neither read nor loaded, so
a page opened on its own waits for its own compile alone.
stringstringstringPromise<WorkbenchInfo | null>agentEnabled
agentEnabled(projectId: string, agentId: string): Promise<boolean>The Agent-wide switch: false while .disabled sits beside the workbench folders.
stringstringPromise<boolean>describe
describe(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo>One workbench's registration, read from its folder alone — no migrate, no watcher, no
load (a 404 WorkbenchNotFound for an unknown id). The auth-less install-manifest gate
answers from this: an anonymous request must not be able to run the folder's
compile/boot lifecycle, only look at its package.json.
stringstringstringPromise<WorkbenchInfo>reload
reload(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>stringstringstringVersionAuthorPromise<WorkbenchInfo>reloadIfEnabled
reloadIfEnabled(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>After its source was written (an archive import): loads it as reload does when it runs,
and otherwise answers it as it stands, not loaded.
stringstringstringVersionAuthorPromise<WorkbenchInfo>setEnabled
setEnabled(projectId: string, agentId: string, workbenchId: string, enabled: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>Sets one workbench's own switch. Off unloads it at once (its subscriptions end with its
tree); on loads it, unless the Agent-wide switch is off. The Project's users hear
workbench_updated.
stringstringstringbooleanVersionAuthorPromise<WorkbenchInfo>setAgentEnabled
setAgentEnabled(projectId: string, agentId: string, enabled: boolean): Promise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>Sets the Agent-wide switch, leaving each workbench's own as it is: off unloads every
workbench of the Agent at once, on loads the ones whose own switch is on. Answers the
listing after the change; each workbench is announced as workbench_updated.
stringstringbooleanPromise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>dispatch
dispatch(projectId: string, agentId: string, workbenchId: string, request: WorkbenchRequest): Promise<WorkbenchResponse>stringstringstringWorkbenchRequestPromise<WorkbenchResponse>uiFile
uiFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiFile | null>A file of the workbench's ui/: the one on disk, else — for a .js a TSX page compiles
to — what the serving instance emitted. Null when absent or unsafe.
stringstringstringstringPromise<WorkbenchUiFile | null>uiRuntimeFile
uiRuntimeFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiRuntimeFile | null>A file of the page runtime this server serves compiled pages with (React and the shared components), under a workbench that exists; null otherwise.
stringstringstringstringPromise<WorkbenchUiRuntimeFile | null>exists
exists(projectId: string, agentId: string, workbenchId: string): Promise<boolean>Whether the Agent has this workbench, read from its folder after any import has ended: false
when it has none, a 409 WorkbenchDisabled when it does not run. Loads nothing, so a route
that serves the same files under every workbench never compiles the Agent's others.
stringstringstringPromise<boolean>iconSvg
iconSvg(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchTabIcon | null>The workbench's plugin icon (.svg markup or .png bytes base64-encoded), from its
package.json#penguin.icon; null when it ships none or the read refuses it. The PWA
manifest inlines it; the session tabs default to it. A pure read of the current
layout — no migration, like describe; the auth-less manifest gate calls this.
stringstringstringPromise<WorkbenchTabIcon | null>history
history(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchVersion[]>stringstringstringPromise<WorkbenchVersion[]>rollback
rollback(projectId: string, agentId: string, workbenchId: string, revision: string, by?: VersionAuthor): Promise<WorkbenchInfo>Restores a version's source; it is loaded (and recorded as the newest version) only when it runs.
stringstringstringstringVersionAuthorPromise<WorkbenchInfo>remove
remove(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<void>Deletes the folder, state and switch included, and records the removal; its earlier versions are no longer listed. The instance goes with it.
stringstringstringVersionAuthorPromise<void>appCenter
appCenter(projectId: string, hidden?: boolean, unavailable?: AppCenterUnavailable): Promise<AppCenterShortcut[]>The App Center of a Project: a shortcut for every workbench of its Agents on this server whose manifest asks to be shown (or explicitly hidden when requested), in Agent list order and by title within an Agent. Read from the manifests, each one's last load status and the loads under way — nothing is loaded or compiled. From then on the Agents' folders are watched, so an edit loads and is announced.
stringbooleanAppCenterUnavailablePromise<AppCenterShortcut[]>appCenterIcon
appCenterIcon(projectId: string, agentId: string, workbenchId: string): Promise<IconImage | null>The icon a workbench's App Center declaration names, read and checked again; null when the workbench is unknown, its declaration does not hold up, or it names no icon.
stringstringstringPromise<IconImage | null>sidebar
sidebar(projectId: string, agentId: string): Promise<AppCenterShortcut[]>The rows of one Agent's sidebar list: the App Center's reading with the sidebar's filter, a
shortcut for every workbench that runs, has a tab and carries no .hidden-from-sidebar
marker, by title. Nothing is loaded or compiled; the Agent's folder is watched from then on.
stringstringPromise<AppCenterShortcut[]>setSidebar
setSidebar(projectId: string, agentId: string, workbenchId: string, show: boolean): Promise<WorkbenchInfo>Writes (show: false) or removes the installation's .hidden-from-sidebar marker. It is no
part of the source, so writing it records no version and does not reload the workbench; the
workbench as it then stands is answered and announced.
stringstringstringbooleanPromise<WorkbenchInfo>setAppCenter
setAppCenter(projectId: string, agentId: string, workbenchId: string, show: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>Rewrites penguin.appCenter.show in the workbench's package.json, and nothing else of it,
then reloads the workbench — which records the edit as a version like any other.
stringstringstringbooleanVersionAuthorPromise<WorkbenchInfo>releaseAgent
releaseAgent(projectId: string, agentId: string): Promise<void>Lets go of everything held for one Agent before its folder is deleted or its State is replaced: the folder watcher, pending reloads, loads in flight and the loaded instances. A later listing takes them up again, so an Agent whose deletion is then refused loses nothing.
stringstringPromise<void>whileReleased
whileReleased<T>(projectId: string, agentId: string, work: () => Promise<T>): Promise<T>Runs work (an Agent State import) with the Agent's workbenches released as by
releaseAgent and kept so until it settles: a request for them meanwhile waits for the end
instead of watching or loading the directory being replaced.
stringstring() => Promise<T>Promise<T>