all.go 804 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package event
  2. import (
  3. "time"
  4. )
  5. var appStartTime time.Time
  6. func AppInitialized() {
  7. appStartTime = time.Now()
  8. send("app initialized")
  9. }
  10. func AppExited() {
  11. duration := time.Since(appStartTime).Truncate(time.Second)
  12. send(
  13. "app exited",
  14. "app duration pretty", duration.String(),
  15. "app duration in seconds", int64(duration.Seconds()),
  16. )
  17. Flush()
  18. }
  19. func SessionCreated() {
  20. send("session created")
  21. }
  22. func SessionDeleted() {
  23. send("session deleted")
  24. }
  25. func SessionSwitched() {
  26. send("session switched")
  27. }
  28. func FilePickerOpened() {
  29. send("filepicker opened")
  30. }
  31. func PromptSent(props ...any) {
  32. send(
  33. "prompt sent",
  34. props...,
  35. )
  36. }
  37. func PromptResponded(props ...any) {
  38. send(
  39. "prompt responded",
  40. props...,
  41. )
  42. }
  43. func TokensUsed(props ...any) {
  44. send(
  45. "tokens used",
  46. props...,
  47. )
  48. }