Files
1Panel/core/utils/mcpruntime/progress.go
T
蘭 d32cbb40f6 feat(mcp): add Panel MCP task configuration and website binding structures (#14229)
* feat(mcp): add Panel MCP task configuration and website binding structures

* fix(mcp): correct variable assignment in mcpWebsiteDomain function
2026-10-28 14:04:38 +08:00

29 lines
761 B
Go

package mcpruntime
import "context"
type Progress struct {
Status string `json:"status,omitempty"`
ID string `json:"id,omitempty"`
Current int64 `json:"current,omitempty"`
Total int64 `json:"total,omitempty"`
}
type progressContextKey struct{}
func WithProgress(ctx context.Context, report func(Progress)) context.Context {
return context.WithValue(ctx, progressContextKey{}, report)
}
func ReportProgress(ctx context.Context, progress Progress) {
if report, ok := ctx.Value(progressContextKey{}).(func(Progress)); ok {
report(progress)
}
}
type OperationError struct{ message string }
func (e *OperationError) Error() string { return e.message }
func operationError(message string) error { return &OperationError{message: message} }