Skip to content

chartSchemaFor ​

Function, in @jr2/orchestrator/src/chart.ts. It is an export of @jr2/orchestrator, on the Authoring surface page, in Charts.

ts
function chartSchemaFor(decl: OpenBodyDeclaration): z.ZodType<ChartText>

The Chart grammar for one Open body, as a zod schema. The names that the Open body lends, and the models and the Workspace accesses that it allows, are the only values that the schema takes. Make it the parameter of the pick of a planner. The model then gets the grammar as the parameters of its tool, and the Briefing tells it how a Chart runs. The door still checks each Chart before it runs.

Parameters

Returns: The schema of a Chart for that Open body.

Example

ts
import { z } from "zod";
import { chartSchemaFor, defineEvent, type OpenBodyDeclaration } from "@jr2/orchestrator";

const declaration: OpenBodyDeclaration = {
  lends: { agents: ["writer"], gate: true },
  allows: { models: ["anthropic/claude-haiku-5-5"], workspace: ["none"] },
  ceilings: { turns: 12, wallClock: "30m", transitions: 500, fanOut: 2, size: 65536 },
};

export const runChart = defineEvent({
  name: "run_chart",
  description: "Run this Chart. Its outcome is the answer to this call.",
  input: z.object({ chart: chartSchemaFor(declaration) }),
});

See also

The docs of Kit version 0.5.1. Each page is also at its .md URL.