@od-oneapp/analytics 2026.1.1301
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/README.md +509 -0
- package/dist/ai-YMnynb-t.mjs +3347 -0
- package/dist/ai-YMnynb-t.mjs.map +1 -0
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/client-CTzJVFU5.mjs +9 -0
- package/dist/client-CTzJVFU5.mjs.map +1 -0
- package/dist/client-CcFTauAh.mjs +54 -0
- package/dist/client-CcFTauAh.mjs.map +1 -0
- package/dist/client-CeOLjbac.mjs +281 -0
- package/dist/client-CeOLjbac.mjs.map +1 -0
- package/dist/client-D339NFJS.mjs +267 -0
- package/dist/client-D339NFJS.mjs.map +1 -0
- package/dist/client-next.d.mts +62 -0
- package/dist/client-next.d.mts.map +1 -0
- package/dist/client-next.mjs +525 -0
- package/dist/client-next.mjs.map +1 -0
- package/dist/client.d.mts +30 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +186 -0
- package/dist/client.mjs.map +1 -0
- package/dist/config-DPS6bSYo.d.mts +34 -0
- package/dist/config-DPS6bSYo.d.mts.map +1 -0
- package/dist/config-P6P5adJg.mjs +287 -0
- package/dist/config-P6P5adJg.mjs.map +1 -0
- package/dist/console-8bND3mMU.mjs +128 -0
- package/dist/console-8bND3mMU.mjs.map +1 -0
- package/dist/ecommerce-Cgu4wlux.mjs +993 -0
- package/dist/ecommerce-Cgu4wlux.mjs.map +1 -0
- package/dist/emitters-6-nKo8i-.mjs +208 -0
- package/dist/emitters-6-nKo8i-.mjs.map +1 -0
- package/dist/emitters-DldkVSPp.d.mts +12 -0
- package/dist/emitters-DldkVSPp.d.mts.map +1 -0
- package/dist/index-BfNWgfa5.d.mts +1494 -0
- package/dist/index-BfNWgfa5.d.mts.map +1 -0
- package/dist/index-BkIWe--N.d.mts +953 -0
- package/dist/index-BkIWe--N.d.mts.map +1 -0
- package/dist/index-jPzXRn52.d.mts +184 -0
- package/dist/index-jPzXRn52.d.mts.map +1 -0
- package/dist/manager-DvRRjza6.d.mts +76 -0
- package/dist/manager-DvRRjza6.d.mts.map +1 -0
- package/dist/posthog-bootstrap-CYfIy_WS.mjs +1769 -0
- package/dist/posthog-bootstrap-CYfIy_WS.mjs.map +1 -0
- package/dist/posthog-bootstrap-DWxFrxlt.d.mts +81 -0
- package/dist/posthog-bootstrap-DWxFrxlt.d.mts.map +1 -0
- package/dist/providers-http-client.d.mts +37 -0
- package/dist/providers-http-client.d.mts.map +1 -0
- package/dist/providers-http-client.mjs +320 -0
- package/dist/providers-http-client.mjs.map +1 -0
- package/dist/providers-http-server.d.mts +31 -0
- package/dist/providers-http-server.d.mts.map +1 -0
- package/dist/providers-http-server.mjs +297 -0
- package/dist/providers-http-server.mjs.map +1 -0
- package/dist/providers-http.d.mts +46 -0
- package/dist/providers-http.d.mts.map +1 -0
- package/dist/providers-http.mjs +4 -0
- package/dist/server-edge.d.mts +9 -0
- package/dist/server-edge.d.mts.map +1 -0
- package/dist/server-edge.mjs +373 -0
- package/dist/server-edge.mjs.map +1 -0
- package/dist/server-next.d.mts +67 -0
- package/dist/server-next.d.mts.map +1 -0
- package/dist/server-next.mjs +193 -0
- package/dist/server-next.mjs.map +1 -0
- package/dist/server.d.mts +10 -0
- package/dist/server.mjs +7 -0
- package/dist/service-cYtBBL8x.mjs +945 -0
- package/dist/service-cYtBBL8x.mjs.map +1 -0
- package/dist/shared.d.mts +16 -0
- package/dist/shared.d.mts.map +1 -0
- package/dist/shared.mjs +93 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/types-BxBnNQ0V.d.mts +354 -0
- package/dist/types-BxBnNQ0V.d.mts.map +1 -0
- package/dist/types-CBvxUEaF.d.mts +216 -0
- package/dist/types-CBvxUEaF.d.mts.map +1 -0
- package/dist/types.d.mts +4 -0
- package/dist/types.mjs +0 -0
- package/dist/vercel-types-lwakUfoI.d.mts +102 -0
- package/dist/vercel-types-lwakUfoI.d.mts.map +1 -0
- package/package.json +129 -0
- package/src/client/index.ts +164 -0
- package/src/client/manager.ts +71 -0
- package/src/client/next/components.tsx +270 -0
- package/src/client/next/hooks.ts +217 -0
- package/src/client/next/manager.ts +141 -0
- package/src/client/next.ts +144 -0
- package/src/client-next.ts +101 -0
- package/src/client.ts +89 -0
- package/src/examples/ai-sdk-patterns.ts +583 -0
- package/src/examples/emitter-patterns.ts +476 -0
- package/src/examples/nextjs-emitter-patterns.tsx +403 -0
- package/src/next/app-router.tsx +564 -0
- package/src/next/client.ts +419 -0
- package/src/next/index.ts +84 -0
- package/src/next/middleware.ts +429 -0
- package/src/next/rsc.tsx +300 -0
- package/src/next/server.ts +253 -0
- package/src/next/types.d.ts +220 -0
- package/src/providers/base-provider.ts +419 -0
- package/src/providers/console/client.ts +10 -0
- package/src/providers/console/index.ts +152 -0
- package/src/providers/console/server.ts +6 -0
- package/src/providers/console/types.ts +15 -0
- package/src/providers/http/client.ts +464 -0
- package/src/providers/http/index.ts +30 -0
- package/src/providers/http/server.ts +396 -0
- package/src/providers/http/types.ts +135 -0
- package/src/providers/posthog/client.ts +518 -0
- package/src/providers/posthog/index.ts +11 -0
- package/src/providers/posthog/server.ts +329 -0
- package/src/providers/posthog/types.ts +104 -0
- package/src/providers/segment/client.ts +113 -0
- package/src/providers/segment/index.ts +11 -0
- package/src/providers/segment/server.ts +115 -0
- package/src/providers/segment/types.ts +51 -0
- package/src/providers/vercel/client.ts +102 -0
- package/src/providers/vercel/index.ts +11 -0
- package/src/providers/vercel/server.ts +89 -0
- package/src/providers/vercel/types.ts +27 -0
- package/src/server/index.ts +103 -0
- package/src/server/manager.ts +62 -0
- package/src/server/next.ts +210 -0
- package/src/server-edge.ts +442 -0
- package/src/server-next.ts +39 -0
- package/src/server.ts +106 -0
- package/src/shared/emitters/ai/README.md +981 -0
- package/src/shared/emitters/ai/events/agent.ts +130 -0
- package/src/shared/emitters/ai/events/artifacts.ts +167 -0
- package/src/shared/emitters/ai/events/chat.ts +126 -0
- package/src/shared/emitters/ai/events/chatbot-ecommerce.ts +133 -0
- package/src/shared/emitters/ai/events/completion.ts +103 -0
- package/src/shared/emitters/ai/events/content-generation.ts +347 -0
- package/src/shared/emitters/ai/events/conversation.ts +332 -0
- package/src/shared/emitters/ai/events/product-features.ts +1402 -0
- package/src/shared/emitters/ai/events/streaming.ts +114 -0
- package/src/shared/emitters/ai/events/tool.ts +93 -0
- package/src/shared/emitters/ai/index.ts +69 -0
- package/src/shared/emitters/ai/track-ai-sdk.ts +74 -0
- package/src/shared/emitters/ai/track-ai.ts +50 -0
- package/src/shared/emitters/ai/types.ts +1041 -0
- package/src/shared/emitters/ai/utils.ts +468 -0
- package/src/shared/emitters/ecommerce/events/cart-checkout.ts +106 -0
- package/src/shared/emitters/ecommerce/events/coupon.ts +49 -0
- package/src/shared/emitters/ecommerce/events/engagement.ts +61 -0
- package/src/shared/emitters/ecommerce/events/marketplace.ts +119 -0
- package/src/shared/emitters/ecommerce/events/order.ts +199 -0
- package/src/shared/emitters/ecommerce/events/product.ts +205 -0
- package/src/shared/emitters/ecommerce/events/registry.ts +123 -0
- package/src/shared/emitters/ecommerce/events/wishlist-sharing.ts +140 -0
- package/src/shared/emitters/ecommerce/index.ts +46 -0
- package/src/shared/emitters/ecommerce/track-ecommerce.ts +53 -0
- package/src/shared/emitters/ecommerce/types.ts +314 -0
- package/src/shared/emitters/ecommerce/utils.ts +216 -0
- package/src/shared/emitters/emitter-types.ts +974 -0
- package/src/shared/emitters/emitters.ts +292 -0
- package/src/shared/emitters/helpers.ts +419 -0
- package/src/shared/emitters/index.ts +66 -0
- package/src/shared/index.ts +142 -0
- package/src/shared/ingestion/index.ts +66 -0
- package/src/shared/ingestion/schemas.ts +386 -0
- package/src/shared/ingestion/service.ts +628 -0
- package/src/shared/node22-features.ts +848 -0
- package/src/shared/providers/console-provider.ts +160 -0
- package/src/shared/types/base-types.ts +54 -0
- package/src/shared/types/console-types.ts +19 -0
- package/src/shared/types/posthog-types.ts +131 -0
- package/src/shared/types/segment-types.ts +15 -0
- package/src/shared/types/types.ts +397 -0
- package/src/shared/types/vercel-types.ts +19 -0
- package/src/shared/utils/config-client.ts +19 -0
- package/src/shared/utils/config.ts +250 -0
- package/src/shared/utils/emitter-adapter.ts +212 -0
- package/src/shared/utils/manager.test.ts +36 -0
- package/src/shared/utils/manager.ts +1322 -0
- package/src/shared/utils/posthog-bootstrap.ts +136 -0
- package/src/shared/utils/posthog-client-utils.ts +48 -0
- package/src/shared/utils/posthog-next-utils.ts +282 -0
- package/src/shared/utils/posthog-server-utils.ts +210 -0
- package/src/shared/utils/rate-limit.ts +289 -0
- package/src/shared/utils/security.ts +545 -0
- package/src/shared/utils/validation-client.ts +161 -0
- package/src/shared/utils/validation.ts +399 -0
- package/src/shared.ts +155 -0
- package/src/types/index.ts +62 -0
|
@@ -0,0 +1,1402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Additional AI Product Features
|
|
3
|
+
* Additional AI Product Features
|
|
4
|
+
*
|
|
5
|
+
* Comprehensive tracking for all remaining AI product features:
|
|
6
|
+
* - User interactions (copy, execute, download)
|
|
7
|
+
* - Files & attachments
|
|
8
|
+
* - Context & memory management
|
|
9
|
+
* - Collaboration & sharing
|
|
10
|
+
* - Workspace & organization
|
|
11
|
+
* - Feedback & quality
|
|
12
|
+
* - System & performance
|
|
13
|
+
* - Tools & functions
|
|
14
|
+
* - Search & citations
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createAITracker } from '../track-ai';
|
|
18
|
+
import {
|
|
19
|
+
AI_EVENTS,
|
|
20
|
+
type BaseAIProperties,
|
|
21
|
+
type CodeGenerationProperties,
|
|
22
|
+
type CollaborationProperties,
|
|
23
|
+
type ContextProperties,
|
|
24
|
+
type FeedbackProperties,
|
|
25
|
+
type FileProperties,
|
|
26
|
+
type MemoryProperties,
|
|
27
|
+
type PerformanceProperties,
|
|
28
|
+
type SearchProperties,
|
|
29
|
+
type SystemProperties,
|
|
30
|
+
type ToolProperties,
|
|
31
|
+
type UserInteractionProperties,
|
|
32
|
+
type WorkspaceProperties,
|
|
33
|
+
} from '../types';
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// USER INTERACTIONS - User actions on generated content
|
|
37
|
+
// ============================================================================
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Track code copy action
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* ai.CODE_COPIED({
|
|
45
|
+
* conversation_id: 'conv_123',
|
|
46
|
+
* model_id: 'gpt-4',
|
|
47
|
+
* code_id: 'code_789',
|
|
48
|
+
* language: 'typescript',
|
|
49
|
+
* code_length: 450,
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export const CODE_COPIED = createAITracker<CodeGenerationProperties>(properties => ({
|
|
54
|
+
name: AI_EVENTS.CODE_COPIED,
|
|
55
|
+
category: 'user-interactions',
|
|
56
|
+
properties,
|
|
57
|
+
requiredProperties: ['task_type'],
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Track code execution
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* ai.CODE_EXECUTED({
|
|
66
|
+
* conversation_id: 'conv_123',
|
|
67
|
+
* model_id: 'gpt-4',
|
|
68
|
+
* code_id: 'code_789',
|
|
69
|
+
* language: 'typescript',
|
|
70
|
+
* execution_status: 'success',
|
|
71
|
+
* execution_time_ms: 120,
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export const CODE_EXECUTED = createAITracker<CodeGenerationProperties>(properties => ({
|
|
76
|
+
name: AI_EVENTS.CODE_EXECUTED,
|
|
77
|
+
category: 'user-interactions',
|
|
78
|
+
properties,
|
|
79
|
+
requiredProperties: ['task_type'],
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Track general content copy
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* ai.CONTENT_COPIED({
|
|
88
|
+
* conversation_id: 'conv_123',
|
|
89
|
+
* model_id: 'claude-3-5-sonnet',
|
|
90
|
+
* content_id: 'content_456',
|
|
91
|
+
* content_type: 'text',
|
|
92
|
+
* content_length: 350,
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export const CONTENT_COPIED = createAITracker<UserInteractionProperties>(properties => ({
|
|
97
|
+
name: AI_EVENTS.CONTENT_COPIED,
|
|
98
|
+
category: 'user-interactions',
|
|
99
|
+
properties,
|
|
100
|
+
requiredProperties: [],
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Track content download
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* ai.CONTENT_DOWNLOADED({
|
|
109
|
+
* conversation_id: 'conv_123',
|
|
110
|
+
* model_id: 'gpt-4',
|
|
111
|
+
* content_id: 'content_456',
|
|
112
|
+
* content_type: 'document',
|
|
113
|
+
* file_format: 'pdf',
|
|
114
|
+
* file_size_bytes: 1024000,
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export const CONTENT_DOWNLOADED = createAITracker<UserInteractionProperties>(properties => ({
|
|
119
|
+
name: AI_EVENTS.CONTENT_DOWNLOADED,
|
|
120
|
+
category: 'user-interactions',
|
|
121
|
+
properties,
|
|
122
|
+
requiredProperties: [],
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Track content sharing
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* ai.CONTENT_SHARED({
|
|
131
|
+
* conversation_id: 'conv_123',
|
|
132
|
+
* model_id: 'claude-3-5-sonnet',
|
|
133
|
+
* content_id: 'content_456',
|
|
134
|
+
* content_type: 'code',
|
|
135
|
+
* share_platform: 'twitter',
|
|
136
|
+
* });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export const CONTENT_SHARED = createAITracker<UserInteractionProperties>(properties => ({
|
|
140
|
+
name: AI_EVENTS.CONTENT_SHARED,
|
|
141
|
+
category: 'user-interactions',
|
|
142
|
+
properties,
|
|
143
|
+
requiredProperties: [],
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Track AI suggestion acceptance
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* ai.SUGGESTION_ACCEPTED({
|
|
152
|
+
* conversation_id: 'conv_123',
|
|
153
|
+
* model_id: 'gpt-4',
|
|
154
|
+
* suggestion_type: 'code-completion',
|
|
155
|
+
* suggestion_id: 'sug_123',
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export const SUGGESTION_ACCEPTED = createAITracker<UserInteractionProperties>(properties => ({
|
|
160
|
+
name: AI_EVENTS.SUGGESTION_ACCEPTED,
|
|
161
|
+
category: 'user-interactions',
|
|
162
|
+
properties,
|
|
163
|
+
requiredProperties: [],
|
|
164
|
+
}));
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Track AI suggestion rejection
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* ai.SUGGESTION_REJECTED({
|
|
172
|
+
* conversation_id: 'conv_123',
|
|
173
|
+
* model_id: 'claude-3-5-sonnet',
|
|
174
|
+
* suggestion_type: 'text-completion',
|
|
175
|
+
* suggestion_id: 'sug_124',
|
|
176
|
+
* rejection_reason: 'not-relevant',
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export const SUGGESTION_REJECTED = createAITracker<UserInteractionProperties>(properties => ({
|
|
181
|
+
name: AI_EVENTS.SUGGESTION_REJECTED,
|
|
182
|
+
category: 'user-interactions',
|
|
183
|
+
properties,
|
|
184
|
+
requiredProperties: [],
|
|
185
|
+
}));
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Track inline edit applied to AI content
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* ai.INLINE_EDIT_APPLIED({
|
|
193
|
+
* conversation_id: 'conv_123',
|
|
194
|
+
* model_id: 'gpt-4',
|
|
195
|
+
* content_id: 'content_456',
|
|
196
|
+
* edit_type: 'user-refinement',
|
|
197
|
+
* characters_changed: 25,
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
export const INLINE_EDIT_APPLIED = createAITracker<UserInteractionProperties>(properties => ({
|
|
202
|
+
name: AI_EVENTS.INLINE_EDIT_APPLIED,
|
|
203
|
+
category: 'user-interactions',
|
|
204
|
+
properties,
|
|
205
|
+
requiredProperties: [],
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Track diff/changes viewed
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* ai.DIFF_VIEWED({
|
|
214
|
+
* conversation_id: 'conv_123',
|
|
215
|
+
* model_id: 'claude-3-5-sonnet',
|
|
216
|
+
* content_id: 'content_456',
|
|
217
|
+
* diff_type: 'side-by-side',
|
|
218
|
+
* lines_added: 15,
|
|
219
|
+
* lines_removed: 8,
|
|
220
|
+
* });
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export const DIFF_VIEWED = createAITracker<UserInteractionProperties>(properties => ({
|
|
224
|
+
name: AI_EVENTS.DIFF_VIEWED,
|
|
225
|
+
category: 'user-interactions',
|
|
226
|
+
properties,
|
|
227
|
+
requiredProperties: [],
|
|
228
|
+
}));
|
|
229
|
+
|
|
230
|
+
// ============================================================================
|
|
231
|
+
// FILES & ATTACHMENTS - File upload, processing, and usage
|
|
232
|
+
// ============================================================================
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Track file upload
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* ai.FILE_UPLOADED({
|
|
240
|
+
* conversation_id: 'conv_123',
|
|
241
|
+
* model_id: 'gpt-4',
|
|
242
|
+
* file_type: 'pdf',
|
|
243
|
+
* file_size_bytes: 1024000,
|
|
244
|
+
* file_count: 1,
|
|
245
|
+
* });
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export const FILE_UPLOADED = createAITracker<FileProperties>(properties => ({
|
|
249
|
+
name: AI_EVENTS.FILE_UPLOADED,
|
|
250
|
+
category: 'files',
|
|
251
|
+
properties,
|
|
252
|
+
requiredProperties: [],
|
|
253
|
+
}));
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Track file processing completion
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* ai.FILE_PROCESSED({
|
|
261
|
+
* conversation_id: 'conv_123',
|
|
262
|
+
* model_id: 'gpt-4',
|
|
263
|
+
* file_id: 'file_123',
|
|
264
|
+
* file_type: 'pdf',
|
|
265
|
+
* processing_time_ms: 2500,
|
|
266
|
+
* extracted_text_length: 5000,
|
|
267
|
+
* processing_status: 'success',
|
|
268
|
+
* });
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
export const FILE_PROCESSED = createAITracker<FileProperties>(properties => ({
|
|
272
|
+
name: AI_EVENTS.FILE_PROCESSED,
|
|
273
|
+
category: 'files',
|
|
274
|
+
properties,
|
|
275
|
+
requiredProperties: [],
|
|
276
|
+
}));
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Track file processing failure
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* ai.FILE_PROCESSING_FAILED({
|
|
284
|
+
* conversation_id: 'conv_123',
|
|
285
|
+
* model_id: 'claude-3-5-sonnet',
|
|
286
|
+
* file_id: 'file_124',
|
|
287
|
+
* file_type: 'docx',
|
|
288
|
+
* processing_status: 'failed',
|
|
289
|
+
* error_reason: 'unsupported-format',
|
|
290
|
+
* });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
export const FILE_PROCESSING_FAILED = createAITracker<FileProperties>(properties => ({
|
|
294
|
+
name: AI_EVENTS.FILE_PROCESSING_FAILED,
|
|
295
|
+
category: 'files',
|
|
296
|
+
properties,
|
|
297
|
+
requiredProperties: [],
|
|
298
|
+
}));
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Track file download
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* ai.FILE_DOWNLOADED({
|
|
306
|
+
* conversation_id: 'conv_123',
|
|
307
|
+
* model_id: 'gpt-4',
|
|
308
|
+
* file_id: 'file_125',
|
|
309
|
+
* file_type: 'csv',
|
|
310
|
+
* file_size_bytes: 512000,
|
|
311
|
+
* });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export const FILE_DOWNLOADED = createAITracker<FileProperties>(properties => ({
|
|
315
|
+
name: AI_EVENTS.FILE_DOWNLOADED,
|
|
316
|
+
category: 'files',
|
|
317
|
+
properties,
|
|
318
|
+
requiredProperties: [],
|
|
319
|
+
}));
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Track file reference in conversation
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* ai.FILE_REFERENCED({
|
|
327
|
+
* conversation_id: 'conv_123',
|
|
328
|
+
* model_id: 'claude-3-5-sonnet',
|
|
329
|
+
* file_id: 'file_123',
|
|
330
|
+
* file_type: 'pdf',
|
|
331
|
+
* reference_context: 'answer-question',
|
|
332
|
+
* });
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
export const FILE_REFERENCED = createAITracker<FileProperties>(properties => ({
|
|
336
|
+
name: AI_EVENTS.FILE_REFERENCED,
|
|
337
|
+
category: 'files',
|
|
338
|
+
properties,
|
|
339
|
+
requiredProperties: [],
|
|
340
|
+
}));
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Track file deletion
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```typescript
|
|
347
|
+
* ai.FILE_DELETED({
|
|
348
|
+
* conversation_id: 'conv_123',
|
|
349
|
+
* model_id: 'gpt-4',
|
|
350
|
+
* file_id: 'file_126',
|
|
351
|
+
* file_type: 'image',
|
|
352
|
+
* deleted_by: 'user',
|
|
353
|
+
* });
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export const FILE_DELETED = createAITracker<FileProperties>(properties => ({
|
|
357
|
+
name: AI_EVENTS.FILE_DELETED,
|
|
358
|
+
category: 'files',
|
|
359
|
+
properties,
|
|
360
|
+
requiredProperties: [],
|
|
361
|
+
}));
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Track batch file processing
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* ```typescript
|
|
368
|
+
* ai.BATCH_FILES_PROCESSED({
|
|
369
|
+
* conversation_id: 'conv_123',
|
|
370
|
+
* model_id: 'claude-3-5-sonnet',
|
|
371
|
+
* file_count: 5,
|
|
372
|
+
* total_size_bytes: 5120000,
|
|
373
|
+
* processing_time_ms: 8500,
|
|
374
|
+
* processing_status: 'success',
|
|
375
|
+
* });
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
export const BATCH_FILES_PROCESSED = createAITracker<FileProperties>(properties => ({
|
|
379
|
+
name: AI_EVENTS.BATCH_FILES_PROCESSED,
|
|
380
|
+
category: 'files',
|
|
381
|
+
properties,
|
|
382
|
+
requiredProperties: [],
|
|
383
|
+
}));
|
|
384
|
+
|
|
385
|
+
// ============================================================================
|
|
386
|
+
// CONTEXT & MEMORY - Context management and long-term memory
|
|
387
|
+
// ============================================================================
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Track context window update
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```typescript
|
|
394
|
+
* ai.CONTEXT_WINDOW_UPDATED({
|
|
395
|
+
* conversation_id: 'conv_123',
|
|
396
|
+
* model_id: 'gpt-4',
|
|
397
|
+
* context_size_tokens: 8000,
|
|
398
|
+
* context_type: 'conversation',
|
|
399
|
+
* });
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
export const CONTEXT_WINDOW_UPDATED = createAITracker<ContextProperties>(properties => ({
|
|
403
|
+
name: AI_EVENTS.CONTEXT_WINDOW_UPDATED,
|
|
404
|
+
category: 'context',
|
|
405
|
+
properties,
|
|
406
|
+
requiredProperties: ['context_type'],
|
|
407
|
+
}));
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Track memory creation
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* ai.MEMORY_CREATED({
|
|
415
|
+
* conversation_id: 'conv_123',
|
|
416
|
+
* model_id: 'claude-3-5-sonnet',
|
|
417
|
+
* memory_id: 'mem_123',
|
|
418
|
+
* memory_type: 'user-preference',
|
|
419
|
+
* memory_content_length: 50,
|
|
420
|
+
* memory_source: 'explicit',
|
|
421
|
+
* });
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
export const MEMORY_CREATED = createAITracker<MemoryProperties>(properties => ({
|
|
425
|
+
name: AI_EVENTS.MEMORY_CREATED,
|
|
426
|
+
category: 'context',
|
|
427
|
+
properties,
|
|
428
|
+
requiredProperties: ['memory_type'],
|
|
429
|
+
}));
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Track memory retrieval
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* ai.MEMORY_RETRIEVED({
|
|
437
|
+
* conversation_id: 'conv_123',
|
|
438
|
+
* model_id: 'gpt-4',
|
|
439
|
+
* memory_id: 'mem_123',
|
|
440
|
+
* memory_type: 'user-preference',
|
|
441
|
+
* retrieval_relevance_score: 0.95,
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
export const MEMORY_RETRIEVED = createAITracker<MemoryProperties>(properties => ({
|
|
446
|
+
name: AI_EVENTS.MEMORY_RETRIEVED,
|
|
447
|
+
category: 'context',
|
|
448
|
+
properties,
|
|
449
|
+
requiredProperties: ['memory_type'],
|
|
450
|
+
}));
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Track memory update
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* ai.MEMORY_UPDATED({
|
|
458
|
+
* conversation_id: 'conv_123',
|
|
459
|
+
* model_id: 'claude-3-5-sonnet',
|
|
460
|
+
* memory_id: 'mem_123',
|
|
461
|
+
* memory_type: 'fact',
|
|
462
|
+
* update_reason: 'correction',
|
|
463
|
+
* });
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
export const MEMORY_UPDATED = createAITracker<MemoryProperties>(properties => ({
|
|
467
|
+
name: AI_EVENTS.MEMORY_UPDATED,
|
|
468
|
+
category: 'context',
|
|
469
|
+
properties,
|
|
470
|
+
requiredProperties: ['memory_type'],
|
|
471
|
+
}));
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Track memory deletion
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* ai.MEMORY_DELETED({
|
|
479
|
+
* conversation_id: 'conv_123',
|
|
480
|
+
* model_id: 'gpt-4',
|
|
481
|
+
* memory_id: 'mem_124',
|
|
482
|
+
* memory_type: 'user-preference',
|
|
483
|
+
* deleted_by: 'user',
|
|
484
|
+
* });
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
export const MEMORY_DELETED = createAITracker<MemoryProperties>(properties => ({
|
|
488
|
+
name: AI_EVENTS.MEMORY_DELETED,
|
|
489
|
+
category: 'context',
|
|
490
|
+
properties,
|
|
491
|
+
requiredProperties: ['memory_type'],
|
|
492
|
+
}));
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Track custom instructions update
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```typescript
|
|
499
|
+
* ai.CUSTOM_INSTRUCTIONS_UPDATED({
|
|
500
|
+
* model_id: 'gpt-4',
|
|
501
|
+
* user_id: 'user_123',
|
|
502
|
+
* instructions_length: 200,
|
|
503
|
+
* has_preferences: true,
|
|
504
|
+
* has_constraints: true,
|
|
505
|
+
* });
|
|
506
|
+
* ```
|
|
507
|
+
*/
|
|
508
|
+
export const CUSTOM_INSTRUCTIONS_UPDATED = createAITracker<ContextProperties>(properties => ({
|
|
509
|
+
name: AI_EVENTS.CUSTOM_INSTRUCTIONS_UPDATED,
|
|
510
|
+
category: 'context',
|
|
511
|
+
properties,
|
|
512
|
+
requiredProperties: ['context_type'],
|
|
513
|
+
}));
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Track project context loading
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```typescript
|
|
520
|
+
* ai.PROJECT_CONTEXT_LOADED({
|
|
521
|
+
* conversation_id: 'conv_123',
|
|
522
|
+
* model_id: 'claude-3-5-sonnet',
|
|
523
|
+
* context_type: 'project',
|
|
524
|
+
* context_size_tokens: 5000,
|
|
525
|
+
* project_id: 'proj_456',
|
|
526
|
+
* });
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
export const PROJECT_CONTEXT_LOADED = createAITracker<ContextProperties>(properties => ({
|
|
530
|
+
name: AI_EVENTS.PROJECT_CONTEXT_LOADED,
|
|
531
|
+
category: 'context',
|
|
532
|
+
properties,
|
|
533
|
+
requiredProperties: ['context_type'],
|
|
534
|
+
}));
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Track RAG query execution
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```typescript
|
|
541
|
+
* ai.RAG_QUERY_EXECUTED({
|
|
542
|
+
* conversation_id: 'conv_123',
|
|
543
|
+
* model_id: 'gpt-4',
|
|
544
|
+
* query_text: 'Find documentation about React hooks',
|
|
545
|
+
* query_embedding_dimensions: 1536,
|
|
546
|
+
* chunks_retrieved: 5,
|
|
547
|
+
* retrieval_time_ms: 150,
|
|
548
|
+
* retrieval_status: 'success',
|
|
549
|
+
* });
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
export const RAG_QUERY_EXECUTED = createAITracker<ContextProperties>(properties => ({
|
|
553
|
+
name: AI_EVENTS.RAG_QUERY_EXECUTED,
|
|
554
|
+
category: 'context',
|
|
555
|
+
properties,
|
|
556
|
+
requiredProperties: ['context_type'],
|
|
557
|
+
}));
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Track embedding generation
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* ai.EMBEDDING_GENERATED({
|
|
565
|
+
* model_id: 'text-embedding-ada-002',
|
|
566
|
+
* text_length: 500,
|
|
567
|
+
* embedding_dimensions: 1536,
|
|
568
|
+
* generation_time_ms: 80,
|
|
569
|
+
* });
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
export const EMBEDDING_GENERATED = createAITracker<ContextProperties>(properties => ({
|
|
573
|
+
name: AI_EVENTS.EMBEDDING_GENERATED,
|
|
574
|
+
category: 'context',
|
|
575
|
+
properties,
|
|
576
|
+
requiredProperties: ['context_type'],
|
|
577
|
+
}));
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Track knowledge base query
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```typescript
|
|
584
|
+
* ai.KNOWLEDGE_BASE_QUERIED({
|
|
585
|
+
* conversation_id: 'conv_123',
|
|
586
|
+
* model_id: 'claude-3-5-sonnet',
|
|
587
|
+
* query_text: 'What is our refund policy?',
|
|
588
|
+
* results_found: 3,
|
|
589
|
+
* query_time_ms: 120,
|
|
590
|
+
* });
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
export const KNOWLEDGE_BASE_QUERIED = createAITracker<ContextProperties>(properties => ({
|
|
594
|
+
name: AI_EVENTS.KNOWLEDGE_BASE_QUERIED,
|
|
595
|
+
category: 'context',
|
|
596
|
+
properties,
|
|
597
|
+
requiredProperties: ['context_type'],
|
|
598
|
+
}));
|
|
599
|
+
|
|
600
|
+
// ============================================================================
|
|
601
|
+
// COLLABORATION & SHARING - Team features and sharing
|
|
602
|
+
// ============================================================================
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Track conversation sharing
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* ai.CONVERSATION_SHARED({
|
|
610
|
+
* conversation_id: 'conv_123',
|
|
611
|
+
* model_id: 'claude-3-5-sonnet',
|
|
612
|
+
* share_type: 'public-link',
|
|
613
|
+
* share_permissions: 'view-only',
|
|
614
|
+
* message_count: 15,
|
|
615
|
+
* });
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
export const CONVERSATION_SHARED = createAITracker<CollaborationProperties>(properties => ({
|
|
619
|
+
name: AI_EVENTS.CONVERSATION_SHARED,
|
|
620
|
+
category: 'collaboration',
|
|
621
|
+
properties,
|
|
622
|
+
requiredProperties: [],
|
|
623
|
+
}));
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Track conversation forking
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```typescript
|
|
630
|
+
* ai.CONVERSATION_FORKED({
|
|
631
|
+
* conversation_id: 'conv_123',
|
|
632
|
+
* model_id: 'gpt-4',
|
|
633
|
+
* original_conversation_id: 'conv_123',
|
|
634
|
+
* new_conversation_id: 'conv_125',
|
|
635
|
+
* forked_from_message_id: 'msg_460',
|
|
636
|
+
* });
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
export const CONVERSATION_FORKED = createAITracker<CollaborationProperties>(properties => ({
|
|
640
|
+
name: AI_EVENTS.CONVERSATION_FORKED,
|
|
641
|
+
category: 'collaboration',
|
|
642
|
+
properties,
|
|
643
|
+
requiredProperties: [],
|
|
644
|
+
}));
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Track workspace creation
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* ai.WORKSPACE_CREATED({
|
|
652
|
+
* workspace_id: 'ws_001',
|
|
653
|
+
* model_id: 'claude-3-5-sonnet',
|
|
654
|
+
* workspace_type: 'team',
|
|
655
|
+
* member_count: 5,
|
|
656
|
+
* });
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
export const WORKSPACE_CREATED = createAITracker<WorkspaceProperties>(properties => ({
|
|
660
|
+
name: AI_EVENTS.WORKSPACE_CREATED,
|
|
661
|
+
category: 'collaboration',
|
|
662
|
+
properties,
|
|
663
|
+
requiredProperties: ['action'],
|
|
664
|
+
}));
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Track member invitation
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```typescript
|
|
671
|
+
* ai.MEMBER_INVITED({
|
|
672
|
+
* workspace_id: 'ws_001',
|
|
673
|
+
* model_id: 'gpt-4',
|
|
674
|
+
* invitee_role: 'member',
|
|
675
|
+
* invitation_method: 'email',
|
|
676
|
+
* });
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
export const MEMBER_INVITED = createAITracker<CollaborationProperties>(properties => ({
|
|
680
|
+
name: AI_EVENTS.MEMBER_INVITED,
|
|
681
|
+
category: 'collaboration',
|
|
682
|
+
properties,
|
|
683
|
+
requiredProperties: [],
|
|
684
|
+
}));
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Track collaboration comment
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```typescript
|
|
691
|
+
* ai.COMMENT_ADDED({
|
|
692
|
+
* conversation_id: 'conv_123',
|
|
693
|
+
* model_id: 'claude-3-5-sonnet',
|
|
694
|
+
* comment_target: 'message',
|
|
695
|
+
* comment_length: 150,
|
|
696
|
+
* });
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
export const COMMENT_ADDED = createAITracker<CollaborationProperties>(properties => ({
|
|
700
|
+
name: AI_EVENTS.COMMENT_ADDED,
|
|
701
|
+
category: 'collaboration',
|
|
702
|
+
properties,
|
|
703
|
+
requiredProperties: [],
|
|
704
|
+
}));
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Track permission change
|
|
708
|
+
*
|
|
709
|
+
* @example
|
|
710
|
+
* ```typescript
|
|
711
|
+
* ai.PERMISSION_CHANGED({
|
|
712
|
+
* workspace_id: 'ws_001',
|
|
713
|
+
* model_id: 'gpt-4',
|
|
714
|
+
* target_user_id: 'user_456',
|
|
715
|
+
* old_permission: 'viewer',
|
|
716
|
+
* new_permission: 'editor',
|
|
717
|
+
* });
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
export const PERMISSION_CHANGED = createAITracker<CollaborationProperties>(properties => ({
|
|
721
|
+
name: AI_EVENTS.PERMISSION_CHANGED,
|
|
722
|
+
category: 'collaboration',
|
|
723
|
+
properties,
|
|
724
|
+
requiredProperties: [],
|
|
725
|
+
}));
|
|
726
|
+
|
|
727
|
+
// ============================================================================
|
|
728
|
+
// WORKSPACE & ORGANIZATION - Organization and workspace management
|
|
729
|
+
// ============================================================================
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Track conversation rename
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```typescript
|
|
736
|
+
* ai.CONVERSATION_RENAMED({
|
|
737
|
+
* conversation_id: 'conv_123',
|
|
738
|
+
* model_id: 'claude-3-5-sonnet',
|
|
739
|
+
* old_title: 'Chat',
|
|
740
|
+
* new_title: 'React Project Discussion',
|
|
741
|
+
* });
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
export const CONVERSATION_RENAMED = createAITracker<WorkspaceProperties>(properties => ({
|
|
745
|
+
name: AI_EVENTS.CONVERSATION_RENAMED,
|
|
746
|
+
category: 'workspace',
|
|
747
|
+
properties,
|
|
748
|
+
requiredProperties: ['action'],
|
|
749
|
+
}));
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Track conversation archival
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* ```typescript
|
|
756
|
+
* ai.CONVERSATION_ARCHIVED({
|
|
757
|
+
* conversation_id: 'conv_123',
|
|
758
|
+
* model_id: 'gpt-4',
|
|
759
|
+
* archive_reason: 'completed',
|
|
760
|
+
* });
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
763
|
+
export const CONVERSATION_ARCHIVED = createAITracker<WorkspaceProperties>(properties => ({
|
|
764
|
+
name: AI_EVENTS.CONVERSATION_ARCHIVED,
|
|
765
|
+
category: 'workspace',
|
|
766
|
+
properties,
|
|
767
|
+
requiredProperties: ['action'],
|
|
768
|
+
}));
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Track conversation deletion
|
|
772
|
+
*
|
|
773
|
+
* @example
|
|
774
|
+
* ```typescript
|
|
775
|
+
* ai.CONVERSATION_DELETED({
|
|
776
|
+
* conversation_id: 'conv_124',
|
|
777
|
+
* model_id: 'claude-3-5-sonnet',
|
|
778
|
+
* message_count: 8,
|
|
779
|
+
* deleted_by: 'user',
|
|
780
|
+
* });
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
export const CONVERSATION_DELETED = createAITracker<WorkspaceProperties>(properties => ({
|
|
784
|
+
name: AI_EVENTS.CONVERSATION_DELETED,
|
|
785
|
+
category: 'workspace',
|
|
786
|
+
properties,
|
|
787
|
+
requiredProperties: ['action'],
|
|
788
|
+
}));
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Track folder creation
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```typescript
|
|
795
|
+
* ai.FOLDER_CREATED({
|
|
796
|
+
* workspace_id: 'ws_001',
|
|
797
|
+
* model_id: 'gpt-4',
|
|
798
|
+
* folder_name: 'Project Ideas',
|
|
799
|
+
* parent_folder_id: 'folder_root',
|
|
800
|
+
* });
|
|
801
|
+
* ```
|
|
802
|
+
*/
|
|
803
|
+
export const FOLDER_CREATED = createAITracker<WorkspaceProperties>(properties => ({
|
|
804
|
+
name: AI_EVENTS.FOLDER_CREATED,
|
|
805
|
+
category: 'workspace',
|
|
806
|
+
properties,
|
|
807
|
+
requiredProperties: ['action'],
|
|
808
|
+
}));
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Track tag addition
|
|
812
|
+
*
|
|
813
|
+
* @example
|
|
814
|
+
* ```typescript
|
|
815
|
+
* ai.TAG_ADDED({
|
|
816
|
+
* conversation_id: 'conv_123',
|
|
817
|
+
* model_id: 'claude-3-5-sonnet',
|
|
818
|
+
* tag_name: 'important',
|
|
819
|
+
* tag_category: 'priority',
|
|
820
|
+
* });
|
|
821
|
+
* ```
|
|
822
|
+
*/
|
|
823
|
+
export const TAG_ADDED = createAITracker<WorkspaceProperties>(properties => ({
|
|
824
|
+
name: AI_EVENTS.TAG_ADDED,
|
|
825
|
+
category: 'workspace',
|
|
826
|
+
properties,
|
|
827
|
+
requiredProperties: ['action'],
|
|
828
|
+
}));
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Track conversation search
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```typescript
|
|
835
|
+
* ai.SEARCH_PERFORMED({
|
|
836
|
+
* model_id: 'gpt-4',
|
|
837
|
+
* search_query: 'React hooks',
|
|
838
|
+
* results_found: 12,
|
|
839
|
+
* search_scope: 'all-conversations',
|
|
840
|
+
* });
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
export const SEARCH_PERFORMED = createAITracker<WorkspaceProperties>(properties => ({
|
|
844
|
+
name: AI_EVENTS.SEARCH_PERFORMED,
|
|
845
|
+
category: 'workspace',
|
|
846
|
+
properties,
|
|
847
|
+
requiredProperties: ['action'],
|
|
848
|
+
}));
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Track filter application
|
|
852
|
+
*
|
|
853
|
+
* @example
|
|
854
|
+
* ```typescript
|
|
855
|
+
* ai.FILTER_APPLIED({
|
|
856
|
+
* model_id: 'claude-3-5-sonnet',
|
|
857
|
+
* filter_type: 'date-range',
|
|
858
|
+
* filter_value: 'last-7-days',
|
|
859
|
+
* results_count: 24,
|
|
860
|
+
* });
|
|
861
|
+
* ```
|
|
862
|
+
*/
|
|
863
|
+
export const FILTER_APPLIED = createAITracker<WorkspaceProperties>(properties => ({
|
|
864
|
+
name: AI_EVENTS.FILTER_APPLIED,
|
|
865
|
+
category: 'workspace',
|
|
866
|
+
properties,
|
|
867
|
+
requiredProperties: ['action'],
|
|
868
|
+
}));
|
|
869
|
+
|
|
870
|
+
// ============================================================================
|
|
871
|
+
// FEEDBACK & QUALITY - User feedback and quality signals
|
|
872
|
+
// ============================================================================
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Track user feedback
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```typescript
|
|
879
|
+
* ai.FEEDBACK_PROVIDED({
|
|
880
|
+
* conversation_id: 'conv_123',
|
|
881
|
+
* model_id: 'gpt-4',
|
|
882
|
+
* message_id: 'msg_457',
|
|
883
|
+
* feedback_type: 'thumbs-up',
|
|
884
|
+
* feedback_comment_length: 50,
|
|
885
|
+
* });
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
export const FEEDBACK_PROVIDED = createAITracker<FeedbackProperties>(properties => ({
|
|
889
|
+
name: AI_EVENTS.FEEDBACK_PROVIDED,
|
|
890
|
+
category: 'feedback',
|
|
891
|
+
properties,
|
|
892
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
893
|
+
}));
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Track response rating
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* ai.RESPONSE_RATED({
|
|
901
|
+
* conversation_id: 'conv_123',
|
|
902
|
+
* model_id: 'claude-3-5-sonnet',
|
|
903
|
+
* message_id: 'msg_458',
|
|
904
|
+
* rating_value: 5,
|
|
905
|
+
* rating_scale: '1-5',
|
|
906
|
+
* });
|
|
907
|
+
* ```
|
|
908
|
+
*/
|
|
909
|
+
export const RESPONSE_RATED = createAITracker<FeedbackProperties>(properties => ({
|
|
910
|
+
name: AI_EVENTS.RESPONSE_RATED,
|
|
911
|
+
category: 'feedback',
|
|
912
|
+
properties,
|
|
913
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
914
|
+
}));
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Track bug report
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* ai.BUG_REPORTED({
|
|
922
|
+
* conversation_id: 'conv_123',
|
|
923
|
+
* model_id: 'gpt-4',
|
|
924
|
+
* bug_type: 'incorrect-output',
|
|
925
|
+
* bug_severity: 'medium',
|
|
926
|
+
* });
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
export const BUG_REPORTED = createAITracker<FeedbackProperties>(properties => ({
|
|
930
|
+
name: AI_EVENTS.BUG_REPORTED,
|
|
931
|
+
category: 'feedback',
|
|
932
|
+
properties,
|
|
933
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
934
|
+
}));
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Track feature request
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```typescript
|
|
941
|
+
* ai.FEATURE_REQUESTED({
|
|
942
|
+
* model_id: 'claude-3-5-sonnet',
|
|
943
|
+
* feature_category: 'ui',
|
|
944
|
+
* feature_description_length: 200,
|
|
945
|
+
* });
|
|
946
|
+
* ```
|
|
947
|
+
*/
|
|
948
|
+
export const FEATURE_REQUESTED = createAITracker<FeedbackProperties>(properties => ({
|
|
949
|
+
name: AI_EVENTS.FEATURE_REQUESTED,
|
|
950
|
+
category: 'feedback',
|
|
951
|
+
properties,
|
|
952
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
953
|
+
}));
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Track harmful content flag
|
|
957
|
+
*
|
|
958
|
+
* @example
|
|
959
|
+
* ```typescript
|
|
960
|
+
* ai.HARMFUL_CONTENT_FLAGGED({
|
|
961
|
+
* conversation_id: 'conv_123',
|
|
962
|
+
* model_id: 'gpt-4',
|
|
963
|
+
* message_id: 'msg_459',
|
|
964
|
+
* content_type: 'misinformation',
|
|
965
|
+
* severity: 'high',
|
|
966
|
+
* });
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
export const HARMFUL_CONTENT_FLAGGED = createAITracker<FeedbackProperties>(properties => ({
|
|
970
|
+
name: AI_EVENTS.HARMFUL_CONTENT_FLAGGED,
|
|
971
|
+
category: 'feedback',
|
|
972
|
+
properties,
|
|
973
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
974
|
+
}));
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Track quality issue report
|
|
978
|
+
*
|
|
979
|
+
* @example
|
|
980
|
+
* ```typescript
|
|
981
|
+
* ai.QUALITY_ISSUE_REPORTED({
|
|
982
|
+
* conversation_id: 'conv_123',
|
|
983
|
+
* model_id: 'claude-3-5-sonnet',
|
|
984
|
+
* message_id: 'msg_460',
|
|
985
|
+
* issue_type: 'factual-error',
|
|
986
|
+
* issue_severity: 'medium',
|
|
987
|
+
* });
|
|
988
|
+
* ```
|
|
989
|
+
*/
|
|
990
|
+
export const QUALITY_ISSUE_REPORTED = createAITracker<FeedbackProperties>(properties => ({
|
|
991
|
+
name: AI_EVENTS.QUALITY_ISSUE_REPORTED,
|
|
992
|
+
category: 'feedback',
|
|
993
|
+
properties,
|
|
994
|
+
requiredProperties: ['feedback_type', 'message_id'],
|
|
995
|
+
}));
|
|
996
|
+
|
|
997
|
+
// ============================================================================
|
|
998
|
+
// SYSTEM & PERFORMANCE - Technical operations and model management
|
|
999
|
+
// ============================================================================
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Track model switch
|
|
1003
|
+
*
|
|
1004
|
+
* @example
|
|
1005
|
+
* ```typescript
|
|
1006
|
+
* ai.MODEL_SWITCHED({
|
|
1007
|
+
* conversation_id: 'conv_123',
|
|
1008
|
+
* model_id: 'gpt-4',
|
|
1009
|
+
* previous_model: 'gpt-3.5-turbo',
|
|
1010
|
+
* switch_reason: 'user-preference',
|
|
1011
|
+
* });
|
|
1012
|
+
* ```
|
|
1013
|
+
*/
|
|
1014
|
+
export const MODEL_SWITCHED = createAITracker<SystemProperties>(properties => ({
|
|
1015
|
+
name: AI_EVENTS.MODEL_SWITCHED,
|
|
1016
|
+
category: 'system',
|
|
1017
|
+
properties,
|
|
1018
|
+
requiredProperties: [],
|
|
1019
|
+
}));
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Track settings update
|
|
1023
|
+
*
|
|
1024
|
+
* @example
|
|
1025
|
+
* ```typescript
|
|
1026
|
+
* ai.SETTINGS_UPDATED({
|
|
1027
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1028
|
+
* user_id: 'user_123',
|
|
1029
|
+
* settings_category: 'appearance',
|
|
1030
|
+
* settings_changed: ['theme', 'font-size'],
|
|
1031
|
+
* });
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
export const SETTINGS_UPDATED = createAITracker<SystemProperties>(properties => ({
|
|
1035
|
+
name: AI_EVENTS.SETTINGS_UPDATED,
|
|
1036
|
+
category: 'system',
|
|
1037
|
+
properties,
|
|
1038
|
+
requiredProperties: [],
|
|
1039
|
+
}));
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Track error occurrence
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```typescript
|
|
1046
|
+
* ai.ERROR_OCCURRED({
|
|
1047
|
+
* conversation_id: 'conv_123',
|
|
1048
|
+
* model_id: 'gpt-4',
|
|
1049
|
+
* error_type: 'api-error',
|
|
1050
|
+
* error_code: '500',
|
|
1051
|
+
* error_message: 'Internal server error',
|
|
1052
|
+
* });
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
export const ERROR_OCCURRED = createAITracker<SystemProperties>(properties => ({
|
|
1056
|
+
name: AI_EVENTS.ERROR_OCCURRED,
|
|
1057
|
+
category: 'system',
|
|
1058
|
+
properties,
|
|
1059
|
+
requiredProperties: [],
|
|
1060
|
+
}));
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Track rate limit hit
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* ai.RATE_LIMIT_HIT({
|
|
1068
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1069
|
+
* user_id: 'user_123',
|
|
1070
|
+
* limit_type: 'requests-per-minute',
|
|
1071
|
+
* retry_after_seconds: 60,
|
|
1072
|
+
* });
|
|
1073
|
+
* ```
|
|
1074
|
+
*/
|
|
1075
|
+
export const RATE_LIMIT_HIT = createAITracker<SystemProperties>(properties => ({
|
|
1076
|
+
name: AI_EVENTS.RATE_LIMIT_HIT,
|
|
1077
|
+
category: 'system',
|
|
1078
|
+
properties,
|
|
1079
|
+
requiredProperties: [],
|
|
1080
|
+
}));
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Track token usage
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* ```typescript
|
|
1087
|
+
* ai.TOKEN_USAGE_TRACKED({
|
|
1088
|
+
* conversation_id: 'conv_123',
|
|
1089
|
+
* model_id: 'gpt-4',
|
|
1090
|
+
* input_tokens: 1500,
|
|
1091
|
+
* output_tokens: 800,
|
|
1092
|
+
* total_tokens: 2300,
|
|
1093
|
+
* cost: 0.0345,
|
|
1094
|
+
* cost_currency: 'USD',
|
|
1095
|
+
* });
|
|
1096
|
+
* ```
|
|
1097
|
+
*/
|
|
1098
|
+
export const TOKEN_USAGE_TRACKED = createAITracker<BaseAIProperties>(properties => ({
|
|
1099
|
+
name: AI_EVENTS.TOKEN_USAGE_TRACKED,
|
|
1100
|
+
category: 'system',
|
|
1101
|
+
properties,
|
|
1102
|
+
requiredProperties: [],
|
|
1103
|
+
}));
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Track performance measurement
|
|
1107
|
+
*
|
|
1108
|
+
* @example
|
|
1109
|
+
* ```typescript
|
|
1110
|
+
* ai.PERFORMANCE_MEASURED({
|
|
1111
|
+
* conversation_id: 'conv_123',
|
|
1112
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1113
|
+
* operation_type: 'message-generation',
|
|
1114
|
+
* duration_ms: 850,
|
|
1115
|
+
* performance_tier: 'normal',
|
|
1116
|
+
* });
|
|
1117
|
+
* ```
|
|
1118
|
+
*/
|
|
1119
|
+
export const PERFORMANCE_MEASURED = createAITracker<PerformanceProperties>(properties => ({
|
|
1120
|
+
name: AI_EVENTS.PERFORMANCE_MEASURED,
|
|
1121
|
+
category: 'system',
|
|
1122
|
+
properties,
|
|
1123
|
+
requiredProperties: [],
|
|
1124
|
+
}));
|
|
1125
|
+
|
|
1126
|
+
// ============================================================================
|
|
1127
|
+
// TOOLS & FUNCTIONS - Tool calls and function execution
|
|
1128
|
+
// ============================================================================
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Track tool call start
|
|
1132
|
+
*
|
|
1133
|
+
* @example
|
|
1134
|
+
* ```typescript
|
|
1135
|
+
* ai.TOOL_CALL_STARTED({
|
|
1136
|
+
* conversation_id: 'conv_123',
|
|
1137
|
+
* model_id: 'gpt-4',
|
|
1138
|
+
* tool_name: 'web_search',
|
|
1139
|
+
* tool_type: 'built-in',
|
|
1140
|
+
* });
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
export const TOOL_CALL_STARTED = createAITracker<ToolProperties>(properties => ({
|
|
1144
|
+
name: AI_EVENTS.TOOL_CALL_STARTED,
|
|
1145
|
+
category: 'tool',
|
|
1146
|
+
properties,
|
|
1147
|
+
requiredProperties: [],
|
|
1148
|
+
}));
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Track tool call completion
|
|
1152
|
+
*
|
|
1153
|
+
* @example
|
|
1154
|
+
* ```typescript
|
|
1155
|
+
* ai.TOOL_CALL_COMPLETED({
|
|
1156
|
+
* conversation_id: 'conv_123',
|
|
1157
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1158
|
+
* tool_name: 'calculator',
|
|
1159
|
+
* tool_type: 'custom',
|
|
1160
|
+
* result_status: 'success',
|
|
1161
|
+
* execution_time_ms: 50,
|
|
1162
|
+
* });
|
|
1163
|
+
* ```
|
|
1164
|
+
*/
|
|
1165
|
+
export const TOOL_CALL_COMPLETED = createAITracker<ToolProperties>(properties => ({
|
|
1166
|
+
name: AI_EVENTS.TOOL_CALL_COMPLETED,
|
|
1167
|
+
category: 'tool',
|
|
1168
|
+
properties,
|
|
1169
|
+
requiredProperties: [],
|
|
1170
|
+
}));
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Track tool call failure
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* ```typescript
|
|
1177
|
+
* ai.TOOL_CALL_FAILED({
|
|
1178
|
+
* conversation_id: 'conv_123',
|
|
1179
|
+
* model_id: 'gpt-4',
|
|
1180
|
+
* tool_name: 'api_caller',
|
|
1181
|
+
* tool_type: 'custom',
|
|
1182
|
+
* error_message: 'Connection timeout',
|
|
1183
|
+
* execution_time_ms: 5000,
|
|
1184
|
+
* });
|
|
1185
|
+
* ```
|
|
1186
|
+
*/
|
|
1187
|
+
export const TOOL_CALL_FAILED = createAITracker<ToolProperties>(properties => ({
|
|
1188
|
+
name: AI_EVENTS.TOOL_CALL_FAILED,
|
|
1189
|
+
category: 'tool',
|
|
1190
|
+
properties,
|
|
1191
|
+
requiredProperties: [],
|
|
1192
|
+
}));
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Track function execution
|
|
1196
|
+
*
|
|
1197
|
+
* @example
|
|
1198
|
+
* ```typescript
|
|
1199
|
+
* ai.FUNCTION_EXECUTED({
|
|
1200
|
+
* conversation_id: 'conv_123',
|
|
1201
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1202
|
+
* function_name: 'getData',
|
|
1203
|
+
* execution_status: 'success',
|
|
1204
|
+
* execution_time_ms: 120,
|
|
1205
|
+
* });
|
|
1206
|
+
* ```
|
|
1207
|
+
*/
|
|
1208
|
+
export const FUNCTION_EXECUTED = createAITracker<ToolProperties>(properties => ({
|
|
1209
|
+
name: AI_EVENTS.FUNCTION_EXECUTED,
|
|
1210
|
+
category: 'tool',
|
|
1211
|
+
properties,
|
|
1212
|
+
requiredProperties: [],
|
|
1213
|
+
}));
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* Track API request
|
|
1217
|
+
*
|
|
1218
|
+
* @example
|
|
1219
|
+
* ```typescript
|
|
1220
|
+
* ai.API_REQUEST_MADE({
|
|
1221
|
+
* conversation_id: 'conv_123',
|
|
1222
|
+
* model_id: 'gpt-4',
|
|
1223
|
+
* api_endpoint: '/v1/data',
|
|
1224
|
+
* api_method: 'GET',
|
|
1225
|
+
* response_status: 200,
|
|
1226
|
+
* response_time_ms: 250,
|
|
1227
|
+
* });
|
|
1228
|
+
* ```
|
|
1229
|
+
*/
|
|
1230
|
+
export const API_REQUEST_MADE = createAITracker<ToolProperties>(properties => ({
|
|
1231
|
+
name: AI_EVENTS.API_REQUEST_MADE,
|
|
1232
|
+
category: 'tool',
|
|
1233
|
+
properties,
|
|
1234
|
+
requiredProperties: [],
|
|
1235
|
+
}));
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* Track plugin activation
|
|
1239
|
+
*
|
|
1240
|
+
* @example
|
|
1241
|
+
* ```typescript
|
|
1242
|
+
* ai.PLUGIN_ACTIVATED({
|
|
1243
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1244
|
+
* plugin_name: 'web-browser',
|
|
1245
|
+
* plugin_version: '1.2.0',
|
|
1246
|
+
* });
|
|
1247
|
+
* ```
|
|
1248
|
+
*/
|
|
1249
|
+
export const PLUGIN_ACTIVATED = createAITracker<ToolProperties>(properties => ({
|
|
1250
|
+
name: AI_EVENTS.PLUGIN_ACTIVATED,
|
|
1251
|
+
category: 'tool',
|
|
1252
|
+
properties,
|
|
1253
|
+
requiredProperties: [],
|
|
1254
|
+
}));
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Track extension usage
|
|
1258
|
+
*
|
|
1259
|
+
* @example
|
|
1260
|
+
* ```typescript
|
|
1261
|
+
* ai.EXTENSION_USED({
|
|
1262
|
+
* conversation_id: 'conv_123',
|
|
1263
|
+
* model_id: 'gpt-4',
|
|
1264
|
+
* extension_name: 'code-runner',
|
|
1265
|
+
* extension_action: 'execute',
|
|
1266
|
+
* });
|
|
1267
|
+
* ```
|
|
1268
|
+
*/
|
|
1269
|
+
export const EXTENSION_USED = createAITracker<ToolProperties>(properties => ({
|
|
1270
|
+
name: AI_EVENTS.EXTENSION_USED,
|
|
1271
|
+
category: 'tool',
|
|
1272
|
+
properties,
|
|
1273
|
+
requiredProperties: [],
|
|
1274
|
+
}));
|
|
1275
|
+
|
|
1276
|
+
// ============================================================================
|
|
1277
|
+
// SEARCH & CITATIONS - Web search and source attribution
|
|
1278
|
+
// ============================================================================
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Track web search
|
|
1282
|
+
*
|
|
1283
|
+
* @example
|
|
1284
|
+
* ```typescript
|
|
1285
|
+
* ai.WEB_SEARCH_PERFORMED({
|
|
1286
|
+
* conversation_id: 'conv_123',
|
|
1287
|
+
* model_id: 'gpt-4',
|
|
1288
|
+
* search_query: 'latest React 19 features',
|
|
1289
|
+
* search_engine: 'google',
|
|
1290
|
+
* results_count: 10,
|
|
1291
|
+
* search_time_ms: 450,
|
|
1292
|
+
* });
|
|
1293
|
+
* ```
|
|
1294
|
+
*/
|
|
1295
|
+
export const WEB_SEARCH_PERFORMED = createAITracker<SearchProperties>(properties => ({
|
|
1296
|
+
name: AI_EVENTS.WEB_SEARCH_PERFORMED,
|
|
1297
|
+
category: 'context',
|
|
1298
|
+
properties,
|
|
1299
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1300
|
+
}));
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* Track citation addition
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* ```typescript
|
|
1307
|
+
* ai.CITATION_ADDED({
|
|
1308
|
+
* conversation_id: 'conv_123',
|
|
1309
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1310
|
+
* message_id: 'msg_461',
|
|
1311
|
+
* citation_source: 'https://react.dev',
|
|
1312
|
+
* citation_type: 'web',
|
|
1313
|
+
* });
|
|
1314
|
+
* ```
|
|
1315
|
+
*/
|
|
1316
|
+
export const CITATION_ADDED = createAITracker<SearchProperties>(properties => ({
|
|
1317
|
+
name: AI_EVENTS.CITATION_ADDED,
|
|
1318
|
+
category: 'context',
|
|
1319
|
+
properties,
|
|
1320
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1321
|
+
}));
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* Track browse session start
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* ai.BROWSE_SESSION_STARTED({
|
|
1329
|
+
* conversation_id: 'conv_123',
|
|
1330
|
+
* model_id: 'gpt-4',
|
|
1331
|
+
* browse_target_url: 'https://example.com',
|
|
1332
|
+
* });
|
|
1333
|
+
* ```
|
|
1334
|
+
*/
|
|
1335
|
+
export const BROWSE_SESSION_STARTED = createAITracker<SearchProperties>(properties => ({
|
|
1336
|
+
name: AI_EVENTS.BROWSE_SESSION_STARTED,
|
|
1337
|
+
category: 'context',
|
|
1338
|
+
properties,
|
|
1339
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1340
|
+
}));
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Track page content fetch
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* ```typescript
|
|
1347
|
+
* ai.PAGE_CONTENT_FETCHED({
|
|
1348
|
+
* conversation_id: 'conv_123',
|
|
1349
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1350
|
+
* page_url: 'https://example.com/article',
|
|
1351
|
+
* content_length: 5000,
|
|
1352
|
+
* fetch_time_ms: 800,
|
|
1353
|
+
* });
|
|
1354
|
+
* ```
|
|
1355
|
+
*/
|
|
1356
|
+
export const PAGE_CONTENT_FETCHED = createAITracker<SearchProperties>(properties => ({
|
|
1357
|
+
name: AI_EVENTS.PAGE_CONTENT_FETCHED,
|
|
1358
|
+
category: 'context',
|
|
1359
|
+
properties,
|
|
1360
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1361
|
+
}));
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Track search results ranking
|
|
1365
|
+
*
|
|
1366
|
+
* @example
|
|
1367
|
+
* ```typescript
|
|
1368
|
+
* ai.SEARCH_RESULTS_RANKED({
|
|
1369
|
+
* conversation_id: 'conv_123',
|
|
1370
|
+
* model_id: 'gpt-4',
|
|
1371
|
+
* results_count: 20,
|
|
1372
|
+
* ranking_algorithm: 'relevance',
|
|
1373
|
+
* });
|
|
1374
|
+
* ```
|
|
1375
|
+
*/
|
|
1376
|
+
export const SEARCH_RESULTS_RANKED = createAITracker<SearchProperties>(properties => ({
|
|
1377
|
+
name: AI_EVENTS.SEARCH_RESULTS_RANKED,
|
|
1378
|
+
category: 'context',
|
|
1379
|
+
properties,
|
|
1380
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1381
|
+
}));
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Track external source access
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```typescript
|
|
1388
|
+
* ai.EXTERNAL_SOURCE_ACCESSED({
|
|
1389
|
+
* conversation_id: 'conv_123',
|
|
1390
|
+
* model_id: 'claude-3-5-sonnet',
|
|
1391
|
+
* source_type: 'api',
|
|
1392
|
+
* source_url: 'https://api.example.com/data',
|
|
1393
|
+
* access_time_ms: 350,
|
|
1394
|
+
* });
|
|
1395
|
+
* ```
|
|
1396
|
+
*/
|
|
1397
|
+
export const EXTERNAL_SOURCE_ACCESSED = createAITracker<SearchProperties>(properties => ({
|
|
1398
|
+
name: AI_EVENTS.EXTERNAL_SOURCE_ACCESSED,
|
|
1399
|
+
category: 'context',
|
|
1400
|
+
properties,
|
|
1401
|
+
requiredProperties: ['query', 'search_scope'],
|
|
1402
|
+
}));
|