-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathanalytics-events.ts
More file actions
1319 lines (1151 loc) · 38.9 KB
/
Copy pathanalytics-events.ts
File metadata and controls
1319 lines (1151 loc) · 38.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Analytics event types and properties
export interface PromptHistoryOpenedProperties {
entry_count: number;
}
export interface PromptHistorySelectedProperties {
entry_count: number;
entry_age_seconds: number | null;
had_pending_draft: boolean;
had_search_query: boolean;
prompt_length: number;
}
type ExecutionType = "cloud" | "local";
export type RepositoryProvider = "github" | "gitlab" | "local" | "none";
type TaskCreatedFrom = "cli" | "command-menu" | "home-quick-action";
type RepositorySelectSource = "task-creation" | "task-detail";
type GitActionType =
| "push"
| "pull"
| "sync"
| "publish"
| "commit"
| "commit-push"
| "create-pr"
| "view-pr"
| "update-pr"
| "branch-here";
export type FeedbackType = "good" | "bad" | "general";
type FileOpenSource = "sidebar" | "agent-suggestion" | "search" | "diff";
export type FileChangeType = "added" | "modified" | "deleted";
type StopReason = "user_cancelled" | "completed" | "error" | "timeout";
export type SkillButtonId =
| "add-analytics"
| "create-feature-flags"
| "run-experiment"
| "add-error-tracking"
| "instrument-llm-calls"
| "add-logging";
type SkillButtonSource = "primary" | "dropdown";
export type CommandMenuAction =
| "home"
| "new-task"
| "settings"
| "logout"
| "toggle-theme"
| "toggle-left-sidebar"
| "open-review-panel"
| "go-back"
| "go-forward"
| "open-task"
| "open-channel"
| "search-files"
| "open-file"
| "reload-window"
| "show-log-folder"
| "zoom-in"
| "zoom-out"
| "zoom-reset";
// Event property interfaces
export interface TaskListViewProperties {
filter_type?: string;
sort_field?: string;
view_mode?: string;
}
export interface TaskCreateProperties {
auto_run: boolean;
created_from: TaskCreatedFrom;
repository_provider?: RepositoryProvider;
workspace_mode?: "local" | "worktree" | "cloud";
has_branch?: boolean;
/** Worktree mode: a project environment with a setup script was selected */
has_environment_setup?: boolean;
/** Cloud mode: a sandbox environment was selected */
has_sandbox_environment?: boolean;
cloud_run_source?: "manual" | "signal_report";
cloud_pr_authorship_mode?: "user" | "bot";
signal_report_id?: string;
/** Worktree mode: repo has a non-empty .worktreelink file */
uses_worktree_link?: boolean;
/** Worktree mode: repo has a non-empty .worktreeinclude file */
uses_worktree_include?: boolean;
adapter?: "claude" | "codex";
}
export interface TaskViewProperties {
task_id: string;
}
export interface TaskRunProperties {
task_id: string;
execution_type: ExecutionType;
}
export interface RepositorySelectProperties {
repository_provider: RepositoryProvider;
source: RepositorySelectSource;
}
export interface UserIdentifyProperties {
email?: string;
uuid?: string;
project_id?: string;
region?: string;
}
export interface TaskRunStartedProperties {
task_id: string;
execution_type: ExecutionType;
model?: string;
initial_mode?: string;
adapter?: string;
}
export interface TaskRunCompletedProperties {
task_id: string;
execution_type: ExecutionType;
duration_seconds: number;
prompts_sent: number;
stop_reason: StopReason;
}
export interface TaskRunCancelledProperties {
task_id: string;
execution_type: ExecutionType;
duration_seconds: number;
prompts_sent: number;
}
export interface PromptSentProperties {
task_id: string;
is_initial: boolean;
execution_type: ExecutionType;
prompt_length_chars: number;
}
// Git operations
export interface GitActionExecutedProperties {
action_type: GitActionType;
success: boolean;
task_id?: string;
/** Number of staged files at time of action */
staged_file_count?: number;
/** Number of unstaged files at time of action */
unstaged_file_count?: number;
/** Whether user chose to commit all changes (vs staged only) */
commit_all?: boolean;
/** Whether stagedOnly mode was used for the commit */
staged_only?: boolean;
}
export interface PrCreatedProperties {
task_id?: string;
success: boolean;
}
export interface AgentFileActivityProperties {
task_id: string;
branch_name: string | null;
}
// Branch link events
type BranchLinkSource = "agent" | "user" | "unknown";
export interface BranchLinkedProperties {
task_id: string;
branch_name: string;
source: BranchLinkSource;
}
export interface BranchUnlinkedProperties {
task_id: string;
source: BranchLinkSource;
}
export interface BranchLinkDefaultBranchUnknownProperties {
task_id: string;
branch_name: string;
}
// File interactions
export interface FileOpenedProperties {
file_extension: string;
source: FileOpenSource;
task_id?: string;
}
export interface FileDiffViewedProperties {
file_extension: string;
change_type: FileChangeType;
task_id?: string;
}
export interface ReviewPanelViewedProperties {
task_id: string;
}
export interface DiffViewModeChangedProperties {
from_mode: "split" | "unified";
to_mode: "split" | "unified";
}
// Workspace events
export interface WorkspaceCreatedProperties {
task_id: string;
mode: "cloud" | "worktree" | "local";
}
export interface WorkspaceScriptsStartedProperties {
task_id: string;
scripts_count: number;
}
export interface FolderRegisteredProperties {
path_hash: string;
}
// Navigation events
export interface CommandMenuActionProperties {
action_type: CommandMenuAction;
/** Channel acted on for the bluebird `open-channel` / `open-task` actions. */
channel_id?: string;
}
export interface BrainrotActivatedProperties {
/** Grid layout preset, e.g. "2x2". */
layout: string;
/** Cells already holding a task when Brainrot was chosen. */
filled_cells: number;
}
export interface SkillButtonTriggeredProperties {
task_id: string;
button_id: SkillButtonId;
source: SkillButtonSource;
}
// Settings events
export interface SettingChangedProperties {
setting_name: string;
new_value: string | boolean | number;
old_value?: string | boolean | number;
}
export interface CustomSoundAddedProperties {
// How the clip was captured.
source: "recording" | "import";
// Whether the user applied the offered leading/trailing-silence trim.
trimmed: boolean;
// Length of the saved clip in ms (no clip contents or name — no PII).
duration_ms: number;
}
// Error events
export interface TaskCreationFailedProperties {
error_type: string;
failed_step?: string;
}
export interface AgentSessionErrorProperties {
task_id: string;
error_type: string;
}
export interface CloudStreamDisconnectedProperties {
task_id: string;
run_id: string;
team_id: number;
error_title: string;
retryable: boolean;
reconnect_attempts: number;
stream_error_attempts: number;
cumulative_reconnect_attempts: number;
was_bootstrapping: boolean;
}
// Permission events
export interface PermissionRespondedProperties {
task_id: string;
tool_name?: string;
option_id?: string;
option_kind?: string;
custom_input?: string;
}
export interface PermissionCancelledProperties {
task_id: string;
tool_name?: string;
}
// Session config events
export interface SessionConfigChangedProperties {
task_id: string;
category: string;
from_value: string;
to_value: string;
}
// Tour events
type TourAction = "started" | "step_advanced" | "dismissed" | "completed";
export interface TourEventProperties {
tour_id: string;
action: TourAction;
step_id?: string;
step_index?: number;
total_steps?: number;
}
// Branch mismatch events
type BranchMismatchAction = "switch" | "continue" | "cancel";
export interface BranchMismatchWarningShownProperties {
task_id: string;
linked_branch: string;
current_branch: string;
has_uncommitted_changes: boolean;
}
export interface BranchMismatchActionProperties {
task_id: string;
action: BranchMismatchAction;
linked_branch: string;
current_branch: string;
}
// Deep link events
export interface DeepLinkNewTaskProperties {
has_prompt: boolean;
has_repo: boolean;
mode?: string;
model?: string;
}
export interface DeepLinkPlanProperties {
has_repo: boolean;
mode?: string;
model?: string;
plan_length_chars: number;
}
export interface DeepLinkIssueProperties {
owner: string;
repo: string;
issue_number: number;
mode?: string;
model?: string;
}
export interface DeepLinkIssueFailedProperties {
owner: string;
repo: string;
issue_number: number;
reason: "not_found" | "fetch_failed";
error_message?: string;
}
export interface DeepLinkCanvasProperties {
channel_id: string;
dashboard_id: string;
}
// Feedback events
export interface TaskFeedbackProperties {
task_id: string;
task_run_id?: string;
log_url?: string;
event_count: number;
feedback_type: FeedbackType;
feedback_comment?: string;
}
// Onboarding events
export type OnboardingStepId =
| "welcome"
| "project-select"
| "invite-code"
| "connect-github"
| "install-cli"
| "import-config"
| "select-repo";
type OnboardingSkipReason = "no_repo_selected" | "dev_skip";
export interface OnboardingStepViewedProperties {
step_id: OnboardingStepId;
step_index: number;
total_steps: number;
}
export interface OnboardingStepCompletedProperties {
step_id: OnboardingStepId;
step_index: number;
total_steps: number;
duration_seconds: number;
github_connected?: boolean;
git_installed?: boolean;
gh_installed?: boolean;
gh_authenticated?: boolean;
}
export interface OnboardingStepSkippedProperties {
step_id: OnboardingStepId;
step_index: number;
reason: OnboardingSkipReason;
}
export interface OnboardingSignInInitiatedProperties {
region: string;
}
export interface OnboardingProjectSelectedProperties {
had_multiple_orgs: boolean;
had_multiple_projects: boolean;
}
export interface OnboardingInviteCodeSubmittedProperties {
success: boolean;
error_type?: string;
}
export interface OnboardingFolderSelectedProperties {
has_git_remote: boolean;
repository_provider: RepositoryProvider;
}
export interface OnboardingCliCheckCompletedProperties {
git_installed: boolean;
gh_installed: boolean;
gh_authenticated: boolean;
}
export interface OnboardingCliRunCompletedProperties {
command: "install_git" | "install_gh" | "auth_gh";
exit_code: number;
}
export interface OnboardingCompletedProperties {
duration_seconds: number;
github_connected: boolean;
repo_skipped: boolean;
}
export type OnboardingGithubConnectFlow =
| "team_existing"
| "team_alternative"
| "user_new";
export interface OnboardingGithubConnectStartedProperties {
flow_type: OnboardingGithubConnectFlow;
is_retry: boolean;
}
export interface OnboardingGithubConnectFailedProperties {
reason: "timeout" | "error";
error_type?: string;
}
export interface OnboardingAbandonedProperties {
last_step_id: OnboardingStepId;
duration_seconds: number;
}
export interface AiConsentGateShownProperties {
is_org_admin: boolean;
}
// Setup / onboarding events
type SetupDiscoveredTaskCategory =
| "bug"
| "security"
| "dead_code"
| "duplication"
| "performance"
| "stale_feature_flag"
| "error_tracking"
| "event_tracking"
| "funnel"
| "posthog_setup"
| "experiment";
export interface SetupDiscoveryStartedProperties {
discovery_task_id: string;
discovery_task_run_id: string;
}
export interface SetupDiscoveryCompletedProperties {
discovery_task_id: string;
discovery_task_run_id: string;
task_count: number;
duration_seconds: number;
signal_source: "structured_output" | "terminal_status" | "missing_output";
}
export interface SetupDiscoveryFailedProperties {
discovery_task_id?: string;
discovery_task_run_id?: string;
reason: "failed" | "cancelled" | "timeout" | "startup_error";
error_message?: string;
}
export interface SetupTaskSelectedProperties {
discovered_task_id: string;
category: SetupDiscoveredTaskCategory;
position: number;
total_discovered: number;
}
export interface SetupTaskDismissedProperties {
discovered_task_id: string;
category: SetupDiscoveredTaskCategory;
position: number;
total_discovered: number;
}
// Inbox events
export type InboxReportOpenMethod =
| "click"
| "click_cmd"
| "click_shift"
| "keyboard"
| "deeplink"
| "unknown";
export type InboxReportCloseMethod =
| "next_report"
| "deselected"
| "navigated_away"
| "unmount";
export type InboxReportActionType =
| "dismiss"
| "snooze"
| "delete"
| "reingest"
| "create_pr"
| "open_pr"
| "copy_link"
| "discuss"
| "expand_signal"
| "collapse_signal"
| "expand_signal_section"
| "view_signal_external"
| "expand_why"
| "click_suggested_reviewer"
| "add_suggested_reviewer"
| "remove_suggested_reviewer"
| "expand_task_section"
| "play_session_recording";
export type InboxReportActionSurface =
| "detail_pane"
| "toolbar"
| "keyboard"
| "list_row";
export interface InboxViewedProperties {
report_count: number;
total_count: number;
ready_count: number;
has_active_filters: boolean;
source_product_filter: string[];
status_filter_count: number;
is_empty: boolean;
/** Breakdown of the visible report_count by priority (P0–P4, or "unknown"). */
priority_p0_count: number;
priority_p1_count: number;
priority_p2_count: number;
priority_p3_count: number;
priority_p4_count: number;
priority_unknown_count: number;
/** Breakdown of the visible report_count by actionability. */
actionability_immediately_actionable_count: number;
actionability_requires_human_input_count: number;
actionability_not_actionable_count: number;
actionability_unknown_count: number;
/**
* Tab badge counts shown in the v2 inbox header on load — the actual numbers
* the user sees (Pull requests / Reports / Runs). Optional: only the desktop
* v2 shell populates these; the mobile event omits them.
*/
pulls_count?: number;
reports_count?: number;
}
export interface InboxReportOpenedProperties {
report_id: string;
report_title: string | null;
report_age_hours: number;
status: string | null;
priority: string | null;
actionability: string | null;
source_products: string[];
rank: number;
list_size: number;
open_method: InboxReportOpenMethod;
previous_report_id: string | null;
}
export interface InboxReportClosedProperties {
report_id: string;
report_title: string | null;
report_age_hours: number;
priority: string | null;
actionability: string | null;
time_spent_ms: number;
scrolled: boolean;
close_method: InboxReportCloseMethod;
}
export interface InboxReportScrolledProperties {
report_id: string;
report_title: string | null;
report_age_hours: number;
priority: string | null;
actionability: string | null;
rank: number;
list_size: number;
time_since_open_ms: number;
}
export interface SpendAnalysisTaskOpenedProperties {
/** Total LLM spend in USD across all products for the analysed window. */
total_cost_usd: number;
/** PostHog Code spend in USD for the analysed window (subset of total). */
scoped_cost_usd: number;
/** Number of `$ai_generation` events in the analysed window. */
scoped_event_count: number;
/** Length of the analysed window in days. */
window_days: number;
/** Number of tool rows the receiving agent will see (capped at 10 in the prompt). */
tool_row_count: number;
/** Number of model rows the receiving agent will see. */
model_row_count: number;
}
export interface InboxReportActionProperties {
report_id: string;
report_title: string | null;
report_age_hours: number;
priority: string | null;
actionability: string | null;
action_type: InboxReportActionType;
surface: InboxReportActionSurface;
is_bulk: boolean;
bulk_size: number;
rank: number;
list_size: number;
dismissal_reason?: string;
dismissal_note?: string;
signal_id?: string;
signal_source_product?: string;
signal_source_type?: string;
signal_section?: "relevant_code" | "data_queried";
why_field?: "priority" | "actionability";
task_section?: "research" | "implementation";
suggested_reviewer_login?: string;
suggested_reviewer_uuid?: string;
// True when the user submitted Discuss with a first question via the popover.
has_question?: boolean;
// The first question text the user typed before hitting Discuss. Truncated to
// 500 chars to keep event payloads bounded.
question_text?: string;
// True when the user submitted Create PR with extra feedback via the popover.
has_feedback?: boolean;
// The feedback text the user typed before hitting Create PR. Truncated to
// 500 chars to keep event payloads bounded.
feedback_text?: string;
}
// Scout events
export type ScoutChatType =
| "fleet_overview"
| "recent_signals"
| "scout_checkin"
| "finding_discuss"
| "author_scout";
export type ScoutSurface =
| "fleet_list"
| "scout_detail"
| "empty_state"
| "scout_findings";
export type ScoutActionType =
| "expand_run"
| "collapse_run"
| "expand_emission"
| "collapse_emission"
| "open_task_run"
| "open_skill_in_posthog"
| "open_helper_skill"
| "copy_finding_link"
| "open_linked_report"
| "show_more_emitted_runs"
| "filter_runs"
| "toggle_hide_disabled"
| "open_settings"
| "close_settings"
| "open_findings"
| "filter_findings"
| "sort_findings";
export interface ScoutFleetViewedProperties {
scout_count: number;
enabled_count: number;
dry_run_count: number;
custom_count: number;
is_empty: boolean;
}
export interface ScoutDetailViewedProperties {
skill_name: string;
scout_origin: "canonical" | "custom";
/** False when the runs window has data but no config exists for this scout. */
has_config: boolean;
enabled: boolean | null;
/** Live (true) vs dry run (false); null when no config was found. */
emit: boolean | null;
run_interval_minutes: number | null;
/** Run stats cover the fleet runs window (currently 24h). */
run_count: number;
emitted_signal_count: number;
failed_run_count: number;
}
export interface ScoutConfigChangedProperties {
skill_name: string;
scout_origin: "canonical" | "custom";
setting: "enabled" | "emit" | "run_interval_minutes";
new_value: boolean | number;
old_value: boolean | number;
/** False when the server rejected the update and the change rolled back. */
success: boolean;
}
export interface ScoutChatStartedProperties {
chat_type: ScoutChatType;
surface: ScoutSurface;
/** Set for per-scout check-ins; absent for fleet-level questions. */
skill_name?: string;
}
export interface ScoutActionProperties {
action_type: ScoutActionType;
surface: ScoutSurface;
skill_name?: string;
run_id?: string;
run_status?: string;
emitted_count?: number;
severity?: string | null;
filter?: string;
filter_match_count?: number;
helper_skill?: string;
hide_disabled?: boolean;
/** Status of the linked inbox report, for `open_linked_report`. */
report_status?: string;
}
export interface SignalSourceConnectedProperties {
source_product:
| "session_replay"
| "error_tracking"
| "signals_scout"
| "github"
| "linear"
| "zendesk"
| "conversations"
| "pganalyze"
| "llm_analytics";
/** True when this is a brand-new createSignalSourceConfig, false for re-enable of an existing config. */
is_first_connection: boolean;
/** True when the connection went through the DataSourceSetup wizard (warehouse OAuth path). */
via_setup_wizard: boolean;
}
// Agents page events (the `/code/agents` configuration surface)
export type AgentsActionType = "run_setup_agent" | "open_mcp_servers";
export interface AgentsViewedProperties {
/** Whether code access (GitHub) is connected — gates responder configuration. */
has_github_integration: boolean;
/** Total number of responder source products on the page. */
responder_total_count: number;
/** How many of those responders are currently enabled. */
responder_enabled_count: number;
/** User's PR auto-start threshold priority (P0–P4), or null when set to "Never". */
autostart_priority: string | null;
/** Whether the agent-driven setup entry point is shown (feature-flagged). */
setup_task_available: boolean;
}
export interface AgentsActionProperties {
action_type: AgentsActionType;
/** Whether `run_setup_agent` successfully created the setup task. */
success?: boolean;
}
// ── Project Bluebird / Channels (Website) space events ──
/** Where within the Channels space an interaction originated. */
export type ChannelsSurface =
| "header_button"
| "title_bar"
| "nav"
| "sidebar"
| "command_menu"
| "new_task"
| "channel_home"
| "channel_history"
| "channel_artifacts"
| "channel_inbox"
| "pinned"
| "dashboards_grid"
| "canvas"
| "context";
export type ChannelActionType =
| "enter_space"
| "leave_space"
| "leave_feedback"
| "nav_click"
| "open_channel"
| "collapse_channel"
| "view_more_tasks"
| "create"
| "rename"
| "delete"
| "star"
| "unstar"
| "edit_context_open"
| "new_task_open"
| "new_task_suggestion"
| "view_context"
| "view_history"
| "view_artifacts"
| "view_inbox"
| "open_artifact"
| "file_task"
| "unfile_task"
| "archive_task"
| "open_task";
export interface ChannelActionProperties {
action_type: ChannelActionType;
surface: ChannelsSurface;
/** The channel acted on, when one is in scope. */
channel_id?: string;
/** For file/unfile/archive/open task actions. */
task_id?: string;
/** For file_task: destination channel when different from `channel_id`. */
target_channel_id?: string;
/** For nav_click: which destination ("home"|"inbox"|"canvas"|"agents"|"files"|"settings"). */
nav_target?: string;
/** For new_task_suggestion: the starter-prompt card label. */
suggestion_label?: string;
/** Whether the underlying mutation resolved successfully. */
success?: boolean;
}
export type DashboardActionType =
| "open"
| "create"
| "delete"
| "rename"
| "save"
| "fork"
| "edit_toggle"
| "revert"
| "refresh"
| "poll_mode_change"
| "date_range_apply"
| "link_copied"
| "pin"
| "unpin";
export interface DashboardActionProperties {
action_type: DashboardActionType;
surface: ChannelsSurface;
channel_id?: string;
dashboard_id?: string;
/** The canvas render kind. */
kind?: "json-render" | "freeform";
/** Template chosen on create. */
template_id?: string;
/** edit_toggle: the state being entered. */
editing?: boolean;
/** poll_mode_change: the new value ("static"|"10s"|"10min"). */
poll_mode?: string;
/** date_range_apply: the named range, when not custom. */
range_name?: string;
/** Whether the underlying mutation resolved successfully. */
success?: boolean;
}
export type CanvasPromptSurface = "json" | "freeform";
export interface CanvasPromptSentProperties {
surface: CanvasPromptSurface;
dashboard_id?: string;
/** True when sent via a suggestion chip rather than free-typed. */
from_suggestion: boolean;
/** "ask_agent_to_fix" for the freeform self-repair path; absent otherwise. */
intent?: "ask_agent_to_fix";
prompt_length_chars: number;
}
export type ContextActionType = "save_version" | "generate_started" | "discard";
export interface ContextActionProperties {
action_type: ContextActionType;
channel_id: string;
/** generate_started only. */
execution_type?: "local" | "cloud";
/** save_version: whether this created the first version vs. an update. */
is_first_version?: boolean;
success?: boolean;
}
export interface ChannelsSpaceViewedProperties {
/** Total channels visible when the space mounts. */
channel_count: number;
starred_count: number;
}
// Subscription / billing events
export type UpgradePromptShownSurface = "usage_limit_modal" | "upgrade_dialog";
export type UpgradePromptClickedSurface =
| "usage_limit_modal"
| "sidebar"
| "plan_page_card"
| "upgrade_dialog";
export interface UpgradePromptShownProperties {
surface: UpgradePromptShownSurface;
}
export interface UpgradePromptClickedProperties {
surface: UpgradePromptClickedSurface;
}
export interface CloudTaskUsageBlockedProperties {
bucket: "burst" | "sustained" | null;
is_pro: boolean;
}
export interface SubscriptionStartedProperties {
plan_key: string;
previous_plan_key?: string;
}
export interface SubscriptionCancelledProperties {
plan_key: string;
}
// Claude Code session import events
/** Where in the new-task suggestions the import was launched from. */
export type ClaudeSessionImportSource = "inline_card" | "picker_dialog";
/**
* Import status of a listed CLI session. "imported" sessions are hidden from
* the suggestions, so an import is only ever started from a "new" or "updated"
* one; the wider union mirrors the domain status field.
*/
export type ClaudeSessionImportStatus = "new" | "imported" | "updated";
export interface ClaudeSessionsShownProperties {
/** Resumable Claude Code CLI sessions surfaced for the repo. */
sessions_count: number;
}
export interface ClaudeSessionImportedProperties {
source: ClaudeSessionImportSource;
session_status: ClaudeSessionImportStatus;
has_git_branch: boolean;
/** Resumable sessions available when this one was imported. */
sessions_available_count: number;
}
export interface ClaudeSessionImportFailedProperties {
source: ClaudeSessionImportSource;
session_status: ClaudeSessionImportStatus;
/** Saga step that failed, e.g. "import_claude_session" or "task_creation". */
failed_step?: string;
}
// Event names as constants
export const ANALYTICS_EVENTS = {
// App lifecycle
APP_STARTED: "App started",
APP_QUIT: "App quit",
// Authentication
USER_LOGGED_IN: "User logged in",
USER_LOGGED_OUT: "User logged out",
// Task management