Documentation
¶
Overview ¶
Package work models the human-agent work continuity loop.
Work records are immutable, versioned Source payloads. They deliberately do not form another Artifact family: committed Handoffs remain the durable authority while contracts, boundaries, acknowledgements, and outcomes form an ordered evidence journal around them.
Index ¶
- Constants
- func ContentDigest(value any) (string, error)
- func DecodeRecord(kind Kind, payload []byte) (any, error)
- func EncodeRecord(value any, pretty bool) ([]byte, error)
- func PreparedDigest(value handoff.Prepared) (string, error)
- type Acknowledge
- func (a Acknowledge) Message() *string
- func (a Acknowledge) Prepared() *handoff.Prepared
- func (a Acknowledge) Receiver() string
- func (a Acknowledge) ReceiverChecks() *ReceiverChecks
- func (a Acknowledge) Revision() *artifact.Ref
- func (a Acknowledge) Selection() handoff.Selection
- func (a Acknowledge) SourceID() string
- func (a Acknowledge) Status() ReceiptStatus
- func (a Acknowledge) Validate() error
- type Acknowledgement
- type CheckStatus
- type Claim
- type ClaimBasis
- type Continuity
- func (c Continuity) Coverage() Coverage
- func (c Continuity) Events() []Event
- func (c Continuity) InvalidRecordCount() int
- func (c Continuity) MarshalJSON() ([]byte, error)
- func (c Continuity) Schema() string
- func (c Continuity) ScopeID() string
- func (c Continuity) SelectedHandoff() *artifact.Ref
- func (c Continuity) TotalEventCount() int
- func (c Continuity) Truncated() bool
- func (c Continuity) Trust() string
- func (c Continuity) Validate() error
- type Contract
- func (c Contract) AuthorizationNotes() []string
- func (c Contract) CompletionCriteria() []string
- func (c Contract) Exclusions() []string
- func (c Contract) Facts() []Claim
- func (c Contract) InScope() []string
- func (c Contract) Objective() string
- func (c Contract) OpenQuestions() []string
- func (c Contract) Schema() string
- func (c Contract) Trust() string
- func (c Contract) Validate() error
- type Coverage
- func (c Coverage) AcknowledgementRecords() int
- func (c Coverage) ActiveReceiptRef() *source.Ref
- func (c Coverage) ContractRecords() int
- func (c Coverage) HandoffRecords() int
- func (c Coverage) HandoffResultCovered() bool
- func (c Coverage) OutcomeRecords() int
- func (c Coverage) OutcomeState() OutcomeState
- func (c Coverage) TransferState() TransferState
- type CreateContract
- type CurrentHandoff
- func (h CurrentHandoff) Disposition() handoff.Disposition
- func (h CurrentHandoff) NextAction() *Claim
- func (h CurrentHandoff) Objective() string
- func (h CurrentHandoff) Omissions() []string
- func (h CurrentHandoff) Schema() string
- func (h CurrentHandoff) State() []Claim
- func (h CurrentHandoff) Trust() string
- func (h CurrentHandoff) Validate() error
- type Event
- func (e Event) Actor() *string
- func (e Event) HandoffReceiptRef() *source.Ref
- func (e Event) Kind() Kind
- func (e Event) Position() int64
- func (e Event) ReceiverChecks() *ReceiverChecks
- func (e Event) RecordSchema() string
- func (e Event) SelectedRevision() *artifact.Ref
- func (e Event) SourceRef() source.Ref
- func (e Event) Status() EventStatus
- func (e Event) Summary() *string
- type EventStatus
- type EvidenceStatus
- type HandoffCurrent
- type HandoffReceipt
- func (r HandoffReceipt) EvidenceStatus() EvidenceStatus
- func (r HandoffReceipt) Message() *string
- func (r HandoffReceipt) PreparedDigest() *string
- func (r HandoffReceipt) Receiver() string
- func (r HandoffReceipt) ReceiverChecks() *ReceiverChecks
- func (r HandoffReceipt) Schema() string
- func (r HandoffReceipt) SelectedRevision() *artifact.Ref
- func (r HandoffReceipt) Selection() handoff.Selection
- func (r HandoffReceipt) Status() ReceiptStatus
- func (r HandoffReceipt) Trust() string
- func (r HandoffReceipt) UnavailableEvidence() []handoff.Citation
- func (r HandoffReceipt) Validate() error
- type InvalidError
- type InvalidRequestError
- type Kind
- type LiveStateCheckStatus
- type OutcomeState
- type OutcomeStatus
- type PreparedHandoff
- type ReadinessCheckStatus
- type ReceiptStatus
- type ReceiverChecks
- type RecordOutcome
- type SourceReceipt
- type TaskCheck
- type TaskOutcome
- func (o TaskOutcome) Checks() []TaskCheck
- func (o TaskOutcome) HandoffReceiptRef() *source.Ref
- func (o TaskOutcome) Objective() string
- func (o TaskOutcome) Observations() []Claim
- func (o TaskOutcome) ProducedArtifacts() []artifact.Ref
- func (o TaskOutcome) RemainingWork() []string
- func (o TaskOutcome) Schema() string
- func (o TaskOutcome) Status() OutcomeStatus
- func (o TaskOutcome) Summary() string
- func (o TaskOutcome) Trust() string
- func (o TaskOutcome) Validate() error
- type TransferState
Constants ¶
const ( MaxTextLength = 8_192 MaxItems = 64 MaxEvidence = 32 MaxClaimEvidence = handoff.MaxCitations - 1 MaxReceiptEvidence = (handoff.MaxStateStatements + 1) * handoff.MaxCitations MaxContinuityEvents = 64 WorkContractSourceKind = Kind("work-contract") HandoffBoundarySourceKind = Kind("handoff-boundary") HandoffReceiptSourceKind = Kind("handoff-receipt") TaskOutcomeSourceKind = Kind("task-outcome") WorkContractSchema = "powercontext.work-contract.v1" CurrentWorkHandoffSchema = "powercontext.current-work-handoff.v1" HandoffReceiptSchema = "powercontext.handoff-receipt.v1" TaskOutcomeSchema = "powercontext.task-outcome.v1" WorkContinuitySchema = "powercontext.work-continuity.v1" UntrustedInput = "untrusted_input" UntrustedObservation = "untrusted_observation" UntrustedHistory = "untrusted_history" )
Variables ¶
This section is empty.
Functions ¶
func ContentDigest ¶
func DecodeRecord ¶
DecodeRecord strictly decodes one Source record selected by its trusted metadata kind. Unknown fields and mismatched schema/trust constants make the record invalid rather than silently expanding history.
func EncodeRecord ¶
EncodeRecord produces the exact schema-specific JSON captured by the Python runtime. pretty controls only the two-space Source representation; digests always use the compact representation.
Types ¶
type Acknowledge ¶
type Acknowledge struct {
// contains filtered or unexported fields
}
func NewAcknowledge ¶
func NewAcknowledge( sourceID, receiver string, status ReceiptStatus, selection handoff.Selection, receiverChecks *ReceiverChecks, prepared *handoff.Prepared, revision *artifact.Ref, message *string, ) (Acknowledge, error)
func (Acknowledge) Message ¶
func (a Acknowledge) Message() *string
func (Acknowledge) Prepared ¶
func (a Acknowledge) Prepared() *handoff.Prepared
func (Acknowledge) Receiver ¶
func (a Acknowledge) Receiver() string
func (Acknowledge) ReceiverChecks ¶
func (a Acknowledge) ReceiverChecks() *ReceiverChecks
func (Acknowledge) Revision ¶
func (a Acknowledge) Revision() *artifact.Ref
func (Acknowledge) Selection ¶
func (a Acknowledge) Selection() handoff.Selection
func (Acknowledge) SourceID ¶
func (a Acknowledge) SourceID() string
func (Acknowledge) Status ¶
func (a Acknowledge) Status() ReceiptStatus
func (Acknowledge) Validate ¶
func (a Acknowledge) Validate() error
type Acknowledgement ¶
type Acknowledgement struct {
Resolution handoff.Resolution
Receipt SourceReceipt
}
type CheckStatus ¶
type CheckStatus string
const ( CheckPassed CheckStatus = "passed" CheckFailed CheckStatus = "failed" CheckSkipped CheckStatus = "skipped" CheckTimedOut CheckStatus = "timed_out" CheckCancelled CheckStatus = "cancelled" CheckUnknown CheckStatus = "unknown" )
type Claim ¶
type Claim struct {
// contains filtered or unexported fields
}
func (Claim) Basis ¶
func (c Claim) Basis() ClaimBasis
type ClaimBasis ¶
type ClaimBasis string
const ( Declared ClaimBasis = "declared" Verified ClaimBasis = "verified" )
type Continuity ¶
type Continuity struct {
// contains filtered or unexported fields
}
func ProjectContinuity ¶
func ProjectContinuity(scopeID string, entries []source.JournalEntry, selectedHandoff *artifact.Ref) (Continuity, error)
ProjectContinuity deterministically projects only valid high-level Work records. Ordinary Sources are ignored and malformed Work Sources are counted without making report generation fail.
func (Continuity) Coverage ¶
func (c Continuity) Coverage() Coverage
func (Continuity) Events ¶
func (c Continuity) Events() []Event
func (Continuity) InvalidRecordCount ¶
func (c Continuity) InvalidRecordCount() int
func (Continuity) MarshalJSON ¶
func (c Continuity) MarshalJSON() ([]byte, error)
MarshalJSON preserves the Python WorkContinuity wire shape, including explicit nulls. It is also the value consumed by Handoff Report JCS digests.
func (Continuity) Schema ¶
func (c Continuity) Schema() string
func (Continuity) ScopeID ¶
func (c Continuity) ScopeID() string
func (Continuity) SelectedHandoff ¶
func (c Continuity) SelectedHandoff() *artifact.Ref
func (Continuity) TotalEventCount ¶
func (c Continuity) TotalEventCount() int
func (Continuity) Truncated ¶
func (c Continuity) Truncated() bool
func (Continuity) Trust ¶
func (c Continuity) Trust() string
func (Continuity) Validate ¶
func (c Continuity) Validate() error
Validate protects the report-facing continuity projection from malformed values. Continuity is assembled by ProjectContinuity, but keeping the invariants on the value itself prevents report digests from blessing an internally inconsistent projection.
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func NewContract ¶
func (Contract) AuthorizationNotes ¶
func (Contract) CompletionCriteria ¶
func (Contract) Exclusions ¶
func (Contract) OpenQuestions ¶
type Coverage ¶
type Coverage struct {
// contains filtered or unexported fields
}
func (Coverage) AcknowledgementRecords ¶
func (Coverage) ActiveReceiptRef ¶
func (Coverage) ContractRecords ¶
func (Coverage) HandoffRecords ¶
func (Coverage) HandoffResultCovered ¶
func (Coverage) OutcomeRecords ¶
func (Coverage) OutcomeState ¶
func (c Coverage) OutcomeState() OutcomeState
func (Coverage) TransferState ¶
func (c Coverage) TransferState() TransferState
type CreateContract ¶
type CurrentHandoff ¶
type CurrentHandoff struct {
// contains filtered or unexported fields
}
func NewCurrentHandoff ¶
func NewCurrentHandoff( objective string, state []Claim, disposition handoff.Disposition, nextAction *Claim, omissions []string, ) (CurrentHandoff, error)
func (CurrentHandoff) Disposition ¶
func (h CurrentHandoff) Disposition() handoff.Disposition
func (CurrentHandoff) NextAction ¶
func (h CurrentHandoff) NextAction() *Claim
func (CurrentHandoff) Objective ¶
func (h CurrentHandoff) Objective() string
func (CurrentHandoff) Omissions ¶
func (h CurrentHandoff) Omissions() []string
func (CurrentHandoff) Schema ¶
func (h CurrentHandoff) Schema() string
func (CurrentHandoff) State ¶
func (h CurrentHandoff) State() []Claim
func (CurrentHandoff) Trust ¶
func (h CurrentHandoff) Trust() string
func (CurrentHandoff) Validate ¶
func (h CurrentHandoff) Validate() error
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (Event) HandoffReceiptRef ¶
func (Event) ReceiverChecks ¶
func (e Event) ReceiverChecks() *ReceiverChecks
func (Event) RecordSchema ¶
func (Event) SelectedRevision ¶
func (Event) Status ¶
func (e Event) Status() EventStatus
type EventStatus ¶
type EventStatus string
type EvidenceStatus ¶
type EvidenceStatus string
const ( EvidenceAvailable EvidenceStatus = "available" )
type HandoffCurrent ¶
type HandoffCurrent struct {
SourceID string
Handoff CurrentHandoff
}
type HandoffReceipt ¶
type HandoffReceipt struct {
// contains filtered or unexported fields
}
func NewHandoffReceipt ¶
func NewHandoffReceipt( receiver string, status ReceiptStatus, selection handoff.Selection, selectedRevision *artifact.Ref, preparedDigest *string, receiverChecks *ReceiverChecks, evidenceStatus EvidenceStatus, unavailableEvidence []handoff.Citation, message *string, ) (HandoffReceipt, error)
func (HandoffReceipt) EvidenceStatus ¶
func (r HandoffReceipt) EvidenceStatus() EvidenceStatus
func (HandoffReceipt) Message ¶
func (r HandoffReceipt) Message() *string
func (HandoffReceipt) PreparedDigest ¶
func (r HandoffReceipt) PreparedDigest() *string
func (HandoffReceipt) Receiver ¶
func (r HandoffReceipt) Receiver() string
func (HandoffReceipt) ReceiverChecks ¶
func (r HandoffReceipt) ReceiverChecks() *ReceiverChecks
func (HandoffReceipt) Schema ¶
func (r HandoffReceipt) Schema() string
func (HandoffReceipt) SelectedRevision ¶
func (r HandoffReceipt) SelectedRevision() *artifact.Ref
func (HandoffReceipt) Selection ¶
func (r HandoffReceipt) Selection() handoff.Selection
func (HandoffReceipt) Status ¶
func (r HandoffReceipt) Status() ReceiptStatus
func (HandoffReceipt) Trust ¶
func (r HandoffReceipt) Trust() string
func (HandoffReceipt) UnavailableEvidence ¶
func (r HandoffReceipt) UnavailableEvidence() []handoff.Citation
func (HandoffReceipt) Validate ¶
func (r HandoffReceipt) Validate() error
type InvalidError ¶
InvalidError identifies a domain validation failure without exposing the submitted value. Transport adapters map it to the public invalid_request envelope.
func (*InvalidError) Error ¶
func (e *InvalidError) Error() string
type InvalidRequestError ¶
type InvalidRequestError struct{ Code string }
InvalidRequestError identifies a validly decoded request whose selected history cannot satisfy the Work continuity trust boundary.
func (*InvalidRequestError) Error ¶
func (e *InvalidRequestError) Error() string
type LiveStateCheckStatus ¶
type LiveStateCheckStatus string
const ( LiveStateConfirmed LiveStateCheckStatus = "confirmed" LiveStateMismatch LiveStateCheckStatus = "mismatch" LiveStateNotChecked LiveStateCheckStatus = "not_checked" )
type OutcomeState ¶
type OutcomeState string
const ( OutcomeNotExpected OutcomeState = "not_expected" OutcomeAwaiting OutcomeState = "awaiting_outcome" OutcomeCovered OutcomeState = "covered" )
type OutcomeStatus ¶
type OutcomeStatus string
const ( OutcomeSucceeded OutcomeStatus = "succeeded" OutcomePartial OutcomeStatus = "partial" OutcomeBlocked OutcomeStatus = "blocked" OutcomeFailed OutcomeStatus = "failed" OutcomeCancelled OutcomeStatus = "cancelled" OutcomeUnknown OutcomeStatus = "unknown" )
type PreparedHandoff ¶
type PreparedHandoff struct {
Boundary SourceReceipt
Handoff handoff.Prepared
}
type ReadinessCheckStatus ¶
type ReadinessCheckStatus string
const ( ReadinessConfirmed ReadinessCheckStatus = "confirmed" ReadinessInsufficient ReadinessCheckStatus = "insufficient" ReadinessNotChecked ReadinessCheckStatus = "not_checked" )
type ReceiptStatus ¶
type ReceiptStatus string
const ( ReceiptAccepted ReceiptStatus = "accepted" ReceiptNeedsClarification ReceiptStatus = "needs_clarification" ReceiptDeclined ReceiptStatus = "declined" )
type ReceiverChecks ¶
type ReceiverChecks struct {
// contains filtered or unexported fields
}
func NewReceiverChecks ¶
func NewReceiverChecks(live LiveStateCheckStatus, capability, authorization ReadinessCheckStatus) (ReceiverChecks, error)
func (ReceiverChecks) AllConfirmed ¶
func (c ReceiverChecks) AllConfirmed() bool
func (ReceiverChecks) Authorization ¶
func (c ReceiverChecks) Authorization() ReadinessCheckStatus
func (ReceiverChecks) Capability ¶
func (c ReceiverChecks) Capability() ReadinessCheckStatus
func (ReceiverChecks) LiveState ¶
func (c ReceiverChecks) LiveState() LiveStateCheckStatus
func (ReceiverChecks) Validate ¶
func (c ReceiverChecks) Validate() error
type RecordOutcome ¶
type RecordOutcome struct {
SourceID string
Outcome TaskOutcome
}
type SourceReceipt ¶
type TaskCheck ¶
type TaskCheck struct {
// contains filtered or unexported fields
}
func NewTaskCheck ¶
func NewTaskCheck(name string, status CheckStatus, details *string, basis ClaimBasis, evidence []handoff.Citation) (TaskCheck, error)
func (TaskCheck) Basis ¶
func (c TaskCheck) Basis() ClaimBasis
func (TaskCheck) Status ¶
func (c TaskCheck) Status() CheckStatus
type TaskOutcome ¶
type TaskOutcome struct {
// contains filtered or unexported fields
}
func NewTaskOutcome ¶
func (TaskOutcome) Checks ¶
func (o TaskOutcome) Checks() []TaskCheck
func (TaskOutcome) HandoffReceiptRef ¶
func (o TaskOutcome) HandoffReceiptRef() *source.Ref
func (TaskOutcome) Objective ¶
func (o TaskOutcome) Objective() string
func (TaskOutcome) Observations ¶
func (o TaskOutcome) Observations() []Claim
func (TaskOutcome) ProducedArtifacts ¶
func (o TaskOutcome) ProducedArtifacts() []artifact.Ref
func (TaskOutcome) RemainingWork ¶
func (o TaskOutcome) RemainingWork() []string
func (TaskOutcome) Schema ¶
func (o TaskOutcome) Schema() string
func (TaskOutcome) Status ¶
func (o TaskOutcome) Status() OutcomeStatus
func (TaskOutcome) Summary ¶
func (o TaskOutcome) Summary() string
func (TaskOutcome) Trust ¶
func (o TaskOutcome) Trust() string
func (TaskOutcome) Validate ¶
func (o TaskOutcome) Validate() error
type TransferState ¶
type TransferState string
const ( TransferNotApplicable TransferState = "not_applicable" TransferAwaitingReceipt TransferState = "awaiting_receipt" TransferNeedsClarification TransferState = "needs_clarification" TransferDeclined TransferState = "declined" TransferAccepted TransferState = "accepted" )