# @atlaskit/rovo-agent-analytics 中文文档

规范地址：https://npmcn.com/package/%40atlaskit/rovo-agent-analytics/

版本：6\.7\.2
npm 元数据更新时间：2026-11-05T03:57:58.947Z
中文译文更新时间：2026-11-07T02:47:20.112Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40atlaskit/rovo-agent-analytics
原文对照：https://npmcn.com/package/%40atlaskit/rovo-agent-analytics/?lang=original
项目主页：https://bitbucket.org/atlassian/atlassian-frontend-monorepo#readme
源码仓库：https://bitbucket.org/atlassian/atlassian-frontend-monorepo

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：106 kB，109 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：5 个
- peer 依赖：react ^18\.2\.0
- 首次发布：2025-11-27T06:52:49.189Z
- 最新版本发布：2026-11-05T03:57:58.775Z
- 近 30 天下载量：33569（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：70（近 12 个月 70 个）

## 中文简介

罗沃代理分析

## 安装

```sh
npm install @atlaskit/rovo-agent-analytics
```

也可以使用：`pnpm add @atlaskit/rovo-agent-analytics`、`yarn add @atlaskit/rovo-agent-analytics`、`bun add @atlaskit/rovo-agent-analytics`

## README

# Rovo Agent分析器

Rovo Agents 分析库,用于编译并发送已键入分析事件.

## 使用量

```typescript
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';

const { trackAgentEvent } = useRovoAgentActionAnalytics({});

// Full control over event properties — all fields are type-checked
trackAgentEvent({
  action: 'view',
  actionSubject: 'rovoAgent',
  attributes: { 
    agentId: 'agent-123',
    touchPoint: 'browse-agent-list',
  },
});
```

可找到详细的文件和示例使用 [这里](https://atlaskit.atlassian.com/packages/ai-mate/rovo-agent-analytics)。 。 。 .

## 实例

### 基本事件跟踪

用于明确类型的活动 `action`, (中文(简体) ), `actionSubject`,以及 `attributes`数字 :

```typescript
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';

const { trackAgentEvent } = useRovoAgentActionAnalytics({
  agentId,
  touchPoint: 'browse-agent-list',
});

// Track a user interaction
trackAgentEvent({
  action: 'duplicate',
  actionSubject: 'rovoAgent',
  attributes: {},
});
```

### 带有自定义属性的事件跟踪

```typescript
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';

const { trackAgentEvent } = useRovoAgentActionAnalytics({});

// Full control over event properties — all fields are type-checked
trackAgentEvent({
  action: 'created',
  actionSubject: 'batchEvaluationDataset',
  attributes: { 
    totalQuestions: 5 
  },
  objectType: 'batchEvaluationDataset',
  objectId: 'dataset-123',
});
```

## 有效载荷类型

每个组文件在 `src/actions/groups/` 出口a **受歧视的联盟有效载荷类型** 定义该组的所有有效事件形状.

| 文件 | 有效载荷类型 | 说明 |
| --- | --- | --- |
| `agent-interactions.ts` | `AgentInteractionsEventPayload` | 用户启动的交互( 查看、 编辑、 删除、 复制、 明星、 聊天、 校验...) |
| `triggers.ts` | `TriggerEventPayload` | 内置触发视图并完成前端 CRUD 操作 |
| `editing.ts` | `EditingEventPayload` | 代理保存/更改事件(更新) |
| `debug.ts` | `DebugEventPayload` | 调试模式动作( 视图、 复制、 切换技能信息) |
| `tools.ts` | `ToolsEventPayload` | 工具执行动作( 确认、 流站、 查看结果、 错误) |
| `evaluation.ts` | `EvaluationEventPayload` | 批量评价活动(CRUD数据集、工作周期、查看结果) |
| `create-flow.ts` | `CreateFlowEventPayload` | 创建代理漏斗步骤 |
| `add-tools-prompt.ts` | `AddToolsPromptEventPayload` | 添加工具提示模式事件 |
| `value-calculator.ts` | `ValueCalculatorEventPayload` | 代理透视值计算器漏斗 |

合计 `EventPayload` 类型(从 `types.ts`)是所有这些有效载荷类型的联盟.

## 添加新动作

### 现有有效载荷类型

1.  打开组文件(例如. `src/actions/groups/agent-interactions.ts`(中文(简体) )
2.  在有效载荷联盟类型上添加有数据-门户登记链接的新变体:

```typescript
export type AgentInteractionsEventPayload =
  | {
      // https://data-portal.internal.atlassian.com/analytics/registry/XXXXX
      actionSubject: 'rovoAgent';
      action: 'myNewAction';
      attributes: BaseAgentAnalyticsAttributes & {
        myCustomField: string;
      };
    }
  | // ... existing variants
```

就这样——TypeScript在调用时会执行正确的形状 `trackAgentEvent()`。 。 。 .

### 给新组合

如果您的行动不符合任何已有的组,请创建一个新的组:

1.  在 `src/actions/groups/` 遵循现有模板
2.  出口受歧视的联盟有效载荷类型(例如:. `MyFeatureEventPayload`(中文(简体) )
3.  将新类型添加到 `EventPayload` 工会 `src/common/types.ts`数字 :

```typescript
import type { MyFeatureEventPayload } from '../actions/groups/my-feature';

export type EventPayload =
  | EditingEventPayload
  | AgentInteractionsEventPayload
  // ... existing types
  | MyFeatureEventPayload;
```

## 定义自定义属性

有效载荷类型中的每个动作变体可以有自己的具体属性:

### 使用底物分析属性

需要采取的行动 `touchPoint` 财务报告和审定财务报表 `agentId`数字 :

```typescript
{
  actionSubject: 'rovoAgent';
  action: 'view';
  attributes: BaseAgentAnalyticsAttributes;
}
```

### 使用自定义属性

对于需要额外属性的行动:

```typescript
{
  actionSubject: 'rovoAgent';
  action: 'updated';
  attributes: BaseAgentAnalyticsAttributes & { 
    agentType: string; 
    field: string; 
  };
}
```

## 条目点

| 入口 | 说明 |
| --- | --- |
| `@atlaskit/rovo-agent-analytics/actions` | 主要入境点——出口 `useRovoAgentActionAnalytics` 钩子 |
| `@atlaskit/rovo-agent-analytics/create` | 创建代理流分析 — 导出 `useRovoAgentCreateAnalytics` 钩子和 `AgentCreateAction` 类型 |

### 创建流程分析

这个 `useRovoAgentCreateAnalytics` 钩子用于跟踪代理创建漏斗:

```typescript
import { useRovoAgentCreateAnalytics } from '@atlaskit/rovo-agent-analytics/create';

const [csid, { trackCreateSession, trackCreateSessionStart }] = useRovoAgentCreateAnalytics({
  touchPoint: 'agent-studio',
});

// Track funnel steps using string literal actions
trackCreateSession('createFlowStart');
trackCreateSession('createFlowActivate', { agentType: 'custom' });
```

## 常见问题

### @atlaskit/rovo-agent-analytics 是什么？

罗沃代理分析

### 如何安装 @atlaskit/rovo-agent-analytics？

在项目目录运行 npm install @atlaskit/rovo-agent-analytics，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：react（^18\.2\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @atlaskit/rovo-agent-analytics 支持 TypeScript 吗？

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

### @atlaskit/rovo-agent-analytics 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @atlaskit/rovo-agent-analytics 可以商用吗？

@atlaskit/rovo-agent-analytics 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @atlaskit/rovo-agent-analytics 的下载量有多少？

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

### @atlaskit/rovo-agent-analytics 还在维护吗？

最新版本 6\.7\.2 发布于 2026/11/05（2 天前）；至今共发布 70 个版本，其中过去 12 个月发布了 70 个；首次发布于 2025/11/27。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

