MCPcopy
hub / github.com/wavetermdev/waveterm / WshActivityCommand

Method WshActivityCommand

pkg/wshrpc/wshserver/wshserver.go:1316–1347  ·  view source on GitHub ↗
(ctx context.Context, data map[string]int)

Source from the content-addressed store, hash-verified

1314var wshActivityRe = regexp.MustCompile(`^[a-z:#]+$`)
1315
1316func (ws *WshServer) WshActivityCommand(ctx context.Context, data map[string]int) error {
1317 if len(data) == 0 {
1318 return nil
1319 }
1320 props := telemetrydata.TEventProps{}
1321 for key, value := range data {
1322 if len(key) > 20 {
1323 delete(data, key)
1324 }
1325 if !wshActivityRe.MatchString(key) {
1326 delete(data, key)
1327 }
1328 if value != 1 {
1329 delete(data, key)
1330 }
1331 if strings.HasSuffix(key, "#error") {
1332 props.WshCmd = strings.TrimSuffix(key, "#error")
1333 props.WshErrorCount = 1
1334 } else {
1335 props.WshCmd = key
1336 }
1337 }
1338 activityUpdate := wshrpc.ActivityUpdate{
1339 WshCmds: data,
1340 }
1341 telemetry.GoUpdateActivityWrap(activityUpdate, "wsh-activity")
1342 telemetry.GoRecordTEventWrap(&telemetrydata.TEvent{
1343 Event: telemetry.WshRunEventName,
1344 Props: props,
1345 })
1346 return nil
1347}
1348
1349func (ws *WshServer) ActivityCommand(ctx context.Context, activity wshrpc.ActivityUpdate) error {
1350 telemetry.GoUpdateActivityWrap(activity, "wshrpc-activity")

Callers

nothing calls this directly

Calls 2

GoUpdateActivityWrapFunction · 0.92
GoRecordTEventWrapFunction · 0.92

Tested by

no test coverage detected