跳到正文
cccskills
免费在 GitHub 公开

build-agent-app

Build a React + Node app with an AI agent inside using Boring UI, or add one to an existing app. Use when asked to "create an agent app", "add an AI assistant/chat/copilot to my app", "scaffold a Boring UI app", "wire AgentWorkspace/PiChat to a server", "set up the Pi Harness with the kit", or to connect the pi-app, pi-chat or pi-ambient blocks to defineAgent, createChatTransportHandler, createConversationsHandler and createRevisionHandler. Gives the verified smallest setup (one Node server, one page) and how to extend it.

中文简介正在准备中。当前显示原文说明。

集成工具OpenAI

实测评分 未实测

查看安装方法

包含的文件(3)

  • SKILL.md7.2 KB
  • references/page.md3.3 KB
  • references/server.md6.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Build an agent app

The smallest whole agent app is one Node server (about 90 lines) and one React page (about 50 lines). The repository's reference is examples/workspace-app. This skill gives the same composition with nothing repository-internal.

Shape of the result:

  • Server (server.mjs): opens Pi's Harness, one workspace provider and one agent, and serves three routes: /api/conversations, /api/chat, /api/resources.
  • Page (src/App.tsx): the pi-app block's AgentWorkspace (sessions, chat, artifact viewers) over those routes.

1. Get the version

npm view @hachej/boring-ui-kit version

Use that version (written <v> below) for every @hachej/boring-* package and every registry URL. Pi packages stay on ~1.2.0.

2. Create the app (skip for an existing app)

A new app uses the pinned shadcn CLI with Base UI and the nova preset (blocks support the Base UI base-nova style only):

npx shadcn@4.21.5 init -t vite -b base -p nova -n app -y --no-monorepo
cd app

An existing app needs React 19, Tailwind v4 and a components.json with a Base UI style. Without one, run npx shadcn@4.21.5 init in it first.

3. Install the packages

npm i @hachej/boring-ui-kit@<v> @hachej/boring-agent@<v> @hachej/boring-files@<v> \
  @earendil-works/pi-durable@~1.2.0 @earendil-works/pi-ai@~1.2.0 @earendil-works/chord@~1.2.0

4. Add the UI block

Pick the block from the table in registry/README.md. For a whole agent page:

npx boring-ui-blocks add https://cdn.jsdelivr.net/npm/@hachej/boring-ui-kit@<v>/r/pi-app.json

This copies pi-app, pi-chat, pi-workspace, viewers, theme and their shadcn components into src/components/, and writes SHADCN-GENERATED.json. Never edit those files; see the add-blocks skill.

Other placements use the same server:

PlacementBlockComponent
Whole page: sessions, chat, viewerspi-appAgentWorkspace
Floating bar over an existing sitepi-ambientAmbientChat
One agent above any app (phone drawer, desktop panel)app-shellAppShell
Only the conversation, your own layoutpi-chatPiChat

5. Write the server

Copy references/server.md to server.mjs. In order, it:

  1. Creates models: createModels() from @earendil-works/pi-ai/models, then models.setProvider(openaiProvider()) (reads OPENAI_API_KEY).
  2. Opens one workspace: NodeExecutionEnv over a directory, openNodeConnection + createWorkspaceJournal, then one createWorkspaceProvider({ identity, fs: env, journal }).
  3. Defines the agent: defineAgent({ id, model, instructions, tools: [createPresentTool({ workspace })], extensions: [fileTools, createFileGuard({ workspace })] }). fileTools is Pi's own createReadTool, createWriteTool and createEditTool in one defineExtension; the guard routes them through the provider.
  4. Opens the Harness: agent.install(registry), Harness.open(storage, { registry, models, env: () => env }, context), createConversations({ harness, context }), harness.resume().
  5. Serves the routes, each behind authenticate/resolve:
    • createConversationsHandler({ conversations, authenticate }): authenticate returns { owner, start }.
    • createChatTransportHandler({ authenticate }): authenticate returns { conversation, context, abortSubmission }.
    • createRevisionHandler({ resolve }): resolve returns { provider: files, access }.
  6. Bridges Node HTTP with webRequest and sendWebResponse from @hachej/boring-files/node-http, and closes everything on SIGINT/SIGTERM.

Replace the development bearer check (allowed) with your own authentication before anything leaves your machine.

6. Write the page

Copy references/page.md to src/App.tsx. It:

  • connects the revision provider: connectRevisionProvider({ endpoint, fetch }) from @hachej/boring-files/revision;
  • lists sessions: useConversations({ endpoint, fetch, activeId, onSelect });
  • opens the chat: useRemoteChat({ conversationId, endpoint: id => ..., fetch, identity });
  • renders <AgentWorkspace conversationId conversations revisionProvider controller chat /> inside TooltipProvider.

Pass controller={chat.status === 'ready' ? chat.controller : undefined} and chat.actions (question and approval answers) only when ready. The identity (runtimeId, scopeId, principalId, initiatorId) must match the access the server resolves.

7. Connect them in development

Add a proxy to vite.config.ts so the page reaches the server on the same origin:

server: {
  // Development only: forward the API and add the server's dev bearer token.
  proxy: { '/api': { target: 'http://127.0.0.1:8787', headers: { authorization: `Bearer ${process.env.APP_TOKEN ?? 'dev-token'}` } } },
},

Run both:

OPENAI_API_KEY=... node server.mjs
npm run dev

Open the page and click Draft a plan. The agent writes a Markdown file and present opens it in the panel.

Extend it

Rules

  • The server opens and closes the Harness. Never put a model key or the dev token in browser code for production.
  • One workspace provider per workspace. present, the file guard and the revision route all get the same files.
  • Agent-written files are data. Never import() them into the server.
  • Fictional data only in seeds, prompts and tests.

Verify

  1. node server.mjs prints API on http://127.0.0.1:8787.
  2. APP_TOKEN=dev-token; curl -H "authorization: Bearer $APP_TOKEN" http://127.0.0.1:8787/api/conversations returns {"conversations":[...]}; without the header it returns 401.
  3. npx tsc -p tsconfig.app.json --noEmit reports nothing in src/App.tsx, and npx vite build succeeds.
  4. The page shows the sessions pane, the chat with Draft a plan and the Library.
  5. npx boring-ui-blocks check --design src prints ok.
  6. With a real key, one turn writes a file and opens it in the panel.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Find, install, update, check and theme Boring UI registry blocks (shadcn items such as pi-chat, pi-ambient, pi-workspace, pi-app, app-shell, viewers, file-tree, documents, feedback, windows) with the boring-ui-blocks command. Use when asked to "add a chat/agent block", "install pi-app", "upgrade/update the Boring blocks", "boring-ui-blocks check fails", "blocks edited", "restyle/rebrand the agent UI", "change the chat labels/icons/actions", "dark mode for the chat", or when tempted to edit a file under src/components/pi-*.

中文简介正在准备中。当前显示原文说明。

hachej/boring-ui492026年10月23日 更新

Give a Boring UI in-app agent capabilities and gate them safely - custom tools, workspace file access (file guard, present), Approve/Deny approvals, ask_user questions, sub-agents (delegate), schedules, sandboxes and self-evolving tools. Use when asked to "add a tool to the agent", "let the agent edit files", "require approval before X", "ask the user a question", "add a sub-agent/delegate", "schedule a follow-up/reminder", "dry-run/sandbox the agent", "let the agent write its own tools", or when choosing which tools to gate with requireApproval or createApprovalExtension.

中文简介正在准备中。当前显示原文说明。

hachej/boring-ui492026年10月23日 更新

boring-pm

免费

The domain expert's product manager in a project repository run by the Boring Factory. Use when the expert brings a need or an idea, wants to clarify, change or resume a feature ("reprends la fiche"), asks what is happening with a feature, has a builder's question to answer, or has a preview to try and accept. Interviews one question at a time, writes the contract and mockups on the contract pull request, and submits the expert's approval only after the expert confirms. Never writes code.

中文简介正在准备中。当前显示原文说明。

hachej/boring-ui492026年10月23日 更新

boring-ui

免费

Entry point for building with Boring UI (the @hachej/boring-* npm packages and shadcn registry blocks for apps with an AI agent inside, on the Pi agent harness). Use when a task mentions boring-ui, @hachej/boring-ui-kit, @hachej/boring-agent, @hachej/boring-files, boring-ui-blocks, PiChat, AgentWorkspace, AmbientChat, AppShell, or asks to "add an agent/assistant/chat to my app", "build an app with an agent inside", or "use the Boring kit". Explains the packages, the rules every change must follow, and which boring-ui skill to load next.

中文简介正在准备中。当前显示原文说明。

hachej/boring-ui492026年10月23日 更新

查看 hachej 的全部技能

报告此技能的问题