mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-28 16:00:18 +00:00
* feat(mcp): add Panel MCP task configuration and website binding structures * fix(mcp): correct variable assignment in mcpWebsiteDomain function
29 lines
761 B
Go
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} }
|