Zod definitions for workspace structure, UI state, and a function to create a fresh workspace instance. Reuse in applications managing AI canvas workspaces.
// Source: https://github.com/mperkins0155/giselle | License: Apache-2.0 | Copyright 2024 ROUTE06, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import * as z from "zod/v4";
import { Connection, ConnectionId } from "../connection";
import { NodeId, NodeLike, NodeUIState } from "../node";
import { WorkspaceId } from "./id";
export { WorkspaceId } from "./id";
export const WorkspaceSchemaVersion = z.enum(["20250221"]);
export const Viewport = z.object({
x: z.number(),
y: z.number(),
zoom: z.number(),
});
export type Viewport = z.infer<typeof Viewport>;
export const ShortcutScope = z.enum(["canvas", "properties-panel", "none"]);
export type ShortcutScope = z.infer<typeof ShortcutScope>;
export const UIState = z.object({
nodeState: z.record(NodeId.schema, NodeUIS
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key