revert file telemetry (#2538)

This commit is contained in:
Mike Sawka 2025-11-10 16:34:35 -08:00 committed by GitHub
parent 0f36b1ca92
commit 8c50f7b0b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 20 deletions

View file

@ -3,6 +3,7 @@
import { BlockModel } from "@/app/block/block-model";
import { Modal } from "@/app/modals/modal";
import { recordTEvent } from "@/app/store/global";
import { cn, fireAndForget } from "@/util/util";
import { useAtomValue } from "jotai";
import { memo, useEffect, useRef, useState } from "react";
@ -151,10 +152,12 @@ const RestoreBackupModal = memo(({ part }: RestoreBackupModalProps) => {
};
const handleConfirm = () => {
recordTEvent("waveai:revertfile", { "waveai:action": "revertfile:confirm" });
model.restoreBackup(toolData.toolcallid, toolData.writebackupfilename, toolData.inputfilename);
};
const handleCancel = () => {
recordTEvent("waveai:revertfile", { "waveai:action": "revertfile:cancel" });
model.closeRestoreBackupModal();
};
@ -309,6 +312,7 @@ const AIToolUse = memo(({ part, isStreaming }: AIToolUseProps) => {
};
const handleOpenDiff = () => {
recordTEvent("waveai:showdiff");
fireAndForget(() => WaveAIModel.getInstance().openDiff(toolData.inputfilename, toolData.toolcallid));
};
@ -328,7 +332,10 @@ const AIToolUse = memo(({ part, isStreaming }: AIToolUseProps) => {
toolData.runts &&
Date.now() - toolData.runts < BackupRetentionDays * 24 * 60 * 60 * 1000 && (
<button
onClick={() => model.openRestoreBackupModal(toolData.toolcallid)}
onClick={() => {
recordTEvent("waveai:revertfile", { "waveai:action": "revertfile:open" });
model.openRestoreBackupModal(toolData.toolcallid);
}}
className="flex-shrink-0 px-1.5 py-0.5 border border-gray-600 hover:border-gray-500 hover:bg-gray-700 rounded cursor-pointer transition-colors flex items-center gap-1 text-gray-400"
title="Restore backup file"
>

View file

@ -1146,6 +1146,7 @@ declare global {
"waveai:requestdurms"?: number;
"waveai:widgetaccess"?: boolean;
"waveai:feedback"?: "good" | "bad";
"waveai:action"?: string;
$set?: TEventUserProps;
$set_once?: TEventUserProps;
};

View file

@ -14,28 +14,36 @@ import (
)
var ValidEventNames = map[string]bool{
"app:startup": true,
"app:shutdown": true,
"app:activity": true,
"app:display": true,
"app:counts": true,
"action:magnify": true,
"action:settabtheme": true,
"action:runaicmd": true,
"action:createtab": true,
"action:createblock": true,
"action:openwaveai": true,
"wsh:run": true,
"debug:panic": true,
"conn:connect": true,
"conn:connecterror": true,
"app:startup": true,
"app:shutdown": true,
"app:activity": true,
"app:display": true,
"app:counts": true,
"action:magnify": true,
"action:settabtheme": true,
"action:runaicmd": true,
"action:createtab": true,
"action:createblock": true,
"action:openwaveai": true,
"wsh:run": true,
"debug:panic": true,
"conn:connect": true,
"conn:connecterror": true,
"waveai:enabletelemetry": true,
"waveai:post": true,
"waveai:feedback": true,
"onboarding:start": true,
"onboarding:skip": true,
"onboarding:fire": true,
"onboarding:githubstar": true,
"waveai:showdiff": true,
"waveai:revertfile": true,
"onboarding:start": true,
"onboarding:skip": true,
"onboarding:fire": true,
"onboarding:githubstar": true,
}
type TEvent struct {
@ -137,6 +145,7 @@ type TEventProps struct {
WaveAIRequestDurMs int `json:"waveai:requestdurms,omitempty"` // ms
WaveAIWidgetAccess bool `json:"waveai:widgetaccess,omitempty"`
WaveAIFeedback string `json:"waveai:feedback,omitempty" tstype:"\"good\" | \"bad\""`
WaveAIAction string `json:"waveai:action,omitempty"`
UserSet *TEventUserProps `json:"$set,omitempty"`
UserSetOnce *TEventUserProps `json:"$set_once,omitempty"`