Version: 0.9.59.dev.260430
后端: 1. 主动调度预览确认主链路落地——新增主动调度数据模型、DAO 与事件契约;接入 dry-run pipeline 与任务触发的 job upsert/cancel;新增 preview 查询与 confirm API,支持 apply_id 幂等确认并同步写入 task_pool 日程 2. 同步更新主动调度实施文档的阶段状态与验收记录 前端: 3. AssistantPanel 脚本层继续解耦——私有类型迁移到独立类型文件,并抽离会话、工具轨迹、思考摘要、任务表单等纯函数辅助逻辑;保持助手面板模板与样式不变,降低表现层回归风险
This commit is contained in:
94
backend/active_scheduler/context/context.go
Normal file
94
backend/active_scheduler/context/context.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package schedulercontext
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/LoveLosita/smartflow/backend/active_scheduler/ports"
|
||||
"github.com/LoveLosita/smartflow/backend/active_scheduler/trigger"
|
||||
)
|
||||
|
||||
const (
|
||||
WindowReasonRolling24H = "rolling_24h"
|
||||
)
|
||||
|
||||
// ActiveScheduleContext 是主动调度 dry-run 的只读事实快照。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 负责承载 BuildContext 阶段聚合出的事实;
|
||||
// 2. 不包含 DAO、service 或 provider 实例;
|
||||
// 3. 不负责生成候选,也不负责写 preview、通知或正式日程。
|
||||
type ActiveScheduleContext struct {
|
||||
Trigger trigger.ActiveScheduleTrigger
|
||||
User UserFacts
|
||||
Now NowFacts
|
||||
Window WindowFacts
|
||||
Target TargetFacts
|
||||
TaskPoolFacts TaskPoolFacts
|
||||
ScheduleFacts ScheduleFacts
|
||||
FeedbackFacts FeedbackFacts
|
||||
DerivedFacts DerivedFacts
|
||||
Trace TraceFacts
|
||||
}
|
||||
|
||||
type UserFacts struct {
|
||||
UserID int
|
||||
Timezone string
|
||||
}
|
||||
|
||||
type NowFacts struct {
|
||||
RealNow time.Time
|
||||
EffectiveNow time.Time
|
||||
}
|
||||
|
||||
type WindowFacts struct {
|
||||
StartAt time.Time
|
||||
EndAt time.Time
|
||||
RelativeSlots []ports.Slot
|
||||
WindowReason string
|
||||
}
|
||||
|
||||
type TargetFacts struct {
|
||||
SourceType trigger.TargetType
|
||||
TaskID int
|
||||
ScheduleEventID int
|
||||
TaskItemID int
|
||||
Title string
|
||||
EstimatedSections int
|
||||
DeadlineAt *time.Time
|
||||
UrgencyThresholdAt *time.Time
|
||||
Priority int
|
||||
Status string
|
||||
}
|
||||
|
||||
type TaskPoolFacts struct {
|
||||
TargetTask *ports.TaskFact
|
||||
}
|
||||
|
||||
type ScheduleFacts struct {
|
||||
Events []ports.ScheduleEventFact
|
||||
OccupiedSlots []ports.Slot
|
||||
FreeSlots []ports.Slot
|
||||
NextDynamicTask *ports.ScheduleEventFact
|
||||
}
|
||||
|
||||
type FeedbackFacts struct {
|
||||
FeedbackID string
|
||||
FeedbackText string
|
||||
FeedbackTarget string
|
||||
TargetKnown bool
|
||||
TargetEventID int
|
||||
TargetTaskItemID int
|
||||
}
|
||||
|
||||
type DerivedFacts struct {
|
||||
TargetAlreadyScheduled bool
|
||||
TargetCompleted bool
|
||||
AvailableCapacity int
|
||||
MissingInfo []string
|
||||
}
|
||||
|
||||
type TraceFacts struct {
|
||||
TraceID string
|
||||
BuildSteps []string
|
||||
Warnings []string
|
||||
}
|
||||
Reference in New Issue
Block a user