Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
import { z } from 'zod';
import {
projectIdSchema,
projectRevisionIdSchema,
materialDependenciesSchema,
type MaterialDependency,
type ProjectRevision,
} from './projects';
import type { MaterialLibraryPayload } from './material-library';
export interface WorkspaceBinding {
project?: ProjectRevision;
materialDependencies: MaterialDependency[];
materialResources: MaterialLibraryPayload;
}
export const workspaceSelectionSchema = z
.object({
projectId: projectIdSchema
.nullable()
.optional()
.describe('Project; omit for the configured default, null for standalone.'),
projectRevision: projectRevisionIdSchema.optional().describe('Exact project revision.'),
materialDependencies: materialDependenciesSchema
.optional()
.describe('Pins for this call; each replaces the project pin of its resourceId.'),
})
.strict()
.superRefine((selection, ctx) => {
if (selection.projectId === null && selection.projectRevision !== undefined)
ctx.addIssue({
code: 'custom',
path: ['projectRevision'],
message: 'projectRevision cannot be combined with standalone projectId: null.',
});
});
export type WorkspaceSelection = z.infer<typeof workspaceSelectionSchema>;
/** A host snapshots optional project context and exact material pins per operation. */
export interface WorkspacePort {
run<T>(selection: WorkspaceSelection, execute: () => Promise<T>): Promise<T>;
current(): WorkspaceBinding | undefined;
/** The project an omitted `projectId` selects, when the host configured one. */
configured?(): string | undefined;
}