@agent-native/pinpoint

中文文档
0.1.108发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 8073

Visual feedback and annotation tool for agent-native web applications

原始使用文档
文档目录33 节
  1. AI Agent Setup Guide
  2. Step 1: Install
  3. Step 2: Initialize agent actions and skill
  4. Step 3: Mount the client overlay
  5. Step 4: Add server middleware
  6. Step 5: Verify
  7. Working with Pins
  8. Troubleshooting
  9. Install
  10. Quick Start
  11. React
  12. Vanilla JS / Script Tag
  13. Imperative API (Non-React)
  14. Setup in an Agent-Native App
  15. 1. Install
  16. 2. Initialize
  17. 3. Client — Mount the overlay
  18. 4. Server — Add the REST middleware
  19. How It Works
  20. Configuration
  21. CLI
  22. Keyboard Shortcuts
  23. Package Exports
  24. Server Middleware
  25. Agent Actions
  26. Primitives API
  27. Plugin System
  28. A2A & MCP
  29. Framework Support
  30. Storage Adapters
  31. Builder.io Integration
  32. Architecture
  33. License

@agent-native/pinpoint

Visual feedback and annotation tool for web applications. Users select UI elements, add feedback, and send structured context to any AI agent.

Pinpoint is a Toolkit capability module installed on demand. It lives in its own npm package so apps only take the visual feedback surfaces and agent integration they need.

Works standalone, with Builder.io, or with any agent runtime that speaks the agent-native protocol (Builder.io, Claude Code, Codex, Gemini CLI, Cursor, etc.).

AI Agent Setup Guide

Instructions for an AI agent (Builder.io, Claude Code, Codex, Cursor, etc.) to add Pinpoint to an agent-native repository.

Step 1: Install

pnpm add @agent-native/pinpoint

Step 2: Initialize agent actions and skill

npx @agent-native/pinpoint@latest init

This copies agent actions to actions/ and the Pinpoint skill to .agents/skills/pinpoint/. No manual file copying needed.

Step 3: Mount the client overlay

Find the root React component (typically app/App.tsx or src/App.tsx). Add the <Pinpoint /> component:

import { Pinpoint } from "@agent-native/pinpoint/react";

// Add as a sibling to your app root — renders nothing, mounts overlay in Shadow DOM
<Pinpoint author="User" endpoint="/api/pins" autoSubmit colorScheme="auto" />;

If the app is not React-based, use the imperative API:

import { mountPinpoint } from "@agent-native/pinpoint";
mountPinpoint({ author: "User", endpoint: "/api/pins", autoSubmit: true });

Step 4: Add server middleware

Find the Express server setup (typically server/index.ts). Add the pin routes:

import { pagePinRoutes } from "@agent-native/pinpoint/server";

// Add before your page routes
app.use("/api/pins", pagePinRoutes());

This creates REST endpoints at /api/pins for pin CRUD. Pins are stored as JSON files in data/pins/.

Step 5: Verify

  1. Start the dev server
  2. Open the app in a browser
  3. Press Cmd+Shift+. to toggle the Pinpoint toolbar
  4. Click any element, add a comment, click "Add Pin"
  5. Click the send button — the annotation should appear in the agent chat

Working with Pins

Pins are stored as individual JSON files in data/pins/{uuid}.json:

{
  "id": "uuid",
  "pageUrl": "/dashboard",
  "comment": "This button color is wrong",
  "element": {
    "tagName": "button",
    "selector": ".sidebar button.primary",
    "classNames": ["primary", "btn"]
  },
  "framework": {
    "framework": "react",
    "componentPath": "<Sidebar> <ActionButton>",
    "sourceFile": "src/components/Sidebar.tsx:42"
  },
  "status": { "state": "open" }
}

Key fields for agents:

  • sourceFile — the exact file and line to edit
  • componentPath — the React/Vue component hierarchy
  • selector — CSS selector to find the element in the DOM
  • comment — what the user wants changed

Agent commands (available after npx @agent-native/pinpoint@latest init):

  • pnpm action get-pins --status open — list unresolved pins
  • pnpm action resolve-pin --id <uuid> — mark as resolved after fixing
  • pnpm action create-pin --pageUrl / --selector ".btn" --comment "Fix this"
  • pnpm action update-pin --id <uuid> --comment "Updated feedback"
  • pnpm action delete-pin --id <uuid> — remove a pin

Workflow:

  1. User creates annotations in the browser
  2. Read with pnpm action get-pins --status open
  3. Use sourceFile to locate and edit the relevant code
  4. After fixing, mark resolved: pnpm action resolve-pin --id <uuid>

Troubleshooting

IssueFix
Toolbar doesn't appearCheck that <Pinpoint /> is mounted. Press Cmd+Shift+.
Pins not persistingEnsure endpoint="/api/pins" is set and server middleware is added
sourceFile is emptySource detection requires dev mode. Production builds strip _debugSource
"Cannot find module"Run pnpm install. Check the package is in dependencies

Install

pnpm add @agent-native/pinpoint
# or
npm install @agent-native/pinpoint

Quick Start

React

import { Pinpoint } from "@agent-native/pinpoint/react";

function App() {
  return (
    <>
      <Pinpoint author="Designer" endpoint="/api/pins" autoSubmit />
      <YourApp />
    </>
  );
}

Vanilla JS / Script Tag

<script src="https://unpkg.com/@agent-native/pinpoint/dist/index.browser.js"></script>
<script>
  Pinpoint.mountPinpoint({ author: "Designer" });
</script>

Imperative API (Non-React)

import { mountPinpoint } from "@agent-native/pinpoint";

const { dispose } = mountPinpoint({
  author: "Designer",
  endpoint: "/api/pins",
});
// Call dispose() to unmount

Setup in an Agent-Native App

1. Install

pnpm add @agent-native/pinpoint

2. Initialize

npx @agent-native/pinpoint@latest init

Copies agent actions to actions/ and the Pinpoint skill to .agents/skills/pinpoint/.

3. Client — Mount the overlay

// app/App.tsx
import { Pinpoint } from "@agent-native/pinpoint/react";

function App() {
  return (
    <>
      <Pinpoint
        author="Designer"
        endpoint="/api/pins"
        autoSubmit
        colorScheme="auto"
      />
      <YourApp />
    </>
  );
}

4. Server — Add the REST middleware

// server/index.ts
import { createServer } from "@agent-native/core/server";
import { pagePinRoutes } from "@agent-native/pinpoint/server";

const app = createServer({
  /* ... */
});
app.use("/api/pins", pagePinRoutes());

How It Works

  1. Toggle the toolbar: Cmd+Shift+. (or Ctrl+Shift+.)
  2. Click any element to annotate it
  3. Type feedback in the popup
  4. Send to the agent: Cmd+Shift+Enter

The agent receives structured context: CSS selector, component hierarchy, source file location, and the user's comment.

Configuration

All options can be passed as props to <Pinpoint /> or as the config object to mountPinpoint():

OptionTypeDefaultDescription
authorstring—Who is annotating
endpointstring—REST endpoint for persistence (e.g., /api/pins)
colorScheme'auto' | 'light' | 'dark''auto'Theme
outputFormat'compact' | 'standard' | 'detailed''standard'Detail level in agent output
autoSubmitbooleantrueAuto-submit annotations to agent chat
clearOnSendbooleanfalseClear pins after sending
sendToAgent(output) => void | Promise<void>—Custom bridge for annotation delivery
blockInteractionsbooleanfalseBlock page clicks during selection
compactPopupbooleantrueHide technical details behind toggle
freezeJSTimersbooleanfalseFreeze JS timers during selection
allowedOriginsstring[]—Allowed origins for postMessage
webhookUrlstring—Webhook URL for pin events
includeSourcePathsboolean—Include source file paths in output
markerColorstring'#3b82f6'Badge color on annotated elements
pluginsPlugin[]—Plugin extensions
storagePinStorage—Custom storage adapter
position{ x, y }—Initial toolbar position

CLI

npx @agent-native/pinpoint@latest init   # Copy actions and skill to your project
npx @agent-native/pinpoint@latest        # Show help

Keyboard Shortcuts

ShortcutAction
Cmd/Ctrl+Shift+.Toggle toolbar
Cmd/Ctrl+Shift+CCopy annotations to clipboard
Cmd/Ctrl+Shift+EnterSend annotations to agent
EscClose popup / collapse toolbar
Shift+DragMulti-select elements

Package Exports

Import PathWhat It Provides
@agent-native/pinpointmountPinpoint(), unmountPinpoint(), types
@agent-native/pinpoint/react<Pinpoint /> React component
@agent-native/pinpoint/serverpagePinRoutes() Express middleware
@agent-native/pinpoint/primitivesgetElementContext(), freeze(), unfreeze(), openFile()
@agent-native/pinpoint/typesTypeScript types (Pin, PinpointConfig, etc.)

Server Middleware

Express middleware for pin CRUD:

import { pagePinRoutes } from "@agent-native/pinpoint/server";

app.use("/api/pins", pagePinRoutes({ dataDir: "data/pins" }));
MethodEndpointDescription
GET/api/pinsList pins (query: pageUrl, status)
GET/api/pins/:idGet a pin
POST/api/pinsCreate a pin
PATCH/api/pins/:idUpdate a pin
DELETE/api/pins/:idDelete a pin
DELETE/api/pinsClear pins (query: pageUrl)

Agent Actions

Available after running npx @agent-native/pinpoint@latest init:

ActionPurposeArgs
get-pinsList pins--pageUrl, --status
create-pinCreate a pin--pageUrl, --selector, --comment
resolve-pinMark as resolved--id, --message
update-pinUpdate a pin--id, --comment, --status
delete-pinRemove a pin--id
list-sessionsList pages with pins—

Primitives API

Standalone functions for programmatic element inspection (no UI):

import {
  getElementContext,
  freeze,
  unfreeze,
  openFile,
  detectFramework,
} from "@agent-native/pinpoint/primitives";

const context = getElementContext(document.querySelector(".sidebar"));

freeze(); // Pause all animations
unfreeze(); // Resume

openFile("src/components/Sidebar.tsx", 42); // Open in editor

Plugin System

import type { Plugin } from "@agent-native/pinpoint/types";

const myPlugin: Plugin = {
  name: "analytics",
  hooks: {
    onPinCreate(pin) {
      analytics.track("pin_created", { page: pin.pageUrl });
    },
    onPinResolve(pin) {
      analytics.track("pin_resolved", { id: pin.id });
    },
    transformOutput(output) {
      return output + "\n\n_Sent via Pinpoint_";
    },
  },
  actions: [
    {
      label: "Export to Jira",
      handler(element, context) {
        createJiraTicket(context);
      },
    },
  ],
};

A2A & MCP

Expose pins to external agents via A2A or MCP:

import {
  registerPinpointA2A,
  createPinpointMCPTools,
} from "@agent-native/pinpoint/server";

registerPinpointA2A(app); // /.well-known/agent-card.json

const { tools, handleTool } = createPinpointMCPTools(); // MCP tool handlers

Framework Support

FrameworkDetectionComponent InfoSource Location
React 18/19Auto (via bippy)Component hierarchy_debugSource / element-source
Vue 3Auto (__VUE__)Component tree$options.__file
OtherFallbackDOM-onlyNot available

Storage Adapters

AdapterUse CasePersistence
MemoryStoreStandalone, no serverSession only (lost on reload)
RestClientBrowser with serverServer-side via REST API
FileStoreServer-sidedata/pins/{uuid}.json

Builder.io Integration

Inside Builder.io's Fusion, annotations are sent via sendToAgentChat() from @agent-native/core:

<Pinpoint author="Builder User" autoSubmit outputFormat="standard" />

No additional configuration needed when running inside a Builder.io project.

Hosts with their own chat implementation can pass sendToAgent to reuse Pinpoint's pin, draw, queue, and prompt UI while delivering { message, context, submit } themselves.

Architecture

  • SolidJS overlay in Shadow DOM — zero interference with host app styles or React reconciliation
  • Canvas-based hover highlighting with LERP interpolation — smooth 60fps
  • One file per pin — eliminates concurrent write conflicts
  • Pluggable storage — MemoryStore, RestClient, FileStore
  • MIT libraries: bippy, @medv/finder, element-source

License

MIT

版本与发布记录

@agent-native/pinpoint 共发布 135 个版本,首次发布于 2026/04/30;过去 12 个月发布了 135 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.108latest2026/11/051 天前
0.1.1062026/11/033 天前
0.1.1052026/10/307 天前
0.1.1042026/10/297 天前
0.1.1032026/10/298 天前
0.1.1022026/10/289 天前

其他发布通道:dev-embed-chat-beta-20261025 → 0.1.102-embed-chat-beta-20261025-20261025212203,dev-beta-dispatch-embed-01a15dc9 → 0.1.102-beta-dispatch-embed-01a15dc9-20261027050558,dev-embedded-chat-fix-20261027 → 0.1.102-embedded-chat-fix-20261027-20261027063754,dev-same-host-mcp-20261027 → 0.1.102-same-host-mcp-20261027-20261027081850,dev-chat-origin-secure-20261027 → 0.1.102-chat-origin-secure-20261027-20261027102654,dev-embedded-chat-20261027 → 0.1.102-embedded-chat-20261027-20261027145752。

关于 @agent-native/pinpoint 的常见问题

@agent-native/pinpoint 是什么?

Visual feedback and annotation tool for agent-native web applications

如何安装 @agent-native/pinpoint?

在项目目录运行 npm install @agent-native/pinpoint,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@agent-native/core(>=0.224.0-0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 pinpoint,可以用 npx pinpoint 直接运行。

@agent-native/pinpoint 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agent-native/pinpoint 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agent-native/pinpoint 可以商用吗?

@agent-native/pinpoint 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agent-native/pinpoint 的下载量有多少?

根据 npm 官方下载统计,@agent-native/pinpoint 在 2026/10/05 – 2026/11/03 这 30 天内被下载 8,073 次,日均约 269 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agent-native/pinpoint 还在维护吗?

最新版本 0.1.108 发布于 2026/11/05(1 天前);至今共发布 135 个版本,其中过去 12 个月发布了 135 个;首次发布于 2026/04/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。