@atlaskit/rovo-agent-analytics 0.20.0 → 1.1.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 (67) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +44 -29
  3. package/dist/cjs/actions/groups/add-tools-prompt.js +1 -43
  4. package/dist/cjs/actions/groups/agent-interactions.js +1 -51
  5. package/dist/cjs/actions/groups/create-flow.js +1 -51
  6. package/dist/cjs/actions/groups/debug.js +1 -42
  7. package/dist/cjs/actions/groups/editing.js +1 -28
  8. package/dist/cjs/actions/groups/tools.js +1 -36
  9. package/dist/cjs/actions/index.js +2 -43
  10. package/dist/cjs/common/csid/index.js +16 -27
  11. package/dist/cjs/common/types.js +5 -0
  12. package/dist/cjs/create/index.js +36 -25
  13. package/dist/es2019/actions/groups/add-tools-prompt.js +0 -37
  14. package/dist/es2019/actions/groups/agent-interactions.js +1 -50
  15. package/dist/es2019/actions/groups/create-flow.js +0 -45
  16. package/dist/es2019/actions/groups/debug.js +0 -37
  17. package/dist/es2019/actions/groups/editing.js +1 -27
  18. package/dist/es2019/actions/groups/tools.js +1 -37
  19. package/dist/es2019/actions/index.js +1 -47
  20. package/dist/es2019/common/csid/index.js +16 -27
  21. package/dist/es2019/common/types.js +5 -0
  22. package/dist/es2019/create/index.js +32 -22
  23. package/dist/esm/actions/groups/add-tools-prompt.js +0 -37
  24. package/dist/esm/actions/groups/agent-interactions.js +1 -50
  25. package/dist/esm/actions/groups/create-flow.js +0 -45
  26. package/dist/esm/actions/groups/debug.js +0 -37
  27. package/dist/esm/actions/groups/editing.js +1 -27
  28. package/dist/esm/actions/groups/tools.js +1 -37
  29. package/dist/esm/actions/index.js +1 -43
  30. package/dist/esm/common/csid/index.js +17 -28
  31. package/dist/esm/common/types.js +5 -0
  32. package/dist/esm/create/index.js +31 -21
  33. package/dist/types/actions/groups/add-tools-prompt.d.ts +1 -14
  34. package/dist/types/actions/groups/agent-interactions.d.ts +0 -26
  35. package/dist/types/actions/groups/create-flow.d.ts +21 -15
  36. package/dist/types/actions/groups/debug.d.ts +0 -21
  37. package/dist/types/actions/groups/editing.d.ts +0 -13
  38. package/dist/types/actions/groups/tools.d.ts +0 -29
  39. package/dist/types/actions/index.d.ts +1 -20
  40. package/dist/types/common/constants.d.ts +1 -1
  41. package/dist/types/common/csid/index.d.ts +8 -4
  42. package/dist/types/common/types.d.ts +17 -5
  43. package/dist/types/create/index.d.ts +10 -18
  44. package/dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts +1 -14
  45. package/dist/types-ts4.5/actions/groups/agent-interactions.d.ts +0 -26
  46. package/dist/types-ts4.5/actions/groups/create-flow.d.ts +21 -15
  47. package/dist/types-ts4.5/actions/groups/debug.d.ts +0 -21
  48. package/dist/types-ts4.5/actions/groups/editing.d.ts +0 -13
  49. package/dist/types-ts4.5/actions/groups/tools.d.ts +0 -29
  50. package/dist/types-ts4.5/actions/index.d.ts +1 -20
  51. package/dist/types-ts4.5/common/constants.d.ts +1 -1
  52. package/dist/types-ts4.5/common/csid/index.d.ts +8 -4
  53. package/dist/types-ts4.5/common/types.d.ts +17 -5
  54. package/dist/types-ts4.5/create/index.d.ts +10 -18
  55. package/package.json +13 -13
  56. package/actions/add-tools-prompt/package.json +0 -17
  57. package/actions/agent-interactions/package.json +0 -17
  58. package/actions/create-flow/package.json +0 -17
  59. package/actions/debug/package.json +0 -17
  60. package/actions/editing/package.json +0 -17
  61. package/actions/evaluation/package.json +0 -17
  62. package/actions/tool-actions/package.json +0 -17
  63. package/dist/cjs/actions/registry.js +0 -26
  64. package/dist/es2019/actions/registry.js +0 -20
  65. package/dist/esm/actions/registry.js +0 -20
  66. package/dist/types/actions/registry.d.ts +0 -23
  67. package/dist/types-ts4.5/actions/registry.d.ts +0 -23
@@ -1,23 +1,4 @@
1
- import { type EventPayload, 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
3
  trackAgentEvent: (payload: EventPayload) => void;
22
- trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
23
4
  };
@@ -1,3 +1,3 @@
1
1
  import { FabricChannel } from '@atlaskit/analytics-listeners';
2
- export declare const ANALYTICS_CHANNEL = FabricChannel.aiMate;
2
+ export declare const ANALYTICS_CHANNEL: FabricChannel.aiMate;
3
3
  export declare const CSID_QUERY_PARAM = "csid";
@@ -1,8 +1,12 @@
1
1
  /**
2
- * Hook to get Rovo Agent Create Session ID (CSID) from the query parameters or generate a new one if not found.
3
- * @returns Rovo Agent CSID as a string.
2
+ * Hook to manage CSID state for entry point components.
3
+ * The returned csid is used in href attributes and by trackCreateSessionStart.
4
+ * After trackCreateSessionStart fires, it calls refresh() to generate a new CSID
5
+ * for the next session — the component re-renders and the href updates.
4
6
  */
5
- export declare const useRovoAgentCSID: () => readonly [string | null, {
7
+ export declare const useRovoAgentCSID: () => readonly [{
8
+ readonly csid: string | null;
9
+ readonly globalCSID: string | null;
10
+ }, {
6
11
  refresh: () => `${string}-${string}-${string}-${string}-${string}`;
7
- clear: () => null;
8
12
  }];
@@ -1,19 +1,31 @@
1
- import type { AddToolsPromptEventPayload } from '../actions/groups/add-tools-prompt';
2
1
  import type { AgentInteractionsEventPayload } from '../actions/groups/agent-interactions';
3
- import type { CreateFlowEventPayload } from '../actions/groups/create-flow';
4
2
  import type { DebugEventPayload } from '../actions/groups/debug';
5
3
  import type { EditingEventPayload } from '../actions/groups/editing';
6
4
  import type { EvaluationEventPayload } from '../actions/groups/evaluation';
7
5
  import type { ToolsEventPayload } from '../actions/groups/tools';
8
6
  export type RemainingRequired<T, P extends Partial<T>> = Required<Omit<T, keyof P>>;
9
7
  export type BaseAgentAnalyticsAttributes = {
10
- touchPoint: string;
11
- agentId: string;
8
+ touchPoint?: string;
9
+ agentId?: string;
12
10
  };
13
11
  /** Common library attribute injected into all events */
14
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
+ };
15
27
  /**
16
28
  * Union of all event payload types.
17
29
  * Use with `trackAgentEvent()` for typed event tracking.
18
30
  */
19
- export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | CreateFlowEventPayload | AddToolsPromptEventPayload;
31
+ export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | ErrorEventPayload;
@@ -1,26 +1,18 @@
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
+ import type { AddToolsPromptEventPayload } from '../actions/groups/add-tools-prompt';
2
+ import type { CreateFlowEventPayload } from '../actions/groups/create-flow';
3
+ /**
4
+ * Union of all valid actions for the create agent analytics hook.
5
+ * Derived from the event payload types in the action group files.
6
+ * To add a new action, update the payload type in the relevant group file.
7
+ */
8
+ type AgentCreateAction = CreateFlowEventPayload['action'] | AddToolsPromptEventPayload['action'];
17
9
  type CommonAnalyticsAttributes = {
18
10
  touchPoint?: string;
19
11
  } & Record<string, any>;
20
12
  export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [string | null, {
21
- readonly trackCreateSession: (action: (typeof AgentCreateActions)[keyof typeof AgentCreateActions], attributes?: CommonAnalyticsAttributes) => void;
13
+ readonly trackCreateSession: (action: AgentCreateAction, attributes?: CommonAnalyticsAttributes) => void;
22
14
  readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
23
15
  readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
24
- readonly refreshCSID: () => `${string}-${string}-${string}-${string}-${string}`;
16
+ readonly refreshCSID: () => string;
25
17
  }];
26
18
  export {};
@@ -1,16 +1,11 @@
1
1
  /**
2
2
  * Action Group: addToolsPrompt
3
3
  *
4
- * Add tools prompt modal shown when a user tries to activate/publish an agent that has no tools.
5
- * The user can browse tools or dismiss and proceed without them.
6
- *
7
- * This group is intentionally flow-agnostic so the action values stay stable
8
- * regardless of whether the prompt fires from the create flow or a future publish flow.
4
+ * Events related to the "Add Tools" prompt shown during agent creation.
9
5
  *
10
6
  * ## Adding a new action
11
7
  * 1. Add a new variant to the `AddToolsPromptEventPayload` union type below with a data-portal link
12
8
  * 2. If this action doesn't fit this group, consider creating a new group file instead
13
- * (see other files in this directory for the template)
14
9
  */
15
10
  /**
16
11
  * Discriminated union payload type for add tools prompt events.
@@ -29,11 +24,3 @@ export type AddToolsPromptEventPayload = {
29
24
  action: 'addToolsPromptDismiss';
30
25
  attributes: {};
31
26
  };
32
- /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
33
- export declare const ACTION_GROUP: "addToolsPrompt";
34
- /** @deprecated Use AddToolsPromptEventPayload with trackAgentEvent() instead */
35
- export declare enum AddToolsPromptActions {
36
- SHOWN = "addToolsPromptShown",
37
- BROWSE = "addToolsPromptBrowse",
38
- DISMISS = "addToolsPromptDismiss"
39
- }
@@ -53,29 +53,3 @@ export type AgentInteractionsEventPayload = {
53
53
  action: 'unverify';
54
54
  attributes: BaseAgentAnalyticsAttributes;
55
55
  };
56
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
57
- export declare const ACTION_GROUP: "agentInteractions";
58
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
59
- export declare enum AgentInteractionActions {
60
- VIEW = "view",
61
- EDIT = "edit",
62
- COPY_LINK = "copyLink",
63
- DELETE = "delete",
64
- DUPLICATE = "duplicate",
65
- STAR = "star",
66
- CHAT = "chat",
67
- VERIFY = "verify",
68
- UNVERIFY = "unverify"
69
- }
70
- /** @deprecated Use AgentInteractionsEventPayload with trackAgentEvent() instead */
71
- export type AgentInteractionAttributes = {
72
- [AgentInteractionActions.VIEW]: BaseAgentAnalyticsAttributes;
73
- [AgentInteractionActions.EDIT]: BaseAgentAnalyticsAttributes;
74
- [AgentInteractionActions.COPY_LINK]: BaseAgentAnalyticsAttributes;
75
- [AgentInteractionActions.DELETE]: BaseAgentAnalyticsAttributes;
76
- [AgentInteractionActions.DUPLICATE]: BaseAgentAnalyticsAttributes;
77
- [AgentInteractionActions.STAR]: BaseAgentAnalyticsAttributes;
78
- [AgentInteractionActions.CHAT]: BaseAgentAnalyticsAttributes;
79
- [AgentInteractionActions.VERIFY]: BaseAgentAnalyticsAttributes;
80
- [AgentInteractionActions.UNVERIFY]: BaseAgentAnalyticsAttributes;
81
- };
@@ -1,7 +1,23 @@
1
1
  /**
2
2
  * Action Group: createFlow
3
3
  *
4
- * Create agent funnel steps — from clicking "Create agent" through to activation or discard,
4
+ * Create agent funnel steps — from clicking "Create agent" through to activation or discard.
5
+ *
6
+ * ## Funnel overview
7
+ *
8
+ * | Step | v1 (NL flow) event | v2 (SA flow) event | CSID behavior |
9
+ * |-----------------------|------------------------|------------------------|----------------------------------|
10
+ * | Intent to create | createFlowStart | saDraft | Uses existing CSID |
11
+ * | Land in NL page | createLandInStudio | (skipped) | Uses existing CSID |
12
+ * | NL interaction | REVIEW_NL / SKIP_NL | (skipped) | Uses existing CSID |
13
+ * | Land in configure | createLandInConfigure | createLandInConfigure | Uses existing CSID |
14
+ * | Activate agent | createFlowActivate | createFlowActivate | Uses existing CSID |
15
+ *
16
+ * ## CSID (Create Session ID)
17
+ *
18
+ * CSID links all events in a single agent creation session.
19
+ * - `trackCreateSessionStart()` fires `createFlowStart` with the current CSID
20
+ * - `trackCreateSession()` uses the existing CSID (for all other steps including `saDraft`)
5
21
  *
6
22
  * ## Adding a new action
7
23
  * 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
@@ -48,18 +64,8 @@ export type CreateFlowEventPayload = {
48
64
  actionSubject: 'rovoAgent';
49
65
  action: 'saDraft';
50
66
  attributes: {};
67
+ } | {
68
+ actionSubject: 'rovoAgent';
69
+ action: 'createLandInConfigure';
70
+ attributes: {};
51
71
  };
52
- /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
53
- export declare const ACTION_GROUP: "createFlow";
54
- /** @deprecated Use CreateFlowEventPayload with trackAgentEvent() instead */
55
- export declare enum CreateFlowActions {
56
- START = "createFlowStart",
57
- SKIP_NL = "createFlowSkipNL",
58
- REVIEW_NL = "createFlowReviewNL",
59
- ACTIVATE = "createFlowActivate",
60
- RESTART = "createFlowRestart",
61
- ERROR = "createFlowError",
62
- LAND = "createLandInStudio",
63
- DISCARD = "createDiscard",
64
- SA_DRAFT = "saDraft"
65
- }
@@ -32,24 +32,3 @@ export type DebugEventPayload = {
32
32
  isExpanded: boolean;
33
33
  };
34
34
  };
35
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
36
- export declare const ACTION_GROUP: "debug";
37
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
38
- export declare enum AgentDebugActions {
39
- VIEW = "debugView",
40
- COPY_ALL = "debugCopyAll",
41
- COPY = "debugCopy",
42
- TOGGLE_SKILL_INFO = "debugToggleSkillInfo"
43
- }
44
- type EmptyAttributes = {};
45
- /** @deprecated Use DebugEventPayload with trackAgentEvent() instead */
46
- export type DebugActionAttributes = {
47
- [AgentDebugActions.COPY_ALL]: EmptyAttributes;
48
- [AgentDebugActions.COPY]: EmptyAttributes;
49
- [AgentDebugActions.TOGGLE_SKILL_INFO]: {
50
- toolId: string;
51
- isExpanded: boolean;
52
- };
53
- [AgentDebugActions.VIEW]: EmptyAttributes;
54
- };
55
- export {};
@@ -18,16 +18,3 @@ export type EditingEventPayload = {
18
18
  field: string;
19
19
  };
20
20
  };
21
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
22
- export declare const ACTION_GROUP: "editing";
23
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
24
- export declare enum AgentEditingActions {
25
- UPDATED = "updated"
26
- }
27
- /** @deprecated Use EditingEventPayload with trackAgentEvent() instead */
28
- export type EditingActionAttributes = {
29
- [AgentEditingActions.UPDATED]: BaseAgentAnalyticsAttributes & {
30
- agentType: string;
31
- field: string;
32
- };
33
- };
@@ -37,33 +37,4 @@ export type ToolsEventPayload = {
37
37
  action: 'toolsExecutionResultError';
38
38
  attributes: ToolsExecutionAttributesBase;
39
39
  };
40
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
41
- export declare const ACTION_GROUP: "tools";
42
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
43
- export declare enum AgentToolActions {
44
- TOOLS_EXECUTION_CONFIRMED = "toolsExecutionConfirmed",
45
- TOOLS_EXECUTION_STREAM_STOPPED = "toolsExecutionStreamStopped",
46
- TOOLS_EXECUTION_RESULT_VIEWED = "toolsExecutionResultViewed",
47
- TOOLS_EXECUTION_RESULT_ERROR = "toolsExecutionResultError"
48
- }
49
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
50
- export type ToolsExecutionAttributes = BaseAgentAnalyticsAttributes & {
51
- tools: {
52
- toolId: string;
53
- toolSource: string;
54
- resolutionType: string;
55
- }[];
56
- singleInstrumentationId: string | undefined;
57
- };
58
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
59
- export type ToolsExecutionResultAttributes = ToolsExecutionAttributes & {
60
- scenarioId: string | null | undefined;
61
- };
62
- /** @deprecated Use ToolsEventPayload with trackAgentEvent() instead */
63
- export type ToolsActionAttributes = {
64
- [AgentToolActions.TOOLS_EXECUTION_CONFIRMED]: ToolsExecutionAttributes;
65
- [AgentToolActions.TOOLS_EXECUTION_STREAM_STOPPED]: ToolsExecutionAttributes;
66
- [AgentToolActions.TOOLS_EXECUTION_RESULT_VIEWED]: ToolsExecutionResultAttributes;
67
- [AgentToolActions.TOOLS_EXECUTION_RESULT_ERROR]: ToolsExecutionAttributes;
68
- };
69
40
  export {};
@@ -1,23 +1,4 @@
1
- import { type EventPayload, 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
3
  trackAgentEvent: (payload: EventPayload) => void;
22
- trackAgentActionError: <A extends keyof ActionAttributes>(action: A, error: Error, attributes?: RemainingRequired<ActionAttributes[A], T>) => void;
23
4
  };
@@ -1,3 +1,3 @@
1
1
  import { FabricChannel } from '@atlaskit/analytics-listeners';
2
- export declare const ANALYTICS_CHANNEL = FabricChannel.aiMate;
2
+ export declare const ANALYTICS_CHANNEL: FabricChannel.aiMate;
3
3
  export declare const CSID_QUERY_PARAM = "csid";
@@ -1,11 +1,15 @@
1
1
  /**
2
- * Hook to get Rovo Agent Create Session ID (CSID) from the query parameters or generate a new one if not found.
3
- * @returns Rovo Agent CSID as a string.
2
+ * Hook to manage CSID state for entry point components.
3
+ * The returned csid is used in href attributes and by trackCreateSessionStart.
4
+ * After trackCreateSessionStart fires, it calls refresh() to generate a new CSID
5
+ * for the next session — the component re-renders and the href updates.
4
6
  */
5
7
  export declare const useRovoAgentCSID: () => readonly [
6
- string | null,
8
+ {
9
+ readonly csid: string | null;
10
+ readonly globalCSID: string | null;
11
+ },
7
12
  {
8
13
  refresh: () => `${string}-${string}-${string}-${string}-${string}`;
9
- clear: () => null;
10
14
  }
11
15
  ];
@@ -1,19 +1,31 @@
1
- import type { AddToolsPromptEventPayload } from '../actions/groups/add-tools-prompt';
2
1
  import type { AgentInteractionsEventPayload } from '../actions/groups/agent-interactions';
3
- import type { CreateFlowEventPayload } from '../actions/groups/create-flow';
4
2
  import type { DebugEventPayload } from '../actions/groups/debug';
5
3
  import type { EditingEventPayload } from '../actions/groups/editing';
6
4
  import type { EvaluationEventPayload } from '../actions/groups/evaluation';
7
5
  import type { ToolsEventPayload } from '../actions/groups/tools';
8
6
  export type RemainingRequired<T, P extends Partial<T>> = Required<Omit<T, keyof P>>;
9
7
  export type BaseAgentAnalyticsAttributes = {
10
- touchPoint: string;
11
- agentId: string;
8
+ touchPoint?: string;
9
+ agentId?: string;
12
10
  };
13
11
  /** Common library attribute injected into all events */
14
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
+ };
15
27
  /**
16
28
  * Union of all event payload types.
17
29
  * Use with `trackAgentEvent()` for typed event tracking.
18
30
  */
19
- export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | CreateFlowEventPayload | AddToolsPromptEventPayload;
31
+ export type EventPayload = EditingEventPayload | AgentInteractionsEventPayload | DebugEventPayload | ToolsEventPayload | EvaluationEventPayload | ErrorEventPayload;
@@ -1,29 +1,21 @@
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
+ import type { AddToolsPromptEventPayload } from '../actions/groups/add-tools-prompt';
2
+ import type { CreateFlowEventPayload } from '../actions/groups/create-flow';
3
+ /**
4
+ * Union of all valid actions for the create agent analytics hook.
5
+ * Derived from the event payload types in the action group files.
6
+ * To add a new action, update the payload type in the relevant group file.
7
+ */
8
+ type AgentCreateAction = CreateFlowEventPayload['action'] | AddToolsPromptEventPayload['action'];
17
9
  type CommonAnalyticsAttributes = {
18
10
  touchPoint?: string;
19
11
  } & Record<string, any>;
20
12
  export declare const useRovoAgentCreateAnalytics: (commonAttributes: CommonAnalyticsAttributes) => readonly [
21
13
  string | null,
22
14
  {
23
- readonly trackCreateSession: (action: (typeof AgentCreateActions)[keyof typeof AgentCreateActions], attributes?: CommonAnalyticsAttributes) => void;
15
+ readonly trackCreateSession: (action: AgentCreateAction, attributes?: CommonAnalyticsAttributes) => void;
24
16
  readonly trackCreateSessionStart: (attributes?: CommonAnalyticsAttributes) => void;
25
17
  readonly trackCreateSessionError: (error: Error, attributes?: CommonAnalyticsAttributes) => void;
26
- readonly refreshCSID: () => `${string}-${string}-${string}-${string}-${string}`;
18
+ readonly refreshCSID: () => string;
27
19
  }
28
20
  ];
29
21
  export {};
package/package.json CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
+ "name": "@atlaskit/rovo-agent-analytics",
3
+ "version": "1.1.0",
4
+ "description": "Rovo Agents analytics",
5
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
2
6
  "atlassian": {
3
7
  "team": "Rovo Agents",
4
8
  "website": {
@@ -6,7 +10,11 @@
6
10
  "category": "Layout and structure"
7
11
  }
8
12
  },
9
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
13
+ "author": "Atlassian Pty Ltd",
14
+ "license": "Apache-2.0",
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
10
18
  "main": "dist/cjs/index.js",
11
19
  "module": "dist/esm/index.js",
12
20
  "module:es2019": "dist/es2019/index.js",
@@ -19,19 +27,16 @@
19
27
  ]
20
28
  }
21
29
  },
30
+ "atlaskit:src": "src/index.ts",
22
31
  "sideEffects": [
23
32
  "*.compiled.css"
24
33
  ],
25
- "atlaskit:src": "src/index.ts",
26
34
  "dependencies": {
27
35
  "@atlaskit/analytics-listeners": "^10.0.0",
28
36
  "@atlaskit/analytics-next": "^11.1.0",
29
37
  "@babel/runtime": "^7.0.0",
30
38
  "@compiled/react": "^0.20.0"
31
39
  },
32
- "peerDependencies": {
33
- "react": "^18.2.0"
34
- },
35
40
  "devDependencies": {
36
41
  "@af/integration-testing": "workspace:^",
37
42
  "@af/visual-regression": "workspace:^",
@@ -39,6 +44,9 @@
39
44
  "@testing-library/react": "^16.3.0",
40
45
  "react-dom": "^18.2.0"
41
46
  },
47
+ "peerDependencies": {
48
+ "react": "^18.2.0"
49
+ },
42
50
  "techstack": {
43
51
  "@atlassian/frontend": {
44
52
  "import-structure": [
@@ -73,13 +81,5 @@
73
81
  "import-no-extraneous-disable-for-examples-and-docs"
74
82
  ]
75
83
  }
76
- },
77
- "name": "@atlaskit/rovo-agent-analytics",
78
- "version": "0.20.0",
79
- "description": "Rovo Agents analytics",
80
- "author": "Atlassian Pty Ltd",
81
- "license": "Apache-2.0",
82
- "publishConfig": {
83
- "registry": "https://registry.npmjs.org/"
84
84
  }
85
85
  }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/add-tools-prompt",
3
- "main": "../../dist/cjs/actions/groups/add-tools-prompt.js",
4
- "module": "../../dist/esm/actions/groups/add-tools-prompt.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/add-tools-prompt.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/add-tools-prompt.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/add-tools-prompt.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/agent-interactions",
3
- "main": "../../dist/cjs/actions/groups/agent-interactions.js",
4
- "module": "../../dist/esm/actions/groups/agent-interactions.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/agent-interactions.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/agent-interactions.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/agent-interactions.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/create-flow",
3
- "main": "../../dist/cjs/actions/groups/create-flow.js",
4
- "module": "../../dist/esm/actions/groups/create-flow.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/create-flow.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/create-flow.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/create-flow.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/debug",
3
- "main": "../../dist/cjs/actions/groups/debug.js",
4
- "module": "../../dist/esm/actions/groups/debug.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/debug.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/debug.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/debug.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/editing",
3
- "main": "../../dist/cjs/actions/groups/editing.js",
4
- "module": "../../dist/esm/actions/groups/editing.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/editing.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/editing.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/editing.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/evaluation",
3
- "main": "../../dist/cjs/actions/groups/evaluation.js",
4
- "module": "../../dist/esm/actions/groups/evaluation.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/evaluation.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/evaluation.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/evaluation.d.ts"
14
- ]
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@atlaskit/rovo-agent-analytics/actions/tool-actions",
3
- "main": "../../dist/cjs/actions/groups/tools.js",
4
- "module": "../../dist/esm/actions/groups/tools.js",
5
- "module:es2019": "../../dist/es2019/actions/groups/tools.js",
6
- "sideEffects": [
7
- "*.compiled.css"
8
- ],
9
- "types": "../../dist/types/actions/groups/tools.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/actions/groups/tools.d.ts"
14
- ]
15
- }
16
- }
17
- }