@atlaskit/rovo-agent-analytics 0.19.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +112 -103
- package/dist/cjs/actions/groups/agent-interactions.js +1 -40
- package/dist/cjs/actions/groups/debug.js +1 -31
- package/dist/cjs/actions/groups/editing.js +1 -22
- package/dist/cjs/actions/groups/evaluation.js +1 -0
- package/dist/cjs/actions/groups/tools.js +1 -28
- package/dist/cjs/actions/index.js +24 -34
- package/dist/cjs/common/types.js +18 -1
- package/dist/cjs/create/index.js +29 -15
- package/dist/es2019/actions/groups/agent-interactions.js +1 -38
- package/dist/es2019/actions/groups/debug.js +0 -25
- package/dist/es2019/actions/groups/editing.js +1 -20
- package/dist/es2019/actions/groups/evaluation.js +0 -0
- package/dist/es2019/actions/groups/tools.js +1 -26
- package/dist/es2019/actions/index.js +17 -34
- package/dist/es2019/common/types.js +12 -0
- package/dist/es2019/create/index.js +26 -16
- package/dist/esm/actions/groups/agent-interactions.js +1 -38
- package/dist/esm/actions/groups/debug.js +0 -25
- package/dist/esm/actions/groups/editing.js +1 -20
- package/dist/esm/actions/groups/evaluation.js +0 -0
- package/dist/esm/actions/groups/tools.js +1 -26
- package/dist/esm/actions/index.js +23 -34
- package/dist/esm/common/types.js +12 -0
- package/dist/esm/create/index.js +27 -14
- package/dist/types/actions/groups/agent-interactions.d.ts +42 -26
- package/dist/types/actions/groups/debug.d.ts +22 -18
- package/dist/types/actions/groups/editing.d.ts +6 -10
- package/dist/types/actions/groups/evaluation.d.ts +56 -0
- package/dist/types/actions/groups/tools.d.ts +22 -20
- package/dist/types/actions/index.d.ts +2 -20
- package/dist/types/common/types.d.ts +28 -2
- package/dist/types/create/index.d.ts +20 -17
- package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +42 -26
- package/dist/types-ts4.5/actions/groups/debug.d.ts +22 -18
- package/dist/types-ts4.5/actions/groups/editing.d.ts +6 -10
- package/dist/types-ts4.5/actions/groups/evaluation.d.ts +56 -0
- package/dist/types-ts4.5/actions/groups/tools.d.ts +22 -20
- package/dist/types-ts4.5/actions/index.d.ts +2 -20
- package/dist/types-ts4.5/common/types.d.ts +28 -2
- package/dist/types-ts4.5/create/index.d.ts +20 -17
- package/package.json +2 -2
- package/actions/add-tools-prompt/package.json +0 -17
- package/actions/agent-interactions/package.json +0 -17
- package/actions/create-flow/package.json +0 -17
- package/actions/debug/package.json +0 -17
- package/actions/editing/package.json +0 -17
- package/actions/tool-actions/package.json +0 -17
- package/dist/cjs/actions/groups/add-tools-prompt.js +0 -32
- package/dist/cjs/actions/groups/create-flow.js +0 -39
- package/dist/cjs/actions/registry.js +0 -53
- package/dist/es2019/actions/groups/add-tools-prompt.js +0 -26
- package/dist/es2019/actions/groups/create-flow.js +0 -33
- package/dist/es2019/actions/registry.js +0 -52
- package/dist/esm/actions/groups/add-tools-prompt.js +0 -26
- package/dist/esm/actions/groups/create-flow.js +0 -33
- package/dist/esm/actions/registry.js +0 -48
- package/dist/types/actions/groups/add-tools-prompt.d.ts +0 -21
- package/dist/types/actions/groups/create-flow.d.ts +0 -22
- package/dist/types/actions/registry.d.ts +0 -16
- package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +0 -21
- package/dist/types-ts4.5/actions/groups/create-flow.d.ts +0 -22
- package/dist/types-ts4.5/actions/registry.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-analytics
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`e4034958fc116`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e4034958fc116) -
|
|
8
|
+
Adjust event tracking for agent analytics to use new trackAgentEvent() method. Remove deprecated
|
|
9
|
+
trackAgentAction() export and exported action const enums
|
|
10
|
+
|
|
11
|
+
## 0.20.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`30edbd0d978ea`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30edbd0d978ea) -
|
|
16
|
+
Deprecate trackAgentAction() and enums exports, introduce trackAgentEvent()
|
|
17
|
+
|
|
3
18
|
## 0.19.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,166 +1,175 @@
|
|
|
1
1
|
# RovoAgentAnalytics
|
|
2
2
|
|
|
3
|
-
Rovo Agents analytics
|
|
3
|
+
Rovo Agents analytics library for composing and sending typed analytics events.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```typescript
|
|
8
|
+
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
|
|
9
|
+
|
|
10
|
+
const { trackAgentEvent } = useRovoAgentActionAnalytics({});
|
|
11
|
+
|
|
12
|
+
// Full control over event properties — all fields are type-checked
|
|
13
|
+
trackAgentEvent({
|
|
14
|
+
action: 'view',
|
|
15
|
+
actionSubject: 'rovoAgent',
|
|
16
|
+
attributes: {
|
|
17
|
+
agentId: 'agent-123',
|
|
18
|
+
touchPoint: 'browse-agent-list',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
```
|
|
8
22
|
|
|
9
23
|
Detailed docs and example usage can be found
|
|
10
24
|
[here](https://atlaskit.atlassian.com/packages/ai-mate/rovo-agent-analytics).
|
|
11
25
|
|
|
12
26
|
## Examples
|
|
13
27
|
|
|
14
|
-
### Basic
|
|
28
|
+
### Basic Event Tracking
|
|
29
|
+
|
|
30
|
+
For fully-typed events with explicit `action`, `actionSubject`, and `attributes`:
|
|
15
31
|
|
|
16
32
|
```typescript
|
|
17
|
-
import { useRovoAgentActionAnalytics
|
|
33
|
+
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
|
|
18
34
|
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
const { trackAgentEvent } = useRovoAgentActionAnalytics({
|
|
36
|
+
agentId,
|
|
37
|
+
touchPoint: 'browse-agent-list',
|
|
22
38
|
});
|
|
23
39
|
|
|
24
|
-
//
|
|
25
|
-
|
|
40
|
+
// Track a user interaction
|
|
41
|
+
trackAgentEvent({
|
|
42
|
+
action: 'duplicate',
|
|
43
|
+
actionSubject: 'rovoAgent',
|
|
44
|
+
attributes: {},
|
|
45
|
+
});
|
|
26
46
|
```
|
|
27
47
|
|
|
28
|
-
###
|
|
48
|
+
### Event Tracking with Custom Attributes
|
|
29
49
|
|
|
30
50
|
```typescript
|
|
31
|
-
import { useRovoAgentActionAnalytics
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
import { useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
|
|
52
|
+
|
|
53
|
+
const { trackAgentEvent } = useRovoAgentActionAnalytics({});
|
|
54
|
+
|
|
55
|
+
// Full control over event properties — all fields are type-checked
|
|
56
|
+
trackAgentEvent({
|
|
57
|
+
action: 'created',
|
|
58
|
+
actionSubject: 'batchEvaluationDataset',
|
|
59
|
+
attributes: {
|
|
60
|
+
totalQuestions: 5
|
|
61
|
+
},
|
|
62
|
+
objectType: 'batchEvaluationDataset',
|
|
63
|
+
objectId: 'dataset-123',
|
|
64
|
+
});
|
|
38
65
|
```
|
|
39
66
|
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
Actions are organized into **groups** — self-contained files that define their actions, attribute
|
|
43
|
-
types, and a group name that gets automatically sent as `attributes.actionGroup` in every fired event.
|
|
67
|
+
## Payload Types
|
|
44
68
|
|
|
45
|
-
|
|
69
|
+
Each group file in `src/actions/groups/` exports a **discriminated union payload type** that defines all valid event shapes for that group.
|
|
46
70
|
|
|
47
|
-
|
|
|
48
|
-
| --- | --- | --- |
|
|
49
|
-
| `
|
|
50
|
-
| `editing` | `
|
|
51
|
-
| `debug` | `
|
|
52
|
-
| `tools` | `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
71
|
+
| File | Payload Type | Description |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| `agent-interactions.ts` | `AgentInteractionsEventPayload` | User-initiated interactions (view, edit, delete, duplicate, star, chat, verify…) |
|
|
74
|
+
| `editing.ts` | `EditingEventPayload` | Agent save/mutation events (updated) |
|
|
75
|
+
| `debug.ts` | `DebugEventPayload` | Debug modal actions (view, copy, toggle skill info) |
|
|
76
|
+
| `tools.ts` | `ToolsEventPayload` | Tool execution actions (confirm, stream stop, result viewed, error) |
|
|
77
|
+
| `evaluation.ts` | `EvaluationEventPayload` | Batch evaluation events (dataset CRUD, job lifecycle, results viewed) |
|
|
78
|
+
| `create-flow.ts` | `CreateFlowEventPayload` | Create agent funnel steps |
|
|
79
|
+
| `add-tools-prompt.ts` | `AddToolsPromptEventPayload` | Add tools prompt modal events |
|
|
55
80
|
|
|
56
|
-
The `
|
|
81
|
+
The combined `EventPayload` type (exported from `types.ts`) is a union of all these payload types.
|
|
57
82
|
|
|
58
83
|
## Adding a New Action
|
|
59
84
|
|
|
60
|
-
### To an existing
|
|
61
|
-
|
|
62
|
-
1. Open the group file (e.g. `src/actions/groups/agent-interactions.ts` or `src/actions/groups/create-flow.ts`)
|
|
63
|
-
2. Add the action to the enum with a data-portal registry link:
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
export enum AgentInteractionActions {
|
|
67
|
-
// ... existing actions
|
|
68
|
-
/* My new action - https://data-portal.internal.atlassian.com/analytics/registry/XXXXX */
|
|
69
|
-
MY_NEW_ACTION = 'myNewAction',
|
|
70
|
-
}
|
|
71
|
-
```
|
|
85
|
+
### To an existing payload type
|
|
72
86
|
|
|
73
|
-
|
|
87
|
+
1. Open the group file (e.g. `src/actions/groups/agent-interactions.ts`)
|
|
88
|
+
2. Add a new variant to the payload union type with a data-portal registry link:
|
|
74
89
|
|
|
75
90
|
```typescript
|
|
76
|
-
export type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
91
|
+
export type AgentInteractionsEventPayload =
|
|
92
|
+
| {
|
|
93
|
+
// https://data-portal.internal.atlassian.com/analytics/registry/XXXXX
|
|
94
|
+
actionSubject: 'rovoAgent';
|
|
95
|
+
action: 'myNewAction';
|
|
96
|
+
attributes: BaseAgentAnalyticsAttributes & {
|
|
97
|
+
myCustomField: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
| // ... existing variants
|
|
80
101
|
```
|
|
81
102
|
|
|
82
|
-
That's it —
|
|
103
|
+
That's it — TypeScript will enforce the correct shape when calling `trackAgentEvent()`.
|
|
83
104
|
|
|
84
105
|
### To a new group
|
|
85
106
|
|
|
86
107
|
If your action doesn't fit any existing group, create a new one:
|
|
87
108
|
|
|
88
|
-
1. Create a new file in `src/actions/groups
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
2. Register the group in `src/actions/registry.ts`:
|
|
109
|
+
1. Create a new file in `src/actions/groups/` following the existing template
|
|
110
|
+
2. Export a discriminated union payload type (e.g. `MyFeatureEventPayload`)
|
|
111
|
+
3. Add the new type to the `EventPayload` union in `src/common/types.ts`:
|
|
92
112
|
|
|
93
113
|
```typescript
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// 2. Add to the combined type
|
|
102
|
-
export type ActionAttributes = AgentInteractionAttributes &
|
|
103
|
-
EditingActionAttributes &
|
|
104
|
-
DebugActionAttributes &
|
|
105
|
-
ToolsActionAttributes &
|
|
106
|
-
MyFeatureActionAttributes;
|
|
107
|
-
|
|
108
|
-
// 3. Add to the runtime group map
|
|
109
|
-
export const ACTION_TO_GROUP: Record<string, string> = {
|
|
110
|
-
...mapActionsToGroup(AgentInteractionActions, AGENT_INTERACTIONS_GROUP),
|
|
111
|
-
...mapActionsToGroup(AgentEditingActions, EDITING_GROUP),
|
|
112
|
-
...mapActionsToGroup(AgentDebugActions, DEBUG_GROUP),
|
|
113
|
-
...mapActionsToGroup(AgentToolActions, TOOLS_GROUP),
|
|
114
|
-
...mapActionsToGroup(MyFeatureActions, MY_FEATURE_GROUP),
|
|
115
|
-
};
|
|
114
|
+
import type { MyFeatureEventPayload } from '../actions/groups/my-feature';
|
|
115
|
+
|
|
116
|
+
export type EventPayload =
|
|
117
|
+
| EditingEventPayload
|
|
118
|
+
| AgentInteractionsEventPayload
|
|
119
|
+
// ... existing types
|
|
120
|
+
| MyFeatureEventPayload;
|
|
116
121
|
```
|
|
117
122
|
|
|
118
|
-
## Defining Custom Attributes
|
|
123
|
+
## Defining Custom Attributes
|
|
119
124
|
|
|
120
|
-
Each action can have its own specific attributes
|
|
121
|
-
will enforce the correct attributes based on the action you pass.
|
|
125
|
+
Each action variant in a payload type can have its own specific attributes:
|
|
122
126
|
|
|
123
127
|
### Using BaseAgentAnalyticsAttributes
|
|
124
128
|
|
|
125
|
-
For actions that
|
|
129
|
+
For actions that need `touchPoint` and `agentId`:
|
|
126
130
|
|
|
127
131
|
```typescript
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
{
|
|
133
|
+
actionSubject: 'rovoAgent';
|
|
134
|
+
action: 'view';
|
|
135
|
+
attributes: BaseAgentAnalyticsAttributes;
|
|
136
|
+
}
|
|
131
137
|
```
|
|
132
138
|
|
|
133
139
|
### Using Custom Attributes
|
|
134
140
|
|
|
135
|
-
For actions that need additional attributes
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
export type EditingActionAttributes = {
|
|
139
|
-
[AgentEditingActions.UPDATED]: BaseAgentAnalyticsAttributes & { agentType: string; field: string };
|
|
140
|
-
};
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
When calling `trackAgentAction`, TypeScript will enforce the custom attributes:
|
|
141
|
+
For actions that need additional attributes:
|
|
144
142
|
|
|
145
143
|
```typescript
|
|
146
|
-
|
|
144
|
+
{
|
|
145
|
+
actionSubject: 'rovoAgent';
|
|
146
|
+
action: 'updated';
|
|
147
|
+
attributes: BaseAgentAnalyticsAttributes & {
|
|
148
|
+
agentType: string;
|
|
149
|
+
field: string;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
147
152
|
```
|
|
148
153
|
|
|
149
|
-
|
|
154
|
+
## Entry Points
|
|
150
155
|
|
|
151
|
-
|
|
156
|
+
| Entry Point | Description |
|
|
157
|
+
| --- | --- |
|
|
158
|
+
| `@atlaskit/rovo-agent-analytics/actions` | Main entry point — exports `useRovoAgentActionAnalytics` hook |
|
|
159
|
+
| `@atlaskit/rovo-agent-analytics/create` | Create agent flow analytics — exports `useRovoAgentCreateAnalytics` hook and `AgentCreateAction` type |
|
|
152
160
|
|
|
153
|
-
|
|
154
|
-
2. It looks up `ActionAttributes[action]` to get the required attributes for that action
|
|
155
|
-
3. It subtracts any attributes already provided in `commonAttributes` (via `RemainingRequired`)
|
|
156
|
-
4. The remaining attributes must be provided in the `attributes` parameter
|
|
161
|
+
### Create Flow Analytics
|
|
157
162
|
|
|
158
|
-
|
|
163
|
+
The `useRovoAgentCreateAnalytics` hook is used for tracking the agent creation funnel:
|
|
159
164
|
|
|
160
165
|
```typescript
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
import { useRovoAgentCreateAnalytics } from '@atlaskit/rovo-agent-analytics/create';
|
|
167
|
+
|
|
168
|
+
const [csid, { trackCreateSession, trackCreateSessionStart }] = useRovoAgentCreateAnalytics({
|
|
169
|
+
touchPoint: 'agent-studio',
|
|
170
|
+
});
|
|
163
171
|
|
|
164
|
-
//
|
|
165
|
-
|
|
172
|
+
// Track funnel steps using string literal actions
|
|
173
|
+
trackCreateSession('createFlowStart');
|
|
174
|
+
trackCreateSession('createFlowActivate', { agentType: 'custom' });
|
|
166
175
|
```
|
|
@@ -2,43 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AgentInteractionActions = exports.ACTION_GROUP = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Action Group: agentInteractions
|
|
9
|
-
*
|
|
10
|
-
* User-initiated interactions with an agent — typically from the overflow menu ("...")
|
|
11
|
-
* or agent profile surfaces (viewing, editing, deleting, duplicating, starring, sharing, verifying).
|
|
12
|
-
*
|
|
13
|
-
* NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
|
|
14
|
-
*
|
|
15
|
-
* ## Adding a new action
|
|
16
|
-
* 1. Add the action to the `AgentInteractionActions` enum below with a data-portal link
|
|
17
|
-
* 2. Add the corresponding attribute type in `AgentInteractionAttributes`
|
|
18
|
-
* 3. If this action doesn't fit user interactions, create a new group file instead
|
|
19
|
-
* (see other files in this directory for the template)
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** The group name sent as `attributes.actionGroup` in analytics events */
|
|
23
|
-
var ACTION_GROUP = exports.ACTION_GROUP = 'agentInteractions';
|
|
24
|
-
var AgentInteractionActions = exports.AgentInteractionActions = /*#__PURE__*/function (AgentInteractionActions) {
|
|
25
|
-
/* View agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97125 */
|
|
26
|
-
AgentInteractionActions["VIEW"] = "view";
|
|
27
|
-
/* Edit agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97126 */
|
|
28
|
-
AgentInteractionActions["EDIT"] = "edit";
|
|
29
|
-
/* Copy link clicked - https://data-portal.internal.atlassian.com/analytics/registry/97128 */
|
|
30
|
-
AgentInteractionActions["COPY_LINK"] = "copyLink";
|
|
31
|
-
/* Delete agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97129 */
|
|
32
|
-
AgentInteractionActions["DELETE"] = "delete";
|
|
33
|
-
/* Duplicate agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97130 */
|
|
34
|
-
AgentInteractionActions["DUPLICATE"] = "duplicate";
|
|
35
|
-
/* Star agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97133 */
|
|
36
|
-
AgentInteractionActions["STAR"] = "star";
|
|
37
|
-
/* Chat with agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97095 */
|
|
38
|
-
AgentInteractionActions["CHAT"] = "chat";
|
|
39
|
-
/* Verify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97134 */
|
|
40
|
-
AgentInteractionActions["VERIFY"] = "verify";
|
|
41
|
-
/* Unverify agent clicked - https://data-portal.internal.atlassian.com/analytics/registry/97135 */
|
|
42
|
-
AgentInteractionActions["UNVERIFY"] = "unverify";
|
|
43
|
-
return AgentInteractionActions;
|
|
44
|
-
}({});
|
|
5
|
+
});
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AgentDebugActions = exports.ACTION_GROUP = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Action Group: debug
|
|
9
|
-
*
|
|
10
|
-
* Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
|
|
11
|
-
*
|
|
12
|
-
* ## Adding a new action
|
|
13
|
-
* 1. Add the action to the `AgentDebugActions` enum below with a data-portal link
|
|
14
|
-
* 2. Add the corresponding attribute type in `DebugActionAttributes`
|
|
15
|
-
* 3. If this action doesn't fit this group, consider creating a new group file instead
|
|
16
|
-
* (see other files in this directory for the template)
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** The group name sent as `attributes.actionGroup` in analytics events */
|
|
20
|
-
var ACTION_GROUP = exports.ACTION_GROUP = 'debug';
|
|
21
|
-
var AgentDebugActions = exports.AgentDebugActions = /*#__PURE__*/function (AgentDebugActions) {
|
|
22
|
-
/* View debug modal - https://data-portal.internal.atlassian.com/analytics/registry/97183 */
|
|
23
|
-
AgentDebugActions["VIEW"] = "debugView";
|
|
24
|
-
/* Copy all debug data - https://data-portal.internal.atlassian.com/analytics/registry/97186 */
|
|
25
|
-
AgentDebugActions["COPY_ALL"] = "debugCopyAll";
|
|
26
|
-
/* Copy debug data - https://data-portal.internal.atlassian.com/analytics/registry/97184 */
|
|
27
|
-
AgentDebugActions["COPY"] = "debugCopy";
|
|
28
|
-
/* Toggle skill info - https://data-portal.internal.atlassian.com/analytics/registry/97185 */
|
|
29
|
-
AgentDebugActions["TOGGLE_SKILL_INFO"] = "debugToggleSkillInfo";
|
|
30
|
-
return AgentDebugActions;
|
|
31
|
-
}({});
|
|
1
|
+
"use strict";
|
|
@@ -2,25 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AgentEditingActions = exports.ACTION_GROUP = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Action Group: editing
|
|
9
|
-
*
|
|
10
|
-
* Agent editing/mutation events — fired when an agent's configuration is saved or modified.
|
|
11
|
-
* Unlike agentInteractions (user clicks), these track actual data changes.
|
|
12
|
-
*
|
|
13
|
-
* ## Adding a new action
|
|
14
|
-
* 1. Add the action to the `AgentEditingActions` enum below with a data-portal link
|
|
15
|
-
* 2. Add the corresponding attribute type in `EditingActionAttributes`
|
|
16
|
-
* 3. If this action doesn't fit editing/mutation events, create a new group file instead
|
|
17
|
-
* (see other files in this directory for the template)
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/** The group name sent as `attributes.actionGroup` in analytics events */
|
|
21
|
-
var ACTION_GROUP = exports.ACTION_GROUP = 'editing';
|
|
22
|
-
var AgentEditingActions = exports.AgentEditingActions = /*#__PURE__*/function (AgentEditingActions) {
|
|
23
|
-
/* Agent updated - https://data-portal.internal.atlassian.com/analytics/registry/97122 */
|
|
24
|
-
AgentEditingActions["UPDATED"] = "updated";
|
|
25
|
-
return AgentEditingActions;
|
|
26
|
-
}({});
|
|
5
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -2,31 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AgentToolActions = exports.ACTION_GROUP = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Action Group: tools
|
|
9
|
-
*
|
|
10
|
-
* Actions related to agent tool execution during chat
|
|
11
|
-
* (confirming, streaming, viewing results, errors).
|
|
12
|
-
*
|
|
13
|
-
* ## Adding a new action
|
|
14
|
-
* 1. Add the action to the `AgentToolActions` enum below with a data-portal link
|
|
15
|
-
* 2. Add the corresponding attribute type in `ToolsActionAttributes`
|
|
16
|
-
* 3. If this action doesn't fit this group, consider creating a new group file instead
|
|
17
|
-
* (see other files in this directory for the template)
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/** The group name sent as `attributes.actionGroup` in analytics events */
|
|
21
|
-
var ACTION_GROUP = exports.ACTION_GROUP = 'tools';
|
|
22
|
-
var AgentToolActions = exports.AgentToolActions = /*#__PURE__*/function (AgentToolActions) {
|
|
23
|
-
/* When chatting with an agent, and tools confirmation being shown, then user click proceed with the possible actions (e.g. confirm, dismiss etc) https://data-portal.internal.atlassian.com/analytics/registry/97675 */
|
|
24
|
-
AgentToolActions["TOOLS_EXECUTION_CONFIRMED"] = "toolsExecutionConfirmed";
|
|
25
|
-
/* When tools execution result is being streamed and user stops the stream e.g. by clicking stop button https://data-portal.internal.atlassian.com/analytics/registry/97750 */
|
|
26
|
-
AgentToolActions["TOOLS_EXECUTION_STREAM_STOPPED"] = "toolsExecutionStreamStopped";
|
|
27
|
-
/* When tools execution result is done streaming and user sees the result https://data-portal.internal.atlassian.com/analytics/registry/97751*/
|
|
28
|
-
AgentToolActions["TOOLS_EXECUTION_RESULT_VIEWED"] = "toolsExecutionResultViewed";
|
|
29
|
-
/* When tools execution result streaming fails https://data-portal.internal.atlassian.com/analytics/registry/97752 */
|
|
30
|
-
AgentToolActions["TOOLS_EXECUTION_RESULT_ERROR"] = "toolsExecutionResultError";
|
|
31
|
-
return AgentToolActions;
|
|
32
|
-
}({});
|
|
5
|
+
});
|
|
@@ -4,24 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useRovoAgentActionAnalytics =
|
|
7
|
+
exports.useRovoAgentActionAnalytics = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _react = require("react");
|
|
10
11
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
11
12
|
var _constants = require("../common/constants");
|
|
13
|
+
var _types = require("../common/types");
|
|
12
14
|
var _utils = require("../common/utils");
|
|
13
|
-
var
|
|
14
|
-
var _debug = require("./groups/debug");
|
|
15
|
-
var _editing = require("./groups/editing");
|
|
16
|
-
var _registry = require("./registry");
|
|
15
|
+
var _excluded = ["action", "actionSubject", "attributes"];
|
|
17
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
// Backward-compatible aliases
|
|
20
|
-
// TODO: migrate consumers to use group-specific imports, then remove
|
|
21
|
-
var AgentCommonActions = exports.AgentCommonActions = _objectSpread(_objectSpread({}, _agentInteractions.AgentInteractionActions), _editing.AgentEditingActions);
|
|
22
|
-
|
|
23
|
-
// TODO: Remove the alias, will be breaking change, this is just for backward compatibility
|
|
24
|
-
var AgentDebugActions = exports.AgentDebugActions = _debug.AgentDebugActions;
|
|
25
18
|
var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
|
|
26
19
|
var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function useRovoAgentActionAnalytics(commonAttributes) {
|
|
27
20
|
var analyticsContext = (0, _react.useContext)(_analyticsNext.AnalyticsReactContext);
|
|
@@ -29,35 +22,32 @@ var useRovoAgentActionAnalytics = exports.useRovoAgentActionAnalytics = function
|
|
|
29
22
|
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
30
23
|
var commonAttributesRef = (0, _react.useRef)(commonAttributes);
|
|
31
24
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
32
|
-
var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current),
|
|
25
|
+
var attributes = _objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), {}, {
|
|
26
|
+
library: _types.LIBRARY_ATTRIBUTE
|
|
27
|
+
}, event.attributes);
|
|
33
28
|
createAnalyticsEvent(_objectSpread(_objectSpread(_objectSpread({}, globalEventConfig), event), {}, {
|
|
34
29
|
attributes: attributes
|
|
35
30
|
})).fire(_constants.ANALYTICS_CHANNEL);
|
|
36
31
|
}, [createAnalyticsEvent, analyticsContext] // keep number of dependencies minimal to prevent re-rendering
|
|
37
32
|
);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
fireAnalyticsEvent({
|
|
49
|
-
actionSubject:
|
|
50
|
-
action: action
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
message: error.message
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
});
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Fully-typed event tracking using discriminated union payload types.
|
|
36
|
+
* The payload type enforces correct action, actionSubject, and attributes.
|
|
37
|
+
*/
|
|
38
|
+
var trackAgentEvent = (0, _react.useCallback)(function (payload) {
|
|
39
|
+
var action = payload.action,
|
|
40
|
+
actionSubject = payload.actionSubject,
|
|
41
|
+
attributes = payload.attributes,
|
|
42
|
+
eventProps = (0, _objectWithoutProperties2.default)(payload, _excluded);
|
|
43
|
+
fireAnalyticsEvent(_objectSpread(_objectSpread({
|
|
44
|
+
actionSubject: actionSubject,
|
|
45
|
+
action: action
|
|
46
|
+
}, eventProps), {}, {
|
|
47
|
+
attributes: attributes
|
|
48
|
+
}));
|
|
58
49
|
}, [fireAnalyticsEvent]);
|
|
59
50
|
return {
|
|
60
|
-
|
|
61
|
-
trackAgentActionError: trackAgentActionError
|
|
51
|
+
trackAgentEvent: trackAgentEvent
|
|
62
52
|
};
|
|
63
53
|
};
|
package/dist/cjs/common/types.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LIBRARY_ATTRIBUTE = void 0;
|
|
7
|
+
/** Common library attribute injected into all events */
|
|
8
|
+
var LIBRARY_ATTRIBUTE = exports.LIBRARY_ATTRIBUTE = 'agents-analytics';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generic error event payload type.
|
|
12
|
+
* Use with `trackAgentEvent()` to track error events.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Union of all event payload types.
|
|
17
|
+
* Use with `trackAgentEvent()` for typed event tracking.
|
|
18
|
+
*/
|
package/dist/cjs/create/index.js
CHANGED
|
@@ -4,22 +4,37 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useRovoAgentCreateAnalytics =
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
exports.useRovoAgentCreateAnalytics = void 0;
|
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
12
|
-
var _addToolsPrompt = require("../actions/groups/add-tools-prompt");
|
|
13
|
-
var _createFlow = require("../actions/groups/create-flow");
|
|
14
|
-
var _registry = require("../actions/registry");
|
|
15
12
|
var _constants = require("../common/constants");
|
|
16
13
|
var _csid = require("../common/csid");
|
|
17
14
|
var _utils = require("../common/utils");
|
|
18
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
var DefaultActionSubject = 'rovoAgent';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Union type of all valid create agent flow actions.
|
|
21
|
+
* Includes both CreateFlow and AddToolsPrompt actions.
|
|
22
|
+
*
|
|
23
|
+
* Data portal registry links:
|
|
24
|
+
* - createFlowStart: https://data-portal.internal.atlassian.com/analytics/registry/97089
|
|
25
|
+
* - createFlowSkipNL: https://data-portal.internal.atlassian.com/analytics/registry/97127
|
|
26
|
+
* - createFlowReviewNL: https://data-portal.internal.atlassian.com/analytics/registry/97124
|
|
27
|
+
* - createFlowActivate: https://data-portal.internal.atlassian.com/analytics/registry/97123
|
|
28
|
+
* - createFlowRestart: https://data-portal.internal.atlassian.com/analytics/registry/97131
|
|
29
|
+
* - createFlowError: https://data-portal.internal.atlassian.com/analytics/registry/97132
|
|
30
|
+
* - createLandInStudio: https://data-portal.internal.atlassian.com/analytics/registry/97136
|
|
31
|
+
* - createDiscard: https://data-portal.internal.atlassian.com/analytics/registry/97137
|
|
32
|
+
* - saDraft: https://data-portal.internal.atlassian.com/analytics/registry/97924
|
|
33
|
+
* - addToolsPromptShown: https://data-portal.internal.atlassian.com/analytics/registry/98106
|
|
34
|
+
* - addToolsPromptBrowse: https://data-portal.internal.atlassian.com/analytics/registry/98107
|
|
35
|
+
* - addToolsPromptDismiss: https://data-portal.internal.atlassian.com/analytics/registry/98108
|
|
36
|
+
*/
|
|
37
|
+
|
|
23
38
|
var globalEventConfig = (0, _utils.getDefaultTrackEventConfig)();
|
|
24
39
|
var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function useRovoAgentCreateAnalytics(commonAttributes) {
|
|
25
40
|
var _useRovoAgentCSID = (0, _csid.useRovoAgentCSID)(),
|
|
@@ -32,9 +47,8 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
32
47
|
var commonAttributesRef = (0, _react.useRef)(commonAttributes);
|
|
33
48
|
var fireAnalyticsEvent = (0, _react.useCallback)(function (event) {
|
|
34
49
|
var referrer = typeof window !== 'undefined' ? window.document.referrer : 'unknown';
|
|
35
|
-
var action = event.action;
|
|
36
50
|
var attributes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (0, _utils.getAttributesFromContexts)(analyticsContext.getAtlaskitAnalyticsContext())), commonAttributesRef.current), event.attributes), {}, {
|
|
37
|
-
actionGroup:
|
|
51
|
+
actionGroup: 'createFlow',
|
|
38
52
|
csid: csid,
|
|
39
53
|
referrer: referrer
|
|
40
54
|
});
|
|
@@ -50,7 +64,7 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
50
64
|
*/
|
|
51
65
|
var trackCreateSession = (0, _react.useCallback)(function (action, attributes) {
|
|
52
66
|
fireAnalyticsEvent({
|
|
53
|
-
actionSubject:
|
|
67
|
+
actionSubject: DefaultActionSubject,
|
|
54
68
|
action: action,
|
|
55
69
|
attributes: attributes
|
|
56
70
|
});
|
|
@@ -61,16 +75,16 @@ var useRovoAgentCreateAnalytics = exports.useRovoAgentCreateAnalytics = function
|
|
|
61
75
|
*/
|
|
62
76
|
var trackCreateSessionStart = (0, _react.useCallback)(function (attributes) {
|
|
63
77
|
fireAnalyticsEvent({
|
|
64
|
-
actionSubject:
|
|
65
|
-
action:
|
|
78
|
+
actionSubject: DefaultActionSubject,
|
|
79
|
+
action: 'createFlowStart',
|
|
66
80
|
attributes: attributes
|
|
67
81
|
});
|
|
68
82
|
refreshCSID();
|
|
69
83
|
}, [fireAnalyticsEvent, refreshCSID]);
|
|
70
84
|
var trackCreateSessionError = (0, _react.useCallback)(function (error, attributes) {
|
|
71
85
|
fireAnalyticsEvent({
|
|
72
|
-
actionSubject:
|
|
73
|
-
action:
|
|
86
|
+
actionSubject: DefaultActionSubject,
|
|
87
|
+
action: 'createFlowError',
|
|
74
88
|
attributes: _objectSpread({
|
|
75
89
|
error: {
|
|
76
90
|
message: error.message
|