@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.
Files changed (64) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +112 -103
  3. package/dist/cjs/actions/groups/agent-interactions.js +1 -40
  4. package/dist/cjs/actions/groups/debug.js +1 -31
  5. package/dist/cjs/actions/groups/editing.js +1 -22
  6. package/dist/cjs/actions/groups/evaluation.js +1 -0
  7. package/dist/cjs/actions/groups/tools.js +1 -28
  8. package/dist/cjs/actions/index.js +24 -34
  9. package/dist/cjs/common/types.js +18 -1
  10. package/dist/cjs/create/index.js +29 -15
  11. package/dist/es2019/actions/groups/agent-interactions.js +1 -38
  12. package/dist/es2019/actions/groups/debug.js +0 -25
  13. package/dist/es2019/actions/groups/editing.js +1 -20
  14. package/dist/es2019/actions/groups/evaluation.js +0 -0
  15. package/dist/es2019/actions/groups/tools.js +1 -26
  16. package/dist/es2019/actions/index.js +17 -34
  17. package/dist/es2019/common/types.js +12 -0
  18. package/dist/es2019/create/index.js +26 -16
  19. package/dist/esm/actions/groups/agent-interactions.js +1 -38
  20. package/dist/esm/actions/groups/debug.js +0 -25
  21. package/dist/esm/actions/groups/editing.js +1 -20
  22. package/dist/esm/actions/groups/evaluation.js +0 -0
  23. package/dist/esm/actions/groups/tools.js +1 -26
  24. package/dist/esm/actions/index.js +23 -34
  25. package/dist/esm/common/types.js +12 -0
  26. package/dist/esm/create/index.js +27 -14
  27. package/dist/types/actions/groups/agent-interactions.d.ts +42 -26
  28. package/dist/types/actions/groups/debug.d.ts +22 -18
  29. package/dist/types/actions/groups/editing.d.ts +6 -10
  30. package/dist/types/actions/groups/evaluation.d.ts +56 -0
  31. package/dist/types/actions/groups/tools.d.ts +22 -20
  32. package/dist/types/actions/index.d.ts +2 -20
  33. package/dist/types/common/types.d.ts +28 -2
  34. package/dist/types/create/index.d.ts +20 -17
  35. package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +42 -26
  36. package/dist/types-ts4.5/actions/groups/debug.d.ts +22 -18
  37. package/dist/types-ts4.5/actions/groups/editing.d.ts +6 -10
  38. package/dist/types-ts4.5/actions/groups/evaluation.d.ts +56 -0
  39. package/dist/types-ts4.5/actions/groups/tools.d.ts +22 -20
  40. package/dist/types-ts4.5/actions/index.d.ts +2 -20
  41. package/dist/types-ts4.5/common/types.d.ts +28 -2
  42. package/dist/types-ts4.5/create/index.d.ts +20 -17
  43. package/package.json +2 -2
  44. package/actions/add-tools-prompt/package.json +0 -17
  45. package/actions/agent-interactions/package.json +0 -17
  46. package/actions/create-flow/package.json +0 -17
  47. package/actions/debug/package.json +0 -17
  48. package/actions/editing/package.json +0 -17
  49. package/actions/tool-actions/package.json +0 -17
  50. package/dist/cjs/actions/groups/add-tools-prompt.js +0 -32
  51. package/dist/cjs/actions/groups/create-flow.js +0 -39
  52. package/dist/cjs/actions/registry.js +0 -53
  53. package/dist/es2019/actions/groups/add-tools-prompt.js +0 -26
  54. package/dist/es2019/actions/groups/create-flow.js +0 -33
  55. package/dist/es2019/actions/registry.js +0 -52
  56. package/dist/esm/actions/groups/add-tools-prompt.js +0 -26
  57. package/dist/esm/actions/groups/create-flow.js +0 -33
  58. package/dist/esm/actions/registry.js +0 -48
  59. package/dist/types/actions/groups/add-tools-prompt.d.ts +0 -21
  60. package/dist/types/actions/groups/create-flow.d.ts +0 -22
  61. package/dist/types/actions/registry.d.ts +0 -16
  62. package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +0 -21
  63. package/dist/types-ts4.5/actions/groups/create-flow.d.ts +0 -22
  64. package/dist/types-ts4.5/actions/registry.d.ts +0 -16
@@ -7,33 +7,49 @@
7
7
  * NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
8
8
  *
9
9
  * ## Adding a new action
10
- * 1. Add the action to the `AgentInteractionActions` enum below with a data-portal link
11
- * 2. Add the corresponding attribute type in `AgentInteractionAttributes`
12
- * 3. If this action doesn't fit user interactions, create a new group file instead
10
+ * 1. Add a new variant to the `AgentInteractionsEventPayload` union type below with a data-portal link
11
+ * 2. If this action doesn't fit user interactions, create a new group file instead
13
12
  * (see other files in this directory for the template)
14
13
  */
15
14
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
16
- /** The group name sent as `attributes.actionGroup` in analytics events */
17
- export declare const ACTION_GROUP: "agentInteractions";
18
- export declare enum AgentInteractionActions {
19
- VIEW = "view",
20
- EDIT = "edit",
21
- COPY_LINK = "copyLink",
22
- DELETE = "delete",
23
- DUPLICATE = "duplicate",
24
- STAR = "star",
25
- CHAT = "chat",
26
- VERIFY = "verify",
27
- UNVERIFY = "unverify"
28
- }
29
- export type AgentInteractionAttributes = {
30
- [AgentInteractionActions.VIEW]: BaseAgentAnalyticsAttributes;
31
- [AgentInteractionActions.EDIT]: BaseAgentAnalyticsAttributes;
32
- [AgentInteractionActions.COPY_LINK]: BaseAgentAnalyticsAttributes;
33
- [AgentInteractionActions.DELETE]: BaseAgentAnalyticsAttributes;
34
- [AgentInteractionActions.DUPLICATE]: BaseAgentAnalyticsAttributes;
35
- [AgentInteractionActions.STAR]: BaseAgentAnalyticsAttributes;
36
- [AgentInteractionActions.CHAT]: BaseAgentAnalyticsAttributes;
37
- [AgentInteractionActions.VERIFY]: BaseAgentAnalyticsAttributes;
38
- [AgentInteractionActions.UNVERIFY]: BaseAgentAnalyticsAttributes;
15
+ /**
16
+ * Discriminated union payload type for agent interaction events.
17
+ * Use with `trackAgentEvent()`.
18
+ */
19
+ export type AgentInteractionsEventPayload = {
20
+ actionSubject: 'rovoAgent';
21
+ action: 'view';
22
+ attributes: BaseAgentAnalyticsAttributes;
23
+ } | {
24
+ actionSubject: 'rovoAgent';
25
+ action: 'edit';
26
+ attributes: BaseAgentAnalyticsAttributes;
27
+ } | {
28
+ actionSubject: 'rovoAgent';
29
+ action: 'copyLink';
30
+ attributes: BaseAgentAnalyticsAttributes;
31
+ } | {
32
+ actionSubject: 'rovoAgent';
33
+ action: 'delete';
34
+ attributes: BaseAgentAnalyticsAttributes;
35
+ } | {
36
+ actionSubject: 'rovoAgent';
37
+ action: 'duplicate';
38
+ attributes: BaseAgentAnalyticsAttributes;
39
+ } | {
40
+ actionSubject: 'rovoAgent';
41
+ action: 'star';
42
+ attributes: BaseAgentAnalyticsAttributes;
43
+ } | {
44
+ actionSubject: 'rovoAgent';
45
+ action: 'chat';
46
+ attributes: BaseAgentAnalyticsAttributes;
47
+ } | {
48
+ actionSubject: 'rovoAgent';
49
+ action: 'verify';
50
+ attributes: BaseAgentAnalyticsAttributes;
51
+ } | {
52
+ actionSubject: 'rovoAgent';
53
+ action: 'unverify';
54
+ attributes: BaseAgentAnalyticsAttributes;
39
55
  };
@@ -4,27 +4,31 @@
4
4
  * Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
5
5
  *
6
6
  * ## Adding a new action
7
- * 1. Add the action to the `AgentDebugActions` enum below with a data-portal link
8
- * 2. Add the corresponding attribute type in `DebugActionAttributes`
9
- * 3. If this action doesn't fit this group, consider creating a new group file instead
7
+ * 1. Add a new variant to the `DebugEventPayload` union type below with a data-portal link
8
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
10
9
  * (see other files in this directory for the template)
11
10
  */
12
- /** The group name sent as `attributes.actionGroup` in analytics events */
13
- export declare const ACTION_GROUP: "debug";
14
- export declare enum AgentDebugActions {
15
- VIEW = "debugView",
16
- COPY_ALL = "debugCopyAll",
17
- COPY = "debugCopy",
18
- TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
19
- }
20
- type EmptyAttributes = {};
21
- export type DebugActionAttributes = {
22
- [AgentDebugActions.COPY_ALL]: EmptyAttributes;
23
- [AgentDebugActions.COPY]: EmptyAttributes;
24
- [AgentDebugActions.TOGGLE_SKILL_INFO]: {
11
+ /**
12
+ * Discriminated union payload type for debug events.
13
+ * Use with `trackAgentEvent()`.
14
+ */
15
+ export type DebugEventPayload = {
16
+ actionSubject: 'rovoAgent';
17
+ action: 'debugView';
18
+ attributes: {};
19
+ } | {
20
+ actionSubject: 'rovoAgent';
21
+ action: 'debugCopyAll';
22
+ attributes: {};
23
+ } | {
24
+ actionSubject: 'rovoAgent';
25
+ action: 'debugCopy';
26
+ attributes: {};
27
+ } | {
28
+ actionSubject: 'rovoAgent';
29
+ action: 'debugToggleSkillInfo';
30
+ attributes: {
25
31
  toolId: string;
26
32
  isExpanded: boolean;
27
33
  };
28
- [AgentDebugActions.VIEW]: EmptyAttributes;
29
34
  };
30
- export {};
@@ -5,19 +5,15 @@
5
5
  * Unlike agentInteractions (user clicks), these track actual data changes.
6
6
  *
7
7
  * ## Adding a new action
8
- * 1. Add the action to the `AgentEditingActions` enum below with a data-portal link
9
- * 2. Add the corresponding attribute type in `EditingActionAttributes`
10
- * 3. If this action doesn't fit editing/mutation events, create a new group file instead
8
+ * 1. Add a new variant to the `EditingEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit editing/mutation events, create a new group file instead
11
10
  * (see other files in this directory for the template)
12
11
  */
13
12
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
14
- /** The group name sent as `attributes.actionGroup` in analytics events */
15
- export declare const ACTION_GROUP: "editing";
16
- export declare enum AgentEditingActions {
17
- UPDATED = "updated"
18
- }
19
- export type EditingActionAttributes = {
20
- [AgentEditingActions.UPDATED]: BaseAgentAnalyticsAttributes & {
13
+ export type EditingEventPayload = {
14
+ actionSubject: 'rovoAgent';
15
+ action: 'updated';
16
+ attributes: BaseAgentAnalyticsAttributes & {
21
17
  agentType: string;
22
18
  field: string;
23
19
  };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Action Group: evaluation
3
+ *
4
+ * Batch evaluation events — dataset CRUD, job lifecycle, and validation UI events
5
+ * fired from the shared `agent-evaluation` package.
6
+ *
7
+ * ## Adding a new action
8
+ * 1. Add a new variant to the `EvaluationEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
10
+ * (see other files in this directory for the template)
11
+ */
12
+ type EvalAttributesBase = {
13
+ objectType?: string;
14
+ objectId?: string;
15
+ containerType?: string;
16
+ containerId?: string;
17
+ actionSubjectId?: string;
18
+ };
19
+ export type EvaluationEventPayload = ({
20
+ actionSubject: 'batchEvaluationDataset';
21
+ action: 'created';
22
+ attributes: {
23
+ totalQuestions: number;
24
+ };
25
+ } & EvalAttributesBase) | ({
26
+ actionSubject: 'batchEvaluationJob';
27
+ action: 'created';
28
+ attributes: {
29
+ datasetSize: number;
30
+ isDraftAgent: boolean;
31
+ judgeMode: string | undefined;
32
+ };
33
+ } & EvalAttributesBase) | ({
34
+ actionSubject: 'batchEvaluationDataset';
35
+ action: 'deleted';
36
+ attributes: {};
37
+ } & EvalAttributesBase) | ({
38
+ actionSubject: 'batchEvaluationDatasetQuestion';
39
+ action: 'deleted';
40
+ attributes: {};
41
+ } & EvalAttributesBase) | ({
42
+ actionSubject: 'evalResultsModal';
43
+ action: 'viewed';
44
+ attributes: {
45
+ trigger: 'row_action' | 'flag_action';
46
+ };
47
+ } & EvalAttributesBase) | ({
48
+ actionSubject: 'batchEvaluationJob';
49
+ action: 'completed';
50
+ attributes: {
51
+ status: string | null;
52
+ durationMs: number | null;
53
+ datasetSize: number | null | undefined;
54
+ };
55
+ } & EvalAttributesBase);
56
+ export {};
@@ -5,21 +5,12 @@
5
5
  * (confirming, streaming, viewing results, errors).
6
6
  *
7
7
  * ## Adding a new action
8
- * 1. Add the action to the `AgentToolActions` enum below with a data-portal link
9
- * 2. Add the corresponding attribute type in `ToolsActionAttributes`
10
- * 3. If this action doesn't fit this group, consider creating a new group file instead
8
+ * 1. Add a new variant to the `ToolsEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
11
10
  * (see other files in this directory for the template)
12
11
  */
13
12
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
14
- /** The group name sent as `attributes.actionGroup` in analytics events */
15
- export declare const ACTION_GROUP: "tools";
16
- export declare enum AgentToolActions {
17
- TOOLS_EXECUTION_CONFIRMED = "toolsExecutionConfirmed",
18
- TOOLS_EXECUTION_STREAM_STOPPED = "toolsExecutionStreamStopped",
19
- TOOLS_EXECUTION_RESULT_VIEWED = "toolsExecutionResultViewed",
20
- TOOLS_EXECUTION_RESULT_ERROR = "toolsExecutionResultError"
21
- }
22
- export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
13
+ type ToolsExecutionAttributesBase = BaseAgentAnalyticsAttributes & {
23
14
  tools: {
24
15
  toolId: string;
25
16
  toolSource: string;
@@ -27,12 +18,23 @@ export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
27
18
  }[];
28
19
  singleInstrumentationId: string | undefined;
29
20
  };
30
- export type ToolsExecutionResultAttributes = ToolsExecutionAttributes & {
31
- scenarioId: string | null | undefined;
32
- };
33
- export type ToolsActionAttributes = {
34
- [AgentToolActions.TOOLS_EXECUTION_CONFIRMED]: ToolsExecutionAttributes;
35
- [AgentToolActions.TOOLS_EXECUTION_STREAM_STOPPED]: ToolsExecutionAttributes;
36
- [AgentToolActions.TOOLS_EXECUTION_RESULT_VIEWED]: ToolsExecutionResultAttributes;
37
- [AgentToolActions.TOOLS_EXECUTION_RESULT_ERROR]: ToolsExecutionAttributes;
21
+ export type ToolsEventPayload = {
22
+ actionSubject: 'rovoAgent';
23
+ action: 'toolsExecutionConfirmed';
24
+ attributes: ToolsExecutionAttributesBase;
25
+ } | {
26
+ actionSubject: 'rovoAgent';
27
+ action: 'toolsExecutionStreamStopped';
28
+ attributes: ToolsExecutionAttributesBase;
29
+ } | {
30
+ actionSubject: 'rovoAgent';
31
+ action: 'toolsExecutionResultViewed';
32
+ attributes: ToolsExecutionAttributesBase & {
33
+ scenarioId: string | null | undefined;
34
+ };
35
+ } | {
36
+ actionSubject: 'rovoAgent';
37
+ action: 'toolsExecutionResultError';
38
+ attributes: ToolsExecutionAttributesBase;
38
39
  };
40
+ export {};
@@ -1,22 +1,4 @@
1
- import type { RemainingRequired } from '../common/types';
2
- import { AgentInteractionActions } from './groups/agent-interactions';
3
- import { AgentDebugActions as AgentDebugActionsEnum } from './groups/debug';
4
- import { AgentEditingActions } from './groups/editing';
5
- import type { ActionAttributes } from './registry';
6
- export declare const AgentCommonActions: {
7
- readonly UPDATED: AgentEditingActions.UPDATED;
8
- readonly VIEW: AgentInteractionActions.VIEW;
9
- readonly EDIT: AgentInteractionActions.EDIT;
10
- readonly COPY_LINK: AgentInteractionActions.COPY_LINK;
11
- readonly DELETE: AgentInteractionActions.DELETE;
12
- readonly DUPLICATE: AgentInteractionActions.DUPLICATE;
13
- readonly STAR: AgentInteractionActions.STAR;
14
- readonly CHAT: AgentInteractionActions.CHAT;
15
- readonly VERIFY: AgentInteractionActions.VERIFY;
16
- readonly UNVERIFY: AgentInteractionActions.UNVERIFY;
17
- };
18
- export declare const AgentDebugActions: typeof AgentDebugActionsEnum;
1
+ import { type EventPayload } from '../common/types';
19
2
  export declare const useRovoAgentActionAnalytics: <T extends {}>(commonAttributes: T) => {
20
- trackAgentAction: <A extends keyof ActionAttributes>(action: A, attributes: RemainingRequired<ActionAttributes[A], T>) => void;
21
- trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
3
+ trackAgentEvent: (payload: EventPayload) => void;
22
4
  };
@@ -1,5 +1,31 @@
1
+ import type { AgentInteractionsEventPayload } from '../actions/groups/agent-interactions';
2
+ import type { DebugEventPayload } from '../actions/groups/debug';
3
+ import type { EditingEventPayload } from '../actions/groups/editing';
4
+ import type { EvaluationEventPayload } from '../actions/groups/evaluation';
5
+ import type { ToolsEventPayload } from '../actions/groups/tools';
1
6
  export type RemainingRequired<T, P extends Partial<T>> = Required<Omit<T, keyof P>>;
2
7
  export type BaseAgentAnalyticsAttributes = {
3
- touchPoint: string;
4
- agentId: string;
8
+ touchPoint?: string;
9
+ agentId?: string;
5
10
  };
11
+ /** Common library attribute injected into all events */
12
+ export declare const LIBRARY_ATTRIBUTE: "agents-analytics";
13
+ /**
14
+ * Generic error event payload type.
15
+ * Use with `trackAgentEvent()` to track error events.
16
+ */
17
+ export type ErrorEventPayload = {
18
+ actionSubject: 'rovoAgentError';
19
+ action: string;
20
+ attributes: {
21
+ error: {
22
+ message: string;
23
+ };
24
+ [key: string]: unknown;
25
+ };
26
+ };
27
+ /**
28
+ * Union of all event payload types.
29
+ * Use with `trackAgentEvent()` for typed event tracking.
30
+ */
31
+ export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | ErrorEventPayload;
@@ -1,24 +1,27 @@
1
- import { AddToolsPromptActions } from '../actions/groups/add-tools-prompt';
2
- import { CreateFlowActions } from '../actions/groups/create-flow';
3
- export declare const AgentCreateActions: {
4
- readonly SHOWN: AddToolsPromptActions.SHOWN;
5
- readonly BROWSE: AddToolsPromptActions.BROWSE;
6
- readonly DISMISS: AddToolsPromptActions.DISMISS;
7
- readonly START: CreateFlowActions.START;
8
- readonly SKIP_NL: CreateFlowActions.SKIP_NL;
9
- readonly REVIEW_NL: CreateFlowActions.REVIEW_NL;
10
- readonly ACTIVATE: CreateFlowActions.ACTIVATE;
11
- readonly RESTART: CreateFlowActions.RESTART;
12
- readonly ERROR: CreateFlowActions.ERROR;
13
- readonly LAND: CreateFlowActions.LAND;
14
- readonly DISCARD: CreateFlowActions.DISCARD;
15
- readonly SA_DRAFT: CreateFlowActions.SA_DRAFT;
16
- };
1
+ /**
2
+ * Union type of all valid create agent flow actions.
3
+ * Includes both CreateFlow and AddToolsPrompt actions.
4
+ *
5
+ * Data portal registry links:
6
+ * - createFlowStart: https://data-portal.internal.atlassian.com/analytics/registry/97089
7
+ * - createFlowSkipNL: https://data-portal.internal.atlassian.com/analytics/registry/97127
8
+ * - createFlowReviewNL: https://data-portal.internal.atlassian.com/analytics/registry/97124
9
+ * - createFlowActivate: https://data-portal.internal.atlassian.com/analytics/registry/97123
10
+ * - createFlowRestart: https://data-portal.internal.atlassian.com/analytics/registry/97131
11
+ * - createFlowError: https://data-portal.internal.atlassian.com/analytics/registry/97132
12
+ * - createLandInStudio: https://data-portal.internal.atlassian.com/analytics/registry/97136
13
+ * - createDiscard: https://data-portal.internal.atlassian.com/analytics/registry/97137
14
+ * - saDraft: https://data-portal.internal.atlassian.com/analytics/registry/97924
15
+ * - addToolsPromptShown: https://data-portal.internal.atlassian.com/analytics/registry/98106
16
+ * - addToolsPromptBrowse: https://data-portal.internal.atlassian.com/analytics/registry/98107
17
+ * - addToolsPromptDismiss: https://data-portal.internal.atlassian.com/analytics/registry/98108
18
+ */
19
+ type AgentCreateAction = 'createFlowStart' | 'createFlowSkipNL' | 'createFlowReviewNL' | 'createFlowActivate' | 'createFlowRestart' | 'createFlowError' | 'createLandInStudio' | 'createDiscard' | 'saDraft' | 'addToolsPromptShown' | 'addToolsPromptBrowse' | 'addToolsPromptDismiss';
17
20
  type CommonAnalyticsAttributes = {
18
21
  touchPoint?: string;
19
22
  } & Record<string, any>;
20
23
  export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [string | null, {
21
- readonly trackCreateSession: (action: (typeof AgentCreateActions)[keyof typeof AgentCreateActions], attributes?: CommonAnalyticsAttributes) => void;
24
+ readonly trackCreateSession: (action: AgentCreateAction, attributes?: CommonAnalyticsAttributes) => void;
22
25
  readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
23
26
  readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
24
27
  readonly refreshCSID: () => `${string}-${string}-${string}-${string}-${string}`;
@@ -7,33 +7,49 @@
7
7
  * NOTE: This is about UI interactions, not backend "actions" (which are being replaced by "tools").
8
8
  *
9
9
  * ## Adding a new action
10
- * 1. Add the action to the `AgentInteractionActions` enum below with a data-portal link
11
- * 2. Add the corresponding attribute type in `AgentInteractionAttributes`
12
- * 3. If this action doesn't fit user interactions, create a new group file instead
10
+ * 1. Add a new variant to the `AgentInteractionsEventPayload` union type below with a data-portal link
11
+ * 2. If this action doesn't fit user interactions, create a new group file instead
13
12
  * (see other files in this directory for the template)
14
13
  */
15
14
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
16
- /** The group name sent as `attributes.actionGroup` in analytics events */
17
- export declare const ACTION_GROUP: "agentInteractions";
18
- export declare enum AgentInteractionActions {
19
- VIEW = "view",
20
- EDIT = "edit",
21
- COPY_LINK = "copyLink",
22
- DELETE = "delete",
23
- DUPLICATE = "duplicate",
24
- STAR = "star",
25
- CHAT = "chat",
26
- VERIFY = "verify",
27
- UNVERIFY = "unverify"
28
- }
29
- export type AgentInteractionAttributes = {
30
- [AgentInteractionActions.VIEW]: BaseAgentAnalyticsAttributes;
31
- [AgentInteractionActions.EDIT]: BaseAgentAnalyticsAttributes;
32
- [AgentInteractionActions.COPY_LINK]: BaseAgentAnalyticsAttributes;
33
- [AgentInteractionActions.DELETE]: BaseAgentAnalyticsAttributes;
34
- [AgentInteractionActions.DUPLICATE]: BaseAgentAnalyticsAttributes;
35
- [AgentInteractionActions.STAR]: BaseAgentAnalyticsAttributes;
36
- [AgentInteractionActions.CHAT]: BaseAgentAnalyticsAttributes;
37
- [AgentInteractionActions.VERIFY]: BaseAgentAnalyticsAttributes;
38
- [AgentInteractionActions.UNVERIFY]: BaseAgentAnalyticsAttributes;
15
+ /**
16
+ * Discriminated union payload type for agent interaction events.
17
+ * Use with `trackAgentEvent()`.
18
+ */
19
+ export type AgentInteractionsEventPayload = {
20
+ actionSubject: 'rovoAgent';
21
+ action: 'view';
22
+ attributes: BaseAgentAnalyticsAttributes;
23
+ } | {
24
+ actionSubject: 'rovoAgent';
25
+ action: 'edit';
26
+ attributes: BaseAgentAnalyticsAttributes;
27
+ } | {
28
+ actionSubject: 'rovoAgent';
29
+ action: 'copyLink';
30
+ attributes: BaseAgentAnalyticsAttributes;
31
+ } | {
32
+ actionSubject: 'rovoAgent';
33
+ action: 'delete';
34
+ attributes: BaseAgentAnalyticsAttributes;
35
+ } | {
36
+ actionSubject: 'rovoAgent';
37
+ action: 'duplicate';
38
+ attributes: BaseAgentAnalyticsAttributes;
39
+ } | {
40
+ actionSubject: 'rovoAgent';
41
+ action: 'star';
42
+ attributes: BaseAgentAnalyticsAttributes;
43
+ } | {
44
+ actionSubject: 'rovoAgent';
45
+ action: 'chat';
46
+ attributes: BaseAgentAnalyticsAttributes;
47
+ } | {
48
+ actionSubject: 'rovoAgent';
49
+ action: 'verify';
50
+ attributes: BaseAgentAnalyticsAttributes;
51
+ } | {
52
+ actionSubject: 'rovoAgent';
53
+ action: 'unverify';
54
+ attributes: BaseAgentAnalyticsAttributes;
39
55
  };
@@ -4,27 +4,31 @@
4
4
  * Actions related to the agent debug modal (viewing, copying debug data, toggling skill info).
5
5
  *
6
6
  * ## Adding a new action
7
- * 1. Add the action to the `AgentDebugActions` enum below with a data-portal link
8
- * 2. Add the corresponding attribute type in `DebugActionAttributes`
9
- * 3. If this action doesn't fit this group, consider creating a new group file instead
7
+ * 1. Add a new variant to the `DebugEventPayload` union type below with a data-portal link
8
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
10
9
  * (see other files in this directory for the template)
11
10
  */
12
- /** The group name sent as `attributes.actionGroup` in analytics events */
13
- export declare const ACTION_GROUP: "debug";
14
- export declare enum AgentDebugActions {
15
- VIEW = "debugView",
16
- COPY_ALL = "debugCopyAll",
17
- COPY = "debugCopy",
18
- TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
19
- }
20
- type EmptyAttributes = {};
21
- export type DebugActionAttributes = {
22
- [AgentDebugActions.COPY_ALL]: EmptyAttributes;
23
- [AgentDebugActions.COPY]: EmptyAttributes;
24
- [AgentDebugActions.TOGGLE_SKILL_INFO]: {
11
+ /**
12
+ * Discriminated union payload type for debug events.
13
+ * Use with `trackAgentEvent()`.
14
+ */
15
+ export type DebugEventPayload = {
16
+ actionSubject: 'rovoAgent';
17
+ action: 'debugView';
18
+ attributes: {};
19
+ } | {
20
+ actionSubject: 'rovoAgent';
21
+ action: 'debugCopyAll';
22
+ attributes: {};
23
+ } | {
24
+ actionSubject: 'rovoAgent';
25
+ action: 'debugCopy';
26
+ attributes: {};
27
+ } | {
28
+ actionSubject: 'rovoAgent';
29
+ action: 'debugToggleSkillInfo';
30
+ attributes: {
25
31
  toolId: string;
26
32
  isExpanded: boolean;
27
33
  };
28
- [AgentDebugActions.VIEW]: EmptyAttributes;
29
34
  };
30
- export {};
@@ -5,19 +5,15 @@
5
5
  * Unlike agentInteractions (user clicks), these track actual data changes.
6
6
  *
7
7
  * ## Adding a new action
8
- * 1. Add the action to the `AgentEditingActions` enum below with a data-portal link
9
- * 2. Add the corresponding attribute type in `EditingActionAttributes`
10
- * 3. If this action doesn't fit editing/mutation events, create a new group file instead
8
+ * 1. Add a new variant to the `EditingEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit editing/mutation events, create a new group file instead
11
10
  * (see other files in this directory for the template)
12
11
  */
13
12
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
14
- /** The group name sent as `attributes.actionGroup` in analytics events */
15
- export declare const ACTION_GROUP: "editing";
16
- export declare enum AgentEditingActions {
17
- UPDATED = "updated"
18
- }
19
- export type EditingActionAttributes = {
20
- [AgentEditingActions.UPDATED]: BaseAgentAnalyticsAttributes & {
13
+ export type EditingEventPayload = {
14
+ actionSubject: 'rovoAgent';
15
+ action: 'updated';
16
+ attributes: BaseAgentAnalyticsAttributes & {
21
17
  agentType: string;
22
18
  field: string;
23
19
  };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Action Group: evaluation
3
+ *
4
+ * Batch evaluation events — dataset CRUD, job lifecycle, and validation UI events
5
+ * fired from the shared `agent-evaluation` package.
6
+ *
7
+ * ## Adding a new action
8
+ * 1. Add a new variant to the `EvaluationEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
10
+ * (see other files in this directory for the template)
11
+ */
12
+ type EvalAttributesBase = {
13
+ objectType?: string;
14
+ objectId?: string;
15
+ containerType?: string;
16
+ containerId?: string;
17
+ actionSubjectId?: string;
18
+ };
19
+ export type EvaluationEventPayload = ({
20
+ actionSubject: 'batchEvaluationDataset';
21
+ action: 'created';
22
+ attributes: {
23
+ totalQuestions: number;
24
+ };
25
+ } & EvalAttributesBase) | ({
26
+ actionSubject: 'batchEvaluationJob';
27
+ action: 'created';
28
+ attributes: {
29
+ datasetSize: number;
30
+ isDraftAgent: boolean;
31
+ judgeMode: string | undefined;
32
+ };
33
+ } & EvalAttributesBase) | ({
34
+ actionSubject: 'batchEvaluationDataset';
35
+ action: 'deleted';
36
+ attributes: {};
37
+ } & EvalAttributesBase) | ({
38
+ actionSubject: 'batchEvaluationDatasetQuestion';
39
+ action: 'deleted';
40
+ attributes: {};
41
+ } & EvalAttributesBase) | ({
42
+ actionSubject: 'evalResultsModal';
43
+ action: 'viewed';
44
+ attributes: {
45
+ trigger: 'row_action' | 'flag_action';
46
+ };
47
+ } & EvalAttributesBase) | ({
48
+ actionSubject: 'batchEvaluationJob';
49
+ action: 'completed';
50
+ attributes: {
51
+ status: string | null;
52
+ durationMs: number | null;
53
+ datasetSize: number | null | undefined;
54
+ };
55
+ } & EvalAttributesBase);
56
+ export {};
@@ -5,21 +5,12 @@
5
5
  * (confirming, streaming, viewing results, errors).
6
6
  *
7
7
  * ## Adding a new action
8
- * 1. Add the action to the `AgentToolActions` enum below with a data-portal link
9
- * 2. Add the corresponding attribute type in `ToolsActionAttributes`
10
- * 3. If this action doesn't fit this group, consider creating a new group file instead
8
+ * 1. Add a new variant to the `ToolsEventPayload` union type below with a data-portal link
9
+ * 2. If this action doesn't fit this group, consider creating a new group file instead
11
10
  * (see other files in this directory for the template)
12
11
  */
13
12
  import type { BaseAgentAnalyticsAttributes } from '../../common/types';
14
- /** The group name sent as `attributes.actionGroup` in analytics events */
15
- export declare const ACTION_GROUP: "tools";
16
- export declare enum AgentToolActions {
17
- TOOLS_EXECUTION_CONFIRMED = "toolsExecutionConfirmed",
18
- TOOLS_EXECUTION_STREAM_STOPPED = "toolsExecutionStreamStopped",
19
- TOOLS_EXECUTION_RESULT_VIEWED = "toolsExecutionResultViewed",
20
- TOOLS_EXECUTION_RESULT_ERROR = "toolsExecutionResultError"
21
- }
22
- export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
13
+ type ToolsExecutionAttributesBase = BaseAgentAnalyticsAttributes & {
23
14
  tools: {
24
15
  toolId: string;
25
16
  toolSource: string;
@@ -27,12 +18,23 @@ export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
27
18
  }[];
28
19
  singleInstrumentationId: string | undefined;
29
20
  };
30
- export type ToolsExecutionResultAttributes = ToolsExecutionAttributes & {
31
- scenarioId: string | null | undefined;
32
- };
33
- export type ToolsActionAttributes = {
34
- [AgentToolActions.TOOLS_EXECUTION_CONFIRMED]: ToolsExecutionAttributes;
35
- [AgentToolActions.TOOLS_EXECUTION_STREAM_STOPPED]: ToolsExecutionAttributes;
36
- [AgentToolActions.TOOLS_EXECUTION_RESULT_VIEWED]: ToolsExecutionResultAttributes;
37
- [AgentToolActions.TOOLS_EXECUTION_RESULT_ERROR]: ToolsExecutionAttributes;
21
+ export type ToolsEventPayload = {
22
+ actionSubject: 'rovoAgent';
23
+ action: 'toolsExecutionConfirmed';
24
+ attributes: ToolsExecutionAttributesBase;
25
+ } | {
26
+ actionSubject: 'rovoAgent';
27
+ action: 'toolsExecutionStreamStopped';
28
+ attributes: ToolsExecutionAttributesBase;
29
+ } | {
30
+ actionSubject: 'rovoAgent';
31
+ action: 'toolsExecutionResultViewed';
32
+ attributes: ToolsExecutionAttributesBase & {
33
+ scenarioId: string | null | undefined;
34
+ };
35
+ } | {
36
+ actionSubject: 'rovoAgent';
37
+ action: 'toolsExecutionResultError';
38
+ attributes: ToolsExecutionAttributesBase;
38
39
  };
40
+ export {};