import "../src/code/element.ts"; import { agentControls, editor, playground } from "./peers.ts"; const SAMPLE = `import { Doc } from "@nibling/app/collab"; /** Says hello to everyone editing this file. */ export function greet(names: string[]): string { const list = names.length > 1 ? \`\${names.slice(0, -1).join(", ")} and \${names.at(-1)}\` : names[0]; return \`Hello, \${list ?? "nobody"}!\`; } const doc = Doc.create(greet(["Ada", "Grace"])); console.log(doc.text); `; const agent = playground("nib-code:playground", SAMPLE, { Ada: editor("nib-code", "ada"), Grace: editor("nib-code", "grace") }); agentControls(agent, (text) => text.replaceAll(/\bgreet\b/g, "welcome"));