feat: add durable Worker execution and WSS server

This commit is contained in:
2026-09-17 08:22:24 +08:00
parent 9701b7a071
commit cd0dc7011b
31 changed files with 3007 additions and 16 deletions

View File

@@ -0,0 +1,25 @@
package model
import core "git.yuntuo.hk/k2safe/orbit/model"
// AttemptEvidence 保留迟到或冲突结果,作为核查证据;保存证据不会改写任务结果。
type AttemptEvidence struct {
// Record 包含命名空间、证据标识、并发版本与首次收到时间。
core.Record
// AttemptID 证据所属尝试,提交者仍需证明原执行秘密与进程身份。
AttemptID core.ID `db:"attempt_id"`
// MessageID 稳定结果消息标识,用于同一证据重报去重。
MessageID core.ID `db:"message_id"`
// Outcome Worker 报告的结果分类,不代表平台认可为任务终态。
Outcome string `db:"outcome"`
// ErrorCode 可选稳定错误分类;无错误分类时为空。
ErrorCode *string `db:"error_code"`
// Payload 结果或证据引用 JSON 文本,保留数字精度。
Payload core.JSON `db:"payload"`
// RequestDigest 结果语义摘要,排除会话身份与原始秘密。
RequestDigest core.Digest `db:"request_digest"`
// Reason 未用于更新权威状态的原因,例如授权失效或与已保存结果冲突。
Reason string `db:"reason"`
}
func (AttemptEvidence) TableName() string { return "pulse_attempt_evidence" }