WorkspaceOptions
Type, in @jr2/orchestrator/src/workspace.ts. The signature of an export, or a type that it names, names this type. The Authoring surface page lists each export. This type is not an export of @jr2/orchestrator, so a workflow module does not import it by name.
type WorkspaceOptions<TSchema extends z.ZodObject, TSlots extends string> = SandboxOptions<
TSlots,
z.infer<TSchema>
> & {
input: TSchema;
spec: (args: { input: WithoutEmptyIndex<z.infer<TSchema>> & HostInjectedInput }) => WorkspaceSpec;
};The options of a workspace() that declares the input that starts a run.
Fields: each field of SandboxOptions, and these:
input:TSchemaThe input that starts a run, as a
z.object. jr2 checks each start against it. It also types theinputofspecand of a per-run Repo Slot, and the body must accept it plus theworkspacehandles. Write it here, not on the body.spec:(args: { input: WithoutEmptyIndex<z.infer<TSchema>> & HostInjectedInput; }) => WorkspaceSpecA function from the run input to the Workspace's
WorkspaceSpec: thebranchit works on, and optionallyreviewShaandworkGroup. jr2 calls it when the run enters the Workspace.The input of
specalso holdsinstanceId, the seed Instance ID of the run (seeHostInjectedInput). Use it to give each run a branch of its own:spec: ({ input }) => ({ branch: `fix/${input.instanceId}` }). Only a rootworkspace()gets it from jr2. Aworkspace()that a different Machine invokes gets only the input that its parent gives it, so that parent must giveinstanceIdwhenspecreads it.