Version: 0.9.75.dev.260505
后端: 1.收口阶段 6 agent 结构迁移,将 newAgent 内核与 agentsvc 编排层迁入 services/agent - 切换 Agent 启动装配与 HTTP handler 直连 agent sv,移除旧 service agent bridge - 补齐 Agent 对 memory、task、task-class、schedule 的 RPC 适配与契约字段 - 扩展 schedule、task、task-class RPC/contract 支撑 Agent 查询、写入与 provider 切流 - 更新迁移文档、README 与相关注释,明确 agent 当前切流点和剩余 memory 迁移面
This commit is contained in:
@@ -55,6 +55,63 @@ type SmartPlanningMultiRequest struct {
|
||||
TaskClassIDs []int `json:"task_class_ids"`
|
||||
}
|
||||
|
||||
// AgentScheduleWeekRequest 是 agent schedule provider 按周读取原始日程槽位的契约。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只按 user_id + week 读取已经落库的 schedule/schedule_event 事实;
|
||||
// 2. 不走前端周课表 DTO,避免丢失 embedded_task_id / can_be_embedded 等编排语义;
|
||||
// 3. 该契约只服务 agent 内部状态加载,不改变现有 HTTP 周课表响应。
|
||||
type AgentScheduleWeekRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
Week int `json:"week"`
|
||||
}
|
||||
|
||||
type AgentScheduleWeekResponse struct {
|
||||
Schedules []AgentScheduleSlot `json:"schedules"`
|
||||
}
|
||||
|
||||
type AgentScheduleSlot struct {
|
||||
ID int `json:"id"`
|
||||
EventID int `json:"event_id"`
|
||||
UserID int `json:"user_id"`
|
||||
Week int `json:"week"`
|
||||
DayOfWeek int `json:"day_of_week"`
|
||||
Section int `json:"section"`
|
||||
EmbeddedTaskID *int `json:"embedded_task_id,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Event *AgentScheduleEvent `json:"event,omitempty"`
|
||||
EmbeddedTask *AgentScheduleTaskItem `json:"embedded_task,omitempty"`
|
||||
}
|
||||
|
||||
type AgentScheduleEvent struct {
|
||||
ID int `json:"id"`
|
||||
UserID int `json:"user_id"`
|
||||
Name string `json:"name"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Type string `json:"type"`
|
||||
RelID *int `json:"rel_id,omitempty"`
|
||||
TaskSourceType string `json:"task_source_type,omitempty"`
|
||||
CanBeEmbedded bool `json:"can_be_embedded"`
|
||||
StartTime time.Time `json:"start_time,omitempty"`
|
||||
EndTime time.Time `json:"end_time,omitempty"`
|
||||
}
|
||||
|
||||
type AgentScheduleTaskItem struct {
|
||||
ID int `json:"id"`
|
||||
CategoryID *int `json:"category_id,omitempty"`
|
||||
Order *int `json:"order,omitempty"`
|
||||
Content string `json:"content"`
|
||||
EmbeddedTime *AgentScheduleTargetTime `json:"embedded_time,omitempty"`
|
||||
Status *int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type AgentScheduleTargetTime struct {
|
||||
Week int `json:"week"`
|
||||
DayOfWeek int `json:"day_of_week"`
|
||||
SectionFrom int `json:"section_from"`
|
||||
SectionTo int `json:"section_to"`
|
||||
}
|
||||
|
||||
// Slot 是跨进程表达日程原子节次的稳定契约。
|
||||
type Slot struct {
|
||||
Week int `json:"week"`
|
||||
|
||||
@@ -9,11 +9,28 @@ import "time"
|
||||
// 2. 不承载 HTTP token、幂等键或缓存语义;
|
||||
// 3. 业务校验仍由 task 服务内部完成。
|
||||
type AddTaskRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
UserID int `json:"user_id"`
|
||||
Title string `json:"title"`
|
||||
PriorityGroup int `json:"priority_group"`
|
||||
EstimatedSections int `json:"estimated_sections"`
|
||||
DeadlineAt *time.Time `json:"deadline_at"`
|
||||
UrgencyThresholdAt *time.Time `json:"urgency_threshold_at"`
|
||||
}
|
||||
|
||||
// AddTaskResponse 是 task 服务新增任务后的稳定响应契约。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只承载调用方需要的任务基础快照,不暴露 DAO / GORM 模型;
|
||||
// 2. CP4 agent 快捷任务只消费 ID,但保留完整字段以匹配既有 HTTP 响应语义;
|
||||
// 3. UrgencyThresholdAt 暂不回显,新增链路只要求写入语义不丢。
|
||||
type AddTaskResponse struct {
|
||||
ID int `json:"id"`
|
||||
Title string `json:"title"`
|
||||
PriorityGroup int `json:"priority_group"`
|
||||
EstimatedSections int `json:"estimated_sections"`
|
||||
DeadlineAt *time.Time `json:"deadline_at"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type UserRequest struct {
|
||||
@@ -49,6 +66,24 @@ type BatchTaskStatusRequest struct {
|
||||
IDs []int `json:"ids"`
|
||||
}
|
||||
|
||||
// TaskListItem 是 task 列表读取返回给跨进程调用方的轻量任务视图。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 字段形状保持 `/api/v1/task/get` 既有响应,便于 gateway 继续 JSON 透传;
|
||||
// 2. agent 快捷查询只基于这些字段做本地过滤、排序和文案渲染;
|
||||
// 3. Deadline / UrgencyThresholdAt 仍沿用历史字符串格式,避免 CP4 改动前端响应契约。
|
||||
type TaskListItem struct {
|
||||
ID int `json:"id"`
|
||||
UserID int `json:"user_id"`
|
||||
Title string `json:"title"`
|
||||
PriorityGroup int `json:"priority_group"`
|
||||
EstimatedSections int `json:"estimated_sections"`
|
||||
Status string `json:"status"`
|
||||
Deadline string `json:"deadline"`
|
||||
IsCompleted bool `json:"is_completed"`
|
||||
UrgencyThresholdAt string `json:"urgency_threshold_at,omitempty"`
|
||||
}
|
||||
|
||||
type TaskFactRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
TaskID int `json:"task_id"`
|
||||
|
||||
@@ -43,6 +43,17 @@ type UpsertTaskClassItemConfig struct {
|
||||
EmbeddedTime *TargetTime `json:"embedded_time"`
|
||||
}
|
||||
|
||||
// UpsertTaskClassResponse 是 task-class 写入完成后的最小确认结果。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. 只返回 agent / gateway 后续编排需要的稳定主键和创建语义;
|
||||
// 2. 不回传完整任务类详情,避免写接口承担读取 DTO 责任;
|
||||
// 3. TaskClassID <= 0 视为服务端异常,由调用方按失败处理。
|
||||
type UpsertTaskClassResponse struct {
|
||||
TaskClassID int `json:"task_class_id"`
|
||||
Created bool `json:"created"`
|
||||
}
|
||||
|
||||
type UserRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
}
|
||||
@@ -52,6 +63,54 @@ type GetTaskClassRequest struct {
|
||||
TaskClassID int `json:"task_class_id"`
|
||||
}
|
||||
|
||||
// AgentTaskClassesRequest 是 agent schedule provider 读取完整任务类的契约。
|
||||
//
|
||||
// 职责边界:
|
||||
// 1. TaskClassIDs 为空表示读取该用户全部任务类,兼容全量日程状态加载;
|
||||
// 2. TaskClassIDs 非空表示按本轮排程范围读取,服务端仍按 user_id 做归属过滤;
|
||||
// 3. 该契约只服务 agent 内部编排,不改变前端 GetTaskClass 的响应形状。
|
||||
type AgentTaskClassesRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
TaskClassIDs []int `json:"task_class_ids,omitempty"`
|
||||
}
|
||||
|
||||
type AgentTaskClassesResponse struct {
|
||||
TaskClasses []AgentTaskClass `json:"task_classes"`
|
||||
}
|
||||
|
||||
// AgentTaskClass 是跨进程传给 agent provider 的任务类原始事实。
|
||||
//
|
||||
// 说明:
|
||||
// 1. 日期用 YYYY-MM-DD 字符串传输,避免跨服务 JSON 时区漂移;
|
||||
// 2. Items 保留 status / embedded_time,确保 LoadScheduleState 的 pending/existing 口径不变;
|
||||
// 3. 不携带 DAO / GORM 元信息,调用侧只还原内存模型。
|
||||
type AgentTaskClass struct {
|
||||
ID int `json:"id"`
|
||||
UserID int `json:"user_id"`
|
||||
Name string `json:"name"`
|
||||
Mode string `json:"mode"`
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
SubjectType string `json:"subject_type,omitempty"`
|
||||
DifficultyLevel string `json:"difficulty_level,omitempty"`
|
||||
CognitiveIntensity string `json:"cognitive_intensity,omitempty"`
|
||||
TotalSlots int `json:"total_slots"`
|
||||
AllowFillerCourse bool `json:"allow_filler_course"`
|
||||
Strategy string `json:"strategy"`
|
||||
ExcludedSlots []int `json:"excluded_slots,omitempty"`
|
||||
ExcludedDaysOfWeek []int `json:"excluded_days_of_week,omitempty"`
|
||||
Items []AgentTaskClassItem `json:"items,omitempty"`
|
||||
}
|
||||
|
||||
type AgentTaskClassItem struct {
|
||||
ID int `json:"id"`
|
||||
CategoryID *int `json:"category_id,omitempty"`
|
||||
Order *int `json:"order,omitempty"`
|
||||
Content string `json:"content"`
|
||||
EmbeddedTime *TargetTime `json:"embedded_time,omitempty"`
|
||||
Status *int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type InsertTaskClassItemIntoScheduleRequest struct {
|
||||
UserID int `json:"user_id"`
|
||||
TaskItemID int `json:"task_item_id"`
|
||||
|
||||
Reference in New Issue
Block a user