New Agent

Make an agent: pick its face, name it, or start from a suggested job.

Color
Shape

Suggestions

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/agent-create

Usage

import { type Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { AgentCreate } from "./ui/uicontext/components/kit/AgentCreate.ts"import { Persona } from "./ui/uicontext/components/kit/Persona.ts"
const Message = UiSchema.TaggedEnum({ SubmittedAgent: { name: Schema.String, persona: Persona, job: Schema.optional(Schema.String) } })// the pane keeps its draft; you make the agent, then pass back how it went as `outcome`export const NewAgent = (h: Html.H<typeof Message.Type>, outcome: Outcome | null) =>	AgentCreate(h, {		props: {			suggestions: [{ id: "night-shift", name: "Night Shift", job: "Works overnight and preps your morning digest.", persona: { shape: "hexagon", color: "orange" } }],			outcome,		},		onEmit: { Submitted: ({ name, persona, job }) => Message.SubmittedAgent({ name, persona, ...(job === undefined ? {} : { job }) }) },	})

API reference

Props

AgentCreate props
NameTypeDescription
suggestionsrequiredAgentSuggestion[]—
personaPersonaThe face it starts with
outcomeOutcome | null—
agentIdstring—

Events

AgentCreate events
EventPayloadDescription
Submitted{ name: string; persona: Persona; job?: string }—

Agent actions

What agents can do with AgentCreate
ActionDescription
RequestedCreateasks firstCreate an agent with a name, optionally a color and shape, and its job as its first message

Source