@atlaskit/rovo-agent-analytics 1.3.0 → 1.4.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 CHANGED
@@ -1,5 +1,45 @@
1
1
  # @atlaskit/rovo-agent-analytics
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`04fe400264167`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/04fe400264167) -
8
+ RAGE-3507: Add versioned-agent analytics foundation
9
+
10
+ ### `@atlaskit/rovo-agent-analytics`
11
+ - Added `VersionedAgentAttributes` type (`agentIsPublished`, `agentVersionNumber`)
12
+ - Added new `createFlow` event payloads:
13
+ - `createAgentRecord` — fires when BE `agentStudio_createAgent` mutation succeeds
14
+ (post-versioning, replaces `createFlowActivate`); minimal payload (registry/101157)
15
+ - `published` — fires on every agent version publish; carries rich agent attrs + versioning
16
+ envelope (registry/101158)
17
+ - `createLandInAgentLandingWithSA` — fires when user lands on agents landing with SA modal
18
+ auto-opened; v2/SA only (registry/99780)
19
+ - Extended `editing.ts` `updated` event to carry `agentIsPublished` from mutation response
20
+ - Updated `createFlow` JSDoc funnel table to v1 / v1+versioning / v2 / v2+versioning columns
21
+
22
+ ### `@atlassian/agent-studio`
23
+ - Three dedicated analytics helpers in `services/create-agent/utils.tsx`:
24
+ - `getAgentLegacyCreateActivateAnalytics` — rich write-input shape for legacy
25
+ `createFlowActivate` (deletion path RAGE-3459)
26
+ - `getAgentCreateAnalytics` — minimal payload for `createAgentRecord` (`agentId`, `source`,
27
+ `agentType`, `agentIsPublished`)
28
+ - `getAgentPublishAnalytics` — fragment-read shape for `published`; computes `agentToolCount`,
29
+ `agentMcpServerCount`, `agentToolsList` from agent-level tools and per-scenario `toolCount`,
30
+ `toolsList`, `mcpServerCount`, `mcpToolCount`
31
+ - `useCreateAgent`: new required `hasVersionCapability` param gates either-or between
32
+ `createAgentRecord` and `createFlowActivate`
33
+ - Publish-button: fires `published` event with rich attrs; fragment extended with `definitionId` +
34
+ `definitionSource` on all tool fields
35
+ - `update-agent-details` mutation: fires `updated` event with `agentIsPublished` from response
36
+ (gated on `rovo_agent_versioning_enabled` FG via `@include`)
37
+ - Landing: fires `createLandInAgentLandingWithSA` when SA modal auto-opens
38
+
39
+ ### `@atlassian/studio-solution-architect-ui-components`
40
+ - SA Manual Create Agent button: fires `createAgentRecord` analytics on successful create (gated
41
+ on `rovo-agents-universal-analytics` FG)
42
+
3
43
  ## 1.3.0
4
44
 
5
45
  ### Minor Changes
@@ -1 +1,5 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -4,6 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.LIBRARY_ATTRIBUTE = void 0;
7
+ /**
8
+ * Common attributes for events scoped to a single versioned agent.
9
+ *
10
+ * Extends `BaseAgentAnalyticsAttributes` with versioning state so DS can
11
+ * distinguish first-publish vs republish, edits-on-draft vs edits-after-publish,
12
+ * etc. without needing a separate event per state.
13
+ *
14
+ * - `agentIsPublished` — sourced from the BE `AgentStudioAssistant.isPublished`
15
+ * field. Whether the agent has at least one published version.
16
+ * - `agentVersionNumber` — the version number the event relates to (e.g. the
17
+ * version being edited or published). Sourced from the BE
18
+ * `AgentStudioAssistant.version.versionNumber` field.
19
+ *
20
+ * Apply to every event scoped to a single agent (CRUD, publish, AND usage events).
21
+ * Pre-mutation create-flow events stay attribute-free — no `agentId` exists yet.
22
+ */
23
+
7
24
  /** Common library attribute injected into all events */
8
25
  var LIBRARY_ATTRIBUTE = exports.LIBRARY_ATTRIBUTE = 'agents-analytics';
9
26
 
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Common attributes for events scoped to a single versioned agent.
3
+ *
4
+ * Extends `BaseAgentAnalyticsAttributes` with versioning state so DS can
5
+ * distinguish first-publish vs republish, edits-on-draft vs edits-after-publish,
6
+ * etc. without needing a separate event per state.
7
+ *
8
+ * - `agentIsPublished` — sourced from the BE `AgentStudioAssistant.isPublished`
9
+ * field. Whether the agent has at least one published version.
10
+ * - `agentVersionNumber` — the version number the event relates to (e.g. the
11
+ * version being edited or published). Sourced from the BE
12
+ * `AgentStudioAssistant.version.versionNumber` field.
13
+ *
14
+ * Apply to every event scoped to a single agent (CRUD, publish, AND usage events).
15
+ * Pre-mutation create-flow events stay attribute-free — no `agentId` exists yet.
16
+ */
17
+
1
18
  /** Common library attribute injected into all events */
2
19
  export const LIBRARY_ATTRIBUTE = 'agents-analytics';
3
20
 
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,20 @@
1
+ /**
2
+ * Common attributes for events scoped to a single versioned agent.
3
+ *
4
+ * Extends `BaseAgentAnalyticsAttributes` with versioning state so DS can
5
+ * distinguish first-publish vs republish, edits-on-draft vs edits-after-publish,
6
+ * etc. without needing a separate event per state.
7
+ *
8
+ * - `agentIsPublished` — sourced from the BE `AgentStudioAssistant.isPublished`
9
+ * field. Whether the agent has at least one published version.
10
+ * - `agentVersionNumber` — the version number the event relates to (e.g. the
11
+ * version being edited or published). Sourced from the BE
12
+ * `AgentStudioAssistant.version.versionNumber` field.
13
+ *
14
+ * Apply to every event scoped to a single agent (CRUD, publish, AND usage events).
15
+ * Pre-mutation create-flow events stay attribute-free — no `agentId` exists yet.
16
+ */
17
+
1
18
  /** Common library attribute injected into all events */
2
19
  export var LIBRARY_ATTRIBUTE = 'agents-analytics';
3
20
 
@@ -1,17 +1,33 @@
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 /
5
+ * publish.
6
+ *
7
+ * See LDR for the full reasoning behind the post-versioning funnel:
8
+ * https://hello.atlassian.net/wiki/spaces/778dcad2d8a34a91b8ebe71c18678e0c/pages/6851055849
5
9
  *
6
10
  * ## Funnel overview
7
11
  *
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 |
12
+ * | Step | v1 / NL (today) | v1 / NL + versioning | v2 / SA (today) | v2 / SA + versioning |
13
+ * |-------------------------------------|-------------------------|---------------------------------|-------------------------|---------------------------------|
14
+ * | Intent to create | createFlowStart | createFlowStart | saDraft | saDraft |
15
+ * | Land in NL page | createLandInStudio | createLandInStudio | — | |
16
+ * | NL interaction | createFlowReviewNL / | createFlowReviewNL / | — | |
17
+ * | | createFlowSkipNL | createFlowSkipNL | | |
18
+ * | Land on landing w/ SA modal | | | createLandIn- | createLandIn- |
19
+ * | | | | AgentLandingWithSA | AgentLandingWithSA |
20
+ * | Land in configure screen | createLandInConfigure | dropped (no FE draft anymore; | createLandInConfigure | createLandInConfigure |
21
+ * | | | createAgentRecord replaces it) | | |
22
+ * | Discard | createDiscard | dropped (no FE draft) | — | — |
23
+ * | Agent record created (BE mutation) | createFlowActivate | createAgentRecord (NEW) + | createFlowActivate | createFlowActivate |
24
+ * | | | createFlowActivate (kept until | | (SA still on FE drafts pre- |
25
+ * | | | rollout — RAGE-3459) | | migration) |
26
+ * | Published | — | published (NEW) | — | ❓ owned by SA team |
27
+ * | Generic error | createFlowError | createFlowError | createFlowError | createFlowError |
28
+ *
29
+ * Funnel completion (first publish) is derived from `published` events with
30
+ * `agentIsPublished === false` in the attributes (i.e. the pre-mutation state).
15
31
  *
16
32
  * ## CSID (Create Session ID)
17
33
  *
@@ -19,11 +35,17 @@
19
35
  * - `trackCreateSessionStart()` fires `createFlowStart` with the current CSID
20
36
  * - `trackCreateSession()` uses the existing CSID (for all other steps including `saDraft`)
21
37
  *
38
+ * With versioning the user can leave and come back days later to keep editing,
39
+ * so the in-memory linear "session" assumption breaks. Post-mutation events
40
+ * carry `agentId` (via `VersionedAgentAttributes`) which can be used as the
41
+ * stable correlation key across sessions. See LDR for the full discussion.
42
+ *
22
43
  * ## Adding a new action
23
44
  * 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
24
45
  * 2. If this action doesn't fit this group, consider creating a new group file instead
25
46
  * (see other files in this directory for the template)
26
47
  */
48
+ import type { VersionedAgentAttributes } from '../../common/types';
27
49
  /**
28
50
  * Discriminated union payload type for create flow events.
29
51
  * Use with `trackAgentEvent()`.
@@ -72,4 +94,16 @@ export type CreateFlowEventPayload = {
72
94
  actionSubject: 'rovoAgent';
73
95
  action: 'createSubpathRedirect';
74
96
  attributes: {};
97
+ } | {
98
+ actionSubject: 'rovoAgent';
99
+ action: 'createLandInAgentLandingWithSA';
100
+ attributes: {};
101
+ } | {
102
+ actionSubject: 'rovoAgent';
103
+ action: 'createAgentRecord';
104
+ attributes: VersionedAgentAttributes & Record<string, unknown>;
105
+ } | {
106
+ actionSubject: 'rovoAgent';
107
+ action: 'published';
108
+ attributes: VersionedAgentAttributes & Record<string, unknown>;
75
109
  };
@@ -9,11 +9,11 @@
9
9
  * 2. If this action doesn't fit editing/mutation events, create a new group file instead
10
10
  * (see other files in this directory for the template)
11
11
  */
12
- import type { BaseAgentAnalyticsAttributes } from '../../common/types';
12
+ import type { VersionedAgentAttributes } from '../../common/types';
13
13
  export type EditingEventPayload = {
14
14
  actionSubject: 'rovoAgent';
15
15
  action: 'updated';
16
- attributes: BaseAgentAnalyticsAttributes & {
16
+ attributes: VersionedAgentAttributes & {
17
17
  agentType: string;
18
18
  field: string;
19
19
  };
@@ -9,6 +9,26 @@ export type BaseAgentAnalyticsAttributes = {
9
9
  touchPoint?: string;
10
10
  agentId?: string;
11
11
  };
12
+ /**
13
+ * Common attributes for events scoped to a single versioned agent.
14
+ *
15
+ * Extends `BaseAgentAnalyticsAttributes` with versioning state so DS can
16
+ * distinguish first-publish vs republish, edits-on-draft vs edits-after-publish,
17
+ * etc. without needing a separate event per state.
18
+ *
19
+ * - `agentIsPublished` — sourced from the BE `AgentStudioAssistant.isPublished`
20
+ * field. Whether the agent has at least one published version.
21
+ * - `agentVersionNumber` — the version number the event relates to (e.g. the
22
+ * version being edited or published). Sourced from the BE
23
+ * `AgentStudioAssistant.version.versionNumber` field.
24
+ *
25
+ * Apply to every event scoped to a single agent (CRUD, publish, AND usage events).
26
+ * Pre-mutation create-flow events stay attribute-free — no `agentId` exists yet.
27
+ */
28
+ export type VersionedAgentAttributes = BaseAgentAnalyticsAttributes & {
29
+ agentIsPublished?: boolean | null;
30
+ agentVersionNumber?: number | null;
31
+ };
12
32
  /** Common library attribute injected into all events */
13
33
  export declare const LIBRARY_ATTRIBUTE: "agents-analytics";
14
34
  /**
@@ -1,17 +1,33 @@
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 /
5
+ * publish.
6
+ *
7
+ * See LDR for the full reasoning behind the post-versioning funnel:
8
+ * https://hello.atlassian.net/wiki/spaces/778dcad2d8a34a91b8ebe71c18678e0c/pages/6851055849
5
9
  *
6
10
  * ## Funnel overview
7
11
  *
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 |
12
+ * | Step | v1 / NL (today) | v1 / NL + versioning | v2 / SA (today) | v2 / SA + versioning |
13
+ * |-------------------------------------|-------------------------|---------------------------------|-------------------------|---------------------------------|
14
+ * | Intent to create | createFlowStart | createFlowStart | saDraft | saDraft |
15
+ * | Land in NL page | createLandInStudio | createLandInStudio | — | |
16
+ * | NL interaction | createFlowReviewNL / | createFlowReviewNL / | — | |
17
+ * | | createFlowSkipNL | createFlowSkipNL | | |
18
+ * | Land on landing w/ SA modal | | | createLandIn- | createLandIn- |
19
+ * | | | | AgentLandingWithSA | AgentLandingWithSA |
20
+ * | Land in configure screen | createLandInConfigure | dropped (no FE draft anymore; | createLandInConfigure | createLandInConfigure |
21
+ * | | | createAgentRecord replaces it) | | |
22
+ * | Discard | createDiscard | dropped (no FE draft) | — | — |
23
+ * | Agent record created (BE mutation) | createFlowActivate | createAgentRecord (NEW) + | createFlowActivate | createFlowActivate |
24
+ * | | | createFlowActivate (kept until | | (SA still on FE drafts pre- |
25
+ * | | | rollout — RAGE-3459) | | migration) |
26
+ * | Published | — | published (NEW) | — | ❓ owned by SA team |
27
+ * | Generic error | createFlowError | createFlowError | createFlowError | createFlowError |
28
+ *
29
+ * Funnel completion (first publish) is derived from `published` events with
30
+ * `agentIsPublished === false` in the attributes (i.e. the pre-mutation state).
15
31
  *
16
32
  * ## CSID (Create Session ID)
17
33
  *
@@ -19,11 +35,17 @@
19
35
  * - `trackCreateSessionStart()` fires `createFlowStart` with the current CSID
20
36
  * - `trackCreateSession()` uses the existing CSID (for all other steps including `saDraft`)
21
37
  *
38
+ * With versioning the user can leave and come back days later to keep editing,
39
+ * so the in-memory linear "session" assumption breaks. Post-mutation events
40
+ * carry `agentId` (via `VersionedAgentAttributes`) which can be used as the
41
+ * stable correlation key across sessions. See LDR for the full discussion.
42
+ *
22
43
  * ## Adding a new action
23
44
  * 1. Add a new variant to the `CreateFlowEventPayload` union type below with a data-portal link
24
45
  * 2. If this action doesn't fit this group, consider creating a new group file instead
25
46
  * (see other files in this directory for the template)
26
47
  */
48
+ import type { VersionedAgentAttributes } from '../../common/types';
27
49
  /**
28
50
  * Discriminated union payload type for create flow events.
29
51
  * Use with `trackAgentEvent()`.
@@ -72,4 +94,16 @@ export type CreateFlowEventPayload = {
72
94
  actionSubject: 'rovoAgent';
73
95
  action: 'createSubpathRedirect';
74
96
  attributes: {};
97
+ } | {
98
+ actionSubject: 'rovoAgent';
99
+ action: 'createLandInAgentLandingWithSA';
100
+ attributes: {};
101
+ } | {
102
+ actionSubject: 'rovoAgent';
103
+ action: 'createAgentRecord';
104
+ attributes: VersionedAgentAttributes & Record<string, unknown>;
105
+ } | {
106
+ actionSubject: 'rovoAgent';
107
+ action: 'published';
108
+ attributes: VersionedAgentAttributes & Record<string, unknown>;
75
109
  };
@@ -9,11 +9,11 @@
9
9
  * 2. If this action doesn't fit editing/mutation events, create a new group file instead
10
10
  * (see other files in this directory for the template)
11
11
  */
12
- import type { BaseAgentAnalyticsAttributes } from '../../common/types';
12
+ import type { VersionedAgentAttributes } from '../../common/types';
13
13
  export type EditingEventPayload = {
14
14
  actionSubject: 'rovoAgent';
15
15
  action: 'updated';
16
- attributes: BaseAgentAnalyticsAttributes & {
16
+ attributes: VersionedAgentAttributes & {
17
17
  agentType: string;
18
18
  field: string;
19
19
  };
@@ -9,6 +9,26 @@ export type BaseAgentAnalyticsAttributes = {
9
9
  touchPoint?: string;
10
10
  agentId?: string;
11
11
  };
12
+ /**
13
+ * Common attributes for events scoped to a single versioned agent.
14
+ *
15
+ * Extends `BaseAgentAnalyticsAttributes` with versioning state so DS can
16
+ * distinguish first-publish vs republish, edits-on-draft vs edits-after-publish,
17
+ * etc. without needing a separate event per state.
18
+ *
19
+ * - `agentIsPublished` — sourced from the BE `AgentStudioAssistant.isPublished`
20
+ * field. Whether the agent has at least one published version.
21
+ * - `agentVersionNumber` — the version number the event relates to (e.g. the
22
+ * version being edited or published). Sourced from the BE
23
+ * `AgentStudioAssistant.version.versionNumber` field.
24
+ *
25
+ * Apply to every event scoped to a single agent (CRUD, publish, AND usage events).
26
+ * Pre-mutation create-flow events stay attribute-free — no `agentId` exists yet.
27
+ */
28
+ export type VersionedAgentAttributes = BaseAgentAnalyticsAttributes & {
29
+ agentIsPublished?: boolean | null;
30
+ agentVersionNumber?: number | null;
31
+ };
12
32
  /** Common library attribute injected into all events */
13
33
  export declare const LIBRARY_ATTRIBUTE: "agents-analytics";
14
34
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-analytics",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Rovo Agents analytics",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
6
6
  "atlassian": {