@ agent- native/ pinpoint (帮助)
网络应用的视觉反馈和注释工具. 用户选择UI元素,添加反馈,并将结构化上下文发送到任何AI代理.
Pinpoint是按要求安装的工具包能力模块。 它生活在一个 拥有 npm 软件包, 因此应用程序只接收视觉反馈表面和代理 他们需要融合.
独立工作,与 构建者.io,或者与任何能说代理人-内设协议的代理运行时间(Builder.io, Claude Code, Codex, 双子座CLI, Cursor等).
AI 代理设置指南
指示AI代理(Builder.io,克洛德代码,Codex,Cursor等)在代理本地寄存器中添加Pinpoint.
步骤1:安装
pnpm add @agent-native/pinpoint
第2步:初始化代理行动和技能
npx @agent-native/pinpoint@latest init
此复制代理动作到 actions/ 和平点技能 .agents/skills/pinpoint/。不需要手动复制文件.
第3步: 挂载客户端
查找根反应组件( 通常为 app/App.tsx 或者说 src/App.tsx) (中文(简体) ). 添加数据 <Pinpoint /> 组件 :
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" />;
如果应用程序不基于反应,请使用必须的 API :
import { mountPinpoint } from "@agent-native/pinpoint";
mountPinpoint({ author: "User", endpoint: "/api/pins", autoSubmit: true });
第4步: 添加服务器中间软件
查找 Express 服务器设置( 通常是) server/index.ts) (中文(简体) ). 添加指针路径 :
import { pagePinRoutes } from "@agent-native/pinpoint/server";
// Add before your page routes
app.use("/api/pins", pagePinRoutes());
创建 REST 端点 /api/pins 为针 CRUD。 纸作为 JSON 文件存储于 data/pins/。 。 。 .
步骤5:核实
- 启动 dev 服务器
- 在浏览器中打开应用程序
- 新闻
Cmd+Shift+.切换 Pinpoint 工具栏 - 单击任意元素,添加注释,并点击"Add Pin"
- 单击发送按钮 — 应在代理聊天中显示注释
与 Pins 合作
柱子作为单个 JSON 文件存储于 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" }
}
代理人关键字段 :
sourceFile——要编辑的确切文件和行componentPath——反应/Vue 组件分级selector—— CSS 选择器在 DOM 中查找元素comment- 用户想要的改变
代理命令 (在 npx @agent-native/pinpoint@latest init:
pnpm action get-pins --status open- 列表中未解决的指针pnpm action resolve-pin --id <uuid>——在修复后标为已解决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>-取出一针
工作流量 :
- 用户在浏览器中创建注释
- 读取
pnpm action get-pins --status open - 使用
sourceFile查找和编辑相关代码 - 修复后, 标记解析 :
pnpm action resolve-pin --id <uuid>
解决问题
| 问题 | 修补 |
|---|---|
| 工具栏没有出现 | 检查 <Pinpoint /> 已挂载。 新闻 Cmd+Shift+. |
| 未持续 | 保证 endpoint="/api/pins" 设置并添加服务器中间软件 |
sourceFile 为空 | 源检测需要dev模式. 生产建筑 _debugSource |
| "找不到模块" | 运行 pnpm install检查软件包 dependencies |
安装
pnpm add @agent-native/pinpoint
# or
npm install @agent-native/pinpoint
快速启动
反应
import { Pinpoint } from "@agent-native/pinpoint/react";
function App() {
return (
<>
<Pinpoint author="Designer" endpoint="/api/pins" autoSubmit />
<YourApp />
</>
);
}
香草JS/脚本标签
<script src="https://unpkg.com/@agent-native/pinpoint/dist/index.browser.js"></script>
<script>
Pinpoint.mountPinpoint({ author: "Designer" });
</script>
强制性 API( 非反应)
import { mountPinpoint } from "@agent-native/pinpoint";
const { dispose } = mountPinpoint({
author: "Designer",
endpoint: "/api/pins",
});
// Call dispose() to unmount
在代理本地应用程序中设置
1. 安装
pnpm add @agent-native/pinpoint
2. 初始化
npx @agent-native/pinpoint@latest init
复制代理动作到 actions/ 和平点技能 .agents/skills/pinpoint/。 。 。 .
3. 客户端-挂载
// app/App.tsx
import { Pinpoint } from "@agent-native/pinpoint/react";
function App() {
return (
<>
<Pinpoint
author="Designer"
endpoint="/api/pins"
autoSubmit
colorScheme="auto"
/>
<YourApp />
</>
);
}
4. 服务器 -- -- 添加 REST 中间软件
// 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());
如何运作
- 切换 工具栏 :
Cmd+Shift+.(或Ctrl+Shift+.(中文(简体) ) - 点击 说明它的任何元素
- 类型 弹出中反馈
- 发送 给代理人的:
Cmd+Shift+Enter
代理接收结构化上下文: CSS 选择器,组件等级,源文件位置,以及用户的评论.
配置
所有选项都可以作为道具传递到 <Pinpoint /> 或作为配置对象 mountPinpoint()数字 :
| 选项 | 类型 | 默认 | 说明 |
|---|---|---|---|
author | string | —— 说 | 谁在注解 |
endpoint | string | —— 说 | REST 持久性的终点(例如, /api/pins(中文(简体) ) |
colorScheme | 'auto' | 'light' | 'dark' | 'auto' | 主题 |
outputFormat | 'compact' | 'standard' | 'detailed' | 'standard' | 代理输出的详细级别 |
autoSubmit | boolean | true | 自动提交代理聊天说明 |
clearOnSend | boolean | false | 发送后清除指针 |
sendToAgent | (output) => void | Promise<void> | —— 说 | 自定义批注发送桥 |
blockInteractions | boolean | false | 选择时点击块页 |
compactPopup | boolean | true | 切换后隐藏技术细节 |
freezeJSTimers | boolean | false | 选择时冻结 JS 计时器 |
allowedOrigins | string[] | —— 说 | 后Message允许的出处 |
webhookUrl | string | —— 说 | 针事件使用 Webhook URL |
includeSourcePaths | boolean | —— 说 | 在输出中包含源文件路径 |
markerColor | string | '#3b82f6' | 附加说明元素上的标记颜色 |
plugins | Plugin[] | —— 说 | 插件扩展 |
storage | PinStorage | —— 说 | 自定义存储适配器 |
position | { x, y } | —— 说 | 初始工具栏位置 |
国 际
npx @agent-native/pinpoint@latest init # Copy actions and skill to your project
npx @agent-native/pinpoint@latest # Show help
键盘快捷键
| 快捷键 | 行动 |
|---|---|
Cmd/Ctrl+Shift+. | 切换工具栏 |
Cmd/Ctrl+Shift+C | 复制剪贴板的注释 |
Cmd/Ctrl+Shift+Enter | 向代理机构发送注释 |
Esc | 关闭弹出/ 倒塌工具栏 |
Shift+Drag | 多选择元素 |
软件包导出
| 导入路径 | 它提供什么 |
|---|---|
@agent-native/pinpoint | mountPinpoint(), (中文(简体) ), unmountPinpoint(),类型 |
@agent-native/pinpoint/react | <Pinpoint /> 反应组件 |
@agent-native/pinpoint/server | pagePinRoutes() 显示中间软件 |
@agent-native/pinpoint/primitives | getElementContext(), (中文(简体) ), freeze(), (中文(简体) ), unfreeze(), (中文(简体) ), openFile() |
@agent-native/pinpoint/types | 类型 :Pin, (中文(简体) ), PinpointConfig页:1 |
服务器中端软件
表示针 CRUD 的中间软件 :
import { pagePinRoutes } from "@agent-native/pinpoint/server";
app.use("/api/pins", pagePinRoutes({ dataDir: "data/pins" }));
| 方法 | 终点 | 说明 |
|---|---|---|
| 获取 | /api/pins | 列表指针( 克里: pageUrl, (中文(简体) ), status(中文(简体) ) |
| 获取 | /api/pins/:id | 拿个针 |
| 邮政 | /api/pins | 创建指针 |
| 帕齐 | /api/pins/:id | 更新针头 |
| 迪莱特 | /api/pins/:id | 删除指针 |
| 迪莱特 | /api/pins | 清除针( 克里: pageUrl(中文(简体) ) |
代理动作
运行后可用 npx @agent-native/pinpoint@latest init数字 :
| 行动 | 目的 | 参数 |
|---|---|---|
get-pins | 列表指针 | --pageUrl, (中文(简体) ), --status |
create-pin | 创建指针 | --pageUrl, (中文(简体) ), --selector, (中文(简体) ), --comment |
resolve-pin | 标记为已解决 | --id, (中文(简体) ), --message |
update-pin | 更新针头 | --id, (中文(简体) ), --comment, (中文(简体) ), --status |
delete-pin | 删除指针 | --id |
list-sessions | 带有指针的列表页面 | —— 说 |
初级 API
方案要素检查的独立职能(无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
插件系统
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 软件
通过 A2A 或 MCP 向外部代理显示指针:
import {
registerPinpointA2A,
createPinpointMCPTools,
} from "@agent-native/pinpoint/server";
registerPinpointA2A(app); // /.well-known/agent-card.json
const { tools, handleTool } = createPinpointMCPTools(); // MCP tool handlers
框架支助
| 框架 | 检测 | 组件信息 | 来源位置 |
|---|---|---|---|
| 反应18/19 | 自动( 通过双盘) | 构成部分等级 | _debugSource / 元素来源 |
| 第3组 | 自动( A)__VUE__(中文(简体) ) | 组件树 | $options.__file |
| 其它 | 倒计时 | 仅限 DOM | 不详 |
存储适配器
| 适配器 | 使用大小写 | 持久性 |
|---|---|---|
MemoryStore | 独立, 没有服务器 | 仅会话( 重新装入时丢失) |
RestClient | 带有服务器的浏览器 | 服务器端通过 REST API |
FileStore | 服务器侧 | data/pins/{uuid}.json |
构建者.io 集成
内部 构建者.io的融合页:1 sendToAgentChat() 从 @agent-native/core数字 :
<Pinpoint author="Builder User" autoSubmit outputFormat="standard" />
在 Builder.io 项目内运行时不需要额外的配置 .
主机拥有自己的聊天执行可以通过 sendToAgent 重新使用平分针,
投递时绘制、队列并提示 UI { message, context, submit } 他们自己.
建筑
- 实心JS 覆盖 内 阴影DOM ——对主机应用程序样式或React调节的零干扰
- 基于帆布 以 LERP 插值- 平滑 60fps 来突出显示
- 每针一个文件 ——消除并发写冲突
- 可插件存储 — 内存站, 休息站, 文件站
- 麻省理工学院图书馆: 双, (中文(简体) ), @ medv/ finder (英语), (中文(简体) ), 元素来源
许可证
麻省理工学院