feat(agent): 云端 Agent - 增加上下文预算、任务事实与终态恢复保障

This commit is contained in:
ddCat
2026-09-19 20:43:20 +08:00
parent 3bf21d79af
commit b52bc9d5f2
61 changed files with 3512 additions and 309 deletions

View File

@@ -11,7 +11,7 @@ import (
"gorm.io/gorm"
)
const CurrentSchemaVersion int64 = 27
const CurrentSchemaVersion int64 = 29
const baselineSchemaChecksum = "sha256:open-ai-canvas-schema-v1-20260830"
const schemaMigrationAppliedAtIndexChecksum = "sha256:schema-migrations-applied-at-index-v2-20260830"
@@ -93,6 +93,12 @@ var schemaMigrations = []migration{
{version: 25, name: "video_token_formula_snapshot", checksum: "sha256:video-token-formula-snapshot-v25", apply: migrateVideoTokenFormulaSnapshot},
{version: 26, name: "channel_model_description", checksum: "sha256:channel-model-description-v26", apply: migrateChannelModelDescription},
{version: 27, name: "channel_credit_cost", checksum: "sha256:channel-credit-cost-v27", apply: migrateChannelCreditCost},
{version: 28, name: "agent_execution_journal", checksum: "sha256:agent-execution-journal-v28", apply: func(tx *gorm.DB) error {
return tx.AutoMigrate(&model.CloudAgentExecution{}, &model.CloudAgentEventRecord{}, &model.CloudAgentMessageRecord{}, &model.Task{}, &model.BillingOrder{})
}},
{version: 29, name: "agent_resource_leases", checksum: "sha256:agent-resource-leases-v29-20260919", apply: func(tx *gorm.DB) error {
return tx.AutoMigrate(&model.CloudAgentResourceLease{})
}},
}
func migrateChannelCreditCost(tx *gorm.DB) error {

View File

@@ -17,7 +17,10 @@ import (
func Models() []any {
return []any{
&model.CloudAgentExecution{},
&model.CloudAgentEventRecord{},
&model.CloudAgentMessageRecord{},
&model.CloudAgentCanvasMutation{},
&model.CloudAgentResourceLease{},
&model.AgentProfile{},
&model.AgentLesson{},
&model.AgentMemorySetting{},