component

package
v0.0.0-...-85a5006 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvaluationRecordProviderConfig

type EvaluationRecordProviderConfig struct {
	Provider string `mapstructure:"provider" json:"provider"` // RDS, S3 等
	MaxSize  int64  `mapstructure:"max_size" json:"max_size"`
}

EvaluationRecordProviderConfig 单个存储 Provider 配置

type EvaluationRecordStorage

type EvaluationRecordStorage struct {
	Providers []*EvaluationRecordProviderConfig `mapstructure:"providers"`
}

EvaluationRecordStorage 评测记录大对象存储配置,与 dataset 模块的 dataset_item_storage 语义一致

type IConfiger

type IConfiger interface {
	GetEvaluationRecordStorage(ctx context.Context) *EvaluationRecordStorage
	GetConsumerConf(ctx context.Context) *entity.ExptConsumerConf
	GetErrCtrl(ctx context.Context) *entity.ExptErrCtrl
	GetExptExecConf(ctx context.Context, spaceID int64) *entity.ExptExecConf
	// GetEvalAsyncCtxTTL 返回 invoke_id → EvalAsyncCtx 的 Redis TTL。
	// 未显式配 eval_async_ctx_ttl_second 时按该空间的 async_zombie_second 推导,
	// 保证 ctx 始终活得比行僵尸判定久。spaceID 为 0(调试等无空间上下文场景)时取全局默认。
	GetEvalAsyncCtxTTL(ctx context.Context, spaceID int64) time.Duration
	GetErrRetryConf(ctx context.Context, spaceID int64, err error) *entity.RetryConf
	GetExptTurnResultFilterBmqProducerCfg(ctx context.Context) *entity.BmqProducerCfg
	GetCKDBName(ctx context.Context) *entity.CKDBConfig
	GetExptExportWhiteList(ctx context.Context) *entity.ExptExportWhiteList
	GetMaintainerUserIDs(ctx context.Context) map[string]bool
	GetSchedulerAbortCtrl(ctx context.Context) *entity.SchedulerAbortCtrl
	GetTargetTrajectoryConf(ctx context.Context) *entity.TargetTrajectoryConf
	GetExptTemplateUpdateEvalSetWhiteList(ctx context.Context) *entity.ExptTemplateUpdateEvalSetWhiteList
	GetExptMultiSetWhiteList(ctx context.Context) *entity.ExptMultiSetWhiteList
	GetExptTurnScoreHookConf(ctx context.Context, spaceID, exptID int64, evaluatorRefs []*entity.ExptEvaluatorVersionRef) (*entity.ExptTurnScoreHookConf, bool)
	// GetSandboxAgentNotifyConf 沙箱 agent 通知配置(进度卡间隔等)。返回 nil 表示读取失败,
	// 上层应回落到 entity.DefaultSandboxAgentNotifyConf。
	GetSandboxAgentNotifyConf(ctx context.Context) *entity.SandboxAgentNotifyConf
	// BuildEvalExt 构造评测记录(EvaluatorRecord/EvalTargetRecord/ExptTurnResultRunLog)落库时的 ext 扩展字段。
	// turn 为评测集中的轮次数据(部分调用点不可用时为 nil),spaceID 为空间 id。默认空实现返回 nil。
	BuildEvalExt(ctx context.Context, spaceID int64, turn *entity.Turn) map[string]string
	// GetCrossSpaceRecordReadEnforce 跨空间读取评估记录且未命中共享白名单时是否拒绝。
	// 未配置默认 false:只告警放行,用于观察存量调用后再收紧。
	GetCrossSpaceRecordReadEnforce(ctx context.Context) bool
}

type IItemCompletePublisher

type IItemCompletePublisher interface {
	PublishItemComplete(ctx context.Context, event *ItemCompleteEvent) error
}

type IRuntime

type IRuntime interface {
	// RunCode 在沙箱中执行文本格式的代码
	RunCode(ctx context.Context, code, language string, timeoutMS int64, ext map[string]string) (*entity.ExecutionResult, error)
	// GetLanguageType 获取支持的语言类型
	GetLanguageType() entity.LanguageType
	// GetReturnValFunction 获取语言特定的return_val函数实现
	GetReturnValFunction() string
}

IRuntime 代码执行沙箱接口

type IRuntimeFactory

type IRuntimeFactory interface {
	// CreateRuntime 根据语言类型创建Runtime实例
	CreateRuntime(languageType entity.LanguageType) (IRuntime, error)
	// GetSupportedLanguages 获取支持的语言类型列表
	GetSupportedLanguages() []entity.LanguageType
}

IRuntimeFactory Runtime工厂接口

type IRuntimeManager

type IRuntimeManager interface {
	// GetRuntime 获取指定语言类型的Runtime实例
	GetRuntime(languageType entity.LanguageType) (IRuntime, error)
	// GetSupportedLanguages 获取支持的语言类型列表
	GetSupportedLanguages() []entity.LanguageType
	// ClearCache 清空缓存
	ClearCache()
}

IRuntimeManager Runtime管理器接口

type IURLProcessor

type IURLProcessor interface {
	// ProcessSignURL 处理签名 URL,包括 URL 解码和本地主机处理
	ProcessSignURL(ctx context.Context, signURL string) string
}

type ItemCompleteEvent

type ItemCompleteEvent struct {
	EvalTargetWorkspaceID string `json:"eval_target_workspace_id"` // 评测对象所在空间
	EvalTargetID          string `json:"eval_target_id"`           // 评测对象 ID(应用注册的 ID)
	SourceTargetID        string `json:"source_target_id"`         // 评测对象对应的业务侧原始对象 ID(EvalTarget.SourceTargetID),为空则空
	ExptWorkspaceID       string `json:"expt_workspace_id"`        // 实验发起的空间
	ExptID                string `json:"expt_id"`                  // 实验 ID
	ExptRunID             string `json:"expt_run_id"`              // 实验单次执行的 ID
	DatasetWorkspaceID    string `json:"dataset_workspace_id"`     // 数据集所在空间
	DatasetID             string `json:"dataset_id"`               // 数据集 ID
	DatasetVersionID      string `json:"dataset_version_id"`       // 数据集版本 ID
	DatasetKey            string `json:"dataset_key"`              // 数据集唯一 Key(预期不可修改)
	DatasetVersionName    string `json:"dataset_version_name"`     // 数据集版本名字,如 0.0.1
	ExperimentGroupKey    string `json:"experiment_group_key"`     // 实验组 Key(关联同组实验),默认为实验 ID,空间内唯一
	ItemID                string `json:"item_id"`                  // 数据集某一行的 ID
	ItemKey               string `json:"item_key"`                 // 评测集 item 的实体 ItemKey(下游 data 服务写入);直接透传,为空则空、不降级
	// EnableAnalysis 评测对象是否开启分析,来源 eval_target 的 SandboxAgent.EnableAnalysis。
	// 商业化侧 producer 据此与 TCC 空间白名单 AND,决定是否发送本事件。
	EnableAnalysis bool `json:"enable_analysis"`
	// CreatedBy 实验创建人 userID,来源 experiment.created_by(实验级恒定)。
	CreatedBy string `json:"created_by"`
}

ItemCompleteEvent 单行评测完成事件,供离线分析侧消费后回查完整数据。 ID 均以 string 传输,避免下游 JSON 解析丢精度。

type SharedResourceConfigProvider

type SharedResourceConfigProvider interface {
	// GetSharedResourceConfig 返回当前全量共享资源配置的标准模型。
	// 返回 nil 或空配置时,上层视为「无任何共享」并 fail-closed。
	GetSharedResourceConfig(ctx context.Context) (*entity.SharedResourceConfig, error)
}

SharedResourceConfigProvider 跨空间共享资源配置提供者。

该接口屏蔽底层配置存储(OSS 走本地配置/默认空实现,商业版走 TCC 等动态配置)的差异, 只对外暴露「标准共享配置模型」。授权判定(某来源空间是否把某资源共享给某调用方、访问级别、 版本策略)全部由上层基于返回的 entity.SharedResourceConfig.Lookup 完成。

安全默认:当无法获取到有效配置(返回 nil/空配置或 error)时,上层按 fail-closed 处理, 即拒绝一切跨空间共享读取。纯 OSS 环境默认即全拒,真正生效需商业版接入动态配置。

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
rpc
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL