WorkbenchesModule · packages/server/src/workbenches/service.ts:367

WorkbenchService

component

No JSDoc comment in source yet.

API

@Component()
export class WorkbenchService implements Workbenches {
  @Use() private readonly paths!: Paths;
  @Use() private readonly config!: Config;
  @Use() private readonly clock!: Clock;
  @Use() private readonly log!: Log;
  @Use() private readonly channels!: Channels;
  @Use() private readonly members!: Members;
  @Use() private readonly projects!: Projects;
  @Use() private readonly hmr!: Hmr;
  @Use() private readonly agents!: AgentIndex;
  @Use() private readonly agentConfig!: AgentConfig;
  @Use() private readonly sessionIndex!: SessionIndex;
  @Use() private readonly traces!: Traces;
  @Use() private readonly runner!: ScheduleTaskRunner;
  @Use() private readonly sessions!: ScheduleSessionCreator;
  @Use() private readonly engines!: AgentStateEngines;
  setup(ctx: ClassCtx);
  async list(projectId: string, agentId: string): Promise<WorkbenchInfo[]>;
  async one(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo | null>;
  async agentEnabled(projectId: string, agentId: string): Promise<boolean>;
  async describe(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo>;
  async reload(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>;
  async reloadIfEnabled(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>;
  async setEnabled(projectId: string, agentId: string, workbenchId: string, enabled: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>;
  async setAgentEnabled(projectId: string, agentId: string, enabled: boolean): Promise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>;
  async dispatch(projectId: string, agentId: string, workbenchId: string, request: WorkbenchRequest): Promise<WorkbenchResponse>;
  async uiFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiFile | null>;
  async uiRuntimeFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiRuntimeFile | null>;
  async exists(projectId: string, agentId: string, workbenchId: string): Promise<boolean>;
  async iconSvg(projectId: string, agentId: string, workbenchId: string): Promise<{ kind: "svg" | "png"; data: string } | null>;
  async history(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchVersion[]>;
  async rollback(projectId: string, agentId: string, workbenchId: string, revision: string, by?: VersionAuthor): Promise<WorkbenchInfo>;
  async remove(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<void>;
  async appCenter(projectId: string, hidden = false, unavailable?: AppCenterUnavailable): Promise<AppCenterShortcut[]>;
  async appCenterIcon(projectId: string, agentId: string, workbenchId: string): Promise<IconImage | null>;
  async sidebar(projectId: string, agentId: string): Promise<AppCenterShortcut[]>;
  async setSidebar(projectId: string, agentId: string, workbenchId: string, show: boolean): Promise<WorkbenchInfo>;
  async setAppCenter(projectId: string, agentId: string, workbenchId: string, show: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>;
  async releaseAgent(projectId: string, agentId: string): Promise<void>;
  async whileReleased<T>(projectId: string, agentId: string, work: () => Promise<T>): Promise<T>;
}

Dependencies & Wiring

Extracted from class decorators
implementsinterfaces
@Userequires (15)
paths: Paths · config: Config · clock: Clock · log: Log · channels: Channels · members: Members · projects: Projects · hmr: Hmr · agents: AgentIndex · agentConfig: AgentConfig · sessionIndex: SessionIndex · traces: Traces · runner: ScheduleTaskRunner · sessions: ScheduleSessionCreator · engines: AgentStateEngines

Methods (24)

setup

setup(ctx: ClassCtx)
@paramctxClassCtx

list

async list(projectId: string, agentId: string): Promise<WorkbenchInfo[]>
@paramprojectIdstring
@paramagentIdstring
@returnsPromise<WorkbenchInfo[]>

one

async one(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo | null>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<WorkbenchInfo | null>

agentEnabled

async agentEnabled(projectId: string, agentId: string): Promise<boolean>
@paramprojectIdstring
@paramagentIdstring
@returnsPromise<boolean>

describe

async describe(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchInfo>

What the install manifest needs, read from the folder alone — NO migrate, NO watcher, NO load: an anonymous request (the manifest's auth-less gate) must not be able to run the folder's compile/boot lifecycle, only look at its package.json. The registration here is the folder's declaration, not a loaded instance: tabs carry their renderer as declared, loadedAt is this read's time, error/hints stay empty — the manifest uses none of them, and anything that wants the live instance asks list.

@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<WorkbenchInfo>

reload

async reload(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramby?VersionAuthor
@returnsPromise<WorkbenchInfo>

reloadIfEnabled

async reloadIfEnabled(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramby?VersionAuthor
@returnsPromise<WorkbenchInfo>

setEnabled

async setEnabled(projectId: string, agentId: string, workbenchId: string, enabled: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramenabledboolean
@paramby?VersionAuthor
@returnsPromise<WorkbenchInfo>

setAgentEnabled

async setAgentEnabled(projectId: string, agentId: string, enabled: boolean): Promise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>
@paramprojectIdstring
@paramagentIdstring
@paramenabledboolean
@returnsPromise<{ workbenches: WorkbenchInfo[]; enabled: boolean }>

dispatch

async dispatch(projectId: string, agentId: string, workbenchId: string, request: WorkbenchRequest): Promise<WorkbenchResponse>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramrequestWorkbenchRequest
@returnsPromise<WorkbenchResponse>

uiFile

async uiFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiFile | null>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramrelstring
@returnsPromise<WorkbenchUiFile | null>

uiRuntimeFile

async uiRuntimeFile(projectId: string, agentId: string, workbenchId: string, rel: string): Promise<WorkbenchUiRuntimeFile | null>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramrelstring
@returnsPromise<WorkbenchUiRuntimeFile | null>

exists

async exists(projectId: string, agentId: string, workbenchId: string): Promise<boolean>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<boolean>

iconSvg

async iconSvg(projectId: string, agentId: string, workbenchId: string): Promise<{ kind: "svg" | "png"; data: string } | null>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<{ kind: "svg" | "png"; data: string } | null>

history

async history(projectId: string, agentId: string, workbenchId: string): Promise<WorkbenchVersion[]>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<WorkbenchVersion[]>

rollback

async rollback(projectId: string, agentId: string, workbenchId: string, revision: string, by?: VersionAuthor): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramrevisionstring
@paramby?VersionAuthor
@returnsPromise<WorkbenchInfo>

remove

async remove(projectId: string, agentId: string, workbenchId: string, by?: VersionAuthor): Promise<void>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramby?VersionAuthor
@returnsPromise<void>

appCenter

async appCenter(projectId: string, hidden = false, unavailable?: AppCenterUnavailable): Promise<AppCenterShortcut[]>
@paramprojectIdstring
@paramhidden?unknown
@paramunavailable?AppCenterUnavailable
@returnsPromise<AppCenterShortcut[]>

appCenterIcon

async appCenterIcon(projectId: string, agentId: string, workbenchId: string): Promise<IconImage | null>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@returnsPromise<IconImage | null>

setSidebar

async setSidebar(projectId: string, agentId: string, workbenchId: string, show: boolean): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramshowboolean
@returnsPromise<WorkbenchInfo>

setAppCenter

async setAppCenter(projectId: string, agentId: string, workbenchId: string, show: boolean, by?: VersionAuthor): Promise<WorkbenchInfo>
@paramprojectIdstring
@paramagentIdstring
@paramworkbenchIdstring
@paramshowboolean
@paramby?VersionAuthor
@returnsPromise<WorkbenchInfo>

releaseAgent

async releaseAgent(projectId: string, agentId: string): Promise<void>
@paramprojectIdstring
@paramagentIdstring
@returnsPromise<void>

whileReleased

async whileReleased<T>(projectId: string, agentId: string, work: () => Promise<T>): Promise<T>
@paramprojectIdstring
@paramagentIdstring
@paramwork() => Promise<T>
@returnsPromise<T>