78 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Go
		
	
	
	
| /*
 | |
|  * Copyright 2025 coze-dev Authors
 | |
|  *
 | |
|  * Licensed under the Apache License, Version 2.0 (the "License");
 | |
|  * you may not use this file except in compliance with the License.
 | |
|  * You may obtain a copy of the License at
 | |
|  *
 | |
|  *     http://www.apache.org/licenses/LICENSE-2.0
 | |
|  *
 | |
|  * Unless required by applicable law or agreed to in writing, software
 | |
|  * distributed under the License is distributed on an "AS IS" BASIS,
 | |
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
|  * See the License for the specific language governing permissions and
 | |
|  * limitations under the License.
 | |
|  */
 | |
| 
 | |
| package crossworkflow
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	einoCompose "github.com/cloudwego/eino/compose"
 | |
| 
 | |
| 	"github.com/coze-dev/coze-studio/backend/domain/workflow"
 | |
| 	workflowEntity "github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
 | |
| 	"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
 | |
| )
 | |
| 
 | |
| // TODO(@fanlv): 参数引用需要修改。
 | |
| type Workflow interface {
 | |
| 	WorkflowAsModelTool(ctx context.Context, policies []*vo.GetPolicy) ([]workflow.ToolFromWorkflow, error)
 | |
| 	DeleteWorkflow(ctx context.Context, id int64) error
 | |
| 	PublishWorkflow(ctx context.Context, info *vo.PublishPolicy) (err error)
 | |
| 	WithResumeToolWorkflow(resumingEvent *workflowEntity.ToolInterruptEvent, resumeData string,
 | |
| 		allInterruptEvents map[string]*workflowEntity.ToolInterruptEvent) einoCompose.Option
 | |
| 	ReleaseApplicationWorkflows(ctx context.Context, appID int64, config *ReleaseWorkflowConfig) ([]*vo.ValidateIssue, error)
 | |
| 	GetWorkflowIDsByAppID(ctx context.Context, appID int64) ([]int64, error)
 | |
| 	SyncExecuteWorkflow(ctx context.Context, config vo.ExecuteConfig, input map[string]any) (*workflowEntity.WorkflowExecution, vo.TerminatePlan, error)
 | |
| 	WithExecuteConfig(cfg vo.ExecuteConfig) einoCompose.Option
 | |
| }
 | |
| 
 | |
| type ExecuteConfig = vo.ExecuteConfig
 | |
| type ExecuteMode = vo.ExecuteMode
 | |
| 
 | |
| const (
 | |
| 	ExecuteModeDebug     ExecuteMode = "debug"
 | |
| 	ExecuteModeRelease   ExecuteMode = "release"
 | |
| 	ExecuteModeNodeDebug ExecuteMode = "node_debug"
 | |
| )
 | |
| 
 | |
| type TaskType = vo.TaskType
 | |
| 
 | |
| const (
 | |
| 	TaskTypeForeground TaskType = "foreground"
 | |
| 	TaskTypeBackground TaskType = "background"
 | |
| )
 | |
| 
 | |
| type BizType = vo.BizType
 | |
| 
 | |
| const (
 | |
| 	BizTypeAgent    BizType = "agent"
 | |
| 	BizTypeWorkflow BizType = "workflow"
 | |
| )
 | |
| 
 | |
| type ReleaseWorkflowConfig = vo.ReleaseWorkflowConfig
 | |
| 
 | |
| type ToolInterruptEvent = workflowEntity.ToolInterruptEvent
 | |
| 
 | |
| var defaultSVC Workflow
 | |
| 
 | |
| func DefaultSVC() Workflow {
 | |
| 	return defaultSVC
 | |
| }
 | |
| 
 | |
| func SetDefaultSVC(svc Workflow) {
 | |
| 	defaultSVC = svc
 | |
| }
 |