157 lines
4.8 KiB
Go
157 lines
4.8 KiB
Go
package continuity
|
|
|
|
import (
|
|
"git.cin.su/m/Assistant/contracts/authority"
|
|
"git.cin.su/m/Assistant/contracts/identity"
|
|
"git.cin.su/m/Assistant/contracts/work"
|
|
"git.cin.su/m/Assistant/platform/ids"
|
|
)
|
|
|
|
type CommitmentID ids.ID
|
|
type ProspectiveItemID ids.ID
|
|
type AttentionItemID ids.ID
|
|
type ProspectiveRevision uint64
|
|
type AttentionRevision uint64
|
|
type CommittedActionIntentID ids.ID
|
|
type CommittedAuthorizedActionID ids.ID
|
|
type CommittedActionAttemptID ids.ID
|
|
|
|
type ProspectiveState string
|
|
|
|
const (
|
|
ProspectiveRegistered ProspectiveState = "REGISTERED"
|
|
ProspectiveArmed ProspectiveState = "ARMED"
|
|
ProspectiveTriggered ProspectiveState = "TRIGGERED"
|
|
ProspectiveRevalidating ProspectiveState = "REVALIDATING"
|
|
ProspectiveDelivered ProspectiveState = "DELIVERED"
|
|
ProspectiveSatisfied ProspectiveState = "SATISFIED"
|
|
ProspectiveSuppressed ProspectiveState = "SUPPRESSED"
|
|
ProspectiveExpired ProspectiveState = "EXPIRED"
|
|
)
|
|
|
|
type AttentionLevel string
|
|
|
|
const (
|
|
AttentionUrgent AttentionLevel = "URGENT"
|
|
AttentionActionRequired AttentionLevel = "ACTION_REQUIRED"
|
|
AttentionDue AttentionLevel = "DUE"
|
|
AttentionImportantChange AttentionLevel = "IMPORTANT_CHANGE"
|
|
AttentionFYI AttentionLevel = "FYI"
|
|
AttentionBackground AttentionLevel = "BACKGROUND"
|
|
)
|
|
|
|
type AttentionState string
|
|
|
|
const (
|
|
AttentionPending AttentionState = "PENDING"
|
|
AttentionDelivering AttentionState = "DELIVERING"
|
|
AttentionDelivered AttentionState = "DELIVERED"
|
|
AttentionSuppressed AttentionState = "SUPPRESSED"
|
|
AttentionExpired AttentionState = "EXPIRED"
|
|
AttentionFailed AttentionState = "FAILED"
|
|
)
|
|
|
|
type AttentionSourceKind string
|
|
|
|
const (
|
|
AttentionSourceProspectiveReminder AttentionSourceKind = "PROSPECTIVE_REMINDER"
|
|
)
|
|
|
|
// ProspectiveItem is canonical future relevance. TriggerAtUnixMillis is an
|
|
// absolute instant; scheduling engines are derived delivery mechanisms only.
|
|
type ProspectiveItem struct {
|
|
ID ProspectiveItemID
|
|
CommitmentID CommitmentID
|
|
OwnerPrincipalID identity.PrincipalID
|
|
ScopeID authority.ScopeID
|
|
GoalID work.GoalID
|
|
SourceIntentID string
|
|
SourceUtteranceID string
|
|
Summary string
|
|
TriggerAtUnixMillis int64
|
|
State ProspectiveState
|
|
Revision ProspectiveRevision
|
|
}
|
|
|
|
type ScheduleReminderRequest struct {
|
|
OwnerPrincipalID identity.PrincipalID
|
|
ScopeID authority.ScopeID
|
|
SourceIntentID string
|
|
SourceUtteranceID string
|
|
Summary string
|
|
TriggerAtUnixMillis int64
|
|
RequestedAtUnixMillis int64
|
|
}
|
|
|
|
type ScheduleReminderResult struct {
|
|
Item ProspectiveItem
|
|
}
|
|
|
|
// AttentionItem is Continuity-owned human-facing relevance state. It can be
|
|
// rendered by UIs, but it is not a notification receipt and does not itself
|
|
// grant authority for external mutation.
|
|
type AttentionItem struct {
|
|
ID AttentionItemID
|
|
OwnerPrincipalID identity.PrincipalID
|
|
ScopeID authority.ScopeID
|
|
SourceKind AttentionSourceKind
|
|
SourceProspectiveID ProspectiveItemID
|
|
Level AttentionLevel
|
|
State AttentionState
|
|
Summary string
|
|
DueAtUnixMillis int64
|
|
CreatedAtUnixMillis int64
|
|
DeliveredAtUnixMillis int64
|
|
ActionIntentID CommittedActionIntentID
|
|
AuthorizedActionID CommittedAuthorizedActionID
|
|
ActionAttemptID CommittedActionAttemptID
|
|
DeliveryOutcome string
|
|
Revision AttentionRevision
|
|
}
|
|
|
|
type AttentionListResult struct {
|
|
Items []AttentionItem
|
|
}
|
|
|
|
type TodayItem struct {
|
|
Title string
|
|
WhenUnixMillis int64
|
|
AttentionLevel AttentionLevel
|
|
AttentionState AttentionState
|
|
HumanState string
|
|
DeliveryState string
|
|
SourceDescription string
|
|
}
|
|
|
|
type TodayResult struct {
|
|
Items []TodayItem
|
|
}
|
|
|
|
// SatisfyDeliveredSubject is the complete serializable operation subject. It
|
|
// is distinct from a Work TaskTarget, which remains the live justification.
|
|
type SatisfyDeliveredSubject struct {
|
|
ProspectiveItemID ProspectiveItemID
|
|
ExpectedRevision ProspectiveRevision
|
|
FromState ProspectiveState
|
|
ToState ProspectiveState
|
|
EvidenceRef string
|
|
}
|
|
|
|
// SatisfyDeliveredCommand is accepted only at Continuity's internal executor
|
|
// boundary. Commit identities are references; Continuity remains state owner.
|
|
type SatisfyDeliveredCommand struct {
|
|
ActionIntentID CommittedActionIntentID
|
|
AuthorizedActionID CommittedAuthorizedActionID
|
|
OwnerPrincipalID identity.PrincipalID
|
|
Subject SatisfyDeliveredSubject
|
|
}
|
|
|
|
type ActionReceipt struct {
|
|
ActionIntentID CommittedActionIntentID
|
|
AuthorizedActionID CommittedAuthorizedActionID
|
|
OwnerPrincipalID identity.PrincipalID
|
|
Subject SatisfyDeliveredSubject
|
|
ResultState ProspectiveState
|
|
ResultRevision ProspectiveRevision
|
|
}
|