{"modulePath":"github.com/xmapst/taskflow","version":"v0.0.0-20261127030116-2fa33bcfeb3e","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package execution\n\n## Types\n\n```go\ntype Handler struct{}\n```\nHandler implements task and step HTTP endpoints.\n\n```go\nfunc (*Handler) ApprovalCallback(w http.ResponseWriter, r *http.Request)\n```\nApprovalCallback validates the wire format and publishes a decision. Only the subscribed runner can decide whether it applies to its invocation. @Summary 接收外部审批结果 @Description 校验消息格式后通过进程内 RPC 转交审批决策。204 不表示审批已采纳。 @Tags 审批 @Accept json @Param decision body iproto.ApprovalDecision true \"审批结果\" @Success 204 \"无响应体\" @Failure 400 \"回调格式错误\" @Failure 503 \"审批服务不可用\" @Router /api/v1/approval/callback \\[post] @Router /api/v1/approval/callback \\[put]\n\n```go\nfunc (h *Handler) CreateTask(w http.ResponseWriter, r *http.Request)\n```\nCreateTask 校验并提交任务定义。 @Summary\t\t创建 @Description\tJSON/YAML 请求体为任务对象；时长字段支持 Go 时长字符串（如 2m）或整数纳秒。Swagger 2.0 的时长 schema 展示整数形式。 @Tags\t\t任务 @Accept\t\tapplication/json,application/yaml @Produce\t\tapplication/json,application/yaml @Param\t\ttask body iproto.STaskReq true \"任务内容\" @Success\t\t200 {object} api.Response\\[iproto.STaskCreateRes] @Router\t\t/api/v1/task \\[post]\n\n```go\nfunc (h *Handler) DeleteTask(w http.ResponseWriter, r *http.Request)\n```\nDeleteTask 删除指定任务。 @Summary\t\t删除 @Description\t删除指定任务 @Tags\t\t任务 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Success\t\t200 {object} api.Response\\[any] @Router\t\t/api/v1/task/{task} \\[delete]\n\n```go\nfunc (h *Handler) DumpTask(w http.ResponseWriter, r *http.Request)\n```\nDumpTask 导出可重新提交的任务定义。 @Summary\t\t导出 @Description\t导出任务 @Tags\t\t任务 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Success\t\t200 {object} api.Response\\[string] \"data 字段为 YAML 字符串\" @Router\t\t/api/v1/task/{task}/dump \\[get]\n\n```go\nfunc (h *Handler) GetStep(w http.ResponseWriter, r *http.Request)\n```\nGetStep 返回指定步骤的详情。 @Summary\t\t详情 @Description\t获取步骤详情；实时订阅走 /api/v1/ws 的 step 主题 @Tags\t\t步骤 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Param\t\tstep path string true \"步骤名称\" @Success\t\t200 {object} api.Response\\[iproto.SStepRes] @Router\t\t/api/v1/task/{task}/step/{step} \\[get]\n\n```go\nfunc (h *Handler) GetStepLog(w http.ResponseWriter, r *http.Request)\n```\nGetStepLog 返回指定步骤的日志快照。 @Summary\t\t日志 @Description\t指定任务指定步骤的执行输出；实时候选订阅走 /api/v1/ws 的 step-log 主题 @Tags\t\t步骤 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Param\t\tstep path string true \"步骤名称\" @Success\t\t200 {object} api.Response\\[iproto.SStepLogsRes] @Router\t\t/api/v1/task/{task}/step/{step}/log \\[get]\n\n```go\nfunc (h *Handler) GetTask(w http.ResponseWriter, r *http.Request)\n```\nGetTask 返回指定任务的详情。 @Summary\t\t详情 @Description\t获取任务详情；实时订阅走 /api/v1/ws 的 task 主题 @Tags\t\t任务 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Success\t\t200 {object} api.Response\\[iproto.STaskRes] @Router\t\t/api/v1/task/{task} \\[get]\n\n```go\nfunc (h *Handler) ListSteps(w http.ResponseWriter, r *http.Request)\n```\nListSteps 返回任务的步骤列表。 @Summary\t\t列表 @Description\t获取指定任务的步骤列表；实时列表订阅走 /api/v1/ws 的 steps 主题 @Tags\t\t步骤 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Success\t\t200 {object} api.Response\\[iproto.SStepsRes] @Router\t\t/api/v1/task/{task}/step \\[get]\n\n```go\nfunc (h *Handler) ListTasks(w http.ResponseWriter, r *http.Request)\n```\nListTasks 分页列出任务。 @Summary\t\t列表 @Description\t获取任务列表；实时列表订阅走 /api/v1/ws 的 tasks 主题 @Tags\t\t任务 @Produce\t\tapplication/json,application/yaml @Param\t\tpage query int false \"页码，-1 为不分页\" default(1) @Param\t\tsize query int false \"每页任务数\" default(15) @Param prefix query string false \"任务名前缀\" @Success\t\t200 {object} api.Response\\[iproto.STaskListDetailRes] @Router\t\t/api/v1/task \\[get]\n\n```go\nfunc (h *Handler) ManageStep(w http.ResponseWriter, r *http.Request)\n```\nManageStep 向运行中的任务发送步骤控制指令。 @Summary\t\t管理 @Description\t管理指定任务的指定步骤, 支持暂停、恢复、终止、超时暂停自动恢复 @Tags\t\t步骤 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Param\t\tstep path string true \"步骤名称\" @Param\t\taction query string true \"操作\" Enums(kill,pause,resume) @Param\t\tduration query string false \"pause 时的 Go 时长（如 30s），-1 表示手动恢复\" default(-1) @Success\t\t200 {object} api.Response\\[any] @Router\t\t/api/v1/task/{task}/step/{step} \\[put]\n\n```go\nfunc (h *Handler) ManageTask(w http.ResponseWriter, r *http.Request)\n```\nManageTask 向指定任务发送控制指令。 @Summary\t\t管理 @Description\t管理任务, 支持暂停、恢复、终止、超时暂停自动恢复 @Tags\t\t任务 @Produce\t\tapplication/json,application/yaml @Param\t\ttask path string true \"任务名称\" @Param\t\taction query string true \"操作\" Enums(kill,pause,resume) @Param\t\tduration query string false \"pause 时的 Go 时长（如 30s），-1 表示手动恢复\" default(-1) @Success\t\t200 {object} api.Response\\[any] @Router\t\t/api/v1/task/{task} \\[put]\n\n```go\nfunc (h *Handler) RegisterStream(reg *httpx.StreamRegistry)\n```\nRegisterStream wires the task topics and calls into the shared WebSocket connection.\n\n","path":"github.com/xmapst/taskflow/internal/server/handler/execution","name":"execution","synopsis":"","isRedistributable":true}
