config-template / agent-kinds / agent.tsmain at 3b8ad1b
// agent-kinds/agent.ts — WHAT THE DASH LOADS OF THE KIND `agent`: how its New agent starts one,
// and the chat it draws.
//
// THE DASH READS THIS FILE'S TEXT AND RUNS IT IN A FRAME OF THE BROWSER. worker.ts writes this
// file's path to the mind's kv at every publish (`agent-kinds`), and the Dash reads the file from
// /repos/config by that path. So the file is here, in this repo, and not beside the agent's code
// in /repos/stdlib: the UI kit that the Dash pins (@iterate-com/ui) reads kind files from
// /repos/config alone. No worker code imports this file.
//
// IT HAS NO IMPORT. In the frame every import is a stub that throws when used. What the mind does
// with the facts below is agent-kinds/agent.ts of /repos/stdlib (`agentKindEvent`).
const T = "events.iterate.com/";
export default {
kind: "agent",
// THE MIND'S DEFAULT KIND: the Dash's New agent starts this one. The Dash appends the fact of
// `start` and then the person's first words (`agent-ui/message-received`) to the new agent's
// path, AS THE MEMBER WHO TYPED: no method of the mind stands between, so each fact carries that
// person's own stamp.
newAgent: {
default: true,
choices: [{ id: "agent", label: "Agent", byPerson: true }],
start: ({ path }: { path: string }) => [
{
type: `${T}agent-ui/agent-requested`,
idempotencyKey: `agent-ui/agent-requested:${path}`,
payload: {},
},
],
},
// the streamed windows of the answer being written, in one shape for every provider
ephemeralEvents: [`${T}llm-request/response-frame-received`],
// THE CHAT is iterate's AgentChat as it is. It reads this agent's facts itself: a person's
// bubble from the raw fact and its stamp, a request and its windows, the agent's words
// (`agent-ui/message-sent`), and the facet's live state. Its composer stores a message's files
// and then appends ONE `agent-ui/message-received` with the words and the files, as the person
// who typed.
view: ({ ui }: { ui: { AgentChat: unknown } }) => ui.AgentChat,
};