259 lines
8.2 KiB
Go
259 lines
8.2 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 HumanResponseID ids.ID
|
|
type HumanResponseRevision uint64
|
|
|
|
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"
|
|
AttentionResolved AttentionState = "RESOLVED"
|
|
AttentionSuppressed AttentionState = "SUPPRESSED"
|
|
AttentionExpired AttentionState = "EXPIRED"
|
|
AttentionFailed AttentionState = "FAILED"
|
|
)
|
|
|
|
type AttentionSourceKind string
|
|
|
|
const (
|
|
AttentionSourceProspectiveReminder AttentionSourceKind = "PROSPECTIVE_REMINDER"
|
|
AttentionSourceAgentDelegation AttentionSourceKind = "AGENT_DELEGATION"
|
|
)
|
|
|
|
// 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
|
|
SourceExternalRef string
|
|
Level AttentionLevel
|
|
State AttentionState
|
|
Summary string
|
|
DueAtUnixMillis int64
|
|
CreatedAtUnixMillis int64
|
|
DeliveredAtUnixMillis int64
|
|
ActionIntentID CommittedActionIntentID
|
|
AuthorizedActionID CommittedAuthorizedActionID
|
|
ActionAttemptID CommittedActionAttemptID
|
|
DeliveryOutcome string
|
|
ResponseID HumanResponseID
|
|
ResponseUtteranceID string
|
|
ResponseOperation HumanResponseOperation
|
|
ResponseOutcome ResponseOutcome
|
|
RespondedAtUnixMillis int64
|
|
Revision AttentionRevision
|
|
}
|
|
|
|
type AttentionListResult struct {
|
|
Items []AttentionItem
|
|
}
|
|
|
|
type TodayItem struct {
|
|
Title string
|
|
WhenUnixMillis int64
|
|
AttentionLevel AttentionLevel
|
|
AttentionState AttentionState
|
|
HumanState string
|
|
DeliveryState string
|
|
SourceDescription string
|
|
ResponseHint string
|
|
}
|
|
|
|
type TodayResult struct {
|
|
Items []TodayItem
|
|
}
|
|
|
|
type HumanResponseOperation string
|
|
|
|
const (
|
|
ResponseAcknowledge HumanResponseOperation = "ACKNOWLEDGE"
|
|
ResponseComplete HumanResponseOperation = "COMPLETE"
|
|
ResponseSnooze HumanResponseOperation = "SNOOZE"
|
|
ResponseCancel HumanResponseOperation = "CANCEL"
|
|
ResponseDismiss HumanResponseOperation = "DISMISS"
|
|
ResponseContinue HumanResponseOperation = "CONTINUE"
|
|
ResponseReject HumanResponseOperation = "REJECT"
|
|
ResponseUnknown HumanResponseOperation = "UNKNOWN"
|
|
)
|
|
|
|
type ResponseTargetKind string
|
|
|
|
const (
|
|
ResponseTargetAttentionItem ResponseTargetKind = "ATTENTION_ITEM"
|
|
ResponseTargetProspectiveItem ResponseTargetKind = "PROSPECTIVE_ITEM"
|
|
ResponseTargetWorkTask ResponseTargetKind = "WORK_TASK"
|
|
ResponseTargetCapabilityGap ResponseTargetKind = "CAPABILITY_GAP"
|
|
ResponseTargetInteractionContext ResponseTargetKind = "INTERACTION_CONTEXT"
|
|
ResponseTargetUnknown ResponseTargetKind = "UNKNOWN"
|
|
)
|
|
|
|
type ResponseResolutionState string
|
|
|
|
const (
|
|
ResponseResolved ResponseResolutionState = "RESOLVED"
|
|
ResponseAmbiguous ResponseResolutionState = "AMBIGUOUS"
|
|
ResponseNoTarget ResponseResolutionState = "NO_TARGET"
|
|
ResponseNoop ResponseResolutionState = "NOOP"
|
|
)
|
|
|
|
type ResponseOutcome string
|
|
|
|
const (
|
|
ResponseOutcomeUserReportedComplete ResponseOutcome = "USER_REPORTED_COMPLETE"
|
|
ResponseOutcomeSnoozed ResponseOutcome = "SNOOZED"
|
|
ResponseOutcomeCancelled ResponseOutcome = "CANCELLED"
|
|
ResponseOutcomeDismissed ResponseOutcome = "DISMISSED"
|
|
ResponseOutcomeClarificationNeeded ResponseOutcome = "CLARIFICATION_NEEDED"
|
|
ResponseOutcomeContinued ResponseOutcome = "CONTINUED"
|
|
ResponseOutcomeRejected ResponseOutcome = "REJECTED"
|
|
ResponseOutcomeNoop ResponseOutcome = "NOOP"
|
|
)
|
|
|
|
type HumanResponse struct {
|
|
ID HumanResponseID
|
|
OwnerPrincipalID identity.PrincipalID
|
|
ScopeID authority.ScopeID
|
|
SourceUtteranceID string
|
|
SourceIntentID string
|
|
Operation HumanResponseOperation
|
|
TargetKind ResponseTargetKind
|
|
TargetAttentionID AttentionItemID
|
|
TargetProspectiveID ProspectiveItemID
|
|
TargetExternalRef string
|
|
ResolutionState ResponseResolutionState
|
|
Outcome ResponseOutcome
|
|
Clarification string
|
|
SnoozeUntilUnixMillis int64
|
|
UserReportedNotVerified bool
|
|
RecordedAtUnixMillis int64
|
|
Revision HumanResponseRevision
|
|
}
|
|
|
|
type HumanResponseRequest struct {
|
|
SourceUtteranceID string
|
|
SourceIntentID string
|
|
Message string
|
|
RequestedAtUnixMillis int64
|
|
}
|
|
|
|
type HumanResponseResult struct {
|
|
Response HumanResponse
|
|
Handled bool
|
|
Reply string
|
|
}
|
|
|
|
type CreateAttentionRequest struct {
|
|
OwnerPrincipalID identity.PrincipalID
|
|
ScopeID authority.ScopeID
|
|
SourceKind AttentionSourceKind
|
|
SourceProspectiveID ProspectiveItemID
|
|
SourceExternalRef string
|
|
Level AttentionLevel
|
|
Summary string
|
|
DueAtUnixMillis int64
|
|
CreatedAtUnixMillis int64
|
|
}
|
|
|
|
// 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
|
|
}
|