Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(onboarding): explain local agent connection and broaden starter roles
Gusec61a98fc662
diff --git a/src/web/src/components/community/machines/machine-pair-message-diagram.tsx b/src/web/src/components/community/machines/machine-pair-message-diagram.tsxnew file mode 100644index 000000000..775d7a29b--- /dev/null+++ b/src/web/src/components/community/machines/machine-pair-message-diagram.tsx@@ -0,0 +1,76 @@+"use client"++import { useId, useRef } from "react"+import gsap from "gsap"+import { useGSAP } from "@gsap/react"+import { FolderLock, MessageSquare } from "lucide-react"+import { TileDefs, tileIds } from "../onboarding-tiles/tile-defs"+import { OT_EASE, comeOnline } from "../onboarding-tiles/tile-motion"++export function MachinePairMessageDiagram() {+ const scope = useRef<SVGSVGElement>(null)+ const idPrefix = useId()+ const id = tileIds(idPrefix)++ useGSAP(() => {+ const media = gsap.matchMedia()+ media.add("(prefers-reduced-motion: no-preference)", () => {+ const timeline = gsap.timeline({ repeat: -1, repeatDelay: 1.2, defaults: { ease: OT_EASE } })+ timeline.set(".pair-packet", { x: 312, y: 60, opacity: 0 })+ .to(".pair-packet", { opacity: 1, duration: 0.2 })+ .to(".pair-packet", { x: 104, duration: 1.2, ease: "power1.inOut" })+ .to(".pair-packet", { opacity: 0, duration: 0.15 })+ comeOnline(timeline, ".pair-online", 117, 73)+ timeline.to({}, { duration: 0.6 })+ .set(".pair-packet", { x: 104 })+ .to(".pair-packet", { opacity: 1, duration: 0.2 })+ .to(".pair-packet", { x: 312, duration: 1.2, ease: "power1.inOut" })+ .to(".pair-packet", { opacity: 0, duration: 0.15 })+ .set(".pair-arrival", { attr: { r: 18 }, opacity: 0.65 })+ .to(".pair-arrival", { attr: { r: 28 }, opacity: 0, duration: 0.6, ease: "power2.out" })+ const updateVisibility = () => { timeline.paused(document.hidden) }+ updateVisibility()+ document.addEventListener("visibilitychange", updateVisibility)+ return () => { document.removeEventListener("visibilitychange", updateVisibility) }+ })+ return () => media.revert()+ }, { scope })++ return (+ <figure className="rounded-lg bg-muted/50 p-4">+ <svg+ ref={scope}+ viewBox="0 0 360 184"+ role="img"+ aria-label="Your CLI agent and local files stay on your computer. Messages and replies travel between the agent and Alook. Alook does not automatically upload local file contents."+ className="ot-svg w-full font-sans"+ >+ <TileDefs idPrefix={idPrefix} />+ <rect x="12" y="24" width="184" height="128" rx="10" fill="var(--card)" stroke="currentColor" strokeWidth="1.5" />+ <rect x="18" y="30" width="172" height="108" rx="5" fill="var(--popover)" stroke="currentColor" strokeWidth="0.75" strokeOpacity="0.25" />+ <circle cx="104" cy="145" r="1.5" fill="currentColor" opacity="0.5" />+ <path d="M100 152H108L110 159H98Z" fill="currentColor" opacity="0.75" />+ <rect x="80" y="158" width="48" height="5" rx="2.5" fill="currentColor" opacity="0.75" />+ <path d="M130 60H284" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" opacity="0.28" />+ <circle cx="196" cy="60" r="3" fill="var(--card)" stroke="currentColor" strokeWidth="1.5" />+ <text x="248" y="40" textAnchor="middle" fontSize="12" fill="var(--muted-foreground)">Only messages</text>+ <g className="pair-agent">+ <svg x="88" y="44" width="32" height="32" viewBox="0 0 36 36">+ <g clipPath={`url(#${id.disc})`}>+ <use href={`#${id.faceA}`} />+ </g>+ </svg>+ <circle cx="117" cy="73" r="5.5" fill="var(--muted)" />+ <circle className="pair-online" cx="117" cy="73" r="3.5" fill="var(--status-online)" />+ </g>+ <FolderLock className="pair-files" x="88" y="86" width="32" height="26" strokeWidth="1.5" />+ <text x="104" y="126" textAnchor="middle" fontSize="11" fill="var(--muted-foreground)">Local files · no auto-upload</text>+ <image href="/alook.svg" x="296" y="44" width="32" height="32" />+ <circle cx="312" cy="60" className="pair-arrival" r="18" fill="none" stroke="var(--status-online)" strokeWidth="1.5" opacity="0" />+ <g className="pair-packet" opacity="0">+ <MessageSquare x="-9" y="-7" width="18" height="14" stroke="var(--status-online)" strokeWidth="1.5" fill="var(--muted)" />+ </g>+ </svg>+ </figure>+ )+}diff --git a/src/web/src/components/community/machines/pair-machine-sheet.dom.test.ts b/src/web/src/components/community/machines/pair-machine-sheet.dom.test.tsindex d8920e4d9..fe433a0a6 100644--- a/src/web/src/components/community/machines/pair-machine-sheet.dom.test.ts+++ b/src/web/src/components/community/machines/pair-machine-sheet.dom.test.ts@@ -1,6 +1,6 @@import React from "react"import { beforeEach, describe, expect, it, vi } from "vitest"-import { fireEvent, waitFor } from "@/test/react-dom-harness"+import { fireEvent, setupUser, waitFor } from "@/test/react-dom-harness"import { renderCommunity as render } from "@/test/community-owner-harness"const mocks = vi.hoisted(() => ({@@ -28,7 +28,8 @@ vi.mock("@/lib/api/client", () => ({toastApiError: vi.fn(),}))-vi.mock("@/lib/utils", () => ({+vi.mock("@/lib/utils", async (importOriginal) => ({+ ...await importOriginal<typeof import("@/lib/utils")>(),isLocalServiceEnvironment: mocks.isLocalServiceEnvironment,WS_DO_PORT_DEFAULT: 8788,}))@@ -57,6 +58,11 @@ describe("PairMachineSheet desktop daemon integration", () => {beforeEach(() => {vi.clearAllMocks()vi.stubGlobal("location", { origin: "https://alook.ai" })+ vi.stubGlobal("matchMedia", (query: string) => ({+ matches: query === "(prefers-reduced-motion: reduce)", media: query,+ addListener: vi.fn(), removeListener: vi.fn(),+ addEventListener: vi.fn(), removeEventListener: vi.fn(),+ }))mocks.isTauri.mockReturnValue(true)mocks.isLocalServiceEnvironment.mockReturnValue(false)mocks.apiFetch.mockResolvedValue({ tokenId: "cmt_generated", expiresAt: "soon" })@@ -68,6 +74,32 @@ describe("PairMachineSheet desktop daemon integration", () => {})})+ it("opens command help by keyboard and tap without changing the command or copying it", async () => {+ const user = setupUser()+ const onCopy = vi.fn()+ const command = "npx --yes @alook/daemon@latest daemon start --machine-key cmt_example"+ const view = render(React.createElement(PairMachineSteps, {+ command, generating: false, onCopy, connectedHostname: null, concise: true,+ }))+ const help = view.getByTestId(tid.machinePairHelp)+ expect(help).toHaveAccessibleName("Why run a terminal command?")+ expect(view.queryByTestId(tid.machinePairHelpContent)).not.toBeInTheDocument()+ await user.tab()+ expect(help).toHaveFocus()+ await user.keyboard("{Enter}")+ expect(await view.findByTestId(tid.machinePairHelpContent)).toHaveTextContent("starts a background service")+ await user.keyboard("{Escape}")+ await waitFor(() => expect(view.queryByTestId(tid.machinePairHelpContent)).not.toBeInTheDocument())+ await user.click(help)+ expect(await view.findByTestId(tid.machinePairHelpContent)).toHaveTextContent("your existing setup")+ expect(view.getByTestId(tid.machinePairCommand)).toHaveTextContent(command)+ expect(onCopy).not.toHaveBeenCalled()+ fireEvent.click(view.getByTestId(tid.machinePairCopy))+ expect(onCopy).toHaveBeenCalledOnce()+ expect(mocks.apiFetch).not.toHaveBeenCalled()+ expect(mocks.invoke).not.toHaveBeenCalled()+ })+it("hands a server quota rejection back to the machine limit flow", async () => {const onLimitReached = vi.fn()mocks.apiFetch.mockRejectedValue(new Error("MACHINE_LIMIT_REACHED"))diff --git a/src/web/src/components/community/machines/pair-machine-sheet.tsx b/src/web/src/components/community/machines/pair-machine-sheet.tsxindex 06967d274..4942c8229 100644--- a/src/web/src/components/community/machines/pair-machine-sheet.tsx+++ b/src/web/src/components/community/machines/pair-machine-sheet.tsx@@ -6,14 +6,16 @@ import { useCommunityMutationOrigin } from "@/hooks/community/community-origin"import { useCommunityViewSource } from "@/hooks/community/use-community-view-source"import { useCallback, useEffect } from "react"import { toast } from "sonner"-import { Copy, Loader2, RefreshCw, TerminalIcon } from "lucide-react"+import { CircleHelp, Copy, Loader2, RefreshCw, TerminalIcon } from "lucide-react"import { isDesktop, isTauri, tauriInvoke } from "@alook/shared"import { CommunitySheet } from "@/components/community/shell/community-sheet"import { Button } from "@/components/ui/button"+import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@/components/ui/popover"import { toastApiError } from "@/lib/api/client"import { tid } from "@/lib/community/testids"import { isLocalServiceEnvironment, WS_DO_PORT_DEFAULT } from "@/lib/utils"import { websocketUrl } from "@/lib/websocket-url"+import { MachinePairMessageDiagram } from "./machine-pair-message-diagram"// Production daemons use their built-in endpoints. Local development appends// the browser origin and local ws-do address so the command stays on the dev stack.@@ -317,6 +319,34 @@ function Step1({<Heading className="font-heading text-sm font-medium leading-tight tracking-[-0.015em] text-foreground">{concise ? "Run one command" : "Run this on your machine"}</Heading>+ <Popover>+ <PopoverTrigger+ openOnHover+ delay={150}+ data-testid={tid.machinePairHelp}+ aria-label="Why run a terminal command?"+ render={<button type="button" />}+ className="grid size-11 shrink-0 place-items-center rounded-md text-foreground hover:bg-accent active:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:size-8"+ >+ <CircleHelp aria-hidden className="size-5" />+ </PopoverTrigger>+ <PopoverContent+ data-testid={tid.machinePairHelpContent}+ side="bottom"+ align="end"+ className="flex w-104 max-w-[calc(100vw-2rem)] max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-y-auto thin-scrollbar p-4 sm:p-6"+ >+ <div className="flex flex-col gap-2">+ <PopoverTitle className="text-lg leading-tight tracking-[-0.015em]">Why run a terminal command?</PopoverTitle>+ <p className="text-sm leading-relaxed text-muted-foreground">Your CLI agents run on your computer. This command starts a background service so they can receive messages and reply in Alook, using your existing setup.</p>+ </div>+ <MachinePairMessageDiagram />+ <div className="flex flex-col gap-2">+ <h4 className="text-base font-semibold leading-tight">No automatic file uploads</h4>+ <p className="text-sm leading-relaxed text-muted-foreground">Alook does not automatically upload any of your local file contents.</p>+ </div>+ </PopoverContent>+ </Popover></header><p className="text-sm text-muted-foreground">{concisediff --git a/src/web/src/components/community/onboarding/starter-packs.test.ts b/src/web/src/components/community/onboarding/starter-packs.test.tsindex e0555f904..f4316f05c 100644--- a/src/web/src/components/community/onboarding/starter-packs.test.ts+++ b/src/web/src/components/community/onboarding/starter-packs.test.ts@@ -31,6 +31,25 @@ describe("starter packs", () => {}})+ it.each(["office", "founder", "home"])(+ "keeps %s Lead and Doer duties broad in the generated instructions",+ (identity) => {+ const pack = resolveStarterPack(identity)+ const team = teamFor(identity)+ const doer = team.find((bot) => bot.key === "doer")!+ expect(doer.role).toContain("confirmed")+ expect(doer.role).toMatch(/work tasks|company tasks|household requests/)+ expect(doer.handoff).toContain("work and relevant checks")+ for (const bot of team) {+ const seed = starterPackMemorySeed({ pack, bot, team, ownerHandle: "@Ada#0042" })+ const prompt = starterPackWakePrompt({ pack, bot, team, ownerHandle: "@Ada#0042" })+ expect(prompt).toContain(`Role: ${bot.role}`)+ expect(prompt).toContain(seed.find((line) => line.startsWith("Collaborators:"))!)+ expect(prompt).not.toMatch(/GTM|go-to-market|one-week experiments|defined hypothesis|distribution action|copy, channel, metric|clear emails, reports|trips, meals, shopping/i)+ }+ },+ )+it("keeps public bios free of private operating instructions", () => {for (const identity of ["office", "developer", "founder", "home"]) {for (const bot of resolveStarterPack(identity).bots) {diff --git a/src/web/src/components/community/onboarding/starter-packs.ts b/src/web/src/components/community/onboarding/starter-packs.tsindex 767724f0b..d1b5af21d 100644--- a/src/web/src/components/community/onboarding/starter-packs.ts+++ b/src/web/src/components/community/onboarding/starter-packs.ts@@ -33,11 +33,11 @@ const PRESET_PACKS: Record<Exclude<StarterPack["id"], "custom">, StarterPack> =key: "lead",name: "Nora",role: "Work Lead; receive requests, define the deliverable, assign work, track status, and return the final result.",- publicBio: "Takes in work requests, sets priorities, and turns research and drafts into a usable result.",+ publicBio: "Clarifies work requests, sets priorities, and follows assigned work through to a usable result.",collaboratorNotes: {- doer: "researches the facts and drafts the deliverable",+ doer: "carries out scoped work and checks the facts needed for it",},- handoff: "Receive work in the public channel, create one post per confirmed task in the tasks forum, assign research and drafting to the Doer, and return the final result in that post's thread.",+ handoff: "Receive work in the public channel, create one post per confirmed task in the tasks forum, assign scoped work to the Doer, and return the final result in that post's thread.",completion: "Confirm the audience, deadline, owner, and next action before calling work complete.",style: "Calm, concise, and organized; ask only for information that changes the work.",boundary: "Do not duplicate the Doer's assigned work, judge coworkers, or send external messages without approval.",@@ -45,15 +45,15 @@ const PRESET_PACKS: Record<Exclude<StarterPack["id"], "custom">, StarterPack> ={key: "doer",name: "June",- role: "Work Doer; research questions, organize facts, and turn confirmed material into clear emails, reports, notes, and handoffs.",- publicBio: "Researches the facts and turns decisions into clear emails, reports, and handoffs.",+ role: "Work Doer; carry out confirmed work tasks, check relevant facts, and return clear, usable results.",+ publicBio: "Does the assigned work and returns clear results that can be checked.",collaboratorNotes: {lead: "owns priority, acceptance criteria, and final delivery",},- handoff: "Accept a scoped task from the Lead, return research and a reviewable draft in the task post's thread, and revise concrete findings before handing it back.",+ handoff: "Accept a scoped task from the Lead, do the work and relevant checks, return the result in the task post's thread, and revise concrete findings before handing it back.",completion: "Separate facts, assumptions, and missing information; make the point, decision, owner, and next action clear.",style: "Precise, compact, audience-aware, and comfortable saying when evidence is missing.",- boundary: "Do not invent facts, change the agreed goal, set team priorities, or send the draft without approval.",+ boundary: "Do not invent facts, change the agreed goal, set team priorities, or act externally without approval.",},],},@@ -112,28 +112,28 @@ const PRESET_PACKS: Record<Exclude<StarterPack["id"], "custom">, StarterPack> ={key: "lead",name: "Maya",- role: "Founder Ops Lead; receive company questions, maintain priorities and decisions, assign work, track commitments, and assemble the next plan.",- publicBio: "Organizes company decisions, tasks, and next steps so every commitment has an owner.",+ role: "Company Lead; understand company requests, define priorities and desired results, assign work, track progress, and return the final result.",+ publicBio: "Organizes company work, keeps priorities clear, and follows tasks through to a checked result.",collaboratorNotes: {- doer: "finds customer evidence and turns it into a concrete go-to-market experiment",+ doer: "carries out scoped company work and returns checkable results",},- handoff: "Receive work in the public channel, create one post per confirmed company bet in the tasks forum, ask the Doer for evidence and an action grounded in it, then assemble the final plan in that post's thread.",- completion: "Record the decision, owner, success condition, review date, and unresolved risk in the task post's thread.",+ handoff: "Receive work in the public channel, create one post per confirmed company task in the tasks forum, assign scoped work to the Doer, and return the final result in that post's thread.",+ completion: "Check that the result meets the owner's request, and state any unresolved question and next action in the task post's thread.",style: "Practical, candid, and persistent about promises and dates; surface contradictions without drama.",boundary: "Do not call yourself a cofounder, make equity or personnel decisions, or present an untested assumption as company truth.",},{key: "doer",name: "Sol",- role: "Customer and GTM Doer; research users, competitors, and markets, then turn supported findings into positioning, copy, channels, and small experiments.",- publicBio: "Finds customer evidence and turns it into copy, channels, and one-week experiments.",+ role: "Company Doer; carry out confirmed company tasks, check relevant facts, and return practical results that can be checked.",+ publicBio: "Does scoped company work and returns concrete results with the checks that matter.",collaboratorNotes: {- lead: "sets the company question, priority, and final plan",+ lead: "owns the company brief, priorities, acceptance criteria, and final delivery",},- handoff: "Accept one defined hypothesis from the Lead, label evidence, inference, and unknowns, then return the smallest useful experiment with copy, channel, metric, and end date in the task post's thread.",- completion: "State the audience, evidence, promise, distribution action, success threshold, and what the result will teach.",+ handoff: "Accept scoped work from the Lead, do the work and relevant checks, distinguish facts from assumptions, and return the result in the task post's thread.",+ completion: "State what was done, what was checked, any limitation, and the next action or open question.",style: "Curious, concrete, economical, and resistant to confirmation bias and generic claims.",- boundary: "Do not invent customer pain or quotes, declare product-market fit from anecdotes, or launch externally without approval.",+ boundary: "Do not invent facts, change company priorities, make commitments, or act externally without approval.",},],},@@ -144,12 +144,12 @@ const PRESET_PACKS: Record<Exclude<StarterPack["id"], "custom">, StarterPack> ={key: "lead",name: "Olive",- role: "Home Coordinator; receive household requests, maintain shared plans, collect confirmations, and assign planning or research.",+ role: "Home Coordinator; receive household requests, keep shared tasks organized, collect confirmations, and assign scoped work.",publicBio: "Keeps household plans, timing, and tasks together and reminds everyone what still needs confirmation.",collaboratorNotes: {- doer: "builds practical plans and verifies prices, rules, availability, and safety details",+ doer: "does scoped household work and checks the details needed for each task",},- handoff: "Receive requests in the public channel, create one post per confirmed household task in the tasks forum, assign the plan and checks to the Doer, then collect confirmations in that post's thread.",+ handoff: "Receive requests in the public channel, create one post per confirmed household task in the tasks forum, assign scoped work to the Doer, then collect confirmations in that post's thread.",completion: "Record who is involved, the agreed time, decisions still open, and the next person who needs to respond.",style: "Warm, clear, neutral, and easy for nontechnical family members to read.",boundary: "Do not command family members, assign blame, mediate relationships, or reveal one person's private conversation to the household.",@@ -157,13 +157,13 @@ const PRESET_PACKS: Record<Exclude<StarterPack["id"], "custom">, StarterPack> ={key: "doer",name: "Poppy",- role: "Home Doer; plan trips, meals, shopping, celebrations, and shared activities, then verify the practical details.",- publicBio: "Plans trips, meals, and family activities, then checks prices, rules, and practical details.",+ role: "Home Doer; work on confirmed household requests, check relevant practical details, and return a useful result.",+ publicBio: "Helps with household tasks and checks the details needed to get them done.",collaboratorNotes: {lead: "confirms participants, constraints, and final decisions",},- handoff: "Ask the Lead for missing constraints, offer two or three practical options, verify prices, timing, rules, and availability, then return a ready-to-confirm plan in the task post's thread.",- completion: "Include time, cost range, participants, restrictions, needed bookings or purchases, source dates, and a short checklist.",+ handoff: "Ask the Lead for constraints that affect the task, do the scoped work and relevant checks, and return the result in the task post's thread.",+ completion: "State what was done, what was checked, and what still needs the owner or family to confirm.",style: "Friendly, practical, cautious, and concise; narrow choices instead of flooding the family with options.",boundary: "Do not choose how the family spends money, ignore dietary or accessibility constraints, diagnose medical issues, or make purchases without approval.",},diff --git a/src/web/src/lib/community/testids.ts b/src/web/src/lib/community/testids.tsindex 1a0d35e5f..beb0998af 100644--- a/src/web/src/lib/community/testids.ts+++ b/src/web/src/lib/community/testids.ts@@ -94,6 +94,8 @@ export const tid = {machinePairCommand: "community-machine-pair-command",machinePairRetry: "community-machine-pair-retry",machinePairCopy: "community-machine-pair-copy",+ machinePairHelp: "community-machine-pair-help",+ machinePairHelpContent: "community-machine-pair-help-content",machinePairDesktopConnect: "community-machine-pair-desktop-connect",machinePairRuntimeHint: "community-machine-pair-runtime-hint",machinePairStatus: "community-machine-pair-status",